From 24dd32f874c176446c4e498cc03b56161a7cd5c3 Mon Sep 17 00:00:00 2001 From: George Ganea Date: Mon, 2 Aug 2021 12:48:18 +0300 Subject: [PATCH 0001/1268] Switch to main branch --- .../BaselineOfGToolkitCoder.class.st | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st b/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st index 2bc695ae7..c591bab9c 100644 --- a/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st +++ b/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st @@ -34,23 +34,23 @@ BaselineOfGToolkitCoder >> baseline: spec [ spec for: #'common' do: [ spec baseline: 'GToolkitBasicUtility' with: [ - spec repository: 'github://feenkcom/gtoolkit-utility/src' ]; + spec repository: 'github://feenkcom/gtoolkit-utility:main/src' ]; baseline: 'GToolkitAnnouncerUtility' with: [ - spec repository: 'github://feenkcom/gtoolkit-utility/src' ]; + spec repository: 'github://feenkcom/gtoolkit-utility:main/src' ]; baseline: 'GToolkitPager' with: [ - spec repository: 'github://feenkcom/gtoolkit-pager/src' ]. + spec repository: 'github://feenkcom/gtoolkit-pager:main/src' ]. spec package: 'GToolkit-VariableBindings'; package: 'GToolkit-Coder' with: [ - spec requires: #( 'GToolkitBasicUtility' 'GToolkitAnnouncerUtility' 'GToolkitPager' ). ]; + spec requires: #('GToolkitBasicUtility' 'GToolkitAnnouncerUtility' 'GToolkitPager' ). ]; package: 'GToolkit-Coder-UI' with: [ spec requires: #('GToolkit-Coder' 'GToolkit-VariableBindings' 'GToolkitBasicUtility' 'GToolkitPager' ). ]; package: 'GToolkit-Coder-AddOns' with: [ - spec requires: #('GToolkit-Coder' 'GToolkit-Coder-UI'). ]; + spec requires: #('GToolkit-Coder' 'GToolkit-Coder-UI' ). ]; package: 'GToolkit-Coder-Extensions' with: [ - spec requires: #('GToolkit-Coder' 'GToolkit-Coder-UI' 'GToolkit-Coder-AddOns'). ]; + spec requires: #('GToolkit-Coder' 'GToolkit-Coder-UI' 'GToolkit-Coder-AddOns' ). ]; package: 'GToolkit-Coder-Examples-SystemS1'; package: 'GToolkit-Coder-Examples' with: [ - spec requires: #('GToolkit-Coder' 'GToolkit-Coder-UI' 'GToolkit-Coder-AddOns' 'GToolkit-Coder-Examples-SystemS1'). ]. ]. + spec requires: #('GToolkit-Coder' 'GToolkit-Coder-UI' 'GToolkit-Coder-AddOns' 'GToolkit-Coder-Examples-SystemS1' ). ]. ]. ] From d57c8726b72daf50a497db0e3b7296a7c1839447 Mon Sep 17 00:00:00 2001 From: George Ganea Date: Mon, 2 Aug 2021 15:59:30 +0300 Subject: [PATCH 0002/1268] trigger the build of the main branch --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index cd2d2fcdd..7f55193ec 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,11 +3,11 @@ pipeline { stages { stage('Build gtoolkit') { when { expression { - env.BRANCH_NAME.toString().equals('master') && (env.TAG_NAME == null) + env.BRANCH_NAME.toString().equals('main') && (env.TAG_NAME == null) } } steps { - build(job: '../gtoolkit/master', wait: false) + build(job: '../gtoolkit/main', wait: false) } } } From 5b0b3bba263f31569c7908b7b4a393ca0010f338 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 2 Aug 2021 17:27:56 +0200 Subject: [PATCH 0003/1268] add embedded expander toggle id --- .../GtSourceCoderEmbeddedExpanderToggleId.class.st | 13 +++++++++++++ .../GtSourceCoderExpanderToggleId.class.st | 5 ++--- 2 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderEmbeddedExpanderToggleId.class.st diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEmbeddedExpanderToggleId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEmbeddedExpanderToggleId.class.st new file mode 100644 index 000000000..84e0827ba --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderEmbeddedExpanderToggleId.class.st @@ -0,0 +1,13 @@ +" +An element to toggle an embedded expandable element within the text of the source coder. An examples can be an expandable method or a baseline name. +" +Class { + #name : #GtSourceCoderEmbeddedExpanderToggleId, + #superclass : #GtCoderElementId, + #category : #'GToolkit-Coder-UI-Coder - Basic' +} + +{ #category : #converting } +GtSourceCoderEmbeddedExpanderToggleId >> asSymbol [ + ^ #'source-coder--embedded-expander-toggle' +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpanderToggleId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpanderToggleId.class.st index 6dfc7b3d1..d8e8b57e4 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExpanderToggleId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpanderToggleId.class.st @@ -1,7 +1,6 @@ " -An element to toggle an expander's state on click - - +An element to toggle {{gtClass:BrExpander}}'s state on click. In a context of a coder, an expander is a sidebar element that allows to collapse/expand a coder. +Do not confuse with an embedded expander within the text which is usually represented by a triangle. " Class { #name : #GtSourceCoderExpanderToggleId, From 1f6c3f43735b4c782a6e9172ade2d59ac21861f4 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 19 Aug 2021 10:13:42 +0200 Subject: [PATCH 0004/1268] [feenkcom/gtoolkit#2084] remove obsolete coderPool --- src/GToolkit-Coder/Announcement.extension.st | 4 +- .../BlTktWorkerProvider.extension.st | 50 +++------ src/GToolkit-Coder/Class.extension.st | 6 +- .../ClassDescription.extension.st | 4 +- .../ClassDiffBuilder.extension.st | 8 +- .../CompiledMethod.extension.st | 6 +- src/GToolkit-Coder/DebugSession.extension.st | 6 +- src/GToolkit-Coder/GtAstCache.class.st | 14 +-- ...CoderMethodNavigationAnnouncement.class.st | 10 +- ...hodProtocolNavigationAnnouncement.class.st | 14 +-- ...sCoderPackagesFilterStringChanged.class.st | 14 +-- .../GtClassesCompletionStrategy.class.st | 18 ++-- src/GToolkit-Coder/GtCoderAction.class.st | 40 +++---- .../GtCoderActivatableAction.class.st | 12 +-- src/GToolkit-Coder/GtCoderAddOns.class.st | 78 +++++++------- ...derAddOnsContextActionsDifference.class.st | 6 +- ...tCoderAddOnsContextMenuDifference.class.st | 6 +- .../GtCoderAddOnsDifference.class.st | 6 +- ...tCoderAddOnsMainActionsDifference.class.st | 6 +- .../GtCoderAddOnsShortcutsDifference.class.st | 6 +- .../GtCoderAddOnsStylersDifference.class.st | 6 +- .../GtCoderAddOnsUpdateRequest.class.st | 6 +- .../GtCoderAnnouncement.class.st | 10 +- src/GToolkit-Coder/GtCoderAnnouncer.class.st | 12 +-- src/GToolkit-Coder/GtCoderAstChanged.class.st | 10 +- .../GtCoderAstCompositeStyler.class.st | 14 +-- .../GtCoderAstSmaCCParserStyler.class.st | 12 +-- src/GToolkit-Coder/GtCoderAstStyler.class.st | 20 ++-- src/GToolkit-Coder/GtCoderClassAdded.class.st | 6 +- .../GtCoderClassRemoved.class.st | 6 +- .../GtCoderClassRenamed.class.st | 6 +- ...lassWithPackageCompletionStrategy.class.st | 18 ++-- .../GtCoderClassesHierarchyTree.class.st | 38 +++---- .../GtCoderCollapsedLabelChanged.class.st | 6 +- .../GtCoderCommentStyler.class.st | 8 +- .../GtCoderCompiledMethodSourceCode.class.st | 18 ++-- .../GtCoderContextActionsChanged.class.st | 6 +- .../GtCoderContextMenuAction.class.st | 14 +-- .../GtCoderContextVariableStyler.class.st | 28 ++--- .../GtCoderCorrectionRequest.class.st | 18 ++-- .../GtCoderDropDownAction.class.st | 10 +- .../GtCoderDropDownWithPreviewAction.class.st | 14 +-- .../GtCoderEvaluationAnnouncement.class.st | 14 +-- .../GtCoderEvaluationUnhandledError.class.st | 22 ++-- .../GtCoderExampleExecuted.class.st | 16 +-- src/GToolkit-Coder/GtCoderExampler.class.st | 54 +++++----- .../GtCoderExplicitSourceCode.class.st | 18 ++-- .../GtCoderExplicitSourceText.class.st | 18 ++-- ...tCoderGrowingClassesHierarchyTree.class.st | 20 ++-- .../GtCoderInstanceVariableStyler.class.st | 10 +- .../GtCoderMainActionsChanged.class.st | 6 +- .../GtCoderMethodAdded.class.st | 6 +- .../GtCoderMethodModified.class.st | 6 +- .../GtCoderMethodRemoved.class.st | 6 +- src/GToolkit-Coder/GtCoderModel.class.st | 66 ++++++------ .../GtCoderNavigationAnnouncement.class.st | 10 +- ...GtCoderNavigationClassAnnoucement.class.st | 18 ++-- .../GtCoderNavigationClassModified.class.st | 6 +- .../GtCoderNavigationClassRenamed.class.st | 14 +-- .../GtCoderNavigationClassSelected.class.st | 18 ++-- .../GtCoderNavigationModel.class.st | 38 +++---- ...avigationModelChangedAnnouncement.class.st | 6 +- ...CoderNavigationPackageAnnoucement.class.st | 12 +-- ...tCoderNavigationPackageRegistered.class.st | 6 +- .../GtCoderNavigationPackageRenamed.class.st | 14 +-- .../GtCoderNavigationPackageSelected.class.st | 10 +- .../GtCoderNavigationPackageTagAdded.class.st | 6 +- ...erNavigationPackageTagAnnoucement.class.st | 14 +-- ...tCoderNavigationPackageTagRemoved.class.st | 6 +- ...CoderNavigationPackageTagSelected.class.st | 14 +-- ...oderNavigationPackageUnregistered.class.st | 6 +- ...GtCoderNavigationPackagesSelected.class.st | 6 +- ...erNavigationSelectionAnnouncement.class.st | 6 +- ...vigationSystemChangesAnnouncement.class.st | 6 +- .../GtCoderNullNavigationModel.class.st | 34 +++--- .../GtCoderObjectSpawnRequest.class.st | 14 +-- .../GtCoderPackageExtentionTag.class.st | 24 ++--- .../GtCoderPackageRegistered.class.st | 6 +- .../GtCoderPackageRenamed.class.st | 6 +- .../GtCoderPackageUncategorizedTag.class.st | 24 ++--- .../GtCoderPackageUnregistered.class.st | 6 +- ...GtCoderPackageUpdatedAnnouncement.class.st | 10 +- src/GToolkit-Coder/GtCoderParseError.class.st | 14 +-- .../GtCoderPrintAnnouncement.class.st | 10 +- .../GtCoderRefreshStackAnnouncement.class.st | 6 +- .../GtCoderRenameMethodChange.class.st | 24 ++--- .../GtCoderRenameMethodRefactoring.class.st | 12 +-- .../GtCoderRequestFocus.class.st | 6 +- .../GtCoderShowDebuggerRequest.class.st | 22 ++-- src/GToolkit-Coder/GtCoderSourceCode.class.st | 56 +++++----- .../GtCoderSourceCodeChanged.class.st | 14 +-- .../GtCoderStyleTextRequest.class.st | 10 +- .../GtCoderStylerChanged.class.st | 10 +- .../GtCoderToolSpawnRequest.class.st | 14 +-- .../GtCoderUpdateStrategy.class.st | 18 ++-- .../GtCodersAnnouncement.class.st | 14 +-- .../GtCodersCoderAdded.class.st | 6 +- .../GtCodersCoderAnnouncement.class.st | 10 +- .../GtCodersCoderRemoved.class.st | 6 +- .../GtCodersCodersChanged.class.st | 6 +- .../GtCodersFiltersChanged.class.st | 12 +-- src/GToolkit-Coder/GtCodersModel.class.st | 42 ++++---- .../GtCodersScrollToCoder.class.st | 10 +- .../GtCompositeHighlighter.class.st | 12 +-- src/GToolkit-Coder/GtDebugContext.class.st | 14 +-- .../GtFilterExampleAllState.class.st | 16 +-- .../GtFilterExampleErrorState.class.st | 18 ++-- .../GtFilterExampleFailureState.class.st | 18 ++-- .../GtFilterExampleNotExecutedState.class.st | 18 ++-- .../GtFilterExampleState.class.st | 28 ++--- .../GtFilterExampleSuccessState.class.st | 18 ++-- ...tMethodProtocolCompletionStrategy.class.st | 10 +- .../GtMethodsCoderExampler.class.st | 12 +-- ...tPackageClassesCompletionStrategy.class.st | 20 ++-- src/GToolkit-Coder/GtPackageCoder.class.st | 30 +++--- src/GToolkit-Coder/GtPackagesCoder.class.st | 20 ++-- .../GtPackagesCompletionStrategy.class.st | 20 ++-- .../GtPharoAssociation.class.st | 16 +-- .../GtPharoClassExtension.class.st | 16 +-- .../GtPharoClassReference.class.st | 20 ++-- .../GtPharoInheritance.class.st | 18 ++-- src/GToolkit-Coder/GtPharoTraitUsage.class.st | 18 ++-- .../GtPhlowContext.extension.st | 14 +-- .../GtPhlowExecutionContext.extension.st | 6 +- .../GtPoolsCompletionStrategy.class.st | 14 +-- src/GToolkit-Coder/GtRBASTStyler.class.st | 24 ++--- .../GtRefactoringDanger.class.st | 14 +-- .../GtReplaceTextCompletionAction.class.st | 24 ++--- .../GtSearchBinaryFilter.class.st | 18 ++-- .../GtSearchBlockFilter.class.st | 14 +-- src/GToolkit-Coder/GtSearchFilter.class.st | 42 ++++---- .../GtSearchGroupResult.class.st | 52 ++++----- .../GtSearchIntersectionFilter.class.st | 14 +-- .../GtSearchNegationFilter.class.st | 20 ++-- .../GtSearchNullFilter.class.st | 14 +-- .../GtSearchNullGroupResult.class.st | 12 +-- .../GtSearchTypedEntitiesFilter.class.st | 10 +- .../GtSearchTypedGroupResult.class.st | 16 +-- .../GtSearchUnionFilter.class.st | 16 +-- src/GToolkit-Coder/GtSourceCoder.class.st | 58 +++++----- .../GtSourceCoderAnnouncement.class.st | 6 +- .../GtSourceCoderEvaluationAllSource.class.st | 10 +- .../GtSourceCoderEvaluationContext.class.st | 36 +++---- ...ourceCoderEvaluationPartialSource.class.st | 18 ++-- .../GtSourceCoderEvaluationResult.class.st | 30 +++--- ...rEvaluationResultWithRuntimeError.class.st | 16 +-- ...erEvaluationResultWithSyntaxError.class.st | 8 +- ...rceCoderEvaluationResultWithValue.class.st | 12 +-- ...urceCoderEvaluationSourceInterval.class.st | 10 +- .../GtSourceReferenceHighlighter.class.st | 8 +- src/GToolkit-Coder/GtTextCoder.class.st | 22 ++-- src/GToolkit-Coder/GtTextualCoder.class.st | 100 +++++++++--------- .../GtTextualCoderAddOns.class.st | 22 ++-- .../GtTraitsCompletionStrategy.class.st | 14 +-- src/GToolkit-Coder/GtWatchExpression.class.st | 26 ++--- .../PrettyTextDiffBuilder.extension.st | 4 +- .../RBAbstractCondition.extension.st | 6 +- .../RBAddPoolVariableChange.extension.st | 4 +- src/GToolkit-Coder/RBArrayNode.extension.st | 4 +- .../RBAssignmentNode.extension.st | 4 +- src/GToolkit-Coder/RBBlockNode.extension.st | 4 +- src/GToolkit-Coder/RBCascadeNode.extension.st | 4 +- ...RBChangeMethodNameRefactoring.extension.st | 4 +- src/GToolkit-Coder/RBClass.extension.st | 4 +- .../RBCommentChange.extension.st | 4 +- .../RBCompositeRefactoryChange.extension.st | 4 +- src/GToolkit-Coder/RBCondition.extension.st | 6 +- .../RBConjunctiveCondition.extension.st | 6 +- src/GToolkit-Coder/RBLiteralNode.extension.st | 4 +- src/GToolkit-Coder/RBMessageNode.extension.st | 4 +- src/GToolkit-Coder/RBMethod.extension.st | 4 +- src/GToolkit-Coder/RBMethodNode.extension.st | 4 +- src/GToolkit-Coder/RBNamespace.extension.st | 12 +-- .../RBNegationCondition.extension.st | 4 +- .../RBParseErrorNode.extension.st | 4 +- src/GToolkit-Coder/RBPragmaNode.extension.st | 4 +- src/GToolkit-Coder/RBProgramNode.extension.st | 8 +- src/GToolkit-Coder/RBRefactoring.extension.st | 10 +- .../RBRefactoryChange.extension.st | 4 +- ...veInstanceVariableRefactoring.extension.st | 4 +- .../RBRemovePoolVariableChange.extension.st | 4 +- .../RBReplaceMethodRefactoring.extension.st | 4 +- .../RBSequenceNode.extension.st | 4 +- .../RBTransformation.extension.st | 8 +- src/GToolkit-Coder/RBValueNode.extension.st | 4 +- .../RBVariableNode.extension.st | 6 +- src/GToolkit-Coder/RPackage.extension.st | 26 ++--- src/GToolkit-Coder/RPackageTag.extension.st | 4 +- src/GToolkit-Coder/SharedPool.extension.st | 4 +- src/GToolkit-Coder/Slot.extension.st | 4 +- src/GToolkit-Coder/String.extension.st | 4 +- src/GToolkit-Coder/Symbol.extension.st | 6 +- src/GToolkit-Coder/TGtCoderTrait.trait.st | 16 +-- .../TextDiffBuilder.extension.st | 8 +- src/GToolkit-Coder/package.st | 2 +- 195 files changed, 1395 insertions(+), 1419 deletions(-) diff --git a/src/GToolkit-Coder/Announcement.extension.st b/src/GToolkit-Coder/Announcement.extension.st index 31da0f484..21c114753 100644 --- a/src/GToolkit-Coder/Announcement.extension.st +++ b/src/GToolkit-Coder/Announcement.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #Announcement } +Extension { #name : 'Announcement' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } Announcement class >> gtAllKindOfReferencesFor: aView [ ^ aView explicit diff --git a/src/GToolkit-Coder/BlTktWorkerProvider.extension.st b/src/GToolkit-Coder/BlTktWorkerProvider.extension.st index 6a5320efe..0d2193909 100644 --- a/src/GToolkit-Coder/BlTktWorkerProvider.extension.st +++ b/src/GToolkit-Coder/BlTktWorkerProvider.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #BlTktWorkerProvider } +Extension { #name : 'BlTktWorkerProvider' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } BlTktWorkerProvider class >> coderAddOnsPool [ ^ self @@ -8,7 +8,7 @@ BlTktWorkerProvider class >> coderAddOnsPool [ ifMissing: [ self new coderAddOnsPool; service ] ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } BlTktWorkerProvider >> coderAddOnsPool [ "Coder addons computation: maxPoolSize: 2, priority: 30" self @@ -18,23 +18,13 @@ BlTktWorkerProvider >> coderAddOnsPool [ nonUIPriority ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } BlTktWorkerProvider class >> coderAddOnsPoolName [ ^ 'Coder addons' ] -{ #category : #'*GToolkit-Coder' } -BlTktWorkerProvider >> coderAstPool [ - "Coder computation processing: maxPoolSize: 2, priority: 30" - self - name: self class coderAstPoolName; - priorityQueue; - poolMaxSize: 2; - nonUIPriority -] - -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } BlTktWorkerProvider class >> coderAstPool [ ^ self @@ -42,32 +32,18 @@ BlTktWorkerProvider class >> coderAstPool [ ifMissing: [ self new coderAstPool; service ] ] -{ #category : #'*GToolkit-Coder' } -BlTktWorkerProvider class >> coderAstPoolName [ - - ^ 'Coder ast' -] - -{ #category : #'*GToolkit-Coder' } -BlTktWorkerProvider class >> coderPool [ - - ^ self - serviceNamed: self coderPoolName - ifMissing: [ self new coderPool; service ] -] - -{ #category : #'*GToolkit-Coder' } -BlTktWorkerProvider >> coderPool [ - "Coder computation processing: maxPoolSize: 1, priority: 30" +{ #category : '*GToolkit-Coder' } +BlTktWorkerProvider >> coderAstPool [ + "Coder computation processing: maxPoolSize: 2, priority: 30" self - name: self class coderPoolName; + name: self class coderAstPoolName; priorityQueue; - poolMaxSize: 1; + poolMaxSize: 2; nonUIPriority ] -{ #category : #'*GToolkit-Coder' } -BlTktWorkerProvider class >> coderPoolName [ +{ #category : '*GToolkit-Coder' } +BlTktWorkerProvider class >> coderAstPoolName [ - ^ 'Coder updates' + ^ 'Coder ast' ] diff --git a/src/GToolkit-Coder/Class.extension.st b/src/GToolkit-Coder/Class.extension.st index 6d4dbc34c..131175fc7 100644 --- a/src/GToolkit-Coder/Class.extension.st +++ b/src/GToolkit-Coder/Class.extension.st @@ -1,11 +1,11 @@ -Extension { #name : #Class } +Extension { #name : 'Class' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } Class >> gtInheritance [ ^ GtPharoInheritance new subclass: self; superclass: self superclass ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } Class >> gtTraitUsages [ ^ self traits collect: [ :each | GtPharoTraitUsage new baseBehavior: self; usedTrait: each ] ] diff --git a/src/GToolkit-Coder/ClassDescription.extension.st b/src/GToolkit-Coder/ClassDescription.extension.st index c7ee1dafc..e51db9b7d 100644 --- a/src/GToolkit-Coder/ClassDescription.extension.st +++ b/src/GToolkit-Coder/ClassDescription.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #ClassDescription } +Extension { #name : 'ClassDescription' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } ClassDescription >> gtPackageScope [ ^ self package ] diff --git a/src/GToolkit-Coder/ClassDiffBuilder.extension.st b/src/GToolkit-Coder/ClassDiffBuilder.extension.st index cbbe0f832..3ecfed0b0 100644 --- a/src/GToolkit-Coder/ClassDiffBuilder.extension.st +++ b/src/GToolkit-Coder/ClassDiffBuilder.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #ClassDiffBuilder } +Extension { #name : 'ClassDiffBuilder' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } ClassDiffBuilder >> attributedRopedFrom: aString do: aBlock [ | aTrimmedLeft aTrimmedRight aTrimmedString aTrimmedText | @@ -33,7 +33,7 @@ ClassDiffBuilder >> attributedRopedFrom: aString do: aBlock [ yourself ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } ClassDiffBuilder >> newRopedText [ | text | text := '' asRopedText. @@ -48,7 +48,7 @@ ClassDiffBuilder >> newRopedText [ ^ text ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } ClassDiffBuilder >> previousRopedText [ | text | text := '' asRopedText. diff --git a/src/GToolkit-Coder/CompiledMethod.extension.st b/src/GToolkit-Coder/CompiledMethod.extension.st index cda7baa95..023e9fcb5 100644 --- a/src/GToolkit-Coder/CompiledMethod.extension.st +++ b/src/GToolkit-Coder/CompiledMethod.extension.st @@ -1,11 +1,11 @@ -Extension { #name : #CompiledMethod } +Extension { #name : 'CompiledMethod' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } CompiledMethod >> gtPackageScope [ ^ self package ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } CompiledMethod >> gtReferencedClasses [ "Return classes that are directly referenced by this method. Compared to #referencedClasses I do not count a value of the ClassVariable as a reference" diff --git a/src/GToolkit-Coder/DebugSession.extension.st b/src/GToolkit-Coder/DebugSession.extension.st index 487fed66d..0f49b187c 100644 --- a/src/GToolkit-Coder/DebugSession.extension.st +++ b/src/GToolkit-Coder/DebugSession.extension.st @@ -1,12 +1,12 @@ -Extension { #name : #DebugSession } +Extension { #name : 'DebugSession' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } DebugSession >> gtCreateModelForContext: aContext [ ^ (GtDebugContext forContext: aContext) topContext: interruptedContext ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } DebugSession >> gtRecompileMethodTo: text inContext: aContext notifying: aNotifyer [ "The retrieved information has changed and its source must now be updated. In this case, the retrieved information is the method of the given context." diff --git a/src/GToolkit-Coder/GtAstCache.class.st b/src/GToolkit-Coder/GtAstCache.class.st index 7ad04ee44..b56a5022c 100644 --- a/src/GToolkit-Coder/GtAstCache.class.st +++ b/src/GToolkit-Coder/GtAstCache.class.st @@ -1,33 +1,33 @@ Class { - #name : #GtAstCache, - #superclass : #Object, + #name : 'GtAstCache', + #superclass : 'Object', #instVars : [ 'dictionary' ], #classInstVars : [ 'default' ], - #category : #'GToolkit-Coder-Ast' + #category : 'GToolkit-Coder-Ast' } -{ #category : #accessing } +{ #category : 'accessing' } GtAstCache class >> cleanUp [ default := nil ] -{ #category : #accessing } +{ #category : 'accessing' } GtAstCache class >> default [ ^ default ifNil: [ default := self new ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtAstCache >> cachedAstAt: anAstKey ifAbsentPut: anAbsentBlock [ ^ dictionary at: anAstKey ifAbsentPut: anAbsentBlock ] -{ #category : #initialization } +{ #category : 'initialization' } GtAstCache >> initialize [ super initialize. diff --git a/src/GToolkit-Coder/GtClassCoderMethodNavigationAnnouncement.class.st b/src/GToolkit-Coder/GtClassCoderMethodNavigationAnnouncement.class.st index 7cda787af..5b1a10b8c 100644 --- a/src/GToolkit-Coder/GtClassCoderMethodNavigationAnnouncement.class.st +++ b/src/GToolkit-Coder/GtClassCoderMethodNavigationAnnouncement.class.st @@ -1,18 +1,18 @@ Class { - #name : #GtClassCoderMethodNavigationAnnouncement, - #superclass : #Announcement, + #name : 'GtClassCoderMethodNavigationAnnouncement', + #superclass : 'Announcement', #instVars : [ 'method' ], - #category : #'GToolkit-Coder-Event' + #category : 'GToolkit-Coder-Event' } -{ #category : #accessing } +{ #category : 'accessing' } GtClassCoderMethodNavigationAnnouncement >> method [ ^ method ] -{ #category : #accessing } +{ #category : 'accessing' } GtClassCoderMethodNavigationAnnouncement >> method: aMethod [ method := aMethod ] diff --git a/src/GToolkit-Coder/GtClassCoderMethodProtocolNavigationAnnouncement.class.st b/src/GToolkit-Coder/GtClassCoderMethodProtocolNavigationAnnouncement.class.st index f9ec57695..2a96093f2 100644 --- a/src/GToolkit-Coder/GtClassCoderMethodProtocolNavigationAnnouncement.class.st +++ b/src/GToolkit-Coder/GtClassCoderMethodProtocolNavigationAnnouncement.class.st @@ -1,29 +1,29 @@ Class { - #name : #GtClassCoderMethodProtocolNavigationAnnouncement, - #superclass : #Announcement, + #name : 'GtClassCoderMethodProtocolNavigationAnnouncement', + #superclass : 'Announcement', #instVars : [ 'methodProtocol', 'source' ], - #category : #'GToolkit-Coder-Event' + #category : 'GToolkit-Coder-Event' } -{ #category : #accessing } +{ #category : 'accessing' } GtClassCoderMethodProtocolNavigationAnnouncement >> methodProtocol [ ^ methodProtocol ] -{ #category : #accessing } +{ #category : 'accessing' } GtClassCoderMethodProtocolNavigationAnnouncement >> methodProtocol: anObject [ methodProtocol := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtClassCoderMethodProtocolNavigationAnnouncement >> source [ ^ source ] -{ #category : #accessing } +{ #category : 'accessing' } GtClassCoderMethodProtocolNavigationAnnouncement >> source: anObject [ source := anObject ] diff --git a/src/GToolkit-Coder/GtClassCoderPackagesFilterStringChanged.class.st b/src/GToolkit-Coder/GtClassCoderPackagesFilterStringChanged.class.st index 0ba449454..881683364 100644 --- a/src/GToolkit-Coder/GtClassCoderPackagesFilterStringChanged.class.st +++ b/src/GToolkit-Coder/GtClassCoderPackagesFilterStringChanged.class.st @@ -1,29 +1,29 @@ Class { - #name : #GtClassCoderPackagesFilterStringChanged, - #superclass : #Announcement, + #name : 'GtClassCoderPackagesFilterStringChanged', + #superclass : 'Announcement', #instVars : [ 'navigationModel', 'packagesFilterString' ], - #category : #'GToolkit-Coder' + #category : 'GToolkit-Coder' } -{ #category : #accessing } +{ #category : 'accessing' } GtClassCoderPackagesFilterStringChanged >> navigationModel [ ^ navigationModel ] -{ #category : #accessing } +{ #category : 'accessing' } GtClassCoderPackagesFilterStringChanged >> navigationModel: anObject [ navigationModel := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtClassCoderPackagesFilterStringChanged >> packagesFilterString [ ^ packagesFilterString ] -{ #category : #accessing } +{ #category : 'accessing' } GtClassCoderPackagesFilterStringChanged >> packagesFilterString: anObject [ packagesFilterString := anObject ] diff --git a/src/GToolkit-Coder/GtClassesCompletionStrategy.class.st b/src/GToolkit-Coder/GtClassesCompletionStrategy.class.st index 3477de38e..f002474dd 100644 --- a/src/GToolkit-Coder/GtClassesCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtClassesCompletionStrategy.class.st @@ -1,14 +1,14 @@ Class { - #name : #GtClassesCompletionStrategy, - #superclass : #GtCompletionStrategy, + #name : 'GtClassesCompletionStrategy', + #superclass : 'GtCompletionStrategy', #instVars : [ 'excludedClasses', 'candidateClasses' ], - #category : #'GToolkit-Coder-Completion' + #category : 'GToolkit-Coder-Completion' } -{ #category : #accessing } +{ #category : 'accessing' } GtClassesCompletionStrategy >> candidateClasses [ ^ candidateClasses ifNil: [ | theInterestingClassNames | @@ -16,7 +16,7 @@ GtClassesCompletionStrategy >> candidateClasses [ candidateClasses := GtPrefixTree withAll: theInterestingClassNames ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtClassesCompletionStrategy >> completionActionsFor: aText at: positionInteger max: maxInteger [ | currentInput completionActions | currentInput := aText asString. @@ -46,22 +46,22 @@ GtClassesCompletionStrategy >> completionActionsFor: aText at: positionInteger m ^ completionActions ] -{ #category : #initialization } +{ #category : 'initialization' } GtClassesCompletionStrategy >> excludeClasses: aCollectionOfClasses [ excludedClasses := aCollectionOfClasses asSet ] -{ #category : #testing } +{ #category : 'testing' } GtClassesCompletionStrategy >> hasCompletionEntryFor: aString [ ^ true ] -{ #category : #testing } +{ #category : 'testing' } GtClassesCompletionStrategy >> hasCompletionsAt: anInteger in: aText [ ^ true ] -{ #category : #initialization } +{ #category : 'initialization' } GtClassesCompletionStrategy >> initialize [ super initialize. diff --git a/src/GToolkit-Coder/GtCoderAction.class.st b/src/GToolkit-Coder/GtCoderAction.class.st index 87563f5e0..87c42cea2 100644 --- a/src/GToolkit-Coder/GtCoderAction.class.st +++ b/src/GToolkit-Coder/GtCoderAction.class.st @@ -1,16 +1,16 @@ Class { - #name : #GtCoderAction, - #superclass : #Object, + #name : 'GtCoderAction', + #superclass : 'Object', #instVars : [ 'title', 'icon', 'action', 'id' ], - #category : #'GToolkit-Coder' + #category : 'GToolkit-Coder' } -{ #category : #comparing } +{ #category : 'comparing' } GtCoderAction >> = anObject [ "Answer whether the receiver and anObject represent the same object." @@ -21,71 +21,71 @@ GtCoderAction >> = anObject [ ^ id = anObject id and: [ title = anObject title ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderAction >> action [ ^ action ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderAction >> action: anObject [ action := anObject ] -{ #category : #evaluating } +{ #category : 'evaluating' } GtCoderAction >> glamourValueWithArgs: aSequenceOfArguments [ ^ self action glamourValueWithArgs: aSequenceOfArguments ] -{ #category : #comparing } +{ #category : 'comparing' } GtCoderAction >> hash [ "Answer an integer value that is related to the identity of the receiver." ^ id hash bitXor: title hash ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderAction >> hoverAction [ ^ nil ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderAction >> icon [ ^ icon ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderAction >> icon: anObject [ icon := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderAction >> id [ ^ id ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderAction >> id: anObject [ id := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderAction >> leaveAction [ ^ nil ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderAction >> name [ ^ id ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderAction >> name: anObject [ id := anObject ] -{ #category : #printing } +{ #category : 'printing' } GtCoderAction >> printOn: aStream [ super printOn: aStream. aStream @@ -94,17 +94,17 @@ GtCoderAction >> printOn: aStream [ nextPut: $) ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderAction >> title [ ^ title ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderAction >> title: anObject [ title := anObject ] -{ #category : #evaluating } +{ #category : 'evaluating' } GtCoderAction >> valueWithArguments: aSequenceOfArguments [ ^ self action valueWithArguments: aSequenceOfArguments ] diff --git a/src/GToolkit-Coder/GtCoderActivatableAction.class.st b/src/GToolkit-Coder/GtCoderActivatableAction.class.st index 8f056b856..baa631ef1 100644 --- a/src/GToolkit-Coder/GtCoderActivatableAction.class.st +++ b/src/GToolkit-Coder/GtCoderActivatableAction.class.st @@ -1,19 +1,19 @@ Class { - #name : #GtCoderActivatableAction, - #superclass : #GtCoderAction, + #name : 'GtCoderActivatableAction', + #superclass : 'GtCoderAction', #instVars : [ 'enabledBlock', 'updateAnnouncement' ], - #category : #'GToolkit-Coder' + #category : 'GToolkit-Coder' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderActivatableAction >> enabled: aBlock [ enabledBlock := aBlock ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderActivatableAction >> initialize [ super initialize. @@ -21,7 +21,7 @@ GtCoderActivatableAction >> initialize [ updateAnnouncement := nil ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderActivatableAction >> updateWhen: anAnnouncementClass [ updateAnnouncement := anAnnouncementClass ] diff --git a/src/GToolkit-Coder/GtCoderAddOns.class.st b/src/GToolkit-Coder/GtCoderAddOns.class.st index eca30ee67..617bccaa3 100644 --- a/src/GToolkit-Coder/GtCoderAddOns.class.st +++ b/src/GToolkit-Coder/GtCoderAddOns.class.st @@ -1,6 +1,6 @@ Class { - #name : #GtCoderAddOns, - #superclass : #Object, + #name : 'GtCoderAddOns', + #superclass : 'Object', #instVars : [ 'contextActions', 'mainActions', @@ -8,10 +8,10 @@ Class { 'shortcuts', 'updateRequested' ], - #category : #'GToolkit-Coder-Coders - Addons' + #category : 'GToolkit-Coder-Coders - Addons' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderAddOns >> addAddOns: aGtCoderAddOns [ self addShortcuts: aGtCoderAddOns shortcuts. self addMainActions: aGtCoderAddOns mainActions. @@ -19,7 +19,7 @@ GtCoderAddOns >> addAddOns: aGtCoderAddOns [ self addContextMenuActions: aGtCoderAddOns contextMenuActions ] -{ #category : #'api - context actions' } +{ #category : 'api - context actions' } GtCoderAddOns >> addContextAction: aGtCoderAction [ self updateActionList: #contextActions @@ -27,7 +27,7 @@ GtCoderAddOns >> addContextAction: aGtCoderAction [ onlyNew: true ] -{ #category : #'api - context actions' } +{ #category : 'api - context actions' } GtCoderAddOns >> addContextAction: aTitleString icon: anIcon action: aBlock [ self addContextAction: aTitleString @@ -36,7 +36,7 @@ GtCoderAddOns >> addContextAction: aTitleString icon: anIcon action: aBlock [ id: nil ] -{ #category : #'api - context actions' } +{ #category : 'api - context actions' } GtCoderAddOns >> addContextAction: aTitleString icon: anIcon action: aBlock id: aBlElementId [ self updateActionList: #contextActions @@ -48,22 +48,22 @@ GtCoderAddOns >> addContextAction: aTitleString icon: anIcon action: aBlock id: onlyNew: true ] -{ #category : #'api - context actions' } +{ #category : 'api - context actions' } GtCoderAddOns >> addContextActions: aCollectionOfContextActions [ aCollectionOfContextActions do: [ :eachContextAction | self addContextAction: eachContextAction ] ] -{ #category : #'api - context menu' } +{ #category : 'api - context menu' } GtCoderAddOns >> addContextMenuAction: aContextMenuAction [ contextMenuActions add: aContextMenuAction ] -{ #category : #'api - context menu' } +{ #category : 'api - context menu' } GtCoderAddOns >> addContextMenuActions: aCollectionOfContextMenuActions [ aCollectionOfContextMenuActions do: [ :eachContextMenuAction | self addContextMenuAction: eachContextMenuAction ] ] -{ #category : #'api - context menu' } +{ #category : 'api - context menu' } GtCoderAddOns >> addContextMenuItem: aString action: aBlock [ ^ self addContextMenuItem: aString @@ -72,7 +72,7 @@ GtCoderAddOns >> addContextMenuItem: aString action: aBlock [ action: aBlock ] -{ #category : #'api - context menu' } +{ #category : 'api - context menu' } GtCoderAddOns >> addContextMenuItem: aString action: aBlock id: aSymbol [ ^ self addContextMenuItem: aString @@ -82,7 +82,7 @@ GtCoderAddOns >> addContextMenuItem: aString action: aBlock id: aSymbol [ id: aSymbol ] -{ #category : #'api - context menu' } +{ #category : 'api - context menu' } GtCoderAddOns >> addContextMenuItem: aString hover: hoverBlock leave: leaveBlock action: aBlock [ self addContextMenuItem: aString @@ -92,7 +92,7 @@ GtCoderAddOns >> addContextMenuItem: aString hover: hoverBlock leave: leaveBlock id: nil ] -{ #category : #'api - context menu' } +{ #category : 'api - context menu' } GtCoderAddOns >> addContextMenuItem: aString hover: hoverBlock leave: leaveBlock action: aBlock id: aSymbol [ | newAction | newAction := GtCoderContextMenuAction new @@ -104,7 +104,7 @@ GtCoderAddOns >> addContextMenuItem: aString hover: hoverBlock leave: leaveBlock self addContextMenuAction: newAction ] -{ #category : #'api - main actions' } +{ #category : 'api - main actions' } GtCoderAddOns >> addDropDownAction: aString icon: anIcon stencil: aBlock [ | newAction | newAction := GtCoderDropDownAction new @@ -114,7 +114,7 @@ GtCoderAddOns >> addDropDownAction: aString icon: anIcon stencil: aBlock [ mainActions add: newAction ] -{ #category : #'api - main actions' } +{ #category : 'api - main actions' } GtCoderAddOns >> addDropDownWithPreviewAction: aString icon: anIcon action: actionBlock stencil: stencilBlock [ | newAction | newAction := GtCoderDropDownWithPreviewAction new @@ -125,7 +125,7 @@ GtCoderAddOns >> addDropDownWithPreviewAction: aString icon: anIcon action: acti mainActions add: newAction ] -{ #category : #'api - main actions' } +{ #category : 'api - main actions' } GtCoderAddOns >> addMainAction: aGtCoderAction [ self updateActionList: #mainActions @@ -133,7 +133,7 @@ GtCoderAddOns >> addMainAction: aGtCoderAction [ onlyNew: true ] -{ #category : #'api - main actions' } +{ #category : 'api - main actions' } GtCoderAddOns >> addMainAction: aString icon: anIcon action: aBlock [ self updateActionList: #mainActions @@ -143,7 +143,7 @@ GtCoderAddOns >> addMainAction: aString icon: anIcon action: aBlock [ onlyNew: true ] -{ #category : #'api - main actions' } +{ #category : 'api - main actions' } GtCoderAddOns >> addMainAction: aTitleString icon: anIcon action: aBlock id: aNameSymbol [ self updateActionList: #mainActions @@ -155,12 +155,12 @@ GtCoderAddOns >> addMainAction: aTitleString icon: anIcon action: aBlock id: aNa onlyNew: true ] -{ #category : #'api - main actions' } +{ #category : 'api - main actions' } GtCoderAddOns >> addMainActions: aCollectionOfMainActions [ aCollectionOfMainActions do: [ :eachMainAction | self addMainAction: eachMainAction ] ] -{ #category : #private } +{ #category : 'private' } GtCoderAddOns >> addOrUpdateShortcut: aBlShortcut to: aCollection [ 1 to: aCollection size do: [ :i | (aCollection at: i) combination = aBlShortcut combination @@ -168,32 +168,32 @@ GtCoderAddOns >> addOrUpdateShortcut: aBlShortcut to: aCollection [ aCollection add: aBlShortcut ] -{ #category : #'api - shortcuts' } +{ #category : 'api - shortcuts' } GtCoderAddOns >> addShortcut: aBlShortcut [ self addOrUpdateShortcut: aBlShortcut to: shortcuts ] -{ #category : #'api - shortcuts' } +{ #category : 'api - shortcuts' } GtCoderAddOns >> addShortcuts: aCollectionOfShortcuts [ aCollectionOfShortcuts do: [ :eachShortcut | self addShortcut: eachShortcut ] ] -{ #category : #'api - context actions' } +{ #category : 'api - context actions' } GtCoderAddOns >> contextActions [ ^ contextActions ] -{ #category : #'api - context menu' } +{ #category : 'api - context menu' } GtCoderAddOns >> contextMenuActions [ ^ contextMenuActions ] -{ #category : #changes } +{ #category : 'changes' } GtCoderAddOns >> differenceWith: aGtCoderAddOns [ ^ Array streamContents: [ :aStream | self differenceWith: aGtCoderAddOns on: aStream ] ] -{ #category : #changes } +{ #category : 'changes' } GtCoderAddOns >> differenceWith: aGtCoderAddOns on: aStream [ self assert: [ self class = aGtCoderAddOns class ] @@ -212,7 +212,7 @@ GtCoderAddOns >> differenceWith: aGtCoderAddOns on: aStream [ ifFalse: [ aStream nextPut: GtCoderAddOnsShortcutsDifference new ]. ] -{ #category : #'gt-extensions' } +{ #category : 'gt-extensions' } GtCoderAddOns >> gtViewContextActionsFor: aView [ ^ aView columnedList @@ -225,7 +225,7 @@ GtCoderAddOns >> gtViewContextActionsFor: aView [ column: 'Action' item: [ :anAction | anAction action ] ] -{ #category : #'gt-extensions' } +{ #category : 'gt-extensions' } GtCoderAddOns >> gtViewKeybindingsFor: aView [ self shortcuts ifEmpty: [ ^ aView empty ]. @@ -237,7 +237,7 @@ GtCoderAddOns >> gtViewKeybindingsFor: aView [ column: 'Combination' item: [ :each | each combination gtDisplayString ] ] -{ #category : #'gt-extensions' } +{ #category : 'gt-extensions' } GtCoderAddOns >> gtViewMainActionsFor: aView [ ^ aView columnedList @@ -252,7 +252,7 @@ GtCoderAddOns >> gtViewMainActionsFor: aView [ weight: 3 ] -{ #category : #'initialize-release' } +{ #category : 'initialize-release' } GtCoderAddOns >> initialize [ super initialize. contextActions := OrderedCollection new. @@ -262,17 +262,17 @@ GtCoderAddOns >> initialize [ updateRequested := true ] -{ #category : #'api - main actions' } +{ #category : 'api - main actions' } GtCoderAddOns >> mainActions [ ^ mainActions ] -{ #category : #changes } +{ #category : 'changes' } GtCoderAddOns >> markAsUpdated [ updateRequested := false ] -{ #category : #copying } +{ #category : 'copying' } GtCoderAddOns >> postCopy [ super postCopy. contextActions := contextActions copy. @@ -281,19 +281,19 @@ GtCoderAddOns >> postCopy [ shortcuts := shortcuts copy ] -{ #category : #changes } +{ #category : 'changes' } GtCoderAddOns >> requestUpdate [ "Mark coder addons as potentially needed to be updated" updateRequested := true ] -{ #category : #'api - shortcuts' } +{ #category : 'api - shortcuts' } GtCoderAddOns >> shortcuts [ ^ shortcuts ] -{ #category : #testing } +{ #category : 'testing' } GtCoderAddOns >> shouldBeUpdated [ "Return true if addons should be updated, false otherwise" @@ -301,7 +301,7 @@ GtCoderAddOns >> shouldBeUpdated [ ^ updateRequested ] -{ #category : #private } +{ #category : 'private' } GtCoderAddOns >> updateActionList: listSymbol title: aString icon: anIcon action: aBlock onlyNew: aBoolean [ self updateActionList: listSymbol @@ -312,7 +312,7 @@ GtCoderAddOns >> updateActionList: listSymbol title: aString icon: anIcon action onlyNew: aBoolean ] -{ #category : #private } +{ #category : 'private' } GtCoderAddOns >> updateActionList: listSymbol withAction: aGtCoderAction onlyNew: aBoolean [ | index actions | diff --git a/src/GToolkit-Coder/GtCoderAddOnsContextActionsDifference.class.st b/src/GToolkit-Coder/GtCoderAddOnsContextActionsDifference.class.st index 8c16afb85..8adf0f428 100644 --- a/src/GToolkit-Coder/GtCoderAddOnsContextActionsDifference.class.st +++ b/src/GToolkit-Coder/GtCoderAddOnsContextActionsDifference.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtCoderAddOnsContextActionsDifference, - #superclass : #GtCoderAddOnsDifference, - #category : #'GToolkit-Coder-Coders - Addons' + #name : 'GtCoderAddOnsContextActionsDifference', + #superclass : 'GtCoderAddOnsDifference', + #category : 'GToolkit-Coder-Coders - Addons' } diff --git a/src/GToolkit-Coder/GtCoderAddOnsContextMenuDifference.class.st b/src/GToolkit-Coder/GtCoderAddOnsContextMenuDifference.class.st index 45be73ab8..df97c0e27 100644 --- a/src/GToolkit-Coder/GtCoderAddOnsContextMenuDifference.class.st +++ b/src/GToolkit-Coder/GtCoderAddOnsContextMenuDifference.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtCoderAddOnsContextMenuDifference, - #superclass : #GtCoderAddOnsDifference, - #category : #'GToolkit-Coder-Coders - Addons' + #name : 'GtCoderAddOnsContextMenuDifference', + #superclass : 'GtCoderAddOnsDifference', + #category : 'GToolkit-Coder-Coders - Addons' } diff --git a/src/GToolkit-Coder/GtCoderAddOnsDifference.class.st b/src/GToolkit-Coder/GtCoderAddOnsDifference.class.st index cf32e5771..41fe2d3fb 100644 --- a/src/GToolkit-Coder/GtCoderAddOnsDifference.class.st +++ b/src/GToolkit-Coder/GtCoderAddOnsDifference.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtCoderAddOnsDifference, - #superclass : #Object, - #category : #'GToolkit-Coder-Coders - Addons' + #name : 'GtCoderAddOnsDifference', + #superclass : 'Object', + #category : 'GToolkit-Coder-Coders - Addons' } diff --git a/src/GToolkit-Coder/GtCoderAddOnsMainActionsDifference.class.st b/src/GToolkit-Coder/GtCoderAddOnsMainActionsDifference.class.st index f374a4c7d..d3c1dd0ea 100644 --- a/src/GToolkit-Coder/GtCoderAddOnsMainActionsDifference.class.st +++ b/src/GToolkit-Coder/GtCoderAddOnsMainActionsDifference.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtCoderAddOnsMainActionsDifference, - #superclass : #GtCoderAddOnsDifference, - #category : #'GToolkit-Coder-Coders - Addons' + #name : 'GtCoderAddOnsMainActionsDifference', + #superclass : 'GtCoderAddOnsDifference', + #category : 'GToolkit-Coder-Coders - Addons' } diff --git a/src/GToolkit-Coder/GtCoderAddOnsShortcutsDifference.class.st b/src/GToolkit-Coder/GtCoderAddOnsShortcutsDifference.class.st index 3fa1cb6d8..70565137f 100644 --- a/src/GToolkit-Coder/GtCoderAddOnsShortcutsDifference.class.st +++ b/src/GToolkit-Coder/GtCoderAddOnsShortcutsDifference.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtCoderAddOnsShortcutsDifference, - #superclass : #GtCoderAddOnsDifference, - #category : #'GToolkit-Coder-Coders - Addons' + #name : 'GtCoderAddOnsShortcutsDifference', + #superclass : 'GtCoderAddOnsDifference', + #category : 'GToolkit-Coder-Coders - Addons' } diff --git a/src/GToolkit-Coder/GtCoderAddOnsStylersDifference.class.st b/src/GToolkit-Coder/GtCoderAddOnsStylersDifference.class.st index 664d90eae..18a860163 100644 --- a/src/GToolkit-Coder/GtCoderAddOnsStylersDifference.class.st +++ b/src/GToolkit-Coder/GtCoderAddOnsStylersDifference.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtCoderAddOnsStylersDifference, - #superclass : #GtCoderAddOnsDifference, - #category : #'GToolkit-Coder-Coders - Addons' + #name : 'GtCoderAddOnsStylersDifference', + #superclass : 'GtCoderAddOnsDifference', + #category : 'GToolkit-Coder-Coders - Addons' } diff --git a/src/GToolkit-Coder/GtCoderAddOnsUpdateRequest.class.st b/src/GToolkit-Coder/GtCoderAddOnsUpdateRequest.class.st index c610c76be..0cdca7652 100644 --- a/src/GToolkit-Coder/GtCoderAddOnsUpdateRequest.class.st +++ b/src/GToolkit-Coder/GtCoderAddOnsUpdateRequest.class.st @@ -10,7 +10,7 @@ It works like this: " Class { - #name : #GtCoderAddOnsUpdateRequest, - #superclass : #GtCoderAnnouncement, - #category : #'GToolkit-Coder-Event' + #name : 'GtCoderAddOnsUpdateRequest', + #superclass : 'GtCoderAnnouncement', + #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCoderAnnouncement.class.st b/src/GToolkit-Coder/GtCoderAnnouncement.class.st index b624d4de6..64c7d07e6 100644 --- a/src/GToolkit-Coder/GtCoderAnnouncement.class.st +++ b/src/GToolkit-Coder/GtCoderAnnouncement.class.st @@ -1,18 +1,18 @@ Class { - #name : #GtCoderAnnouncement, - #superclass : #Announcement, + #name : 'GtCoderAnnouncement', + #superclass : 'Announcement', #instVars : [ 'coder' ], - #category : #'GToolkit-Coder-Event' + #category : 'GToolkit-Coder-Event' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderAnnouncement >> coder [ ^ coder ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderAnnouncement >> coder: methodCoder [ coder := methodCoder ] diff --git a/src/GToolkit-Coder/GtCoderAnnouncer.class.st b/src/GToolkit-Coder/GtCoderAnnouncer.class.st index a9bef339a..762dc7a62 100644 --- a/src/GToolkit-Coder/GtCoderAnnouncer.class.st +++ b/src/GToolkit-Coder/GtCoderAnnouncer.class.st @@ -1,14 +1,14 @@ Class { - #name : #GtCoderAnnouncer, - #superclass : #Announcer, + #name : 'GtCoderAnnouncer', + #superclass : 'Announcer', #instVars : [ 'suppressedAnnouncements', 'monitor' ], - #category : #'GToolkit-Coder-Coders' + #category : 'GToolkit-Coder-Coders' } -{ #category : #announce } +{ #category : 'announce' } GtCoderAnnouncer >> announce: anAnnouncement [ monitor critical: [ (suppressedAnnouncements includes: anAnnouncement class) @@ -16,7 +16,7 @@ GtCoderAnnouncer >> announce: anAnnouncement [ super announce: anAnnouncement ] ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderAnnouncer >> initialize [ super initialize. @@ -24,7 +24,7 @@ GtCoderAnnouncer >> initialize [ suppressedAnnouncements := #() ] -{ #category : #announce } +{ #category : 'announce' } GtCoderAnnouncer >> suppress: aCollectionOfAnnouncementClasses during: aBlock [ monitor critical: [ | aPreviousSuppressedAnnouncements | diff --git a/src/GToolkit-Coder/GtCoderAstChanged.class.st b/src/GToolkit-Coder/GtCoderAstChanged.class.st index 3e187087f..f3f8ce6ca 100644 --- a/src/GToolkit-Coder/GtCoderAstChanged.class.st +++ b/src/GToolkit-Coder/GtCoderAstChanged.class.st @@ -1,18 +1,18 @@ Class { - #name : #GtCoderAstChanged, - #superclass : #GtCoderAnnouncement, + #name : 'GtCoderAstChanged', + #superclass : 'GtCoderAnnouncement', #instVars : [ 'ast' ], - #category : #'GToolkit-Coder-Event' + #category : 'GToolkit-Coder-Event' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderAstChanged >> ast [ ^ ast ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderAstChanged >> ast: anObject [ ast := anObject ] diff --git a/src/GToolkit-Coder/GtCoderAstCompositeStyler.class.st b/src/GToolkit-Coder/GtCoderAstCompositeStyler.class.st index 0166d19a7..350eb6ce4 100644 --- a/src/GToolkit-Coder/GtCoderAstCompositeStyler.class.st +++ b/src/GToolkit-Coder/GtCoderAstCompositeStyler.class.st @@ -1,13 +1,13 @@ Class { - #name : #GtCoderAstCompositeStyler, - #superclass : #GtCoderAstStyler, + #name : 'GtCoderAstCompositeStyler', + #superclass : 'GtCoderAstStyler', #instVars : [ 'stylers' ], - #category : #'GToolkit-Coder-Styler/Highlighter' + #category : 'GToolkit-Coder-Styler/Highlighter' } -{ #category : #'api - styling' } +{ #category : 'api - styling' } GtCoderAstCompositeStyler >> extraStyle: aText ast: theAst [ self stylers do: [ :eachStyler | BlTextStylerTelemetry @@ -15,7 +15,7 @@ GtCoderAstCompositeStyler >> extraStyle: aText ast: theAst [ during: [ eachStyler extraStyle: aText ast: theAst ] ] ] -{ #category : #'api - styling' } +{ #category : 'api - styling' } GtCoderAstCompositeStyler >> style: aText ast: theAst [ self stylers do: [ :eachStyler | [ @@ -39,12 +39,12 @@ GtCoderAstCompositeStyler >> style: aText ast: theAst [ cr ] ] ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderAstCompositeStyler >> stylers [ ^ stylers ifNil: [ #() ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderAstCompositeStyler >> stylers: anObject [ stylers := anObject ] diff --git a/src/GToolkit-Coder/GtCoderAstSmaCCParserStyler.class.st b/src/GToolkit-Coder/GtCoderAstSmaCCParserStyler.class.st index 28449fdd6..a5c4a4caf 100644 --- a/src/GToolkit-Coder/GtCoderAstSmaCCParserStyler.class.st +++ b/src/GToolkit-Coder/GtCoderAstSmaCCParserStyler.class.st @@ -1,23 +1,23 @@ Class { - #name : #GtCoderAstSmaCCParserStyler, - #superclass : #GtCoderAstStyler, + #name : 'GtCoderAstSmaCCParserStyler', + #superclass : 'GtCoderAstStyler', #instVars : [ 'smaccStyler' ], - #category : #'GToolkit-Coder-Styler/Highlighter' + #category : 'GToolkit-Coder-Styler/Highlighter' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderAstSmaCCParserStyler >> smaccStyler [ ^ smaccStyler ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderAstSmaCCParserStyler >> smaccStyler: anObject [ smaccStyler := anObject ] -{ #category : #'api - styling' } +{ #category : 'api - styling' } GtCoderAstSmaCCParserStyler >> style: aText ast: theAst [ self smaccStyler style: aText using: theAst ] diff --git a/src/GToolkit-Coder/GtCoderAstStyler.class.st b/src/GToolkit-Coder/GtCoderAstStyler.class.st index 1e77a1744..989fe9e8c 100644 --- a/src/GToolkit-Coder/GtCoderAstStyler.class.st +++ b/src/GToolkit-Coder/GtCoderAstStyler.class.st @@ -1,18 +1,18 @@ Class { - #name : #GtCoderAstStyler, - #superclass : #BlTextStyler, + #name : 'GtCoderAstStyler', + #superclass : 'BlTextStyler', #instVars : [ 'coderViewModel' ], - #category : #'GToolkit-Coder-Styler/Highlighter' + #category : 'GToolkit-Coder-Styler/Highlighter' } -{ #category : #'api - styling' } +{ #category : 'api - styling' } GtCoderAstStyler >> attribute: aTextAttribute from: aStart to: anEnd [ self attributes: { aTextAttribute } from: aStart to: anEnd ] -{ #category : #'api - styling' } +{ #category : 'api - styling' } GtCoderAstStyler >> attributes: anAttributesCollection from: aStart to: anEnd [ [ text attributes: anAttributesCollection from: aStart to: anEnd. ] @@ -35,21 +35,21 @@ GtCoderAstStyler >> attributes: anAttributesCollection from: aStart to: anEnd [ cr ]. ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderAstStyler >> coderViewModel [ ^ coderViewModel ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderAstStyler >> coderViewModel: anObject [ coderViewModel := anObject ] -{ #category : #'api - styling' } +{ #category : 'api - styling' } GtCoderAstStyler >> extraStyle: aText ast: theAst [ ] -{ #category : #private } +{ #category : 'private' } GtCoderAstStyler >> privateStyle: aText [ | theAst | @@ -75,7 +75,7 @@ GtCoderAstStyler >> privateStyle: aText [ ^ aText ] -{ #category : #'api - styling' } +{ #category : 'api - styling' } GtCoderAstStyler >> style: aText ast: theAst [ self subclassResponsibility ] diff --git a/src/GToolkit-Coder/GtCoderClassAdded.class.st b/src/GToolkit-Coder/GtCoderClassAdded.class.st index 91a1e2180..673dfcdf3 100644 --- a/src/GToolkit-Coder/GtCoderClassAdded.class.st +++ b/src/GToolkit-Coder/GtCoderClassAdded.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtCoderClassAdded, - #superclass : #GtCoderAnnouncement, - #category : #'GToolkit-Coder-Event' + #name : 'GtCoderClassAdded', + #superclass : 'GtCoderAnnouncement', + #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCoderClassRemoved.class.st b/src/GToolkit-Coder/GtCoderClassRemoved.class.st index 3adf9d27b..25e5d6e61 100644 --- a/src/GToolkit-Coder/GtCoderClassRemoved.class.st +++ b/src/GToolkit-Coder/GtCoderClassRemoved.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtCoderClassRemoved, - #superclass : #GtCoderAnnouncement, - #category : #'GToolkit-Coder-Event' + #name : 'GtCoderClassRemoved', + #superclass : 'GtCoderAnnouncement', + #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCoderClassRenamed.class.st b/src/GToolkit-Coder/GtCoderClassRenamed.class.st index 86f32e793..9431aa061 100644 --- a/src/GToolkit-Coder/GtCoderClassRenamed.class.st +++ b/src/GToolkit-Coder/GtCoderClassRenamed.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtCoderClassRenamed, - #superclass : #GtCoderAnnouncement, - #category : #'GToolkit-Coder-Event' + #name : 'GtCoderClassRenamed', + #superclass : 'GtCoderAnnouncement', + #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCoderClassWithPackageCompletionStrategy.class.st b/src/GToolkit-Coder/GtCoderClassWithPackageCompletionStrategy.class.st index 13f8f5997..9d82dfe54 100644 --- a/src/GToolkit-Coder/GtCoderClassWithPackageCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtCoderClassWithPackageCompletionStrategy.class.st @@ -1,31 +1,31 @@ Class { - #name : #GtCoderClassWithPackageCompletionStrategy, - #superclass : #GtCompletionStrategy, + #name : 'GtCoderClassWithPackageCompletionStrategy', + #superclass : 'GtCompletionStrategy', #instVars : [ 'allPackages', 'allClasses' ], - #category : #'GToolkit-Coder-Completion' + #category : 'GToolkit-Coder-Completion' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderClassWithPackageCompletionStrategy >> allClasses [ ^ allClasses ifNil: [ allClasses := GtPrefixTree withAll: Smalltalk globals classNames ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderClassWithPackageCompletionStrategy >> allPackages [ ^ allPackages ifNil: [ allPackages := GtPrefixTree withAll: RPackage organizer packageNames ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderClassWithPackageCompletionStrategy >> classesIn: aPackage [ ^ GtPrefixTree withAll: aPackage definedClassNames ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderClassWithPackageCompletionStrategy >> completionActionsFor: aText at: positionInteger max: maxInteger [ | currentInput completionActions delimitedIndex | currentInput := aText asString. @@ -62,12 +62,12 @@ GtCoderClassWithPackageCompletionStrategy >> completionActionsFor: aText at: pos ] -{ #category : #testing } +{ #category : 'testing' } GtCoderClassWithPackageCompletionStrategy >> hasCompletionEntryFor: aString [ ^ true ] -{ #category : #testing } +{ #category : 'testing' } GtCoderClassWithPackageCompletionStrategy >> hasCompletionsAt: anInteger in: aText [ ^ true ] diff --git a/src/GToolkit-Coder/GtCoderClassesHierarchyTree.class.st b/src/GToolkit-Coder/GtCoderClassesHierarchyTree.class.st index 9f6e51e19..9b8285b10 100644 --- a/src/GToolkit-Coder/GtCoderClassesHierarchyTree.class.st +++ b/src/GToolkit-Coder/GtCoderClassesHierarchyTree.class.st @@ -6,16 +6,16 @@ I am an inheritance hierachy tree that can be built from a collection of classes " Class { - #name : #GtCoderClassesHierarchyTree, - #superclass : #Object, + #name : 'GtCoderClassesHierarchyTree', + #superclass : 'Object', #instVars : [ 'rootClass', 'subclassTrees' ], - #category : #'GToolkit-Coder-Navigation - Model' + #category : 'GToolkit-Coder-Navigation - Model' } -{ #category : #factory } +{ #category : 'factory' } GtCoderClassesHierarchyTree class >> fromClasses: aCollectionOfClasses [ | aRootItem theSetOfClasses theRootTrees theSubclassTrees | @@ -32,7 +32,7 @@ GtCoderClassesHierarchyTree class >> fromClasses: aCollectionOfClasses [ ^ aRootItem ] -{ #category : #factory } +{ #category : 'factory' } GtCoderClassesHierarchyTree class >> hierarchyForClass: aClass [ | aRootNode aCurrentNode | aRootNode := self new. @@ -47,28 +47,28 @@ GtCoderClassesHierarchyTree class >> hierarchyForClass: aClass [ ^ aRootNode. ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderClassesHierarchyTree >> at: anIndex [ ^ self subclassTrees at: anIndex ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderClassesHierarchyTree >> classes [ ^ self subclassTrees collect: [ :eachTree | eachTree rootClass ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderClassesHierarchyTree >> first [ ^ self at: 1 ] -{ #category : #'gt-extension' } +{ #category : 'gt-extension' } GtCoderClassesHierarchyTree >> gtTreeFor: aView [ @@ -80,20 +80,20 @@ GtCoderClassesHierarchyTree >> gtTreeFor: aView [ expandUpTo: 1 ] -{ #category : #testing } +{ #category : 'testing' } GtCoderClassesHierarchyTree >> hasRootClass [ ^ rootClass isNotNil ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderClassesHierarchyTree >> initialize [ super initialize. subclassTrees := Array empty. ] -{ #category : #printing } +{ #category : 'printing' } GtCoderClassesHierarchyTree >> printOn: aStream [ self hasRootClass ifTrue: [ aStream print: self rootClass ] @@ -108,43 +108,43 @@ GtCoderClassesHierarchyTree >> printOn: aStream [ nextPut: $) ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderClassesHierarchyTree >> rootClass [ ^ rootClass ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderClassesHierarchyTree >> rootClass: aClass [ rootClass := aClass ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderClassesHierarchyTree >> size [ ^ subclassTrees size ] -{ #category : #sorting } +{ #category : 'sorting' } GtCoderClassesHierarchyTree >> sort: aBlock [ subclassTrees := subclassTrees sorted: [ :treeA :treeB | aBlock value: treeA rootClass value: treeB rootClass ]. subclassTrees do: [ :eachTree | eachTree sort: aBlock ] ] -{ #category : #sorting } +{ #category : 'sorting' } GtCoderClassesHierarchyTree >> sortByClassName [ self sort: [ :classA :classB | classA name < classB name ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderClassesHierarchyTree >> subclassTrees [ ^ subclassTrees ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderClassesHierarchyTree >> subclassTrees: aCollection [ subclassTrees := aCollection ] diff --git a/src/GToolkit-Coder/GtCoderCollapsedLabelChanged.class.st b/src/GToolkit-Coder/GtCoderCollapsedLabelChanged.class.st index d32d09c22..85a893297 100644 --- a/src/GToolkit-Coder/GtCoderCollapsedLabelChanged.class.st +++ b/src/GToolkit-Coder/GtCoderCollapsedLabelChanged.class.st @@ -4,7 +4,7 @@ Is sent by the {{gtClass:GtSourceCoder}} when it thinks that the collapsed text " Class { - #name : #GtCoderCollapsedLabelChanged, - #superclass : #GtSourceCoderAnnouncement, - #category : #'GToolkit-Coder-Event' + #name : 'GtCoderCollapsedLabelChanged', + #superclass : 'GtSourceCoderAnnouncement', + #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCoderCommentStyler.class.st b/src/GToolkit-Coder/GtCoderCommentStyler.class.st index 4b1bacdbd..d718b4885 100644 --- a/src/GToolkit-Coder/GtCoderCommentStyler.class.st +++ b/src/GToolkit-Coder/GtCoderCommentStyler.class.st @@ -1,12 +1,12 @@ Class { - #name : #GtCoderCommentStyler, - #superclass : #GtRBASTStyler, + #name : 'GtCoderCommentStyler', + #superclass : 'GtRBASTStyler', #traits : 'TRBProgramNodeVisitor', #classTraits : 'TRBProgramNodeVisitor classTrait', - #category : #'GToolkit-Coder-Styler/Highlighter' + #category : 'GToolkit-Coder-Styler/Highlighter' } -{ #category : #visiting } +{ #category : 'visiting' } GtCoderCommentStyler >> visitNode: aNode [ | comments | comments := aNode comments. diff --git a/src/GToolkit-Coder/GtCoderCompiledMethodSourceCode.class.st b/src/GToolkit-Coder/GtCoderCompiledMethodSourceCode.class.st index 2e5d3a0c7..e36be9f99 100644 --- a/src/GToolkit-Coder/GtCoderCompiledMethodSourceCode.class.st +++ b/src/GToolkit-Coder/GtCoderCompiledMethodSourceCode.class.st @@ -4,44 +4,44 @@ I represent a source code of a method defined by a class and a selector " Class { - #name : #GtCoderCompiledMethodSourceCode, - #superclass : #GtCoderSourceCode, + #name : 'GtCoderCompiledMethodSourceCode', + #superclass : 'GtCoderSourceCode', #instVars : [ 'compiledMethod' ], - #category : #'GToolkit-Coder-Coders' + #category : 'GToolkit-Coder-Coders' } -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderCompiledMethodSourceCode >> asAstCacheKey [ ^ compiledMethod ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderCompiledMethodSourceCode >> buildCollapsedText [ ^ compiledMethod selector asRopedText ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderCompiledMethodSourceCode >> buildSourceText [ ^ compiledMethod sourceCode asRopedText ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderCompiledMethodSourceCode >> compiledMethod [ ^ compiledMethod ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderCompiledMethodSourceCode >> compiledMethod: aCompiledMethod [ compiledMethod := aCompiledMethod ] -{ #category : #testing } +{ #category : 'testing' } GtCoderCompiledMethodSourceCode >> isModified [ ^ compiledMethod sourceCode ~= self sourceString ] diff --git a/src/GToolkit-Coder/GtCoderContextActionsChanged.class.st b/src/GToolkit-Coder/GtCoderContextActionsChanged.class.st index 91798f10d..f2dd14ca3 100644 --- a/src/GToolkit-Coder/GtCoderContextActionsChanged.class.st +++ b/src/GToolkit-Coder/GtCoderContextActionsChanged.class.st @@ -7,7 +7,7 @@ Is announced by the {{gtClass:GtCoderModel}} when context actions change. " Class { - #name : #GtCoderContextActionsChanged, - #superclass : #GtCoderAnnouncement, - #category : #'GToolkit-Coder-Event' + #name : 'GtCoderContextActionsChanged', + #superclass : 'GtCoderAnnouncement', + #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCoderContextMenuAction.class.st b/src/GToolkit-Coder/GtCoderContextMenuAction.class.st index 0607d62c1..3cc1e115e 100644 --- a/src/GToolkit-Coder/GtCoderContextMenuAction.class.st +++ b/src/GToolkit-Coder/GtCoderContextMenuAction.class.st @@ -1,29 +1,29 @@ Class { - #name : #GtCoderContextMenuAction, - #superclass : #GtCoderAction, + #name : 'GtCoderContextMenuAction', + #superclass : 'GtCoderAction', #instVars : [ 'hoverAction', 'leaveAction' ], - #category : #'GToolkit-Coder' + #category : 'GToolkit-Coder' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderContextMenuAction >> hoverAction [ ^ hoverAction ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderContextMenuAction >> hoverAction: aBlock [ hoverAction := aBlock ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderContextMenuAction >> leaveAction [ ^ leaveAction ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderContextMenuAction >> leaveAction: aBlock [ leaveAction := aBlock ] diff --git a/src/GToolkit-Coder/GtCoderContextVariableStyler.class.st b/src/GToolkit-Coder/GtCoderContextVariableStyler.class.st index 7c34f8f10..52db6820c 100644 --- a/src/GToolkit-Coder/GtCoderContextVariableStyler.class.st +++ b/src/GToolkit-Coder/GtCoderContextVariableStyler.class.st @@ -1,6 +1,6 @@ Class { - #name : #GtCoderContextVariableStyler, - #superclass : #GtRBASTStyler, + #name : 'GtCoderContextVariableStyler', + #superclass : 'GtRBASTStyler', #traits : 'TRBProgramNodeVisitor', #classTraits : 'TRBProgramNodeVisitor classTrait', #instVars : [ @@ -8,10 +8,10 @@ Class { 'variables', 'interval' ], - #category : #'GToolkit-Coder-Styler/Highlighter' + #category : 'GToolkit-Coder-Styler/Highlighter' } -{ #category : #testing } +{ #category : 'testing' } GtCoderContextVariableStyler >> hasValueForVariableNamed: aVariableName [ ^ self valueForVariableNamed: aVariableName @@ -19,7 +19,7 @@ GtCoderContextVariableStyler >> hasValueForVariableNamed: aVariableName [ ifAbsent: [ false ] ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderContextVariableStyler >> initializeVariables [ variables notNil ifTrue: [ ^ self ]. @@ -31,29 +31,29 @@ GtCoderContextVariableStyler >> initializeVariables [ interval := methodCoder session pcRangeForContext: methodCoder context ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderContextVariableStyler >> methodCoder [ ^ methodCoder ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderContextVariableStyler >> methodCoder: aMethodCoder [ methodCoder := aMethodCoder ] -{ #category : #styling } +{ #category : 'styling' } GtCoderContextVariableStyler >> style: aText ast: ast [ aText clearAttributes: [ :each | each isKindOf: GtPlaygroundEvaluatedCodeButtonAttribute ]. self initializeVariables. super style: aText ast: ast ] -{ #category : #styling } +{ #category : 'styling' } GtCoderContextVariableStyler >> styleVariableNode: aVariableNode [ self subclassResponsibility ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderContextVariableStyler >> valueForVariableNamed: aVariableName ifPresent: presentBlock [ ^ self valueForVariableNamed: aVariableName @@ -61,7 +61,7 @@ GtCoderContextVariableStyler >> valueForVariableNamed: aVariableName ifPresent: ifAbsent: [ ^ self ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderContextVariableStyler >> valueForVariableNamed: aVariableName ifPresent: presentBlock ifAbsent: absentBloc [ ^ variables at: aVariableName @@ -70,17 +70,17 @@ GtCoderContextVariableStyler >> valueForVariableNamed: aVariableName ifPresent: ifAbsent: absentBloc ] -{ #category : #visiting } +{ #category : 'visiting' } GtCoderContextVariableStyler >> visitArgumentNode: anArgumentNode [ self styleVariableNode: anArgumentNode ] -{ #category : #visiting } +{ #category : 'visiting' } GtCoderContextVariableStyler >> visitInstanceVariableNode: aSelfNode [ self styleVariableNode: aSelfNode ] -{ #category : #visiting } +{ #category : 'visiting' } GtCoderContextVariableStyler >> visitTemporaryNode: aNode [ self styleVariableNode: aNode ] diff --git a/src/GToolkit-Coder/GtCoderCorrectionRequest.class.st b/src/GToolkit-Coder/GtCoderCorrectionRequest.class.st index e7d3feced..d4ef80a2a 100644 --- a/src/GToolkit-Coder/GtCoderCorrectionRequest.class.st +++ b/src/GToolkit-Coder/GtCoderCorrectionRequest.class.st @@ -1,40 +1,40 @@ Class { - #name : #GtCoderCorrectionRequest, - #superclass : #GtSourceCoderAnnouncement, + #name : 'GtCoderCorrectionRequest', + #superclass : 'GtSourceCoderAnnouncement', #instVars : [ 'fromIndex', 'toIndex', 'correctionString' ], - #category : #'GToolkit-Coder-Event' + #category : 'GToolkit-Coder-Event' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderCorrectionRequest >> correctionString [ ^ correctionString ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderCorrectionRequest >> correctionString: anObject [ correctionString := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderCorrectionRequest >> fromIndex [ ^ fromIndex ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderCorrectionRequest >> fromIndex: anObject [ fromIndex := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderCorrectionRequest >> toIndex [ ^ toIndex ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderCorrectionRequest >> toIndex: anObject [ toIndex := anObject ] diff --git a/src/GToolkit-Coder/GtCoderDropDownAction.class.st b/src/GToolkit-Coder/GtCoderDropDownAction.class.st index 1885a4caf..dd7b1dd2c 100644 --- a/src/GToolkit-Coder/GtCoderDropDownAction.class.st +++ b/src/GToolkit-Coder/GtCoderDropDownAction.class.st @@ -1,18 +1,18 @@ Class { - #name : #GtCoderDropDownAction, - #superclass : #GtCoderAction, + #name : 'GtCoderDropDownAction', + #superclass : 'GtCoderAction', #instVars : [ 'stencil' ], - #category : #'GToolkit-Coder' + #category : 'GToolkit-Coder' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderDropDownAction >> stencil [ ^ stencil ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderDropDownAction >> stencil: anObject [ stencil := anObject ] diff --git a/src/GToolkit-Coder/GtCoderDropDownWithPreviewAction.class.st b/src/GToolkit-Coder/GtCoderDropDownWithPreviewAction.class.st index ed2030f91..eac38e52a 100644 --- a/src/GToolkit-Coder/GtCoderDropDownWithPreviewAction.class.st +++ b/src/GToolkit-Coder/GtCoderDropDownWithPreviewAction.class.st @@ -1,29 +1,29 @@ Class { - #name : #GtCoderDropDownWithPreviewAction, - #superclass : #GtCoderAction, + #name : 'GtCoderDropDownWithPreviewAction', + #superclass : 'GtCoderAction', #instVars : [ 'changeAction', 'changeStencil' ], - #category : #'GToolkit-Coder-GToolkit-Coder' + #category : 'GToolkit-Coder-GToolkit-Coder' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderDropDownWithPreviewAction >> changeAction [ ^ changeAction ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderDropDownWithPreviewAction >> changeAction: aBlock [ changeAction := aBlock ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderDropDownWithPreviewAction >> changeStencil [ ^ changeStencil ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderDropDownWithPreviewAction >> changeStencil: aBlock [ changeStencil := aBlock ] diff --git a/src/GToolkit-Coder/GtCoderEvaluationAnnouncement.class.st b/src/GToolkit-Coder/GtCoderEvaluationAnnouncement.class.st index e6782bd12..81f8cd05b 100644 --- a/src/GToolkit-Coder/GtCoderEvaluationAnnouncement.class.st +++ b/src/GToolkit-Coder/GtCoderEvaluationAnnouncement.class.st @@ -1,25 +1,25 @@ Class { - #name : #GtCoderEvaluationAnnouncement, - #superclass : #GtSourceCoderAnnouncement, + #name : 'GtCoderEvaluationAnnouncement', + #superclass : 'GtSourceCoderAnnouncement', #instVars : [ 'evaluationResult' ], - #category : #'GToolkit-Coder-Event' + #category : 'GToolkit-Coder-Event' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderEvaluationAnnouncement >> evaluationResult [ ^ evaluationResult ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderEvaluationAnnouncement >> evaluationResult: aGtSourceCoderEvaluationResult [ evaluationResult := aGtSourceCoderEvaluationResult ] -{ #category : #testing } +{ #category : 'testing' } GtCoderEvaluationAnnouncement >> isRequestedByElementOrItsChild: anElement [ "Return true if the evaluation ws requested by a given visual element or any of its children" @@ -33,7 +33,7 @@ GtCoderEvaluationAnnouncement >> isRequestedByElementOrItsChild: anElement [ ^ self requesterObject hasParent: anElement ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderEvaluationAnnouncement >> requesterObject [ ^ self evaluationResult requesterObject ] diff --git a/src/GToolkit-Coder/GtCoderEvaluationUnhandledError.class.st b/src/GToolkit-Coder/GtCoderEvaluationUnhandledError.class.st index 76718d91f..7a8cd1b09 100644 --- a/src/GToolkit-Coder/GtCoderEvaluationUnhandledError.class.st +++ b/src/GToolkit-Coder/GtCoderEvaluationUnhandledError.class.st @@ -1,15 +1,15 @@ Class { - #name : #GtCoderEvaluationUnhandledError, - #superclass : #UnhandledError, + #name : 'GtCoderEvaluationUnhandledError', + #superclass : 'UnhandledError', #instVars : [ 'sourceCoder', 'sourceString', 'sourceInterval' ], - #category : #'GToolkit-Coder-Coders' + #category : 'GToolkit-Coder-Coders' } -{ #category : #handling } +{ #category : 'handling' } GtCoderEvaluationUnhandledError >> debug [ "Request a debugger on myself embedded in the given text editor" @@ -22,38 +22,38 @@ GtCoderEvaluationUnhandledError >> debug [ forException: self exception ] -{ #category : #'priv handling' } +{ #category : 'priv handling' } GtCoderEvaluationUnhandledError >> defaultAction [ ^ UIManager default unhandledErrorDefaultAction: self ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderEvaluationUnhandledError >> sourceCoder [ ^ sourceCoder ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderEvaluationUnhandledError >> sourceCoder: aSourceCoder [ sourceCoder := aSourceCoder ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderEvaluationUnhandledError >> sourceInterval [ ^ sourceInterval ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderEvaluationUnhandledError >> sourceInterval: anObject [ sourceInterval := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderEvaluationUnhandledError >> sourceString [ ^ sourceString ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderEvaluationUnhandledError >> sourceString: anObject [ sourceString := anObject ] diff --git a/src/GToolkit-Coder/GtCoderExampleExecuted.class.st b/src/GToolkit-Coder/GtCoderExampleExecuted.class.st index 503ef45ed..911714b0e 100644 --- a/src/GToolkit-Coder/GtCoderExampleExecuted.class.st +++ b/src/GToolkit-Coder/GtCoderExampleExecuted.class.st @@ -5,21 +5,21 @@ I am used by {{gtClass:GtMethodCoder}}, see {{gtMethod:GtMethodCoder>>#handleExa " Class { - #name : #GtCoderExampleExecuted, - #superclass : #GtSourceCoderAnnouncement, + #name : 'GtCoderExampleExecuted', + #superclass : 'GtSourceCoderAnnouncement', #instVars : [ 'example' ], - #category : #'GToolkit-Coder-Event' + #category : 'GToolkit-Coder-Event' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderExampleExecuted >> example [ ^ example ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderExampleExecuted >> example: aGtExampleWithResult [ self assert: [ aGtExampleWithResult isNotNil ] @@ -27,19 +27,19 @@ GtCoderExampleExecuted >> example: aGtExampleWithResult [ example := aGtExampleWithResult ] -{ #category : #testing } +{ #category : 'testing' } GtCoderExampleExecuted >> hasResult [ ^ self example hasResult ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderExampleExecuted >> result [ ^ self example result ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderExampleExecuted >> returnValue [ ^ self example returnValue ] diff --git a/src/GToolkit-Coder/GtCoderExampler.class.st b/src/GToolkit-Coder/GtCoderExampler.class.st index 70b12c3c5..c00a67697 100644 --- a/src/GToolkit-Coder/GtCoderExampler.class.st +++ b/src/GToolkit-Coder/GtCoderExampler.class.st @@ -5,57 +5,57 @@ I am used by {{gtClass:GtCodersModel}}, see: {{gtMethod:Behavior>>#gtCoderMethod " Class { - #name : #GtCoderExampler, - #superclass : #Object, + #name : 'GtCoderExampler', + #superclass : 'Object', #instVars : [ 'coder' ], - #category : #'GToolkit-Coder-Exampler' + #category : 'GToolkit-Coder-Exampler' } -{ #category : #'api - instance creation' } +{ #category : 'api - instance creation' } GtCoderExampler class >> coder: aCoder [ ^ self new coder: aCoder ] -{ #category : #'api - enumeration' } +{ #category : 'api - enumeration' } GtCoderExampler >> allExampleCodersDo: aBlock [ "iterate all coders with examples" self subclassResponsibility ] -{ #category : #'api - enumeration' } +{ #category : 'api - enumeration' } GtCoderExampler >> allExecutableExampleCodersDo: aBlock [ self allExampleCodersDo: [ :aCoder :anExample | aCoder canExecuteExample ifTrue: [ aBlock cull: aCoder cull: anExample ] ] ] -{ #category : #'api - enumeration' } +{ #category : 'api - enumeration' } GtCoderExampler >> allExecutableExampleCodersWithResultsDo: aBlock [ self allExecutableExampleCodersDo: [ :aCoder :anExample | aCoder exampleResult ifNotNil: [ :aResult | aBlock cull: aCoder cull: anExample cull: aResult ] ] ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderExampler >> coder [ ^ coder ] -{ #category : #'api - initialization' } +{ #category : 'api - initialization' } GtCoderExampler >> coder: anObject [ coder := anObject ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderExampler >> coderFor: aCompiledMethod [ ^ self subclassResponsibility ] -{ #category : #'api - testing' } +{ #category : 'api - testing' } GtCoderExampler >> hasErrorExamples [ self allExecutableExampleCodersWithResultsDo: [ :eachCoder | @@ -64,13 +64,13 @@ GtCoderExampler >> hasErrorExamples [ ^ false ] -{ #category : #'api - testing' } +{ #category : 'api - testing' } GtCoderExampler >> hasExamples [ self allExecutableExampleCodersDo: [ ^ true ]. ^ false ] -{ #category : #'api - testing' } +{ #category : 'api - testing' } GtCoderExampler >> hasFailureExamples [ self allExecutableExampleCodersWithResultsDo: [ :eachCoder | @@ -79,7 +79,7 @@ GtCoderExampler >> hasFailureExamples [ ^ false ] -{ #category : #'api - testing' } +{ #category : 'api - testing' } GtCoderExampler >> hasNotExecutedExamples [ self allExecutableExampleCodersDo: [ :eachCoder | @@ -88,13 +88,13 @@ GtCoderExampler >> hasNotExecutedExamples [ ^ false ] -{ #category : #'api - testing' } +{ #category : 'api - testing' } GtCoderExampler >> hasSelectedExecutableExamples [ self selectedExecutableExampleCodersDo: [ ^ true ]. ^ false ] -{ #category : #'api - testing' } +{ #category : 'api - testing' } GtCoderExampler >> hasSuccessExamples [ self allExecutableExampleCodersWithResultsDo: [ :eachCoder | @@ -103,7 +103,7 @@ GtCoderExampler >> hasSuccessExamples [ ^ false ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderExampler >> numberOfAllExamples [ | aTotal | @@ -113,7 +113,7 @@ GtCoderExampler >> numberOfAllExamples [ ^ aTotal ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderExampler >> numberOfErrorExamples [ | aTotal | @@ -124,7 +124,7 @@ GtCoderExampler >> numberOfErrorExamples [ ^ aTotal ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderExampler >> numberOfFailureExamples [ | aTotal | @@ -135,7 +135,7 @@ GtCoderExampler >> numberOfFailureExamples [ ^ aTotal ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderExampler >> numberOfNotExecutedExamples [ | aTotal | @@ -146,7 +146,7 @@ GtCoderExampler >> numberOfNotExecutedExamples [ ^ aTotal ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderExampler >> numberOfSuccessExamples [ | aTotal | @@ -157,39 +157,39 @@ GtCoderExampler >> numberOfSuccessExamples [ ^ aTotal ] -{ #category : #'api - execution' } +{ #category : 'api - execution' } GtCoderExampler >> runExamples [ self selectedExecutableExampleCodersDo: [ :eachCoder | (eachCoder isModified or: [ eachCoder example hasNoTestPragma ]) ifFalse: [ eachCoder example run ] ] ] -{ #category : #'api - execution' } +{ #category : 'api - execution' } GtCoderExampler >> runExamplesFrom: anElement [ self runExamples. ] -{ #category : #'api - execution' } +{ #category : 'api - execution' } GtCoderExampler >> runNoTestExamples [ self selectedExecutableExampleCodersDo: [ :eachCoder | (eachCoder isModified not and: [ eachCoder example hasNoTestPragma ]) ifTrue: [ eachCoder example run ] ] ] -{ #category : #'api - enumeration' } +{ #category : 'api - enumeration' } GtCoderExampler >> selectedExampleCodersDo: aBlock [ "iterate selected coders with examples" self subclassResponsibility ] -{ #category : #'api - enumeration' } +{ #category : 'api - enumeration' } GtCoderExampler >> selectedExecutableExampleCodersDo: aBlock [ self selectedExampleCodersDo: [ :aCoder :anExample | aCoder canExecuteExample ifTrue: [ aBlock cull: aCoder cull: anExample ] ] ] -{ #category : #'api - enumeration' } +{ #category : 'api - enumeration' } GtCoderExampler >> selectedExecutableExampleCodersWithResultsDo: aBlock [ self selectedExecutableExampleCodersDo: [ :aCoder :anExample | aCoder exampleResult ifNotNil: [ :aResult | diff --git a/src/GToolkit-Coder/GtCoderExplicitSourceCode.class.st b/src/GToolkit-Coder/GtCoderExplicitSourceCode.class.st index acac72fea..cfb32548c 100644 --- a/src/GToolkit-Coder/GtCoderExplicitSourceCode.class.st +++ b/src/GToolkit-Coder/GtCoderExplicitSourceCode.class.st @@ -4,44 +4,44 @@ I represent an explicit source code that was provided as a string " Class { - #name : #GtCoderExplicitSourceCode, - #superclass : #GtCoderSourceCode, + #name : 'GtCoderExplicitSourceCode', + #superclass : 'GtCoderSourceCode', #instVars : [ 'source' ], - #category : #'GToolkit-Coder-Coders' + #category : 'GToolkit-Coder-Coders' } -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderExplicitSourceCode >> asAstCacheKey [ ^ source ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderExplicitSourceCode >> buildCollapsedText [ ^ (self sourceString linesDo: [ :eachLine | eachLine trimmed ifNotEmpty: [ :aNonEmptyLine | ^ aNonEmptyLine ] ]) asRopedText ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderExplicitSourceCode >> buildSourceText [ ^ source asRopedText ] -{ #category : #'api - testing' } +{ #category : 'api - testing' } GtCoderExplicitSourceCode >> isModified [ ^ self source ~= self sourceString ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderExplicitSourceCode >> source [ ^ source ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderExplicitSourceCode >> source: aString [ source := aString ] diff --git a/src/GToolkit-Coder/GtCoderExplicitSourceText.class.st b/src/GToolkit-Coder/GtCoderExplicitSourceText.class.st index d0a50531f..2dad598c8 100644 --- a/src/GToolkit-Coder/GtCoderExplicitSourceText.class.st +++ b/src/GToolkit-Coder/GtCoderExplicitSourceText.class.st @@ -1,42 +1,42 @@ Class { - #name : #GtCoderExplicitSourceText, - #superclass : #GtCoderSourceCode, + #name : 'GtCoderExplicitSourceText', + #superclass : 'GtCoderSourceCode', #instVars : [ 'text' ], - #category : #'GToolkit-Coder-Coders' + #category : 'GToolkit-Coder-Coders' } -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderExplicitSourceText >> asAstCacheKey [ ^ text ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderExplicitSourceText >> buildCollapsedText [ ^ (self sourceString linesDo: [ :eachLine | eachLine trimmed ifNotEmpty: [ :aNonEmptyLine | ^ aNonEmptyLine ] ]) asRopedText ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderExplicitSourceText >> buildSourceText [ ^ text copy ] -{ #category : #'api - testing' } +{ #category : 'api - testing' } GtCoderExplicitSourceText >> isModified [ ^ self text rope ~= self sourceText rope ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderExplicitSourceText >> text [ ^ text ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderExplicitSourceText >> text: aStringOrText [ text := aStringOrText asRopedText ] diff --git a/src/GToolkit-Coder/GtCoderGrowingClassesHierarchyTree.class.st b/src/GToolkit-Coder/GtCoderGrowingClassesHierarchyTree.class.st index c70131c86..6fdb07e47 100644 --- a/src/GToolkit-Coder/GtCoderGrowingClassesHierarchyTree.class.st +++ b/src/GToolkit-Coder/GtCoderGrowingClassesHierarchyTree.class.st @@ -7,26 +7,26 @@ I automatically compute subclasses on demand. " Class { - #name : #GtCoderGrowingClassesHierarchyTree, - #superclass : #GtCoderClassesHierarchyTree, - #category : #'GToolkit-Coder-Navigation - Model' + #name : 'GtCoderGrowingClassesHierarchyTree', + #superclass : 'GtCoderClassesHierarchyTree', + #category : 'GToolkit-Coder-Navigation - Model' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderGrowingClassesHierarchyTree >> currentSize [ ^ self currentSubclassTrees size ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderGrowingClassesHierarchyTree >> currentSubclassTrees [ ^ subclassTrees ] -{ #category : #'gt-extension' } +{ #category : 'gt-extension' } GtCoderGrowingClassesHierarchyTree >> gtFixedTreeFor: aView [ @@ -38,7 +38,7 @@ GtCoderGrowingClassesHierarchyTree >> gtFixedTreeFor: aView [ expandUpTo: 1 ] -{ #category : #'gt-extension' } +{ #category : 'gt-extension' } GtCoderGrowingClassesHierarchyTree >> gtTreeFor: aView [ ^ (super gtTreeFor: aView) @@ -46,7 +46,7 @@ GtCoderGrowingClassesHierarchyTree >> gtTreeFor: aView [ priority: 2 ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderGrowingClassesHierarchyTree >> size [ @@ -55,7 +55,7 @@ GtCoderGrowingClassesHierarchyTree >> size [ ifFalse: [ super size ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderGrowingClassesHierarchyTree >> subclassTrees [ @@ -63,7 +63,7 @@ GtCoderGrowingClassesHierarchyTree >> subclassTrees [ ^ super subclassTrees ] -{ #category : #updating } +{ #category : 'updating' } GtCoderGrowingClassesHierarchyTree >> updateSubclasses [ self rootClass instanceSide hasSubclasses ifFalse: [ ^ self ]. subclassTrees := (self rootClass subclasses diff --git a/src/GToolkit-Coder/GtCoderInstanceVariableStyler.class.st b/src/GToolkit-Coder/GtCoderInstanceVariableStyler.class.st index c2db54c9a..eb1c16317 100644 --- a/src/GToolkit-Coder/GtCoderInstanceVariableStyler.class.st +++ b/src/GToolkit-Coder/GtCoderInstanceVariableStyler.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtCoderInstanceVariableStyler, - #superclass : #BlTextStyler, - #category : #'GToolkit-Coder-Styler/Highlighter' + #name : 'GtCoderInstanceVariableStyler', + #superclass : 'BlTextStyler', + #category : 'GToolkit-Coder-Styler/Highlighter' } -{ #category : #testing } +{ #category : 'testing' } GtCoderInstanceVariableStyler >> isValidVariableName: aText [ @@ -16,7 +16,7 @@ GtCoderInstanceVariableStyler >> isValidVariableName: aText [ do: [ :anError | false ] ] -{ #category : #private } +{ #category : 'private' } GtCoderInstanceVariableStyler >> privateStyle: aText [ diff --git a/src/GToolkit-Coder/GtCoderMainActionsChanged.class.st b/src/GToolkit-Coder/GtCoderMainActionsChanged.class.st index f3b38535e..6be2a7373 100644 --- a/src/GToolkit-Coder/GtCoderMainActionsChanged.class.st +++ b/src/GToolkit-Coder/GtCoderMainActionsChanged.class.st @@ -7,7 +7,7 @@ Is announced by the {{gtClass:GtCoderModel}} when main actions change. " Class { - #name : #GtCoderMainActionsChanged, - #superclass : #GtCoderAnnouncement, - #category : #'GToolkit-Coder-Event' + #name : 'GtCoderMainActionsChanged', + #superclass : 'GtCoderAnnouncement', + #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCoderMethodAdded.class.st b/src/GToolkit-Coder/GtCoderMethodAdded.class.st index 16d7a55cc..bfd538b8d 100644 --- a/src/GToolkit-Coder/GtCoderMethodAdded.class.st +++ b/src/GToolkit-Coder/GtCoderMethodAdded.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtCoderMethodAdded, - #superclass : #GtCoderAnnouncement, - #category : #'GToolkit-Coder-Event' + #name : 'GtCoderMethodAdded', + #superclass : 'GtCoderAnnouncement', + #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCoderMethodModified.class.st b/src/GToolkit-Coder/GtCoderMethodModified.class.st index f8049551d..b2ebbf7c8 100644 --- a/src/GToolkit-Coder/GtCoderMethodModified.class.st +++ b/src/GToolkit-Coder/GtCoderMethodModified.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtCoderMethodModified, - #superclass : #GtCoderAnnouncement, - #category : #'GToolkit-Coder-Event' + #name : 'GtCoderMethodModified', + #superclass : 'GtCoderAnnouncement', + #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCoderMethodRemoved.class.st b/src/GToolkit-Coder/GtCoderMethodRemoved.class.st index 8c8a1cd01..456e5a506 100644 --- a/src/GToolkit-Coder/GtCoderMethodRemoved.class.st +++ b/src/GToolkit-Coder/GtCoderMethodRemoved.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtCoderMethodRemoved, - #superclass : #GtCoderAnnouncement, - #category : #'GToolkit-Coder-Event' + #name : 'GtCoderMethodRemoved', + #superclass : 'GtCoderAnnouncement', + #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCoderModel.class.st b/src/GToolkit-Coder/GtCoderModel.class.st index d70d71d3e..707068d5f 100644 --- a/src/GToolkit-Coder/GtCoderModel.class.st +++ b/src/GToolkit-Coder/GtCoderModel.class.st @@ -17,8 +17,8 @@ By default there are the following types of add-ons: " Class { - #name : #GtCoderModel, - #superclass : #Object, + #name : 'GtCoderModel', + #superclass : 'Object', #traits : 'TGtAnnouncer', #classTraits : 'TGtAnnouncer classTrait', #instVars : [ @@ -32,69 +32,69 @@ Class { #classVars : [ 'UniqueIdGenerator' ], - #category : #'GToolkit-Coder-Coders' + #category : 'GToolkit-Coder-Coders' } -{ #category : #'class initialization' } +{ #category : 'class initialization' } GtCoderModel class >> initialize [ UniqueIdGenerator := BlUniqueIdGenerator new ] -{ #category : #'api - addons' } +{ #category : 'api - addons' } GtCoderModel >> addOns [ ^ extraAddOns ifNil: [ extraAddOns := self newAddOns ] ] -{ #category : #'api - addons' } +{ #category : 'api - addons' } GtCoderModel >> addOnsClass [ ^ GtCoderAddOns ] -{ #category : #'api - announcer' } +{ #category : 'api - announcer' } GtCoderModel >> announcer [ ^ announcer ] -{ #category : #'api - converting' } +{ #category : 'api - converting' } GtCoderModel >> asNewCoderModelWithSameSubject [ "Return new coder model with same subject (e.g., package, class, method)" ^ self subclassResponsibility ] -{ #category : #'api - attributes' } +{ #category : 'api - attributes' } GtCoderModel >> attributeNamed: aSymbol [ ^ attributes notNil ifTrue: [ attributes at: aSymbol ifAbsent: [ ] ] ] -{ #category : #'api - attributes' } +{ #category : 'api - attributes' } GtCoderModel >> attributeNamed: aSymbol ifAbsent: aBlock [ ^ attributes notNil ifTrue: [ attributes at: aSymbol ifAbsent: aBlock ] ifFalse: [ aBlock value ] ] -{ #category : #'api - attributes' } +{ #category : 'api - attributes' } GtCoderModel >> attributeNamed: aSymbol ifPresent: aPresentBlock ifAbsent: anAbsentBlock [ ^ attributes notNil ifTrue: [ attributes at: aSymbol ifPresent: aPresentBlock ifAbsent: anAbsentBlock ] ifFalse: [ anAbsentBlock value ] ] -{ #category : #'api - attributes' } +{ #category : 'api - attributes' } GtCoderModel >> attributeNamed: aSymbol put: anObject [ ^ self attributes at: aSymbol put: anObject ] -{ #category : #'api - attributes' } +{ #category : 'api - attributes' } GtCoderModel >> attributes [ ^ attributes ifNil: [ attributes := IdentityDictionary new ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderModel >> coderName [ "Return a short textual name of the coder. For example, class coder would return a class name, package coder returns a package name." @@ -103,17 +103,17 @@ GtCoderModel >> coderName [ ^ self class name ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderModel >> coders [ ^ self attributeNamed: #coders ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderModel >> coders: aCoders [ ^ self attributeNamed: #coders put: aCoders ] -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtCoderModel >> contextActions [ "Return a collection of contextual actions in the coder. They are renderred separately from mainActions" @@ -121,34 +121,34 @@ GtCoderModel >> contextActions [ ^ self addOns contextActions ] -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtCoderModel >> contextMenuActions [ ^ self addOns contextMenuActions ] -{ #category : #'mutual exclusion' } +{ #category : 'mutual exclusion' } GtCoderModel >> critical: aBlock [ ^ monitor critical: aBlock ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderModel >> expanded [ self deprecated: 'The expansion state was moved to the ViewModel' ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderModel >> expanded: aBoolean [ self deprecated: 'The expansion state was moved to the ViewModel' ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderModel >> id [ ^ id ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderModel >> initialize [ super initialize. @@ -159,15 +159,15 @@ GtCoderModel >> initialize [ self coderLook: self defaultCoderLook ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderModel >> initializeAddOns: addOns [ ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderModel >> initializeShortcuts: addOns [ ] -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtCoderModel >> mainActions [ "Return a collection of main actions in the coder, for example save" @@ -175,12 +175,12 @@ GtCoderModel >> mainActions [ ^ self addOns mainActions ] -{ #category : #'api - addons' } +{ #category : 'api - addons' } GtCoderModel >> newAddOns [ ^ self addOnsClass new ] -{ #category : #elements } +{ #category : 'elements' } GtCoderModel >> previewElement [ "Return a preview element for the Spotter" @@ -188,19 +188,19 @@ GtCoderModel >> previewElement [ ^ self asElement ] -{ #category : #'api - attributes' } +{ #category : 'api - attributes' } GtCoderModel >> removeAttributeNamed: aSymbol [ attributes isNil ifTrue: [ ^ self ]. attributes removeKey: aSymbol ifAbsent: [ ] ] -{ #category : #elements } +{ #category : 'elements' } GtCoderModel >> requestFocus [ self announce: (GtCoderRequestFocus new coder: self) ] -{ #category : #'api - addons' } +{ #category : 'api - addons' } GtCoderModel >> requestUpdateAddOns [ "Request addons to update due to some environmental changes (similar to requesting text to restyle). It is a responsibility of the Coder's Element to start the actual addon update (${method:GtCoderModel>>#updateAddOnsFrom:}$) which may happen in @@ -212,12 +212,12 @@ GtCoderModel >> requestUpdateAddOns [ self announce: (GtCoderAddOnsUpdateRequest new coder: self)" ] -{ #category : #subscriptions } +{ #category : 'subscriptions' } GtCoderModel >> subscribeToSystem [ "do nothing" ] -{ #category : #subscriptions } +{ #category : 'subscriptions' } GtCoderModel >> unsubscribeFromSystem [ SystemAnnouncer uniqueInstance unsubscribe: self ] diff --git a/src/GToolkit-Coder/GtCoderNavigationAnnouncement.class.st b/src/GToolkit-Coder/GtCoderNavigationAnnouncement.class.st index 9007cafd1..481e96d99 100644 --- a/src/GToolkit-Coder/GtCoderNavigationAnnouncement.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationAnnouncement.class.st @@ -1,18 +1,18 @@ Class { - #name : #GtCoderNavigationAnnouncement, - #superclass : #Announcement, + #name : 'GtCoderNavigationAnnouncement', + #superclass : 'Announcement', #instVars : [ 'coder' ], - #category : #'GToolkit-Coder-Navigation - Events' + #category : 'GToolkit-Coder-Navigation - Events' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationAnnouncement >> coder [ ^ coder ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationAnnouncement >> coder: aCoder [ coder := aCoder ] diff --git a/src/GToolkit-Coder/GtCoderNavigationClassAnnoucement.class.st b/src/GToolkit-Coder/GtCoderNavigationClassAnnoucement.class.st index 831bffbc4..2bc79a5df 100644 --- a/src/GToolkit-Coder/GtCoderNavigationClassAnnoucement.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationClassAnnoucement.class.st @@ -1,40 +1,40 @@ Class { - #name : #GtCoderNavigationClassAnnoucement, - #superclass : #GtCoderNavigationSystemChangesAnnouncement, + #name : 'GtCoderNavigationClassAnnoucement', + #superclass : 'GtCoderNavigationSystemChangesAnnouncement', #instVars : [ 'package', 'tag', 'theClass' ], - #category : #'GToolkit-Coder-Navigation - Events' + #category : 'GToolkit-Coder-Navigation - Events' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationClassAnnoucement >> package [ ^ package ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationClassAnnoucement >> package: anObject [ package := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationClassAnnoucement >> tag [ ^ tag ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationClassAnnoucement >> tag: anObject [ tag := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationClassAnnoucement >> theClass [ ^ theClass ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationClassAnnoucement >> theClass: anObject [ theClass := anObject ] diff --git a/src/GToolkit-Coder/GtCoderNavigationClassModified.class.st b/src/GToolkit-Coder/GtCoderNavigationClassModified.class.st index a17d542d9..f3364e6d4 100644 --- a/src/GToolkit-Coder/GtCoderNavigationClassModified.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationClassModified.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtCoderNavigationClassModified, - #superclass : #GtCoderNavigationClassAnnoucement, - #category : #'GToolkit-Coder-Navigation - Events' + #name : 'GtCoderNavigationClassModified', + #superclass : 'GtCoderNavigationClassAnnoucement', + #category : 'GToolkit-Coder-Navigation - Events' } diff --git a/src/GToolkit-Coder/GtCoderNavigationClassRenamed.class.st b/src/GToolkit-Coder/GtCoderNavigationClassRenamed.class.st index 5015ebbf4..682f8005a 100644 --- a/src/GToolkit-Coder/GtCoderNavigationClassRenamed.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationClassRenamed.class.st @@ -1,29 +1,29 @@ Class { - #name : #GtCoderNavigationClassRenamed, - #superclass : #GtCoderNavigationClassAnnoucement, + #name : 'GtCoderNavigationClassRenamed', + #superclass : 'GtCoderNavigationClassAnnoucement', #instVars : [ 'oldName', 'newName' ], - #category : #'GToolkit-Coder-Navigation - Events' + #category : 'GToolkit-Coder-Navigation - Events' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationClassRenamed >> newName [ ^ newName ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationClassRenamed >> newName: anObject [ newName := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationClassRenamed >> oldName [ ^ oldName ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationClassRenamed >> oldName: anObject [ oldName := anObject ] diff --git a/src/GToolkit-Coder/GtCoderNavigationClassSelected.class.st b/src/GToolkit-Coder/GtCoderNavigationClassSelected.class.st index 20b0b864e..5e97edf1b 100644 --- a/src/GToolkit-Coder/GtCoderNavigationClassSelected.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationClassSelected.class.st @@ -1,42 +1,42 @@ Class { - #name : #GtCoderNavigationClassSelected, - #superclass : #GtCoderNavigationSelectionAnnouncement, + #name : 'GtCoderNavigationClassSelected', + #superclass : 'GtCoderNavigationSelectionAnnouncement', #instVars : [ 'theClass', 'package', 'tag' ], - #category : #'GToolkit-Coder-Navigation - Events' + #category : 'GToolkit-Coder-Navigation - Events' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationClassSelected >> package [ ^ package ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationClassSelected >> package: anObject [ package := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationClassSelected >> tag [ ^ tag ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationClassSelected >> tag: anObject [ tag := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationClassSelected >> theClass [ ^ theClass ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationClassSelected >> theClass: anObject [ theClass := anObject ] diff --git a/src/GToolkit-Coder/GtCoderNavigationModel.class.st b/src/GToolkit-Coder/GtCoderNavigationModel.class.st index 7a6744b4f..74a58a353 100644 --- a/src/GToolkit-Coder/GtCoderNavigationModel.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationModel.class.st @@ -1,90 +1,90 @@ Class { - #name : #GtCoderNavigationModel, - #superclass : #Object, - #category : #'GToolkit-Coder-Navigation - Model' + #name : 'GtCoderNavigationModel', + #superclass : 'Object', + #category : 'GToolkit-Coder-Navigation - Model' } -{ #category : #factory } +{ #category : 'factory' } GtCoderNavigationModel class >> null [ ^ GtCoderNullNavigationModel default ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderNavigationModel >> classesToShow [ ^ self subclassResponsibility ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderNavigationModel >> coderDo: aBlock [ self subclassResponsibility ] -{ #category : #'api - testing' } +{ #category : 'api - testing' } GtCoderNavigationModel >> hasSelectedClass [ ^ self subclassResponsibility ] -{ #category : #'api - testing' } +{ #category : 'api - testing' } GtCoderNavigationModel >> hasSelectedPackage [ ^ self subclassResponsibility ] -{ #category : #'api - testing' } +{ #category : 'api - testing' } GtCoderNavigationModel >> hasSelectedTag [ ^ self subclassResponsibility ] -{ #category : #'api - testing' } +{ #category : 'api - testing' } GtCoderNavigationModel >> isNavigationModel [ ^ true ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderNavigationModel >> packagesToShow [ ^ self subclassResponsibility ] -{ #category : #'api - selection' } +{ #category : 'api - selection' } GtCoderNavigationModel >> selectClass: aClass [ self subclassResponsibility ] -{ #category : #'api - selection' } +{ #category : 'api - selection' } GtCoderNavigationModel >> selectMethod: aCompiledMethod [ self subclassResponsibility ] -{ #category : #'api - selection' } +{ #category : 'api - selection' } GtCoderNavigationModel >> selectPackage: aPackage [ self subclassResponsibility ] -{ #category : #'api - selection' } +{ #category : 'api - selection' } GtCoderNavigationModel >> selectedClassDo: aBlock [ self subclassResponsibility ] -{ #category : #'api - selection' } +{ #category : 'api - selection' } GtCoderNavigationModel >> selectedPackageDo: aBlock [ self subclassResponsibility ] -{ #category : #'api - selection' } +{ #category : 'api - selection' } GtCoderNavigationModel >> selectedTagDo: aBlock [ self subclassResponsibility ] -{ #category : #'api - subscriptions' } +{ #category : 'api - subscriptions' } GtCoderNavigationModel >> subscribeToSystem [ "concrete models can subscribe to the system" ] -{ #category : #'api - subscriptions' } +{ #category : 'api - subscriptions' } GtCoderNavigationModel >> unsubscribeFromSystem [ "concrete models can unsubscribe from the system" ] diff --git a/src/GToolkit-Coder/GtCoderNavigationModelChangedAnnouncement.class.st b/src/GToolkit-Coder/GtCoderNavigationModelChangedAnnouncement.class.st index 12be45ce8..19a13e314 100644 --- a/src/GToolkit-Coder/GtCoderNavigationModelChangedAnnouncement.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationModelChangedAnnouncement.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtCoderNavigationModelChangedAnnouncement, - #superclass : #Announcement, - #category : #'GToolkit-Coder-Announcements' + #name : 'GtCoderNavigationModelChangedAnnouncement', + #superclass : 'Announcement', + #category : 'GToolkit-Coder-Announcements' } diff --git a/src/GToolkit-Coder/GtCoderNavigationPackageAnnoucement.class.st b/src/GToolkit-Coder/GtCoderNavigationPackageAnnoucement.class.st index 9cf01c641..cab85c271 100644 --- a/src/GToolkit-Coder/GtCoderNavigationPackageAnnoucement.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationPackageAnnoucement.class.st @@ -1,23 +1,23 @@ Class { - #name : #GtCoderNavigationPackageAnnoucement, - #superclass : #GtCoderNavigationSystemChangesAnnouncement, + #name : 'GtCoderNavigationPackageAnnoucement', + #superclass : 'GtCoderNavigationSystemChangesAnnouncement', #instVars : [ 'package' ], - #category : #'GToolkit-Coder-Navigation - Events' + #category : 'GToolkit-Coder-Navigation - Events' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationPackageAnnoucement class >> package: aRPackage [ ^ self new package: aRPackage ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationPackageAnnoucement >> package [ ^ package ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationPackageAnnoucement >> package: anObject [ package := anObject ] diff --git a/src/GToolkit-Coder/GtCoderNavigationPackageRegistered.class.st b/src/GToolkit-Coder/GtCoderNavigationPackageRegistered.class.st index 0b0623a08..be812256f 100644 --- a/src/GToolkit-Coder/GtCoderNavigationPackageRegistered.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationPackageRegistered.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtCoderNavigationPackageRegistered, - #superclass : #GtCoderNavigationPackageAnnoucement, - #category : #'GToolkit-Coder-Navigation - Events' + #name : 'GtCoderNavigationPackageRegistered', + #superclass : 'GtCoderNavigationPackageAnnoucement', + #category : 'GToolkit-Coder-Navigation - Events' } diff --git a/src/GToolkit-Coder/GtCoderNavigationPackageRenamed.class.st b/src/GToolkit-Coder/GtCoderNavigationPackageRenamed.class.st index 0f2f24da9..1ddca6c28 100644 --- a/src/GToolkit-Coder/GtCoderNavigationPackageRenamed.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationPackageRenamed.class.st @@ -1,29 +1,29 @@ Class { - #name : #GtCoderNavigationPackageRenamed, - #superclass : #GtCoderNavigationPackageAnnoucement, + #name : 'GtCoderNavigationPackageRenamed', + #superclass : 'GtCoderNavigationPackageAnnoucement', #instVars : [ 'oldName', 'newName' ], - #category : #'GToolkit-Coder-Navigation - Events' + #category : 'GToolkit-Coder-Navigation - Events' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationPackageRenamed >> newName [ ^ newName ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationPackageRenamed >> newName: anObject [ newName := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationPackageRenamed >> oldName [ ^ oldName ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationPackageRenamed >> oldName: anObject [ oldName := anObject ] diff --git a/src/GToolkit-Coder/GtCoderNavigationPackageSelected.class.st b/src/GToolkit-Coder/GtCoderNavigationPackageSelected.class.st index 6a14f61df..ce1d7bf31 100644 --- a/src/GToolkit-Coder/GtCoderNavigationPackageSelected.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationPackageSelected.class.st @@ -1,20 +1,20 @@ Class { - #name : #GtCoderNavigationPackageSelected, - #superclass : #GtCoderNavigationSelectionAnnouncement, + #name : 'GtCoderNavigationPackageSelected', + #superclass : 'GtCoderNavigationSelectionAnnouncement', #instVars : [ 'package' ], - #category : #'GToolkit-Coder-Navigation - Events' + #category : 'GToolkit-Coder-Navigation - Events' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationPackageSelected >> package [ ^ package ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationPackageSelected >> package: anObject [ package := anObject ] diff --git a/src/GToolkit-Coder/GtCoderNavigationPackageTagAdded.class.st b/src/GToolkit-Coder/GtCoderNavigationPackageTagAdded.class.st index 769a6d1a3..39238d681 100644 --- a/src/GToolkit-Coder/GtCoderNavigationPackageTagAdded.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationPackageTagAdded.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtCoderNavigationPackageTagAdded, - #superclass : #GtCoderNavigationPackageTagAnnoucement, - #category : #'GToolkit-Coder-Navigation - Events' + #name : 'GtCoderNavigationPackageTagAdded', + #superclass : 'GtCoderNavigationPackageTagAnnoucement', + #category : 'GToolkit-Coder-Navigation - Events' } diff --git a/src/GToolkit-Coder/GtCoderNavigationPackageTagAnnoucement.class.st b/src/GToolkit-Coder/GtCoderNavigationPackageTagAnnoucement.class.st index ca962cb13..5ef3119d0 100644 --- a/src/GToolkit-Coder/GtCoderNavigationPackageTagAnnoucement.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationPackageTagAnnoucement.class.st @@ -1,29 +1,29 @@ Class { - #name : #GtCoderNavigationPackageTagAnnoucement, - #superclass : #GtCoderNavigationSystemChangesAnnouncement, + #name : 'GtCoderNavigationPackageTagAnnoucement', + #superclass : 'GtCoderNavigationSystemChangesAnnouncement', #instVars : [ 'package', 'tag' ], - #category : #'GToolkit-Coder-Navigation - Events' + #category : 'GToolkit-Coder-Navigation - Events' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationPackageTagAnnoucement >> package [ ^ package ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationPackageTagAnnoucement >> package: anObject [ package := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationPackageTagAnnoucement >> tag [ ^ tag ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationPackageTagAnnoucement >> tag: anObject [ tag := anObject ] diff --git a/src/GToolkit-Coder/GtCoderNavigationPackageTagRemoved.class.st b/src/GToolkit-Coder/GtCoderNavigationPackageTagRemoved.class.st index acbe394e6..ab52de09a 100644 --- a/src/GToolkit-Coder/GtCoderNavigationPackageTagRemoved.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationPackageTagRemoved.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtCoderNavigationPackageTagRemoved, - #superclass : #GtCoderNavigationPackageTagAnnoucement, - #category : #'GToolkit-Coder-Navigation - Events' + #name : 'GtCoderNavigationPackageTagRemoved', + #superclass : 'GtCoderNavigationPackageTagAnnoucement', + #category : 'GToolkit-Coder-Navigation - Events' } diff --git a/src/GToolkit-Coder/GtCoderNavigationPackageTagSelected.class.st b/src/GToolkit-Coder/GtCoderNavigationPackageTagSelected.class.st index 16e2f45e6..9b901f1fc 100644 --- a/src/GToolkit-Coder/GtCoderNavigationPackageTagSelected.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationPackageTagSelected.class.st @@ -1,31 +1,31 @@ Class { - #name : #GtCoderNavigationPackageTagSelected, - #superclass : #GtCoderNavigationSelectionAnnouncement, + #name : 'GtCoderNavigationPackageTagSelected', + #superclass : 'GtCoderNavigationSelectionAnnouncement', #instVars : [ 'package', 'tag' ], - #category : #'GToolkit-Coder-Navigation - Events' + #category : 'GToolkit-Coder-Navigation - Events' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationPackageTagSelected >> package [ ^ package ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationPackageTagSelected >> package: anObject [ package := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationPackageTagSelected >> tag [ ^ tag ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationPackageTagSelected >> tag: anObject [ tag := anObject ] diff --git a/src/GToolkit-Coder/GtCoderNavigationPackageUnregistered.class.st b/src/GToolkit-Coder/GtCoderNavigationPackageUnregistered.class.st index 4285ca6a2..5dbca0b6d 100644 --- a/src/GToolkit-Coder/GtCoderNavigationPackageUnregistered.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationPackageUnregistered.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtCoderNavigationPackageUnregistered, - #superclass : #GtCoderNavigationPackageAnnoucement, - #category : #'GToolkit-Coder-Navigation - Events' + #name : 'GtCoderNavigationPackageUnregistered', + #superclass : 'GtCoderNavigationPackageAnnoucement', + #category : 'GToolkit-Coder-Navigation - Events' } diff --git a/src/GToolkit-Coder/GtCoderNavigationPackagesSelected.class.st b/src/GToolkit-Coder/GtCoderNavigationPackagesSelected.class.st index 719bee78c..33998a1ac 100644 --- a/src/GToolkit-Coder/GtCoderNavigationPackagesSelected.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationPackagesSelected.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtCoderNavigationPackagesSelected, - #superclass : #GtCoderNavigationSelectionAnnouncement, - #category : #'GToolkit-Coder-Navigation - Events' + #name : 'GtCoderNavigationPackagesSelected', + #superclass : 'GtCoderNavigationSelectionAnnouncement', + #category : 'GToolkit-Coder-Navigation - Events' } diff --git a/src/GToolkit-Coder/GtCoderNavigationSelectionAnnouncement.class.st b/src/GToolkit-Coder/GtCoderNavigationSelectionAnnouncement.class.st index 5e1772f33..08d1da9e9 100644 --- a/src/GToolkit-Coder/GtCoderNavigationSelectionAnnouncement.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationSelectionAnnouncement.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtCoderNavigationSelectionAnnouncement, - #superclass : #GtCoderNavigationAnnouncement, - #category : #'GToolkit-Coder-Navigation - Events' + #name : 'GtCoderNavigationSelectionAnnouncement', + #superclass : 'GtCoderNavigationAnnouncement', + #category : 'GToolkit-Coder-Navigation - Events' } diff --git a/src/GToolkit-Coder/GtCoderNavigationSystemChangesAnnouncement.class.st b/src/GToolkit-Coder/GtCoderNavigationSystemChangesAnnouncement.class.st index a75c30484..d076cff07 100644 --- a/src/GToolkit-Coder/GtCoderNavigationSystemChangesAnnouncement.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationSystemChangesAnnouncement.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtCoderNavigationSystemChangesAnnouncement, - #superclass : #GtCoderNavigationAnnouncement, - #category : #'GToolkit-Coder-Navigation - Events' + #name : 'GtCoderNavigationSystemChangesAnnouncement', + #superclass : 'GtCoderNavigationAnnouncement', + #category : 'GToolkit-Coder-Navigation - Events' } diff --git a/src/GToolkit-Coder/GtCoderNullNavigationModel.class.st b/src/GToolkit-Coder/GtCoderNullNavigationModel.class.st index 8836922ed..ab0fb3eb5 100644 --- a/src/GToolkit-Coder/GtCoderNullNavigationModel.class.st +++ b/src/GToolkit-Coder/GtCoderNullNavigationModel.class.st @@ -1,77 +1,77 @@ Class { - #name : #GtCoderNullNavigationModel, - #superclass : #GtCoderNavigationModel, + #name : 'GtCoderNullNavigationModel', + #superclass : 'GtCoderNavigationModel', #traits : 'TGtUniqueInstance', #classTraits : 'TGtUniqueInstance classTrait', - #category : #'GToolkit-Coder-Navigation - Model' + #category : 'GToolkit-Coder-Navigation - Model' } -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderNullNavigationModel >> classesToShow [ ^ #() ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderNullNavigationModel >> coderDo: aBlock [ "do nothing" ] -{ #category : #'api - testing' } +{ #category : 'api - testing' } GtCoderNullNavigationModel >> hasSelectedClass [ ^ false ] -{ #category : #'api - testing' } +{ #category : 'api - testing' } GtCoderNullNavigationModel >> hasSelectedPackage [ ^ false ] -{ #category : #'api - testing' } +{ #category : 'api - testing' } GtCoderNullNavigationModel >> hasSelectedTag [ ^ false ] -{ #category : #'api - testing' } +{ #category : 'api - testing' } GtCoderNullNavigationModel >> isNavigationModel [ ^ false ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderNullNavigationModel >> packagesToShow [ ^ #() ] -{ #category : #'api - selection' } +{ #category : 'api - selection' } GtCoderNullNavigationModel >> selectClass: aClass [ "do nothing" ] -{ #category : #'api - selection' } +{ #category : 'api - selection' } GtCoderNullNavigationModel >> selectMethod: aCompiledMethod [ "do nothing" ] -{ #category : #'api - selection' } +{ #category : 'api - selection' } GtCoderNullNavigationModel >> selectMethodProtocol: aMethodProtocol [ "do nothing" ] -{ #category : #'api - selection' } +{ #category : 'api - selection' } GtCoderNullNavigationModel >> selectPackage: aPackage [ "do nothing" ] -{ #category : #'api - selection' } +{ #category : 'api - selection' } GtCoderNullNavigationModel >> selectedClassDo: aBlock [ "do nothing" ] -{ #category : #'api - selection' } +{ #category : 'api - selection' } GtCoderNullNavigationModel >> selectedPackageDo: aBlock [ "do nothing" ] -{ #category : #'api - selection' } +{ #category : 'api - selection' } GtCoderNullNavigationModel >> selectedTagDo: aBlock [ "do nothing" ] diff --git a/src/GToolkit-Coder/GtCoderObjectSpawnRequest.class.st b/src/GToolkit-Coder/GtCoderObjectSpawnRequest.class.st index 767129d5c..766d7fe23 100644 --- a/src/GToolkit-Coder/GtCoderObjectSpawnRequest.class.st +++ b/src/GToolkit-Coder/GtCoderObjectSpawnRequest.class.st @@ -1,29 +1,29 @@ Class { - #name : #GtCoderObjectSpawnRequest, - #superclass : #GtSourceCoderAnnouncement, + #name : 'GtCoderObjectSpawnRequest', + #superclass : 'GtSourceCoderAnnouncement', #instVars : [ 'object', 'spawnDestination' ], - #category : #'GToolkit-Coder-Event' + #category : 'GToolkit-Coder-Event' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderObjectSpawnRequest >> object [ ^ object ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderObjectSpawnRequest >> object: anObject [ object := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderObjectSpawnRequest >> spawnDestination [ ^ spawnDestination ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderObjectSpawnRequest >> spawnDestination: anObject [ spawnDestination := anObject ] diff --git a/src/GToolkit-Coder/GtCoderPackageExtentionTag.class.st b/src/GToolkit-Coder/GtCoderPackageExtentionTag.class.st index 09eef426b..35a84beb5 100644 --- a/src/GToolkit-Coder/GtCoderPackageExtentionTag.class.st +++ b/src/GToolkit-Coder/GtCoderPackageExtentionTag.class.st @@ -1,60 +1,60 @@ Class { - #name : #GtCoderPackageExtentionTag, - #superclass : #Object, + #name : 'GtCoderPackageExtentionTag', + #superclass : 'Object', #traits : 'TBlDebug', #classTraits : 'TBlDebug classTrait', #instVars : [ 'package', 'classes' ], - #category : #'GToolkit-Coder-Navigation - Model' + #category : 'GToolkit-Coder-Navigation - Model' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtCoderPackageExtentionTag class >> forPackage: aRPackage [ ^ self new package: aRPackage. ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderPackageExtentionTag >> classes [ ^ classes ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderPackageExtentionTag >> classes: anObject [ classes := anObject ] -{ #category : #testing } +{ #category : 'testing' } GtCoderPackageExtentionTag >> hasExtendedClasses [ ^ self classes isNotEmpty ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderPackageExtentionTag >> name [ ^ 'Extensions' ] -{ #category : #hooks } +{ #category : 'hooks' } GtCoderPackageExtentionTag >> onPackageChange [ self classes: self package extendedClasses asArray ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderPackageExtentionTag >> package [ ^ package ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderPackageExtentionTag >> package: aRPackage [ package := aRPackage. self onPackageChange. ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderPackageExtentionTag >> packageName [ ^ self package name. ] diff --git a/src/GToolkit-Coder/GtCoderPackageRegistered.class.st b/src/GToolkit-Coder/GtCoderPackageRegistered.class.st index 791d1e4ed..27a9e61e3 100644 --- a/src/GToolkit-Coder/GtCoderPackageRegistered.class.st +++ b/src/GToolkit-Coder/GtCoderPackageRegistered.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtCoderPackageRegistered, - #superclass : #GtCoderAnnouncement, - #category : #'GToolkit-Coder-Event' + #name : 'GtCoderPackageRegistered', + #superclass : 'GtCoderAnnouncement', + #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCoderPackageRenamed.class.st b/src/GToolkit-Coder/GtCoderPackageRenamed.class.st index 043aff60b..16ce5be9d 100644 --- a/src/GToolkit-Coder/GtCoderPackageRenamed.class.st +++ b/src/GToolkit-Coder/GtCoderPackageRenamed.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtCoderPackageRenamed, - #superclass : #GtCoderAnnouncement, - #category : #'GToolkit-Coder-Event' + #name : 'GtCoderPackageRenamed', + #superclass : 'GtCoderAnnouncement', + #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st b/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st index 6db4e74d5..c1bbb2c4f 100644 --- a/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st +++ b/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st @@ -1,57 +1,57 @@ Class { - #name : #GtCoderPackageUncategorizedTag, - #superclass : #Object, + #name : 'GtCoderPackageUncategorizedTag', + #superclass : 'Object', #traits : 'TBlDebug', #classTraits : 'TBlDebug classTrait', #instVars : [ 'packageTag' ], - #category : #'GToolkit-Coder-Navigation - Model' + #category : 'GToolkit-Coder-Navigation - Model' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtCoderPackageUncategorizedTag class >> forPackageTag: aRPackage [ ^ self new packageTag: aRPackage. ] -{ #category : #comparing } +{ #category : 'comparing' } GtCoderPackageUncategorizedTag >> = anObject [ ^ (self class = anObject class and: [ self packageTagName = anObject packageTagName ]) or: [ (anObject isKindOf: RPackageTag) and: [ self packageTagName = anObject name ] ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderPackageUncategorizedTag >> classes [ ^ self packageTag classes ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderPackageUncategorizedTag >> name [ ^ 'Uncategorized' ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderPackageUncategorizedTag >> package [ ^ self packageTag package ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderPackageUncategorizedTag >> packageName [ ^ self package name ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderPackageUncategorizedTag >> packageTag [ ^ packageTag ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderPackageUncategorizedTag >> packageTag: aRPackageTag [ packageTag := aRPackageTag. ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderPackageUncategorizedTag >> packageTagName [ ^ self packageTag name diff --git a/src/GToolkit-Coder/GtCoderPackageUnregistered.class.st b/src/GToolkit-Coder/GtCoderPackageUnregistered.class.st index ac17fe304..b81d0b806 100644 --- a/src/GToolkit-Coder/GtCoderPackageUnregistered.class.st +++ b/src/GToolkit-Coder/GtCoderPackageUnregistered.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtCoderPackageUnregistered, - #superclass : #GtCoderAnnouncement, - #category : #'GToolkit-Coder-Event' + #name : 'GtCoderPackageUnregistered', + #superclass : 'GtCoderAnnouncement', + #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCoderPackageUpdatedAnnouncement.class.st b/src/GToolkit-Coder/GtCoderPackageUpdatedAnnouncement.class.st index f0311324f..0b59cac93 100644 --- a/src/GToolkit-Coder/GtCoderPackageUpdatedAnnouncement.class.st +++ b/src/GToolkit-Coder/GtCoderPackageUpdatedAnnouncement.class.st @@ -4,20 +4,20 @@ I am sent by the {{gtClass:GtBehaviorCoder}} when the current package changes (m " Class { - #name : #GtCoderPackageUpdatedAnnouncement, - #superclass : #Announcement, + #name : 'GtCoderPackageUpdatedAnnouncement', + #superclass : 'Announcement', #instVars : [ 'package' ], - #category : #'GToolkit-Coder-Announcements' + #category : 'GToolkit-Coder-Announcements' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderPackageUpdatedAnnouncement >> package [ ^ package ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderPackageUpdatedAnnouncement >> package: aRPackage [ package := aRPackage ] diff --git a/src/GToolkit-Coder/GtCoderParseError.class.st b/src/GToolkit-Coder/GtCoderParseError.class.st index 299047425..c57cceb73 100644 --- a/src/GToolkit-Coder/GtCoderParseError.class.st +++ b/src/GToolkit-Coder/GtCoderParseError.class.st @@ -1,29 +1,29 @@ Class { - #name : #GtCoderParseError, - #superclass : #GtSourceCoderAnnouncement, + #name : 'GtCoderParseError', + #superclass : 'GtSourceCoderAnnouncement', #instVars : [ 'errorMessage', 'location' ], - #category : #'GToolkit-Coder-Event' + #category : 'GToolkit-Coder-Event' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderParseError >> errorMessage [ ^ errorMessage ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderParseError >> errorMessage: anObject [ errorMessage := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderParseError >> location [ ^ location ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderParseError >> location: anObject [ location := anObject ] diff --git a/src/GToolkit-Coder/GtCoderPrintAnnouncement.class.st b/src/GToolkit-Coder/GtCoderPrintAnnouncement.class.st index 76c508c8d..d7709d682 100644 --- a/src/GToolkit-Coder/GtCoderPrintAnnouncement.class.st +++ b/src/GToolkit-Coder/GtCoderPrintAnnouncement.class.st @@ -1,20 +1,20 @@ Class { - #name : #GtCoderPrintAnnouncement, - #superclass : #GtSourceCoderAnnouncement, + #name : 'GtCoderPrintAnnouncement', + #superclass : 'GtSourceCoderAnnouncement', #instVars : [ 'evaluationResult' ], - #category : #'GToolkit-Coder-Event' + #category : 'GToolkit-Coder-Event' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderPrintAnnouncement >> evaluationResult [ ^ evaluationResult ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderPrintAnnouncement >> evaluationResult: aGtSourceCoderEvaluationResult [ evaluationResult := aGtSourceCoderEvaluationResult ] diff --git a/src/GToolkit-Coder/GtCoderRefreshStackAnnouncement.class.st b/src/GToolkit-Coder/GtCoderRefreshStackAnnouncement.class.st index 2dfa11471..86aeadd4f 100644 --- a/src/GToolkit-Coder/GtCoderRefreshStackAnnouncement.class.st +++ b/src/GToolkit-Coder/GtCoderRefreshStackAnnouncement.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtCoderRefreshStackAnnouncement, - #superclass : #Announcement, - #category : #'GToolkit-Coder-Announcements' + #name : 'GtCoderRefreshStackAnnouncement', + #superclass : 'Announcement', + #category : 'GToolkit-Coder-Announcements' } diff --git a/src/GToolkit-Coder/GtCoderRenameMethodChange.class.st b/src/GToolkit-Coder/GtCoderRenameMethodChange.class.st index 55ea677c0..8a56dc522 100644 --- a/src/GToolkit-Coder/GtCoderRenameMethodChange.class.st +++ b/src/GToolkit-Coder/GtCoderRenameMethodChange.class.st @@ -1,15 +1,15 @@ Class { - #name : #GtCoderRenameMethodChange, - #superclass : #RBRefactoryChange, + #name : 'GtCoderRenameMethodChange', + #superclass : 'RBRefactoryChange', #instVars : [ 'methodCoder', 'newSelector', 'oldSelector' ], - #category : #'GToolkit-Coder-Refactoring' + #category : 'GToolkit-Coder-Refactoring' } -{ #category : #private } +{ #category : 'private' } GtCoderRenameMethodChange >> executeNotifying: aBlock [ | undo | undo := self class new @@ -25,42 +25,42 @@ GtCoderRenameMethodChange >> executeNotifying: aBlock [ ^ undo ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderRenameMethodChange >> methodCoder [ ^ methodCoder ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderRenameMethodChange >> methodCoder: anObject [ methodCoder := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderRenameMethodChange >> newSelector [ ^ newSelector ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderRenameMethodChange >> newSelector: anObject [ newSelector := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderRenameMethodChange >> oldSelector [ ^ oldSelector ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderRenameMethodChange >> oldSelector: anObject [ oldSelector := anObject ] -{ #category : #private } +{ #category : 'private' } GtCoderRenameMethodChange >> primitiveExecute [ methodCoder selector: self newSelector ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderRenameMethodChange >> renameChangesForClass: oldClassName to: newClassName [ ] diff --git a/src/GToolkit-Coder/GtCoderRenameMethodRefactoring.class.st b/src/GToolkit-Coder/GtCoderRenameMethodRefactoring.class.st index ea923009c..b6fb1d6da 100644 --- a/src/GToolkit-Coder/GtCoderRenameMethodRefactoring.class.st +++ b/src/GToolkit-Coder/GtCoderRenameMethodRefactoring.class.st @@ -1,23 +1,23 @@ Class { - #name : #GtCoderRenameMethodRefactoring, - #superclass : #RBRenameMethodRefactoring, + #name : 'GtCoderRenameMethodRefactoring', + #superclass : 'RBRenameMethodRefactoring', #instVars : [ 'methodCoder' ], - #category : #'GToolkit-Coder-Refactoring' + #category : 'GToolkit-Coder-Refactoring' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderRenameMethodRefactoring >> methodCoder [ ^ methodCoder ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderRenameMethodRefactoring >> methodCoder: anObject [ methodCoder := anObject ] -{ #category : #transforming } +{ #category : 'transforming' } GtCoderRenameMethodRefactoring >> transform [ self changes addChange: (GtCoderRenameMethodChange new methodCoder: self methodCoder; diff --git a/src/GToolkit-Coder/GtCoderRequestFocus.class.st b/src/GToolkit-Coder/GtCoderRequestFocus.class.st index efb23f800..1e44404fe 100644 --- a/src/GToolkit-Coder/GtCoderRequestFocus.class.st +++ b/src/GToolkit-Coder/GtCoderRequestFocus.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtCoderRequestFocus, - #superclass : #GtCoderAnnouncement, - #category : #'GToolkit-Coder-Event' + #name : 'GtCoderRequestFocus', + #superclass : 'GtCoderAnnouncement', + #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCoderShowDebuggerRequest.class.st b/src/GToolkit-Coder/GtCoderShowDebuggerRequest.class.st index 595cf3c98..71283ae0b 100644 --- a/src/GToolkit-Coder/GtCoderShowDebuggerRequest.class.st +++ b/src/GToolkit-Coder/GtCoderShowDebuggerRequest.class.st @@ -1,51 +1,51 @@ Class { - #name : #GtCoderShowDebuggerRequest, - #superclass : #GtSourceCoderAnnouncement, + #name : 'GtCoderShowDebuggerRequest', + #superclass : 'GtSourceCoderAnnouncement', #instVars : [ 'debugSession', 'exception', 'sourceString', 'sourceInterval' ], - #category : #'GToolkit-Coder-Event' + #category : 'GToolkit-Coder-Event' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderShowDebuggerRequest >> debugSession [ ^ debugSession ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderShowDebuggerRequest >> debugSession: anObject [ debugSession := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderShowDebuggerRequest >> exception [ ^ exception ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderShowDebuggerRequest >> exception: anObject [ exception := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderShowDebuggerRequest >> sourceInterval [ ^ sourceInterval ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderShowDebuggerRequest >> sourceInterval: anObject [ sourceInterval := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderShowDebuggerRequest >> sourceString [ ^ sourceString ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderShowDebuggerRequest >> sourceString: anObject [ sourceString := anObject ] diff --git a/src/GToolkit-Coder/GtCoderSourceCode.class.st b/src/GToolkit-Coder/GtCoderSourceCode.class.st index 1b8c25438..f46ce0cd4 100644 --- a/src/GToolkit-Coder/GtCoderSourceCode.class.st +++ b/src/GToolkit-Coder/GtCoderSourceCode.class.st @@ -4,94 +4,94 @@ I represent a source code of the {{gtClass:GtSourceCoder}}. For performance reas " Class { - #name : #GtCoderSourceCode, - #superclass : #Object, + #name : 'GtCoderSourceCode', + #superclass : 'Object', #instVars : [ 'monitor', 'sourceText', 'collapsedText' ], - #category : #'GToolkit-Coder-Coders' + #category : 'GToolkit-Coder-Coders' } -{ #category : #'api - text' } +{ #category : 'api - text' } GtCoderSourceCode >> appendString: aString [ self critical: [ self sourceText appendString: aString ] ] -{ #category : #'api - text' } +{ #category : 'api - text' } GtCoderSourceCode >> appendText: aText [ self critical: [ self sourceText append: aText ] ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderSourceCode >> asAstCacheKey [ ^ self subclassResponsibility ] -{ #category : #'api - converting' } +{ #category : 'api - converting' } GtCoderSourceCode >> asCompiledMethodSourceCode: aCompiledMethod [ ^ (GtCoderCompiledMethodSourceCode new fromSourceCode: self) compiledMethod: aCompiledMethod ] -{ #category : #'api - converting' } +{ #category : 'api - converting' } GtCoderSourceCode >> asExplicitSourceCode: aString [ ^ (GtCoderExplicitSourceCode new fromSourceCode: self) source: aString ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderSourceCode >> buildCollapsedText [ ^ self subclassResponsibility ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderSourceCode >> buildSourceText [ ^ self subclassResponsibility ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderSourceCode >> collapsedText [ ^ self critical: [ collapsedText ifNil: [ collapsedText := self buildCollapsedText ] ] ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderSourceCode >> collapsedTextDo: aBlock [ "Evaluate a given block with my source code if present" ^ self critical: [ collapsedText ifNotNil: aBlock ] ] -{ #category : #'mutual exclusion' } +{ #category : 'mutual exclusion' } GtCoderSourceCode >> critical: aBlock [ ^ monitor critical: aBlock ] -{ #category : #'api - text' } +{ #category : 'api - text' } GtCoderSourceCode >> currentSourceString: aString [ "Set a new source text" self critical: [ sourceText := aString asRopedText ] ] -{ #category : #'api - text' } +{ #category : 'api - text' } GtCoderSourceCode >> currentSourceText: aText [ "Set a new source text" self critical: [ sourceText := aText copyWithoutExternalReferences ] ] -{ #category : #'api - text' } +{ #category : 'api - text' } GtCoderSourceCode >> delete: aFromIndex to: aToIndex [ self sourceTextDo: [ :aText | aText delete: aFromIndex to: aToIndex ] ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderSourceCode >> fromSourceCode: aGtCoderSourceCode [ sourceText := nil. collapsedText := nil. @@ -100,52 +100,52 @@ GtCoderSourceCode >> fromSourceCode: aGtCoderSourceCode [ aGtCoderSourceCode collapsedTextDo: [ :aCollapsedText | collapsedText := aCollapsedText ]. ] -{ #category : #'api - testing' } +{ #category : 'api - testing' } GtCoderSourceCode >> hasCollapsedText [ ^ self critical: [ collapsedText notNil ] ] -{ #category : #'api - testing' } +{ #category : 'api - testing' } GtCoderSourceCode >> hasSourceText [ ^ self critical: [ sourceText notNil ] ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderSourceCode >> initialize [ super initialize. monitor := Monitor new ] -{ #category : #'api - testing' } +{ #category : 'api - testing' } GtCoderSourceCode >> isModified [ ^ self subclassResponsibility ] -{ #category : #'api - text' } +{ #category : 'api - text' } GtCoderSourceCode >> replaceFrom: aFromIndex to: aToIndex withString: aString [ self critical: [ self sourceText replace: aFromIndex to: aToIndex withString: aString ] ] -{ #category : #'api - text' } +{ #category : 'api - text' } GtCoderSourceCode >> resetCollapsedText [ "Remove the cached collapsed text forcing it to be recomputed next time it is accessed" collapsedText := nil ] -{ #category : #'api - text' } +{ #category : 'api - text' } GtCoderSourceCode >> resetSourceText [ "Remove the cached source text forcing it to be recomputed next time it is accessed" sourceText := nil ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderSourceCode >> sourceString [ "Return a string representation of the current source text" @@ -153,19 +153,19 @@ GtCoderSourceCode >> sourceString [ ^ self critical: [ self sourceText asString ] ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderSourceCode >> sourceText [ ^ self critical: [ sourceText ifNil: [ sourceText := self buildSourceText ] ] ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderSourceCode >> sourceText: aText [ self critical: [ sourceText := aText copyWithoutExternalReferences ] ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderSourceCode >> sourceTextDo: aBlock [ "Evaluate a given block with my source code if present" diff --git a/src/GToolkit-Coder/GtCoderSourceCodeChanged.class.st b/src/GToolkit-Coder/GtCoderSourceCodeChanged.class.st index 2b321f019..65c8100ac 100644 --- a/src/GToolkit-Coder/GtCoderSourceCodeChanged.class.st +++ b/src/GToolkit-Coder/GtCoderSourceCodeChanged.class.st @@ -4,31 +4,31 @@ Is sent when coder's source code changes " Class { - #name : #GtCoderSourceCodeChanged, - #superclass : #GtSourceCoderAnnouncement, + #name : 'GtCoderSourceCodeChanged', + #superclass : 'GtSourceCoderAnnouncement', #instVars : [ 'updateStragegy' ], - #category : #'GToolkit-Coder-Event' + #category : 'GToolkit-Coder-Event' } -{ #category : #testing } +{ #category : 'testing' } GtCoderSourceCodeChanged >> isSynchronous [ ^ self updateStrategy notNil and: [ self updateStrategy isSynchronous ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderSourceCodeChanged >> source [ ^ self updateStrategy source ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderSourceCodeChanged >> updateStrategy [ ^ updateStragegy ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderSourceCodeChanged >> updateStrategy: anUpdateStragegy [ updateStragegy := anUpdateStragegy ] diff --git a/src/GToolkit-Coder/GtCoderStyleTextRequest.class.st b/src/GToolkit-Coder/GtCoderStyleTextRequest.class.st index f5eebb66e..46158f28c 100644 --- a/src/GToolkit-Coder/GtCoderStyleTextRequest.class.st +++ b/src/GToolkit-Coder/GtCoderStyleTextRequest.class.st @@ -5,20 +5,20 @@ One of the usecases is to restyle the text after execution of a `gtExample` " Class { - #name : #GtCoderStyleTextRequest, - #superclass : #GtSourceCoderAnnouncement, + #name : 'GtCoderStyleTextRequest', + #superclass : 'GtSourceCoderAnnouncement', #instVars : [ 'afterAction' ], - #category : #'GToolkit-Coder-Event' + #category : 'GToolkit-Coder-Event' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderStyleTextRequest >> afterAction [ ^ afterAction ifNil: [ [ :aStyleText | "do nothing" ] ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderStyleTextRequest >> afterAction: aBlock [ afterAction := aBlock ] diff --git a/src/GToolkit-Coder/GtCoderStylerChanged.class.st b/src/GToolkit-Coder/GtCoderStylerChanged.class.st index 2eb792f81..06a2d9c34 100644 --- a/src/GToolkit-Coder/GtCoderStylerChanged.class.st +++ b/src/GToolkit-Coder/GtCoderStylerChanged.class.st @@ -7,20 +7,20 @@ Is announced by the {{gtClass:GtCoderModel}} when stylers change. " Class { - #name : #GtCoderStylerChanged, - #superclass : #GtSourceCoderAnnouncement, + #name : 'GtCoderStylerChanged', + #superclass : 'GtSourceCoderAnnouncement', #instVars : [ 'stylers' ], - #category : #'GToolkit-Coder-Event' + #category : 'GToolkit-Coder-Event' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderStylerChanged >> stylers [ ^ stylers ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderStylerChanged >> stylers: anObject [ stylers := anObject ] diff --git a/src/GToolkit-Coder/GtCoderToolSpawnRequest.class.st b/src/GToolkit-Coder/GtCoderToolSpawnRequest.class.st index 3a372ebe5..d33c0db17 100644 --- a/src/GToolkit-Coder/GtCoderToolSpawnRequest.class.st +++ b/src/GToolkit-Coder/GtCoderToolSpawnRequest.class.st @@ -1,29 +1,29 @@ Class { - #name : #GtCoderToolSpawnRequest, - #superclass : #GtSourceCoderAnnouncement, + #name : 'GtCoderToolSpawnRequest', + #superclass : 'GtSourceCoderAnnouncement', #instVars : [ 'tool', 'spawnDestination' ], - #category : #'GToolkit-Coder-Event' + #category : 'GToolkit-Coder-Event' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderToolSpawnRequest >> spawnDestination [ ^ spawnDestination ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderToolSpawnRequest >> spawnDestination: anObject [ spawnDestination := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderToolSpawnRequest >> tool [ ^ tool ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderToolSpawnRequest >> tool: anObject [ tool := anObject ] diff --git a/src/GToolkit-Coder/GtCoderUpdateStrategy.class.st b/src/GToolkit-Coder/GtCoderUpdateStrategy.class.st index 9170c07f9..e1da74298 100644 --- a/src/GToolkit-Coder/GtCoderUpdateStrategy.class.st +++ b/src/GToolkit-Coder/GtCoderUpdateStrategy.class.st @@ -6,41 +6,41 @@ Currently I indicate if code should be changed syncronously or asyncronously. " Class { - #name : #GtCoderUpdateStrategy, - #superclass : #Object, + #name : 'GtCoderUpdateStrategy', + #superclass : 'Object', #instVars : [ 'announcementSource', 'isSynchronous' ], - #category : #'GToolkit-Coder-Coders' + #category : 'GToolkit-Coder-Coders' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderUpdateStrategy >> isSynchronous [ ^ isSynchronous ifNil: [ false ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderUpdateStrategy >> isSynchronous: anObject [ isSynchronous := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderUpdateStrategy >> makeAsynchronous [ isSynchronous := false ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderUpdateStrategy >> makeSynchronous [ isSynchronous := true ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderUpdateStrategy >> source [ ^ announcementSource ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderUpdateStrategy >> source: anObject [ announcementSource := anObject ] diff --git a/src/GToolkit-Coder/GtCodersAnnouncement.class.st b/src/GToolkit-Coder/GtCodersAnnouncement.class.st index cd812c184..5375266d8 100644 --- a/src/GToolkit-Coder/GtCodersAnnouncement.class.st +++ b/src/GToolkit-Coder/GtCodersAnnouncement.class.st @@ -1,29 +1,29 @@ Class { - #name : #GtCodersAnnouncement, - #superclass : #Announcement, + #name : 'GtCodersAnnouncement', + #superclass : 'Announcement', #instVars : [ 'coders', 'source' ], - #category : #'GToolkit-Coder-Event' + #category : 'GToolkit-Coder-Event' } -{ #category : #accessing } +{ #category : 'accessing' } GtCodersAnnouncement >> coders [ ^ coders ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodersAnnouncement >> coders: anObject [ coders := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodersAnnouncement >> source [ ^ source ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodersAnnouncement >> source: anObject [ source := anObject ] diff --git a/src/GToolkit-Coder/GtCodersCoderAdded.class.st b/src/GToolkit-Coder/GtCodersCoderAdded.class.st index 42d8d68dd..d833e5523 100644 --- a/src/GToolkit-Coder/GtCodersCoderAdded.class.st +++ b/src/GToolkit-Coder/GtCodersCoderAdded.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtCodersCoderAdded, - #superclass : #GtCodersCoderAnnouncement, - #category : #'GToolkit-Coder-Event' + #name : 'GtCodersCoderAdded', + #superclass : 'GtCodersCoderAnnouncement', + #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCodersCoderAnnouncement.class.st b/src/GToolkit-Coder/GtCodersCoderAnnouncement.class.st index 087c95865..1677998ce 100644 --- a/src/GToolkit-Coder/GtCodersCoderAnnouncement.class.st +++ b/src/GToolkit-Coder/GtCodersCoderAnnouncement.class.st @@ -1,18 +1,18 @@ Class { - #name : #GtCodersCoderAnnouncement, - #superclass : #GtCodersAnnouncement, + #name : 'GtCodersCoderAnnouncement', + #superclass : 'GtCodersAnnouncement', #instVars : [ 'coder' ], - #category : #'GToolkit-Coder-Event' + #category : 'GToolkit-Coder-Event' } -{ #category : #accessing } +{ #category : 'accessing' } GtCodersCoderAnnouncement >> coder [ ^ coder ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodersCoderAnnouncement >> coder: anObject [ coder := anObject ] diff --git a/src/GToolkit-Coder/GtCodersCoderRemoved.class.st b/src/GToolkit-Coder/GtCodersCoderRemoved.class.st index a3f6127a7..da15d1598 100644 --- a/src/GToolkit-Coder/GtCodersCoderRemoved.class.st +++ b/src/GToolkit-Coder/GtCodersCoderRemoved.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtCodersCoderRemoved, - #superclass : #GtCodersCoderAnnouncement, - #category : #'GToolkit-Coder-Event' + #name : 'GtCodersCoderRemoved', + #superclass : 'GtCodersCoderAnnouncement', + #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCodersCodersChanged.class.st b/src/GToolkit-Coder/GtCodersCodersChanged.class.st index fc8549497..2711eb767 100644 --- a/src/GToolkit-Coder/GtCodersCodersChanged.class.st +++ b/src/GToolkit-Coder/GtCodersCodersChanged.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtCodersCodersChanged, - #superclass : #GtCodersAnnouncement, - #category : #'GToolkit-Coder-Event' + #name : 'GtCodersCodersChanged', + #superclass : 'GtCodersAnnouncement', + #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCodersFiltersChanged.class.st b/src/GToolkit-Coder/GtCodersFiltersChanged.class.st index 65d15223b..a5069f423 100644 --- a/src/GToolkit-Coder/GtCodersFiltersChanged.class.st +++ b/src/GToolkit-Coder/GtCodersFiltersChanged.class.st @@ -1,23 +1,23 @@ Class { - #name : #GtCodersFiltersChanged, - #superclass : #GtCodersAnnouncement, + #name : 'GtCodersFiltersChanged', + #superclass : 'GtCodersAnnouncement', #instVars : [ 'filters' ], - #category : #'GToolkit-Coder-Event' + #category : 'GToolkit-Coder-Event' } -{ #category : #accessing } +{ #category : 'accessing' } GtCodersFiltersChanged >> filters [ ^ filters ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodersFiltersChanged >> filters: anObject [ filters := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodersFiltersChanged >> gtFiltesFor: aView [ self filters ifNil: [ ^ aView empty ]. diff --git a/src/GToolkit-Coder/GtCodersModel.class.st b/src/GToolkit-Coder/GtCodersModel.class.st index 7f49bb960..8ad7887ea 100644 --- a/src/GToolkit-Coder/GtCodersModel.class.st +++ b/src/GToolkit-Coder/GtCodersModel.class.st @@ -1,6 +1,6 @@ Class { - #name : #GtCodersModel, - #superclass : #Object, + #name : 'GtCodersModel', + #superclass : 'Object', #traits : 'TGtAnnouncer + TGtOptions', #classTraits : 'TGtAnnouncer classTrait + TGtOptions classTrait', #instVars : [ @@ -8,52 +8,52 @@ Class { 'items', 'coders' ], - #category : #'GToolkit-Coder-Coders' + #category : 'GToolkit-Coder-Coders' } -{ #category : #'initialize-release' } +{ #category : 'initialize-release' } GtCodersModel class >> forItems: aCollection [ ^ self new forItems: aCollection; yourself ] -{ #category : #'private - adding / removing' } +{ #category : 'private - adding / removing' } GtCodersModel >> addCoder: aCoder [ coders add: aCoder. self subscribeToCoder: aCoder. self notifyCoderAdded: aCoder. ] -{ #category : #'private - adding / removing' } +{ #category : 'private - adding / removing' } GtCodersModel >> addFirstCoder: aCoder [ coders addFirst: aCoder. self subscribeToCoder: aCoder. self notifyCoderAdded: aCoder ] -{ #category : #announcer } +{ #category : 'announcer' } GtCodersModel >> announcer [ ^ announcer ifNil: [ announcer := Announcer new ] ] -{ #category : #testing } +{ #category : 'testing' } GtCodersModel >> canFilter [ ^ false ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodersModel >> coders [ ^ coders ] -{ #category : #'initialize-release' } +{ #category : 'initialize-release' } GtCodersModel >> forItems: aCollection [ items := aCollection. coders := items collect: [ :each | self newCoderFor: each ] ] -{ #category : #ui } +{ #category : 'ui' } GtCodersModel >> gtLiveFor: aView [ ^ aView explicit @@ -62,59 +62,59 @@ GtCodersModel >> gtLiveFor: aView [ stencil: [ self ] ] -{ #category : #'initialize-release' } +{ #category : 'initialize-release' } GtCodersModel >> initialize [ super initialize. coders := #(). items := #() ] -{ #category : #private } +{ #category : 'private' } GtCodersModel >> newCoderFor: anObject [ self subclassResponsibility ] -{ #category : #'private - notifying' } +{ #category : 'private - notifying' } GtCodersModel >> notifyCoderAdded: aCoder [ self announce: (GtCodersCoderAdded new coders: self; coder: aCoder) ] -{ #category : #'private - notifying' } +{ #category : 'private - notifying' } GtCodersModel >> notifyCoderRemoved: aCoder [ self announce: (GtCodersCoderRemoved new coders: self; coder: aCoder) ] -{ #category : #'private - adding / removing' } +{ #category : 'private - adding / removing' } GtCodersModel >> removeCoder: aCoder [ self unsubscribeFromCoder: aCoder. coders remove: aCoder ifAbsent: [ ^ self ]. self notifyCoderRemoved: aCoder ] -{ #category : #'private - subscriptions' } +{ #category : 'private - subscriptions' } GtCodersModel >> subscribeToCoder: eachCoder [ ] -{ #category : #'private - subscriptions' } +{ #category : 'private - subscriptions' } GtCodersModel >> subscribeToSystem [ "do nothing" ] -{ #category : #'private - subscriptions' } +{ #category : 'private - subscriptions' } GtCodersModel >> unsubscribeFromCoder: aCoder [ aCoder unsubscribe: self ] -{ #category : #'private - subscriptions' } +{ #category : 'private - subscriptions' } GtCodersModel >> unsubscribeFromSystem [ SystemAnnouncer uniqueInstance unsubscribe: self ] -{ #category : #updating } +{ #category : 'updating' } GtCodersModel >> updateCoders [ coders := items collect: [ :each | self newCoderFor: each ]. self diff --git a/src/GToolkit-Coder/GtCodersScrollToCoder.class.st b/src/GToolkit-Coder/GtCodersScrollToCoder.class.st index 94a95b6c9..2f4b6e97d 100644 --- a/src/GToolkit-Coder/GtCodersScrollToCoder.class.st +++ b/src/GToolkit-Coder/GtCodersScrollToCoder.class.st @@ -1,18 +1,18 @@ Class { - #name : #GtCodersScrollToCoder, - #superclass : #GtCodersAnnouncement, + #name : 'GtCodersScrollToCoder', + #superclass : 'GtCodersAnnouncement', #instVars : [ 'sourceCoder' ], - #category : #'GToolkit-Coder-Event' + #category : 'GToolkit-Coder-Event' } -{ #category : #accessing } +{ #category : 'accessing' } GtCodersScrollToCoder >> sourceCoder [ ^ sourceCoder ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodersScrollToCoder >> sourceCoder: anObject [ sourceCoder := anObject ] diff --git a/src/GToolkit-Coder/GtCompositeHighlighter.class.st b/src/GToolkit-Coder/GtCompositeHighlighter.class.st index 0e9626aae..0f28c0cc8 100644 --- a/src/GToolkit-Coder/GtCompositeHighlighter.class.st +++ b/src/GToolkit-Coder/GtCompositeHighlighter.class.st @@ -1,25 +1,25 @@ Class { - #name : #GtCompositeHighlighter, - #superclass : #GtSourceReferenceHighlighter, + #name : 'GtCompositeHighlighter', + #superclass : 'GtSourceReferenceHighlighter', #instVars : [ 'highlighters' ], - #category : #'GToolkit-Coder-Styler/Highlighter' + #category : 'GToolkit-Coder-Styler/Highlighter' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtCompositeHighlighter class >> forHighlighters: aCollection [ ^ self new forHighlighters: aCollection; yourself ] -{ #category : #'initialize-release' } +{ #category : 'initialize-release' } GtCompositeHighlighter >> forHighlighters: aCollection [ highlighters := aCollection ] -{ #category : #styling } +{ #category : 'styling' } GtCompositeHighlighter >> style: aText ast: ast [ highlighters do: [ :each | each style: aText ast: ast ] ] diff --git a/src/GToolkit-Coder/GtDebugContext.class.st b/src/GToolkit-Coder/GtDebugContext.class.st index eabaacce3..98e36befb 100644 --- a/src/GToolkit-Coder/GtDebugContext.class.st +++ b/src/GToolkit-Coder/GtDebugContext.class.st @@ -1,31 +1,31 @@ Class { - #name : #GtDebugContext, - #superclass : #DebugContext, - #category : #'GToolkit-Coder' + #name : 'GtDebugContext', + #superclass : 'DebugContext', + #category : 'GToolkit-Coder' } -{ #category : #private } +{ #category : 'private' } GtDebugContext >> blockNotFoundDialog: aMethod with: aText [ aMethod selector isDoIt ifTrue: [ "shouldn't edit doits" ^ self ]. self recompileCurrentMethodTo: aText notifying: nil ] -{ #category : #private } +{ #category : 'private' } GtDebugContext >> checkSelectorUnchanged: aSelector [ ^ aSelector == self selectedMessageName or: [ self selectedMessageName isDoIt and: [ aSelector numArgs = self selectedMessageName numArgs ] ] ] -{ #category : #private } +{ #category : 'private' } GtDebugContext >> confirmOnTraitOverwrite: aSelector inClass: aClass [ | method | method := aClass methodNamed: aSelector. ^ method origin ] -{ #category : #accessing } +{ #category : 'accessing' } GtDebugContext >> locateClosureHomeWithContent: aText [ context isBlockContext ifTrue: [ ^ context activeHome diff --git a/src/GToolkit-Coder/GtFilterExampleAllState.class.st b/src/GToolkit-Coder/GtFilterExampleAllState.class.st index 484a09f77..cbff7ffd4 100644 --- a/src/GToolkit-Coder/GtFilterExampleAllState.class.st +++ b/src/GToolkit-Coder/GtFilterExampleAllState.class.st @@ -1,30 +1,30 @@ Class { - #name : #GtFilterExampleAllState, - #superclass : #GtFilterExampleState, - #category : #'GToolkit-Coder-Filters - Support' + #name : 'GtFilterExampleAllState', + #superclass : 'GtFilterExampleState', + #category : 'GToolkit-Coder-Filters - Support' } -{ #category : #'api - testing' } +{ #category : 'api - testing' } GtFilterExampleAllState >> includesCoder: aCoder [ ^ aCoder example isNotNil ] -{ #category : #'api - testing' } +{ #category : 'api - testing' } GtFilterExampleAllState >> isStatusFor: aGtExampleWithResult [ ^ false ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtFilterExampleAllState >> label [ ^ 'All' ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtFilterExampleAllState >> numberOfExamplesFor: anExampler [ ^ anExampler numberOfAllExamples ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtFilterExampleAllState >> order [ ^ 1 ] diff --git a/src/GToolkit-Coder/GtFilterExampleErrorState.class.st b/src/GToolkit-Coder/GtFilterExampleErrorState.class.st index baa501f6f..cdd44160a 100644 --- a/src/GToolkit-Coder/GtFilterExampleErrorState.class.st +++ b/src/GToolkit-Coder/GtFilterExampleErrorState.class.st @@ -1,39 +1,39 @@ Class { - #name : #GtFilterExampleErrorState, - #superclass : #GtFilterExampleState, - #category : #'GToolkit-Coder-Filters - Support' + #name : 'GtFilterExampleErrorState', + #superclass : 'GtFilterExampleState', + #category : 'GToolkit-Coder-Filters - Support' } -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtFilterExampleErrorState >> color [ ^ BrGlamorousColors errorBackgroundColor ] -{ #category : #'api - testing' } +{ #category : 'api - testing' } GtFilterExampleErrorState >> includesCoder: aCoder [ ^ aCoder canExecuteExample and: [ aCoder exampleResult isNotNil and: [ aCoder exampleResult isError ] ] ] -{ #category : #'api - testing' } +{ #category : 'api - testing' } GtFilterExampleErrorState >> isStatusFor: aGtExampleWithResult [ ^ aGtExampleWithResult isNotNil and: [ aGtExampleWithResult hasResult and: [ aGtExampleWithResult isError ] ] ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtFilterExampleErrorState >> label [ ^ 'Error' ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtFilterExampleErrorState >> numberOfExamplesFor: anExampler [ ^ anExampler numberOfErrorExamples ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtFilterExampleErrorState >> order [ ^ 4 ] diff --git a/src/GToolkit-Coder/GtFilterExampleFailureState.class.st b/src/GToolkit-Coder/GtFilterExampleFailureState.class.st index ff48b9e0e..433f0377b 100644 --- a/src/GToolkit-Coder/GtFilterExampleFailureState.class.st +++ b/src/GToolkit-Coder/GtFilterExampleFailureState.class.st @@ -1,39 +1,39 @@ Class { - #name : #GtFilterExampleFailureState, - #superclass : #GtFilterExampleState, - #category : #'GToolkit-Coder-Filters - Support' + #name : 'GtFilterExampleFailureState', + #superclass : 'GtFilterExampleState', + #category : 'GToolkit-Coder-Filters - Support' } -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtFilterExampleFailureState >> color [ ^ BrGlamorousColors failureBackgroundColor ] -{ #category : #'api - testing' } +{ #category : 'api - testing' } GtFilterExampleFailureState >> includesCoder: aCoder [ ^ aCoder canExecuteExample and: [ aCoder exampleResult isNotNil and: [ aCoder exampleResult isFailure ] ] ] -{ #category : #'api - testing' } +{ #category : 'api - testing' } GtFilterExampleFailureState >> isStatusFor: aGtExampleWithResult [ ^ aGtExampleWithResult isNotNil and: [ aGtExampleWithResult hasResult and: [ aGtExampleWithResult isFailure ] ] ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtFilterExampleFailureState >> label [ ^ 'Failure' ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtFilterExampleFailureState >> numberOfExamplesFor: anExampler [ ^ anExampler numberOfFailureExamples ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtFilterExampleFailureState >> order [ ^ 3 ] diff --git a/src/GToolkit-Coder/GtFilterExampleNotExecutedState.class.st b/src/GToolkit-Coder/GtFilterExampleNotExecutedState.class.st index 2540d0e47..071d08d74 100644 --- a/src/GToolkit-Coder/GtFilterExampleNotExecutedState.class.st +++ b/src/GToolkit-Coder/GtFilterExampleNotExecutedState.class.st @@ -1,36 +1,36 @@ Class { - #name : #GtFilterExampleNotExecutedState, - #superclass : #GtFilterExampleState, - #category : #'GToolkit-Coder-Filters - Support' + #name : 'GtFilterExampleNotExecutedState', + #superclass : 'GtFilterExampleState', + #category : 'GToolkit-Coder-Filters - Support' } -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtFilterExampleNotExecutedState >> color [ ^ BrGlamorousColors neutralBackgroundColor ] -{ #category : #'api - testing' } +{ #category : 'api - testing' } GtFilterExampleNotExecutedState >> includesCoder: aCoder [ ^ aCoder exampleResult isNil ] -{ #category : #'api - testing' } +{ #category : 'api - testing' } GtFilterExampleNotExecutedState >> isStatusFor: aGtExampleWithResult [ ^ aGtExampleWithResult isNotNil and: [ aGtExampleWithResult hasResult not ] ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtFilterExampleNotExecutedState >> label [ ^ 'Not Executed' ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtFilterExampleNotExecutedState >> numberOfExamplesFor: anExampler [ ^ anExampler numberOfNotExecutedExamples ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtFilterExampleNotExecutedState >> order [ ^ 5 ] diff --git a/src/GToolkit-Coder/GtFilterExampleState.class.st b/src/GToolkit-Coder/GtFilterExampleState.class.st index 179811c14..552d74d45 100644 --- a/src/GToolkit-Coder/GtFilterExampleState.class.st +++ b/src/GToolkit-Coder/GtFilterExampleState.class.st @@ -1,19 +1,19 @@ Class { - #name : #GtFilterExampleState, - #superclass : #Object, + #name : 'GtFilterExampleState', + #superclass : 'Object', #traits : 'TBlDebug + TGtUniqueInstance', #classTraits : 'TBlDebug classTrait + TGtUniqueInstance classTrait', - #category : #'GToolkit-Coder-Filters - Support' + #category : 'GToolkit-Coder-Filters - Support' } -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtFilterExampleState >> allLabels [ "Return all available labels" ^ self allStates collect: #label ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtFilterExampleState >> allStates [ | allInstances | allInstances := self class allSubclasses collect: #default. @@ -21,28 +21,28 @@ GtFilterExampleState >> allStates [ ^ allInstances ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtFilterExampleState >> color [ "Return a color that represents given state" ^ Color transparent ] -{ #category : #'api - testing' } +{ #category : 'api - testing' } GtFilterExampleState >> includesCoder: aCoder [ "Return true if a method filter should be displayed. Return false otherwise." ^ true ] -{ #category : #'api - testing' } +{ #category : 'api - testing' } GtFilterExampleState >> isStatusFor: aGtExampleWithResult [ "Return true if the status is equal to the example result status" ^ self subclassResponsibility ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtFilterExampleState >> label [ "Return a name that is used by ${class:GtSearchExamplesFilter}$ to display available example filters in ${class:GtFiltersElement}$." @@ -50,7 +50,7 @@ GtFilterExampleState >> label [ ^ self className ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtFilterExampleState >> labelWithAmountFor: anExampler [ | aTotal aTotalString aTotalText | @@ -61,13 +61,13 @@ GtFilterExampleState >> labelWithAmountFor: anExampler [ append: aTotalText. ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtFilterExampleState >> numberOfExamplesFor: anExampler [ "Return number of examples with a given state" ^ 0 ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtFilterExampleState >> order [ "Return a number that is used by ${class:GtSearchExamplesFilter}$ to display available example filters in ${class:GtFiltersElement}$ @@ -76,7 +76,7 @@ GtFilterExampleState >> order [ ^ 50 ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtFilterExampleState >> stateFromExample: aGtExampleWithResult [ aGtExampleWithResult ifNotNil: [ self allStates do: [ :eachStatus | @@ -85,7 +85,7 @@ GtFilterExampleState >> stateFromExample: aGtExampleWithResult [ ^ GtFilterExampleNotExecutedState default ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtFilterExampleState >> stateFromLabel: aLabel [ | aString | diff --git a/src/GToolkit-Coder/GtFilterExampleSuccessState.class.st b/src/GToolkit-Coder/GtFilterExampleSuccessState.class.st index c94d32a35..17319296b 100644 --- a/src/GToolkit-Coder/GtFilterExampleSuccessState.class.st +++ b/src/GToolkit-Coder/GtFilterExampleSuccessState.class.st @@ -1,39 +1,39 @@ Class { - #name : #GtFilterExampleSuccessState, - #superclass : #GtFilterExampleState, - #category : #'GToolkit-Coder-Filters - Support' + #name : 'GtFilterExampleSuccessState', + #superclass : 'GtFilterExampleState', + #category : 'GToolkit-Coder-Filters - Support' } -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtFilterExampleSuccessState >> color [ ^ BrGlamorousColors successBackgroundColor ] -{ #category : #'api - testing' } +{ #category : 'api - testing' } GtFilterExampleSuccessState >> includesCoder: aCoder [ ^ aCoder canExecuteExample and: [ aCoder exampleResult isNotNil and: [ aCoder exampleResult isSuccess ] ] ] -{ #category : #'api - testing' } +{ #category : 'api - testing' } GtFilterExampleSuccessState >> isStatusFor: aGtExampleWithResult [ ^ aGtExampleWithResult isNotNil and: [ aGtExampleWithResult hasResult and: [ aGtExampleWithResult isSuccess ] ] ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtFilterExampleSuccessState >> label [ ^ 'Success' ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtFilterExampleSuccessState >> numberOfExamplesFor: anExampler [ ^ anExampler numberOfSuccessExamples ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtFilterExampleSuccessState >> order [ ^ 2 ] diff --git a/src/GToolkit-Coder/GtMethodProtocolCompletionStrategy.class.st b/src/GToolkit-Coder/GtMethodProtocolCompletionStrategy.class.st index 0696b85af..a2affd066 100644 --- a/src/GToolkit-Coder/GtMethodProtocolCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtMethodProtocolCompletionStrategy.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtMethodProtocolCompletionStrategy, - #superclass : #GtStringsCompletionStrategy, - #category : #'GToolkit-Coder-Completion' + #name : 'GtMethodProtocolCompletionStrategy', + #superclass : 'GtStringsCompletionStrategy', + #category : 'GToolkit-Coder-Completion' } -{ #category : #private } +{ #category : 'private' } GtMethodProtocolCompletionStrategy >> buildCompletions [ | protocols | protocols := GtPrefixTree new. @@ -15,7 +15,7 @@ GtMethodProtocolCompletionStrategy >> buildCompletions [ ^ protocols ] -{ #category : #accessing } +{ #category : 'accessing' } GtMethodProtocolCompletionStrategy >> completionPrefixAt: anIndex in: blText [ anIndex < self minimumPrefixLength ifTrue: [ ^ nil ]. diff --git a/src/GToolkit-Coder/GtMethodsCoderExampler.class.st b/src/GToolkit-Coder/GtMethodsCoderExampler.class.st index c2dbc0dbc..bbc4760a7 100644 --- a/src/GToolkit-Coder/GtMethodsCoderExampler.class.st +++ b/src/GToolkit-Coder/GtMethodsCoderExampler.class.st @@ -5,25 +5,25 @@ I am used by {{gtClass:GtMethodsCoder}}, see: {{gtMethod:Behavior>>#gtCoderMetho " Class { - #name : #GtMethodsCoderExampler, - #superclass : #GtCoderExampler, - #category : #'GToolkit-Coder-Exampler' + #name : 'GtMethodsCoderExampler', + #superclass : 'GtCoderExampler', + #category : 'GToolkit-Coder-Exampler' } -{ #category : #'api - enumeration' } +{ #category : 'api - enumeration' } GtMethodsCoderExampler >> allExampleCodersDo: aBlock [ self coder allCoders do: [ :eachCoder | eachCoder example ifNotNil: [ :anExample | aBlock cull: eachCoder cull: anExample ] ] ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtMethodsCoderExampler >> coderFor: aCompiledMethod [ ^ self coder coderFor: aCompiledMethod ] -{ #category : #'api - enumeration' } +{ #category : 'api - enumeration' } GtMethodsCoderExampler >> selectedExampleCodersDo: aBlock [ self coder coders do: [ :eachCoder | eachCoder example ifNotNil: [ :anExample | diff --git a/src/GToolkit-Coder/GtPackageClassesCompletionStrategy.class.st b/src/GToolkit-Coder/GtPackageClassesCompletionStrategy.class.st index 1569823d6..e9fda664d 100644 --- a/src/GToolkit-Coder/GtPackageClassesCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtPackageClassesCompletionStrategy.class.st @@ -1,13 +1,13 @@ Class { - #name : #GtPackageClassesCompletionStrategy, - #superclass : #GtCompletionStrategy, + #name : 'GtPackageClassesCompletionStrategy', + #superclass : 'GtCompletionStrategy', #instVars : [ 'packageSearchString' ], - #category : #'GToolkit-Coder-Completion' + #category : 'GToolkit-Coder-Completion' } -{ #category : #accessing } +{ #category : 'accessing' } GtPackageClassesCompletionStrategy >> classesMatching: aString [ | classNamePattern matchedClasses | matchedClasses := Set new. @@ -19,7 +19,7 @@ GtPackageClassesCompletionStrategy >> classesMatching: aString [ ^ matchedClasses select: [ :each | classNamePattern match: each name ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtPackageClassesCompletionStrategy >> completionActionsFor: aText at: positionInteger max: maxInteger [ | string | string := aText asString. @@ -28,28 +28,28 @@ GtPackageClassesCompletionStrategy >> completionActionsFor: aText at: positionIn asSortedCollection: [ :a :b | a text < b text ] ] -{ #category : #testing } +{ #category : 'testing' } GtPackageClassesCompletionStrategy >> hasCompletionEntryFor: aString [ ^ true ] -{ #category : #testing } +{ #category : 'testing' } GtPackageClassesCompletionStrategy >> hasCompletionsAt: anInteger in: aText [ ^ true ] -{ #category : #'initialize-release' } +{ #category : 'initialize-release' } GtPackageClassesCompletionStrategy >> initialize [ super initialize. packageSearchString := '' ] -{ #category : #accessing } +{ #category : 'accessing' } GtPackageClassesCompletionStrategy >> packageSearchString [ ^ packageSearchString ] -{ #category : #accessing } +{ #category : 'accessing' } GtPackageClassesCompletionStrategy >> packageSearchString: anObject [ packageSearchString := anObject ] diff --git a/src/GToolkit-Coder/GtPackageCoder.class.st b/src/GToolkit-Coder/GtPackageCoder.class.st index bc547ee06..ac770aeaa 100644 --- a/src/GToolkit-Coder/GtPackageCoder.class.st +++ b/src/GToolkit-Coder/GtPackageCoder.class.st @@ -1,52 +1,52 @@ Class { - #name : #GtPackageCoder, - #superclass : #GtCoderModel, + #name : 'GtPackageCoder', + #superclass : 'GtCoderModel', #traits : 'TGtCoderTrait', #classTraits : 'TGtCoderTrait classTrait', - #category : #'GToolkit-Coder-Coders' + #category : 'GToolkit-Coder-Coders' } -{ #category : #testing } +{ #category : 'testing' } GtPackageCoder >> isForPackage [ ^ true ] -{ #category : #'private - notifying' } +{ #category : 'private - notifying' } GtPackageCoder >> notifyPackageRegistered [ self announce: (GtCoderPackageRegistered new coder: self) ] -{ #category : #'private - notifying' } +{ #category : 'private - notifying' } GtPackageCoder >> notifyPackageRenamed [ self announce: (GtCoderPackageRenamed new coder: self) ] -{ #category : #'private - notifying' } +{ #category : 'private - notifying' } GtPackageCoder >> notifyPackageUnregistered [ self announce: (GtCoderPackageUnregistered new coder: self) ] -{ #category : #'private - actions' } +{ #category : 'private - actions' } GtPackageCoder >> primitiveRegisterPackage [ self subclassResponsibility ] -{ #category : #'private - actions' } +{ #category : 'private - actions' } GtPackageCoder >> primitiveRemovePackage [ self subclassResponsibility ] -{ #category : #'private - actions' } +{ #category : 'private - actions' } GtPackageCoder >> primitiveRenamePackageTo: aNewPackageName [ self subclassResponsibility ] -{ #category : #'private - actions' } +{ #category : 'private - actions' } GtPackageCoder >> primitiveUnregisterPackage [ self subclassResponsibility ] -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtPackageCoder >> register [ "Register a package in the system, and announce ${class:GtCoderPackageRegistered}$ if it was registered" self isRegistered @@ -59,7 +59,7 @@ GtPackageCoder >> register [ self notifyPackageRegistered ] -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtPackageCoder >> renameTo: aNewPackageName [ self isRegistered @@ -74,7 +74,7 @@ GtPackageCoder >> renameTo: aNewPackageName [ self notifyPackageRenamed ] -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtPackageCoder >> unload [ "Remove package from the system including all defined classes and extension methods" | wasRegistered | @@ -90,7 +90,7 @@ GtPackageCoder >> unload [ ifTrue: [ self notifyPackageUnregistered ] ] -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtPackageCoder >> unregister [ "Register a package in the system, and announce ${class:GtCoderPackageUnregistered}$ if it was unregistered. Unregistering a package does not remove its classes (quite dangerous!)" diff --git a/src/GToolkit-Coder/GtPackagesCoder.class.st b/src/GToolkit-Coder/GtPackagesCoder.class.st index 92e692a26..62d303d35 100644 --- a/src/GToolkit-Coder/GtPackagesCoder.class.st +++ b/src/GToolkit-Coder/GtPackagesCoder.class.st @@ -1,23 +1,23 @@ Class { - #name : #GtPackagesCoder, - #superclass : #GtCodersModel, + #name : 'GtPackagesCoder', + #superclass : 'GtCodersModel', #traits : 'TGtCoderTrait', #classTraits : 'TGtCoderTrait classTrait', - #category : #'GToolkit-Coder-Coders' + #category : 'GToolkit-Coder-Coders' } -{ #category : #comparing } +{ #category : 'comparing' } GtPackagesCoder >> = anObject [ ^ self class = anObject class ] -{ #category : #accessing } +{ #category : 'accessing' } GtPackagesCoder >> coderForClass: aClass [ ^ (self coderForPackage: aClass package) ifNotNil: [ :coder | coder coderForClass: aClass ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtPackagesCoder >> coderForPackage: aPackage [ ^ self coders detect: [ :each | each package = aPackage ] @@ -28,22 +28,22 @@ GtPackagesCoder >> coderForPackage: aPackage [ coder ] ] -{ #category : #comparing } +{ #category : 'comparing' } GtPackagesCoder >> hash [ ^ self class hash ] -{ #category : #accessing } +{ #category : 'accessing' } GtPackagesCoder >> icon [ ^ BrGlamorousIcons packageicon asElement ] -{ #category : #accessing } +{ #category : 'accessing' } GtPackagesCoder >> name [ ^ 'Pharo' ] -{ #category : #private } +{ #category : 'private' } GtPackagesCoder >> newCoderFor: aPackage [ ^ self subclassResponsibility ] diff --git a/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st b/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st index 83a9dd9ea..abd200b08 100644 --- a/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st @@ -1,20 +1,20 @@ Class { - #name : #GtPackagesCompletionStrategy, - #superclass : #GtCompletionStrategy, - #category : #'GToolkit-Coder-Completion' + #name : 'GtPackagesCompletionStrategy', + #superclass : 'GtCompletionStrategy', + #category : 'GToolkit-Coder-Completion' } -{ #category : #private } +{ #category : 'private' } GtPackagesCompletionStrategy class >> allPackages [ ^ RPackageOrganizer default packages ] -{ #category : #private } +{ #category : 'private' } GtPackagesCompletionStrategy class >> allPackagesDo: aBlock [ ^ RPackageOrganizer default packagesDo: aBlock ] -{ #category : #querying } +{ #category : 'querying' } GtPackagesCompletionStrategy class >> findPackageTagsMatching: aString [ | searchString results | searchString := '*' , aString , '*'. @@ -27,7 +27,7 @@ GtPackagesCompletionStrategy class >> findPackageTagsMatching: aString [ ^ results ] -{ #category : #querying } +{ #category : 'querying' } GtPackagesCompletionStrategy class >> findPackagesMatching: aString [ | searchString results | searchString := '*' , aString , '*'. @@ -38,7 +38,7 @@ GtPackagesCompletionStrategy class >> findPackagesMatching: aString [ ^ results ] -{ #category : #accessing } +{ #category : 'accessing' } GtPackagesCompletionStrategy >> completionActionsFor: aText at: positionInteger max: maxInteger [ | string completionActions | string := aText asString. @@ -53,12 +53,12 @@ GtPackagesCompletionStrategy >> completionActionsFor: aText at: positionInteger a text < b text ] ] -{ #category : #testing } +{ #category : 'testing' } GtPackagesCompletionStrategy >> hasCompletionEntryFor: aString [ ^ true ] -{ #category : #testing } +{ #category : 'testing' } GtPackagesCompletionStrategy >> hasCompletionsAt: anInteger in: aText [ ^ true ] diff --git a/src/GToolkit-Coder/GtPharoAssociation.class.st b/src/GToolkit-Coder/GtPharoAssociation.class.st index fbed6f252..acd05e1d4 100644 --- a/src/GToolkit-Coder/GtPharoAssociation.class.st +++ b/src/GToolkit-Coder/GtPharoAssociation.class.st @@ -1,32 +1,32 @@ Class { - #name : #GtPharoAssociation, - #superclass : #Object, - #category : #'GToolkit-Coder-Support-Pharo' + #name : 'GtPharoAssociation', + #superclass : 'Object', + #category : 'GToolkit-Coder-Support-Pharo' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtPharoAssociation >> from [ ^ self subclassResponsibility ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtPharoAssociation >> fromPackage [ ^ self from gtPackageScope ] -{ #category : #printing } +{ #category : 'printing' } GtPharoAssociation >> gtDisplayOn: stream [ self from gtDisplayOn: stream. stream nextPutAll: '->'. self to gtDisplayOn: stream. ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtPharoAssociation >> to [ ^ self subclassResponsibility ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtPharoAssociation >> toPackage [ ^ self to gtPackageScope ] diff --git a/src/GToolkit-Coder/GtPharoClassExtension.class.st b/src/GToolkit-Coder/GtPharoClassExtension.class.st index 3e3745141..2e1b8ce3c 100644 --- a/src/GToolkit-Coder/GtPharoClassExtension.class.st +++ b/src/GToolkit-Coder/GtPharoClassExtension.class.st @@ -1,34 +1,34 @@ Class { - #name : #GtPharoClassExtension, - #superclass : #GtPharoAssociation, + #name : 'GtPharoClassExtension', + #superclass : 'GtPharoAssociation', #instVars : [ 'extendedClass', 'extendingMethod' ], - #category : #'GToolkit-Coder-Support-Pharo' + #category : 'GToolkit-Coder-Support-Pharo' } -{ #category : #accessing } +{ #category : 'accessing' } GtPharoClassExtension >> extendedClass [ ^ self extendingMethod methodClass ] -{ #category : #accessing } +{ #category : 'accessing' } GtPharoClassExtension >> extendingMethod [ ^ extendingMethod ] -{ #category : #accessing } +{ #category : 'accessing' } GtPharoClassExtension >> extendingMethod: anObject [ extendingMethod := anObject ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtPharoClassExtension >> from [ ^ self extendingMethod ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtPharoClassExtension >> to [ ^ self extendedClass ] diff --git a/src/GToolkit-Coder/GtPharoClassReference.class.st b/src/GToolkit-Coder/GtPharoClassReference.class.st index 3a42c0067..c88356a6f 100644 --- a/src/GToolkit-Coder/GtPharoClassReference.class.st +++ b/src/GToolkit-Coder/GtPharoClassReference.class.st @@ -1,19 +1,19 @@ Class { - #name : #GtPharoClassReference, - #superclass : #GtPharoAssociation, + #name : 'GtPharoClassReference', + #superclass : 'GtPharoAssociation', #instVars : [ 'referencingMethod', 'referencedClass' ], - #category : #'GToolkit-Coder-Support-Pharo' + #category : 'GToolkit-Coder-Support-Pharo' } -{ #category : #accessing } +{ #category : 'accessing' } GtPharoClassReference >> from [ ^ self referencingMethod ] -{ #category : #accessing } +{ #category : 'accessing' } GtPharoClassReference >> gtSourceFor: aView [ ^ aView forward @@ -22,27 +22,27 @@ GtPharoClassReference >> gtSourceFor: aView [ view: #gtSourceFor: ] -{ #category : #accessing } +{ #category : 'accessing' } GtPharoClassReference >> referencedClass [ ^ referencedClass ] -{ #category : #accessing } +{ #category : 'accessing' } GtPharoClassReference >> referencedClass: anObject [ referencedClass := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtPharoClassReference >> referencingMethod [ ^ referencingMethod ] -{ #category : #accessing } +{ #category : 'accessing' } GtPharoClassReference >> referencingMethod: anObject [ referencingMethod := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtPharoClassReference >> to [ ^ self referencedClass ] diff --git a/src/GToolkit-Coder/GtPharoInheritance.class.st b/src/GToolkit-Coder/GtPharoInheritance.class.st index 9c15d8153..eb280e8c0 100644 --- a/src/GToolkit-Coder/GtPharoInheritance.class.st +++ b/src/GToolkit-Coder/GtPharoInheritance.class.st @@ -1,39 +1,39 @@ Class { - #name : #GtPharoInheritance, - #superclass : #GtPharoAssociation, + #name : 'GtPharoInheritance', + #superclass : 'GtPharoAssociation', #instVars : [ 'superclass', 'subclass' ], - #category : #'GToolkit-Coder-Support-Pharo' + #category : 'GToolkit-Coder-Support-Pharo' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtPharoInheritance >> from [ ^ self subclass ] -{ #category : #accessing } +{ #category : 'accessing' } GtPharoInheritance >> subclass [ ^ subclass ] -{ #category : #accessing } +{ #category : 'accessing' } GtPharoInheritance >> subclass: anObject [ subclass := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtPharoInheritance >> superclass [ ^ superclass ] -{ #category : #accessing } +{ #category : 'accessing' } GtPharoInheritance >> superclass: anObject [ superclass := anObject ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtPharoInheritance >> to [ ^ self superclass ] diff --git a/src/GToolkit-Coder/GtPharoTraitUsage.class.st b/src/GToolkit-Coder/GtPharoTraitUsage.class.st index dca9674a9..939a69fa4 100644 --- a/src/GToolkit-Coder/GtPharoTraitUsage.class.st +++ b/src/GToolkit-Coder/GtPharoTraitUsage.class.st @@ -1,39 +1,39 @@ Class { - #name : #GtPharoTraitUsage, - #superclass : #GtPharoAssociation, + #name : 'GtPharoTraitUsage', + #superclass : 'GtPharoAssociation', #instVars : [ 'trait', 'baseBehavior' ], - #category : #'GToolkit-Coder-Support-Pharo' + #category : 'GToolkit-Coder-Support-Pharo' } -{ #category : #accessing } +{ #category : 'accessing' } GtPharoTraitUsage >> baseBehavior [ ^ baseBehavior ] -{ #category : #accessing } +{ #category : 'accessing' } GtPharoTraitUsage >> baseBehavior: aBehavior [ baseBehavior := aBehavior ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtPharoTraitUsage >> from [ ^ self baseBehavior ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtPharoTraitUsage >> to [ ^ self usedTrait ] -{ #category : #accessing } +{ #category : 'accessing' } GtPharoTraitUsage >> usedTrait [ ^ trait ] -{ #category : #accessing } +{ #category : 'accessing' } GtPharoTraitUsage >> usedTrait: aTrait [ trait := aTrait ] diff --git a/src/GToolkit-Coder/GtPhlowContext.extension.st b/src/GToolkit-Coder/GtPhlowContext.extension.st index 34240c73c..008b5f434 100644 --- a/src/GToolkit-Coder/GtPhlowContext.extension.st +++ b/src/GToolkit-Coder/GtPhlowContext.extension.st @@ -1,36 +1,36 @@ -Extension { #name : #GtPhlowContext } +Extension { #name : 'GtPhlowContext' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } GtPhlowContext >> hasPackageCoder [ ^ self hasOptionAt: #packageCoder ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } GtPhlowContext >> hasPackageTagCoder [ ^ self hasOptionAt: #packageTagCoder ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } GtPhlowContext >> packageCoder [ ^ self optionAt: #packageCoder ifAbsent: [ nil ] ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } GtPhlowContext >> packageCoder: aCoder [ self optionAt: #packageCoder put: aCoder ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } GtPhlowContext >> packageTagCoder [ ^ self optionAt: #packageTagCoder ifAbsent: [ nil ] ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } GtPhlowContext >> packageTagCoder: aCoder [ self optionAt: #packageTagCoder put: aCoder diff --git a/src/GToolkit-Coder/GtPhlowExecutionContext.extension.st b/src/GToolkit-Coder/GtPhlowExecutionContext.extension.st index 08d93fe2d..26eb9e0d5 100644 --- a/src/GToolkit-Coder/GtPhlowExecutionContext.extension.st +++ b/src/GToolkit-Coder/GtPhlowExecutionContext.extension.st @@ -1,11 +1,11 @@ -Extension { #name : #GtPhlowExecutionContext } +Extension { #name : 'GtPhlowExecutionContext' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } GtPhlowExecutionContext >> hasPackageCoder [ ^ false ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } GtPhlowExecutionContext >> hasPackageTagCoder [ ^ false ] diff --git a/src/GToolkit-Coder/GtPoolsCompletionStrategy.class.st b/src/GToolkit-Coder/GtPoolsCompletionStrategy.class.st index 40fef5e10..ea8ce7707 100644 --- a/src/GToolkit-Coder/GtPoolsCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtPoolsCompletionStrategy.class.st @@ -1,13 +1,13 @@ Class { - #name : #GtPoolsCompletionStrategy, - #superclass : #GtCompletionStrategy, + #name : 'GtPoolsCompletionStrategy', + #superclass : 'GtCompletionStrategy', #instVars : [ 'candidatePools' ], - #category : #'GToolkit-Coder-Completion' + #category : 'GToolkit-Coder-Completion' } -{ #category : #accessing } +{ #category : 'accessing' } GtPoolsCompletionStrategy >> candidatePools [ ^ candidatePools ifNil: [ | theInterestingPoolNames | @@ -17,7 +17,7 @@ GtPoolsCompletionStrategy >> candidatePools [ candidatePools := GtPrefixTree withAll: theInterestingPoolNames ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtPoolsCompletionStrategy >> completionActionsFor: aText at: positionInteger max: maxInteger [ | currentInput completionActions | @@ -32,12 +32,12 @@ GtPoolsCompletionStrategy >> completionActionsFor: aText at: positionInteger max ^ completionActions ] -{ #category : #testing } +{ #category : 'testing' } GtPoolsCompletionStrategy >> hasCompletionEntryFor: aString [ ^ true ] -{ #category : #testing } +{ #category : 'testing' } GtPoolsCompletionStrategy >> hasCompletionsAt: anInteger in: aText [ ^ true ] diff --git a/src/GToolkit-Coder/GtRBASTStyler.class.st b/src/GToolkit-Coder/GtRBASTStyler.class.st index 02772fdd1..2368f06c0 100644 --- a/src/GToolkit-Coder/GtRBASTStyler.class.st +++ b/src/GToolkit-Coder/GtRBASTStyler.class.st @@ -1,16 +1,16 @@ Class { - #name : #GtRBASTStyler, - #superclass : #BlTextStyler, + #name : 'GtRBASTStyler', + #superclass : 'BlTextStyler', #classTraits : 'TRBProgramNodeVisitor classTrait', - #category : #'GToolkit-Coder-Styler/Highlighter' + #category : 'GToolkit-Coder-Styler/Highlighter' } -{ #category : #styling } +{ #category : 'styling' } GtRBASTStyler >> extraStyle: aText ast: ast [ ] -{ #category : #'gt-extension' } +{ #category : 'gt-extension' } GtRBASTStyler >> gtViewTextFor: aView [ text ifNil: [ ^ aView empty ]. @@ -20,14 +20,14 @@ GtRBASTStyler >> gtViewTextFor: aView [ text: [ text ] ] -{ #category : #private } +{ #category : 'private' } GtRBASTStyler >> parse: aText [ | code | code := aText asString. ^ RBParser parseFaultyMethod: code ] -{ #category : #private } +{ #category : 'private' } GtRBASTStyler >> privateStyle: aText [ | ast | ast := self parse: aText. @@ -40,18 +40,18 @@ GtRBASTStyler >> privateStyle: aText [ ^ aText ] -{ #category : #styling } +{ #category : 'styling' } GtRBASTStyler >> style: aText ast: ast [ text := aText. self visitNode: ast ] -{ #category : #private } +{ #category : 'private' } GtRBASTStyler >> styleFrom: from to: to with: attributes [ (text from: from to: to) attributes: attributes ] -{ #category : #accessing } +{ #category : 'accessing' } GtRBASTStyler >> typeOf: aNode in: aClass [ aNode isSelf ifTrue: [ ^ aClass ]. @@ -78,13 +78,13 @@ GtRBASTStyler >> typeOf: aNode in: aClass [ ^ nil ] -{ #category : #visiting } +{ #category : 'visiting' } GtRBASTStyler >> visitArgumentNodes: aNodeCollection [ "Sent *once* when visiting method and block nodes" ^aNodeCollection do: [ :each | self visitNode: each ] ] -{ #category : #visiting } +{ #category : 'visiting' } GtRBASTStyler >> visitTemporaryDeclarationNode: aTemporaryDeclarationNode [ "| temp | temp is a temporary node as we can find in the body of methods, but it can't be visited the same way. diff --git a/src/GToolkit-Coder/GtRefactoringDanger.class.st b/src/GToolkit-Coder/GtRefactoringDanger.class.st index 905722063..3b67d6db7 100644 --- a/src/GToolkit-Coder/GtRefactoringDanger.class.st +++ b/src/GToolkit-Coder/GtRefactoringDanger.class.st @@ -1,29 +1,29 @@ Class { - #name : #GtRefactoringDanger, - #superclass : #Object, + #name : 'GtRefactoringDanger', + #superclass : 'Object', #instVars : [ 'condition', 'description' ], - #category : #'GToolkit-Coder-Refactoring' + #category : 'GToolkit-Coder-Refactoring' } -{ #category : #accessing } +{ #category : 'accessing' } GtRefactoringDanger >> condition [ ^ condition ] -{ #category : #accessing } +{ #category : 'accessing' } GtRefactoringDanger >> condition: anObject [ condition := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtRefactoringDanger >> description [ ^ description ] -{ #category : #accessing } +{ #category : 'accessing' } GtRefactoringDanger >> description: anObject [ description := anObject ] diff --git a/src/GToolkit-Coder/GtReplaceTextCompletionAction.class.st b/src/GToolkit-Coder/GtReplaceTextCompletionAction.class.st index 1c1be7711..a90d68a5f 100644 --- a/src/GToolkit-Coder/GtReplaceTextCompletionAction.class.st +++ b/src/GToolkit-Coder/GtReplaceTextCompletionAction.class.st @@ -1,25 +1,25 @@ Class { - #name : #GtReplaceTextCompletionAction, - #superclass : #GtCompletionAction, + #name : 'GtReplaceTextCompletionAction', + #superclass : 'GtCompletionAction', #instVars : [ 'text' ], - #category : #'GToolkit-Coder-Completion' + #category : 'GToolkit-Coder-Completion' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtReplaceTextCompletionAction class >> forText: aString [ ^ (self labeled: aString) text: aString; yourself ] -{ #category : #comparing } +{ #category : 'comparing' } GtReplaceTextCompletionAction >> = anObject [ ^ super = anObject and: [ self text = anObject text ] ] -{ #category : #executing } +{ #category : 'executing' } GtReplaceTextCompletionAction >> finishCompletionOn: aCompletionController moveCursor: aBoolean [ aCompletionController textEditor deleter from: 0 to: aCompletionController textEditor text size; @@ -30,30 +30,30 @@ GtReplaceTextCompletionAction >> finishCompletionOn: aCompletionController moveC insert ] -{ #category : #comparing } +{ #category : 'comparing' } GtReplaceTextCompletionAction >> hash [ ^ super hash bitXor: text hash ] -{ #category : #executing } +{ #category : 'executing' } GtReplaceTextCompletionAction >> previewOn: aCompletionController [ ] -{ #category : #accessing } +{ #category : 'accessing' } GtReplaceTextCompletionAction >> searchStartPosition [ ^ 1 ] -{ #category : #accessing } +{ #category : 'accessing' } GtReplaceTextCompletionAction >> text [ ^ text ] -{ #category : #accessing } +{ #category : 'accessing' } GtReplaceTextCompletionAction >> text: anObject [ text := anObject ] -{ #category : #executing } +{ #category : 'executing' } GtReplaceTextCompletionAction >> undoPreviewOn: aCompletionController [ ] diff --git a/src/GToolkit-Coder/GtSearchBinaryFilter.class.st b/src/GToolkit-Coder/GtSearchBinaryFilter.class.st index 4bca919fe..f07d67f74 100644 --- a/src/GToolkit-Coder/GtSearchBinaryFilter.class.st +++ b/src/GToolkit-Coder/GtSearchBinaryFilter.class.st @@ -1,27 +1,27 @@ Class { - #name : #GtSearchBinaryFilter, - #superclass : #GtSearchFilter, + #name : 'GtSearchBinaryFilter', + #superclass : 'GtSearchFilter', #instVars : [ 'left', 'right' ], - #category : #'GToolkit-Coder-Filters' + #category : 'GToolkit-Coder-Filters' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtSearchBinaryFilter class >> forFilter: leftFilter filter: rightFilter [ ^ self new filter: leftFilter filter: rightFilter; yourself ] -{ #category : #'initialize-release' } +{ #category : 'initialize-release' } GtSearchBinaryFilter >> filter: leftFilter filter: rightFilter [ left := leftFilter. right := rightFilter ] -{ #category : #accessing } +{ #category : 'accessing' } GtSearchBinaryFilter >> highlighter [ ^ left highlighter ifNil: [ right highlighter ] @@ -32,17 +32,17 @@ GtSearchBinaryFilter >> highlighter [ [ :rh | GtCompositeHighlighter forHighlighters: (Array with: lh with: rh) ] ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtSearchBinaryFilter >> leftFilter [ ^ left ] -{ #category : #accessing } +{ #category : 'accessing' } GtSearchBinaryFilter >> resultType [ ^ left resultType mergeTypeWith: right resultType ] -{ #category : #accessing } +{ #category : 'accessing' } GtSearchBinaryFilter >> rightFilter [ ^ right ] diff --git a/src/GToolkit-Coder/GtSearchBlockFilter.class.st b/src/GToolkit-Coder/GtSearchBlockFilter.class.st index 1c0c489fe..b9c02df4c 100644 --- a/src/GToolkit-Coder/GtSearchBlockFilter.class.st +++ b/src/GToolkit-Coder/GtSearchBlockFilter.class.st @@ -1,30 +1,30 @@ Class { - #name : #GtSearchBlockFilter, - #superclass : #GtSearchFilter, + #name : 'GtSearchBlockFilter', + #superclass : 'GtSearchFilter', #instVars : [ 'block' ], - #category : #'GToolkit-Coder-Filters' + #category : 'GToolkit-Coder-Filters' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtSearchBlockFilter class >> forBlock: aBlock [ ^ self new block: aBlock; yourself ] -{ #category : #accessing } +{ #category : 'accessing' } GtSearchBlockFilter >> block [ ^ block ] -{ #category : #accessing } +{ #category : 'accessing' } GtSearchBlockFilter >> block: aBlock [ block := aBlock ] -{ #category : #testing } +{ #category : 'testing' } GtSearchBlockFilter >> matches: anObject [ ^ block value: anObject ] diff --git a/src/GToolkit-Coder/GtSearchFilter.class.st b/src/GToolkit-Coder/GtSearchFilter.class.st index 95ea719cf..8ede7d70b 100644 --- a/src/GToolkit-Coder/GtSearchFilter.class.st +++ b/src/GToolkit-Coder/GtSearchFilter.class.st @@ -1,42 +1,42 @@ Class { - #name : #GtSearchFilter, - #superclass : #Object, - #category : #'GToolkit-Coder-Filters' + #name : 'GtSearchFilter', + #superclass : 'Object', + #category : 'GToolkit-Coder-Filters' } -{ #category : #'logical operations' } +{ #category : 'logical operations' } GtSearchFilter >> & aFilter [ ^ GtSearchIntersectionFilter forFilter: self filter: aFilter ] -{ #category : #evaluating } +{ #category : 'evaluating' } GtSearchFilter >> applyInScope: aSearchScope [ ^ self resultType new scope: aSearchScope; filter: self ] -{ #category : #converting } +{ #category : 'converting' } GtSearchFilter >> asCoder [ ^ self result asCoder ] -{ #category : #converting } +{ #category : 'converting' } GtSearchFilter >> asElement [ ^ self asCoder asElement ] -{ #category : #accessing } +{ #category : 'accessing' } GtSearchFilter >> defaultFilterScope [ ^ GtSearchNullFilter new ] -{ #category : #iterating } +{ #category : 'iterating' } GtSearchFilter >> do: aBlock [ self result do: aBlock ] -{ #category : #converting } +{ #category : 'converting' } GtSearchFilter >> gtExamples [ | examples | examples := OrderedCollection new. @@ -44,7 +44,7 @@ GtSearchFilter >> gtExamples [ ^ GtExampleGroup withAll: examples ] -{ #category : #ui } +{ #category : 'ui' } GtSearchFilter >> gtItemsFor: aView [ "this is a view that is polymorphic with the one defined in ${method:Collection>>#gtItemsFor:}$" @@ -55,52 +55,52 @@ GtSearchFilter >> gtItemsFor: aView [ view: #gtItemsFor: ] -{ #category : #accessing } +{ #category : 'accessing' } GtSearchFilter >> highlighter [ ^ nil ] -{ #category : #accessing } +{ #category : 'accessing' } GtSearchFilter >> isEmpty [ ^ self result isEmpty ] -{ #category : #testing } +{ #category : 'testing' } GtSearchFilter >> matches: anObject [ self subclassResponsibility ] -{ #category : #'logical operations' } +{ #category : 'logical operations' } GtSearchFilter >> not [ ^ GtSearchNegationFilter new originalFilter: self ] -{ #category : #testing } +{ #category : 'testing' } GtSearchFilter >> notEmpty [ ^ self isEmpty not ] -{ #category : #converting } +{ #category : 'converting' } GtSearchFilter >> result [ ^ self applyInScope: self defaultFilterScope ] -{ #category : #accessing } +{ #category : 'accessing' } GtSearchFilter >> resultType [ ^ GtSearchNullGroupResult ] -{ #category : #'logical operations' } +{ #category : 'logical operations' } GtSearchFilter >> select: aBlock [ ^ self & (GtSearchBlockFilter forBlock: aBlock) ] -{ #category : #accessing } +{ #category : 'accessing' } GtSearchFilter >> size [ ^ self result size ] -{ #category : #'logical operations' } +{ #category : 'logical operations' } GtSearchFilter >> | aFilter [ ^ GtSearchUnionFilter forFilter: self filter: aFilter ] diff --git a/src/GToolkit-Coder/GtSearchGroupResult.class.st b/src/GToolkit-Coder/GtSearchGroupResult.class.st index 8702a2fae..619aae714 100644 --- a/src/GToolkit-Coder/GtSearchGroupResult.class.st +++ b/src/GToolkit-Coder/GtSearchGroupResult.class.st @@ -1,68 +1,68 @@ Class { - #name : #GtSearchGroupResult, - #superclass : #Object, + #name : 'GtSearchGroupResult', + #superclass : 'Object', #instVars : [ 'items', 'filter', 'filtered', 'scope' ], - #category : #'GToolkit-Coder-Filters' + #category : 'GToolkit-Coder-Filters' } -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } GtSearchGroupResult class >> mergeTypeWith: aGroupResultClass [ ^ aGroupResultClass mergeTypeWithDefaultGroup ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } GtSearchGroupResult class >> mergeTypeWithDefaultGroup [ "The common type between the default group and any other group is the other group." ^ self ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } GtSearchGroupResult class >> mergeTypeWithGenericGroup [ "The common type between a generic group and any other group is the other group." ^ self ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } GtSearchGroupResult class >> mergeTypeWithTypedGroup: aGroupType [ ^ self ] -{ #category : #adding } +{ #category : 'adding' } GtSearchGroupResult >> add: anObject [ self refreshItems. ^ items add: anObject ] -{ #category : #enumerating } +{ #category : 'enumerating' } GtSearchGroupResult >> collect: aBlock [ self refreshItems. ^ items collect: aBlock ] -{ #category : #enumerating } +{ #category : 'enumerating' } GtSearchGroupResult >> do: aBlock [ self refreshItems. ^ items do: aBlock ] -{ #category : #accessing } +{ #category : 'accessing' } GtSearchGroupResult >> filter [ ^ filter ] -{ #category : #accessing } +{ #category : 'accessing' } GtSearchGroupResult >> filter: methodsFilter [ filtered := false. items := OrderedCollection new. filter := methodsFilter ] -{ #category : #enumerating } +{ #category : 'enumerating' } GtSearchGroupResult >> groupedBy: aBlockClosureOrSymbol [ "Group the filteres items using the given block. The returned groups are just a copy based on the current items at the time of the call. They are not updated if the filtered items change." @@ -70,7 +70,7 @@ GtSearchGroupResult >> groupedBy: aBlockClosureOrSymbol [ ^ items groupedBy: aBlockClosureOrSymbol ] -{ #category : #ui } +{ #category : 'ui' } GtSearchGroupResult >> gtItemsFor: aView [ self refreshItems. @@ -80,33 +80,33 @@ GtSearchGroupResult >> gtItemsFor: aView [ items: [ items ifNil: [ #() ] ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtSearchGroupResult >> highlighter [ ^ filter notNil ifTrue: [ filter highlighter ] ifFalse: [ nil ] ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } GtSearchGroupResult >> includes: aCollection [ self refreshItems. ^ items includes: aCollection ] -{ #category : #initialization } +{ #category : 'initialization' } GtSearchGroupResult >> initialize [ super initialize. filtered := false. items := OrderedCollection new. ] -{ #category : #testing } +{ #category : 'testing' } GtSearchGroupResult >> isEmpty [ "Answer whether the receiver contains any elements." ^ self size = 0 ] -{ #category : #enumerating } +{ #category : 'enumerating' } GtSearchGroupResult >> refreshItems [ | filteredItems | filtered @@ -120,41 +120,41 @@ GtSearchGroupResult >> refreshItems [ filtered := true. ] -{ #category : #removing } +{ #category : 'removing' } GtSearchGroupResult >> remove: anItem ifAbsent: aBlock [ self refreshItems. ^ items remove: anItem ifAbsent: aBlock ] -{ #category : #accessing } +{ #category : 'accessing' } GtSearchGroupResult >> scope [ ^ scope ] -{ #category : #accessing } +{ #category : 'accessing' } GtSearchGroupResult >> scope: aSearchScope [ scope := aSearchScope ] -{ #category : #accessing } +{ #category : 'accessing' } GtSearchGroupResult >> size [ self refreshItems. ^ items size ] -{ #category : #private } +{ #category : 'private' } GtSearchGroupResult >> species [ self refreshItems. ^ items class ] -{ #category : #enumerating } +{ #category : 'enumerating' } GtSearchGroupResult >> sumNumbers: aBlock [ self refreshItems. ^ items sumNumbers: aBlock ] -{ #category : #initialization } +{ #category : 'initialization' } GtSearchGroupResult >> updateForFilter: aFilter [ self filter: aFilter. self scope: (aFilter diff --git a/src/GToolkit-Coder/GtSearchIntersectionFilter.class.st b/src/GToolkit-Coder/GtSearchIntersectionFilter.class.st index 54a49dbc3..519943ec6 100644 --- a/src/GToolkit-Coder/GtSearchIntersectionFilter.class.st +++ b/src/GToolkit-Coder/GtSearchIntersectionFilter.class.st @@ -1,27 +1,27 @@ Class { - #name : #GtSearchIntersectionFilter, - #superclass : #GtSearchBinaryFilter, - #category : #'GToolkit-Coder-Filters' + #name : 'GtSearchIntersectionFilter', + #superclass : 'GtSearchBinaryFilter', + #category : 'GToolkit-Coder-Filters' } -{ #category : #accessing } +{ #category : 'accessing' } GtSearchIntersectionFilter >> defaultFilterScope [ ^ left defaultFilterScope ] -{ #category : #printing } +{ #category : 'printing' } GtSearchIntersectionFilter >> gtDisplayOn: stream [ left gtDisplayOn: stream. stream nextPutAll: ' & '. right gtDisplayOn: stream. ] -{ #category : #testing } +{ #category : 'testing' } GtSearchIntersectionFilter >> matches: anObject [ ^ (left matches: anObject) and: [ right matches: anObject ] ] -{ #category : #printing } +{ #category : 'printing' } GtSearchIntersectionFilter >> printOn: stream [ left printOn: stream. stream nextPutAll: ' & '. diff --git a/src/GToolkit-Coder/GtSearchNegationFilter.class.st b/src/GToolkit-Coder/GtSearchNegationFilter.class.st index 30ac0a934..4898417bf 100644 --- a/src/GToolkit-Coder/GtSearchNegationFilter.class.st +++ b/src/GToolkit-Coder/GtSearchNegationFilter.class.st @@ -1,45 +1,45 @@ Class { - #name : #GtSearchNegationFilter, - #superclass : #GtSearchFilter, + #name : 'GtSearchNegationFilter', + #superclass : 'GtSearchFilter', #instVars : [ 'originalFilter' ], - #category : #'GToolkit-Coder-Filters' + #category : 'GToolkit-Coder-Filters' } -{ #category : #accessing } +{ #category : 'accessing' } GtSearchNegationFilter >> defaultFilterScope [ ^ originalFilter defaultFilterScope ] -{ #category : #printing } +{ #category : 'printing' } GtSearchNegationFilter >> gtDisplayOn: stream [ self originalFilter gtDisplayOn: stream. stream nextPutAll: ' not' ] -{ #category : #testing } +{ #category : 'testing' } GtSearchNegationFilter >> matches: anObject [ ^ (self originalFilter matches: anObject) not ] -{ #category : #accessing } +{ #category : 'accessing' } GtSearchNegationFilter >> originalFilter [ ^ originalFilter ] -{ #category : #accessing } +{ #category : 'accessing' } GtSearchNegationFilter >> originalFilter: anObject [ originalFilter := anObject ] -{ #category : #printing } +{ #category : 'printing' } GtSearchNegationFilter >> printOn: stream [ self originalFilter printOn: stream. stream nextPutAll: ' not' ] -{ #category : #accessing } +{ #category : 'accessing' } GtSearchNegationFilter >> resultType [ ^ originalFilter resultType ] diff --git a/src/GToolkit-Coder/GtSearchNullFilter.class.st b/src/GToolkit-Coder/GtSearchNullFilter.class.st index 2c104d79d..7c0f3349f 100644 --- a/src/GToolkit-Coder/GtSearchNullFilter.class.st +++ b/src/GToolkit-Coder/GtSearchNullFilter.class.st @@ -1,26 +1,26 @@ Class { - #name : #GtSearchNullFilter, - #superclass : #GtSearchFilter, - #category : #'GToolkit-Coder-Filters' + #name : 'GtSearchNullFilter', + #superclass : 'GtSearchFilter', + #category : 'GToolkit-Coder-Filters' } -{ #category : #comparing } +{ #category : 'comparing' } GtSearchNullFilter >> = anObject [ self == anObject ifTrue: [ ^ true ]. self class = anObject class ifFalse: [ ^ false ]. ^ true ] -{ #category : #accessing } +{ #category : 'accessing' } GtSearchNullFilter >> defaultFilterScope [ ^ self ] -{ #category : #enumerating } +{ #category : 'enumerating' } GtSearchNullFilter >> itemsDo: aBloc [ ] -{ #category : #testing } +{ #category : 'testing' } GtSearchNullFilter >> matches: anObject [ ^ false ] diff --git a/src/GToolkit-Coder/GtSearchNullGroupResult.class.st b/src/GToolkit-Coder/GtSearchNullGroupResult.class.st index 53a3fbc9a..66a794410 100644 --- a/src/GToolkit-Coder/GtSearchNullGroupResult.class.st +++ b/src/GToolkit-Coder/GtSearchNullGroupResult.class.st @@ -1,20 +1,20 @@ Class { - #name : #GtSearchNullGroupResult, - #superclass : #GtSearchGroupResult, - #category : #'GToolkit-Coder-Filters' + #name : 'GtSearchNullGroupResult', + #superclass : 'GtSearchGroupResult', + #category : 'GToolkit-Coder-Filters' } -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } GtSearchNullGroupResult class >> mergeTypeWith: aGroupResultClass [ ^ aGroupResultClass mergeTypeWithGenericGroup. ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } GtSearchNullGroupResult class >> mergeTypeWithTypedGroup: aGroupType [ ^ aGroupType ] -{ #category : #enumerating } +{ #category : 'enumerating' } GtSearchNullGroupResult >> refreshItems [ filtered ifTrue: [ ^ self ]. diff --git a/src/GToolkit-Coder/GtSearchTypedEntitiesFilter.class.st b/src/GToolkit-Coder/GtSearchTypedEntitiesFilter.class.st index 29e1b8345..ea7a7febf 100644 --- a/src/GToolkit-Coder/GtSearchTypedEntitiesFilter.class.st +++ b/src/GToolkit-Coder/GtSearchTypedEntitiesFilter.class.st @@ -1,15 +1,15 @@ Class { - #name : #GtSearchTypedEntitiesFilter, - #superclass : #GtSearchFilter, - #category : #'GToolkit-Coder-Filters' + #name : 'GtSearchTypedEntitiesFilter', + #superclass : 'GtSearchFilter', + #category : 'GToolkit-Coder-Filters' } -{ #category : #accessing } +{ #category : 'accessing' } GtSearchTypedEntitiesFilter class >> resultType [ self subclassResponsibility ] -{ #category : #accessing } +{ #category : 'accessing' } GtSearchTypedEntitiesFilter >> resultType [ ^ self class resultType ] diff --git a/src/GToolkit-Coder/GtSearchTypedGroupResult.class.st b/src/GToolkit-Coder/GtSearchTypedGroupResult.class.st index 3562395e0..9683e2937 100644 --- a/src/GToolkit-Coder/GtSearchTypedGroupResult.class.st +++ b/src/GToolkit-Coder/GtSearchTypedGroupResult.class.st @@ -1,36 +1,36 @@ Class { - #name : #GtSearchTypedGroupResult, - #superclass : #GtSearchGroupResult, + #name : 'GtSearchTypedGroupResult', + #superclass : 'GtSearchGroupResult', #instVars : [ 'announcer' ], - #category : #'GToolkit-Coder-Filters' + #category : 'GToolkit-Coder-Filters' } -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } GtSearchTypedGroupResult class >> mergeTypeWith: aGroupResultClass [ ^ aGroupResultClass mergeTypeWithTypedGroup: self. ] -{ #category : #'as yet unclassified' } +{ #category : 'as yet unclassified' } GtSearchTypedGroupResult class >> mergeTypeWithTypedGroup: aGroupType [ ^ aGroupType = self ifTrue: [ self ] ifFalse: [ GtSearchGroupResult ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtSearchTypedGroupResult >> announcer [ ^ announcer ] -{ #category : #initialization } +{ #category : 'initialization' } GtSearchTypedGroupResult >> initialize [ super initialize. announcer := Announcer new. self subscribe ] -{ #category : #subscription } +{ #category : 'subscription' } GtSearchTypedGroupResult >> subscribe [ ] diff --git a/src/GToolkit-Coder/GtSearchUnionFilter.class.st b/src/GToolkit-Coder/GtSearchUnionFilter.class.st index 646f49350..8fca1002d 100644 --- a/src/GToolkit-Coder/GtSearchUnionFilter.class.st +++ b/src/GToolkit-Coder/GtSearchUnionFilter.class.st @@ -1,17 +1,17 @@ Class { - #name : #GtSearchUnionFilter, - #superclass : #GtSearchBinaryFilter, - #category : #'GToolkit-Coder-Filters' + #name : 'GtSearchUnionFilter', + #superclass : 'GtSearchBinaryFilter', + #category : 'GToolkit-Coder-Filters' } -{ #category : #accessing } +{ #category : 'accessing' } GtSearchUnionFilter >> defaultFilterScope [ ^ left defaultFilterScope = right defaultFilterScope ifTrue: [ left defaultFilterScope ] ifFalse: [ self ] ] -{ #category : #printing } +{ #category : 'printing' } GtSearchUnionFilter >> gtDisplayOn: stream [ left gtDisplayOn: stream. stream nextPutAll: ' | '. @@ -19,7 +19,7 @@ GtSearchUnionFilter >> gtDisplayOn: stream [ ] -{ #category : #enumerating } +{ #category : 'enumerating' } GtSearchUnionFilter >> itemsDo: aBlock [ | seen | seen := IdentitySet new. @@ -33,12 +33,12 @@ GtSearchUnionFilter >> itemsDo: aBlock [ ifFalse: [ aBlock value: each ] ] ] -{ #category : #testing } +{ #category : 'testing' } GtSearchUnionFilter >> matches: anObject [ ^ (left matches: anObject) or: [ right matches: anObject ] ] -{ #category : #printing } +{ #category : 'printing' } GtSearchUnionFilter >> printOn: stream [ left printOn: stream. stream nextPutAll: ' | '. diff --git a/src/GToolkit-Coder/GtSourceCoder.class.st b/src/GToolkit-Coder/GtSourceCoder.class.st index 1d443df0e..0bd2ae58d 100644 --- a/src/GToolkit-Coder/GtSourceCoder.class.st +++ b/src/GToolkit-Coder/GtSourceCoder.class.st @@ -15,17 +15,17 @@ To add support for code debugging the subclasses must implement " Class { - #name : #GtSourceCoder, - #superclass : #GtTextualCoder, - #category : #'GToolkit-Coder-Coders' + #name : 'GtSourceCoder', + #superclass : 'GtTextualCoder', + #category : 'GToolkit-Coder-Coders' } -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtSourceCoder >> debug [ self debugInContext: self evaluationContext ] -{ #category : #'private - actions' } +{ #category : 'private - actions' } GtSourceCoder >> debug: aSourceStringOrBlock inContext: aGtSourceCoderEvaluationContext [ | aSourceString aSourceInterval aCompleteSourceString | @@ -47,12 +47,12 @@ GtSourceCoder >> debug: aSourceStringOrBlock inContext: aGtSourceCoderEvaluation onFailDo: [ self error: 'Failed to debug' ] ] -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtSourceCoder >> debugInContext: aGtSourceCoderEvaluationContext [ self debug: self currentSourceString inContext: aGtSourceCoderEvaluationContext ] -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtSourceCoder >> discardChanges [ "Discard not-accepted changes." @@ -65,7 +65,7 @@ GtSourceCoder >> discardChanges [ self sourceChanged ] -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtSourceCoder >> doItAll [ "Evaluate the whole source code in a default evaluation context and return the result. See the implementation of #evaluationContext to find the default state" @@ -73,7 +73,7 @@ GtSourceCoder >> doItAll [ ^ self doItInContext: self evaluationContext ] -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtSourceCoder >> doItAndGo [ "Evaluate and inspect the whole source code in a default evaluation context and return the result. See the implementation of #evaluationContext to find the default state" @@ -81,7 +81,7 @@ GtSourceCoder >> doItAndGo [ ^ self doItAndGoInContext: self evaluationContext ] -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtSourceCoder >> doItAndGoInContext: aGtSourceCoderEvaluationContext [ ^ self evaluate: [ :thisCoder | thisCoder currentSourceString ] @@ -91,14 +91,14 @@ GtSourceCoder >> doItAndGoInContext: aGtSourceCoderEvaluationContext [ self notifyObjectSpawnFromEvaluationResult: anEvaluationResult ] ] -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtSourceCoder >> doItInContext: aGtSourceCoderEvaluationContext [ ^ self doItInContext: aGtSourceCoderEvaluationContext thenDo: [ :aResult | self notifyEvaluatedWithResult: aResult ] ] -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtSourceCoder >> doItInContext: aGtSourceCoderEvaluationContext thenDo: aBlock [ ^ self evaluate: [ :thisCoder | thisCoder currentSourceString ] @@ -106,7 +106,7 @@ GtSourceCoder >> doItInContext: aGtSourceCoderEvaluationContext thenDo: aBlock [ thenDo: aBlock ] -{ #category : #'private - actions' } +{ #category : 'private - actions' } GtSourceCoder >> evaluate: aSourceStringOrBlock [ "Evaluate a given source code and show the print string if needed" @@ -115,7 +115,7 @@ GtSourceCoder >> evaluate: aSourceStringOrBlock [ thenDo: [ ] ] -{ #category : #'private - actions' } +{ #category : 'private - actions' } GtSourceCoder >> evaluate: aSourceStringOrBlock decorated: aSourceCodeDecorator inContext: aSourceCoderEvaluationContext thenDo: aThenBlock [ "Evaluate a given source code" | aCompleteSourceString aSourceString aSourceInterval aResult aDecoratedSourceString | @@ -158,7 +158,7 @@ GtSourceCoder >> evaluate: aSourceStringOrBlock decorated: aSourceCodeDecorator ^ aResult ] -{ #category : #'private - actions' } +{ #category : 'private - actions' } GtSourceCoder >> evaluate: aSourceStringOrBlock inContext: aGtSourceCoderEvaluationContext thenDo: aThenBlock [ ^ self evaluate: aSourceStringOrBlock @@ -167,7 +167,7 @@ GtSourceCoder >> evaluate: aSourceStringOrBlock inContext: aGtSourceCoderEvaluat thenDo: aThenBlock ] -{ #category : #'private - actions' } +{ #category : 'private - actions' } GtSourceCoder >> evaluate: aSourceStringOrBlock thenDo: aThenBlock [ "Evaluate a given source code and show the print string if needed" @@ -177,7 +177,7 @@ GtSourceCoder >> evaluate: aSourceStringOrBlock thenDo: aThenBlock [ thenDo: aThenBlock ] -{ #category : #'private - actions' } +{ #category : 'private - actions' } GtSourceCoder >> evaluateBlock: aBlock onErrorDo: anErrorBlock [ | aResult wasErrorAlreadySignaled | @@ -228,7 +228,7 @@ GtSourceCoder >> evaluateBlock: aBlock onErrorDo: anErrorBlock [ ^ GtSourceCoderEvaluationResultWithValue new value: aResult ] -{ #category : #'private - actions' } +{ #category : 'private - actions' } GtSourceCoder >> evaluationContext [ @@ -237,21 +237,21 @@ GtSourceCoder >> evaluationContext [ coder: self ] -{ #category : #'private - notifying' } +{ #category : 'private - notifying' } GtSourceCoder >> notifyEvaluatedWithResult: anEvaluationResult [ self announce: (GtCoderEvaluationAnnouncement new evaluationResult: anEvaluationResult; coder: self) ] -{ #category : #'private - notifying' } +{ #category : 'private - notifying' } GtSourceCoder >> notifyObjectSpawn: anObject [ self notifyObjectSpawn: anObject withDestination: self spawnDestination ] -{ #category : #'private - notifying' } +{ #category : 'private - notifying' } GtSourceCoder >> notifyObjectSpawn: anObject withDestination: aSpawnDestination [ self announce: (GtCoderObjectSpawnRequest new object: anObject; @@ -259,7 +259,7 @@ GtSourceCoder >> notifyObjectSpawn: anObject withDestination: aSpawnDestination coder: self) ] -{ #category : #'private - notifying' } +{ #category : 'private - notifying' } GtSourceCoder >> notifyObjectSpawnFromEvaluationResult: anEvaluationResult [ anEvaluationResult isSuccess @@ -269,14 +269,14 @@ GtSourceCoder >> notifyObjectSpawnFromEvaluationResult: anEvaluationResult [ notifyObjectSpawn: anEvaluationResult value ] -{ #category : #'private - notifying' } +{ #category : 'private - notifying' } GtSourceCoder >> notifyPrintResult: anEvaluationResult [ self announce: (GtCoderPrintAnnouncement new evaluationResult: anEvaluationResult; coder: self) ] -{ #category : #'private - notifying' } +{ #category : 'private - notifying' } GtSourceCoder >> notifyShowDebuggerRequest: aDebugSession dueTo: anException sourceString: aSourceString sourceInterval: aSourceInterval [ (self announcer subscriptionsForClass: GtCoderShowDebuggerRequest) size isZero ifTrue: [ @@ -292,17 +292,17 @@ GtSourceCoder >> notifyShowDebuggerRequest: aDebugSession dueTo: anException sou sourceInterval: aSourceInterval) ] -{ #category : #'private - actions' } +{ #category : 'private - actions' } GtSourceCoder >> primitiveDebug: aSourceString inContext: aGtSourceCoderEvaluationContext onFailDo: anEvaluationFailBlock [ ^ self subclassResponsibility ] -{ #category : #'private - actions' } +{ #category : 'private - actions' } GtSourceCoder >> primitiveEvaluate: aSourceString inContext: aGtSourceCoderEvaluationContext onFailDo: anEvaluationFailBlock [ ^ self subclassResponsibility ] -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtSourceCoder >> printItInContext: aGtSourceCoderEvaluationContext [ ^ self evaluate: [ :thisCoder | thisCoder currentSourceString ] @@ -310,14 +310,14 @@ GtSourceCoder >> printItInContext: aGtSourceCoderEvaluationContext [ thenDo: [ :aResult | self notifyPrintResult: aResult ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoder >> spawnDestination [ ^ self attributeNamed: #spawnDestination ifAbsent: [ GtPhlowSpawnDesiredDestination defaultDestination ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoder >> spawnDestination: aSpawnDestination [ self attributeNamed: #spawnDestination put: aSpawnDestination ] diff --git a/src/GToolkit-Coder/GtSourceCoderAnnouncement.class.st b/src/GToolkit-Coder/GtSourceCoderAnnouncement.class.st index e2508d29e..6fd415fb2 100644 --- a/src/GToolkit-Coder/GtSourceCoderAnnouncement.class.st +++ b/src/GToolkit-Coder/GtSourceCoderAnnouncement.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtSourceCoderAnnouncement, - #superclass : #GtCoderAnnouncement, - #category : #'GToolkit-Coder-Event' + #name : 'GtSourceCoderAnnouncement', + #superclass : 'GtCoderAnnouncement', + #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtSourceCoderEvaluationAllSource.class.st b/src/GToolkit-Coder/GtSourceCoderEvaluationAllSource.class.st index d7e8109c0..ec51439c4 100644 --- a/src/GToolkit-Coder/GtSourceCoderEvaluationAllSource.class.st +++ b/src/GToolkit-Coder/GtSourceCoderEvaluationAllSource.class.st @@ -1,17 +1,17 @@ Class { - #name : #GtSourceCoderEvaluationAllSource, - #superclass : #GtSourceCoderEvaluationSourceInterval, - #category : #'GToolkit-Coder-Coders - Evaluation' + #name : 'GtSourceCoderEvaluationAllSource', + #superclass : 'GtSourceCoderEvaluationSourceInterval', + #category : 'GToolkit-Coder-Coders - Evaluation' } -{ #category : #evaluation } +{ #category : 'evaluation' } GtSourceCoderEvaluationAllSource >> computeSourceInterval: aCompleteCoderSourceTextOrString [ ^ 1 to: aCompleteCoderSourceTextOrString size ] -{ #category : #evaluation } +{ #category : 'evaluation' } GtSourceCoderEvaluationAllSource >> computeSourceString: aCompleteCoderSourceTextOrString [ diff --git a/src/GToolkit-Coder/GtSourceCoderEvaluationContext.class.st b/src/GToolkit-Coder/GtSourceCoderEvaluationContext.class.st index 23bba3841..9402d962d 100644 --- a/src/GToolkit-Coder/GtSourceCoderEvaluationContext.class.st +++ b/src/GToolkit-Coder/GtSourceCoderEvaluationContext.class.st @@ -1,6 +1,6 @@ Class { - #name : #GtSourceCoderEvaluationContext, - #superclass : #Object, + #name : 'GtSourceCoderEvaluationContext', + #superclass : 'Object', #instVars : [ 'coder', 'requesterObject', @@ -9,47 +9,47 @@ Class { 'evaluatedInterval', 'evaluatedSourceString' ], - #category : #'GToolkit-Coder-Coders - Evaluation' + #category : 'GToolkit-Coder-Coders - Evaluation' } -{ #category : #'api - context' } +{ #category : 'api - context' } GtSourceCoderEvaluationContext >> all [ sourceInterval := GtSourceCoderEvaluationAllSource new ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderEvaluationContext >> coder [ ^ coder ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderEvaluationContext >> coder: aGtSourceCoder [ coder := aGtSourceCoder ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderEvaluationContext >> evaluatedInterval [ ^ evaluatedInterval ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderEvaluationContext >> evaluatedInterval: anObject [ evaluatedInterval := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderEvaluationContext >> evaluatedSourceString [ ^ evaluatedSourceString ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderEvaluationContext >> evaluatedSourceString: anObject [ evaluatedSourceString := anObject ] -{ #category : #'api - context' } +{ #category : 'api - context' } GtSourceCoderEvaluationContext >> from: aStartPosition to: aStopPosition [ sourceInterval := GtSourceCoderEvaluationPartialSource new startPosition: aStartPosition; @@ -57,41 +57,41 @@ GtSourceCoderEvaluationContext >> from: aStartPosition to: aStopPosition [ yourself ] -{ #category : #initialization } +{ #category : 'initialization' } GtSourceCoderEvaluationContext >> initialize [ super initialize. sourceInterval := GtSourceCoderEvaluationAllSource new ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderEvaluationContext >> requesterObject [ ^ requesterObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderEvaluationContext >> requesterObject: anObject [ requesterObject := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderEvaluationContext >> sourceInterval [ ^ sourceInterval ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderEvaluationContext >> sourceInterval: aGtSourceCoderEvaluationSourceInterval [ sourceInterval := aGtSourceCoderEvaluationSourceInterval ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderEvaluationContext >> sourceString [ ^ sourceString ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderEvaluationContext >> sourceString: anObject [ "Set the complete source string of the coder at the moment of the evaluation" diff --git a/src/GToolkit-Coder/GtSourceCoderEvaluationPartialSource.class.st b/src/GToolkit-Coder/GtSourceCoderEvaluationPartialSource.class.st index f75302734..57ef3cf5d 100644 --- a/src/GToolkit-Coder/GtSourceCoderEvaluationPartialSource.class.st +++ b/src/GToolkit-Coder/GtSourceCoderEvaluationPartialSource.class.st @@ -1,14 +1,14 @@ Class { - #name : #GtSourceCoderEvaluationPartialSource, - #superclass : #GtSourceCoderEvaluationSourceInterval, + #name : 'GtSourceCoderEvaluationPartialSource', + #superclass : 'GtSourceCoderEvaluationSourceInterval', #instVars : [ 'startPosition', 'stopPosition' ], - #category : #'GToolkit-Coder-Coders - Evaluation' + #category : 'GToolkit-Coder-Coders - Evaluation' } -{ #category : #evaluation } +{ #category : 'evaluation' } GtSourceCoderEvaluationPartialSource >> computeSourceInterval: aCompleteCoderSourceTextOrString [ @@ -16,7 +16,7 @@ GtSourceCoderEvaluationPartialSource >> computeSourceInterval: aCompleteCoderSou to: (self stopPosition min: aCompleteCoderSourceTextOrString size) ] -{ #category : #evaluation } +{ #category : 'evaluation' } GtSourceCoderEvaluationPartialSource >> computeSourceString: aCompleteCoderSourceTextOrString [ | anInterval | @@ -26,22 +26,22 @@ GtSourceCoderEvaluationPartialSource >> computeSourceString: aCompleteCoderSourc ^ (aCompleteCoderSourceTextOrString copyFrom: anInterval first to: anInterval last) asString ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderEvaluationPartialSource >> startPosition [ ^ startPosition ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderEvaluationPartialSource >> startPosition: anObject [ startPosition := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderEvaluationPartialSource >> stopPosition [ ^ stopPosition ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderEvaluationPartialSource >> stopPosition: anObject [ stopPosition := anObject ] diff --git a/src/GToolkit-Coder/GtSourceCoderEvaluationResult.class.st b/src/GToolkit-Coder/GtSourceCoderEvaluationResult.class.st index 02cb69ff1..c2c41c65b 100644 --- a/src/GToolkit-Coder/GtSourceCoderEvaluationResult.class.st +++ b/src/GToolkit-Coder/GtSourceCoderEvaluationResult.class.st @@ -1,66 +1,66 @@ Class { - #name : #GtSourceCoderEvaluationResult, - #superclass : #Object, + #name : 'GtSourceCoderEvaluationResult', + #superclass : 'Object', #instVars : [ 'evaluationContext' ], - #category : #'GToolkit-Coder-Coders - Evaluation' + #category : 'GToolkit-Coder-Coders - Evaluation' } -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderEvaluationResult >> evaluationContext [ ^ evaluationContext ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderEvaluationResult >> evaluationContext: anObject [ evaluationContext := anObject ] -{ #category : #testing } +{ #category : 'testing' } GtSourceCoderEvaluationResult >> isError [ ^ self isRuntimeError or: [ self isSyntaxError ] ] -{ #category : #testing } +{ #category : 'testing' } GtSourceCoderEvaluationResult >> isRuntimeError [ ^ false ] -{ #category : #testing } +{ #category : 'testing' } GtSourceCoderEvaluationResult >> isSuccess [ ^ false ] -{ #category : #testing } +{ #category : 'testing' } GtSourceCoderEvaluationResult >> isSyntaxError [ ^ false ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderEvaluationResult >> requesterObject [ ^ self evaluationContext requesterObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderEvaluationResult >> sourceCoder [ ^ self evaluationContext coder ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderEvaluationResult >> sourceInterval [ ^ self evaluationContext evaluatedInterval ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderEvaluationResult >> sourceInterval: anObject [ ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderEvaluationResult >> sourceString [ ^ self evaluationContext evaluatedSourceString ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderEvaluationResult >> sourceString: anObject [ ] diff --git a/src/GToolkit-Coder/GtSourceCoderEvaluationResultWithRuntimeError.class.st b/src/GToolkit-Coder/GtSourceCoderEvaluationResultWithRuntimeError.class.st index ccb6a0116..c9de298f5 100644 --- a/src/GToolkit-Coder/GtSourceCoderEvaluationResultWithRuntimeError.class.st +++ b/src/GToolkit-Coder/GtSourceCoderEvaluationResultWithRuntimeError.class.st @@ -1,34 +1,34 @@ Class { - #name : #GtSourceCoderEvaluationResultWithRuntimeError, - #superclass : #GtSourceCoderEvaluationResult, + #name : 'GtSourceCoderEvaluationResultWithRuntimeError', + #superclass : 'GtSourceCoderEvaluationResult', #instVars : [ 'error', 'isResignaled' ], - #category : #'GToolkit-Coder-Coders - Evaluation' + #category : 'GToolkit-Coder-Coders - Evaluation' } -{ #category : #'error handling' } +{ #category : 'error handling' } GtSourceCoderEvaluationResultWithRuntimeError >> error [ ^ error ] -{ #category : #'error handling' } +{ #category : 'error handling' } GtSourceCoderEvaluationResultWithRuntimeError >> error: anError [ error := anError ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderEvaluationResultWithRuntimeError >> isResignaled [ ^ isResignaled ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderEvaluationResultWithRuntimeError >> isResignaled: anObject [ isResignaled := anObject ] -{ #category : #testing } +{ #category : 'testing' } GtSourceCoderEvaluationResultWithRuntimeError >> isRuntimeError [ ^ true ] diff --git a/src/GToolkit-Coder/GtSourceCoderEvaluationResultWithSyntaxError.class.st b/src/GToolkit-Coder/GtSourceCoderEvaluationResultWithSyntaxError.class.st index e3987b1c2..b9f1ef3c5 100644 --- a/src/GToolkit-Coder/GtSourceCoderEvaluationResultWithSyntaxError.class.st +++ b/src/GToolkit-Coder/GtSourceCoderEvaluationResultWithSyntaxError.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtSourceCoderEvaluationResultWithSyntaxError, - #superclass : #GtSourceCoderEvaluationResult, - #category : #'GToolkit-Coder-Coders - Evaluation' + #name : 'GtSourceCoderEvaluationResultWithSyntaxError', + #superclass : 'GtSourceCoderEvaluationResult', + #category : 'GToolkit-Coder-Coders - Evaluation' } -{ #category : #testing } +{ #category : 'testing' } GtSourceCoderEvaluationResultWithSyntaxError >> isSyntaxError [ ^ true ] diff --git a/src/GToolkit-Coder/GtSourceCoderEvaluationResultWithValue.class.st b/src/GToolkit-Coder/GtSourceCoderEvaluationResultWithValue.class.st index c1df5cc18..936127fb1 100644 --- a/src/GToolkit-Coder/GtSourceCoderEvaluationResultWithValue.class.st +++ b/src/GToolkit-Coder/GtSourceCoderEvaluationResultWithValue.class.st @@ -1,23 +1,23 @@ Class { - #name : #GtSourceCoderEvaluationResultWithValue, - #superclass : #GtSourceCoderEvaluationResult, + #name : 'GtSourceCoderEvaluationResultWithValue', + #superclass : 'GtSourceCoderEvaluationResult', #instVars : [ 'value' ], - #category : #'GToolkit-Coder-Coders - Evaluation' + #category : 'GToolkit-Coder-Coders - Evaluation' } -{ #category : #testing } +{ #category : 'testing' } GtSourceCoderEvaluationResultWithValue >> isSuccess [ ^ true ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderEvaluationResultWithValue >> value [ ^ value ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderEvaluationResultWithValue >> value: anObject [ value := anObject ] diff --git a/src/GToolkit-Coder/GtSourceCoderEvaluationSourceInterval.class.st b/src/GToolkit-Coder/GtSourceCoderEvaluationSourceInterval.class.st index 388a6e2ff..791f12207 100644 --- a/src/GToolkit-Coder/GtSourceCoderEvaluationSourceInterval.class.st +++ b/src/GToolkit-Coder/GtSourceCoderEvaluationSourceInterval.class.st @@ -1,17 +1,17 @@ Class { - #name : #GtSourceCoderEvaluationSourceInterval, - #superclass : #Object, - #category : #'GToolkit-Coder-Coders - Evaluation' + #name : 'GtSourceCoderEvaluationSourceInterval', + #superclass : 'Object', + #category : 'GToolkit-Coder-Coders - Evaluation' } -{ #category : #evaluation } +{ #category : 'evaluation' } GtSourceCoderEvaluationSourceInterval >> computeSourceInterval: aCompleteCoderSourceTextOrString [ ^ self subclassResponsibility ] -{ #category : #evaluation } +{ #category : 'evaluation' } GtSourceCoderEvaluationSourceInterval >> computeSourceString: aCompleteCoderSourceTextOrString [ diff --git a/src/GToolkit-Coder/GtSourceReferenceHighlighter.class.st b/src/GToolkit-Coder/GtSourceReferenceHighlighter.class.st index 594e1295e..8f2799231 100644 --- a/src/GToolkit-Coder/GtSourceReferenceHighlighter.class.st +++ b/src/GToolkit-Coder/GtSourceReferenceHighlighter.class.st @@ -1,13 +1,13 @@ Class { - #name : #GtSourceReferenceHighlighter, - #superclass : #GtCoderAstStyler, + #name : 'GtSourceReferenceHighlighter', + #superclass : 'GtCoderAstStyler', #classVars : [ 'HighlightAttributes' ], - #category : #'GToolkit-Coder-Styler/Highlighter' + #category : 'GToolkit-Coder-Styler/Highlighter' } -{ #category : #'class initialization' } +{ #category : 'class initialization' } GtSourceReferenceHighlighter class >> initialize [ HighlightAttributes := { BlTextDecorationAttribute new diff --git a/src/GToolkit-Coder/GtTextCoder.class.st b/src/GToolkit-Coder/GtTextCoder.class.st index 1a6f88585..7dd0bd82d 100644 --- a/src/GToolkit-Coder/GtTextCoder.class.st +++ b/src/GToolkit-Coder/GtTextCoder.class.st @@ -1,14 +1,14 @@ Class { - #name : #GtTextCoder, - #superclass : #GtTextualCoder, + #name : 'GtTextCoder', + #superclass : 'GtTextualCoder', #instVars : [ 'parser', 'parserStartingState' ], - #category : #'GToolkit-Coder-Coders' + #category : 'GToolkit-Coder-Coders' } -{ #category : #'api - ast' } +{ #category : 'api - ast' } GtTextCoder >> computeAst: theSourceString [ ^ parser ifNil: [ theSourceString ] @@ -18,37 +18,37 @@ GtTextCoder >> computeAst: theSourceString [ ifNotNil: [ parser parseWithErrors: theSourceString startingAt: parserStartingState ] ] ] -{ #category : #initialization } +{ #category : 'initialization' } GtTextCoder >> forString: aString [ self sourceCode: (GtCoderExplicitSourceCode new source: aString) ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtTextCoder >> newCompletionStrategy [ ^ GtCompletionStrategy new ] -{ #category : #accessing } +{ #category : 'accessing' } GtTextCoder >> parser [ ^ parser ] -{ #category : #accessing } +{ #category : 'accessing' } GtTextCoder >> parser: anObject [ parser := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtTextCoder >> parserStartingState [ ^ parserStartingState ] -{ #category : #accessing } +{ #category : 'accessing' } GtTextCoder >> parserStartingState: anObject [ parserStartingState := anObject ] -{ #category : #'api - ast' } +{ #category : 'api - ast' } GtTextCoder >> supportsAstCache [ ^ false ] diff --git a/src/GToolkit-Coder/GtTextualCoder.class.st b/src/GToolkit-Coder/GtTextualCoder.class.st index 77f41c052..cff7c3f19 100644 --- a/src/GToolkit-Coder/GtTextualCoder.class.st +++ b/src/GToolkit-Coder/GtTextualCoder.class.st @@ -1,6 +1,6 @@ Class { - #name : #GtTextualCoder, - #superclass : #GtCoderModel, + #name : 'GtTextualCoder', + #superclass : 'GtCoderModel', #instVars : [ 'sourceCode', 'completionStrategy', @@ -10,36 +10,36 @@ Class { 'astCommand', 'astCommandBlock' ], - #category : #'GToolkit-Coder-Coders' + #category : 'GToolkit-Coder-Coders' } -{ #category : #'private - addons' } +{ #category : 'private - addons' } GtTextualCoder >> addOnsClass [ ^ GtTextualCoderAddOns ] -{ #category : #'api - text' } +{ #category : 'api - text' } GtTextualCoder >> appendString: aString [ self critical: [ self sourceCode appendString: aString. self sourceChanged ] ] -{ #category : #'api - text' } +{ #category : 'api - text' } GtTextualCoder >> appendText: aText [ self critical: [ self sourceCode appendText: aText. self sourceChanged ] ] -{ #category : #'api - text' } +{ #category : 'api - text' } GtTextualCoder >> appendText: aText with: aGtCoderUpdateStragegy [ self critical: [ self sourceCode appendText: aText. self sourceChangedWith: aGtCoderUpdateStragegy ] ] -{ #category : #'api - converting' } +{ #category : 'api - converting' } GtTextualCoder >> asNewCoderModelWithSameSubject [ "Return new coder model with same subject (e.g., package, class, method)" @@ -47,7 +47,7 @@ GtTextualCoder >> asNewCoderModelWithSameSubject [ ^ self shouldNotImplement ] -{ #category : #'api - ast' } +{ #category : 'api - ast' } GtTextualCoder >> astAsyncDo: aBlock [ astMonitor critical: [ astCommand ifNotNil: [ @@ -92,7 +92,7 @@ GtTextualCoder >> astAsyncDo: aBlock [ otherwise: [ astCommand execute ] ] ] -{ #category : #'api - ast' } +{ #category : 'api - ast' } GtTextualCoder >> astAwait [ | theAst | @@ -101,7 +101,7 @@ GtTextualCoder >> astAwait [ ^ theAst ] -{ #category : #'api - ast' } +{ #category : 'api - ast' } GtTextualCoder >> astAwaitDo: aBlock [ | aSemaphore anAst | @@ -115,25 +115,25 @@ GtTextualCoder >> astAwaitDo: aBlock [ aBlock value: anAst ] -{ #category : #'private - ast' } +{ #category : 'private - ast' } GtTextualCoder >> astCache [ ^ astMonitor critical: [ astCache ] ] -{ #category : #'private - ast' } +{ #category : 'private - ast' } GtTextualCoder >> astCache: anAssociation [ astMonitor critical: [ astCache := anAssociation ]. self onAstChanged ] -{ #category : #'api - text' } +{ #category : 'api - text' } GtTextualCoder >> collapsedText [ ^ self sourceCode collapsedText ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtTextualCoder >> completionStrategy [ @@ -141,22 +141,22 @@ GtTextualCoder >> completionStrategy [ ifNil: [ completionStrategy := self newCompletionStrategy ] ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtTextualCoder >> completionStrategy: aGtCompletionStrategy [ completionStrategy := aGtCompletionStrategy ] -{ #category : #'api - ast' } +{ #category : 'api - ast' } GtTextualCoder >> computeAst [ ^ self computeAst: self currentSourceString ] -{ #category : #'api - ast' } +{ #category : 'api - ast' } GtTextualCoder >> computeAst: theSourceString [ ^ self subclassResponsibility ] -{ #category : #'api - text' } +{ #category : 'api - text' } GtTextualCoder >> correctFrom: aFromIndex to: aToIndex with: aString [ self critical: [ self sourceCode @@ -167,7 +167,7 @@ GtTextualCoder >> correctFrom: aFromIndex to: aToIndex with: aString [ self notifyCorrectionFrom: aFromIndex to: aToIndex with: aString ] ] -{ #category : #'api - text' } +{ #category : 'api - text' } GtTextualCoder >> currentSourceString [ "Return a String representation of the current source text" @@ -175,7 +175,7 @@ GtTextualCoder >> currentSourceString [ ^ self critical: [ self sourceCode sourceString ] ] -{ #category : #'api - text' } +{ #category : 'api - text' } GtTextualCoder >> currentSourceString: aString [ "Set a new source text" @@ -184,7 +184,7 @@ GtTextualCoder >> currentSourceString: aString [ self sourceChanged ] ] -{ #category : #'api - text' } +{ #category : 'api - text' } GtTextualCoder >> currentSourceText: aText [ "Set a new source text" @@ -193,7 +193,7 @@ GtTextualCoder >> currentSourceText: aText [ self sourceChanged ] ] -{ #category : #'api - text' } +{ #category : 'api - text' } GtTextualCoder >> currentSourceText: aText with: aGtCoderUpdateStragegy [ "Set a new source text" @@ -202,7 +202,7 @@ GtTextualCoder >> currentSourceText: aText with: aGtCoderUpdateStragegy [ self sourceChangedWith: aGtCoderUpdateStragegy ] ] -{ #category : #'api - text' } +{ #category : 'api - text' } GtTextualCoder >> currentSourceTextSynchronously: aText [ "Set a new source text" @@ -211,19 +211,19 @@ GtTextualCoder >> currentSourceTextSynchronously: aText [ self sourceChangedWith: GtCoderUpdateStrategy new makeSynchronous ] ] -{ #category : #'api - text' } +{ #category : 'api - text' } GtTextualCoder >> deleteSourceTextFrom: aFromIndex to: aToIndex [ self critical: [ self sourceCode delete: aFromIndex to: aToIndex. self sourceChanged ] ] -{ #category : #'api - ast' } +{ #category : 'api - ast' } GtTextualCoder >> ensureAst [ self astAsyncDo: [ :theAst | ] ] -{ #category : #initialize } +{ #category : 'initialize' } GtTextualCoder >> initialize [ super initialize. @@ -231,19 +231,19 @@ GtTextualCoder >> initialize [ self reset ] -{ #category : #testing } +{ #category : 'testing' } GtTextualCoder >> isModified [ ^ self sourceCode isModified ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtTextualCoder >> newCompletionStrategy [ ^ self subclassResponsibility ] -{ #category : #'private - notifying' } +{ #category : 'private - notifying' } GtTextualCoder >> notifyCorrectionFrom: aFromIndex to: aToIndex with: aString [ self announce: (GtCoderCorrectionRequest new coder: self; @@ -252,7 +252,7 @@ GtTextualCoder >> notifyCorrectionFrom: aFromIndex to: aToIndex with: aString [ correctionString: aString) ] -{ #category : #'private - notifying' } +{ #category : 'private - notifying' } GtTextualCoder >> notifySourceChangedWith: anUpdateStragegy [ "Notify the text editor that it should update the text (for example due to refactoring changes)" @@ -261,7 +261,7 @@ GtTextualCoder >> notifySourceChangedWith: anUpdateStragegy [ coder: self) ] -{ #category : #'private - notifying' } +{ #category : 'private - notifying' } GtTextualCoder >> notifyStylersUpdated [ "Is sent when AddOn stylers changed. It also means that the text editor should restyle the text" @@ -270,11 +270,11 @@ GtTextualCoder >> notifyStylersUpdated [ stylers: self addOns stylers copy) ] -{ #category : #'private - ast' } +{ #category : 'private - ast' } GtTextualCoder >> onAstChanged [ ] -{ #category : #private } +{ #category : 'private' } GtTextualCoder >> pragmasNamed: aSymbol inHierarchy: aClass [ | actions | actions := OrderedCollection new. @@ -283,7 +283,7 @@ GtTextualCoder >> pragmasNamed: aSymbol inHierarchy: aClass [ ^ actions ] -{ #category : #'api - text' } +{ #category : 'api - text' } GtTextualCoder >> requestStyleSourceText [ "Request the text editor to restyle the text (for example due to environmental changes)" @@ -291,7 +291,7 @@ GtTextualCoder >> requestStyleSourceText [ self announce: (GtCoderStyleTextRequest new coder: self) ] -{ #category : #'api - text' } +{ #category : 'api - text' } GtTextualCoder >> requestStyleSourceTextAndAfterDo: aBlock [ "Request the text editor to restyle the text (for example due to environmental changes)" @@ -303,7 +303,7 @@ GtTextualCoder >> requestStyleSourceTextAndAfterDo: aBlock [ afterAction: aBlock) ] -{ #category : #'api - text' } +{ #category : 'api - text' } GtTextualCoder >> requestUpdateCollapsedText [ "Request to update the collapsed text, for example due to changes in the current source text. It is not guaranteed that the collapsed text actually changes as for example in the method coder @@ -313,7 +313,7 @@ GtTextualCoder >> requestUpdateCollapsedText [ self announce: (GtCoderCollapsedLabelChanged new coder: self) ] -{ #category : #initialize } +{ #category : 'initialize' } GtTextualCoder >> reset [ self resetASTCache. @@ -322,17 +322,17 @@ GtTextualCoder >> reset [ completionStrategy := nil ] -{ #category : #'private - ast' } +{ #category : 'private - ast' } GtTextualCoder >> resetASTCache [ self astCache: (nil -> nil) ] -{ #category : #'event handling' } +{ #category : 'event handling' } GtTextualCoder >> sourceChanged [ self sourceChangedWith: GtCoderUpdateStrategy new makeAsynchronous ] -{ #category : #'event handling' } +{ #category : 'event handling' } GtTextualCoder >> sourceChangedWith: anUpdateStrategy [ "if there is an ast computation that was triggered before source code change we re-schedule the computation. Any #astAsyncDo: caller will be waiting for the result with the new ast" @@ -357,7 +357,7 @@ GtTextualCoder >> sourceChangedWith: anUpdateStrategy [ self requestUpdateCollapsedText ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtTextualCoder >> sourceCode [ @@ -365,7 +365,7 @@ GtTextualCoder >> sourceCode [ ^ sourceCode ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtTextualCoder >> sourceCode: aGtCoderSourceCode [ "Set the source code of this coder to a given one and notify about the changes" @@ -374,7 +374,7 @@ GtTextualCoder >> sourceCode: aGtCoderSourceCode [ withStrategy: GtCoderUpdateStrategy new makeAsynchronous ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtTextualCoder >> sourceCode: aGtCoderSourceCode withStrategy: anUpdateStragegy [ "Set the source code of this coder to a given one and notify about the changes" @@ -382,14 +382,14 @@ GtTextualCoder >> sourceCode: aGtCoderSourceCode withStrategy: anUpdateStragegy self sourceChangedWith: anUpdateStragegy. ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtTextualCoder >> sourceCodeSynchronously: aGtCoderSourceCode [ self sourceCode: aGtCoderSourceCode withStrategy: GtCoderUpdateStrategy new makeSynchronous ] -{ #category : #'api - text' } +{ #category : 'api - text' } GtTextualCoder >> sourceText [ "Return the source text of this coder. The computation of the source text may be expensive, use me with caution. If the operation you would like to perform on the source text is optional consider using #sourceTextDo:" @@ -398,26 +398,26 @@ GtTextualCoder >> sourceText [ ^ self sourceCode sourceText ] -{ #category : #'api - text' } +{ #category : 'api - text' } GtTextualCoder >> sourceTextDo: aBlock [ "Evaluate a given block with my source code text if present" ^ self sourceCode sourceTextDo: aBlock ] -{ #category : #'api - addons' } +{ #category : 'api - addons' } GtTextualCoder >> stylers [ ^ #() ] -{ #category : #'api - ast' } +{ #category : 'api - ast' } GtTextualCoder >> supportsAstCache [ "Return true if ast cache should be used, false otherwise" ^ true ] -{ #category : #'api - ast' } +{ #category : 'api - ast' } GtTextualCoder >> terminateAstCommand [ astMonitor critical: [ astCommand ifNotNil: [ :anAstCommand | anAstCommand terminate ]. diff --git a/src/GToolkit-Coder/GtTextualCoderAddOns.class.st b/src/GToolkit-Coder/GtTextualCoderAddOns.class.st index 08a907cf2..c49ac9074 100644 --- a/src/GToolkit-Coder/GtTextualCoderAddOns.class.st +++ b/src/GToolkit-Coder/GtTextualCoderAddOns.class.st @@ -1,20 +1,20 @@ Class { - #name : #GtTextualCoderAddOns, - #superclass : #GtCoderAddOns, + #name : 'GtTextualCoderAddOns', + #superclass : 'GtCoderAddOns', #instVars : [ 'stylers' ], - #category : #'GToolkit-Coder-Coders - Addons' + #category : 'GToolkit-Coder-Coders - Addons' } -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderAddOns >> addAddOns: aGtCoderAddOns [ super addAddOns: aGtCoderAddOns. self addStylers: aGtCoderAddOns stylers ] -{ #category : #'api - stylers' } +{ #category : 'api - stylers' } GtTextualCoderAddOns >> addStyler: aStyler [ (stylers anySatisfy: [ :each | each class = aStyler class ]) ifTrue: [ ^ self ]. @@ -22,12 +22,12 @@ GtTextualCoderAddOns >> addStyler: aStyler [ stylers add: aStyler ] -{ #category : #'api - stylers' } +{ #category : 'api - stylers' } GtTextualCoderAddOns >> addStylers: aCollectionOfStylers [ aCollectionOfStylers do: [ :eachStyler | self addStyler: eachStyler ] ] -{ #category : #changes } +{ #category : 'changes' } GtTextualCoderAddOns >> differenceWith: aGtCoderAddOns on: aStream [ super differenceWith: aGtCoderAddOns on: aStream. @@ -35,7 +35,7 @@ GtTextualCoderAddOns >> differenceWith: aGtCoderAddOns on: aStream [ ifFalse: [ aStream nextPut: GtCoderAddOnsStylersDifference new ] ] -{ #category : #'gt-extensions' } +{ #category : 'gt-extensions' } GtTextualCoderAddOns >> gtViewStylersFor: aView [ ^ aView list @@ -44,19 +44,19 @@ GtTextualCoderAddOns >> gtViewStylersFor: aView [ items: [ self stylers ] ] -{ #category : #'initialize-release' } +{ #category : 'initialize-release' } GtTextualCoderAddOns >> initialize [ super initialize. stylers := OrderedCollection new ] -{ #category : #copying } +{ #category : 'copying' } GtTextualCoderAddOns >> postCopy [ super postCopy. stylers := stylers copy ] -{ #category : #'api - stylers' } +{ #category : 'api - stylers' } GtTextualCoderAddOns >> stylers [ ^ stylers ] diff --git a/src/GToolkit-Coder/GtTraitsCompletionStrategy.class.st b/src/GToolkit-Coder/GtTraitsCompletionStrategy.class.st index fb2c49d27..4cee42d13 100644 --- a/src/GToolkit-Coder/GtTraitsCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtTraitsCompletionStrategy.class.st @@ -1,13 +1,13 @@ Class { - #name : #GtTraitsCompletionStrategy, - #superclass : #GtCompletionStrategy, + #name : 'GtTraitsCompletionStrategy', + #superclass : 'GtCompletionStrategy', #instVars : [ 'candidateTraits' ], - #category : #'GToolkit-Coder-Completion' + #category : 'GToolkit-Coder-Completion' } -{ #category : #accessing } +{ #category : 'accessing' } GtTraitsCompletionStrategy >> candidateTraits [ ^ candidateTraits ifNil: [ | theInterestingTraitNames | @@ -15,7 +15,7 @@ GtTraitsCompletionStrategy >> candidateTraits [ candidateTraits := GtPrefixTree withAll: theInterestingTraitNames ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtTraitsCompletionStrategy >> completionActionsFor: aText at: positionInteger max: maxInteger [ | currentInput completionActions | @@ -30,12 +30,12 @@ GtTraitsCompletionStrategy >> completionActionsFor: aText at: positionInteger ma ^ completionActions ] -{ #category : #testing } +{ #category : 'testing' } GtTraitsCompletionStrategy >> hasCompletionEntryFor: aString [ ^ true ] -{ #category : #testing } +{ #category : 'testing' } GtTraitsCompletionStrategy >> hasCompletionsAt: anInteger in: aText [ ^ true ] diff --git a/src/GToolkit-Coder/GtWatchExpression.class.st b/src/GToolkit-Coder/GtWatchExpression.class.st index c09965bdb..3b9914ffc 100644 --- a/src/GToolkit-Coder/GtWatchExpression.class.st +++ b/src/GToolkit-Coder/GtWatchExpression.class.st @@ -1,65 +1,65 @@ Class { - #name : #GtWatchExpression, - #superclass : #Object, + #name : 'GtWatchExpression', + #superclass : 'Object', #instVars : [ 'expression' ], #classVars : [ 'MethodExpressions' ], - #category : #'GToolkit-Coder' + #category : 'GToolkit-Coder' } -{ #category : #accessing } +{ #category : 'accessing' } GtWatchExpression class >> addExpression: aString for: aCompiledMethod [ ^ ((self methodExpressions at: aCompiledMethod methodClass ifAbsentPut: [ WeakKeyDictionary new ]) at: aCompiledMethod selector ifAbsentPut: [ Set new ]) add: (self new expression: aString) ] -{ #category : #accessing } +{ #category : 'accessing' } GtWatchExpression class >> expressionsFor: aCompiledMethod [ ^ (self methodExpressions at: aCompiledMethod methodClass ifAbsent: [ ^ #() ]) at: aCompiledMethod selector ifAbsent: [ #() ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtWatchExpression class >> methodExpressions [ ^ MethodExpressions ifNil: [ MethodExpressions := WeakKeyDictionary new ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtWatchExpression class >> removeExpression: aWatchExpression for: aCompiledMethod [ ((self methodExpressions at: aCompiledMethod methodClass ifAbsent: [ ^ self ]) at: aCompiledMethod selector ifAbsent: [ ^ self ]) remove: aWatchExpression ifAbsent: [ ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtWatchExpression class >> reset [ MethodExpressions := nil ] -{ #category : #comparing } +{ #category : 'comparing' } GtWatchExpression >> = anObject [ ^ self class = anObject class and: [ self expression = anObject expression ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtWatchExpression >> expression [ ^ expression ] -{ #category : #accessing } +{ #category : 'accessing' } GtWatchExpression >> expression: aString [ expression := aString ] -{ #category : #comparing } +{ #category : 'comparing' } GtWatchExpression >> hash [ ^ expression hash ] -{ #category : #evaluating } +{ #category : 'evaluating' } GtWatchExpression >> valueIn: aContext [ ^ [ aContext receiver class compiler source: expression; diff --git a/src/GToolkit-Coder/PrettyTextDiffBuilder.extension.st b/src/GToolkit-Coder/PrettyTextDiffBuilder.extension.st index 01c9c29cb..d692c1379 100644 --- a/src/GToolkit-Coder/PrettyTextDiffBuilder.extension.st +++ b/src/GToolkit-Coder/PrettyTextDiffBuilder.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #PrettyTextDiffBuilder } +Extension { #name : 'PrettyTextDiffBuilder' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } PrettyTextDiffBuilder >> newStyler [ ^ BrRBTextStyler new classOrMetaClass: sourceClass ] diff --git a/src/GToolkit-Coder/RBAbstractCondition.extension.st b/src/GToolkit-Coder/RBAbstractCondition.extension.st index e9012c497..c7f77eb26 100644 --- a/src/GToolkit-Coder/RBAbstractCondition.extension.st +++ b/src/GToolkit-Coder/RBAbstractCondition.extension.st @@ -1,11 +1,11 @@ -Extension { #name : #RBAbstractCondition } +Extension { #name : 'RBAbstractCondition' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBAbstractCondition >> gtChildren [ ^ #() ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBAbstractCondition >> gtLeafChildren [ ^ { self } ] diff --git a/src/GToolkit-Coder/RBAddPoolVariableChange.extension.st b/src/GToolkit-Coder/RBAddPoolVariableChange.extension.st index 21b503f5a..cd354fbc4 100644 --- a/src/GToolkit-Coder/RBAddPoolVariableChange.extension.st +++ b/src/GToolkit-Coder/RBAddPoolVariableChange.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBAddPoolVariableChange } +Extension { #name : 'RBAddPoolVariableChange' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBAddPoolVariableChange >> changeObject [ ^ Smalltalk globals at: self variable asSymbol ] diff --git a/src/GToolkit-Coder/RBArrayNode.extension.st b/src/GToolkit-Coder/RBArrayNode.extension.st index 8cf8c00b2..15687f2ee 100644 --- a/src/GToolkit-Coder/RBArrayNode.extension.st +++ b/src/GToolkit-Coder/RBArrayNode.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBArrayNode } +Extension { #name : 'RBArrayNode' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBArrayNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. periods diff --git a/src/GToolkit-Coder/RBAssignmentNode.extension.st b/src/GToolkit-Coder/RBAssignmentNode.extension.st index 932ce03eb..568551cf9 100644 --- a/src/GToolkit-Coder/RBAssignmentNode.extension.st +++ b/src/GToolkit-Coder/RBAssignmentNode.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBAssignmentNode } +Extension { #name : 'RBAssignmentNode' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBAssignmentNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. assignment ifNotNil: [ assignment := assignment + anInteger ] diff --git a/src/GToolkit-Coder/RBBlockNode.extension.st b/src/GToolkit-Coder/RBBlockNode.extension.st index 9d93e4028..9ab4f3f4c 100644 --- a/src/GToolkit-Coder/RBBlockNode.extension.st +++ b/src/GToolkit-Coder/RBBlockNode.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBBlockNode } +Extension { #name : 'RBBlockNode' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBBlockNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. colons ifNotNil: [ colons := colons collect: [ :f | f + anInteger ] ]. diff --git a/src/GToolkit-Coder/RBCascadeNode.extension.st b/src/GToolkit-Coder/RBCascadeNode.extension.st index acb9718b5..b1f9dcba2 100644 --- a/src/GToolkit-Coder/RBCascadeNode.extension.st +++ b/src/GToolkit-Coder/RBCascadeNode.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBCascadeNode } +Extension { #name : 'RBCascadeNode' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBCascadeNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. (messages size - 1) timesRepeat: [ self receiver gtMoveBy: 0 - anInteger ]. diff --git a/src/GToolkit-Coder/RBChangeMethodNameRefactoring.extension.st b/src/GToolkit-Coder/RBChangeMethodNameRefactoring.extension.st index 894a9d830..938d66c3a 100644 --- a/src/GToolkit-Coder/RBChangeMethodNameRefactoring.extension.st +++ b/src/GToolkit-Coder/RBChangeMethodNameRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBChangeMethodNameRefactoring } +Extension { #name : 'RBChangeMethodNameRefactoring' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBChangeMethodNameRefactoring >> gtPreconditions [ "This refactoring only preserves behavior if all implementors are renamed." diff --git a/src/GToolkit-Coder/RBClass.extension.st b/src/GToolkit-Coder/RBClass.extension.st index 059f01568..5ce845758 100644 --- a/src/GToolkit-Coder/RBClass.extension.st +++ b/src/GToolkit-Coder/RBClass.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBClass } +Extension { #name : 'RBClass' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBClass >> traitExpression [ ^ (self isDefined and: [ self realClass hasTraitComposition ]) ifTrue: [ self realClass traitComposition printString ] diff --git a/src/GToolkit-Coder/RBCommentChange.extension.st b/src/GToolkit-Coder/RBCommentChange.extension.st index 7d0dc9f5f..263d3c613 100644 --- a/src/GToolkit-Coder/RBCommentChange.extension.st +++ b/src/GToolkit-Coder/RBCommentChange.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBCommentChange } +Extension { #name : 'RBCommentChange' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBCommentChange >> gtChangesFor: aView [ ^ aView explicit diff --git a/src/GToolkit-Coder/RBCompositeRefactoryChange.extension.st b/src/GToolkit-Coder/RBCompositeRefactoryChange.extension.st index 21e075d5d..f95cd5f74 100644 --- a/src/GToolkit-Coder/RBCompositeRefactoryChange.extension.st +++ b/src/GToolkit-Coder/RBCompositeRefactoryChange.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBCompositeRefactoryChange } +Extension { #name : 'RBCompositeRefactoryChange' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBCompositeRefactoryChange >> gtWithoutChanges [ ^ self shallowCopy changes: #(); diff --git a/src/GToolkit-Coder/RBCondition.extension.st b/src/GToolkit-Coder/RBCondition.extension.st index 4a4297077..35e793293 100644 --- a/src/GToolkit-Coder/RBCondition.extension.st +++ b/src/GToolkit-Coder/RBCondition.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBCondition } +Extension { #name : 'RBCondition' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBCondition class >> includesPoolDictionary: aString in: aClass [ ^ self new type: (Array with: #includesPool with: aString with: aClass) @@ -8,7 +8,7 @@ RBCondition class >> includesPoolDictionary: aString in: aClass [ errorString: aString , ' is <1?:not >included in ' , aClass name ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBCondition class >> isPoolDictionary: aString in: aRBSmalltalk [ ^ self new type: (Array with: #isPoolDictionary with: aString) diff --git a/src/GToolkit-Coder/RBConjunctiveCondition.extension.st b/src/GToolkit-Coder/RBConjunctiveCondition.extension.st index 431dbd0ed..404c184aa 100644 --- a/src/GToolkit-Coder/RBConjunctiveCondition.extension.st +++ b/src/GToolkit-Coder/RBConjunctiveCondition.extension.st @@ -1,11 +1,11 @@ -Extension { #name : #RBConjunctiveCondition } +Extension { #name : 'RBConjunctiveCondition' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBConjunctiveCondition >> gtChildren [ ^ { left . right } ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBConjunctiveCondition >> gtLeafChildren [ ^ left gtLeafChildren, right gtLeafChildren ] diff --git a/src/GToolkit-Coder/RBLiteralNode.extension.st b/src/GToolkit-Coder/RBLiteralNode.extension.st index 78ecb4692..0fe573913 100644 --- a/src/GToolkit-Coder/RBLiteralNode.extension.st +++ b/src/GToolkit-Coder/RBLiteralNode.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBLiteralNode } +Extension { #name : 'RBLiteralNode' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBLiteralNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. start ifNotNil: [ start := start + anInteger ]. diff --git a/src/GToolkit-Coder/RBMessageNode.extension.st b/src/GToolkit-Coder/RBMessageNode.extension.st index 7dfab62f7..abb4e529e 100644 --- a/src/GToolkit-Coder/RBMessageNode.extension.st +++ b/src/GToolkit-Coder/RBMessageNode.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBMessageNode } +Extension { #name : 'RBMessageNode' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBMessageNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. keywordsPositions diff --git a/src/GToolkit-Coder/RBMethod.extension.st b/src/GToolkit-Coder/RBMethod.extension.st index 7e89bb03d..d5a1ebe14 100644 --- a/src/GToolkit-Coder/RBMethod.extension.st +++ b/src/GToolkit-Coder/RBMethod.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBMethod } +Extension { #name : 'RBMethod' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBMethod >> containsSubstring: aString [ ^ (source ifNil: [ (class realClass sourceCodeAt: selector) asString ]) diff --git a/src/GToolkit-Coder/RBMethodNode.extension.st b/src/GToolkit-Coder/RBMethodNode.extension.st index 74564e5e0..dd71d79e1 100644 --- a/src/GToolkit-Coder/RBMethodNode.extension.st +++ b/src/GToolkit-Coder/RBMethodNode.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBMethodNode } +Extension { #name : 'RBMethodNode' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBMethodNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. keywordsPositions diff --git a/src/GToolkit-Coder/RBNamespace.extension.st b/src/GToolkit-Coder/RBNamespace.extension.st index 10504677a..4bef3e181 100644 --- a/src/GToolkit-Coder/RBNamespace.extension.st +++ b/src/GToolkit-Coder/RBNamespace.extension.st @@ -1,17 +1,17 @@ -Extension { #name : #RBNamespace } +Extension { #name : 'RBNamespace' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBNamespace >> category: aString for: aClass [ ^ changes addChange: (RBClassCategoryChange category: aString for: aClass) ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBNamespace >> changedClasses [ ^ changedClasses ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBNamespace >> classObjectFor: anObject [ (anObject isBehavior or: [anObject isTrait]) @@ -21,12 +21,12 @@ RBNamespace >> classObjectFor: anObject [ ^ anObject ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBNamespace >> newClasses [ ^ newClasses ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBNamespace >> removePool: aString from: aRBClass [ ^changes removePool: aString from: aRBClass ] diff --git a/src/GToolkit-Coder/RBNegationCondition.extension.st b/src/GToolkit-Coder/RBNegationCondition.extension.st index ffc0131c4..0bac28baf 100644 --- a/src/GToolkit-Coder/RBNegationCondition.extension.st +++ b/src/GToolkit-Coder/RBNegationCondition.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBNegationCondition } +Extension { #name : 'RBNegationCondition' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBNegationCondition >> gtChildren [ ^ condition gtChildren collect: [ :eachCondition | eachCondition not ] ] diff --git a/src/GToolkit-Coder/RBParseErrorNode.extension.st b/src/GToolkit-Coder/RBParseErrorNode.extension.st index 89fc9c541..ec2105973 100644 --- a/src/GToolkit-Coder/RBParseErrorNode.extension.st +++ b/src/GToolkit-Coder/RBParseErrorNode.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBParseErrorNode } +Extension { #name : 'RBParseErrorNode' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBParseErrorNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. start ifNotNil: [ start := start + anInteger ] diff --git a/src/GToolkit-Coder/RBPragmaNode.extension.st b/src/GToolkit-Coder/RBPragmaNode.extension.st index 963884f68..e94fa8a51 100644 --- a/src/GToolkit-Coder/RBPragmaNode.extension.st +++ b/src/GToolkit-Coder/RBPragmaNode.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBPragmaNode } +Extension { #name : 'RBPragmaNode' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBPragmaNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. keywordsPositions diff --git a/src/GToolkit-Coder/RBProgramNode.extension.st b/src/GToolkit-Coder/RBProgramNode.extension.st index 62eb9d6ae..94bed7f6b 100644 --- a/src/GToolkit-Coder/RBProgramNode.extension.st +++ b/src/GToolkit-Coder/RBProgramNode.extension.st @@ -1,17 +1,17 @@ -Extension { #name : #RBProgramNode } +Extension { #name : 'RBProgramNode' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBProgramNode >> gtMoveAllBy: anInteger [ self gtMoveBy: anInteger. self children do: [ :e | e gtMoveAllBy: anInteger ] ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBProgramNode >> gtMoveBy: anInteger [ self comments do: [ :f | f with: f contents at: f start + anInteger ] ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBProgramNode >> withAllParentsDo: aBlock [ | node | node := self. diff --git a/src/GToolkit-Coder/RBRefactoring.extension.st b/src/GToolkit-Coder/RBRefactoring.extension.st index cb782cb97..f8d20516f 100644 --- a/src/GToolkit-Coder/RBRefactoring.extension.st +++ b/src/GToolkit-Coder/RBRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBRefactoring } +Extension { #name : 'RBRefactoring' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBRefactoring >> gtDangers [ @@ -11,7 +11,7 @@ RBRefactoring >> gtDangers [ description: (eachCondition errorMacro expandMacrosWith: false) ] ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBRefactoring >> gtExecute: isForce [ isForce ifTrue: [ self transform ] @@ -19,12 +19,12 @@ RBRefactoring >> gtExecute: isForce [ RBRefactoryChangeManager instance performChange: self changes; addUndoPointer: 1 ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBRefactoring >> gtPreconditions [ ^ self preconditions ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBRefactoring >> gtTransform [ self transform ] diff --git a/src/GToolkit-Coder/RBRefactoryChange.extension.st b/src/GToolkit-Coder/RBRefactoryChange.extension.st index 1d1a47fd3..ef9dfd56d 100644 --- a/src/GToolkit-Coder/RBRefactoryChange.extension.st +++ b/src/GToolkit-Coder/RBRefactoryChange.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBRefactoryChange } +Extension { #name : 'RBRefactoryChange' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBRefactoryChange >> gtWithoutChanges [ ^ self ] diff --git a/src/GToolkit-Coder/RBRemoveInstanceVariableRefactoring.extension.st b/src/GToolkit-Coder/RBRemoveInstanceVariableRefactoring.extension.st index 80a3fe941..c490bedb7 100644 --- a/src/GToolkit-Coder/RBRemoveInstanceVariableRefactoring.extension.st +++ b/src/GToolkit-Coder/RBRemoveInstanceVariableRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBRemoveInstanceVariableRefactoring } +Extension { #name : 'RBRemoveInstanceVariableRefactoring' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBRemoveInstanceVariableRefactoring >> gtPreconditions [ | references | diff --git a/src/GToolkit-Coder/RBRemovePoolVariableChange.extension.st b/src/GToolkit-Coder/RBRemovePoolVariableChange.extension.st index bd8df502d..a91439049 100644 --- a/src/GToolkit-Coder/RBRemovePoolVariableChange.extension.st +++ b/src/GToolkit-Coder/RBRemovePoolVariableChange.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBRemovePoolVariableChange } +Extension { #name : 'RBRemovePoolVariableChange' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBRemovePoolVariableChange >> changeObject [ ^ Smalltalk globals at: self variable asSymbol ] diff --git a/src/GToolkit-Coder/RBReplaceMethodRefactoring.extension.st b/src/GToolkit-Coder/RBReplaceMethodRefactoring.extension.st index 5f7e3047b..9a36492f5 100644 --- a/src/GToolkit-Coder/RBReplaceMethodRefactoring.extension.st +++ b/src/GToolkit-Coder/RBReplaceMethodRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBReplaceMethodRefactoring } +Extension { #name : 'RBReplaceMethodRefactoring' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBReplaceMethodRefactoring >> gtPreconditions [ |conditions| conditions := (RBCondition withBlock: [ self haveSameNumberOfArgs. true]) diff --git a/src/GToolkit-Coder/RBSequenceNode.extension.st b/src/GToolkit-Coder/RBSequenceNode.extension.st index 2e06f438e..d6064d954 100644 --- a/src/GToolkit-Coder/RBSequenceNode.extension.st +++ b/src/GToolkit-Coder/RBSequenceNode.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBSequenceNode } +Extension { #name : 'RBSequenceNode' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBSequenceNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. periods ifNotNil: [ periods := periods collect: [ :f | f + anInteger ] ]. diff --git a/src/GToolkit-Coder/RBTransformation.extension.st b/src/GToolkit-Coder/RBTransformation.extension.st index 4a00240ab..ccc3f6381 100644 --- a/src/GToolkit-Coder/RBTransformation.extension.st +++ b/src/GToolkit-Coder/RBTransformation.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBTransformation } +Extension { #name : 'RBTransformation' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBTransformation >> gtDangers [ @@ -11,12 +11,12 @@ RBTransformation >> gtDangers [ description: (eachCondition errorMacro expandMacrosWith: false) ] ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBTransformation >> gtPreconditions [ ^ self preconditions ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBTransformation >> gtTransform [ self privateTransform ] diff --git a/src/GToolkit-Coder/RBValueNode.extension.st b/src/GToolkit-Coder/RBValueNode.extension.st index 3d8f74ea1..e6516c42d 100644 --- a/src/GToolkit-Coder/RBValueNode.extension.st +++ b/src/GToolkit-Coder/RBValueNode.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBValueNode } +Extension { #name : 'RBValueNode' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBValueNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. parentheses ifNotNil: [ parentheses := parentheses collect: [ :f | f + anInteger ] ]. diff --git a/src/GToolkit-Coder/RBVariableNode.extension.st b/src/GToolkit-Coder/RBVariableNode.extension.st index aa4a6fd38..3e32a054e 100644 --- a/src/GToolkit-Coder/RBVariableNode.extension.st +++ b/src/GToolkit-Coder/RBVariableNode.extension.st @@ -1,11 +1,11 @@ -Extension { #name : #RBVariableNode } +Extension { #name : 'RBVariableNode' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBVariableNode >> gtIsLocal [ ^ (self whoDefines: self name) notNil ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RBVariableNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. start ifNotNil: [ start := start + anInteger ] diff --git a/src/GToolkit-Coder/RPackage.extension.st b/src/GToolkit-Coder/RPackage.extension.st index 724adf04f..18f2978af 100644 --- a/src/GToolkit-Coder/RPackage.extension.st +++ b/src/GToolkit-Coder/RPackage.extension.st @@ -1,11 +1,11 @@ -Extension { #name : #RPackage } +Extension { #name : 'RPackage' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RPackage >> gtClassExtensions [ ^ self extensionMethods collect: [ :each | GtPharoClassExtension new extendingMethod: each ] ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RPackage >> gtClassReferences [ ^ self gtMethodReferences flatCollectAsSet: [ :m | m method gtReferencedClasses collect: [ :each | @@ -14,7 +14,7 @@ RPackage >> gtClassReferences [ referencedClass: each ]] ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RPackage >> gtDependencies [ | all | all := Set new. @@ -25,24 +25,24 @@ RPackage >> gtDependencies [ ^ all select: [ :each | each toPackage ~= self ] ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RPackage >> gtInheritances [ ^ self definedClasses select: [ : each | each isClass and: [ each superclass notNil ] ] thenCollect: [ :each | each gtInheritance ] ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RPackage >> gtMethodReferences [ ^ self methods collect: [:each | each methodReference] thenSelect: [:each| each isValid and: [each isLocalSelector]]. ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RPackage >> gtPackageScope [ ^ self ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RPackage >> gtPackagesUsed [ | result | result := Set new. @@ -54,33 +54,33 @@ RPackage >> gtPackagesUsed [ ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RPackage >> gtPackagesUsedThroughClassExtensions [ ^ self gtClassExtensions collectAsSet: [ :each | each toPackage ] ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RPackage >> gtPackagesUsedThroughClassReferences [ ^ (self gtClassReferences collectAsSet: [ :each | each toPackage ]) remove: self ifAbsent: []; yourself ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RPackage >> gtPackagesUsedThroughSubclassing [ ^ (self gtInheritances collectAsSet: [ :each | each toPackage ]) remove: self ifAbsent: []; yourself ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RPackage >> gtPackagesUsedThroughTraitUsages [ ^ (self gtTraitUsages collectAsSet: [ :each | each toPackage ]) remove: self ifAbsent: []; yourself ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RPackage >> gtTraitUsages [ ^ self definedClasses flatCollect: [ :each | each gtTraitUsages ] ] diff --git a/src/GToolkit-Coder/RPackageTag.extension.st b/src/GToolkit-Coder/RPackageTag.extension.st index 5bfacab0a..512789389 100644 --- a/src/GToolkit-Coder/RPackageTag.extension.st +++ b/src/GToolkit-Coder/RPackageTag.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RPackageTag } +Extension { #name : 'RPackageTag' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } RPackageTag >> gtClassesCoderFor: aView context: aPhlowContext [ (aPhlowContext isKindOf: GtPhlowExecutionContext) ifFalse: [ ^ aView empty ]. diff --git a/src/GToolkit-Coder/SharedPool.extension.st b/src/GToolkit-Coder/SharedPool.extension.st index c9e76c1f5..de70fa4a5 100644 --- a/src/GToolkit-Coder/SharedPool.extension.st +++ b/src/GToolkit-Coder/SharedPool.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #SharedPool } +Extension { #name : 'SharedPool' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } SharedPool class >> associationsDo: aBlock [ ^ self bindingsDo: aBlock ] diff --git a/src/GToolkit-Coder/Slot.extension.st b/src/GToolkit-Coder/Slot.extension.st index 84dc58ce9..369203875 100644 --- a/src/GToolkit-Coder/Slot.extension.st +++ b/src/GToolkit-Coder/Slot.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #Slot } +Extension { #name : 'Slot' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } Slot class >> gtIsValidName: aSymbol [ diff --git a/src/GToolkit-Coder/String.extension.st b/src/GToolkit-Coder/String.extension.st index ce5e5b68b..a5acbb5b4 100644 --- a/src/GToolkit-Coder/String.extension.st +++ b/src/GToolkit-Coder/String.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #String } +Extension { #name : 'String' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } String >> gtMethodCategories [ ^ self gtMethodProtocols ] diff --git a/src/GToolkit-Coder/Symbol.extension.st b/src/GToolkit-Coder/Symbol.extension.st index 2f7d22bf9..3540fafb7 100644 --- a/src/GToolkit-Coder/Symbol.extension.st +++ b/src/GToolkit-Coder/Symbol.extension.st @@ -1,11 +1,11 @@ -Extension { #name : #Symbol } +Extension { #name : 'Symbol' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } Symbol >> asGlobalVariable [ ^ Smalltalk globals associationAt: self ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } Symbol >> gtSenders [ ^ self gtReferences ] diff --git a/src/GToolkit-Coder/TGtCoderTrait.trait.st b/src/GToolkit-Coder/TGtCoderTrait.trait.st index 3e3ebd49e..549250a1a 100644 --- a/src/GToolkit-Coder/TGtCoderTrait.trait.st +++ b/src/GToolkit-Coder/TGtCoderTrait.trait.st @@ -1,34 +1,34 @@ Trait { - #name : #TGtCoderTrait, - #category : #'GToolkit-Coder-Coders' + #name : 'TGtCoderTrait', + #category : 'GToolkit-Coder-Coders' } -{ #category : #testing } +{ #category : 'testing' } TGtCoderTrait >> isForClass [ ^ false ] -{ #category : #testing } +{ #category : 'testing' } TGtCoderTrait >> isForPackage [ ^ false ] -{ #category : #testing } +{ #category : 'testing' } TGtCoderTrait >> isForPackageTag [ ^ false ] -{ #category : #accessing } +{ #category : 'accessing' } TGtCoderTrait >> package [ ^ nil ] -{ #category : #accessing } +{ #category : 'accessing' } TGtCoderTrait >> packageTag [ ^ nil ] -{ #category : #accessing } +{ #category : 'accessing' } TGtCoderTrait >> theClass [ ^ nil ] diff --git a/src/GToolkit-Coder/TextDiffBuilder.extension.st b/src/GToolkit-Coder/TextDiffBuilder.extension.st index b5dd16f8b..10c567082 100644 --- a/src/GToolkit-Coder/TextDiffBuilder.extension.st +++ b/src/GToolkit-Coder/TextDiffBuilder.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #TextDiffBuilder } +Extension { #name : 'TextDiffBuilder' } -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } TextDiffBuilder >> newRopedText [ | text | text := '' asRopedText. @@ -17,12 +17,12 @@ TextDiffBuilder >> newRopedText [ ^ text ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } TextDiffBuilder >> newStyler [ ^ nil ] -{ #category : #'*GToolkit-Coder' } +{ #category : '*GToolkit-Coder' } TextDiffBuilder >> previousRopedText [ | text | text := '' asRopedText. diff --git a/src/GToolkit-Coder/package.st b/src/GToolkit-Coder/package.st index 1585672da..42396c66c 100644 --- a/src/GToolkit-Coder/package.st +++ b/src/GToolkit-Coder/package.st @@ -1 +1 @@ -Package { #name : #'GToolkit-Coder' } +Package { #name : 'GToolkit-Coder' } From 4d946e904b132f8b78887a0fc90d5ff6b36a816e Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Tue, 24 Aug 2021 10:20:14 +0200 Subject: [PATCH 0005/1268] make coder bubbles work again --- .../Behavior.extension.st | 8 +- .../GtPharoBehaviorBubblesElement.class.st | 116 +++++++++-------- ...haroBehaviorProtocolBubbleElement.class.st | 123 +++++++++--------- ...otocolBubbleMethodHeaderElementId.class.st | 8 +- src/GToolkit-Coder-Pharo-Bubbles/package.st | 2 +- 5 files changed, 127 insertions(+), 130 deletions(-) diff --git a/src/GToolkit-Coder-Pharo-Bubbles/Behavior.extension.st b/src/GToolkit-Coder-Pharo-Bubbles/Behavior.extension.st index ee197a358..8df364586 100644 --- a/src/GToolkit-Coder-Pharo-Bubbles/Behavior.extension.st +++ b/src/GToolkit-Coder-Pharo-Bubbles/Behavior.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #Behavior } +Extension { #name : 'Behavior' } -{ #category : #'*GToolkit-Coder-Pharo-Bubbles' } +{ #category : '*GToolkit-Coder-Pharo-Bubbles' } Behavior >> gtCoderProtocolsBubblesFor: aView context: aPhlowContext [ | aBehaviorCoderViewModel | @@ -8,11 +8,11 @@ Behavior >> gtCoderProtocolsBubblesFor: aView context: aPhlowContext [ aBehaviorCoderViewModel := aPhlowContext optionAt: #behaviorCoder ifPresent: [ :aBehaviorCoderUIModel | aBehaviorCoderUIModel ] - ifAbsentPut: [ (GtBehaviorCoder forClass: self) asCoderUIModel ]. + ifAbsentPut: [ (GtPharoBehaviorCoder forClass: self) asCoderUIModel ]. ^ aView explicit priority: 11; - title: 'Protocols'; + title: 'Bubbles'; disableAsync; stencil: [ GtPharoBehaviorBubblesElement new pharoBehaviorCoderViewModel: aBehaviorCoderViewModel ]; diff --git a/src/GToolkit-Coder-Pharo-Bubbles/GtPharoBehaviorBubblesElement.class.st b/src/GToolkit-Coder-Pharo-Bubbles/GtPharoBehaviorBubblesElement.class.st index 098502f17..be5feec91 100644 --- a/src/GToolkit-Coder-Pharo-Bubbles/GtPharoBehaviorBubblesElement.class.st +++ b/src/GToolkit-Coder-Pharo-Bubbles/GtPharoBehaviorBubblesElement.class.st @@ -1,16 +1,16 @@ Class { - #name : #GtPharoBehaviorBubblesElement, - #superclass : #BlElement, + #name : 'GtPharoBehaviorBubblesElement', + #superclass : 'BlElement', #traits : 'TGtWithPharoBehaviorCoderViewModel', #classTraits : 'TGtWithPharoBehaviorCoderViewModel classTrait', #instVars : [ 'canvas', 'zoomToProtocolHandler' ], - #category : #'GToolkit-Coder-Pharo-Bubbles' + #category : 'GToolkit-Coder-Pharo-Bubbles' } -{ #category : #private } +{ #category : 'private' } GtPharoBehaviorBubblesElement >> canvasBoundingBox [ | aBoundingBox | @@ -28,7 +28,7 @@ GtPharoBehaviorBubblesElement >> canvasBoundingBox [ ^ aBoundingBox expanded asRectangle ] -{ #category : #'hooks - layout' } +{ #category : 'hooks - layout' } GtPharoBehaviorBubblesElement >> dispatchLayoutDone [ super dispatchLayoutDone. @@ -40,40 +40,42 @@ GtPharoBehaviorBubblesElement >> dispatchLayoutDone [ self zoomToFit ] -{ #category : #initialization } +{ #category : 'initialization' } GtPharoBehaviorBubblesElement >> initialize [ + super initialize. - - self constraintsDo: [ :c | + + self constraintsDo: [ :c | c horizontal matchParent. c vertical matchParent ]. self beInSeparateCompositionLayer. self background: BrGlamorousColors backdropColor. - self addLook: BrGlamorousMaximizerFullscreenHostAptitude new. + self addAptitude: BrGlamorousMaximizerFullscreenHostAptitude new. - canvas := BlCanvassableElement new - constraintsDo: [ :c | - c horizontal matchParent. - c vertical matchParent ]. - canvas addEventHandler: BlSlideHandler new. + canvas := BlCanvassableElement new constraintsDo: [ :c | + c horizontal matchParent. + c vertical matchParent ]. + canvas addEventHandler: BlSlideHandler new. canvas addEventHandler: BlScrollSlideHandler new. canvas layout: (BlOnceLayout on: (GtGraphGridLayout new gapSize: 30)). - + canvas when: BlCanvassableZoomLevelChanged - do: [ :anEvent | self updateForZoomLevel: anEvent currentTarget zoomLevel ]. - + do: [ :anEvent | + self updateForZoomLevel: anEvent currentTarget zoomLevel ]. + zoomToProtocolHandler := BlEventHandler - on: BlClickEvent - do: [ :anEvent | - anEvent consumed: true. - self zoomInTo: anEvent currentTarget parent ]. + on: BlClickEvent + do: [ :anEvent | + anEvent consumed: true. + self zoomInTo: + anEvent currentTarget parent ]. self addChild: canvas ] -{ #category : #'api - pharo behavior coder view model' } +{ #category : 'api - pharo behavior coder view model' } GtPharoBehaviorBubblesElement >> onPharoBehaviorCoderViewModelChanged [ "Is sent when a new pharoBehaviorCoder view model is assigned to the element. Note: #onPharoBehaviorCoderViewModelChanged is sent before #subscribeToPharoBehaviorCoderViewModel @@ -99,7 +101,7 @@ GtPharoBehaviorBubblesElement >> onPharoBehaviorCoderViewModelChanged [ addEventHandler: BlPullHandler new ]) ] -{ #category : #private } +{ #category : 'private' } GtPharoBehaviorBubblesElement >> startZoomAnimation: anAnimation [ anAnimation onFinishedDo: [ (self query // BlElement) all @@ -108,39 +110,41 @@ GtPharoBehaviorBubblesElement >> startZoomAnimation: anAnimation [ self addAnimation: anAnimation ] -{ #category : #private } +{ #category : 'private' } GtPharoBehaviorBubblesElement >> updateForZoomLevel: aZoomLevel [ - (self query // GtPharoBehaviorProtocolBubbleElement) all - do: [ :eachCard | - eachCard childrenDo: [ :eachChild | - aZoomLevel > 0.5 - ifTrue: [ eachChild visibility: BlVisibility visible ] - ifFalse: [ eachChild visibility: BlVisibility hidden ]. - aZoomLevel > 0.5 - ifTrue: [ - eachCard - childWithId: #protocolLabelPreview - ifFound: [ :anElement | - anElement removeFromParent. - anElement removeEventHandler: zoomToProtocolHandler ] - ifNone: [ ] ] - ifFalse: [ - eachCard - childWithId: #protocolLabelPreview - ifFound: [ :anElement | anElement visibility: BlVisibility visible ] - ifNone: [ - eachCard addChild: ((BrLabel new - padding: (BlInsets all: 2); - look: BrGlamorousLabelLook; - text: eachCard pharoBehaviorProtocolCoderViewModel protocol) asScalableElement - id: #protocolLabelPreview; - fitAll; - addEventHandler: zoomToProtocolHandler; - constraintsDo: [ :c | - c ignoreByLayout ]) ] ] ] ] + + (self query // GtPharoBehaviorProtocolBubbleElement) all do: [ + :eachCard | + eachCard childrenDo: [ :eachChild | + aZoomLevel > 0.5 + ifTrue: [ eachChild visibility: BlVisibility visible ] + ifFalse: [ eachChild visibility: BlVisibility hidden ]. + aZoomLevel > 0.5 + ifTrue: [ + eachCard + childWithId: #protocolLabelPreview + ifFound: [ :anElement | + anElement removeFromParent. + anElement removeEventHandler: zoomToProtocolHandler ] + ifNone: [ ] ] + ifFalse: [ + eachCard + childWithId: #protocolLabelPreview + ifFound: [ :anElement | + anElement visibility: BlVisibility visible ] + ifNone: [ + eachCard addChild: ((BrLabel new + padding: (BlInsets all: 2); + aptitude: BrGlamorousLabelAptitude; + text: eachCard pharoBehaviorProtocolCoderViewModel protocol) + asScalableElement + id: #protocolLabelPreview; + fitAll; + addEventHandler: zoomToProtocolHandler; + constraintsDo: [ :c | c ignoreByLayout ]) ] ] ] ] ] -{ #category : #'api - zooming' } +{ #category : 'api - zooming' } GtPharoBehaviorBubblesElement >> zoomIn [ self startZoomAnimation: (BlNumberTransition new onStepDo: [ :eachLevel | canvas zoomLevel: eachLevel ]; @@ -149,7 +153,7 @@ GtPharoBehaviorBubblesElement >> zoomIn [ duration: 200 milliSeconds) ] -{ #category : #'api - zooming' } +{ #category : 'api - zooming' } GtPharoBehaviorBubblesElement >> zoomInTo: anElement [ | anElementBounds anElementExtent aNewZoomLevel aMoveDelta zoomAnimation relocateAnimations | @@ -180,7 +184,7 @@ GtPharoBehaviorBubblesElement >> zoomInTo: anElement [ self startZoomAnimation: (BlSequentialAnimation with: { BlParallelAnimation with: relocateAnimations . zoomAnimation }). ] -{ #category : #'api - zooming' } +{ #category : 'api - zooming' } GtPharoBehaviorBubblesElement >> zoomOut [ self startZoomAnimation: (BlNumberTransition new onStepDo: [ :eachLevel | canvas zoomLevel: eachLevel ]; @@ -189,7 +193,7 @@ GtPharoBehaviorBubblesElement >> zoomOut [ duration: 200 milliSeconds) ] -{ #category : #'api - zooming' } +{ #category : 'api - zooming' } GtPharoBehaviorBubblesElement >> zoomToFit [ | theChildrenBoundingBox theChildrenExtent aNewZoomLevel aMoveDelta zoomAnimation relocateAnimations | diff --git a/src/GToolkit-Coder-Pharo-Bubbles/GtPharoBehaviorProtocolBubbleElement.class.st b/src/GToolkit-Coder-Pharo-Bubbles/GtPharoBehaviorProtocolBubbleElement.class.st index 83d0c65ad..1ae31d181 100644 --- a/src/GToolkit-Coder-Pharo-Bubbles/GtPharoBehaviorProtocolBubbleElement.class.st +++ b/src/GToolkit-Coder-Pharo-Bubbles/GtPharoBehaviorProtocolBubbleElement.class.st @@ -1,16 +1,16 @@ Class { - #name : #GtPharoBehaviorProtocolBubbleElement, - #superclass : #BrHorizontalPane, + #name : 'GtPharoBehaviorProtocolBubbleElement', + #superclass : 'BrHorizontalPane', #traits : 'TGtWithPharoBehaviorProtocolCoderViewModel', #classTraits : 'TGtWithPharoBehaviorProtocolCoderViewModel classTrait', #instVars : [ 'protocolLabel', 'methodsContainer' ], - #category : #'GToolkit-Coder-Pharo-Bubbles' + #category : 'GToolkit-Coder-Pharo-Bubbles' } -{ #category : #initialization } +{ #category : 'initialization' } GtPharoBehaviorProtocolBubbleElement >> createMethodsContainer [ ^ BrVerticalPane new hExact: 200; @@ -18,25 +18,26 @@ GtPharoBehaviorProtocolBubbleElement >> createMethodsContainer [ padding: (BlInsets all: 4) ] -{ #category : #initialization } +{ #category : 'initialization' } GtPharoBehaviorProtocolBubbleElement >> createProtocolLabel [ + ^ BrLabel new - beLargeSize; - look: BrGlamorousLabelLook + beLargeSize; + aptitude: BrGlamorousLabelAptitude ] -{ #category : #'private - instance creation' } +{ #category : 'private - instance creation' } GtPharoBehaviorProtocolBubbleElement >> createProtocolMethodRowFor: aPharoMethodsCoderViewModel index: anIndex [ - | tooltipLook | - tooltipLook := BrGlamorousWithTooltipLook - content: [ - aPharoMethodsCoderViewModel expanded: true. - GtSourceCoderEditorElement new - in: [ :anEditorElement | anEditorElement editor beParagraphBased ]; - textualCoderViewModel: aPharoMethodsCoderViewModel; - vFitContent; - hExact: 400 ]. + | tooltipLook | + tooltipLook := BrGlamorousWithTooltipAptitude content: [ + aPharoMethodsCoderViewModel expanded: true. + GtSourceCoderEditorElement new + in: [ :anEditorElement | + anEditorElement editor beParagraphBased ]; + textualCoderViewModel: aPharoMethodsCoderViewModel; + vFitContent; + hExact: 400 ]. tooltipLook showDelay: 0 seconds; hideDelay: 0 seconds; @@ -44,35 +45,39 @@ GtPharoBehaviorProtocolBubbleElement >> createProtocolMethodRowFor: aPharoMethod onPrimaryHover. ^ BrLabel new - hMatchParent; - id: (GtPharoBehaviorProtocolBubbleMethodHeaderElementId indexed: anIndex); - text: aPharoMethodsCoderViewModel selector; - look: BrGlamorousLabelLook + tooltipLook + (BrStyleCommonLook new - hovered: [ :s | s background: (Color gray alpha: 0.2) ]); - when: BlClickEvent do: [ :anEvent | - | aContainer aCoderElement | - anEvent consumed: true. - - aContainer := self. - aContainer removeChildNamed: #'bubble--editor'. - - aPharoMethodsCoderViewModel expanded: true. - aCoderElement := aPharoMethodsCoderViewModel asElement. - aCoderElement hExact: 500. - aCoderElement vFitContent. - - aContainer addChild: (aCoderElement id: #'bubble--editor'). - self requestStyle ] + hMatchParent; + id: + (GtPharoBehaviorProtocolBubbleMethodHeaderElementId indexed: + anIndex); + text: aPharoMethodsCoderViewModel selector; + aptitude: BrGlamorousLabelAptitude + tooltipLook + + (BrStyleCommonAptitude new hovered: [ :s | + s background: (Color gray alpha: 0.2) ]); + when: BlClickEvent do: [ :anEvent | + | aContainer aCoderElement | + anEvent consumed: true. + + aContainer := self. + aContainer removeChildNamed: #'bubble--editor'. + + aPharoMethodsCoderViewModel expanded: true. + aCoderElement := aPharoMethodsCoderViewModel asElement. + aCoderElement hExact: 500. + aCoderElement vFitContent. + + aContainer addChild: (aCoderElement id: #'bubble--editor'). + self requestStyle ] ] -{ #category : #initialization } +{ #category : 'initialization' } GtPharoBehaviorProtocolBubbleElement >> initialize [ + super initialize. self - background: (Color white); - addLook: BrShadowLook new beLarge; - addLook: BrGlamorousWithMaximizerAptitude new; + background: Color white; + addAptitude: BrShadowLook new beLarge; + addAptitude: BrGlamorousWithMaximizerAptitude new; geometry: (BlRoundedRectangleGeometry cornerRadius: 5); beInSeparateCompositionLayer; fitContent. @@ -82,34 +87,22 @@ GtPharoBehaviorProtocolBubbleElement >> initialize [ methodsContainer := self createMethodsContainer. methodsContainer addChild: protocolLabel. - + self addChild: methodsContainer. - - self addLook: (BrLayoutResizerLook new - vFitContentToFitContent: [ :aBlock | - self - childWithId: #'bubble--editor' - ifFound: aBlock - ifNone: [ ] ]; - hFitContent: [ :aBlock | - self - childWithId: #'bubble--editor' - ifFound: aBlock - ifNone: [ ] ] - toExact: 500; - exactToMatchParent: [ :aBlock | - self - childWithId: #'bubble--editor' - ifFound: aBlock - ifNone: [ ] ]; - matchParentToMatchParent: [ :aBlock | - self - childWithId: #'bubble--editor' - ifFound: aBlock - ifNone: [ ] ]) + + self addAptitude: (BrLayoutResizerAptitude new + vFitContentToFitContent: [ :aBlock | + self childWithId: #'bubble--editor' ifFound: aBlock ifNone: [ ] ]; + hFitContent: [ :aBlock | + self childWithId: #'bubble--editor' ifFound: aBlock ifNone: [ ] ] + toExact: 500; + exactToMatchParent: [ :aBlock | + self childWithId: #'bubble--editor' ifFound: aBlock ifNone: [ ] ]; + matchParentToMatchParent: [ :aBlock | + self childWithId: #'bubble--editor' ifFound: aBlock ifNone: [ ] ]) ] -{ #category : #'api - pharo behavior protocol coder view model' } +{ #category : 'api - pharo behavior protocol coder view model' } GtPharoBehaviorProtocolBubbleElement >> onPharoBehaviorProtocolCoderViewModelChanged [ "Is sent when a new pharoBehaviorProtocolCoder view model is assigned to the element. Note: #onPharoBehaviorProtocolCoderViewModelChanged is sent before #subscribeToPharoBehaviorProtocolCoderViewModel diff --git a/src/GToolkit-Coder-Pharo-Bubbles/GtPharoBehaviorProtocolBubbleMethodHeaderElementId.class.st b/src/GToolkit-Coder-Pharo-Bubbles/GtPharoBehaviorProtocolBubbleMethodHeaderElementId.class.st index a95c1fc83..d7531ec38 100644 --- a/src/GToolkit-Coder-Pharo-Bubbles/GtPharoBehaviorProtocolBubbleMethodHeaderElementId.class.st +++ b/src/GToolkit-Coder-Pharo-Bubbles/GtPharoBehaviorProtocolBubbleMethodHeaderElementId.class.st @@ -2,12 +2,12 @@ A method header in the list of methods in the protocol bubble " Class { - #name : #GtPharoBehaviorProtocolBubbleMethodHeaderElementId, - #superclass : #GtCoderElementId, - #category : #'GToolkit-Coder-Pharo-Bubbles' + #name : 'GtPharoBehaviorProtocolBubbleMethodHeaderElementId', + #superclass : 'GtCoderElementId', + #category : 'GToolkit-Coder-Pharo-Bubbles' } -{ #category : #converting } +{ #category : 'converting' } GtPharoBehaviorProtocolBubbleMethodHeaderElementId >> asSymbol [ ^ #'behavior-protocol-bubble--method-header' ] diff --git a/src/GToolkit-Coder-Pharo-Bubbles/package.st b/src/GToolkit-Coder-Pharo-Bubbles/package.st index f8fa9d7f8..c57a2a758 100644 --- a/src/GToolkit-Coder-Pharo-Bubbles/package.st +++ b/src/GToolkit-Coder-Pharo-Bubbles/package.st @@ -1 +1 @@ -Package { #name : #'GToolkit-Coder-Pharo-Bubbles' } +Package { #name : 'GToolkit-Coder-Pharo-Bubbles' } From ea6c84fee0e40219d1143403ba4389bfa214a132 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Tue, 24 Aug 2021 10:25:57 +0200 Subject: [PATCH 0006/1268] move coder bubbles to gt4pharo --- .../Behavior.extension.st | 29 --- .../GtPharoBehaviorBubblesElement.class.st | 225 ------------------ ...haroBehaviorProtocolBubbleElement.class.st | 123 ---------- ...otocolBubbleMethodHeaderElementId.class.st | 13 - src/GToolkit-Coder-Pharo-Bubbles/package.st | 1 - 5 files changed, 391 deletions(-) delete mode 100644 src/GToolkit-Coder-Pharo-Bubbles/Behavior.extension.st delete mode 100644 src/GToolkit-Coder-Pharo-Bubbles/GtPharoBehaviorBubblesElement.class.st delete mode 100644 src/GToolkit-Coder-Pharo-Bubbles/GtPharoBehaviorProtocolBubbleElement.class.st delete mode 100644 src/GToolkit-Coder-Pharo-Bubbles/GtPharoBehaviorProtocolBubbleMethodHeaderElementId.class.st delete mode 100644 src/GToolkit-Coder-Pharo-Bubbles/package.st diff --git a/src/GToolkit-Coder-Pharo-Bubbles/Behavior.extension.st b/src/GToolkit-Coder-Pharo-Bubbles/Behavior.extension.st deleted file mode 100644 index 8df364586..000000000 --- a/src/GToolkit-Coder-Pharo-Bubbles/Behavior.extension.st +++ /dev/null @@ -1,29 +0,0 @@ -Extension { #name : 'Behavior' } - -{ #category : '*GToolkit-Coder-Pharo-Bubbles' } -Behavior >> gtCoderProtocolsBubblesFor: aView context: aPhlowContext [ - - | aBehaviorCoderViewModel | - - aBehaviorCoderViewModel := aPhlowContext - optionAt: #behaviorCoder - ifPresent: [ :aBehaviorCoderUIModel | aBehaviorCoderUIModel ] - ifAbsentPut: [ (GtPharoBehaviorCoder forClass: self) asCoderUIModel ]. - - ^ aView explicit - priority: 11; - title: 'Bubbles'; - disableAsync; - stencil: [ GtPharoBehaviorBubblesElement new - pharoBehaviorCoderViewModel: aBehaviorCoderViewModel ]; - actionButtonIcon: BrGlamorousIcons zoomin - tooltip: 'Zoom in' - action: [ :aButton :aTab | aTab viewContentElement zoomIn ]; - actionButtonIcon: BrGlamorousIcons zoomout - tooltip: 'Zoom out' - action: [ :aButton :aTab | aTab viewContentElement zoomOut ]; - actionButtonIcon: BrGlamorousIcons zoomtofit - tooltip: 'Zoom to fit' - action: [ :aButton :aTab | aTab viewContentElement zoomToFit ]; - actionUpdateButton -] diff --git a/src/GToolkit-Coder-Pharo-Bubbles/GtPharoBehaviorBubblesElement.class.st b/src/GToolkit-Coder-Pharo-Bubbles/GtPharoBehaviorBubblesElement.class.st deleted file mode 100644 index be5feec91..000000000 --- a/src/GToolkit-Coder-Pharo-Bubbles/GtPharoBehaviorBubblesElement.class.st +++ /dev/null @@ -1,225 +0,0 @@ -Class { - #name : 'GtPharoBehaviorBubblesElement', - #superclass : 'BlElement', - #traits : 'TGtWithPharoBehaviorCoderViewModel', - #classTraits : 'TGtWithPharoBehaviorCoderViewModel classTrait', - #instVars : [ - 'canvas', - 'zoomToProtocolHandler' - ], - #category : 'GToolkit-Coder-Pharo-Bubbles' -} - -{ #category : 'private' } -GtPharoBehaviorBubblesElement >> canvasBoundingBox [ - - | aBoundingBox | - - canvas hasChildren - ifFalse: [ ^ BlBounds new asRectangle ]. - - aBoundingBox := nil. - - canvas childrenDo: [ :aChild | - aBoundingBox - ifNil: [ aBoundingBox := aChild bounds inParent bounds ] - ifNotNil: [ aBoundingBox merge: aChild bounds inParent bounds ] ]. - - ^ aBoundingBox expanded asRectangle -] - -{ #category : 'hooks - layout' } -GtPharoBehaviorBubblesElement >> dispatchLayoutDone [ - super dispatchLayoutDone. - - (canvas layout isKindOf: BlBasicLayout) - ifTrue: [ ^ self ]. - - canvas layout: BlBasicLayout new. - - self zoomToFit -] - -{ #category : 'initialization' } -GtPharoBehaviorBubblesElement >> initialize [ - - super initialize. - - self constraintsDo: [ :c | - c horizontal matchParent. - c vertical matchParent ]. - - self beInSeparateCompositionLayer. - self background: BrGlamorousColors backdropColor. - self addAptitude: BrGlamorousMaximizerFullscreenHostAptitude new. - - canvas := BlCanvassableElement new constraintsDo: [ :c | - c horizontal matchParent. - c vertical matchParent ]. - canvas addEventHandler: BlSlideHandler new. - canvas addEventHandler: BlScrollSlideHandler new. - canvas layout: (BlOnceLayout on: (GtGraphGridLayout new gapSize: 30)). - - canvas - when: BlCanvassableZoomLevelChanged - do: [ :anEvent | - self updateForZoomLevel: anEvent currentTarget zoomLevel ]. - - zoomToProtocolHandler := BlEventHandler - on: BlClickEvent - do: [ :anEvent | - anEvent consumed: true. - self zoomInTo: - anEvent currentTarget parent ]. - - self addChild: canvas -] - -{ #category : 'api - pharo behavior coder view model' } -GtPharoBehaviorBubblesElement >> onPharoBehaviorCoderViewModelChanged [ - "Is sent when a new pharoBehaviorCoder view model is assigned to the element. - Note: #onPharoBehaviorCoderViewModelChanged is sent before #subscribeToPharoBehaviorCoderViewModel - which means that if you perform any operation that triggers an announcement it will be ignored because the receiver - didn't get a chance to subscribe to any announcement. Override #onPostPharoBehaviorCoderViewModelChanged if you - wish to perform an operation that requires an announcement, but keep in mind that this is not the most efficient way" - | theProtocols | - - theProtocols := self pharoBehaviorCoderViewModel protocols sorted. - - canvas removeChildren. - canvas addChildren: (theProtocols collect: [ :eachProtocol | - | eachBehaviorProtocolCoder eachBehaviorProtocolCoderViewModel | - eachBehaviorProtocolCoder := GtPharoBehaviorProtocolCoder - forBehavior: self pharoBehaviorCoderViewModel behavior - protocol: eachProtocol. - - eachBehaviorProtocolCoderViewModel := GtPharoBehaviorProtocolCoderViewModel new - coderModel: eachBehaviorProtocolCoder. - - GtPharoBehaviorProtocolBubbleElement new - pharoBehaviorProtocolCoderViewModel: eachBehaviorProtocolCoderViewModel; - addEventHandler: BlPullHandler new ]) -] - -{ #category : 'private' } -GtPharoBehaviorBubblesElement >> startZoomAnimation: anAnimation [ - anAnimation onFinishedDo: [ - (self query // BlElement) all - do: [ :eachCard | eachCard invalidate ] ]. - - self addAnimation: anAnimation -] - -{ #category : 'private' } -GtPharoBehaviorBubblesElement >> updateForZoomLevel: aZoomLevel [ - - (self query // GtPharoBehaviorProtocolBubbleElement) all do: [ - :eachCard | - eachCard childrenDo: [ :eachChild | - aZoomLevel > 0.5 - ifTrue: [ eachChild visibility: BlVisibility visible ] - ifFalse: [ eachChild visibility: BlVisibility hidden ]. - aZoomLevel > 0.5 - ifTrue: [ - eachCard - childWithId: #protocolLabelPreview - ifFound: [ :anElement | - anElement removeFromParent. - anElement removeEventHandler: zoomToProtocolHandler ] - ifNone: [ ] ] - ifFalse: [ - eachCard - childWithId: #protocolLabelPreview - ifFound: [ :anElement | - anElement visibility: BlVisibility visible ] - ifNone: [ - eachCard addChild: ((BrLabel new - padding: (BlInsets all: 2); - aptitude: BrGlamorousLabelAptitude; - text: eachCard pharoBehaviorProtocolCoderViewModel protocol) - asScalableElement - id: #protocolLabelPreview; - fitAll; - addEventHandler: zoomToProtocolHandler; - constraintsDo: [ :c | c ignoreByLayout ]) ] ] ] ] -] - -{ #category : 'api - zooming' } -GtPharoBehaviorBubblesElement >> zoomIn [ - self startZoomAnimation: (BlNumberTransition new - onStepDo: [ :eachLevel | canvas zoomLevel: eachLevel ]; - from: canvas zoomLevel; - to: canvas zoomLevel + canvas zoomStep; - duration: 200 milliSeconds) -] - -{ #category : 'api - zooming' } -GtPharoBehaviorBubblesElement >> zoomInTo: anElement [ - | anElementBounds anElementExtent aNewZoomLevel aMoveDelta zoomAnimation relocateAnimations | - - anElementBounds := anElement bounds inParent: self. - anElementExtent := anElementBounds extent. - (anElementExtent x isZero or: [ anElementExtent y isZero ]) - ifTrue: [ ^ self ]. - - aNewZoomLevel := 1. - - aMoveDelta := (canvas localPointToChildren: canvas bounds inLocal center) - (canvas localPointToChildren: anElementBounds center). - - zoomAnimation := BlNumberTransition new - target: canvas; - onStepDo: [ :eachLevel :aCanvas | aCanvas zoomLevel: eachLevel ]; - from: canvas zoomLevel; - to: aNewZoomLevel; - duration: 500 milliSeconds. - - relocateAnimations := canvas children accountedByLayout collect: [ :eachElement | - BlNumberTransition new - target: eachElement; - onStepDo: [ :eachPoint :aTarget | aTarget relocate: eachPoint ]; - from: eachElement constraints position; - to: eachElement constraints position + aMoveDelta; - duration: 200 milliSeconds ]. - - self startZoomAnimation: (BlSequentialAnimation with: { BlParallelAnimation with: relocateAnimations . zoomAnimation }). -] - -{ #category : 'api - zooming' } -GtPharoBehaviorBubblesElement >> zoomOut [ - self startZoomAnimation: (BlNumberTransition new - onStepDo: [ :eachLevel | canvas zoomLevel: eachLevel ]; - from: canvas zoomLevel; - to: canvas zoomLevel - canvas zoomStep; - duration: 200 milliSeconds) -] - -{ #category : 'api - zooming' } -GtPharoBehaviorBubblesElement >> zoomToFit [ - | theChildrenBoundingBox theChildrenExtent aNewZoomLevel aMoveDelta zoomAnimation relocateAnimations | - - theChildrenBoundingBox := self canvasBoundingBox. - theChildrenExtent := theChildrenBoundingBox extent. - (theChildrenExtent x isZero or: [ theChildrenExtent y isZero ]) - ifTrue: [ ^ self ]. - - aNewZoomLevel := ((canvas extent / theChildrenExtent) min - 0.05) min: 1. - - aMoveDelta := (canvas localPointToChildren: canvas bounds inLocal center) - (theChildrenBoundingBox center). - - zoomAnimation := BlNumberTransition new - target: canvas; - onStepDo: [ :eachLevel :aCanvas | aCanvas zoomLevel: eachLevel ]; - from: canvas zoomLevel; - to: aNewZoomLevel; - duration: 500 milliSeconds. - - relocateAnimations := canvas children accountedByLayout collect: [ :eachElement | - BlNumberTransition new - target: eachElement; - onStepDo: [ :eachPoint :aTarget | aTarget relocate: eachPoint ]; - from: eachElement constraints position; - to: eachElement constraints position + aMoveDelta; - duration: 200 milliSeconds ]. - - self startZoomAnimation: (BlSequentialAnimation with: { zoomAnimation . BlParallelAnimation with: relocateAnimations }). -] diff --git a/src/GToolkit-Coder-Pharo-Bubbles/GtPharoBehaviorProtocolBubbleElement.class.st b/src/GToolkit-Coder-Pharo-Bubbles/GtPharoBehaviorProtocolBubbleElement.class.st deleted file mode 100644 index 1ae31d181..000000000 --- a/src/GToolkit-Coder-Pharo-Bubbles/GtPharoBehaviorProtocolBubbleElement.class.st +++ /dev/null @@ -1,123 +0,0 @@ -Class { - #name : 'GtPharoBehaviorProtocolBubbleElement', - #superclass : 'BrHorizontalPane', - #traits : 'TGtWithPharoBehaviorProtocolCoderViewModel', - #classTraits : 'TGtWithPharoBehaviorProtocolCoderViewModel classTrait', - #instVars : [ - 'protocolLabel', - 'methodsContainer' - ], - #category : 'GToolkit-Coder-Pharo-Bubbles' -} - -{ #category : 'initialization' } -GtPharoBehaviorProtocolBubbleElement >> createMethodsContainer [ - ^ BrVerticalPane new - hExact: 200; - vFitContent; - padding: (BlInsets all: 4) -] - -{ #category : 'initialization' } -GtPharoBehaviorProtocolBubbleElement >> createProtocolLabel [ - - ^ BrLabel new - beLargeSize; - aptitude: BrGlamorousLabelAptitude -] - -{ #category : 'private - instance creation' } -GtPharoBehaviorProtocolBubbleElement >> createProtocolMethodRowFor: aPharoMethodsCoderViewModel index: anIndex [ - - | tooltipLook | - tooltipLook := BrGlamorousWithTooltipAptitude content: [ - aPharoMethodsCoderViewModel expanded: true. - GtSourceCoderEditorElement new - in: [ :anEditorElement | - anEditorElement editor beParagraphBased ]; - textualCoderViewModel: aPharoMethodsCoderViewModel; - vFitContent; - hExact: 400 ]. - tooltipLook - showDelay: 0 seconds; - hideDelay: 0 seconds; - attachToLeftAndRight; - onPrimaryHover. - - ^ BrLabel new - hMatchParent; - id: - (GtPharoBehaviorProtocolBubbleMethodHeaderElementId indexed: - anIndex); - text: aPharoMethodsCoderViewModel selector; - aptitude: BrGlamorousLabelAptitude + tooltipLook - + (BrStyleCommonAptitude new hovered: [ :s | - s background: (Color gray alpha: 0.2) ]); - when: BlClickEvent do: [ :anEvent | - | aContainer aCoderElement | - anEvent consumed: true. - - aContainer := self. - aContainer removeChildNamed: #'bubble--editor'. - - aPharoMethodsCoderViewModel expanded: true. - aCoderElement := aPharoMethodsCoderViewModel asElement. - aCoderElement hExact: 500. - aCoderElement vFitContent. - - aContainer addChild: (aCoderElement id: #'bubble--editor'). - self requestStyle ] -] - -{ #category : 'initialization' } -GtPharoBehaviorProtocolBubbleElement >> initialize [ - - super initialize. - - self - background: Color white; - addAptitude: BrShadowLook new beLarge; - addAptitude: BrGlamorousWithMaximizerAptitude new; - geometry: (BlRoundedRectangleGeometry cornerRadius: 5); - beInSeparateCompositionLayer; - fitContent. - - protocolLabel := self createProtocolLabel. - protocolLabel constraintsDo: [ :c | c linear horizontal alignCenter ]. - methodsContainer := self createMethodsContainer. - - methodsContainer addChild: protocolLabel. - - self addChild: methodsContainer. - - self addAptitude: (BrLayoutResizerAptitude new - vFitContentToFitContent: [ :aBlock | - self childWithId: #'bubble--editor' ifFound: aBlock ifNone: [ ] ]; - hFitContent: [ :aBlock | - self childWithId: #'bubble--editor' ifFound: aBlock ifNone: [ ] ] - toExact: 500; - exactToMatchParent: [ :aBlock | - self childWithId: #'bubble--editor' ifFound: aBlock ifNone: [ ] ]; - matchParentToMatchParent: [ :aBlock | - self childWithId: #'bubble--editor' ifFound: aBlock ifNone: [ ] ]) -] - -{ #category : 'api - pharo behavior protocol coder view model' } -GtPharoBehaviorProtocolBubbleElement >> onPharoBehaviorProtocolCoderViewModelChanged [ - "Is sent when a new pharoBehaviorProtocolCoder view model is assigned to the element. - Note: #onPharoBehaviorProtocolCoderViewModelChanged is sent before #subscribeToPharoBehaviorProtocolCoderViewModel - which means that if you perform any operation that triggers an announcement it will be ignored because the receiver - didn't get a chance to subscribe to any announcement. Override #onPostPharoBehaviorProtocolCoderViewModelChanged if you - wish to perform an operation that requires an announcement, but keep in mind that this is not the most efficient way" - - protocolLabel text: self pharoBehaviorProtocolCoderViewModel protocol. - - methodsContainer removeChildren: (methodsContainer query // GtPharoBehaviorProtocolBubbleMethodHeaderElementId) all. - methodsContainer addChildren: (self pharoBehaviorProtocolCoderViewModel methodViewModels - collectWithIndex: [ :eachMethodViewModel :anIndex | self createProtocolMethodRowFor: eachMethodViewModel index: anIndex ]). - - ((self pharoBehaviorProtocolCoderViewModel protocol beginsWith: 'private') - or: [ (self pharoBehaviorProtocolCoderViewModel protocol beginsWith: '*') ]) - ifTrue: [ self background: BrGlamorousColors backdropColor ] - ifFalse: [ self background: Color white ] -] diff --git a/src/GToolkit-Coder-Pharo-Bubbles/GtPharoBehaviorProtocolBubbleMethodHeaderElementId.class.st b/src/GToolkit-Coder-Pharo-Bubbles/GtPharoBehaviorProtocolBubbleMethodHeaderElementId.class.st deleted file mode 100644 index d7531ec38..000000000 --- a/src/GToolkit-Coder-Pharo-Bubbles/GtPharoBehaviorProtocolBubbleMethodHeaderElementId.class.st +++ /dev/null @@ -1,13 +0,0 @@ -" -A method header in the list of methods in the protocol bubble -" -Class { - #name : 'GtPharoBehaviorProtocolBubbleMethodHeaderElementId', - #superclass : 'GtCoderElementId', - #category : 'GToolkit-Coder-Pharo-Bubbles' -} - -{ #category : 'converting' } -GtPharoBehaviorProtocolBubbleMethodHeaderElementId >> asSymbol [ - ^ #'behavior-protocol-bubble--method-header' -] diff --git a/src/GToolkit-Coder-Pharo-Bubbles/package.st b/src/GToolkit-Coder-Pharo-Bubbles/package.st deleted file mode 100644 index c57a2a758..000000000 --- a/src/GToolkit-Coder-Pharo-Bubbles/package.st +++ /dev/null @@ -1 +0,0 @@ -Package { #name : 'GToolkit-Coder-Pharo-Bubbles' } From 79d5a41e14820100185d722212d3c1e542f6437a Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Wed, 25 Aug 2021 17:44:22 +0200 Subject: [PATCH 0007/1268] [feenkcom/gtoolkit#2091] fix coder context menu --- .../GtCompositeRenameAction.class.st | 28 ++-- .../GtDefineClassFixItAction.class.st | 14 +- ...GtDefineClassFixItActionElementId.class.st | 8 +- .../GtDefineClassVariableFixItAction.class.st | 12 +- ...ClassVariableFixItActionElementId.class.st | 8 +- ...DefineInstanceVariableFixItAction.class.st | 12 +- ...tanceVariableFixItActionElementId.class.st | 8 +- ...tDefineMethodFixItActionElementId.class.st | 8 +- .../GtDefineTemporaryFixItAction.class.st | 12 +- ...oraryVariableFixItActionElementId.class.st | 8 +- ...tMethodReorderParametersAttribute.class.st | 20 +-- ...actMethodSelectorKeywordAttribute.class.st | 18 +-- .../GtFixItAction.class.st | 28 ++-- .../GtFixItActionElementId.class.st | 8 +- .../GtFixItAttribute.class.st | 12 +- .../GtFixItButton.class.st | 6 +- .../GtFixItVariableNodeAction.class.st | 8 +- .../GtRenameAction.class.st | 98 ++++++------ .../GtRenameAction2.class.st | 94 +++++------ .../GtRenameActionAnnouncement.class.st | 16 +- .../GtRenameClassController.class.st | 10 +- .../GtRenameClassVariableController.class.st | 10 +- .../GtRenameController.class.st | 40 ++--- .../GtRenameEditor.class.st | 6 +- .../GtRenameEditorAttribute.class.st | 34 ++-- ...tRenameInstanceVariableController.class.st | 10 +- .../GtRenameMethodController.class.st | 32 ++-- .../GtRenamePreviewAttribute.class.st | 26 +-- .../GtRenameVariableController.class.st | 18 +-- .../GtRenameVariableFixItAction.class.st | 14 +- ...enameVariableFixItActionElementId.class.st | 8 +- ...GtSourceCoderInlineRenameShortcut.class.st | 14 +- ...tSourceCoderRefactoringController.class.st | 44 +++--- .../GtTextualCoder.extension.st | 10 +- src/GToolkit-Coder-AddOns/package.st | 2 +- ...orCoderBehaviorNameApplyPreviewId.class.st | 8 +- .../GtBehaviorCoderBehaviorNameId.class.st | 8 +- .../GtBehaviorDefinitionCoderUIModel.class.st | 8 +- .../GtCategoryToggleAptitude.class.st | 8 +- .../GtClassBreadcrumbToggleAptitude.class.st | 8 +- .../GtClassCardElement.class.st | 8 +- .../GtClassCoderTool.class.st | 18 +-- .../GtClassesCoderUIModel.class.st | 8 +- .../GtClassesElement.class.st | 14 +- ...deDefinitionCompositeEntityViewer.class.st | 22 +-- .../GtCodeDefinitionEntityViewer.class.st | 34 ++-- ...tCodeDefinitionNestedEntityViewer.class.st | 16 +- .../GtCodeDefinitionPluralEditor.class.st | 20 +-- .../GtCodeDefinitionPluralReader.class.st | 8 +- .../GtCodeDefinitionPluralViewer.class.st | 22 +-- ...CodeDefinitionSectionLabelStencil.class.st | 12 +- .../GtCodeDefinitionSingleEditor.class.st | 18 +-- .../GtCodeDefinitionSingleReader.class.st | 8 +- .../GtCodeDefinitionSingleViewer.class.st | 14 +- .../GtCodeDefinitionViewer.class.st | 22 +-- src/GToolkit-Coder-UI/GtCoder.class.st | 40 ++--- src/GToolkit-Coder-UI/GtCoder2.class.st | 34 ++-- .../GtCoderAction.extension.st | 4 +- .../GtCoderActionsElement.class.st | 44 +++--- .../GtCoderActivatableAction.extension.st | 4 +- .../GtCoderCardElement.class.st | 20 +-- .../GtCoderCodeExecutor.class.st | 44 +++--- .../GtCoderContentElement.class.st | 18 +-- .../GtCoderContextMenuContent.class.st | 20 +-- .../GtCoderDropDownAction.extension.st | 4 +- ...oderDropDownWithPreviewAction.extension.st | 4 +- src/GToolkit-Coder-UI/GtCoderElement.class.st | 8 +- .../GtCoderElementId.class.st | 8 +- .../GtCoderExampleStateElement.class.st | 64 ++++---- .../GtCoderExecutionContextVariable.class.st | 14 +- .../GtCoderExpanderAptitude.class.st | 8 +- .../GtCoderExpanderShadowAptitude.class.st | 8 +- ...oderExpanderWithoutShadowAptitude.class.st | 48 +++--- .../GtCoderFilterList.class.st | 12 +- .../GtCoderFilterListItem.class.st | 20 +-- .../GtCoderFilterListItemElement.class.st | 16 +- .../GtCoderModel.extension.st | 18 +-- ...derNavigationClassHierachyElement.class.st | 32 ++-- ...gationClassesHierarchyTreeElement.class.st | 20 +-- ...CoderNavigationClassesListElement.class.st | 16 +- .../GtCoderNavigationElement.class.st | 70 ++++----- ...vigationMethodProtocolListElement.class.st | 18 +-- .../GtCoderNavigationModelElement.class.st | 32 ++-- ...igationPackagesTagsClassesElement.class.st | 98 ++++++------ ...oderNavigationPackagesTreeElement.class.st | 26 +-- .../GtCoderNavigationTabsStencil.class.st | 28 ++-- .../GtCoderPlaygroundElement.class.st | 36 ++--- .../GtCoderPrintStringAttribute.class.st | 36 ++--- .../GtCoderSpotterStart.class.st | 24 +-- .../GtCoderToReplace.class.st | 10 +- src/GToolkit-Coder-UI/GtCoderToSpawn.class.st | 10 +- .../GtCoderToSpawnInSpace.class.st | 6 +- .../GtCoderToggleAptitude.class.st | 12 +- src/GToolkit-Coder-UI/GtCoderTool.class.st | 16 +- .../GtCoderToolViewModel.class.st | 24 +-- .../GtCoderToolViewModelCoderPopped.class.st | 6 +- .../GtCoderToolViewModelCoderPushed.class.st | 6 +- ...derToolViewModelCoderStackChanged.class.st | 10 +- .../GtCoderToolbarElement.class.st | 30 ++-- .../GtCodersModel.extension.st | 6 +- .../GtContextCoderVariableAptitude.class.st | 16 +- .../GtCreateElement.class.st | 14 +- src/GToolkit-Coder-UI/GtDiffAptitude.class.st | 8 +- src/GToolkit-Coder-UI/GtDiffElement.class.st | 68 ++++---- .../GtDiffElementId.class.st | 8 +- .../GtDiffFlatAptitude.class.st | 10 +- .../GtDiffNewTextId.class.st | 8 +- .../GtDiffOldTextId.class.st | 8 +- .../GtDiffSeparatorId.class.st | 8 +- .../GtDiffShadowAptitude.class.st | 14 +- .../GtExpandableSourceCoderElement.class.st | 42 ++--- .../GtExpandedOnlyCoderElement.class.st | 24 +-- .../GtFilterDescriptor.class.st | 46 +++--- .../GtFilterRunExampleButtonAptitude.class.st | 52 +++--- ...xampleButtonFourStateIconAptitude.class.st | 36 ++--- ...ilterRunExampleButtonIconAptitude.class.st | 28 ++-- ...erRunExampleButtonTooltipAptitude.class.st | 18 +-- .../GtFilterTagElement.class.st | 40 ++--- .../GtFiltersChangedEvent.class.st | 10 +- .../GtFiltersElement.class.st | 28 ++-- ...tMethodCoderContextPCRangeChanged.class.st | 10 +- ...GtMethodCoderDebugExampleActionId.class.st | 8 +- ...MethodCoderDiscardChangesActionId.class.st | 8 +- ...derExtractMethodContextMenuItemId.class.st | 8 +- ...oderPlayAndInspectExampleActionId.class.st | 8 +- .../GtMethodCoderPlayExampleActionId.class.st | 8 +- .../GtMethodCoderSaveAbilityChanged.class.st | 6 +- .../GtMethodCoderSaveActionId.class.st | 8 +- .../GtMethodCoderSaveDisabled.class.st | 12 +- .../GtMethodCoderSaveEnabled.class.st | 8 +- .../GtMethodCoderTool.class.st | 16 +- .../GtMultipleCodersViewModel.class.st | 30 ++-- .../GtPackageCardElement.class.st | 10 +- .../GtPackageCoderPackageNameId.class.st | 8 +- .../GtPackageCoderTool.class.st | 16 +- .../GtPackageCoderViewModel.class.st | 6 +- .../GtPackageTagCardElement.class.st | 8 +- .../GtPackagesCoderElement.class.st | 18 +-- .../GtPackagesCoderUIModel.class.st | 8 +- .../GtPreviewChangeButton.class.st | 18 +-- ...tRBAddPoolVariableRefactoring.extension.st | 4 +- .../GtRBAddTraitUsageRefactoring.extension.st | 4 +- ...RBChangeSuperclassRefactoring.extension.st | 4 +- ...RemovePoolVariableRefactoring.extension.st | 4 +- ...RBRemoveTraitUsageRefactoring.extension.st | 4 +- .../GtReadyCoderTool.class.st | 22 +-- .../GtRefactoringsPreviewAcceptId.class.st | 8 +- .../GtSingleCoderViewModel.class.st | 40 ++--- .../GtSourceCoderAptitude.class.st | 16 +- .../GtSourceCoderBreadcrumbAction.class.st | 12 +- ...oderBreadcrumbSpawnBehaviorAction.class.st | 18 +-- ...CoderBreadcrumbSpawnPackageAction.class.st | 16 +- ...SourceCoderBrowseBehaviorShortcut.class.st | 14 +- ...ceCoderBrowseImplementorsShortcut.class.st | 14 +- ...urceCoderBrowseReferencesShortcut.class.st | 14 +- ...ourceCoderCollapsedContentElement.class.st | 6 +- ...erCollapsedTextAndExampleAptitude.class.st | 38 ++--- ...tSourceCoderCollapsedTextAptitude.class.st | 18 +-- .../GtSourceCoderCollapsedTextId.class.st | 8 +- .../GtSourceCoderContentCoderChanged.class.st | 10 +- .../GtSourceCoderContentCoderRequest.class.st | 8 +- .../GtSourceCoderContentElement.class.st | 18 +-- .../GtSourceCoderContentModel.class.st | 14 +- .../GtSourceCoderDebugActionId.class.st | 8 +- ...SourceCoderDiscardChangesShortcut.class.st | 14 +- .../GtSourceCoderDoItActionId.class.st | 8 +- .../GtSourceCoderDoItAndGoActionId.class.st | 8 +- ...SourceCoderDoItAndInspectShortcut.class.st | 14 +- .../GtSourceCoderDoItShortcut.class.st | 14 +- .../GtSourceCoderEditorAptitude.class.st | 16 +- .../GtSourceCoderEditorElement.class.st | 8 +- .../GtSourceCoderEditorId.class.st | 8 +- ...urceCoderEmbeddedExpanderToggleId.class.st | 8 +- .../GtSourceCoderErrorAttribute.class.st | 12 +- ...tSourceCoderEvaluationHighlighter.class.st | 8 +- .../GtSourceCoderEvaluationPrinter.class.st | 8 +- ...rceCoderEvaluationResultDisplayer.class.st | 32 ++-- ...SourceCoderExpandedContentElement.class.st | 6 +- .../GtSourceCoderExpanderToggleId.class.st | 8 +- ...tSourceCoderExtractMethodShortcut.class.st | 14 +- .../GtSourceCoderFocusChanged.class.st | 14 +- .../GtSourceCoderFormatShortcut.class.st | 14 +- ...SourceCoderPlayAndInspectShortcut.class.st | 14 +- .../GtSourceCoderPlayShortcut.class.st | 14 +- .../GtSourceCoderPrintItShortcut.class.st | 14 +- .../GtSourceCoderProfileActionId.class.st | 8 +- .../GtSourceCoderSaveShortcut.class.st | 14 +- .../GtSourceCoderShortcut.class.st | 18 +-- ...urceCoderSpawnDestinationAptitude.class.st | 16 +- .../GtSourceCoderViewModel.class.st | 48 +++--- .../GtSyncScrollRange.class.st | 38 ++--- .../GtSyncScrollRanges.class.st | 32 ++-- .../GtTextCoder.extension.st | 4 +- .../GtTextualCoder.extension.st | 4 +- ...TextualCoderCopyContextMenuItemId.class.st | 8 +- ...tTextualCoderCutContextMenuItemId.class.st | 8 +- .../GtTextualCoderEditorElement.class.st | 82 +++++----- ...extualCoderPasteContextMenuItemId.class.st | 8 +- .../GtTextualCoderTextAttributes.class.st | 20 +-- .../GtTextualCoderViewModel.class.st | 148 +++++++++--------- ...extualCoderViewModelAddOnsChanged.class.st | 10 +- ...TextualCoderViewModelAnnouncement.class.st | 6 +- ...GtTextualCoderViewModelAstChanged.class.st | 10 +- ...derViewModelContextActionsChanged.class.st | 6 +- ...iewModelContextMenuActionsChanged.class.st | 6 +- ...xtualCoderViewModelCursorsChanged.class.st | 14 +- ...ualCoderViewModelExpansionChanged.class.st | 10 +- ...lCoderViewModelMainActionsChanged.class.st | 6 +- ...xtualCoderViewModelReadyToRestyle.class.st | 6 +- ...ualCoderViewModelSelectionChanged.class.st | 14 +- ...ualCoderViewModelShortcutsChanged.class.st | 6 +- ...alCoderViewModelStyledTextChanged.class.st | 10 +- ...xtualCoderViewModelStylersChanged.class.st | 6 +- ...CoderViewModelTextAttributesAdded.class.st | 18 +-- ...derViewModelTextAttributesRemoved.class.st | 10 +- ...tTextualCoderViewModelTextChanged.class.st | 18 +-- ...RBAddClassVariableRefactoring.extension.st | 4 +- ...ddInstanceVariableRefactoring.extension.st | 4 +- .../RBRefactoring.extension.st | 4 +- ...emoveClassVariableRefactoring.extension.st | 4 +- ...veInstanceVariableRefactoring.extension.st | 4 +- .../RBRenameClassRefactoring.extension.st | 4 +- ...enameClassVariableRefactoring.extension.st | 4 +- ...meInstanceVariableRefactoring.extension.st | 4 +- .../RBTransformation.extension.st | 4 +- .../TBlDevScripterTarget.extension.st | 8 +- .../TGtCoderNavigationClassesHelper.trait.st | 10 +- .../TGtWithCoderModel.trait.st | 16 +- .../TGtWithCoderToolViewModel.trait.st | 18 +-- .../TGtWithTextualCoderViewModel.trait.st | 18 +-- src/GToolkit-Coder-UI/package.st | 2 +- 231 files changed, 2015 insertions(+), 2011 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtCompositeRenameAction.class.st b/src/GToolkit-Coder-AddOns/GtCompositeRenameAction.class.st index 7af94fd91..8face5ebc 100644 --- a/src/GToolkit-Coder-AddOns/GtCompositeRenameAction.class.st +++ b/src/GToolkit-Coder-AddOns/GtCompositeRenameAction.class.st @@ -1,32 +1,32 @@ Class { - #name : #GtCompositeRenameAction, - #superclass : #GtRenameAction, + #name : 'GtCompositeRenameAction', + #superclass : 'GtRenameAction', #instVars : [ 'otherTextIntervals', 'otherTextAttributes' ], - #category : #'GToolkit-Coder-AddOns-Inline rename' + #category : 'GToolkit-Coder-AddOns-Inline rename' } -{ #category : #private } +{ #category : 'private' } GtCompositeRenameAction >> addLocations: intervals to: anEditor [ self addLocations: intervals toText: anEditor text ] -{ #category : #private } +{ #category : 'private' } GtCompositeRenameAction >> addLocations: intervals toText: ropedText [ otherTextIntervals at: ropedText put: (intervals asSortedCollection: [ :a :b | a first < b first ]) ] -{ #category : #private } +{ #category : 'private' } GtCompositeRenameAction >> addRenameAttributes [ super addRenameAttributes. self addRenameAttributesToOtherEditors ] -{ #category : #private } +{ #category : 'private' } GtCompositeRenameAction >> addRenameAttributesToOtherEditors [ | size | size := self originalName size. @@ -48,40 +48,40 @@ GtCompositeRenameAction >> addRenameAttributesToOtherEditors [ attribute ]) ] ] -{ #category : #'initialize-release' } +{ #category : 'initialize-release' } GtCompositeRenameAction >> initialize [ super initialize. otherTextIntervals := IdentityDictionary new. otherTextAttributes := IdentityDictionary new ] -{ #category : #private } +{ #category : 'private' } GtCompositeRenameAction >> removeAttributes [ super removeAttributes. self removeOtherAttributes ] -{ #category : #private } +{ #category : 'private' } GtCompositeRenameAction >> removeOtherAttributes [ otherTextAttributes keysDo: [ :text | text clearAttributes: [ :each | self isRenameAttribute: each ] ] ] -{ #category : #private } +{ #category : 'private' } GtCompositeRenameAction >> undoChanges [ super undoChanges. self removeOtherAttributes ] -{ #category : #actions } +{ #category : 'actions' } GtCompositeRenameAction >> updateName: blText [ super updateName: blText. otherTextAttributes do: [ :attrs | attrs do: [ :each | each updateText: blText ] ] ] -{ #category : #private } +{ #category : 'private' } GtCompositeRenameAction >> updateOtherEditors [ self newName = self originalName ifTrue: [ ^ self ]. @@ -93,7 +93,7 @@ GtCompositeRenameAction >> updateOtherEditors [ attributes: (otherTextAttributes at: text) ] ] -{ #category : #private } +{ #category : 'private' } GtCompositeRenameAction >> updateSource [ super updateSource. self updateOtherEditors diff --git a/src/GToolkit-Coder-AddOns/GtDefineClassFixItAction.class.st b/src/GToolkit-Coder-AddOns/GtDefineClassFixItAction.class.st index f6e5105ba..8161ca5a1 100644 --- a/src/GToolkit-Coder-AddOns/GtDefineClassFixItAction.class.st +++ b/src/GToolkit-Coder-AddOns/GtDefineClassFixItAction.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtDefineClassFixItAction, - #superclass : #GtFixItVariableNodeAction, - #category : #'GToolkit-Coder-AddOns-FixIt' + #name : 'GtDefineClassFixItAction', + #superclass : 'GtFixItVariableNodeAction', + #category : 'GToolkit-Coder-AddOns-FixIt' } -{ #category : #private } +{ #category : 'private' } GtDefineClassFixItAction >> addCreateClassAttributeInEditor: aBrTextEditor [ | text stencilBlock attribute adornmentAttribute | @@ -42,18 +42,18 @@ GtDefineClassFixItAction >> addCreateClassAttributeInEditor: aBrTextEditor [ to: self attributePosition ] -{ #category : #accessing } +{ #category : 'accessing' } GtDefineClassFixItAction >> description [ ^ 'Create class ' , self nodeName ] -{ #category : #accessing } +{ #category : 'accessing' } GtDefineClassFixItAction >> executeOn: anEditorElement [ self clearFixItAttributeInEditor: anEditorElement editor. self addCreateClassAttributeInEditor: anEditorElement editor. ] -{ #category : #accessing } +{ #category : 'accessing' } GtDefineClassFixItAction >> id [ diff --git a/src/GToolkit-Coder-AddOns/GtDefineClassFixItActionElementId.class.st b/src/GToolkit-Coder-AddOns/GtDefineClassFixItActionElementId.class.st index e36dc9ea5..e4765428d 100644 --- a/src/GToolkit-Coder-AddOns/GtDefineClassFixItActionElementId.class.st +++ b/src/GToolkit-Coder-AddOns/GtDefineClassFixItActionElementId.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtDefineClassFixItActionElementId, - #superclass : #GtFixItActionElementId, - #category : #'GToolkit-Coder-AddOns-FixIt' + #name : 'GtDefineClassFixItActionElementId', + #superclass : 'GtFixItActionElementId', + #category : 'GToolkit-Coder-AddOns-FixIt' } -{ #category : #converting } +{ #category : 'converting' } GtDefineClassFixItActionElementId >> asSymbol [ ^ #'fixit-action--define-class' ] diff --git a/src/GToolkit-Coder-AddOns/GtDefineClassVariableFixItAction.class.st b/src/GToolkit-Coder-AddOns/GtDefineClassVariableFixItAction.class.st index e64de5fc6..096ca52f2 100644 --- a/src/GToolkit-Coder-AddOns/GtDefineClassVariableFixItAction.class.st +++ b/src/GToolkit-Coder-AddOns/GtDefineClassVariableFixItAction.class.st @@ -1,20 +1,20 @@ Class { - #name : #GtDefineClassVariableFixItAction, - #superclass : #GtFixItVariableNodeAction, - #category : #'GToolkit-Coder-AddOns-FixIt' + #name : 'GtDefineClassVariableFixItAction', + #superclass : 'GtFixItVariableNodeAction', + #category : 'GToolkit-Coder-AddOns-FixIt' } -{ #category : #accessing } +{ #category : 'accessing' } GtDefineClassVariableFixItAction >> description [ ^ 'Add class variable ' , self nodeName , ' to class ', sourceCoder behavior name ] -{ #category : #accessing } +{ #category : 'accessing' } GtDefineClassVariableFixItAction >> executeOn: anEditorElement [ sourceCoder addClassVariable: node name ] -{ #category : #accessing } +{ #category : 'accessing' } GtDefineClassVariableFixItAction >> id [ diff --git a/src/GToolkit-Coder-AddOns/GtDefineClassVariableFixItActionElementId.class.st b/src/GToolkit-Coder-AddOns/GtDefineClassVariableFixItActionElementId.class.st index 2e0abb920..464c2601a 100644 --- a/src/GToolkit-Coder-AddOns/GtDefineClassVariableFixItActionElementId.class.st +++ b/src/GToolkit-Coder-AddOns/GtDefineClassVariableFixItActionElementId.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtDefineClassVariableFixItActionElementId, - #superclass : #GtFixItActionElementId, - #category : #'GToolkit-Coder-AddOns-FixIt' + #name : 'GtDefineClassVariableFixItActionElementId', + #superclass : 'GtFixItActionElementId', + #category : 'GToolkit-Coder-AddOns-FixIt' } -{ #category : #converting } +{ #category : 'converting' } GtDefineClassVariableFixItActionElementId >> asSymbol [ ^ #'fixit-action--define-class-variable' ] diff --git a/src/GToolkit-Coder-AddOns/GtDefineInstanceVariableFixItAction.class.st b/src/GToolkit-Coder-AddOns/GtDefineInstanceVariableFixItAction.class.st index dd573b023..9b71e08b9 100644 --- a/src/GToolkit-Coder-AddOns/GtDefineInstanceVariableFixItAction.class.st +++ b/src/GToolkit-Coder-AddOns/GtDefineInstanceVariableFixItAction.class.st @@ -1,20 +1,20 @@ Class { - #name : #GtDefineInstanceVariableFixItAction, - #superclass : #GtFixItVariableNodeAction, - #category : #'GToolkit-Coder-AddOns-FixIt' + #name : 'GtDefineInstanceVariableFixItAction', + #superclass : 'GtFixItVariableNodeAction', + #category : 'GToolkit-Coder-AddOns-FixIt' } -{ #category : #accessing } +{ #category : 'accessing' } GtDefineInstanceVariableFixItAction >> description [ ^ 'Add slot ' , self nodeName , ' in ', sourceCoder behavior name ] -{ #category : #accessing } +{ #category : 'accessing' } GtDefineInstanceVariableFixItAction >> executeOn: anEditorElement [ sourceCoder addInstanceVariable: self nodeName ] -{ #category : #accessing } +{ #category : 'accessing' } GtDefineInstanceVariableFixItAction >> id [ diff --git a/src/GToolkit-Coder-AddOns/GtDefineInstanceVariableFixItActionElementId.class.st b/src/GToolkit-Coder-AddOns/GtDefineInstanceVariableFixItActionElementId.class.st index ebdacf66b..87211ca36 100644 --- a/src/GToolkit-Coder-AddOns/GtDefineInstanceVariableFixItActionElementId.class.st +++ b/src/GToolkit-Coder-AddOns/GtDefineInstanceVariableFixItActionElementId.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtDefineInstanceVariableFixItActionElementId, - #superclass : #GtFixItActionElementId, - #category : #'GToolkit-Coder-AddOns-FixIt' + #name : 'GtDefineInstanceVariableFixItActionElementId', + #superclass : 'GtFixItActionElementId', + #category : 'GToolkit-Coder-AddOns-FixIt' } -{ #category : #converting } +{ #category : 'converting' } GtDefineInstanceVariableFixItActionElementId >> asSymbol [ ^ #'fixit-action--define-instance-variable' ] diff --git a/src/GToolkit-Coder-AddOns/GtDefineMethodFixItActionElementId.class.st b/src/GToolkit-Coder-AddOns/GtDefineMethodFixItActionElementId.class.st index 5de45f04b..5a496d2b7 100644 --- a/src/GToolkit-Coder-AddOns/GtDefineMethodFixItActionElementId.class.st +++ b/src/GToolkit-Coder-AddOns/GtDefineMethodFixItActionElementId.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtDefineMethodFixItActionElementId, - #superclass : #GtFixItActionElementId, - #category : #'GToolkit-Coder-AddOns-FixIt' + #name : 'GtDefineMethodFixItActionElementId', + #superclass : 'GtFixItActionElementId', + #category : 'GToolkit-Coder-AddOns-FixIt' } -{ #category : #converting } +{ #category : 'converting' } GtDefineMethodFixItActionElementId >> asSymbol [ ^ #'fixit-action--define-method' ] diff --git a/src/GToolkit-Coder-AddOns/GtDefineTemporaryFixItAction.class.st b/src/GToolkit-Coder-AddOns/GtDefineTemporaryFixItAction.class.st index d362195ab..c8fe37b1a 100644 --- a/src/GToolkit-Coder-AddOns/GtDefineTemporaryFixItAction.class.st +++ b/src/GToolkit-Coder-AddOns/GtDefineTemporaryFixItAction.class.st @@ -1,15 +1,15 @@ Class { - #name : #GtDefineTemporaryFixItAction, - #superclass : #GtFixItVariableNodeAction, - #category : #'GToolkit-Coder-AddOns-FixIt' + #name : 'GtDefineTemporaryFixItAction', + #superclass : 'GtFixItVariableNodeAction', + #category : 'GToolkit-Coder-AddOns-FixIt' } -{ #category : #accessing } +{ #category : 'accessing' } GtDefineTemporaryFixItAction >> description [ ^ 'Add temporary variable ' , self nodeName ] -{ #category : #executing } +{ #category : 'executing' } GtDefineTemporaryFixItAction >> executeOn: anEditorElement [ | ast newSource location declaration | @@ -28,7 +28,7 @@ GtDefineTemporaryFixItAction >> executeOn: anEditorElement [ sourceCoder currentSourceString: newSource ] -{ #category : #accessing } +{ #category : 'accessing' } GtDefineTemporaryFixItAction >> id [ diff --git a/src/GToolkit-Coder-AddOns/GtDefineTemporaryVariableFixItActionElementId.class.st b/src/GToolkit-Coder-AddOns/GtDefineTemporaryVariableFixItActionElementId.class.st index c86896cca..145be54c2 100644 --- a/src/GToolkit-Coder-AddOns/GtDefineTemporaryVariableFixItActionElementId.class.st +++ b/src/GToolkit-Coder-AddOns/GtDefineTemporaryVariableFixItActionElementId.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtDefineTemporaryVariableFixItActionElementId, - #superclass : #GtFixItActionElementId, - #category : #'GToolkit-Coder-AddOns-FixIt' + #name : 'GtDefineTemporaryVariableFixItActionElementId', + #superclass : 'GtFixItActionElementId', + #category : 'GToolkit-Coder-AddOns-FixIt' } -{ #category : #converting } +{ #category : 'converting' } GtDefineTemporaryVariableFixItActionElementId >> asSymbol [ ^ #'fixit-action--define-temporary-variable' ] diff --git a/src/GToolkit-Coder-AddOns/GtExtractMethodReorderParametersAttribute.class.st b/src/GToolkit-Coder-AddOns/GtExtractMethodReorderParametersAttribute.class.st index 1c61bf158..4f59966f2 100644 --- a/src/GToolkit-Coder-AddOns/GtExtractMethodReorderParametersAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtExtractMethodReorderParametersAttribute.class.st @@ -1,14 +1,14 @@ Class { - #name : #GtExtractMethodReorderParametersAttribute, - #superclass : #BrTextAdornmentAttribute, + #name : 'GtExtractMethodReorderParametersAttribute', + #superclass : 'BrTextAdornmentAttribute', #instVars : [ 'actionBlock', 'icon' ], - #category : #'GToolkit-Coder-AddOns-Extract method' + #category : 'GToolkit-Coder-AddOns-Extract method' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtExtractMethodReorderParametersAttribute class >> action: aBlock icon: anIcon [ ^ self new actionBlock: aBlock; @@ -16,17 +16,17 @@ GtExtractMethodReorderParametersAttribute class >> action: aBlock icon: anIcon [ yourself ] -{ #category : #accessing } +{ #category : 'accessing' } GtExtractMethodReorderParametersAttribute >> actionBlock [ ^ actionBlock ] -{ #category : #accessing } +{ #category : 'accessing' } GtExtractMethodReorderParametersAttribute >> actionBlock: aBlock [ actionBlock := aBlock ] -{ #category : #accessing } +{ #category : 'accessing' } GtExtractMethodReorderParametersAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ ^ BlElement new size: icon extent; @@ -35,17 +35,17 @@ GtExtractMethodReorderParametersAttribute >> doAffect: aTBrTextEditorTextualPiec yourself ] -{ #category : #accessing } +{ #category : 'accessing' } GtExtractMethodReorderParametersAttribute >> icon [ ^ icon ] -{ #category : #accessing } +{ #category : 'accessing' } GtExtractMethodReorderParametersAttribute >> icon: anObject [ icon := anObject ] -{ #category : #'initialize-release' } +{ #category : 'initialize-release' } GtExtractMethodReorderParametersAttribute >> initialize [ super initialize. diff --git a/src/GToolkit-Coder-AddOns/GtExtractMethodSelectorKeywordAttribute.class.st b/src/GToolkit-Coder-AddOns/GtExtractMethodSelectorKeywordAttribute.class.st index 5712b22df..9ca198579 100644 --- a/src/GToolkit-Coder-AddOns/GtExtractMethodSelectorKeywordAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtExtractMethodSelectorKeywordAttribute.class.st @@ -1,42 +1,42 @@ Class { - #name : #GtExtractMethodSelectorKeywordAttribute, - #superclass : #BlTextAttribute, + #name : 'GtExtractMethodSelectorKeywordAttribute', + #superclass : 'BlTextAttribute', #instVars : [ 'index' ], - #category : #'GToolkit-Coder-AddOns-Extract method' + #category : 'GToolkit-Coder-AddOns-Extract method' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtExtractMethodSelectorKeywordAttribute class >> keywordIndex: anInteger [ ^ self new index: anInteger; yourself ] -{ #category : #comparing } +{ #category : 'comparing' } GtExtractMethodSelectorKeywordAttribute >> equals: aTextAttribute [ ^ self index = aTextAttribute index ] -{ #category : #comparing } +{ #category : 'comparing' } GtExtractMethodSelectorKeywordAttribute >> hash [ "Answer an integer value that is related to the identity of the receiver." ^ super hash bitXor: self index hash ] -{ #category : #accessing } +{ #category : 'accessing' } GtExtractMethodSelectorKeywordAttribute >> index [ ^ index ] -{ #category : #accessing } +{ #category : 'accessing' } GtExtractMethodSelectorKeywordAttribute >> index: anInteger [ index := anInteger ] -{ #category : #initialization } +{ #category : 'initialization' } GtExtractMethodSelectorKeywordAttribute >> initialize [ super initialize. diff --git a/src/GToolkit-Coder-AddOns/GtFixItAction.class.st b/src/GToolkit-Coder-AddOns/GtFixItAction.class.st index d7da10cec..86db5117c 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItAction.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItAction.class.st @@ -1,14 +1,14 @@ Class { - #name : #GtFixItAction, - #superclass : #Object, + #name : 'GtFixItAction', + #superclass : 'Object', #instVars : [ 'node', 'sourceCoder' ], - #category : #'GToolkit-Coder-AddOns-FixIt' + #category : 'GToolkit-Coder-AddOns-FixIt' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtFixItAction class >> forCoder: aSourceCoder node: aRBProgramNode [ ^ self new sourceCoder: aSourceCoder; @@ -16,12 +16,12 @@ GtFixItAction class >> forCoder: aSourceCoder node: aRBProgramNode [ yourself ] -{ #category : #'api - node' } +{ #category : 'api - node' } GtFixItAction >> attributePosition [ ^ node name stopPosition ] -{ #category : #private } +{ #category : 'private' } GtFixItAction >> clearFixItAttributeInEditor: aBrTextEditor [ | position | position := self attributePosition. @@ -29,24 +29,24 @@ GtFixItAction >> clearFixItAttributeInEditor: aBrTextEditor [ clearAttributes: [ :each | each isKindOf: GtFixItAttribute ] ] -{ #category : #'api - action' } +{ #category : 'api - action' } GtFixItAction >> description [ self subclassResponsibility ] -{ #category : #executing } +{ #category : 'executing' } GtFixItAction >> executeOn: anEditorElement [ self subclassResponsibility ] -{ #category : #'api - action' } +{ #category : 'api - action' } GtFixItAction >> id [ ^ self subclassResponsibility ] -{ #category : #private } +{ #category : 'private' } GtFixItAction >> menuActionWithIndex: anIndex [ ^ GtCoderContextMenuAction new action: [ :aCoderViewModel :anEvent :anEditorElement | @@ -56,22 +56,22 @@ GtFixItAction >> menuActionWithIndex: anIndex [ id: (self id indexed: anIndex) ] -{ #category : #initialization } +{ #category : 'initialization' } GtFixItAction >> node: aRBProgramNode [ node := aRBProgramNode ] -{ #category : #initialization } +{ #category : 'initialization' } GtFixItAction >> sourceCoder: aCoder [ sourceCoder := aCoder ] -{ #category : #'api - node' } +{ #category : 'api - node' } GtFixItAction >> startPosition [ ^ node name startPosition ] -{ #category : #'api - node' } +{ #category : 'api - node' } GtFixItAction >> stopPosition [ ^ node name stopPosition ] diff --git a/src/GToolkit-Coder-AddOns/GtFixItActionElementId.class.st b/src/GToolkit-Coder-AddOns/GtFixItActionElementId.class.st index 4f1c633cd..6a146fc5a 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItActionElementId.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItActionElementId.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtFixItActionElementId, - #superclass : #GtCoderElementId, - #category : #'GToolkit-Coder-AddOns-FixIt' + #name : 'GtFixItActionElementId', + #superclass : 'GtCoderElementId', + #category : 'GToolkit-Coder-AddOns-FixIt' } -{ #category : #testing } +{ #category : 'testing' } GtFixItActionElementId class >> isAbstract [ ^ self = GtFixItActionElementId ] diff --git a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st index a5a6d4247..f3ba7a772 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st @@ -1,13 +1,13 @@ Class { - #name : #GtFixItAttribute, - #superclass : #BrTextAdornmentAttribute, + #name : 'GtFixItAttribute', + #superclass : 'BrTextAdornmentAttribute', #instVars : [ 'fixItActionsBlock' ], - #category : #'GToolkit-Coder-AddOns-FixIt' + #category : 'GToolkit-Coder-AddOns-FixIt' } -{ #category : #accessing } +{ #category : 'accessing' } GtFixItAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ "Return an element that should affect (either append or replace) a provided text piece" @@ -34,12 +34,12 @@ GtFixItAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ yourself ] -{ #category : #initialization } +{ #category : 'initialization' } GtFixItAttribute >> fixItActions: aCollection [ fixItActionsBlock := aCollection ] -{ #category : #accessing } +{ #category : 'accessing' } GtFixItAttribute >> initialize [ super initialize. diff --git a/src/GToolkit-Coder-AddOns/GtFixItButton.class.st b/src/GToolkit-Coder-AddOns/GtFixItButton.class.st index a3248280d..4bb08be43 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItButton.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItButton.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtFixItButton, - #superclass : #BrButton, - #category : #'GToolkit-Coder-AddOns-FixIt' + #name : 'GtFixItButton', + #superclass : 'BrButton', + #category : 'GToolkit-Coder-AddOns-FixIt' } diff --git a/src/GToolkit-Coder-AddOns/GtFixItVariableNodeAction.class.st b/src/GToolkit-Coder-AddOns/GtFixItVariableNodeAction.class.st index 95ffed4f5..d0fd50ac4 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItVariableNodeAction.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItVariableNodeAction.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtFixItVariableNodeAction, - #superclass : #GtFixItAction, - #category : #'GToolkit-Coder-AddOns-FixIt' + #name : 'GtFixItVariableNodeAction', + #superclass : 'GtFixItAction', + #category : 'GToolkit-Coder-AddOns-FixIt' } -{ #category : #'api - node' } +{ #category : 'api - node' } GtFixItVariableNodeAction >> nodeName [ ^ node variableName ] diff --git a/src/GToolkit-Coder-AddOns/GtRenameAction.class.st b/src/GToolkit-Coder-AddOns/GtRenameAction.class.st index e61cebb63..06bd74641 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameAction.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameAction.class.st @@ -1,6 +1,6 @@ Class { - #name : #GtRenameAction, - #superclass : #Object, + #name : 'GtRenameAction', + #superclass : 'Object', #traits : 'TGtAnnouncer', #classTraits : 'TGtAnnouncer classTrait', #instVars : [ @@ -15,10 +15,10 @@ Class { 'validationBlock', 'filter' ], - #category : #'GToolkit-Coder-AddOns-Inline rename' + #category : 'GToolkit-Coder-AddOns-Inline rename' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtRenameAction class >> locations: aCollectionOfIntervals element: aTextEditorElement [ ^ self new textElement: aTextEditorElement; @@ -26,7 +26,7 @@ GtRenameAction class >> locations: aCollectionOfIntervals element: aTextEditorEl yourself ] -{ #category : #actions } +{ #category : 'actions' } GtRenameAction >> accept [ self updateSource. self uninstall. @@ -34,7 +34,7 @@ GtRenameAction >> accept [ self announceEvent: #accept ] -{ #category : #private } +{ #category : 'private' } GtRenameAction >> addRenameAttributes [ | text cursorInLocation | text := self text. @@ -60,22 +60,22 @@ GtRenameAction >> addRenameAttributes [ attribute ] ] -{ #category : #'private - actions' } +{ #category : 'private - actions' } GtRenameAction >> allowSave [ textElement textualCoderViewModel allowSaveDueTo: self ] -{ #category : #private } +{ #category : 'private' } GtRenameAction >> announceEvent: aSymbol [ ^ self announce: (GtRenameActionAnnouncement for: self type: aSymbol) ] -{ #category : #announcer } +{ #category : 'announcer' } GtRenameAction >> announcer [ ^ announcer ifNil: [ announcer := Announcer new ] ] -{ #category : #actions } +{ #category : 'actions' } GtRenameAction >> cancel [ self uninstall. self undoChanges. @@ -83,12 +83,12 @@ GtRenameAction >> cancel [ self announceEvent: #cancel ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameAction >> editor [ ^ self editorAttribute editor ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameAction >> editorAttribute [ ^ renameAttributes notNil ifTrue: [ renameAttributes @@ -96,30 +96,30 @@ GtRenameAction >> editorAttribute [ ifNone: [ ] ] ] -{ #category : #private } +{ #category : 'private' } GtRenameAction >> filter: aTextEditorInputFilter [ filter := aTextEditorInputFilter. self primaryRenameAttribute ifNotNil: [ :attr | attr filter: aTextEditorInputFilter ] ] -{ #category : #'initialize-release' } +{ #category : 'initialize-release' } GtRenameAction >> forBinaryOrKeyword [ validationBlock := [ :str | (self validateKeyword: str) or: [ self validateBinary: str ] ] ] -{ #category : #'initialize-release' } +{ #category : 'initialize-release' } GtRenameAction >> forKeyword [ validationBlock := [ :str | self validateKeyword: str ] ] -{ #category : #'initialize-release' } +{ #category : 'initialize-release' } GtRenameAction >> forVariableOrUnaryMessage [ validationBlock := [ :str | self validateVariable: str ]. self filter: BrTextEditorAlphaNumericInputFilter new ] -{ #category : #'initialize-release' } +{ #category : 'initialize-release' } GtRenameAction >> initialize [ super initialize. originalLocations := #(). @@ -128,7 +128,7 @@ GtRenameAction >> initialize [ filter := BrTextEditorNoInputFilter new ] -{ #category : #installation } +{ #category : 'installation' } GtRenameAction >> install [ originalLocations isEmpty ifTrue: [ ^ self ]. @@ -139,54 +139,54 @@ GtRenameAction >> install [ self announceEvent: #install ] -{ #category : #testing } +{ #category : 'testing' } GtRenameAction >> isInstalled [ ^ isInstalled ] -{ #category : #testing } +{ #category : 'testing' } GtRenameAction >> isRenameAttribute: anAttribute [ ^ anAttribute isKindOf: GtRenamePreviewAttribute ] -{ #category : #'private-validation' } +{ #category : 'private-validation' } GtRenameAction >> isValid [ validationBlock isNil ifTrue: [ ^ true ]. ^ validationBlock value: self newName ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameAction >> locations: aCollectionOfIntervals [ originalLocations := aCollectionOfIntervals asSortedCollection: [ :a :b | a first < b first ]. self validateLocations ] -{ #category : #actions } +{ #category : 'actions' } GtRenameAction >> lostFocus [ self isValid ifTrue: [ self accept ] ifFalse: [ self cancel ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameAction >> newName [ ^ renameAttributes first text asString ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameAction >> originalName [ ^ (originalText copyFrom: originalLocations first first to: originalLocations first last) asString ] -{ #category : #'private - actions' } +{ #category : 'private - actions' } GtRenameAction >> preventSave [ textElement textualCoderViewModel preventSaveDueTo: self ] -{ #category : #private } +{ #category : 'private' } GtRenameAction >> primaryRenameAttribute [ renameAttributes isNil ifTrue: [ ^ nil ]. @@ -195,25 +195,25 @@ GtRenameAction >> primaryRenameAttribute [ ifNone: [ nil ] ] -{ #category : #private } +{ #category : 'private' } GtRenameAction >> removeAttributeHandlers [ renameAttributes do: [ :each | each uninstallEventHandlers ] ] -{ #category : #private } +{ #category : 'private' } GtRenameAction >> removeAttributes [ self text clearAttributes: [ :each | self isRenameAttribute: each ]. self removeAttributeHandlers ] -{ #category : #actions } +{ #category : 'actions' } GtRenameAction >> returnAccept [ self isValid ifFalse: [ ^ self ]. self accept ] -{ #category : #private } +{ #category : 'private' } GtRenameAction >> saveOriginalState [ | text | text := self text. @@ -221,17 +221,17 @@ GtRenameAction >> saveOriginalState [ originalCursorPosition := self textEditor cursors first position ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameAction >> selectAll [ ^ selectAll ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameAction >> selectAll: anObject [ selectAll := anObject ] -{ #category : #actions } +{ #category : 'actions' } GtRenameAction >> tabAccept: forward [ self isValid ifFalse: [ ^ self ]. @@ -243,27 +243,27 @@ GtRenameAction >> tabAccept: forward [ ifFalse: [ #shiftTab ]) ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameAction >> text [ ^ self textEditor text ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameAction >> textEditor [ ^ self textElement editor ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameAction >> textElement [ ^ textElement ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameAction >> textElement: aTextEditorElement [ textElement := aTextEditorElement ] -{ #category : #private } +{ #category : 'private' } GtRenameAction >> undoChanges [ self textElement text: originalText; @@ -272,7 +272,7 @@ GtRenameAction >> undoChanges [ self textEditor moveCursorTo: originalCursorPosition ] -{ #category : #installation } +{ #category : 'installation' } GtRenameAction >> uninstall [ self removeAttributes. isInstalled := false. @@ -282,7 +282,7 @@ GtRenameAction >> uninstall [ enqueueTask: (BlTaskAction new action: [ textElement requestFocus ]) ] -{ #category : #private } +{ #category : 'private' } GtRenameAction >> updateCursorLocation [ | sizeDifference offset | sizeDifference := self newName size - self originalName size. @@ -299,13 +299,13 @@ GtRenameAction >> updateCursorLocation [ offset := offset + sizeDifference ] ] -{ #category : #actions } +{ #category : 'actions' } GtRenameAction >> updateName: blText [ renameAttributes do: [ :each | each updateText: blText ]. self announceEvent: #textUpdated ] -{ #category : #private } +{ #category : 'private' } GtRenameAction >> updateSource [ self newName = self originalName ifTrue: [ ^ self removeAttributes ]. @@ -316,7 +316,7 @@ GtRenameAction >> updateSource [ self updateCursorLocation ] -{ #category : #private } +{ #category : 'private' } GtRenameAction >> updateSourceIn: editor at: intervals attributes: attributeCollection [ self updateText: editor text @@ -324,7 +324,7 @@ GtRenameAction >> updateSourceIn: editor at: intervals attributes: attributeColl attributes: attributeCollection ] -{ #category : #private } +{ #category : 'private' } GtRenameAction >> updateText: text at: intervals attributes: attributeCollection [ | newText index | newText := '' asRopedText. @@ -345,14 +345,14 @@ GtRenameAction >> updateText: text at: intervals attributes: attributeCollection onTextModified ] -{ #category : #'private-validation' } +{ #category : 'private-validation' } GtRenameAction >> validateBinary: aString [ aString isEmpty ifTrue: [ ^ false ]. ^ (RBScanner isSelector: aString) and: [ aString asSymbol isBinary ] ] -{ #category : #'private-validation' } +{ #category : 'private-validation' } GtRenameAction >> validateKeyword: aString [ aString isEmpty ifTrue: [ ^ false ]. @@ -362,7 +362,7 @@ GtRenameAction >> validateKeyword: aString [ and: [ aString asSymbol numArgs = 1 ] ] -{ #category : #private } +{ #category : 'private' } GtRenameAction >> validateLocations [ | lastLocation size | originalLocations isEmpty @@ -378,7 +378,7 @@ GtRenameAction >> validateLocations [ ifTrue: [ self error: 'Cannot rename items of different sizes' ] ] ] -{ #category : #'private-validation' } +{ #category : 'private-validation' } GtRenameAction >> validateVariable: aString [ ^ RBScanner isVariable: aString ] diff --git a/src/GToolkit-Coder-AddOns/GtRenameAction2.class.st b/src/GToolkit-Coder-AddOns/GtRenameAction2.class.st index 78f8563e9..aad9376ce 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameAction2.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameAction2.class.st @@ -1,6 +1,6 @@ Class { - #name : #GtRenameAction2, - #superclass : #Object, + #name : 'GtRenameAction2', + #superclass : 'Object', #traits : 'TGtAnnouncer', #classTraits : 'TGtAnnouncer classTrait', #instVars : [ @@ -16,10 +16,10 @@ Class { 'originalCursors', 'coderAttributes' ], - #category : #'GToolkit-Coder-AddOns-Inline rename' + #category : 'GToolkit-Coder-AddOns-Inline rename' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtRenameAction2 class >> locations: aCollectionOfIntervals textualCoderViewModel: aTextualCoderViewModel [ ^ self new locations: aCollectionOfIntervals; @@ -27,7 +27,7 @@ GtRenameAction2 class >> locations: aCollectionOfIntervals textualCoderViewModel yourself ] -{ #category : #actions } +{ #category : 'actions' } GtRenameAction2 >> accept [ self updateSource. self uninstall. @@ -35,7 +35,7 @@ GtRenameAction2 >> accept [ self announceEvent: #accept ] -{ #category : #'private - attributes' } +{ #category : 'private - attributes' } GtRenameAction2 >> addRenameAttributes [ | text cursorInLocation | @@ -73,22 +73,22 @@ GtRenameAction2 >> addRenameAttributes [ description: [ 'There must not be more than one editor attribute' ] ] -{ #category : #'private - actions' } +{ #category : 'private - actions' } GtRenameAction2 >> allowSave [ pharoSourceCoderViewModel allowSaveDueTo: self ] -{ #category : #private } +{ #category : 'private' } GtRenameAction2 >> announceEvent: aSymbol [ ^ self announce: (GtRenameActionAnnouncement for: self type: aSymbol) ] -{ #category : #announcer } +{ #category : 'announcer' } GtRenameAction2 >> announcer [ ^ announcer ifNil: [ announcer := Announcer new ] ] -{ #category : #actions } +{ #category : 'actions' } GtRenameAction2 >> cancel [ self uninstall. self undoChanges. @@ -96,12 +96,12 @@ GtRenameAction2 >> cancel [ self announceEvent: #cancel ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameAction2 >> editor [ ^ self editorAttribute editor ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameAction2 >> editorAttribute [ ^ renameAttributes notNil ifTrue: [ renameAttributes @@ -109,30 +109,30 @@ GtRenameAction2 >> editorAttribute [ ifNone: [ ] ] ] -{ #category : #private } +{ #category : 'private' } GtRenameAction2 >> filter: aTextEditorInputFilter [ filter := aTextEditorInputFilter. self primaryRenameAttribute ifNotNil: [ :attr | attr filter: aTextEditorInputFilter ] ] -{ #category : #'initialize-release' } +{ #category : 'initialize-release' } GtRenameAction2 >> forBinaryOrKeyword [ validationBlock := [ :str | (self validateKeyword: str) or: [ self validateBinary: str ] ] ] -{ #category : #'initialize-release' } +{ #category : 'initialize-release' } GtRenameAction2 >> forKeyword [ validationBlock := [ :str | self validateKeyword: str ] ] -{ #category : #'initialize-release' } +{ #category : 'initialize-release' } GtRenameAction2 >> forVariableOrUnaryMessage [ validationBlock := [ :str | self validateVariable: str ]. self filter: BrTextEditorAlphaNumericInputFilter new ] -{ #category : #'initialize-release' } +{ #category : 'initialize-release' } GtRenameAction2 >> initialize [ super initialize. originalLocations := #(). @@ -143,7 +143,7 @@ GtRenameAction2 >> initialize [ coderAttributes := #(). ] -{ #category : #installation } +{ #category : 'installation' } GtRenameAction2 >> install [ originalLocations isEmpty ifTrue: [ ^ self ]. @@ -157,64 +157,64 @@ GtRenameAction2 >> install [ self announceEvent: #install ] -{ #category : #testing } +{ #category : 'testing' } GtRenameAction2 >> isInstalled [ ^ isInstalled ] -{ #category : #testing } +{ #category : 'testing' } GtRenameAction2 >> isRenameAttribute: anAttribute [ ^ anAttribute isKindOf: GtRenamePreviewAttribute ] -{ #category : #'private-validation' } +{ #category : 'private-validation' } GtRenameAction2 >> isValid [ validationBlock isNil ifTrue: [ ^ true ]. ^ validationBlock value: self newName ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameAction2 >> locations: aCollectionOfIntervals [ originalLocations := aCollectionOfIntervals asSortedCollection: [ :a :b | a first < b first ]. self validateLocations ] -{ #category : #actions } +{ #category : 'actions' } GtRenameAction2 >> lostFocus [ self isValid ifTrue: [ self accept ] ifFalse: [ self cancel ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameAction2 >> newName [ ^ renameAttributes first text asString ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameAction2 >> originalName [ ^ (originalText copyFrom: originalLocations first first to: originalLocations first last) asString ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameAction2 >> pharoSourceCoderViewModel [ ^ pharoSourceCoderViewModel ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameAction2 >> pharoSourceCoderViewModel: anObject [ pharoSourceCoderViewModel := anObject ] -{ #category : #'private - actions' } +{ #category : 'private - actions' } GtRenameAction2 >> preventSave [ pharoSourceCoderViewModel preventSaveDueTo: self ] -{ #category : #'private - attributes' } +{ #category : 'private - attributes' } GtRenameAction2 >> primaryRenameAttribute [ renameAttributes isNil ifTrue: [ ^ nil ]. @@ -223,41 +223,41 @@ GtRenameAction2 >> primaryRenameAttribute [ ifNone: [ nil ] ] -{ #category : #'private - attributes' } +{ #category : 'private - attributes' } GtRenameAction2 >> removeAttributeHandlers [ renameAttributes do: [ :each | each uninstallEventHandlers ] ] -{ #category : #'private - attributes' } +{ #category : 'private - attributes' } GtRenameAction2 >> removeAttributes [ self pharoSourceCoderViewModel removeAllCoderTextAttributes: coderAttributes. self removeAttributeHandlers ] -{ #category : #actions } +{ #category : 'actions' } GtRenameAction2 >> returnAccept [ self isValid ifFalse: [ ^ self ]. self accept ] -{ #category : #private } +{ #category : 'private' } GtRenameAction2 >> saveOriginalState [ originalText := self pharoSourceCoderViewModel sourceText copy. originalCursors := self pharoSourceCoderViewModel cursors copy ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameAction2 >> selectAll [ ^ selectAll ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameAction2 >> selectAll: anObject [ selectAll := anObject ] -{ #category : #actions } +{ #category : 'actions' } GtRenameAction2 >> tabAccept: forward [ self isValid ifFalse: [ ^ self ]. @@ -269,12 +269,12 @@ GtRenameAction2 >> tabAccept: forward [ ifFalse: [ #shiftTab ]) ] -{ #category : #private } +{ #category : 'private' } GtRenameAction2 >> undoChanges [ self pharoSourceCoderViewModel cursors: originalCursors ] -{ #category : #installation } +{ #category : 'installation' } GtRenameAction2 >> uninstall [ self removeAttributes. isInstalled := false. @@ -284,7 +284,7 @@ GtRenameAction2 >> uninstall [ pharoSourceCoderViewModel focused: true ] -{ #category : #private } +{ #category : 'private' } GtRenameAction2 >> updateCursorLocation [ | sizeDifference offset | sizeDifference := self newName size - self originalName size. @@ -303,13 +303,13 @@ GtRenameAction2 >> updateCursorLocation [ offset := offset + sizeDifference ] ] -{ #category : #actions } +{ #category : 'actions' } GtRenameAction2 >> updateName: blText [ renameAttributes do: [ :each | each updateText: blText ]. self announceEvent: #textUpdated ] -{ #category : #private } +{ #category : 'private' } GtRenameAction2 >> updateSource [ self newName = self originalName ifTrue: [ ^ self removeAttributes ]. @@ -322,7 +322,7 @@ GtRenameAction2 >> updateSource [ self updateCursorLocation ] -{ #category : #private } +{ #category : 'private' } GtRenameAction2 >> updateSourceIn: aTextualSourceCoderViewModel at: intervals attributes: attributeCollection [ self updateText: aTextualSourceCoderViewModel sourceText @@ -330,7 +330,7 @@ GtRenameAction2 >> updateSourceIn: aTextualSourceCoderViewModel at: intervals at attributes: attributeCollection ] -{ #category : #private } +{ #category : 'private' } GtRenameAction2 >> updateText: text at: intervals attributes: attributeCollection [ | newText index | newText := '' asRopedText. @@ -352,14 +352,14 @@ GtRenameAction2 >> updateText: text at: intervals attributes: attributeCollectio synchronously: true ] -{ #category : #'private-validation' } +{ #category : 'private-validation' } GtRenameAction2 >> validateBinary: aString [ aString isEmpty ifTrue: [ ^ false ]. ^ (RBScanner isSelector: aString) and: [ aString asSymbol isBinary ] ] -{ #category : #'private-validation' } +{ #category : 'private-validation' } GtRenameAction2 >> validateKeyword: aString [ aString isEmpty ifTrue: [ ^ false ]. @@ -369,7 +369,7 @@ GtRenameAction2 >> validateKeyword: aString [ and: [ aString asSymbol numArgs = 1 ] ] -{ #category : #private } +{ #category : 'private' } GtRenameAction2 >> validateLocations [ | lastLocation size | originalLocations isEmpty @@ -385,7 +385,7 @@ GtRenameAction2 >> validateLocations [ ifTrue: [ self error: 'Cannot rename items of different sizes' ] ] ] -{ #category : #'private-validation' } +{ #category : 'private-validation' } GtRenameAction2 >> validateVariable: aString [ ^ RBScanner isVariable: aString ] diff --git a/src/GToolkit-Coder-AddOns/GtRenameActionAnnouncement.class.st b/src/GToolkit-Coder-AddOns/GtRenameActionAnnouncement.class.st index 505e8ec12..96a233d5b 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameActionAnnouncement.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameActionAnnouncement.class.st @@ -1,14 +1,14 @@ Class { - #name : #GtRenameActionAnnouncement, - #superclass : #Announcement, + #name : 'GtRenameActionAnnouncement', + #superclass : 'Announcement', #instVars : [ 'renameAction', 'eventType' ], - #category : #'GToolkit-Coder-AddOns-Inline rename' + #category : 'GToolkit-Coder-AddOns-Inline rename' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtRenameActionAnnouncement class >> for: aRenameAction type: aSymbol [ ^ self new renameAction: aRenameAction; @@ -16,22 +16,22 @@ GtRenameActionAnnouncement class >> for: aRenameAction type: aSymbol [ yourself ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameActionAnnouncement >> eventType [ ^ eventType ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameActionAnnouncement >> eventType: aSymbol [ eventType := aSymbol ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameActionAnnouncement >> renameAction [ ^ renameAction ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameActionAnnouncement >> renameAction: aRenameAction [ renameAction := aRenameAction ] diff --git a/src/GToolkit-Coder-AddOns/GtRenameClassController.class.st b/src/GToolkit-Coder-AddOns/GtRenameClassController.class.st index b8ecc7d7b..b1ec2939f 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameClassController.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameClassController.class.st @@ -1,15 +1,15 @@ Class { - #name : #GtRenameClassController, - #superclass : #GtRenameVariableController, - #category : #'GToolkit-Coder-AddOns-Inline rename' + #name : 'GtRenameClassController', + #superclass : 'GtRenameVariableController', + #category : 'GToolkit-Coder-AddOns-Inline rename' } -{ #category : #accessing } +{ #category : 'accessing' } GtRenameClassController >> refactoringName [ ^ 'Rename class' ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameClassController >> rename: oldNameString to: newNameString [ | model | model := self createModel. diff --git a/src/GToolkit-Coder-AddOns/GtRenameClassVariableController.class.st b/src/GToolkit-Coder-AddOns/GtRenameClassVariableController.class.st index 7a24f5e27..9518c2194 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameClassVariableController.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameClassVariableController.class.st @@ -1,15 +1,15 @@ Class { - #name : #GtRenameClassVariableController, - #superclass : #GtRenameVariableController, - #category : #'GToolkit-Coder-AddOns-Inline rename' + #name : 'GtRenameClassVariableController', + #superclass : 'GtRenameVariableController', + #category : 'GToolkit-Coder-AddOns-Inline rename' } -{ #category : #accessing } +{ #category : 'accessing' } GtRenameClassVariableController >> refactoringName [ ^ 'Rename class variable' ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameClassVariableController >> rename: oldName to: newName [ | model class | model := self createModel. diff --git a/src/GToolkit-Coder-AddOns/GtRenameController.class.st b/src/GToolkit-Coder-AddOns/GtRenameController.class.st index 0e6549131..3cbdd2b60 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameController.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameController.class.st @@ -1,6 +1,6 @@ Class { - #name : #GtRenameController, - #superclass : #GtSourceCoderRefactoringController, + #name : 'GtRenameController', + #superclass : 'GtSourceCoderRefactoringController', #instVars : [ 'handlers', 'renameAction', @@ -9,10 +9,10 @@ Class { 'renameInterval', 'completionAction' ], - #category : #'GToolkit-Coder-AddOns-Inline rename' + #category : 'GToolkit-Coder-AddOns-Inline rename' } -{ #category : #private } +{ #category : 'private' } GtRenameController >> addRefactoringChangesPreview [ | aRefactoring aRenamePosition | self removeRefactoringAttribute. @@ -33,24 +33,24 @@ GtRenameController >> addRefactoringChangesPreview [ self allowSave ] ] -{ #category : #executing } +{ #category : 'executing' } GtRenameController >> cancelRefactoring [ self removeRefactoringAttribute. self restoreText. self allowSave ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameController >> completionAction [ ^ completionAction ifNil: [ [ ] ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameController >> completionAction: aBlock [ completionAction := aBlock ] -{ #category : #executing } +{ #category : 'executing' } GtRenameController >> createModel [ | model | model := RBClassModelFactory rbNamespace @@ -65,13 +65,13 @@ GtRenameController >> createModel [ ^ model ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameController >> cursorPositionDo: aBlock [ self sourceEditor cursors do: [ :eachCursor | ^ aBlock value: (eachCursor position + 1 min: self sourceEditor text size) ] ] -{ #category : #executing } +{ #category : 'executing' } GtRenameController >> installRenameAction [ renameAction := GtRenameAction locations: { renameInterval } @@ -95,55 +95,55 @@ GtRenameController >> installRenameAction [ renameAction install ] -{ #category : #executing } +{ #category : 'executing' } GtRenameController >> installRenamer [ self subclassResponsibility ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameController >> installValidation [ renameAction forVariableOrUnaryMessage ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameController >> newName [ ^ newName ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameController >> originalName [ ^ self subclassResponsibility ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameController >> originalNode [ ^ node ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameController >> originalNode: aGtPharoProgramNode [ node := aGtPharoProgramNode ] -{ #category : #private } +{ #category : 'private' } GtRenameController >> renamePosition [ ^ (renameAction isNil or: [ renameAction isInstalled ]) ifTrue: [ renameInterval last ] ifFalse: [ renameInterval last + self newName size - self originalName size ] ] -{ #category : #executing } +{ #category : 'executing' } GtRenameController >> safelyExecute [ self installRenamer ] -{ #category : #private } +{ #category : 'private' } GtRenameController >> tab: forward [ ] -{ #category : #private } +{ #category : 'private' } GtRenameController >> updateName: aString [ newName := aString. self addRefactoringChangesPreview diff --git a/src/GToolkit-Coder-AddOns/GtRenameEditor.class.st b/src/GToolkit-Coder-AddOns/GtRenameEditor.class.st index 684bf5573..974bedc9e 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameEditor.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameEditor.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtRenameEditor, - #superclass : #BrEditableLabel, - #category : #'GToolkit-Coder-AddOns-Inline rename' + #name : 'GtRenameEditor', + #superclass : 'BrEditableLabel', + #category : 'GToolkit-Coder-AddOns-Inline rename' } diff --git a/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st b/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st index 43ef15f75..718dd81f3 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st @@ -1,26 +1,26 @@ Class { - #name : #GtRenameEditorAttribute, - #superclass : #GtRenamePreviewAttribute, + #name : 'GtRenameEditorAttribute', + #superclass : 'GtRenamePreviewAttribute', #instVars : [ 'cursorLocation', 'selectAll', 'filter', 'editorShortcuts' ], - #category : #'GToolkit-Coder-AddOns-Inline rename' + #category : 'GToolkit-Coder-AddOns-Inline rename' } -{ #category : #accessing } +{ #category : 'accessing' } GtRenameEditorAttribute >> additionalAttributes [ ^ #() ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameEditorAttribute >> cursorLocation: anInteger [ cursorLocation := anInteger ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameEditorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ renameEditor := GtRenameEditor new fitContent; @@ -50,14 +50,14 @@ GtRenameEditorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElem ^ renameEditor ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameEditorAttribute >> editorCursorLocation [ renameEditor notNil ifTrue: [ renameEditor editor cursors do: [ :cursor | ^ cursor position ] ]. ^ text size ] -{ #category : #private } +{ #category : 'private' } GtRenameEditorAttribute >> editorShortcuts [ ^ editorShortcuts ifNil: [ editorShortcuts := { @@ -75,14 +75,14 @@ GtRenameEditorAttribute >> editorShortcuts [ action: [ :aShortcutEvent | self renameAction accept ])} ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameEditorAttribute >> filter: aTextEditorInputFilter [ filter := aTextEditorInputFilter. renameEditor notNil ifTrue: [ renameEditor inputFilter: aTextEditorInputFilter ] ] -{ #category : #initialization } +{ #category : 'initialization' } GtRenameEditorAttribute >> initialize [ super initialize. @@ -91,38 +91,38 @@ GtRenameEditorAttribute >> initialize [ self cache: self newPooledCache ] -{ #category : #testing } +{ #category : 'testing' } GtRenameEditorAttribute >> isEditorAttribute [ ^ true ] -{ #category : #testing } +{ #category : 'testing' } GtRenameEditorAttribute >> isFocusable [ ^ true ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameEditorAttribute >> renameAction [ ^ renameAction ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameEditorAttribute >> selectAll [ ^ selectAll ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameEditorAttribute >> selectAll: aBoolean [ selectAll := aBoolean ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameEditorAttribute >> uninstallEventHandlers [ renameEditor notNil ifTrue: [ renameEditor editor removeEditorShortcuts: self editorShortcuts ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameEditorAttribute >> updateFocus: event [ renameAction isInstalled ifTrue: [ renameAction lostFocus ] diff --git a/src/GToolkit-Coder-AddOns/GtRenameInstanceVariableController.class.st b/src/GToolkit-Coder-AddOns/GtRenameInstanceVariableController.class.st index 985dc47e1..57ebc06f4 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameInstanceVariableController.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameInstanceVariableController.class.st @@ -1,15 +1,15 @@ Class { - #name : #GtRenameInstanceVariableController, - #superclass : #GtRenameVariableController, - #category : #'GToolkit-Coder-AddOns-Inline rename' + #name : 'GtRenameInstanceVariableController', + #superclass : 'GtRenameVariableController', + #category : 'GToolkit-Coder-AddOns-Inline rename' } -{ #category : #accessing } +{ #category : 'accessing' } GtRenameInstanceVariableController >> refactoringName [ ^ 'Rename instance variable' ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameInstanceVariableController >> rename: oldName to: newName [ | model class | model := self createModel. diff --git a/src/GToolkit-Coder-AddOns/GtRenameMethodController.class.st b/src/GToolkit-Coder-AddOns/GtRenameMethodController.class.st index 14e73e596..2bd163f75 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameMethodController.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameMethodController.class.st @@ -1,6 +1,6 @@ Class { - #name : #GtRenameMethodController, - #superclass : #GtRenameController, + #name : 'GtRenameMethodController', + #superclass : 'GtRenameController', #instVars : [ 'selector', 'someImplementor', @@ -9,10 +9,10 @@ Class { 'startIndex', 'previewIndex' ], - #category : #'GToolkit-Coder-AddOns-Inline rename' + #category : 'GToolkit-Coder-AddOns-Inline rename' } -{ #category : #executing } +{ #category : 'executing' } GtRenameMethodController >> installRenamer [ self cursorPositionDo: [ :position | @@ -32,7 +32,7 @@ GtRenameMethodController >> installRenamer [ self installRenamerOn: message ] ] ] ] -{ #category : #executing } +{ #category : 'executing' } GtRenameMethodController >> installRenamerOn: aGtPharoMessageNode [ previewIndex := node selectorParts last stopPosition. newName := newSelectorParts at: selectorIndex. @@ -40,7 +40,7 @@ GtRenameMethodController >> installRenamerOn: aGtPharoMessageNode [ self installRenameAction ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameMethodController >> installValidation [ | argCount | argCount := selector numArgs. @@ -51,12 +51,12 @@ GtRenameMethodController >> installValidation [ ifFalse: [ renameAction forKeyword ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameMethodController >> newName [ ^ self newSelectorName ] -{ #category : #private } +{ #category : 'private' } GtRenameMethodController >> newNode [ coder astAwait nodesDo: [ :each | ((each isMessage or: [ each isMethod or: [ each isMethodPattern ] ]) @@ -65,7 +65,7 @@ GtRenameMethodController >> newNode [ ^ nil ] -{ #category : #private } +{ #category : 'private' } GtRenameMethodController >> newSelectorName [ selector numArgs = 0 ifTrue: [ ^ newName asSymbol ]. @@ -75,12 +75,12 @@ GtRenameMethodController >> newSelectorName [ asSymbol ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameMethodController >> originalName [ ^ selector ] -{ #category : #private } +{ #category : 'private' } GtRenameMethodController >> refactoring [ | implementor newSelector model | implementor := self someImplementor. @@ -99,12 +99,12 @@ GtRenameMethodController >> refactoring [ methodCoder: coder ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameMethodController >> refactoringName [ ^ 'Rename method' ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameMethodController >> renamePosition [ self newNode ifNotNil: [ :message | ^ message selectorParts last stopPosition ]. @@ -114,7 +114,7 @@ GtRenameMethodController >> renamePosition [ - self originalName size ] ] -{ #category : #private } +{ #category : 'private' } GtRenameMethodController >> someImplementor [ ^ someImplementor ifNil: [ (SystemNavigation default allImplementorsOf: selector) @@ -122,7 +122,7 @@ GtRenameMethodController >> someImplementor [ ifNotEmpty: [ :impls | someImplementor := impls anyOne methodClass ] ] ] -{ #category : #private } +{ #category : 'private' } GtRenameMethodController >> tab: forward [ self originalNode arguments size < 2 ifTrue: [ ^ self ]. @@ -143,7 +143,7 @@ GtRenameMethodController >> tab: forward [ ifFalse: [ self addRefactoringChangesPreview ] ] ] -{ #category : #private } +{ #category : 'private' } GtRenameMethodController >> updateName: aString [ "we should update selector parts before updating the name, otherwise the refactoring will be canceled" diff --git a/src/GToolkit-Coder-AddOns/GtRenamePreviewAttribute.class.st b/src/GToolkit-Coder-AddOns/GtRenamePreviewAttribute.class.st index 5130a0425..d4f381a4d 100644 --- a/src/GToolkit-Coder-AddOns/GtRenamePreviewAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenamePreviewAttribute.class.st @@ -1,28 +1,28 @@ Class { - #name : #GtRenamePreviewAttribute, - #superclass : #BrTextAdornmentAttribute, + #name : 'GtRenamePreviewAttribute', + #superclass : 'BrTextAdornmentAttribute', #instVars : [ 'text', 'originalAttributes', 'renameAction', 'renameEditor' ], - #category : #'GToolkit-Coder-AddOns-Inline rename' + #category : 'GToolkit-Coder-AddOns-Inline rename' } -{ #category : #accessing } +{ #category : 'accessing' } GtRenamePreviewAttribute >> action: aRenameAction [ renameAction := aRenameAction ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenamePreviewAttribute >> additionalAttributes [ ^ { BlTextDecorationAttribute new underline color: BrGlamorousColors textHighlightColor } ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenamePreviewAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ | editor | @@ -39,12 +39,12 @@ GtRenamePreviewAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorEle ^ renameEditor ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenamePreviewAttribute >> editor [ ^ renameEditor editor ] -{ #category : #initialization } +{ #category : 'initialization' } GtRenamePreviewAttribute >> initialize [ super initialize. @@ -52,17 +52,17 @@ GtRenamePreviewAttribute >> initialize [ self beReplace ] -{ #category : #testing } +{ #category : 'testing' } GtRenamePreviewAttribute >> isEditorAttribute [ ^ false ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenamePreviewAttribute >> text [ ^ text ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenamePreviewAttribute >> text: blText [ text := blText asString asRopedText. originalAttributes isNil @@ -72,11 +72,11 @@ GtRenamePreviewAttribute >> text: blText [ text attributes: originalAttributes , self additionalAttributes ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenamePreviewAttribute >> uninstallEventHandlers [ ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenamePreviewAttribute >> updateText: blText [ self text: blText. renameEditor notNil diff --git a/src/GToolkit-Coder-AddOns/GtRenameVariableController.class.st b/src/GToolkit-Coder-AddOns/GtRenameVariableController.class.st index e306322d0..dd0c04bf3 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameVariableController.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameVariableController.class.st @@ -1,16 +1,16 @@ Class { - #name : #GtRenameVariableController, - #superclass : #GtRenameController, - #category : #'GToolkit-Coder-AddOns-Inline rename' + #name : 'GtRenameVariableController', + #superclass : 'GtRenameController', + #category : 'GToolkit-Coder-AddOns-Inline rename' } -{ #category : #accessing } +{ #category : 'accessing' } GtRenameVariableController >> addRefactoringChangesPreview [ super addRefactoringChangesPreview. self styleRenamedVariable ] -{ #category : #executing } +{ #category : 'executing' } GtRenameVariableController >> installRenamer [ newName := self originalNode source. renameInterval := self originalNode sourceInterval. @@ -18,24 +18,24 @@ GtRenameVariableController >> installRenamer [ self installRenameAction ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameVariableController >> originalName [ ^ self originalNode source ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameVariableController >> refactoring [ self originalName = self newName ifTrue: [ ^ nil ]. ^ self rename: self originalName to: self newName ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameVariableController >> rename: oldName to: newName [ ^ self subclassResponsibility ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameVariableController >> styleRenamedVariable [ (self sourceText from: renameInterval first diff --git a/src/GToolkit-Coder-AddOns/GtRenameVariableFixItAction.class.st b/src/GToolkit-Coder-AddOns/GtRenameVariableFixItAction.class.st index 2a533651e..938614900 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameVariableFixItAction.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameVariableFixItAction.class.st @@ -1,18 +1,18 @@ Class { - #name : #GtRenameVariableFixItAction, - #superclass : #GtFixItVariableNodeAction, + #name : 'GtRenameVariableFixItAction', + #superclass : 'GtFixItVariableNodeAction', #instVars : [ 'newName' ], - #category : #'GToolkit-Coder-AddOns-FixIt' + #category : 'GToolkit-Coder-AddOns-FixIt' } -{ #category : #accessing } +{ #category : 'accessing' } GtRenameVariableFixItAction >> description [ ^ 'Use ' , newName , ' instead of ' , self nodeName ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameVariableFixItAction >> executeOn: anEditorElement [ | newSource | newSource := sourceCoder currentSourceString. @@ -21,14 +21,14 @@ GtRenameVariableFixItAction >> executeOn: anEditorElement [ sourceCoder currentSourceString: newSource ] -{ #category : #accessing } +{ #category : 'accessing' } GtRenameVariableFixItAction >> id [ ^ GtRenameVariableFixItActionElementId ] -{ #category : #initialization } +{ #category : 'initialization' } GtRenameVariableFixItAction >> newName: aString [ newName := aString ] diff --git a/src/GToolkit-Coder-AddOns/GtRenameVariableFixItActionElementId.class.st b/src/GToolkit-Coder-AddOns/GtRenameVariableFixItActionElementId.class.st index edc10139b..1040bf59b 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameVariableFixItActionElementId.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameVariableFixItActionElementId.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtRenameVariableFixItActionElementId, - #superclass : #GtFixItActionElementId, - #category : #'GToolkit-Coder-AddOns-FixIt' + #name : 'GtRenameVariableFixItActionElementId', + #superclass : 'GtFixItActionElementId', + #category : 'GToolkit-Coder-AddOns-FixIt' } -{ #category : #converting } +{ #category : 'converting' } GtRenameVariableFixItActionElementId >> asSymbol [ ^ #'fixit-action--rename-variable' ] diff --git a/src/GToolkit-Coder-AddOns/GtSourceCoderInlineRenameShortcut.class.st b/src/GToolkit-Coder-AddOns/GtSourceCoderInlineRenameShortcut.class.st index ae5bc710b..010bd6208 100644 --- a/src/GToolkit-Coder-AddOns/GtSourceCoderInlineRenameShortcut.class.st +++ b/src/GToolkit-Coder-AddOns/GtSourceCoderInlineRenameShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : #GtSourceCoderInlineRenameShortcut, - #superclass : #GtSourceCoderShortcut, - #category : #'GToolkit-Coder-AddOns-Inline rename' + #name : 'GtSourceCoderInlineRenameShortcut', + #superclass : 'GtSourceCoderShortcut', + #category : 'GToolkit-Coder-AddOns-Inline rename' } -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderInlineRenameShortcut >> description [ ^ 'Performs the rename refactoring of the selected variable/class/method.' ] -{ #category : #initialization } +{ #category : 'initialization' } GtSourceCoderInlineRenameShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryR ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderInlineRenameShortcut >> name [ ^ 'Rename' ] -{ #category : #evaluation } +{ #category : 'evaluation' } GtSourceCoderInlineRenameShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent [ self diff --git a/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st b/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st index 4f115e762..54fca49a0 100644 --- a/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st +++ b/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st @@ -5,17 +5,17 @@ Is applied on a specific instance of the source coder editor and plays a role of " Class { - #name : #GtSourceCoderRefactoringController, - #superclass : #Object, + #name : 'GtSourceCoderRefactoringController', + #superclass : 'Object', #instVars : [ 'coder', 'sourceElement', 'originalSource' ], - #category : #'GToolkit-Coder-AddOns-! Core' + #category : 'GToolkit-Coder-AddOns-! Core' } -{ #category : #'private - attributes' } +{ #category : 'private - attributes' } GtSourceCoderRefactoringController >> addRefactoringChangesPreview: aRefactoring at: aTextPosition [ self addRefactoringChangesPreview: aRefactoring @@ -23,7 +23,7 @@ GtSourceCoderRefactoringController >> addRefactoringChangesPreview: aRefactoring whenComplete: nil ] -{ #category : #'private - attributes' } +{ #category : 'private - attributes' } GtSourceCoderRefactoringController >> addRefactoringChangesPreview: aRefactoring at: aTextPosition whenComplete: aBlock [ self removeRefactoringAttribute. aRefactoring isNil @@ -36,22 +36,22 @@ GtSourceCoderRefactoringController >> addRefactoringChangesPreview: aRefactoring completionAction: aBlock) } ] -{ #category : #private } +{ #category : 'private' } GtSourceCoderRefactoringController >> allowSave [ self sourceElement textualCoderViewModel allowSaveDueTo: self ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderRefactoringController >> coder [ ^ coder ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderRefactoringController >> coder: methodCoder [ coder := methodCoder ] -{ #category : #executing } +{ #category : 'executing' } GtSourceCoderRefactoringController >> execute [ [ self saveSource. @@ -71,69 +71,69 @@ GtSourceCoderRefactoringController >> execute [ ex return ] ] -{ #category : #private } +{ #category : 'private' } GtSourceCoderRefactoringController >> preventSave [ self sourceElement textualCoderViewModel preventSaveDueTo: self ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderRefactoringController >> refactoring [ ^ self subclassResponsibility ] -{ #category : #executing } +{ #category : 'executing' } GtSourceCoderRefactoringController >> refactoringFailed [ ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderRefactoringController >> refactoringName [ ^ self subclassResponsibility ] -{ #category : #'private - attributes' } +{ #category : 'private - attributes' } GtSourceCoderRefactoringController >> removeRefactoringAttribute [ self sourceEditor text clearAttributes: [ :each | each class = GtRefactoringChangesAttribute ] ] -{ #category : #private } +{ #category : 'private' } GtSourceCoderRefactoringController >> restoreText [ self setText: originalSource ] -{ #category : #executing } +{ #category : 'executing' } GtSourceCoderRefactoringController >> safelyExecute [ self subclassResponsibility ] -{ #category : #executing } +{ #category : 'executing' } GtSourceCoderRefactoringController >> saveSource [ originalSource := self sourceText copy ] -{ #category : #private } +{ #category : 'private' } GtSourceCoderRefactoringController >> setText: aStringOrText [ self sourceElement text: aStringOrText asRopedText; onTextModified ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderRefactoringController >> sourceEditor [ ^ self sourceElement editor ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderRefactoringController >> sourceElement [ ^ sourceElement ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderRefactoringController >> sourceElement: textElement [ sourceElement := textElement ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderRefactoringController >> sourceText [ ^ self sourceEditor text ] diff --git a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st index bf6ff786c..181a98ada 100644 --- a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st +++ b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st @@ -1,16 +1,16 @@ -Extension { #name : #GtTextualCoder } +Extension { #name : 'GtTextualCoder' } -{ #category : #'*GToolkit-Coder-AddOns' } +{ #category : '*GToolkit-Coder-AddOns' } GtTextualCoder >> addCopyCutPasteContextMenuAddOnsAst: anAst to: coderAddOns [ coderAddOns addContextMenuItem: 'Cut' - action: [ :aCoderViewModel :aClickEvent :anEditorElement | anEditorElement editor cutSelected ] + action: [ :aCoderViewModel :anEditorElement | anEditorElement editor cutSelected ] id: GtTextualCoderCutContextMenuItemId; addContextMenuItem: 'Copy' - action: [ :aCoderViewModel :aClickEvent :anEditorElement | anEditorElement editor copySelected ] + action: [ :aCoderViewModel :anEditorElement | anEditorElement editor copySelected ] id: GtTextualCoderCopyContextMenuItemId; addContextMenuItem: 'Paste' - action: [ :aCoderViewModel :aClickEvent :anEditorElement | anEditorElement editor paste ] + action: [ :aCoderViewModel :anEditorElement | anEditorElement editor paste ] id: GtTextualCoderPasteContextMenuItemId ] diff --git a/src/GToolkit-Coder-AddOns/package.st b/src/GToolkit-Coder-AddOns/package.st index 0792a8a8b..b81ef9a60 100644 --- a/src/GToolkit-Coder-AddOns/package.st +++ b/src/GToolkit-Coder-AddOns/package.st @@ -1 +1 @@ -Package { #name : #'GToolkit-Coder-AddOns' } +Package { #name : 'GToolkit-Coder-AddOns' } diff --git a/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorNameApplyPreviewId.class.st b/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorNameApplyPreviewId.class.st index 811cd432e..dd3660795 100644 --- a/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorNameApplyPreviewId.class.st +++ b/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorNameApplyPreviewId.class.st @@ -4,12 +4,12 @@ A button that appears when behavior name is modified to open a popup with the re " Class { - #name : #GtBehaviorCoderBehaviorNameApplyPreviewId, - #superclass : #GtCoderElementId, - #category : #'GToolkit-Coder-UI-Coder - Basic' + #name : 'GtBehaviorCoderBehaviorNameApplyPreviewId', + #superclass : 'GtCoderElementId', + #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : #converting } +{ #category : 'converting' } GtBehaviorCoderBehaviorNameApplyPreviewId >> asSymbol [ ^ #'behavior-coder--behavior-name-apply-preview' ] diff --git a/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorNameId.class.st b/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorNameId.class.st index 04cd3e513..6f8f12fa9 100644 --- a/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorNameId.class.st +++ b/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorNameId.class.st @@ -4,12 +4,12 @@ An editable label with behavior's name " Class { - #name : #GtBehaviorCoderBehaviorNameId, - #superclass : #GtCoderElementId, - #category : #'GToolkit-Coder-UI-Coder - Basic' + #name : 'GtBehaviorCoderBehaviorNameId', + #superclass : 'GtCoderElementId', + #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : #converting } +{ #category : 'converting' } GtBehaviorCoderBehaviorNameId >> asSymbol [ ^ #'behavior-coder--behavior-name-editor' ] diff --git a/src/GToolkit-Coder-UI/GtBehaviorDefinitionCoderUIModel.class.st b/src/GToolkit-Coder-UI/GtBehaviorDefinitionCoderUIModel.class.st index 334250827..7a879ac8e 100644 --- a/src/GToolkit-Coder-UI/GtBehaviorDefinitionCoderUIModel.class.st +++ b/src/GToolkit-Coder-UI/GtBehaviorDefinitionCoderUIModel.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtBehaviorDefinitionCoderUIModel, - #superclass : #GtSingleCoderViewModel, - #category : #'GToolkit-Coder-UI-Coder - Behavior-Definition Model' + #name : 'GtBehaviorDefinitionCoderUIModel', + #superclass : 'GtSingleCoderViewModel', + #category : 'GToolkit-Coder-UI-Coder - Behavior-Definition Model' } -{ #category : #accessing } +{ #category : 'accessing' } GtBehaviorDefinitionCoderUIModel >> elementClass [ ^ GtPharoBehaviorDefinitionCoderElement ] diff --git a/src/GToolkit-Coder-UI/GtCategoryToggleAptitude.class.st b/src/GToolkit-Coder-UI/GtCategoryToggleAptitude.class.st index 2548de648..6a1191936 100644 --- a/src/GToolkit-Coder-UI/GtCategoryToggleAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtCategoryToggleAptitude.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtCategoryToggleAptitude, - #superclass : #GtCoderToggleAptitude, - #category : #'GToolkit-Coder-UI-Looks' + #name : 'GtCategoryToggleAptitude', + #superclass : 'GtCoderToggleAptitude', + #category : 'GToolkit-Coder-UI-Looks' } -{ #category : #accessing } +{ #category : 'accessing' } GtCategoryToggleAptitude >> initialize [ super initialize. self diff --git a/src/GToolkit-Coder-UI/GtClassBreadcrumbToggleAptitude.class.st b/src/GToolkit-Coder-UI/GtClassBreadcrumbToggleAptitude.class.st index a09a9f4ce..01a6c9cbf 100644 --- a/src/GToolkit-Coder-UI/GtClassBreadcrumbToggleAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtClassBreadcrumbToggleAptitude.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtClassBreadcrumbToggleAptitude, - #superclass : #BrAptitude, - #category : #'GToolkit-Coder-UI-Looks' + #name : 'GtClassBreadcrumbToggleAptitude', + #superclass : 'BrAptitude', + #category : 'GToolkit-Coder-UI-Looks' } -{ #category : #accessing } +{ #category : 'accessing' } GtClassBreadcrumbToggleAptitude >> initialize [ super initialize. self diff --git a/src/GToolkit-Coder-UI/GtClassCardElement.class.st b/src/GToolkit-Coder-UI/GtClassCardElement.class.st index e4139861a..725e0d9e5 100644 --- a/src/GToolkit-Coder-UI/GtClassCardElement.class.st +++ b/src/GToolkit-Coder-UI/GtClassCardElement.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtClassCardElement, - #superclass : #GtCoderCardElement, - #category : #'GToolkit-Coder-UI-Basic' + #name : 'GtClassCardElement', + #superclass : 'GtCoderCardElement', + #category : 'GToolkit-Coder-UI-Basic' } -{ #category : #'building ui' } +{ #category : 'building ui' } GtClassCardElement >> detailsLabel [ | comment | comment := coder theClass organization comment. diff --git a/src/GToolkit-Coder-UI/GtClassCoderTool.class.st b/src/GToolkit-Coder-UI/GtClassCoderTool.class.st index 41c37ed97..c4485ccd8 100644 --- a/src/GToolkit-Coder-UI/GtClassCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtClassCoderTool.class.st @@ -1,39 +1,39 @@ Class { - #name : #GtClassCoderTool, - #superclass : #GtCoderTool, + #name : 'GtClassCoderTool', + #superclass : 'GtCoderTool', #instVars : [ 'observedClass' ], - #category : #'GToolkit-Coder-UI-Tools' + #category : 'GToolkit-Coder-UI-Tools' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtClassCoderTool class >> forClass: aClass [ ^ self new observedClass: aClass ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtClassCoderTool class >> observedClass: aClass [ ^ self new observedClass: aClass ] -{ #category : #converting } +{ #category : 'converting' } GtClassCoderTool >> newCoder [ ^ GtCoder forClass: self observedClass instanceSide ] -{ #category : #accessing } +{ #category : 'accessing' } GtClassCoderTool >> object [ "compatibility method for ${GLMBlocObjectToSelect}$" ^ self observedClass ] -{ #category : #accessing } +{ #category : 'accessing' } GtClassCoderTool >> observedClass [ ^ observedClass ] -{ #category : #accessing } +{ #category : 'accessing' } GtClassCoderTool >> observedClass: anObject [ observedClass := anObject ] diff --git a/src/GToolkit-Coder-UI/GtClassesCoderUIModel.class.st b/src/GToolkit-Coder-UI/GtClassesCoderUIModel.class.st index 6201e1c55..a9245d8fa 100644 --- a/src/GToolkit-Coder-UI/GtClassesCoderUIModel.class.st +++ b/src/GToolkit-Coder-UI/GtClassesCoderUIModel.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtClassesCoderUIModel, - #superclass : #GtMultipleCodersViewModel, - #category : #'GToolkit-Coder-UI-Coder - Classes Model' + #name : 'GtClassesCoderUIModel', + #superclass : 'GtMultipleCodersViewModel', + #category : 'GToolkit-Coder-UI-Coder - Classes Model' } -{ #category : #accessing } +{ #category : 'accessing' } GtClassesCoderUIModel >> elementClass [ ^ GtClassesElement ] diff --git a/src/GToolkit-Coder-UI/GtClassesElement.class.st b/src/GToolkit-Coder-UI/GtClassesElement.class.st index 44575b807..8ef17c709 100644 --- a/src/GToolkit-Coder-UI/GtClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtClassesElement.class.st @@ -1,13 +1,13 @@ Class { - #name : #GtClassesElement, - #superclass : #BlElement, + #name : 'GtClassesElement', + #superclass : 'BlElement', #instVars : [ 'coder' ], - #category : #'GToolkit-Coder-UI-Basic' + #category : 'GToolkit-Coder-UI-Basic' } -{ #category : #'building ui' } +{ #category : 'building ui' } GtClassesElement >> buildContainer [ | aClassList | self removeChildren. @@ -21,19 +21,19 @@ GtClassesElement >> buildContainer [ self addChild: aClassList ] -{ #category : #accessing } +{ #category : 'accessing' } GtClassesElement >> coders: aCoder [ coder := aCoder. self buildContainer ] -{ #category : #accessing } +{ #category : 'accessing' } GtClassesElement >> codersUIModel: aCoder [ coder := aCoder coder. self buildContainer ] -{ #category : #initialization } +{ #category : 'initialization' } GtClassesElement >> initialize [ super initialize. self diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionCompositeEntityViewer.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionCompositeEntityViewer.class.st index 4536b894b..b965b17e3 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionCompositeEntityViewer.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionCompositeEntityViewer.class.st @@ -1,20 +1,20 @@ Class { - #name : #GtCodeDefinitionCompositeEntityViewer, - #superclass : #GtCodeDefinitionViewer, + #name : 'GtCodeDefinitionCompositeEntityViewer', + #superclass : 'GtCodeDefinitionViewer', #instVars : [ 'editors', 'separatorStencil', 'showSectionNames' ], - #category : #'GToolkit-Coder-UI-Behaviour - Editor / Reader' + #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtCodeDefinitionCompositeEntityViewer class >> withAll: aCollectionOfEditors [ ^ self new editors: aCollectionOfEditors ] -{ #category : #'api - instantiation' } +{ #category : 'api - instantiation' } GtCodeDefinitionCompositeEntityViewer >> create [ @@ -45,18 +45,18 @@ GtCodeDefinitionCompositeEntityViewer >> create [ aStream nextPut: (self buildSectionLabel: (editors at: aCurrentIndex) title) ] ] ]) ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionCompositeEntityViewer >> editors [ ^ editors ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionCompositeEntityViewer >> editors: anObject [ editors := anObject. self title: editors first title ] -{ #category : #initialization } +{ #category : 'initialization' } GtCodeDefinitionCompositeEntityViewer >> initialize [ super initialize. @@ -64,17 +64,17 @@ GtCodeDefinitionCompositeEntityViewer >> initialize [ showSectionNames := true ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionCompositeEntityViewer >> separator: aStencil [ separatorStencil := aStencil asStencil ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionCompositeEntityViewer >> withSectionNames [ showSectionNames := true ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionCompositeEntityViewer >> withoutSectionNames [ showSectionNames := false ] diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionEntityViewer.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionEntityViewer.class.st index 560417a36..5c3965006 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionEntityViewer.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionEntityViewer.class.st @@ -1,6 +1,6 @@ Class { - #name : #GtCodeDefinitionEntityViewer, - #superclass : #GtCodeDefinitionViewer, + #name : 'GtCodeDefinitionEntityViewer', + #superclass : 'GtCodeDefinitionViewer', #instVars : [ 'definition', 'owner', @@ -12,35 +12,35 @@ Class { 'eventHandlers', 'containerName' ], - #category : #'GToolkit-Coder-UI-Behaviour - Editor / Reader' + #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' } -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionEntityViewer >> completion: aStencil [ completionStencil := aStencil asStencil ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionEntityViewer >> containerName [ ^ containerName ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionEntityViewer >> containerName: anObject [ containerName := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionEntityViewer >> definition [ ^ definition ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionEntityViewer >> definition: anObject [ definition := anObject ] -{ #category : #initialization } +{ #category : 'initialization' } GtCodeDefinitionEntityViewer >> initialize [ super initialize. @@ -59,34 +59,34 @@ GtCodeDefinitionEntityViewer >> initialize [ modelSelector := nil ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionEntityViewer >> modelSelector [ ^ modelSelector ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionEntityViewer >> modelSelector: anObject [ modelSelector := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionEntityViewer >> owner [ ^ owner ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionEntityViewer >> owner: anObject [ owner := anObject ] -{ #category : #interactions } +{ #category : 'interactions' } GtCodeDefinitionEntityViewer >> when: aBlEvent do: aBlock [ "aBlock is in form [ :anEvent :aCodeDefinition ]" eventHandlers add: (aBlEvent -> aBlock) ] -{ #category : #interactions } +{ #category : 'interactions' } GtCodeDefinitionEntityViewer >> whenClickDo: aBlock [ "I do not react to primary+click" "aBlock is in form [ :anEvent :aCodeDefinition ]" @@ -100,14 +100,14 @@ GtCodeDefinitionEntityViewer >> whenClickDo: aBlock [ aBlock cull: anEvent cull: aDefinition ] ] ] -{ #category : #interactions } +{ #category : 'interactions' } GtCodeDefinitionEntityViewer >> whenKey: aBlKeyCombination do: aBlock [ "aBlock is in form [ :anEvent :aCodeDefinition ]" interactions add: (aBlKeyCombination -> aBlock) ] -{ #category : #interactions } +{ #category : 'interactions' } GtCodeDefinitionEntityViewer >> whenPrimaryClickDo: aBlock [ "aBlock is in form [ :anEvent :aCodeDefinition ]" diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionNestedEntityViewer.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionNestedEntityViewer.class.st index e8a7969e7..9ebb72bbd 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionNestedEntityViewer.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionNestedEntityViewer.class.st @@ -1,14 +1,14 @@ Class { - #name : #GtCodeDefinitionNestedEntityViewer, - #superclass : #GtCodeDefinitionViewer, + #name : 'GtCodeDefinitionNestedEntityViewer', + #superclass : 'GtCodeDefinitionViewer', #instVars : [ 'editor', 'nestedEditors' ], - #category : #'GToolkit-Coder-UI-Behaviour - Editor / Reader' + #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' } -{ #category : #'api - instantiation' } +{ #category : 'api - instantiation' } GtCodeDefinitionNestedEntityViewer >> create [ | aContainer theNestedEditors | @@ -44,23 +44,23 @@ GtCodeDefinitionNestedEntityViewer >> create [ ^ aContainer ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionNestedEntityViewer >> editor [ ^ editor ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionNestedEntityViewer >> editor: anObject [ editor := anObject. self title: editor title ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionNestedEntityViewer >> nestedEditors [ ^ nestedEditors ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionNestedEntityViewer >> nestedEditors: anObject [ nestedEditors := anObject ] diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st index 588d4bf17..b57a2f609 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st @@ -1,25 +1,25 @@ Class { - #name : #GtCodeDefinitionPluralEditor, - #superclass : #GtCodeDefinitionPluralViewer, + #name : 'GtCodeDefinitionPluralEditor', + #superclass : 'GtCodeDefinitionPluralViewer', #instVars : [ 'addSelector', 'renameSelector', 'removeSelector' ], - #category : #'GToolkit-Coder-UI-Behaviour - Editor / Reader' + #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' } -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionPluralEditor >> addSelector [ ^ addSelector ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionPluralEditor >> addSelector: anObject [ addSelector := anObject ] -{ #category : #'api - instantiation' } +{ #category : 'api - instantiation' } GtCodeDefinitionPluralEditor >> create [ | aDefinition anOwner theInitialNames addAction removeAction renameAction aTagger | @@ -114,22 +114,22 @@ GtCodeDefinitionPluralEditor >> create [ ^ aTagger ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionPluralEditor >> removeSelector [ ^ removeSelector ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionPluralEditor >> removeSelector: anObject [ removeSelector := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionPluralEditor >> renameSelector [ ^ renameSelector ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionPluralEditor >> renameSelector: anObject [ renameSelector := anObject ] diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralReader.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionPluralReader.class.st index 1599d8759..68c3f82d9 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralReader.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionPluralReader.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtCodeDefinitionPluralReader, - #superclass : #GtCodeDefinitionPluralViewer, - #category : #'GToolkit-Coder-UI-Behaviour - Editor / Reader' + #name : 'GtCodeDefinitionPluralReader', + #superclass : 'GtCodeDefinitionPluralViewer', + #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' } -{ #category : #'api - instantiation' } +{ #category : 'api - instantiation' } GtCodeDefinitionPluralReader >> create [ | aDefinition anOwner theInitialNames aTagger | diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralViewer.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionPluralViewer.class.st index 4b5eb2199..0af717cce 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralViewer.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionPluralViewer.class.st @@ -1,6 +1,6 @@ Class { - #name : #GtCodeDefinitionPluralViewer, - #superclass : #GtCodeDefinitionEntityViewer, + #name : 'GtCodeDefinitionPluralViewer', + #superclass : 'GtCodeDefinitionEntityViewer', #instVars : [ 'separatorStencil', 'getSelector', @@ -8,32 +8,32 @@ Class { 'removeAnnouncement', 'renameAnnouncement' ], - #category : #'GToolkit-Coder-UI-Behaviour - Editor / Reader' + #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' } -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionPluralViewer >> addEvent: anObject [ addAnnouncement := anObject ] -{ #category : #'api - instantiation' } +{ #category : 'api - instantiation' } GtCodeDefinitionPluralViewer >> create [ ^ self subclassResponsibility ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionPluralViewer >> getSelector [ ^ getSelector ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionPluralViewer >> getSelector: anObject [ getSelector := anObject ] -{ #category : #initialization } +{ #category : 'initialization' } GtCodeDefinitionPluralViewer >> initialize [ super initialize. @@ -41,17 +41,17 @@ GtCodeDefinitionPluralViewer >> initialize [ separatorStencil := nil ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionPluralViewer >> removeEvent: anObject [ removeAnnouncement := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionPluralViewer >> renameEvent: anObject [ renameAnnouncement := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionPluralViewer >> separator: aStencil [ separatorStencil := aStencil asStencil ] diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionSectionLabelStencil.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionSectionLabelStencil.class.st index cd0313f20..6f39c1643 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionSectionLabelStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionSectionLabelStencil.class.st @@ -1,13 +1,13 @@ Class { - #name : #GtCodeDefinitionSectionLabelStencil, - #superclass : #BrStencil, + #name : 'GtCodeDefinitionSectionLabelStencil', + #superclass : 'BrStencil', #instVars : [ 'name' ], - #category : #'GToolkit-Coder-UI-Behaviour - Editor / Reader' + #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' } -{ #category : #'api - instantiation' } +{ #category : 'api - instantiation' } GtCodeDefinitionSectionLabelStencil >> create [ @@ -18,12 +18,12 @@ GtCodeDefinitionSectionLabelStencil >> create [ constraintsDo: [ :c | c grid horizontal alignLeft ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionSectionLabelStencil >> name [ ^ name ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionSectionLabelStencil >> name: anObject [ name := anObject ] diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionSingleEditor.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionSingleEditor.class.st index 777794c53..ee32a337b 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionSingleEditor.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionSingleEditor.class.st @@ -1,13 +1,13 @@ Class { - #name : #GtCodeDefinitionSingleEditor, - #superclass : #GtCodeDefinitionSingleViewer, + #name : 'GtCodeDefinitionSingleEditor', + #superclass : 'GtCodeDefinitionSingleViewer', #instVars : [ 'setSelector' ], - #category : #'GToolkit-Coder-UI-Behaviour - Editor / Reader' + #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' } -{ #category : #private } +{ #category : 'private' } GtCodeDefinitionSingleEditor >> addErrorOverlayTo: aTagElement [ | anOverlay anAnimation | @@ -27,7 +27,7 @@ GtCodeDefinitionSingleEditor >> addErrorOverlayTo: aTagElement [ ifTrue: [ aTagElement parent addChild: anOverlay ] ] -{ #category : #'api - instantiation' } +{ #category : 'api - instantiation' } GtCodeDefinitionSingleEditor >> create [ | aDefinition theInitialName anEditableLabel anOwner | @@ -80,7 +80,7 @@ GtCodeDefinitionSingleEditor >> create [ ^ anEditableLabel ] -{ #category : #private } +{ #category : 'private' } GtCodeDefinitionSingleEditor >> handleRenameError: anError to: aNewName from: aTagElement [ anError description traceCr. @@ -95,7 +95,7 @@ GtCodeDefinitionSingleEditor >> handleRenameError: anError to: aNewName from: aT self addErrorOverlayTo: aTagElement ] -{ #category : #private } +{ #category : 'private' } GtCodeDefinitionSingleEditor >> requestRename: aDefinition to: aNewName from: aTagElement [ setSelector ifNil: [ ^ self ]. @@ -113,12 +113,12 @@ GtCodeDefinitionSingleEditor >> requestRename: aDefinition to: aNewName from: aT from: aTagElement ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionSingleEditor >> setSelector [ ^ setSelector ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionSingleEditor >> setSelector: anObject [ setSelector := anObject ] diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionSingleReader.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionSingleReader.class.st index 1b2c9c574..0ce3d6dd5 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionSingleReader.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionSingleReader.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtCodeDefinitionSingleReader, - #superclass : #GtCodeDefinitionSingleViewer, - #category : #'GToolkit-Coder-UI-Behaviour - Editor / Reader' + #name : 'GtCodeDefinitionSingleReader', + #superclass : 'GtCodeDefinitionSingleViewer', + #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' } -{ #category : #'api - instantiation' } +{ #category : 'api - instantiation' } GtCodeDefinitionSingleReader >> create [ | aDefinition theInitialName aLabel anOwner | diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionSingleViewer.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionSingleViewer.class.st index 30e5c144c..de7b44968 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionSingleViewer.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionSingleViewer.class.st @@ -1,31 +1,31 @@ Class { - #name : #GtCodeDefinitionSingleViewer, - #superclass : #GtCodeDefinitionEntityViewer, + #name : 'GtCodeDefinitionSingleViewer', + #superclass : 'GtCodeDefinitionEntityViewer', #instVars : [ 'getSelector', 'renameAnnouncement' ], - #category : #'GToolkit-Coder-UI-Behaviour - Editor / Reader' + #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' } -{ #category : #'api - instantiation' } +{ #category : 'api - instantiation' } GtCodeDefinitionSingleViewer >> create [ ^ self subclassResponsibility ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionSingleViewer >> getSelector [ ^ getSelector ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionSingleViewer >> getSelector: anObject [ getSelector := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionSingleViewer >> renameEvent: anObject [ renameAnnouncement := anObject ] diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionViewer.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionViewer.class.st index be2c688b8..43a9ffcbc 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionViewer.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionViewer.class.st @@ -1,20 +1,20 @@ Class { - #name : #GtCodeDefinitionViewer, - #superclass : #BrStencil, + #name : 'GtCodeDefinitionViewer', + #superclass : 'BrStencil', #instVars : [ 'title', 'margin', 'lookStencil' ], - #category : #'GToolkit-Coder-UI-Behaviour - Editor / Reader' + #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' } -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionViewer >> aptitude: aStencil [ lookStencil := aStencil asStencil ] -{ #category : #'private - instance creation' } +{ #category : 'private - instance creation' } GtCodeDefinitionViewer >> buildSectionLabel: aSectionName [ ^ BrLabel new @@ -25,7 +25,7 @@ GtCodeDefinitionViewer >> buildSectionLabel: aSectionName [ constraintsDo: [ :c | c grid horizontal alignLeft ] ] -{ #category : #initialization } +{ #category : 'initialization' } GtCodeDefinitionViewer >> initialize [ super initialize. @@ -36,27 +36,27 @@ GtCodeDefinitionViewer >> initialize [ fontSize: 10 ] asStencil. ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionViewer >> margin [ ^ margin ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionViewer >> margin: anObject [ margin := anObject ] -{ #category : #printing } +{ #category : 'printing' } GtCodeDefinitionViewer >> printOn: aStream [ aStream print: self title ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionViewer >> title [ ^ title ] -{ #category : #accessing } +{ #category : 'accessing' } GtCodeDefinitionViewer >> title: anObject [ title := anObject ] diff --git a/src/GToolkit-Coder-UI/GtCoder.class.st b/src/GToolkit-Coder-UI/GtCoder.class.st index 2e5e95736..f9e04c0be 100644 --- a/src/GToolkit-Coder-UI/GtCoder.class.st +++ b/src/GToolkit-Coder-UI/GtCoder.class.st @@ -12,8 +12,8 @@ I am the entrance point into the coder as a tool. To instantiate me, use one of " Class { - #name : #GtCoder, - #superclass : #GtCoderNavigationModelElement, + #name : 'GtCoder', + #superclass : 'GtCoderNavigationModelElement', #traits : 'TGtPagerPageInstantiator + TGtPhlowToolDetailAdjustable', #classTraits : 'TGtPagerPageInstantiator classTrait + TGtPhlowToolDetailAdjustable classTrait', #instVars : [ @@ -22,16 +22,16 @@ Class { 'toolbarElement', 'titleNotifier' ], - #category : #'GToolkit-Coder-UI-! Core' + #category : 'GToolkit-Coder-UI-! Core' } -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtCoder >> contentElement [ ^ contentElement ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoder >> initialize [ super initialize. self initializeTitleNotifier. @@ -50,12 +50,12 @@ GtCoder >> initialize [ self addAptitude: (BrLayoutResizerAptitude inherit). ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoder >> initializeContentElement [ contentElement := GtCoderPlaygroundElement new. ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoder >> initializeSidebarElement [ sidebarElement := GtPhlowHorizontalSidebarElement new beLeft. self addAptitude: (GtPhlowToolDetailAptitude new @@ -63,7 +63,7 @@ GtCoder >> initializeSidebarElement [ detailed: [ :theInstance | sidebarElement show ]). ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoder >> initializeTitleNotifier [ titleNotifier := GtPhlowTitleIconAndLabelNotifier new shortLabel: [ self shortTitle ifEmpty: [ 'Coder' asRopedText ] ]; @@ -71,7 +71,7 @@ GtCoder >> initializeTitleNotifier [ self addEventHandler: titleNotifier. ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoder >> initializeToolbarElement [ toolbarElement := GtCoderToolbarElement new constraintsDo: [ :c | @@ -80,7 +80,7 @@ GtCoder >> initializeToolbarElement [ c ignored vertical alignTop ]. ] -{ #category : #'private - hooks' } +{ #category : 'private - hooks' } GtCoder >> onNavigationModelChanged [ super onNavigationModelChanged. self contentElement navigationModel: self navigationModel. @@ -89,32 +89,32 @@ GtCoder >> onNavigationModelChanged [ self updateTabLabel ] -{ #category : #'private - announcement handling' } +{ #category : 'private - announcement handling' } GtCoder >> onNavigationModelSubjectChange [ self enqueueTask: (BlTaskAction new action: [ self updateTabLabel ]) ] -{ #category : #opening } +{ #category : 'opening' } GtCoder >> pagerWindowTitle [ ^ self shortTitle ] -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtCoder >> shortTitle [ ^ (GtPhlowTitleLabelBuilder longLabel: self subjectTitle) build ] -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtCoder >> sidebarElement [ ^ sidebarElement ] -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtCoder >> subjectTitle [ self navigationModel selectedClassDo: [ :aClass | ^ aClass name ]. @@ -123,7 +123,7 @@ GtCoder >> subjectTitle [ ^ nil ] -{ #category : #'private - subscriptions' } +{ #category : 'private - subscriptions' } GtCoder >> subscribeToNavigationModel [ super subscribeToNavigationModel. self navigationModel weak @@ -137,26 +137,26 @@ GtCoder >> subscribeToNavigationModel [ send: #onNavigationModelSubjectChange to: self ] -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtCoder >> titleNotifier [ ^ titleNotifier ] -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtCoder >> toolbarElement [ ^ toolbarElement ] -{ #category : #'private - updating' } +{ #category : 'private - updating' } GtCoder >> updateSidebarContent [ self sidebarElement contentStencil: (GtCoderNavigationTabsStencil new navigationModel: self navigationModel) ] -{ #category : #'private - updating' } +{ #category : 'private - updating' } GtCoder >> updateTabLabel [ self titleNotifier notifyIfFocused ] diff --git a/src/GToolkit-Coder-UI/GtCoder2.class.st b/src/GToolkit-Coder-UI/GtCoder2.class.st index 9a75f6bb2..81eaa8b74 100644 --- a/src/GToolkit-Coder-UI/GtCoder2.class.st +++ b/src/GToolkit-Coder-UI/GtCoder2.class.st @@ -1,6 +1,6 @@ Class { - #name : #GtCoder2, - #superclass : #BlElement, + #name : 'GtCoder2', + #superclass : 'BlElement', #traits : 'TGtPagerPageInstantiator + TGtPhlowToolDetailAdjustable + TGtWithCoderToolViewModel + TBrLayoutResizable', #classTraits : 'TGtPagerPageInstantiator classTrait + TGtPhlowToolDetailAdjustable classTrait + TGtWithCoderToolViewModel classTrait + TBrLayoutResizable classTrait', #instVars : [ @@ -9,10 +9,10 @@ Class { 'navigationBreacrumb', 'navigationSidebar' ], - #category : #'GToolkit-Coder-UI-! Core' + #category : 'GToolkit-Coder-UI-! Core' } -{ #category : #initialization } +{ #category : 'initialization' } GtCoder2 >> createCoderContainer [ "A container that contains an actual current coder element. The content of the container is replaced every time a coder is pushed or popped" @@ -21,7 +21,7 @@ GtCoder2 >> createCoderContainer [ matchParent ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoder2 >> createGoBackButton [ ^ BrButton new aptitude: BrGlamorousButtonWithLabelAptitude; @@ -29,19 +29,19 @@ GtCoder2 >> createGoBackButton [ action: [ self coderToolViewModel popCoderViewModel ] ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoder2 >> createNavigationBreadcrumb [ ^ BrHorizontalPane new hMatchParent; vFitContent ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoder2 >> createNavigationSidebar [ ^ GtPhlowHorizontalSidebarElement new beLeft ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoder2 >> initialize [ super initialize. @@ -80,12 +80,12 @@ GtCoder2 >> initialize [ ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoder2 >> navigationStencil: aStencil [ navigationSidebar contentStencil: aStencil ] -{ #category : #'api - coder tool view model' } +{ #category : 'api - coder tool view model' } GtCoder2 >> onCoderToolViewModelChanged [ "Is sent when a new coderTool view model is assigned to the element. Note: #onCoderToolViewModelChanged is sent before #subscribeToCoderToolViewModel @@ -97,25 +97,25 @@ GtCoder2 >> onCoderToolViewModelChanged [ self rebuildTopCoderElement ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtCoder2 >> onViewModelCoderPopped: anAnnouncement [ self updateGoBackButton. self rebuildTopCoderElement. ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtCoder2 >> onViewModelCoderPushed: anAnnouncement [ self updateGoBackButton. self rebuildTopCoderElement ] -{ #category : #opening } +{ #category : 'opening' } GtCoder2 >> pagerWindowTitle [ ^ self shortTitle ] -{ #category : #'private - updating' } +{ #category : 'private - updating' } GtCoder2 >> rebuildTopCoderElement [ coderContainer removeChildren. @@ -123,7 +123,7 @@ GtCoder2 >> rebuildTopCoderElement [ ifTrue: [ coderContainer addChild: self coderToolViewModel currentCoderViewModel asElement ] ] -{ #category : #'api - coder tool view model' } +{ #category : 'api - coder tool view model' } GtCoder2 >> subscribeToCoderToolViewModel [ "Is sent after a new coderTool view model is assigned to the element. It is required to unsubscribe from the view model or domain model by implementing @@ -134,7 +134,7 @@ GtCoder2 >> subscribeToCoderToolViewModel [ when: GtCoderToolViewModelCoderPopped send: #onViewModelCoderPopped: to: self ] -{ #category : #'api - coder tool view model' } +{ #category : 'api - coder tool view model' } GtCoder2 >> unsubscribeFromCoderToolViewModel [ "Is sent before a new coderTool view model is assigned to the element. Elements that subscribe to coderTool view model in domain model are required to implement this methods." @@ -142,7 +142,7 @@ GtCoder2 >> unsubscribeFromCoderToolViewModel [ self coderToolViewModel unsubscribe: self ] -{ #category : #'private - updating' } +{ #category : 'private - updating' } GtCoder2 >> updateGoBackButton [ goBackButton enabled: self coderToolViewModel canGoBack ] diff --git a/src/GToolkit-Coder-UI/GtCoderAction.extension.st b/src/GToolkit-Coder-UI/GtCoderAction.extension.st index b19504a76..e5e276824 100644 --- a/src/GToolkit-Coder-UI/GtCoderAction.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderAction.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #GtCoderAction } +Extension { #name : 'GtCoderAction' } -{ #category : #'*GToolkit-Coder-UI' } +{ #category : '*GToolkit-Coder-UI' } GtCoderAction >> buildElementIn: aCoderActionsElement [ ^ aCoderActionsElement newButtonForAction: self ] diff --git a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st index 7931ca22d..156bca59f 100644 --- a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st @@ -1,6 +1,6 @@ Class { - #name : #GtCoderActionsElement, - #superclass : #BlElement, + #name : 'GtCoderActionsElement', + #superclass : 'BlElement', #traits : 'TGtWithTextualCoderViewModel', #classTraits : 'TGtWithTextualCoderViewModel classTrait', #instVars : [ @@ -9,10 +9,10 @@ Class { 'separator', 'editor' ], - #category : #'GToolkit-Coder-UI-Coder - Basic' + #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : #private } +{ #category : 'private' } GtCoderActionsElement >> addContextToolbarActions [ contextToolbar addItems: (self textualCoderViewModel contextActions collect: [ :aGtCoderAction | self newButtonForAction: aGtCoderAction ]). separator @@ -22,7 +22,7 @@ GtCoderActionsElement >> addContextToolbarActions [ ifFalse: [ BlVisibility gone ]) ] -{ #category : #private } +{ #category : 'private' } GtCoderActionsElement >> addMainToolbarActions [ mainToolbar addItems: @@ -32,17 +32,17 @@ GtCoderActionsElement >> addMainToolbarActions [ aGtCoderAction buildElementIn: self ]) ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderActionsElement >> coderUIModel [ ^ self textualCoderViewModel ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderActionsElement >> coderUIModel: aCoderUIModel [ self textualCoderViewModel: aCoderUIModel ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtCoderActionsElement >> disableButton: aButtonElement action: aGtCoderAction [ aButtonElement icon: @@ -52,7 +52,7 @@ GtCoderActionsElement >> disableButton: aButtonElement action: aGtCoderAction [ disable ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtCoderActionsElement >> enqueueEnableButton: aButtonElement action: aGtCoderAction [ ^ aButtonElement enqueueTask: @@ -63,7 +63,7 @@ GtCoderActionsElement >> enqueueEnableButton: aButtonElement action: aGtCoderAct enable ]) ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtCoderActionsElement >> handleButton: aButtonElement action: aGtCoderAction onEvent: anEvent [ self disableButton: aButtonElement action: aGtCoderAction. GtCoderExecutionContextVariable @@ -78,7 +78,7 @@ GtCoderActionsElement >> handleButton: aButtonElement action: aGtCoderAction onE ensure: [ self enqueueEnableButton: aButtonElement action: aGtCoderAction ] ]) ] ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderActionsElement >> initialize [ super initialize. @@ -102,7 +102,7 @@ GtCoderActionsElement >> initialize [ self addChildren: { mainToolbar . separator . contextToolbar } ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtCoderActionsElement >> newButtonForAction: aGtCoderAction [ ^ BrButton new @@ -118,7 +118,7 @@ GtCoderActionsElement >> newButtonForAction: aGtCoderAction [ onEvent: anEvent ] ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtCoderActionsElement >> newDropButtonForAction: aGtCoderAction [ | button aContentStencil | @@ -178,7 +178,7 @@ GtCoderActionsElement >> newDropButtonForAction: aGtCoderAction [ yourself ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtCoderActionsElement >> newToolbar [ @@ -187,7 +187,7 @@ GtCoderActionsElement >> newToolbar [ padding: (BlInsets left: -4) ] -{ #category : #'api - textual coder view model' } +{ #category : 'api - textual coder view model' } GtCoderActionsElement >> onPostTextualCoderViewModelChanged [ "I am an optional hook method that is sent after #subscribeToTextualCoderViewModel. I do nothing by default but allow users to perform update operations when a receiver object is already @@ -196,7 +196,7 @@ GtCoderActionsElement >> onPostTextualCoderViewModelChanged [ self textualCoderViewModel ensureAddOns ] -{ #category : #'api - textual coder view model' } +{ #category : 'api - textual coder view model' } GtCoderActionsElement >> onTextualCoderViewModelChanged [ "Is sent when a new textualCoder view model is assigned to the element. Note: #onTextualCoderViewModelChanged is sent before #subscribeToTextualCoderViewModel @@ -210,17 +210,17 @@ GtCoderActionsElement >> onTextualCoderViewModelChanged [ self addContextToolbarActions ] -{ #category : #private } +{ #category : 'private' } GtCoderActionsElement >> removeContextToolbarActions [ contextToolbar numberOfItems timesRepeat: [ contextToolbar removeItemAt: 1 ] ] -{ #category : #private } +{ #category : 'private' } GtCoderActionsElement >> removeMainToolbarActions [ mainToolbar numberOfItems timesRepeat: [ mainToolbar removeItemAt: 1 ] ] -{ #category : #'api - textual coder view model' } +{ #category : 'api - textual coder view model' } GtCoderActionsElement >> subscribeToTextualCoderViewModel [ "Is sent after a new textualCoder view model is assigned to the element. It is required to unsubscribe from the view model or domain model by implementing @@ -231,7 +231,7 @@ GtCoderActionsElement >> subscribeToTextualCoderViewModel [ when: GtTextualCoderViewModelContextActionsChanged send: #updateContextToolbar to: self ] -{ #category : #'api - textual coder view model' } +{ #category : 'api - textual coder view model' } GtCoderActionsElement >> unsubscribeFromTextualCoderViewModel [ "Is sent before a new textualCoder view model is assigned to the element. Elements that subscribe to textualCoder view model in domain model are required to implement this methods." @@ -239,7 +239,7 @@ GtCoderActionsElement >> unsubscribeFromTextualCoderViewModel [ self textualCoderViewModel unsubscribe: self ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtCoderActionsElement >> updateContextToolbar [ self enqueueTask: (BlTaskAction new @@ -248,7 +248,7 @@ GtCoderActionsElement >> updateContextToolbar [ self addContextToolbarActions ]) ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtCoderActionsElement >> updateMainToolbar [ self enqueueTask: (BlTaskAction new action: [ diff --git a/src/GToolkit-Coder-UI/GtCoderActivatableAction.extension.st b/src/GToolkit-Coder-UI/GtCoderActivatableAction.extension.st index 7393539ad..25467fbae 100644 --- a/src/GToolkit-Coder-UI/GtCoderActivatableAction.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderActivatableAction.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #GtCoderActivatableAction } +Extension { #name : 'GtCoderActivatableAction' } -{ #category : #'*GToolkit-Coder-UI' } +{ #category : '*GToolkit-Coder-UI' } GtCoderActivatableAction >> buildElementIn: aCoderActionsElement [ | aButton | diff --git a/src/GToolkit-Coder-UI/GtCoderCardElement.class.st b/src/GToolkit-Coder-UI/GtCoderCardElement.class.st index bf39e5fad..2ec945777 100644 --- a/src/GToolkit-Coder-UI/GtCoderCardElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderCardElement.class.st @@ -1,20 +1,20 @@ Class { - #name : #GtCoderCardElement, - #superclass : #BlElement, + #name : 'GtCoderCardElement', + #superclass : 'BlElement', #instVars : [ 'coder', 'coderNameLabel', 'coderDetailsLabel' ], - #category : #'GToolkit-Coder-UI-Basic' + #category : 'GToolkit-Coder-UI-Basic' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderCardElement >> coder [ ^ coder ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderCardElement >> coder: anObject [ coder := anObject. coderNameLabel text: (self coderNameTextFrom: coder coderName). @@ -26,7 +26,7 @@ GtCoderCardElement >> coder: anObject [ text: (self coderDetailsTextFrom: aDetailsString) ] ] -{ #category : #'private - instance creation' } +{ #category : 'private - instance creation' } GtCoderCardElement >> coderDetailsTextFrom: aString [ "Convert a coder's details to a styled text" @@ -35,7 +35,7 @@ GtCoderCardElement >> coderDetailsTextFrom: aString [ foreground: self theme button defaultTextColor ] -{ #category : #'private - instance creation' } +{ #category : 'private - instance creation' } GtCoderCardElement >> coderNameTextFrom: aString [ "Convert a coder's name to a styled text" @@ -43,12 +43,12 @@ GtCoderCardElement >> coderNameTextFrom: aString [ ^ aString asRopedText glamorousCodeFont bold ] -{ #category : #'building ui' } +{ #category : 'building ui' } GtCoderCardElement >> detailsLabel [ ^ '' ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderCardElement >> initialize [ super initialize. self aptitude: (BrGlamorousButtonExteriorAptitude new borderPaint: Color transparent). @@ -81,7 +81,7 @@ GtCoderCardElement >> initialize [ self addChildren: { coderNameLabel . coderDetailsLabel } ] -{ #category : #private } +{ #category : 'private' } GtCoderCardElement >> selectCoder [ | anEvent | diff --git a/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st b/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st index 60025d99c..1dea8df19 100644 --- a/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st +++ b/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st @@ -6,114 +6,118 @@ If a code is selected, I execute the selection. If there is no selection, I exec " Class { - #name : #GtCoderCodeExecutor, - #superclass : #Object, + #name : 'GtCoderCodeExecutor', + #superclass : 'Object', #instVars : [ 'coderUIModel', 'action', 'element' ], - #category : #'GToolkit-Coder-UI-Execution' + #category : 'GToolkit-Coder-UI-Execution' } -{ #category : #'api - instance creation' } +{ #category : 'api - instance creation' } GtCoderCodeExecutor class >> doIt [ "Execute a code (and do not display the execution result)" ^ self new doIt ] -{ #category : #'api - instance creation' } +{ #category : 'api - instance creation' } GtCoderCodeExecutor class >> doItAndGo [ "Execute a code and display the execution result" ^ self new doItAndGo ] -{ #category : #'api - instance creation' } +{ #category : 'api - instance creation' } GtCoderCodeExecutor class >> playAll [ "Execute a method code (and do not display the execution result)" ^ self new playAll ] -{ #category : #'api - instance creation' } +{ #category : 'api - instance creation' } GtCoderCodeExecutor class >> playAllAndInspect [ "Execute a method code and display the execution result" ^ self new playAllAndInspect ] -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtCoderCodeExecutor >> coder [ ^ self coderUIModel coder ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderCodeExecutor >> coderUIModel [ ^ coderUIModel ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderCodeExecutor >> coderUIModel: anObject [ coderUIModel := anObject ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderCodeExecutor >> doIt [ "Execute a code (and do not display the execution result)" action := #doIt ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderCodeExecutor >> doItAndGo [ "Execute a code and display the execution result" action := #doItAndGo ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderCodeExecutor >> element [ ^ element ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderCodeExecutor >> element: anElement [ + self + assert: [ anElement isKindOf: BlElement ] + description: [ 'A code executor must be created in a context of an element' ]. + element := anElement ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderCodeExecutor >> event [ self flag: 'I should not keep events, but rather #element'. self halt. ^ nil ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderCodeExecutor >> event: anObject [ self halt. self flag: 'I should not receive events, but rather #element:'. ] -{ #category : #'api - execution' } +{ #category : 'api - execution' } GtCoderCodeExecutor >> execute [ GtCoderExecutionContextVariable element: self element do: [ self coderUIModel perform: action ] ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderCodeExecutor >> initialize [ super initialize. self doItAndGo. ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderCodeExecutor >> playAll [ "Execute a method code (and do not display the execution result)" action := #playAll ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderCodeExecutor >> playAllAndInspect [ "Execute a method code and display the execution result" diff --git a/src/GToolkit-Coder-UI/GtCoderContentElement.class.st b/src/GToolkit-Coder-UI/GtCoderContentElement.class.st index d565cb873..8a6fade80 100644 --- a/src/GToolkit-Coder-UI/GtCoderContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderContentElement.class.st @@ -7,18 +7,18 @@ I display a {{gtClass:GtBehaviorCoder}}, {{gtClass:GtPackageTagCoder}}, {{gtClas " Class { - #name : #GtCoderContentElement, - #superclass : #GtCoderNavigationModelElement, - #category : #'GToolkit-Coder-UI-Basic' + #name : 'GtCoderContentElement', + #superclass : 'GtCoderNavigationModelElement', + #category : 'GToolkit-Coder-UI-Basic' } -{ #category : #factory } +{ #category : 'factory' } GtCoderContentElement class >> default [ ^ self new navigationModel: GtCoderNavigationModel default ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderContentElement >> initialize [ super initialize. self layout: BlFrameLayout new. @@ -26,26 +26,26 @@ GtCoderContentElement >> initialize [ self addAptitude: (BrLayoutResizerAptitude inherit). ] -{ #category : #'hooks - children' } +{ #category : 'hooks - children' } GtCoderContentElement >> onAddedToSceneGraph [ super onAddedToSceneGraph. self navigationModel subscribeToSystem. ] -{ #category : #'hooks - children' } +{ #category : 'hooks - children' } GtCoderContentElement >> onRemovedFromSceneGraph [ super onRemovedFromSceneGraph. self navigationModel unsubscribeFromSystem. ] -{ #category : #'private - subscriptions' } +{ #category : 'private - subscriptions' } GtCoderContentElement >> subscribeToNavigationModel [ super subscribeToNavigationModel. self navigationModel weak when: GtCoderNavigationSelectionAnnouncement send: #updateCoder: to: self. ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtCoderContentElement >> updateCoder: anAnnouncement [ self removeChildren. self addChild: anAnnouncement coder asElement. diff --git a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st index 792914f45..444929dd2 100644 --- a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st +++ b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st @@ -1,29 +1,29 @@ Class { - #name : #GtCoderContextMenuContent, - #superclass : #BrSimpleList, + #name : 'GtCoderContextMenuContent', + #superclass : 'BrSimpleList', #instVars : [ 'editorElement' ], - #category : #'GToolkit-Coder-UI-Basic' + #category : 'GToolkit-Coder-UI-Basic' } -{ #category : #defaults } +{ #category : 'defaults' } GtCoderContextMenuContent >> defaultContextMenuActionName [ ^ #contextMenuAction ] -{ #category : #defaults } +{ #category : 'defaults' } GtCoderContextMenuContent >> defaultLabelChildName [ ^ #label ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderContextMenuContent >> editorElement [ ^ editorElement ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderContextMenuContent >> editorElement: anEditorElement [ self assert: [ anEditorElement isNotNil ] @@ -31,7 +31,7 @@ GtCoderContextMenuContent >> editorElement: anEditorElement [ editorElement := anEditorElement ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderContextMenuContent >> initialize [ super initialize. self @@ -50,8 +50,8 @@ GtCoderContextMenuContent >> initialize [ anEvent consumed: true. eachGtCoderContextMenuAction action cull: self editorElement textualCoderViewModel - cull: anEvent - cull: self editorElement. + cull: self editorElement + cull: anEvent. self fireEvent: BrDropdownHideWish new. self fireEvent: BrContextMenuHideWish new ]; addChild: diff --git a/src/GToolkit-Coder-UI/GtCoderDropDownAction.extension.st b/src/GToolkit-Coder-UI/GtCoderDropDownAction.extension.st index bf916cea4..4e40b4785 100644 --- a/src/GToolkit-Coder-UI/GtCoderDropDownAction.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderDropDownAction.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #GtCoderDropDownAction } +Extension { #name : 'GtCoderDropDownAction' } -{ #category : #'*GToolkit-Coder-UI' } +{ #category : '*GToolkit-Coder-UI' } GtCoderDropDownAction >> buildElementIn: aCoderActionsElement [ ^ aCoderActionsElement newDropButtonForAction: self ] diff --git a/src/GToolkit-Coder-UI/GtCoderDropDownWithPreviewAction.extension.st b/src/GToolkit-Coder-UI/GtCoderDropDownWithPreviewAction.extension.st index c2697730e..564533f98 100644 --- a/src/GToolkit-Coder-UI/GtCoderDropDownWithPreviewAction.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderDropDownWithPreviewAction.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #GtCoderDropDownWithPreviewAction } +Extension { #name : 'GtCoderDropDownWithPreviewAction' } -{ #category : #'*GToolkit-Coder-UI' } +{ #category : '*GToolkit-Coder-UI' } GtCoderDropDownWithPreviewAction >> buildElementIn: aCoderActionsElement [ ^ GtPreviewChangeButton new icon: self icon; diff --git a/src/GToolkit-Coder-UI/GtCoderElement.class.st b/src/GToolkit-Coder-UI/GtCoderElement.class.st index 2b2328b70..31437e42f 100644 --- a/src/GToolkit-Coder-UI/GtCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderElement.class.st @@ -7,14 +7,14 @@ See my {{gtClass:GtCoderElement|expanded|show=#gtSubclassesFor:}} for concrete i " Class { - #name : #GtCoderElement, - #superclass : #BlElement, + #name : 'GtCoderElement', + #superclass : 'BlElement', #traits : 'TBrLayoutResizable', #classTraits : 'TBrLayoutResizable classTrait', - #category : #'GToolkit-Coder-UI-Basic' + #category : 'GToolkit-Coder-UI-Basic' } -{ #category : #initialization } +{ #category : 'initialization' } GtCoderElement >> initialize [ super initialize. diff --git a/src/GToolkit-Coder-UI/GtCoderElementId.class.st b/src/GToolkit-Coder-UI/GtCoderElementId.class.st index bd621ea93..283895420 100644 --- a/src/GToolkit-Coder-UI/GtCoderElementId.class.st +++ b/src/GToolkit-Coder-UI/GtCoderElementId.class.st @@ -3,12 +3,12 @@ " Class { - #name : #GtCoderElementId, - #superclass : #BlElementUniqueId, - #category : #'GToolkit-Coder-UI-Coder - Basic' + #name : 'GtCoderElementId', + #superclass : 'BlElementUniqueId', + #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : #testing } +{ #category : 'testing' } GtCoderElementId class >> isAbstract [ ^ self = GtCoderElementId ] diff --git a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st index 6e25ce974..575f7ddf2 100644 --- a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st @@ -17,37 +17,37 @@ I am an icon that represents an {{gtClass:GtExampleWithResult}} result state. " Class { - #name : #GtCoderExampleStateElement, - #superclass : #BlElement, + #name : 'GtCoderExampleStateElement', + #superclass : 'BlElement', #traits : 'TBrLayoutResizable + TBrEnableable', #classTraits : 'TBrLayoutResizable classTrait + TBrEnableable classTrait', #instVars : [ 'example', 'styleLook' ], - #category : #'GToolkit-Coder-UI-Basic' + #category : 'GToolkit-Coder-UI-Basic' } -{ #category : #'private - asserting' } +{ #category : 'private - asserting' } GtCoderExampleStateElement >> assertExample: aGtExampleWithResult [ self assert: [ aGtExampleWithResult isNotNil ] description: [ 'Example must be non-nil' ]. ] -{ #category : #'private - actions' } +{ #category : 'private - actions' } GtCoderExampleStateElement >> debugExampleFrom: aButton [ self exampleDo: [ :anExample | anExample openingDebugger result ] ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderExampleStateElement >> example [ ^ example ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderExampleStateElement >> example: aGtExampleWithResult [ self assertExample: aGtExampleWithResult. self unsubscribeFromExample. @@ -56,23 +56,23 @@ GtCoderExampleStateElement >> example: aGtExampleWithResult [ self onExampleChanged. ] -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtCoderExampleStateElement >> exampleDo: aBlock [ self example ifNotNil: aBlock ] -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtCoderExampleStateElement >> exampleResult [ ^ self example ifNotNil: #result ] -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtCoderExampleStateElement >> exampleState [ ^ GtFilterExampleState default stateFromExample: self example ] -{ #category : #'private - testing' } +{ #category : 'private - testing' } GtCoderExampleStateElement >> hasExampleResult [ ^ self example @@ -80,7 +80,7 @@ GtCoderExampleStateElement >> hasExampleResult [ ifNil: [ false ] ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderExampleStateElement >> initialize [ super initialize. self initializeViewModels. @@ -96,20 +96,20 @@ GtCoderExampleStateElement >> initialize [ self addAptitude: BrLayoutResizerAptitude inherit. ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderExampleStateElement >> initializeInteractiveLook [ self addAptitude: (styleLook := BrStyleCommonAptitude new). self updateStyleLook. ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderExampleStateElement >> initializeTooltipLook [ self addAptitude: (BrGlamorousWithTooltipAptitude2 content: [ self newTooltipContent ]) ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderExampleStateElement >> initializeViewModels [ | aButtonModel | @@ -118,14 +118,14 @@ GtCoderExampleStateElement >> initializeViewModels [ self viewModel: aButtonModel. ] -{ #category : #'private - instance creation' } +{ #category : 'private - instance creation' } GtCoderExampleStateElement >> newInspectorWithExampleResult [ ^ ((GtInspector forObject: self tooltipObject) exact: 400@400) asScalableElement size: 200@200. ] -{ #category : #'private - instance creation' } +{ #category : 'private - instance creation' } GtCoderExampleStateElement >> newNotExecutedLabel [ ^ BrLabel new aptitude: BrGlamorousLabelAptitude; @@ -133,7 +133,7 @@ GtCoderExampleStateElement >> newNotExecutedLabel [ padding: (BlInsets all: 5) ] -{ #category : #'private - instance creation' } +{ #category : 'private - instance creation' } GtCoderExampleStateElement >> newNotExecutedToolbar [ ^ BrToolbar new aptitude: BrGlamorousToolbarAptitude new; @@ -157,7 +157,7 @@ GtCoderExampleStateElement >> newNotExecutedToolbar [ beSmallSize) ] -{ #category : #'private - instance creation' } +{ #category : 'private - instance creation' } GtCoderExampleStateElement >> newNotExecutedTooltipContent [ ^ BrVerticalPane new fitContent; @@ -171,7 +171,7 @@ GtCoderExampleStateElement >> newNotExecutedTooltipContent [ margin: (BlInsets top: 3)). ] -{ #category : #'private - instance creation' } +{ #category : 'private - instance creation' } GtCoderExampleStateElement >> newTooltipContent [ | aContainer | aContainer := BrFrame new @@ -185,7 +185,7 @@ GtCoderExampleStateElement >> newTooltipContent [ ^ aContainer ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtCoderExampleStateElement >> onClick: aButton [ self exampleDo: [ :anExample | anExample hasResult ifFalse: [ ^ self ]. @@ -193,12 +193,12 @@ GtCoderExampleStateElement >> onClick: aButton [ self debugExampleFrom: aButton ] ] -{ #category : #'private - hooks' } +{ #category : 'private - hooks' } GtCoderExampleStateElement >> onExampleChanged [ self updateIcon. ] -{ #category : #'private - announcement handling' } +{ #category : 'private - announcement handling' } GtCoderExampleStateElement >> onExampleExecuted: aGtExampleExecuted [ BlUseAsyncFeatures ifEnabledDo: [ @@ -207,32 +207,32 @@ GtCoderExampleStateElement >> onExampleExecuted: aGtExampleExecuted [ otherwise: [ self updateIcon ] ] -{ #category : #'private - actions' } +{ #category : 'private - actions' } GtCoderExampleStateElement >> playAndInspectExampleFrom: aButton [ self playExampleFrom: aButton. self spawnExampleFrom: aButton. ] -{ #category : #'private - actions' } +{ #category : 'private - actions' } GtCoderExampleStateElement >> playExampleFrom: aButton [ self exampleDo: [ :anExample | anExample run ] ] -{ #category : #'private - actions' } +{ #category : 'private - actions' } GtCoderExampleStateElement >> spawnExampleFrom: anElement [ self exampleDo: [ :anExample | anExample hasResult ifTrue: [ anElement phlow spawnObject: anExample result returnValueOrExampleException ] ] ] -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtCoderExampleStateElement >> styleLook [ ^ styleLook ] -{ #category : #'private - subscriptions' } +{ #category : 'private - subscriptions' } GtCoderExampleStateElement >> subscribeToExample [ self example announcer when: GtExampleExecuted @@ -240,25 +240,25 @@ GtCoderExampleStateElement >> subscribeToExample [ to: self. ] -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtCoderExampleStateElement >> tooltipObject [ self exampleResult ifNotNil: [ :aResult | ^ aResult returnValueOrExampleException ]. ^ self example ] -{ #category : #'private - subscriptions' } +{ #category : 'private - subscriptions' } GtCoderExampleStateElement >> unsubscribeFromExample [ self example ifNil: [ ^ self ]. self example announcer unsubscribe: self. ] -{ #category : #'private - updating' } +{ #category : 'private - updating' } GtCoderExampleStateElement >> updateIcon [ self background: self exampleState color. self updateStyleLook. ] -{ #category : #'private - updating' } +{ #category : 'private - updating' } GtCoderExampleStateElement >> updateStyleLook [ "the following nil check can be removed anytime later. diff --git a/src/GToolkit-Coder-UI/GtCoderExecutionContextVariable.class.st b/src/GToolkit-Coder-UI/GtCoderExecutionContextVariable.class.st index 26c4e21d2..a841c5170 100644 --- a/src/GToolkit-Coder-UI/GtCoderExecutionContextVariable.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExecutionContextVariable.class.st @@ -13,12 +13,12 @@ To obtain the execution context, use {{gtMethod:GtCoderExecutionContextVariable " Class { - #name : #GtCoderExecutionContextVariable, - #superclass : #DynamicVariable, - #category : #'GToolkit-Coder-UI-Basic' + #name : 'GtCoderExecutionContextVariable', + #superclass : 'DynamicVariable', + #category : 'GToolkit-Coder-UI-Basic' } -{ #category : #'api - execution' } +{ #category : 'api - execution' } GtCoderExecutionContextVariable class >> element: anElement do: aBlock [ "Initialize a Space ID using the element and evaluate the block" | aSpaceId | @@ -28,19 +28,19 @@ GtCoderExecutionContextVariable class >> element: anElement do: aBlock [ during: aBlock ] -{ #category : #testing } +{ #category : 'testing' } GtCoderExecutionContextVariable class >> isInheritable [ ^true ] -{ #category : #'private - instance creation' } +{ #category : 'private - instance creation' } GtCoderExecutionContextVariable class >> newSpaceIdFromElement: anElement [ anElement spaceDo: [ :aSpace | ^ aSpace id ]. ^ nil ] -{ #category : #'api - execution' } +{ #category : 'api - execution' } GtCoderExecutionContextVariable class >> spaceDo: aSpaceBlock ifClosed: aClosedBlock [ self value ifNotNil: [ :aSpaceId | BlSpace diff --git a/src/GToolkit-Coder-UI/GtCoderExpanderAptitude.class.st b/src/GToolkit-Coder-UI/GtCoderExpanderAptitude.class.st index 614de56dd..c530ac07e 100644 --- a/src/GToolkit-Coder-UI/GtCoderExpanderAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExpanderAptitude.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtCoderExpanderAptitude, - #superclass : #GtCoderExpanderWithoutShadowAptitude, - #category : #'GToolkit-Coder-UI-Looks' + #name : 'GtCoderExpanderAptitude', + #superclass : 'GtCoderExpanderWithoutShadowAptitude', + #category : 'GToolkit-Coder-UI-Looks' } -{ #category : #initialization } +{ #category : 'initialization' } GtCoderExpanderAptitude >> initialize [ super initialize. diff --git a/src/GToolkit-Coder-UI/GtCoderExpanderShadowAptitude.class.st b/src/GToolkit-Coder-UI/GtCoderExpanderShadowAptitude.class.st index 29b32f44d..836f9b332 100644 --- a/src/GToolkit-Coder-UI/GtCoderExpanderShadowAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExpanderShadowAptitude.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtCoderExpanderShadowAptitude, - #superclass : #BrStyleCommonAptitude, - #category : #'GToolkit-Coder-UI-Looks' + #name : 'GtCoderExpanderShadowAptitude', + #superclass : 'BrStyleCommonAptitude', + #category : 'GToolkit-Coder-UI-Looks' } -{ #category : #initialization } +{ #category : 'initialization' } GtCoderExpanderShadowAptitude >> initialize [ super initialize. diff --git a/src/GToolkit-Coder-UI/GtCoderExpanderWithoutShadowAptitude.class.st b/src/GToolkit-Coder-UI/GtCoderExpanderWithoutShadowAptitude.class.st index 8ecdb796a..8ff90c1ee 100644 --- a/src/GToolkit-Coder-UI/GtCoderExpanderWithoutShadowAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExpanderWithoutShadowAptitude.class.st @@ -1,6 +1,6 @@ Class { - #name : #GtCoderExpanderWithoutShadowAptitude, - #superclass : #BrExpanderAptitude, + #name : 'GtCoderExpanderWithoutShadowAptitude', + #superclass : 'BrExpanderAptitude', #instVars : [ 'sidebar', 'toggle', @@ -13,73 +13,73 @@ Class { 'styleLook', 'padding' ], - #category : #'GToolkit-Coder-UI-Looks' + #category : 'GToolkit-Coder-UI-Looks' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderExpanderWithoutShadowAptitude >> borderFocusedPaint [ ^ borderFocusedPaint ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderExpanderWithoutShadowAptitude >> borderFocusedPaint: aPaintOrColor [ borderFocusedPaint := aPaintOrColor ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderExpanderWithoutShadowAptitude >> borderPaint [ ^ borderPaint ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderExpanderWithoutShadowAptitude >> borderPaint: aPaintOrColor [ borderPaint := aPaintOrColor ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderExpanderWithoutShadowAptitude >> borderWidth [ ^ borderWidth ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderExpanderWithoutShadowAptitude >> borderWidth: anInteger [ borderWidth := anInteger ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderExpanderWithoutShadowAptitude >> cornerRadius [ ^ cornerRadius ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderExpanderWithoutShadowAptitude >> cornerRadius: aNumber [ cornerRadius := aNumber ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderExpanderWithoutShadowAptitude >> defaultBorderPaint [ ^ self theme default lightBorderColor ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderExpanderWithoutShadowAptitude >> defaultFocusedBorderPaint [ ^ (self theme default primaryBorderColor alpha: 0.4) gtOpaqueColorOnWhite ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderExpanderWithoutShadowAptitude >> expandedBorderWidth [ ^ expandedBorderWidth ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderExpanderWithoutShadowAptitude >> expandedBorderWidth: aNumber [ expandedBorderWidth := aNumber ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderExpanderWithoutShadowAptitude >> initialize [ | aTriangle | super initialize. @@ -131,7 +131,7 @@ GtCoderExpanderWithoutShadowAptitude >> initialize [ with: [ BlRoundedRectangleGeometry cornerRadius: self cornerRadius ] ] -{ #category : #'private - instance creation' } +{ #category : 'private - instance creation' } GtCoderExpanderWithoutShadowAptitude >> newCollapsedTriangleGeometry [ ^ BlPolygon vertices: { (0 @ 0). @@ -140,7 +140,7 @@ GtCoderExpanderWithoutShadowAptitude >> newCollapsedTriangleGeometry [ } ] -{ #category : #'private - instance creation' } +{ #category : 'private - instance creation' } GtCoderExpanderWithoutShadowAptitude >> newExpandedTriangleGeometry [ ^ BlPolygon vertices: { (0 @ 0). @@ -149,7 +149,7 @@ GtCoderExpanderWithoutShadowAptitude >> newExpandedTriangleGeometry [ } ] -{ #category : #'private - instance creation' } +{ #category : 'private - instance creation' } GtCoderExpanderWithoutShadowAptitude >> newSidebar [ ^ BlElement new layout: BlLinearLayout vertical; @@ -159,7 +159,7 @@ GtCoderExpanderWithoutShadowAptitude >> newSidebar [ background: Color veryVeryLightGray ] -{ #category : #'private - instance creation' } +{ #category : 'private - instance creation' } GtCoderExpanderWithoutShadowAptitude >> newToggle [ ^ BlElement new id: GtSourceCoderExpanderToggleId; @@ -175,7 +175,7 @@ GtCoderExpanderWithoutShadowAptitude >> newToggle [ self dispatchEvent: BrExpansionToggleWish new ] ] -{ #category : #'private - instance creation' } +{ #category : 'private - instance creation' } GtCoderExpanderWithoutShadowAptitude >> newTriangle [ ^ BlElement new size: 8 @ 8; @@ -183,18 +183,18 @@ GtCoderExpanderWithoutShadowAptitude >> newTriangle [ constraintsDo: [ :c | c linear vertical alignTop ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderExpanderWithoutShadowAptitude >> padding [ ^ padding ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderExpanderWithoutShadowAptitude >> padding: aBlInsets [ padding := aBlInsets. container padding: aBlInsets ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderExpanderWithoutShadowAptitude >> resizableElementsDo: aBlock [ super resizableElementsDo: aBlock. aBlock value: container diff --git a/src/GToolkit-Coder-UI/GtCoderFilterList.class.st b/src/GToolkit-Coder-UI/GtCoderFilterList.class.st index 6734b560e..ddc436431 100644 --- a/src/GToolkit-Coder-UI/GtCoderFilterList.class.st +++ b/src/GToolkit-Coder-UI/GtCoderFilterList.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtCoderFilterList, - #superclass : #BrSimpleList, - #category : #'GToolkit-Coder-UI-Basic' + #name : 'GtCoderFilterList', + #superclass : 'BrSimpleList', + #category : 'GToolkit-Coder-UI-Basic' } -{ #category : #initialization } +{ #category : 'initialization' } GtCoderFilterList >> initialize [ super initialize. self @@ -22,7 +22,7 @@ GtCoderFilterList >> initialize [ self vFitContent. ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderFilterList >> items: anItemCollection title: aTitleBlock action: anActionBlock [ | anActionCollection | anActionCollection := anItemCollection collect: [ :eachItem | @@ -33,7 +33,7 @@ GtCoderFilterList >> items: anItemCollection title: aTitleBlock action: anAction self items: anActionCollection. ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtCoderFilterList >> onSelectionChanged: anEvent [ self selectedItemDo: [ :anItem | anEvent consumed: true. diff --git a/src/GToolkit-Coder-UI/GtCoderFilterListItem.class.st b/src/GToolkit-Coder-UI/GtCoderFilterListItem.class.st index dea66f8b2..a4604bb0a 100644 --- a/src/GToolkit-Coder-UI/GtCoderFilterListItem.class.st +++ b/src/GToolkit-Coder-UI/GtCoderFilterListItem.class.st @@ -1,45 +1,45 @@ Class { - #name : #GtCoderFilterListItem, - #superclass : #BrHorizontalPane, + #name : 'GtCoderFilterListItem', + #superclass : 'BrHorizontalPane', #instVars : [ 'item', 'title', 'action' ], - #category : #'GToolkit-Coder-UI-Basic' + #category : 'GToolkit-Coder-UI-Basic' } -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtCoderFilterListItem >> actOnEvent: anEvent [ self action cull: self item cull: self cull: anEvent ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderFilterListItem >> action [ ^ action ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderFilterListItem >> action: anObject [ action := anObject ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderFilterListItem >> item [ ^ item ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderFilterListItem >> item: anObject [ item := anObject ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderFilterListItem >> title [ ^ title cull: self item cull: self ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderFilterListItem >> title: anObject [ title := anObject ] diff --git a/src/GToolkit-Coder-UI/GtCoderFilterListItemElement.class.st b/src/GToolkit-Coder-UI/GtCoderFilterListItemElement.class.st index 04a21289c..e12ea4098 100644 --- a/src/GToolkit-Coder-UI/GtCoderFilterListItemElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderFilterListItemElement.class.st @@ -1,14 +1,14 @@ Class { - #name : #GtCoderFilterListItemElement, - #superclass : #BrHorizontalPane, + #name : 'GtCoderFilterListItemElement', + #superclass : 'BrHorizontalPane', #instVars : [ 'item', 'labelElement' ], - #category : #'GToolkit-Coder-UI-Basic' + #category : 'GToolkit-Coder-UI-Basic' } -{ #category : #initialization } +{ #category : 'initialization' } GtCoderFilterListItemElement >> initialize [ super initialize. @@ -18,25 +18,25 @@ GtCoderFilterListItemElement >> initialize [ self vFitContent. ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderFilterListItemElement >> item [ ^ item ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderFilterListItemElement >> item: anObject [ item == anObject ifTrue: [ ^ self ]. item := anObject. self onItemChanged. ] -{ #category : #'private - instance creation' } +{ #category : 'private - instance creation' } GtCoderFilterListItemElement >> newLabelElement [ ^ BrLabel new aptitude: BrGlamorousLabelAptitude ] -{ #category : #'private - hooks' } +{ #category : 'private - hooks' } GtCoderFilterListItemElement >> onItemChanged [ labelElement text: self item title ] diff --git a/src/GToolkit-Coder-UI/GtCoderModel.extension.st b/src/GToolkit-Coder-UI/GtCoderModel.extension.st index e11830871..03a9f8397 100644 --- a/src/GToolkit-Coder-UI/GtCoderModel.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderModel.extension.st @@ -1,21 +1,21 @@ -Extension { #name : #GtCoderModel } +Extension { #name : 'GtCoderModel' } -{ #category : #'*GToolkit-Coder-UI' } +{ #category : '*GToolkit-Coder-UI' } GtCoderModel >> asCoderUIModel [ ^ self subclassResponsibility ] -{ #category : #'*GToolkit-Coder-UI' } +{ #category : '*GToolkit-Coder-UI' } GtCoderModel >> asCoderViewModel [ ^ self asCoderUIModel ] -{ #category : #'*GToolkit-Coder-UI' } +{ #category : '*GToolkit-Coder-UI' } GtCoderModel >> asElement [ ^ self asCoderUIModel asElement ] -{ #category : #'*GToolkit-Coder-UI' } +{ #category : '*GToolkit-Coder-UI' } GtCoderModel >> asExpandedOnlyElement [ "Create an element for just the expanded coder without expander" @@ -24,24 +24,24 @@ GtCoderModel >> asExpandedOnlyElement [ yourself ] -{ #category : #'*GToolkit-Coder-UI' } +{ #category : '*GToolkit-Coder-UI' } GtCoderModel >> coderLook [ ^ (self attributeNamed: #coderLook ifAbsent: [ nil ]) value ] -{ #category : #'*GToolkit-Coder-UI' } +{ #category : '*GToolkit-Coder-UI' } GtCoderModel >> coderLook: aLookOrBlock [ self attributeNamed: #coderLook put: aLookOrBlock ] -{ #category : #'*GToolkit-Coder-UI' } +{ #category : '*GToolkit-Coder-UI' } GtCoderModel >> defaultCoderLook [ ^ nil ] -{ #category : #'*GToolkit-Coder-UI' } +{ #category : '*GToolkit-Coder-UI' } GtCoderModel >> elementClass [ ^ GtExpandableSourceCoderElement ] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassHierachyElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassHierachyElement.class.st index f1760be15..52fe25b64 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassHierachyElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassHierachyElement.class.st @@ -1,16 +1,16 @@ Class { - #name : #GtCoderNavigationClassHierachyElement, - #superclass : #GtCoderNavigationElement, - #category : #'GToolkit-Coder-UI-Navigation' + #name : 'GtCoderNavigationClassHierachyElement', + #superclass : 'GtCoderNavigationElement', + #category : 'GToolkit-Coder-UI-Navigation' } -{ #category : #initialization } +{ #category : 'initialization' } GtCoderNavigationClassHierachyElement >> initializeElement [ super initializeElement. self addChild: classesList ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderNavigationClassHierachyElement >> initializeLayout [ super initializeLayout. self layout: BlLinearLayout vertical. @@ -19,7 +19,7 @@ GtCoderNavigationClassHierachyElement >> initializeLayout [ c vertical matchParent ]. ] -{ #category : #subscriptions } +{ #category : 'subscriptions' } GtCoderNavigationClassHierachyElement >> onClassModified: anAnnouncement [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -29,7 +29,7 @@ GtCoderNavigationClassHierachyElement >> onClassModified: anAnnouncement [ tag: anAnnouncement tag ] ] -{ #category : #subscriptions } +{ #category : 'subscriptions' } GtCoderNavigationClassHierachyElement >> onClassRenamed: anAnnouncement [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -41,7 +41,7 @@ GtCoderNavigationClassHierachyElement >> onClassRenamed: anAnnouncement [ tag: anAnnouncement tag ] ] -{ #category : #'event handling' } +{ #category : 'event handling' } GtCoderNavigationClassHierachyElement >> onClassSelected: anAnnouncement [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -49,7 +49,7 @@ GtCoderNavigationClassHierachyElement >> onClassSelected: anAnnouncement [ self selectClass: anAnnouncement theClass ]. ] -{ #category : #'event handling' } +{ #category : 'event handling' } GtCoderNavigationClassHierachyElement >> onPackageSelected: anAnnouncer [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -57,7 +57,7 @@ GtCoderNavigationClassHierachyElement >> onPackageSelected: anAnnouncer [ self deselectClasses. ] ] -{ #category : #'event handling' } +{ #category : 'event handling' } GtCoderNavigationClassHierachyElement >> onPackageTagSelected: anAnnouncer [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -65,7 +65,7 @@ GtCoderNavigationClassHierachyElement >> onPackageTagSelected: anAnnouncer [ self deselectClasses. ]. ] -{ #category : #'event handling' } +{ #category : 'event handling' } GtCoderNavigationClassHierachyElement >> onPackagesSelected: anAnnouncer [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -73,13 +73,13 @@ GtCoderNavigationClassHierachyElement >> onPackagesSelected: anAnnouncer [ self deselectClasses. ] ] -{ #category : #subscriptions } +{ #category : 'subscriptions' } GtCoderNavigationClassHierachyElement >> subscribeToContent [ super subscribeToContent. self subscribeToClassList. ] -{ #category : #subscriptions } +{ #category : 'subscriptions' } GtCoderNavigationClassHierachyElement >> subscribeToNavigationModel [ self hasNavigationModel ifFalse: [ ^ self ]. super subscribeToNavigationModel. @@ -88,7 +88,7 @@ GtCoderNavigationClassHierachyElement >> subscribeToNavigationModel [ navigationModel when: GtCoderNavigationPackageTagSelected send: #onPackageTagSelected: to: self. ] -{ #category : #'updating lists' } +{ #category : 'updating lists' } GtCoderNavigationClassHierachyElement >> updateClassLists [ self hasNavigationModel ifFalse: [ ^ self ]. navigationModel hasSelectedClass @@ -96,12 +96,12 @@ GtCoderNavigationClassHierachyElement >> updateClassLists [ ifFalse: [ self emptyClassList ]. ] -{ #category : #'updating lists' } +{ #category : 'updating lists' } GtCoderNavigationClassHierachyElement >> updateClassListsWith: aClass [ classesList initializeWithHierachyForClass: aClass. ] -{ #category : #'updating lists' } +{ #category : 'updating lists' } GtCoderNavigationClassHierachyElement >> updateContent [ self updateClassLists. self updateSelectedClass diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st index 8cf7b93b2..8e7cdfbb6 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st @@ -4,20 +4,20 @@ I show a list of classes grouping them based on the inheritance hierarchy and so " Class { - #name : #GtCoderNavigationClassesHierarchyTreeElement, - #superclass : #BrSimpleTree, + #name : 'GtCoderNavigationClassesHierarchyTreeElement', + #superclass : 'BrSimpleTree', #instVars : [ 'classesTree' ], - #category : #'GToolkit-Coder-UI-Navigation' + #category : 'GToolkit-Coder-UI-Navigation' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtCoderNavigationClassesHierarchyTreeElement class >> fromClasses: aCollectionOfClasses [ ^ self new initializeWithClasses: aCollectionOfClasses ] -{ #category : #'private - ui' } +{ #category : 'private - ui' } GtCoderNavigationClassesHierarchyTreeElement >> expandClass: aClass [ | aClassDepth | aClassDepth := 0. @@ -26,7 +26,7 @@ GtCoderNavigationClassesHierarchyTreeElement >> expandClass: aClass [ self expandUpTo: aClassDepth + 1 ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderNavigationClassesHierarchyTreeElement >> initialize [ super initialize. @@ -51,7 +51,7 @@ GtCoderNavigationClassesHierarchyTreeElement >> initialize [ aText ]) ] ] -{ #category : #'api - initialization' } +{ #category : 'api - initialization' } GtCoderNavigationClassesHierarchyTreeElement >> initializeWithClasses: aCollectionOfClasses [ classesTree := (GtCoderClassesHierarchyTree fromClasses: aCollectionOfClasses) sortByClassName. @@ -61,7 +61,7 @@ GtCoderNavigationClassesHierarchyTreeElement >> initializeWithClasses: aCollecti self expandAll ] -{ #category : #'api - initialization' } +{ #category : 'api - initialization' } GtCoderNavigationClassesHierarchyTreeElement >> initializeWithHierachyForClass: aClass [ classesTree := (GtCoderGrowingClassesHierarchyTree hierarchyForClass: aClass) sortByClassName. @@ -71,14 +71,14 @@ GtCoderNavigationClassesHierarchyTreeElement >> initializeWithHierachyForClass: self expandAll ] -{ #category : #'api - selection' } +{ #category : 'api - selection' } GtCoderNavigationClassesHierarchyTreeElement >> selectedClass [ self selectedNodeDo: [ :aNode | ^ aNode value rootClass ]. ^ nil ] -{ #category : #'api - selection' } +{ #category : 'api - selection' } GtCoderNavigationClassesHierarchyTreeElement >> selectedIndice [ "Return selected indice or zero" diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassesListElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassesListElement.class.st index 89057a611..d388d9197 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassesListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassesListElement.class.st @@ -4,19 +4,19 @@ I show a simple list of classes sorting alphabetically " Class { - #name : #GtCoderNavigationClassesListElement, - #superclass : #BrSimpleList, + #name : 'GtCoderNavigationClassesListElement', + #superclass : 'BrSimpleList', #traits : 'TGtCoderNavigationClassesHelper', #classTraits : 'TGtCoderNavigationClassesHelper classTrait', - #category : #'GToolkit-Coder-UI-Navigation' + #category : 'GToolkit-Coder-UI-Navigation' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtCoderNavigationClassesListElement class >> fromClasses: aCollectionOfClasses [ ^ self new initializeWithClasses: aCollectionOfClasses ] -{ #category : #'private - ui' } +{ #category : 'private - ui' } GtCoderNavigationClassesListElement >> buildClassLabel: aClass [ | aLook aText | aLook := (BrGlamorousLabelAptitude new fontSize: 12). @@ -36,7 +36,7 @@ GtCoderNavigationClassesListElement >> buildClassLabel: aClass [ text: aText. ] -{ #category : #'private - ui' } +{ #category : 'private - ui' } GtCoderNavigationClassesListElement >> buildClassRow: aClass index: aRowIndex list: aListElement [ ^ BrWidgetContainer new layout: BlLinearLayout horizontal; @@ -66,14 +66,14 @@ GtCoderNavigationClassesListElement >> buildClassRow: aClass index: aRowIndex li addChild: (self buildClassLabel: aClass) ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderNavigationClassesListElement >> initialize [ super initialize. self stencil: [ :eachClass :eachIndex :aListElement | self buildClassRow: eachClass index: eachIndex list: aListElement ] ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderNavigationClassesListElement >> initializeWithClasses: aCollectionOfClasses [ self items: (aCollectionOfClasses sorted: [ :classA :classB | classA name < classB name ]) ] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st index 448c306e8..b7feadf37 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st @@ -1,39 +1,39 @@ Class { - #name : #GtCoderNavigationElement, - #superclass : #BlElement, + #name : 'GtCoderNavigationElement', + #superclass : 'BlElement', #instVars : [ 'navigationModel', 'supressNavigationChanges', 'supressListChanges', 'classesList' ], - #category : #'GToolkit-Coder-UI-Navigation' + #category : 'GToolkit-Coder-UI-Navigation' } -{ #category : #asserting } +{ #category : 'asserting' } GtCoderNavigationElement >> assertNavigationModel: aGtCoderNavigationPackagesTagsClassesModel [ self assert: [ aGtCoderNavigationPackagesTagsClassesModel isNotNil ] description: [ 'Navigation model must be non-nil' ]. ] -{ #category : #'api - class selections' } +{ #category : 'api - class selections' } GtCoderNavigationElement >> deselectClasses [ classesList deselectAll ] -{ #category : #'updating lists' } +{ #category : 'updating lists' } GtCoderNavigationElement >> emptyClassList [ classesList initializeWithClasses: #(). ] -{ #category : #testing } +{ #category : 'testing' } GtCoderNavigationElement >> hasNavigationModel [ ^ self navigationModel isNotNil and: [ self navigationModel isNavigationModel ] ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderNavigationElement >> initialize [ super initialize. supressListChanges := false. @@ -43,29 +43,29 @@ GtCoderNavigationElement >> initialize [ self initializeElement. ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderNavigationElement >> initializeContent [ classesList := GtCoderNavigationClassesHierarchyTreeElement new. ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderNavigationElement >> initializeElement [ "subclasses may initialize element" ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderNavigationElement >> initializeLayout [ "subclasses may define its layout" ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationElement >> navigationModel [ ^ navigationModel ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationElement >> navigationModel: aGtCoderNavigationPackagesTagsClassesModel [ self assertNavigationModel: aGtCoderNavigationPackagesTagsClassesModel. self unsubscribeFromNavigationModel. @@ -73,7 +73,7 @@ GtCoderNavigationElement >> navigationModel: aGtCoderNavigationPackagesTagsClass self onNavigationModelChanged. ] -{ #category : #'hooks - children' } +{ #category : 'hooks - children' } GtCoderNavigationElement >> onAddedToSceneGraph [ super onAddedToSceneGraph. self updateContent. @@ -81,7 +81,7 @@ GtCoderNavigationElement >> onAddedToSceneGraph [ self subscribeToContent. ] -{ #category : #'event handling' } +{ #category : 'event handling' } GtCoderNavigationElement >> onClassListSelectionChanged [ | anIndex aSelectedItem theIndices | supressListChanges ifTrue: [ ^ self ]. @@ -94,7 +94,7 @@ GtCoderNavigationElement >> onClassListSelectionChanged [ self navigationModel selectClass: aSelectedItem ] -{ #category : #'event handling' } +{ #category : 'event handling' } GtCoderNavigationElement >> onClassModified: anAnnouncement [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -104,7 +104,7 @@ GtCoderNavigationElement >> onClassModified: anAnnouncement [ tag: anAnnouncement tag ] ] -{ #category : #'event handling' } +{ #category : 'event handling' } GtCoderNavigationElement >> onClassRenamed: anAnnouncement [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -116,7 +116,7 @@ GtCoderNavigationElement >> onClassRenamed: anAnnouncement [ tag: anAnnouncement tag ] ] -{ #category : #'event handling' } +{ #category : 'event handling' } GtCoderNavigationElement >> onClassSelected: anAnnouncement [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -126,7 +126,7 @@ GtCoderNavigationElement >> onClassSelected: anAnnouncement [ tag: anAnnouncement tag ]. ] -{ #category : #'event handling' } +{ #category : 'event handling' } GtCoderNavigationElement >> onNavigationModelChanged [ "subclasses may perform actions on navigation model changes" self isAttachedToSceneGraph ifFalse: [ ^ self ]. @@ -134,14 +134,14 @@ GtCoderNavigationElement >> onNavigationModelChanged [ self updateContent. ] -{ #category : #'hooks - children' } +{ #category : 'hooks - children' } GtCoderNavigationElement >> onRemovedFromSceneGraph [ super onRemovedFromSceneGraph. self unsuscribeFromContent. self unsubscribeFromNavigationModel. ] -{ #category : #'api - class updates' } +{ #category : 'api - class updates' } GtCoderNavigationElement >> renameClass: aClass oldName: anOldName newName: aNewName inPackage: aPackage tag: aTag [ classesList viewModel @@ -152,14 +152,14 @@ GtCoderNavigationElement >> renameClass: aClass oldName: anOldName newName: aNew self updateSelectedClass ]. ] -{ #category : #'private - selection' } +{ #category : 'private - selection' } GtCoderNavigationElement >> scrollIndexFrom: aNodeIndex [ "TODO: does not work if an index is at a bottom: aNodeIndex - 5 max: 1" ^ aNodeIndex ] -{ #category : #'private - selection' } +{ #category : 'private - selection' } GtCoderNavigationElement >> scrollIndexFromPrevious: aPreviousIndex current: aNewIndex max: aNumberOfItems [ ^ (aPreviousIndex isZero or: [ aPreviousIndex >= aNewIndex ]) @@ -167,7 +167,7 @@ GtCoderNavigationElement >> scrollIndexFromPrevious: aPreviousIndex current: aNe ifFalse: [ aNewIndex + 5 min: aNumberOfItems ]. ] -{ #category : #'api - class selections' } +{ #category : 'api - class selections' } GtCoderNavigationElement >> selectClass: aClass [ | aPreviousIndex | aPreviousIndex := classesList selectedIndice. @@ -183,18 +183,18 @@ GtCoderNavigationElement >> selectClass: aClass [ max: classesList viewModel itemCount) ] ] -{ #category : #subscriptions } +{ #category : 'subscriptions' } GtCoderNavigationElement >> subscribeToClassList [ classesList when: BrSelectionChanged do: [ :anEvent | self onClassListSelectionChanged ]. ] -{ #category : #subscriptions } +{ #category : 'subscriptions' } GtCoderNavigationElement >> subscribeToContent [ ] -{ #category : #subscriptions } +{ #category : 'subscriptions' } GtCoderNavigationElement >> subscribeToNavigationModel [ self hasNavigationModel ifFalse: [ ^ self ]. navigationModel when: GtCoderNavigationClassSelected send: #onClassSelected: to: self. @@ -202,7 +202,7 @@ GtCoderNavigationElement >> subscribeToNavigationModel [ navigationModel when: GtCoderNavigationClassModified send: #onClassModified: to: self. ] -{ #category : #subscriptions } +{ #category : 'subscriptions' } GtCoderNavigationElement >> suppressListChangeEventsDuring: aBlock [ | anOldValue | anOldValue := supressListChanges. @@ -210,7 +210,7 @@ GtCoderNavigationElement >> suppressListChangeEventsDuring: aBlock [ aBlock ensure: [ supressListChanges := anOldValue ]. ] -{ #category : #subscriptions } +{ #category : 'subscriptions' } GtCoderNavigationElement >> suppressNavigationChangeEventsDuring: aBlock [ | anOldValue | anOldValue := supressNavigationChanges. @@ -218,17 +218,17 @@ GtCoderNavigationElement >> suppressNavigationChangeEventsDuring: aBlock [ aBlock ensure: [ supressNavigationChanges := anOldValue ]. ] -{ #category : #subscriptions } +{ #category : 'subscriptions' } GtCoderNavigationElement >> unsubscribeFromNavigationModel [ self hasNavigationModel ifFalse: [ ^ self ]. navigationModel ifNotNil: [ :aModel | aModel unsubscribe: self ]. ] -{ #category : #subscriptions } +{ #category : 'subscriptions' } GtCoderNavigationElement >> unsuscribeFromContent [ ] -{ #category : #'api - class updates' } +{ #category : 'api - class updates' } GtCoderNavigationElement >> updateClass: aClass inPackage: aPackage tag: aTag [ classesList viewModel @@ -239,16 +239,16 @@ GtCoderNavigationElement >> updateClass: aClass inPackage: aPackage tag: aTag [ self updateSelectedClass ]. ] -{ #category : #'updating lists' } +{ #category : 'updating lists' } GtCoderNavigationElement >> updateClassLists [ "Update class list" ] -{ #category : #updating } +{ #category : 'updating' } GtCoderNavigationElement >> updateContent [ ] -{ #category : #'updating lists' } +{ #category : 'updating lists' } GtCoderNavigationElement >> updateSelectedClass [ self hasNavigationModel ifFalse: [ ^ self ]. navigationModel selectedClassDo: [ :aClass | diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationMethodProtocolListElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationMethodProtocolListElement.class.st index 786325b1e..98ff43b07 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationMethodProtocolListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationMethodProtocolListElement.class.st @@ -1,15 +1,15 @@ Class { - #name : #GtCoderNavigationMethodProtocolListElement, - #superclass : #BrSimpleList, - #category : #'GToolkit-Coder-UI-Navigation' + #name : 'GtCoderNavigationMethodProtocolListElement', + #superclass : 'BrSimpleList', + #category : 'GToolkit-Coder-UI-Navigation' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtCoderNavigationMethodProtocolListElement class >> fromClass: aClass [ ^ self new initializeWithClass: aClass ] -{ #category : #'private - ui' } +{ #category : 'private - ui' } GtCoderNavigationMethodProtocolListElement >> buildProtocolLabel: aProtocol [ ^ BrLabel new aptitude: BrGlamorousLabelAptitude; @@ -17,7 +17,7 @@ GtCoderNavigationMethodProtocolListElement >> buildProtocolLabel: aProtocol [ text: aProtocol name ] -{ #category : #'private - ui' } +{ #category : 'private - ui' } GtCoderNavigationMethodProtocolListElement >> buildProtocolRow: aProtocol index: aRowIndex list: aListElement [ ^ BrWidgetContainer new layout: BlLinearLayout horizontal; @@ -47,19 +47,19 @@ GtCoderNavigationMethodProtocolListElement >> buildProtocolRow: aProtocol index: addChild: (self buildProtocolLabel: aProtocol) ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderNavigationMethodProtocolListElement >> initialize [ super initialize. self stencil: [ :eachProtocol :eachIndex :aListElement | self buildProtocolRow: eachProtocol index: eachIndex list: aListElement ] ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderNavigationMethodProtocolListElement >> initializeWithClass: aClass [ self initializeWithProtocols: aClass organization allProtocols ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderNavigationMethodProtocolListElement >> initializeWithProtocols: aCollection [ self items: (aCollection sorted: [ :protocolA :protocolB | protocolA name < protocolB name ]) ] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationModelElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationModelElement.class.st index a8c5bd952..f9d4eea17 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationModelElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationModelElement.class.st @@ -6,15 +6,15 @@ See my {{gtClass:GtCoderNavigationModelElement|expanded|show=#gtSubclassesFor:}} " Class { - #name : #GtCoderNavigationModelElement, - #superclass : #GtCoderElement, + #name : 'GtCoderNavigationModelElement', + #superclass : 'GtCoderElement', #instVars : [ 'navigationModel' ], - #category : #'GToolkit-Coder-UI-Basic' + #category : 'GToolkit-Coder-UI-Basic' } -{ #category : #'private - asserting' } +{ #category : 'private - asserting' } GtCoderNavigationModelElement >> assertNavigationModel: aGtCoderNavigationModel [ self assert: [ aGtCoderNavigationModel isNotNil ] @@ -25,12 +25,12 @@ GtCoderNavigationModelElement >> assertNavigationModel: aGtCoderNavigationModel ] -{ #category : #defaults } +{ #category : 'defaults' } GtCoderNavigationModelElement >> defaultNavigationModel [ ^ GtCoderNavigationModel null ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderNavigationModelElement >> initialize [ super initialize. navigationModel := self defaultNavigationModel. @@ -38,7 +38,7 @@ GtCoderNavigationModelElement >> initialize [ ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderNavigationModelElement >> initializeListeners [ self when: GtCoderToReplace @@ -53,13 +53,13 @@ GtCoderNavigationModelElement >> initializeListeners [ do: [ :anEvent | self spawnInSpaceFrom: anEvent ]. ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderNavigationModelElement >> navigationModel [ ^ navigationModel ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderNavigationModelElement >> navigationModel: aGtCoderNavigationModel [ navigationModel = aGtCoderNavigationModel ifTrue: [ ^ self ]. self assertNavigationModel: aGtCoderNavigationModel. @@ -69,42 +69,42 @@ GtCoderNavigationModelElement >> navigationModel: aGtCoderNavigationModel [ self onNavigationModelChanged. ] -{ #category : #'private - hooks' } +{ #category : 'private - hooks' } GtCoderNavigationModelElement >> onNavigationModelChanged [ "Subclasses can react to navigation model changes." ] -{ #category : #'api - updating' } +{ #category : 'api - updating' } GtCoderNavigationModelElement >> pushCoder: aCoderOrCoders [ self assertNavigationModel: self navigationModel. self navigationModel selectCoder: aCoderOrCoders ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtCoderNavigationModelElement >> replaceFrom: aGtCoderToReplaceEvent [ aGtCoderToReplaceEvent consumed: true. self pushCoder: aGtCoderToReplaceEvent coder ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtCoderNavigationModelElement >> spawnFrom: aGtCoderToSpawnEvent [ aGtCoderToSpawnEvent consumed: true. self phlow spawnTool: (GtReadyCoderTool coder: (aGtCoderToSpawnEvent coder)) ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtCoderNavigationModelElement >> spawnInSpaceFrom: aGtCoderToSpawnInSpaceEvent [ aGtCoderToSpawnInSpaceEvent consumed: true. ] -{ #category : #'private - subscriptions' } +{ #category : 'private - subscriptions' } GtCoderNavigationModelElement >> subscribeToNavigationModel [ "Subclasses can subscribe to the navigation model" ] -{ #category : #'private - subscriptions' } +{ #category : 'private - subscriptions' } GtCoderNavigationModelElement >> unsubscribeFromNavigationModel [ self navigationModel = GtCoderNavigationModel null ifTrue: [ ^ self ]. self navigationModel unsubscribe: self. diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 85f938cf5..99c49a852 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -1,6 +1,6 @@ Class { - #name : #GtCoderNavigationPackagesTagsClassesElement, - #superclass : #GtCoderNavigationElement, + #name : 'GtCoderNavigationPackagesTagsClassesElement', + #superclass : 'GtCoderNavigationElement', #instVars : [ 'packagesList', 'classesLabel', @@ -9,10 +9,10 @@ Class { 'protocolLabel', 'coderFilterChangesSubscription' ], - #category : #'GToolkit-Coder-UI-Navigation' + #category : 'GToolkit-Coder-UI-Navigation' } -{ #category : #'api - package updates' } +{ #category : 'api - package updates' } GtCoderNavigationPackagesTagsClassesElement >> addPackage: aPackage [ | aSelectedPackageOrTag | @@ -24,7 +24,7 @@ GtCoderNavigationPackagesTagsClassesElement >> addPackage: aPackage [ self selectPackageOrTag: aSelectedPackageOrTag ]. ] -{ #category : #'api - package updates' } +{ #category : 'api - package updates' } GtCoderNavigationPackagesTagsClassesElement >> addPackage: aPackage tag: aPackageTag [ | aSelectedPackageOrTag | @@ -36,17 +36,17 @@ GtCoderNavigationPackagesTagsClassesElement >> addPackage: aPackage tag: aPackag self selectPackageOrTag: aSelectedPackageOrTag ]. ] -{ #category : #'api - package selections' } +{ #category : 'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> deselectPackages [ packagesList deselectAll ] -{ #category : #'updating lists' } +{ #category : 'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> emptyMethodProtocolList [ methodProtocolsList initializeWithProtocols: #(). ] -{ #category : #'api - package selections' } +{ #category : 'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> expandPackage: aRPackage [ packagesList viewModel root allChildrenNodesBreadthFirstDo: [ :eachTreeNode | @@ -54,7 +54,7 @@ GtCoderNavigationPackagesTagsClassesElement >> expandPackage: aRPackage [ ifTrue: [ eachTreeNode expand ] ] ] -{ #category : #'private - testing' } +{ #category : 'private - testing' } GtCoderNavigationPackagesTagsClassesElement >> hasPackageTagsIn: aRPackage [ | noTags noExtensions | @@ -63,21 +63,21 @@ GtCoderNavigationPackagesTagsClassesElement >> hasPackageTagsIn: aRPackage [ ^ noTags not or: [ noExtensions not ] ] -{ #category : #'showing / hiding' } +{ #category : 'showing / hiding' } GtCoderNavigationPackagesTagsClassesElement >> hideClassList [ classAndMethodProtocolList visibility: BlVisibility gone. classesLabel visibility: BlVisibility gone. self layout columnCount: 1. ] -{ #category : #'showing / hiding' } +{ #category : 'showing / hiding' } GtCoderNavigationPackagesTagsClassesElement >> hideOrShowClassList [ classesList maxSelectionIndex isZero ifTrue: [ self hideClassList ] ifFalse: [ self showClassList ] ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderNavigationPackagesTagsClassesElement >> initializeContent [ super initializeContent. packagesList := GtCoderNavigationPackagesTreeElement new. @@ -94,7 +94,7 @@ GtCoderNavigationPackagesTagsClassesElement >> initializeContent [ addChild: methodProtocolsList. ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderNavigationPackagesTagsClassesElement >> initializeElement [ super initializeElement. self addChildren: { @@ -111,7 +111,7 @@ GtCoderNavigationPackagesTagsClassesElement >> initializeElement [ } ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderNavigationPackagesTagsClassesElement >> initializeLayout [ super initializeLayout. self layout: (BlGridLayout horizontal columnCount: 2; cellSpacing: 5). @@ -120,7 +120,7 @@ GtCoderNavigationPackagesTagsClassesElement >> initializeLayout [ c vertical matchParent ]. ] -{ #category : #'event handling' } +{ #category : 'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onMethodsCoderFiltersChanged: aGtCodersFiltersChanged [ aGtCodersFiltersChanged source = self ifTrue: [ ^ self ]. @@ -145,7 +145,7 @@ GtCoderNavigationPackagesTagsClassesElement >> onMethodsCoderFiltersChanged: aGt methodProtocolsList deselectAll ]. ] -{ #category : #'event handling' } +{ #category : 'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageListSelectionChanged [ | anIndex aSelectedItem theIndices | supressListChanges ifTrue: [ ^ self ]. @@ -160,14 +160,14 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackageListSelectionChanged [ ifFalse: [ self navigationModel selectTag: aSelectedItem ] ] -{ #category : #'event handling' } +{ #category : 'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageRegistered: anAnnouncement [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ self addPackage: anAnnouncement package ] ] -{ #category : #'event handling' } +{ #category : 'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageRenamed: anAnnouncement [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -177,7 +177,7 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackageRenamed: anAnnouncement newName: anAnnouncement newName ] ] -{ #category : #'event handling' } +{ #category : 'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageSelected: anAnnouncer [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -185,21 +185,21 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackageSelected: anAnnouncer [ self deselectClasses. ] ] -{ #category : #'event handling' } +{ #category : 'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageTagAdded: anAnnouncement [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ self addPackage: anAnnouncement package tag: anAnnouncement tag ] ] -{ #category : #'event handling' } +{ #category : 'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageTagRemoved: anAnnouncement [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ self removePackage: anAnnouncement package tag: anAnnouncement tag ] ] -{ #category : #'event handling' } +{ #category : 'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageTagSelected: anAnnouncer [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -209,14 +209,14 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackageTagSelected: anAnnouncer self deselectClasses. ]. ] -{ #category : #'event handling' } +{ #category : 'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageUnregistered: anAnnouncement [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ self removePackage: anAnnouncement package ] ] -{ #category : #'event handling' } +{ #category : 'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackagesSelected: anAnnouncer [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -224,7 +224,7 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackagesSelected: anAnnouncer [ self deselectClasses. ] ] -{ #category : #'event handling' } +{ #category : 'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onProtocolListSelectionChanged [ | anIndex aSelectedItem theIndices | supressListChanges ifTrue: [ ^ self ]. @@ -237,7 +237,7 @@ GtCoderNavigationPackagesTagsClassesElement >> onProtocolListSelectionChanged [ self navigationModel selectMethodProtocol: aSelectedItem source: self. ] -{ #category : #'api - package updates' } +{ #category : 'api - package updates' } GtCoderNavigationPackagesTagsClassesElement >> removePackage: aPackage [ | aSelectedPackageOrTag anIndex | @@ -251,7 +251,7 @@ GtCoderNavigationPackagesTagsClassesElement >> removePackage: aPackage [ self reselectPackageOrTag: aSelectedPackageOrTag afterRemovalOfPackageNamed: aPackage name. ] -{ #category : #'api - package updates' } +{ #category : 'api - package updates' } GtCoderNavigationPackagesTagsClassesElement >> removePackage: aPackage tag: aPackageTagName [ | aSelectedPackageOrTag anIndex | anIndex := packagesList viewModel indexOf: aPackage. @@ -262,7 +262,7 @@ GtCoderNavigationPackagesTagsClassesElement >> removePackage: aPackage tag: aPac self reselectPackageOrTag: aSelectedPackageOrTag afterRemovalOfTagNamed: aPackageTagName. ] -{ #category : #'api - package updates' } +{ #category : 'api - package updates' } GtCoderNavigationPackagesTagsClassesElement >> renamePackage: aPackage oldName: anOldName newName: aNewName [ | aSelectedPackageOrTag | @@ -274,7 +274,7 @@ GtCoderNavigationPackagesTagsClassesElement >> renamePackage: aPackage oldName: self selectPackageOrTag: aSelectedPackageOrTag ]. ] -{ #category : #'api - package reselections' } +{ #category : 'api - package reselections' } GtCoderNavigationPackagesTagsClassesElement >> reselectPackageOrTag: aSelectedPackageOrTag afterRemovalOfPackageNamed: aRemovedPackageOrTagName [ aSelectedPackageOrTag ifNotNil: [ self deselectPackages. @@ -285,7 +285,7 @@ GtCoderNavigationPackagesTagsClassesElement >> reselectPackageOrTag: aSelectedPa self selectPackageOrTag: aSelectedPackageOrTag ] ] ] -{ #category : #'api - package reselections' } +{ #category : 'api - package reselections' } GtCoderNavigationPackagesTagsClassesElement >> reselectPackageOrTag: aSelectedPackageOrTag afterRemovalOfTagNamed: aRemovedTagName [ aSelectedPackageOrTag ifNotNil: [ self deselectPackages. @@ -297,7 +297,7 @@ GtCoderNavigationPackagesTagsClassesElement >> reselectPackageOrTag: aSelectedPa self selectPackageOrTag: aSelectedPackageOrTag ] ] ] -{ #category : #'api - class selections' } +{ #category : 'api - class selections' } GtCoderNavigationPackagesTagsClassesElement >> selectClass: aClass inPackage: aPackage tag: aPackageTag [ (self selectedPackage ~= aPackage or: [ self selectedPackageTag ~= aPackageTag ]) @@ -305,7 +305,7 @@ GtCoderNavigationPackagesTagsClassesElement >> selectClass: aClass inPackage: aP self selectClass: aClass ] -{ #category : #'api - package selections' } +{ #category : 'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> selectPackage: aPackage [ | aPreviousIndex | aPreviousIndex := packagesList selectedIndice. @@ -323,7 +323,7 @@ GtCoderNavigationPackagesTagsClassesElement >> selectPackage: aPackage [ self hideOrShowClassList ] -{ #category : #'api - package selections' } +{ #category : 'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> selectPackage: aPackage tag: aPackageTag [ | aPreviousIndex | (self hasPackageTagsIn: aPackage) @@ -344,49 +344,49 @@ GtCoderNavigationPackagesTagsClassesElement >> selectPackage: aPackage tag: aPac self hideOrShowClassList ] -{ #category : #'api - package selections' } +{ #category : 'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> selectPackageOrTag: aPackageOrTag [ (aPackageOrTag isKindOf: RPackage) ifTrue: [ self selectPackage: aPackageOrTag ] ifFalse: [ self selectPackage: aPackageOrTag package tag: aPackageOrTag ] ] -{ #category : #'api - class selections' } +{ #category : 'api - class selections' } GtCoderNavigationPackagesTagsClassesElement >> selectedClass [ ^ classesList selectedClass ] -{ #category : #'api - package selections' } +{ #category : 'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> selectedPackage [ ^ packagesList selectedPackage ] -{ #category : #'api - package selections' } +{ #category : 'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> selectedPackageNodeDo: aBlock [ ^ packagesList selectedPackageNodeDo: aBlock ] -{ #category : #'api - package selections' } +{ #category : 'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> selectedPackageTag [ ^ packagesList selectedPackageTag ] -{ #category : #'api - package selections' } +{ #category : 'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> selectedPackageTagNodeDo: aBlock [ ^ packagesList selectedPackageTagNodeDo: aBlock ] -{ #category : #'showing / hiding' } +{ #category : 'showing / hiding' } GtCoderNavigationPackagesTagsClassesElement >> showClassList [ classAndMethodProtocolList visibility: BlVisibility visible. classesLabel visibility: BlVisibility visible. self layout columnCount: 2. ] -{ #category : #subscriptions } +{ #category : 'subscriptions' } GtCoderNavigationPackagesTagsClassesElement >> subscribeToContent [ super subscribeToContent. self subscribeToPackageList. @@ -394,7 +394,7 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToContent [ self subscribeToProtocolList. ] -{ #category : #subscriptions } +{ #category : 'subscriptions' } GtCoderNavigationPackagesTagsClassesElement >> subscribeToNavigationModel [ self hasNavigationModel ifFalse: [ ^ self ]. super subscribeToNavigationModel. @@ -409,21 +409,21 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToNavigationModel [ navigationModel when: GtCodersFiltersChanged send: #onMethodsCoderFiltersChanged: to: self. ] -{ #category : #subscriptions } +{ #category : 'subscriptions' } GtCoderNavigationPackagesTagsClassesElement >> subscribeToPackageList [ packagesList when: BrSelectionChanged do: [ :anEvent | self onPackageListSelectionChanged ]. ] -{ #category : #subscriptions } +{ #category : 'subscriptions' } GtCoderNavigationPackagesTagsClassesElement >> subscribeToProtocolList [ methodProtocolsList when: BrSelectionChanged do: [ :anEvent | self onProtocolListSelectionChanged ]. ] -{ #category : #'updating lists' } +{ #category : 'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updateClassLists [ self hasNavigationModel ifFalse: [ ^ self ]. classesList initializeWithClasses: navigationModel classesToShow. @@ -441,7 +441,7 @@ GtCoderNavigationPackagesTagsClassesElement >> updateClassLists [ methodProtocolsList visibility: BlVisibility gone. ] ] -{ #category : #'updating lists' } +{ #category : 'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updateContent [ self updatePackageAndClassLists. self updateSelectedPackageAndTag. @@ -449,19 +449,19 @@ GtCoderNavigationPackagesTagsClassesElement >> updateContent [ self hideOrShowClassList ] -{ #category : #'updating lists' } +{ #category : 'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updatePackageAndClassLists [ self updatePackageLists. self updateClassLists. ] -{ #category : #'updating lists' } +{ #category : 'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updatePackageLists [ self hasNavigationModel ifFalse: [ ^ self ]. packagesList initializeWithPackages: navigationModel packagesToShow. ] -{ #category : #'updating lists' } +{ #category : 'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updateSelectedPackageAndTag [ self hasNavigationModel ifFalse: [ ^ self ]. navigationModel hasSelectedPackage diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st index 0be67b322..d4b689bd6 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st @@ -4,17 +4,17 @@ I show a simple list of packages sorting alphabetically " Class { - #name : #GtCoderNavigationPackagesTreeElement, - #superclass : #BrSimpleTree, - #category : #'GToolkit-Coder-UI-Navigation' + #name : 'GtCoderNavigationPackagesTreeElement', + #superclass : 'BrSimpleTree', + #category : 'GToolkit-Coder-UI-Navigation' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtCoderNavigationPackagesTreeElement class >> fromPackages: aCollectionOfPackages [ ^ self new initializeWithPackages: aCollectionOfPackages ] -{ #category : #'private - enumeration' } +{ #category : 'private - enumeration' } GtCoderNavigationPackagesTreeElement >> childrenForPackageOrTag: aPackageOrTag [ | theTags anExtension | (aPackageOrTag isKindOf: RPackage) ifFalse: [ ^ #() ]. @@ -33,7 +33,7 @@ GtCoderNavigationPackagesTreeElement >> childrenForPackageOrTag: aPackageOrTag [ ^ theTags ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderNavigationPackagesTreeElement >> initialize [ super initialize. @@ -50,7 +50,7 @@ GtCoderNavigationPackagesTreeElement >> initialize [ ifNotNil: [ aPackage name ]) ] ] -{ #category : #'api - initialization' } +{ #category : 'api - initialization' } GtCoderNavigationPackagesTreeElement >> initializeWithPackages: aCollectionOfPackages [ | theSortedPackages | theSortedPackages := aCollectionOfPackages asArray @@ -62,7 +62,7 @@ GtCoderNavigationPackagesTreeElement >> initializeWithPackages: aCollectionOfPac [ :eachPackageOrTag | self childrenForPackageOrTag: eachPackageOrTag ] ] -{ #category : #'private - testing' } +{ #category : 'private - testing' } GtCoderNavigationPackagesTreeElement >> isTag: tagA lessThan: tagB [ tagA class = GtCoderPackageUncategorizedTag ifTrue: [ ^ true ]. tagB class = GtCoderPackageUncategorizedTag ifTrue: [ ^ false ]. @@ -70,7 +70,7 @@ GtCoderNavigationPackagesTreeElement >> isTag: tagA lessThan: tagB [ ] -{ #category : #'api - selection' } +{ #category : 'api - selection' } GtCoderNavigationPackagesTreeElement >> selectedIndice [ "Return selected indice or zero" @@ -81,26 +81,26 @@ GtCoderNavigationPackagesTreeElement >> selectedIndice [ ^ 0 ] -{ #category : #'api - selection' } +{ #category : 'api - selection' } GtCoderNavigationPackagesTreeElement >> selectedPackage [ ^ self selectedPackageNodeDo: #value ] -{ #category : #'api - selection' } +{ #category : 'api - selection' } GtCoderNavigationPackagesTreeElement >> selectedPackageNodeDo: aBlock [ self selectedNodeDo: [ :aNode | aNode depth = 0 ifTrue: [ ^ aBlock cull: aNode ] ]. ^ nil ] -{ #category : #'api - selection' } +{ #category : 'api - selection' } GtCoderNavigationPackagesTreeElement >> selectedPackageTag [ ^ self selectedPackageTagNodeDo: #value ] -{ #category : #'api - selection' } +{ #category : 'api - selection' } GtCoderNavigationPackagesTreeElement >> selectedPackageTagNodeDo: aBlock [ self selectedNodeDo: [ :aNode | aNode depth = 1 ifTrue: [ ^ aBlock cull: aNode ] ]. diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index 0a32a2f91..ae02cb259 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -1,34 +1,34 @@ Class { - #name : #GtCoderNavigationTabsStencil, - #superclass : #BrStencil, + #name : 'GtCoderNavigationTabsStencil', + #superclass : 'BrStencil', #instVars : [ 'navigations', 'navigationModel' ], - #category : #'GToolkit-Coder-UI-Navigation' + #category : 'GToolkit-Coder-UI-Navigation' } -{ #category : #adding } +{ #category : 'adding' } GtCoderNavigationTabsStencil >> addNavigation: aNavigationElement [ self assertNavigationView: aNavigationElement. self navigations: (self navigations copyWith: aNavigationElement) ] -{ #category : #asserting } +{ #category : 'asserting' } GtCoderNavigationTabsStencil >> assertNavigationModel: aGtCoderNavigationPackagesTagsClassesModel [ self assert: [ aGtCoderNavigationPackagesTagsClassesModel isNotNil ] description: [ 'Navigation model must be non-nil' ]. ] -{ #category : #asserting } +{ #category : 'asserting' } GtCoderNavigationTabsStencil >> assertNavigationView: aNavigationView [ self assert: [ aNavigationView isKindOf: GtPhlowProtoView ] description: [ 'Navigation must be kind of ', GtPhlowView name ]. ] -{ #category : #'api - instantiation' } +{ #category : 'api - instantiation' } GtCoderNavigationTabsStencil >> create [ ^ GtPhlowCompositeView new @@ -39,7 +39,7 @@ GtCoderNavigationTabsStencil >> create [ matchParent ] ] -{ #category : #defaults } +{ #category : 'defaults' } GtCoderNavigationTabsStencil >> defaultNavigations [ ^ GtPhlowViewsCollector new @@ -48,7 +48,7 @@ GtCoderNavigationTabsStencil >> defaultNavigations [ collect ] -{ #category : #'gt-extensions' } +{ #category : 'gt-extensions' } GtCoderNavigationTabsStencil >> gtClassHierarchyFor: aView [ self navigationModel ifNil: [ ^ aView empty ]. @@ -58,7 +58,7 @@ GtCoderNavigationTabsStencil >> gtClassHierarchyFor: aView [ stencil: [ GtCoderNavigationClassHierachyElement new navigationModel: self navigationModel ] ] -{ #category : #'gt-extensions' } +{ #category : 'gt-extensions' } GtCoderNavigationTabsStencil >> gtPackagesTagsClassesFor: aView [ self navigationModel ifNil: [ ^ aView empty ]. @@ -69,25 +69,25 @@ GtCoderNavigationTabsStencil >> gtPackagesTagsClassesFor: aView [ navigationModel: self navigationModel ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationTabsStencil >> navigationModel [ ^ navigationModel ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationTabsStencil >> navigationModel: aGtCoderNavigationPackagesTagsClassesModel [ self assertNavigationModel: aGtCoderNavigationPackagesTagsClassesModel. navigationModel := aGtCoderNavigationPackagesTagsClassesModel. ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationTabsStencil >> navigations [ ^ navigations ifNil: [ navigations := self defaultNavigations ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderNavigationTabsStencil >> navigations: anArrayOfPhlowViews [ navigations := anArrayOfPhlowViews ] diff --git a/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st b/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st index 3bf778695..2dc3d1df0 100644 --- a/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st @@ -7,28 +7,28 @@ I display {{gtClass:GtCoderContentElement}} and {{gtClass:GtPageElement}}. " Class { - #name : #GtCoderPlaygroundElement, - #superclass : #GtCoderNavigationModelElement, + #name : 'GtCoderPlaygroundElement', + #superclass : 'GtCoderNavigationModelElement', #instVars : [ 'contentElement', 'playPageElement', 'playPage' ], - #category : #'GToolkit-Coder-UI-Basic' + #category : 'GToolkit-Coder-UI-Basic' } -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtCoderPlaygroundElement >> contentElement [ ^ contentElement ] -{ #category : #defaults } +{ #category : 'defaults' } GtCoderPlaygroundElement >> defaultPlayPage [ ^ GtPlayPage newDefault. ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderPlaygroundElement >> initialize [ super initialize. playPage := self defaultPlayPage. @@ -43,12 +43,12 @@ GtCoderPlaygroundElement >> initialize [ self addAptitude: (BrLayoutResizerAptitude inherit). ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderPlaygroundElement >> initializeContentElement [ contentElement := GtCoderContentElement new. ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderPlaygroundElement >> initializePlayPageElement [ | aStencil | aStencil := GtPlayPageStencil new @@ -62,51 +62,51 @@ GtCoderPlaygroundElement >> initializePlayPageElement [ contentStencil: aStencil ] -{ #category : #'private - hooks' } +{ #category : 'private - hooks' } GtCoderPlaygroundElement >> onClassSelected: anEvent [ self playPage receiver: anEvent theClass. self playPage xDocLoadSavedContent. ] -{ #category : #'private - hooks' } +{ #category : 'private - hooks' } GtCoderPlaygroundElement >> onNavigationModelChanged [ super onNavigationModelChanged. self contentElement navigationModel: self navigationModel. self updatePlayground. ] -{ #category : #'private - hooks' } +{ #category : 'private - hooks' } GtCoderPlaygroundElement >> onPackageSelected: anEvent [ self playPage receiver: anEvent package. self playPage xDocLoadSavedContent. ] -{ #category : #'private - hooks' } +{ #category : 'private - hooks' } GtCoderPlaygroundElement >> onPackageTagSelected: anEvent [ self playPage receiver: anEvent tag. self playPage xDocLoadSavedContent. ] -{ #category : #'private - hooks' } +{ #category : 'private - hooks' } GtCoderPlaygroundElement >> onPackagesSelected: anEvent [ self playPage receiver: Smalltalk. self playPage xDocLoadSavedContent. ] -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtCoderPlaygroundElement >> playPage [ ^ playPage ] -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtCoderPlaygroundElement >> playPageElement [ ^ playPageElement ] -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtCoderPlaygroundElement >> receiver [ self navigationModel selectedClassDo: [ :aClass | ^ aClass ]. self navigationModel selectedTagDo: [ :aPackageTag | ^ aPackageTag ]. @@ -114,7 +114,7 @@ GtCoderPlaygroundElement >> receiver [ ^ Smalltalk ] -{ #category : #'private - subscriptions' } +{ #category : 'private - subscriptions' } GtCoderPlaygroundElement >> subscribeToNavigationModel [ super subscribeToNavigationModel. self navigationModel weak @@ -124,7 +124,7 @@ GtCoderPlaygroundElement >> subscribeToNavigationModel [ when: GtCoderNavigationClassSelected send: #onClassSelected: to: self. ] -{ #category : #'private - updating' } +{ #category : 'private - updating' } GtCoderPlaygroundElement >> updatePlayground [ self playPage receiver: self receiver. self playPage xDocLoadSavedContent. diff --git a/src/GToolkit-Coder-UI/GtCoderPrintStringAttribute.class.st b/src/GToolkit-Coder-UI/GtCoderPrintStringAttribute.class.st index efa002593..032e8a827 100644 --- a/src/GToolkit-Coder-UI/GtCoderPrintStringAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPrintStringAttribute.class.st @@ -1,27 +1,27 @@ Class { - #name : #GtCoderPrintStringAttribute, - #superclass : #BrTextAdornmentAttribute, + #name : 'GtCoderPrintStringAttribute', + #superclass : 'BrTextAdornmentAttribute', #instVars : [ 'object' ], - #category : #'GToolkit-Coder-UI-Coder - Source Attributes' + #category : 'GToolkit-Coder-UI-Coder - Source Attributes' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtCoderPrintStringAttribute class >> forObject: anObject [ ^ self new object: anObject; yourself ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtCoderPrintStringAttribute class >> forString: aString [ ^ self new object: aString; yourself ] -{ #category : #private } +{ #category : 'private' } GtCoderPrintStringAttribute >> actionButtonLook [ ^ BrGlamorousButtonIconAptitude + BrGlamorousButtonLayoutAptitude + (BrStyleCommonAptitude new default: [ :aStyle | aStyle geometry: BlCircle new ]; @@ -29,7 +29,7 @@ GtCoderPrintStringAttribute >> actionButtonLook [ pressed: [ :aStyle | aStyle background: BrGlamorousColors neutralBackgroundColor darker darker ]) ] -{ #category : #private } +{ #category : 'private' } GtCoderPrintStringAttribute >> buildMenuFor: aHamburgerButton fromEditorElement: anEditorElement [ ^ BrVerticalPane new @@ -78,7 +78,7 @@ GtCoderPrintStringAttribute >> buildMenuFor: aHamburgerButton fromEditorElement: } ] -{ #category : #private } +{ #category : 'private' } GtCoderPrintStringAttribute >> buildTooltip [ ^ BrEditor new aptitude: BrGlamorousEditorAptitude new glamorousRegularSmallSize; @@ -91,17 +91,17 @@ GtCoderPrintStringAttribute >> buildTooltip [ 'Press ' asRopedText, 'backspace' asRopedText glamorousRoundedBackground, ' to remove this popup.' asRopedText ] -{ #category : #private } +{ #category : 'private' } GtCoderPrintStringAttribute >> closeMenuFromElement: anElement [ anElement fireEvent: BrDropdownHideWish new ] -{ #category : #'private - actions' } +{ #category : 'private - actions' } GtCoderPrintStringAttribute >> copyFromEditorElement: anEditorElement [ Clipboard clipboardText: object printString ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderPrintStringAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ | hamburgerButton | @@ -149,13 +149,13 @@ GtCoderPrintStringAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditor exact: 12@12) ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderPrintStringAttribute >> initialize [ super initialize. self beAppend ] -{ #category : #'private - actions' } +{ #category : 'private - actions' } GtCoderPrintStringAttribute >> insertIntoTheEditorElement: anEditorElement [ anEditorElement text findAttribute: self @@ -181,12 +181,12 @@ GtCoderPrintStringAttribute >> insertIntoTheEditorElement: anEditorElement [ anEditorElement requestFocus ] -{ #category : #testing } +{ #category : 'testing' } GtCoderPrintStringAttribute >> isFocusable [ ^ true ] -{ #category : #private } +{ #category : 'private' } GtCoderPrintStringAttribute >> menuButtonLook [ ^ (BrGlamorousButtonRectangularAptitude new cornerRadius: 0) + BrGlamorousButtonIconAptitude @@ -194,12 +194,12 @@ GtCoderPrintStringAttribute >> menuButtonLook [ + BrGlamorousListItemAptitude ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderPrintStringAttribute >> object: anObject [ object := anObject ] -{ #category : #'private - actions' } +{ #category : 'private - actions' } GtCoderPrintStringAttribute >> removeFromEditorElement: anEditorElement [ anEditorElement text findAttribute: self @@ -211,7 +211,7 @@ GtCoderPrintStringAttribute >> removeFromEditorElement: anEditorElement [ anEditorElement requestFocus ] -{ #category : #'private - actions' } +{ #category : 'private - actions' } GtCoderPrintStringAttribute >> spawnFromElement: anElement [ anElement phlow spawnObject: object ] diff --git a/src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st b/src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st index 5f79aa89d..13a5a9073 100644 --- a/src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st +++ b/src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st @@ -1,13 +1,13 @@ Class { - #name : #GtCoderSpotterStart, - #superclass : #Object, + #name : 'GtCoderSpotterStart', + #superclass : 'Object', #instVars : [ 'navigationModelBlock' ], - #category : #'GToolkit-Coder-UI-Basic' + #category : 'GToolkit-Coder-UI-Basic' } -{ #category : #searching } +{ #category : 'searching' } GtCoderSpotterStart >> gtSpotterForClassMethodsInCurrentClassFor: aStep [ self navigationModel hasSelectedClass @@ -20,7 +20,7 @@ GtCoderSpotterStart >> gtSpotterForClassMethodsInCurrentClassFor: aStep [ wantsToDisplayOnEmptyQuery: true ] -{ #category : #searching } +{ #category : 'searching' } GtCoderSpotterStart >> gtSpotterForClassesFor: aStep [ aStep listProcessor @@ -33,7 +33,7 @@ GtCoderSpotterStart >> gtSpotterForClassesFor: aStep [ wantsToDisplayOnEmptyQuery: self navigationModel hasSelectedClass not ] -{ #category : #searching } +{ #category : 'searching' } GtCoderSpotterStart >> gtSpotterForInstanceMethodsInCurrentClassFor: aStep [ self navigationModel hasSelectedClass @@ -46,7 +46,7 @@ GtCoderSpotterStart >> gtSpotterForInstanceMethodsInCurrentClassFor: aStep [ wantsToDisplayOnEmptyQuery: true ] -{ #category : #searching } +{ #category : 'searching' } GtCoderSpotterStart >> gtSpotterForMessagesFor: aStep [ aStep listProcessor @@ -62,7 +62,7 @@ GtCoderSpotterStart >> gtSpotterForMessagesFor: aStep [ wantsToDisplayOnEmptyQuery: false ] -{ #category : #searching } +{ #category : 'searching' } GtCoderSpotterStart >> gtSpotterForPackagesFor: aStep [ aStep listProcessor @@ -75,7 +75,7 @@ GtCoderSpotterStart >> gtSpotterForPackagesFor: aStep [ wantsToDisplayOnEmptyQuery: self navigationModel hasSelectedPackage not ] -{ #category : #searching } +{ #category : 'searching' } GtCoderSpotterStart >> gtSpotterImplementorsFor: aStep [ self flag: #specialFilter. @@ -90,17 +90,17 @@ GtCoderSpotterStart >> gtSpotterImplementorsFor: aStep [ wantsToDisplayOnEmptyQuery: false ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderSpotterStart >> navigationModel [ ^ navigationModelBlock value ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderSpotterStart >> navigationModelBlock: aBlock [ navigationModelBlock := aBlock ] -{ #category : #printing } +{ #category : 'printing' } GtCoderSpotterStart >> printOn: aStream [ aStream nextPutAll: 'Spotter' ] diff --git a/src/GToolkit-Coder-UI/GtCoderToReplace.class.st b/src/GToolkit-Coder-UI/GtCoderToReplace.class.st index 7fca458a2..5d53fe746 100644 --- a/src/GToolkit-Coder-UI/GtCoderToReplace.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToReplace.class.st @@ -4,22 +4,22 @@ I am fired by inner coders to tell {{gtClass:GtCoder}} to replace its current co " Class { - #name : #GtCoderToReplace, - #superclass : #BlEvent, + #name : 'GtCoderToReplace', + #superclass : 'BlEvent', #instVars : [ 'coder' ], - #category : #'GToolkit-Coder-UI-! Core' + #category : 'GToolkit-Coder-UI-! Core' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderToReplace >> coder [ ^ coder ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderToReplace >> coder: aGtCoderModel [ coder := aGtCoderModel ] diff --git a/src/GToolkit-Coder-UI/GtCoderToSpawn.class.st b/src/GToolkit-Coder-UI/GtCoderToSpawn.class.st index 05c656acd..c4d68324a 100644 --- a/src/GToolkit-Coder-UI/GtCoderToSpawn.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToSpawn.class.st @@ -4,22 +4,22 @@ I am fired by inner coders to tell {{gtClass:GtCoder}} to spawn a new coder usin " Class { - #name : #GtCoderToSpawn, - #superclass : #BlEvent, + #name : 'GtCoderToSpawn', + #superclass : 'BlEvent', #instVars : [ 'coder' ], - #category : #'GToolkit-Coder-UI-! Core' + #category : 'GToolkit-Coder-UI-! Core' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderToSpawn >> coder [ ^ coder ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderToSpawn >> coder: aGtCoderModel [ coder := aGtCoderModel ] diff --git a/src/GToolkit-Coder-UI/GtCoderToSpawnInSpace.class.st b/src/GToolkit-Coder-UI/GtCoderToSpawnInSpace.class.st index 8bb5a94bd..fce2c694a 100644 --- a/src/GToolkit-Coder-UI/GtCoderToSpawnInSpace.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToSpawnInSpace.class.st @@ -4,7 +4,7 @@ I am fired by inner coders to tell {{gtClass:GtCoder}} to spawn a new coder in a " Class { - #name : #GtCoderToSpawnInSpace, - #superclass : #BlEvent, - #category : #'GToolkit-Coder-UI-! Core' + #name : 'GtCoderToSpawnInSpace', + #superclass : 'BlEvent', + #category : 'GToolkit-Coder-UI-! Core' } diff --git a/src/GToolkit-Coder-UI/GtCoderToggleAptitude.class.st b/src/GToolkit-Coder-UI/GtCoderToggleAptitude.class.st index 86f662daf..9f44f0d34 100644 --- a/src/GToolkit-Coder-UI/GtCoderToggleAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToggleAptitude.class.st @@ -1,15 +1,15 @@ Class { - #name : #GtCoderToggleAptitude, - #superclass : #BrMaterialToggleBackgroundAptitude, - #category : #'GToolkit-Coder-UI-Looks' + #name : 'GtCoderToggleAptitude', + #superclass : 'BrMaterialToggleBackgroundAptitude', + #category : 'GToolkit-Coder-UI-Looks' } -{ #category : #initialization } +{ #category : 'initialization' } GtCoderToggleAptitude >> defaultNormalBackground [ ^ Color transparent ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderToggleAptitude >> initialize [ | interactiveLook | super initialize. @@ -37,7 +37,7 @@ GtCoderToggleAptitude >> initialize [ yourself) ] -{ #category : #private } +{ #category : 'private' } GtCoderToggleAptitude >> updateActivatedBackground [ self widget isActivated ifTrue: [ self toggleActivated ] diff --git a/src/GToolkit-Coder-UI/GtCoderTool.class.st b/src/GToolkit-Coder-UI/GtCoderTool.class.st index 44dad7343..6c86c1ad0 100644 --- a/src/GToolkit-Coder-UI/GtCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtCoderTool.class.st @@ -1,32 +1,32 @@ Class { - #name : #GtCoderTool, - #superclass : #GtPhlowTool, - #category : #'GToolkit-Coder-UI-Tools' + #name : 'GtCoderTool', + #superclass : 'GtPhlowTool', + #category : 'GToolkit-Coder-UI-Tools' } -{ #category : #converting } +{ #category : 'converting' } GtCoderTool >> asElementDo: aOneArgBlock [ "Create a tool element and execute the block." ^ aOneArgBlock cull: self newCoder asPagerPageElement ] -{ #category : #'api - converting' } +{ #category : 'api - converting' } GtCoderTool >> icon [ ^ BrGlamorousVectorIcons browse ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtCoderTool >> name [ ^ 'coder' ] -{ #category : #converting } +{ #category : 'converting' } GtCoderTool >> newCoder [ ^ self subclassResponsibility ] -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtCoderTool >> tabLook [ ^ BrGlamorousTabSwitcherWithIconAptitude ] diff --git a/src/GToolkit-Coder-UI/GtCoderToolViewModel.class.st b/src/GToolkit-Coder-UI/GtCoderToolViewModel.class.st index 90d76f429..7dd419e53 100644 --- a/src/GToolkit-Coder-UI/GtCoderToolViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToolViewModel.class.st @@ -1,56 +1,56 @@ Class { - #name : #GtCoderToolViewModel, - #superclass : #Object, + #name : 'GtCoderToolViewModel', + #superclass : 'Object', #traits : 'TGtAnnouncer', #classTraits : 'TGtAnnouncer classTrait', #instVars : [ 'coderViewModelsStack', 'announcer' ], - #category : #'GToolkit-Coder-UI-! Core - View Models' + #category : 'GToolkit-Coder-UI-! Core - View Models' } -{ #category : #announcer } +{ #category : 'announcer' } GtCoderToolViewModel >> announcer [ ^ announcer ifNil: [ announcer := Announcer new ] ] -{ #category : #'api - coder tool' } +{ #category : 'api - coder tool' } GtCoderToolViewModel >> canGoBack [ ^ coderViewModelsStack size > 1 ] -{ #category : #'api - coder tool' } +{ #category : 'api - coder tool' } GtCoderToolViewModel >> currentCoderViewModel [ ^ coderViewModelsStack top ] -{ #category : #'api - coder tool' } +{ #category : 'api - coder tool' } GtCoderToolViewModel >> hasCoderViewModel [ ^ coderViewModelsStack isNotEmpty ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderToolViewModel >> initialize [ super initialize. coderViewModelsStack := Stack new ] -{ #category : #'private - notifying' } +{ #category : 'private - notifying' } GtCoderToolViewModel >> notifyCoderViewModelPopped: aCoderViewModel [ self announce: (GtCoderToolViewModelCoderPopped new coderViewModel: aCoderViewModel) ] -{ #category : #'private - notifying' } +{ #category : 'private - notifying' } GtCoderToolViewModel >> notifyCoderViewModelPushed: aCoderViewModel [ self announce: (GtCoderToolViewModelCoderPushed new coderViewModel: aCoderViewModel) ] -{ #category : #'api - coder tool' } +{ #category : 'api - coder tool' } GtCoderToolViewModel >> popCoderViewModel [ | aPoppedCoder | @@ -61,7 +61,7 @@ GtCoderToolViewModel >> popCoderViewModel [ self notifyCoderViewModelPopped: aPoppedCoder ] -{ #category : #'api - coder tool' } +{ #category : 'api - coder tool' } GtCoderToolViewModel >> pushCoderViewModel: aCoderViewModel [ coderViewModelsStack push: aCoderViewModel. self notifyCoderViewModelPushed: aCoderViewModel diff --git a/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderPopped.class.st b/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderPopped.class.st index d19d88b6c..99bcb2e55 100644 --- a/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderPopped.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderPopped.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtCoderToolViewModelCoderPopped, - #superclass : #GtCoderToolViewModelCoderStackChanged, - #category : #'GToolkit-Coder-UI-! Core - View Models' + #name : 'GtCoderToolViewModelCoderPopped', + #superclass : 'GtCoderToolViewModelCoderStackChanged', + #category : 'GToolkit-Coder-UI-! Core - View Models' } diff --git a/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderPushed.class.st b/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderPushed.class.st index 8c97e1424..a360f4f28 100644 --- a/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderPushed.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderPushed.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtCoderToolViewModelCoderPushed, - #superclass : #GtCoderToolViewModelCoderStackChanged, - #category : #'GToolkit-Coder-UI-! Core - View Models' + #name : 'GtCoderToolViewModelCoderPushed', + #superclass : 'GtCoderToolViewModelCoderStackChanged', + #category : 'GToolkit-Coder-UI-! Core - View Models' } diff --git a/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderStackChanged.class.st b/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderStackChanged.class.st index 6c4872a12..c097c5472 100644 --- a/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderStackChanged.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderStackChanged.class.st @@ -1,18 +1,18 @@ Class { - #name : #GtCoderToolViewModelCoderStackChanged, - #superclass : #Announcement, + #name : 'GtCoderToolViewModelCoderStackChanged', + #superclass : 'Announcement', #instVars : [ 'coderViewModel' ], - #category : #'GToolkit-Coder-UI-! Core - View Models' + #category : 'GToolkit-Coder-UI-! Core - View Models' } -{ #category : #accessing } +{ #category : 'accessing' } GtCoderToolViewModelCoderStackChanged >> coderViewModel [ ^ coderViewModel ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderToolViewModelCoderStackChanged >> coderViewModel: anObject [ coderViewModel := anObject ] diff --git a/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st b/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st index 37df61b05..a131ee193 100644 --- a/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st @@ -7,15 +7,15 @@ I display a {{gtClass:BrToolbar}}. " Class { - #name : #GtCoderToolbarElement, - #superclass : #GtCoderNavigationModelElement, + #name : 'GtCoderToolbarElement', + #superclass : 'GtCoderNavigationModelElement', #instVars : [ 'toolbarElement' ], - #category : #'GToolkit-Coder-UI-Basic' + #category : 'GToolkit-Coder-UI-Basic' } -{ #category : #'gt-extensions' } +{ #category : 'gt-extensions' } GtCoderToolbarElement >> addClassTab: look [ ^ BrTab new @@ -35,7 +35,7 @@ GtCoderToolbarElement >> addClassTab: look [ element ] ] -{ #category : #'gt-extensions' } +{ #category : 'gt-extensions' } GtCoderToolbarElement >> addPackageTab: look [ ^ BrTab new @@ -54,7 +54,7 @@ GtCoderToolbarElement >> addPackageTab: look [ element ] ] -{ #category : #'gt-extensions' } +{ #category : 'gt-extensions' } GtCoderToolbarElement >> addTraitTab: look [ ^ BrTab new @@ -74,7 +74,7 @@ GtCoderToolbarElement >> addTraitTab: look [ element ] ] -{ #category : #'private - actions' } +{ #category : 'private - actions' } GtCoderToolbarElement >> browseFrom: anElement [ "Do we want to share the same coder model?" self navigationModel coderDo: [ :aCoder | @@ -83,7 +83,7 @@ GtCoderToolbarElement >> browseFrom: anElement [ maximized ] ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderToolbarElement >> initialize [ super initialize. self initializeToolbarElement. @@ -97,7 +97,7 @@ GtCoderToolbarElement >> initialize [ anyToFitContent: self toolbarElement) ] -{ #category : #initialization } +{ #category : 'initialization' } GtCoderToolbarElement >> initializeToolbarElement [ toolbarElement := BrToolbar new aptitude: BrGlamorousToolbarAptitude new; @@ -114,7 +114,7 @@ GtCoderToolbarElement >> initializeToolbarElement [ yourself ] -{ #category : #'private - instance creation' } +{ #category : 'private - instance creation' } GtCoderToolbarElement >> newAddButton [ | look | ^ BrButton new @@ -141,7 +141,7 @@ GtCoderToolbarElement >> newAddButton [ yourself ] -{ #category : #'private - instance creation' } +{ #category : 'private - instance creation' } GtCoderToolbarElement >> newAddInterface: look [ | contentTabs tabMethods | contentTabs := BrTabGroup new. @@ -158,7 +158,7 @@ GtCoderToolbarElement >> newAddInterface: look [ ^ contentTabs ] -{ #category : #'private - instance creation' } +{ #category : 'private - instance creation' } GtCoderToolbarElement >> newBrowseButton [ ^ BrButton new aptitude: BrGlamorousButtonWithIconAptitude; @@ -167,7 +167,7 @@ GtCoderToolbarElement >> newBrowseButton [ action: [ :aButton | self browseFrom: aButton ] ] -{ #category : #'private - instance creation' } +{ #category : 'private - instance creation' } GtCoderToolbarElement >> newHierarchyButton [ ^ BrButton new label: 'Show Package and Class Hierarchies'; @@ -187,7 +187,7 @@ GtCoderToolbarElement >> newHierarchyButton [ yourself ] -{ #category : #'private - instance creation' } +{ #category : 'private - instance creation' } GtCoderToolbarElement >> newSpotterButton [ @@ -207,7 +207,7 @@ GtCoderToolbarElement >> newSpotterButton [ asElement. ] -{ #category : #accessing } +{ #category : 'accessing' } GtCoderToolbarElement >> toolbarElement [ ^ toolbarElement diff --git a/src/GToolkit-Coder-UI/GtCodersModel.extension.st b/src/GToolkit-Coder-UI/GtCodersModel.extension.st index b144255a3..b3a373ec1 100644 --- a/src/GToolkit-Coder-UI/GtCodersModel.extension.st +++ b/src/GToolkit-Coder-UI/GtCodersModel.extension.st @@ -1,11 +1,11 @@ -Extension { #name : #GtCodersModel } +Extension { #name : 'GtCodersModel' } -{ #category : #'*GToolkit-Coder-UI' } +{ #category : '*GToolkit-Coder-UI' } GtCodersModel >> asCoderUIModel [ ^ self subclassResponsibility ] -{ #category : #'*GToolkit-Coder-UI' } +{ #category : '*GToolkit-Coder-UI' } GtCodersModel >> asElement [ ^ self asCoderUIModel asElement ] diff --git a/src/GToolkit-Coder-UI/GtContextCoderVariableAptitude.class.st b/src/GToolkit-Coder-UI/GtContextCoderVariableAptitude.class.st index 357fdfacf..65a2d7746 100644 --- a/src/GToolkit-Coder-UI/GtContextCoderVariableAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtContextCoderVariableAptitude.class.st @@ -1,13 +1,13 @@ Class { - #name : #GtContextCoderVariableAptitude, - #superclass : #BrAptitude, + #name : 'GtContextCoderVariableAptitude', + #superclass : 'BrAptitude', #instVars : [ 'methodCoder' ], - #category : #'GToolkit-Coder-UI-Looks' + #category : 'GToolkit-Coder-UI-Looks' } -{ #category : #initialization } +{ #category : 'initialization' } GtContextCoderVariableAptitude >> initialize [ super initialize. self @@ -22,17 +22,17 @@ GtContextCoderVariableAptitude >> initialize [ yourself) ] -{ #category : #accessing } +{ #category : 'accessing' } GtContextCoderVariableAptitude >> methodCoder [ ^ methodCoder ] -{ #category : #accessing } +{ #category : 'accessing' } GtContextCoderVariableAptitude >> methodCoder: contextCoder [ methodCoder := contextCoder ] -{ #category : #private } +{ #category : 'private' } GtContextCoderVariableAptitude >> variables [ | vars | vars := OrderedCollection new. @@ -44,7 +44,7 @@ GtContextCoderVariableAptitude >> variables [ ^ vars ] -{ #category : #initialization } +{ #category : 'initialization' } GtContextCoderVariableAptitude >> variablesElement [ | variablesElement | variablesElement := BrColumnedList new. diff --git a/src/GToolkit-Coder-UI/GtCreateElement.class.st b/src/GToolkit-Coder-UI/GtCreateElement.class.st index 9b545e2ca..634652361 100644 --- a/src/GToolkit-Coder-UI/GtCreateElement.class.st +++ b/src/GToolkit-Coder-UI/GtCreateElement.class.st @@ -1,15 +1,15 @@ Class { - #name : #GtCreateElement, - #superclass : #BlElement, + #name : 'GtCreateElement', + #superclass : 'BlElement', #traits : 'TBrLayoutResizable', #classTraits : 'TBrLayoutResizable classTrait', #instVars : [ 'definition' ], - #category : #'GToolkit-Coder-UI-Behaviour' + #category : 'GToolkit-Coder-UI-Behaviour' } -{ #category : #'private - instance creation' } +{ #category : 'private - instance creation' } GtCreateElement >> buildSectionLabel: aSectionName [ ^ BrLabel new @@ -20,12 +20,12 @@ GtCreateElement >> buildSectionLabel: aSectionName [ constraintsDo: [ :c | c grid horizontal alignLeft ] ] -{ #category : #'private - ui' } +{ #category : 'private - ui' } GtCreateElement >> buttonMargin [ ^ BlInsets top: 3 left: 0 bottom: 3 right: 5 ] -{ #category : #'private - ui' } +{ #category : 'private - ui' } GtCreateElement >> editableLabelLook [ ^ BrGlamorousEditableLabelAptitude new glamorousCodeFont; @@ -33,7 +33,7 @@ GtCreateElement >> editableLabelLook [ fontSize: 10 ] -{ #category : #initialization } +{ #category : 'initialization' } GtCreateElement >> initialize [ super initialize. self layout: BlFlowLayout vertical. diff --git a/src/GToolkit-Coder-UI/GtDiffAptitude.class.st b/src/GToolkit-Coder-UI/GtDiffAptitude.class.st index 501fb928b..e0e3d02ec 100644 --- a/src/GToolkit-Coder-UI/GtDiffAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtDiffAptitude.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtDiffAptitude, - #superclass : #BrAptitude, - #category : #'GToolkit-Coder-UI-Diff' + #name : 'GtDiffAptitude', + #superclass : 'BrAptitude', + #category : 'GToolkit-Coder-UI-Diff' } -{ #category : #initialization } +{ #category : 'initialization' } GtDiffAptitude >> initialize [ super initialize. diff --git a/src/GToolkit-Coder-UI/GtDiffElement.class.st b/src/GToolkit-Coder-UI/GtDiffElement.class.st index 21c84931a..24c23fc49 100644 --- a/src/GToolkit-Coder-UI/GtDiffElement.class.st +++ b/src/GToolkit-Coder-UI/GtDiffElement.class.st @@ -1,6 +1,6 @@ Class { - #name : #GtDiffElement, - #superclass : #BlElement, + #name : 'GtDiffElement', + #superclass : 'BlElement', #traits : 'TBrLayoutResizable + TBrSizeAdjustable', #classTraits : 'TBrLayoutResizable classTrait + TBrSizeAdjustable classTrait', #instVars : [ @@ -11,37 +11,37 @@ Class { 'outlines', 'separatorElement' ], - #category : #'GToolkit-Coder-UI-Diff' + #category : 'GToolkit-Coder-UI-Diff' } -{ #category : #examples } +{ #category : 'examples' } GtDiffElement class >> example [ ^ self on: self exampleDiff ] -{ #category : #examples } +{ #category : 'examples' } GtDiffElement class >> exampleDiff [ ^ TextDiffBuilder from: self originalString to: self newString ] -{ #category : #examples } +{ #category : 'examples' } GtDiffElement class >> exampleFlat [ ^ (self on: self exampleDiff) aptitude: GtDiffFlatAptitude ] -{ #category : #examples } +{ #category : 'examples' } GtDiffElement class >> exampleShadow [ ^ (self on: self exampleDiff) aptitude: GtDiffShadowAptitude ] -{ #category : #examples } +{ #category : 'examples' } GtDiffElement class >> newString [ ^ String @@ -56,14 +56,14 @@ GtDiffElement class >> newString [ cr ] ] ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtDiffElement class >> on: aDiffBuilder [ ^ self new diff: aDiffBuilder; yourself ] -{ #category : #examples } +{ #category : 'examples' } GtDiffElement class >> originalString [ ^ String @@ -78,7 +78,7 @@ GtDiffElement class >> originalString [ cr ] ] ] -{ #category : #private } +{ #category : 'private' } GtDiffElement >> buildInterface [ syncScrollRanges := GtSyncScrollRanges createFromDiff: diff. @@ -91,13 +91,13 @@ GtDiffElement >> buildInterface [ self updateOutlines ] -{ #category : #initialize } +{ #category : 'initialize' } GtDiffElement >> diff: aDiffBuilder [ diff := aDiffBuilder. self buildInterface ] -{ #category : #'event handling' } +{ #category : 'event handling' } GtDiffElement >> drawMeAndChildrenOnSpartaCanvas: aCanvas [ | stroke fill | super drawMeAndChildrenOnSpartaCanvas: aCanvas. @@ -118,12 +118,12 @@ GtDiffElement >> drawMeAndChildrenOnSpartaCanvas: aCanvas [ draw ] ] -{ #category : #initialize } +{ #category : 'initialize' } GtDiffElement >> editorLook [ ^ BrGlamorousCodeEditorAptitude ] -{ #category : #initialize } +{ #category : 'initialize' } GtDiffElement >> initialize [ super initialize. @@ -152,7 +152,7 @@ GtDiffElement >> initialize [ }. ] -{ #category : #'event handling' } +{ #category : 'event handling' } GtDiffElement >> leftBottomFor: anInteger [ | range element | range := self leftRange. @@ -165,12 +165,12 @@ GtDiffElement >> leftBottomFor: anInteger [ max: 0 ] -{ #category : #accessing } +{ #category : 'accessing' } GtDiffElement >> leftEditorLook: aLook [ leftElement aptitude: aLook ] -{ #category : #private } +{ #category : 'private' } GtDiffElement >> leftRange [ | first | first := (leftElement instVarNamed: 'layoutPositionsRange') @@ -179,7 +179,7 @@ GtDiffElement >> leftRange [ ^ first to: first + leftElement children size - 1 ] -{ #category : #'event handling' } +{ #category : 'event handling' } GtDiffElement >> leftScrolled [ | newPosition | newPosition := syncScrollRanges rightLineFor: self leftRange first. @@ -194,12 +194,12 @@ GtDiffElement >> leftScrolled [ self updateOutlines ] -{ #category : #accessing } +{ #category : 'accessing' } GtDiffElement >> leftStyler: aStyler [ leftElement editor styler: aStyler ] -{ #category : #'event handling' } +{ #category : 'event handling' } GtDiffElement >> leftTopFor: anInteger [ | range element | range := self leftRange. @@ -212,12 +212,12 @@ GtDiffElement >> leftTopFor: anInteger [ max: 0 ] -{ #category : #private } +{ #category : 'private' } GtDiffElement >> newRopedText [ ^ diff newRopedText ] -{ #category : #initialize } +{ #category : 'initialize' } GtDiffElement >> newSeparatorElement [ ^ BlElement new constraintsDo: [ :c | @@ -226,7 +226,7 @@ GtDiffElement >> newSeparatorElement [ yourself ] -{ #category : #initialize } +{ #category : 'initialize' } GtDiffElement >> newTextElement [ ^ BrEditor new focusability: BlFocusability none; @@ -235,14 +235,14 @@ GtDiffElement >> newTextElement [ aptitude: self editorLook ] -{ #category : #'geometry hooks' } +{ #category : 'geometry hooks' } GtDiffElement >> notifyExtentChanged [ super notifyExtentChanged. outlines := #(). self updateOutlines ] -{ #category : #'event handling' } +{ #category : 'event handling' } GtDiffElement >> outlineFor: aSyncScrollRange [ | leftTop leftBottom rightTop rightBottom vertices leftBounds rightBounds | leftTop := self leftTopFor: aSyncScrollRange leftFirst + 1. @@ -265,12 +265,12 @@ GtDiffElement >> outlineFor: aSyncScrollRange [ ^ BlPolyline vertices: vertices ] -{ #category : #private } +{ #category : 'private' } GtDiffElement >> previousRopedText [ ^ diff previousRopedText ] -{ #category : #'event handling' } +{ #category : 'event handling' } GtDiffElement >> rightBottomFor: anInteger [ | range element | range := self rightRange. @@ -283,12 +283,12 @@ GtDiffElement >> rightBottomFor: anInteger [ max: 0 ] -{ #category : #accessing } +{ #category : 'accessing' } GtDiffElement >> rightEditorLook: aLook [ rightElement aptitude: aLook ] -{ #category : #private } +{ #category : 'private' } GtDiffElement >> rightRange [ | first | first := (rightElement instVarNamed: 'layoutPositionsRange') @@ -297,7 +297,7 @@ GtDiffElement >> rightRange [ ^ first to: first + rightElement children size - 1 ] -{ #category : #'event handling' } +{ #category : 'event handling' } GtDiffElement >> rightScrolled [ | newPosition | newPosition := syncScrollRanges leftLineFor: self rightRange first. @@ -312,12 +312,12 @@ GtDiffElement >> rightScrolled [ self updateOutlines ] -{ #category : #accessing } +{ #category : 'accessing' } GtDiffElement >> rightStyler: aStyler [ rightElement editor styler: aStyler ] -{ #category : #'event handling' } +{ #category : 'event handling' } GtDiffElement >> rightTopFor: anInteger [ | range element | range := self rightRange. @@ -330,7 +330,7 @@ GtDiffElement >> rightTopFor: anInteger [ max: 0 ] -{ #category : #'event handling' } +{ #category : 'event handling' } GtDiffElement >> updateOutlines [ | ranges | outlines := OrderedCollection new. diff --git a/src/GToolkit-Coder-UI/GtDiffElementId.class.st b/src/GToolkit-Coder-UI/GtDiffElementId.class.st index 87876934e..a0387ad4c 100644 --- a/src/GToolkit-Coder-UI/GtDiffElementId.class.st +++ b/src/GToolkit-Coder-UI/GtDiffElementId.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtDiffElementId, - #superclass : #BlElementUniqueId, - #category : #'GToolkit-Coder-UI-Diff' + #name : 'GtDiffElementId', + #superclass : 'BlElementUniqueId', + #category : 'GToolkit-Coder-UI-Diff' } -{ #category : #testing } +{ #category : 'testing' } GtDiffElementId class >> isAbstract [ ^ self = GtDiffElementId ] diff --git a/src/GToolkit-Coder-UI/GtDiffFlatAptitude.class.st b/src/GToolkit-Coder-UI/GtDiffFlatAptitude.class.st index 9a737c959..801c24966 100644 --- a/src/GToolkit-Coder-UI/GtDiffFlatAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtDiffFlatAptitude.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtDiffFlatAptitude, - #superclass : #GtDiffAptitude, - #category : #'GToolkit-Coder-UI-Diff' + #name : 'GtDiffFlatAptitude', + #superclass : 'GtDiffAptitude', + #category : 'GToolkit-Coder-UI-Diff' } -{ #category : #initialization } +{ #category : 'initialization' } GtDiffFlatAptitude >> initialize [ super initialize. @@ -17,7 +17,7 @@ GtDiffFlatAptitude >> initialize [ self add: (self newTextLook // GtDiffNewTextId) ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtDiffFlatAptitude >> newTextLook [ ^ BrSizeAdjustmentAptitude new normal: [ :aStyle | diff --git a/src/GToolkit-Coder-UI/GtDiffNewTextId.class.st b/src/GToolkit-Coder-UI/GtDiffNewTextId.class.st index c927ea00b..881e3034f 100644 --- a/src/GToolkit-Coder-UI/GtDiffNewTextId.class.st +++ b/src/GToolkit-Coder-UI/GtDiffNewTextId.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtDiffNewTextId, - #superclass : #GtDiffElementId, - #category : #'GToolkit-Coder-UI-Diff' + #name : 'GtDiffNewTextId', + #superclass : 'GtDiffElementId', + #category : 'GToolkit-Coder-UI-Diff' } -{ #category : #converting } +{ #category : 'converting' } GtDiffNewTextId >> asSymbol [ ^ #'diff--new-text' ] diff --git a/src/GToolkit-Coder-UI/GtDiffOldTextId.class.st b/src/GToolkit-Coder-UI/GtDiffOldTextId.class.st index 3898ccf7f..325a7f201 100644 --- a/src/GToolkit-Coder-UI/GtDiffOldTextId.class.st +++ b/src/GToolkit-Coder-UI/GtDiffOldTextId.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtDiffOldTextId, - #superclass : #GtDiffElementId, - #category : #'GToolkit-Coder-UI-Diff' + #name : 'GtDiffOldTextId', + #superclass : 'GtDiffElementId', + #category : 'GToolkit-Coder-UI-Diff' } -{ #category : #converting } +{ #category : 'converting' } GtDiffOldTextId >> asSymbol [ ^ #'diff--old-text' ] diff --git a/src/GToolkit-Coder-UI/GtDiffSeparatorId.class.st b/src/GToolkit-Coder-UI/GtDiffSeparatorId.class.st index 70b70fbf6..ce30ee8c2 100644 --- a/src/GToolkit-Coder-UI/GtDiffSeparatorId.class.st +++ b/src/GToolkit-Coder-UI/GtDiffSeparatorId.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtDiffSeparatorId, - #superclass : #GtDiffElementId, - #category : #'GToolkit-Coder-UI-Diff' + #name : 'GtDiffSeparatorId', + #superclass : 'GtDiffElementId', + #category : 'GToolkit-Coder-UI-Diff' } -{ #category : #converting } +{ #category : 'converting' } GtDiffSeparatorId >> asSymbol [ ^ #'diff--separator' ] diff --git a/src/GToolkit-Coder-UI/GtDiffShadowAptitude.class.st b/src/GToolkit-Coder-UI/GtDiffShadowAptitude.class.st index 18341f689..8aa7fff1a 100644 --- a/src/GToolkit-Coder-UI/GtDiffShadowAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtDiffShadowAptitude.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtDiffShadowAptitude, - #superclass : #GtDiffAptitude, - #category : #'GToolkit-Coder-UI-Diff' + #name : 'GtDiffShadowAptitude', + #superclass : 'GtDiffAptitude', + #category : 'GToolkit-Coder-UI-Diff' } -{ #category : #initialization } +{ #category : 'initialization' } GtDiffShadowAptitude >> initialize [ super initialize. @@ -28,7 +28,7 @@ GtDiffShadowAptitude >> initialize [ self add: (self newShadowLook // GtDiffNewTextId) ] -{ #category : #initialization } +{ #category : 'initialization' } GtDiffShadowAptitude >> newSeparatorLook [ ^ BrSizeAdjustmentAptitude new normal: [ :aStyle | aStyle hExact: 40 ]; @@ -37,7 +37,7 @@ GtDiffShadowAptitude >> newSeparatorLook [ mini: [ :aStyle | aStyle hExact: 10 ] ] -{ #category : #initialization } +{ #category : 'initialization' } GtDiffShadowAptitude >> newShadowLook [ ^ BrStyleCommonAptitude new default: [ :aStyle | @@ -47,7 +47,7 @@ GtDiffShadowAptitude >> newShadowLook [ yourself ] -{ #category : #initialization } +{ #category : 'initialization' } GtDiffShadowAptitude >> newTextLook [ ^ BrSizeAdjustmentAptitude new normal: [ :aStyle | diff --git a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st index cd9827d6a..416d770ff 100644 --- a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st @@ -1,26 +1,26 @@ Class { - #name : #GtExpandableSourceCoderElement, - #superclass : #BrExpander, + #name : 'GtExpandableSourceCoderElement', + #superclass : 'BrExpander', #instVars : [ 'collapsedElement', 'expandedElement', 'coderUIModel' ], - #category : #'GToolkit-Coder-UI-Coder - Source' + #category : 'GToolkit-Coder-UI-Coder - Source' } -{ #category : #private } +{ #category : 'private' } GtExpandableSourceCoderElement >> addCodersCoderLook: aSourceCoder to: anElement [ aSourceCoder coderLook ifNotNil: [ :aCoderLook | anElement addAptitude: aCoderLook ] ] -{ #category : #converting } +{ #category : 'converting' } GtExpandableSourceCoderElement >> asVerticallyResizableDo: aBlock [ ^ self ] -{ #category : #private } +{ #category : 'private' } GtExpandableSourceCoderElement >> assignCollapsedCoder: aSourceCoder to: aCollapsedElement [ aCollapsedElement coderUIModel: aSourceCoder. @@ -31,7 +31,7 @@ GtExpandableSourceCoderElement >> assignCollapsedCoder: aSourceCoder to: aCollap aCollapsedElement addAptitude: GtSourceCoderCollapsedTextAndExampleAptitude ] ] -{ #category : #private } +{ #category : 'private' } GtExpandableSourceCoderElement >> assignExpandedCoder: aSourceCoder to: anExpandedElement [ anExpandedElement coderUIModel: aSourceCoder. @@ -42,7 +42,7 @@ GtExpandableSourceCoderElement >> assignExpandedCoder: aSourceCoder to: anExpand anExpandedElement addAptitude: GtSourceCoderEditorAptitude ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtExpandableSourceCoderElement >> coderUIModel [ self @@ -52,7 +52,7 @@ GtExpandableSourceCoderElement >> coderUIModel [ ^ coderUIModel ] -{ #category : #accessing } +{ #category : 'accessing' } GtExpandableSourceCoderElement >> coderUIModel: aCoderUIModel [ self assert: [ aCoderUIModel isNotNil ] @@ -93,7 +93,7 @@ GtExpandableSourceCoderElement >> coderUIModel: aCoderUIModel [ when: GtTextualCoderViewModelExpansionChanged send: #onViewModelExpansionChanged: to: self ] -{ #category : #accessing } +{ #category : 'accessing' } GtExpandableSourceCoderElement >> gtAllShortcutsFor: aView [ self shortcuts ifEmpty: [ ^ aView empty ]. @@ -106,7 +106,7 @@ GtExpandableSourceCoderElement >> gtAllShortcutsFor: aView [ column: 'Action' item: [ :each | each action asString ] ] -{ #category : #initialization } +{ #category : 'initialization' } GtExpandableSourceCoderElement >> initialize [ super initialize. @@ -127,19 +127,19 @@ GtExpandableSourceCoderElement >> initialize [ content: [ expandedElement := self newExpandedElement ] ] -{ #category : #private } +{ #category : 'private' } GtExpandableSourceCoderElement >> isDirty: anElement [ ^ anElement userData at: #coderDirty ifAbsent: [ false ] ] -{ #category : #private } +{ #category : 'private' } GtExpandableSourceCoderElement >> markDirty: anElement as: aBoolean [ anElement userData at: #coderDirty put: aBoolean ] -{ #category : #private } +{ #category : 'private' } GtExpandableSourceCoderElement >> newCollapsedElement [ | aCollapsedElement | aCollapsedElement := GtSourceCoderCollapsedContentElement new. @@ -150,7 +150,7 @@ GtExpandableSourceCoderElement >> newCollapsedElement [ ^ aCollapsedElement ] -{ #category : #private } +{ #category : 'private' } GtExpandableSourceCoderElement >> newExpandedElement [ | anExpandedElement | anExpandedElement := GtSourceCoderExpandedContentElement new. @@ -161,7 +161,7 @@ GtExpandableSourceCoderElement >> newExpandedElement [ ^ anExpandedElement ] -{ #category : #private } +{ #category : 'private' } GtExpandableSourceCoderElement >> onCollapsed [ self beInSingleCompositionLayer. @@ -171,7 +171,7 @@ GtExpandableSourceCoderElement >> onCollapsed [ ifTrue: [ self assignCollapsedCoder: aCoderUIModel to: collapsedElement ] ] ] -{ #category : #private } +{ #category : 'private' } GtExpandableSourceCoderElement >> onExpanded [ self beInSeparateCompositionLayer. @@ -181,16 +181,16 @@ GtExpandableSourceCoderElement >> onExpanded [ ifTrue: [ self assignExpandedCoder: aCoderUIModel to: expandedElement ] ] ] -{ #category : #events } +{ #category : 'events' } GtExpandableSourceCoderElement >> onMethodRemoved: anAnnouncement [ ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtExpandableSourceCoderElement >> onViewModelExpansionChanged: anAnnouncement [ self expanded: anAnnouncement expanded ] -{ #category : #'focus requesting' } +{ #category : 'focus requesting' } GtExpandableSourceCoderElement >> requestFocus [ self childNamed: #editor @@ -198,7 +198,7 @@ GtExpandableSourceCoderElement >> requestFocus [ ifNone: [ super requestFocus ] ] -{ #category : #'focus requesting' } +{ #category : 'focus requesting' } GtExpandableSourceCoderElement >> requestFocusAsyncronously [ ^ self enqueueTask: diff --git a/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st b/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st index d7775bb5c..bbf85d8cf 100644 --- a/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st @@ -1,25 +1,25 @@ Class { - #name : #GtExpandedOnlyCoderElement, - #superclass : #BrVerticalPane, + #name : 'GtExpandedOnlyCoderElement', + #superclass : 'BrVerticalPane', #instVars : [ 'coderUIModel', 'expandedElement' ], - #category : #'GToolkit-Coder-UI-Coder - Source' + #category : 'GToolkit-Coder-UI-Coder - Source' } -{ #category : #adding } +{ #category : 'adding' } GtExpandedOnlyCoderElement >> addCodersCoderLook: aSourceCoder to: anElement [ aSourceCoder coderLook ifNotNil: [ :aCoderLook | anElement addAptitude: aCoderLook ] ] -{ #category : #converting } +{ #category : 'converting' } GtExpandedOnlyCoderElement >> asVerticallyResizableDo: aBlock [ ^ self ] -{ #category : #accessing } +{ #category : 'accessing' } GtExpandedOnlyCoderElement >> coder: aCoderUIModel [ self @@ -29,12 +29,12 @@ GtExpandedOnlyCoderElement >> coder: aCoderUIModel [ ^ self coderUIModel: aCoderUIModel ] -{ #category : #accessing } +{ #category : 'accessing' } GtExpandedOnlyCoderElement >> coderUIModel [ ^ coderUIModel ] -{ #category : #accessing } +{ #category : 'accessing' } GtExpandedOnlyCoderElement >> coderUIModel: aCoderUIModel [ self @@ -59,7 +59,7 @@ GtExpandedOnlyCoderElement >> coderUIModel: aCoderUIModel [ to: self ] -{ #category : #initialization } +{ #category : 'initialization' } GtExpandedOnlyCoderElement >> initialize [ super initialize. @@ -69,7 +69,7 @@ GtExpandedOnlyCoderElement >> initialize [ margin: (BlInsets all: 10) ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtExpandedOnlyCoderElement >> newExpandedElement: aCoderModel [ ^ GtSourceCoderExpandedContentElement new coderUIModel: aCoderModel; @@ -78,7 +78,7 @@ GtExpandedOnlyCoderElement >> newExpandedElement: aCoderModel [ yourself ] -{ #category : #'focus requesting' } +{ #category : 'focus requesting' } GtExpandedOnlyCoderElement >> requestFocus [ self childNamed: #editor @@ -86,7 +86,7 @@ GtExpandedOnlyCoderElement >> requestFocus [ ifNone: [ super requestFocus ] ] -{ #category : #'focus requesting' } +{ #category : 'focus requesting' } GtExpandedOnlyCoderElement >> requestFocusAsyncronously [ ^ self enqueueTask: diff --git a/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st b/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st index e0e92263b..00c9aebf4 100644 --- a/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st +++ b/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st @@ -9,8 +9,8 @@ See {{gtClass:GtFiltersElement}} for an example. " Class { - #name : #GtFilterDescriptor, - #superclass : #Object, + #name : 'GtFilterDescriptor', + #superclass : 'Object', #instVars : [ 'name', 'order', @@ -20,10 +20,10 @@ Class { 'valueIsRequired', 'isDefault' ], - #category : #'GToolkit-Coder-UI-Filters' + #category : 'GToolkit-Coder-UI-Filters' } -{ #category : #'instace creation' } +{ #category : 'instace creation' } GtFilterDescriptor class >> creator: aBlock named: aString order: anInteger [ ^ self new creationBlock: aBlock; @@ -32,7 +32,7 @@ GtFilterDescriptor class >> creator: aBlock named: aString order: anInteger [ yourself ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtFilterDescriptor class >> creator: aBlock named: aString order: anInteger completion: completionStrategy [ ^ self new creationBlock: aBlock; @@ -42,7 +42,7 @@ GtFilterDescriptor class >> creator: aBlock named: aString order: anInteger comp yourself ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtFilterDescriptor class >> creator: aBlock named: aString order: anInteger completion: completionStrategy emptyDefaultValue: defaultValueString [ ^ self new creationBlock: aBlock; @@ -53,38 +53,38 @@ GtFilterDescriptor class >> creator: aBlock named: aString order: anInteger comp yourself ] -{ #category : #'initialize-release' } +{ #category : 'initialize-release' } GtFilterDescriptor >> beNotDefault [ "Do not display this particular descriptor filter as a default filter" isDefault := false ] -{ #category : #accessing } +{ #category : 'accessing' } GtFilterDescriptor >> completion [ ^ completion ] -{ #category : #accessing } +{ #category : 'accessing' } GtFilterDescriptor >> completion: completionStrategy [ completion := completionStrategy ] -{ #category : #accessing } +{ #category : 'accessing' } GtFilterDescriptor >> creationBlock: aBlock [ creationBlock := aBlock ] -{ #category : #accessing } +{ #category : 'accessing' } GtFilterDescriptor >> emptyDefaultValue [ ^ emptyDefaultValue ] -{ #category : #accessing } +{ #category : 'accessing' } GtFilterDescriptor >> emptyDefaultValue: aString [ emptyDefaultValue := aString ] -{ #category : #'gt-extensions' } +{ #category : 'gt-extensions' } GtFilterDescriptor >> gtCompletionsFor: aView [ self completion ifNil: [ ^ aView empty ]. @@ -96,39 +96,39 @@ GtFilterDescriptor >> gtCompletionsFor: aView [ view: #gtCompletionsFor: ] -{ #category : #'initialize-release' } +{ #category : 'initialize-release' } GtFilterDescriptor >> initialize [ super initialize. valueIsRequired := true. isDefault := true. ] -{ #category : #accessing } +{ #category : 'accessing' } GtFilterDescriptor >> name [ ^ name ] -{ #category : #accessing } +{ #category : 'accessing' } GtFilterDescriptor >> name: aString [ name := aString ] -{ #category : #filters } +{ #category : 'filters' } GtFilterDescriptor >> newFilterWithValue: aString [ ^ creationBlock value: aString ] -{ #category : #accessing } +{ #category : 'accessing' } GtFilterDescriptor >> order [ ^ order ] -{ #category : #accessing } +{ #category : 'accessing' } GtFilterDescriptor >> order: anInteger [ order := anInteger ] -{ #category : #printing } +{ #category : 'printing' } GtFilterDescriptor >> printOn: aStream [ self name ifNil: [ ^ super printOn: aStream ]. aStream @@ -139,17 +139,17 @@ GtFilterDescriptor >> printOn: aStream [ nextPutAll: ')' ] -{ #category : #testing } +{ #category : 'testing' } GtFilterDescriptor >> showAsDefaultWhenEmpty [ ^ isDefault and: [ emptyDefaultValue notNil ] ] -{ #category : #testing } +{ #category : 'testing' } GtFilterDescriptor >> valueIsRequired [ ^ valueIsRequired ] -{ #category : #'initialize-release' } +{ #category : 'initialize-release' } GtFilterDescriptor >> valueNotRequired [ valueIsRequired := false ] diff --git a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonAptitude.class.st b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonAptitude.class.st index 1a13eeb06..89221deaf 100644 --- a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonAptitude.class.st @@ -7,30 +7,30 @@ Look at my {{gtClass:GtFilterRunExampleButtonLook|show=#gtSubclassesFor:|expande " Class { - #name : #GtFilterRunExampleButtonAptitude, - #superclass : #BrAptitude, + #name : 'GtFilterRunExampleButtonAptitude', + #superclass : 'BrAptitude', #instVars : [ 'coder', 'mutex', 'isUpdateRequested' ], - #category : #'GToolkit-Coder-UI-Filters' + #category : 'GToolkit-Coder-UI-Filters' } -{ #category : #'private - updating' } +{ #category : 'private - updating' } GtFilterRunExampleButtonAptitude >> beUpdateRequestedIfDoneEarlierDo: aBlock [ mutex critical: [ self isUpdateRequested ifTrue: aBlock. isUpdateRequested := true. ] ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtFilterRunExampleButtonAptitude >> coder [ ^ coder ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtFilterRunExampleButtonAptitude >> coder: aGtFilteredMethodsCoder [ coder = aGtFilteredMethodsCoder ifTrue: [ ^ self ]. self unsubscribeFromCoder. @@ -39,38 +39,38 @@ GtFilterRunExampleButtonAptitude >> coder: aGtFilteredMethodsCoder [ self onCoderChanged. ] -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtFilterRunExampleButtonAptitude >> coderDo: aBlock [ self coder ifNotNil: aBlock ] -{ #category : #'private - updating' } +{ #category : 'private - updating' } GtFilterRunExampleButtonAptitude >> enqueueUpdate [ self widgetAndCoderDo: [ :aWidget :aCoder | aWidget enqueueTask: (BlTaskAction new action: [ self updateNow ]) ]. ] -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtFilterRunExampleButtonAptitude >> exampler [ ^ self coder exampler ] -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtFilterRunExampleButtonAptitude >> examplerDo: aBlock [ self coderDo: [ :aCoder | aBlock cull: aCoder exampler ] ] -{ #category : #initialization } +{ #category : 'initialization' } GtFilterRunExampleButtonAptitude >> initialize [ super initialize. isUpdateRequested := false. mutex := Mutex new. ] -{ #category : #initialization } +{ #category : 'initialization' } GtFilterRunExampleButtonAptitude >> initializeIconElement: anElement [ anElement geometry: BlCircle new; @@ -78,43 +78,43 @@ GtFilterRunExampleButtonAptitude >> initializeIconElement: anElement [ size: 8 @ 8. ] -{ #category : #'private - testing' } +{ #category : 'private - testing' } GtFilterRunExampleButtonAptitude >> isUpdateRequested [ ^ isUpdateRequested ] -{ #category : #'api - hooks' } +{ #category : 'api - hooks' } GtFilterRunExampleButtonAptitude >> onAttachedTo: anElement [ super onAttachedTo: anElement. self postponeUpdate. ] -{ #category : #'private - hooks' } +{ #category : 'private - hooks' } GtFilterRunExampleButtonAptitude >> onCoderChanged [ "We expect that the Coder is changed just once before the look is attached." self beUpdateRequestedIfDoneEarlierDo: [ ^ self ]. self updateNow. ] -{ #category : #'private - announcement handling' } +{ #category : 'private - announcement handling' } GtFilterRunExampleButtonAptitude >> onCoderChanged: aGtCodersCodersChanged [ self postponeUpdate. ] -{ #category : #'private - announcement handling' } +{ #category : 'private - announcement handling' } GtFilterRunExampleButtonAptitude >> onExampleExecuted: aGtCoderExampleExecuted [ self postponeUpdate. ] -{ #category : #'api - hooks' } +{ #category : 'api - hooks' } GtFilterRunExampleButtonAptitude >> onUninstalledIn: anElement [ super onUninstalledIn: anElement. self resetUpdateRequested. ] -{ #category : #'private - updating' } +{ #category : 'private - updating' } GtFilterRunExampleButtonAptitude >> postponeUpdate [ self widgetAndCoderDo: [ :aWidget :aCoder | self beUpdateRequestedIfDoneEarlierDo: [ ^ self ]. @@ -127,7 +127,7 @@ GtFilterRunExampleButtonAptitude >> postponeUpdate [ self updateNow ] ] ] -{ #category : #'private - updating' } +{ #category : 'private - updating' } GtFilterRunExampleButtonAptitude >> postponedTime [ | aNow | self widgetDo: [ :aWidget | @@ -138,13 +138,13 @@ GtFilterRunExampleButtonAptitude >> postponedTime [ ^ aNow + 300 milliSeconds. ] -{ #category : #'private - updating' } +{ #category : 'private - updating' } GtFilterRunExampleButtonAptitude >> resetUpdateRequested [ mutex critical: [ isUpdateRequested := false ]. ] -{ #category : #'private - subscriptions' } +{ #category : 'private - subscriptions' } GtFilterRunExampleButtonAptitude >> subscribeToCoder [ self coder weak when: GtCoderExampleExecuted @@ -156,25 +156,25 @@ GtFilterRunExampleButtonAptitude >> subscribeToCoder [ to: self ] -{ #category : #'private - subscriptions' } +{ #category : 'private - subscriptions' } GtFilterRunExampleButtonAptitude >> unsubscribeFromCoder [ self coderDo: [ :aCoder | aCoder unsubscribe: self ]. ] -{ #category : #'private - updating' } +{ #category : 'private - updating' } GtFilterRunExampleButtonAptitude >> updateNow [ self resetUpdateRequested. self updateWidget. ] -{ #category : #'private - updating' } +{ #category : 'private - updating' } GtFilterRunExampleButtonAptitude >> updateWidget [ "Subclasses may perform update actions. I should be called from a UI process." ] -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtFilterRunExampleButtonAptitude >> widgetAndCoderDo: aTwoArgBlock [ self widgetDo: [ :aWidget | self coderDo: [ :aCoder | diff --git a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonFourStateIconAptitude.class.st b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonFourStateIconAptitude.class.st index 4ac76c7ad..26908ef51 100644 --- a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonFourStateIconAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonFourStateIconAptitude.class.st @@ -20,8 +20,8 @@ If all examples have same state, only one icon (color) is displayed: {{gtExample " Class { - #name : #GtFilterRunExampleButtonFourStateIconAptitude, - #superclass : #GtFilterRunExampleButtonIconAptitude, + #name : 'GtFilterRunExampleButtonFourStateIconAptitude', + #superclass : 'GtFilterRunExampleButtonIconAptitude', #instVars : [ 'fourIconElement', 'failureIconElement', @@ -29,25 +29,25 @@ Class { 'successIconElement', 'neutralIconElement' ], - #category : #'GToolkit-Coder-UI-Filters' + #category : 'GToolkit-Coder-UI-Filters' } -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtFilterRunExampleButtonFourStateIconAptitude >> errorIconElement [ ^ errorIconElement ] -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtFilterRunExampleButtonFourStateIconAptitude >> failureIconElement [ ^ failureIconElement ] -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtFilterRunExampleButtonFourStateIconAptitude >> fourIconElement [ ^ fourIconElement ] -{ #category : #initialization } +{ #category : 'initialization' } GtFilterRunExampleButtonFourStateIconAptitude >> initialize [ super initialize. self initializeFourStateIconElement. @@ -64,27 +64,27 @@ GtFilterRunExampleButtonFourStateIconAptitude >> initialize [ self addChangeAddChildAs: #(content fourStateExample) with: [ self fourIconElement ]. ] -{ #category : #initialization } +{ #category : 'initialization' } GtFilterRunExampleButtonFourStateIconAptitude >> initializeErrorIconElement [ errorIconElement := BlElement new background: self newErrorBackground. self initializeIconElement: errorIconElement. ] -{ #category : #initialization } +{ #category : 'initialization' } GtFilterRunExampleButtonFourStateIconAptitude >> initializeExampleElement [ super initializeExampleElement. self exampleElement visibility: BlVisibility gone. ] -{ #category : #initialization } +{ #category : 'initialization' } GtFilterRunExampleButtonFourStateIconAptitude >> initializeFailureIconElement [ failureIconElement := BlElement new background: self newFailureBackground. self initializeIconElement: failureIconElement ] -{ #category : #initialization } +{ #category : 'initialization' } GtFilterRunExampleButtonFourStateIconAptitude >> initializeFourStateIconElement [ fourIconElement := BlElement new layout: (BlGridLayout new @@ -96,31 +96,31 @@ GtFilterRunExampleButtonFourStateIconAptitude >> initializeFourStateIconElement c vertical fitContent ]. ] -{ #category : #initialization } +{ #category : 'initialization' } GtFilterRunExampleButtonFourStateIconAptitude >> initializeNeutralIconElement [ neutralIconElement := BlElement new background: self newNotExecutedBackground. self initializeIconElement: neutralIconElement. ] -{ #category : #initialization } +{ #category : 'initialization' } GtFilterRunExampleButtonFourStateIconAptitude >> initializeSuccessIconElement [ successIconElement := BlElement new background: self newSuccessBackground. self initializeIconElement: successIconElement ] -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtFilterRunExampleButtonFourStateIconAptitude >> neutralIconElement [ ^ neutralIconElement ] -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtFilterRunExampleButtonFourStateIconAptitude >> successIconElement [ ^ successIconElement ] -{ #category : #'private - updating' } +{ #category : 'private - updating' } GtFilterRunExampleButtonFourStateIconAptitude >> updateFourIconElement [ | isNeutralVisible isErrorVisible isFailureVisible isSuccessVisible | self updateIconElement: self neutralIconElement status: (isNeutralVisible := self exampler hasNotExecutedExamples). @@ -136,7 +136,7 @@ GtFilterRunExampleButtonFourStateIconAptitude >> updateFourIconElement [ self exampleElement visibility: BlVisibility gone ] ] -{ #category : #'private - updating' } +{ #category : 'private - updating' } GtFilterRunExampleButtonFourStateIconAptitude >> updateIconElement: anElement status: aBoolean [ aBoolean ifTrue: [ @@ -145,7 +145,7 @@ GtFilterRunExampleButtonFourStateIconAptitude >> updateIconElement: anElement st anElement visibility: BlVisibility hidden ]. ] -{ #category : #'private - updating' } +{ #category : 'private - updating' } GtFilterRunExampleButtonFourStateIconAptitude >> updateWidget [ super updateWidget. self updateFourIconElement. diff --git a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonIconAptitude.class.st b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonIconAptitude.class.st index 31db54c42..d6c8a78da 100644 --- a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonIconAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonIconAptitude.class.st @@ -20,21 +20,21 @@ The following examples shows a colored icon as a part of a button in four possib " Class { - #name : #GtFilterRunExampleButtonIconAptitude, - #superclass : #GtFilterRunExampleButtonAptitude, + #name : 'GtFilterRunExampleButtonIconAptitude', + #superclass : 'GtFilterRunExampleButtonAptitude', #instVars : [ 'exampleElement' ], - #category : #'GToolkit-Coder-UI-Filters' + #category : 'GToolkit-Coder-UI-Filters' } -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtFilterRunExampleButtonIconAptitude >> exampleElement [ ^ exampleElement ] -{ #category : #initialization } +{ #category : 'initialization' } GtFilterRunExampleButtonIconAptitude >> initialize [ super initialize. self initializeExampleElement. @@ -42,14 +42,14 @@ GtFilterRunExampleButtonIconAptitude >> initialize [ self addChangeAddChildAs: #(content example) with: [ self exampleElement ]. ] -{ #category : #initialization } +{ #category : 'initialization' } GtFilterRunExampleButtonIconAptitude >> initializeExampleElement [ exampleElement := BlElement new background: self newNotExecutedBackground. self initializeIconElement: exampleElement. ] -{ #category : #'private - instance creation' } +{ #category : 'private - instance creation' } GtFilterRunExampleButtonIconAptitude >> newBackground [ self coder exampler hasNotExecutedExamples ifTrue: [ ^ self newNotExecutedBackground ]. @@ -62,27 +62,27 @@ GtFilterRunExampleButtonIconAptitude >> newBackground [ ^ self newNotExecutedBackground. ] -{ #category : #'private - instance creation' } +{ #category : 'private - instance creation' } GtFilterRunExampleButtonIconAptitude >> newErrorBackground [ ^ GtFilterExampleErrorState default color ] -{ #category : #'private - instance creation' } +{ #category : 'private - instance creation' } GtFilterRunExampleButtonIconAptitude >> newFailureBackground [ ^ GtFilterExampleFailureState default color ] -{ #category : #'private - instance creation' } +{ #category : 'private - instance creation' } GtFilterRunExampleButtonIconAptitude >> newNotExecutedBackground [ ^ GtFilterExampleNotExecutedState default color ] -{ #category : #'private - instance creation' } +{ #category : 'private - instance creation' } GtFilterRunExampleButtonIconAptitude >> newSuccessBackground [ ^ GtFilterExampleSuccessState default color ] -{ #category : #'private - updating' } +{ #category : 'private - updating' } GtFilterRunExampleButtonIconAptitude >> updateButtonStatus [ "I must be called in a UI process". self widgetDo: [ :aWidget | @@ -95,14 +95,14 @@ GtFilterRunExampleButtonIconAptitude >> updateButtonStatus [ ifTrue: [ aWidget visibility: BlVisibility visible] ] ] ] -{ #category : #'private - updating' } +{ #category : 'private - updating' } GtFilterRunExampleButtonIconAptitude >> updateExampleStatus [ "I must be called in a UI process". self exampleElement background: self newBackground ] -{ #category : #'private - updating' } +{ #category : 'private - updating' } GtFilterRunExampleButtonIconAptitude >> updateWidget [ super updateWidget. self updateExampleStatus. diff --git a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonTooltipAptitude.class.st b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonTooltipAptitude.class.st index aa2d4c06c..2a5c8f572 100644 --- a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonTooltipAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonTooltipAptitude.class.st @@ -1,13 +1,13 @@ Class { - #name : #GtFilterRunExampleButtonTooltipAptitude, - #superclass : #GtFilterRunExampleButtonAptitude, + #name : 'GtFilterRunExampleButtonTooltipAptitude', + #superclass : 'GtFilterRunExampleButtonAptitude', #instVars : [ 'tooltipContent' ], - #category : #'GToolkit-Coder-UI-Filters' + #category : 'GToolkit-Coder-UI-Filters' } -{ #category : #initialization } +{ #category : 'initialization' } GtFilterRunExampleButtonTooltipAptitude >> initialize [ super initialize. self initializeTooltipContent. @@ -15,7 +15,7 @@ GtFilterRunExampleButtonTooltipAptitude >> initialize [ self add: (BrGlamorousWithTooltipAptitude content: [self initializeTooltipContent]). ] -{ #category : #initialization } +{ #category : 'initialization' } GtFilterRunExampleButtonTooltipAptitude >> initializeTooltipContent [ tooltipContent := BrColumnedList new. tooltipContent @@ -77,7 +77,7 @@ GtFilterRunExampleButtonTooltipAptitude >> initializeTooltipContent [ ^ tooltipContent ] -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtFilterRunExampleButtonTooltipAptitude >> listItems [ | states | states := GtFilterExampleState default allStates. @@ -85,13 +85,13 @@ GtFilterRunExampleButtonTooltipAptitude >> listItems [ eachState labelWithAmountFor: self coder exampler ]. ] -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtFilterRunExampleButtonTooltipAptitude >> tooltipContent [ ^ tooltipContent ] -{ #category : #'private - updating' } +{ #category : 'private - updating' } GtFilterRunExampleButtonTooltipAptitude >> updateList [ | statusesToDisplay | statusesToDisplay := GtFilterExampleState default allStates reject: [ :eachStatus | @@ -101,7 +101,7 @@ GtFilterRunExampleButtonTooltipAptitude >> updateList [ items: statusesToDisplay ] -{ #category : #'private - updating' } +{ #category : 'private - updating' } GtFilterRunExampleButtonTooltipAptitude >> updateWidget [ super updateWidget. self updateList. diff --git a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st index 260994524..c0cbbc52f 100644 --- a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st @@ -12,17 +12,17 @@ The following example shows a coder with default filters element that you can ch " Class { - #name : #GtFilterTagElement, - #superclass : #BrHorizontalPane, + #name : 'GtFilterTagElement', + #superclass : 'BrHorizontalPane', #instVars : [ 'descriptor', 'valueString', 'filterElement' ], - #category : #'GToolkit-Coder-UI-Filters' + #category : 'GToolkit-Coder-UI-Filters' } -{ #category : #actions } +{ #category : 'actions' } GtFilterTagElement >> activateEditor [ self childNamed: #editableLabel @@ -33,14 +33,14 @@ GtFilterTagElement >> activateEditor [ ifNone: [ (self childNamed: #dropDown) requestFocus ] ] -{ #category : #private } +{ #category : 'private' } GtFilterTagElement >> applyDescriptor: aDescriptor [ self descriptor: aDescriptor. self activateEditor. filterElement applyFilters ] -{ #category : #elements } +{ #category : 'elements' } GtFilterTagElement >> buildTagElements [ self removeChildren. self addChild: self createDropDown as: #dropDown. @@ -48,7 +48,7 @@ GtFilterTagElement >> buildTagElements [ ifTrue: [ self addChild: self createEditableLabel as: #editableLabel ] ] -{ #category : #elements } +{ #category : 'elements' } GtFilterTagElement >> createDropDown [ | button dropDownLook | button := self createDropDownButton. @@ -98,7 +98,7 @@ GtFilterTagElement >> createDropDown [ ^ button ] -{ #category : #elements } +{ #category : 'elements' } GtFilterTagElement >> createDropDownButton [ | button | button := BrButton new. @@ -114,7 +114,7 @@ GtFilterTagElement >> createDropDownButton [ ^ button ] -{ #category : #elements } +{ #category : 'elements' } GtFilterTagElement >> createEditableLabel [ | label | label := BrEditableLabel new. @@ -154,29 +154,29 @@ GtFilterTagElement >> createEditableLabel [ ^ label ] -{ #category : #accessing } +{ #category : 'accessing' } GtFilterTagElement >> descriptor [ ^ descriptor ] -{ #category : #accessing } +{ #category : 'accessing' } GtFilterTagElement >> descriptor: aFilterDescriptor [ descriptor := aFilterDescriptor. valueString := ''. self buildTagElements ] -{ #category : #'initialize-release' } +{ #category : 'initialize-release' } GtFilterTagElement >> emptyDefaultValueLabel [ ^ descriptor emptyDefaultValue ] -{ #category : #accessing } +{ #category : 'accessing' } GtFilterTagElement >> filter: aGtMethodsFilter [ filterElement := aGtMethodsFilter ] -{ #category : #'initialize-release' } +{ #category : 'initialize-release' } GtFilterTagElement >> initialize [ super initialize. self fitContent. @@ -193,7 +193,7 @@ GtFilterTagElement >> initialize [ self theme status neutralBackgroundColor darker ]) ] -{ #category : #testing } +{ #category : 'testing' } GtFilterTagElement >> isDefaultAllFilter [ ^ self descriptor showAsDefaultWhenEmpty and: [ valueString isEmpty @@ -201,18 +201,18 @@ GtFilterTagElement >> isDefaultAllFilter [ [ (self childNamed: #editableLabel) text asString = self emptyDefaultValueLabel ] ] ] -{ #category : #testing } +{ #category : 'testing' } GtFilterTagElement >> isValid [ ^ descriptor valueIsRequired not or: [ self valueString notEmpty ] ] -{ #category : #'initialize-release' } +{ #category : 'initialize-release' } GtFilterTagElement >> makeDefaultFilter [ valueString := ''. self setLabelText: self emptyDefaultValueLabel ] -{ #category : #private } +{ #category : 'private' } GtFilterTagElement >> setLabelText: aString [ self childNamed: #editableLabel @@ -223,12 +223,12 @@ GtFilterTagElement >> setLabelText: aString [ append: aString asRopedText glamorousRegularFont glamorousRegularSmallSize ] ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtFilterTagElement >> valueString [ ^ valueString ] -{ #category : #accessing } +{ #category : 'accessing' } GtFilterTagElement >> valueString: aString [ valueString := aString. self setLabelText: aString diff --git a/src/GToolkit-Coder-UI/GtFiltersChangedEvent.class.st b/src/GToolkit-Coder-UI/GtFiltersChangedEvent.class.st index f1d469053..4ca407cc2 100644 --- a/src/GToolkit-Coder-UI/GtFiltersChangedEvent.class.st +++ b/src/GToolkit-Coder-UI/GtFiltersChangedEvent.class.st @@ -1,18 +1,18 @@ Class { - #name : #GtFiltersChangedEvent, - #superclass : #BlEvent, + #name : 'GtFiltersChangedEvent', + #superclass : 'BlEvent', #instVars : [ 'filterElement' ], - #category : #'GToolkit-Coder-UI-Filters' + #category : 'GToolkit-Coder-UI-Filters' } -{ #category : #accessing } +{ #category : 'accessing' } GtFiltersChangedEvent >> filterElement [ ^ filterElement ] -{ #category : #accessing } +{ #category : 'accessing' } GtFiltersChangedEvent >> filterElement: anElement [ filterElement := anElement ] diff --git a/src/GToolkit-Coder-UI/GtFiltersElement.class.st b/src/GToolkit-Coder-UI/GtFiltersElement.class.st index 07fccb762..296d67277 100644 --- a/src/GToolkit-Coder-UI/GtFiltersElement.class.st +++ b/src/GToolkit-Coder-UI/GtFiltersElement.class.st @@ -11,15 +11,15 @@ The following example shows a coder with default filters element that you can ch " Class { - #name : #GtFiltersElement, - #superclass : #BrHorizontalFlow, + #name : 'GtFiltersElement', + #superclass : 'BrHorizontalFlow', #instVars : [ 'descriptors' ], - #category : #'GToolkit-Coder-UI-Filters' + #category : 'GToolkit-Coder-UI-Filters' } -{ #category : #accessing } +{ #category : 'accessing' } GtFiltersElement >> addEmptyDefault [ | filterElement defaultDescriptor | self childrenCount = 1 @@ -34,7 +34,7 @@ GtFiltersElement >> addEmptyDefault [ self addChild: filterElement at: self childrenCount ] -{ #category : #accessing } +{ #category : 'accessing' } GtFiltersElement >> addFilterForDescriptor: aFilterDescriptor andValue: aString [ | element | element := GtFilterTagElement new. @@ -45,25 +45,25 @@ GtFiltersElement >> addFilterForDescriptor: aFilterDescriptor andValue: aString self addChild: element at: self childrenCount ] -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtFiltersElement >> applyFilters [ self fireEvent: (GtFiltersChangedEvent new filterElement: self). self addEmptyDefault ] -{ #category : #accessing } +{ #category : 'accessing' } GtFiltersElement >> buildFilters: aBlock [ self clearFilters. aBlock value. self addEmptyDefault ] -{ #category : #accessing } +{ #category : 'accessing' } GtFiltersElement >> clearFilters [ [ self childrenCount > 1 ] whileTrue: [ self removeChildAt: 1 ] ] -{ #category : #'private - actions' } +{ #category : 'private - actions' } GtFiltersElement >> createNewTag [ | tag | self descriptors isEmptyOrNil ifTrue: [ ^ self ]. @@ -77,18 +77,18 @@ GtFiltersElement >> createNewTag [ tag activateEditor ] -{ #category : #accessing } +{ #category : 'accessing' } GtFiltersElement >> descriptors [ ^ descriptors ] -{ #category : #accessing } +{ #category : 'accessing' } GtFiltersElement >> descriptors: aCollection [ descriptors := aCollection. self addEmptyDefault ] -{ #category : #accessing } +{ #category : 'accessing' } GtFiltersElement >> filtersDo: aBlock [ 1 to: self childrenCount - 1 do: [ :i | | filterTagElement | @@ -99,7 +99,7 @@ GtFiltersElement >> filtersDo: aBlock [ value: filterTagElement valueString ] ] ] -{ #category : #initialization } +{ #category : 'initialization' } GtFiltersElement >> initialize [ super initialize. self hMatchParent. @@ -107,7 +107,7 @@ GtFiltersElement >> initialize [ self addChild: self newAddTagButton as: #newButton ] -{ #category : #'private - instance creation' } +{ #category : 'private - instance creation' } GtFiltersElement >> newAddTagButton [ ^ BrButton new aptitude: diff --git a/src/GToolkit-Coder-UI/GtMethodCoderContextPCRangeChanged.class.st b/src/GToolkit-Coder-UI/GtMethodCoderContextPCRangeChanged.class.st index 33b8926c6..19e97b4d7 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderContextPCRangeChanged.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderContextPCRangeChanged.class.st @@ -1,18 +1,18 @@ Class { - #name : #GtMethodCoderContextPCRangeChanged, - #superclass : #Announcement, + #name : 'GtMethodCoderContextPCRangeChanged', + #superclass : 'Announcement', #instVars : [ 'pcRange' ], - #category : #'GToolkit-Coder-UI-Coder - Method Events' + #category : 'GToolkit-Coder-UI-Coder - Method Events' } -{ #category : #accessing } +{ #category : 'accessing' } GtMethodCoderContextPCRangeChanged >> pcRange [ ^ pcRange ] -{ #category : #accessing } +{ #category : 'accessing' } GtMethodCoderContextPCRangeChanged >> pcRange: anObject [ pcRange := anObject ] diff --git a/src/GToolkit-Coder-UI/GtMethodCoderDebugExampleActionId.class.st b/src/GToolkit-Coder-UI/GtMethodCoderDebugExampleActionId.class.st index b83ab61de..bb3c520ff 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderDebugExampleActionId.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderDebugExampleActionId.class.st @@ -4,12 +4,12 @@ A button to debug an example " Class { - #name : #GtMethodCoderDebugExampleActionId, - #superclass : #GtCoderElementId, - #category : #'GToolkit-Coder-UI-Coder - Basic' + #name : 'GtMethodCoderDebugExampleActionId', + #superclass : 'GtCoderElementId', + #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : #converting } +{ #category : 'converting' } GtMethodCoderDebugExampleActionId >> asSymbol [ ^ #'context-action--debug-example' ] diff --git a/src/GToolkit-Coder-UI/GtMethodCoderDiscardChangesActionId.class.st b/src/GToolkit-Coder-UI/GtMethodCoderDiscardChangesActionId.class.st index 36443a415..56373e2e8 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderDiscardChangesActionId.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderDiscardChangesActionId.class.st @@ -4,12 +4,12 @@ A button to discard changes " Class { - #name : #GtMethodCoderDiscardChangesActionId, - #superclass : #GtCoderElementId, - #category : #'GToolkit-Coder-UI-Coder - Basic' + #name : 'GtMethodCoderDiscardChangesActionId', + #superclass : 'GtCoderElementId', + #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : #converting } +{ #category : 'converting' } GtMethodCoderDiscardChangesActionId >> asSymbol [ ^ #'main-action--discard-changes' ] diff --git a/src/GToolkit-Coder-UI/GtMethodCoderExtractMethodContextMenuItemId.class.st b/src/GToolkit-Coder-UI/GtMethodCoderExtractMethodContextMenuItemId.class.st index d63d0e0e3..ed0753ce4 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderExtractMethodContextMenuItemId.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderExtractMethodContextMenuItemId.class.st @@ -4,12 +4,12 @@ A context menu action to extract a method " Class { - #name : #GtMethodCoderExtractMethodContextMenuItemId, - #superclass : #GtCoderElementId, - #category : #'GToolkit-Coder-UI-Coder - Basic' + #name : 'GtMethodCoderExtractMethodContextMenuItemId', + #superclass : 'GtCoderElementId', + #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : #converting } +{ #category : 'converting' } GtMethodCoderExtractMethodContextMenuItemId >> asSymbol [ ^ #'context-menu-item--extract-method' ] diff --git a/src/GToolkit-Coder-UI/GtMethodCoderPlayAndInspectExampleActionId.class.st b/src/GToolkit-Coder-UI/GtMethodCoderPlayAndInspectExampleActionId.class.st index 9be320ab0..128044784 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderPlayAndInspectExampleActionId.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderPlayAndInspectExampleActionId.class.st @@ -4,12 +4,12 @@ A button to play and inspect an example " Class { - #name : #GtMethodCoderPlayAndInspectExampleActionId, - #superclass : #GtCoderElementId, - #category : #'GToolkit-Coder-UI-Coder - Basic' + #name : 'GtMethodCoderPlayAndInspectExampleActionId', + #superclass : 'GtCoderElementId', + #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : #converting } +{ #category : 'converting' } GtMethodCoderPlayAndInspectExampleActionId >> asSymbol [ ^ #'context-action--play-and-inspect-example' ] diff --git a/src/GToolkit-Coder-UI/GtMethodCoderPlayExampleActionId.class.st b/src/GToolkit-Coder-UI/GtMethodCoderPlayExampleActionId.class.st index d9474b39c..955d1fa77 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderPlayExampleActionId.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderPlayExampleActionId.class.st @@ -4,12 +4,12 @@ A button to play an example " Class { - #name : #GtMethodCoderPlayExampleActionId, - #superclass : #GtCoderElementId, - #category : #'GToolkit-Coder-UI-Coder - Basic' + #name : 'GtMethodCoderPlayExampleActionId', + #superclass : 'GtCoderElementId', + #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : #converting } +{ #category : 'converting' } GtMethodCoderPlayExampleActionId >> asSymbol [ ^ #'context-action--play-example' ] diff --git a/src/GToolkit-Coder-UI/GtMethodCoderSaveAbilityChanged.class.st b/src/GToolkit-Coder-UI/GtMethodCoderSaveAbilityChanged.class.st index c8f3268be..a2ad0736f 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderSaveAbilityChanged.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderSaveAbilityChanged.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtMethodCoderSaveAbilityChanged, - #superclass : #GtTextualCoderViewModelAnnouncement, - #category : #'GToolkit-Coder-UI-Coder - Method Events' + #name : 'GtMethodCoderSaveAbilityChanged', + #superclass : 'GtTextualCoderViewModelAnnouncement', + #category : 'GToolkit-Coder-UI-Coder - Method Events' } diff --git a/src/GToolkit-Coder-UI/GtMethodCoderSaveActionId.class.st b/src/GToolkit-Coder-UI/GtMethodCoderSaveActionId.class.st index 4f6c0d0b3..b7a2158f7 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderSaveActionId.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderSaveActionId.class.st @@ -4,12 +4,12 @@ A button to save a method " Class { - #name : #GtMethodCoderSaveActionId, - #superclass : #GtCoderElementId, - #category : #'GToolkit-Coder-UI-Coder - Basic' + #name : 'GtMethodCoderSaveActionId', + #superclass : 'GtCoderElementId', + #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : #converting } +{ #category : 'converting' } GtMethodCoderSaveActionId >> asSymbol [ ^ #'main-action--save' ] diff --git a/src/GToolkit-Coder-UI/GtMethodCoderSaveDisabled.class.st b/src/GToolkit-Coder-UI/GtMethodCoderSaveDisabled.class.st index 02218a48d..9f80acdf6 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderSaveDisabled.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderSaveDisabled.class.st @@ -1,23 +1,23 @@ Class { - #name : #GtMethodCoderSaveDisabled, - #superclass : #GtMethodCoderSaveAbilityChanged, + #name : 'GtMethodCoderSaveDisabled', + #superclass : 'GtMethodCoderSaveAbilityChanged', #instVars : [ 'preventors' ], - #category : #'GToolkit-Coder-UI-Coder - Method Events' + #category : 'GToolkit-Coder-UI-Coder - Method Events' } -{ #category : #accessing } +{ #category : 'accessing' } GtMethodCoderSaveDisabled >> preventors [ ^ preventors ] -{ #category : #accessing } +{ #category : 'accessing' } GtMethodCoderSaveDisabled >> preventors: anObject [ preventors := anObject ] -{ #category : #evaluating } +{ #category : 'evaluating' } GtMethodCoderSaveDisabled >> value [ ^ false ] diff --git a/src/GToolkit-Coder-UI/GtMethodCoderSaveEnabled.class.st b/src/GToolkit-Coder-UI/GtMethodCoderSaveEnabled.class.st index 9d87e6b91..9245baaa0 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderSaveEnabled.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderSaveEnabled.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtMethodCoderSaveEnabled, - #superclass : #GtMethodCoderSaveAbilityChanged, - #category : #'GToolkit-Coder-UI-Coder - Method Events' + #name : 'GtMethodCoderSaveEnabled', + #superclass : 'GtMethodCoderSaveAbilityChanged', + #category : 'GToolkit-Coder-UI-Coder - Method Events' } -{ #category : #evaluating } +{ #category : 'evaluating' } GtMethodCoderSaveEnabled >> value [ ^ true ] diff --git a/src/GToolkit-Coder-UI/GtMethodCoderTool.class.st b/src/GToolkit-Coder-UI/GtMethodCoderTool.class.st index e667f7935..f8d5a91b9 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderTool.class.st @@ -1,33 +1,33 @@ Class { - #name : #GtMethodCoderTool, - #superclass : #GtCoderTool, + #name : 'GtMethodCoderTool', + #superclass : 'GtCoderTool', #instVars : [ 'compiledMethod' ], - #category : #'GToolkit-Coder-UI-Tools' + #category : 'GToolkit-Coder-UI-Tools' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtMethodCoderTool class >> compiledMethod: aMethod [ ^ self new compiledMethod: aMethod ] -{ #category : #accessing } +{ #category : 'accessing' } GtMethodCoderTool >> compiledMethod [ ^ compiledMethod ] -{ #category : #accessing } +{ #category : 'accessing' } GtMethodCoderTool >> compiledMethod: anObject [ compiledMethod := anObject ] -{ #category : #converting } +{ #category : 'converting' } GtMethodCoderTool >> newCoder [ ^ GtCoder forMethod: self compiledMethod ] -{ #category : #accessing } +{ #category : 'accessing' } GtMethodCoderTool >> object [ "compatibility method for ${GLMBlocObjectToSelect}$" ^ self compiledMethod diff --git a/src/GToolkit-Coder-UI/GtMultipleCodersViewModel.class.st b/src/GToolkit-Coder-UI/GtMultipleCodersViewModel.class.st index d8feac7a2..825513fb0 100644 --- a/src/GToolkit-Coder-UI/GtMultipleCodersViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtMultipleCodersViewModel.class.st @@ -1,14 +1,14 @@ Class { - #name : #GtMultipleCodersViewModel, - #superclass : #Object, + #name : 'GtMultipleCodersViewModel', + #superclass : 'Object', #instVars : [ 'coder', 'coderUIModels' ], - #category : #'GToolkit-Coder-UI-Coder - Basic' + #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : #accessing } +{ #category : 'accessing' } GtMultipleCodersViewModel >> announcer [ self deprecated: 'Use #coder announcer instead.' @@ -17,42 +17,42 @@ GtMultipleCodersViewModel >> announcer [ ^ self coder announcer ] -{ #category : #converting } +{ #category : 'converting' } GtMultipleCodersViewModel >> asCoderUIModel [ ^ self ] -{ #category : #converting } +{ #category : 'converting' } GtMultipleCodersViewModel >> asElement [ ^ self elementClass new codersUIModel: self; yourself ] -{ #category : #accessing } +{ #category : 'accessing' } GtMultipleCodersViewModel >> coder [ ^ coder ] -{ #category : #accessing } +{ #category : 'accessing' } GtMultipleCodersViewModel >> coder: aGtCodersModel [ coder := aGtCodersModel. self updateCoderUIModels ] -{ #category : #updating } +{ #category : 'updating' } GtMultipleCodersViewModel >> coderUIModelFor: aCoder [ ^ aCoder asCoderUIModel ] -{ #category : #accessing } +{ #category : 'accessing' } GtMultipleCodersViewModel >> coderUIModels [ ^ coderUIModels ] -{ #category : #accessing } +{ #category : 'accessing' } GtMultipleCodersViewModel >> coders [ @@ -63,7 +63,7 @@ GtMultipleCodersViewModel >> coders [ ^ coder ] -{ #category : #accessing } +{ #category : 'accessing' } GtMultipleCodersViewModel >> coders: aGtCodersModel [ self deprecated: 'Please use coder: instead.' @@ -74,19 +74,19 @@ GtMultipleCodersViewModel >> coders: aGtCodersModel [ self coder: aGtCodersModel ] -{ #category : #accessing } +{ #category : 'accessing' } GtMultipleCodersViewModel >> elementClass [ ^ self subclassResponsibility ] -{ #category : #initialization } +{ #category : 'initialization' } GtMultipleCodersViewModel >> initialize [ super initialize. coderUIModels := #() ] -{ #category : #updating } +{ #category : 'updating' } GtMultipleCodersViewModel >> updateCoderUIModels [ | aMappingOfCoderToCoderUI | diff --git a/src/GToolkit-Coder-UI/GtPackageCardElement.class.st b/src/GToolkit-Coder-UI/GtPackageCardElement.class.st index 003543fe5..b661591b3 100644 --- a/src/GToolkit-Coder-UI/GtPackageCardElement.class.st +++ b/src/GToolkit-Coder-UI/GtPackageCardElement.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtPackageCardElement, - #superclass : #GtCoderCardElement, - #category : #'GToolkit-Coder-UI-Basic' + #name : 'GtPackageCardElement', + #superclass : 'GtCoderCardElement', + #category : 'GToolkit-Coder-UI-Basic' } -{ #category : #'building ui' } +{ #category : 'building ui' } GtPackageCardElement >> detailsLabel [ | extensionMethodsCount | extensionMethodsCount := self extensionMethodsCount. @@ -15,7 +15,7 @@ GtPackageCardElement >> detailsLabel [ ifFalse: [ '' ]) ] -{ #category : #'building ui' } +{ #category : 'building ui' } GtPackageCardElement >> extensionMethodsCount [ | count | count := 0. diff --git a/src/GToolkit-Coder-UI/GtPackageCoderPackageNameId.class.st b/src/GToolkit-Coder-UI/GtPackageCoderPackageNameId.class.st index 0365834e4..9b8a027fb 100644 --- a/src/GToolkit-Coder-UI/GtPackageCoderPackageNameId.class.st +++ b/src/GToolkit-Coder-UI/GtPackageCoderPackageNameId.class.st @@ -4,12 +4,12 @@ An editable label with package name " Class { - #name : #GtPackageCoderPackageNameId, - #superclass : #GtCoderElementId, - #category : #'GToolkit-Coder-UI-Coder - Basic' + #name : 'GtPackageCoderPackageNameId', + #superclass : 'GtCoderElementId', + #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : #converting } +{ #category : 'converting' } GtPackageCoderPackageNameId >> asSymbol [ ^ #'package-coder--package-name-editor' ] diff --git a/src/GToolkit-Coder-UI/GtPackageCoderTool.class.st b/src/GToolkit-Coder-UI/GtPackageCoderTool.class.st index 3773f9dbc..50cbbdca1 100644 --- a/src/GToolkit-Coder-UI/GtPackageCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtPackageCoderTool.class.st @@ -1,34 +1,34 @@ Class { - #name : #GtPackageCoderTool, - #superclass : #GtCoderTool, + #name : 'GtPackageCoderTool', + #superclass : 'GtCoderTool', #instVars : [ 'package' ], - #category : #'GToolkit-Coder-UI-Tools' + #category : 'GToolkit-Coder-UI-Tools' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtPackageCoderTool class >> package: aPackage [ ^ self new package: aPackage ] -{ #category : #converting } +{ #category : 'converting' } GtPackageCoderTool >> newCoder [ ^ GtCoder forPackage: self package ] -{ #category : #accessing } +{ #category : 'accessing' } GtPackageCoderTool >> object [ "compatibility method for ${GLMBlocObjectToSelect}$" ^ self package ] -{ #category : #accessing } +{ #category : 'accessing' } GtPackageCoderTool >> package [ ^ package ] -{ #category : #accessing } +{ #category : 'accessing' } GtPackageCoderTool >> package: aPackage [ package := aPackage ] diff --git a/src/GToolkit-Coder-UI/GtPackageCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtPackageCoderViewModel.class.st index ed97fa9a1..2340a83fd 100644 --- a/src/GToolkit-Coder-UI/GtPackageCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtPackageCoderViewModel.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtPackageCoderViewModel, - #superclass : #GtSingleCoderViewModel, - #category : #'GToolkit-Coder-UI-Coder - Package Model' + #name : 'GtPackageCoderViewModel', + #superclass : 'GtSingleCoderViewModel', + #category : 'GToolkit-Coder-UI-Coder - Package Model' } diff --git a/src/GToolkit-Coder-UI/GtPackageTagCardElement.class.st b/src/GToolkit-Coder-UI/GtPackageTagCardElement.class.st index 3f8aac706..687dacde1 100644 --- a/src/GToolkit-Coder-UI/GtPackageTagCardElement.class.st +++ b/src/GToolkit-Coder-UI/GtPackageTagCardElement.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtPackageTagCardElement, - #superclass : #GtCoderCardElement, - #category : #'GToolkit-Coder-UI-Basic' + #name : 'GtPackageTagCardElement', + #superclass : 'GtCoderCardElement', + #category : 'GToolkit-Coder-UI-Basic' } -{ #category : #'building ui' } +{ #category : 'building ui' } GtPackageTagCardElement >> detailsLabel [ ^ coder packageTag classes size printString , ' Classes' ] diff --git a/src/GToolkit-Coder-UI/GtPackagesCoderElement.class.st b/src/GToolkit-Coder-UI/GtPackagesCoderElement.class.st index f79705d17..510d90656 100644 --- a/src/GToolkit-Coder-UI/GtPackagesCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtPackagesCoderElement.class.st @@ -1,14 +1,14 @@ Class { - #name : #GtPackagesCoderElement, - #superclass : #BlElement, + #name : 'GtPackagesCoderElement', + #superclass : 'BlElement', #instVars : [ 'packagesCoder', 'contentPane' ], - #category : #'GToolkit-Coder-UI-Coder - Packages' + #category : 'GToolkit-Coder-UI-Coder - Packages' } -{ #category : #'private - ui' } +{ #category : 'private - ui' } GtPackagesCoderElement >> buildContentPane [ contentPane := BlElement new. contentPane layout: BlLinearLayout horizontal. @@ -20,7 +20,7 @@ GtPackagesCoderElement >> buildContentPane [ ^ contentPane ] -{ #category : #'private - ui' } +{ #category : 'private - ui' } GtPackagesCoderElement >> buildPackageList [ ^ BrSimpleList new itemStencil: [ GtPackageCardElement new ]; @@ -32,7 +32,7 @@ GtPackagesCoderElement >> buildPackageList [ addEventFilterOn: BlClickEvent do: [ :anEvent | self requestFocus ] ] -{ #category : #'private - ui' } +{ #category : 'private - ui' } GtPackagesCoderElement >> buildPackagesElement [ | element | element := BlElement new. @@ -61,7 +61,7 @@ GtPackagesCoderElement >> buildPackagesElement [ ^ element ] -{ #category : #'initialize-release' } +{ #category : 'initialize-release' } GtPackagesCoderElement >> coders: aPackagesCoder [ | coderElement | @@ -74,7 +74,7 @@ GtPackagesCoderElement >> coders: aPackagesCoder [ addChild: coderElement as: #coder. ] -{ #category : #'initialize-release' } +{ #category : 'initialize-release' } GtPackagesCoderElement >> codersUIModel: aPackagesCoder [ | coderElement | @@ -87,7 +87,7 @@ GtPackagesCoderElement >> codersUIModel: aPackagesCoder [ addChild: coderElement as: #coder. ] -{ #category : #'initialize-release' } +{ #category : 'initialize-release' } GtPackagesCoderElement >> initialize [ super initialize. self diff --git a/src/GToolkit-Coder-UI/GtPackagesCoderUIModel.class.st b/src/GToolkit-Coder-UI/GtPackagesCoderUIModel.class.st index ba5943dbf..e8ce72f9d 100644 --- a/src/GToolkit-Coder-UI/GtPackagesCoderUIModel.class.st +++ b/src/GToolkit-Coder-UI/GtPackagesCoderUIModel.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtPackagesCoderUIModel, - #superclass : #GtMultipleCodersViewModel, - #category : #'GToolkit-Coder-UI-Coder - Packages Model' + #name : 'GtPackagesCoderUIModel', + #superclass : 'GtMultipleCodersViewModel', + #category : 'GToolkit-Coder-UI-Coder - Packages Model' } -{ #category : #accessing } +{ #category : 'accessing' } GtPackagesCoderUIModel >> elementClass [ ^ GtPackagesCoderElement ] diff --git a/src/GToolkit-Coder-UI/GtPreviewChangeButton.class.st b/src/GToolkit-Coder-UI/GtPreviewChangeButton.class.st index f267ab131..8a75841f1 100644 --- a/src/GToolkit-Coder-UI/GtPreviewChangeButton.class.st +++ b/src/GToolkit-Coder-UI/GtPreviewChangeButton.class.st @@ -1,14 +1,14 @@ Class { - #name : #GtPreviewChangeButton, - #superclass : #BrButton, + #name : 'GtPreviewChangeButton', + #superclass : 'BrButton', #instVars : [ 'changeAction', 'changeStencil' ], - #category : #'GToolkit-Coder-UI-Basic' + #category : 'GToolkit-Coder-UI-Basic' } -{ #category : #ui } +{ #category : 'ui' } GtPreviewChangeButton >> buildDropDownElement [ | element unloadButton | element := BrVerticalPane new @@ -36,27 +36,27 @@ GtPreviewChangeButton >> buildDropDownElement [ ^ element ] -{ #category : #accessing } +{ #category : 'accessing' } GtPreviewChangeButton >> changeAction [ ^ changeAction ] -{ #category : #accessing } +{ #category : 'accessing' } GtPreviewChangeButton >> changeAction: aBlock [ changeAction := aBlock ] -{ #category : #accessing } +{ #category : 'accessing' } GtPreviewChangeButton >> changeStencil [ ^ changeStencil ] -{ #category : #accessing } +{ #category : 'accessing' } GtPreviewChangeButton >> changeStencil: aStencil [ changeStencil := aStencil asStencil ] -{ #category : #ui } +{ #category : 'ui' } GtPreviewChangeButton >> initialize [ super initialize. diff --git a/src/GToolkit-Coder-UI/GtRBAddPoolVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/GtRBAddPoolVariableRefactoring.extension.st index b96c948fc..acb8c6364 100644 --- a/src/GToolkit-Coder-UI/GtRBAddPoolVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/GtRBAddPoolVariableRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #GtRBAddPoolVariableRefactoring } +Extension { #name : 'GtRBAddPoolVariableRefactoring' } -{ #category : #'*GToolkit-Coder-UI' } +{ #category : '*GToolkit-Coder-UI' } GtRBAddPoolVariableRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/GtRBAddTraitUsageRefactoring.extension.st b/src/GToolkit-Coder-UI/GtRBAddTraitUsageRefactoring.extension.st index e382afddd..e4955350b 100644 --- a/src/GToolkit-Coder-UI/GtRBAddTraitUsageRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/GtRBAddTraitUsageRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #GtRBAddTraitUsageRefactoring } +Extension { #name : 'GtRBAddTraitUsageRefactoring' } -{ #category : #'*GToolkit-Coder-UI' } +{ #category : '*GToolkit-Coder-UI' } GtRBAddTraitUsageRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/GtRBChangeSuperclassRefactoring.extension.st b/src/GToolkit-Coder-UI/GtRBChangeSuperclassRefactoring.extension.st index 09f61b996..f8e47f96a 100644 --- a/src/GToolkit-Coder-UI/GtRBChangeSuperclassRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/GtRBChangeSuperclassRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #GtRBChangeSuperclassRefactoring } +Extension { #name : 'GtRBChangeSuperclassRefactoring' } -{ #category : #'*GToolkit-Coder-UI' } +{ #category : '*GToolkit-Coder-UI' } GtRBChangeSuperclassRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/GtRBRemovePoolVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/GtRBRemovePoolVariableRefactoring.extension.st index c4b8628ad..4d065f953 100644 --- a/src/GToolkit-Coder-UI/GtRBRemovePoolVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/GtRBRemovePoolVariableRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #GtRBRemovePoolVariableRefactoring } +Extension { #name : 'GtRBRemovePoolVariableRefactoring' } -{ #category : #'*GToolkit-Coder-UI' } +{ #category : '*GToolkit-Coder-UI' } GtRBRemovePoolVariableRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/GtRBRemoveTraitUsageRefactoring.extension.st b/src/GToolkit-Coder-UI/GtRBRemoveTraitUsageRefactoring.extension.st index c52704dd8..29f986d53 100644 --- a/src/GToolkit-Coder-UI/GtRBRemoveTraitUsageRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/GtRBRemoveTraitUsageRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #GtRBRemoveTraitUsageRefactoring } +Extension { #name : 'GtRBRemoveTraitUsageRefactoring' } -{ #category : #'*GToolkit-Coder-UI' } +{ #category : '*GToolkit-Coder-UI' } GtRBRemoveTraitUsageRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/GtReadyCoderTool.class.st b/src/GToolkit-Coder-UI/GtReadyCoderTool.class.st index e39023197..bf85f7c01 100644 --- a/src/GToolkit-Coder-UI/GtReadyCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtReadyCoderTool.class.st @@ -1,25 +1,25 @@ Class { - #name : #GtReadyCoderTool, - #superclass : #GtPhlowTool, + #name : 'GtReadyCoderTool', + #superclass : 'GtPhlowTool', #instVars : [ 'coder' ], - #category : #'GToolkit-Coder-UI-Tools' + #category : 'GToolkit-Coder-UI-Tools' } -{ #category : #accessing } +{ #category : 'accessing' } GtReadyCoderTool class >> coder: aCoder [ ^ self new coder: aCoder ] -{ #category : #converting } +{ #category : 'converting' } GtReadyCoderTool >> asElementDo: aOneArgBlock [ "Create a tool element and execute the block." ^ aOneArgBlock cull: (GtCoder forCoder: self coder) asPagerPageElement ] -{ #category : #accessing } +{ #category : 'accessing' } GtReadyCoderTool >> assertCoder: aCoder [ self assert: [ aCoder isNotNil ] @@ -29,28 +29,28 @@ GtReadyCoderTool >> assertCoder: aCoder [ description: [ 'Coder cannot be an element because it may be added to a space graph several times' ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtReadyCoderTool >> coder [ ^ coder ] -{ #category : #accessing } +{ #category : 'accessing' } GtReadyCoderTool >> coder: aCoder [ self assertCoder: aCoder. coder := aCoder ] -{ #category : #'api - converting' } +{ #category : 'api - converting' } GtReadyCoderTool >> icon [ ^ BrGlamorousVectorIcons browse ] -{ #category : #'api - accessing' } +{ #category : 'api - accessing' } GtReadyCoderTool >> name [ ^ 'coder' ] -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtReadyCoderTool >> tabLook [ ^ BrGlamorousTabSwitcherWithIconAptitude ] diff --git a/src/GToolkit-Coder-UI/GtRefactoringsPreviewAcceptId.class.st b/src/GToolkit-Coder-UI/GtRefactoringsPreviewAcceptId.class.st index 1ba93a5fb..238fde373 100644 --- a/src/GToolkit-Coder-UI/GtRefactoringsPreviewAcceptId.class.st +++ b/src/GToolkit-Coder-UI/GtRefactoringsPreviewAcceptId.class.st @@ -4,12 +4,12 @@ A button to apply refactorings from a preview dropdown " Class { - #name : #GtRefactoringsPreviewAcceptId, - #superclass : #GtCoderElementId, - #category : #'GToolkit-Coder-UI-Coder - Basic' + #name : 'GtRefactoringsPreviewAcceptId', + #superclass : 'GtCoderElementId', + #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : #converting } +{ #category : 'converting' } GtRefactoringsPreviewAcceptId >> asSymbol [ ^ #'refactorings-preview--accept' ] diff --git a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st index 290a0a97b..15d456983 100644 --- a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st @@ -5,75 +5,75 @@ Wraps {{gtClass:GtCoderModel}} and optionally adds UI related api and state. Cod " Class { - #name : #GtSingleCoderViewModel, - #superclass : #Object, + #name : 'GtSingleCoderViewModel', + #superclass : 'Object', #traits : 'TGtAnnouncer + TGtWithCoderModel', #classTraits : 'TGtAnnouncer classTrait + TGtWithCoderModel classTrait', #instVars : [ 'announcer', 'codersUIModel' ], - #category : #'GToolkit-Coder-UI-Coder - Basic' + #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : #accessing } +{ #category : 'accessing' } GtSingleCoderViewModel >> announcer [ ^ announcer ifNil: [ announcer := Announcer new ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtSingleCoderViewModel >> announcerUIModel [ ^ self announcer ] -{ #category : #converting } +{ #category : 'converting' } GtSingleCoderViewModel >> asCoderUIModel [ ^ self ] -{ #category : #converting } +{ #category : 'converting' } GtSingleCoderViewModel >> asElement [ ^ self elementClass new coderUIModel: self; yourself ] -{ #category : #accessing } +{ #category : 'accessing' } GtSingleCoderViewModel >> coder [ ^ self coderModel ] -{ #category : #accessing } +{ #category : 'accessing' } GtSingleCoderViewModel >> coder: anObject [ self coderModel: anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtSingleCoderViewModel >> coderLook [ ^ self coder coderLook ] -{ #category : #accessing } +{ #category : 'accessing' } GtSingleCoderViewModel >> coders [ ^ self coder coders ] -{ #category : #accessing } +{ #category : 'accessing' } GtSingleCoderViewModel >> codersUIModel [ ^ codersUIModel ] -{ #category : #accessing } +{ #category : 'accessing' } GtSingleCoderViewModel >> codersUIModel: anObject [ codersUIModel := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtSingleCoderViewModel >> elementClass [ ^ self subclassResponsibility ] -{ #category : #'gt-extension' } +{ #category : 'gt-extension' } GtSingleCoderViewModel >> gtLiveFor: aView [ @@ -84,7 +84,7 @@ GtSingleCoderViewModel >> gtLiveFor: aView [ view: #gtLiveFor: ] -{ #category : #accessing } +{ #category : 'accessing' } GtSingleCoderViewModel >> hasFocus [ self @@ -94,7 +94,7 @@ GtSingleCoderViewModel >> hasFocus [ ^ self focused ] -{ #category : #accessing } +{ #category : 'accessing' } GtSingleCoderViewModel >> hasFocus: aBoolean [ self deprecated: 'Please use #focused: instead.' @@ -105,17 +105,17 @@ GtSingleCoderViewModel >> hasFocus: aBoolean [ self focused: aBoolean ] -{ #category : #testing } +{ #category : 'testing' } GtSingleCoderViewModel >> isModified [ ^ self coder isModified ] -{ #category : #'api - coder model' } +{ #category : 'api - coder model' } GtSingleCoderViewModel >> onCoderModelChanged [ "Is sent when a new coder model is assigned to the view model" ] -{ #category : #accessing } +{ #category : 'accessing' } GtSingleCoderViewModel >> programCounterRange [ "This is workwound util the method coder context had a dedicated element. Now the element for displaying a coder is shared between all types of coders." diff --git a/src/GToolkit-Coder-UI/GtSourceCoderAptitude.class.st b/src/GToolkit-Coder-UI/GtSourceCoderAptitude.class.st index 28838f24c..fb736b5fe 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderAptitude.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtSourceCoderAptitude, - #superclass : #BrAptitude, - #category : #'GToolkit-Coder-UI-Coder - Source Look' + #name : 'GtSourceCoderAptitude', + #superclass : 'BrAptitude', + #category : 'GToolkit-Coder-UI-Coder - Source Look' } -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtSourceCoderAptitude >> coder [ self deprecated: 'Please use #sourceCoderUIModel instead' @@ -13,7 +13,7 @@ GtSourceCoderAptitude >> coder [ ^ self sourceCoderUIModel ] -{ #category : #initialization } +{ #category : 'initialization' } GtSourceCoderAptitude >> initializeListeners [ super initializeListeners. @@ -22,18 +22,18 @@ GtSourceCoderAptitude >> initializeListeners [ ifNotNil: [ :aSourceCoder | self onCoderChanged: aSourceCoder ] ] ] -{ #category : #initialization } +{ #category : 'initialization' } GtSourceCoderAptitude >> initializeRequests [ super initializeRequests. self request: GtSourceCoderContentCoderRequest new ] -{ #category : #hooks } +{ #category : 'hooks' } GtSourceCoderAptitude >> onCoderChanged: aGtSourceCoder [ ] -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtSourceCoderAptitude >> sourceCoderUIModel [ diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbAction.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbAction.class.st index 3400cfa9d..d8a04fc9a 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbAction.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbAction.class.st @@ -1,22 +1,22 @@ Class { - #name : #GtSourceCoderBreadcrumbAction, - #superclass : #Object, - #category : #'GToolkit-Coder-UI-Coder - Source Model' + #name : 'GtSourceCoderBreadcrumbAction', + #superclass : 'Object', + #category : 'GToolkit-Coder-UI-Coder - Source Model' } -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderBreadcrumbAction >> foreground [ ^ BrGlamorousColors defaultButtonTextColor ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderBreadcrumbAction >> name [ ^ self subclassResponsibility ] -{ #category : #action } +{ #category : 'action' } GtSourceCoderBreadcrumbAction >> performSourceCoderActionFrom: anElement [ self subclassResponsibility ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbSpawnBehaviorAction.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbSpawnBehaviorAction.class.st index 78fbe736e..90fd336b5 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbSpawnBehaviorAction.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbSpawnBehaviorAction.class.st @@ -1,30 +1,30 @@ Class { - #name : #GtSourceCoderBreadcrumbSpawnBehaviorAction, - #superclass : #GtSourceCoderBreadcrumbAction, + #name : 'GtSourceCoderBreadcrumbSpawnBehaviorAction', + #superclass : 'GtSourceCoderBreadcrumbAction', #instVars : [ 'methodBehavior' ], - #category : #'GToolkit-Coder-UI-Coder - Source Model' + #category : 'GToolkit-Coder-UI-Coder - Source Model' } -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderBreadcrumbSpawnBehaviorAction >> foreground [ ^ self methodBehavior exists ifTrue: [ BrGlamorousColors defaultButtonTextColor ] ifFalse: [ BrGlamorousColors linkWithErrorColor ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderBreadcrumbSpawnBehaviorAction >> methodBehavior [ ^ methodBehavior ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderBreadcrumbSpawnBehaviorAction >> methodBehavior: anObject [ methodBehavior := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderBreadcrumbSpawnBehaviorAction >> name [ @@ -36,7 +36,7 @@ GtSourceCoderBreadcrumbSpawnBehaviorAction >> name [ ifAbsent: [ '(Unspecified)' ] ] -{ #category : #action } +{ #category : 'action' } GtSourceCoderBreadcrumbSpawnBehaviorAction >> performSourceCoderActionFrom: anElement [ self methodBehavior realBehaviorDo: [ :aBehavior | @@ -46,7 +46,7 @@ GtSourceCoderBreadcrumbSpawnBehaviorAction >> performSourceCoderActionFrom: anEl anElement phlow spawnTool: (GtInspectorTool forObject: self methodBehavior). ] -{ #category : #printing } +{ #category : 'printing' } GtSourceCoderBreadcrumbSpawnBehaviorAction >> printOn: aStream [ aStream nextPutAll: 'Spawn '; diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbSpawnPackageAction.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbSpawnPackageAction.class.st index 7cb330911..c60509a6e 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbSpawnPackageAction.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbSpawnPackageAction.class.st @@ -1,25 +1,25 @@ Class { - #name : #GtSourceCoderBreadcrumbSpawnPackageAction, - #superclass : #GtSourceCoderBreadcrumbAction, + #name : 'GtSourceCoderBreadcrumbSpawnPackageAction', + #superclass : 'GtSourceCoderBreadcrumbAction', #instVars : [ 'package' ], - #category : #'GToolkit-Coder-UI-Coder - Source Model' + #category : 'GToolkit-Coder-UI-Coder - Source Model' } -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderBreadcrumbSpawnPackageAction >> name [ ^ self package name ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderBreadcrumbSpawnPackageAction >> package [ ^ package ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderBreadcrumbSpawnPackageAction >> package: aPackage [ self assert: [ aPackage notNil ] @@ -28,12 +28,12 @@ GtSourceCoderBreadcrumbSpawnPackageAction >> package: aPackage [ package := aPackage ] -{ #category : #action } +{ #category : 'action' } GtSourceCoderBreadcrumbSpawnPackageAction >> performSourceCoderActionFrom: anElement [ anElement phlow spawnTool: (GtPackageCoderTool package: self package) ] -{ #category : #printing } +{ #category : 'printing' } GtSourceCoderBreadcrumbSpawnPackageAction >> printOn: aStream [ aStream nextPutAll: 'Spawn '; diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBrowseBehaviorShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBrowseBehaviorShortcut.class.st index 538701da5..598813cc0 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderBrowseBehaviorShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderBrowseBehaviorShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : #GtSourceCoderBrowseBehaviorShortcut, - #superclass : #GtSourceCoderShortcut, - #category : #'GToolkit-Coder-UI-Shortcuts' + #name : 'GtSourceCoderBrowseBehaviorShortcut', + #superclass : 'GtSourceCoderShortcut', + #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderBrowseBehaviorShortcut >> description [ ^ 'Browses behavior (class, method, pool etc) near the cursor or selection.' ] -{ #category : #initialization } +{ #category : 'initialization' } GtSourceCoderBrowseBehaviorShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryB ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderBrowseBehaviorShortcut >> name [ ^ 'Browse behavior' ] -{ #category : #evaluation } +{ #category : 'evaluation' } GtSourceCoderBrowseBehaviorShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent [ self diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBrowseImplementorsShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBrowseImplementorsShortcut.class.st index 516b415cf..5d783a67f 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderBrowseImplementorsShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderBrowseImplementorsShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : #GtSourceCoderBrowseImplementorsShortcut, - #superclass : #GtSourceCoderShortcut, - #category : #'GToolkit-Coder-UI-Shortcuts' + #name : 'GtSourceCoderBrowseImplementorsShortcut', + #superclass : 'GtSourceCoderShortcut', + #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderBrowseImplementorsShortcut >> description [ ^ 'Browses implementors of the method near the cursor or selection.' ] -{ #category : #initialization } +{ #category : 'initialization' } GtSourceCoderBrowseImplementorsShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryM ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderBrowseImplementorsShortcut >> name [ ^ 'Browse implementors' ] -{ #category : #evaluation } +{ #category : 'evaluation' } GtSourceCoderBrowseImplementorsShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent [ self forEditor: aBrTextEditor diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBrowseReferencesShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBrowseReferencesShortcut.class.st index 63c597a99..739026dcb 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderBrowseReferencesShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderBrowseReferencesShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : #GtSourceCoderBrowseReferencesShortcut, - #superclass : #GtSourceCoderShortcut, - #category : #'GToolkit-Coder-UI-Shortcuts' + #name : 'GtSourceCoderBrowseReferencesShortcut', + #superclass : 'GtSourceCoderShortcut', + #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderBrowseReferencesShortcut >> description [ ^ 'Browses references of the class or sender of the method near the cursor or selection.' ] -{ #category : #initialization } +{ #category : 'initialization' } GtSourceCoderBrowseReferencesShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryN ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderBrowseReferencesShortcut >> name [ ^ 'Browse references' ] -{ #category : #evaluation } +{ #category : 'evaluation' } GtSourceCoderBrowseReferencesShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent [ self forEditor: aBrTextEditor diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st index ab0d2f037..d4e718ee8 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtSourceCoderCollapsedContentElement, - #superclass : #GtSourceCoderContentElement, - #category : #'GToolkit-Coder-UI-Coder - Source' + #name : 'GtSourceCoderCollapsedContentElement', + #superclass : 'GtSourceCoderContentElement', + #category : 'GToolkit-Coder-UI-Coder - Source' } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAndExampleAptitude.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAndExampleAptitude.class.st index e3ed820a5..440c6fe71 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAndExampleAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAndExampleAptitude.class.st @@ -12,34 +12,34 @@ If a method is ** an example, I omit displaying the example result: {{gtExample: " Class { - #name : #GtSourceCoderCollapsedTextAndExampleAptitude, - #superclass : #GtSourceCoderAptitude, + #name : 'GtSourceCoderCollapsedTextAndExampleAptitude', + #superclass : 'GtSourceCoderAptitude', #instVars : [ 'container', 'methodLabel', 'exampleElement' ], - #category : #'GToolkit-Coder-UI-Coder - Source Look' + #category : 'GToolkit-Coder-UI-Coder - Source Look' } -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtSourceCoderCollapsedTextAndExampleAptitude >> container [ ^ container ] -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtSourceCoderCollapsedTextAndExampleAptitude >> exampleElement [ ^ exampleElement ] -{ #category : #'private - updating' } +{ #category : 'private - updating' } GtSourceCoderCollapsedTextAndExampleAptitude >> hide [ self exampleElement visibility: BlVisibility hidden ] -{ #category : #initialization } +{ #category : 'initialization' } GtSourceCoderCollapsedTextAndExampleAptitude >> initialize [ super initialize. self initializeMethodLabel. @@ -53,20 +53,20 @@ GtSourceCoderCollapsedTextAndExampleAptitude >> initialize [ self addChangeAddChildAs: #(content label) with: [ self container ] ] -{ #category : #initialization } +{ #category : 'initialization' } GtSourceCoderCollapsedTextAndExampleAptitude >> initializeContainer [ container := BrHorizontalPane new fitContent; alignCenterLeft ] -{ #category : #initialization } +{ #category : 'initialization' } GtSourceCoderCollapsedTextAndExampleAptitude >> initializeExampleElement [ exampleElement := GtCoderExampleStateElement new margin: (BlInsets top: 4 left: 1 bottom: 1 right: 1). ] -{ #category : #initialization } +{ #category : 'initialization' } GtSourceCoderCollapsedTextAndExampleAptitude >> initializeListeners [ super initializeListeners. @@ -77,19 +77,19 @@ GtSourceCoderCollapsedTextAndExampleAptitude >> initializeListeners [ focused: true ] ] -{ #category : #initialization } +{ #category : 'initialization' } GtSourceCoderCollapsedTextAndExampleAptitude >> initializeMethodLabel [ methodLabel := BrLabel new aptitude: BrGlamorousLabelAptitude new editorMeasurement bold glamorousCodeFont ] -{ #category : #'private - accessing' } +{ #category : 'private - accessing' } GtSourceCoderCollapsedTextAndExampleAptitude >> methodLabel [ ^ methodLabel ] -{ #category : #hooks } +{ #category : 'hooks' } GtSourceCoderCollapsedTextAndExampleAptitude >> onCoderChanged: aGtSourceCoderUIModel [ self widget coderUIModel ifNotNil: [ :aPreviousCoder | aPreviousCoder coder announcer unsubscribe: self ]. @@ -104,22 +104,22 @@ GtSourceCoderCollapsedTextAndExampleAptitude >> onCoderChanged: aGtSourceCoderUI to: self ] -{ #category : #'private - announcement handling' } +{ #category : 'private - announcement handling' } GtSourceCoderCollapsedTextAndExampleAptitude >> onCollapsedLabelChanged: anAnnouncement [ self updateLabelsFor: anAnnouncement coder ] -{ #category : #'private - announcement handling' } +{ #category : 'private - announcement handling' } GtSourceCoderCollapsedTextAndExampleAptitude >> onExampleExecuted: anAnnouncement [ self updateExampleElementFor: anAnnouncement coder ] -{ #category : #'private - updating' } +{ #category : 'private - updating' } GtSourceCoderCollapsedTextAndExampleAptitude >> show [ self exampleElement visibility: BlVisibility visible ] -{ #category : #'private - updating' } +{ #category : 'private - updating' } GtSourceCoderCollapsedTextAndExampleAptitude >> updateExampleElementFor: aSourceCoder [ aSourceCoder canExecuteExample ifFalse: [ self hide. @@ -129,13 +129,13 @@ GtSourceCoderCollapsedTextAndExampleAptitude >> updateExampleElementFor: aSource self exampleElement example: aSourceCoder example ] -{ #category : #'private - updating' } +{ #category : 'private - updating' } GtSourceCoderCollapsedTextAndExampleAptitude >> updateLabelsFor: aSourceCoder [ self updateMethodLabelFor: aSourceCoder. self updateExampleElementFor: aSourceCoder. ] -{ #category : #'private - updating' } +{ #category : 'private - updating' } GtSourceCoderCollapsedTextAndExampleAptitude >> updateMethodLabelFor: aSourceCoder [ self methodLabel text: aSourceCoder collapsedText ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAptitude.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAptitude.class.st index d3ca3af72..058be9f4f 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAptitude.class.st @@ -1,13 +1,13 @@ Class { - #name : #GtSourceCoderCollapsedTextAptitude, - #superclass : #GtSourceCoderAptitude, + #name : 'GtSourceCoderCollapsedTextAptitude', + #superclass : 'GtSourceCoderAptitude', #instVars : [ 'label' ], - #category : #'GToolkit-Coder-UI-Coder - Source Look' + #category : 'GToolkit-Coder-UI-Coder - Source Look' } -{ #category : #initialization } +{ #category : 'initialization' } GtSourceCoderCollapsedTextAptitude >> initialize [ super initialize. @@ -15,7 +15,7 @@ GtSourceCoderCollapsedTextAptitude >> initialize [ self addChangeAddChildAs: { #content . GtSourceCoderCollapsedTextId } with: [ label ]. ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderCollapsedTextAptitude >> initializeListeners [ super initializeListeners. @@ -26,13 +26,13 @@ GtSourceCoderCollapsedTextAptitude >> initializeListeners [ focused: true ] ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtSourceCoderCollapsedTextAptitude >> newLabel [ ^ BrLabel new aptitude: BrGlamorousLabelAptitude new editorMeasurement bold glamorousCodeFont ] -{ #category : #initialization } +{ #category : 'initialization' } GtSourceCoderCollapsedTextAptitude >> onCoderChanged: aGtSourceCoderUIModel [ self widget coderUIModel ifNotNil: [ :aPreviousCoder | aPreviousCoder coder announcer unsubscribe: self ]. @@ -43,12 +43,12 @@ GtSourceCoderCollapsedTextAptitude >> onCoderChanged: aGtSourceCoderUIModel [ to: self ] -{ #category : #private } +{ #category : 'private' } GtSourceCoderCollapsedTextAptitude >> updateLabel: anAnnouncement [ self updateLabelFor: anAnnouncement coder ] -{ #category : #private } +{ #category : 'private' } GtSourceCoderCollapsedTextAptitude >> updateLabelFor: aSourceCoder [ label text: aSourceCoder collapsedText ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextId.class.st index 4b97a5ab3..ca1fac794 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextId.class.st @@ -4,12 +4,12 @@ A label that shows a collapsed text of the source coder " Class { - #name : #GtSourceCoderCollapsedTextId, - #superclass : #GtCoderElementId, - #category : #'GToolkit-Coder-UI-Coder - Basic' + #name : 'GtSourceCoderCollapsedTextId', + #superclass : 'GtCoderElementId', + #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : #converting } +{ #category : 'converting' } GtSourceCoderCollapsedTextId >> asSymbol [ ^ 'source-coder--collapsed-text' ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderContentCoderChanged.class.st b/src/GToolkit-Coder-UI/GtSourceCoderContentCoderChanged.class.st index 6c7c73941..c771f5621 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderContentCoderChanged.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderContentCoderChanged.class.st @@ -1,18 +1,18 @@ Class { - #name : #GtSourceCoderContentCoderChanged, - #superclass : #BrChangeEvent, + #name : 'GtSourceCoderContentCoderChanged', + #superclass : 'BrChangeEvent', #instVars : [ 'sourceCoder' ], - #category : #'GToolkit-Coder-UI-Coder - Source Events' + #category : 'GToolkit-Coder-UI-Coder - Source Events' } -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderContentCoderChanged >> sourceCoder [ ^ sourceCoder ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderContentCoderChanged >> sourceCoder: anObject [ sourceCoder := anObject ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderContentCoderRequest.class.st b/src/GToolkit-Coder-UI/GtSourceCoderContentCoderRequest.class.st index 3bb3e7875..486e2c629 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderContentCoderRequest.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderContentCoderRequest.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtSourceCoderContentCoderRequest, - #superclass : #BrRequest, - #category : #'GToolkit-Coder-UI-Coder - Source Events' + #name : 'GtSourceCoderContentCoderRequest', + #superclass : 'BrRequest', + #category : 'GToolkit-Coder-UI-Coder - Source Events' } -{ #category : #initialization } +{ #category : 'initialization' } GtSourceCoderContentCoderRequest >> responseClass [ ^ GtSourceCoderContentCoderChanged ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st index e72ba1d9c..362a35ef6 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st @@ -1,12 +1,12 @@ Class { - #name : #GtSourceCoderContentElement, - #superclass : #BlElement, + #name : 'GtSourceCoderContentElement', + #superclass : 'BlElement', #traits : 'TBrLayoutResizable', #classTraits : 'TBrLayoutResizable classTrait', - #category : #'GToolkit-Coder-UI-Coder - Source' + #category : 'GToolkit-Coder-UI-Coder - Source' } -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderContentElement >> coder [ self deprecated: 'Use #coderUIModel instead.' @@ -15,7 +15,7 @@ GtSourceCoderContentElement >> coder [ ^ self coderUIModel ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderContentElement >> coder: aCoder [ self @@ -25,14 +25,14 @@ GtSourceCoderContentElement >> coder: aCoder [ self coderUIModel: aCoder ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderContentElement >> coderUIModel [ ^ self viewModel sourceCoder ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderContentElement >> coderUIModel: aGtSourceCoderUIModel [ self telemetry @@ -40,7 +40,7 @@ GtSourceCoderContentElement >> coderUIModel: aGtSourceCoderUIModel [ during: [ self viewModel sourceCoder: aGtSourceCoderUIModel ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderContentElement >> gtAllShortcutsFor: aView [ self shortcuts ifEmpty: [ ^ aView empty ]. @@ -52,7 +52,7 @@ GtSourceCoderContentElement >> gtAllShortcutsFor: aView [ column: 'Action' item: [ :each | each action asString ] ] -{ #category : #initialization } +{ #category : 'initialization' } GtSourceCoderContentElement >> initialize [ super initialize. self diff --git a/src/GToolkit-Coder-UI/GtSourceCoderContentModel.class.st b/src/GToolkit-Coder-UI/GtSourceCoderContentModel.class.st index 663b16cb9..479413d8b 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderContentModel.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderContentModel.class.st @@ -1,32 +1,32 @@ Class { - #name : #GtSourceCoderContentModel, - #superclass : #BrWidgetModel, + #name : 'GtSourceCoderContentModel', + #superclass : 'BrWidgetModel', #instVars : [ 'sourceCoder' ], - #category : #'GToolkit-Coder-UI-Coder - Source' + #category : 'GToolkit-Coder-UI-Coder - Source' } -{ #category : #initialization } +{ #category : 'initialization' } GtSourceCoderContentModel >> initializeListeners [ super initializeListeners. self when: GtSourceCoderContentCoderRequest reply: [ :aResponse | aResponse sourceCoder: self sourceCoder ] ] -{ #category : #'private - notifying' } +{ #category : 'private - notifying' } GtSourceCoderContentModel >> notifySourceCoderChanged: aGtSourceCoderUIModel [ self dispatchEvent: (GtSourceCoderContentCoderChanged new sourceCoder: aGtSourceCoderUIModel) ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderContentModel >> sourceCoder [ ^ sourceCoder ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderContentModel >> sourceCoder: aGtSourceCoderUIModel [ self assert: [ aGtSourceCoderUIModel isKindOf: GtSourceCoderViewModel ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDebugActionId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDebugActionId.class.st index f013da5de..992cf5b6c 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderDebugActionId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderDebugActionId.class.st @@ -4,12 +4,12 @@ A button to debug a piece of code " Class { - #name : #GtSourceCoderDebugActionId, - #superclass : #GtCoderElementId, - #category : #'GToolkit-Coder-UI-Coder - Basic' + #name : 'GtSourceCoderDebugActionId', + #superclass : 'GtCoderElementId', + #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : #converting } +{ #category : 'converting' } GtSourceCoderDebugActionId >> asSymbol [ ^ #'source-coder--debug-action' ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDiscardChangesShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDiscardChangesShortcut.class.st index 3b406787a..6cd905866 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderDiscardChangesShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderDiscardChangesShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : #GtSourceCoderDiscardChangesShortcut, - #superclass : #GtSourceCoderShortcut, - #category : #'GToolkit-Coder-UI-Shortcuts' + #name : 'GtSourceCoderDiscardChangesShortcut', + #superclass : 'GtSourceCoderShortcut', + #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderDiscardChangesShortcut >> description [ ^ 'Discards changes done to the source code.' ] -{ #category : #initialization } +{ #category : 'initialization' } GtSourceCoderDiscardChangesShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryL ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderDiscardChangesShortcut >> name [ ^ 'Discard changes' ] -{ #category : #evaluation } +{ #category : 'evaluation' } GtSourceCoderDiscardChangesShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ aSourceCoderViewModel discardChanges ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDoItActionId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDoItActionId.class.st index f0bf39f33..a7fd16ded 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderDoItActionId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderDoItActionId.class.st @@ -4,12 +4,12 @@ A button to evaluate a source code " Class { - #name : #GtSourceCoderDoItActionId, - #superclass : #GtCoderElementId, - #category : #'GToolkit-Coder-UI-Coder - Basic' + #name : 'GtSourceCoderDoItActionId', + #superclass : 'GtCoderElementId', + #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : #converting } +{ #category : 'converting' } GtSourceCoderDoItActionId >> asSymbol [ ^ 'source-coder--doit-action' ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDoItAndGoActionId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDoItAndGoActionId.class.st index 7d65b3310..1f0f8e1fb 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderDoItAndGoActionId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderDoItAndGoActionId.class.st @@ -4,12 +4,12 @@ A button to evaluate and inspect the result " Class { - #name : #GtSourceCoderDoItAndGoActionId, - #superclass : #GtCoderElementId, - #category : #'GToolkit-Coder-UI-Coder - Basic' + #name : 'GtSourceCoderDoItAndGoActionId', + #superclass : 'GtCoderElementId', + #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : #converting } +{ #category : 'converting' } GtSourceCoderDoItAndGoActionId >> asSymbol [ ^ #'source-coder--doit-and-go-action' ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectShortcut.class.st index 61db5bcf4..25c1c5eff 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : #GtSourceCoderDoItAndInspectShortcut, - #superclass : #GtSourceCoderShortcut, - #category : #'GToolkit-Coder-UI-Shortcuts' + #name : 'GtSourceCoderDoItAndInspectShortcut', + #superclass : 'GtSourceCoderShortcut', + #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderDoItAndInspectShortcut >> description [ ^ 'Evaluates the whole source code or just the selection and inspects the result.' ] -{ #category : #initialization } +{ #category : 'initialization' } GtSourceCoderDoItAndInspectShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryG ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderDoItAndInspectShortcut >> name [ ^ 'Do it and inspect' ] -{ #category : #evaluation } +{ #category : 'evaluation' } GtSourceCoderDoItAndInspectShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ GtCoderExecutionContextVariable element: aBrEditorElement diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDoItShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDoItShortcut.class.st index 2e67e9b95..01aadb3b2 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderDoItShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderDoItShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : #GtSourceCoderDoItShortcut, - #superclass : #GtSourceCoderShortcut, - #category : #'GToolkit-Coder-UI-Shortcuts' + #name : 'GtSourceCoderDoItShortcut', + #superclass : 'GtSourceCoderShortcut', + #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderDoItShortcut >> description [ ^ 'Evaluates the whole source code (method) or just the selection.' ] -{ #category : #initialization } +{ #category : 'initialization' } GtSourceCoderDoItShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryD ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderDoItShortcut >> name [ ^ 'Do it' ] -{ #category : #evaluation } +{ #category : 'evaluation' } GtSourceCoderDoItShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ GtCoderExecutionContextVariable element: aBrEditorElement diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEditorAptitude.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEditorAptitude.class.st index 4a90dc94d..fe63c8fe8 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEditorAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEditorAptitude.class.st @@ -1,6 +1,6 @@ Class { - #name : #GtSourceCoderEditorAptitude, - #superclass : #GtSourceCoderAptitude, + #name : 'GtSourceCoderEditorAptitude', + #superclass : 'GtSourceCoderAptitude', #instVars : [ 'sourceCoderUIModel', 'editorElement', @@ -8,17 +8,17 @@ Class { 'completion', 'actions' ], - #category : #'GToolkit-Coder-UI-Coder - Source Look' + #category : 'GToolkit-Coder-UI-Coder - Source Look' } -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderEditorAptitude >> editorElement [ ^ editorElement ] -{ #category : #initialization } +{ #category : 'initialization' } GtSourceCoderEditorAptitude >> initialize [ super initialize. @@ -31,19 +31,19 @@ GtSourceCoderEditorAptitude >> initialize [ self add: (BrLayoutResizerAptitude new inherit: editorElement) ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtSourceCoderEditorAptitude >> newActionsElement [ ^ GtCoderActionsElement new margin: (BlInsets top: 5); yourself ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtSourceCoderEditorAptitude >> newEditorElement [ ^ GtSourceCoderEditorElement new ] -{ #category : #hooks } +{ #category : 'hooks' } GtSourceCoderEditorAptitude >> onCoderChanged: aGtSourceCoderUIModel [ actions coderUIModel: aGtSourceCoderUIModel. editorElement textualCoderViewModel: aGtSourceCoderUIModel diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st index 3b6d1b188..744235ca7 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtSourceCoderEditorElement, - #superclass : #GtTextualCoderEditorElement, - #category : #'GToolkit-Coder-UI-Coder - Textual' + #name : 'GtSourceCoderEditorElement', + #superclass : 'GtTextualCoderEditorElement', + #category : 'GToolkit-Coder-UI-Coder - Textual' } -{ #category : #'api - textual coder view model' } +{ #category : 'api - textual coder view model' } GtSourceCoderEditorElement >> onTextualCoderViewModelChanged [ super onTextualCoderViewModelChanged. diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEditorId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEditorId.class.st index 789743391..dd9300106 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEditorId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEditorId.class.st @@ -4,12 +4,12 @@ Text editor within the source coder " Class { - #name : #GtSourceCoderEditorId, - #superclass : #GtCoderElementId, - #category : #'GToolkit-Coder-UI-Coder - Basic' + #name : 'GtSourceCoderEditorId', + #superclass : 'GtCoderElementId', + #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : #converting } +{ #category : 'converting' } GtSourceCoderEditorId >> asSymbol [ ^ #editor ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEmbeddedExpanderToggleId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEmbeddedExpanderToggleId.class.st index 84e0827ba..3c4ee2c79 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEmbeddedExpanderToggleId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEmbeddedExpanderToggleId.class.st @@ -2,12 +2,12 @@ An element to toggle an embedded expandable element within the text of the source coder. An examples can be an expandable method or a baseline name. " Class { - #name : #GtSourceCoderEmbeddedExpanderToggleId, - #superclass : #GtCoderElementId, - #category : #'GToolkit-Coder-UI-Coder - Basic' + #name : 'GtSourceCoderEmbeddedExpanderToggleId', + #superclass : 'GtCoderElementId', + #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : #converting } +{ #category : 'converting' } GtSourceCoderEmbeddedExpanderToggleId >> asSymbol [ ^ #'source-coder--embedded-expander-toggle' ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st index 32087e6e4..18287f433 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st @@ -1,13 +1,13 @@ Class { - #name : #GtSourceCoderErrorAttribute, - #superclass : #BrTextAdornmentAttribute, + #name : 'GtSourceCoderErrorAttribute', + #superclass : 'BrTextAdornmentAttribute', #instVars : [ 'string' ], - #category : #'GToolkit-Coder-UI-Coder - Source Attributes' + #category : 'GToolkit-Coder-UI-Coder - Source Attributes' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtSourceCoderErrorAttribute class >> for: aString [ ^ self new for: aString; @@ -16,7 +16,7 @@ GtSourceCoderErrorAttribute class >> for: aString [ yourself ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderErrorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ | text | @@ -33,7 +33,7 @@ GtSourceCoderErrorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditor yourself ] -{ #category : #'initialize-release' } +{ #category : 'initialize-release' } GtSourceCoderErrorAttribute >> for: aString [ string := aString ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEvaluationHighlighter.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEvaluationHighlighter.class.st index 1d9255d49..6d10dc68f 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEvaluationHighlighter.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEvaluationHighlighter.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtSourceCoderEvaluationHighlighter, - #superclass : #GtSourceCoderEvaluationResultDisplayer, - #category : #'GToolkit-Coder-UI-Coder - Source' + #name : 'GtSourceCoderEvaluationHighlighter', + #superclass : 'GtSourceCoderEvaluationResultDisplayer', + #category : 'GToolkit-Coder-UI-Coder - Source' } -{ #category : #'private - ui' } +{ #category : 'private - ui' } GtSourceCoderEvaluationHighlighter >> addAttributesFor: anEvaluationResult within: aTextInterval [ | theAttributes | diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEvaluationPrinter.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEvaluationPrinter.class.st index a54af7261..023388714 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEvaluationPrinter.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEvaluationPrinter.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtSourceCoderEvaluationPrinter, - #superclass : #GtSourceCoderEvaluationResultDisplayer, - #category : #'GToolkit-Coder-UI-Coder - Source' + #name : 'GtSourceCoderEvaluationPrinter', + #superclass : 'GtSourceCoderEvaluationResultDisplayer', + #category : 'GToolkit-Coder-UI-Coder - Source' } -{ #category : #private } +{ #category : 'private' } GtSourceCoderEvaluationPrinter >> addAttributesFor: anEvaluationResult within: aTextInterval [ | theAttributes | diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEvaluationResultDisplayer.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEvaluationResultDisplayer.class.st index 60f2d3101..7aa8bbe16 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEvaluationResultDisplayer.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEvaluationResultDisplayer.class.st @@ -1,21 +1,21 @@ Class { - #name : #GtSourceCoderEvaluationResultDisplayer, - #superclass : #Object, + #name : 'GtSourceCoderEvaluationResultDisplayer', + #superclass : 'Object', #instVars : [ 'editorElement', 'updateRequester', 'evaluationResult', 'evaluationAttributes' ], - #category : #'GToolkit-Coder-UI-Coder - Source' + #category : 'GToolkit-Coder-UI-Coder - Source' } -{ #category : #private } +{ #category : 'private' } GtSourceCoderEvaluationResultDisplayer >> addAttributesFor: anEvaluationResult within: aTextInterval [ self subclassResponsibility ] -{ #category : #'api - evaluation result' } +{ #category : 'api - evaluation result' } GtSourceCoderEvaluationResultDisplayer >> displayResult: anEvaluationResult [ self assert: [ anEvaluationResult notNil ] @@ -27,7 +27,7 @@ GtSourceCoderEvaluationResultDisplayer >> displayResult: anEvaluationResult [ updateRequester requestUpdate ] -{ #category : #'api - evaluation result' } +{ #category : 'api - evaluation result' } GtSourceCoderEvaluationResultDisplayer >> displayResultSynchronously: anEvaluationResult [ self assert: [ anEvaluationResult notNil ] @@ -39,23 +39,23 @@ GtSourceCoderEvaluationResultDisplayer >> displayResultSynchronously: anEvaluati self primitiveUpdateResult ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderEvaluationResultDisplayer >> editorElement [ ^ editorElement ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderEvaluationResultDisplayer >> editorElement: anObject [ editorElement := anObject. updateRequester element: editorElement ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderEvaluationResultDisplayer >> evaluationResult [ ^ evaluationResult ] -{ #category : #'api - evaluation result' } +{ #category : 'api - evaluation result' } GtSourceCoderEvaluationResultDisplayer >> hideResult [ evaluationResult ifNil: [ ^ self ]. @@ -63,7 +63,7 @@ GtSourceCoderEvaluationResultDisplayer >> hideResult [ updateRequester requestUpdate ] -{ #category : #'api - evaluation result' } +{ #category : 'api - evaluation result' } GtSourceCoderEvaluationResultDisplayer >> hideResultSynchronously [ evaluationResult ifNil: [ ^ self ]. @@ -71,7 +71,7 @@ GtSourceCoderEvaluationResultDisplayer >> hideResultSynchronously [ self primitiveUpdateResult ] -{ #category : #initialization } +{ #category : 'initialization' } GtSourceCoderEvaluationResultDisplayer >> initialize [ super initialize. @@ -83,7 +83,7 @@ GtSourceCoderEvaluationResultDisplayer >> initialize [ evaluationAttributes := #() ] -{ #category : #private } +{ #category : 'private' } GtSourceCoderEvaluationResultDisplayer >> primitiveAddResult: anEvaluationResult [ | anEvaluatedSource anEvaluatedInterval theSourceStartInText theSourceEndInText | @@ -107,20 +107,20 @@ GtSourceCoderEvaluationResultDisplayer >> primitiveAddResult: anEvaluationResult within: (theSourceStartInText to: theSourceEndInText) ] -{ #category : #private } +{ #category : 'private' } GtSourceCoderEvaluationResultDisplayer >> primitiveRemoveResult [ self text removeAttributes: evaluationAttributes. evaluationAttributes := #() ] -{ #category : #private } +{ #category : 'private' } GtSourceCoderEvaluationResultDisplayer >> primitiveUpdateResult [ self primitiveRemoveResult. evaluationResult ifNotNil: [ :anEvaluationResult | self primitiveAddResult: anEvaluationResult ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderEvaluationResultDisplayer >> text [ ^ self editorElement text ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st index 08034a3bc..27a4f53fa 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtSourceCoderExpandedContentElement, - #superclass : #GtSourceCoderContentElement, - #category : #'GToolkit-Coder-UI-Coder - Source' + #name : 'GtSourceCoderExpandedContentElement', + #superclass : 'GtSourceCoderContentElement', + #category : 'GToolkit-Coder-UI-Coder - Source' } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpanderToggleId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpanderToggleId.class.st index d8e8b57e4..6c55e9260 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExpanderToggleId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpanderToggleId.class.st @@ -3,12 +3,12 @@ An element to toggle {{gtClass:BrExpander}}'s state on click. In a context of a Do not confuse with an embedded expander within the text which is usually represented by a triangle. " Class { - #name : #GtSourceCoderExpanderToggleId, - #superclass : #GtCoderElementId, - #category : #'GToolkit-Coder-UI-Coder - Basic' + #name : 'GtSourceCoderExpanderToggleId', + #superclass : 'GtCoderElementId', + #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : #converting } +{ #category : 'converting' } GtSourceCoderExpanderToggleId >> asSymbol [ ^ #'source-coder--expander-toggle' ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExtractMethodShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExtractMethodShortcut.class.st index 4251d09e9..cfeb68168 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExtractMethodShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExtractMethodShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : #GtSourceCoderExtractMethodShortcut, - #superclass : #GtSourceCoderShortcut, - #category : #'GToolkit-Coder-UI-Shortcuts' + #name : 'GtSourceCoderExtractMethodShortcut', + #superclass : 'GtSourceCoderShortcut', + #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderExtractMethodShortcut >> description [ ^ 'Extracts the selected code into a new method.' ] -{ #category : #initialization } +{ #category : 'initialization' } GtSourceCoderExtractMethodShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryE ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderExtractMethodShortcut >> name [ ^ 'Extract method' ] -{ #category : #evaluation } +{ #category : 'evaluation' } GtSourceCoderExtractMethodShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent [ aGtSourceCoder extractMethod: aBrEditorElement ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderFocusChanged.class.st b/src/GToolkit-Coder-UI/GtSourceCoderFocusChanged.class.st index b503e81cc..9cec071a1 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderFocusChanged.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderFocusChanged.class.st @@ -1,29 +1,29 @@ Class { - #name : #GtSourceCoderFocusChanged, - #superclass : #Announcement, + #name : 'GtSourceCoderFocusChanged', + #superclass : 'Announcement', #instVars : [ 'source', 'focused' ], - #category : #'GToolkit-Coder-UI-Coder - Source Events' + #category : 'GToolkit-Coder-UI-Coder - Source Events' } -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderFocusChanged >> focused [ ^ focused ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderFocusChanged >> focused: anObject [ focused := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderFocusChanged >> source [ ^ source ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderFocusChanged >> source: anObject [ source := anObject ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderFormatShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderFormatShortcut.class.st index 44509a72a..816839d5e 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderFormatShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderFormatShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : #GtSourceCoderFormatShortcut, - #superclass : #GtSourceCoderShortcut, - #category : #'GToolkit-Coder-UI-Shortcuts' + #name : 'GtSourceCoderFormatShortcut', + #superclass : 'GtSourceCoderShortcut', + #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderFormatShortcut >> description [ ^ 'Formats and saves the source code.' ] -{ #category : #initialization } +{ #category : 'initialization' } GtSourceCoderFormatShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryShiftF ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderFormatShortcut >> name [ ^ 'Format' ] -{ #category : #evaluation } +{ #category : 'evaluation' } GtSourceCoderFormatShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent [ aGtSourceCoder format ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderPlayAndInspectShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderPlayAndInspectShortcut.class.st index 783c294a3..f373cd3c3 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderPlayAndInspectShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderPlayAndInspectShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : #GtSourceCoderPlayAndInspectShortcut, - #superclass : #GtSourceCoderShortcut, - #category : #'GToolkit-Coder-UI-Shortcuts' + #name : 'GtSourceCoderPlayAndInspectShortcut', + #superclass : 'GtSourceCoderShortcut', + #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderPlayAndInspectShortcut >> description [ ^ 'Compiles, saves and evaluates the whole source code (method) or just the selection and inspects the result.' ] -{ #category : #initialization } +{ #category : 'initialization' } GtSourceCoderPlayAndInspectShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryG ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderPlayAndInspectShortcut >> name [ ^ 'Save, play and inspect' ] -{ #category : #evaluation } +{ #category : 'evaluation' } GtSourceCoderPlayAndInspectShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent [ GtCoderExecutionContextVariable element: aBrEditorElement diff --git a/src/GToolkit-Coder-UI/GtSourceCoderPlayShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderPlayShortcut.class.st index c38d0de4e..b58e26a00 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderPlayShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderPlayShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : #GtSourceCoderPlayShortcut, - #superclass : #GtSourceCoderShortcut, - #category : #'GToolkit-Coder-UI-Shortcuts' + #name : 'GtSourceCoderPlayShortcut', + #superclass : 'GtSourceCoderShortcut', + #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderPlayShortcut >> description [ ^ 'Compiles, saves and evaluates the whole source code (method) or just the selection.' ] -{ #category : #initialization } +{ #category : 'initialization' } GtSourceCoderPlayShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryD ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderPlayShortcut >> name [ ^ 'Save and play' ] -{ #category : #evaluation } +{ #category : 'evaluation' } GtSourceCoderPlayShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent [ GtCoderExecutionContextVariable element: aBrEditorElement diff --git a/src/GToolkit-Coder-UI/GtSourceCoderPrintItShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderPrintItShortcut.class.st index 3a98a6016..7e6522943 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderPrintItShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderPrintItShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : #GtSourceCoderPrintItShortcut, - #superclass : #GtSourceCoderShortcut, - #category : #'GToolkit-Coder-UI-Shortcuts' + #name : 'GtSourceCoderPrintItShortcut', + #superclass : 'GtSourceCoderShortcut', + #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderPrintItShortcut >> description [ ^ 'Evaluates the whole source code (method) or just the selection and prints it in the editor.' ] -{ #category : #initialization } +{ #category : 'initialization' } GtSourceCoderPrintItShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryP ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderPrintItShortcut >> name [ ^ 'Print' ] -{ #category : #evaluation } +{ #category : 'evaluation' } GtSourceCoderPrintItShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aGtSourceCoderViewModel dueTo: aShortcutEvent [ GtCoderExecutionContextVariable element: aBrEditorElement diff --git a/src/GToolkit-Coder-UI/GtSourceCoderProfileActionId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderProfileActionId.class.st index 3be8509ce..5be41e41a 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderProfileActionId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderProfileActionId.class.st @@ -4,12 +4,12 @@ A button to profile a piece of code " Class { - #name : #GtSourceCoderProfileActionId, - #superclass : #GtCoderElementId, - #category : #'GToolkit-Coder-UI-Coder - Basic' + #name : 'GtSourceCoderProfileActionId', + #superclass : 'GtCoderElementId', + #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : #converting } +{ #category : 'converting' } GtSourceCoderProfileActionId >> asSymbol [ ^ #'source-coder--profile-action' ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderSaveShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderSaveShortcut.class.st index 8b228ef82..0676aae5e 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderSaveShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderSaveShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : #GtSourceCoderSaveShortcut, - #superclass : #GtSourceCoderShortcut, - #category : #'GToolkit-Coder-UI-Shortcuts' + #name : 'GtSourceCoderSaveShortcut', + #superclass : 'GtSourceCoderShortcut', + #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderSaveShortcut >> description [ ^ 'Apply changes and save the source code (compile).' ] -{ #category : #initialization } +{ #category : 'initialization' } GtSourceCoderSaveShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryS ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderSaveShortcut >> name [ ^ 'Save' ] -{ #category : #evaluation } +{ #category : 'evaluation' } GtSourceCoderSaveShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ aSourceCoderViewModel save ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderShortcut.class.st index 0e7e4568c..e3131fa18 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderShortcut.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtSourceCoderShortcut, - #superclass : #BrEditorShortcut, - #category : #'GToolkit-Coder-UI-Shortcuts' + #name : 'GtSourceCoderShortcut', + #superclass : 'BrEditorShortcut', + #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : #private } +{ #category : 'private' } GtSourceCoderShortcut >> forEditor: aBrTextEditor selectedStringDo: aSelectedTextBlock orCursorStringPositionDo: aCursorTextPositionBlock [ aBrTextEditor selectedText ifEmpty: [ aBrTextEditor hasCursors @@ -18,7 +18,7 @@ GtSourceCoderShortcut >> forEditor: aBrTextEditor selectedStringDo: aSelectedTex ifNotEmpty: [ :aSelectedText | aSelectedTextBlock value: aSelectedText asString ] ] -{ #category : #private } +{ #category : 'private' } GtSourceCoderShortcut >> forEditor: aBrTextEditor selectionIntervalDo: aSelectionIntervalBlock orCursorStringPositionDo: aCursorTextPositionBlock [ aBrTextEditor hasSelection ifTrue: [ @@ -36,12 +36,12 @@ GtSourceCoderShortcut >> forEditor: aBrTextEditor selectionIntervalDo: aSelectio aCursorTextPositionBlock value: aTextPosition ] ] ] -{ #category : #evaluation } +{ #category : 'evaluation' } GtSourceCoderShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent [ self subclassResponsibility ] -{ #category : #evaluation } +{ #category : 'evaluation' } GtSourceCoderShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ self performOnEditor: aBrTextEditor @@ -50,13 +50,13 @@ GtSourceCoderShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElemen dueTo: aShortcutEvent ] -{ #category : #evaluation } +{ #category : 'evaluation' } GtSourceCoderShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement dueTo: aShortcutEvent [ aBrTextEditor model ifNotNil: [ :aSourceCoderViewModel | self performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent ] ] -{ #category : #private } +{ #category : 'private' } GtSourceCoderShortcut >> selectionIntervalIn: aBrTextEditor [ aBrTextEditor selection do: [ :eachMonotoneSelection | ^ eachMonotoneSelection from + 1 to: eachMonotoneSelection to ]. diff --git a/src/GToolkit-Coder-UI/GtSourceCoderSpawnDestinationAptitude.class.st b/src/GToolkit-Coder-UI/GtSourceCoderSpawnDestinationAptitude.class.st index 7a40edf2a..70e698715 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderSpawnDestinationAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderSpawnDestinationAptitude.class.st @@ -6,15 +6,15 @@ Each coder holds to its destination. Available destinations are modeled as subcl " Class { - #name : #GtSourceCoderSpawnDestinationAptitude, - #superclass : #GtSourceCoderAptitude, + #name : 'GtSourceCoderSpawnDestinationAptitude', + #superclass : 'GtSourceCoderAptitude', #instVars : [ 'switchButton' ], - #category : #'GToolkit-Coder-UI-Coder - Source Look' + #category : 'GToolkit-Coder-UI-Coder - Source Look' } -{ #category : #initialization } +{ #category : 'initialization' } GtSourceCoderSpawnDestinationAptitude >> initialize [ super initialize. @@ -23,7 +23,7 @@ GtSourceCoderSpawnDestinationAptitude >> initialize [ self addChangeAddChildAs: #(content switchButton) with: [ switchButton ] ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtSourceCoderSpawnDestinationAptitude >> newSwitchButton [ ^ BrButton new aptitude: BrGlamorousButtonWithIconAptitude - BrGlamorousButtonExteriorAptitude; @@ -36,18 +36,18 @@ GtSourceCoderSpawnDestinationAptitude >> newSwitchButton [ zIndex: 10 ] -{ #category : #hooks } +{ #category : 'hooks' } GtSourceCoderSpawnDestinationAptitude >> onCoderChanged: aGtSourceCoderUIModel [ self switchButton icon: aGtSourceCoderUIModel coder spawnDestination icon ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderSpawnDestinationAptitude >> switchButton [ ^ switchButton ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtSourceCoderSpawnDestinationAptitude >> switchSpawnDestination [ | aSourceCoder | diff --git a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st index 653b1cbc5..a0c7271d2 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st @@ -1,36 +1,36 @@ Class { - #name : #GtSourceCoderViewModel, - #superclass : #GtTextualCoderViewModel, + #name : 'GtSourceCoderViewModel', + #superclass : 'GtTextualCoderViewModel', #instVars : [ 'evaluationResult' ], - #category : #'GToolkit-Coder-UI-Coder - Source Model' + #category : 'GToolkit-Coder-UI-Coder - Source Model' } -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtSourceCoderViewModel >> debug [ ^ self selection isEmpty ifTrue: [ self debugAll ] ifFalse: [ self debugIt: self selectedTextInterval ] ] -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtSourceCoderViewModel >> debugAll [ ^ self coderModel debugInContext: self evaluationContext all ] -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtSourceCoderViewModel >> debugIt: aTextInterval [ ^ self coderModel debugInContext: (self evaluationContext from: aTextInterval first to: aTextInterval last) ] -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtSourceCoderViewModel >> discardChanges [ self coder discardChanges ] -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtSourceCoderViewModel >> doIt [ "Evaluate a piece of source code within a selection interval or everything if nothing is selected and return a result" @@ -38,7 +38,7 @@ GtSourceCoderViewModel >> doIt [ ^ self doItRequestedBy: self ] -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtSourceCoderViewModel >> doIt: aTextInterval [ "Evaluate a piece of source code within an interval and return a result. I am also able to evaluate an empty or only consisting of whitespace @@ -48,7 +48,7 @@ GtSourceCoderViewModel >> doIt: aTextInterval [ ^ self doIt: aTextInterval requestedBy: self ] -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtSourceCoderViewModel >> doIt: aTextInterval requestedBy: aRequesterObject [ "Evaluate source code within given text interval and return the result" @@ -57,14 +57,14 @@ GtSourceCoderViewModel >> doIt: aTextInterval requestedBy: aRequesterObject [ requesterObject: aRequesterObject) ] -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtSourceCoderViewModel >> doItAll [ "Evaluate the whole source code and return the result" ^ self doItAllRequestedBy: self ] -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtSourceCoderViewModel >> doItAllRequestedBy: aRequesterObject [ "Evaluate the whole source code independent from the selection and return the result" @@ -73,7 +73,7 @@ GtSourceCoderViewModel >> doItAllRequestedBy: aRequesterObject [ requesterObject: aRequesterObject) ] -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtSourceCoderViewModel >> doItAndGo [ "Evaluate selected source code or everything if there is nothing selected and inspect the result" @@ -82,21 +82,21 @@ GtSourceCoderViewModel >> doItAndGo [ ifFalse: [ self doItAndGo: self selectedTextInterval ] ] -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtSourceCoderViewModel >> doItAndGo: aTextInterval [ "Evaluate a piece of source code within an interval and inspect a result." ^ self coder doItAndGoInContext: (self evaluationContext from: aTextInterval first to: aTextInterval last) ] -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtSourceCoderViewModel >> doItAndGoAll [ "Evaluate the whole source code and inspect the result" ^ self coder doItAndGoInContext: self evaluationContext all ] -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtSourceCoderViewModel >> doItRequestedBy: aRequesterObject [ "Evaluate selected source code or everything if there is nothing selected and return the result" @@ -105,12 +105,12 @@ GtSourceCoderViewModel >> doItRequestedBy: aRequesterObject [ ifFalse: [ self doIt: self selectedTextInterval requestedBy: aRequesterObject ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderViewModel >> elementClass [ ^ GtExpandableSourceCoderElement ] -{ #category : #'private - evaluation' } +{ #category : 'private - evaluation' } GtSourceCoderViewModel >> evaluationContext [ @@ -118,17 +118,17 @@ GtSourceCoderViewModel >> evaluationContext [ requesterObject: self ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderViewModel >> evaluationResult [ ^ evaluationResult ] -{ #category : #accessing } +{ #category : 'accessing' } GtSourceCoderViewModel >> evaluationResult: anObject [ evaluationResult := anObject ] -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtSourceCoderViewModel >> printIt [ "Evaluate selected source code or everything if there is nothing selected and print the result" @@ -137,21 +137,21 @@ GtSourceCoderViewModel >> printIt [ ifFalse: [ self printIt: self selectedTextInterval ] ] -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtSourceCoderViewModel >> printIt: aTextInterval [ "Evaluate a piece of source code within an interval and print a result." ^ self coder printItInContext: (self evaluationContext from: aTextInterval first to: aTextInterval last) ] -{ #category : #'api - actions' } +{ #category : 'api - actions' } GtSourceCoderViewModel >> printItAll [ "Evaluate the whole source code and print the result" ^ self coder printItInContext: self evaluationContext all ] -{ #category : #'private - evaluation' } +{ #category : 'private - evaluation' } GtSourceCoderViewModel >> selectedTextInterval [ | anInterval | diff --git a/src/GToolkit-Coder-UI/GtSyncScrollRange.class.st b/src/GToolkit-Coder-UI/GtSyncScrollRange.class.st index edfd039d2..6b6af4542 100644 --- a/src/GToolkit-Coder-UI/GtSyncScrollRange.class.st +++ b/src/GToolkit-Coder-UI/GtSyncScrollRange.class.st @@ -1,6 +1,6 @@ Class { - #name : #GtSyncScrollRange, - #superclass : #Object, + #name : 'GtSyncScrollRange', + #superclass : 'Object', #instVars : [ 'leftFirst', 'leftLast', @@ -8,17 +8,17 @@ Class { 'rightLast', 'isDifference' ], - #category : #'GToolkit-Coder-UI-Diff' + #category : 'GToolkit-Coder-UI-Diff' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtSyncScrollRange class >> left: leftInteger right: rightInteger [ ^ self new initializeLeft: leftInteger right: rightInteger; yourself ] -{ #category : #syncing } +{ #category : 'syncing' } GtSyncScrollRange >> advanceBoth [ self leftSize = self rightSize ifTrue: [ leftLast := leftLast + 1. @@ -29,7 +29,7 @@ GtSyncScrollRange >> advanceBoth [ yourself ] -{ #category : #syncing } +{ #category : 'syncing' } GtSyncScrollRange >> advanceLeft [ self rightSize = 0 ifTrue: [ isDifference := true. @@ -40,7 +40,7 @@ GtSyncScrollRange >> advanceLeft [ yourself ] -{ #category : #syncing } +{ #category : 'syncing' } GtSyncScrollRange >> advanceRight [ self leftSize = 0 ifTrue: [ isDifference := true. @@ -51,7 +51,7 @@ GtSyncScrollRange >> advanceRight [ yourself ] -{ #category : #'initialize-release' } +{ #category : 'initialize-release' } GtSyncScrollRange >> initialize [ super initialize. isDifference := false. @@ -61,7 +61,7 @@ GtSyncScrollRange >> initialize [ rightLast := 0 ] -{ #category : #'initialize-release' } +{ #category : 'initialize-release' } GtSyncScrollRange >> initializeLeft: leftInteger right: rightInteger [ leftFirst := leftInteger. leftLast := leftInteger. @@ -69,27 +69,27 @@ GtSyncScrollRange >> initializeLeft: leftInteger right: rightInteger [ rightLast := rightInteger ] -{ #category : #testing } +{ #category : 'testing' } GtSyncScrollRange >> isDifference [ ^ isDifference ] -{ #category : #accessing } +{ #category : 'accessing' } GtSyncScrollRange >> leftFirst [ ^ leftFirst ] -{ #category : #accessing } +{ #category : 'accessing' } GtSyncScrollRange >> leftLast [ ^ leftLast ] -{ #category : #accessing } +{ #category : 'accessing' } GtSyncScrollRange >> leftSize [ ^ leftLast - leftFirst ] -{ #category : #syncing } +{ #category : 'syncing' } GtSyncScrollRange >> mergeWith: aRange [ leftFirst := leftFirst min: aRange leftFirst. leftLast := leftLast max: aRange leftLast. @@ -97,7 +97,7 @@ GtSyncScrollRange >> mergeWith: aRange [ rightLast := rightLast max: aRange rightLast ] -{ #category : #testing } +{ #category : 'testing' } GtSyncScrollRange >> overlapsLeft: leftInterval orRight: rightInterval [ ^ ((self leftLast < leftInterval first or: [ self leftFirst > leftInterval last ]) @@ -105,7 +105,7 @@ GtSyncScrollRange >> overlapsLeft: leftInterval orRight: rightInterval [ or: [ self rightFirst > rightInterval last ] ]) not ] -{ #category : #printing } +{ #category : 'printing' } GtSyncScrollRange >> printOn: aStream [ super printOn: aStream. aStream @@ -123,17 +123,17 @@ GtSyncScrollRange >> printOn: aStream [ nextPut: $] ] -{ #category : #accessing } +{ #category : 'accessing' } GtSyncScrollRange >> rightFirst [ ^ rightFirst ] -{ #category : #accessing } +{ #category : 'accessing' } GtSyncScrollRange >> rightLast [ ^ rightLast ] -{ #category : #accessing } +{ #category : 'accessing' } GtSyncScrollRange >> rightSize [ ^ rightLast - rightFirst ] diff --git a/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st b/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st index 196ebc1f7..271416dbb 100644 --- a/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st +++ b/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st @@ -1,13 +1,13 @@ Class { - #name : #GtSyncScrollRanges, - #superclass : #Object, + #name : 'GtSyncScrollRanges', + #superclass : 'Object', #instVars : [ 'ranges' ], - #category : #'GToolkit-Coder-UI-Diff' + #category : 'GToolkit-Coder-UI-Diff' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtSyncScrollRanges class >> createFromDiff: aDiffBuilder [ | syncScroll | syncScroll := self new. @@ -19,19 +19,19 @@ GtSyncScrollRanges class >> createFromDiff: aDiffBuilder [ ^ syncScroll ] -{ #category : #examples } +{ #category : 'examples' } GtSyncScrollRanges class >> example [ ^ self createFromDiff: self exampleDiff ] -{ #category : #examples } +{ #category : 'examples' } GtSyncScrollRanges class >> exampleDiff [ ^ TextDiffBuilder from: self originalString to: self newString ] -{ #category : #examples } +{ #category : 'examples' } GtSyncScrollRanges class >> newString [ ^ '1 @@ -43,7 +43,7 @@ GtSyncScrollRanges class >> newString [ 9' ] -{ #category : #examples } +{ #category : 'examples' } GtSyncScrollRanges class >> originalString [ ^ '1 @@ -56,28 +56,28 @@ GtSyncScrollRanges class >> originalString [ 10' ] -{ #category : #'private-creation' } +{ #category : 'private-creation' } GtSyncScrollRanges >> advanceBoth [ ranges last advanceBoth ifNotNil: [ :range | ranges add: range ] ] -{ #category : #'private-creation' } +{ #category : 'private-creation' } GtSyncScrollRanges >> advanceLeft [ ranges last advanceLeft ifNotNil: [ :range | ranges add: range ] ] -{ #category : #'private-creation' } +{ #category : 'private-creation' } GtSyncScrollRanges >> advanceRight [ ranges last advanceRight ifNotNil: [ :range | ranges add: range ] ] -{ #category : #'initialize-release' } +{ #category : 'initialize-release' } GtSyncScrollRanges >> initialize [ super initialize. ranges := OrderedCollection with: GtSyncScrollRange new ] -{ #category : #accessing } +{ #category : 'accessing' } GtSyncScrollRanges >> leftLineFor: rightIndex [ | range | range := ranges @@ -89,7 +89,7 @@ GtSyncScrollRanges >> leftLineFor: rightIndex [ * range leftSize + range leftFirst) rounded ] -{ #category : #'private-creation' } +{ #category : 'private-creation' } GtSyncScrollRanges >> mergeDifferences [ | index current previous | index := ranges size. @@ -103,13 +103,13 @@ GtSyncScrollRanges >> mergeDifferences [ current := previous ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtSyncScrollRanges >> rangesForLeft: leftInterval andRight: rightInterval [ ^ ranges select: [ :each | each overlapsLeft: leftInterval orRight: rightInterval ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtSyncScrollRanges >> rightLineFor: leftIndex [ | range | range := ranges diff --git a/src/GToolkit-Coder-UI/GtTextCoder.extension.st b/src/GToolkit-Coder-UI/GtTextCoder.extension.st index 6f65a9f19..d63f91914 100644 --- a/src/GToolkit-Coder-UI/GtTextCoder.extension.st +++ b/src/GToolkit-Coder-UI/GtTextCoder.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #GtTextCoder } +Extension { #name : 'GtTextCoder' } -{ #category : #'*GToolkit-Coder-UI' } +{ #category : '*GToolkit-Coder-UI' } GtTextCoder >> asCoderUIModel [ ^ GtTextualCoderViewModel new coder: self ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoder.extension.st b/src/GToolkit-Coder-UI/GtTextualCoder.extension.st index 53c367312..9191fb99d 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoder.extension.st +++ b/src/GToolkit-Coder-UI/GtTextualCoder.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #GtTextualCoder } +Extension { #name : 'GtTextualCoder' } -{ #category : #'*GToolkit-Coder-UI' } +{ #category : '*GToolkit-Coder-UI' } GtTextualCoder >> breadcrumbActions [ diff --git a/src/GToolkit-Coder-UI/GtTextualCoderCopyContextMenuItemId.class.st b/src/GToolkit-Coder-UI/GtTextualCoderCopyContextMenuItemId.class.st index 55acfa133..863af42aa 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderCopyContextMenuItemId.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderCopyContextMenuItemId.class.st @@ -4,12 +4,12 @@ A context menu action to copy a text " Class { - #name : #GtTextualCoderCopyContextMenuItemId, - #superclass : #GtCoderElementId, - #category : #'GToolkit-Coder-UI-Coder - Basic' + #name : 'GtTextualCoderCopyContextMenuItemId', + #superclass : 'GtCoderElementId', + #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : #converting } +{ #category : 'converting' } GtTextualCoderCopyContextMenuItemId >> asSymbol [ ^ #'context-menu-item--copy' ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderCutContextMenuItemId.class.st b/src/GToolkit-Coder-UI/GtTextualCoderCutContextMenuItemId.class.st index 6186f955a..72db20acb 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderCutContextMenuItemId.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderCutContextMenuItemId.class.st @@ -4,12 +4,12 @@ A context menu action to cut text " Class { - #name : #GtTextualCoderCutContextMenuItemId, - #superclass : #GtCoderElementId, - #category : #'GToolkit-Coder-UI-Coder - Basic' + #name : 'GtTextualCoderCutContextMenuItemId', + #superclass : 'GtCoderElementId', + #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : #converting } +{ #category : 'converting' } GtTextualCoderCutContextMenuItemId >> asSymbol [ ^ #'context-menu-item--cut' ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 055ccf64e..eabc0cff2 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -1,6 +1,6 @@ Class { - #name : #GtTextualCoderEditorElement, - #superclass : #BrEditor, + #name : 'GtTextualCoderEditorElement', + #superclass : 'BrEditor', #traits : 'TBlAssertUIProcess + TGtWithTextualCoderViewModel', #classTraits : 'TBlAssertUIProcess classTrait + TGtWithTextualCoderViewModel classTrait', #instVars : [ @@ -9,15 +9,15 @@ Class { 'evaluationPrinter', 'shortcuts' ], - #category : #'GToolkit-Coder-UI-Coder - Textual' + #category : 'GToolkit-Coder-UI-Coder - Textual' } -{ #category : #'api - textual coder view model' } +{ #category : 'api - textual coder view model' } GtTextualCoderEditorElement >> coderUIModel: aTextualCoderViewModel [ self textualCoderViewModel: aTextualCoderViewModel ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtTextualCoderEditorElement >> createContextMenuContent [ "wait for the addons to be computed" | theContextMenu | @@ -39,7 +39,7 @@ GtTextualCoderEditorElement >> createContextMenuContent [ ^ theContextMenu ] -{ #category : #private } +{ #category : 'private' } GtTextualCoderEditorElement >> hideHighlighters [ self text clearAttributes: [ :eachAttribute | eachAttribute isKindOf: GtSourceCoderErrorAttribute ]. @@ -47,7 +47,7 @@ GtTextualCoderEditorElement >> hideHighlighters [ evaluationPrinter hideResultSynchronously. ] -{ #category : #private } +{ #category : 'private' } GtTextualCoderEditorElement >> highlightPCRangeForInterval: aSelectionInterval [ self textualCoderViewModel isModified ifTrue: [ ^ self ]. @@ -61,7 +61,7 @@ GtTextualCoderEditorElement >> highlightPCRangeForInterval: aSelectionInterval [ beNotOverwritableByStyler ] ] -{ #category : #initialization } +{ #category : 'initialization' } GtTextualCoderEditorElement >> initialize [ super initialize. @@ -84,7 +84,7 @@ GtTextualCoderEditorElement >> initialize [ self initializeListeners ] -{ #category : #initialization } +{ #category : 'initialization' } GtTextualCoderEditorElement >> initializeListeners [ self when: BlFocusInEvent do: [ :anEvent | self textualCoderViewModel focused: true from: self ]. @@ -111,13 +111,13 @@ GtTextualCoderEditorElement >> initializeListeners [ do: [ :anEvent | self textualCoderViewModel styledText: anEvent styledText ] ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtTextualCoderEditorElement >> onCodeEvaluated: anEvaluationAnnouncement [ evaluationHighlighter displayResult: anEvaluationAnnouncement evaluationResult. evaluationPrinter hideResult ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtTextualCoderEditorElement >> onCoderParseError: aGtCoderParseError [ "A parse error can be notifying from a non-UI thread" @@ -127,14 +127,14 @@ GtTextualCoderEditorElement >> onCoderParseError: aGtCoderParseError [ at: aGtCoderParseError location ]) ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtTextualCoderEditorElement >> onCoderViewModelFocused: aBoolean [ aBoolean ifTrue: [ self requestFocus ] ifFalse: [ self loseFocus ] ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtTextualCoderEditorElement >> onContextPCRangeChanged: aContextPCRangeChangedAnnouncement [ | selectionInterval | @@ -142,7 +142,7 @@ GtTextualCoderEditorElement >> onContextPCRangeChanged: aContextPCRangeChangedAn self highlightPCRangeForInterval: selectionInterval ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtTextualCoderEditorElement >> onCursorsChanged: aCursorsChangedAnnouncement [ "Is sent when the cursors change in the View Model. May be sent from a non-UI thread" @@ -160,7 +160,7 @@ GtTextualCoderEditorElement >> onCursorsChanged: aCursorsChangedAnnouncement [ apply ]) ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtTextualCoderEditorElement >> onFocusChangedAnnouncement: anAnnouncement [ self assertUIProcess. @@ -173,7 +173,7 @@ GtTextualCoderEditorElement >> onFocusChangedAnnouncement: anAnnouncement [ self onCoderViewModelFocused: anAnnouncement focused ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtTextualCoderEditorElement >> onObjectSpawnRequest: anAnnouncement [ self enqueueTask: (BlTaskAction new action: [ self phlow @@ -181,7 +181,7 @@ GtTextualCoderEditorElement >> onObjectSpawnRequest: anAnnouncement [ withDestination: anAnnouncement spawnDestination ]) ] -{ #category : #'api - textual coder view model' } +{ #category : 'api - textual coder view model' } GtTextualCoderEditorElement >> onPostTextualCoderViewModelChanged [ "I am an optional hook method that is sent after #subscribeToTextualCoderViewModel. I do nothing by default but allow users to perform update operations when a receiver object is already @@ -194,13 +194,13 @@ GtTextualCoderEditorElement >> onPostTextualCoderViewModelChanged [ self textualCoderViewModel addOnsAsyncDo: [ :theAddOns | self onViewModelReadyToStyle ] ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtTextualCoderEditorElement >> onPrintRequest: anEvaluationAnnouncement [ evaluationHighlighter hideResult. evaluationPrinter displayResult: anEvaluationAnnouncement evaluationResult. ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtTextualCoderEditorElement >> onShowDebuggerRequest: aShowDebuggerAnnouncement [ | sharedDebugSession anEvaluatedSource anEvaluatedInterval theSourceStartInText theSourceEndInText | @@ -236,19 +236,19 @@ GtTextualCoderEditorElement >> onShowDebuggerRequest: aShowDebuggerAnnouncement debugSession: sharedDebugSession) ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtTextualCoderEditorElement >> onStyleTextRequest: anEvent [ "onStyleTextRequest: may be sent from a non-UI thread" self enqueueTask: (BlTaskAction new action: [ self styleTextAndAfterDo: anEvent afterAction ]) ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtTextualCoderEditorElement >> onStylersUpdated: anAnnouncement [ ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtTextualCoderEditorElement >> onTextModified [ "Is sent when the text changes in the editor. Here we should synchronise the UI and the model." @@ -258,7 +258,7 @@ GtTextualCoderEditorElement >> onTextModified [ synchronously: true ] -{ #category : #'api - textual coder view model' } +{ #category : 'api - textual coder view model' } GtTextualCoderEditorElement >> onTextualCoderViewModelChanged [ "Is sent when a new textualCoder view model is assigned to the element. Note: #onTextualCoderViewModelChanged is sent before #subscribeToTextualCoderViewModel @@ -281,7 +281,7 @@ GtTextualCoderEditorElement >> onTextualCoderViewModelChanged [ completion strategy: self textualCoderViewModel coderModel completionStrategy ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtTextualCoderEditorElement >> onToolSpawnRequest: anAnnouncement [ self enqueueTask: (BlTaskAction new action: [ self phlow @@ -289,12 +289,12 @@ GtTextualCoderEditorElement >> onToolSpawnRequest: anAnnouncement [ withDestination: anAnnouncement spawnDestination ]) ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtTextualCoderEditorElement >> onUpdateAddOnsRequest: anAnnouncement [ ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtTextualCoderEditorElement >> onViewModelCursorsChanged: aCursorsChangedAnnouncement [ "Is sent when the cursors changes in the View Model. May be sent from a non-UI thread" @@ -315,12 +315,12 @@ GtTextualCoderEditorElement >> onViewModelCursorsChanged: aCursorsChangedAnnounc apply ]) ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtTextualCoderEditorElement >> onViewModelReadyToStyle [ self enqueueTask: (BlTaskAction new action: [ self editor styleText ]) ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtTextualCoderEditorElement >> onViewModelSelectionChanged: aSelectionChangedAnnouncement [ "Is sent when the selection changes in the View Model. May be sent from a non-UI thread" @@ -341,7 +341,7 @@ GtTextualCoderEditorElement >> onViewModelSelectionChanged: aSelectionChangedAnn select ]) ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtTextualCoderEditorElement >> onViewModelShortcutsChanged [ "Is sent when the shortcuts change in the View Model. May be sent from a non-UI thread" @@ -353,17 +353,17 @@ GtTextualCoderEditorElement >> onViewModelShortcutsChanged [ self editor addEditorShortcuts: shortcuts ]) ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtTextualCoderEditorElement >> onViewModelStyledTextChanged: anAnnouncement [ ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtTextualCoderEditorElement >> onViewModelStylersChanged [ self enqueueTask: (BlTaskAction new action: [ self styler: self textualCoderViewModel compositeStyler ]) ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtTextualCoderEditorElement >> onViewModelTextAttributesAdded: anAnnouncement [ self enqueueTask: (BlTaskAction new action: [ anAnnouncement coderTextAttributes @@ -372,13 +372,13 @@ GtTextualCoderEditorElement >> onViewModelTextAttributesAdded: anAnnouncement [ to: anAnnouncement stopPosition ]) ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtTextualCoderEditorElement >> onViewModelTextAttributesRemoved: anAnnouncement [ self enqueueTask: (BlTaskAction new action: [ anAnnouncement coderTextAttributes removeFromEditorText: self text ]) ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtTextualCoderEditorElement >> onViewModelTextChanged: aGtTextualCoderViewModelTextChanged [ aGtTextualCoderViewModelTextChanged source == self @@ -393,7 +393,7 @@ GtTextualCoderEditorElement >> onViewModelTextChanged: aGtTextualCoderViewModelT self hideHighlighters ]) ] ] -{ #category : #registration } +{ #category : 'registration' } GtTextualCoderEditorElement >> registerCoderModelAnnouncementsFor: aCoderModel [ aCoderModel announcer weak when: GtCoderAddOnsUpdateRequest @@ -415,7 +415,7 @@ GtTextualCoderEditorElement >> registerCoderModelAnnouncementsFor: aCoderModel [ to: self ] -{ #category : #registration } +{ #category : 'registration' } GtTextualCoderEditorElement >> registerCoderViewModelAnnouncementsFor: aGtSourceCoderUIModel [ aGtSourceCoderUIModel weak when: GtMethodCoderContextPCRangeChanged @@ -454,7 +454,7 @@ GtTextualCoderEditorElement >> registerCoderViewModelAnnouncementsFor: aGtSource to: self. ] -{ #category : #private } +{ #category : 'private' } GtTextualCoderEditorElement >> reportParseError: aString at: anInteger [ | text position | @@ -471,17 +471,17 @@ GtTextualCoderEditorElement >> reportParseError: aString at: anInteger [ to: position ] -{ #category : #private } +{ #category : 'private' } GtTextualCoderEditorElement >> styleText [ self editor styleText ] -{ #category : #private } +{ #category : 'private' } GtTextualCoderEditorElement >> styleTextAndAfterDo: aBlock [ self editor styleTextAndAfterDo: aBlock ] -{ #category : #'api - textual coder view model' } +{ #category : 'api - textual coder view model' } GtTextualCoderEditorElement >> subscribeToTextualCoderViewModel [ "Is sent after a new textualCoder view model is assigned to the element. It is required to unsubscribe from the view model or domain model by implementing @@ -493,7 +493,7 @@ GtTextualCoderEditorElement >> subscribeToTextualCoderViewModel [ completion install ] -{ #category : #'api - textual coder view model' } +{ #category : 'api - textual coder view model' } GtTextualCoderEditorElement >> unsubscribeFromTextualCoderViewModel [ "Is sent before a new textualCoder view model is assigned to the element. Elements that subscribe to textualCoder view model in domain model are required to implement this methods." diff --git a/src/GToolkit-Coder-UI/GtTextualCoderPasteContextMenuItemId.class.st b/src/GToolkit-Coder-UI/GtTextualCoderPasteContextMenuItemId.class.st index a63874090..37ba25bea 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderPasteContextMenuItemId.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderPasteContextMenuItemId.class.st @@ -4,12 +4,12 @@ A context menu action to paste a text " Class { - #name : #GtTextualCoderPasteContextMenuItemId, - #superclass : #GtCoderElementId, - #category : #'GToolkit-Coder-UI-Coder - Basic' + #name : 'GtTextualCoderPasteContextMenuItemId', + #superclass : 'GtCoderElementId', + #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : #converting } +{ #category : 'converting' } GtTextualCoderPasteContextMenuItemId >> asSymbol [ ^ #'context-menu-item--paste' ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st b/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st index 50c089c50..ac1c1f77e 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st @@ -1,14 +1,14 @@ Class { - #name : #GtTextualCoderTextAttributes, - #superclass : #Object, + #name : 'GtTextualCoderTextAttributes', + #superclass : 'Object', #instVars : [ 'markerAttribute', 'textAttributes' ], - #category : #'GToolkit-Coder-UI-Coder - Textual Model' + #category : 'GToolkit-Coder-UI-Coder - Textual Model' } -{ #category : #'api - attribute' } +{ #category : 'api - attribute' } GtTextualCoderTextAttributes >> applyOnEditorText: aText [ aText findAttribute: markerAttribute @@ -16,7 +16,7 @@ GtTextualCoderTextAttributes >> applyOnEditorText: aText [ aText attributes: textAttributes from: aStartPosition to: anEndPosition ] ] -{ #category : #'api - attribute' } +{ #category : 'api - attribute' } GtTextualCoderTextAttributes >> applyOnEditorText: aText from: aStartPosition to: anEndPosition [ aText findAttribute: markerAttribute @@ -26,27 +26,27 @@ GtTextualCoderTextAttributes >> applyOnEditorText: aText from: aStartPosition to aText attributes: { markerAttribute }, textAttributes from: aStartPosition to: anEndPosition ] -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderTextAttributes >> markerAttribute [ ^ markerAttribute ] -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderTextAttributes >> markerAttribute: anObject [ markerAttribute := anObject ] -{ #category : #'api - attribute' } +{ #category : 'api - attribute' } GtTextualCoderTextAttributes >> removeFromEditorText: aText [ aText removeAttributes: { self markerAttribute }, self textAttributes ] -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderTextAttributes >> textAttributes [ ^ textAttributes ] -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderTextAttributes >> textAttributes: anObject [ textAttributes := anObject ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 157102688..83da6625f 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -1,6 +1,6 @@ Class { - #name : #GtTextualCoderViewModel, - #superclass : #GtSingleCoderViewModel, + #name : 'GtTextualCoderViewModel', + #superclass : 'GtSingleCoderViewModel', #instVars : [ 'addOns', 'addOnMonitor', @@ -19,10 +19,10 @@ Class { 'extraTextAttributes', 'styledText' ], - #category : #'GToolkit-Coder-UI-Coder - Textual Model' + #category : 'GToolkit-Coder-UI-Coder - Textual Model' } -{ #category : #'api - add-ons' } +{ #category : 'api - add-ons' } GtTextualCoderViewModel >> addOnsAsyncDo: aBlock [ addOnMonitor critical: [ addOnCommand ifNotNil: [ @@ -55,7 +55,7 @@ GtTextualCoderViewModel >> addOnsAsyncDo: aBlock [ otherwise: [ addOnCommand execute ] ] ] -{ #category : #'api - add-ons' } +{ #category : 'api - add-ons' } GtTextualCoderViewModel >> addOnsAwait [ | theAddOns | @@ -64,7 +64,7 @@ GtTextualCoderViewModel >> addOnsAwait [ ^ theAddOns ] -{ #category : #'api - add-ons' } +{ #category : 'api - add-ons' } GtTextualCoderViewModel >> addOnsAwaitDo: aBlock [ | aSemaphore theAddOns | @@ -78,28 +78,28 @@ GtTextualCoderViewModel >> addOnsAwaitDo: aBlock [ aBlock value: theAddOns ] -{ #category : #'api - shortcuts' } +{ #category : 'api - shortcuts' } GtTextualCoderViewModel >> addShortcut: aShortcut [ "Add an extra shortcut add-on independent from the dynamically computed add-ons" extraAddOns addShortcut: aShortcut ] -{ #category : #'api - shortcuts' } +{ #category : 'api - shortcuts' } GtTextualCoderViewModel >> addStyler: aGtCoderStyler [ "Add an extra styler add-on independent from the dynamically computed add-ons" extraAddOns addStyler: aGtCoderStyler ] -{ #category : #'api - shortcuts' } +{ #category : 'api - shortcuts' } GtTextualCoderViewModel >> addStylers: aCollectionOfGtCoderStyler [ "Add extra styler add-ons independent from the dynamically computed add-ons" aCollectionOfGtCoderStyler do: [ :eachStyler | self addStyler: eachStyler ] ] -{ #category : #'api - text' } +{ #category : 'api - text' } GtTextualCoderViewModel >> addTextAttribute: aTextAttribute from: aStartPosition to: anEndPosition [ ^ self @@ -108,7 +108,7 @@ GtTextualCoderViewModel >> addTextAttribute: aTextAttribute from: aStartPosition to: anEndPosition ] -{ #category : #'api - text' } +{ #category : 'api - text' } GtTextualCoderViewModel >> addTextAttributes: aCollectionOfTextAttributes from: aStartPosition to: anEndPosition [ | aCurrentText aMarkerAttribute newCoderTextAttributes | @@ -132,7 +132,7 @@ GtTextualCoderViewModel >> addTextAttributes: aCollectionOfTextAttributes from: ^ newCoderTextAttributes ] -{ #category : #converting } +{ #category : 'converting' } GtTextualCoderViewModel >> asEditorState [ | anEditorText aMemento | @@ -158,22 +158,22 @@ GtTextualCoderViewModel >> asEditorState [ ^ aMemento ] -{ #category : #'api - coder model' } +{ #category : 'api - coder model' } GtTextualCoderViewModel >> astAsyncDo: aBlock [ ^ self coderModel astAsyncDo: aBlock ] -{ #category : #'api - coder model' } +{ #category : 'api - coder model' } GtTextualCoderViewModel >> astAwait [ ^ self coderModel astAwait ] -{ #category : #'api - expansion' } +{ #category : 'api - expansion' } GtTextualCoderViewModel >> collapse [ self expanded: false ] -{ #category : #'api - stylers' } +{ #category : 'api - stylers' } GtTextualCoderViewModel >> compositeStyler [ ^ GtCoderAstCompositeStyler new coderViewModel: self; @@ -181,7 +181,7 @@ GtTextualCoderViewModel >> compositeStyler [ yourself ] -{ #category : #'private - addons' } +{ #category : 'private - addons' } GtTextualCoderViewModel >> computeAddOns [ | aCoderModel newAddOns pragmas theAst | @@ -221,7 +221,7 @@ GtTextualCoderViewModel >> computeAddOns [ ^ newAddOns ] -{ #category : #'private - addons' } +{ #category : 'private - addons' } GtTextualCoderViewModel >> computeContextMenuAstAddOns [ | aCoderModel newAddOns pragmas theAst | @@ -254,12 +254,12 @@ GtTextualCoderViewModel >> computeContextMenuAstAddOns [ ^ newAddOns ] -{ #category : #'api - add-ons' } +{ #category : 'api - add-ons' } GtTextualCoderViewModel >> contextActions [ ^ contextActions ] -{ #category : #'api - add-ons' } +{ #category : 'api - add-ons' } GtTextualCoderViewModel >> contextActions: theContextActions [ contextActions = theContextActions ifTrue: [ ^ self ]. @@ -268,12 +268,12 @@ GtTextualCoderViewModel >> contextActions: theContextActions [ self announce: GtTextualCoderViewModelContextActionsChanged new ] -{ #category : #'api - add-ons' } +{ #category : 'api - add-ons' } GtTextualCoderViewModel >> contextMenuActions [ ^ contextMenuActions ] -{ #category : #'api - add-ons' } +{ #category : 'api - add-ons' } GtTextualCoderViewModel >> contextMenuActions: theContextMenuActions [ contextMenuActions = theContextMenuActions ifTrue: [ ^ self ]. @@ -282,19 +282,19 @@ GtTextualCoderViewModel >> contextMenuActions: theContextMenuActions [ self announce: GtTextualCoderViewModelContextMenuActionsChanged new ] -{ #category : #'api - cursors' } +{ #category : 'api - cursors' } GtTextualCoderViewModel >> cursors [ ^ cursors ] -{ #category : #'api - cursors' } +{ #category : 'api - cursors' } GtTextualCoderViewModel >> cursors: aBrTextEditorCursor [ self cursors: aBrTextEditorCursor from: self ] -{ #category : #'api - cursors' } +{ #category : 'api - cursors' } GtTextualCoderViewModel >> cursors: aBrTextEditorCursor from: aSourceObject [ cursors = aBrTextEditorCursor ifTrue: [ ^ self ]. @@ -303,27 +303,27 @@ GtTextualCoderViewModel >> cursors: aBrTextEditorCursor from: aSourceObject [ self notifyCursorsChanged: cursors from: aSourceObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderViewModel >> elementClass [ ^ GtTextualCoderEditorElement ] -{ #category : #'api - add-ons' } +{ #category : 'api - add-ons' } GtTextualCoderViewModel >> ensureAddOns [ self addOnsAsyncDo: [ :theAddOns | ] ] -{ #category : #'api - expansion' } +{ #category : 'api - expansion' } GtTextualCoderViewModel >> expand [ self expanded: true ] -{ #category : #'api - expansion' } +{ #category : 'api - expansion' } GtTextualCoderViewModel >> expanded [ ^ expanded ] -{ #category : #'api - expansion' } +{ #category : 'api - expansion' } GtTextualCoderViewModel >> expanded: aBoolean [ expanded = aBoolean ifTrue: [ ^ self ]. @@ -332,24 +332,24 @@ GtTextualCoderViewModel >> expanded: aBoolean [ self notifyExpansionChanged: expanded ] -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderViewModel >> extraTextAttributes [ ^ extraTextAttributes ] -{ #category : #'api - focus' } +{ #category : 'api - focus' } GtTextualCoderViewModel >> focused [ ^ hasFocus ] -{ #category : #'api - focus' } +{ #category : 'api - focus' } GtTextualCoderViewModel >> focused: aBoolean [ self focused: aBoolean from: self ] -{ #category : #'api - focus' } +{ #category : 'api - focus' } GtTextualCoderViewModel >> focused: aBoolean from: aSourceObject [ hasFocus = aBoolean ifTrue: [ ^ self ]. @@ -363,7 +363,7 @@ GtTextualCoderViewModel >> focused: aBoolean from: aSourceObject [ ifFalse: [ theCoders unfocusCoderUIModel: self ] ] ] -{ #category : #'gt-extension' } +{ #category : 'gt-extension' } GtTextualCoderViewModel >> gtInfo [ ^ Array streamContents: [ :aStream | aStream nextPut: (#coderModel -> self coderModel). @@ -380,7 +380,7 @@ GtTextualCoderViewModel >> gtInfo [ aStream nextPut: (#expanded -> self expanded) ] ] -{ #category : #'gt-extension' } +{ #category : 'gt-extension' } GtTextualCoderViewModel >> gtInfoFor: aView [ @@ -398,12 +398,12 @@ GtTextualCoderViewModel >> gtInfoFor: aView [ updateWhen: GtTextualCoderViewModelAnnouncement in: self announcer ] -{ #category : #'api - selection' } +{ #category : 'api - selection' } GtTextualCoderViewModel >> hasSelection [ ^ self selection isNotEmpty ] -{ #category : #'api - styled text' } +{ #category : 'api - styled text' } GtTextualCoderViewModel >> hasStyledText [ @@ -412,7 +412,7 @@ GtTextualCoderViewModel >> hasStyledText [ ^ styledText notNil ] -{ #category : #initialization } +{ #category : 'initialization' } GtTextualCoderViewModel >> initialize [ super initialize. @@ -432,12 +432,12 @@ GtTextualCoderViewModel >> initialize [ expanded := true ] -{ #category : #'api - add-ons' } +{ #category : 'api - add-ons' } GtTextualCoderViewModel >> mainActions [ ^ mainActions ] -{ #category : #'api - add-ons' } +{ #category : 'api - add-ons' } GtTextualCoderViewModel >> mainActions: theMainActions [ mainActions = theMainActions ifTrue: [ ^ self ]. @@ -446,48 +446,48 @@ GtTextualCoderViewModel >> mainActions: theMainActions [ self announce: GtTextualCoderViewModelMainActionsChanged new ] -{ #category : #'api - cursors' } +{ #category : 'api - cursors' } GtTextualCoderViewModel >> moveCursorAtEnd [ "Move the cursor at the end of the textual snippet" self moveCursorTo: self sourceText size ] -{ #category : #'api - cursors' } +{ #category : 'api - cursors' } GtTextualCoderViewModel >> moveCursorAtStart [ "Move the cursor at the end of the textual snippet" self moveCursorTo: 0 ] -{ #category : #'api - cursors' } +{ #category : 'api - cursors' } GtTextualCoderViewModel >> moveCursorTo: aCursorIndex [ self cursors: (BrTextEditorCursor at: aCursorIndex) ] -{ #category : #'private - notifying' } +{ #category : 'private - notifying' } GtTextualCoderViewModel >> notifyCursorsChanged: aBrTextEditorCursor from: aSourceObject [ self announce: (GtTextualCoderViewModelCursorsChanged new cursors: aBrTextEditorCursor; source: aSourceObject) ] -{ #category : #'private - notifying' } +{ #category : 'private - notifying' } GtTextualCoderViewModel >> notifyExpansionChanged: aBoolean [ self announce: (GtTextualCoderViewModelExpansionChanged new expanded: aBoolean) ] -{ #category : #'private - notifying' } +{ #category : 'private - notifying' } GtTextualCoderViewModel >> notifyFocusChanged: aBoolean from: aSourceObject [ self announcerUIModel announce: (GtSourceCoderFocusChanged new focused: aBoolean; source: aSourceObject) ] -{ #category : #'private - notifying' } +{ #category : 'private - notifying' } GtTextualCoderViewModel >> notifySelectionChanged: aBlCompositeSelection from: aSourceObject [ self announce: (GtTextualCoderViewModelSelectionChanged new selection: aBlCompositeSelection; source: aSourceObject) ] -{ #category : #'api - styled text' } +{ #category : 'api - styled text' } GtTextualCoderViewModel >> notifyStyledTextChanged [ "Override this notify method to announce changes to the property" @@ -496,7 +496,7 @@ GtTextualCoderViewModel >> notifyStyledTextChanged [ styledText: self styledText). ] -{ #category : #'private - addons' } +{ #category : 'private - addons' } GtTextualCoderViewModel >> onAddOnsChanged: theAddOns [ "Is sent when new add-ons are computed" @@ -507,7 +507,7 @@ GtTextualCoderViewModel >> onAddOnsChanged: theAddOns [ self contextMenuActions: theAddOns contextMenuActions ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtTextualCoderViewModel >> onAstChanged: anAstChangedAnnouncement [ "ast changed, the styled text may not be valid anymore" @@ -520,21 +520,21 @@ GtTextualCoderViewModel >> onAstChanged: anAstChangedAnnouncement [ self addOnsAsyncDo: [ :theAddOns | self announce: GtTextualCoderViewModelReadyToRestyle new ] ] -{ #category : #'api - styled text' } +{ #category : 'api - styled text' } GtTextualCoderViewModel >> onNewStyledTextSet: aNewStyledText [ "Is sent after a new value of the styledText is assigned" >#onNewPropertySetHookTemplate'> ] -{ #category : #'api - styled text' } +{ #category : 'api - styled text' } GtTextualCoderViewModel >> onPreviousStyledTextUnset: aPreviousStyledText [ "Is sent after a previous value of the styledText is de-assigned" >#onPreviousPropertyUnsetHookTemplate'> ] -{ #category : #'private - event handling' } +{ #category : 'private - event handling' } GtTextualCoderViewModel >> onSourceCodeChanged: anSourceCodeChangedAnnouncement [ "source code changed, meaning that the styled text is no longer correct" @@ -550,13 +550,13 @@ GtTextualCoderViewModel >> onSourceCodeChanged: anSourceCodeChangedAnnouncement self coderModel ensureAst ] -{ #category : #'api - text' } +{ #category : 'api - text' } GtTextualCoderViewModel >> removeAllCoderTextAttributes: aCollectionOfGtTextualCoderTextAttributes [ aCollectionOfGtTextualCoderTextAttributes do: [ :eachCoderTextAttribute | self removeCoderTextAttributes: eachCoderTextAttribute ] ] -{ #category : #'api - text' } +{ #category : 'api - text' } GtTextualCoderViewModel >> removeCoderTextAttributes: aGtTextualCoderTextAttributes [ | aCurrentText | @@ -571,31 +571,31 @@ GtTextualCoderViewModel >> removeCoderTextAttributes: aGtTextualCoderTextAttribu self announce: (GtTextualCoderViewModelTextAttributesRemoved new coderTextAttributes: aGtTextualCoderTextAttributes) ] -{ #category : #'api - selection' } +{ #category : 'api - selection' } GtTextualCoderViewModel >> select: aFromCursorIndex to: aToCursorIndex [ self selection: (self selection copy select: aFromCursorIndex to: aToCursorIndex) ] -{ #category : #'api - selection' } +{ #category : 'api - selection' } GtTextualCoderViewModel >> selectNone [ self selection: BlCompositeSelection new ] -{ #category : #'api - selection' } +{ #category : 'api - selection' } GtTextualCoderViewModel >> selection [ ^ selection ] -{ #category : #'api - selection' } +{ #category : 'api - selection' } GtTextualCoderViewModel >> selection: aBlCompositeSelection [ self selection: aBlCompositeSelection from: self ] -{ #category : #'api - selection' } +{ #category : 'api - selection' } GtTextualCoderViewModel >> selection: aBlCompositeSelection from: aSourceObject [ selection = aBlCompositeSelection ifTrue: [ ^ self ]. @@ -604,7 +604,7 @@ GtTextualCoderViewModel >> selection: aBlCompositeSelection from: aSourceObject self notifySelectionChanged: selection from: aSourceObject ] -{ #category : #'api - shortcuts' } +{ #category : 'api - shortcuts' } GtTextualCoderViewModel >> shortcuts [ "Return a collection of current editor shortcuts that are computed based on the coder add-ons and extra view-model add-ons. Do not modify the returned collection as it will be recomputed when ast or add-ons change; instead use #addShortcut:" @@ -613,7 +613,7 @@ GtTextualCoderViewModel >> shortcuts [ ^ shortcuts ] -{ #category : #'api - shortcuts' } +{ #category : 'api - shortcuts' } GtTextualCoderViewModel >> shortcuts: aCollectionOfShortcuts [ shortcuts = aCollectionOfShortcuts ifTrue: [ ^ self ]. @@ -622,7 +622,7 @@ GtTextualCoderViewModel >> shortcuts: aCollectionOfShortcuts [ self announce: GtTextualCoderViewModelShortcutsChanged new ] -{ #category : #'api - add-ons' } +{ #category : 'api - add-ons' } GtTextualCoderViewModel >> shouldAddOnsBeUpdated [ "Return true if addons should be updated, false otherwise. When a Coder Model is attached to the corresponding Element that element should check if addons need to be updated and if it is the case start the update with the help of ${method:GtCoderModel>>#updateAddOnsFrom:}$" @@ -634,14 +634,14 @@ GtTextualCoderViewModel >> shouldAddOnsBeUpdated [ ifNotNil: [ :theAddOns | theAddOns shouldBeUpdated ] ] ] -{ #category : #'api - text' } +{ #category : 'api - text' } GtTextualCoderViewModel >> sourceText [ ^ self coderModel sourceText ] -{ #category : #'api - text' } +{ #category : 'api - text' } GtTextualCoderViewModel >> sourceText: aNewSourceText from: aSourceObject synchronously: isSynchronous [ self coderModel currentSourceText: aNewSourceText @@ -650,7 +650,7 @@ GtTextualCoderViewModel >> sourceText: aNewSourceText from: aSourceObject synch isSynchronous: isSynchronous) ] -{ #category : #'api - styled text' } +{ #category : 'api - styled text' } GtTextualCoderViewModel >> styledText [ @@ -659,7 +659,7 @@ GtTextualCoderViewModel >> styledText [ ^ styledText ] -{ #category : #'api - styled text' } +{ #category : 'api - styled text' } GtTextualCoderViewModel >> styledText: aNewStyledText [ @@ -680,12 +680,12 @@ GtTextualCoderViewModel >> styledText: aNewStyledText [ self notifyStyledTextChanged ] -{ #category : #'api - stylers' } +{ #category : 'api - stylers' } GtTextualCoderViewModel >> stylers [ ^ stylers ] -{ #category : #'api - stylers' } +{ #category : 'api - stylers' } GtTextualCoderViewModel >> stylers: theStylers [ stylers = theStylers ifTrue: [ ^ self ]. @@ -700,7 +700,7 @@ GtTextualCoderViewModel >> stylers: theStylers [ self announce: GtTextualCoderViewModelStylersChanged new ] -{ #category : #'api - coder model' } +{ #category : 'api - coder model' } GtTextualCoderViewModel >> subscribeToCoderModel [ super subscribeToCoderModel. @@ -715,7 +715,7 @@ GtTextualCoderViewModel >> subscribeToCoderModel [ to: self ] -{ #category : #'api - add-ons' } +{ #category : 'api - add-ons' } GtTextualCoderViewModel >> terminateAddOnsCommand [ addOnMonitor critical: [ addOnCommand ifNotNil: [ :anAddOnsCommand | anAddOnsCommand terminate ]. @@ -723,7 +723,7 @@ GtTextualCoderViewModel >> terminateAddOnsCommand [ addOnCommandBlock := nil ] ] -{ #category : #'api - styled text' } +{ #category : 'api - styled text' } GtTextualCoderViewModel >> unsetStyledText [ >#propertyUnsetterTemplate'> @@ -738,7 +738,7 @@ GtTextualCoderViewModel >> unsetStyledText [ self notifyStyledTextChanged ] -{ #category : #'api - coder model' } +{ #category : 'api - coder model' } GtTextualCoderViewModel >> unsubscribeFromCoderModel [ super unsubscribeFromCoderModel. diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelAddOnsChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelAddOnsChanged.class.st index 1492dce24..2ebdf2585 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelAddOnsChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelAddOnsChanged.class.st @@ -1,18 +1,18 @@ Class { - #name : #GtTextualCoderViewModelAddOnsChanged, - #superclass : #GtTextualCoderViewModelAnnouncement, + #name : 'GtTextualCoderViewModelAddOnsChanged', + #superclass : 'GtTextualCoderViewModelAnnouncement', #instVars : [ 'addOns' ], - #category : #'GToolkit-Coder-UI-Coder - Textual Model - Events' + #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderViewModelAddOnsChanged >> addOns [ ^ addOns ] -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderViewModelAddOnsChanged >> addOns: anObject [ addOns := anObject ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelAnnouncement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelAnnouncement.class.st index 5958dfa76..25e571df2 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelAnnouncement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelAnnouncement.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtTextualCoderViewModelAnnouncement, - #superclass : #Announcement, - #category : #'GToolkit-Coder-UI-Coder - Textual Model - Events' + #name : 'GtTextualCoderViewModelAnnouncement', + #superclass : 'Announcement', + #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelAstChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelAstChanged.class.st index 5f09aed04..60dd1173d 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelAstChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelAstChanged.class.st @@ -1,18 +1,18 @@ Class { - #name : #GtTextualCoderViewModelAstChanged, - #superclass : #GtTextualCoderViewModelAnnouncement, + #name : 'GtTextualCoderViewModelAstChanged', + #superclass : 'GtTextualCoderViewModelAnnouncement', #instVars : [ 'ast' ], - #category : #'GToolkit-Coder-UI-Coder - Textual Model - Events' + #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderViewModelAstChanged >> ast [ ^ ast ] -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderViewModelAstChanged >> ast: anObject [ ast := anObject ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelContextActionsChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelContextActionsChanged.class.st index aa04d642a..6b006b2f7 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelContextActionsChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelContextActionsChanged.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtTextualCoderViewModelContextActionsChanged, - #superclass : #GtTextualCoderViewModelAnnouncement, - #category : #'GToolkit-Coder-UI-Coder - Textual Model - Events' + #name : 'GtTextualCoderViewModelContextActionsChanged', + #superclass : 'GtTextualCoderViewModelAnnouncement', + #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelContextMenuActionsChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelContextMenuActionsChanged.class.st index d4c00c6e0..35eff09fd 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelContextMenuActionsChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelContextMenuActionsChanged.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtTextualCoderViewModelContextMenuActionsChanged, - #superclass : #GtTextualCoderViewModelAnnouncement, - #category : #'GToolkit-Coder-UI-Coder - Textual Model - Events' + #name : 'GtTextualCoderViewModelContextMenuActionsChanged', + #superclass : 'GtTextualCoderViewModelAnnouncement', + #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelCursorsChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelCursorsChanged.class.st index ba76aa343..e1721c0cd 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelCursorsChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelCursorsChanged.class.st @@ -1,29 +1,29 @@ Class { - #name : #GtTextualCoderViewModelCursorsChanged, - #superclass : #GtTextualCoderViewModelAnnouncement, + #name : 'GtTextualCoderViewModelCursorsChanged', + #superclass : 'GtTextualCoderViewModelAnnouncement', #instVars : [ 'source', 'cursors' ], - #category : #'GToolkit-Coder-UI-Coder - Textual Model - Events' + #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderViewModelCursorsChanged >> cursors [ ^ cursors ] -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderViewModelCursorsChanged >> cursors: anObject [ cursors := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderViewModelCursorsChanged >> source [ ^ source ] -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderViewModelCursorsChanged >> source: anObject [ source := anObject ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelExpansionChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelExpansionChanged.class.st index c338626c2..0e793da52 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelExpansionChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelExpansionChanged.class.st @@ -1,18 +1,18 @@ Class { - #name : #GtTextualCoderViewModelExpansionChanged, - #superclass : #GtTextualCoderViewModelAnnouncement, + #name : 'GtTextualCoderViewModelExpansionChanged', + #superclass : 'GtTextualCoderViewModelAnnouncement', #instVars : [ 'expanded' ], - #category : #'GToolkit-Coder-UI-Coder - Textual Model - Events' + #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderViewModelExpansionChanged >> expanded [ ^ expanded ] -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderViewModelExpansionChanged >> expanded: aBoolean [ expanded := aBoolean ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelMainActionsChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelMainActionsChanged.class.st index 093608d39..ad3a090f6 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelMainActionsChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelMainActionsChanged.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtTextualCoderViewModelMainActionsChanged, - #superclass : #GtTextualCoderViewModelAnnouncement, - #category : #'GToolkit-Coder-UI-Coder - Textual Model - Events' + #name : 'GtTextualCoderViewModelMainActionsChanged', + #superclass : 'GtTextualCoderViewModelAnnouncement', + #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelReadyToRestyle.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelReadyToRestyle.class.st index d8e7bd19f..4203b075b 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelReadyToRestyle.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelReadyToRestyle.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtTextualCoderViewModelReadyToRestyle, - #superclass : #GtTextualCoderViewModelAnnouncement, - #category : #'GToolkit-Coder-UI-Coder - Textual Model - Events' + #name : 'GtTextualCoderViewModelReadyToRestyle', + #superclass : 'GtTextualCoderViewModelAnnouncement', + #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelSelectionChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelSelectionChanged.class.st index ba9545d3c..c9b976a50 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelSelectionChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelSelectionChanged.class.st @@ -1,29 +1,29 @@ Class { - #name : #GtTextualCoderViewModelSelectionChanged, - #superclass : #GtTextualCoderViewModelAnnouncement, + #name : 'GtTextualCoderViewModelSelectionChanged', + #superclass : 'GtTextualCoderViewModelAnnouncement', #instVars : [ 'source', 'selection' ], - #category : #'GToolkit-Coder-UI-Coder - Textual Model - Events' + #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderViewModelSelectionChanged >> selection [ ^ selection ] -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderViewModelSelectionChanged >> selection: anObject [ selection := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderViewModelSelectionChanged >> source [ ^ source ] -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderViewModelSelectionChanged >> source: anObject [ source := anObject ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelShortcutsChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelShortcutsChanged.class.st index a2cee72dd..49b725897 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelShortcutsChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelShortcutsChanged.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtTextualCoderViewModelShortcutsChanged, - #superclass : #GtTextualCoderViewModelAnnouncement, - #category : #'GToolkit-Coder-UI-Coder - Textual Model - Events' + #name : 'GtTextualCoderViewModelShortcutsChanged', + #superclass : 'GtTextualCoderViewModelAnnouncement', + #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelStyledTextChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelStyledTextChanged.class.st index ad52c6cbe..290eda7f9 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelStyledTextChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelStyledTextChanged.class.st @@ -1,13 +1,13 @@ Class { - #name : #GtTextualCoderViewModelStyledTextChanged, - #superclass : #GtTextualCoderViewModelAnnouncement, + #name : 'GtTextualCoderViewModelStyledTextChanged', + #superclass : 'GtTextualCoderViewModelAnnouncement', #instVars : [ 'styledText' ], - #category : #'GToolkit-Coder-UI-Coder - Textual Model - Events' + #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } -{ #category : #generated } +{ #category : 'generated' } GtTextualCoderViewModelStyledTextChanged >> styledText [ >#objectGetterTemplate'> @@ -15,7 +15,7 @@ GtTextualCoderViewModelStyledTextChanged >> styledText [ ^ styledText ] -{ #category : #generated } +{ #category : 'generated' } GtTextualCoderViewModelStyledTextChanged >> styledText: aStyledText [ >#objectSetterTemplate'> diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelStylersChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelStylersChanged.class.st index c1602a619..8abca3996 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelStylersChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelStylersChanged.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtTextualCoderViewModelStylersChanged, - #superclass : #GtTextualCoderViewModelAnnouncement, - #category : #'GToolkit-Coder-UI-Coder - Textual Model - Events' + #name : 'GtTextualCoderViewModelStylersChanged', + #superclass : 'GtTextualCoderViewModelAnnouncement', + #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextAttributesAdded.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextAttributesAdded.class.st index a29458ab4..69f35f6d9 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextAttributesAdded.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextAttributesAdded.class.st @@ -1,40 +1,40 @@ Class { - #name : #GtTextualCoderViewModelTextAttributesAdded, - #superclass : #GtTextualCoderViewModelAnnouncement, + #name : 'GtTextualCoderViewModelTextAttributesAdded', + #superclass : 'GtTextualCoderViewModelAnnouncement', #instVars : [ 'coderTextAttributes', 'startPosition', 'stopPosition' ], - #category : #'GToolkit-Coder-UI-Coder - Textual Model - Events' + #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderViewModelTextAttributesAdded >> coderTextAttributes [ ^ coderTextAttributes ] -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderViewModelTextAttributesAdded >> coderTextAttributes: anObject [ coderTextAttributes := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderViewModelTextAttributesAdded >> startPosition [ ^ startPosition ] -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderViewModelTextAttributesAdded >> startPosition: anObject [ startPosition := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderViewModelTextAttributesAdded >> stopPosition [ ^ stopPosition ] -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderViewModelTextAttributesAdded >> stopPosition: anObject [ stopPosition := anObject ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextAttributesRemoved.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextAttributesRemoved.class.st index a94532d85..e6e8241e6 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextAttributesRemoved.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextAttributesRemoved.class.st @@ -1,18 +1,18 @@ Class { - #name : #GtTextualCoderViewModelTextAttributesRemoved, - #superclass : #GtTextualCoderViewModelAnnouncement, + #name : 'GtTextualCoderViewModelTextAttributesRemoved', + #superclass : 'GtTextualCoderViewModelAnnouncement', #instVars : [ 'coderTextAttributes' ], - #category : #'GToolkit-Coder-UI-Coder - Textual Model - Events' + #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderViewModelTextAttributesRemoved >> coderTextAttributes [ ^ coderTextAttributes ] -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderViewModelTextAttributesRemoved >> coderTextAttributes: anObject [ coderTextAttributes := anObject ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextChanged.class.st index 12d5e1a7e..5d1e95353 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextChanged.class.st @@ -1,39 +1,39 @@ Class { - #name : #GtTextualCoderViewModelTextChanged, - #superclass : #GtTextualCoderViewModelAnnouncement, + #name : 'GtTextualCoderViewModelTextChanged', + #superclass : 'GtTextualCoderViewModelAnnouncement', #instVars : [ 'text', 'updateStrategy' ], - #category : #'GToolkit-Coder-UI-Coder - Textual Model - Events' + #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderViewModelTextChanged >> isSynchronous [ ^ self updateStrategy isSynchronous ] -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderViewModelTextChanged >> source [ ^ self updateStrategy source ] -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderViewModelTextChanged >> text [ ^ text ] -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderViewModelTextChanged >> text: anObject [ text := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderViewModelTextChanged >> updateStrategy [ ^ updateStrategy ] -{ #category : #accessing } +{ #category : 'accessing' } GtTextualCoderViewModelTextChanged >> updateStrategy: anObject [ updateStrategy := anObject ] diff --git a/src/GToolkit-Coder-UI/RBAddClassVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBAddClassVariableRefactoring.extension.st index 3afe79dd1..dc4dae786 100644 --- a/src/GToolkit-Coder-UI/RBAddClassVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBAddClassVariableRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBAddClassVariableRefactoring } +Extension { #name : 'RBAddClassVariableRefactoring' } -{ #category : #'*GToolkit-Coder-UI' } +{ #category : '*GToolkit-Coder-UI' } RBAddClassVariableRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/RBAddInstanceVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBAddInstanceVariableRefactoring.extension.st index c54c63196..1e6342e68 100644 --- a/src/GToolkit-Coder-UI/RBAddInstanceVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBAddInstanceVariableRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBAddInstanceVariableRefactoring } +Extension { #name : 'RBAddInstanceVariableRefactoring' } -{ #category : #'*GToolkit-Coder-UI' } +{ #category : '*GToolkit-Coder-UI' } RBAddInstanceVariableRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/RBRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRefactoring.extension.st index 5dfe0ecf1..5acca20e2 100644 --- a/src/GToolkit-Coder-UI/RBRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBRefactoring } +Extension { #name : 'RBRefactoring' } -{ #category : #'*GToolkit-Coder-UI' } +{ #category : '*GToolkit-Coder-UI' } RBRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/RBRemoveClassVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRemoveClassVariableRefactoring.extension.st index 515063afb..91780cc1c 100644 --- a/src/GToolkit-Coder-UI/RBRemoveClassVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBRemoveClassVariableRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBRemoveClassVariableRefactoring } +Extension { #name : 'RBRemoveClassVariableRefactoring' } -{ #category : #'*GToolkit-Coder-UI' } +{ #category : '*GToolkit-Coder-UI' } RBRemoveClassVariableRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/RBRemoveInstanceVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRemoveInstanceVariableRefactoring.extension.st index 54daab99c..661def9e9 100644 --- a/src/GToolkit-Coder-UI/RBRemoveInstanceVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBRemoveInstanceVariableRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBRemoveInstanceVariableRefactoring } +Extension { #name : 'RBRemoveInstanceVariableRefactoring' } -{ #category : #'*GToolkit-Coder-UI' } +{ #category : '*GToolkit-Coder-UI' } RBRemoveInstanceVariableRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/RBRenameClassRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRenameClassRefactoring.extension.st index 9e8c10631..a3377598d 100644 --- a/src/GToolkit-Coder-UI/RBRenameClassRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBRenameClassRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBRenameClassRefactoring } +Extension { #name : 'RBRenameClassRefactoring' } -{ #category : #'*GToolkit-Coder-UI' } +{ #category : '*GToolkit-Coder-UI' } RBRenameClassRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/RBRenameClassVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRenameClassVariableRefactoring.extension.st index fd3f38aa4..009ed66f1 100644 --- a/src/GToolkit-Coder-UI/RBRenameClassVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBRenameClassVariableRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBRenameClassVariableRefactoring } +Extension { #name : 'RBRenameClassVariableRefactoring' } -{ #category : #'*GToolkit-Coder-UI' } +{ #category : '*GToolkit-Coder-UI' } RBRenameClassVariableRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/RBRenameInstanceVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRenameInstanceVariableRefactoring.extension.st index 2b29bcf97..e1732c3f1 100644 --- a/src/GToolkit-Coder-UI/RBRenameInstanceVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBRenameInstanceVariableRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBRenameInstanceVariableRefactoring } +Extension { #name : 'RBRenameInstanceVariableRefactoring' } -{ #category : #'*GToolkit-Coder-UI' } +{ #category : '*GToolkit-Coder-UI' } RBRenameInstanceVariableRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/RBTransformation.extension.st b/src/GToolkit-Coder-UI/RBTransformation.extension.st index 2da892fec..85e4edab8 100644 --- a/src/GToolkit-Coder-UI/RBTransformation.extension.st +++ b/src/GToolkit-Coder-UI/RBTransformation.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBTransformation } +Extension { #name : 'RBTransformation' } -{ #category : #'*GToolkit-Coder-UI' } +{ #category : '*GToolkit-Coder-UI' } RBTransformation >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/TBlDevScripterTarget.extension.st b/src/GToolkit-Coder-UI/TBlDevScripterTarget.extension.st index ac516b20c..fdda33985 100644 --- a/src/GToolkit-Coder-UI/TBlDevScripterTarget.extension.st +++ b/src/GToolkit-Coder-UI/TBlDevScripterTarget.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #TBlDevScripterTarget } +Extension { #name : 'TBlDevScripterTarget' } -{ #category : #'*GToolkit-Coder-UI' } +{ #category : '*GToolkit-Coder-UI' } TBlDevScripterTarget >> onGtPharoSnippetDestinationButton [ self onChildNamed: #content; @@ -8,7 +8,7 @@ TBlDevScripterTarget >> onGtPharoSnippetDestinationButton [ onChildNamed: #switchButton ] -{ #category : #'*GToolkit-Coder-UI' } +{ #category : '*GToolkit-Coder-UI' } TBlDevScripterTarget >> onGtPharoSnippetEvaluateButton [ self "onChildOfClass: GtExpandableCoderElement;" @@ -20,7 +20,7 @@ TBlDevScripterTarget >> onGtPharoSnippetEvaluateButton [ onChildAt: 1 ] -{ #category : #'*GToolkit-Coder-UI' } +{ #category : '*GToolkit-Coder-UI' } TBlDevScripterTarget >> onGtPharoSnippetPlayButton [ self onChildNamed: #content; diff --git a/src/GToolkit-Coder-UI/TGtCoderNavigationClassesHelper.trait.st b/src/GToolkit-Coder-UI/TGtCoderNavigationClassesHelper.trait.st index bc14dbd20..c30cf9ec1 100644 --- a/src/GToolkit-Coder-UI/TGtCoderNavigationClassesHelper.trait.st +++ b/src/GToolkit-Coder-UI/TGtCoderNavigationClassesHelper.trait.st @@ -1,9 +1,9 @@ Trait { - #name : #TGtCoderNavigationClassesHelper, - #category : #'GToolkit-Coder-UI-Navigation' + #name : 'TGtCoderNavigationClassesHelper', + #category : 'GToolkit-Coder-UI-Navigation' } -{ #category : #'private - ui' } +{ #category : 'private - ui' } TGtCoderNavigationClassesHelper >> buildClassLabel: aClass [ | aLook aText | aLook := (BrGlamorousLabelAptitude new fontSize: 12). @@ -23,12 +23,12 @@ TGtCoderNavigationClassesHelper >> buildClassLabel: aClass [ text: aText. ] -{ #category : #'private - testing' } +{ #category : 'private - testing' } TGtCoderNavigationClassesHelper >> isAbstractClass: aClass [ ^ aClass isAbstract or: [ aClass hasAbstractMethods ] ] -{ #category : #'private - testing' } +{ #category : 'private - testing' } TGtCoderNavigationClassesHelper >> isDeprecatedClass: aClass [ ^ aClass isDeprecated ] diff --git a/src/GToolkit-Coder-UI/TGtWithCoderModel.trait.st b/src/GToolkit-Coder-UI/TGtWithCoderModel.trait.st index ac140505c..8af096e17 100644 --- a/src/GToolkit-Coder-UI/TGtWithCoderModel.trait.st +++ b/src/GToolkit-Coder-UI/TGtWithCoderModel.trait.st @@ -1,12 +1,12 @@ Trait { - #name : #TGtWithCoderModel, + #name : 'TGtWithCoderModel', #instVars : [ 'coderModel' ], - #category : #'GToolkit-Coder-UI-Coder - Basic' + #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : #'api - coder model' } +{ #category : 'api - coder model' } TGtWithCoderModel >> coderModel [ "Return a not-null coder model assigned to the receiver view model" self @@ -16,7 +16,7 @@ TGtWithCoderModel >> coderModel [ ^ coderModel ] -{ #category : #'api - coder model' } +{ #category : 'api - coder model' } TGtWithCoderModel >> coderModel: aCoderModel [ "Set a not-null coder domain model assigned to the receiver view model" self @@ -33,7 +33,7 @@ TGtWithCoderModel >> coderModel: aCoderModel [ self subscribeToCoderModel ] -{ #category : #'api - coder model' } +{ #category : 'api - coder model' } TGtWithCoderModel >> hasCoder [ "Return a true if coder model is assigned to the receiver, false otherwise" @@ -41,21 +41,21 @@ TGtWithCoderModel >> hasCoder [ ^ coderModel notNil ] -{ #category : #'api - coder model' } +{ #category : 'api - coder model' } TGtWithCoderModel >> onCoderModelChanged [ "Is sent when a new coder model is assigned to the view model" self explicitRequirement ] -{ #category : #'api - coder model' } +{ #category : 'api - coder model' } TGtWithCoderModel >> subscribeToCoderModel [ "Is sent after a new coder model is assigned to the view model. It is required to unsubscribe from the domain model by implementing #unsubscribeFromCoderModel if view model subscribes to them" ] -{ #category : #'api - coder model' } +{ #category : 'api - coder model' } TGtWithCoderModel >> unsubscribeFromCoderModel [ "Is sent before a new coder model is assigned to the view model. View models that subscribe to coder model are required to implement this methods" diff --git a/src/GToolkit-Coder-UI/TGtWithCoderToolViewModel.trait.st b/src/GToolkit-Coder-UI/TGtWithCoderToolViewModel.trait.st index 02f980f74..2fe498778 100644 --- a/src/GToolkit-Coder-UI/TGtWithCoderToolViewModel.trait.st +++ b/src/GToolkit-Coder-UI/TGtWithCoderToolViewModel.trait.st @@ -1,12 +1,12 @@ Trait { - #name : #TGtWithCoderToolViewModel, + #name : 'TGtWithCoderToolViewModel', #instVars : [ 'coderToolViewModel' ], - #category : #'GToolkit-Coder-UI-! Core - View Models' + #category : 'GToolkit-Coder-UI-! Core - View Models' } -{ #category : #'api - coder tool view model' } +{ #category : 'api - coder tool view model' } TGtWithCoderToolViewModel >> coderToolViewModel [ "Return a not-null coderTool view model assigned to the receiver element" self @@ -16,7 +16,7 @@ TGtWithCoderToolViewModel >> coderToolViewModel [ ^ coderToolViewModel ] -{ #category : #'api - coder tool view model' } +{ #category : 'api - coder tool view model' } TGtWithCoderToolViewModel >> coderToolViewModel: aCoderToolViewModel [ "Set a not-null coderTool view model assigned to the receiver element" self @@ -34,7 +34,7 @@ TGtWithCoderToolViewModel >> coderToolViewModel: aCoderToolViewModel [ self onPostCoderToolViewModelChanged ] -{ #category : #'api - coder tool view model' } +{ #category : 'api - coder tool view model' } TGtWithCoderToolViewModel >> hasCoderToolViewModel [ "Return a true if coderTool view model is assigned to the receiver element, false otherwise" @@ -42,7 +42,7 @@ TGtWithCoderToolViewModel >> hasCoderToolViewModel [ ^ coderToolViewModel notNil ] -{ #category : #'api - coder tool view model' } +{ #category : 'api - coder tool view model' } TGtWithCoderToolViewModel >> onCoderToolViewModelChanged [ "Is sent when a new coderTool view model is assigned to the element. Note: #onCoderToolViewModelChanged is sent before #subscribeToCoderToolViewModel @@ -53,21 +53,21 @@ TGtWithCoderToolViewModel >> onCoderToolViewModelChanged [ self explicitRequirement ] -{ #category : #'api - coder tool view model' } +{ #category : 'api - coder tool view model' } TGtWithCoderToolViewModel >> onPostCoderToolViewModelChanged [ "I am an optional hook method that is sent after #subscribeToCoderToolViewModel. I do nothing by default but allow users to perform update operations when a receiver object is already subscribed to announcements." ] -{ #category : #'api - coder tool view model' } +{ #category : 'api - coder tool view model' } TGtWithCoderToolViewModel >> subscribeToCoderToolViewModel [ "Is sent after a new coderTool view model is assigned to the element. It is required to unsubscribe from the view model or domain model by implementing #unsubscribeFromCoderToolViewModel if elements subscribe to them" ] -{ #category : #'api - coder tool view model' } +{ #category : 'api - coder tool view model' } TGtWithCoderToolViewModel >> unsubscribeFromCoderToolViewModel [ "Is sent before a new coderTool view model is assigned to the element. Elements that subscribe to coderTool view model in domain model are required to implement this methods." diff --git a/src/GToolkit-Coder-UI/TGtWithTextualCoderViewModel.trait.st b/src/GToolkit-Coder-UI/TGtWithTextualCoderViewModel.trait.st index 15a90478b..ce8a7ea3c 100644 --- a/src/GToolkit-Coder-UI/TGtWithTextualCoderViewModel.trait.st +++ b/src/GToolkit-Coder-UI/TGtWithTextualCoderViewModel.trait.st @@ -1,12 +1,12 @@ Trait { - #name : #TGtWithTextualCoderViewModel, + #name : 'TGtWithTextualCoderViewModel', #instVars : [ 'textualCoderViewModel' ], - #category : #'GToolkit-Coder-UI-Coder - Textual' + #category : 'GToolkit-Coder-UI-Coder - Textual' } -{ #category : #'api - textual coder view model' } +{ #category : 'api - textual coder view model' } TGtWithTextualCoderViewModel >> hasTextualCoderViewModel [ "Return a true if textualCoder view model is assigned to the receiver element, false otherwise" @@ -14,14 +14,14 @@ TGtWithTextualCoderViewModel >> hasTextualCoderViewModel [ ^ textualCoderViewModel notNil ] -{ #category : #'api - textual coder view model' } +{ #category : 'api - textual coder view model' } TGtWithTextualCoderViewModel >> onPostTextualCoderViewModelChanged [ "I am an optional hook method that is sent after #subscribeToTextualCoderViewModel. I do nothing by default but allow users to perform update operations when a receiver object is already subscribed to announcements." ] -{ #category : #'api - textual coder view model' } +{ #category : 'api - textual coder view model' } TGtWithTextualCoderViewModel >> onTextualCoderViewModelChanged [ "Is sent when a new textualCoder view model is assigned to the element. Note: #onTextualCoderViewModelChanged is sent before #subscribeToTextualCoderViewModel @@ -32,14 +32,14 @@ TGtWithTextualCoderViewModel >> onTextualCoderViewModelChanged [ self explicitRequirement ] -{ #category : #'api - textual coder view model' } +{ #category : 'api - textual coder view model' } TGtWithTextualCoderViewModel >> subscribeToTextualCoderViewModel [ "Is sent after a new textualCoder view model is assigned to the element. It is required to unsubscribe from the view model or domain model by implementing #unsubscribeFromTextualCoderViewModel if elements subscribe to them" ] -{ #category : #'api - textual coder view model' } +{ #category : 'api - textual coder view model' } TGtWithTextualCoderViewModel >> textualCoderViewModel [ "Return a not-null textualCoder view model assigned to the receiver element" self @@ -49,7 +49,7 @@ TGtWithTextualCoderViewModel >> textualCoderViewModel [ ^ textualCoderViewModel ] -{ #category : #'api - textual coder view model' } +{ #category : 'api - textual coder view model' } TGtWithTextualCoderViewModel >> textualCoderViewModel: aTextualCoderViewModel [ "Set a not-null textualCoder view model assigned to the receiver element" self @@ -67,7 +67,7 @@ TGtWithTextualCoderViewModel >> textualCoderViewModel: aTextualCoderViewModel [ self onPostTextualCoderViewModelChanged ] -{ #category : #'api - textual coder view model' } +{ #category : 'api - textual coder view model' } TGtWithTextualCoderViewModel >> unsubscribeFromTextualCoderViewModel [ "Is sent before a new textualCoder view model is assigned to the element. Elements that subscribe to textualCoder view model in domain model are required to implement this methods." diff --git a/src/GToolkit-Coder-UI/package.st b/src/GToolkit-Coder-UI/package.st index 1af08cc70..433afab60 100644 --- a/src/GToolkit-Coder-UI/package.st +++ b/src/GToolkit-Coder-UI/package.st @@ -1 +1 @@ -Package { #name : #'GToolkit-Coder-UI' } +Package { #name : 'GToolkit-Coder-UI' } From 2647e65b4f8060b8b952d12932039690b7da4764 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Wed, 25 Aug 2021 19:26:54 +0200 Subject: [PATCH 0008/1268] fix fixit menu action --- src/GToolkit-Coder-AddOns/GtFixItAction.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-AddOns/GtFixItAction.class.st b/src/GToolkit-Coder-AddOns/GtFixItAction.class.st index 86db5117c..107dbcc13 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItAction.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItAction.class.st @@ -49,7 +49,7 @@ GtFixItAction >> id [ { #category : 'private' } GtFixItAction >> menuActionWithIndex: anIndex [ ^ GtCoderContextMenuAction new - action: [ :aCoderViewModel :anEvent :anEditorElement | + action: [ :aCoderViewModel :anEditorElement | aCoderViewModel selectNone. self executeOn: anEditorElement ]; title: self description; From b4d23cca3d11841c88f2d6f98a933980daf72b61 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 26 Aug 2021 12:01:35 +0200 Subject: [PATCH 0009/1268] fix source coder refactoring controller --- .../GtSourceCoderRefactoringController.class.st | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st b/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st index 54fca49a0..f6744eee5 100644 --- a/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st +++ b/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st @@ -130,6 +130,10 @@ GtSourceCoderRefactoringController >> sourceElement [ { #category : 'accessing' } GtSourceCoderRefactoringController >> sourceElement: textElement [ + self + assert: [ textElement isKindOf: BlElement ] + description: [ 'A source must be an element' ]. + sourceElement := textElement ] From dc0084e24db0f45507b60532222801c9f12beb6e Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Fri, 27 Aug 2021 19:35:33 +0200 Subject: [PATCH 0010/1268] [feenkcom/gtoolkit#2095] add a proof of concept support of async stream --- .../BaselineOfGToolkitCoder.class.st | 12 +- src/BaselineOfGToolkitCoder/package.st | 2 +- .../GtAsyncSearchGroupStream.class.st | 142 ++++++++++++++++++ .../GtAsyncSearchNullGroupStream.class.st | 23 +++ .../GtAsyncSearchTypedGroupStream.class.st | 36 +++++ src/GToolkit-Coder/GtSearchFilter.class.st | 40 +++++ .../GtSearchTypedEntitiesFilter.class.st | 10 ++ 7 files changed, 259 insertions(+), 6 deletions(-) create mode 100644 src/GToolkit-Coder/GtAsyncSearchGroupStream.class.st create mode 100644 src/GToolkit-Coder/GtAsyncSearchNullGroupStream.class.st create mode 100644 src/GToolkit-Coder/GtAsyncSearchTypedGroupStream.class.st diff --git a/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st b/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st index c591bab9c..1b2d63a47 100644 --- a/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st +++ b/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st @@ -23,16 +23,18 @@ See {{gtClass:GtSearchMethodFilterExamples}} for more details. " Class { - #name : #BaselineOfGToolkitCoder, - #superclass : #BaselineOf, - #category : #BaselineOfGToolkitCoder + #name : 'BaselineOfGToolkitCoder', + #superclass : 'BaselineOf', + #category : 'BaselineOfGToolkitCoder' } -{ #category : #baseline } +{ #category : 'baseline' } BaselineOfGToolkitCoder >> baseline: spec [ spec for: #'common' do: [ spec + baseline: 'Futures' with: [ + spec repository: 'github://feenkcom/pharo-futures:main/src' ]; baseline: 'GToolkitBasicUtility' with: [ spec repository: 'github://feenkcom/gtoolkit-utility:main/src' ]; baseline: 'GToolkitAnnouncerUtility' with: [ @@ -42,7 +44,7 @@ BaselineOfGToolkitCoder >> baseline: spec [ spec package: 'GToolkit-VariableBindings'; package: 'GToolkit-Coder' with: [ - spec requires: #('GToolkitBasicUtility' 'GToolkitAnnouncerUtility' 'GToolkitPager' ). ]; + spec requires: #('Futures' 'GToolkitBasicUtility' 'GToolkitAnnouncerUtility' 'GToolkitPager' ). ]; package: 'GToolkit-Coder-UI' with: [ spec requires: #('GToolkit-Coder' 'GToolkit-VariableBindings' 'GToolkitBasicUtility' 'GToolkitPager' ). ]; package: 'GToolkit-Coder-AddOns' with: [ diff --git a/src/BaselineOfGToolkitCoder/package.st b/src/BaselineOfGToolkitCoder/package.st index 489a47034..5ddc1cde6 100644 --- a/src/BaselineOfGToolkitCoder/package.st +++ b/src/BaselineOfGToolkitCoder/package.st @@ -1 +1 @@ -Package { #name : #BaselineOfGToolkitCoder } +Package { #name : 'BaselineOfGToolkitCoder' } diff --git a/src/GToolkit-Coder/GtAsyncSearchGroupStream.class.st b/src/GToolkit-Coder/GtAsyncSearchGroupStream.class.st new file mode 100644 index 000000000..b3c1b129a --- /dev/null +++ b/src/GToolkit-Coder/GtAsyncSearchGroupStream.class.st @@ -0,0 +1,142 @@ +Class { + #name : 'GtAsyncSearchGroupStream', + #superclass : 'Object', + #traits : 'TAsyncStream', + #classTraits : 'TAsyncStream classTrait', + #instVars : [ + 'itemsStream', + 'itemsFuture', + 'filter', + 'scope' + ], + #category : 'GToolkit-Coder-Filters - Streams' +} + +{ #category : 'as yet unclassified' } +GtAsyncSearchGroupStream class >> mergeTypeWith: aGroupResultClass [ + ^ aGroupResultClass mergeTypeWithDefaultGroup +] + +{ #category : 'as yet unclassified' } +GtAsyncSearchGroupStream class >> mergeTypeWithDefaultGroup [ + "The common type between the default group and any other group is the other group." + ^ self +] + +{ #category : 'as yet unclassified' } +GtAsyncSearchGroupStream class >> mergeTypeWithGenericGroup [ + "The common type between a generic group and any other group is the other group." + ^ self +] + +{ #category : 'as yet unclassified' } +GtAsyncSearchGroupStream class >> mergeTypeWithTypedGroup: aGroupType [ + ^ self +] + +{ #category : 'accessing' } +GtAsyncSearchGroupStream >> filter [ + ^ filter +] + +{ #category : 'initialization' } +GtAsyncSearchGroupStream >> forFilter: aFilter [ + self + forFilter: aFilter + scope: (aFilter + ifNil: [ AsyncEmptyStream new ] + ifNotNil: [ aFilter defaultFilterScopeStream ]) +] + +{ #category : 'initialization' } +GtAsyncSearchGroupStream >> forFilter: aFilter scope: aScopeStream [ + filter := aFilter. + scope := aScopeStream. + self updateItems +] + +{ #category : 'as yet unclassified' } +GtAsyncSearchGroupStream >> gtItemsFor: aView [ + + | anAnnouncer theItems aListView | + + anAnnouncer := Announcer new. + theItems := nil. + + aListView := aView list. + ^ aListView + title: 'Items' translated; + priority: 10; + items: [ + theItems ifNil: [ + self refreshItems. + (itemsFuture map: [ :computedItems | computedItems collect: [ :each | #item -> each ] ]) await + onSuccessDo: [ :theLoadedItems | + theItems := theLoadedItems. + anAnnouncer announce: Announcement new ]; + onFailureDo: [ :anError | ] ]. + theItems ifNil: [ { #loading -> 'Loading..' } ] ]; + itemType: [ :anItemTypeFactory :eachItem | eachItem key ]; + itemStencil: [ :anItemType | + (anItemType = #item) + ifTrue: [ aListView newItemLabel ] + ifFalse: [ + BrLabel new + alignCenter; + hMatchParent; + aptitude: (BrGlamorousLabelAptitude new italic; foreground: Color gray) ] ]; + itemDataBinder: [ :aLabel :anItem :anItemNode | + | aText | + aText := anItem value. + aLabel text: aText gtDisplayText asRopedText. ]; + disableAsync; + updateWhen: Announcement in: anAnnouncer +] + +{ #category : 'accessing' } +GtAsyncSearchGroupStream >> highlighter [ + ^ filter notNil + ifTrue: [ filter highlighter ] + ifFalse: [ nil ] +] + +{ #category : 'initialization' } +GtAsyncSearchGroupStream >> initialize [ + super initialize. + + itemsStream := AsyncEmptyStream new. +] + +{ #category : 'api - stream' } +GtAsyncSearchGroupStream >> pollNext: anAsynchronousContext [ + "Attempt to pull out the next value of this stream, registering the current task for wakeup if the value is not yet available, and returning None if the stream is exhausted. + There are several possible return values, each indicating a distinct stream state: + - Poll::Pending means that this stream's next value is not ready yet. Implementations will ensure that the current task will be notified when the next value may be ready. + - Poll::Ready(Some(val)) means that the stream has successfully produced a value, val, and may produce further values on subsequent poll_next calls. + - Poll::Ready(None) means that the stream has terminated, and poll_next should not be invoked again." + + + ^ itemsStream pollNext: anAsynchronousContext +] + +{ #category : 'initialization' } +GtAsyncSearchGroupStream >> refreshItems [ + self forFilter: self filter +] + +{ #category : 'accessing' } +GtAsyncSearchGroupStream >> scope [ + ^ scope +] + +{ #category : 'api - stream' } +GtAsyncSearchGroupStream >> sizeHint [ + + + ^ itemsStream sizeHint +] + +{ #category : 'initialization' } +GtAsyncSearchGroupStream >> updateItems [ + itemsStream := scope filter: filter +] diff --git a/src/GToolkit-Coder/GtAsyncSearchNullGroupStream.class.st b/src/GToolkit-Coder/GtAsyncSearchNullGroupStream.class.st new file mode 100644 index 000000000..3e4439df4 --- /dev/null +++ b/src/GToolkit-Coder/GtAsyncSearchNullGroupStream.class.st @@ -0,0 +1,23 @@ +Class { + #name : 'GtAsyncSearchNullGroupStream', + #superclass : 'GtSearchGroupResult', + #category : 'GToolkit-Coder-Filters - Streams' +} + +{ #category : 'as yet unclassified' } +GtAsyncSearchNullGroupStream class >> mergeTypeWith: aGroupResultClass [ + ^ aGroupResultClass mergeTypeWithGenericGroup. +] + +{ #category : 'as yet unclassified' } +GtAsyncSearchNullGroupStream class >> mergeTypeWithTypedGroup: aGroupType [ + ^ aGroupType +] + +{ #category : 'enumerating' } +GtAsyncSearchNullGroupStream >> refreshItems [ + filtered + ifTrue: [ ^ self ]. + items := OrderedCollection new. + filtered := true. +] diff --git a/src/GToolkit-Coder/GtAsyncSearchTypedGroupStream.class.st b/src/GToolkit-Coder/GtAsyncSearchTypedGroupStream.class.st new file mode 100644 index 000000000..4aaa5b935 --- /dev/null +++ b/src/GToolkit-Coder/GtAsyncSearchTypedGroupStream.class.st @@ -0,0 +1,36 @@ +Class { + #name : 'GtAsyncSearchTypedGroupStream', + #superclass : 'GtAsyncSearchGroupStream', + #instVars : [ + 'announcer' + ], + #category : 'GToolkit-Coder-Filters - Streams' +} + +{ #category : 'as yet unclassified' } +GtAsyncSearchTypedGroupStream class >> mergeTypeWith: aGroupResultClass [ + ^ aGroupResultClass mergeTypeWithTypedGroup: self. +] + +{ #category : 'as yet unclassified' } +GtAsyncSearchTypedGroupStream class >> mergeTypeWithTypedGroup: aGroupType [ + ^ aGroupType = self + ifTrue: [ self ] + ifFalse: [ GtSearchGroupResult ] +] + +{ #category : 'accessing' } +GtAsyncSearchTypedGroupStream >> announcer [ + ^ announcer +] + +{ #category : 'initialization' } +GtAsyncSearchTypedGroupStream >> initialize [ + super initialize. + announcer := Announcer new. + self subscribe +] + +{ #category : 'subscription' } +GtAsyncSearchTypedGroupStream >> subscribe [ +] diff --git a/src/GToolkit-Coder/GtSearchFilter.class.st b/src/GToolkit-Coder/GtSearchFilter.class.st index 8ede7d70b..b47987196 100644 --- a/src/GToolkit-Coder/GtSearchFilter.class.st +++ b/src/GToolkit-Coder/GtSearchFilter.class.st @@ -16,6 +16,13 @@ GtSearchFilter >> applyInScope: aSearchScope [ filter: self ] +{ #category : 'evaluating' } +GtSearchFilter >> applyInScopeStream: aStream [ + ^ self resultTypeStream new + forFilter: self + scope: aStream +] + { #category : 'converting' } GtSearchFilter >> asCoder [ ^ self result asCoder @@ -31,6 +38,11 @@ GtSearchFilter >> defaultFilterScope [ ^ GtSearchNullFilter new ] +{ #category : 'accessing' } +GtSearchFilter >> defaultFilterScopeStream [ + ^ AsyncEmptyStream new +] + { #category : 'iterating' } GtSearchFilter >> do: aBlock [ self result do: aBlock @@ -55,6 +67,17 @@ GtSearchFilter >> gtItemsFor: aView [ view: #gtItemsFor: ] +{ #category : 'ui' } +GtSearchFilter >> gtItemsStreamFor: aView [ + "this is a view that is polymorphic with the one defined in ${method:Collection>>#gtItemsFor:}$" + + ^ aView forward + title: 'Live (Stream)'; + priority: 11; + object: [ self resultStream ]; + view: #gtItemsFor: +] + { #category : 'accessing' } GtSearchFilter >> highlighter [ ^ nil @@ -85,11 +108,21 @@ GtSearchFilter >> result [ ^ self applyInScope: self defaultFilterScope ] +{ #category : 'converting' } +GtSearchFilter >> resultStream [ + ^ self applyInScopeStream: self defaultFilterScopeStream +] + { #category : 'accessing' } GtSearchFilter >> resultType [ ^ GtSearchNullGroupResult ] +{ #category : 'accessing' } +GtSearchFilter >> resultTypeStream [ + ^ GtAsyncSearchNullGroupStream +] + { #category : 'logical operations' } GtSearchFilter >> select: aBlock [ ^ self & (GtSearchBlockFilter forBlock: aBlock) @@ -100,6 +133,13 @@ GtSearchFilter >> size [ ^ self result size ] +{ #category : 'testing' } +GtSearchFilter >> value: anObject [ + "To be polymorphic with block closures" + + ^ self matches: anObject +] + { #category : 'logical operations' } GtSearchFilter >> | aFilter [ ^ GtSearchUnionFilter forFilter: self filter: aFilter diff --git a/src/GToolkit-Coder/GtSearchTypedEntitiesFilter.class.st b/src/GToolkit-Coder/GtSearchTypedEntitiesFilter.class.st index ea7a7febf..845c3a165 100644 --- a/src/GToolkit-Coder/GtSearchTypedEntitiesFilter.class.st +++ b/src/GToolkit-Coder/GtSearchTypedEntitiesFilter.class.st @@ -9,7 +9,17 @@ GtSearchTypedEntitiesFilter class >> resultType [ self subclassResponsibility ] +{ #category : 'accessing' } +GtSearchTypedEntitiesFilter class >> resultTypeStream [ + self subclassResponsibility +] + { #category : 'accessing' } GtSearchTypedEntitiesFilter >> resultType [ ^ self class resultType ] + +{ #category : 'accessing' } +GtSearchTypedEntitiesFilter >> resultTypeStream [ + ^ self class resultTypeStream +] From aab739f965f510c9249d811b06d35ca1a0f644d5 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 2 Sep 2021 19:41:31 +0200 Subject: [PATCH 0011/1268] [feenkcom/gtoolkit#2106] Deprecate column:item: in favor of column:text: --- .../GtExpandableSourceCoderElement.class.st | 4 ++-- .../GtSourceCoderContentElement.class.st | 4 ++-- .../GtTextualCoderViewModel.class.st | 2 +- src/GToolkit-Coder/GtCoderAddOns.class.st | 15 ++++++--------- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st index 416d770ff..51a78598e 100644 --- a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st @@ -102,8 +102,8 @@ GtExpandableSourceCoderElement >> gtAllShortcutsFor: aView [ title: 'All shortcuts' translated; priority: 10; items: [ self shortcuts , coderUIModel addOns shortcuts ]; - column: 'Key' item: [ :each | each combination gtDisplayString ]; - column: 'Action' item: [ :each | each action asString ] + column: 'Key' text: [ :each | each combination gtDisplayString ]; + column: 'Action' text: [ :each | each action asString ] ] { #category : 'initialization' } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st index 362a35ef6..87866461c 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st @@ -48,8 +48,8 @@ GtSourceCoderContentElement >> gtAllShortcutsFor: aView [ title: 'All shortcuts' translated; priority: 10; items: [ self shortcuts , self coder addOns shortcuts ]; - column: 'Key' item: [ :each | each combination gtDisplayString ]; - column: 'Action' item: [ :each | each action asString ] + column: 'Key' text: [ :each | each combination gtDisplayString ]; + column: 'Action' text: [ :each | each action asString ] ] { #category : 'initialization' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 83da6625f..dfcc62e75 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -390,7 +390,7 @@ GtTextualCoderViewModel >> gtInfoFor: aView [ items: [ self gtInfo ]; actionUpdateButtonTooltip: 'Refresh'; column: 'Property' - item: [ :eachItem :eachIndex | eachItem key asRopedText foreground: Color gray ] + text: [ :eachItem :eachIndex | eachItem key asRopedText foreground: Color gray ] width: 150; column: 'Value' text: [ :eachItem | eachItem value gtDisplayText ]; diff --git a/src/GToolkit-Coder/GtCoderAddOns.class.st b/src/GToolkit-Coder/GtCoderAddOns.class.st index 617bccaa3..9882759c8 100644 --- a/src/GToolkit-Coder/GtCoderAddOns.class.st +++ b/src/GToolkit-Coder/GtCoderAddOns.class.st @@ -219,10 +219,8 @@ GtCoderAddOns >> gtViewContextActionsFor: aView [ title: 'Context actions' translated; priority: 25; items: [ self contextActions ]; - column: 'Title' - item: [ :anAction | anAction title ] - text: [ :title | title ifNil: [ '' ] ]; - column: 'Action' item: [ :anAction | anAction action ] + column: 'Title' text: [ :anAction | anAction title ifNil: [ '' ] ]; + column: 'Action' text: [ :anAction | anAction action ] ] { #category : 'gt-extensions' } @@ -233,8 +231,8 @@ GtCoderAddOns >> gtViewKeybindingsFor: aView [ title: 'Shortcuts' translated; priority: 10; items: [ self shortcuts asArray ]; - column: 'Name' item: [ :each | each name ifNil: [ each gtDisplayString ] ]; - column: 'Combination' item: [ :each | each combination gtDisplayString ] + column: 'Name' text: [ :each | each name ifNil: [ each gtDisplayString ] ]; + column: 'Combination' text: [ :each | each combination gtDisplayString ] ] { #category : 'gt-extensions' } @@ -245,10 +243,9 @@ GtCoderAddOns >> gtViewMainActionsFor: aView [ priority: 20; items: [ self mainActions ]; column: 'Title' - item: [ :anAction | anAction title ] - text: [ :title | title ifNil: [ '' ] ]; + text: [ :anAction | anAction title ifNil: [ '' ] ]; column: 'Action' - item: [ :anAction | anAction action ] + text: [ :anAction | anAction action ] weight: 3 ] From 7421ac979d85800d068b4d8584836dfbc56c3888 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Tue, 7 Sep 2021 13:06:33 +0200 Subject: [PATCH 0012/1268] [feenkcom/gtoolkit#2088] fix add class variable fixit action --- .../GtDefineClassVariableFixItAction.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-AddOns/GtDefineClassVariableFixItAction.class.st b/src/GToolkit-Coder-AddOns/GtDefineClassVariableFixItAction.class.st index 096ca52f2..bf44a2911 100644 --- a/src/GToolkit-Coder-AddOns/GtDefineClassVariableFixItAction.class.st +++ b/src/GToolkit-Coder-AddOns/GtDefineClassVariableFixItAction.class.st @@ -11,7 +11,7 @@ GtDefineClassVariableFixItAction >> description [ { #category : 'accessing' } GtDefineClassVariableFixItAction >> executeOn: anEditorElement [ - sourceCoder addClassVariable: node name + sourceCoder addClassVariable: self nodeName ] { #category : 'accessing' } From eb7ff330bb06a1c1c28f0fa91b0fedd7e7fb51fd Mon Sep 17 00:00:00 2001 From: John Brant Date: Fri, 10 Sep 2021 13:06:06 -0500 Subject: [PATCH 0013/1268] fixing some rename refactoring actions --- .../GtRenameClassVariableController.class.st | 13 +++++++------ .../GtRenamePreviewAttribute.class.st | 6 +++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtRenameClassVariableController.class.st b/src/GToolkit-Coder-AddOns/GtRenameClassVariableController.class.st index 9518c2194..b7a047f59 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameClassVariableController.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameClassVariableController.class.st @@ -11,13 +11,14 @@ GtRenameClassVariableController >> refactoringName [ { #category : 'accessing' } GtRenameClassVariableController >> rename: oldName to: newName [ + | model class | model := self createModel. - class := (model classFor: coder classOrMetaClass) instanceSide - whoDefinesClassVariable: oldName. + class := (model classFor: coder behavior) instanceSide + whoDefinesClassVariable: oldName. ^ RBRenameClassVariableRefactoring - model: model - rename: oldName - to: newName - in: class + model: model + rename: oldName + to: newName + in: class ] diff --git a/src/GToolkit-Coder-AddOns/GtRenamePreviewAttribute.class.st b/src/GToolkit-Coder-AddOns/GtRenamePreviewAttribute.class.st index d4f381a4d..8ae8a253f 100644 --- a/src/GToolkit-Coder-AddOns/GtRenamePreviewAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenamePreviewAttribute.class.st @@ -66,9 +66,9 @@ GtRenamePreviewAttribute >> text [ GtRenamePreviewAttribute >> text: blText [ text := blText asString asRopedText. originalAttributes isNil - ifTrue: [ originalAttributes := blText isEmpty - ifTrue: [ #() ] - ifFalse: [ blText attributesAt: 1 ] ]. + ifTrue: + [ originalAttributes := (blText isEmpty ifTrue: [ #() ] ifFalse: [ blText attributesAt: 1 ]) + reject: [ :each | each isEventHandler ] ]. text attributes: originalAttributes , self additionalAttributes ] From ee50462538971af6cc6a362ea37d53af9b853d1e Mon Sep 17 00:00:00 2001 From: John Brant Date: Sat, 11 Sep 2021 07:43:15 -0500 Subject: [PATCH 0014/1268] changing the cursor position returned for nodes --- src/GToolkit-Coder-UI/GtSourceCoderShortcut.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderShortcut.class.st index e3131fa18..69994ee62 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderShortcut.class.st @@ -12,7 +12,7 @@ GtSourceCoderShortcut >> forEditor: aBrTextEditor selectedStringDo: aSelectedTex | aCursorPosition aTextPosition | aCursorPosition := aBrTextEditor cursors first position. - aTextPosition := (aCursorPosition + 1) min: aBrTextEditor text size. + aTextPosition := aCursorPosition min: aBrTextEditor text size max: 1. aCursorTextPositionBlock value: aTextPosition ] ] ifNotEmpty: [ :aSelectedText | aSelectedTextBlock value: aSelectedText asString ] @@ -31,7 +31,7 @@ GtSourceCoderShortcut >> forEditor: aBrTextEditor selectionIntervalDo: aSelectio | aCursorPosition aTextPosition | aCursorPosition := aBrTextEditor cursors first position. - aTextPosition := (aCursorPosition + 1) min: aBrTextEditor text size. + aTextPosition := aCursorPosition min: aBrTextEditor text size max: 1. aCursorTextPositionBlock value: aTextPosition ] ] ] From 2fc2bc71ad2cafb2fd6e2258a77d03fe3fa410fe Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 14 Sep 2021 09:45:50 -0500 Subject: [PATCH 0015/1268] adding rename across snippets --- ...ameTemporaryRequestedAnnouncement.class.st | 30 +++++++++++++++++++ src/GToolkit-Coder/GtSourceCoder.class.st | 28 +++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 src/GToolkit-Coder/GtCoderRenameTemporaryRequestedAnnouncement.class.st diff --git a/src/GToolkit-Coder/GtCoderRenameTemporaryRequestedAnnouncement.class.st b/src/GToolkit-Coder/GtCoderRenameTemporaryRequestedAnnouncement.class.st new file mode 100644 index 000000000..a2ae354b1 --- /dev/null +++ b/src/GToolkit-Coder/GtCoderRenameTemporaryRequestedAnnouncement.class.st @@ -0,0 +1,30 @@ +Class { + #name : 'GtCoderRenameTemporaryRequestedAnnouncement', + #superclass : 'GtSourceCoderAnnouncement', + #instVars : [ + 'variableName', + 'interestedCoders' + ], + #category : 'GToolkit-Coder-Event' +} + +{ #category : 'initialization' } +GtCoderRenameTemporaryRequestedAnnouncement >> initialize [ + super initialize. + interestedCoders := OrderedCollection new +] + +{ #category : 'accessing' } +GtCoderRenameTemporaryRequestedAnnouncement >> interestedCoders [ + ^ interestedCoders +] + +{ #category : 'accessing' } +GtCoderRenameTemporaryRequestedAnnouncement >> variableName [ + ^ variableName +] + +{ #category : 'accessing' } +GtCoderRenameTemporaryRequestedAnnouncement >> variableName: aString [ + variableName := aString +] diff --git a/src/GToolkit-Coder/GtSourceCoder.class.st b/src/GToolkit-Coder/GtSourceCoder.class.st index 0bd2ae58d..45c42279c 100644 --- a/src/GToolkit-Coder/GtSourceCoder.class.st +++ b/src/GToolkit-Coder/GtSourceCoder.class.st @@ -237,6 +237,19 @@ GtSourceCoder >> evaluationContext [ coder: self ] +{ #category : 'testing' } +GtSourceCoder >> hasImplicitVariableReferenceTo: aString [ + self implicitVariableReferencesTo: aString do: [ :each | ^ true ]. + ^ false +] + +{ #category : 'api - ast' } +GtSourceCoder >> implicitVariableReferencesTo: aString do: aBlock [ + "Evaluate aBlock for every ast node that is a variable reference to an implicitly defined variable named aString." + + +] + { #category : 'private - notifying' } GtSourceCoder >> notifyEvaluatedWithResult: anEvaluationResult [ self announce: (GtCoderEvaluationAnnouncement new @@ -310,6 +323,21 @@ GtSourceCoder >> printItInContext: aGtSourceCoderEvaluationContext [ thenDo: [ :aResult | self notifyPrintResult: aResult ] ] +{ #category : 'api - ast' } +GtSourceCoder >> renameImplicitTemporary: oldName to: newName [ + | source | + source := SmaCCString on: self currentSourceString. + self + implicitVariableReferencesTo: oldName + do: + [ :node | + source + replaceFrom: node startPosition + to: node stopPosition + with: newName ]. + self currentSourceString: source asString +] + { #category : 'accessing' } GtSourceCoder >> spawnDestination [ ^ self From 7dee5bcf5d3d2b881ad05d4d8b4bac3633224b49 Mon Sep 17 00:00:00 2001 From: John Brant Date: Thu, 16 Sep 2021 19:04:28 -0500 Subject: [PATCH 0016/1268] reenabling some coder refactorings --- .../GtTextualCoderViewModel.class.st | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index dfcc62e75..b51beaf9b 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -78,6 +78,27 @@ GtTextualCoderViewModel >> addOnsAwaitDo: aBlock [ aBlock value: theAddOns ] +{ #category : 'api - refactorings' } +GtTextualCoderViewModel >> addRefactoringChangesPreview: aRefactoring at: position [ + self + addRefactoringChangesPreview: aRefactoring + at: position + whenComplete: nil +] + +{ #category : 'api - refactorings' } +GtTextualCoderViewModel >> addRefactoringChangesPreview: aRefactoring at: aTextPosition whenComplete: aBlock [ + self removeRefactoringAttribute. + aRefactoring isNil ifTrue: [ ^ self ]. + self + addTextAttribute: + ((GtRefactoringChangesAttribute new) + refactoring: aRefactoring; + completionAction: aBlock) + from: aTextPosition + to: aTextPosition +] + { #category : 'api - shortcuts' } GtTextualCoderViewModel >> addShortcut: aShortcut [ "Add an extra shortcut add-on independent from the dynamically computed add-ons" @@ -571,6 +592,14 @@ GtTextualCoderViewModel >> removeCoderTextAttributes: aGtTextualCoderTextAttribu self announce: (GtTextualCoderViewModelTextAttributesRemoved new coderTextAttributes: aGtTextualCoderTextAttributes) ] +{ #category : 'api - refactorings' } +GtTextualCoderViewModel >> removeRefactoringAttribute [ + | attributes | + attributes := OrderedCollection new. + self sourceText attributesDo: [ :each | (each isKindOf: GtRefactoringChangesAttribute) ifTrue: [ attributes add: each ] ]. + self removeAllCoderTextAttributes: attributes +] + { #category : 'api - selection' } GtTextualCoderViewModel >> select: aFromCursorIndex to: aToCursorIndex [ self selection: (self selection copy select: aFromCursorIndex to: aToCursorIndex) From 5badbe35e107dcd3a3291bc7dd28f6345166567e Mon Sep 17 00:00:00 2001 From: John Brant Date: Mon, 20 Sep 2021 14:13:30 -0500 Subject: [PATCH 0017/1268] highlighting nodes when hovering menu item --- src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st | 4 ++-- src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st index 444929dd2..59bf18a8f 100644 --- a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st +++ b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st @@ -63,12 +63,12 @@ GtCoderContextMenuContent >> initialize [ ifNotNil: [ :hover | element when: BlMouseEnterEvent - do: [ :anEvent | hover cull: self editorElement cull: anEvent ] ]. + do: [ :anEvent | hover cull: self editorElement textualCoderViewModel cull: anEvent ] ]. eachGtCoderContextMenuAction leaveAction ifNotNil: [ :leave | element when: BlMouseLeaveEvent - do: [ :anEvent | leave cull: self editorElement cull: anEvent ] ]. + do: [ :anEvent | leave cull: self editorElement textualCoderViewModel cull: anEvent ] ]. eachGtCoderContextMenuAction name ifNotNil: [ :anActionName | element containerName: anActionName ]. element ]; diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index b51beaf9b..5c3133784 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -577,6 +577,13 @@ GtTextualCoderViewModel >> removeAllCoderTextAttributes: aCollectionOfGtTextualC self removeCoderTextAttributes: eachCoderTextAttribute ] ] +{ #category : 'api - refactorings' } +GtTextualCoderViewModel >> removeAttribute: anAttribute [ + | attributes | + attributes := self extraTextAttributes select: [ :each | each textAttributes includes: anAttribute ]. + self removeAllCoderTextAttributes: attributes +] + { #category : 'api - text' } GtTextualCoderViewModel >> removeCoderTextAttributes: aGtTextualCoderTextAttributes [ | aCurrentText | From 6a473c34010f00b0bdeb89d8c1ee46dbacee62ef Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Tue, 21 Sep 2021 15:48:30 +0200 Subject: [PATCH 0018/1268] [feenkcom/gtoolkit#2127] rename should be based on the view model --- .../GtRenameClassController.class.st | 14 ++-- .../GtRenameClassVariableController.class.st | 19 ++--- .../GtRenameController.class.st | 17 ++--- ...tRenameInstanceVariableController.class.st | 20 ++--- .../GtRenameMethodController.class.st | 7 +- ...GtSourceCoderInlineRenameShortcut.class.st | 7 +- ...tSourceCoderRefactoringController.class.st | 73 +++++++------------ ...tSourceCoderExtractMethodShortcut.class.st | 5 +- ...erExtractTempVarContextMenuItemId.class.st | 13 ++++ .../GtTextualCoderViewModel.class.st | 33 +-------- 10 files changed, 88 insertions(+), 120 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderExtractTempVarContextMenuItemId.class.st diff --git a/src/GToolkit-Coder-AddOns/GtRenameClassController.class.st b/src/GToolkit-Coder-AddOns/GtRenameClassController.class.st index b1ec2939f..6a814a5d7 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameClassController.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameClassController.class.st @@ -10,11 +10,13 @@ GtRenameClassController >> refactoringName [ ] { #category : 'accessing' } -GtRenameClassController >> rename: oldNameString to: newNameString [ - | model | - model := self createModel. +GtRenameClassController >> rename: anOldName to: aNewName [ + | aModel | + + aModel := self createModel. + ^ GtRBRenameClassWithCommentsRefactoring - model: model - rename: (Smalltalk at: oldNameString asSymbol) - to: newNameString + model: aModel + rename: (self class environment at: anOldName asSymbol) + to: aNewName ] diff --git a/src/GToolkit-Coder-AddOns/GtRenameClassVariableController.class.st b/src/GToolkit-Coder-AddOns/GtRenameClassVariableController.class.st index b7a047f59..96ff21316 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameClassVariableController.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameClassVariableController.class.st @@ -10,15 +10,16 @@ GtRenameClassVariableController >> refactoringName [ ] { #category : 'accessing' } -GtRenameClassVariableController >> rename: oldName to: newName [ +GtRenameClassVariableController >> rename: anOldName to: aNewName [ + | aModel aClass | - | model class | - model := self createModel. - class := (model classFor: coder behavior) instanceSide - whoDefinesClassVariable: oldName. + aModel := self createModel. + aClass := (aModel classFor: sourceCoderViewModel behavior) instanceSide + whoDefinesClassVariable: anOldName. + ^ RBRenameClassVariableRefactoring - model: model - rename: oldName - to: newName - in: class + model: aModel + rename: anOldName + to: aNewName + in: aClass ] diff --git a/src/GToolkit-Coder-AddOns/GtRenameController.class.st b/src/GToolkit-Coder-AddOns/GtRenameController.class.st index 3cbdd2b60..7ee45ba83 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameController.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameController.class.st @@ -29,7 +29,6 @@ GtRenameController >> addRefactoringChangesPreview [ whenComplete: [ self removeRefactoringAttribute. self completionAction value. - coder requestStyleSourceText. self allowSave ] ] @@ -56,26 +55,26 @@ GtRenameController >> createModel [ model := RBClassModelFactory rbNamespace onEnvironment: RBBrowserEnvironment new. model name: self refactoringName. - coder isForMethod - ifTrue: [ ((model classFor: coder behavior) sourceCodeFor: coder selector) + sourceCoderViewModel coderModel isForMethod + ifTrue: [ ((model classFor: sourceCoderViewModel behavior) sourceCodeFor: sourceCoderViewModel selector) ~= originalSource asString - ifTrue: [ (model classFor: coder behavior) + ifTrue: [ (model classFor: sourceCoderViewModel behavior) compile: originalSource asString - classified: coder protocol ] ]. + classified: sourceCoderViewModel protocol ] ]. ^ model ] { #category : 'accessing' } GtRenameController >> cursorPositionDo: aBlock [ - self sourceEditor cursors - do: [ :eachCursor | ^ aBlock value: (eachCursor position + 1 min: self sourceEditor text size) ] + sourceCoderViewModel cursors + do: [ :eachCursor | ^ aBlock value: (eachCursor position + 1 min: self sourceText size) ] ] { #category : 'executing' } GtRenameController >> installRenameAction [ - renameAction := GtRenameAction + renameAction := GtRenameAction2 locations: { renameInterval } - element: sourceElement. + textualCoderViewModel: sourceCoderViewModel. renameAction selectAll: true. diff --git a/src/GToolkit-Coder-AddOns/GtRenameInstanceVariableController.class.st b/src/GToolkit-Coder-AddOns/GtRenameInstanceVariableController.class.st index 57ebc06f4..528d2bfb3 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameInstanceVariableController.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameInstanceVariableController.class.st @@ -10,14 +10,16 @@ GtRenameInstanceVariableController >> refactoringName [ ] { #category : 'accessing' } -GtRenameInstanceVariableController >> rename: oldName to: newName [ - | model class | - model := self createModel. - class := (model classFor: coder behavior) - whoDefinesInstanceVariable: oldName. +GtRenameInstanceVariableController >> rename: anOldName to: aNewName [ + | aModel aClass | + + aModel := self createModel. + aClass := (aModel classFor: sourceCoderViewModel behavior) + whoDefinesInstanceVariable: anOldName. + ^ RBRenameInstanceVariableRefactoring - model: model - rename: oldName - to: newName - in: class + model: aModel + rename: anOldName + to: aNewName + in: aClass ] diff --git a/src/GToolkit-Coder-AddOns/GtRenameMethodController.class.st b/src/GToolkit-Coder-AddOns/GtRenameMethodController.class.st index 2bd163f75..e6d0020ba 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameMethodController.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameMethodController.class.st @@ -58,7 +58,7 @@ GtRenameMethodController >> newName [ { #category : 'private' } GtRenameMethodController >> newNode [ - coder astAwait nodesDo: [ :each | + sourceCoderViewModel astAwait nodesDo: [ :each | ((each isMessage or: [ each isMethod or: [ each isMethodPattern ] ]) and: [ each selectorParts first startPosition = startIndex ]) ifTrue: [ ^ each ] ]. @@ -96,7 +96,7 @@ GtRenameMethodController >> refactoring [ in: (model classFor: implementor) to: newSelector permutation: (1 to: selector numArgs)) - methodCoder: coder + methodCoder: sourceCoderViewModel coderModel ] { #category : 'accessing' } @@ -136,8 +136,7 @@ GtRenameMethodController >> tab: forward [ self newNode ifNotNil: [ :message | self removeRefactoringAttribute. - self sourceEditor - moveCursorTo: (message selectorParts at: selectorIndex) stopPosition. + self sourceCoderViewModel moveCursorTo: (message selectorParts at: selectorIndex) stopPosition. self installRenamerOn: message. newSelectorParts = selector keywords ifFalse: [ self addRefactoringChangesPreview ] ] diff --git a/src/GToolkit-Coder-AddOns/GtSourceCoderInlineRenameShortcut.class.st b/src/GToolkit-Coder-AddOns/GtSourceCoderInlineRenameShortcut.class.st index 010bd6208..fd975abf9 100644 --- a/src/GToolkit-Coder-AddOns/GtSourceCoderInlineRenameShortcut.class.st +++ b/src/GToolkit-Coder-AddOns/GtSourceCoderInlineRenameShortcut.class.st @@ -22,10 +22,9 @@ GtSourceCoderInlineRenameShortcut >> name [ ] { #category : 'evaluation' } -GtSourceCoderInlineRenameShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent [ - +GtSourceCoderInlineRenameShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ self forEditor: aBrTextEditor - selectionIntervalDo: [ :aSelectionInterval | aGtSourceCoder renameAt: aSelectionInterval last in: aBrEditorElement ] - orCursorStringPositionDo: [ :aCursorTextPosition | aGtSourceCoder renameAt: aCursorTextPosition in: aBrEditorElement ] + selectionIntervalDo: [ :aSelectionInterval | aSourceCoderViewModel coder renameAt: aSelectionInterval last in: aSourceCoderViewModel ] + orCursorStringPositionDo: [ :aCursorTextPosition | aSourceCoderViewModel coder renameAt: aCursorTextPosition in: aSourceCoderViewModel ] ] diff --git a/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st b/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st index f6744eee5..9870deeae 100644 --- a/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st +++ b/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st @@ -8,47 +8,35 @@ Class { #name : 'GtSourceCoderRefactoringController', #superclass : 'Object', #instVars : [ - 'coder', - 'sourceElement', - 'originalSource' + 'originalSource', + 'sourceCoderViewModel', + 'refactoringPreviewAttributes' ], #category : 'GToolkit-Coder-AddOns-! Core' } { #category : 'private - attributes' } GtSourceCoderRefactoringController >> addRefactoringChangesPreview: aRefactoring at: aTextPosition [ - self - addRefactoringChangesPreview: aRefactoring - at: aTextPosition - whenComplete: nil + refactoringPreviewAttributes := self sourceCoderViewModel + addTextAttribute: (GtRefactoringChangesAttribute new refactoring: aRefactoring) + from: aTextPosition + to: aTextPosition ] { #category : 'private - attributes' } GtSourceCoderRefactoringController >> addRefactoringChangesPreview: aRefactoring at: aTextPosition whenComplete: aBlock [ - self removeRefactoringAttribute. - aRefactoring isNil - ifTrue: [ ^ self ]. - - (self sourceText from: aTextPosition to: aTextPosition) - attributes: { + refactoringPreviewAttributes := self sourceCoderViewModel + addTextAttribute: (GtRefactoringChangesAttribute new refactoring: aRefactoring; - completionAction: aBlock) } + completionAction: aBlock) + from: aTextPosition + to: aTextPosition ] { #category : 'private' } GtSourceCoderRefactoringController >> allowSave [ - self sourceElement textualCoderViewModel allowSaveDueTo: self -] - -{ #category : 'accessing' } -GtSourceCoderRefactoringController >> coder [ - ^ coder -] - -{ #category : 'accessing' } -GtSourceCoderRefactoringController >> coder: methodCoder [ - coder := methodCoder + self sourceCoderViewModel allowSaveDueTo: self ] { #category : 'executing' } @@ -73,7 +61,7 @@ GtSourceCoderRefactoringController >> execute [ { #category : 'private' } GtSourceCoderRefactoringController >> preventSave [ - self sourceElement textualCoderViewModel preventSaveDueTo: self + self sourceCoderViewModel preventSaveDueTo: self ] { #category : 'accessing' } @@ -92,8 +80,7 @@ GtSourceCoderRefactoringController >> refactoringName [ { #category : 'private - attributes' } GtSourceCoderRefactoringController >> removeRefactoringAttribute [ - self sourceEditor text - clearAttributes: [ :each | each class = GtRefactoringChangesAttribute ] + self sourceCoderViewModel removeCoderTextAttributes: refactoringPreviewAttributes ] { #category : 'private' } @@ -112,32 +99,26 @@ GtSourceCoderRefactoringController >> saveSource [ ] { #category : 'private' } -GtSourceCoderRefactoringController >> setText: aStringOrText [ - self sourceElement - text: aStringOrText asRopedText; - onTextModified +GtSourceCoderRefactoringController >> setText: aStringOrText [ + self sourceCoderViewModel + sourceText: aStringOrText asRopedText + from: self + synchronously: true ] { #category : 'accessing' } -GtSourceCoderRefactoringController >> sourceEditor [ - ^ self sourceElement editor -] +GtSourceCoderRefactoringController >> sourceCoderViewModel [ + -{ #category : 'accessing' } -GtSourceCoderRefactoringController >> sourceElement [ - ^ sourceElement + ^ sourceCoderViewModel ] -{ #category : 'accessing' } -GtSourceCoderRefactoringController >> sourceElement: textElement [ - self - assert: [ textElement isKindOf: BlElement ] - description: [ 'A source must be an element' ]. - - sourceElement := textElement +{ #category : 'initialization' } +GtSourceCoderRefactoringController >> sourceCoderViewModel: aSourceCoderViewModel [ + sourceCoderViewModel := aSourceCoderViewModel ] { #category : 'accessing' } GtSourceCoderRefactoringController >> sourceText [ - ^ self sourceEditor text + ^ self sourceCoderViewModel sourceText copy ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExtractMethodShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExtractMethodShortcut.class.st index cfeb68168..83ea1b400 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExtractMethodShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExtractMethodShortcut.class.st @@ -22,6 +22,7 @@ GtSourceCoderExtractMethodShortcut >> name [ ] { #category : 'evaluation' } -GtSourceCoderExtractMethodShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent [ - aGtSourceCoder extractMethod: aBrEditorElement +GtSourceCoderExtractMethodShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ + aSourceCoderViewModel coder + extractMethod: aSourceCoderViewModel ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExtractTempVarContextMenuItemId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExtractTempVarContextMenuItemId.class.st new file mode 100644 index 000000000..bd0f4a144 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderExtractTempVarContextMenuItemId.class.st @@ -0,0 +1,13 @@ +" +A context menu action to extract a temporary variable +" +Class { + #name : 'GtSourceCoderExtractTempVarContextMenuItemId', + #superclass : 'GtCoderElementId', + #category : 'GToolkit-Coder-UI-Coder - Basic' +} + +{ #category : 'converting' } +GtSourceCoderExtractTempVarContextMenuItemId >> asSymbol [ + ^ #'context-menu--extract-temp' +] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index b51beaf9b..95f72514f 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -78,27 +78,6 @@ GtTextualCoderViewModel >> addOnsAwaitDo: aBlock [ aBlock value: theAddOns ] -{ #category : 'api - refactorings' } -GtTextualCoderViewModel >> addRefactoringChangesPreview: aRefactoring at: position [ - self - addRefactoringChangesPreview: aRefactoring - at: position - whenComplete: nil -] - -{ #category : 'api - refactorings' } -GtTextualCoderViewModel >> addRefactoringChangesPreview: aRefactoring at: aTextPosition whenComplete: aBlock [ - self removeRefactoringAttribute. - aRefactoring isNil ifTrue: [ ^ self ]. - self - addTextAttribute: - ((GtRefactoringChangesAttribute new) - refactoring: aRefactoring; - completionAction: aBlock) - from: aTextPosition - to: aTextPosition -] - { #category : 'api - shortcuts' } GtTextualCoderViewModel >> addShortcut: aShortcut [ "Add an extra shortcut add-on independent from the dynamically computed add-ons" @@ -122,7 +101,7 @@ GtTextualCoderViewModel >> addStylers: aCollectionOfGtCoderStyler [ { #category : 'api - text' } GtTextualCoderViewModel >> addTextAttribute: aTextAttribute from: aStartPosition to: anEndPosition [ - + ^ self addTextAttributes: { aTextAttribute } from: aStartPosition @@ -131,7 +110,7 @@ GtTextualCoderViewModel >> addTextAttribute: aTextAttribute from: aStartPosition { #category : 'api - text' } GtTextualCoderViewModel >> addTextAttributes: aCollectionOfTextAttributes from: aStartPosition to: anEndPosition [ - + | aCurrentText aMarkerAttribute newCoderTextAttributes | aMarkerAttribute := BrTextInvisibleMarkerAttribute new beNotOverwritableByStyler. @@ -592,14 +571,6 @@ GtTextualCoderViewModel >> removeCoderTextAttributes: aGtTextualCoderTextAttribu self announce: (GtTextualCoderViewModelTextAttributesRemoved new coderTextAttributes: aGtTextualCoderTextAttributes) ] -{ #category : 'api - refactorings' } -GtTextualCoderViewModel >> removeRefactoringAttribute [ - | attributes | - attributes := OrderedCollection new. - self sourceText attributesDo: [ :each | (each isKindOf: GtRefactoringChangesAttribute) ifTrue: [ attributes add: each ] ]. - self removeAllCoderTextAttributes: attributes -] - { #category : 'api - selection' } GtTextualCoderViewModel >> select: aFromCursorIndex to: aToCursorIndex [ self selection: (self selection copy select: aFromCursorIndex to: aToCursorIndex) From 17fdc087616dc41322ec481f582517eb6ed2040c Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Tue, 21 Sep 2021 20:38:07 +0200 Subject: [PATCH 0019/1268] [feenkcom/gtoolkit#2127] use GtExtractMethodController in the extract method shortcut --- .../GtSourceCoderExtractMethodShortcut.class.st | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExtractMethodShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExtractMethodShortcut.class.st index 83ea1b400..46a8dc534 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExtractMethodShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExtractMethodShortcut.class.st @@ -22,7 +22,6 @@ GtSourceCoderExtractMethodShortcut >> name [ ] { #category : 'evaluation' } -GtSourceCoderExtractMethodShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ - aSourceCoderViewModel coder - extractMethod: aSourceCoderViewModel +GtSourceCoderExtractMethodShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ + (GtExtractMethodController new sourceCoderViewModel: aSourceCoderViewModel) execute ] From 3a2e2eafe931fbe22b46ee1114b4ae5a94b0a0f9 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Tue, 21 Sep 2021 21:05:12 +0200 Subject: [PATCH 0020/1268] fix return type --- .../GtSourceCoderRefactoringController.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st b/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st index 9870deeae..279f23ce4 100644 --- a/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st +++ b/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st @@ -108,7 +108,7 @@ GtSourceCoderRefactoringController >> setText: aStringOrText [ { #category : 'accessing' } GtSourceCoderRefactoringController >> sourceCoderViewModel [ - + ^ sourceCoderViewModel ] From 3153a99603c028dc3a4b3d4ccc0e6160b18cf7d1 Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Tue, 21 Sep 2021 22:04:11 +0200 Subject: [PATCH 0021/1268] remove broken view from filters --- src/GToolkit-Coder/GtSearchFilter.class.st | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/GToolkit-Coder/GtSearchFilter.class.st b/src/GToolkit-Coder/GtSearchFilter.class.st index b47987196..93788cde9 100644 --- a/src/GToolkit-Coder/GtSearchFilter.class.st +++ b/src/GToolkit-Coder/GtSearchFilter.class.st @@ -67,17 +67,6 @@ GtSearchFilter >> gtItemsFor: aView [ view: #gtItemsFor: ] -{ #category : 'ui' } -GtSearchFilter >> gtItemsStreamFor: aView [ - "this is a view that is polymorphic with the one defined in ${method:Collection>>#gtItemsFor:}$" - - ^ aView forward - title: 'Live (Stream)'; - priority: 11; - object: [ self resultStream ]; - view: #gtItemsFor: -] - { #category : 'accessing' } GtSearchFilter >> highlighter [ ^ nil From 73c20447c2f642c29aa5728d14e09e62bc205731 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Wed, 22 Sep 2021 11:06:57 +0200 Subject: [PATCH 0022/1268] move pharo related coder addons to gt4pharo --- .../GtDefineClassFixItAction.class.st | 61 ------- ...GtDefineClassFixItActionElementId.class.st | 10 -- .../GtDefineClassVariableFixItAction.class.st | 22 --- ...ClassVariableFixItActionElementId.class.st | 10 -- ...DefineInstanceVariableFixItAction.class.st | 22 --- ...tanceVariableFixItActionElementId.class.st | 10 -- ...tDefineMethodFixItActionElementId.class.st | 10 -- .../GtDefineTemporaryFixItAction.class.st | 36 ----- ...oraryVariableFixItActionElementId.class.st | 10 -- ...tMethodReorderParametersAttribute.class.st | 54 ------- ...actMethodSelectorKeywordAttribute.class.st | 44 ----- .../GtFixItVariableNodeAction.class.st | 10 -- .../GtRenameClassController.class.st | 22 --- .../GtRenameClassVariableController.class.st | 25 --- .../GtRenameController.class.st | 149 ----------------- ...tRenameInstanceVariableController.class.st | 25 --- .../GtRenameMethodController.class.st | 151 ------------------ .../GtRenameVariableController.class.st | 44 ----- .../GtRenameVariableFixItAction.class.st | 34 ---- ...enameVariableFixItActionElementId.class.st | 10 -- ...tSourceCoderRefactoringController.class.st | 19 --- 21 files changed, 778 deletions(-) delete mode 100644 src/GToolkit-Coder-AddOns/GtDefineClassFixItAction.class.st delete mode 100644 src/GToolkit-Coder-AddOns/GtDefineClassFixItActionElementId.class.st delete mode 100644 src/GToolkit-Coder-AddOns/GtDefineClassVariableFixItAction.class.st delete mode 100644 src/GToolkit-Coder-AddOns/GtDefineClassVariableFixItActionElementId.class.st delete mode 100644 src/GToolkit-Coder-AddOns/GtDefineInstanceVariableFixItAction.class.st delete mode 100644 src/GToolkit-Coder-AddOns/GtDefineInstanceVariableFixItActionElementId.class.st delete mode 100644 src/GToolkit-Coder-AddOns/GtDefineMethodFixItActionElementId.class.st delete mode 100644 src/GToolkit-Coder-AddOns/GtDefineTemporaryFixItAction.class.st delete mode 100644 src/GToolkit-Coder-AddOns/GtDefineTemporaryVariableFixItActionElementId.class.st delete mode 100644 src/GToolkit-Coder-AddOns/GtExtractMethodReorderParametersAttribute.class.st delete mode 100644 src/GToolkit-Coder-AddOns/GtExtractMethodSelectorKeywordAttribute.class.st delete mode 100644 src/GToolkit-Coder-AddOns/GtFixItVariableNodeAction.class.st delete mode 100644 src/GToolkit-Coder-AddOns/GtRenameClassController.class.st delete mode 100644 src/GToolkit-Coder-AddOns/GtRenameClassVariableController.class.st delete mode 100644 src/GToolkit-Coder-AddOns/GtRenameController.class.st delete mode 100644 src/GToolkit-Coder-AddOns/GtRenameInstanceVariableController.class.st delete mode 100644 src/GToolkit-Coder-AddOns/GtRenameMethodController.class.st delete mode 100644 src/GToolkit-Coder-AddOns/GtRenameVariableController.class.st delete mode 100644 src/GToolkit-Coder-AddOns/GtRenameVariableFixItAction.class.st delete mode 100644 src/GToolkit-Coder-AddOns/GtRenameVariableFixItActionElementId.class.st diff --git a/src/GToolkit-Coder-AddOns/GtDefineClassFixItAction.class.st b/src/GToolkit-Coder-AddOns/GtDefineClassFixItAction.class.st deleted file mode 100644 index 8161ca5a1..000000000 --- a/src/GToolkit-Coder-AddOns/GtDefineClassFixItAction.class.st +++ /dev/null @@ -1,61 +0,0 @@ -Class { - #name : 'GtDefineClassFixItAction', - #superclass : 'GtFixItVariableNodeAction', - #category : 'GToolkit-Coder-AddOns-FixIt' -} - -{ #category : 'private' } -GtDefineClassFixItAction >> addCreateClassAttributeInEditor: aBrTextEditor [ - | text stencilBlock attribute adornmentAttribute | - - text := aBrTextEditor text. - stencilBlock := [ | element | - element := GtPharoCreateBehaviorElement new. - element - behaviorBlock: [ :cls | - text - clearAttributes: [ :each | each == attribute or: [ each == adornmentAttribute ] ]. - sourceCoder requestStyleSourceText ]. - element forClassDefinition. - element forClassName: node name value asSymbol. - sourceCoder package - ifNotNil: [ :package | element forPackage: package ]. - sourceCoder packageTag - ifNotNil: [ :tag | element forPackageTag: tag ]. - element addAptitude: BrShadowAptitude. - element background: Color white. - element margin: (BlInsets all: 10). - element - constraintsDo: [ :c | - c textFlow pushLine. - c horizontal matchParent ]. - element ]. - attribute := BrGlamorousTrangleExpanderTextAttribute new. - attribute isExpanded: true. - attribute - attributesCreatingBlock: [ adornmentAttribute := BrTextAdornmentDynamicAttribute new - beAppend; - stencil: stencilBlock ]. - text - attribute: attribute - from: self attributePosition - to: self attributePosition -] - -{ #category : 'accessing' } -GtDefineClassFixItAction >> description [ - ^ 'Create class ' , self nodeName -] - -{ #category : 'accessing' } -GtDefineClassFixItAction >> executeOn: anEditorElement [ - self clearFixItAttributeInEditor: anEditorElement editor. - self addCreateClassAttributeInEditor: anEditorElement editor. -] - -{ #category : 'accessing' } -GtDefineClassFixItAction >> id [ - - - ^ GtDefineClassFixItActionElementId -] diff --git a/src/GToolkit-Coder-AddOns/GtDefineClassFixItActionElementId.class.st b/src/GToolkit-Coder-AddOns/GtDefineClassFixItActionElementId.class.st deleted file mode 100644 index e4765428d..000000000 --- a/src/GToolkit-Coder-AddOns/GtDefineClassFixItActionElementId.class.st +++ /dev/null @@ -1,10 +0,0 @@ -Class { - #name : 'GtDefineClassFixItActionElementId', - #superclass : 'GtFixItActionElementId', - #category : 'GToolkit-Coder-AddOns-FixIt' -} - -{ #category : 'converting' } -GtDefineClassFixItActionElementId >> asSymbol [ - ^ #'fixit-action--define-class' -] diff --git a/src/GToolkit-Coder-AddOns/GtDefineClassVariableFixItAction.class.st b/src/GToolkit-Coder-AddOns/GtDefineClassVariableFixItAction.class.st deleted file mode 100644 index bf44a2911..000000000 --- a/src/GToolkit-Coder-AddOns/GtDefineClassVariableFixItAction.class.st +++ /dev/null @@ -1,22 +0,0 @@ -Class { - #name : 'GtDefineClassVariableFixItAction', - #superclass : 'GtFixItVariableNodeAction', - #category : 'GToolkit-Coder-AddOns-FixIt' -} - -{ #category : 'accessing' } -GtDefineClassVariableFixItAction >> description [ - ^ 'Add class variable ' , self nodeName , ' to class ', sourceCoder behavior name -] - -{ #category : 'accessing' } -GtDefineClassVariableFixItAction >> executeOn: anEditorElement [ - sourceCoder addClassVariable: self nodeName -] - -{ #category : 'accessing' } -GtDefineClassVariableFixItAction >> id [ - - - ^ GtDefineClassVariableFixItActionElementId -] diff --git a/src/GToolkit-Coder-AddOns/GtDefineClassVariableFixItActionElementId.class.st b/src/GToolkit-Coder-AddOns/GtDefineClassVariableFixItActionElementId.class.st deleted file mode 100644 index 464c2601a..000000000 --- a/src/GToolkit-Coder-AddOns/GtDefineClassVariableFixItActionElementId.class.st +++ /dev/null @@ -1,10 +0,0 @@ -Class { - #name : 'GtDefineClassVariableFixItActionElementId', - #superclass : 'GtFixItActionElementId', - #category : 'GToolkit-Coder-AddOns-FixIt' -} - -{ #category : 'converting' } -GtDefineClassVariableFixItActionElementId >> asSymbol [ - ^ #'fixit-action--define-class-variable' -] diff --git a/src/GToolkit-Coder-AddOns/GtDefineInstanceVariableFixItAction.class.st b/src/GToolkit-Coder-AddOns/GtDefineInstanceVariableFixItAction.class.st deleted file mode 100644 index 9b71e08b9..000000000 --- a/src/GToolkit-Coder-AddOns/GtDefineInstanceVariableFixItAction.class.st +++ /dev/null @@ -1,22 +0,0 @@ -Class { - #name : 'GtDefineInstanceVariableFixItAction', - #superclass : 'GtFixItVariableNodeAction', - #category : 'GToolkit-Coder-AddOns-FixIt' -} - -{ #category : 'accessing' } -GtDefineInstanceVariableFixItAction >> description [ - ^ 'Add slot ' , self nodeName , ' in ', sourceCoder behavior name -] - -{ #category : 'accessing' } -GtDefineInstanceVariableFixItAction >> executeOn: anEditorElement [ - sourceCoder addInstanceVariable: self nodeName -] - -{ #category : 'accessing' } -GtDefineInstanceVariableFixItAction >> id [ - - - ^ GtDefineInstanceVariableFixItActionElementId -] diff --git a/src/GToolkit-Coder-AddOns/GtDefineInstanceVariableFixItActionElementId.class.st b/src/GToolkit-Coder-AddOns/GtDefineInstanceVariableFixItActionElementId.class.st deleted file mode 100644 index 87211ca36..000000000 --- a/src/GToolkit-Coder-AddOns/GtDefineInstanceVariableFixItActionElementId.class.st +++ /dev/null @@ -1,10 +0,0 @@ -Class { - #name : 'GtDefineInstanceVariableFixItActionElementId', - #superclass : 'GtFixItActionElementId', - #category : 'GToolkit-Coder-AddOns-FixIt' -} - -{ #category : 'converting' } -GtDefineInstanceVariableFixItActionElementId >> asSymbol [ - ^ #'fixit-action--define-instance-variable' -] diff --git a/src/GToolkit-Coder-AddOns/GtDefineMethodFixItActionElementId.class.st b/src/GToolkit-Coder-AddOns/GtDefineMethodFixItActionElementId.class.st deleted file mode 100644 index 5a496d2b7..000000000 --- a/src/GToolkit-Coder-AddOns/GtDefineMethodFixItActionElementId.class.st +++ /dev/null @@ -1,10 +0,0 @@ -Class { - #name : 'GtDefineMethodFixItActionElementId', - #superclass : 'GtFixItActionElementId', - #category : 'GToolkit-Coder-AddOns-FixIt' -} - -{ #category : 'converting' } -GtDefineMethodFixItActionElementId >> asSymbol [ - ^ #'fixit-action--define-method' -] diff --git a/src/GToolkit-Coder-AddOns/GtDefineTemporaryFixItAction.class.st b/src/GToolkit-Coder-AddOns/GtDefineTemporaryFixItAction.class.st deleted file mode 100644 index c8fe37b1a..000000000 --- a/src/GToolkit-Coder-AddOns/GtDefineTemporaryFixItAction.class.st +++ /dev/null @@ -1,36 +0,0 @@ -Class { - #name : 'GtDefineTemporaryFixItAction', - #superclass : 'GtFixItVariableNodeAction', - #category : 'GToolkit-Coder-AddOns-FixIt' -} - -{ #category : 'accessing' } -GtDefineTemporaryFixItAction >> description [ - ^ 'Add temporary variable ' , self nodeName -] - -{ #category : 'executing' } -GtDefineTemporaryFixItAction >> executeOn: anEditorElement [ - | ast newSource location declaration | - - ast := sourceCoder rbAST. - newSource := sourceCoder currentSourceString. - ast body rightBar isNil - ifTrue: [ location := ast body start - 1. - declaration := '| ' , self nodeName , ' |' , String cr , String tab ] - ifFalse: [ location := ast body rightBar - 1. - declaration := ((newSource at: location) isSeparator - ifTrue: [ '' ] - ifFalse: [ ' ' ]) , self nodeName , ' ' ]. - - newSource := (newSource first: location) , declaration - , (newSource allButFirst: location). - sourceCoder currentSourceString: newSource -] - -{ #category : 'accessing' } -GtDefineTemporaryFixItAction >> id [ - - - ^ GtDefineTemporaryVariableFixItActionElementId -] diff --git a/src/GToolkit-Coder-AddOns/GtDefineTemporaryVariableFixItActionElementId.class.st b/src/GToolkit-Coder-AddOns/GtDefineTemporaryVariableFixItActionElementId.class.st deleted file mode 100644 index 145be54c2..000000000 --- a/src/GToolkit-Coder-AddOns/GtDefineTemporaryVariableFixItActionElementId.class.st +++ /dev/null @@ -1,10 +0,0 @@ -Class { - #name : 'GtDefineTemporaryVariableFixItActionElementId', - #superclass : 'GtFixItActionElementId', - #category : 'GToolkit-Coder-AddOns-FixIt' -} - -{ #category : 'converting' } -GtDefineTemporaryVariableFixItActionElementId >> asSymbol [ - ^ #'fixit-action--define-temporary-variable' -] diff --git a/src/GToolkit-Coder-AddOns/GtExtractMethodReorderParametersAttribute.class.st b/src/GToolkit-Coder-AddOns/GtExtractMethodReorderParametersAttribute.class.st deleted file mode 100644 index 4f59966f2..000000000 --- a/src/GToolkit-Coder-AddOns/GtExtractMethodReorderParametersAttribute.class.st +++ /dev/null @@ -1,54 +0,0 @@ -Class { - #name : 'GtExtractMethodReorderParametersAttribute', - #superclass : 'BrTextAdornmentAttribute', - #instVars : [ - 'actionBlock', - 'icon' - ], - #category : 'GToolkit-Coder-AddOns-Extract method' -} - -{ #category : 'instance creation' } -GtExtractMethodReorderParametersAttribute class >> action: aBlock icon: anIcon [ - ^ self new - actionBlock: aBlock; - icon: anIcon; - yourself -] - -{ #category : 'accessing' } -GtExtractMethodReorderParametersAttribute >> actionBlock [ - ^ actionBlock -] - -{ #category : 'accessing' } -GtExtractMethodReorderParametersAttribute >> actionBlock: aBlock [ - actionBlock := aBlock -] - -{ #category : 'accessing' } -GtExtractMethodReorderParametersAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ - ^ BlElement new - size: icon extent; - background: icon; - addEventHandlerOn: BlClickEvent do: [ :anEvent | actionBlock cull: anEvent ]; - yourself -] - -{ #category : 'accessing' } -GtExtractMethodReorderParametersAttribute >> icon [ - ^ icon -] - -{ #category : 'accessing' } -GtExtractMethodReorderParametersAttribute >> icon: anObject [ - icon := anObject -] - -{ #category : 'initialize-release' } -GtExtractMethodReorderParametersAttribute >> initialize [ - super initialize. - - self beAppend. - self beNotOverwritableByStyler -] diff --git a/src/GToolkit-Coder-AddOns/GtExtractMethodSelectorKeywordAttribute.class.st b/src/GToolkit-Coder-AddOns/GtExtractMethodSelectorKeywordAttribute.class.st deleted file mode 100644 index 9ca198579..000000000 --- a/src/GToolkit-Coder-AddOns/GtExtractMethodSelectorKeywordAttribute.class.st +++ /dev/null @@ -1,44 +0,0 @@ -Class { - #name : 'GtExtractMethodSelectorKeywordAttribute', - #superclass : 'BlTextAttribute', - #instVars : [ - 'index' - ], - #category : 'GToolkit-Coder-AddOns-Extract method' -} - -{ #category : 'instance creation' } -GtExtractMethodSelectorKeywordAttribute class >> keywordIndex: anInteger [ - ^ self new - index: anInteger; - yourself -] - -{ #category : 'comparing' } -GtExtractMethodSelectorKeywordAttribute >> equals: aTextAttribute [ - ^ self index = aTextAttribute index -] - -{ #category : 'comparing' } -GtExtractMethodSelectorKeywordAttribute >> hash [ - "Answer an integer value that is related to the identity of the receiver." - - ^ super hash bitXor: self index hash -] - -{ #category : 'accessing' } -GtExtractMethodSelectorKeywordAttribute >> index [ - ^ index -] - -{ #category : 'accessing' } -GtExtractMethodSelectorKeywordAttribute >> index: anInteger [ - index := anInteger -] - -{ #category : 'initialization' } -GtExtractMethodSelectorKeywordAttribute >> initialize [ - super initialize. - - self beNotOverwritableByStyler -] diff --git a/src/GToolkit-Coder-AddOns/GtFixItVariableNodeAction.class.st b/src/GToolkit-Coder-AddOns/GtFixItVariableNodeAction.class.st deleted file mode 100644 index d0fd50ac4..000000000 --- a/src/GToolkit-Coder-AddOns/GtFixItVariableNodeAction.class.st +++ /dev/null @@ -1,10 +0,0 @@ -Class { - #name : 'GtFixItVariableNodeAction', - #superclass : 'GtFixItAction', - #category : 'GToolkit-Coder-AddOns-FixIt' -} - -{ #category : 'api - node' } -GtFixItVariableNodeAction >> nodeName [ - ^ node variableName -] diff --git a/src/GToolkit-Coder-AddOns/GtRenameClassController.class.st b/src/GToolkit-Coder-AddOns/GtRenameClassController.class.st deleted file mode 100644 index 6a814a5d7..000000000 --- a/src/GToolkit-Coder-AddOns/GtRenameClassController.class.st +++ /dev/null @@ -1,22 +0,0 @@ -Class { - #name : 'GtRenameClassController', - #superclass : 'GtRenameVariableController', - #category : 'GToolkit-Coder-AddOns-Inline rename' -} - -{ #category : 'accessing' } -GtRenameClassController >> refactoringName [ - ^ 'Rename class' -] - -{ #category : 'accessing' } -GtRenameClassController >> rename: anOldName to: aNewName [ - | aModel | - - aModel := self createModel. - - ^ GtRBRenameClassWithCommentsRefactoring - model: aModel - rename: (self class environment at: anOldName asSymbol) - to: aNewName -] diff --git a/src/GToolkit-Coder-AddOns/GtRenameClassVariableController.class.st b/src/GToolkit-Coder-AddOns/GtRenameClassVariableController.class.st deleted file mode 100644 index 96ff21316..000000000 --- a/src/GToolkit-Coder-AddOns/GtRenameClassVariableController.class.st +++ /dev/null @@ -1,25 +0,0 @@ -Class { - #name : 'GtRenameClassVariableController', - #superclass : 'GtRenameVariableController', - #category : 'GToolkit-Coder-AddOns-Inline rename' -} - -{ #category : 'accessing' } -GtRenameClassVariableController >> refactoringName [ - ^ 'Rename class variable' -] - -{ #category : 'accessing' } -GtRenameClassVariableController >> rename: anOldName to: aNewName [ - | aModel aClass | - - aModel := self createModel. - aClass := (aModel classFor: sourceCoderViewModel behavior) instanceSide - whoDefinesClassVariable: anOldName. - - ^ RBRenameClassVariableRefactoring - model: aModel - rename: anOldName - to: aNewName - in: aClass -] diff --git a/src/GToolkit-Coder-AddOns/GtRenameController.class.st b/src/GToolkit-Coder-AddOns/GtRenameController.class.st deleted file mode 100644 index 7ee45ba83..000000000 --- a/src/GToolkit-Coder-AddOns/GtRenameController.class.st +++ /dev/null @@ -1,149 +0,0 @@ -Class { - #name : 'GtRenameController', - #superclass : 'GtSourceCoderRefactoringController', - #instVars : [ - 'handlers', - 'renameAction', - 'node', - 'newName', - 'renameInterval', - 'completionAction' - ], - #category : 'GToolkit-Coder-AddOns-Inline rename' -} - -{ #category : 'private' } -GtRenameController >> addRefactoringChangesPreview [ - | aRefactoring aRenamePosition | - self removeRefactoringAttribute. - - aRefactoring := self refactoring. - aRefactoring - ifNil: [ ^ self cancelRefactoring ]. - - aRenamePosition := self renamePosition. - - self - addRefactoringChangesPreview: aRefactoring - at: aRenamePosition - whenComplete: [ - self removeRefactoringAttribute. - self completionAction value. - self allowSave ] -] - -{ #category : 'executing' } -GtRenameController >> cancelRefactoring [ - self removeRefactoringAttribute. - self restoreText. - self allowSave -] - -{ #category : 'accessing' } -GtRenameController >> completionAction [ - ^ completionAction ifNil: [ [ ] ] -] - -{ #category : 'accessing' } -GtRenameController >> completionAction: aBlock [ - completionAction := aBlock -] - -{ #category : 'executing' } -GtRenameController >> createModel [ - | model | - model := RBClassModelFactory rbNamespace - onEnvironment: RBBrowserEnvironment new. - model name: self refactoringName. - sourceCoderViewModel coderModel isForMethod - ifTrue: [ ((model classFor: sourceCoderViewModel behavior) sourceCodeFor: sourceCoderViewModel selector) - ~= originalSource asString - ifTrue: [ (model classFor: sourceCoderViewModel behavior) - compile: originalSource asString - classified: sourceCoderViewModel protocol ] ]. - ^ model -] - -{ #category : 'accessing' } -GtRenameController >> cursorPositionDo: aBlock [ - sourceCoderViewModel cursors - do: [ :eachCursor | ^ aBlock value: (eachCursor position + 1 min: self sourceText size) ] -] - -{ #category : 'executing' } -GtRenameController >> installRenameAction [ - renameAction := GtRenameAction2 - locations: { renameInterval } - textualCoderViewModel: sourceCoderViewModel. - - renameAction selectAll: true. - - self preventSave. - - renameAction - when: GtRenameActionAnnouncement - do: [ :ann | - (#(#textUpdated #accept) includes: ann eventType) - ifTrue: [ self updateName: renameAction newName ]. - (#(#tab #shiftTab) includes: ann eventType) - ifTrue: [ self tab: ann eventType = #tab ]. - ann eventType = #cancel - ifTrue: [ self cancelRefactoring ] ]. - - self installValidation. - renameAction install -] - -{ #category : 'executing' } -GtRenameController >> installRenamer [ - self subclassResponsibility -] - -{ #category : 'accessing' } -GtRenameController >> installValidation [ - renameAction forVariableOrUnaryMessage -] - -{ #category : 'accessing' } -GtRenameController >> newName [ - ^ newName -] - -{ #category : 'accessing' } -GtRenameController >> originalName [ - ^ self subclassResponsibility -] - -{ #category : 'accessing' } -GtRenameController >> originalNode [ - - - ^ node -] - -{ #category : 'accessing' } -GtRenameController >> originalNode: aGtPharoProgramNode [ - node := aGtPharoProgramNode -] - -{ #category : 'private' } -GtRenameController >> renamePosition [ - ^ (renameAction isNil or: [ renameAction isInstalled ]) - ifTrue: [ renameInterval last ] - ifFalse: [ renameInterval last + self newName size - self originalName size ] -] - -{ #category : 'executing' } -GtRenameController >> safelyExecute [ - self installRenamer -] - -{ #category : 'private' } -GtRenameController >> tab: forward [ -] - -{ #category : 'private' } -GtRenameController >> updateName: aString [ - newName := aString. - self addRefactoringChangesPreview -] diff --git a/src/GToolkit-Coder-AddOns/GtRenameInstanceVariableController.class.st b/src/GToolkit-Coder-AddOns/GtRenameInstanceVariableController.class.st deleted file mode 100644 index 528d2bfb3..000000000 --- a/src/GToolkit-Coder-AddOns/GtRenameInstanceVariableController.class.st +++ /dev/null @@ -1,25 +0,0 @@ -Class { - #name : 'GtRenameInstanceVariableController', - #superclass : 'GtRenameVariableController', - #category : 'GToolkit-Coder-AddOns-Inline rename' -} - -{ #category : 'accessing' } -GtRenameInstanceVariableController >> refactoringName [ - ^ 'Rename instance variable' -] - -{ #category : 'accessing' } -GtRenameInstanceVariableController >> rename: anOldName to: aNewName [ - | aModel aClass | - - aModel := self createModel. - aClass := (aModel classFor: sourceCoderViewModel behavior) - whoDefinesInstanceVariable: anOldName. - - ^ RBRenameInstanceVariableRefactoring - model: aModel - rename: anOldName - to: aNewName - in: aClass -] diff --git a/src/GToolkit-Coder-AddOns/GtRenameMethodController.class.st b/src/GToolkit-Coder-AddOns/GtRenameMethodController.class.st deleted file mode 100644 index e6d0020ba..000000000 --- a/src/GToolkit-Coder-AddOns/GtRenameMethodController.class.st +++ /dev/null @@ -1,151 +0,0 @@ -Class { - #name : 'GtRenameMethodController', - #superclass : 'GtRenameController', - #instVars : [ - 'selector', - 'someImplementor', - 'newSelectorParts', - 'selectorIndex', - 'startIndex', - 'previewIndex' - ], - #category : 'GToolkit-Coder-AddOns-Inline rename' -} - -{ #category : 'executing' } -GtRenameMethodController >> installRenamer [ - self - cursorPositionDo: [ :position | - | message | - selector := self originalNode selector. - self someImplementor isNil - ifTrue: [ ^ self ]. - - startIndex := self originalNode selectorParts first startPosition. - newSelectorParts := selector keywords. - message := self originalNode. - message selectorParts - keysAndValuesDo: [ :i :eachSmaCCToken | - (eachSmaCCToken sourceInterval includes: position) - ifTrue: [ - selectorIndex := i. - self installRenamerOn: message ] ] ] -] - -{ #category : 'executing' } -GtRenameMethodController >> installRenamerOn: aGtPharoMessageNode [ - previewIndex := node selectorParts last stopPosition. - newName := newSelectorParts at: selectorIndex. - renameInterval := (aGtPharoMessageNode selectorParts at: selectorIndex) sourceInterval. - self installRenameAction -] - -{ #category : 'accessing' } -GtRenameMethodController >> installValidation [ - | argCount | - argCount := selector numArgs. - argCount = 0 - ifTrue: [ ^ super installValidation ]. - argCount = 1 - ifTrue: [ renameAction forBinaryOrKeyword ] - ifFalse: [ renameAction forKeyword ] -] - -{ #category : 'accessing' } -GtRenameMethodController >> newName [ - ^ self newSelectorName -] - -{ #category : 'private' } -GtRenameMethodController >> newNode [ - sourceCoderViewModel astAwait nodesDo: [ :each | - ((each isMessage or: [ each isMethod or: [ each isMethodPattern ] ]) - and: [ each selectorParts first startPosition = startIndex ]) - ifTrue: [ ^ each ] ]. - ^ nil -] - -{ #category : 'private' } -GtRenameMethodController >> newSelectorName [ - selector numArgs = 0 - ifTrue: [ ^ newName asSymbol ]. - ^ (String - streamContents: - [ :stream | newSelectorParts do: [ :each | stream nextPutAll: each ] ]) - asSymbol -] - -{ #category : 'accessing' } -GtRenameMethodController >> originalName [ - ^ selector -] - -{ #category : 'private' } -GtRenameMethodController >> refactoring [ - | implementor newSelector model | - implementor := self someImplementor. - implementor isNil - ifTrue: [ ^ nil ]. - newSelector := self newSelectorName. - newSelector = selector - ifTrue: [ ^ nil ]. - model := self createModel. - ^ (GtCoderRenameMethodRefactoring - model: model - renameMethod: selector - in: (model classFor: implementor) - to: newSelector - permutation: (1 to: selector numArgs)) - methodCoder: sourceCoderViewModel coderModel -] - -{ #category : 'accessing' } -GtRenameMethodController >> refactoringName [ - ^ 'Rename method' -] - -{ #category : 'accessing' } -GtRenameMethodController >> renamePosition [ - self newNode - ifNotNil: [ :message | ^ message selectorParts last stopPosition ]. - ^ (renameAction isNil or: [ renameAction isInstalled ]) - ifTrue: [ previewIndex ] - ifFalse: [ self originalNode selectorParts last stopPosition + self newName size - - self originalName size ] -] - -{ #category : 'private' } -GtRenameMethodController >> someImplementor [ - ^ someImplementor - ifNil: [ (SystemNavigation default allImplementorsOf: selector) - ifEmpty: [ nil ] - ifNotEmpty: [ :impls | someImplementor := impls anyOne methodClass ] ] -] - -{ #category : 'private' } -GtRenameMethodController >> tab: forward [ - self originalNode arguments size < 2 - ifTrue: [ ^ self ]. - forward - ifTrue: [ selectorIndex := selectorIndex + 1. - selectorIndex > self originalNode arguments size - ifTrue: [ selectorIndex := 1 ] ] - ifFalse: [ selectorIndex := selectorIndex - 1. - selectorIndex = 0 - ifTrue: [ selectorIndex := self originalNode arguments size ] ]. - self newNode - ifNotNil: [ :message | - self removeRefactoringAttribute. - self sourceCoderViewModel moveCursorTo: (message selectorParts at: selectorIndex) stopPosition. - self installRenamerOn: message. - newSelectorParts = selector keywords - ifFalse: [ self addRefactoringChangesPreview ] ] -] - -{ #category : 'private' } -GtRenameMethodController >> updateName: aString [ - - "we should update selector parts before updating the name, otherwise the refactoring will be canceled" - newSelectorParts at: selectorIndex put: aString. - super updateName: aString -] diff --git a/src/GToolkit-Coder-AddOns/GtRenameVariableController.class.st b/src/GToolkit-Coder-AddOns/GtRenameVariableController.class.st deleted file mode 100644 index dd0c04bf3..000000000 --- a/src/GToolkit-Coder-AddOns/GtRenameVariableController.class.st +++ /dev/null @@ -1,44 +0,0 @@ -Class { - #name : 'GtRenameVariableController', - #superclass : 'GtRenameController', - #category : 'GToolkit-Coder-AddOns-Inline rename' -} - -{ #category : 'accessing' } -GtRenameVariableController >> addRefactoringChangesPreview [ - super addRefactoringChangesPreview. - self styleRenamedVariable -] - -{ #category : 'executing' } -GtRenameVariableController >> installRenamer [ - newName := self originalNode source. - renameInterval := self originalNode sourceInterval. - - self installRenameAction -] - -{ #category : 'accessing' } -GtRenameVariableController >> originalName [ - ^ self originalNode source -] - -{ #category : 'accessing' } -GtRenameVariableController >> refactoring [ - self originalName = self newName - ifTrue: [ ^ nil ]. - ^ self rename: self originalName to: self newName -] - -{ #category : 'accessing' } -GtRenameVariableController >> rename: oldName to: newName [ - ^ self subclassResponsibility -] - -{ #category : 'accessing' } -GtRenameVariableController >> styleRenamedVariable [ - (self sourceText - from: renameInterval first - to: self renamePosition) - attributes: {(BlTextForegroundAttribute paint: Color gray) } -] diff --git a/src/GToolkit-Coder-AddOns/GtRenameVariableFixItAction.class.st b/src/GToolkit-Coder-AddOns/GtRenameVariableFixItAction.class.st deleted file mode 100644 index 938614900..000000000 --- a/src/GToolkit-Coder-AddOns/GtRenameVariableFixItAction.class.st +++ /dev/null @@ -1,34 +0,0 @@ -Class { - #name : 'GtRenameVariableFixItAction', - #superclass : 'GtFixItVariableNodeAction', - #instVars : [ - 'newName' - ], - #category : 'GToolkit-Coder-AddOns-FixIt' -} - -{ #category : 'accessing' } -GtRenameVariableFixItAction >> description [ - ^ 'Use ' , newName , ' instead of ' , self nodeName -] - -{ #category : 'accessing' } -GtRenameVariableFixItAction >> executeOn: anEditorElement [ - | newSource | - newSource := sourceCoder currentSourceString. - newSource := (newSource first: self startPosition - 1) , newName - , (newSource allButFirst: self stopPosition). - sourceCoder currentSourceString: newSource -] - -{ #category : 'accessing' } -GtRenameVariableFixItAction >> id [ - - - ^ GtRenameVariableFixItActionElementId -] - -{ #category : 'initialization' } -GtRenameVariableFixItAction >> newName: aString [ - newName := aString -] diff --git a/src/GToolkit-Coder-AddOns/GtRenameVariableFixItActionElementId.class.st b/src/GToolkit-Coder-AddOns/GtRenameVariableFixItActionElementId.class.st deleted file mode 100644 index 1040bf59b..000000000 --- a/src/GToolkit-Coder-AddOns/GtRenameVariableFixItActionElementId.class.st +++ /dev/null @@ -1,10 +0,0 @@ -Class { - #name : 'GtRenameVariableFixItActionElementId', - #superclass : 'GtFixItActionElementId', - #category : 'GToolkit-Coder-AddOns-FixIt' -} - -{ #category : 'converting' } -GtRenameVariableFixItActionElementId >> asSymbol [ - ^ #'fixit-action--rename-variable' -] diff --git a/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st b/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st index 279f23ce4..49543b330 100644 --- a/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st +++ b/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st @@ -15,25 +15,6 @@ Class { #category : 'GToolkit-Coder-AddOns-! Core' } -{ #category : 'private - attributes' } -GtSourceCoderRefactoringController >> addRefactoringChangesPreview: aRefactoring at: aTextPosition [ - refactoringPreviewAttributes := self sourceCoderViewModel - addTextAttribute: (GtRefactoringChangesAttribute new refactoring: aRefactoring) - from: aTextPosition - to: aTextPosition -] - -{ #category : 'private - attributes' } -GtSourceCoderRefactoringController >> addRefactoringChangesPreview: aRefactoring at: aTextPosition whenComplete: aBlock [ - refactoringPreviewAttributes := self sourceCoderViewModel - addTextAttribute: - (GtRefactoringChangesAttribute new - refactoring: aRefactoring; - completionAction: aBlock) - from: aTextPosition - to: aTextPosition -] - { #category : 'private' } GtSourceCoderRefactoringController >> allowSave [ self sourceCoderViewModel allowSaveDueTo: self From 2c128a55147a94efa2b38e7eb2595e085c1d0605 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 23 Sep 2021 11:40:41 +0200 Subject: [PATCH 0023/1268] [feenkcom/gtoolkit#2113] new hierarchy of the variable bindings --- .../GtBindingExamples.class.st | 36 ++++++------- .../GtBindingStrategy.class.st | 28 +++++----- .../GtBindingStrategyWithRequestor.class.st | 20 +++---- .../GtBindingsTrait.trait.st | 14 ++--- .../GtCommandExamples.class.st | 20 +++---- .../GtCompositeVariablesBindings.class.st | 48 +++++++++++++++++ ...ontextHighlightingBindingStrategy.class.st | 12 ++--- .../GtContextVariablesBindings.class.st | 49 +++++++++++++++++ .../GtEvaluateSourceCodeCommand.class.st | 34 ++++++------ .../GtGlobalVariablesBindings.class.st | 29 +++++++++++ .../GtHighlightingBindingStrategy.class.st | 8 +-- .../GtLocalSnippetBindings.class.st | 48 ++++++++--------- .../GtLocalVariablesBindings.class.st | 52 +++++++++++++++++++ .../GtNoBindings.class.st | 28 +++++----- .../GtReservedVariablesBindings.class.st | 31 +++++++++++ .../GtSharedVariablesBindings.class.st | 41 +++++++++++++++ .../GtSlotVariablesBindings.class.st | 50 ++++++++++++++++++ .../GtSnippetBindingStrategy.class.st | 16 +++--- .../GtSnippetBindings.class.st | 34 ++++++------ .../ManifestGToolkitVariableBindings.class.st | 6 +-- .../TGtVariablesBindings.trait.st | 37 +++++++++++++ src/GToolkit-VariableBindings/package.st | 2 +- 22 files changed, 490 insertions(+), 153 deletions(-) create mode 100644 src/GToolkit-VariableBindings/GtCompositeVariablesBindings.class.st create mode 100644 src/GToolkit-VariableBindings/GtContextVariablesBindings.class.st create mode 100644 src/GToolkit-VariableBindings/GtGlobalVariablesBindings.class.st create mode 100644 src/GToolkit-VariableBindings/GtLocalVariablesBindings.class.st create mode 100644 src/GToolkit-VariableBindings/GtReservedVariablesBindings.class.st create mode 100644 src/GToolkit-VariableBindings/GtSharedVariablesBindings.class.st create mode 100644 src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st create mode 100644 src/GToolkit-VariableBindings/TGtVariablesBindings.trait.st diff --git a/src/GToolkit-VariableBindings/GtBindingExamples.class.st b/src/GToolkit-VariableBindings/GtBindingExamples.class.st index 28d985696..93b0880c5 100644 --- a/src/GToolkit-VariableBindings/GtBindingExamples.class.st +++ b/src/GToolkit-VariableBindings/GtBindingExamples.class.st @@ -1,24 +1,24 @@ Class { - #name : #GtBindingExamples, - #superclass : #Object, - #category : #'GToolkit-VariableBindings-Examples' + #name : 'GtBindingExamples', + #superclass : 'Object', + #category : 'GToolkit-VariableBindings-Examples' } -{ #category : #'binding strategy' } +{ #category : 'binding strategy' } GtBindingExamples >> defaultHighlightingBindingStrategy [ ^ GtHighlightingBindingStrategy new ] -{ #category : #'binding strategy' } +{ #category : 'binding strategy' } GtBindingExamples >> defaultSnippetBindingStrategy [ ^ GtSnippetBindingStrategy new ] -{ #category : #'binding strategy' } +{ #category : 'binding strategy' } GtBindingExamples >> highlightingBindingStrategy [ @@ -26,7 +26,7 @@ GtBindingExamples >> highlightingBindingStrategy [ bindings: self snippetEmptyBindings ] -{ #category : #'binding strategy' } +{ #category : 'binding strategy' } GtBindingExamples >> queryDefaultHighlightingBindingStrategy [ @@ -37,7 +37,7 @@ GtBindingExamples >> queryDefaultHighlightingBindingStrategy [ ^ strategy ] -{ #category : #'binding strategy' } +{ #category : 'binding strategy' } GtBindingExamples >> queryDefaultSnippetBindingStrategy [ @@ -48,7 +48,7 @@ GtBindingExamples >> queryDefaultSnippetBindingStrategy [ ^ strategy ] -{ #category : #'bindings - snippet' } +{ #category : 'bindings - snippet' } GtBindingExamples >> queryEmptySnippetBindings [ @@ -60,7 +60,7 @@ GtBindingExamples >> queryEmptySnippetBindings [ ^ emptyBindings ] -{ #category : #'binding strategy' } +{ #category : 'binding strategy' } GtBindingExamples >> queryHighlightingBindingStrategy [ @@ -71,7 +71,7 @@ GtBindingExamples >> queryHighlightingBindingStrategy [ ^ strategy ] -{ #category : #'binding strategy' } +{ #category : 'binding strategy' } GtBindingExamples >> querySnippetBindingStrategy [ @@ -84,7 +84,7 @@ GtBindingExamples >> querySnippetBindingStrategy [ ^ result ] -{ #category : #'bindings - snippet' } +{ #category : 'bindings - snippet' } GtBindingExamples >> querySnippetBindingsWithReceiver [ @@ -96,7 +96,7 @@ GtBindingExamples >> querySnippetBindingsWithReceiver [ ^ bindings ] -{ #category : #'bindings - snippet' } +{ #category : 'bindings - snippet' } GtBindingExamples >> setSnippetBindings [ @@ -111,7 +111,7 @@ GtBindingExamples >> setSnippetBindings [ ^ bindings ] -{ #category : #'bindings - snippet' } +{ #category : 'bindings - snippet' } GtBindingExamples >> setSnippetBindingsReceiver [ @@ -123,7 +123,7 @@ GtBindingExamples >> setSnippetBindingsReceiver [ ^ bindings ] -{ #category : #'bindings - snippet' } +{ #category : 'bindings - snippet' } GtBindingExamples >> setSnippetBindingsWithReceiver [ | bindings result receiver | @@ -137,7 +137,7 @@ GtBindingExamples >> setSnippetBindingsWithReceiver [ ^ bindings ] -{ #category : #'binding strategy' } +{ #category : 'binding strategy' } GtBindingExamples >> snippetBindingStrategy [ @@ -145,7 +145,7 @@ GtBindingExamples >> snippetBindingStrategy [ bindings: self snippetEmptyBindings ] -{ #category : #'bindings - snippet' } +{ #category : 'bindings - snippet' } GtBindingExamples >> snippetEmptyBindings [ @@ -156,7 +156,7 @@ GtBindingExamples >> snippetEmptyBindings [ ^ aBindings ] -{ #category : #accessing } +{ #category : 'accessing' } GtBindingExamples >> variableOneName [ diff --git a/src/GToolkit-VariableBindings/GtBindingStrategy.class.st b/src/GToolkit-VariableBindings/GtBindingStrategy.class.st index b5fb1141a..720b7b694 100644 --- a/src/GToolkit-VariableBindings/GtBindingStrategy.class.st +++ b/src/GToolkit-VariableBindings/GtBindingStrategy.class.st @@ -1,15 +1,15 @@ Class { - #name : #GtBindingStrategy, - #superclass : #Object, + #name : 'GtBindingStrategy', + #superclass : 'Object', #traits : 'TGtAssert', #classTraits : 'TGtAssert classTrait', #instVars : [ 'bindings' ], - #category : #'GToolkit-VariableBindings-Core' + #category : 'GToolkit-VariableBindings-Core' } -{ #category : #asserting } +{ #category : 'asserting' } GtBindingStrategy class >> assert: aBlock description: aStringOrBlock [ "Throw an assertion error if aBlock does not evaluates to true. We check for true explicitly to make the assertion fail for non booleans." @@ -19,17 +19,17 @@ GtBindingStrategy class >> assert: aBlock description: aStringOrBlock [ AssertionFailure signal: aStringOrBlock value ] ] ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } GtBindingStrategy class >> bindings: aGtBindings [ ^ self new bindings: aGtBindings ] -{ #category : #converting } +{ #category : 'converting' } GtBindingStrategy >> asDictionary [ ^ self bindings asDictionary ] -{ #category : #binding } +{ #category : 'binding' } GtBindingStrategy >> bindingOf: aSymbol [ | assocOrNil | @@ -49,18 +49,18 @@ GtBindingStrategy >> bindingOf: aSymbol [ ] -{ #category : #accessing } +{ #category : 'accessing' } GtBindingStrategy >> bindings [ ^ bindings ] -{ #category : #accessing } +{ #category : 'accessing' } GtBindingStrategy >> bindings: anObject [ self assert: [ anObject notNil ] description: [ 'Bindings should be an object' ]. bindings := anObject ] -{ #category : #'gt-extension' } +{ #category : 'gt-extension' } GtBindingStrategy >> gtBindingsFor: aView [ ^ (self bindings respondsTo: #gtBindingsFor:) @@ -68,23 +68,23 @@ GtBindingStrategy >> gtBindingsFor: aView [ ifFalse: [ aView empty ] ] -{ #category : #binding } +{ #category : 'binding' } GtBindingStrategy >> hasBindingOf: aSymbol [ ^ self bindings hasBindingOf: aSymbol ] -{ #category : #initialization } +{ #category : 'initialization' } GtBindingStrategy >> initialize [ super initialize. self initializeBindings. ] -{ #category : #initialization } +{ #category : 'initialization' } GtBindingStrategy >> initializeBindings [ bindings := GtNoBindings uniqueInstance. ] -{ #category : #private } +{ #category : 'private' } GtBindingStrategy >> treatBinding: anAssocOrNil of: aSymbol [ self subclassResponsibility ] diff --git a/src/GToolkit-VariableBindings/GtBindingStrategyWithRequestor.class.st b/src/GToolkit-VariableBindings/GtBindingStrategyWithRequestor.class.st index a6034a2eb..dcf877860 100644 --- a/src/GToolkit-VariableBindings/GtBindingStrategyWithRequestor.class.st +++ b/src/GToolkit-VariableBindings/GtBindingStrategyWithRequestor.class.st @@ -1,26 +1,26 @@ Class { - #name : #GtBindingStrategyWithRequestor, - #superclass : #Object, + #name : 'GtBindingStrategyWithRequestor', + #superclass : 'Object', #instVars : [ 'requestor', 'bindingStrategy' ], - #category : #'GToolkit-VariableBindings-Commands' + #category : 'GToolkit-VariableBindings-Commands' } -{ #category : #binding } +{ #category : 'binding' } GtBindingStrategyWithRequestor >> bindingOf: aSymbol [ ^ self bindingStrategy bindingOf: aSymbol ] -{ #category : #accessing } +{ #category : 'accessing' } GtBindingStrategyWithRequestor >> bindingStrategy [ ^ bindingStrategy ] -{ #category : #accessing } +{ #category : 'accessing' } GtBindingStrategyWithRequestor >> bindingStrategy: aGtBindingStrategy [ self assert: [ aGtBindingStrategy notNil ] @@ -28,24 +28,24 @@ GtBindingStrategyWithRequestor >> bindingStrategy: aGtBindingStrategy [ bindingStrategy := aGtBindingStrategy ] -{ #category : #initialization } +{ #category : 'initialization' } GtBindingStrategyWithRequestor >> initialize [ super initialize. bindingStrategy := GtSnippetBindingStrategy new. requestor := nil. ] -{ #category : #accessing } +{ #category : 'accessing' } GtBindingStrategyWithRequestor >> requestor [ ^ requestor ] -{ #category : #accessing } +{ #category : 'accessing' } GtBindingStrategyWithRequestor >> requestor: anObject [ requestor := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtBindingStrategyWithRequestor >> selection [ ^ self requestor diff --git a/src/GToolkit-VariableBindings/GtBindingsTrait.trait.st b/src/GToolkit-VariableBindings/GtBindingsTrait.trait.st index f634b1e01..f04b4bab6 100644 --- a/src/GToolkit-VariableBindings/GtBindingsTrait.trait.st +++ b/src/GToolkit-VariableBindings/GtBindingsTrait.trait.st @@ -1,26 +1,26 @@ Trait { - #name : #GtBindingsTrait, - #category : #'GToolkit-VariableBindings-Core' + #name : 'GtBindingsTrait', + #category : 'GToolkit-VariableBindings-Core' } -{ #category : #converting } +{ #category : 'converting' } GtBindingsTrait >> allNames [ ^ self asDictionary keys ] -{ #category : #converting } +{ #category : 'converting' } GtBindingsTrait >> asDictionary [ ^ self explicitRequirement ] -{ #category : #adding } +{ #category : 'adding' } GtBindingsTrait >> at: aSymbol put: anObject [ "Set bindings for a variable named aSymbol and value anObject." self explicitRequirement ] -{ #category : #accessing } +{ #category : 'accessing' } GtBindingsTrait >> bindingOf: aSymbol [ "aSymbol is a variable name. Return a literal variable if the variable has a value assigned. @@ -29,7 +29,7 @@ GtBindingsTrait >> bindingOf: aSymbol [ ^ self explicitRequirement ] -{ #category : #testing } +{ #category : 'testing' } GtBindingsTrait >> hasBindingOf: aSymbol [ ^ self explicitRequirement diff --git a/src/GToolkit-VariableBindings/GtCommandExamples.class.st b/src/GToolkit-VariableBindings/GtCommandExamples.class.st index db9a4b375..31811f663 100644 --- a/src/GToolkit-VariableBindings/GtCommandExamples.class.st +++ b/src/GToolkit-VariableBindings/GtCommandExamples.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtCommandExamples, - #superclass : #Object, - #category : #'GToolkit-VariableBindings-Examples' + #name : 'GtCommandExamples', + #superclass : 'Object', + #category : 'GToolkit-VariableBindings-Examples' } -{ #category : #'code evaluation' } +{ #category : 'code evaluation' } GtCommandExamples >> evaluateSourceCodeCommand [ @@ -17,7 +17,7 @@ GtCommandExamples >> evaluateSourceCodeCommand [ ^ aCommand ] -{ #category : #'code evaluation' } +{ #category : 'code evaluation' } GtCommandExamples >> executeDefaultSourceCode [ @@ -28,7 +28,7 @@ GtCommandExamples >> executeDefaultSourceCode [ ^ aCommand ] -{ #category : #'code evaluation' } +{ #category : 'code evaluation' } GtCommandExamples >> executeSourceCode [ @@ -40,7 +40,7 @@ GtCommandExamples >> executeSourceCode [ ^ aCommand ] -{ #category : #'code evaluation' } +{ #category : 'code evaluation' } GtCommandExamples >> executeSourceCodeWithUndefinedVariable [ @@ -57,7 +57,7 @@ GtCommandExamples >> executeSourceCodeWithUndefinedVariable [ ^ aCommand ] -{ #category : #'code evaluation' } +{ #category : 'code evaluation' } GtCommandExamples >> executeSourceCodeWithUndefinedVariableUsingPlaygroundBindings [ @@ -72,7 +72,7 @@ GtCommandExamples >> executeSourceCodeWithUndefinedVariableUsingPlaygroundBindin ^ aCommand ] -{ #category : #'code evaluation' } +{ #category : 'code evaluation' } GtCommandExamples >> executeUndefinedVariable [ @@ -89,7 +89,7 @@ GtCommandExamples >> executeUndefinedVariable [ ^ aCommand ] -{ #category : #'code evaluation' } +{ #category : 'code evaluation' } GtCommandExamples >> playgroundBindings [ ^ GtSnippetBindings new diff --git a/src/GToolkit-VariableBindings/GtCompositeVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtCompositeVariablesBindings.class.st new file mode 100644 index 000000000..b969d077c --- /dev/null +++ b/src/GToolkit-VariableBindings/GtCompositeVariablesBindings.class.st @@ -0,0 +1,48 @@ +Class { + #name : 'GtCompositeVariablesBindings', + #superclass : 'Object', + #traits : 'TGtVariablesBindings', + #classTraits : 'TGtVariablesBindings classTrait', + #instVars : [ + 'bindings' + ], + #category : 'GToolkit-VariableBindings-Bindings' +} + +{ #category : 'adding' } +GtCompositeVariablesBindings >> addBindings: aGtVariablesBindings [ + bindings add: aGtVariablesBindings +] + +{ #category : 'binding' } +GtCompositeVariablesBindings >> bindingNames [ + ^ bindings flatCollect: [ :eachVariableBindings | eachVariableBindings bindingNames ] +] + +{ #category : 'binding' } +GtCompositeVariablesBindings >> bindingOf: aSymbol [ + "aSymbol is a variable name. + Return a literal variable if the variable has a value assigned. + Return nil, if the variable has no value assigned." + + + bindings do: [ :eachVariableBindings | + (eachVariableBindings bindingOf: aSymbol) + ifNotNil: [ :aVariable | ^ aVariable ] ]. + + ^ nil +] + +{ #category : 'testing' } +GtCompositeVariablesBindings >> hasBindingOf: aSymbol [ + + + ^ bindings anySatisfy: [ :eachVariableBindings | eachVariableBindings hasBindingOf: aSymbol ] +] + +{ #category : 'initialization' } +GtCompositeVariablesBindings >> initialize [ + super initialize. + + bindings := OrderedCollection new +] diff --git a/src/GToolkit-VariableBindings/GtContextHighlightingBindingStrategy.class.st b/src/GToolkit-VariableBindings/GtContextHighlightingBindingStrategy.class.st index e422ab8e8..53ba2769f 100644 --- a/src/GToolkit-VariableBindings/GtContextHighlightingBindingStrategy.class.st +++ b/src/GToolkit-VariableBindings/GtContextHighlightingBindingStrategy.class.st @@ -1,13 +1,13 @@ Class { - #name : #GtContextHighlightingBindingStrategy, - #superclass : #GtHighlightingBindingStrategy, + #name : 'GtContextHighlightingBindingStrategy', + #superclass : 'GtHighlightingBindingStrategy', #instVars : [ 'context' ], - #category : #'GToolkit-VariableBindings-Core' + #category : 'GToolkit-VariableBindings-Core' } -{ #category : #binding } +{ #category : 'binding' } GtContextHighlightingBindingStrategy >> bindingOf: aSymbol [ | value | (super bindingOf: aSymbol) ifNotNil: [ :aBinding | aBinding ]. @@ -17,12 +17,12 @@ GtContextHighlightingBindingStrategy >> bindingOf: aSymbol [ ^ WorkspaceVariable key: aSymbol value: value ] -{ #category : #accessing } +{ #category : 'accessing' } GtContextHighlightingBindingStrategy >> context: aContext [ context := aContext ] -{ #category : #binding } +{ #category : 'binding' } GtContextHighlightingBindingStrategy >> hasBindingOf: aSymbol [ ^ (super hasBindingOf: aSymbol) or: [ context hasTemporaryVariableNamed: aSymbol ] diff --git a/src/GToolkit-VariableBindings/GtContextVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtContextVariablesBindings.class.st new file mode 100644 index 000000000..3845f6bb0 --- /dev/null +++ b/src/GToolkit-VariableBindings/GtContextVariablesBindings.class.st @@ -0,0 +1,49 @@ +Class { + #name : 'GtContextVariablesBindings', + #superclass : 'Object', + #traits : 'TGtVariablesBindings', + #classTraits : 'TGtVariablesBindings classTrait', + #instVars : [ + 'context' + ], + #category : 'GToolkit-VariableBindings-Bindings' +} + +{ #category : 'binding' } +GtContextVariablesBindings >> bindingNames [ + ^ context tempNames +] + +{ #category : 'binding' } +GtContextVariablesBindings >> bindingOf: aSymbol [ + "aSymbol is a variable name. + Return a literal variable if the variable has a value assigned. + Return nil, if the variable has no value assigned." + + | var | + var := context lookupVar: aSymbol. + var + ifNil: [ ^ nil ]. + var isLocalVariable + ifFalse: [ ^ nil ]. + ^ var +] + +{ #category : 'accessing' } +GtContextVariablesBindings >> context [ + + ^ context +] + +{ #category : 'accessing' } +GtContextVariablesBindings >> context: anObject [ + + context := anObject +] + +{ #category : 'testing' } +GtContextVariablesBindings >> hasBindingOf: aSymbol [ + + + ^ (self bindingOf: aSymbol) notNil +] diff --git a/src/GToolkit-VariableBindings/GtEvaluateSourceCodeCommand.class.st b/src/GToolkit-VariableBindings/GtEvaluateSourceCodeCommand.class.st index 1e16970fb..ed0b09aea 100644 --- a/src/GToolkit-VariableBindings/GtEvaluateSourceCodeCommand.class.st +++ b/src/GToolkit-VariableBindings/GtEvaluateSourceCodeCommand.class.st @@ -1,33 +1,33 @@ Class { - #name : #GtEvaluateSourceCodeCommand, - #superclass : #BlTktCommand, + #name : 'GtEvaluateSourceCodeCommand', + #superclass : 'BlTktCommand', #instVars : [ 'result', 'sourceCode', 'receiver', 'requestorAndBindings' ], - #category : #'GToolkit-VariableBindings-Commands' + #category : 'GToolkit-VariableBindings-Commands' } -{ #category : #accessing } +{ #category : 'accessing' } GtEvaluateSourceCodeCommand >> bindingStrategy [ ^ requestorAndBindings bindingStrategy ] -{ #category : #accessing } +{ #category : 'accessing' } GtEvaluateSourceCodeCommand >> bindingStrategy: aGtBindingStrategy [ requestorAndBindings bindingStrategy: aGtBindingStrategy ] -{ #category : #accessing } +{ #category : 'accessing' } GtEvaluateSourceCodeCommand >> catchingErrors [ "Return an error or collections of errors to catch during a command execution" ^ Error, OCSemanticWarning ] -{ #category : #execution } +{ #category : 'execution' } GtEvaluateSourceCodeCommand >> execute [ | aCompiler | aCompiler := self class compiler @@ -49,7 +49,7 @@ GtEvaluateSourceCodeCommand >> execute [ ^ result ] -{ #category : #initialization } +{ #category : 'initialization' } GtEvaluateSourceCodeCommand >> initialize [ super initialize. sourceCode := 'nil'. @@ -57,39 +57,39 @@ GtEvaluateSourceCodeCommand >> initialize [ requestorAndBindings := GtBindingStrategyWithRequestor new. ] -{ #category : #accessing } +{ #category : 'accessing' } GtEvaluateSourceCodeCommand >> receiver [ ^ receiver ] -{ #category : #accessing } +{ #category : 'accessing' } GtEvaluateSourceCodeCommand >> receiver: anObject [ receiver := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtEvaluateSourceCodeCommand >> requestor [ ^ requestorAndBindings requestor ] -{ #category : #accessing } +{ #category : 'accessing' } GtEvaluateSourceCodeCommand >> requestor: anObject [ requestorAndBindings requestor: anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtEvaluateSourceCodeCommand >> result [ "Return a source code evaluation result" ^ result ] -{ #category : #accessing } +{ #category : 'accessing' } GtEvaluateSourceCodeCommand >> sourceCode [ ^ sourceCode ] -{ #category : #accessing } +{ #category : 'accessing' } GtEvaluateSourceCodeCommand >> sourceCode: aString [ self assert: [ aString notNil ] @@ -97,13 +97,13 @@ GtEvaluateSourceCodeCommand >> sourceCode: aString [ sourceCode := aString asString ] -{ #category : #accessing } +{ #category : 'accessing' } GtEvaluateSourceCodeCommand >> variableBindings [ ^ requestorAndBindings bindingStrategy bindings ] -{ #category : #accessing } +{ #category : 'accessing' } GtEvaluateSourceCodeCommand >> variableBindings: aGtBindingsTrait [ self assert: [ aGtBindingsTrait notNil ] diff --git a/src/GToolkit-VariableBindings/GtGlobalVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtGlobalVariablesBindings.class.st new file mode 100644 index 000000000..228ee3cd2 --- /dev/null +++ b/src/GToolkit-VariableBindings/GtGlobalVariablesBindings.class.st @@ -0,0 +1,29 @@ +Class { + #name : 'GtGlobalVariablesBindings', + #superclass : 'Object', + #traits : 'TGtVariablesBindings', + #classTraits : 'TGtVariablesBindings classTrait', + #category : 'GToolkit-VariableBindings-Bindings' +} + +{ #category : 'binding' } +GtGlobalVariablesBindings >> bindingNames [ + ^ self class environment keys +] + +{ #category : 'binding' } +GtGlobalVariablesBindings >> bindingOf: aSymbol [ + "aSymbol is a variable name. + Return a literal variable if the variable has a value assigned. + Return nil, if the variable has no value assigned." + + + ^ self class environment bindingOf: aSymbol +] + +{ #category : 'testing' } +GtGlobalVariablesBindings >> hasBindingOf: aSymbol [ + + + ^ self class environment includesKey: aSymbol +] diff --git a/src/GToolkit-VariableBindings/GtHighlightingBindingStrategy.class.st b/src/GToolkit-VariableBindings/GtHighlightingBindingStrategy.class.st index dc26a58ed..4a84a7f22 100644 --- a/src/GToolkit-VariableBindings/GtHighlightingBindingStrategy.class.st +++ b/src/GToolkit-VariableBindings/GtHighlightingBindingStrategy.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtHighlightingBindingStrategy, - #superclass : #GtBindingStrategy, - #category : #'GToolkit-VariableBindings-Core' + #name : 'GtHighlightingBindingStrategy', + #superclass : 'GtBindingStrategy', + #category : 'GToolkit-VariableBindings-Core' } -{ #category : #private } +{ #category : 'private' } GtHighlightingBindingStrategy >> treatBinding: anAssocOrNil of: aSymbol [ "Subclasses can treat existing or missing bindings of a variable named aSymbol" diff --git a/src/GToolkit-VariableBindings/GtLocalSnippetBindings.class.st b/src/GToolkit-VariableBindings/GtLocalSnippetBindings.class.st index 215f86896..c4cf42789 100644 --- a/src/GToolkit-VariableBindings/GtLocalSnippetBindings.class.st +++ b/src/GToolkit-VariableBindings/GtLocalSnippetBindings.class.st @@ -16,18 +16,18 @@ GtLocalSnippetBindings provide a multi-tier set of bindings, allowing snippets t " Class { - #name : #GtLocalSnippetBindings, - #superclass : #Object, + #name : 'GtLocalSnippetBindings', + #superclass : 'Object', #traits : 'GtBindingsTrait + TGtAssert', #classTraits : 'GtBindingsTrait classTrait + TGtAssert classTrait', #instVars : [ 'sharedBindings', 'localBindings' ], - #category : #'GToolkit-VariableBindings-Core' + #category : 'GToolkit-VariableBindings-Core' } -{ #category : #comparing } +{ #category : 'comparing' } GtLocalSnippetBindings >> = anObject [ "Answer whether the receiver and anObject represent the same object." @@ -39,13 +39,13 @@ GtLocalSnippetBindings >> = anObject [ and: [ localBindings = anObject localBindings ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtLocalSnippetBindings >> allNames [ ^ self localNames, self sharedNames ] -{ #category : #converting } +{ #category : 'converting' } GtLocalSnippetBindings >> asDictionary [ | dictionary | @@ -55,7 +55,7 @@ GtLocalSnippetBindings >> asDictionary [ ^ dictionary ] -{ #category : #accessing } +{ #category : 'accessing' } GtLocalSnippetBindings >> at: aSymbol put: anObject [ "By default, bindings are global" @@ -66,7 +66,7 @@ GtLocalSnippetBindings >> at: aSymbol put: anObject [ ] -{ #category : #binding } +{ #category : 'binding' } GtLocalSnippetBindings >> bindingOf: aSymbol [ ^ localBindings @@ -75,32 +75,32 @@ GtLocalSnippetBindings >> bindingOf: aSymbol [ ifAbsent: [ sharedBindings bindingOf: aSymbol ] ] -{ #category : #'gt-extension' } +{ #category : 'gt-extension' } GtLocalSnippetBindings >> gtBindingsFor: aView [ ^ self asDictionary gtItemsFor: aView ] -{ #category : #binding } +{ #category : 'binding' } GtLocalSnippetBindings >> hasBindingOf: aSymbol [ ^ (sharedBindings hasBindingOf: aSymbol) or: [ localBindings includesKey: aSymbol ] ] -{ #category : #comparing } +{ #category : 'comparing' } GtLocalSnippetBindings >> hash [ "Answer an integer value that is related to the identity of the receiver." ^ sharedBindings hash bitXor: localBindings hash ] -{ #category : #initialization } +{ #category : 'initialization' } GtLocalSnippetBindings >> initialize [ super initialize. localBindings := IdentityDictionary new. ] -{ #category : #accessing } +{ #category : 'accessing' } GtLocalSnippetBindings >> localAt: aSymbol put: anObject [ self assert: [ aSymbol isSymbol ] description: [ 'Variable name should be a symbol' ]. @@ -109,47 +109,47 @@ GtLocalSnippetBindings >> localAt: aSymbol put: anObject [ put: ((WorkspaceVariable named: aSymbol) value: anObject) ] -{ #category : #accessing } +{ #category : 'accessing' } GtLocalSnippetBindings >> localBindings [ ^ localBindings ] -{ #category : #accessing } +{ #category : 'accessing' } GtLocalSnippetBindings >> localBindings: anObject [ localBindings := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtLocalSnippetBindings >> localNames [ "Answer the names of the local bindings" ^ localBindings keys ] -{ #category : #copying } +{ #category : 'copying' } GtLocalSnippetBindings >> postCopy [ sharedBindings := sharedBindings copy. localBindings := localBindings copy ] -{ #category : #accessing } +{ #category : 'accessing' } GtLocalSnippetBindings >> receiver [ ^ sharedBindings receiver ] -{ #category : #accessing } +{ #category : 'accessing' } GtLocalSnippetBindings >> receiver: anObject [ sharedBindings receiver: anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtLocalSnippetBindings >> receiverClass [ ^ sharedBindings receiver class ] -{ #category : #removing } +{ #category : 'removing' } GtLocalSnippetBindings >> remove: aSymbol [ self assert: [ aSymbol isSymbol ] description: [ 'Variable name should be a symbol' ]. localBindings @@ -157,17 +157,17 @@ GtLocalSnippetBindings >> remove: aSymbol [ ifAbsent: [ sharedBindings remove: aSymbol ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtLocalSnippetBindings >> sharedBindings [ ^ sharedBindings ] -{ #category : #accessing } +{ #category : 'accessing' } GtLocalSnippetBindings >> sharedBindings: anObject [ sharedBindings := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtLocalSnippetBindings >> sharedNames [ ^ sharedBindings names diff --git a/src/GToolkit-VariableBindings/GtLocalVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtLocalVariablesBindings.class.st new file mode 100644 index 000000000..c171ec114 --- /dev/null +++ b/src/GToolkit-VariableBindings/GtLocalVariablesBindings.class.st @@ -0,0 +1,52 @@ +Class { + #name : 'GtLocalVariablesBindings', + #superclass : 'Object', + #traits : 'TGtVariablesBindings', + #classTraits : 'TGtVariablesBindings classTrait', + #instVars : [ + 'bindings' + ], + #category : 'GToolkit-VariableBindings-Bindings' +} + +{ #category : 'binding' } +GtLocalVariablesBindings >> bindingNames [ + ^ bindings keys +] + +{ #category : 'binding' } +GtLocalVariablesBindings >> bindingOf: aSymbol [ + "aSymbol is a variable name. + Return a literal variable if the variable has a value assigned. + Return nil, if the variable has no value assigned." + + + ^ bindings + at: aSymbol + ifAbsent: [ nil ] +] + +{ #category : 'testing' } +GtLocalVariablesBindings >> hasBindingOf: aSymbol [ + + + ^ bindings includesKey: aSymbol +] + +{ #category : 'initialization' } +GtLocalVariablesBindings >> initialize [ + super initialize. + + bindings := Dictionary new +] + +{ #category : 'accessing' } +GtLocalVariablesBindings >> localAt: aSymbol put: anObject [ + self + assert: [ aSymbol isSymbol ] + description: [ 'Variable name should be a symbol' ]. + + bindings + at: aSymbol + put: (WorkspaceVariable key: aSymbol value: anObject) +] diff --git a/src/GToolkit-VariableBindings/GtNoBindings.class.st b/src/GToolkit-VariableBindings/GtNoBindings.class.st index 4b1c0003b..606ce151a 100644 --- a/src/GToolkit-VariableBindings/GtNoBindings.class.st +++ b/src/GToolkit-VariableBindings/GtNoBindings.class.st @@ -1,67 +1,67 @@ Class { - #name : #GtNoBindings, - #superclass : #Object, + #name : 'GtNoBindings', + #superclass : 'Object', #traits : 'GtBindingsTrait', #classTraits : 'GtBindingsTrait classTrait', #classInstVars : [ 'uniqueInstance' ], - #category : #'GToolkit-VariableBindings-Core' + #category : 'GToolkit-VariableBindings-Core' } -{ #category : #cleanup } +{ #category : 'cleanup' } GtNoBindings class >> cleanUp [ self reset. ] -{ #category : #accessing } +{ #category : 'accessing' } GtNoBindings class >> reset [ uniqueInstance := nil ] -{ #category : #accessing } +{ #category : 'accessing' } GtNoBindings class >> uniqueInstance [ ^ uniqueInstance ifNil: [ uniqueInstance := self new ] ] -{ #category : #comparing } +{ #category : 'comparing' } GtNoBindings >> = anObject [ self == anObject ifTrue: [ ^ true ]. ^ self class = anObject class ] -{ #category : #converting } +{ #category : 'converting' } GtNoBindings >> asDictionary [ ^ Dictionary new ] -{ #category : #adding } +{ #category : 'adding' } GtNoBindings >> at: aString put: anObject [ "ignore by default" ] -{ #category : #binding } +{ #category : 'binding' } GtNoBindings >> bindingOf: aSymbol [ ^ nil ] -{ #category : #binding } +{ #category : 'binding' } GtNoBindings >> hasBindingOf: aSymbol [ ^ false ] -{ #category : #comparing } +{ #category : 'comparing' } GtNoBindings >> hash [ ^ self class hash ] -{ #category : #accessing } +{ #category : 'accessing' } GtNoBindings >> receiver [ ^ nil ] -{ #category : #accessing } +{ #category : 'accessing' } GtNoBindings >> receiverClass [ ^ self receiver class ] diff --git a/src/GToolkit-VariableBindings/GtReservedVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtReservedVariablesBindings.class.st new file mode 100644 index 000000000..290970d73 --- /dev/null +++ b/src/GToolkit-VariableBindings/GtReservedVariablesBindings.class.st @@ -0,0 +1,31 @@ +Class { + #name : 'GtReservedVariablesBindings', + #superclass : 'Object', + #traits : 'TGtVariablesBindings', + #classTraits : 'TGtVariablesBindings classTrait', + #category : 'GToolkit-VariableBindings-Bindings' +} + +{ #category : 'binding' } +GtReservedVariablesBindings >> bindingNames [ + ^ self class environment reservedVariables +] + +{ #category : 'binding' } +GtReservedVariablesBindings >> bindingOf: aSymbol [ + "aSymbol is a variable name. + Return a literal variable if the variable has a value assigned. + Return nil, if the variable has no value assigned." + + + ^ self class environment reservedVariables + at: aSymbol + ifAbsent: [ nil ] +] + +{ #category : 'testing' } +GtReservedVariablesBindings >> hasBindingOf: aSymbol [ + + + ^ self class environment reservedVariables includesKey: aSymbol +] diff --git a/src/GToolkit-VariableBindings/GtSharedVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtSharedVariablesBindings.class.st new file mode 100644 index 000000000..8885cd97b --- /dev/null +++ b/src/GToolkit-VariableBindings/GtSharedVariablesBindings.class.st @@ -0,0 +1,41 @@ +Class { + #name : 'GtSharedVariablesBindings', + #superclass : 'Object', + #traits : 'TGtVariablesBindings', + #classTraits : 'TGtVariablesBindings classTrait', + #instVars : [ + 'bindings' + ], + #category : 'GToolkit-VariableBindings-Bindings' +} + +{ #category : 'binding' } +GtSharedVariablesBindings >> bindingNames [ + ^ bindings keys +] + +{ #category : 'binding' } +GtSharedVariablesBindings >> bindingOf: aSymbol [ + "aSymbol is a variable name. + Return a literal variable if the variable has a value assigned. + Return nil, if the variable has no value assigned." + + + ^ bindings + at: aSymbol + ifAbsentPut: [ WorkspaceVariable key: aSymbol ] +] + +{ #category : 'testing' } +GtSharedVariablesBindings >> hasBindingOf: aSymbol [ + + + ^ bindings includesKey: aSymbol +] + +{ #category : 'initialization' } +GtSharedVariablesBindings >> initialize [ + super initialize. + + bindings := Dictionary new +] diff --git a/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st new file mode 100644 index 000000000..d0b58de17 --- /dev/null +++ b/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st @@ -0,0 +1,50 @@ +Class { + #name : 'GtSlotVariablesBindings', + #superclass : 'Object', + #traits : 'TGtVariablesBindings', + #classTraits : 'TGtVariablesBindings classTrait', + #instVars : [ + 'object' + ], + #category : 'GToolkit-VariableBindings-Bindings' +} + +{ #category : 'binding' } +GtSlotVariablesBindings >> bindingNames [ + ^ object slotNames +] + +{ #category : 'binding' } +GtSlotVariablesBindings >> bindingOf: aSymbol [ + "aSymbol is a variable name. + Return a literal variable if the variable has a value assigned. + Return nil, if the variable has no value assigned." + + + ^ object class + slotNamed: aSymbol + ifFound: [ :aSlot | aSlot ] + ifNone: [ nil ] +] + +{ #category : 'testing' } +GtSlotVariablesBindings >> hasBindingOf: aSymbol [ + + + ^ object class + slotNamed: aSymbol + ifFound: [ :slot | true ] + ifNone: [ false ] +] + +{ #category : 'accessing' } +GtSlotVariablesBindings >> object [ + + ^ object +] + +{ #category : 'accessing' } +GtSlotVariablesBindings >> object: anObject [ + + object := anObject +] diff --git a/src/GToolkit-VariableBindings/GtSnippetBindingStrategy.class.st b/src/GToolkit-VariableBindings/GtSnippetBindingStrategy.class.st index 0ad02e532..30ba2907c 100644 --- a/src/GToolkit-VariableBindings/GtSnippetBindingStrategy.class.st +++ b/src/GToolkit-VariableBindings/GtSnippetBindingStrategy.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtSnippetBindingStrategy, - #superclass : #GtBindingStrategy, - #category : #'GToolkit-VariableBindings-Core' + #name : 'GtSnippetBindingStrategy', + #superclass : 'GtBindingStrategy', + #category : 'GToolkit-VariableBindings-Core' } -{ #category : #comparing } +{ #category : 'comparing' } GtSnippetBindingStrategy >> = anObject [ "Answer whether the receiver and anObject represent the same object." @@ -13,7 +13,7 @@ GtSnippetBindingStrategy >> = anObject [ ^ bindings = anObject bindings ] -{ #category : #binding } +{ #category : 'binding' } GtSnippetBindingStrategy >> bindingOf: aSymbol [ (self isBindingInReceiverScope: aSymbol) ifTrue: [ @@ -22,14 +22,14 @@ GtSnippetBindingStrategy >> bindingOf: aSymbol [ ] -{ #category : #comparing } +{ #category : 'comparing' } GtSnippetBindingStrategy >> hash [ "Answer an integer value that is related to the identity of the receiver." ^ bindings hash ] -{ #category : #testing } +{ #category : 'testing' } GtSnippetBindingStrategy >> isBindingInReceiverScope: aSymbol [ "If the requested binding is an instance variable of the receiver then return nil and allow the instance scope to return the binding. This needs to happen as currenty @@ -42,7 +42,7 @@ GtSnippetBindingStrategy >> isBindingInReceiverScope: aSymbol [ ] -{ #category : #private } +{ #category : 'private' } GtSnippetBindingStrategy >> treatBinding: anAssocOrNil of: aSymbol [ "Subclasses can treat existing or missing bindings of a variable named aSymbol" diff --git a/src/GToolkit-VariableBindings/GtSnippetBindings.class.st b/src/GToolkit-VariableBindings/GtSnippetBindings.class.st index d8c3ece97..bf7ef9c77 100644 --- a/src/GToolkit-VariableBindings/GtSnippetBindings.class.st +++ b/src/GToolkit-VariableBindings/GtSnippetBindings.class.st @@ -1,16 +1,16 @@ Class { - #name : #GtSnippetBindings, - #superclass : #Object, + #name : 'GtSnippetBindings', + #superclass : 'Object', #traits : 'GtBindingsTrait + TGtAssert', #classTraits : 'GtBindingsTrait classTrait + TGtAssert classTrait', #instVars : [ 'bindings', 'receiver' ], - #category : #'GToolkit-VariableBindings-Core' + #category : 'GToolkit-VariableBindings-Core' } -{ #category : #comparing } +{ #category : 'comparing' } GtSnippetBindings >> = anObject [ "Answer whether the receiver and anObject represent the same object." @@ -19,7 +19,7 @@ GtSnippetBindings >> = anObject [ ^ receiver = anObject receiver and: [ bindings = anObject bindings ] ] -{ #category : #converting } +{ #category : 'converting' } GtSnippetBindings >> asDictionary [ | aDictionary | @@ -34,7 +34,7 @@ GtSnippetBindings >> asDictionary [ ^ aDictionary ] -{ #category : #adding } +{ #category : 'adding' } GtSnippetBindings >> at: aSymbol put: anObject [ self assert: [ aSymbol isSymbol ] description: [ 'Variable name should be a symbol' ]. @@ -43,7 +43,7 @@ GtSnippetBindings >> at: aSymbol put: anObject [ put: ((WorkspaceVariable named: aSymbol) value: anObject) ] -{ #category : #binding } +{ #category : 'binding' } GtSnippetBindings >> bindingOf: aSymbol [ ^ bindings at: aSymbol @@ -51,58 +51,58 @@ GtSnippetBindings >> bindingOf: aSymbol [ ifAbsent: [ nil ] ] -{ #category : #accessing } +{ #category : 'accessing' } GtSnippetBindings >> bindings [ ^ bindings ] -{ #category : #'gt-extension' } +{ #category : 'gt-extension' } GtSnippetBindings >> gtBindingsFor: aView [ ^ bindings gtItemsFor: aView ] -{ #category : #binding } +{ #category : 'binding' } GtSnippetBindings >> hasBindingOf: aSymbol [ ^ bindings includesKey: aSymbol ] -{ #category : #comparing } +{ #category : 'comparing' } GtSnippetBindings >> hash [ "Answer an integer value that is related to the identity of the receiver." ^ receiver hash bitXor: bindings hash ] -{ #category : #initialization } +{ #category : 'initialization' } GtSnippetBindings >> initialize [ super initialize. bindings := Dictionary new. receiver := nil. ] -{ #category : #accessing } +{ #category : 'accessing' } GtSnippetBindings >> names [ ^ bindings keys ] -{ #category : #accessing } +{ #category : 'accessing' } GtSnippetBindings >> receiver [ ^ receiver ] -{ #category : #accessing } +{ #category : 'accessing' } GtSnippetBindings >> receiver: anObject [ receiver := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } GtSnippetBindings >> receiverClass [ ^ self receiver class ] -{ #category : #removing } +{ #category : 'removing' } GtSnippetBindings >> remove: aSymbol [ self assert: [ aSymbol isSymbol ] description: [ 'Variable name should be a symbol' ]. bindings diff --git a/src/GToolkit-VariableBindings/ManifestGToolkitVariableBindings.class.st b/src/GToolkit-VariableBindings/ManifestGToolkitVariableBindings.class.st index bb9b20cfb..f45df364a 100644 --- a/src/GToolkit-VariableBindings/ManifestGToolkitVariableBindings.class.st +++ b/src/GToolkit-VariableBindings/ManifestGToolkitVariableBindings.class.st @@ -4,7 +4,7 @@ I store metadata for this package. These meta data are used by other tools such " Class { - #name : #ManifestGToolkitVariableBindings, - #superclass : #PackageManifest, - #category : #'GToolkit-VariableBindings-Manifest' + #name : 'ManifestGToolkitVariableBindings', + #superclass : 'PackageManifest', + #category : 'GToolkit-VariableBindings-Manifest' } diff --git a/src/GToolkit-VariableBindings/TGtVariablesBindings.trait.st b/src/GToolkit-VariableBindings/TGtVariablesBindings.trait.st new file mode 100644 index 000000000..9b1b090e7 --- /dev/null +++ b/src/GToolkit-VariableBindings/TGtVariablesBindings.trait.st @@ -0,0 +1,37 @@ +Trait { + #name : 'TGtVariablesBindings', + #category : 'GToolkit-VariableBindings-Bindings' +} + +{ #category : 'converting' } +TGtVariablesBindings >> asDictionary [ + | aDictionary | + + aDictionary := Dictionary new. + self bindingNames do: [ :eachBindingName | + aDictionary at: eachBindingName put: (self bindingOf: eachBindingName) ]. + + ^ aDictionary +] + +{ #category : 'binding' } +TGtVariablesBindings >> bindingNames [ + ^ self explicitRequirement +] + +{ #category : 'binding' } +TGtVariablesBindings >> bindingOf: aSymbol [ + "aSymbol is a variable name. + Return a literal variable if the variable has a value assigned. + Return nil, if the variable has no value assigned." + + + ^ self explicitRequirement +] + +{ #category : 'testing' } +TGtVariablesBindings >> hasBindingOf: aSymbol [ + + + ^ self explicitRequirement +] diff --git a/src/GToolkit-VariableBindings/package.st b/src/GToolkit-VariableBindings/package.st index 0c31d5739..f16e575b7 100644 --- a/src/GToolkit-VariableBindings/package.st +++ b/src/GToolkit-VariableBindings/package.st @@ -1 +1 @@ -Package { #name : #'GToolkit-VariableBindings' } +Package { #name : 'GToolkit-VariableBindings' } From 3d6aa068cb25bb98de8e00bbf20f6c211426e680 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 23 Sep 2021 12:45:32 +0200 Subject: [PATCH 0024/1268] [feenkcom/gtoolkit#2113] add equals and hash to variable bindings --- .../GtCompositeVariablesBindings.class.st | 24 +++++++++++ .../GtContextVariablesBindings.class.st | 18 +++++++++ .../GtEmptyVariablesBindings.class.st | 40 +++++++++++++++++++ .../GtGlobalVariablesBindings.class.st | 11 +++++ .../GtLocalVariablesBindings.class.st | 24 +++++++++++ .../GtReservedVariablesBindings.class.st | 13 +++++- .../GtSharedVariablesBindings.class.st | 24 +++++++++++ .../GtSlotVariablesBindings.class.st | 18 +++++++++ 8 files changed, 171 insertions(+), 1 deletion(-) create mode 100644 src/GToolkit-VariableBindings/GtEmptyVariablesBindings.class.st diff --git a/src/GToolkit-VariableBindings/GtCompositeVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtCompositeVariablesBindings.class.st index b969d077c..77c30554b 100644 --- a/src/GToolkit-VariableBindings/GtCompositeVariablesBindings.class.st +++ b/src/GToolkit-VariableBindings/GtCompositeVariablesBindings.class.st @@ -9,6 +9,16 @@ Class { #category : 'GToolkit-VariableBindings-Bindings' } +{ #category : 'comparing' } +GtCompositeVariablesBindings >> = anObject [ + + "Answer whether the receiver and anObject represent the same object." + + self == anObject ifTrue: [ ^ true ]. + self class = anObject class ifFalse: [ ^ false ]. + ^ bindings = anObject bindings +] + { #category : 'adding' } GtCompositeVariablesBindings >> addBindings: aGtVariablesBindings [ bindings add: aGtVariablesBindings @@ -33,6 +43,12 @@ GtCompositeVariablesBindings >> bindingOf: aSymbol [ ^ nil ] +{ #category : 'accessing' } +GtCompositeVariablesBindings >> bindings [ + + ^ bindings +] + { #category : 'testing' } GtCompositeVariablesBindings >> hasBindingOf: aSymbol [ @@ -40,6 +56,14 @@ GtCompositeVariablesBindings >> hasBindingOf: aSymbol [ ^ bindings anySatisfy: [ :eachVariableBindings | eachVariableBindings hasBindingOf: aSymbol ] ] +{ #category : 'comparing' } +GtCompositeVariablesBindings >> hash [ + + "Answer an integer value that is related to the identity of the receiver." + + ^ bindings hash +] + { #category : 'initialization' } GtCompositeVariablesBindings >> initialize [ super initialize. diff --git a/src/GToolkit-VariableBindings/GtContextVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtContextVariablesBindings.class.st index 3845f6bb0..30dd6143e 100644 --- a/src/GToolkit-VariableBindings/GtContextVariablesBindings.class.st +++ b/src/GToolkit-VariableBindings/GtContextVariablesBindings.class.st @@ -9,6 +9,16 @@ Class { #category : 'GToolkit-VariableBindings-Bindings' } +{ #category : 'comparing' } +GtContextVariablesBindings >> = anObject [ + + "Answer whether the receiver and anObject represent the same object." + + self == anObject ifTrue: [ ^ true ]. + self class = anObject class ifFalse: [ ^ false ]. + ^ context = anObject context +] + { #category : 'binding' } GtContextVariablesBindings >> bindingNames [ ^ context tempNames @@ -47,3 +57,11 @@ GtContextVariablesBindings >> hasBindingOf: aSymbol [ ^ (self bindingOf: aSymbol) notNil ] + +{ #category : 'comparing' } +GtContextVariablesBindings >> hash [ + + "Answer an integer value that is related to the identity of the receiver." + + ^ context hash +] diff --git a/src/GToolkit-VariableBindings/GtEmptyVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtEmptyVariablesBindings.class.st new file mode 100644 index 000000000..8c0be714c --- /dev/null +++ b/src/GToolkit-VariableBindings/GtEmptyVariablesBindings.class.st @@ -0,0 +1,40 @@ +Class { + #name : 'GtEmptyVariablesBindings', + #superclass : 'Object', + #traits : 'TGtVariablesBindings', + #classTraits : 'TGtVariablesBindings classTrait', + #category : 'GToolkit-VariableBindings-Bindings' +} + +{ #category : 'comparing' } +GtEmptyVariablesBindings >> = anObject [ + self == anObject ifTrue: [ ^ true ]. + ^ self class = anObject class +] + +{ #category : 'binding' } +GtEmptyVariablesBindings >> bindingNames [ + ^ #() +] + +{ #category : 'binding' } +GtEmptyVariablesBindings >> bindingOf: aSymbol [ + "aSymbol is a variable name. + Return a literal variable if the variable has a value assigned. + Return nil, if the variable has no value assigned." + + + ^ nil +] + +{ #category : 'testing' } +GtEmptyVariablesBindings >> hasBindingOf: aSymbol [ + + + ^ false +] + +{ #category : 'comparing' } +GtEmptyVariablesBindings >> hash [ + ^ self class hash +] diff --git a/src/GToolkit-VariableBindings/GtGlobalVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtGlobalVariablesBindings.class.st index 228ee3cd2..b5e87ec3e 100644 --- a/src/GToolkit-VariableBindings/GtGlobalVariablesBindings.class.st +++ b/src/GToolkit-VariableBindings/GtGlobalVariablesBindings.class.st @@ -6,6 +6,12 @@ Class { #category : 'GToolkit-VariableBindings-Bindings' } +{ #category : 'comparing' } +GtGlobalVariablesBindings >> = anObject [ + self == anObject ifTrue: [ ^ true ]. + ^ self class = anObject class +] + { #category : 'binding' } GtGlobalVariablesBindings >> bindingNames [ ^ self class environment keys @@ -27,3 +33,8 @@ GtGlobalVariablesBindings >> hasBindingOf: aSymbol [ ^ self class environment includesKey: aSymbol ] + +{ #category : 'comparing' } +GtGlobalVariablesBindings >> hash [ + ^ self class hash +] diff --git a/src/GToolkit-VariableBindings/GtLocalVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtLocalVariablesBindings.class.st index c171ec114..d1daa2d27 100644 --- a/src/GToolkit-VariableBindings/GtLocalVariablesBindings.class.st +++ b/src/GToolkit-VariableBindings/GtLocalVariablesBindings.class.st @@ -9,6 +9,16 @@ Class { #category : 'GToolkit-VariableBindings-Bindings' } +{ #category : 'comparing' } +GtLocalVariablesBindings >> = anObject [ + + "Answer whether the receiver and anObject represent the same object." + + self == anObject ifTrue: [ ^ true ]. + self class = anObject class ifFalse: [ ^ false ]. + ^ bindings = anObject bindings +] + { #category : 'binding' } GtLocalVariablesBindings >> bindingNames [ ^ bindings keys @@ -26,6 +36,12 @@ GtLocalVariablesBindings >> bindingOf: aSymbol [ ifAbsent: [ nil ] ] +{ #category : 'accessing' } +GtLocalVariablesBindings >> bindings [ + + ^ bindings +] + { #category : 'testing' } GtLocalVariablesBindings >> hasBindingOf: aSymbol [ @@ -33,6 +49,14 @@ GtLocalVariablesBindings >> hasBindingOf: aSymbol [ ^ bindings includesKey: aSymbol ] +{ #category : 'comparing' } +GtLocalVariablesBindings >> hash [ + + "Answer an integer value that is related to the identity of the receiver." + + ^ bindings hash +] + { #category : 'initialization' } GtLocalVariablesBindings >> initialize [ super initialize. diff --git a/src/GToolkit-VariableBindings/GtReservedVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtReservedVariablesBindings.class.st index 290970d73..7b47b4c89 100644 --- a/src/GToolkit-VariableBindings/GtReservedVariablesBindings.class.st +++ b/src/GToolkit-VariableBindings/GtReservedVariablesBindings.class.st @@ -6,9 +6,15 @@ Class { #category : 'GToolkit-VariableBindings-Bindings' } +{ #category : 'comparing' } +GtReservedVariablesBindings >> = anObject [ + self == anObject ifTrue: [ ^ true ]. + ^ self class = anObject class +] + { #category : 'binding' } GtReservedVariablesBindings >> bindingNames [ - ^ self class environment reservedVariables + ^ self class environment reservedVariables keys collect: [ :each | each asSymbol ] ] { #category : 'binding' } @@ -29,3 +35,8 @@ GtReservedVariablesBindings >> hasBindingOf: aSymbol [ ^ self class environment reservedVariables includesKey: aSymbol ] + +{ #category : 'comparing' } +GtReservedVariablesBindings >> hash [ + ^ self class hash +] diff --git a/src/GToolkit-VariableBindings/GtSharedVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtSharedVariablesBindings.class.st index 8885cd97b..4a819be67 100644 --- a/src/GToolkit-VariableBindings/GtSharedVariablesBindings.class.st +++ b/src/GToolkit-VariableBindings/GtSharedVariablesBindings.class.st @@ -9,6 +9,16 @@ Class { #category : 'GToolkit-VariableBindings-Bindings' } +{ #category : 'comparing' } +GtSharedVariablesBindings >> = anObject [ + + "Answer whether the receiver and anObject represent the same object." + + self == anObject ifTrue: [ ^ true ]. + self class = anObject class ifFalse: [ ^ false ]. + ^ bindings = anObject bindings +] + { #category : 'binding' } GtSharedVariablesBindings >> bindingNames [ ^ bindings keys @@ -26,6 +36,12 @@ GtSharedVariablesBindings >> bindingOf: aSymbol [ ifAbsentPut: [ WorkspaceVariable key: aSymbol ] ] +{ #category : 'accessing' } +GtSharedVariablesBindings >> bindings [ + + ^ bindings +] + { #category : 'testing' } GtSharedVariablesBindings >> hasBindingOf: aSymbol [ @@ -33,6 +49,14 @@ GtSharedVariablesBindings >> hasBindingOf: aSymbol [ ^ bindings includesKey: aSymbol ] +{ #category : 'comparing' } +GtSharedVariablesBindings >> hash [ + + "Answer an integer value that is related to the identity of the receiver." + + ^ bindings hash +] + { #category : 'initialization' } GtSharedVariablesBindings >> initialize [ super initialize. diff --git a/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st index d0b58de17..680e8d924 100644 --- a/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st +++ b/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st @@ -9,6 +9,16 @@ Class { #category : 'GToolkit-VariableBindings-Bindings' } +{ #category : 'comparing' } +GtSlotVariablesBindings >> = anObject [ + + "Answer whether the receiver and anObject represent the same object." + + self == anObject ifTrue: [ ^ true ]. + self class = anObject class ifFalse: [ ^ false ]. + ^ object = anObject object +] + { #category : 'binding' } GtSlotVariablesBindings >> bindingNames [ ^ object slotNames @@ -37,6 +47,14 @@ GtSlotVariablesBindings >> hasBindingOf: aSymbol [ ifNone: [ false ] ] +{ #category : 'comparing' } +GtSlotVariablesBindings >> hash [ + + "Answer an integer value that is related to the identity of the receiver." + + ^ object hash +] + { #category : 'accessing' } GtSlotVariablesBindings >> object [ From 12c753ebf36e7e9d43a3697e6aeab70ee8e957ca Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 23 Sep 2021 13:03:08 +0200 Subject: [PATCH 0025/1268] [feenkcom/gtoolkit#2113] move gtSlotNames and gtSlotNamed: to variable bindings and use it by the slot variable bindings --- .../ClassDescription.extension.st | 15 +++++++++++++++ .../GtSlotVariablesBindings.class.st | 6 +++--- 2 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 src/GToolkit-VariableBindings/ClassDescription.extension.st diff --git a/src/GToolkit-VariableBindings/ClassDescription.extension.st b/src/GToolkit-VariableBindings/ClassDescription.extension.st new file mode 100644 index 000000000..92ecc7194 --- /dev/null +++ b/src/GToolkit-VariableBindings/ClassDescription.extension.st @@ -0,0 +1,15 @@ +Extension { #name : 'ClassDescription' } + +{ #category : '*GToolkit-VariableBindings' } +ClassDescription >> gtSlotNamed: aName ifFound: foundBlock ifNone: exceptionBlock [ + "By default, searches through all the slots in the object, however proxies may want to override this to display a different set (e.g. none)" + ^self classLayout resolveSlot: aName asSymbol ifFound: foundBlock ifNone: exceptionBlock +] + +{ #category : '*GToolkit-VariableBindings' } +ClassDescription >> gtSlotNames [ + "Answer the slot names to be bound by GtPharoSourceCoderViewModel. + By default, this is all the slots in the object, however proxies may want to override this to display a different set (e.g. none)." + + ^ self slotNames +] diff --git a/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st index 680e8d924..153aecf09 100644 --- a/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st +++ b/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st @@ -21,7 +21,7 @@ GtSlotVariablesBindings >> = anObject [ { #category : 'binding' } GtSlotVariablesBindings >> bindingNames [ - ^ object slotNames + ^ object gtSlotNames ] { #category : 'binding' } @@ -32,7 +32,7 @@ GtSlotVariablesBindings >> bindingOf: aSymbol [ ^ object class - slotNamed: aSymbol + gtSlotNamed: aSymbol ifFound: [ :aSlot | aSlot ] ifNone: [ nil ] ] @@ -42,7 +42,7 @@ GtSlotVariablesBindings >> hasBindingOf: aSymbol [ ^ object class - slotNamed: aSymbol + gtSlotNamed: aSymbol ifFound: [ :slot | true ] ifNone: [ false ] ] From c28d856cc0e1e8bb96343ce63ece689467dd2691 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 23 Sep 2021 14:39:20 +0200 Subject: [PATCH 0026/1268] [feenkcom/gtoolkit#2135] change the embedded coder playground to lepiter --- .../GtCoderPlaygroundElement.class.st | 61 +++++++------------ 1 file changed, 21 insertions(+), 40 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st b/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st index 2dc3d1df0..18158690a 100644 --- a/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st @@ -1,5 +1,5 @@ " -I display {{gtClass:GtCoderContentElement}} and {{gtClass:GtPageElement}}. +I display {{gtClass:GtCoderContentElement}} and an embedded playground. 1. # Example {{gtExample:GtCoderElementExamples>>#playgroundElementWithClass|previewExpanded|codeExpanded=false|previewHeight=700}} @@ -11,8 +11,7 @@ Class { #superclass : 'GtCoderNavigationModelElement', #instVars : [ 'contentElement', - 'playPageElement', - 'playPage' + 'playgroundElement' ], #category : 'GToolkit-Coder-UI-Basic' } @@ -23,24 +22,17 @@ GtCoderPlaygroundElement >> contentElement [ ^ contentElement ] -{ #category : 'defaults' } -GtCoderPlaygroundElement >> defaultPlayPage [ - ^ GtPlayPage newDefault. -] - { #category : 'initialization' } GtCoderPlaygroundElement >> initialize [ super initialize. - playPage := self defaultPlayPage. + self initializeContentElement. self initializePlayPageElement. self layout: BlLinearLayout vertical. self addChild: self contentElement as: #content. - self addChild: self playPageElement as: #playPage. - - self addAptitude: (BrLayoutResizerAptitude inherit). + self addChild: self playPageElement as: #playPage ] { #category : 'initialization' } @@ -50,23 +42,22 @@ GtCoderPlaygroundElement >> initializeContentElement [ { #category : 'initialization' } GtCoderPlaygroundElement >> initializePlayPageElement [ - | aStencil | - aStencil := GtPlayPageStencil new - playPage: self playPage; - receiver: self receiver. - playPageElement := GtPhlowVerticalSidebarElement new - beBottom; - show; - collapse; - background: self theme status neutralBackgroundColor; - contentStencil: aStencil + playgroundElement := (GtInspector environment + at: GtInspector embeddedPlaygroundName + ifAbsent: [ GtInspectorPlaygroundElement ]) new. + + playgroundElement collapse. + playgroundElement objectHolder: self objectHolder +] + +{ #category : 'private - accessing' } +GtCoderPlaygroundElement >> objectHolder [ + ^ GtInspectorObject new object: self receiver ] { #category : 'private - hooks' } GtCoderPlaygroundElement >> onClassSelected: anEvent [ - self playPage receiver: anEvent theClass. - self playPage xDocLoadSavedContent. - + self updatePlayground ] { #category : 'private - hooks' } @@ -78,32 +69,23 @@ GtCoderPlaygroundElement >> onNavigationModelChanged [ { #category : 'private - hooks' } GtCoderPlaygroundElement >> onPackageSelected: anEvent [ - self playPage receiver: anEvent package. - self playPage xDocLoadSavedContent. + self updatePlayground ] { #category : 'private - hooks' } GtCoderPlaygroundElement >> onPackageTagSelected: anEvent [ - self playPage receiver: anEvent tag. - self playPage xDocLoadSavedContent. + self updatePlayground ] { #category : 'private - hooks' } GtCoderPlaygroundElement >> onPackagesSelected: anEvent [ - self playPage receiver: Smalltalk. - self playPage xDocLoadSavedContent. -] - -{ #category : 'private - accessing' } -GtCoderPlaygroundElement >> playPage [ - - ^ playPage + self updatePlayground ] { #category : 'private - accessing' } GtCoderPlaygroundElement >> playPageElement [ - ^ playPageElement + ^ playgroundElement ] { #category : 'private - accessing' } @@ -126,6 +108,5 @@ GtCoderPlaygroundElement >> subscribeToNavigationModel [ { #category : 'private - updating' } GtCoderPlaygroundElement >> updatePlayground [ - self playPage receiver: self receiver. - self playPage xDocLoadSavedContent. + self playPageElement objectHolder: self objectHolder ] From 92b8c72099e2888c0de55cf3d154fa0632e8b371 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 23 Sep 2021 17:12:12 +0200 Subject: [PATCH 0027/1268] [feenkcom/gtoolkit#2135] remove GtInspectorPlaygroundElement --- src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st b/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st index 18158690a..3fb20c1fe 100644 --- a/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st @@ -43,9 +43,8 @@ GtCoderPlaygroundElement >> initializeContentElement [ { #category : 'initialization' } GtCoderPlaygroundElement >> initializePlayPageElement [ playgroundElement := (GtInspector environment - at: GtInspector embeddedPlaygroundName - ifAbsent: [ GtInspectorPlaygroundElement ]) new. - + at: GtInspector embeddedPlaygroundName) new. + playgroundElement collapse. playgroundElement objectHolder: self objectHolder ] From 4d3f48606c8fc33afd0d2d9821088166a9deeff7 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 23 Sep 2021 20:04:54 +0200 Subject: [PATCH 0028/1268] [feenkcom/gtoolkit#2135] move playground evaluated code button attribute to coder --- ...roundEvaluatedCodeButtonAttribute.class.st | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st diff --git a/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st b/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st new file mode 100644 index 000000000..4c456c810 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st @@ -0,0 +1,103 @@ +Class { + #name : 'GtPlaygroundEvaluatedCodeButtonAttribute', + #superclass : 'BrTextAdornmentAttribute', + #instVars : [ + 'result', + 'action', + 'coder' + ], + #category : 'GToolkit-Coder-UI-Coder - Source Attributes' +} + +{ #category : 'accessing' } +GtPlaygroundEvaluatedCodeButtonAttribute >> action [ + ^ action +] + +{ #category : 'accessing' } +GtPlaygroundEvaluatedCodeButtonAttribute >> action: aBlock [ + action := aBlock +] + +{ #category : 'initialization' } +GtPlaygroundEvaluatedCodeButtonAttribute >> affect: aTBrTextEditorTextualPiece in: anEditorElement [ + + | aButton | + + aButton := BrButton new. + + ^ aButton + aptitude: ( + (BrInteractiveCommonAptitude new + default: [ :aWidget | aWidget background: BrGlamorousColors defaultButtonBorderColor ]; + hovered: [ :aWidget | aWidget background: BrGlamorousColors hoveredButtonBorderColor ]) + + + + ((BrGlamorousWithTooltipAptitude2 content: [ + | aContainer | + aContainer := BlElement new + layout: BlFrameLayout new; + constraintsDo: [ :c | + c horizontal fitContent. + c vertical fitContent ]; + when: GtPhlowObjectToSpawn do: [ :anEvent | aButton fireEvent: (GtPhlowObjectToSpawn new + previousSpawnEvent: anEvent; + tool: anEvent tool; + sourceElement: aButton; + spawnDestination: self spawnDestination) ]. + (self result gtViewsFor: GtPhlowEmptyView new) asElementDo: [ :anInspectorElement | + aContainer addChild: ((anInspectorElement exact: 400@400) asScalableElement size: 200@200) + ] ]) showDelay: 200 milliSeconds)); + size: 8@8; + geometry: BlEllipseGeometry new; + margin: (BlInsets left: 2 right: 2); + action: [ :aButtonElement :aButtonModel :anEvent | self clickEvent: anEvent from: aButtonElement ]; + yourself +] + +{ #category : 'event handling' } +GtPlaygroundEvaluatedCodeButtonAttribute >> clickEvent: anEvent from: aButton [ + self action cull: aButton cull: anEvent +] + +{ #category : 'accessing' } +GtPlaygroundEvaluatedCodeButtonAttribute >> coder [ + ^ coder +] + +{ #category : 'accessing' } +GtPlaygroundEvaluatedCodeButtonAttribute >> coder: anObject [ + coder := anObject +] + +{ #category : 'initialization' } +GtPlaygroundEvaluatedCodeButtonAttribute >> initialize [ + super initialize. + self beAppend. + action := [ :aButton :anEvent | + aButton phlow + spawnObject: self result + withDestination: self spawnDestination ] +] + +{ #category : 'testing' } +GtPlaygroundEvaluatedCodeButtonAttribute >> mayHaveExternalReferences [ + ^ true +] + +{ #category : 'accessing' } +GtPlaygroundEvaluatedCodeButtonAttribute >> result [ + ^ result +] + +{ #category : 'accessing' } +GtPlaygroundEvaluatedCodeButtonAttribute >> result: anObject [ + result := anObject +] + +{ #category : 'accessing' } +GtPlaygroundEvaluatedCodeButtonAttribute >> spawnDestination [ + ^ self coder + ifNil: [ GtPhlowSpawnDesiredDestination defaultDestination ] + ifNotNil: [ self coder spawnDestination ] +] From 4783021d1b30aa5c52bd8688c6beba34b5a3f847 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Fri, 24 Sep 2021 09:43:30 +0200 Subject: [PATCH 0029/1268] [feenkcom/gtoolkit#2113] remove obsolete bindings --- .../GtBindingExamples.class.st | 164 ----------------- .../GtBindingStrategy.class.st | 90 --------- .../GtBindingStrategyWithRequestor.class.st | 57 ------ .../GtBindingsTrait.trait.st | 36 ---- .../GtCommandExamples.class.st | 96 ---------- ...ontextHighlightingBindingStrategy.class.st | 29 --- .../GtContextVariablesBindings.class.st | 4 +- .../GtEvaluateSourceCodeCommand.class.st | 112 ----------- .../GtHighlightingBindingStrategy.class.st | 12 -- .../GtLocalSnippetBindings.class.st | 174 ------------------ .../GtNoBindings.class.st | 67 ------- .../GtSnippetBindingStrategy.class.st | 52 ------ .../GtSnippetBindings.class.st | 111 ----------- .../ManifestGToolkitVariableBindings.class.st | 10 - 14 files changed, 3 insertions(+), 1011 deletions(-) delete mode 100644 src/GToolkit-VariableBindings/GtBindingExamples.class.st delete mode 100644 src/GToolkit-VariableBindings/GtBindingStrategy.class.st delete mode 100644 src/GToolkit-VariableBindings/GtBindingStrategyWithRequestor.class.st delete mode 100644 src/GToolkit-VariableBindings/GtBindingsTrait.trait.st delete mode 100644 src/GToolkit-VariableBindings/GtCommandExamples.class.st delete mode 100644 src/GToolkit-VariableBindings/GtContextHighlightingBindingStrategy.class.st delete mode 100644 src/GToolkit-VariableBindings/GtEvaluateSourceCodeCommand.class.st delete mode 100644 src/GToolkit-VariableBindings/GtHighlightingBindingStrategy.class.st delete mode 100644 src/GToolkit-VariableBindings/GtLocalSnippetBindings.class.st delete mode 100644 src/GToolkit-VariableBindings/GtNoBindings.class.st delete mode 100644 src/GToolkit-VariableBindings/GtSnippetBindingStrategy.class.st delete mode 100644 src/GToolkit-VariableBindings/GtSnippetBindings.class.st delete mode 100644 src/GToolkit-VariableBindings/ManifestGToolkitVariableBindings.class.st diff --git a/src/GToolkit-VariableBindings/GtBindingExamples.class.st b/src/GToolkit-VariableBindings/GtBindingExamples.class.st deleted file mode 100644 index 93b0880c5..000000000 --- a/src/GToolkit-VariableBindings/GtBindingExamples.class.st +++ /dev/null @@ -1,164 +0,0 @@ -Class { - #name : 'GtBindingExamples', - #superclass : 'Object', - #category : 'GToolkit-VariableBindings-Examples' -} - -{ #category : 'binding strategy' } -GtBindingExamples >> defaultHighlightingBindingStrategy [ - - - ^ GtHighlightingBindingStrategy new -] - -{ #category : 'binding strategy' } -GtBindingExamples >> defaultSnippetBindingStrategy [ - - - ^ GtSnippetBindingStrategy new -] - -{ #category : 'binding strategy' } -GtBindingExamples >> highlightingBindingStrategy [ - - - ^ self defaultHighlightingBindingStrategy - bindings: self snippetEmptyBindings -] - -{ #category : 'binding strategy' } -GtBindingExamples >> queryDefaultHighlightingBindingStrategy [ - - - | strategy result | - strategy := self defaultHighlightingBindingStrategy. - result := strategy bindingOf: self variableOneName. - self assert: result isNil. - ^ strategy -] - -{ #category : 'binding strategy' } -GtBindingExamples >> queryDefaultSnippetBindingStrategy [ - - - | strategy result | - strategy := self defaultSnippetBindingStrategy. - result := strategy bindingOf: self variableOneName. - self assert: result isNil. - ^ strategy -] - -{ #category : 'bindings - snippet' } -GtBindingExamples >> queryEmptySnippetBindings [ - - - | emptyBindings result | - emptyBindings := self snippetEmptyBindings. - result := emptyBindings - bindingOf: self variableOneName. - self assert: result isNil. - ^ emptyBindings -] - -{ #category : 'binding strategy' } -GtBindingExamples >> queryHighlightingBindingStrategy [ - - - | strategy result | - strategy := self highlightingBindingStrategy. - result := strategy bindingOf: self variableOneName. - self assert: result isNil. - ^ strategy -] - -{ #category : 'binding strategy' } -GtBindingExamples >> querySnippetBindingStrategy [ - - - | strategy result | - strategy := self snippetBindingStrategy. - result := strategy bindingOf: self variableOneName. - self assert: result notNil. - self assert: result key equals: self variableOneName. - self assert: result value equals: nil. - ^ result -] - -{ #category : 'bindings - snippet' } -GtBindingExamples >> querySnippetBindingsWithReceiver [ - - - | bindings result | - bindings := self snippetEmptyBindings. - bindings receiver: self setSnippetBindingsReceiver. - result := bindings bindingOf: #receiver. - self assert: result isNil. - ^ bindings -] - -{ #category : 'bindings - snippet' } -GtBindingExamples >> setSnippetBindings [ - - - | bindings result | - bindings := self snippetEmptyBindings. - bindings at: self variableOneName put: 42. - result := bindings - bindingOf: self variableOneName. - self assert: result notNil. - self assert: result value equals: 42. - self assert: result key equals: self variableOneName. - ^ bindings -] - -{ #category : 'bindings - snippet' } -GtBindingExamples >> setSnippetBindingsReceiver [ - - - | bindings | - bindings := self snippetEmptyBindings. - bindings receiver: 42. - self assert: bindings receiver equals: 42. - self assert: bindings receiverClass equals: 42 class. - ^ bindings -] - -{ #category : 'bindings - snippet' } -GtBindingExamples >> setSnippetBindingsWithReceiver [ - - | bindings result receiver | - bindings := self querySnippetBindingsWithReceiver. - receiver := self setSnippetBindingsReceiver. - bindings receiver: receiver. - bindings at: #receiver put: 42. - result := receiver receiver. - self assert: result notNil. - self assert: result equals: 42. - ^ bindings -] - -{ #category : 'binding strategy' } -GtBindingExamples >> snippetBindingStrategy [ - - - ^ self defaultSnippetBindingStrategy - bindings: self snippetEmptyBindings -] - -{ #category : 'bindings - snippet' } -GtBindingExamples >> snippetEmptyBindings [ - - - | aBindings | - aBindings := GtSnippetBindings new. - self assert: aBindings receiver isNil. - self assert: aBindings asDictionary isEmpty. - ^ aBindings -] - -{ #category : 'accessing' } -GtBindingExamples >> variableOneName [ - - - ^ #variableOne -] diff --git a/src/GToolkit-VariableBindings/GtBindingStrategy.class.st b/src/GToolkit-VariableBindings/GtBindingStrategy.class.st deleted file mode 100644 index 720b7b694..000000000 --- a/src/GToolkit-VariableBindings/GtBindingStrategy.class.st +++ /dev/null @@ -1,90 +0,0 @@ -Class { - #name : 'GtBindingStrategy', - #superclass : 'Object', - #traits : 'TGtAssert', - #classTraits : 'TGtAssert classTrait', - #instVars : [ - 'bindings' - ], - #category : 'GToolkit-VariableBindings-Core' -} - -{ #category : 'asserting' } -GtBindingStrategy class >> assert: aBlock description: aStringOrBlock [ - "Throw an assertion error if aBlock does not evaluates to true. - We check for true explicitly to make the assertion fail for non booleans." - - self isAssertionEnabled - ifTrue: [ (aBlock value == true) ifFalse: [ - AssertionFailure signal: aStringOrBlock value ] ] -] - -{ #category : 'instance creation' } -GtBindingStrategy class >> bindings: aGtBindings [ - ^ self new bindings: aGtBindings -] - -{ #category : 'converting' } -GtBindingStrategy >> asDictionary [ - ^ self bindings asDictionary -] - -{ #category : 'binding' } -GtBindingStrategy >> bindingOf: aSymbol [ - - | assocOrNil | - - self - assert: [ aSymbol isSymbol ] - description: [ 'Bindings should be referenced by a symbol' ]. - - self - forPharo8: [ ] - forPharo9: [ - (self class environment lookupVar: aSymbol) - ifNotNil: [ :aVariable | ^ aVariable ] ]. - - assocOrNil := bindings bindingOf: aSymbol. - ^ self treatBinding: assocOrNil of: aSymbol. - -] - -{ #category : 'accessing' } -GtBindingStrategy >> bindings [ - ^ bindings -] - -{ #category : 'accessing' } -GtBindingStrategy >> bindings: anObject [ - self assert: [ anObject notNil ] description: [ 'Bindings should be an object' ]. - bindings := anObject -] - -{ #category : 'gt-extension' } -GtBindingStrategy >> gtBindingsFor: aView [ - - ^ (self bindings respondsTo: #gtBindingsFor:) - ifTrue: [ self bindings gtBindingsFor: aView ] - ifFalse: [ aView empty ] -] - -{ #category : 'binding' } -GtBindingStrategy >> hasBindingOf: aSymbol [ - ^ self bindings hasBindingOf: aSymbol -] - -{ #category : 'initialization' } -GtBindingStrategy >> initialize [ - super initialize. - self initializeBindings. -] - -{ #category : 'initialization' } -GtBindingStrategy >> initializeBindings [ - bindings := GtNoBindings uniqueInstance. -] - -{ #category : 'private' } -GtBindingStrategy >> treatBinding: anAssocOrNil of: aSymbol [ - self subclassResponsibility -] diff --git a/src/GToolkit-VariableBindings/GtBindingStrategyWithRequestor.class.st b/src/GToolkit-VariableBindings/GtBindingStrategyWithRequestor.class.st deleted file mode 100644 index dcf877860..000000000 --- a/src/GToolkit-VariableBindings/GtBindingStrategyWithRequestor.class.st +++ /dev/null @@ -1,57 +0,0 @@ -Class { - #name : 'GtBindingStrategyWithRequestor', - #superclass : 'Object', - #instVars : [ - 'requestor', - 'bindingStrategy' - ], - #category : 'GToolkit-VariableBindings-Commands' -} - -{ #category : 'binding' } -GtBindingStrategyWithRequestor >> bindingOf: aSymbol [ - - ^ self bindingStrategy bindingOf: aSymbol -] - -{ #category : 'accessing' } -GtBindingStrategyWithRequestor >> bindingStrategy [ - - ^ bindingStrategy -] - -{ #category : 'accessing' } -GtBindingStrategyWithRequestor >> bindingStrategy: aGtBindingStrategy [ - self - assert: [ aGtBindingStrategy notNil ] - description: [ 'Binding strategy must be non-nil' ]. - bindingStrategy := aGtBindingStrategy -] - -{ #category : 'initialization' } -GtBindingStrategyWithRequestor >> initialize [ - super initialize. - bindingStrategy := GtSnippetBindingStrategy new. - requestor := nil. -] - -{ #category : 'accessing' } -GtBindingStrategyWithRequestor >> requestor [ - ^ requestor -] - -{ #category : 'accessing' } -GtBindingStrategyWithRequestor >> requestor: anObject [ - requestor := anObject -] - -{ #category : 'accessing' } -GtBindingStrategyWithRequestor >> selection [ - - ^ self requestor - ifNotNil: [ :aRequestor | - (aRequestor respondsTo: #selection) - ifTrue: [ aRequestor selection ] - ifFalse: [ '' ] ] - ifNil: [ '' ] -] diff --git a/src/GToolkit-VariableBindings/GtBindingsTrait.trait.st b/src/GToolkit-VariableBindings/GtBindingsTrait.trait.st deleted file mode 100644 index f04b4bab6..000000000 --- a/src/GToolkit-VariableBindings/GtBindingsTrait.trait.st +++ /dev/null @@ -1,36 +0,0 @@ -Trait { - #name : 'GtBindingsTrait', - #category : 'GToolkit-VariableBindings-Core' -} - -{ #category : 'converting' } -GtBindingsTrait >> allNames [ - ^ self asDictionary keys -] - -{ #category : 'converting' } -GtBindingsTrait >> asDictionary [ - - ^ self explicitRequirement -] - -{ #category : 'adding' } -GtBindingsTrait >> at: aSymbol put: anObject [ - "Set bindings for a variable named aSymbol and value anObject." - self explicitRequirement -] - -{ #category : 'accessing' } -GtBindingsTrait >> bindingOf: aSymbol [ - "aSymbol is a variable name. - Return a literal variable if the variable has a value assigned. - Return nil, if the variable has no value assigned." - - ^ self explicitRequirement -] - -{ #category : 'testing' } -GtBindingsTrait >> hasBindingOf: aSymbol [ - - ^ self explicitRequirement -] diff --git a/src/GToolkit-VariableBindings/GtCommandExamples.class.st b/src/GToolkit-VariableBindings/GtCommandExamples.class.st deleted file mode 100644 index 31811f663..000000000 --- a/src/GToolkit-VariableBindings/GtCommandExamples.class.st +++ /dev/null @@ -1,96 +0,0 @@ -Class { - #name : 'GtCommandExamples', - #superclass : 'Object', - #category : 'GToolkit-VariableBindings-Examples' -} - -{ #category : 'code evaluation' } -GtCommandExamples >> evaluateSourceCodeCommand [ - - - | aCommand | - aCommand := GtEvaluateSourceCodeCommand new. - self assert: aCommand sourceCode isString. - self assert: aCommand bindingStrategy notNil. - self assert: aCommand result isNil. - self assert: aCommand receiver isNil. - ^ aCommand -] - -{ #category : 'code evaluation' } -GtCommandExamples >> executeDefaultSourceCode [ - - - | aCommand | - aCommand := self evaluateSourceCodeCommand. - aCommand execute. - self assert: aCommand result isNil. - ^ aCommand -] - -{ #category : 'code evaluation' } -GtCommandExamples >> executeSourceCode [ - - - | aCommand | - aCommand := self evaluateSourceCodeCommand. - aCommand sourceCode: '4 factorial'. - aCommand execute. - self assert: aCommand result equals: 24. - ^ aCommand -] - -{ #category : 'code evaluation' } -GtCommandExamples >> executeSourceCodeWithUndefinedVariable [ - - - | aCommand aWarning | - aCommand := self evaluateSourceCodeCommand. - aCommand sourceCode: 'aValue := 4 factorial'. - [ aCommand execute ] - on: OCUndeclaredVariableWarning - do: [ :theWarning | aWarning := theWarning ]. - self assert: aWarning notNil. - self assert: aWarning class equals: OCUndeclaredVariableWarning. - self assert: aWarning node name equals: #aValue. - self assert: aCommand result isNil. - ^ aCommand -] - -{ #category : 'code evaluation' } -GtCommandExamples >> executeSourceCodeWithUndefinedVariableUsingPlaygroundBindings [ - - - | aCommand | - aCommand := self evaluateSourceCodeCommand. - aCommand sourceCode: 'aValue := 4 factorial'. - aCommand variableBindings: GtSnippetBindings new. - aCommand execute. - self assert: aCommand result equals: 24. - self assert: (aCommand variableBindings bindingOf: #aValue) notNil. - self assert: (aCommand variableBindings bindingOf: #aValue) value equals: 24. - ^ aCommand -] - -{ #category : 'code evaluation' } -GtCommandExamples >> executeUndefinedVariable [ - - - | aCommand aVariable | - aCommand := self evaluateSourceCodeCommand. - aCommand variableBindings: self playgroundBindings. - aCommand sourceCode: 'aValue := 42'. - aCommand execute. - self assert: aCommand result equals: 42. - self assert: aCommand variableBindings notNil. - aVariable := aCommand variableBindings bindingOf: #aValue. - self assert: aVariable notNil. - self assert: aVariable value equals: 42. - ^ aCommand -] - -{ #category : 'code evaluation' } -GtCommandExamples >> playgroundBindings [ - - ^ GtSnippetBindings new -] diff --git a/src/GToolkit-VariableBindings/GtContextHighlightingBindingStrategy.class.st b/src/GToolkit-VariableBindings/GtContextHighlightingBindingStrategy.class.st deleted file mode 100644 index 53ba2769f..000000000 --- a/src/GToolkit-VariableBindings/GtContextHighlightingBindingStrategy.class.st +++ /dev/null @@ -1,29 +0,0 @@ -Class { - #name : 'GtContextHighlightingBindingStrategy', - #superclass : 'GtHighlightingBindingStrategy', - #instVars : [ - 'context' - ], - #category : 'GToolkit-VariableBindings-Core' -} - -{ #category : 'binding' } -GtContextHighlightingBindingStrategy >> bindingOf: aSymbol [ - | value | - (super bindingOf: aSymbol) ifNotNil: [ :aBinding | aBinding ]. - (self hasBindingOf: aSymbol) ifFalse: [ ^ nil ]. - - value := [ (context tempNamed: aSymbol) ] on: Error do: [ nil ]. - ^ WorkspaceVariable key: aSymbol value: value -] - -{ #category : 'accessing' } -GtContextHighlightingBindingStrategy >> context: aContext [ - context := aContext -] - -{ #category : 'binding' } -GtContextHighlightingBindingStrategy >> hasBindingOf: aSymbol [ - ^ (super hasBindingOf: aSymbol) or: [ - context hasTemporaryVariableNamed: aSymbol ] -] diff --git a/src/GToolkit-VariableBindings/GtContextVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtContextVariablesBindings.class.st index 30dd6143e..0512db9ee 100644 --- a/src/GToolkit-VariableBindings/GtContextVariablesBindings.class.st +++ b/src/GToolkit-VariableBindings/GtContextVariablesBindings.class.st @@ -31,7 +31,9 @@ GtContextVariablesBindings >> bindingOf: aSymbol [ Return nil, if the variable has no value assigned." | var | - var := context lookupVar: aSymbol. + var := [ context lookupVar: aSymbol ] + on: Error + do: [ nil ]. var ifNil: [ ^ nil ]. var isLocalVariable diff --git a/src/GToolkit-VariableBindings/GtEvaluateSourceCodeCommand.class.st b/src/GToolkit-VariableBindings/GtEvaluateSourceCodeCommand.class.st deleted file mode 100644 index ed0b09aea..000000000 --- a/src/GToolkit-VariableBindings/GtEvaluateSourceCodeCommand.class.st +++ /dev/null @@ -1,112 +0,0 @@ -Class { - #name : 'GtEvaluateSourceCodeCommand', - #superclass : 'BlTktCommand', - #instVars : [ - 'result', - 'sourceCode', - 'receiver', - 'requestorAndBindings' - ], - #category : 'GToolkit-VariableBindings-Commands' -} - -{ #category : 'accessing' } -GtEvaluateSourceCodeCommand >> bindingStrategy [ - - ^ requestorAndBindings bindingStrategy -] - -{ #category : 'accessing' } -GtEvaluateSourceCodeCommand >> bindingStrategy: aGtBindingStrategy [ - requestorAndBindings bindingStrategy: aGtBindingStrategy -] - -{ #category : 'accessing' } -GtEvaluateSourceCodeCommand >> catchingErrors [ - "Return an error or collections of errors to catch during a command execution" - ^ Error, OCSemanticWarning -] - -{ #category : 'execution' } -GtEvaluateSourceCodeCommand >> execute [ - | aCompiler | - aCompiler := self class compiler - source: self sourceCode "readStream" "Looks like it can be a String instead of readSream"; - context: nil "TODO: what is context? evaluation uses `context method methodClass`"; - receiver: self receiver "TODO: what is receiver? evaluation uses `receiver class` if context is nil"; - requestor: requestorAndBindings. "TODO: requestor should be an editor? - evaluation uses `requestor selection` to evaluate only selected part" - result := aCompiler evaluate. - "evaluation does: - `receiver withArgs: context or #() executeMethod: - parse uses `noPattern`, - if context is not nil, `context tempNames` is used in `rewriteTempsForContext:` - doSemanticAnalysis uses: - `compilationContext failBlock` on an exception - `compilationContext scope newMethodScope to validate source code - `lookupVariableForWrite:` uses `scope lookupVar: aVarNameString" - "parseExpression uses `parserClass` and `optionParseErrors` to parse faulty expressions" - ^ result -] - -{ #category : 'initialization' } -GtEvaluateSourceCodeCommand >> initialize [ - super initialize. - sourceCode := 'nil'. - result := nil. - requestorAndBindings := GtBindingStrategyWithRequestor new. -] - -{ #category : 'accessing' } -GtEvaluateSourceCodeCommand >> receiver [ - ^ receiver -] - -{ #category : 'accessing' } -GtEvaluateSourceCodeCommand >> receiver: anObject [ - receiver := anObject -] - -{ #category : 'accessing' } -GtEvaluateSourceCodeCommand >> requestor [ - ^ requestorAndBindings requestor -] - -{ #category : 'accessing' } -GtEvaluateSourceCodeCommand >> requestor: anObject [ - requestorAndBindings requestor: anObject -] - -{ #category : 'accessing' } -GtEvaluateSourceCodeCommand >> result [ - "Return a source code evaluation result" - ^ result -] - -{ #category : 'accessing' } -GtEvaluateSourceCodeCommand >> sourceCode [ - - ^ sourceCode -] - -{ #category : 'accessing' } -GtEvaluateSourceCodeCommand >> sourceCode: aString [ - self - assert: [ aString notNil ] - description: [ 'Source code must be non-nil' ]. - sourceCode := aString asString -] - -{ #category : 'accessing' } -GtEvaluateSourceCodeCommand >> variableBindings [ - - ^ requestorAndBindings bindingStrategy bindings -] - -{ #category : 'accessing' } -GtEvaluateSourceCodeCommand >> variableBindings: aGtBindingsTrait [ - self - assert: [ aGtBindingsTrait notNil ] - description: [ 'Bindings must be non-nil' ]. - requestorAndBindings bindingStrategy bindings: aGtBindingsTrait -] diff --git a/src/GToolkit-VariableBindings/GtHighlightingBindingStrategy.class.st b/src/GToolkit-VariableBindings/GtHighlightingBindingStrategy.class.st deleted file mode 100644 index 4a84a7f22..000000000 --- a/src/GToolkit-VariableBindings/GtHighlightingBindingStrategy.class.st +++ /dev/null @@ -1,12 +0,0 @@ -Class { - #name : 'GtHighlightingBindingStrategy', - #superclass : 'GtBindingStrategy', - #category : 'GToolkit-VariableBindings-Core' -} - -{ #category : 'private' } -GtHighlightingBindingStrategy >> treatBinding: anAssocOrNil of: aSymbol [ - "Subclasses can treat existing or missing bindings of a variable named aSymbol" - - ^ anAssocOrNil -] diff --git a/src/GToolkit-VariableBindings/GtLocalSnippetBindings.class.st b/src/GToolkit-VariableBindings/GtLocalSnippetBindings.class.st deleted file mode 100644 index c4cf42789..000000000 --- a/src/GToolkit-VariableBindings/GtLocalSnippetBindings.class.st +++ /dev/null @@ -1,174 +0,0 @@ -" -GtLocalSnippetBindings provide a multi-tier set of bindings, allowing snippets to have local variables, e.g. `thisSnippet`, and shared variables. - - -1. # Internal Representation and Key Implementation Points. - - -1. ## Instance Variables - - localBindings: Bindings local to the user of these bindings - sharedBindings: Bindings shared amongst muiltiple users - - -1. ## Implementation Points - - -" -Class { - #name : 'GtLocalSnippetBindings', - #superclass : 'Object', - #traits : 'GtBindingsTrait + TGtAssert', - #classTraits : 'GtBindingsTrait classTrait + TGtAssert classTrait', - #instVars : [ - 'sharedBindings', - 'localBindings' - ], - #category : 'GToolkit-VariableBindings-Core' -} - -{ #category : 'comparing' } -GtLocalSnippetBindings >> = anObject [ - "Answer whether the receiver and anObject represent the same object." - - self == anObject - ifTrue: [ ^ true ]. - self class = anObject class - ifFalse: [ ^ false ]. - ^ sharedBindings = anObject sharedBindings - and: [ localBindings = anObject localBindings ] -] - -{ #category : 'accessing' } -GtLocalSnippetBindings >> allNames [ - - ^ self localNames, self sharedNames -] - -{ #category : 'converting' } -GtLocalSnippetBindings >> asDictionary [ - - | dictionary | - - dictionary := localBindings copy. - dictionary addAll: sharedBindings bindings. - ^ dictionary -] - -{ #category : 'accessing' } -GtLocalSnippetBindings >> at: aSymbol put: anObject [ - "By default, bindings are global" - - ^ localBindings - at: aSymbol - ifPresent: [ localBindings at: aSymbol put: anObject ] - ifAbsent: [ sharedBindings at: aSymbol put: anObject ]. - -] - -{ #category : 'binding' } -GtLocalSnippetBindings >> bindingOf: aSymbol [ - - ^ localBindings - at: aSymbol - ifPresent: [ :aValue | aValue ] - ifAbsent: [ sharedBindings bindingOf: aSymbol ] -] - -{ #category : 'gt-extension' } -GtLocalSnippetBindings >> gtBindingsFor: aView [ - - ^ self asDictionary gtItemsFor: aView -] - -{ #category : 'binding' } -GtLocalSnippetBindings >> hasBindingOf: aSymbol [ - ^ (sharedBindings hasBindingOf: aSymbol) or: [ localBindings includesKey: aSymbol ] -] - -{ #category : 'comparing' } -GtLocalSnippetBindings >> hash [ - "Answer an integer value that is related to the identity of the receiver." - - ^ sharedBindings hash bitXor: localBindings hash -] - -{ #category : 'initialization' } -GtLocalSnippetBindings >> initialize [ - - super initialize. - localBindings := IdentityDictionary new. -] - -{ #category : 'accessing' } -GtLocalSnippetBindings >> localAt: aSymbol put: anObject [ - - self assert: [ aSymbol isSymbol ] description: [ 'Variable name should be a symbol' ]. - localBindings - at: aSymbol - put: ((WorkspaceVariable named: aSymbol) value: anObject) -] - -{ #category : 'accessing' } -GtLocalSnippetBindings >> localBindings [ - ^ localBindings -] - -{ #category : 'accessing' } -GtLocalSnippetBindings >> localBindings: anObject [ - localBindings := anObject -] - -{ #category : 'accessing' } -GtLocalSnippetBindings >> localNames [ - "Answer the names of the local bindings" - - ^ localBindings keys -] - -{ #category : 'copying' } -GtLocalSnippetBindings >> postCopy [ - sharedBindings := sharedBindings copy. - localBindings := localBindings copy -] - -{ #category : 'accessing' } -GtLocalSnippetBindings >> receiver [ - - ^ sharedBindings receiver -] - -{ #category : 'accessing' } -GtLocalSnippetBindings >> receiver: anObject [ - - sharedBindings receiver: anObject -] - -{ #category : 'accessing' } -GtLocalSnippetBindings >> receiverClass [ - ^ sharedBindings receiver class -] - -{ #category : 'removing' } -GtLocalSnippetBindings >> remove: aSymbol [ - self assert: [ aSymbol isSymbol ] description: [ 'Variable name should be a symbol' ]. - localBindings - removeKey: aSymbol - ifAbsent: [ sharedBindings remove: aSymbol ] -] - -{ #category : 'accessing' } -GtLocalSnippetBindings >> sharedBindings [ - ^ sharedBindings -] - -{ #category : 'accessing' } -GtLocalSnippetBindings >> sharedBindings: anObject [ - sharedBindings := anObject -] - -{ #category : 'accessing' } -GtLocalSnippetBindings >> sharedNames [ - - ^ sharedBindings names -] diff --git a/src/GToolkit-VariableBindings/GtNoBindings.class.st b/src/GToolkit-VariableBindings/GtNoBindings.class.st deleted file mode 100644 index 606ce151a..000000000 --- a/src/GToolkit-VariableBindings/GtNoBindings.class.st +++ /dev/null @@ -1,67 +0,0 @@ -Class { - #name : 'GtNoBindings', - #superclass : 'Object', - #traits : 'GtBindingsTrait', - #classTraits : 'GtBindingsTrait classTrait', - #classInstVars : [ - 'uniqueInstance' - ], - #category : 'GToolkit-VariableBindings-Core' -} - -{ #category : 'cleanup' } -GtNoBindings class >> cleanUp [ - self reset. -] - -{ #category : 'accessing' } -GtNoBindings class >> reset [ - uniqueInstance := nil -] - -{ #category : 'accessing' } -GtNoBindings class >> uniqueInstance [ - ^ uniqueInstance ifNil: [ uniqueInstance := self new ] -] - -{ #category : 'comparing' } -GtNoBindings >> = anObject [ - self == anObject ifTrue: [ ^ true ]. - ^ self class = anObject class -] - -{ #category : 'converting' } -GtNoBindings >> asDictionary [ - - ^ Dictionary new -] - -{ #category : 'adding' } -GtNoBindings >> at: aString put: anObject [ - "ignore by default" -] - -{ #category : 'binding' } -GtNoBindings >> bindingOf: aSymbol [ - ^ nil -] - -{ #category : 'binding' } -GtNoBindings >> hasBindingOf: aSymbol [ - ^ false -] - -{ #category : 'comparing' } -GtNoBindings >> hash [ - ^ self class hash -] - -{ #category : 'accessing' } -GtNoBindings >> receiver [ - ^ nil -] - -{ #category : 'accessing' } -GtNoBindings >> receiverClass [ - ^ self receiver class -] diff --git a/src/GToolkit-VariableBindings/GtSnippetBindingStrategy.class.st b/src/GToolkit-VariableBindings/GtSnippetBindingStrategy.class.st deleted file mode 100644 index 30ba2907c..000000000 --- a/src/GToolkit-VariableBindings/GtSnippetBindingStrategy.class.st +++ /dev/null @@ -1,52 +0,0 @@ -Class { - #name : 'GtSnippetBindingStrategy', - #superclass : 'GtBindingStrategy', - #category : 'GToolkit-VariableBindings-Core' -} - -{ #category : 'comparing' } -GtSnippetBindingStrategy >> = anObject [ - "Answer whether the receiver and anObject represent the same object." - - self == anObject ifTrue: [ ^ true ]. - self class = anObject class ifFalse: [ ^ false ]. - ^ bindings = anObject bindings -] - -{ #category : 'binding' } -GtSnippetBindingStrategy >> bindingOf: aSymbol [ - - (self isBindingInReceiverScope: aSymbol) ifTrue: [ - ^ nil ]. - ^ super bindingOf: aSymbol - -] - -{ #category : 'comparing' } -GtSnippetBindingStrategy >> hash [ - "Answer an integer value that is related to the identity of the receiver." - - ^ bindings hash -] - -{ #category : 'testing' } -GtSnippetBindingStrategy >> isBindingInReceiverScope: aSymbol [ - "If the requested binding is an instance variable of the receiver then return nil - and allow the instance scope to return the binding. This needs to happen as currenty - the following scopes are searched: OCMethodScope -> OCRequestorScope -> OCInstanceScope. - If the requestor scope returns a variable that is present in the instance scope the value - of that variable will be read/written from the binding and not from the instance." - | receiverClass | - receiverClass := bindings receiver class. - ^ receiverClass allInstVarNames includes: aSymbol - -] - -{ #category : 'private' } -GtSnippetBindingStrategy >> treatBinding: anAssocOrNil of: aSymbol [ - "Subclasses can treat existing or missing bindings of a variable named aSymbol" - - ^ anAssocOrNil ifNil: [ - bindings at: aSymbol put: nil. - bindings bindingOf: aSymbol ] -] diff --git a/src/GToolkit-VariableBindings/GtSnippetBindings.class.st b/src/GToolkit-VariableBindings/GtSnippetBindings.class.st deleted file mode 100644 index bf7ef9c77..000000000 --- a/src/GToolkit-VariableBindings/GtSnippetBindings.class.st +++ /dev/null @@ -1,111 +0,0 @@ -Class { - #name : 'GtSnippetBindings', - #superclass : 'Object', - #traits : 'GtBindingsTrait + TGtAssert', - #classTraits : 'GtBindingsTrait classTrait + TGtAssert classTrait', - #instVars : [ - 'bindings', - 'receiver' - ], - #category : 'GToolkit-VariableBindings-Core' -} - -{ #category : 'comparing' } -GtSnippetBindings >> = anObject [ - "Answer whether the receiver and anObject represent the same object." - - self == anObject ifTrue: [ ^ true ]. - self class = anObject class ifFalse: [ ^ false ]. - ^ receiver = anObject receiver and: [ bindings = anObject bindings ] -] - -{ #category : 'converting' } -GtSnippetBindings >> asDictionary [ - - | aDictionary | - - "bindings copy is not enough, because each value is a workspace variable which - is in fact an association of ket -> value. When converting to the dictionary we should - flatten the associations" - aDictionary := Dictionary new. - bindings keysAndValuesDo: [ :eachKey :eachWorkSpaceVariable | - aDictionary at: eachKey put: eachWorkSpaceVariable value ]. - - ^ aDictionary -] - -{ #category : 'adding' } -GtSnippetBindings >> at: aSymbol put: anObject [ - self assert: [ aSymbol isSymbol ] description: [ 'Variable name should be a symbol' ]. - - bindings - at: aSymbol - put: ((WorkspaceVariable named: aSymbol) value: anObject) -] - -{ #category : 'binding' } -GtSnippetBindings >> bindingOf: aSymbol [ - ^ bindings - at: aSymbol - ifPresent: [ :aValue | aValue ] - ifAbsent: [ nil ] -] - -{ #category : 'accessing' } -GtSnippetBindings >> bindings [ - ^ bindings -] - -{ #category : 'gt-extension' } -GtSnippetBindings >> gtBindingsFor: aView [ - - ^ bindings gtItemsFor: aView -] - -{ #category : 'binding' } -GtSnippetBindings >> hasBindingOf: aSymbol [ - ^ bindings includesKey: aSymbol -] - -{ #category : 'comparing' } -GtSnippetBindings >> hash [ - "Answer an integer value that is related to the identity of the receiver." - - ^ receiver hash bitXor: bindings hash -] - -{ #category : 'initialization' } -GtSnippetBindings >> initialize [ - super initialize. - bindings := Dictionary new. - receiver := nil. -] - -{ #category : 'accessing' } -GtSnippetBindings >> names [ - - ^ bindings keys -] - -{ #category : 'accessing' } -GtSnippetBindings >> receiver [ - ^ receiver -] - -{ #category : 'accessing' } -GtSnippetBindings >> receiver: anObject [ - receiver := anObject -] - -{ #category : 'accessing' } -GtSnippetBindings >> receiverClass [ - ^ self receiver class -] - -{ #category : 'removing' } -GtSnippetBindings >> remove: aSymbol [ - self assert: [ aSymbol isSymbol ] description: [ 'Variable name should be a symbol' ]. - bindings - removeKey: aSymbol - ifAbsent: [ "ignore" ] -] diff --git a/src/GToolkit-VariableBindings/ManifestGToolkitVariableBindings.class.st b/src/GToolkit-VariableBindings/ManifestGToolkitVariableBindings.class.st deleted file mode 100644 index f45df364a..000000000 --- a/src/GToolkit-VariableBindings/ManifestGToolkitVariableBindings.class.st +++ /dev/null @@ -1,10 +0,0 @@ -" -I store metadata for this package. These meta data are used by other tools such as the SmalllintManifestChecker and the critics Browser - - -" -Class { - #name : 'ManifestGToolkitVariableBindings', - #superclass : 'PackageManifest', - #category : 'GToolkit-VariableBindings-Manifest' -} From cee00553c2b92a6b03f0336d0388a9618742567c Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Fri, 24 Sep 2021 10:17:13 +0200 Subject: [PATCH 0030/1268] fix GtSlotVariablesBindings >> #bindingNames --- src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st index 153aecf09..1f4122ee4 100644 --- a/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st +++ b/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st @@ -21,7 +21,7 @@ GtSlotVariablesBindings >> = anObject [ { #category : 'binding' } GtSlotVariablesBindings >> bindingNames [ - ^ object gtSlotNames + ^ object class gtSlotNames ] { #category : 'binding' } From 88e4baba816f9a31a3e90a184a4b225f2536cd5c Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Fri, 24 Sep 2021 13:10:56 +0200 Subject: [PATCH 0031/1268] add bindingValueOf: --- .../GtCompositeVariablesBindings.class.st | 13 +++++++++++++ .../GtSlotVariablesBindings.class.st | 9 +++++++++ .../TGtVariablesBindings.trait.st | 10 ++++++++++ 3 files changed, 32 insertions(+) diff --git a/src/GToolkit-VariableBindings/GtCompositeVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtCompositeVariablesBindings.class.st index 77c30554b..c8514e634 100644 --- a/src/GToolkit-VariableBindings/GtCompositeVariablesBindings.class.st +++ b/src/GToolkit-VariableBindings/GtCompositeVariablesBindings.class.st @@ -43,6 +43,19 @@ GtCompositeVariablesBindings >> bindingOf: aSymbol [ ^ nil ] +{ #category : 'binding' } +GtCompositeVariablesBindings >> bindingValueOf: aSymbol [ + "aSymbol is a variable name. + Return a value of the variable." + + + bindings do: [ :eachVariableBindings | + (eachVariableBindings bindingValueOf: aSymbol) + ifNotNil: [ :aVariable | ^ aVariable ] ]. + + ^ nil +] + { #category : 'accessing' } GtCompositeVariablesBindings >> bindings [ diff --git a/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st index 1f4122ee4..dad7919ee 100644 --- a/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st +++ b/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st @@ -37,6 +37,15 @@ GtSlotVariablesBindings >> bindingOf: aSymbol [ ifNone: [ nil ] ] +{ #category : 'binding' } +GtSlotVariablesBindings >> bindingValueOf: aSymbol [ + "aSymbol is a variable name. + Return a value of the variable." + + + ^ (self bindingOf: aSymbol) ifNotNil: [ :aSlot | aSlot read: self object ] +] + { #category : 'testing' } GtSlotVariablesBindings >> hasBindingOf: aSymbol [ diff --git a/src/GToolkit-VariableBindings/TGtVariablesBindings.trait.st b/src/GToolkit-VariableBindings/TGtVariablesBindings.trait.st index 9b1b090e7..899bed92f 100644 --- a/src/GToolkit-VariableBindings/TGtVariablesBindings.trait.st +++ b/src/GToolkit-VariableBindings/TGtVariablesBindings.trait.st @@ -29,6 +29,16 @@ TGtVariablesBindings >> bindingOf: aSymbol [ ^ self explicitRequirement ] +{ #category : 'binding' } +TGtVariablesBindings >> bindingValueOf: aSymbol [ + "aSymbol is a variable name. + Return a value of the variable." + + + ^ (self bindingOf: aSymbol) + ifNotNil: [ :aBinding | aBinding value ] +] + { #category : 'testing' } TGtVariablesBindings >> hasBindingOf: aSymbol [ From f801adca9c3645c2df0f5a106685c4275af324bb Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Fri, 24 Sep 2021 16:38:44 +0200 Subject: [PATCH 0032/1268] [feenkcom/gtoolkit#1989] include class variables in the slot variables bindings --- .../GtSlotVariablesBindings.class.st | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st index dad7919ee..d13b22ae7 100644 --- a/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st +++ b/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st @@ -21,7 +21,7 @@ GtSlotVariablesBindings >> = anObject [ { #category : 'binding' } GtSlotVariablesBindings >> bindingNames [ - ^ object class gtSlotNames + ^ object class gtSlotNames, object class classVarNames ] { #category : 'binding' } @@ -34,7 +34,10 @@ GtSlotVariablesBindings >> bindingOf: aSymbol [ ^ object class gtSlotNamed: aSymbol ifFound: [ :aSlot | aSlot ] - ifNone: [ nil ] + ifNone: [ + object class + classVariableNamed: aSymbol + ifAbsent: [ nil ] ] ] { #category : 'binding' } @@ -53,7 +56,7 @@ GtSlotVariablesBindings >> hasBindingOf: aSymbol [ ^ object class gtSlotNamed: aSymbol ifFound: [ :slot | true ] - ifNone: [ false ] + ifNone: [ object class hasClassVarNamed: aSymbol ] ] { #category : 'comparing' } From 04b736da711f4eb6a6fe698fcf4279a7bd1d9b2b Mon Sep 17 00:00:00 2001 From: Andrei Chis Date: Wed, 29 Sep 2021 15:40:33 +0200 Subject: [PATCH 0033/1268] Fix missing class reference in comments --- src/GToolkit-Coder/GtCoderModel.class.st | 2 +- src/GToolkit-Coder/GtCoderPackageUpdatedAnnouncement.class.st | 2 +- src/GToolkit-Coder/GtMethodsCoderExampler.class.st | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder/GtCoderModel.class.st b/src/GToolkit-Coder/GtCoderModel.class.st index 707068d5f..19c350b8c 100644 --- a/src/GToolkit-Coder/GtCoderModel.class.st +++ b/src/GToolkit-Coder/GtCoderModel.class.st @@ -5,7 +5,7 @@ Is an abstract model of a moldable Coder - a tool for creating and manipulating As a root entity in the hierarchy of coders {{gtClass:GtCoderModel}} do not make any assumptions on the way code is represented. In fact in contrast to {{gtClass:GtSourceCoder}} , it does not know anything about code. 1. # Moldability -Coder is designed to be easily adapted by the users in order to be used in various contexts through so called `add-ons` {{gtClass:GtCoderAddOns}}. Its subclasses can override {{gtMethod:GtCoderModel>>#addOnsClass}} to allow coder to have extra kinds of addons or {{gtMethod:GtCoderModel>>#initializeAddOns}} to customize the default add-ons. +Coder is designed to be easily adapted by the users in order to be used in various contexts through so called `add-ons` {{gtClass:GtCoderAddOns}}. Its subclasses can override {{gtMethod:GtCoderModel>>#addOnsClass}} to allow coder to have extra kinds of addons or {{gtMethod:GtCoderModel>>#initializeAddOns:}} to customize the default add-ons. 1. # Add-ons By default there are the following types of add-ons: diff --git a/src/GToolkit-Coder/GtCoderPackageUpdatedAnnouncement.class.st b/src/GToolkit-Coder/GtCoderPackageUpdatedAnnouncement.class.st index 0b59cac93..87222837a 100644 --- a/src/GToolkit-Coder/GtCoderPackageUpdatedAnnouncement.class.st +++ b/src/GToolkit-Coder/GtCoderPackageUpdatedAnnouncement.class.st @@ -1,5 +1,5 @@ " -I am sent by the {{gtClass:GtBehaviorCoder}} when the current package changes (means class is not selected and we have to remove the content from the class coder) +I am sent by the {{gtClass:GtPharoBehaviorCoder}} when the current package changes (means class is not selected and we have to remove the content from the class coder) " diff --git a/src/GToolkit-Coder/GtMethodsCoderExampler.class.st b/src/GToolkit-Coder/GtMethodsCoderExampler.class.st index bbc4760a7..11b53de01 100644 --- a/src/GToolkit-Coder/GtMethodsCoderExampler.class.st +++ b/src/GToolkit-Coder/GtMethodsCoderExampler.class.st @@ -1,6 +1,6 @@ " I am an example executor. -I am used by {{gtClass:GtMethodsCoder}}, see: {{gtMethod:Behavior>>#gtCoderMethodsFor:context:}} for a usage. +I am used by {{gtClass:GtPharoMethodsCoder}}, see: {{gtMethod:Behavior>>#gtCoderMethodsFor:context:}} for a usage. " From 2b59bb86a66164111420a9ac7cd658b8ea41d1c8 Mon Sep 17 00:00:00 2001 From: Andrei Chis Date: Wed, 29 Sep 2021 16:00:37 +0200 Subject: [PATCH 0034/1268] Fix missing references in class comments --- src/GToolkit-Coder-UI/GtFilterDescriptor.class.st | 2 +- .../GtFilterRunExampleButtonAptitude.class.st | 4 ++-- .../GtFilterRunExampleButtonFourStateIconAptitude.class.st | 2 +- .../GtFilterRunExampleButtonIconAptitude.class.st | 2 +- src/GToolkit-Coder-UI/GtFiltersElement.class.st | 2 +- .../GtSourceCoderCollapsedTextAndExampleAptitude.class.st | 6 +++--- src/GToolkit-Coder/GtCoderExampleExecuted.class.st | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st b/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st index 00c9aebf4..a3c17cb3a 100644 --- a/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st +++ b/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st @@ -2,7 +2,7 @@ I describe how a {{gtClass:GtSearchMethodsFilter}} should look and behave in a UI. I am used to build {{gtClass:GtFilterTagElement}} instances inside of {{gtClass:GtFiltersElement}}. For more details: -- {{gtMethod:GtMethodsCoderElement>>#buildFilter}} is a code that inittialize {{gtClass:GtFiltersElement}} using instances of myself, +- {{gtMethod:GtPharoMethodsCoderElement>>#buildFilter}} is a code that inittialize {{gtClass:GtFiltersElement}} using instances of myself, - {{gtMethod:GtSearchMethodsFilter class>>#filterDescriptorFor:|show=#gtImplementorsFor:}} displays a list of various definitions of myself. See {{gtClass:GtFiltersElement}} for an example. diff --git a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonAptitude.class.st b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonAptitude.class.st index 89221deaf..2f5b11cdf 100644 --- a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonAptitude.class.st @@ -1,8 +1,8 @@ " I am an abstract class. I am a {{gtClass:BrLook}}. -I provide common behavior to update a {{gtClass:BrButton}} visual apperance based on {{gtClass:GtMethodsCoder}} and {{gtClass:GtExampleWithResult}} changes. See my {{gtMethod:GtFilterRunExampleButtonLook>>#subscribeToCoder|label=subscriptions}} for more details. -Look at my {{gtClass:GtFilterRunExampleButtonLook|show=#gtSubclassesFor:|expanded=true|height=150}} for more details and examples: +I provide common behavior to update a {{gtClass:BrButton}} visual apperance based on {{gtClass:GtPharoMethodsCoder}} and {{gtClass:GtExampleWithResult}} changes. See my {{gtMethod:GtFilterRunExampleButtonAptitude>>#subscribeToCoder|label=subscriptions}} for more details. +Look at my {{gtClass:GtFilterRunExampleButtonAptitude|show=#gtSubclassesFor:|expanded=true|height=150}} for more details and examples: " diff --git a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonFourStateIconAptitude.class.st b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonFourStateIconAptitude.class.st index 26908ef51..8cfe86170 100644 --- a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonFourStateIconAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonFourStateIconAptitude.class.st @@ -1,5 +1,5 @@ " -I am a {{gtClass:GtFilterRunExampleButtonIconLook}}. +I am a {{gtClass:GtFilterRunExampleButtonIconAptitude}}. I display a colored icon that represents an {{gtClass:GtExampleWithResult}} execution and result state. If there are examples with different execution states, I display several colors. 1. # Examples diff --git a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonIconAptitude.class.st b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonIconAptitude.class.st index d6c8a78da..ac123fea3 100644 --- a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonIconAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonIconAptitude.class.st @@ -1,5 +1,5 @@ " -I am a {{gtClass:GtFilterRunExampleButtonLook}}. +I am a {{gtClass:GtFilterRunExampleButtonAptitude}}. I display a colored icon that represent an {{gtClass:GtExampleWithResult}} execution and result state. 1. # Examples diff --git a/src/GToolkit-Coder-UI/GtFiltersElement.class.st b/src/GToolkit-Coder-UI/GtFiltersElement.class.st index 296d67277..d08ea6325 100644 --- a/src/GToolkit-Coder-UI/GtFiltersElement.class.st +++ b/src/GToolkit-Coder-UI/GtFiltersElement.class.st @@ -1,6 +1,6 @@ " I am a {{gtClass:BlElement}}. -I build a filter in {{gtClass:GtCoderElement}}, see {{gtMethod:GtMethodsCoderElement>>#buildFilter|label=#selector}}. +I build a filter in {{gtClass:GtCoderElement}}, see {{gtMethod:GtPharoMethodsCoderElement>>#buildFilter|label=#selector}}. 1. # Element Example The following example shows how I look like: {{gtExample:GtFiltersElementExamples>>#filtersElement|codeExpanded=false|previewExpanded=true|previewShow=#gtLiveFor:|previewHeight=70}} diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAndExampleAptitude.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAndExampleAptitude.class.st index 440c6fe71..3e5af1e1f 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAndExampleAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAndExampleAptitude.class.st @@ -1,9 +1,9 @@ " I am a {{gtClass:BrLook}}. -I am a {{gtClass:GtSourceCoderLook}}. +I am a {{gtClass:GtSourceCoderAptitude}}. I attach two labels: -1. a {{gtMethod:GtSourceCoderCollapsedTextAndExampleLook>>#methodLabel|label=method name}}, and -2. example {{gtMethod:GtSourceCoderCollapsedTextAndExampleLook>>#exampleElement|label=execution state}}. +1. a {{gtMethod:GtSourceCoderCollapsedTextAndExampleAptitude>>#methodLabel|label=method name}}, and +2. example {{gtMethod:GtSourceCoderCollapsedTextAndExampleAptitude>>#exampleElement|label=execution state}}. 1. # Examples If a method is an example, I display the method name and example result: {{gtExample:GtCoderCollapsedContentElementExamples>>#textAndExampleLook_withExampleMethod|codeExpanded=false|previewExpanded=true|previewHeight=150}} diff --git a/src/GToolkit-Coder/GtCoderExampleExecuted.class.st b/src/GToolkit-Coder/GtCoderExampleExecuted.class.st index 911714b0e..19149fcfc 100644 --- a/src/GToolkit-Coder/GtCoderExampleExecuted.class.st +++ b/src/GToolkit-Coder/GtCoderExampleExecuted.class.st @@ -1,6 +1,6 @@ " I am announced when a Coder example is executed. -I am used by {{gtClass:GtMethodCoder}}, see {{gtMethod:GtMethodCoder>>#handleExampleExecuted:|expanded}}. +I am used by {{gtClass:GtPharoMethodCoder}}, see {{gtMethod:GtPharoMethodCoder>>#handleExampleExecuted:|expanded}}. " From c4a4f1c7dd10fab1126410c2152581d47e889c80 Mon Sep 17 00:00:00 2001 From: Andrei Chis Date: Wed, 29 Sep 2021 16:20:15 +0200 Subject: [PATCH 0035/1268] FIx class comment of GtCoderContentElement --- src/GToolkit-Coder-UI/GtCoderContentElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderContentElement.class.st b/src/GToolkit-Coder-UI/GtCoderContentElement.class.st index 8a6fade80..80597961f 100644 --- a/src/GToolkit-Coder-UI/GtCoderContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderContentElement.class.st @@ -1,5 +1,5 @@ " -I display a {{gtClass:GtBehaviorCoder}}, {{gtClass:GtPackageTagCoder}}, {{gtClass:GtPackageCoder}}, and {{gtClass:GtCodersModel}} coders. +I display a {{gtClass:GtPharoBehaviorCoder}}, {{gtClass:GtPharoPackageTagCoder}}, {{gtClass:GtPackageCoder}}, and {{gtClass:GtCodersModel}} coders. 1. # Example {{gtExample:GtCoderElementExamples>>#contentElementWithClass|previewExpanded|codeExpanded=false|previewHeight=700}} From 0e0491b499231a8705843388c0a556c9fe9d21eb Mon Sep 17 00:00:00 2001 From: John Brant Date: Wed, 6 Oct 2021 17:36:19 -0500 Subject: [PATCH 0036/1268] add ability to convert snippet to example method --- ...orCoderBehaviorNameApplyPreviewId.class.st | 6 +- .../GtBehaviorCoderBehaviorNameId.class.st | 6 +- .../GtBehaviorDefinitionCoderUIModel.class.st | 6 +- .../GtCategoryToggleAptitude.class.st | 6 +- .../GtClassBreadcrumbToggleAptitude.class.st | 6 +- .../GtClassCardElement.class.st | 6 +- .../GtClassCoderTool.class.st | 16 +- .../GtClassesCoderUIModel.class.st | 6 +- .../GtClassesElement.class.st | 12 +- ...deDefinitionCompositeEntityViewer.class.st | 20 +-- .../GtCodeDefinitionEntityViewer.class.st | 32 ++-- ...tCodeDefinitionNestedEntityViewer.class.st | 14 +- .../GtCodeDefinitionPluralEditor.class.st | 18 +- .../GtCodeDefinitionPluralReader.class.st | 6 +- .../GtCodeDefinitionPluralViewer.class.st | 20 +-- ...CodeDefinitionSectionLabelStencil.class.st | 10 +- .../GtCodeDefinitionSingleEditor.class.st | 16 +- .../GtCodeDefinitionSingleReader.class.st | 6 +- .../GtCodeDefinitionSingleViewer.class.st | 12 +- .../GtCodeDefinitionViewer.class.st | 20 +-- src/GToolkit-Coder-UI/GtCoder.class.st | 38 ++--- src/GToolkit-Coder-UI/GtCoder2.class.st | 32 ++-- .../GtCoderAction.extension.st | 4 +- .../GtCoderActionsElement.class.st | 42 ++--- .../GtCoderActivatableAction.extension.st | 4 +- .../GtCoderCardElement.class.st | 18 +- .../GtCoderCodeExecutor.class.st | 38 ++--- .../GtCoderContentElement.class.st | 16 +- .../GtCoderContextMenuContent.class.st | 14 +- .../GtCoderDropDownAction.extension.st | 4 +- ...oderDropDownWithPreviewAction.extension.st | 4 +- src/GToolkit-Coder-UI/GtCoderElement.class.st | 6 +- .../GtCoderElementId.class.st | 6 +- .../GtCoderExampleStateElement.class.st | 62 +++---- .../GtCoderExecutionContextVariable.class.st | 12 +- .../GtCoderExpanderAptitude.class.st | 6 +- .../GtCoderExpanderShadowAptitude.class.st | 6 +- ...oderExpanderWithoutShadowAptitude.class.st | 46 ++--- .../GtCoderFilterList.class.st | 10 +- .../GtCoderFilterListItem.class.st | 18 +- .../GtCoderFilterListItemElement.class.st | 14 +- .../GtCoderModel.extension.st | 18 +- ...derNavigationClassHierachyElement.class.st | 30 ++-- ...gationClassesHierarchyTreeElement.class.st | 18 +- ...CoderNavigationClassesListElement.class.st | 14 +- .../GtCoderNavigationElement.class.st | 68 ++++---- ...vigationMethodProtocolListElement.class.st | 16 +- .../GtCoderNavigationModelElement.class.st | 30 ++-- ...igationPackagesTagsClassesElement.class.st | 96 +++++------ ...oderNavigationPackagesTreeElement.class.st | 24 +-- .../GtCoderNavigationTabsStencil.class.st | 26 +-- .../GtCoderPlaygroundElement.class.st | 32 ++-- .../GtCoderPrintStringAttribute.class.st | 34 ++-- .../GtCoderSpotterStart.class.st | 22 +-- .../GtCoderToReplace.class.st | 8 +- src/GToolkit-Coder-UI/GtCoderToSpawn.class.st | 8 +- .../GtCoderToSpawnInSpace.class.st | 4 +- .../GtCoderToggleAptitude.class.st | 10 +- src/GToolkit-Coder-UI/GtCoderTool.class.st | 14 +- .../GtCoderToolViewModel.class.st | 22 +-- .../GtCoderToolViewModelCoderPopped.class.st | 4 +- .../GtCoderToolViewModelCoderPushed.class.st | 4 +- ...derToolViewModelCoderStackChanged.class.st | 8 +- .../GtCoderToolbarElement.class.st | 28 ++-- .../GtCodersModel.extension.st | 6 +- .../GtContextCoderVariableAptitude.class.st | 14 +- .../GtCreateElement.class.st | 12 +- src/GToolkit-Coder-UI/GtDiffAptitude.class.st | 6 +- src/GToolkit-Coder-UI/GtDiffElement.class.st | 66 ++++---- .../GtDiffElementId.class.st | 6 +- .../GtDiffFlatAptitude.class.st | 8 +- .../GtDiffNewTextId.class.st | 6 +- .../GtDiffOldTextId.class.st | 6 +- .../GtDiffSeparatorId.class.st | 6 +- .../GtDiffShadowAptitude.class.st | 12 +- .../GtExpandableSourceCoderElement.class.st | 40 ++--- .../GtExpandedOnlyCoderElement.class.st | 22 +-- .../GtFilterDescriptor.class.st | 44 ++--- .../GtFilterRunExampleButtonAptitude.class.st | 50 +++--- ...xampleButtonFourStateIconAptitude.class.st | 34 ++-- ...ilterRunExampleButtonIconAptitude.class.st | 26 +-- ...erRunExampleButtonTooltipAptitude.class.st | 16 +- .../GtFilterTagElement.class.st | 38 ++--- .../GtFiltersChangedEvent.class.st | 8 +- .../GtFiltersElement.class.st | 26 +-- ...tMethodCoderContextPCRangeChanged.class.st | 8 +- ...GtMethodCoderDebugExampleActionId.class.st | 6 +- ...MethodCoderDiscardChangesActionId.class.st | 6 +- ...derExtractMethodContextMenuItemId.class.st | 6 +- ...oderPlayAndInspectExampleActionId.class.st | 6 +- .../GtMethodCoderPlayExampleActionId.class.st | 6 +- .../GtMethodCoderSaveAbilityChanged.class.st | 4 +- .../GtMethodCoderSaveActionId.class.st | 6 +- .../GtMethodCoderSaveDisabled.class.st | 10 +- .../GtMethodCoderSaveEnabled.class.st | 6 +- .../GtMethodCoderTool.class.st | 14 +- .../GtMultipleCodersViewModel.class.st | 28 ++-- .../GtPackageCardElement.class.st | 8 +- .../GtPackageCoderPackageNameId.class.st | 6 +- .../GtPackageCoderTool.class.st | 14 +- .../GtPackageCoderViewModel.class.st | 4 +- .../GtPackageTagCardElement.class.st | 6 +- .../GtPackagesCoderElement.class.st | 16 +- .../GtPackagesCoderUIModel.class.st | 6 +- ...roundEvaluatedCodeButtonAttribute.class.st | 26 +-- .../GtPreviewChangeButton.class.st | 16 +- ...tRBAddPoolVariableRefactoring.extension.st | 4 +- .../GtRBAddTraitUsageRefactoring.extension.st | 4 +- ...RBChangeSuperclassRefactoring.extension.st | 4 +- ...RemovePoolVariableRefactoring.extension.st | 4 +- ...RBRemoveTraitUsageRefactoring.extension.st | 4 +- .../GtReadyCoderTool.class.st | 20 +-- .../GtRefactoringsPreviewAcceptId.class.st | 6 +- .../GtSingleCoderViewModel.class.st | 38 ++--- .../GtSourceCoderAptitude.class.st | 14 +- .../GtSourceCoderBreadcrumbAction.class.st | 10 +- ...oderBreadcrumbSpawnBehaviorAction.class.st | 16 +- ...CoderBreadcrumbSpawnPackageAction.class.st | 14 +- ...SourceCoderBrowseBehaviorShortcut.class.st | 12 +- ...ceCoderBrowseImplementorsShortcut.class.st | 12 +- ...urceCoderBrowseReferencesShortcut.class.st | 12 +- ...ourceCoderCollapsedContentElement.class.st | 4 +- ...erCollapsedTextAndExampleAptitude.class.st | 36 ++-- ...tSourceCoderCollapsedTextAptitude.class.st | 16 +- .../GtSourceCoderCollapsedTextId.class.st | 6 +- .../GtSourceCoderContentCoderChanged.class.st | 8 +- .../GtSourceCoderContentCoderRequest.class.st | 6 +- .../GtSourceCoderContentElement.class.st | 16 +- .../GtSourceCoderContentModel.class.st | 12 +- .../GtSourceCoderDebugActionId.class.st | 6 +- ...SourceCoderDiscardChangesShortcut.class.st | 12 +- .../GtSourceCoderDoItActionId.class.st | 6 +- .../GtSourceCoderDoItAndGoActionId.class.st | 6 +- ...SourceCoderDoItAndInspectShortcut.class.st | 12 +- .../GtSourceCoderDoItShortcut.class.st | 12 +- .../GtSourceCoderEditorAptitude.class.st | 14 +- .../GtSourceCoderEditorElement.class.st | 6 +- .../GtSourceCoderEditorId.class.st | 6 +- ...urceCoderEmbeddedExpanderToggleId.class.st | 6 +- .../GtSourceCoderErrorAttribute.class.st | 10 +- ...tSourceCoderEvaluationHighlighter.class.st | 6 +- .../GtSourceCoderEvaluationPrinter.class.st | 6 +- ...rceCoderEvaluationResultDisplayer.class.st | 30 ++-- ...SourceCoderExpandedContentElement.class.st | 4 +- .../GtSourceCoderExpanderToggleId.class.st | 6 +- ...tSourceCoderExtractMethodShortcut.class.st | 12 +- ...erExtractTempVarContextMenuItemId.class.st | 6 +- .../GtSourceCoderFocusChanged.class.st | 12 +- .../GtSourceCoderFormatShortcut.class.st | 12 +- ...SourceCoderPlayAndInspectShortcut.class.st | 12 +- .../GtSourceCoderPlayShortcut.class.st | 12 +- .../GtSourceCoderPrintItShortcut.class.st | 12 +- .../GtSourceCoderProfileActionId.class.st | 6 +- .../GtSourceCoderSaveShortcut.class.st | 12 +- .../GtSourceCoderShortcut.class.st | 16 +- ...urceCoderSpawnDestinationAptitude.class.st | 14 +- .../GtSourceCoderViewModel.class.st | 46 ++--- .../GtSyncScrollRange.class.st | 36 ++-- .../GtSyncScrollRanges.class.st | 30 ++-- .../GtTextCoder.extension.st | 4 +- .../GtTextualCoder.extension.st | 4 +- ...TextualCoderCopyContextMenuItemId.class.st | 6 +- ...tTextualCoderCutContextMenuItemId.class.st | 6 +- .../GtTextualCoderEditorElement.class.st | 80 ++++----- ...extualCoderPasteContextMenuItemId.class.st | 6 +- .../GtTextualCoderTextAttributes.class.st | 18 +- .../GtTextualCoderViewModel.class.st | 157 +++++++++--------- ...extualCoderViewModelAddOnsChanged.class.st | 8 +- ...TextualCoderViewModelAnnouncement.class.st | 4 +- ...GtTextualCoderViewModelAstChanged.class.st | 8 +- ...derViewModelContextActionsChanged.class.st | 4 +- ...iewModelContextMenuActionsChanged.class.st | 4 +- ...xtualCoderViewModelCursorsChanged.class.st | 12 +- ...ualCoderViewModelExpansionChanged.class.st | 8 +- ...lCoderViewModelMainActionsChanged.class.st | 4 +- ...xtualCoderViewModelReadyToRestyle.class.st | 4 +- ...ualCoderViewModelSelectionChanged.class.st | 12 +- ...ualCoderViewModelShortcutsChanged.class.st | 4 +- ...alCoderViewModelStyledTextChanged.class.st | 8 +- ...xtualCoderViewModelStylersChanged.class.st | 4 +- ...CoderViewModelTextAttributesAdded.class.st | 16 +- ...derViewModelTextAttributesRemoved.class.st | 8 +- ...tTextualCoderViewModelTextChanged.class.st | 16 +- ...RBAddClassVariableRefactoring.extension.st | 4 +- ...ddInstanceVariableRefactoring.extension.st | 4 +- .../RBRefactoring.extension.st | 4 +- ...emoveClassVariableRefactoring.extension.st | 4 +- ...veInstanceVariableRefactoring.extension.st | 4 +- .../RBRenameClassRefactoring.extension.st | 4 +- ...enameClassVariableRefactoring.extension.st | 4 +- ...meInstanceVariableRefactoring.extension.st | 4 +- .../RBTransformation.extension.st | 4 +- .../TBlDevScripterTarget.extension.st | 8 +- .../TGtCoderNavigationClassesHelper.trait.st | 8 +- .../TGtWithCoderModel.trait.st | 14 +- .../TGtWithCoderToolViewModel.trait.st | 16 +- .../TGtWithTextualCoderViewModel.trait.st | 16 +- src/GToolkit-Coder-UI/package.st | 2 +- 198 files changed, 1509 insertions(+), 1502 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorNameApplyPreviewId.class.st b/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorNameApplyPreviewId.class.st index dd3660795..e9f225c9e 100644 --- a/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorNameApplyPreviewId.class.st +++ b/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorNameApplyPreviewId.class.st @@ -4,12 +4,12 @@ A button that appears when behavior name is modified to open a popup with the re " Class { - #name : 'GtBehaviorCoderBehaviorNameApplyPreviewId', - #superclass : 'GtCoderElementId', + #name : #GtBehaviorCoderBehaviorNameApplyPreviewId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtBehaviorCoderBehaviorNameApplyPreviewId >> asSymbol [ ^ #'behavior-coder--behavior-name-apply-preview' ] diff --git a/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorNameId.class.st b/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorNameId.class.st index 6f8f12fa9..ada7779a4 100644 --- a/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorNameId.class.st +++ b/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorNameId.class.st @@ -4,12 +4,12 @@ An editable label with behavior's name " Class { - #name : 'GtBehaviorCoderBehaviorNameId', - #superclass : 'GtCoderElementId', + #name : #GtBehaviorCoderBehaviorNameId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtBehaviorCoderBehaviorNameId >> asSymbol [ ^ #'behavior-coder--behavior-name-editor' ] diff --git a/src/GToolkit-Coder-UI/GtBehaviorDefinitionCoderUIModel.class.st b/src/GToolkit-Coder-UI/GtBehaviorDefinitionCoderUIModel.class.st index 7a879ac8e..6a55a2a1a 100644 --- a/src/GToolkit-Coder-UI/GtBehaviorDefinitionCoderUIModel.class.st +++ b/src/GToolkit-Coder-UI/GtBehaviorDefinitionCoderUIModel.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtBehaviorDefinitionCoderUIModel', - #superclass : 'GtSingleCoderViewModel', + #name : #GtBehaviorDefinitionCoderUIModel, + #superclass : #GtSingleCoderViewModel, #category : 'GToolkit-Coder-UI-Coder - Behavior-Definition Model' } -{ #category : 'accessing' } +{ #category : #accessing } GtBehaviorDefinitionCoderUIModel >> elementClass [ ^ GtPharoBehaviorDefinitionCoderElement ] diff --git a/src/GToolkit-Coder-UI/GtCategoryToggleAptitude.class.st b/src/GToolkit-Coder-UI/GtCategoryToggleAptitude.class.st index 6a1191936..524b4fffe 100644 --- a/src/GToolkit-Coder-UI/GtCategoryToggleAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtCategoryToggleAptitude.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtCategoryToggleAptitude', - #superclass : 'GtCoderToggleAptitude', + #name : #GtCategoryToggleAptitude, + #superclass : #GtCoderToggleAptitude, #category : 'GToolkit-Coder-UI-Looks' } -{ #category : 'accessing' } +{ #category : #accessing } GtCategoryToggleAptitude >> initialize [ super initialize. self diff --git a/src/GToolkit-Coder-UI/GtClassBreadcrumbToggleAptitude.class.st b/src/GToolkit-Coder-UI/GtClassBreadcrumbToggleAptitude.class.st index 01a6c9cbf..3f4a5c6ba 100644 --- a/src/GToolkit-Coder-UI/GtClassBreadcrumbToggleAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtClassBreadcrumbToggleAptitude.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtClassBreadcrumbToggleAptitude', - #superclass : 'BrAptitude', + #name : #GtClassBreadcrumbToggleAptitude, + #superclass : #BrAptitude, #category : 'GToolkit-Coder-UI-Looks' } -{ #category : 'accessing' } +{ #category : #accessing } GtClassBreadcrumbToggleAptitude >> initialize [ super initialize. self diff --git a/src/GToolkit-Coder-UI/GtClassCardElement.class.st b/src/GToolkit-Coder-UI/GtClassCardElement.class.st index 725e0d9e5..1d3d587b0 100644 --- a/src/GToolkit-Coder-UI/GtClassCardElement.class.st +++ b/src/GToolkit-Coder-UI/GtClassCardElement.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtClassCardElement', - #superclass : 'GtCoderCardElement', + #name : #GtClassCardElement, + #superclass : #GtCoderCardElement, #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'building ui' } +{ #category : #'building ui' } GtClassCardElement >> detailsLabel [ | comment | comment := coder theClass organization comment. diff --git a/src/GToolkit-Coder-UI/GtClassCoderTool.class.st b/src/GToolkit-Coder-UI/GtClassCoderTool.class.st index c4485ccd8..42eea5265 100644 --- a/src/GToolkit-Coder-UI/GtClassCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtClassCoderTool.class.st @@ -1,39 +1,39 @@ Class { - #name : 'GtClassCoderTool', - #superclass : 'GtCoderTool', + #name : #GtClassCoderTool, + #superclass : #GtCoderTool, #instVars : [ 'observedClass' ], #category : 'GToolkit-Coder-UI-Tools' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtClassCoderTool class >> forClass: aClass [ ^ self new observedClass: aClass ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtClassCoderTool class >> observedClass: aClass [ ^ self new observedClass: aClass ] -{ #category : 'converting' } +{ #category : #converting } GtClassCoderTool >> newCoder [ ^ GtCoder forClass: self observedClass instanceSide ] -{ #category : 'accessing' } +{ #category : #accessing } GtClassCoderTool >> object [ "compatibility method for ${GLMBlocObjectToSelect}$" ^ self observedClass ] -{ #category : 'accessing' } +{ #category : #accessing } GtClassCoderTool >> observedClass [ ^ observedClass ] -{ #category : 'accessing' } +{ #category : #accessing } GtClassCoderTool >> observedClass: anObject [ observedClass := anObject ] diff --git a/src/GToolkit-Coder-UI/GtClassesCoderUIModel.class.st b/src/GToolkit-Coder-UI/GtClassesCoderUIModel.class.st index a9245d8fa..52af41890 100644 --- a/src/GToolkit-Coder-UI/GtClassesCoderUIModel.class.st +++ b/src/GToolkit-Coder-UI/GtClassesCoderUIModel.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtClassesCoderUIModel', - #superclass : 'GtMultipleCodersViewModel', + #name : #GtClassesCoderUIModel, + #superclass : #GtMultipleCodersViewModel, #category : 'GToolkit-Coder-UI-Coder - Classes Model' } -{ #category : 'accessing' } +{ #category : #accessing } GtClassesCoderUIModel >> elementClass [ ^ GtClassesElement ] diff --git a/src/GToolkit-Coder-UI/GtClassesElement.class.st b/src/GToolkit-Coder-UI/GtClassesElement.class.st index 8ef17c709..ddf1ba370 100644 --- a/src/GToolkit-Coder-UI/GtClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtClassesElement.class.st @@ -1,13 +1,13 @@ Class { - #name : 'GtClassesElement', - #superclass : 'BlElement', + #name : #GtClassesElement, + #superclass : #BlElement, #instVars : [ 'coder' ], #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'building ui' } +{ #category : #'building ui' } GtClassesElement >> buildContainer [ | aClassList | self removeChildren. @@ -21,19 +21,19 @@ GtClassesElement >> buildContainer [ self addChild: aClassList ] -{ #category : 'accessing' } +{ #category : #accessing } GtClassesElement >> coders: aCoder [ coder := aCoder. self buildContainer ] -{ #category : 'accessing' } +{ #category : #accessing } GtClassesElement >> codersUIModel: aCoder [ coder := aCoder coder. self buildContainer ] -{ #category : 'initialization' } +{ #category : #initialization } GtClassesElement >> initialize [ super initialize. self diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionCompositeEntityViewer.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionCompositeEntityViewer.class.st index b965b17e3..a69921235 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionCompositeEntityViewer.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionCompositeEntityViewer.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCodeDefinitionCompositeEntityViewer', - #superclass : 'GtCodeDefinitionViewer', + #name : #GtCodeDefinitionCompositeEntityViewer, + #superclass : #GtCodeDefinitionViewer, #instVars : [ 'editors', 'separatorStencil', @@ -9,12 +9,12 @@ Class { #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtCodeDefinitionCompositeEntityViewer class >> withAll: aCollectionOfEditors [ ^ self new editors: aCollectionOfEditors ] -{ #category : 'api - instantiation' } +{ #category : #'api - instantiation' } GtCodeDefinitionCompositeEntityViewer >> create [ @@ -45,18 +45,18 @@ GtCodeDefinitionCompositeEntityViewer >> create [ aStream nextPut: (self buildSectionLabel: (editors at: aCurrentIndex) title) ] ] ]) ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionCompositeEntityViewer >> editors [ ^ editors ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionCompositeEntityViewer >> editors: anObject [ editors := anObject. self title: editors first title ] -{ #category : 'initialization' } +{ #category : #initialization } GtCodeDefinitionCompositeEntityViewer >> initialize [ super initialize. @@ -64,17 +64,17 @@ GtCodeDefinitionCompositeEntityViewer >> initialize [ showSectionNames := true ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionCompositeEntityViewer >> separator: aStencil [ separatorStencil := aStencil asStencil ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionCompositeEntityViewer >> withSectionNames [ showSectionNames := true ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionCompositeEntityViewer >> withoutSectionNames [ showSectionNames := false ] diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionEntityViewer.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionEntityViewer.class.st index 5c3965006..7b7c83cdc 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionEntityViewer.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionEntityViewer.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCodeDefinitionEntityViewer', - #superclass : 'GtCodeDefinitionViewer', + #name : #GtCodeDefinitionEntityViewer, + #superclass : #GtCodeDefinitionViewer, #instVars : [ 'definition', 'owner', @@ -15,32 +15,32 @@ Class { #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' } -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionEntityViewer >> completion: aStencil [ completionStencil := aStencil asStencil ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionEntityViewer >> containerName [ ^ containerName ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionEntityViewer >> containerName: anObject [ containerName := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionEntityViewer >> definition [ ^ definition ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionEntityViewer >> definition: anObject [ definition := anObject ] -{ #category : 'initialization' } +{ #category : #initialization } GtCodeDefinitionEntityViewer >> initialize [ super initialize. @@ -59,34 +59,34 @@ GtCodeDefinitionEntityViewer >> initialize [ modelSelector := nil ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionEntityViewer >> modelSelector [ ^ modelSelector ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionEntityViewer >> modelSelector: anObject [ modelSelector := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionEntityViewer >> owner [ ^ owner ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionEntityViewer >> owner: anObject [ owner := anObject ] -{ #category : 'interactions' } +{ #category : #interactions } GtCodeDefinitionEntityViewer >> when: aBlEvent do: aBlock [ "aBlock is in form [ :anEvent :aCodeDefinition ]" eventHandlers add: (aBlEvent -> aBlock) ] -{ #category : 'interactions' } +{ #category : #interactions } GtCodeDefinitionEntityViewer >> whenClickDo: aBlock [ "I do not react to primary+click" "aBlock is in form [ :anEvent :aCodeDefinition ]" @@ -100,14 +100,14 @@ GtCodeDefinitionEntityViewer >> whenClickDo: aBlock [ aBlock cull: anEvent cull: aDefinition ] ] ] -{ #category : 'interactions' } +{ #category : #interactions } GtCodeDefinitionEntityViewer >> whenKey: aBlKeyCombination do: aBlock [ "aBlock is in form [ :anEvent :aCodeDefinition ]" interactions add: (aBlKeyCombination -> aBlock) ] -{ #category : 'interactions' } +{ #category : #interactions } GtCodeDefinitionEntityViewer >> whenPrimaryClickDo: aBlock [ "aBlock is in form [ :anEvent :aCodeDefinition ]" diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionNestedEntityViewer.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionNestedEntityViewer.class.st index 9ebb72bbd..0683cdf6d 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionNestedEntityViewer.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionNestedEntityViewer.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCodeDefinitionNestedEntityViewer', - #superclass : 'GtCodeDefinitionViewer', + #name : #GtCodeDefinitionNestedEntityViewer, + #superclass : #GtCodeDefinitionViewer, #instVars : [ 'editor', 'nestedEditors' @@ -8,7 +8,7 @@ Class { #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' } -{ #category : 'api - instantiation' } +{ #category : #'api - instantiation' } GtCodeDefinitionNestedEntityViewer >> create [ | aContainer theNestedEditors | @@ -44,23 +44,23 @@ GtCodeDefinitionNestedEntityViewer >> create [ ^ aContainer ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionNestedEntityViewer >> editor [ ^ editor ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionNestedEntityViewer >> editor: anObject [ editor := anObject. self title: editor title ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionNestedEntityViewer >> nestedEditors [ ^ nestedEditors ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionNestedEntityViewer >> nestedEditors: anObject [ nestedEditors := anObject ] diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st index b57a2f609..71c51a1ac 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCodeDefinitionPluralEditor', - #superclass : 'GtCodeDefinitionPluralViewer', + #name : #GtCodeDefinitionPluralEditor, + #superclass : #GtCodeDefinitionPluralViewer, #instVars : [ 'addSelector', 'renameSelector', @@ -9,17 +9,17 @@ Class { #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' } -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionPluralEditor >> addSelector [ ^ addSelector ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionPluralEditor >> addSelector: anObject [ addSelector := anObject ] -{ #category : 'api - instantiation' } +{ #category : #'api - instantiation' } GtCodeDefinitionPluralEditor >> create [ | aDefinition anOwner theInitialNames addAction removeAction renameAction aTagger | @@ -114,22 +114,22 @@ GtCodeDefinitionPluralEditor >> create [ ^ aTagger ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionPluralEditor >> removeSelector [ ^ removeSelector ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionPluralEditor >> removeSelector: anObject [ removeSelector := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionPluralEditor >> renameSelector [ ^ renameSelector ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionPluralEditor >> renameSelector: anObject [ renameSelector := anObject ] diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralReader.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionPluralReader.class.st index 68c3f82d9..d6db61be9 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralReader.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionPluralReader.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtCodeDefinitionPluralReader', - #superclass : 'GtCodeDefinitionPluralViewer', + #name : #GtCodeDefinitionPluralReader, + #superclass : #GtCodeDefinitionPluralViewer, #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' } -{ #category : 'api - instantiation' } +{ #category : #'api - instantiation' } GtCodeDefinitionPluralReader >> create [ | aDefinition anOwner theInitialNames aTagger | diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralViewer.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionPluralViewer.class.st index 0af717cce..51227cf9a 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralViewer.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionPluralViewer.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCodeDefinitionPluralViewer', - #superclass : 'GtCodeDefinitionEntityViewer', + #name : #GtCodeDefinitionPluralViewer, + #superclass : #GtCodeDefinitionEntityViewer, #instVars : [ 'separatorStencil', 'getSelector', @@ -11,29 +11,29 @@ Class { #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' } -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionPluralViewer >> addEvent: anObject [ addAnnouncement := anObject ] -{ #category : 'api - instantiation' } +{ #category : #'api - instantiation' } GtCodeDefinitionPluralViewer >> create [ ^ self subclassResponsibility ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionPluralViewer >> getSelector [ ^ getSelector ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionPluralViewer >> getSelector: anObject [ getSelector := anObject ] -{ #category : 'initialization' } +{ #category : #initialization } GtCodeDefinitionPluralViewer >> initialize [ super initialize. @@ -41,17 +41,17 @@ GtCodeDefinitionPluralViewer >> initialize [ separatorStencil := nil ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionPluralViewer >> removeEvent: anObject [ removeAnnouncement := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionPluralViewer >> renameEvent: anObject [ renameAnnouncement := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionPluralViewer >> separator: aStencil [ separatorStencil := aStencil asStencil ] diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionSectionLabelStencil.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionSectionLabelStencil.class.st index 6f39c1643..4e43408fe 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionSectionLabelStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionSectionLabelStencil.class.st @@ -1,13 +1,13 @@ Class { - #name : 'GtCodeDefinitionSectionLabelStencil', - #superclass : 'BrStencil', + #name : #GtCodeDefinitionSectionLabelStencil, + #superclass : #BrStencil, #instVars : [ 'name' ], #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' } -{ #category : 'api - instantiation' } +{ #category : #'api - instantiation' } GtCodeDefinitionSectionLabelStencil >> create [ @@ -18,12 +18,12 @@ GtCodeDefinitionSectionLabelStencil >> create [ constraintsDo: [ :c | c grid horizontal alignLeft ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionSectionLabelStencil >> name [ ^ name ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionSectionLabelStencil >> name: anObject [ name := anObject ] diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionSingleEditor.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionSingleEditor.class.st index ee32a337b..f12dc74db 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionSingleEditor.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionSingleEditor.class.st @@ -1,13 +1,13 @@ Class { - #name : 'GtCodeDefinitionSingleEditor', - #superclass : 'GtCodeDefinitionSingleViewer', + #name : #GtCodeDefinitionSingleEditor, + #superclass : #GtCodeDefinitionSingleViewer, #instVars : [ 'setSelector' ], #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' } -{ #category : 'private' } +{ #category : #private } GtCodeDefinitionSingleEditor >> addErrorOverlayTo: aTagElement [ | anOverlay anAnimation | @@ -27,7 +27,7 @@ GtCodeDefinitionSingleEditor >> addErrorOverlayTo: aTagElement [ ifTrue: [ aTagElement parent addChild: anOverlay ] ] -{ #category : 'api - instantiation' } +{ #category : #'api - instantiation' } GtCodeDefinitionSingleEditor >> create [ | aDefinition theInitialName anEditableLabel anOwner | @@ -80,7 +80,7 @@ GtCodeDefinitionSingleEditor >> create [ ^ anEditableLabel ] -{ #category : 'private' } +{ #category : #private } GtCodeDefinitionSingleEditor >> handleRenameError: anError to: aNewName from: aTagElement [ anError description traceCr. @@ -95,7 +95,7 @@ GtCodeDefinitionSingleEditor >> handleRenameError: anError to: aNewName from: aT self addErrorOverlayTo: aTagElement ] -{ #category : 'private' } +{ #category : #private } GtCodeDefinitionSingleEditor >> requestRename: aDefinition to: aNewName from: aTagElement [ setSelector ifNil: [ ^ self ]. @@ -113,12 +113,12 @@ GtCodeDefinitionSingleEditor >> requestRename: aDefinition to: aNewName from: aT from: aTagElement ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionSingleEditor >> setSelector [ ^ setSelector ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionSingleEditor >> setSelector: anObject [ setSelector := anObject ] diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionSingleReader.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionSingleReader.class.st index 0ce3d6dd5..48fee669d 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionSingleReader.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionSingleReader.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtCodeDefinitionSingleReader', - #superclass : 'GtCodeDefinitionSingleViewer', + #name : #GtCodeDefinitionSingleReader, + #superclass : #GtCodeDefinitionSingleViewer, #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' } -{ #category : 'api - instantiation' } +{ #category : #'api - instantiation' } GtCodeDefinitionSingleReader >> create [ | aDefinition theInitialName aLabel anOwner | diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionSingleViewer.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionSingleViewer.class.st index de7b44968..357eefc64 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionSingleViewer.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionSingleViewer.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCodeDefinitionSingleViewer', - #superclass : 'GtCodeDefinitionEntityViewer', + #name : #GtCodeDefinitionSingleViewer, + #superclass : #GtCodeDefinitionEntityViewer, #instVars : [ 'getSelector', 'renameAnnouncement' @@ -8,24 +8,24 @@ Class { #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' } -{ #category : 'api - instantiation' } +{ #category : #'api - instantiation' } GtCodeDefinitionSingleViewer >> create [ ^ self subclassResponsibility ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionSingleViewer >> getSelector [ ^ getSelector ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionSingleViewer >> getSelector: anObject [ getSelector := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionSingleViewer >> renameEvent: anObject [ renameAnnouncement := anObject ] diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionViewer.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionViewer.class.st index 43a9ffcbc..347d1b704 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionViewer.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionViewer.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCodeDefinitionViewer', - #superclass : 'BrStencil', + #name : #GtCodeDefinitionViewer, + #superclass : #BrStencil, #instVars : [ 'title', 'margin', @@ -9,12 +9,12 @@ Class { #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' } -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionViewer >> aptitude: aStencil [ lookStencil := aStencil asStencil ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCodeDefinitionViewer >> buildSectionLabel: aSectionName [ ^ BrLabel new @@ -25,7 +25,7 @@ GtCodeDefinitionViewer >> buildSectionLabel: aSectionName [ constraintsDo: [ :c | c grid horizontal alignLeft ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtCodeDefinitionViewer >> initialize [ super initialize. @@ -36,27 +36,27 @@ GtCodeDefinitionViewer >> initialize [ fontSize: 10 ] asStencil. ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionViewer >> margin [ ^ margin ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionViewer >> margin: anObject [ margin := anObject ] -{ #category : 'printing' } +{ #category : #printing } GtCodeDefinitionViewer >> printOn: aStream [ aStream print: self title ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionViewer >> title [ ^ title ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionViewer >> title: anObject [ title := anObject ] diff --git a/src/GToolkit-Coder-UI/GtCoder.class.st b/src/GToolkit-Coder-UI/GtCoder.class.st index f9e04c0be..1aad20f56 100644 --- a/src/GToolkit-Coder-UI/GtCoder.class.st +++ b/src/GToolkit-Coder-UI/GtCoder.class.st @@ -12,8 +12,8 @@ I am the entrance point into the coder as a tool. To instantiate me, use one of " Class { - #name : 'GtCoder', - #superclass : 'GtCoderNavigationModelElement', + #name : #GtCoder, + #superclass : #GtCoderNavigationModelElement, #traits : 'TGtPagerPageInstantiator + TGtPhlowToolDetailAdjustable', #classTraits : 'TGtPagerPageInstantiator classTrait + TGtPhlowToolDetailAdjustable classTrait', #instVars : [ @@ -25,13 +25,13 @@ Class { #category : 'GToolkit-Coder-UI-! Core' } -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoder >> contentElement [ ^ contentElement ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoder >> initialize [ super initialize. self initializeTitleNotifier. @@ -50,12 +50,12 @@ GtCoder >> initialize [ self addAptitude: (BrLayoutResizerAptitude inherit). ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoder >> initializeContentElement [ contentElement := GtCoderPlaygroundElement new. ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoder >> initializeSidebarElement [ sidebarElement := GtPhlowHorizontalSidebarElement new beLeft. self addAptitude: (GtPhlowToolDetailAptitude new @@ -63,7 +63,7 @@ GtCoder >> initializeSidebarElement [ detailed: [ :theInstance | sidebarElement show ]). ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoder >> initializeTitleNotifier [ titleNotifier := GtPhlowTitleIconAndLabelNotifier new shortLabel: [ self shortTitle ifEmpty: [ 'Coder' asRopedText ] ]; @@ -71,7 +71,7 @@ GtCoder >> initializeTitleNotifier [ self addEventHandler: titleNotifier. ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoder >> initializeToolbarElement [ toolbarElement := GtCoderToolbarElement new constraintsDo: [ :c | @@ -80,7 +80,7 @@ GtCoder >> initializeToolbarElement [ c ignored vertical alignTop ]. ] -{ #category : 'private - hooks' } +{ #category : #'private - hooks' } GtCoder >> onNavigationModelChanged [ super onNavigationModelChanged. self contentElement navigationModel: self navigationModel. @@ -89,32 +89,32 @@ GtCoder >> onNavigationModelChanged [ self updateTabLabel ] -{ #category : 'private - announcement handling' } +{ #category : #'private - announcement handling' } GtCoder >> onNavigationModelSubjectChange [ self enqueueTask: (BlTaskAction new action: [ self updateTabLabel ]) ] -{ #category : 'opening' } +{ #category : #opening } GtCoder >> pagerWindowTitle [ ^ self shortTitle ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoder >> shortTitle [ ^ (GtPhlowTitleLabelBuilder longLabel: self subjectTitle) build ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoder >> sidebarElement [ ^ sidebarElement ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoder >> subjectTitle [ self navigationModel selectedClassDo: [ :aClass | ^ aClass name ]. @@ -123,7 +123,7 @@ GtCoder >> subjectTitle [ ^ nil ] -{ #category : 'private - subscriptions' } +{ #category : #'private - subscriptions' } GtCoder >> subscribeToNavigationModel [ super subscribeToNavigationModel. self navigationModel weak @@ -137,26 +137,26 @@ GtCoder >> subscribeToNavigationModel [ send: #onNavigationModelSubjectChange to: self ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoder >> titleNotifier [ ^ titleNotifier ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoder >> toolbarElement [ ^ toolbarElement ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtCoder >> updateSidebarContent [ self sidebarElement contentStencil: (GtCoderNavigationTabsStencil new navigationModel: self navigationModel) ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtCoder >> updateTabLabel [ self titleNotifier notifyIfFocused ] diff --git a/src/GToolkit-Coder-UI/GtCoder2.class.st b/src/GToolkit-Coder-UI/GtCoder2.class.st index 81eaa8b74..f26172e3a 100644 --- a/src/GToolkit-Coder-UI/GtCoder2.class.st +++ b/src/GToolkit-Coder-UI/GtCoder2.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoder2', - #superclass : 'BlElement', + #name : #GtCoder2, + #superclass : #BlElement, #traits : 'TGtPagerPageInstantiator + TGtPhlowToolDetailAdjustable + TGtWithCoderToolViewModel + TBrLayoutResizable', #classTraits : 'TGtPagerPageInstantiator classTrait + TGtPhlowToolDetailAdjustable classTrait + TGtWithCoderToolViewModel classTrait + TBrLayoutResizable classTrait', #instVars : [ @@ -12,7 +12,7 @@ Class { #category : 'GToolkit-Coder-UI-! Core' } -{ #category : 'initialization' } +{ #category : #initialization } GtCoder2 >> createCoderContainer [ "A container that contains an actual current coder element. The content of the container is replaced every time a coder is pushed or popped" @@ -21,7 +21,7 @@ GtCoder2 >> createCoderContainer [ matchParent ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoder2 >> createGoBackButton [ ^ BrButton new aptitude: BrGlamorousButtonWithLabelAptitude; @@ -29,19 +29,19 @@ GtCoder2 >> createGoBackButton [ action: [ self coderToolViewModel popCoderViewModel ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoder2 >> createNavigationBreadcrumb [ ^ BrHorizontalPane new hMatchParent; vFitContent ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoder2 >> createNavigationSidebar [ ^ GtPhlowHorizontalSidebarElement new beLeft ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoder2 >> initialize [ super initialize. @@ -80,12 +80,12 @@ GtCoder2 >> initialize [ ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoder2 >> navigationStencil: aStencil [ navigationSidebar contentStencil: aStencil ] -{ #category : 'api - coder tool view model' } +{ #category : #'api - coder tool view model' } GtCoder2 >> onCoderToolViewModelChanged [ "Is sent when a new coderTool view model is assigned to the element. Note: #onCoderToolViewModelChanged is sent before #subscribeToCoderToolViewModel @@ -97,25 +97,25 @@ GtCoder2 >> onCoderToolViewModelChanged [ self rebuildTopCoderElement ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtCoder2 >> onViewModelCoderPopped: anAnnouncement [ self updateGoBackButton. self rebuildTopCoderElement. ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtCoder2 >> onViewModelCoderPushed: anAnnouncement [ self updateGoBackButton. self rebuildTopCoderElement ] -{ #category : 'opening' } +{ #category : #opening } GtCoder2 >> pagerWindowTitle [ ^ self shortTitle ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtCoder2 >> rebuildTopCoderElement [ coderContainer removeChildren. @@ -123,7 +123,7 @@ GtCoder2 >> rebuildTopCoderElement [ ifTrue: [ coderContainer addChild: self coderToolViewModel currentCoderViewModel asElement ] ] -{ #category : 'api - coder tool view model' } +{ #category : #'api - coder tool view model' } GtCoder2 >> subscribeToCoderToolViewModel [ "Is sent after a new coderTool view model is assigned to the element. It is required to unsubscribe from the view model or domain model by implementing @@ -134,7 +134,7 @@ GtCoder2 >> subscribeToCoderToolViewModel [ when: GtCoderToolViewModelCoderPopped send: #onViewModelCoderPopped: to: self ] -{ #category : 'api - coder tool view model' } +{ #category : #'api - coder tool view model' } GtCoder2 >> unsubscribeFromCoderToolViewModel [ "Is sent before a new coderTool view model is assigned to the element. Elements that subscribe to coderTool view model in domain model are required to implement this methods." @@ -142,7 +142,7 @@ GtCoder2 >> unsubscribeFromCoderToolViewModel [ self coderToolViewModel unsubscribe: self ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtCoder2 >> updateGoBackButton [ goBackButton enabled: self coderToolViewModel canGoBack ] diff --git a/src/GToolkit-Coder-UI/GtCoderAction.extension.st b/src/GToolkit-Coder-UI/GtCoderAction.extension.st index e5e276824..b19504a76 100644 --- a/src/GToolkit-Coder-UI/GtCoderAction.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderAction.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'GtCoderAction' } +Extension { #name : #GtCoderAction } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtCoderAction >> buildElementIn: aCoderActionsElement [ ^ aCoderActionsElement newButtonForAction: self ] diff --git a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st index 156bca59f..2d464fe2e 100644 --- a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderActionsElement', - #superclass : 'BlElement', + #name : #GtCoderActionsElement, + #superclass : #BlElement, #traits : 'TGtWithTextualCoderViewModel', #classTraits : 'TGtWithTextualCoderViewModel classTrait', #instVars : [ @@ -12,7 +12,7 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'private' } +{ #category : #private } GtCoderActionsElement >> addContextToolbarActions [ contextToolbar addItems: (self textualCoderViewModel contextActions collect: [ :aGtCoderAction | self newButtonForAction: aGtCoderAction ]). separator @@ -22,7 +22,7 @@ GtCoderActionsElement >> addContextToolbarActions [ ifFalse: [ BlVisibility gone ]) ] -{ #category : 'private' } +{ #category : #private } GtCoderActionsElement >> addMainToolbarActions [ mainToolbar addItems: @@ -32,17 +32,17 @@ GtCoderActionsElement >> addMainToolbarActions [ aGtCoderAction buildElementIn: self ]) ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderActionsElement >> coderUIModel [ ^ self textualCoderViewModel ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderActionsElement >> coderUIModel: aCoderUIModel [ self textualCoderViewModel: aCoderUIModel ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtCoderActionsElement >> disableButton: aButtonElement action: aGtCoderAction [ aButtonElement icon: @@ -52,7 +52,7 @@ GtCoderActionsElement >> disableButton: aButtonElement action: aGtCoderAction [ disable ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtCoderActionsElement >> enqueueEnableButton: aButtonElement action: aGtCoderAction [ ^ aButtonElement enqueueTask: @@ -63,7 +63,7 @@ GtCoderActionsElement >> enqueueEnableButton: aButtonElement action: aGtCoderAct enable ]) ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtCoderActionsElement >> handleButton: aButtonElement action: aGtCoderAction onEvent: anEvent [ self disableButton: aButtonElement action: aGtCoderAction. GtCoderExecutionContextVariable @@ -78,7 +78,7 @@ GtCoderActionsElement >> handleButton: aButtonElement action: aGtCoderAction onE ensure: [ self enqueueEnableButton: aButtonElement action: aGtCoderAction ] ]) ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderActionsElement >> initialize [ super initialize. @@ -102,7 +102,7 @@ GtCoderActionsElement >> initialize [ self addChildren: { mainToolbar . separator . contextToolbar } ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtCoderActionsElement >> newButtonForAction: aGtCoderAction [ ^ BrButton new @@ -118,7 +118,7 @@ GtCoderActionsElement >> newButtonForAction: aGtCoderAction [ onEvent: anEvent ] ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtCoderActionsElement >> newDropButtonForAction: aGtCoderAction [ | button aContentStencil | @@ -178,7 +178,7 @@ GtCoderActionsElement >> newDropButtonForAction: aGtCoderAction [ yourself ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtCoderActionsElement >> newToolbar [ @@ -187,7 +187,7 @@ GtCoderActionsElement >> newToolbar [ padding: (BlInsets left: -4) ] -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } GtCoderActionsElement >> onPostTextualCoderViewModelChanged [ "I am an optional hook method that is sent after #subscribeToTextualCoderViewModel. I do nothing by default but allow users to perform update operations when a receiver object is already @@ -196,7 +196,7 @@ GtCoderActionsElement >> onPostTextualCoderViewModelChanged [ self textualCoderViewModel ensureAddOns ] -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } GtCoderActionsElement >> onTextualCoderViewModelChanged [ "Is sent when a new textualCoder view model is assigned to the element. Note: #onTextualCoderViewModelChanged is sent before #subscribeToTextualCoderViewModel @@ -210,17 +210,17 @@ GtCoderActionsElement >> onTextualCoderViewModelChanged [ self addContextToolbarActions ] -{ #category : 'private' } +{ #category : #private } GtCoderActionsElement >> removeContextToolbarActions [ contextToolbar numberOfItems timesRepeat: [ contextToolbar removeItemAt: 1 ] ] -{ #category : 'private' } +{ #category : #private } GtCoderActionsElement >> removeMainToolbarActions [ mainToolbar numberOfItems timesRepeat: [ mainToolbar removeItemAt: 1 ] ] -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } GtCoderActionsElement >> subscribeToTextualCoderViewModel [ "Is sent after a new textualCoder view model is assigned to the element. It is required to unsubscribe from the view model or domain model by implementing @@ -231,7 +231,7 @@ GtCoderActionsElement >> subscribeToTextualCoderViewModel [ when: GtTextualCoderViewModelContextActionsChanged send: #updateContextToolbar to: self ] -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } GtCoderActionsElement >> unsubscribeFromTextualCoderViewModel [ "Is sent before a new textualCoder view model is assigned to the element. Elements that subscribe to textualCoder view model in domain model are required to implement this methods." @@ -239,7 +239,7 @@ GtCoderActionsElement >> unsubscribeFromTextualCoderViewModel [ self textualCoderViewModel unsubscribe: self ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtCoderActionsElement >> updateContextToolbar [ self enqueueTask: (BlTaskAction new @@ -248,7 +248,7 @@ GtCoderActionsElement >> updateContextToolbar [ self addContextToolbarActions ]) ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtCoderActionsElement >> updateMainToolbar [ self enqueueTask: (BlTaskAction new action: [ diff --git a/src/GToolkit-Coder-UI/GtCoderActivatableAction.extension.st b/src/GToolkit-Coder-UI/GtCoderActivatableAction.extension.st index 25467fbae..7393539ad 100644 --- a/src/GToolkit-Coder-UI/GtCoderActivatableAction.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderActivatableAction.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'GtCoderActivatableAction' } +Extension { #name : #GtCoderActivatableAction } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtCoderActivatableAction >> buildElementIn: aCoderActionsElement [ | aButton | diff --git a/src/GToolkit-Coder-UI/GtCoderCardElement.class.st b/src/GToolkit-Coder-UI/GtCoderCardElement.class.st index 2ec945777..0bba78c46 100644 --- a/src/GToolkit-Coder-UI/GtCoderCardElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderCardElement.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderCardElement', - #superclass : 'BlElement', + #name : #GtCoderCardElement, + #superclass : #BlElement, #instVars : [ 'coder', 'coderNameLabel', @@ -9,12 +9,12 @@ Class { #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderCardElement >> coder [ ^ coder ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderCardElement >> coder: anObject [ coder := anObject. coderNameLabel text: (self coderNameTextFrom: coder coderName). @@ -26,7 +26,7 @@ GtCoderCardElement >> coder: anObject [ text: (self coderDetailsTextFrom: aDetailsString) ] ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderCardElement >> coderDetailsTextFrom: aString [ "Convert a coder's details to a styled text" @@ -35,7 +35,7 @@ GtCoderCardElement >> coderDetailsTextFrom: aString [ foreground: self theme button defaultTextColor ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderCardElement >> coderNameTextFrom: aString [ "Convert a coder's name to a styled text" @@ -43,12 +43,12 @@ GtCoderCardElement >> coderNameTextFrom: aString [ ^ aString asRopedText glamorousCodeFont bold ] -{ #category : 'building ui' } +{ #category : #'building ui' } GtCoderCardElement >> detailsLabel [ ^ '' ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderCardElement >> initialize [ super initialize. self aptitude: (BrGlamorousButtonExteriorAptitude new borderPaint: Color transparent). @@ -81,7 +81,7 @@ GtCoderCardElement >> initialize [ self addChildren: { coderNameLabel . coderDetailsLabel } ] -{ #category : 'private' } +{ #category : #private } GtCoderCardElement >> selectCoder [ | anEvent | diff --git a/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st b/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st index 1dea8df19..1cf8deea1 100644 --- a/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st +++ b/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st @@ -6,8 +6,8 @@ If a code is selected, I execute the selection. If there is no selection, I exec " Class { - #name : 'GtCoderCodeExecutor', - #superclass : 'Object', + #name : #GtCoderCodeExecutor, + #superclass : #Object, #instVars : [ 'coderUIModel', 'action', @@ -16,65 +16,65 @@ Class { #category : 'GToolkit-Coder-UI-Execution' } -{ #category : 'api - instance creation' } +{ #category : #'api - instance creation' } GtCoderCodeExecutor class >> doIt [ "Execute a code (and do not display the execution result)" ^ self new doIt ] -{ #category : 'api - instance creation' } +{ #category : #'api - instance creation' } GtCoderCodeExecutor class >> doItAndGo [ "Execute a code and display the execution result" ^ self new doItAndGo ] -{ #category : 'api - instance creation' } +{ #category : #'api - instance creation' } GtCoderCodeExecutor class >> playAll [ "Execute a method code (and do not display the execution result)" ^ self new playAll ] -{ #category : 'api - instance creation' } +{ #category : #'api - instance creation' } GtCoderCodeExecutor class >> playAllAndInspect [ "Execute a method code and display the execution result" ^ self new playAllAndInspect ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoderCodeExecutor >> coder [ ^ self coderUIModel coder ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderCodeExecutor >> coderUIModel [ ^ coderUIModel ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderCodeExecutor >> coderUIModel: anObject [ coderUIModel := anObject ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderCodeExecutor >> doIt [ "Execute a code (and do not display the execution result)" action := #doIt ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderCodeExecutor >> doItAndGo [ "Execute a code and display the execution result" action := #doItAndGo ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderCodeExecutor >> element [ ^ element ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderCodeExecutor >> element: anElement [ self assert: [ anElement isKindOf: BlElement ] @@ -83,41 +83,41 @@ GtCoderCodeExecutor >> element: anElement [ element := anElement ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderCodeExecutor >> event [ self flag: 'I should not keep events, but rather #element'. self halt. ^ nil ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderCodeExecutor >> event: anObject [ self halt. self flag: 'I should not receive events, but rather #element:'. ] -{ #category : 'api - execution' } +{ #category : #'api - execution' } GtCoderCodeExecutor >> execute [ GtCoderExecutionContextVariable element: self element do: [ self coderUIModel perform: action ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderCodeExecutor >> initialize [ super initialize. self doItAndGo. ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderCodeExecutor >> playAll [ "Execute a method code (and do not display the execution result)" action := #playAll ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderCodeExecutor >> playAllAndInspect [ "Execute a method code and display the execution result" diff --git a/src/GToolkit-Coder-UI/GtCoderContentElement.class.st b/src/GToolkit-Coder-UI/GtCoderContentElement.class.st index 80597961f..f9d7f2114 100644 --- a/src/GToolkit-Coder-UI/GtCoderContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderContentElement.class.st @@ -7,18 +7,18 @@ I display a {{gtClass:GtPharoBehaviorCoder}}, {{gtClass:GtPharoPackageTagCoder}} " Class { - #name : 'GtCoderContentElement', - #superclass : 'GtCoderNavigationModelElement', + #name : #GtCoderContentElement, + #superclass : #GtCoderNavigationModelElement, #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'factory' } +{ #category : #factory } GtCoderContentElement class >> default [ ^ self new navigationModel: GtCoderNavigationModel default ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderContentElement >> initialize [ super initialize. self layout: BlFrameLayout new. @@ -26,26 +26,26 @@ GtCoderContentElement >> initialize [ self addAptitude: (BrLayoutResizerAptitude inherit). ] -{ #category : 'hooks - children' } +{ #category : #'hooks - children' } GtCoderContentElement >> onAddedToSceneGraph [ super onAddedToSceneGraph. self navigationModel subscribeToSystem. ] -{ #category : 'hooks - children' } +{ #category : #'hooks - children' } GtCoderContentElement >> onRemovedFromSceneGraph [ super onRemovedFromSceneGraph. self navigationModel unsubscribeFromSystem. ] -{ #category : 'private - subscriptions' } +{ #category : #'private - subscriptions' } GtCoderContentElement >> subscribeToNavigationModel [ super subscribeToNavigationModel. self navigationModel weak when: GtCoderNavigationSelectionAnnouncement send: #updateCoder: to: self. ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtCoderContentElement >> updateCoder: anAnnouncement [ self removeChildren. self addChild: anAnnouncement coder asElement. diff --git a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st index 59bf18a8f..39bbc311f 100644 --- a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st +++ b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st @@ -1,29 +1,29 @@ Class { - #name : 'GtCoderContextMenuContent', - #superclass : 'BrSimpleList', + #name : #GtCoderContextMenuContent, + #superclass : #BrSimpleList, #instVars : [ 'editorElement' ], #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'defaults' } +{ #category : #defaults } GtCoderContextMenuContent >> defaultContextMenuActionName [ ^ #contextMenuAction ] -{ #category : 'defaults' } +{ #category : #defaults } GtCoderContextMenuContent >> defaultLabelChildName [ ^ #label ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderContextMenuContent >> editorElement [ ^ editorElement ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderContextMenuContent >> editorElement: anEditorElement [ self assert: [ anEditorElement isNotNil ] @@ -31,7 +31,7 @@ GtCoderContextMenuContent >> editorElement: anEditorElement [ editorElement := anEditorElement ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderContextMenuContent >> initialize [ super initialize. self diff --git a/src/GToolkit-Coder-UI/GtCoderDropDownAction.extension.st b/src/GToolkit-Coder-UI/GtCoderDropDownAction.extension.st index 4e40b4785..bf916cea4 100644 --- a/src/GToolkit-Coder-UI/GtCoderDropDownAction.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderDropDownAction.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'GtCoderDropDownAction' } +Extension { #name : #GtCoderDropDownAction } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtCoderDropDownAction >> buildElementIn: aCoderActionsElement [ ^ aCoderActionsElement newDropButtonForAction: self ] diff --git a/src/GToolkit-Coder-UI/GtCoderDropDownWithPreviewAction.extension.st b/src/GToolkit-Coder-UI/GtCoderDropDownWithPreviewAction.extension.st index 564533f98..c2697730e 100644 --- a/src/GToolkit-Coder-UI/GtCoderDropDownWithPreviewAction.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderDropDownWithPreviewAction.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'GtCoderDropDownWithPreviewAction' } +Extension { #name : #GtCoderDropDownWithPreviewAction } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtCoderDropDownWithPreviewAction >> buildElementIn: aCoderActionsElement [ ^ GtPreviewChangeButton new icon: self icon; diff --git a/src/GToolkit-Coder-UI/GtCoderElement.class.st b/src/GToolkit-Coder-UI/GtCoderElement.class.st index 31437e42f..7f138c307 100644 --- a/src/GToolkit-Coder-UI/GtCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderElement.class.st @@ -7,14 +7,14 @@ See my {{gtClass:GtCoderElement|expanded|show=#gtSubclassesFor:}} for concrete i " Class { - #name : 'GtCoderElement', - #superclass : 'BlElement', + #name : #GtCoderElement, + #superclass : #BlElement, #traits : 'TBrLayoutResizable', #classTraits : 'TBrLayoutResizable classTrait', #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'initialization' } +{ #category : #initialization } GtCoderElement >> initialize [ super initialize. diff --git a/src/GToolkit-Coder-UI/GtCoderElementId.class.st b/src/GToolkit-Coder-UI/GtCoderElementId.class.st index 283895420..1f4cc6504 100644 --- a/src/GToolkit-Coder-UI/GtCoderElementId.class.st +++ b/src/GToolkit-Coder-UI/GtCoderElementId.class.st @@ -3,12 +3,12 @@ " Class { - #name : 'GtCoderElementId', - #superclass : 'BlElementUniqueId', + #name : #GtCoderElementId, + #superclass : #BlElementUniqueId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'testing' } +{ #category : #testing } GtCoderElementId class >> isAbstract [ ^ self = GtCoderElementId ] diff --git a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st index 575f7ddf2..06e1ea410 100644 --- a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st @@ -17,8 +17,8 @@ I am an icon that represents an {{gtClass:GtExampleWithResult}} result state. " Class { - #name : 'GtCoderExampleStateElement', - #superclass : 'BlElement', + #name : #GtCoderExampleStateElement, + #superclass : #BlElement, #traits : 'TBrLayoutResizable + TBrEnableable', #classTraits : 'TBrLayoutResizable classTrait + TBrEnableable classTrait', #instVars : [ @@ -28,26 +28,26 @@ Class { #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'private - asserting' } +{ #category : #'private - asserting' } GtCoderExampleStateElement >> assertExample: aGtExampleWithResult [ self assert: [ aGtExampleWithResult isNotNil ] description: [ 'Example must be non-nil' ]. ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtCoderExampleStateElement >> debugExampleFrom: aButton [ self exampleDo: [ :anExample | anExample openingDebugger result ] ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderExampleStateElement >> example [ ^ example ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderExampleStateElement >> example: aGtExampleWithResult [ self assertExample: aGtExampleWithResult. self unsubscribeFromExample. @@ -56,23 +56,23 @@ GtCoderExampleStateElement >> example: aGtExampleWithResult [ self onExampleChanged. ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoderExampleStateElement >> exampleDo: aBlock [ self example ifNotNil: aBlock ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoderExampleStateElement >> exampleResult [ ^ self example ifNotNil: #result ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoderExampleStateElement >> exampleState [ ^ GtFilterExampleState default stateFromExample: self example ] -{ #category : 'private - testing' } +{ #category : #'private - testing' } GtCoderExampleStateElement >> hasExampleResult [ ^ self example @@ -80,7 +80,7 @@ GtCoderExampleStateElement >> hasExampleResult [ ifNil: [ false ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderExampleStateElement >> initialize [ super initialize. self initializeViewModels. @@ -96,20 +96,20 @@ GtCoderExampleStateElement >> initialize [ self addAptitude: BrLayoutResizerAptitude inherit. ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderExampleStateElement >> initializeInteractiveLook [ self addAptitude: (styleLook := BrStyleCommonAptitude new). self updateStyleLook. ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderExampleStateElement >> initializeTooltipLook [ self addAptitude: (BrGlamorousWithTooltipAptitude2 content: [ self newTooltipContent ]) ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderExampleStateElement >> initializeViewModels [ | aButtonModel | @@ -118,14 +118,14 @@ GtCoderExampleStateElement >> initializeViewModels [ self viewModel: aButtonModel. ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderExampleStateElement >> newInspectorWithExampleResult [ ^ ((GtInspector forObject: self tooltipObject) exact: 400@400) asScalableElement size: 200@200. ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderExampleStateElement >> newNotExecutedLabel [ ^ BrLabel new aptitude: BrGlamorousLabelAptitude; @@ -133,7 +133,7 @@ GtCoderExampleStateElement >> newNotExecutedLabel [ padding: (BlInsets all: 5) ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderExampleStateElement >> newNotExecutedToolbar [ ^ BrToolbar new aptitude: BrGlamorousToolbarAptitude new; @@ -157,7 +157,7 @@ GtCoderExampleStateElement >> newNotExecutedToolbar [ beSmallSize) ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderExampleStateElement >> newNotExecutedTooltipContent [ ^ BrVerticalPane new fitContent; @@ -171,7 +171,7 @@ GtCoderExampleStateElement >> newNotExecutedTooltipContent [ margin: (BlInsets top: 3)). ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderExampleStateElement >> newTooltipContent [ | aContainer | aContainer := BrFrame new @@ -185,7 +185,7 @@ GtCoderExampleStateElement >> newTooltipContent [ ^ aContainer ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtCoderExampleStateElement >> onClick: aButton [ self exampleDo: [ :anExample | anExample hasResult ifFalse: [ ^ self ]. @@ -193,12 +193,12 @@ GtCoderExampleStateElement >> onClick: aButton [ self debugExampleFrom: aButton ] ] -{ #category : 'private - hooks' } +{ #category : #'private - hooks' } GtCoderExampleStateElement >> onExampleChanged [ self updateIcon. ] -{ #category : 'private - announcement handling' } +{ #category : #'private - announcement handling' } GtCoderExampleStateElement >> onExampleExecuted: aGtExampleExecuted [ BlUseAsyncFeatures ifEnabledDo: [ @@ -207,32 +207,32 @@ GtCoderExampleStateElement >> onExampleExecuted: aGtExampleExecuted [ otherwise: [ self updateIcon ] ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtCoderExampleStateElement >> playAndInspectExampleFrom: aButton [ self playExampleFrom: aButton. self spawnExampleFrom: aButton. ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtCoderExampleStateElement >> playExampleFrom: aButton [ self exampleDo: [ :anExample | anExample run ] ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtCoderExampleStateElement >> spawnExampleFrom: anElement [ self exampleDo: [ :anExample | anExample hasResult ifTrue: [ anElement phlow spawnObject: anExample result returnValueOrExampleException ] ] ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoderExampleStateElement >> styleLook [ ^ styleLook ] -{ #category : 'private - subscriptions' } +{ #category : #'private - subscriptions' } GtCoderExampleStateElement >> subscribeToExample [ self example announcer when: GtExampleExecuted @@ -240,25 +240,25 @@ GtCoderExampleStateElement >> subscribeToExample [ to: self. ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoderExampleStateElement >> tooltipObject [ self exampleResult ifNotNil: [ :aResult | ^ aResult returnValueOrExampleException ]. ^ self example ] -{ #category : 'private - subscriptions' } +{ #category : #'private - subscriptions' } GtCoderExampleStateElement >> unsubscribeFromExample [ self example ifNil: [ ^ self ]. self example announcer unsubscribe: self. ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtCoderExampleStateElement >> updateIcon [ self background: self exampleState color. self updateStyleLook. ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtCoderExampleStateElement >> updateStyleLook [ "the following nil check can be removed anytime later. diff --git a/src/GToolkit-Coder-UI/GtCoderExecutionContextVariable.class.st b/src/GToolkit-Coder-UI/GtCoderExecutionContextVariable.class.st index a841c5170..29211d4b4 100644 --- a/src/GToolkit-Coder-UI/GtCoderExecutionContextVariable.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExecutionContextVariable.class.st @@ -13,12 +13,12 @@ To obtain the execution context, use {{gtMethod:GtCoderExecutionContextVariable " Class { - #name : 'GtCoderExecutionContextVariable', - #superclass : 'DynamicVariable', + #name : #GtCoderExecutionContextVariable, + #superclass : #DynamicVariable, #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'api - execution' } +{ #category : #'api - execution' } GtCoderExecutionContextVariable class >> element: anElement do: aBlock [ "Initialize a Space ID using the element and evaluate the block" | aSpaceId | @@ -28,19 +28,19 @@ GtCoderExecutionContextVariable class >> element: anElement do: aBlock [ during: aBlock ] -{ #category : 'testing' } +{ #category : #testing } GtCoderExecutionContextVariable class >> isInheritable [ ^true ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderExecutionContextVariable class >> newSpaceIdFromElement: anElement [ anElement spaceDo: [ :aSpace | ^ aSpace id ]. ^ nil ] -{ #category : 'api - execution' } +{ #category : #'api - execution' } GtCoderExecutionContextVariable class >> spaceDo: aSpaceBlock ifClosed: aClosedBlock [ self value ifNotNil: [ :aSpaceId | BlSpace diff --git a/src/GToolkit-Coder-UI/GtCoderExpanderAptitude.class.st b/src/GToolkit-Coder-UI/GtCoderExpanderAptitude.class.st index c530ac07e..67fc932ff 100644 --- a/src/GToolkit-Coder-UI/GtCoderExpanderAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExpanderAptitude.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtCoderExpanderAptitude', - #superclass : 'GtCoderExpanderWithoutShadowAptitude', + #name : #GtCoderExpanderAptitude, + #superclass : #GtCoderExpanderWithoutShadowAptitude, #category : 'GToolkit-Coder-UI-Looks' } -{ #category : 'initialization' } +{ #category : #initialization } GtCoderExpanderAptitude >> initialize [ super initialize. diff --git a/src/GToolkit-Coder-UI/GtCoderExpanderShadowAptitude.class.st b/src/GToolkit-Coder-UI/GtCoderExpanderShadowAptitude.class.st index 836f9b332..b963c9028 100644 --- a/src/GToolkit-Coder-UI/GtCoderExpanderShadowAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExpanderShadowAptitude.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtCoderExpanderShadowAptitude', - #superclass : 'BrStyleCommonAptitude', + #name : #GtCoderExpanderShadowAptitude, + #superclass : #BrStyleCommonAptitude, #category : 'GToolkit-Coder-UI-Looks' } -{ #category : 'initialization' } +{ #category : #initialization } GtCoderExpanderShadowAptitude >> initialize [ super initialize. diff --git a/src/GToolkit-Coder-UI/GtCoderExpanderWithoutShadowAptitude.class.st b/src/GToolkit-Coder-UI/GtCoderExpanderWithoutShadowAptitude.class.st index 8ff90c1ee..de1e714c2 100644 --- a/src/GToolkit-Coder-UI/GtCoderExpanderWithoutShadowAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExpanderWithoutShadowAptitude.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderExpanderWithoutShadowAptitude', - #superclass : 'BrExpanderAptitude', + #name : #GtCoderExpanderWithoutShadowAptitude, + #superclass : #BrExpanderAptitude, #instVars : [ 'sidebar', 'toggle', @@ -16,70 +16,70 @@ Class { #category : 'GToolkit-Coder-UI-Looks' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExpanderWithoutShadowAptitude >> borderFocusedPaint [ ^ borderFocusedPaint ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExpanderWithoutShadowAptitude >> borderFocusedPaint: aPaintOrColor [ borderFocusedPaint := aPaintOrColor ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExpanderWithoutShadowAptitude >> borderPaint [ ^ borderPaint ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExpanderWithoutShadowAptitude >> borderPaint: aPaintOrColor [ borderPaint := aPaintOrColor ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExpanderWithoutShadowAptitude >> borderWidth [ ^ borderWidth ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExpanderWithoutShadowAptitude >> borderWidth: anInteger [ borderWidth := anInteger ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExpanderWithoutShadowAptitude >> cornerRadius [ ^ cornerRadius ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExpanderWithoutShadowAptitude >> cornerRadius: aNumber [ cornerRadius := aNumber ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderExpanderWithoutShadowAptitude >> defaultBorderPaint [ ^ self theme default lightBorderColor ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderExpanderWithoutShadowAptitude >> defaultFocusedBorderPaint [ ^ (self theme default primaryBorderColor alpha: 0.4) gtOpaqueColorOnWhite ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExpanderWithoutShadowAptitude >> expandedBorderWidth [ ^ expandedBorderWidth ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExpanderWithoutShadowAptitude >> expandedBorderWidth: aNumber [ expandedBorderWidth := aNumber ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderExpanderWithoutShadowAptitude >> initialize [ | aTriangle | super initialize. @@ -131,7 +131,7 @@ GtCoderExpanderWithoutShadowAptitude >> initialize [ with: [ BlRoundedRectangleGeometry cornerRadius: self cornerRadius ] ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderExpanderWithoutShadowAptitude >> newCollapsedTriangleGeometry [ ^ BlPolygon vertices: { (0 @ 0). @@ -140,7 +140,7 @@ GtCoderExpanderWithoutShadowAptitude >> newCollapsedTriangleGeometry [ } ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderExpanderWithoutShadowAptitude >> newExpandedTriangleGeometry [ ^ BlPolygon vertices: { (0 @ 0). @@ -149,7 +149,7 @@ GtCoderExpanderWithoutShadowAptitude >> newExpandedTriangleGeometry [ } ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderExpanderWithoutShadowAptitude >> newSidebar [ ^ BlElement new layout: BlLinearLayout vertical; @@ -159,7 +159,7 @@ GtCoderExpanderWithoutShadowAptitude >> newSidebar [ background: Color veryVeryLightGray ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderExpanderWithoutShadowAptitude >> newToggle [ ^ BlElement new id: GtSourceCoderExpanderToggleId; @@ -175,7 +175,7 @@ GtCoderExpanderWithoutShadowAptitude >> newToggle [ self dispatchEvent: BrExpansionToggleWish new ] ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderExpanderWithoutShadowAptitude >> newTriangle [ ^ BlElement new size: 8 @ 8; @@ -183,18 +183,18 @@ GtCoderExpanderWithoutShadowAptitude >> newTriangle [ constraintsDo: [ :c | c linear vertical alignTop ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExpanderWithoutShadowAptitude >> padding [ ^ padding ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExpanderWithoutShadowAptitude >> padding: aBlInsets [ padding := aBlInsets. container padding: aBlInsets ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExpanderWithoutShadowAptitude >> resizableElementsDo: aBlock [ super resizableElementsDo: aBlock. aBlock value: container diff --git a/src/GToolkit-Coder-UI/GtCoderFilterList.class.st b/src/GToolkit-Coder-UI/GtCoderFilterList.class.st index ddc436431..7b05a43f3 100644 --- a/src/GToolkit-Coder-UI/GtCoderFilterList.class.st +++ b/src/GToolkit-Coder-UI/GtCoderFilterList.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtCoderFilterList', - #superclass : 'BrSimpleList', + #name : #GtCoderFilterList, + #superclass : #BrSimpleList, #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'initialization' } +{ #category : #initialization } GtCoderFilterList >> initialize [ super initialize. self @@ -22,7 +22,7 @@ GtCoderFilterList >> initialize [ self vFitContent. ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderFilterList >> items: anItemCollection title: aTitleBlock action: anActionBlock [ | anActionCollection | anActionCollection := anItemCollection collect: [ :eachItem | @@ -33,7 +33,7 @@ GtCoderFilterList >> items: anItemCollection title: aTitleBlock action: anAction self items: anActionCollection. ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtCoderFilterList >> onSelectionChanged: anEvent [ self selectedItemDo: [ :anItem | anEvent consumed: true. diff --git a/src/GToolkit-Coder-UI/GtCoderFilterListItem.class.st b/src/GToolkit-Coder-UI/GtCoderFilterListItem.class.st index a4604bb0a..bbe58da5e 100644 --- a/src/GToolkit-Coder-UI/GtCoderFilterListItem.class.st +++ b/src/GToolkit-Coder-UI/GtCoderFilterListItem.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderFilterListItem', - #superclass : 'BrHorizontalPane', + #name : #GtCoderFilterListItem, + #superclass : #BrHorizontalPane, #instVars : [ 'item', 'title', @@ -9,37 +9,37 @@ Class { #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtCoderFilterListItem >> actOnEvent: anEvent [ self action cull: self item cull: self cull: anEvent ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderFilterListItem >> action [ ^ action ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderFilterListItem >> action: anObject [ action := anObject ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderFilterListItem >> item [ ^ item ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderFilterListItem >> item: anObject [ item := anObject ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderFilterListItem >> title [ ^ title cull: self item cull: self ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderFilterListItem >> title: anObject [ title := anObject ] diff --git a/src/GToolkit-Coder-UI/GtCoderFilterListItemElement.class.st b/src/GToolkit-Coder-UI/GtCoderFilterListItemElement.class.st index e12ea4098..d8895d846 100644 --- a/src/GToolkit-Coder-UI/GtCoderFilterListItemElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderFilterListItemElement.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderFilterListItemElement', - #superclass : 'BrHorizontalPane', + #name : #GtCoderFilterListItemElement, + #superclass : #BrHorizontalPane, #instVars : [ 'item', 'labelElement' @@ -8,7 +8,7 @@ Class { #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'initialization' } +{ #category : #initialization } GtCoderFilterListItemElement >> initialize [ super initialize. @@ -18,25 +18,25 @@ GtCoderFilterListItemElement >> initialize [ self vFitContent. ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderFilterListItemElement >> item [ ^ item ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderFilterListItemElement >> item: anObject [ item == anObject ifTrue: [ ^ self ]. item := anObject. self onItemChanged. ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderFilterListItemElement >> newLabelElement [ ^ BrLabel new aptitude: BrGlamorousLabelAptitude ] -{ #category : 'private - hooks' } +{ #category : #'private - hooks' } GtCoderFilterListItemElement >> onItemChanged [ labelElement text: self item title ] diff --git a/src/GToolkit-Coder-UI/GtCoderModel.extension.st b/src/GToolkit-Coder-UI/GtCoderModel.extension.st index 03a9f8397..e11830871 100644 --- a/src/GToolkit-Coder-UI/GtCoderModel.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderModel.extension.st @@ -1,21 +1,21 @@ -Extension { #name : 'GtCoderModel' } +Extension { #name : #GtCoderModel } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtCoderModel >> asCoderUIModel [ ^ self subclassResponsibility ] -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtCoderModel >> asCoderViewModel [ ^ self asCoderUIModel ] -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtCoderModel >> asElement [ ^ self asCoderUIModel asElement ] -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtCoderModel >> asExpandedOnlyElement [ "Create an element for just the expanded coder without expander" @@ -24,24 +24,24 @@ GtCoderModel >> asExpandedOnlyElement [ yourself ] -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtCoderModel >> coderLook [ ^ (self attributeNamed: #coderLook ifAbsent: [ nil ]) value ] -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtCoderModel >> coderLook: aLookOrBlock [ self attributeNamed: #coderLook put: aLookOrBlock ] -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtCoderModel >> defaultCoderLook [ ^ nil ] -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtCoderModel >> elementClass [ ^ GtExpandableSourceCoderElement ] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassHierachyElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassHierachyElement.class.st index 52fe25b64..834d11849 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassHierachyElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassHierachyElement.class.st @@ -1,16 +1,16 @@ Class { - #name : 'GtCoderNavigationClassHierachyElement', - #superclass : 'GtCoderNavigationElement', + #name : #GtCoderNavigationClassHierachyElement, + #superclass : #GtCoderNavigationElement, #category : 'GToolkit-Coder-UI-Navigation' } -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationClassHierachyElement >> initializeElement [ super initializeElement. self addChild: classesList ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationClassHierachyElement >> initializeLayout [ super initializeLayout. self layout: BlLinearLayout vertical. @@ -19,7 +19,7 @@ GtCoderNavigationClassHierachyElement >> initializeLayout [ c vertical matchParent ]. ] -{ #category : 'subscriptions' } +{ #category : #subscriptions } GtCoderNavigationClassHierachyElement >> onClassModified: anAnnouncement [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -29,7 +29,7 @@ GtCoderNavigationClassHierachyElement >> onClassModified: anAnnouncement [ tag: anAnnouncement tag ] ] -{ #category : 'subscriptions' } +{ #category : #subscriptions } GtCoderNavigationClassHierachyElement >> onClassRenamed: anAnnouncement [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -41,7 +41,7 @@ GtCoderNavigationClassHierachyElement >> onClassRenamed: anAnnouncement [ tag: anAnnouncement tag ] ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationClassHierachyElement >> onClassSelected: anAnnouncement [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -49,7 +49,7 @@ GtCoderNavigationClassHierachyElement >> onClassSelected: anAnnouncement [ self selectClass: anAnnouncement theClass ]. ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationClassHierachyElement >> onPackageSelected: anAnnouncer [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -57,7 +57,7 @@ GtCoderNavigationClassHierachyElement >> onPackageSelected: anAnnouncer [ self deselectClasses. ] ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationClassHierachyElement >> onPackageTagSelected: anAnnouncer [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -65,7 +65,7 @@ GtCoderNavigationClassHierachyElement >> onPackageTagSelected: anAnnouncer [ self deselectClasses. ]. ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationClassHierachyElement >> onPackagesSelected: anAnnouncer [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -73,13 +73,13 @@ GtCoderNavigationClassHierachyElement >> onPackagesSelected: anAnnouncer [ self deselectClasses. ] ] -{ #category : 'subscriptions' } +{ #category : #subscriptions } GtCoderNavigationClassHierachyElement >> subscribeToContent [ super subscribeToContent. self subscribeToClassList. ] -{ #category : 'subscriptions' } +{ #category : #subscriptions } GtCoderNavigationClassHierachyElement >> subscribeToNavigationModel [ self hasNavigationModel ifFalse: [ ^ self ]. super subscribeToNavigationModel. @@ -88,7 +88,7 @@ GtCoderNavigationClassHierachyElement >> subscribeToNavigationModel [ navigationModel when: GtCoderNavigationPackageTagSelected send: #onPackageTagSelected: to: self. ] -{ #category : 'updating lists' } +{ #category : #'updating lists' } GtCoderNavigationClassHierachyElement >> updateClassLists [ self hasNavigationModel ifFalse: [ ^ self ]. navigationModel hasSelectedClass @@ -96,12 +96,12 @@ GtCoderNavigationClassHierachyElement >> updateClassLists [ ifFalse: [ self emptyClassList ]. ] -{ #category : 'updating lists' } +{ #category : #'updating lists' } GtCoderNavigationClassHierachyElement >> updateClassListsWith: aClass [ classesList initializeWithHierachyForClass: aClass. ] -{ #category : 'updating lists' } +{ #category : #'updating lists' } GtCoderNavigationClassHierachyElement >> updateContent [ self updateClassLists. self updateSelectedClass diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st index 8e7cdfbb6..192f6d552 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st @@ -4,20 +4,20 @@ I show a list of classes grouping them based on the inheritance hierarchy and so " Class { - #name : 'GtCoderNavigationClassesHierarchyTreeElement', - #superclass : 'BrSimpleTree', + #name : #GtCoderNavigationClassesHierarchyTreeElement, + #superclass : #BrSimpleTree, #instVars : [ 'classesTree' ], #category : 'GToolkit-Coder-UI-Navigation' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtCoderNavigationClassesHierarchyTreeElement class >> fromClasses: aCollectionOfClasses [ ^ self new initializeWithClasses: aCollectionOfClasses ] -{ #category : 'private - ui' } +{ #category : #'private - ui' } GtCoderNavigationClassesHierarchyTreeElement >> expandClass: aClass [ | aClassDepth | aClassDepth := 0. @@ -26,7 +26,7 @@ GtCoderNavigationClassesHierarchyTreeElement >> expandClass: aClass [ self expandUpTo: aClassDepth + 1 ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationClassesHierarchyTreeElement >> initialize [ super initialize. @@ -51,7 +51,7 @@ GtCoderNavigationClassesHierarchyTreeElement >> initialize [ aText ]) ] ] -{ #category : 'api - initialization' } +{ #category : #'api - initialization' } GtCoderNavigationClassesHierarchyTreeElement >> initializeWithClasses: aCollectionOfClasses [ classesTree := (GtCoderClassesHierarchyTree fromClasses: aCollectionOfClasses) sortByClassName. @@ -61,7 +61,7 @@ GtCoderNavigationClassesHierarchyTreeElement >> initializeWithClasses: aCollecti self expandAll ] -{ #category : 'api - initialization' } +{ #category : #'api - initialization' } GtCoderNavigationClassesHierarchyTreeElement >> initializeWithHierachyForClass: aClass [ classesTree := (GtCoderGrowingClassesHierarchyTree hierarchyForClass: aClass) sortByClassName. @@ -71,14 +71,14 @@ GtCoderNavigationClassesHierarchyTreeElement >> initializeWithHierachyForClass: self expandAll ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtCoderNavigationClassesHierarchyTreeElement >> selectedClass [ self selectedNodeDo: [ :aNode | ^ aNode value rootClass ]. ^ nil ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtCoderNavigationClassesHierarchyTreeElement >> selectedIndice [ "Return selected indice or zero" diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassesListElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassesListElement.class.st index d388d9197..eaee18d05 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassesListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassesListElement.class.st @@ -4,19 +4,19 @@ I show a simple list of classes sorting alphabetically " Class { - #name : 'GtCoderNavigationClassesListElement', - #superclass : 'BrSimpleList', + #name : #GtCoderNavigationClassesListElement, + #superclass : #BrSimpleList, #traits : 'TGtCoderNavigationClassesHelper', #classTraits : 'TGtCoderNavigationClassesHelper classTrait', #category : 'GToolkit-Coder-UI-Navigation' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtCoderNavigationClassesListElement class >> fromClasses: aCollectionOfClasses [ ^ self new initializeWithClasses: aCollectionOfClasses ] -{ #category : 'private - ui' } +{ #category : #'private - ui' } GtCoderNavigationClassesListElement >> buildClassLabel: aClass [ | aLook aText | aLook := (BrGlamorousLabelAptitude new fontSize: 12). @@ -36,7 +36,7 @@ GtCoderNavigationClassesListElement >> buildClassLabel: aClass [ text: aText. ] -{ #category : 'private - ui' } +{ #category : #'private - ui' } GtCoderNavigationClassesListElement >> buildClassRow: aClass index: aRowIndex list: aListElement [ ^ BrWidgetContainer new layout: BlLinearLayout horizontal; @@ -66,14 +66,14 @@ GtCoderNavigationClassesListElement >> buildClassRow: aClass index: aRowIndex li addChild: (self buildClassLabel: aClass) ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationClassesListElement >> initialize [ super initialize. self stencil: [ :eachClass :eachIndex :aListElement | self buildClassRow: eachClass index: eachIndex list: aListElement ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationClassesListElement >> initializeWithClasses: aCollectionOfClasses [ self items: (aCollectionOfClasses sorted: [ :classA :classB | classA name < classB name ]) ] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st index b7feadf37..5a01cbe6d 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderNavigationElement', - #superclass : 'BlElement', + #name : #GtCoderNavigationElement, + #superclass : #BlElement, #instVars : [ 'navigationModel', 'supressNavigationChanges', @@ -10,30 +10,30 @@ Class { #category : 'GToolkit-Coder-UI-Navigation' } -{ #category : 'asserting' } +{ #category : #asserting } GtCoderNavigationElement >> assertNavigationModel: aGtCoderNavigationPackagesTagsClassesModel [ self assert: [ aGtCoderNavigationPackagesTagsClassesModel isNotNil ] description: [ 'Navigation model must be non-nil' ]. ] -{ #category : 'api - class selections' } +{ #category : #'api - class selections' } GtCoderNavigationElement >> deselectClasses [ classesList deselectAll ] -{ #category : 'updating lists' } +{ #category : #'updating lists' } GtCoderNavigationElement >> emptyClassList [ classesList initializeWithClasses: #(). ] -{ #category : 'testing' } +{ #category : #testing } GtCoderNavigationElement >> hasNavigationModel [ ^ self navigationModel isNotNil and: [ self navigationModel isNavigationModel ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationElement >> initialize [ super initialize. supressListChanges := false. @@ -43,29 +43,29 @@ GtCoderNavigationElement >> initialize [ self initializeElement. ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationElement >> initializeContent [ classesList := GtCoderNavigationClassesHierarchyTreeElement new. ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationElement >> initializeElement [ "subclasses may initialize element" ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationElement >> initializeLayout [ "subclasses may define its layout" ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationElement >> navigationModel [ ^ navigationModel ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationElement >> navigationModel: aGtCoderNavigationPackagesTagsClassesModel [ self assertNavigationModel: aGtCoderNavigationPackagesTagsClassesModel. self unsubscribeFromNavigationModel. @@ -73,7 +73,7 @@ GtCoderNavigationElement >> navigationModel: aGtCoderNavigationPackagesTagsClass self onNavigationModelChanged. ] -{ #category : 'hooks - children' } +{ #category : #'hooks - children' } GtCoderNavigationElement >> onAddedToSceneGraph [ super onAddedToSceneGraph. self updateContent. @@ -81,7 +81,7 @@ GtCoderNavigationElement >> onAddedToSceneGraph [ self subscribeToContent. ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationElement >> onClassListSelectionChanged [ | anIndex aSelectedItem theIndices | supressListChanges ifTrue: [ ^ self ]. @@ -94,7 +94,7 @@ GtCoderNavigationElement >> onClassListSelectionChanged [ self navigationModel selectClass: aSelectedItem ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationElement >> onClassModified: anAnnouncement [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -104,7 +104,7 @@ GtCoderNavigationElement >> onClassModified: anAnnouncement [ tag: anAnnouncement tag ] ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationElement >> onClassRenamed: anAnnouncement [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -116,7 +116,7 @@ GtCoderNavigationElement >> onClassRenamed: anAnnouncement [ tag: anAnnouncement tag ] ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationElement >> onClassSelected: anAnnouncement [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -126,7 +126,7 @@ GtCoderNavigationElement >> onClassSelected: anAnnouncement [ tag: anAnnouncement tag ]. ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationElement >> onNavigationModelChanged [ "subclasses may perform actions on navigation model changes" self isAttachedToSceneGraph ifFalse: [ ^ self ]. @@ -134,14 +134,14 @@ GtCoderNavigationElement >> onNavigationModelChanged [ self updateContent. ] -{ #category : 'hooks - children' } +{ #category : #'hooks - children' } GtCoderNavigationElement >> onRemovedFromSceneGraph [ super onRemovedFromSceneGraph. self unsuscribeFromContent. self unsubscribeFromNavigationModel. ] -{ #category : 'api - class updates' } +{ #category : #'api - class updates' } GtCoderNavigationElement >> renameClass: aClass oldName: anOldName newName: aNewName inPackage: aPackage tag: aTag [ classesList viewModel @@ -152,14 +152,14 @@ GtCoderNavigationElement >> renameClass: aClass oldName: anOldName newName: aNew self updateSelectedClass ]. ] -{ #category : 'private - selection' } +{ #category : #'private - selection' } GtCoderNavigationElement >> scrollIndexFrom: aNodeIndex [ "TODO: does not work if an index is at a bottom: aNodeIndex - 5 max: 1" ^ aNodeIndex ] -{ #category : 'private - selection' } +{ #category : #'private - selection' } GtCoderNavigationElement >> scrollIndexFromPrevious: aPreviousIndex current: aNewIndex max: aNumberOfItems [ ^ (aPreviousIndex isZero or: [ aPreviousIndex >= aNewIndex ]) @@ -167,7 +167,7 @@ GtCoderNavigationElement >> scrollIndexFromPrevious: aPreviousIndex current: aNe ifFalse: [ aNewIndex + 5 min: aNumberOfItems ]. ] -{ #category : 'api - class selections' } +{ #category : #'api - class selections' } GtCoderNavigationElement >> selectClass: aClass [ | aPreviousIndex | aPreviousIndex := classesList selectedIndice. @@ -183,18 +183,18 @@ GtCoderNavigationElement >> selectClass: aClass [ max: classesList viewModel itemCount) ] ] -{ #category : 'subscriptions' } +{ #category : #subscriptions } GtCoderNavigationElement >> subscribeToClassList [ classesList when: BrSelectionChanged do: [ :anEvent | self onClassListSelectionChanged ]. ] -{ #category : 'subscriptions' } +{ #category : #subscriptions } GtCoderNavigationElement >> subscribeToContent [ ] -{ #category : 'subscriptions' } +{ #category : #subscriptions } GtCoderNavigationElement >> subscribeToNavigationModel [ self hasNavigationModel ifFalse: [ ^ self ]. navigationModel when: GtCoderNavigationClassSelected send: #onClassSelected: to: self. @@ -202,7 +202,7 @@ GtCoderNavigationElement >> subscribeToNavigationModel [ navigationModel when: GtCoderNavigationClassModified send: #onClassModified: to: self. ] -{ #category : 'subscriptions' } +{ #category : #subscriptions } GtCoderNavigationElement >> suppressListChangeEventsDuring: aBlock [ | anOldValue | anOldValue := supressListChanges. @@ -210,7 +210,7 @@ GtCoderNavigationElement >> suppressListChangeEventsDuring: aBlock [ aBlock ensure: [ supressListChanges := anOldValue ]. ] -{ #category : 'subscriptions' } +{ #category : #subscriptions } GtCoderNavigationElement >> suppressNavigationChangeEventsDuring: aBlock [ | anOldValue | anOldValue := supressNavigationChanges. @@ -218,17 +218,17 @@ GtCoderNavigationElement >> suppressNavigationChangeEventsDuring: aBlock [ aBlock ensure: [ supressNavigationChanges := anOldValue ]. ] -{ #category : 'subscriptions' } +{ #category : #subscriptions } GtCoderNavigationElement >> unsubscribeFromNavigationModel [ self hasNavigationModel ifFalse: [ ^ self ]. navigationModel ifNotNil: [ :aModel | aModel unsubscribe: self ]. ] -{ #category : 'subscriptions' } +{ #category : #subscriptions } GtCoderNavigationElement >> unsuscribeFromContent [ ] -{ #category : 'api - class updates' } +{ #category : #'api - class updates' } GtCoderNavigationElement >> updateClass: aClass inPackage: aPackage tag: aTag [ classesList viewModel @@ -239,16 +239,16 @@ GtCoderNavigationElement >> updateClass: aClass inPackage: aPackage tag: aTag [ self updateSelectedClass ]. ] -{ #category : 'updating lists' } +{ #category : #'updating lists' } GtCoderNavigationElement >> updateClassLists [ "Update class list" ] -{ #category : 'updating' } +{ #category : #updating } GtCoderNavigationElement >> updateContent [ ] -{ #category : 'updating lists' } +{ #category : #'updating lists' } GtCoderNavigationElement >> updateSelectedClass [ self hasNavigationModel ifFalse: [ ^ self ]. navigationModel selectedClassDo: [ :aClass | diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationMethodProtocolListElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationMethodProtocolListElement.class.st index 98ff43b07..dba2554a6 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationMethodProtocolListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationMethodProtocolListElement.class.st @@ -1,15 +1,15 @@ Class { - #name : 'GtCoderNavigationMethodProtocolListElement', - #superclass : 'BrSimpleList', + #name : #GtCoderNavigationMethodProtocolListElement, + #superclass : #BrSimpleList, #category : 'GToolkit-Coder-UI-Navigation' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtCoderNavigationMethodProtocolListElement class >> fromClass: aClass [ ^ self new initializeWithClass: aClass ] -{ #category : 'private - ui' } +{ #category : #'private - ui' } GtCoderNavigationMethodProtocolListElement >> buildProtocolLabel: aProtocol [ ^ BrLabel new aptitude: BrGlamorousLabelAptitude; @@ -17,7 +17,7 @@ GtCoderNavigationMethodProtocolListElement >> buildProtocolLabel: aProtocol [ text: aProtocol name ] -{ #category : 'private - ui' } +{ #category : #'private - ui' } GtCoderNavigationMethodProtocolListElement >> buildProtocolRow: aProtocol index: aRowIndex list: aListElement [ ^ BrWidgetContainer new layout: BlLinearLayout horizontal; @@ -47,19 +47,19 @@ GtCoderNavigationMethodProtocolListElement >> buildProtocolRow: aProtocol index: addChild: (self buildProtocolLabel: aProtocol) ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationMethodProtocolListElement >> initialize [ super initialize. self stencil: [ :eachProtocol :eachIndex :aListElement | self buildProtocolRow: eachProtocol index: eachIndex list: aListElement ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationMethodProtocolListElement >> initializeWithClass: aClass [ self initializeWithProtocols: aClass organization allProtocols ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationMethodProtocolListElement >> initializeWithProtocols: aCollection [ self items: (aCollection sorted: [ :protocolA :protocolB | protocolA name < protocolB name ]) ] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationModelElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationModelElement.class.st index f9d4eea17..1b61e7643 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationModelElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationModelElement.class.st @@ -6,15 +6,15 @@ See my {{gtClass:GtCoderNavigationModelElement|expanded|show=#gtSubclassesFor:}} " Class { - #name : 'GtCoderNavigationModelElement', - #superclass : 'GtCoderElement', + #name : #GtCoderNavigationModelElement, + #superclass : #GtCoderElement, #instVars : [ 'navigationModel' ], #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'private - asserting' } +{ #category : #'private - asserting' } GtCoderNavigationModelElement >> assertNavigationModel: aGtCoderNavigationModel [ self assert: [ aGtCoderNavigationModel isNotNil ] @@ -25,12 +25,12 @@ GtCoderNavigationModelElement >> assertNavigationModel: aGtCoderNavigationModel ] -{ #category : 'defaults' } +{ #category : #defaults } GtCoderNavigationModelElement >> defaultNavigationModel [ ^ GtCoderNavigationModel null ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationModelElement >> initialize [ super initialize. navigationModel := self defaultNavigationModel. @@ -38,7 +38,7 @@ GtCoderNavigationModelElement >> initialize [ ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationModelElement >> initializeListeners [ self when: GtCoderToReplace @@ -53,13 +53,13 @@ GtCoderNavigationModelElement >> initializeListeners [ do: [ :anEvent | self spawnInSpaceFrom: anEvent ]. ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderNavigationModelElement >> navigationModel [ ^ navigationModel ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderNavigationModelElement >> navigationModel: aGtCoderNavigationModel [ navigationModel = aGtCoderNavigationModel ifTrue: [ ^ self ]. self assertNavigationModel: aGtCoderNavigationModel. @@ -69,42 +69,42 @@ GtCoderNavigationModelElement >> navigationModel: aGtCoderNavigationModel [ self onNavigationModelChanged. ] -{ #category : 'private - hooks' } +{ #category : #'private - hooks' } GtCoderNavigationModelElement >> onNavigationModelChanged [ "Subclasses can react to navigation model changes." ] -{ #category : 'api - updating' } +{ #category : #'api - updating' } GtCoderNavigationModelElement >> pushCoder: aCoderOrCoders [ self assertNavigationModel: self navigationModel. self navigationModel selectCoder: aCoderOrCoders ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtCoderNavigationModelElement >> replaceFrom: aGtCoderToReplaceEvent [ aGtCoderToReplaceEvent consumed: true. self pushCoder: aGtCoderToReplaceEvent coder ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtCoderNavigationModelElement >> spawnFrom: aGtCoderToSpawnEvent [ aGtCoderToSpawnEvent consumed: true. self phlow spawnTool: (GtReadyCoderTool coder: (aGtCoderToSpawnEvent coder)) ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtCoderNavigationModelElement >> spawnInSpaceFrom: aGtCoderToSpawnInSpaceEvent [ aGtCoderToSpawnInSpaceEvent consumed: true. ] -{ #category : 'private - subscriptions' } +{ #category : #'private - subscriptions' } GtCoderNavigationModelElement >> subscribeToNavigationModel [ "Subclasses can subscribe to the navigation model" ] -{ #category : 'private - subscriptions' } +{ #category : #'private - subscriptions' } GtCoderNavigationModelElement >> unsubscribeFromNavigationModel [ self navigationModel = GtCoderNavigationModel null ifTrue: [ ^ self ]. self navigationModel unsubscribe: self. diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 99c49a852..3450e70f3 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderNavigationPackagesTagsClassesElement', - #superclass : 'GtCoderNavigationElement', + #name : #GtCoderNavigationPackagesTagsClassesElement, + #superclass : #GtCoderNavigationElement, #instVars : [ 'packagesList', 'classesLabel', @@ -12,7 +12,7 @@ Class { #category : 'GToolkit-Coder-UI-Navigation' } -{ #category : 'api - package updates' } +{ #category : #'api - package updates' } GtCoderNavigationPackagesTagsClassesElement >> addPackage: aPackage [ | aSelectedPackageOrTag | @@ -24,7 +24,7 @@ GtCoderNavigationPackagesTagsClassesElement >> addPackage: aPackage [ self selectPackageOrTag: aSelectedPackageOrTag ]. ] -{ #category : 'api - package updates' } +{ #category : #'api - package updates' } GtCoderNavigationPackagesTagsClassesElement >> addPackage: aPackage tag: aPackageTag [ | aSelectedPackageOrTag | @@ -36,17 +36,17 @@ GtCoderNavigationPackagesTagsClassesElement >> addPackage: aPackage tag: aPackag self selectPackageOrTag: aSelectedPackageOrTag ]. ] -{ #category : 'api - package selections' } +{ #category : #'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> deselectPackages [ packagesList deselectAll ] -{ #category : 'updating lists' } +{ #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> emptyMethodProtocolList [ methodProtocolsList initializeWithProtocols: #(). ] -{ #category : 'api - package selections' } +{ #category : #'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> expandPackage: aRPackage [ packagesList viewModel root allChildrenNodesBreadthFirstDo: [ :eachTreeNode | @@ -54,7 +54,7 @@ GtCoderNavigationPackagesTagsClassesElement >> expandPackage: aRPackage [ ifTrue: [ eachTreeNode expand ] ] ] -{ #category : 'private - testing' } +{ #category : #'private - testing' } GtCoderNavigationPackagesTagsClassesElement >> hasPackageTagsIn: aRPackage [ | noTags noExtensions | @@ -63,21 +63,21 @@ GtCoderNavigationPackagesTagsClassesElement >> hasPackageTagsIn: aRPackage [ ^ noTags not or: [ noExtensions not ] ] -{ #category : 'showing / hiding' } +{ #category : #'showing / hiding' } GtCoderNavigationPackagesTagsClassesElement >> hideClassList [ classAndMethodProtocolList visibility: BlVisibility gone. classesLabel visibility: BlVisibility gone. self layout columnCount: 1. ] -{ #category : 'showing / hiding' } +{ #category : #'showing / hiding' } GtCoderNavigationPackagesTagsClassesElement >> hideOrShowClassList [ classesList maxSelectionIndex isZero ifTrue: [ self hideClassList ] ifFalse: [ self showClassList ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> initializeContent [ super initializeContent. packagesList := GtCoderNavigationPackagesTreeElement new. @@ -94,7 +94,7 @@ GtCoderNavigationPackagesTagsClassesElement >> initializeContent [ addChild: methodProtocolsList. ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> initializeElement [ super initializeElement. self addChildren: { @@ -111,7 +111,7 @@ GtCoderNavigationPackagesTagsClassesElement >> initializeElement [ } ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> initializeLayout [ super initializeLayout. self layout: (BlGridLayout horizontal columnCount: 2; cellSpacing: 5). @@ -120,7 +120,7 @@ GtCoderNavigationPackagesTagsClassesElement >> initializeLayout [ c vertical matchParent ]. ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onMethodsCoderFiltersChanged: aGtCodersFiltersChanged [ aGtCodersFiltersChanged source = self ifTrue: [ ^ self ]. @@ -145,7 +145,7 @@ GtCoderNavigationPackagesTagsClassesElement >> onMethodsCoderFiltersChanged: aGt methodProtocolsList deselectAll ]. ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageListSelectionChanged [ | anIndex aSelectedItem theIndices | supressListChanges ifTrue: [ ^ self ]. @@ -160,14 +160,14 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackageListSelectionChanged [ ifFalse: [ self navigationModel selectTag: aSelectedItem ] ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageRegistered: anAnnouncement [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ self addPackage: anAnnouncement package ] ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageRenamed: anAnnouncement [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -177,7 +177,7 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackageRenamed: anAnnouncement newName: anAnnouncement newName ] ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageSelected: anAnnouncer [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -185,21 +185,21 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackageSelected: anAnnouncer [ self deselectClasses. ] ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageTagAdded: anAnnouncement [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ self addPackage: anAnnouncement package tag: anAnnouncement tag ] ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageTagRemoved: anAnnouncement [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ self removePackage: anAnnouncement package tag: anAnnouncement tag ] ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageTagSelected: anAnnouncer [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -209,14 +209,14 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackageTagSelected: anAnnouncer self deselectClasses. ]. ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageUnregistered: anAnnouncement [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ self removePackage: anAnnouncement package ] ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackagesSelected: anAnnouncer [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -224,7 +224,7 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackagesSelected: anAnnouncer [ self deselectClasses. ] ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onProtocolListSelectionChanged [ | anIndex aSelectedItem theIndices | supressListChanges ifTrue: [ ^ self ]. @@ -237,7 +237,7 @@ GtCoderNavigationPackagesTagsClassesElement >> onProtocolListSelectionChanged [ self navigationModel selectMethodProtocol: aSelectedItem source: self. ] -{ #category : 'api - package updates' } +{ #category : #'api - package updates' } GtCoderNavigationPackagesTagsClassesElement >> removePackage: aPackage [ | aSelectedPackageOrTag anIndex | @@ -251,7 +251,7 @@ GtCoderNavigationPackagesTagsClassesElement >> removePackage: aPackage [ self reselectPackageOrTag: aSelectedPackageOrTag afterRemovalOfPackageNamed: aPackage name. ] -{ #category : 'api - package updates' } +{ #category : #'api - package updates' } GtCoderNavigationPackagesTagsClassesElement >> removePackage: aPackage tag: aPackageTagName [ | aSelectedPackageOrTag anIndex | anIndex := packagesList viewModel indexOf: aPackage. @@ -262,7 +262,7 @@ GtCoderNavigationPackagesTagsClassesElement >> removePackage: aPackage tag: aPac self reselectPackageOrTag: aSelectedPackageOrTag afterRemovalOfTagNamed: aPackageTagName. ] -{ #category : 'api - package updates' } +{ #category : #'api - package updates' } GtCoderNavigationPackagesTagsClassesElement >> renamePackage: aPackage oldName: anOldName newName: aNewName [ | aSelectedPackageOrTag | @@ -274,7 +274,7 @@ GtCoderNavigationPackagesTagsClassesElement >> renamePackage: aPackage oldName: self selectPackageOrTag: aSelectedPackageOrTag ]. ] -{ #category : 'api - package reselections' } +{ #category : #'api - package reselections' } GtCoderNavigationPackagesTagsClassesElement >> reselectPackageOrTag: aSelectedPackageOrTag afterRemovalOfPackageNamed: aRemovedPackageOrTagName [ aSelectedPackageOrTag ifNotNil: [ self deselectPackages. @@ -285,7 +285,7 @@ GtCoderNavigationPackagesTagsClassesElement >> reselectPackageOrTag: aSelectedPa self selectPackageOrTag: aSelectedPackageOrTag ] ] ] -{ #category : 'api - package reselections' } +{ #category : #'api - package reselections' } GtCoderNavigationPackagesTagsClassesElement >> reselectPackageOrTag: aSelectedPackageOrTag afterRemovalOfTagNamed: aRemovedTagName [ aSelectedPackageOrTag ifNotNil: [ self deselectPackages. @@ -297,7 +297,7 @@ GtCoderNavigationPackagesTagsClassesElement >> reselectPackageOrTag: aSelectedPa self selectPackageOrTag: aSelectedPackageOrTag ] ] ] -{ #category : 'api - class selections' } +{ #category : #'api - class selections' } GtCoderNavigationPackagesTagsClassesElement >> selectClass: aClass inPackage: aPackage tag: aPackageTag [ (self selectedPackage ~= aPackage or: [ self selectedPackageTag ~= aPackageTag ]) @@ -305,7 +305,7 @@ GtCoderNavigationPackagesTagsClassesElement >> selectClass: aClass inPackage: aP self selectClass: aClass ] -{ #category : 'api - package selections' } +{ #category : #'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> selectPackage: aPackage [ | aPreviousIndex | aPreviousIndex := packagesList selectedIndice. @@ -323,7 +323,7 @@ GtCoderNavigationPackagesTagsClassesElement >> selectPackage: aPackage [ self hideOrShowClassList ] -{ #category : 'api - package selections' } +{ #category : #'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> selectPackage: aPackage tag: aPackageTag [ | aPreviousIndex | (self hasPackageTagsIn: aPackage) @@ -344,49 +344,49 @@ GtCoderNavigationPackagesTagsClassesElement >> selectPackage: aPackage tag: aPac self hideOrShowClassList ] -{ #category : 'api - package selections' } +{ #category : #'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> selectPackageOrTag: aPackageOrTag [ (aPackageOrTag isKindOf: RPackage) ifTrue: [ self selectPackage: aPackageOrTag ] ifFalse: [ self selectPackage: aPackageOrTag package tag: aPackageOrTag ] ] -{ #category : 'api - class selections' } +{ #category : #'api - class selections' } GtCoderNavigationPackagesTagsClassesElement >> selectedClass [ ^ classesList selectedClass ] -{ #category : 'api - package selections' } +{ #category : #'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> selectedPackage [ ^ packagesList selectedPackage ] -{ #category : 'api - package selections' } +{ #category : #'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> selectedPackageNodeDo: aBlock [ ^ packagesList selectedPackageNodeDo: aBlock ] -{ #category : 'api - package selections' } +{ #category : #'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> selectedPackageTag [ ^ packagesList selectedPackageTag ] -{ #category : 'api - package selections' } +{ #category : #'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> selectedPackageTagNodeDo: aBlock [ ^ packagesList selectedPackageTagNodeDo: aBlock ] -{ #category : 'showing / hiding' } +{ #category : #'showing / hiding' } GtCoderNavigationPackagesTagsClassesElement >> showClassList [ classAndMethodProtocolList visibility: BlVisibility visible. classesLabel visibility: BlVisibility visible. self layout columnCount: 2. ] -{ #category : 'subscriptions' } +{ #category : #subscriptions } GtCoderNavigationPackagesTagsClassesElement >> subscribeToContent [ super subscribeToContent. self subscribeToPackageList. @@ -394,7 +394,7 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToContent [ self subscribeToProtocolList. ] -{ #category : 'subscriptions' } +{ #category : #subscriptions } GtCoderNavigationPackagesTagsClassesElement >> subscribeToNavigationModel [ self hasNavigationModel ifFalse: [ ^ self ]. super subscribeToNavigationModel. @@ -409,21 +409,21 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToNavigationModel [ navigationModel when: GtCodersFiltersChanged send: #onMethodsCoderFiltersChanged: to: self. ] -{ #category : 'subscriptions' } +{ #category : #subscriptions } GtCoderNavigationPackagesTagsClassesElement >> subscribeToPackageList [ packagesList when: BrSelectionChanged do: [ :anEvent | self onPackageListSelectionChanged ]. ] -{ #category : 'subscriptions' } +{ #category : #subscriptions } GtCoderNavigationPackagesTagsClassesElement >> subscribeToProtocolList [ methodProtocolsList when: BrSelectionChanged do: [ :anEvent | self onProtocolListSelectionChanged ]. ] -{ #category : 'updating lists' } +{ #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updateClassLists [ self hasNavigationModel ifFalse: [ ^ self ]. classesList initializeWithClasses: navigationModel classesToShow. @@ -441,7 +441,7 @@ GtCoderNavigationPackagesTagsClassesElement >> updateClassLists [ methodProtocolsList visibility: BlVisibility gone. ] ] -{ #category : 'updating lists' } +{ #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updateContent [ self updatePackageAndClassLists. self updateSelectedPackageAndTag. @@ -449,19 +449,19 @@ GtCoderNavigationPackagesTagsClassesElement >> updateContent [ self hideOrShowClassList ] -{ #category : 'updating lists' } +{ #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updatePackageAndClassLists [ self updatePackageLists. self updateClassLists. ] -{ #category : 'updating lists' } +{ #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updatePackageLists [ self hasNavigationModel ifFalse: [ ^ self ]. packagesList initializeWithPackages: navigationModel packagesToShow. ] -{ #category : 'updating lists' } +{ #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updateSelectedPackageAndTag [ self hasNavigationModel ifFalse: [ ^ self ]. navigationModel hasSelectedPackage diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st index d4b689bd6..241d454c1 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st @@ -4,17 +4,17 @@ I show a simple list of packages sorting alphabetically " Class { - #name : 'GtCoderNavigationPackagesTreeElement', - #superclass : 'BrSimpleTree', + #name : #GtCoderNavigationPackagesTreeElement, + #superclass : #BrSimpleTree, #category : 'GToolkit-Coder-UI-Navigation' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtCoderNavigationPackagesTreeElement class >> fromPackages: aCollectionOfPackages [ ^ self new initializeWithPackages: aCollectionOfPackages ] -{ #category : 'private - enumeration' } +{ #category : #'private - enumeration' } GtCoderNavigationPackagesTreeElement >> childrenForPackageOrTag: aPackageOrTag [ | theTags anExtension | (aPackageOrTag isKindOf: RPackage) ifFalse: [ ^ #() ]. @@ -33,7 +33,7 @@ GtCoderNavigationPackagesTreeElement >> childrenForPackageOrTag: aPackageOrTag [ ^ theTags ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationPackagesTreeElement >> initialize [ super initialize. @@ -50,7 +50,7 @@ GtCoderNavigationPackagesTreeElement >> initialize [ ifNotNil: [ aPackage name ]) ] ] -{ #category : 'api - initialization' } +{ #category : #'api - initialization' } GtCoderNavigationPackagesTreeElement >> initializeWithPackages: aCollectionOfPackages [ | theSortedPackages | theSortedPackages := aCollectionOfPackages asArray @@ -62,7 +62,7 @@ GtCoderNavigationPackagesTreeElement >> initializeWithPackages: aCollectionOfPac [ :eachPackageOrTag | self childrenForPackageOrTag: eachPackageOrTag ] ] -{ #category : 'private - testing' } +{ #category : #'private - testing' } GtCoderNavigationPackagesTreeElement >> isTag: tagA lessThan: tagB [ tagA class = GtCoderPackageUncategorizedTag ifTrue: [ ^ true ]. tagB class = GtCoderPackageUncategorizedTag ifTrue: [ ^ false ]. @@ -70,7 +70,7 @@ GtCoderNavigationPackagesTreeElement >> isTag: tagA lessThan: tagB [ ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtCoderNavigationPackagesTreeElement >> selectedIndice [ "Return selected indice or zero" @@ -81,26 +81,26 @@ GtCoderNavigationPackagesTreeElement >> selectedIndice [ ^ 0 ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtCoderNavigationPackagesTreeElement >> selectedPackage [ ^ self selectedPackageNodeDo: #value ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtCoderNavigationPackagesTreeElement >> selectedPackageNodeDo: aBlock [ self selectedNodeDo: [ :aNode | aNode depth = 0 ifTrue: [ ^ aBlock cull: aNode ] ]. ^ nil ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtCoderNavigationPackagesTreeElement >> selectedPackageTag [ ^ self selectedPackageTagNodeDo: #value ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtCoderNavigationPackagesTreeElement >> selectedPackageTagNodeDo: aBlock [ self selectedNodeDo: [ :aNode | aNode depth = 1 ifTrue: [ ^ aBlock cull: aNode ] ]. diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index ae02cb259..c708e315c 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderNavigationTabsStencil', - #superclass : 'BrStencil', + #name : #GtCoderNavigationTabsStencil, + #superclass : #BrStencil, #instVars : [ 'navigations', 'navigationModel' @@ -8,27 +8,27 @@ Class { #category : 'GToolkit-Coder-UI-Navigation' } -{ #category : 'adding' } +{ #category : #adding } GtCoderNavigationTabsStencil >> addNavigation: aNavigationElement [ self assertNavigationView: aNavigationElement. self navigations: (self navigations copyWith: aNavigationElement) ] -{ #category : 'asserting' } +{ #category : #asserting } GtCoderNavigationTabsStencil >> assertNavigationModel: aGtCoderNavigationPackagesTagsClassesModel [ self assert: [ aGtCoderNavigationPackagesTagsClassesModel isNotNil ] description: [ 'Navigation model must be non-nil' ]. ] -{ #category : 'asserting' } +{ #category : #asserting } GtCoderNavigationTabsStencil >> assertNavigationView: aNavigationView [ self assert: [ aNavigationView isKindOf: GtPhlowProtoView ] description: [ 'Navigation must be kind of ', GtPhlowView name ]. ] -{ #category : 'api - instantiation' } +{ #category : #'api - instantiation' } GtCoderNavigationTabsStencil >> create [ ^ GtPhlowCompositeView new @@ -39,7 +39,7 @@ GtCoderNavigationTabsStencil >> create [ matchParent ] ] -{ #category : 'defaults' } +{ #category : #defaults } GtCoderNavigationTabsStencil >> defaultNavigations [ ^ GtPhlowViewsCollector new @@ -48,7 +48,7 @@ GtCoderNavigationTabsStencil >> defaultNavigations [ collect ] -{ #category : 'gt-extensions' } +{ #category : #'gt-extensions' } GtCoderNavigationTabsStencil >> gtClassHierarchyFor: aView [ self navigationModel ifNil: [ ^ aView empty ]. @@ -58,7 +58,7 @@ GtCoderNavigationTabsStencil >> gtClassHierarchyFor: aView [ stencil: [ GtCoderNavigationClassHierachyElement new navigationModel: self navigationModel ] ] -{ #category : 'gt-extensions' } +{ #category : #'gt-extensions' } GtCoderNavigationTabsStencil >> gtPackagesTagsClassesFor: aView [ self navigationModel ifNil: [ ^ aView empty ]. @@ -69,25 +69,25 @@ GtCoderNavigationTabsStencil >> gtPackagesTagsClassesFor: aView [ navigationModel: self navigationModel ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationTabsStencil >> navigationModel [ ^ navigationModel ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationTabsStencil >> navigationModel: aGtCoderNavigationPackagesTagsClassesModel [ self assertNavigationModel: aGtCoderNavigationPackagesTagsClassesModel. navigationModel := aGtCoderNavigationPackagesTagsClassesModel. ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationTabsStencil >> navigations [ ^ navigations ifNil: [ navigations := self defaultNavigations ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationTabsStencil >> navigations: anArrayOfPhlowViews [ navigations := anArrayOfPhlowViews ] diff --git a/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st b/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st index 3fb20c1fe..44feb7796 100644 --- a/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st @@ -7,8 +7,8 @@ I display {{gtClass:GtCoderContentElement}} and an embedded playground. " Class { - #name : 'GtCoderPlaygroundElement', - #superclass : 'GtCoderNavigationModelElement', + #name : #GtCoderPlaygroundElement, + #superclass : #GtCoderNavigationModelElement, #instVars : [ 'contentElement', 'playgroundElement' @@ -16,13 +16,13 @@ Class { #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoderPlaygroundElement >> contentElement [ ^ contentElement ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderPlaygroundElement >> initialize [ super initialize. @@ -35,12 +35,12 @@ GtCoderPlaygroundElement >> initialize [ self addChild: self playPageElement as: #playPage ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderPlaygroundElement >> initializeContentElement [ contentElement := GtCoderContentElement new. ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderPlaygroundElement >> initializePlayPageElement [ playgroundElement := (GtInspector environment at: GtInspector embeddedPlaygroundName) new. @@ -49,45 +49,45 @@ GtCoderPlaygroundElement >> initializePlayPageElement [ playgroundElement objectHolder: self objectHolder ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoderPlaygroundElement >> objectHolder [ ^ GtInspectorObject new object: self receiver ] -{ #category : 'private - hooks' } +{ #category : #'private - hooks' } GtCoderPlaygroundElement >> onClassSelected: anEvent [ self updatePlayground ] -{ #category : 'private - hooks' } +{ #category : #'private - hooks' } GtCoderPlaygroundElement >> onNavigationModelChanged [ super onNavigationModelChanged. self contentElement navigationModel: self navigationModel. self updatePlayground. ] -{ #category : 'private - hooks' } +{ #category : #'private - hooks' } GtCoderPlaygroundElement >> onPackageSelected: anEvent [ self updatePlayground ] -{ #category : 'private - hooks' } +{ #category : #'private - hooks' } GtCoderPlaygroundElement >> onPackageTagSelected: anEvent [ self updatePlayground ] -{ #category : 'private - hooks' } +{ #category : #'private - hooks' } GtCoderPlaygroundElement >> onPackagesSelected: anEvent [ self updatePlayground ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoderPlaygroundElement >> playPageElement [ ^ playgroundElement ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoderPlaygroundElement >> receiver [ self navigationModel selectedClassDo: [ :aClass | ^ aClass ]. self navigationModel selectedTagDo: [ :aPackageTag | ^ aPackageTag ]. @@ -95,7 +95,7 @@ GtCoderPlaygroundElement >> receiver [ ^ Smalltalk ] -{ #category : 'private - subscriptions' } +{ #category : #'private - subscriptions' } GtCoderPlaygroundElement >> subscribeToNavigationModel [ super subscribeToNavigationModel. self navigationModel weak @@ -105,7 +105,7 @@ GtCoderPlaygroundElement >> subscribeToNavigationModel [ when: GtCoderNavigationClassSelected send: #onClassSelected: to: self. ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtCoderPlaygroundElement >> updatePlayground [ self playPageElement objectHolder: self objectHolder ] diff --git a/src/GToolkit-Coder-UI/GtCoderPrintStringAttribute.class.st b/src/GToolkit-Coder-UI/GtCoderPrintStringAttribute.class.st index 032e8a827..bcb36635b 100644 --- a/src/GToolkit-Coder-UI/GtCoderPrintStringAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPrintStringAttribute.class.st @@ -1,27 +1,27 @@ Class { - #name : 'GtCoderPrintStringAttribute', - #superclass : 'BrTextAdornmentAttribute', + #name : #GtCoderPrintStringAttribute, + #superclass : #BrTextAdornmentAttribute, #instVars : [ 'object' ], #category : 'GToolkit-Coder-UI-Coder - Source Attributes' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtCoderPrintStringAttribute class >> forObject: anObject [ ^ self new object: anObject; yourself ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtCoderPrintStringAttribute class >> forString: aString [ ^ self new object: aString; yourself ] -{ #category : 'private' } +{ #category : #private } GtCoderPrintStringAttribute >> actionButtonLook [ ^ BrGlamorousButtonIconAptitude + BrGlamorousButtonLayoutAptitude + (BrStyleCommonAptitude new default: [ :aStyle | aStyle geometry: BlCircle new ]; @@ -29,7 +29,7 @@ GtCoderPrintStringAttribute >> actionButtonLook [ pressed: [ :aStyle | aStyle background: BrGlamorousColors neutralBackgroundColor darker darker ]) ] -{ #category : 'private' } +{ #category : #private } GtCoderPrintStringAttribute >> buildMenuFor: aHamburgerButton fromEditorElement: anEditorElement [ ^ BrVerticalPane new @@ -78,7 +78,7 @@ GtCoderPrintStringAttribute >> buildMenuFor: aHamburgerButton fromEditorElement: } ] -{ #category : 'private' } +{ #category : #private } GtCoderPrintStringAttribute >> buildTooltip [ ^ BrEditor new aptitude: BrGlamorousEditorAptitude new glamorousRegularSmallSize; @@ -91,17 +91,17 @@ GtCoderPrintStringAttribute >> buildTooltip [ 'Press ' asRopedText, 'backspace' asRopedText glamorousRoundedBackground, ' to remove this popup.' asRopedText ] -{ #category : 'private' } +{ #category : #private } GtCoderPrintStringAttribute >> closeMenuFromElement: anElement [ anElement fireEvent: BrDropdownHideWish new ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtCoderPrintStringAttribute >> copyFromEditorElement: anEditorElement [ Clipboard clipboardText: object printString ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderPrintStringAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ | hamburgerButton | @@ -149,13 +149,13 @@ GtCoderPrintStringAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditor exact: 12@12) ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderPrintStringAttribute >> initialize [ super initialize. self beAppend ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtCoderPrintStringAttribute >> insertIntoTheEditorElement: anEditorElement [ anEditorElement text findAttribute: self @@ -181,12 +181,12 @@ GtCoderPrintStringAttribute >> insertIntoTheEditorElement: anEditorElement [ anEditorElement requestFocus ] -{ #category : 'testing' } +{ #category : #testing } GtCoderPrintStringAttribute >> isFocusable [ ^ true ] -{ #category : 'private' } +{ #category : #private } GtCoderPrintStringAttribute >> menuButtonLook [ ^ (BrGlamorousButtonRectangularAptitude new cornerRadius: 0) + BrGlamorousButtonIconAptitude @@ -194,12 +194,12 @@ GtCoderPrintStringAttribute >> menuButtonLook [ + BrGlamorousListItemAptitude ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderPrintStringAttribute >> object: anObject [ object := anObject ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtCoderPrintStringAttribute >> removeFromEditorElement: anEditorElement [ anEditorElement text findAttribute: self @@ -211,7 +211,7 @@ GtCoderPrintStringAttribute >> removeFromEditorElement: anEditorElement [ anEditorElement requestFocus ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtCoderPrintStringAttribute >> spawnFromElement: anElement [ anElement phlow spawnObject: object ] diff --git a/src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st b/src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st index 13a5a9073..83ead3802 100644 --- a/src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st +++ b/src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st @@ -1,13 +1,13 @@ Class { - #name : 'GtCoderSpotterStart', - #superclass : 'Object', + #name : #GtCoderSpotterStart, + #superclass : #Object, #instVars : [ 'navigationModelBlock' ], #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'searching' } +{ #category : #searching } GtCoderSpotterStart >> gtSpotterForClassMethodsInCurrentClassFor: aStep [ self navigationModel hasSelectedClass @@ -20,7 +20,7 @@ GtCoderSpotterStart >> gtSpotterForClassMethodsInCurrentClassFor: aStep [ wantsToDisplayOnEmptyQuery: true ] -{ #category : 'searching' } +{ #category : #searching } GtCoderSpotterStart >> gtSpotterForClassesFor: aStep [ aStep listProcessor @@ -33,7 +33,7 @@ GtCoderSpotterStart >> gtSpotterForClassesFor: aStep [ wantsToDisplayOnEmptyQuery: self navigationModel hasSelectedClass not ] -{ #category : 'searching' } +{ #category : #searching } GtCoderSpotterStart >> gtSpotterForInstanceMethodsInCurrentClassFor: aStep [ self navigationModel hasSelectedClass @@ -46,7 +46,7 @@ GtCoderSpotterStart >> gtSpotterForInstanceMethodsInCurrentClassFor: aStep [ wantsToDisplayOnEmptyQuery: true ] -{ #category : 'searching' } +{ #category : #searching } GtCoderSpotterStart >> gtSpotterForMessagesFor: aStep [ aStep listProcessor @@ -62,7 +62,7 @@ GtCoderSpotterStart >> gtSpotterForMessagesFor: aStep [ wantsToDisplayOnEmptyQuery: false ] -{ #category : 'searching' } +{ #category : #searching } GtCoderSpotterStart >> gtSpotterForPackagesFor: aStep [ aStep listProcessor @@ -75,7 +75,7 @@ GtCoderSpotterStart >> gtSpotterForPackagesFor: aStep [ wantsToDisplayOnEmptyQuery: self navigationModel hasSelectedPackage not ] -{ #category : 'searching' } +{ #category : #searching } GtCoderSpotterStart >> gtSpotterImplementorsFor: aStep [ self flag: #specialFilter. @@ -90,17 +90,17 @@ GtCoderSpotterStart >> gtSpotterImplementorsFor: aStep [ wantsToDisplayOnEmptyQuery: false ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderSpotterStart >> navigationModel [ ^ navigationModelBlock value ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderSpotterStart >> navigationModelBlock: aBlock [ navigationModelBlock := aBlock ] -{ #category : 'printing' } +{ #category : #printing } GtCoderSpotterStart >> printOn: aStream [ aStream nextPutAll: 'Spotter' ] diff --git a/src/GToolkit-Coder-UI/GtCoderToReplace.class.st b/src/GToolkit-Coder-UI/GtCoderToReplace.class.st index 5d53fe746..75af71889 100644 --- a/src/GToolkit-Coder-UI/GtCoderToReplace.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToReplace.class.st @@ -4,22 +4,22 @@ I am fired by inner coders to tell {{gtClass:GtCoder}} to replace its current co " Class { - #name : 'GtCoderToReplace', - #superclass : 'BlEvent', + #name : #GtCoderToReplace, + #superclass : #BlEvent, #instVars : [ 'coder' ], #category : 'GToolkit-Coder-UI-! Core' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderToReplace >> coder [ ^ coder ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderToReplace >> coder: aGtCoderModel [ coder := aGtCoderModel ] diff --git a/src/GToolkit-Coder-UI/GtCoderToSpawn.class.st b/src/GToolkit-Coder-UI/GtCoderToSpawn.class.st index c4d68324a..0c4672baa 100644 --- a/src/GToolkit-Coder-UI/GtCoderToSpawn.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToSpawn.class.st @@ -4,22 +4,22 @@ I am fired by inner coders to tell {{gtClass:GtCoder}} to spawn a new coder usin " Class { - #name : 'GtCoderToSpawn', - #superclass : 'BlEvent', + #name : #GtCoderToSpawn, + #superclass : #BlEvent, #instVars : [ 'coder' ], #category : 'GToolkit-Coder-UI-! Core' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderToSpawn >> coder [ ^ coder ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderToSpawn >> coder: aGtCoderModel [ coder := aGtCoderModel ] diff --git a/src/GToolkit-Coder-UI/GtCoderToSpawnInSpace.class.st b/src/GToolkit-Coder-UI/GtCoderToSpawnInSpace.class.st index fce2c694a..8090598fa 100644 --- a/src/GToolkit-Coder-UI/GtCoderToSpawnInSpace.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToSpawnInSpace.class.st @@ -4,7 +4,7 @@ I am fired by inner coders to tell {{gtClass:GtCoder}} to spawn a new coder in a " Class { - #name : 'GtCoderToSpawnInSpace', - #superclass : 'BlEvent', + #name : #GtCoderToSpawnInSpace, + #superclass : #BlEvent, #category : 'GToolkit-Coder-UI-! Core' } diff --git a/src/GToolkit-Coder-UI/GtCoderToggleAptitude.class.st b/src/GToolkit-Coder-UI/GtCoderToggleAptitude.class.st index 9f44f0d34..3473263dd 100644 --- a/src/GToolkit-Coder-UI/GtCoderToggleAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToggleAptitude.class.st @@ -1,15 +1,15 @@ Class { - #name : 'GtCoderToggleAptitude', - #superclass : 'BrMaterialToggleBackgroundAptitude', + #name : #GtCoderToggleAptitude, + #superclass : #BrMaterialToggleBackgroundAptitude, #category : 'GToolkit-Coder-UI-Looks' } -{ #category : 'initialization' } +{ #category : #initialization } GtCoderToggleAptitude >> defaultNormalBackground [ ^ Color transparent ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderToggleAptitude >> initialize [ | interactiveLook | super initialize. @@ -37,7 +37,7 @@ GtCoderToggleAptitude >> initialize [ yourself) ] -{ #category : 'private' } +{ #category : #private } GtCoderToggleAptitude >> updateActivatedBackground [ self widget isActivated ifTrue: [ self toggleActivated ] diff --git a/src/GToolkit-Coder-UI/GtCoderTool.class.st b/src/GToolkit-Coder-UI/GtCoderTool.class.st index 6c86c1ad0..337a9f711 100644 --- a/src/GToolkit-Coder-UI/GtCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtCoderTool.class.st @@ -1,32 +1,32 @@ Class { - #name : 'GtCoderTool', - #superclass : 'GtPhlowTool', + #name : #GtCoderTool, + #superclass : #GtPhlowTool, #category : 'GToolkit-Coder-UI-Tools' } -{ #category : 'converting' } +{ #category : #converting } GtCoderTool >> asElementDo: aOneArgBlock [ "Create a tool element and execute the block." ^ aOneArgBlock cull: self newCoder asPagerPageElement ] -{ #category : 'api - converting' } +{ #category : #'api - converting' } GtCoderTool >> icon [ ^ BrGlamorousVectorIcons browse ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderTool >> name [ ^ 'coder' ] -{ #category : 'converting' } +{ #category : #converting } GtCoderTool >> newCoder [ ^ self subclassResponsibility ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoderTool >> tabLook [ ^ BrGlamorousTabSwitcherWithIconAptitude ] diff --git a/src/GToolkit-Coder-UI/GtCoderToolViewModel.class.st b/src/GToolkit-Coder-UI/GtCoderToolViewModel.class.st index 7dd419e53..28e3ef62b 100644 --- a/src/GToolkit-Coder-UI/GtCoderToolViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToolViewModel.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderToolViewModel', - #superclass : 'Object', + #name : #GtCoderToolViewModel, + #superclass : #Object, #traits : 'TGtAnnouncer', #classTraits : 'TGtAnnouncer classTrait', #instVars : [ @@ -10,47 +10,47 @@ Class { #category : 'GToolkit-Coder-UI-! Core - View Models' } -{ #category : 'announcer' } +{ #category : #announcer } GtCoderToolViewModel >> announcer [ ^ announcer ifNil: [ announcer := Announcer new ] ] -{ #category : 'api - coder tool' } +{ #category : #'api - coder tool' } GtCoderToolViewModel >> canGoBack [ ^ coderViewModelsStack size > 1 ] -{ #category : 'api - coder tool' } +{ #category : #'api - coder tool' } GtCoderToolViewModel >> currentCoderViewModel [ ^ coderViewModelsStack top ] -{ #category : 'api - coder tool' } +{ #category : #'api - coder tool' } GtCoderToolViewModel >> hasCoderViewModel [ ^ coderViewModelsStack isNotEmpty ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderToolViewModel >> initialize [ super initialize. coderViewModelsStack := Stack new ] -{ #category : 'private - notifying' } +{ #category : #'private - notifying' } GtCoderToolViewModel >> notifyCoderViewModelPopped: aCoderViewModel [ self announce: (GtCoderToolViewModelCoderPopped new coderViewModel: aCoderViewModel) ] -{ #category : 'private - notifying' } +{ #category : #'private - notifying' } GtCoderToolViewModel >> notifyCoderViewModelPushed: aCoderViewModel [ self announce: (GtCoderToolViewModelCoderPushed new coderViewModel: aCoderViewModel) ] -{ #category : 'api - coder tool' } +{ #category : #'api - coder tool' } GtCoderToolViewModel >> popCoderViewModel [ | aPoppedCoder | @@ -61,7 +61,7 @@ GtCoderToolViewModel >> popCoderViewModel [ self notifyCoderViewModelPopped: aPoppedCoder ] -{ #category : 'api - coder tool' } +{ #category : #'api - coder tool' } GtCoderToolViewModel >> pushCoderViewModel: aCoderViewModel [ coderViewModelsStack push: aCoderViewModel. self notifyCoderViewModelPushed: aCoderViewModel diff --git a/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderPopped.class.st b/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderPopped.class.st index 99bcb2e55..dabd318a6 100644 --- a/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderPopped.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderPopped.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtCoderToolViewModelCoderPopped', - #superclass : 'GtCoderToolViewModelCoderStackChanged', + #name : #GtCoderToolViewModelCoderPopped, + #superclass : #GtCoderToolViewModelCoderStackChanged, #category : 'GToolkit-Coder-UI-! Core - View Models' } diff --git a/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderPushed.class.st b/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderPushed.class.st index a360f4f28..8d2527886 100644 --- a/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderPushed.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderPushed.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtCoderToolViewModelCoderPushed', - #superclass : 'GtCoderToolViewModelCoderStackChanged', + #name : #GtCoderToolViewModelCoderPushed, + #superclass : #GtCoderToolViewModelCoderStackChanged, #category : 'GToolkit-Coder-UI-! Core - View Models' } diff --git a/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderStackChanged.class.st b/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderStackChanged.class.st index c097c5472..769187382 100644 --- a/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderStackChanged.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderStackChanged.class.st @@ -1,18 +1,18 @@ Class { - #name : 'GtCoderToolViewModelCoderStackChanged', - #superclass : 'Announcement', + #name : #GtCoderToolViewModelCoderStackChanged, + #superclass : #Announcement, #instVars : [ 'coderViewModel' ], #category : 'GToolkit-Coder-UI-! Core - View Models' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderToolViewModelCoderStackChanged >> coderViewModel [ ^ coderViewModel ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderToolViewModelCoderStackChanged >> coderViewModel: anObject [ coderViewModel := anObject ] diff --git a/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st b/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st index a131ee193..90b8c9c35 100644 --- a/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st @@ -7,15 +7,15 @@ I display a {{gtClass:BrToolbar}}. " Class { - #name : 'GtCoderToolbarElement', - #superclass : 'GtCoderNavigationModelElement', + #name : #GtCoderToolbarElement, + #superclass : #GtCoderNavigationModelElement, #instVars : [ 'toolbarElement' ], #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'gt-extensions' } +{ #category : #'gt-extensions' } GtCoderToolbarElement >> addClassTab: look [ ^ BrTab new @@ -35,7 +35,7 @@ GtCoderToolbarElement >> addClassTab: look [ element ] ] -{ #category : 'gt-extensions' } +{ #category : #'gt-extensions' } GtCoderToolbarElement >> addPackageTab: look [ ^ BrTab new @@ -54,7 +54,7 @@ GtCoderToolbarElement >> addPackageTab: look [ element ] ] -{ #category : 'gt-extensions' } +{ #category : #'gt-extensions' } GtCoderToolbarElement >> addTraitTab: look [ ^ BrTab new @@ -74,7 +74,7 @@ GtCoderToolbarElement >> addTraitTab: look [ element ] ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtCoderToolbarElement >> browseFrom: anElement [ "Do we want to share the same coder model?" self navigationModel coderDo: [ :aCoder | @@ -83,7 +83,7 @@ GtCoderToolbarElement >> browseFrom: anElement [ maximized ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderToolbarElement >> initialize [ super initialize. self initializeToolbarElement. @@ -97,7 +97,7 @@ GtCoderToolbarElement >> initialize [ anyToFitContent: self toolbarElement) ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderToolbarElement >> initializeToolbarElement [ toolbarElement := BrToolbar new aptitude: BrGlamorousToolbarAptitude new; @@ -114,7 +114,7 @@ GtCoderToolbarElement >> initializeToolbarElement [ yourself ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderToolbarElement >> newAddButton [ | look | ^ BrButton new @@ -141,7 +141,7 @@ GtCoderToolbarElement >> newAddButton [ yourself ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderToolbarElement >> newAddInterface: look [ | contentTabs tabMethods | contentTabs := BrTabGroup new. @@ -158,7 +158,7 @@ GtCoderToolbarElement >> newAddInterface: look [ ^ contentTabs ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderToolbarElement >> newBrowseButton [ ^ BrButton new aptitude: BrGlamorousButtonWithIconAptitude; @@ -167,7 +167,7 @@ GtCoderToolbarElement >> newBrowseButton [ action: [ :aButton | self browseFrom: aButton ] ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderToolbarElement >> newHierarchyButton [ ^ BrButton new label: 'Show Package and Class Hierarchies'; @@ -187,7 +187,7 @@ GtCoderToolbarElement >> newHierarchyButton [ yourself ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderToolbarElement >> newSpotterButton [ @@ -207,7 +207,7 @@ GtCoderToolbarElement >> newSpotterButton [ asElement. ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderToolbarElement >> toolbarElement [ ^ toolbarElement diff --git a/src/GToolkit-Coder-UI/GtCodersModel.extension.st b/src/GToolkit-Coder-UI/GtCodersModel.extension.st index b3a373ec1..b144255a3 100644 --- a/src/GToolkit-Coder-UI/GtCodersModel.extension.st +++ b/src/GToolkit-Coder-UI/GtCodersModel.extension.st @@ -1,11 +1,11 @@ -Extension { #name : 'GtCodersModel' } +Extension { #name : #GtCodersModel } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtCodersModel >> asCoderUIModel [ ^ self subclassResponsibility ] -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtCodersModel >> asElement [ ^ self asCoderUIModel asElement ] diff --git a/src/GToolkit-Coder-UI/GtContextCoderVariableAptitude.class.st b/src/GToolkit-Coder-UI/GtContextCoderVariableAptitude.class.st index 65a2d7746..a8e9d0d4a 100644 --- a/src/GToolkit-Coder-UI/GtContextCoderVariableAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtContextCoderVariableAptitude.class.st @@ -1,13 +1,13 @@ Class { - #name : 'GtContextCoderVariableAptitude', - #superclass : 'BrAptitude', + #name : #GtContextCoderVariableAptitude, + #superclass : #BrAptitude, #instVars : [ 'methodCoder' ], #category : 'GToolkit-Coder-UI-Looks' } -{ #category : 'initialization' } +{ #category : #initialization } GtContextCoderVariableAptitude >> initialize [ super initialize. self @@ -22,17 +22,17 @@ GtContextCoderVariableAptitude >> initialize [ yourself) ] -{ #category : 'accessing' } +{ #category : #accessing } GtContextCoderVariableAptitude >> methodCoder [ ^ methodCoder ] -{ #category : 'accessing' } +{ #category : #accessing } GtContextCoderVariableAptitude >> methodCoder: contextCoder [ methodCoder := contextCoder ] -{ #category : 'private' } +{ #category : #private } GtContextCoderVariableAptitude >> variables [ | vars | vars := OrderedCollection new. @@ -44,7 +44,7 @@ GtContextCoderVariableAptitude >> variables [ ^ vars ] -{ #category : 'initialization' } +{ #category : #initialization } GtContextCoderVariableAptitude >> variablesElement [ | variablesElement | variablesElement := BrColumnedList new. diff --git a/src/GToolkit-Coder-UI/GtCreateElement.class.st b/src/GToolkit-Coder-UI/GtCreateElement.class.st index 634652361..e436f2014 100644 --- a/src/GToolkit-Coder-UI/GtCreateElement.class.st +++ b/src/GToolkit-Coder-UI/GtCreateElement.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCreateElement', - #superclass : 'BlElement', + #name : #GtCreateElement, + #superclass : #BlElement, #traits : 'TBrLayoutResizable', #classTraits : 'TBrLayoutResizable classTrait', #instVars : [ @@ -9,7 +9,7 @@ Class { #category : 'GToolkit-Coder-UI-Behaviour' } -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCreateElement >> buildSectionLabel: aSectionName [ ^ BrLabel new @@ -20,12 +20,12 @@ GtCreateElement >> buildSectionLabel: aSectionName [ constraintsDo: [ :c | c grid horizontal alignLeft ] ] -{ #category : 'private - ui' } +{ #category : #'private - ui' } GtCreateElement >> buttonMargin [ ^ BlInsets top: 3 left: 0 bottom: 3 right: 5 ] -{ #category : 'private - ui' } +{ #category : #'private - ui' } GtCreateElement >> editableLabelLook [ ^ BrGlamorousEditableLabelAptitude new glamorousCodeFont; @@ -33,7 +33,7 @@ GtCreateElement >> editableLabelLook [ fontSize: 10 ] -{ #category : 'initialization' } +{ #category : #initialization } GtCreateElement >> initialize [ super initialize. self layout: BlFlowLayout vertical. diff --git a/src/GToolkit-Coder-UI/GtDiffAptitude.class.st b/src/GToolkit-Coder-UI/GtDiffAptitude.class.st index e0e3d02ec..0594edcaf 100644 --- a/src/GToolkit-Coder-UI/GtDiffAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtDiffAptitude.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtDiffAptitude', - #superclass : 'BrAptitude', + #name : #GtDiffAptitude, + #superclass : #BrAptitude, #category : 'GToolkit-Coder-UI-Diff' } -{ #category : 'initialization' } +{ #category : #initialization } GtDiffAptitude >> initialize [ super initialize. diff --git a/src/GToolkit-Coder-UI/GtDiffElement.class.st b/src/GToolkit-Coder-UI/GtDiffElement.class.st index 24c23fc49..63902a371 100644 --- a/src/GToolkit-Coder-UI/GtDiffElement.class.st +++ b/src/GToolkit-Coder-UI/GtDiffElement.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtDiffElement', - #superclass : 'BlElement', + #name : #GtDiffElement, + #superclass : #BlElement, #traits : 'TBrLayoutResizable + TBrSizeAdjustable', #classTraits : 'TBrLayoutResizable classTrait + TBrSizeAdjustable classTrait', #instVars : [ @@ -14,34 +14,34 @@ Class { #category : 'GToolkit-Coder-UI-Diff' } -{ #category : 'examples' } +{ #category : #examples } GtDiffElement class >> example [ ^ self on: self exampleDiff ] -{ #category : 'examples' } +{ #category : #examples } GtDiffElement class >> exampleDiff [ ^ TextDiffBuilder from: self originalString to: self newString ] -{ #category : 'examples' } +{ #category : #examples } GtDiffElement class >> exampleFlat [ ^ (self on: self exampleDiff) aptitude: GtDiffFlatAptitude ] -{ #category : 'examples' } +{ #category : #examples } GtDiffElement class >> exampleShadow [ ^ (self on: self exampleDiff) aptitude: GtDiffShadowAptitude ] -{ #category : 'examples' } +{ #category : #examples } GtDiffElement class >> newString [ ^ String @@ -56,14 +56,14 @@ GtDiffElement class >> newString [ cr ] ] ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtDiffElement class >> on: aDiffBuilder [ ^ self new diff: aDiffBuilder; yourself ] -{ #category : 'examples' } +{ #category : #examples } GtDiffElement class >> originalString [ ^ String @@ -78,7 +78,7 @@ GtDiffElement class >> originalString [ cr ] ] ] -{ #category : 'private' } +{ #category : #private } GtDiffElement >> buildInterface [ syncScrollRanges := GtSyncScrollRanges createFromDiff: diff. @@ -91,13 +91,13 @@ GtDiffElement >> buildInterface [ self updateOutlines ] -{ #category : 'initialize' } +{ #category : #initialize } GtDiffElement >> diff: aDiffBuilder [ diff := aDiffBuilder. self buildInterface ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtDiffElement >> drawMeAndChildrenOnSpartaCanvas: aCanvas [ | stroke fill | super drawMeAndChildrenOnSpartaCanvas: aCanvas. @@ -118,12 +118,12 @@ GtDiffElement >> drawMeAndChildrenOnSpartaCanvas: aCanvas [ draw ] ] -{ #category : 'initialize' } +{ #category : #initialize } GtDiffElement >> editorLook [ ^ BrGlamorousCodeEditorAptitude ] -{ #category : 'initialize' } +{ #category : #initialize } GtDiffElement >> initialize [ super initialize. @@ -152,7 +152,7 @@ GtDiffElement >> initialize [ }. ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtDiffElement >> leftBottomFor: anInteger [ | range element | range := self leftRange. @@ -165,12 +165,12 @@ GtDiffElement >> leftBottomFor: anInteger [ max: 0 ] -{ #category : 'accessing' } +{ #category : #accessing } GtDiffElement >> leftEditorLook: aLook [ leftElement aptitude: aLook ] -{ #category : 'private' } +{ #category : #private } GtDiffElement >> leftRange [ | first | first := (leftElement instVarNamed: 'layoutPositionsRange') @@ -179,7 +179,7 @@ GtDiffElement >> leftRange [ ^ first to: first + leftElement children size - 1 ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtDiffElement >> leftScrolled [ | newPosition | newPosition := syncScrollRanges rightLineFor: self leftRange first. @@ -194,12 +194,12 @@ GtDiffElement >> leftScrolled [ self updateOutlines ] -{ #category : 'accessing' } +{ #category : #accessing } GtDiffElement >> leftStyler: aStyler [ leftElement editor styler: aStyler ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtDiffElement >> leftTopFor: anInteger [ | range element | range := self leftRange. @@ -212,12 +212,12 @@ GtDiffElement >> leftTopFor: anInteger [ max: 0 ] -{ #category : 'private' } +{ #category : #private } GtDiffElement >> newRopedText [ ^ diff newRopedText ] -{ #category : 'initialize' } +{ #category : #initialize } GtDiffElement >> newSeparatorElement [ ^ BlElement new constraintsDo: [ :c | @@ -226,7 +226,7 @@ GtDiffElement >> newSeparatorElement [ yourself ] -{ #category : 'initialize' } +{ #category : #initialize } GtDiffElement >> newTextElement [ ^ BrEditor new focusability: BlFocusability none; @@ -235,14 +235,14 @@ GtDiffElement >> newTextElement [ aptitude: self editorLook ] -{ #category : 'geometry hooks' } +{ #category : #'geometry hooks' } GtDiffElement >> notifyExtentChanged [ super notifyExtentChanged. outlines := #(). self updateOutlines ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtDiffElement >> outlineFor: aSyncScrollRange [ | leftTop leftBottom rightTop rightBottom vertices leftBounds rightBounds | leftTop := self leftTopFor: aSyncScrollRange leftFirst + 1. @@ -265,12 +265,12 @@ GtDiffElement >> outlineFor: aSyncScrollRange [ ^ BlPolyline vertices: vertices ] -{ #category : 'private' } +{ #category : #private } GtDiffElement >> previousRopedText [ ^ diff previousRopedText ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtDiffElement >> rightBottomFor: anInteger [ | range element | range := self rightRange. @@ -283,12 +283,12 @@ GtDiffElement >> rightBottomFor: anInteger [ max: 0 ] -{ #category : 'accessing' } +{ #category : #accessing } GtDiffElement >> rightEditorLook: aLook [ rightElement aptitude: aLook ] -{ #category : 'private' } +{ #category : #private } GtDiffElement >> rightRange [ | first | first := (rightElement instVarNamed: 'layoutPositionsRange') @@ -297,7 +297,7 @@ GtDiffElement >> rightRange [ ^ first to: first + rightElement children size - 1 ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtDiffElement >> rightScrolled [ | newPosition | newPosition := syncScrollRanges leftLineFor: self rightRange first. @@ -312,12 +312,12 @@ GtDiffElement >> rightScrolled [ self updateOutlines ] -{ #category : 'accessing' } +{ #category : #accessing } GtDiffElement >> rightStyler: aStyler [ rightElement editor styler: aStyler ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtDiffElement >> rightTopFor: anInteger [ | range element | range := self rightRange. @@ -330,7 +330,7 @@ GtDiffElement >> rightTopFor: anInteger [ max: 0 ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtDiffElement >> updateOutlines [ | ranges | outlines := OrderedCollection new. diff --git a/src/GToolkit-Coder-UI/GtDiffElementId.class.st b/src/GToolkit-Coder-UI/GtDiffElementId.class.st index a0387ad4c..813107782 100644 --- a/src/GToolkit-Coder-UI/GtDiffElementId.class.st +++ b/src/GToolkit-Coder-UI/GtDiffElementId.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtDiffElementId', - #superclass : 'BlElementUniqueId', + #name : #GtDiffElementId, + #superclass : #BlElementUniqueId, #category : 'GToolkit-Coder-UI-Diff' } -{ #category : 'testing' } +{ #category : #testing } GtDiffElementId class >> isAbstract [ ^ self = GtDiffElementId ] diff --git a/src/GToolkit-Coder-UI/GtDiffFlatAptitude.class.st b/src/GToolkit-Coder-UI/GtDiffFlatAptitude.class.st index 801c24966..2bdf234e0 100644 --- a/src/GToolkit-Coder-UI/GtDiffFlatAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtDiffFlatAptitude.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtDiffFlatAptitude', - #superclass : 'GtDiffAptitude', + #name : #GtDiffFlatAptitude, + #superclass : #GtDiffAptitude, #category : 'GToolkit-Coder-UI-Diff' } -{ #category : 'initialization' } +{ #category : #initialization } GtDiffFlatAptitude >> initialize [ super initialize. @@ -17,7 +17,7 @@ GtDiffFlatAptitude >> initialize [ self add: (self newTextLook // GtDiffNewTextId) ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtDiffFlatAptitude >> newTextLook [ ^ BrSizeAdjustmentAptitude new normal: [ :aStyle | diff --git a/src/GToolkit-Coder-UI/GtDiffNewTextId.class.st b/src/GToolkit-Coder-UI/GtDiffNewTextId.class.st index 881e3034f..7dcae2b56 100644 --- a/src/GToolkit-Coder-UI/GtDiffNewTextId.class.st +++ b/src/GToolkit-Coder-UI/GtDiffNewTextId.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtDiffNewTextId', - #superclass : 'GtDiffElementId', + #name : #GtDiffNewTextId, + #superclass : #GtDiffElementId, #category : 'GToolkit-Coder-UI-Diff' } -{ #category : 'converting' } +{ #category : #converting } GtDiffNewTextId >> asSymbol [ ^ #'diff--new-text' ] diff --git a/src/GToolkit-Coder-UI/GtDiffOldTextId.class.st b/src/GToolkit-Coder-UI/GtDiffOldTextId.class.st index 325a7f201..c4fefeaa6 100644 --- a/src/GToolkit-Coder-UI/GtDiffOldTextId.class.st +++ b/src/GToolkit-Coder-UI/GtDiffOldTextId.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtDiffOldTextId', - #superclass : 'GtDiffElementId', + #name : #GtDiffOldTextId, + #superclass : #GtDiffElementId, #category : 'GToolkit-Coder-UI-Diff' } -{ #category : 'converting' } +{ #category : #converting } GtDiffOldTextId >> asSymbol [ ^ #'diff--old-text' ] diff --git a/src/GToolkit-Coder-UI/GtDiffSeparatorId.class.st b/src/GToolkit-Coder-UI/GtDiffSeparatorId.class.st index ce30ee8c2..00a7c7818 100644 --- a/src/GToolkit-Coder-UI/GtDiffSeparatorId.class.st +++ b/src/GToolkit-Coder-UI/GtDiffSeparatorId.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtDiffSeparatorId', - #superclass : 'GtDiffElementId', + #name : #GtDiffSeparatorId, + #superclass : #GtDiffElementId, #category : 'GToolkit-Coder-UI-Diff' } -{ #category : 'converting' } +{ #category : #converting } GtDiffSeparatorId >> asSymbol [ ^ #'diff--separator' ] diff --git a/src/GToolkit-Coder-UI/GtDiffShadowAptitude.class.st b/src/GToolkit-Coder-UI/GtDiffShadowAptitude.class.st index 8aa7fff1a..870009dca 100644 --- a/src/GToolkit-Coder-UI/GtDiffShadowAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtDiffShadowAptitude.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtDiffShadowAptitude', - #superclass : 'GtDiffAptitude', + #name : #GtDiffShadowAptitude, + #superclass : #GtDiffAptitude, #category : 'GToolkit-Coder-UI-Diff' } -{ #category : 'initialization' } +{ #category : #initialization } GtDiffShadowAptitude >> initialize [ super initialize. @@ -28,7 +28,7 @@ GtDiffShadowAptitude >> initialize [ self add: (self newShadowLook // GtDiffNewTextId) ] -{ #category : 'initialization' } +{ #category : #initialization } GtDiffShadowAptitude >> newSeparatorLook [ ^ BrSizeAdjustmentAptitude new normal: [ :aStyle | aStyle hExact: 40 ]; @@ -37,7 +37,7 @@ GtDiffShadowAptitude >> newSeparatorLook [ mini: [ :aStyle | aStyle hExact: 10 ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtDiffShadowAptitude >> newShadowLook [ ^ BrStyleCommonAptitude new default: [ :aStyle | @@ -47,7 +47,7 @@ GtDiffShadowAptitude >> newShadowLook [ yourself ] -{ #category : 'initialization' } +{ #category : #initialization } GtDiffShadowAptitude >> newTextLook [ ^ BrSizeAdjustmentAptitude new normal: [ :aStyle | diff --git a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st index 51a78598e..c8ebe091e 100644 --- a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtExpandableSourceCoderElement', - #superclass : 'BrExpander', + #name : #GtExpandableSourceCoderElement, + #superclass : #BrExpander, #instVars : [ 'collapsedElement', 'expandedElement', @@ -9,18 +9,18 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Source' } -{ #category : 'private' } +{ #category : #private } GtExpandableSourceCoderElement >> addCodersCoderLook: aSourceCoder to: anElement [ aSourceCoder coderLook ifNotNil: [ :aCoderLook | anElement addAptitude: aCoderLook ] ] -{ #category : 'converting' } +{ #category : #converting } GtExpandableSourceCoderElement >> asVerticallyResizableDo: aBlock [ ^ self ] -{ #category : 'private' } +{ #category : #private } GtExpandableSourceCoderElement >> assignCollapsedCoder: aSourceCoder to: aCollapsedElement [ aCollapsedElement coderUIModel: aSourceCoder. @@ -31,7 +31,7 @@ GtExpandableSourceCoderElement >> assignCollapsedCoder: aSourceCoder to: aCollap aCollapsedElement addAptitude: GtSourceCoderCollapsedTextAndExampleAptitude ] ] -{ #category : 'private' } +{ #category : #private } GtExpandableSourceCoderElement >> assignExpandedCoder: aSourceCoder to: anExpandedElement [ anExpandedElement coderUIModel: aSourceCoder. @@ -42,7 +42,7 @@ GtExpandableSourceCoderElement >> assignExpandedCoder: aSourceCoder to: anExpand anExpandedElement addAptitude: GtSourceCoderEditorAptitude ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtExpandableSourceCoderElement >> coderUIModel [ self @@ -52,7 +52,7 @@ GtExpandableSourceCoderElement >> coderUIModel [ ^ coderUIModel ] -{ #category : 'accessing' } +{ #category : #accessing } GtExpandableSourceCoderElement >> coderUIModel: aCoderUIModel [ self assert: [ aCoderUIModel isNotNil ] @@ -93,7 +93,7 @@ GtExpandableSourceCoderElement >> coderUIModel: aCoderUIModel [ when: GtTextualCoderViewModelExpansionChanged send: #onViewModelExpansionChanged: to: self ] -{ #category : 'accessing' } +{ #category : #accessing } GtExpandableSourceCoderElement >> gtAllShortcutsFor: aView [ self shortcuts ifEmpty: [ ^ aView empty ]. @@ -106,7 +106,7 @@ GtExpandableSourceCoderElement >> gtAllShortcutsFor: aView [ column: 'Action' text: [ :each | each action asString ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtExpandableSourceCoderElement >> initialize [ super initialize. @@ -127,19 +127,19 @@ GtExpandableSourceCoderElement >> initialize [ content: [ expandedElement := self newExpandedElement ] ] -{ #category : 'private' } +{ #category : #private } GtExpandableSourceCoderElement >> isDirty: anElement [ ^ anElement userData at: #coderDirty ifAbsent: [ false ] ] -{ #category : 'private' } +{ #category : #private } GtExpandableSourceCoderElement >> markDirty: anElement as: aBoolean [ anElement userData at: #coderDirty put: aBoolean ] -{ #category : 'private' } +{ #category : #private } GtExpandableSourceCoderElement >> newCollapsedElement [ | aCollapsedElement | aCollapsedElement := GtSourceCoderCollapsedContentElement new. @@ -150,7 +150,7 @@ GtExpandableSourceCoderElement >> newCollapsedElement [ ^ aCollapsedElement ] -{ #category : 'private' } +{ #category : #private } GtExpandableSourceCoderElement >> newExpandedElement [ | anExpandedElement | anExpandedElement := GtSourceCoderExpandedContentElement new. @@ -161,7 +161,7 @@ GtExpandableSourceCoderElement >> newExpandedElement [ ^ anExpandedElement ] -{ #category : 'private' } +{ #category : #private } GtExpandableSourceCoderElement >> onCollapsed [ self beInSingleCompositionLayer. @@ -171,7 +171,7 @@ GtExpandableSourceCoderElement >> onCollapsed [ ifTrue: [ self assignCollapsedCoder: aCoderUIModel to: collapsedElement ] ] ] -{ #category : 'private' } +{ #category : #private } GtExpandableSourceCoderElement >> onExpanded [ self beInSeparateCompositionLayer. @@ -181,16 +181,16 @@ GtExpandableSourceCoderElement >> onExpanded [ ifTrue: [ self assignExpandedCoder: aCoderUIModel to: expandedElement ] ] ] -{ #category : 'events' } +{ #category : #events } GtExpandableSourceCoderElement >> onMethodRemoved: anAnnouncement [ ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtExpandableSourceCoderElement >> onViewModelExpansionChanged: anAnnouncement [ self expanded: anAnnouncement expanded ] -{ #category : 'focus requesting' } +{ #category : #'focus requesting' } GtExpandableSourceCoderElement >> requestFocus [ self childNamed: #editor @@ -198,7 +198,7 @@ GtExpandableSourceCoderElement >> requestFocus [ ifNone: [ super requestFocus ] ] -{ #category : 'focus requesting' } +{ #category : #'focus requesting' } GtExpandableSourceCoderElement >> requestFocusAsyncronously [ ^ self enqueueTask: diff --git a/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st b/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st index bbf85d8cf..2c647a1ef 100644 --- a/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtExpandedOnlyCoderElement', - #superclass : 'BrVerticalPane', + #name : #GtExpandedOnlyCoderElement, + #superclass : #BrVerticalPane, #instVars : [ 'coderUIModel', 'expandedElement' @@ -8,18 +8,18 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Source' } -{ #category : 'adding' } +{ #category : #adding } GtExpandedOnlyCoderElement >> addCodersCoderLook: aSourceCoder to: anElement [ aSourceCoder coderLook ifNotNil: [ :aCoderLook | anElement addAptitude: aCoderLook ] ] -{ #category : 'converting' } +{ #category : #converting } GtExpandedOnlyCoderElement >> asVerticallyResizableDo: aBlock [ ^ self ] -{ #category : 'accessing' } +{ #category : #accessing } GtExpandedOnlyCoderElement >> coder: aCoderUIModel [ self @@ -29,12 +29,12 @@ GtExpandedOnlyCoderElement >> coder: aCoderUIModel [ ^ self coderUIModel: aCoderUIModel ] -{ #category : 'accessing' } +{ #category : #accessing } GtExpandedOnlyCoderElement >> coderUIModel [ ^ coderUIModel ] -{ #category : 'accessing' } +{ #category : #accessing } GtExpandedOnlyCoderElement >> coderUIModel: aCoderUIModel [ self @@ -59,7 +59,7 @@ GtExpandedOnlyCoderElement >> coderUIModel: aCoderUIModel [ to: self ] -{ #category : 'initialization' } +{ #category : #initialization } GtExpandedOnlyCoderElement >> initialize [ super initialize. @@ -69,7 +69,7 @@ GtExpandedOnlyCoderElement >> initialize [ margin: (BlInsets all: 10) ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtExpandedOnlyCoderElement >> newExpandedElement: aCoderModel [ ^ GtSourceCoderExpandedContentElement new coderUIModel: aCoderModel; @@ -78,7 +78,7 @@ GtExpandedOnlyCoderElement >> newExpandedElement: aCoderModel [ yourself ] -{ #category : 'focus requesting' } +{ #category : #'focus requesting' } GtExpandedOnlyCoderElement >> requestFocus [ self childNamed: #editor @@ -86,7 +86,7 @@ GtExpandedOnlyCoderElement >> requestFocus [ ifNone: [ super requestFocus ] ] -{ #category : 'focus requesting' } +{ #category : #'focus requesting' } GtExpandedOnlyCoderElement >> requestFocusAsyncronously [ ^ self enqueueTask: diff --git a/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st b/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st index a3c17cb3a..37de44938 100644 --- a/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st +++ b/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st @@ -9,8 +9,8 @@ See {{gtClass:GtFiltersElement}} for an example. " Class { - #name : 'GtFilterDescriptor', - #superclass : 'Object', + #name : #GtFilterDescriptor, + #superclass : #Object, #instVars : [ 'name', 'order', @@ -23,7 +23,7 @@ Class { #category : 'GToolkit-Coder-UI-Filters' } -{ #category : 'instace creation' } +{ #category : #'instace creation' } GtFilterDescriptor class >> creator: aBlock named: aString order: anInteger [ ^ self new creationBlock: aBlock; @@ -32,7 +32,7 @@ GtFilterDescriptor class >> creator: aBlock named: aString order: anInteger [ yourself ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtFilterDescriptor class >> creator: aBlock named: aString order: anInteger completion: completionStrategy [ ^ self new creationBlock: aBlock; @@ -42,7 +42,7 @@ GtFilterDescriptor class >> creator: aBlock named: aString order: anInteger comp yourself ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtFilterDescriptor class >> creator: aBlock named: aString order: anInteger completion: completionStrategy emptyDefaultValue: defaultValueString [ ^ self new creationBlock: aBlock; @@ -53,38 +53,38 @@ GtFilterDescriptor class >> creator: aBlock named: aString order: anInteger comp yourself ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtFilterDescriptor >> beNotDefault [ "Do not display this particular descriptor filter as a default filter" isDefault := false ] -{ #category : 'accessing' } +{ #category : #accessing } GtFilterDescriptor >> completion [ ^ completion ] -{ #category : 'accessing' } +{ #category : #accessing } GtFilterDescriptor >> completion: completionStrategy [ completion := completionStrategy ] -{ #category : 'accessing' } +{ #category : #accessing } GtFilterDescriptor >> creationBlock: aBlock [ creationBlock := aBlock ] -{ #category : 'accessing' } +{ #category : #accessing } GtFilterDescriptor >> emptyDefaultValue [ ^ emptyDefaultValue ] -{ #category : 'accessing' } +{ #category : #accessing } GtFilterDescriptor >> emptyDefaultValue: aString [ emptyDefaultValue := aString ] -{ #category : 'gt-extensions' } +{ #category : #'gt-extensions' } GtFilterDescriptor >> gtCompletionsFor: aView [ self completion ifNil: [ ^ aView empty ]. @@ -96,39 +96,39 @@ GtFilterDescriptor >> gtCompletionsFor: aView [ view: #gtCompletionsFor: ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtFilterDescriptor >> initialize [ super initialize. valueIsRequired := true. isDefault := true. ] -{ #category : 'accessing' } +{ #category : #accessing } GtFilterDescriptor >> name [ ^ name ] -{ #category : 'accessing' } +{ #category : #accessing } GtFilterDescriptor >> name: aString [ name := aString ] -{ #category : 'filters' } +{ #category : #filters } GtFilterDescriptor >> newFilterWithValue: aString [ ^ creationBlock value: aString ] -{ #category : 'accessing' } +{ #category : #accessing } GtFilterDescriptor >> order [ ^ order ] -{ #category : 'accessing' } +{ #category : #accessing } GtFilterDescriptor >> order: anInteger [ order := anInteger ] -{ #category : 'printing' } +{ #category : #printing } GtFilterDescriptor >> printOn: aStream [ self name ifNil: [ ^ super printOn: aStream ]. aStream @@ -139,17 +139,17 @@ GtFilterDescriptor >> printOn: aStream [ nextPutAll: ')' ] -{ #category : 'testing' } +{ #category : #testing } GtFilterDescriptor >> showAsDefaultWhenEmpty [ ^ isDefault and: [ emptyDefaultValue notNil ] ] -{ #category : 'testing' } +{ #category : #testing } GtFilterDescriptor >> valueIsRequired [ ^ valueIsRequired ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtFilterDescriptor >> valueNotRequired [ valueIsRequired := false ] diff --git a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonAptitude.class.st b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonAptitude.class.st index 2f5b11cdf..ff92a6cd9 100644 --- a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonAptitude.class.st @@ -7,8 +7,8 @@ Look at my {{gtClass:GtFilterRunExampleButtonAptitude|show=#gtSubclassesFor:|exp " Class { - #name : 'GtFilterRunExampleButtonAptitude', - #superclass : 'BrAptitude', + #name : #GtFilterRunExampleButtonAptitude, + #superclass : #BrAptitude, #instVars : [ 'coder', 'mutex', @@ -17,20 +17,20 @@ Class { #category : 'GToolkit-Coder-UI-Filters' } -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtFilterRunExampleButtonAptitude >> beUpdateRequestedIfDoneEarlierDo: aBlock [ mutex critical: [ self isUpdateRequested ifTrue: aBlock. isUpdateRequested := true. ] ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtFilterRunExampleButtonAptitude >> coder [ ^ coder ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtFilterRunExampleButtonAptitude >> coder: aGtFilteredMethodsCoder [ coder = aGtFilteredMethodsCoder ifTrue: [ ^ self ]. self unsubscribeFromCoder. @@ -39,38 +39,38 @@ GtFilterRunExampleButtonAptitude >> coder: aGtFilteredMethodsCoder [ self onCoderChanged. ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtFilterRunExampleButtonAptitude >> coderDo: aBlock [ self coder ifNotNil: aBlock ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtFilterRunExampleButtonAptitude >> enqueueUpdate [ self widgetAndCoderDo: [ :aWidget :aCoder | aWidget enqueueTask: (BlTaskAction new action: [ self updateNow ]) ]. ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtFilterRunExampleButtonAptitude >> exampler [ ^ self coder exampler ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtFilterRunExampleButtonAptitude >> examplerDo: aBlock [ self coderDo: [ :aCoder | aBlock cull: aCoder exampler ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtFilterRunExampleButtonAptitude >> initialize [ super initialize. isUpdateRequested := false. mutex := Mutex new. ] -{ #category : 'initialization' } +{ #category : #initialization } GtFilterRunExampleButtonAptitude >> initializeIconElement: anElement [ anElement geometry: BlCircle new; @@ -78,43 +78,43 @@ GtFilterRunExampleButtonAptitude >> initializeIconElement: anElement [ size: 8 @ 8. ] -{ #category : 'private - testing' } +{ #category : #'private - testing' } GtFilterRunExampleButtonAptitude >> isUpdateRequested [ ^ isUpdateRequested ] -{ #category : 'api - hooks' } +{ #category : #'api - hooks' } GtFilterRunExampleButtonAptitude >> onAttachedTo: anElement [ super onAttachedTo: anElement. self postponeUpdate. ] -{ #category : 'private - hooks' } +{ #category : #'private - hooks' } GtFilterRunExampleButtonAptitude >> onCoderChanged [ "We expect that the Coder is changed just once before the look is attached." self beUpdateRequestedIfDoneEarlierDo: [ ^ self ]. self updateNow. ] -{ #category : 'private - announcement handling' } +{ #category : #'private - announcement handling' } GtFilterRunExampleButtonAptitude >> onCoderChanged: aGtCodersCodersChanged [ self postponeUpdate. ] -{ #category : 'private - announcement handling' } +{ #category : #'private - announcement handling' } GtFilterRunExampleButtonAptitude >> onExampleExecuted: aGtCoderExampleExecuted [ self postponeUpdate. ] -{ #category : 'api - hooks' } +{ #category : #'api - hooks' } GtFilterRunExampleButtonAptitude >> onUninstalledIn: anElement [ super onUninstalledIn: anElement. self resetUpdateRequested. ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtFilterRunExampleButtonAptitude >> postponeUpdate [ self widgetAndCoderDo: [ :aWidget :aCoder | self beUpdateRequestedIfDoneEarlierDo: [ ^ self ]. @@ -127,7 +127,7 @@ GtFilterRunExampleButtonAptitude >> postponeUpdate [ self updateNow ] ] ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtFilterRunExampleButtonAptitude >> postponedTime [ | aNow | self widgetDo: [ :aWidget | @@ -138,13 +138,13 @@ GtFilterRunExampleButtonAptitude >> postponedTime [ ^ aNow + 300 milliSeconds. ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtFilterRunExampleButtonAptitude >> resetUpdateRequested [ mutex critical: [ isUpdateRequested := false ]. ] -{ #category : 'private - subscriptions' } +{ #category : #'private - subscriptions' } GtFilterRunExampleButtonAptitude >> subscribeToCoder [ self coder weak when: GtCoderExampleExecuted @@ -156,25 +156,25 @@ GtFilterRunExampleButtonAptitude >> subscribeToCoder [ to: self ] -{ #category : 'private - subscriptions' } +{ #category : #'private - subscriptions' } GtFilterRunExampleButtonAptitude >> unsubscribeFromCoder [ self coderDo: [ :aCoder | aCoder unsubscribe: self ]. ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtFilterRunExampleButtonAptitude >> updateNow [ self resetUpdateRequested. self updateWidget. ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtFilterRunExampleButtonAptitude >> updateWidget [ "Subclasses may perform update actions. I should be called from a UI process." ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtFilterRunExampleButtonAptitude >> widgetAndCoderDo: aTwoArgBlock [ self widgetDo: [ :aWidget | self coderDo: [ :aCoder | diff --git a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonFourStateIconAptitude.class.st b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonFourStateIconAptitude.class.st index 8cfe86170..63b2a094d 100644 --- a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonFourStateIconAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonFourStateIconAptitude.class.st @@ -20,8 +20,8 @@ If all examples have same state, only one icon (color) is displayed: {{gtExample " Class { - #name : 'GtFilterRunExampleButtonFourStateIconAptitude', - #superclass : 'GtFilterRunExampleButtonIconAptitude', + #name : #GtFilterRunExampleButtonFourStateIconAptitude, + #superclass : #GtFilterRunExampleButtonIconAptitude, #instVars : [ 'fourIconElement', 'failureIconElement', @@ -32,22 +32,22 @@ Class { #category : 'GToolkit-Coder-UI-Filters' } -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtFilterRunExampleButtonFourStateIconAptitude >> errorIconElement [ ^ errorIconElement ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtFilterRunExampleButtonFourStateIconAptitude >> failureIconElement [ ^ failureIconElement ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtFilterRunExampleButtonFourStateIconAptitude >> fourIconElement [ ^ fourIconElement ] -{ #category : 'initialization' } +{ #category : #initialization } GtFilterRunExampleButtonFourStateIconAptitude >> initialize [ super initialize. self initializeFourStateIconElement. @@ -64,27 +64,27 @@ GtFilterRunExampleButtonFourStateIconAptitude >> initialize [ self addChangeAddChildAs: #(content fourStateExample) with: [ self fourIconElement ]. ] -{ #category : 'initialization' } +{ #category : #initialization } GtFilterRunExampleButtonFourStateIconAptitude >> initializeErrorIconElement [ errorIconElement := BlElement new background: self newErrorBackground. self initializeIconElement: errorIconElement. ] -{ #category : 'initialization' } +{ #category : #initialization } GtFilterRunExampleButtonFourStateIconAptitude >> initializeExampleElement [ super initializeExampleElement. self exampleElement visibility: BlVisibility gone. ] -{ #category : 'initialization' } +{ #category : #initialization } GtFilterRunExampleButtonFourStateIconAptitude >> initializeFailureIconElement [ failureIconElement := BlElement new background: self newFailureBackground. self initializeIconElement: failureIconElement ] -{ #category : 'initialization' } +{ #category : #initialization } GtFilterRunExampleButtonFourStateIconAptitude >> initializeFourStateIconElement [ fourIconElement := BlElement new layout: (BlGridLayout new @@ -96,31 +96,31 @@ GtFilterRunExampleButtonFourStateIconAptitude >> initializeFourStateIconElement c vertical fitContent ]. ] -{ #category : 'initialization' } +{ #category : #initialization } GtFilterRunExampleButtonFourStateIconAptitude >> initializeNeutralIconElement [ neutralIconElement := BlElement new background: self newNotExecutedBackground. self initializeIconElement: neutralIconElement. ] -{ #category : 'initialization' } +{ #category : #initialization } GtFilterRunExampleButtonFourStateIconAptitude >> initializeSuccessIconElement [ successIconElement := BlElement new background: self newSuccessBackground. self initializeIconElement: successIconElement ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtFilterRunExampleButtonFourStateIconAptitude >> neutralIconElement [ ^ neutralIconElement ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtFilterRunExampleButtonFourStateIconAptitude >> successIconElement [ ^ successIconElement ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtFilterRunExampleButtonFourStateIconAptitude >> updateFourIconElement [ | isNeutralVisible isErrorVisible isFailureVisible isSuccessVisible | self updateIconElement: self neutralIconElement status: (isNeutralVisible := self exampler hasNotExecutedExamples). @@ -136,7 +136,7 @@ GtFilterRunExampleButtonFourStateIconAptitude >> updateFourIconElement [ self exampleElement visibility: BlVisibility gone ] ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtFilterRunExampleButtonFourStateIconAptitude >> updateIconElement: anElement status: aBoolean [ aBoolean ifTrue: [ @@ -145,7 +145,7 @@ GtFilterRunExampleButtonFourStateIconAptitude >> updateIconElement: anElement st anElement visibility: BlVisibility hidden ]. ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtFilterRunExampleButtonFourStateIconAptitude >> updateWidget [ super updateWidget. self updateFourIconElement. diff --git a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonIconAptitude.class.st b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonIconAptitude.class.st index ac123fea3..0f540813a 100644 --- a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonIconAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonIconAptitude.class.st @@ -20,21 +20,21 @@ The following examples shows a colored icon as a part of a button in four possib " Class { - #name : 'GtFilterRunExampleButtonIconAptitude', - #superclass : 'GtFilterRunExampleButtonAptitude', + #name : #GtFilterRunExampleButtonIconAptitude, + #superclass : #GtFilterRunExampleButtonAptitude, #instVars : [ 'exampleElement' ], #category : 'GToolkit-Coder-UI-Filters' } -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtFilterRunExampleButtonIconAptitude >> exampleElement [ ^ exampleElement ] -{ #category : 'initialization' } +{ #category : #initialization } GtFilterRunExampleButtonIconAptitude >> initialize [ super initialize. self initializeExampleElement. @@ -42,14 +42,14 @@ GtFilterRunExampleButtonIconAptitude >> initialize [ self addChangeAddChildAs: #(content example) with: [ self exampleElement ]. ] -{ #category : 'initialization' } +{ #category : #initialization } GtFilterRunExampleButtonIconAptitude >> initializeExampleElement [ exampleElement := BlElement new background: self newNotExecutedBackground. self initializeIconElement: exampleElement. ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtFilterRunExampleButtonIconAptitude >> newBackground [ self coder exampler hasNotExecutedExamples ifTrue: [ ^ self newNotExecutedBackground ]. @@ -62,27 +62,27 @@ GtFilterRunExampleButtonIconAptitude >> newBackground [ ^ self newNotExecutedBackground. ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtFilterRunExampleButtonIconAptitude >> newErrorBackground [ ^ GtFilterExampleErrorState default color ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtFilterRunExampleButtonIconAptitude >> newFailureBackground [ ^ GtFilterExampleFailureState default color ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtFilterRunExampleButtonIconAptitude >> newNotExecutedBackground [ ^ GtFilterExampleNotExecutedState default color ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtFilterRunExampleButtonIconAptitude >> newSuccessBackground [ ^ GtFilterExampleSuccessState default color ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtFilterRunExampleButtonIconAptitude >> updateButtonStatus [ "I must be called in a UI process". self widgetDo: [ :aWidget | @@ -95,14 +95,14 @@ GtFilterRunExampleButtonIconAptitude >> updateButtonStatus [ ifTrue: [ aWidget visibility: BlVisibility visible] ] ] ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtFilterRunExampleButtonIconAptitude >> updateExampleStatus [ "I must be called in a UI process". self exampleElement background: self newBackground ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtFilterRunExampleButtonIconAptitude >> updateWidget [ super updateWidget. self updateExampleStatus. diff --git a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonTooltipAptitude.class.st b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonTooltipAptitude.class.st index 2a5c8f572..885ce0b9e 100644 --- a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonTooltipAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonTooltipAptitude.class.st @@ -1,13 +1,13 @@ Class { - #name : 'GtFilterRunExampleButtonTooltipAptitude', - #superclass : 'GtFilterRunExampleButtonAptitude', + #name : #GtFilterRunExampleButtonTooltipAptitude, + #superclass : #GtFilterRunExampleButtonAptitude, #instVars : [ 'tooltipContent' ], #category : 'GToolkit-Coder-UI-Filters' } -{ #category : 'initialization' } +{ #category : #initialization } GtFilterRunExampleButtonTooltipAptitude >> initialize [ super initialize. self initializeTooltipContent. @@ -15,7 +15,7 @@ GtFilterRunExampleButtonTooltipAptitude >> initialize [ self add: (BrGlamorousWithTooltipAptitude content: [self initializeTooltipContent]). ] -{ #category : 'initialization' } +{ #category : #initialization } GtFilterRunExampleButtonTooltipAptitude >> initializeTooltipContent [ tooltipContent := BrColumnedList new. tooltipContent @@ -77,7 +77,7 @@ GtFilterRunExampleButtonTooltipAptitude >> initializeTooltipContent [ ^ tooltipContent ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtFilterRunExampleButtonTooltipAptitude >> listItems [ | states | states := GtFilterExampleState default allStates. @@ -85,13 +85,13 @@ GtFilterRunExampleButtonTooltipAptitude >> listItems [ eachState labelWithAmountFor: self coder exampler ]. ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtFilterRunExampleButtonTooltipAptitude >> tooltipContent [ ^ tooltipContent ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtFilterRunExampleButtonTooltipAptitude >> updateList [ | statusesToDisplay | statusesToDisplay := GtFilterExampleState default allStates reject: [ :eachStatus | @@ -101,7 +101,7 @@ GtFilterRunExampleButtonTooltipAptitude >> updateList [ items: statusesToDisplay ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtFilterRunExampleButtonTooltipAptitude >> updateWidget [ super updateWidget. self updateList. diff --git a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st index c0cbbc52f..1b0ce38ae 100644 --- a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st @@ -12,8 +12,8 @@ The following example shows a coder with default filters element that you can ch " Class { - #name : 'GtFilterTagElement', - #superclass : 'BrHorizontalPane', + #name : #GtFilterTagElement, + #superclass : #BrHorizontalPane, #instVars : [ 'descriptor', 'valueString', @@ -22,7 +22,7 @@ Class { #category : 'GToolkit-Coder-UI-Filters' } -{ #category : 'actions' } +{ #category : #actions } GtFilterTagElement >> activateEditor [ self childNamed: #editableLabel @@ -33,14 +33,14 @@ GtFilterTagElement >> activateEditor [ ifNone: [ (self childNamed: #dropDown) requestFocus ] ] -{ #category : 'private' } +{ #category : #private } GtFilterTagElement >> applyDescriptor: aDescriptor [ self descriptor: aDescriptor. self activateEditor. filterElement applyFilters ] -{ #category : 'elements' } +{ #category : #elements } GtFilterTagElement >> buildTagElements [ self removeChildren. self addChild: self createDropDown as: #dropDown. @@ -48,7 +48,7 @@ GtFilterTagElement >> buildTagElements [ ifTrue: [ self addChild: self createEditableLabel as: #editableLabel ] ] -{ #category : 'elements' } +{ #category : #elements } GtFilterTagElement >> createDropDown [ | button dropDownLook | button := self createDropDownButton. @@ -98,7 +98,7 @@ GtFilterTagElement >> createDropDown [ ^ button ] -{ #category : 'elements' } +{ #category : #elements } GtFilterTagElement >> createDropDownButton [ | button | button := BrButton new. @@ -114,7 +114,7 @@ GtFilterTagElement >> createDropDownButton [ ^ button ] -{ #category : 'elements' } +{ #category : #elements } GtFilterTagElement >> createEditableLabel [ | label | label := BrEditableLabel new. @@ -154,29 +154,29 @@ GtFilterTagElement >> createEditableLabel [ ^ label ] -{ #category : 'accessing' } +{ #category : #accessing } GtFilterTagElement >> descriptor [ ^ descriptor ] -{ #category : 'accessing' } +{ #category : #accessing } GtFilterTagElement >> descriptor: aFilterDescriptor [ descriptor := aFilterDescriptor. valueString := ''. self buildTagElements ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtFilterTagElement >> emptyDefaultValueLabel [ ^ descriptor emptyDefaultValue ] -{ #category : 'accessing' } +{ #category : #accessing } GtFilterTagElement >> filter: aGtMethodsFilter [ filterElement := aGtMethodsFilter ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtFilterTagElement >> initialize [ super initialize. self fitContent. @@ -193,7 +193,7 @@ GtFilterTagElement >> initialize [ self theme status neutralBackgroundColor darker ]) ] -{ #category : 'testing' } +{ #category : #testing } GtFilterTagElement >> isDefaultAllFilter [ ^ self descriptor showAsDefaultWhenEmpty and: [ valueString isEmpty @@ -201,18 +201,18 @@ GtFilterTagElement >> isDefaultAllFilter [ [ (self childNamed: #editableLabel) text asString = self emptyDefaultValueLabel ] ] ] -{ #category : 'testing' } +{ #category : #testing } GtFilterTagElement >> isValid [ ^ descriptor valueIsRequired not or: [ self valueString notEmpty ] ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtFilterTagElement >> makeDefaultFilter [ valueString := ''. self setLabelText: self emptyDefaultValueLabel ] -{ #category : 'private' } +{ #category : #private } GtFilterTagElement >> setLabelText: aString [ self childNamed: #editableLabel @@ -223,12 +223,12 @@ GtFilterTagElement >> setLabelText: aString [ append: aString asRopedText glamorousRegularFont glamorousRegularSmallSize ] ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtFilterTagElement >> valueString [ ^ valueString ] -{ #category : 'accessing' } +{ #category : #accessing } GtFilterTagElement >> valueString: aString [ valueString := aString. self setLabelText: aString diff --git a/src/GToolkit-Coder-UI/GtFiltersChangedEvent.class.st b/src/GToolkit-Coder-UI/GtFiltersChangedEvent.class.st index 4ca407cc2..ddbae2ac5 100644 --- a/src/GToolkit-Coder-UI/GtFiltersChangedEvent.class.st +++ b/src/GToolkit-Coder-UI/GtFiltersChangedEvent.class.st @@ -1,18 +1,18 @@ Class { - #name : 'GtFiltersChangedEvent', - #superclass : 'BlEvent', + #name : #GtFiltersChangedEvent, + #superclass : #BlEvent, #instVars : [ 'filterElement' ], #category : 'GToolkit-Coder-UI-Filters' } -{ #category : 'accessing' } +{ #category : #accessing } GtFiltersChangedEvent >> filterElement [ ^ filterElement ] -{ #category : 'accessing' } +{ #category : #accessing } GtFiltersChangedEvent >> filterElement: anElement [ filterElement := anElement ] diff --git a/src/GToolkit-Coder-UI/GtFiltersElement.class.st b/src/GToolkit-Coder-UI/GtFiltersElement.class.st index d08ea6325..fded05c69 100644 --- a/src/GToolkit-Coder-UI/GtFiltersElement.class.st +++ b/src/GToolkit-Coder-UI/GtFiltersElement.class.st @@ -11,15 +11,15 @@ The following example shows a coder with default filters element that you can ch " Class { - #name : 'GtFiltersElement', - #superclass : 'BrHorizontalFlow', + #name : #GtFiltersElement, + #superclass : #BrHorizontalFlow, #instVars : [ 'descriptors' ], #category : 'GToolkit-Coder-UI-Filters' } -{ #category : 'accessing' } +{ #category : #accessing } GtFiltersElement >> addEmptyDefault [ | filterElement defaultDescriptor | self childrenCount = 1 @@ -34,7 +34,7 @@ GtFiltersElement >> addEmptyDefault [ self addChild: filterElement at: self childrenCount ] -{ #category : 'accessing' } +{ #category : #accessing } GtFiltersElement >> addFilterForDescriptor: aFilterDescriptor andValue: aString [ | element | element := GtFilterTagElement new. @@ -45,25 +45,25 @@ GtFiltersElement >> addFilterForDescriptor: aFilterDescriptor andValue: aString self addChild: element at: self childrenCount ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtFiltersElement >> applyFilters [ self fireEvent: (GtFiltersChangedEvent new filterElement: self). self addEmptyDefault ] -{ #category : 'accessing' } +{ #category : #accessing } GtFiltersElement >> buildFilters: aBlock [ self clearFilters. aBlock value. self addEmptyDefault ] -{ #category : 'accessing' } +{ #category : #accessing } GtFiltersElement >> clearFilters [ [ self childrenCount > 1 ] whileTrue: [ self removeChildAt: 1 ] ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtFiltersElement >> createNewTag [ | tag | self descriptors isEmptyOrNil ifTrue: [ ^ self ]. @@ -77,18 +77,18 @@ GtFiltersElement >> createNewTag [ tag activateEditor ] -{ #category : 'accessing' } +{ #category : #accessing } GtFiltersElement >> descriptors [ ^ descriptors ] -{ #category : 'accessing' } +{ #category : #accessing } GtFiltersElement >> descriptors: aCollection [ descriptors := aCollection. self addEmptyDefault ] -{ #category : 'accessing' } +{ #category : #accessing } GtFiltersElement >> filtersDo: aBlock [ 1 to: self childrenCount - 1 do: [ :i | | filterTagElement | @@ -99,7 +99,7 @@ GtFiltersElement >> filtersDo: aBlock [ value: filterTagElement valueString ] ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtFiltersElement >> initialize [ super initialize. self hMatchParent. @@ -107,7 +107,7 @@ GtFiltersElement >> initialize [ self addChild: self newAddTagButton as: #newButton ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtFiltersElement >> newAddTagButton [ ^ BrButton new aptitude: diff --git a/src/GToolkit-Coder-UI/GtMethodCoderContextPCRangeChanged.class.st b/src/GToolkit-Coder-UI/GtMethodCoderContextPCRangeChanged.class.st index 19e97b4d7..27036d49c 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderContextPCRangeChanged.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderContextPCRangeChanged.class.st @@ -1,18 +1,18 @@ Class { - #name : 'GtMethodCoderContextPCRangeChanged', - #superclass : 'Announcement', + #name : #GtMethodCoderContextPCRangeChanged, + #superclass : #Announcement, #instVars : [ 'pcRange' ], #category : 'GToolkit-Coder-UI-Coder - Method Events' } -{ #category : 'accessing' } +{ #category : #accessing } GtMethodCoderContextPCRangeChanged >> pcRange [ ^ pcRange ] -{ #category : 'accessing' } +{ #category : #accessing } GtMethodCoderContextPCRangeChanged >> pcRange: anObject [ pcRange := anObject ] diff --git a/src/GToolkit-Coder-UI/GtMethodCoderDebugExampleActionId.class.st b/src/GToolkit-Coder-UI/GtMethodCoderDebugExampleActionId.class.st index bb3c520ff..b47ffedaf 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderDebugExampleActionId.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderDebugExampleActionId.class.st @@ -4,12 +4,12 @@ A button to debug an example " Class { - #name : 'GtMethodCoderDebugExampleActionId', - #superclass : 'GtCoderElementId', + #name : #GtMethodCoderDebugExampleActionId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtMethodCoderDebugExampleActionId >> asSymbol [ ^ #'context-action--debug-example' ] diff --git a/src/GToolkit-Coder-UI/GtMethodCoderDiscardChangesActionId.class.st b/src/GToolkit-Coder-UI/GtMethodCoderDiscardChangesActionId.class.st index 56373e2e8..feaab2c50 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderDiscardChangesActionId.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderDiscardChangesActionId.class.st @@ -4,12 +4,12 @@ A button to discard changes " Class { - #name : 'GtMethodCoderDiscardChangesActionId', - #superclass : 'GtCoderElementId', + #name : #GtMethodCoderDiscardChangesActionId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtMethodCoderDiscardChangesActionId >> asSymbol [ ^ #'main-action--discard-changes' ] diff --git a/src/GToolkit-Coder-UI/GtMethodCoderExtractMethodContextMenuItemId.class.st b/src/GToolkit-Coder-UI/GtMethodCoderExtractMethodContextMenuItemId.class.st index ed0753ce4..2c2c2b666 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderExtractMethodContextMenuItemId.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderExtractMethodContextMenuItemId.class.st @@ -4,12 +4,12 @@ A context menu action to extract a method " Class { - #name : 'GtMethodCoderExtractMethodContextMenuItemId', - #superclass : 'GtCoderElementId', + #name : #GtMethodCoderExtractMethodContextMenuItemId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtMethodCoderExtractMethodContextMenuItemId >> asSymbol [ ^ #'context-menu-item--extract-method' ] diff --git a/src/GToolkit-Coder-UI/GtMethodCoderPlayAndInspectExampleActionId.class.st b/src/GToolkit-Coder-UI/GtMethodCoderPlayAndInspectExampleActionId.class.st index 128044784..997d18135 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderPlayAndInspectExampleActionId.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderPlayAndInspectExampleActionId.class.st @@ -4,12 +4,12 @@ A button to play and inspect an example " Class { - #name : 'GtMethodCoderPlayAndInspectExampleActionId', - #superclass : 'GtCoderElementId', + #name : #GtMethodCoderPlayAndInspectExampleActionId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtMethodCoderPlayAndInspectExampleActionId >> asSymbol [ ^ #'context-action--play-and-inspect-example' ] diff --git a/src/GToolkit-Coder-UI/GtMethodCoderPlayExampleActionId.class.st b/src/GToolkit-Coder-UI/GtMethodCoderPlayExampleActionId.class.st index 955d1fa77..ac6815b8a 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderPlayExampleActionId.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderPlayExampleActionId.class.st @@ -4,12 +4,12 @@ A button to play an example " Class { - #name : 'GtMethodCoderPlayExampleActionId', - #superclass : 'GtCoderElementId', + #name : #GtMethodCoderPlayExampleActionId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtMethodCoderPlayExampleActionId >> asSymbol [ ^ #'context-action--play-example' ] diff --git a/src/GToolkit-Coder-UI/GtMethodCoderSaveAbilityChanged.class.st b/src/GToolkit-Coder-UI/GtMethodCoderSaveAbilityChanged.class.st index a2ad0736f..d6d38647c 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderSaveAbilityChanged.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderSaveAbilityChanged.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtMethodCoderSaveAbilityChanged', - #superclass : 'GtTextualCoderViewModelAnnouncement', + #name : #GtMethodCoderSaveAbilityChanged, + #superclass : #GtTextualCoderViewModelAnnouncement, #category : 'GToolkit-Coder-UI-Coder - Method Events' } diff --git a/src/GToolkit-Coder-UI/GtMethodCoderSaveActionId.class.st b/src/GToolkit-Coder-UI/GtMethodCoderSaveActionId.class.st index b7a2158f7..6ae3d408d 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderSaveActionId.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderSaveActionId.class.st @@ -4,12 +4,12 @@ A button to save a method " Class { - #name : 'GtMethodCoderSaveActionId', - #superclass : 'GtCoderElementId', + #name : #GtMethodCoderSaveActionId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtMethodCoderSaveActionId >> asSymbol [ ^ #'main-action--save' ] diff --git a/src/GToolkit-Coder-UI/GtMethodCoderSaveDisabled.class.st b/src/GToolkit-Coder-UI/GtMethodCoderSaveDisabled.class.st index 9f80acdf6..e1e94dd63 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderSaveDisabled.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderSaveDisabled.class.st @@ -1,23 +1,23 @@ Class { - #name : 'GtMethodCoderSaveDisabled', - #superclass : 'GtMethodCoderSaveAbilityChanged', + #name : #GtMethodCoderSaveDisabled, + #superclass : #GtMethodCoderSaveAbilityChanged, #instVars : [ 'preventors' ], #category : 'GToolkit-Coder-UI-Coder - Method Events' } -{ #category : 'accessing' } +{ #category : #accessing } GtMethodCoderSaveDisabled >> preventors [ ^ preventors ] -{ #category : 'accessing' } +{ #category : #accessing } GtMethodCoderSaveDisabled >> preventors: anObject [ preventors := anObject ] -{ #category : 'evaluating' } +{ #category : #evaluating } GtMethodCoderSaveDisabled >> value [ ^ false ] diff --git a/src/GToolkit-Coder-UI/GtMethodCoderSaveEnabled.class.st b/src/GToolkit-Coder-UI/GtMethodCoderSaveEnabled.class.st index 9245baaa0..043e809f2 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderSaveEnabled.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderSaveEnabled.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtMethodCoderSaveEnabled', - #superclass : 'GtMethodCoderSaveAbilityChanged', + #name : #GtMethodCoderSaveEnabled, + #superclass : #GtMethodCoderSaveAbilityChanged, #category : 'GToolkit-Coder-UI-Coder - Method Events' } -{ #category : 'evaluating' } +{ #category : #evaluating } GtMethodCoderSaveEnabled >> value [ ^ true ] diff --git a/src/GToolkit-Coder-UI/GtMethodCoderTool.class.st b/src/GToolkit-Coder-UI/GtMethodCoderTool.class.st index f8d5a91b9..31b17c2d0 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderTool.class.st @@ -1,33 +1,33 @@ Class { - #name : 'GtMethodCoderTool', - #superclass : 'GtCoderTool', + #name : #GtMethodCoderTool, + #superclass : #GtCoderTool, #instVars : [ 'compiledMethod' ], #category : 'GToolkit-Coder-UI-Tools' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtMethodCoderTool class >> compiledMethod: aMethod [ ^ self new compiledMethod: aMethod ] -{ #category : 'accessing' } +{ #category : #accessing } GtMethodCoderTool >> compiledMethod [ ^ compiledMethod ] -{ #category : 'accessing' } +{ #category : #accessing } GtMethodCoderTool >> compiledMethod: anObject [ compiledMethod := anObject ] -{ #category : 'converting' } +{ #category : #converting } GtMethodCoderTool >> newCoder [ ^ GtCoder forMethod: self compiledMethod ] -{ #category : 'accessing' } +{ #category : #accessing } GtMethodCoderTool >> object [ "compatibility method for ${GLMBlocObjectToSelect}$" ^ self compiledMethod diff --git a/src/GToolkit-Coder-UI/GtMultipleCodersViewModel.class.st b/src/GToolkit-Coder-UI/GtMultipleCodersViewModel.class.st index 825513fb0..8b18e6f5a 100644 --- a/src/GToolkit-Coder-UI/GtMultipleCodersViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtMultipleCodersViewModel.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtMultipleCodersViewModel', - #superclass : 'Object', + #name : #GtMultipleCodersViewModel, + #superclass : #Object, #instVars : [ 'coder', 'coderUIModels' @@ -8,7 +8,7 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'accessing' } +{ #category : #accessing } GtMultipleCodersViewModel >> announcer [ self deprecated: 'Use #coder announcer instead.' @@ -17,42 +17,42 @@ GtMultipleCodersViewModel >> announcer [ ^ self coder announcer ] -{ #category : 'converting' } +{ #category : #converting } GtMultipleCodersViewModel >> asCoderUIModel [ ^ self ] -{ #category : 'converting' } +{ #category : #converting } GtMultipleCodersViewModel >> asElement [ ^ self elementClass new codersUIModel: self; yourself ] -{ #category : 'accessing' } +{ #category : #accessing } GtMultipleCodersViewModel >> coder [ ^ coder ] -{ #category : 'accessing' } +{ #category : #accessing } GtMultipleCodersViewModel >> coder: aGtCodersModel [ coder := aGtCodersModel. self updateCoderUIModels ] -{ #category : 'updating' } +{ #category : #updating } GtMultipleCodersViewModel >> coderUIModelFor: aCoder [ ^ aCoder asCoderUIModel ] -{ #category : 'accessing' } +{ #category : #accessing } GtMultipleCodersViewModel >> coderUIModels [ ^ coderUIModels ] -{ #category : 'accessing' } +{ #category : #accessing } GtMultipleCodersViewModel >> coders [ @@ -63,7 +63,7 @@ GtMultipleCodersViewModel >> coders [ ^ coder ] -{ #category : 'accessing' } +{ #category : #accessing } GtMultipleCodersViewModel >> coders: aGtCodersModel [ self deprecated: 'Please use coder: instead.' @@ -74,19 +74,19 @@ GtMultipleCodersViewModel >> coders: aGtCodersModel [ self coder: aGtCodersModel ] -{ #category : 'accessing' } +{ #category : #accessing } GtMultipleCodersViewModel >> elementClass [ ^ self subclassResponsibility ] -{ #category : 'initialization' } +{ #category : #initialization } GtMultipleCodersViewModel >> initialize [ super initialize. coderUIModels := #() ] -{ #category : 'updating' } +{ #category : #updating } GtMultipleCodersViewModel >> updateCoderUIModels [ | aMappingOfCoderToCoderUI | diff --git a/src/GToolkit-Coder-UI/GtPackageCardElement.class.st b/src/GToolkit-Coder-UI/GtPackageCardElement.class.st index b661591b3..1542c96f0 100644 --- a/src/GToolkit-Coder-UI/GtPackageCardElement.class.st +++ b/src/GToolkit-Coder-UI/GtPackageCardElement.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtPackageCardElement', - #superclass : 'GtCoderCardElement', + #name : #GtPackageCardElement, + #superclass : #GtCoderCardElement, #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'building ui' } +{ #category : #'building ui' } GtPackageCardElement >> detailsLabel [ | extensionMethodsCount | extensionMethodsCount := self extensionMethodsCount. @@ -15,7 +15,7 @@ GtPackageCardElement >> detailsLabel [ ifFalse: [ '' ]) ] -{ #category : 'building ui' } +{ #category : #'building ui' } GtPackageCardElement >> extensionMethodsCount [ | count | count := 0. diff --git a/src/GToolkit-Coder-UI/GtPackageCoderPackageNameId.class.st b/src/GToolkit-Coder-UI/GtPackageCoderPackageNameId.class.st index 9b8a027fb..a8fd5fd30 100644 --- a/src/GToolkit-Coder-UI/GtPackageCoderPackageNameId.class.st +++ b/src/GToolkit-Coder-UI/GtPackageCoderPackageNameId.class.st @@ -4,12 +4,12 @@ An editable label with package name " Class { - #name : 'GtPackageCoderPackageNameId', - #superclass : 'GtCoderElementId', + #name : #GtPackageCoderPackageNameId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtPackageCoderPackageNameId >> asSymbol [ ^ #'package-coder--package-name-editor' ] diff --git a/src/GToolkit-Coder-UI/GtPackageCoderTool.class.st b/src/GToolkit-Coder-UI/GtPackageCoderTool.class.st index 50cbbdca1..cfaa37b26 100644 --- a/src/GToolkit-Coder-UI/GtPackageCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtPackageCoderTool.class.st @@ -1,34 +1,34 @@ Class { - #name : 'GtPackageCoderTool', - #superclass : 'GtCoderTool', + #name : #GtPackageCoderTool, + #superclass : #GtCoderTool, #instVars : [ 'package' ], #category : 'GToolkit-Coder-UI-Tools' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtPackageCoderTool class >> package: aPackage [ ^ self new package: aPackage ] -{ #category : 'converting' } +{ #category : #converting } GtPackageCoderTool >> newCoder [ ^ GtCoder forPackage: self package ] -{ #category : 'accessing' } +{ #category : #accessing } GtPackageCoderTool >> object [ "compatibility method for ${GLMBlocObjectToSelect}$" ^ self package ] -{ #category : 'accessing' } +{ #category : #accessing } GtPackageCoderTool >> package [ ^ package ] -{ #category : 'accessing' } +{ #category : #accessing } GtPackageCoderTool >> package: aPackage [ package := aPackage ] diff --git a/src/GToolkit-Coder-UI/GtPackageCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtPackageCoderViewModel.class.st index 2340a83fd..88ef267a5 100644 --- a/src/GToolkit-Coder-UI/GtPackageCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtPackageCoderViewModel.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtPackageCoderViewModel', - #superclass : 'GtSingleCoderViewModel', + #name : #GtPackageCoderViewModel, + #superclass : #GtSingleCoderViewModel, #category : 'GToolkit-Coder-UI-Coder - Package Model' } diff --git a/src/GToolkit-Coder-UI/GtPackageTagCardElement.class.st b/src/GToolkit-Coder-UI/GtPackageTagCardElement.class.st index 687dacde1..9222d0409 100644 --- a/src/GToolkit-Coder-UI/GtPackageTagCardElement.class.st +++ b/src/GToolkit-Coder-UI/GtPackageTagCardElement.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtPackageTagCardElement', - #superclass : 'GtCoderCardElement', + #name : #GtPackageTagCardElement, + #superclass : #GtCoderCardElement, #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'building ui' } +{ #category : #'building ui' } GtPackageTagCardElement >> detailsLabel [ ^ coder packageTag classes size printString , ' Classes' ] diff --git a/src/GToolkit-Coder-UI/GtPackagesCoderElement.class.st b/src/GToolkit-Coder-UI/GtPackagesCoderElement.class.st index 510d90656..a9a39a4ab 100644 --- a/src/GToolkit-Coder-UI/GtPackagesCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtPackagesCoderElement.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtPackagesCoderElement', - #superclass : 'BlElement', + #name : #GtPackagesCoderElement, + #superclass : #BlElement, #instVars : [ 'packagesCoder', 'contentPane' @@ -8,7 +8,7 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Packages' } -{ #category : 'private - ui' } +{ #category : #'private - ui' } GtPackagesCoderElement >> buildContentPane [ contentPane := BlElement new. contentPane layout: BlLinearLayout horizontal. @@ -20,7 +20,7 @@ GtPackagesCoderElement >> buildContentPane [ ^ contentPane ] -{ #category : 'private - ui' } +{ #category : #'private - ui' } GtPackagesCoderElement >> buildPackageList [ ^ BrSimpleList new itemStencil: [ GtPackageCardElement new ]; @@ -32,7 +32,7 @@ GtPackagesCoderElement >> buildPackageList [ addEventFilterOn: BlClickEvent do: [ :anEvent | self requestFocus ] ] -{ #category : 'private - ui' } +{ #category : #'private - ui' } GtPackagesCoderElement >> buildPackagesElement [ | element | element := BlElement new. @@ -61,7 +61,7 @@ GtPackagesCoderElement >> buildPackagesElement [ ^ element ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtPackagesCoderElement >> coders: aPackagesCoder [ | coderElement | @@ -74,7 +74,7 @@ GtPackagesCoderElement >> coders: aPackagesCoder [ addChild: coderElement as: #coder. ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtPackagesCoderElement >> codersUIModel: aPackagesCoder [ | coderElement | @@ -87,7 +87,7 @@ GtPackagesCoderElement >> codersUIModel: aPackagesCoder [ addChild: coderElement as: #coder. ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtPackagesCoderElement >> initialize [ super initialize. self diff --git a/src/GToolkit-Coder-UI/GtPackagesCoderUIModel.class.st b/src/GToolkit-Coder-UI/GtPackagesCoderUIModel.class.st index e8ce72f9d..9c26d3c71 100644 --- a/src/GToolkit-Coder-UI/GtPackagesCoderUIModel.class.st +++ b/src/GToolkit-Coder-UI/GtPackagesCoderUIModel.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtPackagesCoderUIModel', - #superclass : 'GtMultipleCodersViewModel', + #name : #GtPackagesCoderUIModel, + #superclass : #GtMultipleCodersViewModel, #category : 'GToolkit-Coder-UI-Coder - Packages Model' } -{ #category : 'accessing' } +{ #category : #accessing } GtPackagesCoderUIModel >> elementClass [ ^ GtPackagesCoderElement ] diff --git a/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st b/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st index 4c456c810..bdc69db3c 100644 --- a/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtPlaygroundEvaluatedCodeButtonAttribute', - #superclass : 'BrTextAdornmentAttribute', + #name : #GtPlaygroundEvaluatedCodeButtonAttribute, + #superclass : #BrTextAdornmentAttribute, #instVars : [ 'result', 'action', @@ -9,17 +9,17 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Source Attributes' } -{ #category : 'accessing' } +{ #category : #accessing } GtPlaygroundEvaluatedCodeButtonAttribute >> action [ ^ action ] -{ #category : 'accessing' } +{ #category : #accessing } GtPlaygroundEvaluatedCodeButtonAttribute >> action: aBlock [ action := aBlock ] -{ #category : 'initialization' } +{ #category : #initialization } GtPlaygroundEvaluatedCodeButtonAttribute >> affect: aTBrTextEditorTextualPiece in: anEditorElement [ | aButton | @@ -55,22 +55,22 @@ GtPlaygroundEvaluatedCodeButtonAttribute >> affect: aTBrTextEditorTextualPiece i yourself ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtPlaygroundEvaluatedCodeButtonAttribute >> clickEvent: anEvent from: aButton [ self action cull: aButton cull: anEvent ] -{ #category : 'accessing' } +{ #category : #accessing } GtPlaygroundEvaluatedCodeButtonAttribute >> coder [ ^ coder ] -{ #category : 'accessing' } +{ #category : #accessing } GtPlaygroundEvaluatedCodeButtonAttribute >> coder: anObject [ coder := anObject ] -{ #category : 'initialization' } +{ #category : #initialization } GtPlaygroundEvaluatedCodeButtonAttribute >> initialize [ super initialize. self beAppend. @@ -80,22 +80,22 @@ GtPlaygroundEvaluatedCodeButtonAttribute >> initialize [ withDestination: self spawnDestination ] ] -{ #category : 'testing' } +{ #category : #testing } GtPlaygroundEvaluatedCodeButtonAttribute >> mayHaveExternalReferences [ ^ true ] -{ #category : 'accessing' } +{ #category : #accessing } GtPlaygroundEvaluatedCodeButtonAttribute >> result [ ^ result ] -{ #category : 'accessing' } +{ #category : #accessing } GtPlaygroundEvaluatedCodeButtonAttribute >> result: anObject [ result := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtPlaygroundEvaluatedCodeButtonAttribute >> spawnDestination [ ^ self coder ifNil: [ GtPhlowSpawnDesiredDestination defaultDestination ] diff --git a/src/GToolkit-Coder-UI/GtPreviewChangeButton.class.st b/src/GToolkit-Coder-UI/GtPreviewChangeButton.class.st index 8a75841f1..f81c75b18 100644 --- a/src/GToolkit-Coder-UI/GtPreviewChangeButton.class.st +++ b/src/GToolkit-Coder-UI/GtPreviewChangeButton.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtPreviewChangeButton', - #superclass : 'BrButton', + #name : #GtPreviewChangeButton, + #superclass : #BrButton, #instVars : [ 'changeAction', 'changeStencil' @@ -8,7 +8,7 @@ Class { #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'ui' } +{ #category : #ui } GtPreviewChangeButton >> buildDropDownElement [ | element unloadButton | element := BrVerticalPane new @@ -36,27 +36,27 @@ GtPreviewChangeButton >> buildDropDownElement [ ^ element ] -{ #category : 'accessing' } +{ #category : #accessing } GtPreviewChangeButton >> changeAction [ ^ changeAction ] -{ #category : 'accessing' } +{ #category : #accessing } GtPreviewChangeButton >> changeAction: aBlock [ changeAction := aBlock ] -{ #category : 'accessing' } +{ #category : #accessing } GtPreviewChangeButton >> changeStencil [ ^ changeStencil ] -{ #category : 'accessing' } +{ #category : #accessing } GtPreviewChangeButton >> changeStencil: aStencil [ changeStencil := aStencil asStencil ] -{ #category : 'ui' } +{ #category : #ui } GtPreviewChangeButton >> initialize [ super initialize. diff --git a/src/GToolkit-Coder-UI/GtRBAddPoolVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/GtRBAddPoolVariableRefactoring.extension.st index acb8c6364..b96c948fc 100644 --- a/src/GToolkit-Coder-UI/GtRBAddPoolVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/GtRBAddPoolVariableRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'GtRBAddPoolVariableRefactoring' } +Extension { #name : #GtRBAddPoolVariableRefactoring } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtRBAddPoolVariableRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/GtRBAddTraitUsageRefactoring.extension.st b/src/GToolkit-Coder-UI/GtRBAddTraitUsageRefactoring.extension.st index e4955350b..e382afddd 100644 --- a/src/GToolkit-Coder-UI/GtRBAddTraitUsageRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/GtRBAddTraitUsageRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'GtRBAddTraitUsageRefactoring' } +Extension { #name : #GtRBAddTraitUsageRefactoring } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtRBAddTraitUsageRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/GtRBChangeSuperclassRefactoring.extension.st b/src/GToolkit-Coder-UI/GtRBChangeSuperclassRefactoring.extension.st index f8e47f96a..09f61b996 100644 --- a/src/GToolkit-Coder-UI/GtRBChangeSuperclassRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/GtRBChangeSuperclassRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'GtRBChangeSuperclassRefactoring' } +Extension { #name : #GtRBChangeSuperclassRefactoring } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtRBChangeSuperclassRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/GtRBRemovePoolVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/GtRBRemovePoolVariableRefactoring.extension.st index 4d065f953..c4b8628ad 100644 --- a/src/GToolkit-Coder-UI/GtRBRemovePoolVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/GtRBRemovePoolVariableRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'GtRBRemovePoolVariableRefactoring' } +Extension { #name : #GtRBRemovePoolVariableRefactoring } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtRBRemovePoolVariableRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/GtRBRemoveTraitUsageRefactoring.extension.st b/src/GToolkit-Coder-UI/GtRBRemoveTraitUsageRefactoring.extension.st index 29f986d53..c52704dd8 100644 --- a/src/GToolkit-Coder-UI/GtRBRemoveTraitUsageRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/GtRBRemoveTraitUsageRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'GtRBRemoveTraitUsageRefactoring' } +Extension { #name : #GtRBRemoveTraitUsageRefactoring } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtRBRemoveTraitUsageRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/GtReadyCoderTool.class.st b/src/GToolkit-Coder-UI/GtReadyCoderTool.class.st index bf85f7c01..ac71d2f72 100644 --- a/src/GToolkit-Coder-UI/GtReadyCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtReadyCoderTool.class.st @@ -1,25 +1,25 @@ Class { - #name : 'GtReadyCoderTool', - #superclass : 'GtPhlowTool', + #name : #GtReadyCoderTool, + #superclass : #GtPhlowTool, #instVars : [ 'coder' ], #category : 'GToolkit-Coder-UI-Tools' } -{ #category : 'accessing' } +{ #category : #accessing } GtReadyCoderTool class >> coder: aCoder [ ^ self new coder: aCoder ] -{ #category : 'converting' } +{ #category : #converting } GtReadyCoderTool >> asElementDo: aOneArgBlock [ "Create a tool element and execute the block." ^ aOneArgBlock cull: (GtCoder forCoder: self coder) asPagerPageElement ] -{ #category : 'accessing' } +{ #category : #accessing } GtReadyCoderTool >> assertCoder: aCoder [ self assert: [ aCoder isNotNil ] @@ -29,28 +29,28 @@ GtReadyCoderTool >> assertCoder: aCoder [ description: [ 'Coder cannot be an element because it may be added to a space graph several times' ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtReadyCoderTool >> coder [ ^ coder ] -{ #category : 'accessing' } +{ #category : #accessing } GtReadyCoderTool >> coder: aCoder [ self assertCoder: aCoder. coder := aCoder ] -{ #category : 'api - converting' } +{ #category : #'api - converting' } GtReadyCoderTool >> icon [ ^ BrGlamorousVectorIcons browse ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtReadyCoderTool >> name [ ^ 'coder' ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtReadyCoderTool >> tabLook [ ^ BrGlamorousTabSwitcherWithIconAptitude ] diff --git a/src/GToolkit-Coder-UI/GtRefactoringsPreviewAcceptId.class.st b/src/GToolkit-Coder-UI/GtRefactoringsPreviewAcceptId.class.st index 238fde373..59d8faa1d 100644 --- a/src/GToolkit-Coder-UI/GtRefactoringsPreviewAcceptId.class.st +++ b/src/GToolkit-Coder-UI/GtRefactoringsPreviewAcceptId.class.st @@ -4,12 +4,12 @@ A button to apply refactorings from a preview dropdown " Class { - #name : 'GtRefactoringsPreviewAcceptId', - #superclass : 'GtCoderElementId', + #name : #GtRefactoringsPreviewAcceptId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtRefactoringsPreviewAcceptId >> asSymbol [ ^ #'refactorings-preview--accept' ] diff --git a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st index 15d456983..d1ab1d432 100644 --- a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st @@ -5,8 +5,8 @@ Wraps {{gtClass:GtCoderModel}} and optionally adds UI related api and state. Cod " Class { - #name : 'GtSingleCoderViewModel', - #superclass : 'Object', + #name : #GtSingleCoderViewModel, + #superclass : #Object, #traits : 'TGtAnnouncer + TGtWithCoderModel', #classTraits : 'TGtAnnouncer classTrait + TGtWithCoderModel classTrait', #instVars : [ @@ -16,64 +16,64 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'accessing' } +{ #category : #accessing } GtSingleCoderViewModel >> announcer [ ^ announcer ifNil: [ announcer := Announcer new ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtSingleCoderViewModel >> announcerUIModel [ ^ self announcer ] -{ #category : 'converting' } +{ #category : #converting } GtSingleCoderViewModel >> asCoderUIModel [ ^ self ] -{ #category : 'converting' } +{ #category : #converting } GtSingleCoderViewModel >> asElement [ ^ self elementClass new coderUIModel: self; yourself ] -{ #category : 'accessing' } +{ #category : #accessing } GtSingleCoderViewModel >> coder [ ^ self coderModel ] -{ #category : 'accessing' } +{ #category : #accessing } GtSingleCoderViewModel >> coder: anObject [ self coderModel: anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtSingleCoderViewModel >> coderLook [ ^ self coder coderLook ] -{ #category : 'accessing' } +{ #category : #accessing } GtSingleCoderViewModel >> coders [ ^ self coder coders ] -{ #category : 'accessing' } +{ #category : #accessing } GtSingleCoderViewModel >> codersUIModel [ ^ codersUIModel ] -{ #category : 'accessing' } +{ #category : #accessing } GtSingleCoderViewModel >> codersUIModel: anObject [ codersUIModel := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtSingleCoderViewModel >> elementClass [ ^ self subclassResponsibility ] -{ #category : 'gt-extension' } +{ #category : #'gt-extension' } GtSingleCoderViewModel >> gtLiveFor: aView [ @@ -84,7 +84,7 @@ GtSingleCoderViewModel >> gtLiveFor: aView [ view: #gtLiveFor: ] -{ #category : 'accessing' } +{ #category : #accessing } GtSingleCoderViewModel >> hasFocus [ self @@ -94,7 +94,7 @@ GtSingleCoderViewModel >> hasFocus [ ^ self focused ] -{ #category : 'accessing' } +{ #category : #accessing } GtSingleCoderViewModel >> hasFocus: aBoolean [ self deprecated: 'Please use #focused: instead.' @@ -105,17 +105,17 @@ GtSingleCoderViewModel >> hasFocus: aBoolean [ self focused: aBoolean ] -{ #category : 'testing' } +{ #category : #testing } GtSingleCoderViewModel >> isModified [ ^ self coder isModified ] -{ #category : 'api - coder model' } +{ #category : #'api - coder model' } GtSingleCoderViewModel >> onCoderModelChanged [ "Is sent when a new coder model is assigned to the view model" ] -{ #category : 'accessing' } +{ #category : #accessing } GtSingleCoderViewModel >> programCounterRange [ "This is workwound util the method coder context had a dedicated element. Now the element for displaying a coder is shared between all types of coders." diff --git a/src/GToolkit-Coder-UI/GtSourceCoderAptitude.class.st b/src/GToolkit-Coder-UI/GtSourceCoderAptitude.class.st index fb736b5fe..7e976497c 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderAptitude.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtSourceCoderAptitude', - #superclass : 'BrAptitude', + #name : #GtSourceCoderAptitude, + #superclass : #BrAptitude, #category : 'GToolkit-Coder-UI-Coder - Source Look' } -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtSourceCoderAptitude >> coder [ self deprecated: 'Please use #sourceCoderUIModel instead' @@ -13,7 +13,7 @@ GtSourceCoderAptitude >> coder [ ^ self sourceCoderUIModel ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderAptitude >> initializeListeners [ super initializeListeners. @@ -22,18 +22,18 @@ GtSourceCoderAptitude >> initializeListeners [ ifNotNil: [ :aSourceCoder | self onCoderChanged: aSourceCoder ] ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderAptitude >> initializeRequests [ super initializeRequests. self request: GtSourceCoderContentCoderRequest new ] -{ #category : 'hooks' } +{ #category : #hooks } GtSourceCoderAptitude >> onCoderChanged: aGtSourceCoder [ ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtSourceCoderAptitude >> sourceCoderUIModel [ diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbAction.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbAction.class.st index d8a04fc9a..e35501f0f 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbAction.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbAction.class.st @@ -1,22 +1,22 @@ Class { - #name : 'GtSourceCoderBreadcrumbAction', - #superclass : 'Object', + #name : #GtSourceCoderBreadcrumbAction, + #superclass : #Object, #category : 'GToolkit-Coder-UI-Coder - Source Model' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderBreadcrumbAction >> foreground [ ^ BrGlamorousColors defaultButtonTextColor ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderBreadcrumbAction >> name [ ^ self subclassResponsibility ] -{ #category : 'action' } +{ #category : #action } GtSourceCoderBreadcrumbAction >> performSourceCoderActionFrom: anElement [ self subclassResponsibility ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbSpawnBehaviorAction.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbSpawnBehaviorAction.class.st index 90fd336b5..3c2b3d555 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbSpawnBehaviorAction.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbSpawnBehaviorAction.class.st @@ -1,30 +1,30 @@ Class { - #name : 'GtSourceCoderBreadcrumbSpawnBehaviorAction', - #superclass : 'GtSourceCoderBreadcrumbAction', + #name : #GtSourceCoderBreadcrumbSpawnBehaviorAction, + #superclass : #GtSourceCoderBreadcrumbAction, #instVars : [ 'methodBehavior' ], #category : 'GToolkit-Coder-UI-Coder - Source Model' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderBreadcrumbSpawnBehaviorAction >> foreground [ ^ self methodBehavior exists ifTrue: [ BrGlamorousColors defaultButtonTextColor ] ifFalse: [ BrGlamorousColors linkWithErrorColor ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderBreadcrumbSpawnBehaviorAction >> methodBehavior [ ^ methodBehavior ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderBreadcrumbSpawnBehaviorAction >> methodBehavior: anObject [ methodBehavior := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderBreadcrumbSpawnBehaviorAction >> name [ @@ -36,7 +36,7 @@ GtSourceCoderBreadcrumbSpawnBehaviorAction >> name [ ifAbsent: [ '(Unspecified)' ] ] -{ #category : 'action' } +{ #category : #action } GtSourceCoderBreadcrumbSpawnBehaviorAction >> performSourceCoderActionFrom: anElement [ self methodBehavior realBehaviorDo: [ :aBehavior | @@ -46,7 +46,7 @@ GtSourceCoderBreadcrumbSpawnBehaviorAction >> performSourceCoderActionFrom: anEl anElement phlow spawnTool: (GtInspectorTool forObject: self methodBehavior). ] -{ #category : 'printing' } +{ #category : #printing } GtSourceCoderBreadcrumbSpawnBehaviorAction >> printOn: aStream [ aStream nextPutAll: 'Spawn '; diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbSpawnPackageAction.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbSpawnPackageAction.class.st index c60509a6e..ce3708db7 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbSpawnPackageAction.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbSpawnPackageAction.class.st @@ -1,25 +1,25 @@ Class { - #name : 'GtSourceCoderBreadcrumbSpawnPackageAction', - #superclass : 'GtSourceCoderBreadcrumbAction', + #name : #GtSourceCoderBreadcrumbSpawnPackageAction, + #superclass : #GtSourceCoderBreadcrumbAction, #instVars : [ 'package' ], #category : 'GToolkit-Coder-UI-Coder - Source Model' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderBreadcrumbSpawnPackageAction >> name [ ^ self package name ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderBreadcrumbSpawnPackageAction >> package [ ^ package ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderBreadcrumbSpawnPackageAction >> package: aPackage [ self assert: [ aPackage notNil ] @@ -28,12 +28,12 @@ GtSourceCoderBreadcrumbSpawnPackageAction >> package: aPackage [ package := aPackage ] -{ #category : 'action' } +{ #category : #action } GtSourceCoderBreadcrumbSpawnPackageAction >> performSourceCoderActionFrom: anElement [ anElement phlow spawnTool: (GtPackageCoderTool package: self package) ] -{ #category : 'printing' } +{ #category : #printing } GtSourceCoderBreadcrumbSpawnPackageAction >> printOn: aStream [ aStream nextPutAll: 'Spawn '; diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBrowseBehaviorShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBrowseBehaviorShortcut.class.st index 598813cc0..0865b9658 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderBrowseBehaviorShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderBrowseBehaviorShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : 'GtSourceCoderBrowseBehaviorShortcut', - #superclass : 'GtSourceCoderShortcut', + #name : #GtSourceCoderBrowseBehaviorShortcut, + #superclass : #GtSourceCoderShortcut, #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderBrowseBehaviorShortcut >> description [ ^ 'Browses behavior (class, method, pool etc) near the cursor or selection.' ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderBrowseBehaviorShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryB ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderBrowseBehaviorShortcut >> name [ ^ 'Browse behavior' ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderBrowseBehaviorShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent [ self diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBrowseImplementorsShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBrowseImplementorsShortcut.class.st index 5d783a67f..07055ec6e 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderBrowseImplementorsShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderBrowseImplementorsShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : 'GtSourceCoderBrowseImplementorsShortcut', - #superclass : 'GtSourceCoderShortcut', + #name : #GtSourceCoderBrowseImplementorsShortcut, + #superclass : #GtSourceCoderShortcut, #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderBrowseImplementorsShortcut >> description [ ^ 'Browses implementors of the method near the cursor or selection.' ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderBrowseImplementorsShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryM ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderBrowseImplementorsShortcut >> name [ ^ 'Browse implementors' ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderBrowseImplementorsShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent [ self forEditor: aBrTextEditor diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBrowseReferencesShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBrowseReferencesShortcut.class.st index 739026dcb..7ebf707d4 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderBrowseReferencesShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderBrowseReferencesShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : 'GtSourceCoderBrowseReferencesShortcut', - #superclass : 'GtSourceCoderShortcut', + #name : #GtSourceCoderBrowseReferencesShortcut, + #superclass : #GtSourceCoderShortcut, #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderBrowseReferencesShortcut >> description [ ^ 'Browses references of the class or sender of the method near the cursor or selection.' ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderBrowseReferencesShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryN ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderBrowseReferencesShortcut >> name [ ^ 'Browse references' ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderBrowseReferencesShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent [ self forEditor: aBrTextEditor diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st index d4e718ee8..cda0c0d36 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtSourceCoderCollapsedContentElement', - #superclass : 'GtSourceCoderContentElement', + #name : #GtSourceCoderCollapsedContentElement, + #superclass : #GtSourceCoderContentElement, #category : 'GToolkit-Coder-UI-Coder - Source' } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAndExampleAptitude.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAndExampleAptitude.class.st index 3e5af1e1f..71441361f 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAndExampleAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAndExampleAptitude.class.st @@ -12,8 +12,8 @@ If a method is ** an example, I omit displaying the example result: {{gtExample: " Class { - #name : 'GtSourceCoderCollapsedTextAndExampleAptitude', - #superclass : 'GtSourceCoderAptitude', + #name : #GtSourceCoderCollapsedTextAndExampleAptitude, + #superclass : #GtSourceCoderAptitude, #instVars : [ 'container', 'methodLabel', @@ -22,24 +22,24 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Source Look' } -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtSourceCoderCollapsedTextAndExampleAptitude >> container [ ^ container ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtSourceCoderCollapsedTextAndExampleAptitude >> exampleElement [ ^ exampleElement ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtSourceCoderCollapsedTextAndExampleAptitude >> hide [ self exampleElement visibility: BlVisibility hidden ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderCollapsedTextAndExampleAptitude >> initialize [ super initialize. self initializeMethodLabel. @@ -53,20 +53,20 @@ GtSourceCoderCollapsedTextAndExampleAptitude >> initialize [ self addChangeAddChildAs: #(content label) with: [ self container ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderCollapsedTextAndExampleAptitude >> initializeContainer [ container := BrHorizontalPane new fitContent; alignCenterLeft ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderCollapsedTextAndExampleAptitude >> initializeExampleElement [ exampleElement := GtCoderExampleStateElement new margin: (BlInsets top: 4 left: 1 bottom: 1 right: 1). ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderCollapsedTextAndExampleAptitude >> initializeListeners [ super initializeListeners. @@ -77,19 +77,19 @@ GtSourceCoderCollapsedTextAndExampleAptitude >> initializeListeners [ focused: true ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderCollapsedTextAndExampleAptitude >> initializeMethodLabel [ methodLabel := BrLabel new aptitude: BrGlamorousLabelAptitude new editorMeasurement bold glamorousCodeFont ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtSourceCoderCollapsedTextAndExampleAptitude >> methodLabel [ ^ methodLabel ] -{ #category : 'hooks' } +{ #category : #hooks } GtSourceCoderCollapsedTextAndExampleAptitude >> onCoderChanged: aGtSourceCoderUIModel [ self widget coderUIModel ifNotNil: [ :aPreviousCoder | aPreviousCoder coder announcer unsubscribe: self ]. @@ -104,22 +104,22 @@ GtSourceCoderCollapsedTextAndExampleAptitude >> onCoderChanged: aGtSourceCoderUI to: self ] -{ #category : 'private - announcement handling' } +{ #category : #'private - announcement handling' } GtSourceCoderCollapsedTextAndExampleAptitude >> onCollapsedLabelChanged: anAnnouncement [ self updateLabelsFor: anAnnouncement coder ] -{ #category : 'private - announcement handling' } +{ #category : #'private - announcement handling' } GtSourceCoderCollapsedTextAndExampleAptitude >> onExampleExecuted: anAnnouncement [ self updateExampleElementFor: anAnnouncement coder ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtSourceCoderCollapsedTextAndExampleAptitude >> show [ self exampleElement visibility: BlVisibility visible ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtSourceCoderCollapsedTextAndExampleAptitude >> updateExampleElementFor: aSourceCoder [ aSourceCoder canExecuteExample ifFalse: [ self hide. @@ -129,13 +129,13 @@ GtSourceCoderCollapsedTextAndExampleAptitude >> updateExampleElementFor: aSource self exampleElement example: aSourceCoder example ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtSourceCoderCollapsedTextAndExampleAptitude >> updateLabelsFor: aSourceCoder [ self updateMethodLabelFor: aSourceCoder. self updateExampleElementFor: aSourceCoder. ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtSourceCoderCollapsedTextAndExampleAptitude >> updateMethodLabelFor: aSourceCoder [ self methodLabel text: aSourceCoder collapsedText ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAptitude.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAptitude.class.st index 058be9f4f..56a1594fb 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAptitude.class.st @@ -1,13 +1,13 @@ Class { - #name : 'GtSourceCoderCollapsedTextAptitude', - #superclass : 'GtSourceCoderAptitude', + #name : #GtSourceCoderCollapsedTextAptitude, + #superclass : #GtSourceCoderAptitude, #instVars : [ 'label' ], #category : 'GToolkit-Coder-UI-Coder - Source Look' } -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderCollapsedTextAptitude >> initialize [ super initialize. @@ -15,7 +15,7 @@ GtSourceCoderCollapsedTextAptitude >> initialize [ self addChangeAddChildAs: { #content . GtSourceCoderCollapsedTextId } with: [ label ]. ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderCollapsedTextAptitude >> initializeListeners [ super initializeListeners. @@ -26,13 +26,13 @@ GtSourceCoderCollapsedTextAptitude >> initializeListeners [ focused: true ] ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtSourceCoderCollapsedTextAptitude >> newLabel [ ^ BrLabel new aptitude: BrGlamorousLabelAptitude new editorMeasurement bold glamorousCodeFont ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderCollapsedTextAptitude >> onCoderChanged: aGtSourceCoderUIModel [ self widget coderUIModel ifNotNil: [ :aPreviousCoder | aPreviousCoder coder announcer unsubscribe: self ]. @@ -43,12 +43,12 @@ GtSourceCoderCollapsedTextAptitude >> onCoderChanged: aGtSourceCoderUIModel [ to: self ] -{ #category : 'private' } +{ #category : #private } GtSourceCoderCollapsedTextAptitude >> updateLabel: anAnnouncement [ self updateLabelFor: anAnnouncement coder ] -{ #category : 'private' } +{ #category : #private } GtSourceCoderCollapsedTextAptitude >> updateLabelFor: aSourceCoder [ label text: aSourceCoder collapsedText ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextId.class.st index ca1fac794..787a7450e 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextId.class.st @@ -4,12 +4,12 @@ A label that shows a collapsed text of the source coder " Class { - #name : 'GtSourceCoderCollapsedTextId', - #superclass : 'GtCoderElementId', + #name : #GtSourceCoderCollapsedTextId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtSourceCoderCollapsedTextId >> asSymbol [ ^ 'source-coder--collapsed-text' ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderContentCoderChanged.class.st b/src/GToolkit-Coder-UI/GtSourceCoderContentCoderChanged.class.st index c771f5621..b2c0ddcf9 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderContentCoderChanged.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderContentCoderChanged.class.st @@ -1,18 +1,18 @@ Class { - #name : 'GtSourceCoderContentCoderChanged', - #superclass : 'BrChangeEvent', + #name : #GtSourceCoderContentCoderChanged, + #superclass : #BrChangeEvent, #instVars : [ 'sourceCoder' ], #category : 'GToolkit-Coder-UI-Coder - Source Events' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderContentCoderChanged >> sourceCoder [ ^ sourceCoder ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderContentCoderChanged >> sourceCoder: anObject [ sourceCoder := anObject ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderContentCoderRequest.class.st b/src/GToolkit-Coder-UI/GtSourceCoderContentCoderRequest.class.st index 486e2c629..158fc6092 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderContentCoderRequest.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderContentCoderRequest.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtSourceCoderContentCoderRequest', - #superclass : 'BrRequest', + #name : #GtSourceCoderContentCoderRequest, + #superclass : #BrRequest, #category : 'GToolkit-Coder-UI-Coder - Source Events' } -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderContentCoderRequest >> responseClass [ ^ GtSourceCoderContentCoderChanged ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st index 87866461c..a1ce2405d 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st @@ -1,12 +1,12 @@ Class { - #name : 'GtSourceCoderContentElement', - #superclass : 'BlElement', + #name : #GtSourceCoderContentElement, + #superclass : #BlElement, #traits : 'TBrLayoutResizable', #classTraits : 'TBrLayoutResizable classTrait', #category : 'GToolkit-Coder-UI-Coder - Source' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderContentElement >> coder [ self deprecated: 'Use #coderUIModel instead.' @@ -15,7 +15,7 @@ GtSourceCoderContentElement >> coder [ ^ self coderUIModel ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderContentElement >> coder: aCoder [ self @@ -25,14 +25,14 @@ GtSourceCoderContentElement >> coder: aCoder [ self coderUIModel: aCoder ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderContentElement >> coderUIModel [ ^ self viewModel sourceCoder ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderContentElement >> coderUIModel: aGtSourceCoderUIModel [ self telemetry @@ -40,7 +40,7 @@ GtSourceCoderContentElement >> coderUIModel: aGtSourceCoderUIModel [ during: [ self viewModel sourceCoder: aGtSourceCoderUIModel ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderContentElement >> gtAllShortcutsFor: aView [ self shortcuts ifEmpty: [ ^ aView empty ]. @@ -52,7 +52,7 @@ GtSourceCoderContentElement >> gtAllShortcutsFor: aView [ column: 'Action' text: [ :each | each action asString ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderContentElement >> initialize [ super initialize. self diff --git a/src/GToolkit-Coder-UI/GtSourceCoderContentModel.class.st b/src/GToolkit-Coder-UI/GtSourceCoderContentModel.class.st index 479413d8b..16056f9fb 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderContentModel.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderContentModel.class.st @@ -1,32 +1,32 @@ Class { - #name : 'GtSourceCoderContentModel', - #superclass : 'BrWidgetModel', + #name : #GtSourceCoderContentModel, + #superclass : #BrWidgetModel, #instVars : [ 'sourceCoder' ], #category : 'GToolkit-Coder-UI-Coder - Source' } -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderContentModel >> initializeListeners [ super initializeListeners. self when: GtSourceCoderContentCoderRequest reply: [ :aResponse | aResponse sourceCoder: self sourceCoder ] ] -{ #category : 'private - notifying' } +{ #category : #'private - notifying' } GtSourceCoderContentModel >> notifySourceCoderChanged: aGtSourceCoderUIModel [ self dispatchEvent: (GtSourceCoderContentCoderChanged new sourceCoder: aGtSourceCoderUIModel) ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderContentModel >> sourceCoder [ ^ sourceCoder ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderContentModel >> sourceCoder: aGtSourceCoderUIModel [ self assert: [ aGtSourceCoderUIModel isKindOf: GtSourceCoderViewModel ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDebugActionId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDebugActionId.class.st index 992cf5b6c..0792ab00a 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderDebugActionId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderDebugActionId.class.st @@ -4,12 +4,12 @@ A button to debug a piece of code " Class { - #name : 'GtSourceCoderDebugActionId', - #superclass : 'GtCoderElementId', + #name : #GtSourceCoderDebugActionId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtSourceCoderDebugActionId >> asSymbol [ ^ #'source-coder--debug-action' ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDiscardChangesShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDiscardChangesShortcut.class.st index 6cd905866..98e151ee5 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderDiscardChangesShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderDiscardChangesShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : 'GtSourceCoderDiscardChangesShortcut', - #superclass : 'GtSourceCoderShortcut', + #name : #GtSourceCoderDiscardChangesShortcut, + #superclass : #GtSourceCoderShortcut, #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderDiscardChangesShortcut >> description [ ^ 'Discards changes done to the source code.' ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderDiscardChangesShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryL ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderDiscardChangesShortcut >> name [ ^ 'Discard changes' ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderDiscardChangesShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ aSourceCoderViewModel discardChanges ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDoItActionId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDoItActionId.class.st index a7fd16ded..88cf554d0 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderDoItActionId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderDoItActionId.class.st @@ -4,12 +4,12 @@ A button to evaluate a source code " Class { - #name : 'GtSourceCoderDoItActionId', - #superclass : 'GtCoderElementId', + #name : #GtSourceCoderDoItActionId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtSourceCoderDoItActionId >> asSymbol [ ^ 'source-coder--doit-action' ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDoItAndGoActionId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDoItAndGoActionId.class.st index 1f0f8e1fb..d1fcc813a 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderDoItAndGoActionId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderDoItAndGoActionId.class.st @@ -4,12 +4,12 @@ A button to evaluate and inspect the result " Class { - #name : 'GtSourceCoderDoItAndGoActionId', - #superclass : 'GtCoderElementId', + #name : #GtSourceCoderDoItAndGoActionId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtSourceCoderDoItAndGoActionId >> asSymbol [ ^ #'source-coder--doit-and-go-action' ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectShortcut.class.st index 25c1c5eff..9fe5585b6 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : 'GtSourceCoderDoItAndInspectShortcut', - #superclass : 'GtSourceCoderShortcut', + #name : #GtSourceCoderDoItAndInspectShortcut, + #superclass : #GtSourceCoderShortcut, #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderDoItAndInspectShortcut >> description [ ^ 'Evaluates the whole source code or just the selection and inspects the result.' ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderDoItAndInspectShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryG ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderDoItAndInspectShortcut >> name [ ^ 'Do it and inspect' ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderDoItAndInspectShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ GtCoderExecutionContextVariable element: aBrEditorElement diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDoItShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDoItShortcut.class.st index 01aadb3b2..edfc70fb3 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderDoItShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderDoItShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : 'GtSourceCoderDoItShortcut', - #superclass : 'GtSourceCoderShortcut', + #name : #GtSourceCoderDoItShortcut, + #superclass : #GtSourceCoderShortcut, #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderDoItShortcut >> description [ ^ 'Evaluates the whole source code (method) or just the selection.' ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderDoItShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryD ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderDoItShortcut >> name [ ^ 'Do it' ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderDoItShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ GtCoderExecutionContextVariable element: aBrEditorElement diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEditorAptitude.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEditorAptitude.class.st index fe63c8fe8..2b2d678b0 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEditorAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEditorAptitude.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtSourceCoderEditorAptitude', - #superclass : 'GtSourceCoderAptitude', + #name : #GtSourceCoderEditorAptitude, + #superclass : #GtSourceCoderAptitude, #instVars : [ 'sourceCoderUIModel', 'editorElement', @@ -11,14 +11,14 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Source Look' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEditorAptitude >> editorElement [ ^ editorElement ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderEditorAptitude >> initialize [ super initialize. @@ -31,19 +31,19 @@ GtSourceCoderEditorAptitude >> initialize [ self add: (BrLayoutResizerAptitude new inherit: editorElement) ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtSourceCoderEditorAptitude >> newActionsElement [ ^ GtCoderActionsElement new margin: (BlInsets top: 5); yourself ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtSourceCoderEditorAptitude >> newEditorElement [ ^ GtSourceCoderEditorElement new ] -{ #category : 'hooks' } +{ #category : #hooks } GtSourceCoderEditorAptitude >> onCoderChanged: aGtSourceCoderUIModel [ actions coderUIModel: aGtSourceCoderUIModel. editorElement textualCoderViewModel: aGtSourceCoderUIModel diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st index 744235ca7..c72b0da14 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtSourceCoderEditorElement', - #superclass : 'GtTextualCoderEditorElement', + #name : #GtSourceCoderEditorElement, + #superclass : #GtTextualCoderEditorElement, #category : 'GToolkit-Coder-UI-Coder - Textual' } -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } GtSourceCoderEditorElement >> onTextualCoderViewModelChanged [ super onTextualCoderViewModelChanged. diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEditorId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEditorId.class.st index dd9300106..da201c803 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEditorId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEditorId.class.st @@ -4,12 +4,12 @@ Text editor within the source coder " Class { - #name : 'GtSourceCoderEditorId', - #superclass : 'GtCoderElementId', + #name : #GtSourceCoderEditorId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtSourceCoderEditorId >> asSymbol [ ^ #editor ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEmbeddedExpanderToggleId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEmbeddedExpanderToggleId.class.st index 3c4ee2c79..33398803a 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEmbeddedExpanderToggleId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEmbeddedExpanderToggleId.class.st @@ -2,12 +2,12 @@ An element to toggle an embedded expandable element within the text of the source coder. An examples can be an expandable method or a baseline name. " Class { - #name : 'GtSourceCoderEmbeddedExpanderToggleId', - #superclass : 'GtCoderElementId', + #name : #GtSourceCoderEmbeddedExpanderToggleId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtSourceCoderEmbeddedExpanderToggleId >> asSymbol [ ^ #'source-coder--embedded-expander-toggle' ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st index 18287f433..915e2ce4c 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st @@ -1,13 +1,13 @@ Class { - #name : 'GtSourceCoderErrorAttribute', - #superclass : 'BrTextAdornmentAttribute', + #name : #GtSourceCoderErrorAttribute, + #superclass : #BrTextAdornmentAttribute, #instVars : [ 'string' ], #category : 'GToolkit-Coder-UI-Coder - Source Attributes' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtSourceCoderErrorAttribute class >> for: aString [ ^ self new for: aString; @@ -16,7 +16,7 @@ GtSourceCoderErrorAttribute class >> for: aString [ yourself ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderErrorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ | text | @@ -33,7 +33,7 @@ GtSourceCoderErrorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditor yourself ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtSourceCoderErrorAttribute >> for: aString [ string := aString ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEvaluationHighlighter.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEvaluationHighlighter.class.st index 6d10dc68f..076e87f48 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEvaluationHighlighter.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEvaluationHighlighter.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtSourceCoderEvaluationHighlighter', - #superclass : 'GtSourceCoderEvaluationResultDisplayer', + #name : #GtSourceCoderEvaluationHighlighter, + #superclass : #GtSourceCoderEvaluationResultDisplayer, #category : 'GToolkit-Coder-UI-Coder - Source' } -{ #category : 'private - ui' } +{ #category : #'private - ui' } GtSourceCoderEvaluationHighlighter >> addAttributesFor: anEvaluationResult within: aTextInterval [ | theAttributes | diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEvaluationPrinter.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEvaluationPrinter.class.st index 023388714..997b4cbc1 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEvaluationPrinter.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEvaluationPrinter.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtSourceCoderEvaluationPrinter', - #superclass : 'GtSourceCoderEvaluationResultDisplayer', + #name : #GtSourceCoderEvaluationPrinter, + #superclass : #GtSourceCoderEvaluationResultDisplayer, #category : 'GToolkit-Coder-UI-Coder - Source' } -{ #category : 'private' } +{ #category : #private } GtSourceCoderEvaluationPrinter >> addAttributesFor: anEvaluationResult within: aTextInterval [ | theAttributes | diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEvaluationResultDisplayer.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEvaluationResultDisplayer.class.st index 7aa8bbe16..d008f37fa 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEvaluationResultDisplayer.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEvaluationResultDisplayer.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtSourceCoderEvaluationResultDisplayer', - #superclass : 'Object', + #name : #GtSourceCoderEvaluationResultDisplayer, + #superclass : #Object, #instVars : [ 'editorElement', 'updateRequester', @@ -10,12 +10,12 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Source' } -{ #category : 'private' } +{ #category : #private } GtSourceCoderEvaluationResultDisplayer >> addAttributesFor: anEvaluationResult within: aTextInterval [ self subclassResponsibility ] -{ #category : 'api - evaluation result' } +{ #category : #'api - evaluation result' } GtSourceCoderEvaluationResultDisplayer >> displayResult: anEvaluationResult [ self assert: [ anEvaluationResult notNil ] @@ -27,7 +27,7 @@ GtSourceCoderEvaluationResultDisplayer >> displayResult: anEvaluationResult [ updateRequester requestUpdate ] -{ #category : 'api - evaluation result' } +{ #category : #'api - evaluation result' } GtSourceCoderEvaluationResultDisplayer >> displayResultSynchronously: anEvaluationResult [ self assert: [ anEvaluationResult notNil ] @@ -39,23 +39,23 @@ GtSourceCoderEvaluationResultDisplayer >> displayResultSynchronously: anEvaluati self primitiveUpdateResult ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationResultDisplayer >> editorElement [ ^ editorElement ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationResultDisplayer >> editorElement: anObject [ editorElement := anObject. updateRequester element: editorElement ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationResultDisplayer >> evaluationResult [ ^ evaluationResult ] -{ #category : 'api - evaluation result' } +{ #category : #'api - evaluation result' } GtSourceCoderEvaluationResultDisplayer >> hideResult [ evaluationResult ifNil: [ ^ self ]. @@ -63,7 +63,7 @@ GtSourceCoderEvaluationResultDisplayer >> hideResult [ updateRequester requestUpdate ] -{ #category : 'api - evaluation result' } +{ #category : #'api - evaluation result' } GtSourceCoderEvaluationResultDisplayer >> hideResultSynchronously [ evaluationResult ifNil: [ ^ self ]. @@ -71,7 +71,7 @@ GtSourceCoderEvaluationResultDisplayer >> hideResultSynchronously [ self primitiveUpdateResult ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderEvaluationResultDisplayer >> initialize [ super initialize. @@ -83,7 +83,7 @@ GtSourceCoderEvaluationResultDisplayer >> initialize [ evaluationAttributes := #() ] -{ #category : 'private' } +{ #category : #private } GtSourceCoderEvaluationResultDisplayer >> primitiveAddResult: anEvaluationResult [ | anEvaluatedSource anEvaluatedInterval theSourceStartInText theSourceEndInText | @@ -107,20 +107,20 @@ GtSourceCoderEvaluationResultDisplayer >> primitiveAddResult: anEvaluationResult within: (theSourceStartInText to: theSourceEndInText) ] -{ #category : 'private' } +{ #category : #private } GtSourceCoderEvaluationResultDisplayer >> primitiveRemoveResult [ self text removeAttributes: evaluationAttributes. evaluationAttributes := #() ] -{ #category : 'private' } +{ #category : #private } GtSourceCoderEvaluationResultDisplayer >> primitiveUpdateResult [ self primitiveRemoveResult. evaluationResult ifNotNil: [ :anEvaluationResult | self primitiveAddResult: anEvaluationResult ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationResultDisplayer >> text [ ^ self editorElement text ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st index 27a4f53fa..b4a21fe09 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtSourceCoderExpandedContentElement', - #superclass : 'GtSourceCoderContentElement', + #name : #GtSourceCoderExpandedContentElement, + #superclass : #GtSourceCoderContentElement, #category : 'GToolkit-Coder-UI-Coder - Source' } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpanderToggleId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpanderToggleId.class.st index 6c55e9260..91f6e0159 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExpanderToggleId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpanderToggleId.class.st @@ -3,12 +3,12 @@ An element to toggle {{gtClass:BrExpander}}'s state on click. In a context of a Do not confuse with an embedded expander within the text which is usually represented by a triangle. " Class { - #name : 'GtSourceCoderExpanderToggleId', - #superclass : 'GtCoderElementId', + #name : #GtSourceCoderExpanderToggleId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtSourceCoderExpanderToggleId >> asSymbol [ ^ #'source-coder--expander-toggle' ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExtractMethodShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExtractMethodShortcut.class.st index 46a8dc534..87823ed24 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExtractMethodShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExtractMethodShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : 'GtSourceCoderExtractMethodShortcut', - #superclass : 'GtSourceCoderShortcut', + #name : #GtSourceCoderExtractMethodShortcut, + #superclass : #GtSourceCoderShortcut, #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderExtractMethodShortcut >> description [ ^ 'Extracts the selected code into a new method.' ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderExtractMethodShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryE ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderExtractMethodShortcut >> name [ ^ 'Extract method' ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderExtractMethodShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ (GtExtractMethodController new sourceCoderViewModel: aSourceCoderViewModel) execute ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExtractTempVarContextMenuItemId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExtractTempVarContextMenuItemId.class.st index bd0f4a144..9a0862a06 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExtractTempVarContextMenuItemId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExtractTempVarContextMenuItemId.class.st @@ -2,12 +2,12 @@ A context menu action to extract a temporary variable " Class { - #name : 'GtSourceCoderExtractTempVarContextMenuItemId', - #superclass : 'GtCoderElementId', + #name : #GtSourceCoderExtractTempVarContextMenuItemId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtSourceCoderExtractTempVarContextMenuItemId >> asSymbol [ ^ #'context-menu--extract-temp' ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderFocusChanged.class.st b/src/GToolkit-Coder-UI/GtSourceCoderFocusChanged.class.st index 9cec071a1..3615e8c25 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderFocusChanged.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderFocusChanged.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtSourceCoderFocusChanged', - #superclass : 'Announcement', + #name : #GtSourceCoderFocusChanged, + #superclass : #Announcement, #instVars : [ 'source', 'focused' @@ -8,22 +8,22 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Source Events' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderFocusChanged >> focused [ ^ focused ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderFocusChanged >> focused: anObject [ focused := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderFocusChanged >> source [ ^ source ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderFocusChanged >> source: anObject [ source := anObject ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderFormatShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderFormatShortcut.class.st index 816839d5e..1ea942834 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderFormatShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderFormatShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : 'GtSourceCoderFormatShortcut', - #superclass : 'GtSourceCoderShortcut', + #name : #GtSourceCoderFormatShortcut, + #superclass : #GtSourceCoderShortcut, #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderFormatShortcut >> description [ ^ 'Formats and saves the source code.' ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderFormatShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryShiftF ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderFormatShortcut >> name [ ^ 'Format' ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderFormatShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent [ aGtSourceCoder format ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderPlayAndInspectShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderPlayAndInspectShortcut.class.st index f373cd3c3..7040118d6 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderPlayAndInspectShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderPlayAndInspectShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : 'GtSourceCoderPlayAndInspectShortcut', - #superclass : 'GtSourceCoderShortcut', + #name : #GtSourceCoderPlayAndInspectShortcut, + #superclass : #GtSourceCoderShortcut, #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderPlayAndInspectShortcut >> description [ ^ 'Compiles, saves and evaluates the whole source code (method) or just the selection and inspects the result.' ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderPlayAndInspectShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryG ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderPlayAndInspectShortcut >> name [ ^ 'Save, play and inspect' ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderPlayAndInspectShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent [ GtCoderExecutionContextVariable element: aBrEditorElement diff --git a/src/GToolkit-Coder-UI/GtSourceCoderPlayShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderPlayShortcut.class.st index b58e26a00..de6cec80d 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderPlayShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderPlayShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : 'GtSourceCoderPlayShortcut', - #superclass : 'GtSourceCoderShortcut', + #name : #GtSourceCoderPlayShortcut, + #superclass : #GtSourceCoderShortcut, #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderPlayShortcut >> description [ ^ 'Compiles, saves and evaluates the whole source code (method) or just the selection.' ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderPlayShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryD ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderPlayShortcut >> name [ ^ 'Save and play' ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderPlayShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent [ GtCoderExecutionContextVariable element: aBrEditorElement diff --git a/src/GToolkit-Coder-UI/GtSourceCoderPrintItShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderPrintItShortcut.class.st index 7e6522943..6b18b26ce 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderPrintItShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderPrintItShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : 'GtSourceCoderPrintItShortcut', - #superclass : 'GtSourceCoderShortcut', + #name : #GtSourceCoderPrintItShortcut, + #superclass : #GtSourceCoderShortcut, #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderPrintItShortcut >> description [ ^ 'Evaluates the whole source code (method) or just the selection and prints it in the editor.' ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderPrintItShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryP ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderPrintItShortcut >> name [ ^ 'Print' ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderPrintItShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aGtSourceCoderViewModel dueTo: aShortcutEvent [ GtCoderExecutionContextVariable element: aBrEditorElement diff --git a/src/GToolkit-Coder-UI/GtSourceCoderProfileActionId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderProfileActionId.class.st index 5be41e41a..b58273d60 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderProfileActionId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderProfileActionId.class.st @@ -4,12 +4,12 @@ A button to profile a piece of code " Class { - #name : 'GtSourceCoderProfileActionId', - #superclass : 'GtCoderElementId', + #name : #GtSourceCoderProfileActionId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtSourceCoderProfileActionId >> asSymbol [ ^ #'source-coder--profile-action' ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderSaveShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderSaveShortcut.class.st index 0676aae5e..83bbd6b9a 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderSaveShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderSaveShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : 'GtSourceCoderSaveShortcut', - #superclass : 'GtSourceCoderShortcut', + #name : #GtSourceCoderSaveShortcut, + #superclass : #GtSourceCoderShortcut, #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderSaveShortcut >> description [ ^ 'Apply changes and save the source code (compile).' ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderSaveShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryS ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderSaveShortcut >> name [ ^ 'Save' ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderSaveShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ aSourceCoderViewModel save ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderShortcut.class.st index 69994ee62..4133a9ccc 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderShortcut.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtSourceCoderShortcut', - #superclass : 'BrEditorShortcut', + #name : #GtSourceCoderShortcut, + #superclass : #BrEditorShortcut, #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : 'private' } +{ #category : #private } GtSourceCoderShortcut >> forEditor: aBrTextEditor selectedStringDo: aSelectedTextBlock orCursorStringPositionDo: aCursorTextPositionBlock [ aBrTextEditor selectedText ifEmpty: [ aBrTextEditor hasCursors @@ -18,7 +18,7 @@ GtSourceCoderShortcut >> forEditor: aBrTextEditor selectedStringDo: aSelectedTex ifNotEmpty: [ :aSelectedText | aSelectedTextBlock value: aSelectedText asString ] ] -{ #category : 'private' } +{ #category : #private } GtSourceCoderShortcut >> forEditor: aBrTextEditor selectionIntervalDo: aSelectionIntervalBlock orCursorStringPositionDo: aCursorTextPositionBlock [ aBrTextEditor hasSelection ifTrue: [ @@ -36,12 +36,12 @@ GtSourceCoderShortcut >> forEditor: aBrTextEditor selectionIntervalDo: aSelectio aCursorTextPositionBlock value: aTextPosition ] ] ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent [ self subclassResponsibility ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ self performOnEditor: aBrTextEditor @@ -50,13 +50,13 @@ GtSourceCoderShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElemen dueTo: aShortcutEvent ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement dueTo: aShortcutEvent [ aBrTextEditor model ifNotNil: [ :aSourceCoderViewModel | self performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent ] ] -{ #category : 'private' } +{ #category : #private } GtSourceCoderShortcut >> selectionIntervalIn: aBrTextEditor [ aBrTextEditor selection do: [ :eachMonotoneSelection | ^ eachMonotoneSelection from + 1 to: eachMonotoneSelection to ]. diff --git a/src/GToolkit-Coder-UI/GtSourceCoderSpawnDestinationAptitude.class.st b/src/GToolkit-Coder-UI/GtSourceCoderSpawnDestinationAptitude.class.st index 70e698715..1b790c2b1 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderSpawnDestinationAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderSpawnDestinationAptitude.class.st @@ -6,15 +6,15 @@ Each coder holds to its destination. Available destinations are modeled as subcl " Class { - #name : 'GtSourceCoderSpawnDestinationAptitude', - #superclass : 'GtSourceCoderAptitude', + #name : #GtSourceCoderSpawnDestinationAptitude, + #superclass : #GtSourceCoderAptitude, #instVars : [ 'switchButton' ], #category : 'GToolkit-Coder-UI-Coder - Source Look' } -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderSpawnDestinationAptitude >> initialize [ super initialize. @@ -23,7 +23,7 @@ GtSourceCoderSpawnDestinationAptitude >> initialize [ self addChangeAddChildAs: #(content switchButton) with: [ switchButton ] ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtSourceCoderSpawnDestinationAptitude >> newSwitchButton [ ^ BrButton new aptitude: BrGlamorousButtonWithIconAptitude - BrGlamorousButtonExteriorAptitude; @@ -36,18 +36,18 @@ GtSourceCoderSpawnDestinationAptitude >> newSwitchButton [ zIndex: 10 ] -{ #category : 'hooks' } +{ #category : #hooks } GtSourceCoderSpawnDestinationAptitude >> onCoderChanged: aGtSourceCoderUIModel [ self switchButton icon: aGtSourceCoderUIModel coder spawnDestination icon ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderSpawnDestinationAptitude >> switchButton [ ^ switchButton ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtSourceCoderSpawnDestinationAptitude >> switchSpawnDestination [ | aSourceCoder | diff --git a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st index a0c7271d2..8fb01389b 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st @@ -1,36 +1,36 @@ Class { - #name : 'GtSourceCoderViewModel', - #superclass : 'GtTextualCoderViewModel', + #name : #GtSourceCoderViewModel, + #superclass : #GtTextualCoderViewModel, #instVars : [ 'evaluationResult' ], #category : 'GToolkit-Coder-UI-Coder - Source Model' } -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoderViewModel >> debug [ ^ self selection isEmpty ifTrue: [ self debugAll ] ifFalse: [ self debugIt: self selectedTextInterval ] ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoderViewModel >> debugAll [ ^ self coderModel debugInContext: self evaluationContext all ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoderViewModel >> debugIt: aTextInterval [ ^ self coderModel debugInContext: (self evaluationContext from: aTextInterval first to: aTextInterval last) ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoderViewModel >> discardChanges [ self coder discardChanges ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoderViewModel >> doIt [ "Evaluate a piece of source code within a selection interval or everything if nothing is selected and return a result" @@ -38,7 +38,7 @@ GtSourceCoderViewModel >> doIt [ ^ self doItRequestedBy: self ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoderViewModel >> doIt: aTextInterval [ "Evaluate a piece of source code within an interval and return a result. I am also able to evaluate an empty or only consisting of whitespace @@ -48,7 +48,7 @@ GtSourceCoderViewModel >> doIt: aTextInterval [ ^ self doIt: aTextInterval requestedBy: self ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoderViewModel >> doIt: aTextInterval requestedBy: aRequesterObject [ "Evaluate source code within given text interval and return the result" @@ -57,14 +57,14 @@ GtSourceCoderViewModel >> doIt: aTextInterval requestedBy: aRequesterObject [ requesterObject: aRequesterObject) ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoderViewModel >> doItAll [ "Evaluate the whole source code and return the result" ^ self doItAllRequestedBy: self ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoderViewModel >> doItAllRequestedBy: aRequesterObject [ "Evaluate the whole source code independent from the selection and return the result" @@ -73,7 +73,7 @@ GtSourceCoderViewModel >> doItAllRequestedBy: aRequesterObject [ requesterObject: aRequesterObject) ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoderViewModel >> doItAndGo [ "Evaluate selected source code or everything if there is nothing selected and inspect the result" @@ -82,21 +82,21 @@ GtSourceCoderViewModel >> doItAndGo [ ifFalse: [ self doItAndGo: self selectedTextInterval ] ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoderViewModel >> doItAndGo: aTextInterval [ "Evaluate a piece of source code within an interval and inspect a result." ^ self coder doItAndGoInContext: (self evaluationContext from: aTextInterval first to: aTextInterval last) ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoderViewModel >> doItAndGoAll [ "Evaluate the whole source code and inspect the result" ^ self coder doItAndGoInContext: self evaluationContext all ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoderViewModel >> doItRequestedBy: aRequesterObject [ "Evaluate selected source code or everything if there is nothing selected and return the result" @@ -105,12 +105,12 @@ GtSourceCoderViewModel >> doItRequestedBy: aRequesterObject [ ifFalse: [ self doIt: self selectedTextInterval requestedBy: aRequesterObject ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderViewModel >> elementClass [ ^ GtExpandableSourceCoderElement ] -{ #category : 'private - evaluation' } +{ #category : #'private - evaluation' } GtSourceCoderViewModel >> evaluationContext [ @@ -118,17 +118,17 @@ GtSourceCoderViewModel >> evaluationContext [ requesterObject: self ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderViewModel >> evaluationResult [ ^ evaluationResult ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderViewModel >> evaluationResult: anObject [ evaluationResult := anObject ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoderViewModel >> printIt [ "Evaluate selected source code or everything if there is nothing selected and print the result" @@ -137,21 +137,21 @@ GtSourceCoderViewModel >> printIt [ ifFalse: [ self printIt: self selectedTextInterval ] ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoderViewModel >> printIt: aTextInterval [ "Evaluate a piece of source code within an interval and print a result." ^ self coder printItInContext: (self evaluationContext from: aTextInterval first to: aTextInterval last) ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoderViewModel >> printItAll [ "Evaluate the whole source code and print the result" ^ self coder printItInContext: self evaluationContext all ] -{ #category : 'private - evaluation' } +{ #category : #'private - evaluation' } GtSourceCoderViewModel >> selectedTextInterval [ | anInterval | diff --git a/src/GToolkit-Coder-UI/GtSyncScrollRange.class.st b/src/GToolkit-Coder-UI/GtSyncScrollRange.class.st index 6b6af4542..673f672b5 100644 --- a/src/GToolkit-Coder-UI/GtSyncScrollRange.class.st +++ b/src/GToolkit-Coder-UI/GtSyncScrollRange.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtSyncScrollRange', - #superclass : 'Object', + #name : #GtSyncScrollRange, + #superclass : #Object, #instVars : [ 'leftFirst', 'leftLast', @@ -11,14 +11,14 @@ Class { #category : 'GToolkit-Coder-UI-Diff' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtSyncScrollRange class >> left: leftInteger right: rightInteger [ ^ self new initializeLeft: leftInteger right: rightInteger; yourself ] -{ #category : 'syncing' } +{ #category : #syncing } GtSyncScrollRange >> advanceBoth [ self leftSize = self rightSize ifTrue: [ leftLast := leftLast + 1. @@ -29,7 +29,7 @@ GtSyncScrollRange >> advanceBoth [ yourself ] -{ #category : 'syncing' } +{ #category : #syncing } GtSyncScrollRange >> advanceLeft [ self rightSize = 0 ifTrue: [ isDifference := true. @@ -40,7 +40,7 @@ GtSyncScrollRange >> advanceLeft [ yourself ] -{ #category : 'syncing' } +{ #category : #syncing } GtSyncScrollRange >> advanceRight [ self leftSize = 0 ifTrue: [ isDifference := true. @@ -51,7 +51,7 @@ GtSyncScrollRange >> advanceRight [ yourself ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtSyncScrollRange >> initialize [ super initialize. isDifference := false. @@ -61,7 +61,7 @@ GtSyncScrollRange >> initialize [ rightLast := 0 ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtSyncScrollRange >> initializeLeft: leftInteger right: rightInteger [ leftFirst := leftInteger. leftLast := leftInteger. @@ -69,27 +69,27 @@ GtSyncScrollRange >> initializeLeft: leftInteger right: rightInteger [ rightLast := rightInteger ] -{ #category : 'testing' } +{ #category : #testing } GtSyncScrollRange >> isDifference [ ^ isDifference ] -{ #category : 'accessing' } +{ #category : #accessing } GtSyncScrollRange >> leftFirst [ ^ leftFirst ] -{ #category : 'accessing' } +{ #category : #accessing } GtSyncScrollRange >> leftLast [ ^ leftLast ] -{ #category : 'accessing' } +{ #category : #accessing } GtSyncScrollRange >> leftSize [ ^ leftLast - leftFirst ] -{ #category : 'syncing' } +{ #category : #syncing } GtSyncScrollRange >> mergeWith: aRange [ leftFirst := leftFirst min: aRange leftFirst. leftLast := leftLast max: aRange leftLast. @@ -97,7 +97,7 @@ GtSyncScrollRange >> mergeWith: aRange [ rightLast := rightLast max: aRange rightLast ] -{ #category : 'testing' } +{ #category : #testing } GtSyncScrollRange >> overlapsLeft: leftInterval orRight: rightInterval [ ^ ((self leftLast < leftInterval first or: [ self leftFirst > leftInterval last ]) @@ -105,7 +105,7 @@ GtSyncScrollRange >> overlapsLeft: leftInterval orRight: rightInterval [ or: [ self rightFirst > rightInterval last ] ]) not ] -{ #category : 'printing' } +{ #category : #printing } GtSyncScrollRange >> printOn: aStream [ super printOn: aStream. aStream @@ -123,17 +123,17 @@ GtSyncScrollRange >> printOn: aStream [ nextPut: $] ] -{ #category : 'accessing' } +{ #category : #accessing } GtSyncScrollRange >> rightFirst [ ^ rightFirst ] -{ #category : 'accessing' } +{ #category : #accessing } GtSyncScrollRange >> rightLast [ ^ rightLast ] -{ #category : 'accessing' } +{ #category : #accessing } GtSyncScrollRange >> rightSize [ ^ rightLast - rightFirst ] diff --git a/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st b/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st index 271416dbb..d730e7043 100644 --- a/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st +++ b/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st @@ -1,13 +1,13 @@ Class { - #name : 'GtSyncScrollRanges', - #superclass : 'Object', + #name : #GtSyncScrollRanges, + #superclass : #Object, #instVars : [ 'ranges' ], #category : 'GToolkit-Coder-UI-Diff' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtSyncScrollRanges class >> createFromDiff: aDiffBuilder [ | syncScroll | syncScroll := self new. @@ -19,19 +19,19 @@ GtSyncScrollRanges class >> createFromDiff: aDiffBuilder [ ^ syncScroll ] -{ #category : 'examples' } +{ #category : #examples } GtSyncScrollRanges class >> example [ ^ self createFromDiff: self exampleDiff ] -{ #category : 'examples' } +{ #category : #examples } GtSyncScrollRanges class >> exampleDiff [ ^ TextDiffBuilder from: self originalString to: self newString ] -{ #category : 'examples' } +{ #category : #examples } GtSyncScrollRanges class >> newString [ ^ '1 @@ -43,7 +43,7 @@ GtSyncScrollRanges class >> newString [ 9' ] -{ #category : 'examples' } +{ #category : #examples } GtSyncScrollRanges class >> originalString [ ^ '1 @@ -56,28 +56,28 @@ GtSyncScrollRanges class >> originalString [ 10' ] -{ #category : 'private-creation' } +{ #category : #'private-creation' } GtSyncScrollRanges >> advanceBoth [ ranges last advanceBoth ifNotNil: [ :range | ranges add: range ] ] -{ #category : 'private-creation' } +{ #category : #'private-creation' } GtSyncScrollRanges >> advanceLeft [ ranges last advanceLeft ifNotNil: [ :range | ranges add: range ] ] -{ #category : 'private-creation' } +{ #category : #'private-creation' } GtSyncScrollRanges >> advanceRight [ ranges last advanceRight ifNotNil: [ :range | ranges add: range ] ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtSyncScrollRanges >> initialize [ super initialize. ranges := OrderedCollection with: GtSyncScrollRange new ] -{ #category : 'accessing' } +{ #category : #accessing } GtSyncScrollRanges >> leftLineFor: rightIndex [ | range | range := ranges @@ -89,7 +89,7 @@ GtSyncScrollRanges >> leftLineFor: rightIndex [ * range leftSize + range leftFirst) rounded ] -{ #category : 'private-creation' } +{ #category : #'private-creation' } GtSyncScrollRanges >> mergeDifferences [ | index current previous | index := ranges size. @@ -103,13 +103,13 @@ GtSyncScrollRanges >> mergeDifferences [ current := previous ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtSyncScrollRanges >> rangesForLeft: leftInterval andRight: rightInterval [ ^ ranges select: [ :each | each overlapsLeft: leftInterval orRight: rightInterval ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtSyncScrollRanges >> rightLineFor: leftIndex [ | range | range := ranges diff --git a/src/GToolkit-Coder-UI/GtTextCoder.extension.st b/src/GToolkit-Coder-UI/GtTextCoder.extension.st index d63f91914..6f65a9f19 100644 --- a/src/GToolkit-Coder-UI/GtTextCoder.extension.st +++ b/src/GToolkit-Coder-UI/GtTextCoder.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'GtTextCoder' } +Extension { #name : #GtTextCoder } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtTextCoder >> asCoderUIModel [ ^ GtTextualCoderViewModel new coder: self ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoder.extension.st b/src/GToolkit-Coder-UI/GtTextualCoder.extension.st index 9191fb99d..53c367312 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoder.extension.st +++ b/src/GToolkit-Coder-UI/GtTextualCoder.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'GtTextualCoder' } +Extension { #name : #GtTextualCoder } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtTextualCoder >> breadcrumbActions [ diff --git a/src/GToolkit-Coder-UI/GtTextualCoderCopyContextMenuItemId.class.st b/src/GToolkit-Coder-UI/GtTextualCoderCopyContextMenuItemId.class.st index 863af42aa..b06a40fcb 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderCopyContextMenuItemId.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderCopyContextMenuItemId.class.st @@ -4,12 +4,12 @@ A context menu action to copy a text " Class { - #name : 'GtTextualCoderCopyContextMenuItemId', - #superclass : 'GtCoderElementId', + #name : #GtTextualCoderCopyContextMenuItemId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtTextualCoderCopyContextMenuItemId >> asSymbol [ ^ #'context-menu-item--copy' ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderCutContextMenuItemId.class.st b/src/GToolkit-Coder-UI/GtTextualCoderCutContextMenuItemId.class.st index 72db20acb..c1c6e896a 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderCutContextMenuItemId.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderCutContextMenuItemId.class.st @@ -4,12 +4,12 @@ A context menu action to cut text " Class { - #name : 'GtTextualCoderCutContextMenuItemId', - #superclass : 'GtCoderElementId', + #name : #GtTextualCoderCutContextMenuItemId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtTextualCoderCutContextMenuItemId >> asSymbol [ ^ #'context-menu-item--cut' ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index eabc0cff2..ba8ade5e0 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtTextualCoderEditorElement', - #superclass : 'BrEditor', + #name : #GtTextualCoderEditorElement, + #superclass : #BrEditor, #traits : 'TBlAssertUIProcess + TGtWithTextualCoderViewModel', #classTraits : 'TBlAssertUIProcess classTrait + TGtWithTextualCoderViewModel classTrait', #instVars : [ @@ -12,12 +12,12 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Textual' } -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } GtTextualCoderEditorElement >> coderUIModel: aTextualCoderViewModel [ self textualCoderViewModel: aTextualCoderViewModel ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtTextualCoderEditorElement >> createContextMenuContent [ "wait for the addons to be computed" | theContextMenu | @@ -39,7 +39,7 @@ GtTextualCoderEditorElement >> createContextMenuContent [ ^ theContextMenu ] -{ #category : 'private' } +{ #category : #private } GtTextualCoderEditorElement >> hideHighlighters [ self text clearAttributes: [ :eachAttribute | eachAttribute isKindOf: GtSourceCoderErrorAttribute ]. @@ -47,7 +47,7 @@ GtTextualCoderEditorElement >> hideHighlighters [ evaluationPrinter hideResultSynchronously. ] -{ #category : 'private' } +{ #category : #private } GtTextualCoderEditorElement >> highlightPCRangeForInterval: aSelectionInterval [ self textualCoderViewModel isModified ifTrue: [ ^ self ]. @@ -61,7 +61,7 @@ GtTextualCoderEditorElement >> highlightPCRangeForInterval: aSelectionInterval [ beNotOverwritableByStyler ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtTextualCoderEditorElement >> initialize [ super initialize. @@ -84,7 +84,7 @@ GtTextualCoderEditorElement >> initialize [ self initializeListeners ] -{ #category : 'initialization' } +{ #category : #initialization } GtTextualCoderEditorElement >> initializeListeners [ self when: BlFocusInEvent do: [ :anEvent | self textualCoderViewModel focused: true from: self ]. @@ -111,13 +111,13 @@ GtTextualCoderEditorElement >> initializeListeners [ do: [ :anEvent | self textualCoderViewModel styledText: anEvent styledText ] ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onCodeEvaluated: anEvaluationAnnouncement [ evaluationHighlighter displayResult: anEvaluationAnnouncement evaluationResult. evaluationPrinter hideResult ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onCoderParseError: aGtCoderParseError [ "A parse error can be notifying from a non-UI thread" @@ -127,14 +127,14 @@ GtTextualCoderEditorElement >> onCoderParseError: aGtCoderParseError [ at: aGtCoderParseError location ]) ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onCoderViewModelFocused: aBoolean [ aBoolean ifTrue: [ self requestFocus ] ifFalse: [ self loseFocus ] ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onContextPCRangeChanged: aContextPCRangeChangedAnnouncement [ | selectionInterval | @@ -142,7 +142,7 @@ GtTextualCoderEditorElement >> onContextPCRangeChanged: aContextPCRangeChangedAn self highlightPCRangeForInterval: selectionInterval ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onCursorsChanged: aCursorsChangedAnnouncement [ "Is sent when the cursors change in the View Model. May be sent from a non-UI thread" @@ -160,7 +160,7 @@ GtTextualCoderEditorElement >> onCursorsChanged: aCursorsChangedAnnouncement [ apply ]) ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onFocusChangedAnnouncement: anAnnouncement [ self assertUIProcess. @@ -173,7 +173,7 @@ GtTextualCoderEditorElement >> onFocusChangedAnnouncement: anAnnouncement [ self onCoderViewModelFocused: anAnnouncement focused ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onObjectSpawnRequest: anAnnouncement [ self enqueueTask: (BlTaskAction new action: [ self phlow @@ -181,7 +181,7 @@ GtTextualCoderEditorElement >> onObjectSpawnRequest: anAnnouncement [ withDestination: anAnnouncement spawnDestination ]) ] -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } GtTextualCoderEditorElement >> onPostTextualCoderViewModelChanged [ "I am an optional hook method that is sent after #subscribeToTextualCoderViewModel. I do nothing by default but allow users to perform update operations when a receiver object is already @@ -194,13 +194,13 @@ GtTextualCoderEditorElement >> onPostTextualCoderViewModelChanged [ self textualCoderViewModel addOnsAsyncDo: [ :theAddOns | self onViewModelReadyToStyle ] ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onPrintRequest: anEvaluationAnnouncement [ evaluationHighlighter hideResult. evaluationPrinter displayResult: anEvaluationAnnouncement evaluationResult. ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onShowDebuggerRequest: aShowDebuggerAnnouncement [ | sharedDebugSession anEvaluatedSource anEvaluatedInterval theSourceStartInText theSourceEndInText | @@ -236,19 +236,19 @@ GtTextualCoderEditorElement >> onShowDebuggerRequest: aShowDebuggerAnnouncement debugSession: sharedDebugSession) ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onStyleTextRequest: anEvent [ "onStyleTextRequest: may be sent from a non-UI thread" self enqueueTask: (BlTaskAction new action: [ self styleTextAndAfterDo: anEvent afterAction ]) ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onStylersUpdated: anAnnouncement [ ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onTextModified [ "Is sent when the text changes in the editor. Here we should synchronise the UI and the model." @@ -258,7 +258,7 @@ GtTextualCoderEditorElement >> onTextModified [ synchronously: true ] -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } GtTextualCoderEditorElement >> onTextualCoderViewModelChanged [ "Is sent when a new textualCoder view model is assigned to the element. Note: #onTextualCoderViewModelChanged is sent before #subscribeToTextualCoderViewModel @@ -281,7 +281,7 @@ GtTextualCoderEditorElement >> onTextualCoderViewModelChanged [ completion strategy: self textualCoderViewModel coderModel completionStrategy ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onToolSpawnRequest: anAnnouncement [ self enqueueTask: (BlTaskAction new action: [ self phlow @@ -289,12 +289,12 @@ GtTextualCoderEditorElement >> onToolSpawnRequest: anAnnouncement [ withDestination: anAnnouncement spawnDestination ]) ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onUpdateAddOnsRequest: anAnnouncement [ ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onViewModelCursorsChanged: aCursorsChangedAnnouncement [ "Is sent when the cursors changes in the View Model. May be sent from a non-UI thread" @@ -315,12 +315,12 @@ GtTextualCoderEditorElement >> onViewModelCursorsChanged: aCursorsChangedAnnounc apply ]) ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onViewModelReadyToStyle [ self enqueueTask: (BlTaskAction new action: [ self editor styleText ]) ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onViewModelSelectionChanged: aSelectionChangedAnnouncement [ "Is sent when the selection changes in the View Model. May be sent from a non-UI thread" @@ -341,7 +341,7 @@ GtTextualCoderEditorElement >> onViewModelSelectionChanged: aSelectionChangedAnn select ]) ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onViewModelShortcutsChanged [ "Is sent when the shortcuts change in the View Model. May be sent from a non-UI thread" @@ -353,17 +353,17 @@ GtTextualCoderEditorElement >> onViewModelShortcutsChanged [ self editor addEditorShortcuts: shortcuts ]) ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onViewModelStyledTextChanged: anAnnouncement [ ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onViewModelStylersChanged [ self enqueueTask: (BlTaskAction new action: [ self styler: self textualCoderViewModel compositeStyler ]) ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onViewModelTextAttributesAdded: anAnnouncement [ self enqueueTask: (BlTaskAction new action: [ anAnnouncement coderTextAttributes @@ -372,13 +372,13 @@ GtTextualCoderEditorElement >> onViewModelTextAttributesAdded: anAnnouncement [ to: anAnnouncement stopPosition ]) ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onViewModelTextAttributesRemoved: anAnnouncement [ self enqueueTask: (BlTaskAction new action: [ anAnnouncement coderTextAttributes removeFromEditorText: self text ]) ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onViewModelTextChanged: aGtTextualCoderViewModelTextChanged [ aGtTextualCoderViewModelTextChanged source == self @@ -393,7 +393,7 @@ GtTextualCoderEditorElement >> onViewModelTextChanged: aGtTextualCoderViewModelT self hideHighlighters ]) ] ] -{ #category : 'registration' } +{ #category : #registration } GtTextualCoderEditorElement >> registerCoderModelAnnouncementsFor: aCoderModel [ aCoderModel announcer weak when: GtCoderAddOnsUpdateRequest @@ -415,7 +415,7 @@ GtTextualCoderEditorElement >> registerCoderModelAnnouncementsFor: aCoderModel [ to: self ] -{ #category : 'registration' } +{ #category : #registration } GtTextualCoderEditorElement >> registerCoderViewModelAnnouncementsFor: aGtSourceCoderUIModel [ aGtSourceCoderUIModel weak when: GtMethodCoderContextPCRangeChanged @@ -454,7 +454,7 @@ GtTextualCoderEditorElement >> registerCoderViewModelAnnouncementsFor: aGtSource to: self. ] -{ #category : 'private' } +{ #category : #private } GtTextualCoderEditorElement >> reportParseError: aString at: anInteger [ | text position | @@ -471,17 +471,17 @@ GtTextualCoderEditorElement >> reportParseError: aString at: anInteger [ to: position ] -{ #category : 'private' } +{ #category : #private } GtTextualCoderEditorElement >> styleText [ self editor styleText ] -{ #category : 'private' } +{ #category : #private } GtTextualCoderEditorElement >> styleTextAndAfterDo: aBlock [ self editor styleTextAndAfterDo: aBlock ] -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } GtTextualCoderEditorElement >> subscribeToTextualCoderViewModel [ "Is sent after a new textualCoder view model is assigned to the element. It is required to unsubscribe from the view model or domain model by implementing @@ -493,7 +493,7 @@ GtTextualCoderEditorElement >> subscribeToTextualCoderViewModel [ completion install ] -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } GtTextualCoderEditorElement >> unsubscribeFromTextualCoderViewModel [ "Is sent before a new textualCoder view model is assigned to the element. Elements that subscribe to textualCoder view model in domain model are required to implement this methods." diff --git a/src/GToolkit-Coder-UI/GtTextualCoderPasteContextMenuItemId.class.st b/src/GToolkit-Coder-UI/GtTextualCoderPasteContextMenuItemId.class.st index 37ba25bea..76d2c5631 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderPasteContextMenuItemId.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderPasteContextMenuItemId.class.st @@ -4,12 +4,12 @@ A context menu action to paste a text " Class { - #name : 'GtTextualCoderPasteContextMenuItemId', - #superclass : 'GtCoderElementId', + #name : #GtTextualCoderPasteContextMenuItemId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtTextualCoderPasteContextMenuItemId >> asSymbol [ ^ #'context-menu-item--paste' ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st b/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st index ac1c1f77e..86ea200ac 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtTextualCoderTextAttributes', - #superclass : 'Object', + #name : #GtTextualCoderTextAttributes, + #superclass : #Object, #instVars : [ 'markerAttribute', 'textAttributes' @@ -8,7 +8,7 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Textual Model' } -{ #category : 'api - attribute' } +{ #category : #'api - attribute' } GtTextualCoderTextAttributes >> applyOnEditorText: aText [ aText findAttribute: markerAttribute @@ -16,7 +16,7 @@ GtTextualCoderTextAttributes >> applyOnEditorText: aText [ aText attributes: textAttributes from: aStartPosition to: anEndPosition ] ] -{ #category : 'api - attribute' } +{ #category : #'api - attribute' } GtTextualCoderTextAttributes >> applyOnEditorText: aText from: aStartPosition to: anEndPosition [ aText findAttribute: markerAttribute @@ -26,27 +26,27 @@ GtTextualCoderTextAttributes >> applyOnEditorText: aText from: aStartPosition to aText attributes: { markerAttribute }, textAttributes from: aStartPosition to: anEndPosition ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderTextAttributes >> markerAttribute [ ^ markerAttribute ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderTextAttributes >> markerAttribute: anObject [ markerAttribute := anObject ] -{ #category : 'api - attribute' } +{ #category : #'api - attribute' } GtTextualCoderTextAttributes >> removeFromEditorText: aText [ aText removeAttributes: { self markerAttribute }, self textAttributes ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderTextAttributes >> textAttributes [ ^ textAttributes ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderTextAttributes >> textAttributes: anObject [ textAttributes := anObject ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 80c8d0621..5e4992e63 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtTextualCoderViewModel', - #superclass : 'GtSingleCoderViewModel', + #name : #GtTextualCoderViewModel, + #superclass : #GtSingleCoderViewModel, #instVars : [ 'addOns', 'addOnMonitor', @@ -19,10 +19,17 @@ Class { 'extraTextAttributes', 'styledText' ], - #category : 'GToolkit-Coder-UI-Coder - Textual Model' + #category : #'GToolkit-Coder-UI-Coder - Textual Model' } -{ #category : 'api - add-ons' } +{ #category : #'api - shortcuts' } +GtTextualCoderViewModel >> addMainAction: aGtCoderAction [ + "Add an extra main action add-on independent from the dynamically computed add-ons" + + extraAddOns addMainAction: aGtCoderAction +] + +{ #category : #'api - add-ons' } GtTextualCoderViewModel >> addOnsAsyncDo: aBlock [ addOnMonitor critical: [ addOnCommand ifNotNil: [ @@ -55,7 +62,7 @@ GtTextualCoderViewModel >> addOnsAsyncDo: aBlock [ otherwise: [ addOnCommand execute ] ] ] -{ #category : 'api - add-ons' } +{ #category : #'api - add-ons' } GtTextualCoderViewModel >> addOnsAwait [ | theAddOns | @@ -64,7 +71,7 @@ GtTextualCoderViewModel >> addOnsAwait [ ^ theAddOns ] -{ #category : 'api - add-ons' } +{ #category : #'api - add-ons' } GtTextualCoderViewModel >> addOnsAwaitDo: aBlock [ | aSemaphore theAddOns | @@ -78,28 +85,28 @@ GtTextualCoderViewModel >> addOnsAwaitDo: aBlock [ aBlock value: theAddOns ] -{ #category : 'api - shortcuts' } +{ #category : #'api - shortcuts' } GtTextualCoderViewModel >> addShortcut: aShortcut [ "Add an extra shortcut add-on independent from the dynamically computed add-ons" extraAddOns addShortcut: aShortcut ] -{ #category : 'api - shortcuts' } +{ #category : #'api - shortcuts' } GtTextualCoderViewModel >> addStyler: aGtCoderStyler [ "Add an extra styler add-on independent from the dynamically computed add-ons" extraAddOns addStyler: aGtCoderStyler ] -{ #category : 'api - shortcuts' } +{ #category : #'api - shortcuts' } GtTextualCoderViewModel >> addStylers: aCollectionOfGtCoderStyler [ "Add extra styler add-ons independent from the dynamically computed add-ons" aCollectionOfGtCoderStyler do: [ :eachStyler | self addStyler: eachStyler ] ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtTextualCoderViewModel >> addTextAttribute: aTextAttribute from: aStartPosition to: anEndPosition [ ^ self @@ -108,7 +115,7 @@ GtTextualCoderViewModel >> addTextAttribute: aTextAttribute from: aStartPosition to: anEndPosition ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtTextualCoderViewModel >> addTextAttributes: aCollectionOfTextAttributes from: aStartPosition to: anEndPosition [ | aCurrentText aMarkerAttribute newCoderTextAttributes | @@ -132,7 +139,7 @@ GtTextualCoderViewModel >> addTextAttributes: aCollectionOfTextAttributes from: ^ newCoderTextAttributes ] -{ #category : 'converting' } +{ #category : #converting } GtTextualCoderViewModel >> asEditorState [ | anEditorText aMemento | @@ -158,22 +165,22 @@ GtTextualCoderViewModel >> asEditorState [ ^ aMemento ] -{ #category : 'api - coder model' } +{ #category : #'api - coder model' } GtTextualCoderViewModel >> astAsyncDo: aBlock [ ^ self coderModel astAsyncDo: aBlock ] -{ #category : 'api - coder model' } +{ #category : #'api - coder model' } GtTextualCoderViewModel >> astAwait [ ^ self coderModel astAwait ] -{ #category : 'api - expansion' } +{ #category : #'api - expansion' } GtTextualCoderViewModel >> collapse [ self expanded: false ] -{ #category : 'api - stylers' } +{ #category : #'api - stylers' } GtTextualCoderViewModel >> compositeStyler [ ^ GtCoderAstCompositeStyler new coderViewModel: self; @@ -181,7 +188,7 @@ GtTextualCoderViewModel >> compositeStyler [ yourself ] -{ #category : 'private - addons' } +{ #category : #'private - addons' } GtTextualCoderViewModel >> computeAddOns [ | aCoderModel newAddOns pragmas theAst | @@ -221,7 +228,7 @@ GtTextualCoderViewModel >> computeAddOns [ ^ newAddOns ] -{ #category : 'private - addons' } +{ #category : #'private - addons' } GtTextualCoderViewModel >> computeContextMenuAstAddOns [ | aCoderModel newAddOns pragmas theAst | @@ -254,12 +261,12 @@ GtTextualCoderViewModel >> computeContextMenuAstAddOns [ ^ newAddOns ] -{ #category : 'api - add-ons' } +{ #category : #'api - add-ons' } GtTextualCoderViewModel >> contextActions [ ^ contextActions ] -{ #category : 'api - add-ons' } +{ #category : #'api - add-ons' } GtTextualCoderViewModel >> contextActions: theContextActions [ contextActions = theContextActions ifTrue: [ ^ self ]. @@ -268,12 +275,12 @@ GtTextualCoderViewModel >> contextActions: theContextActions [ self announce: GtTextualCoderViewModelContextActionsChanged new ] -{ #category : 'api - add-ons' } +{ #category : #'api - add-ons' } GtTextualCoderViewModel >> contextMenuActions [ ^ contextMenuActions ] -{ #category : 'api - add-ons' } +{ #category : #'api - add-ons' } GtTextualCoderViewModel >> contextMenuActions: theContextMenuActions [ contextMenuActions = theContextMenuActions ifTrue: [ ^ self ]. @@ -282,19 +289,19 @@ GtTextualCoderViewModel >> contextMenuActions: theContextMenuActions [ self announce: GtTextualCoderViewModelContextMenuActionsChanged new ] -{ #category : 'api - cursors' } +{ #category : #'api - cursors' } GtTextualCoderViewModel >> cursors [ ^ cursors ] -{ #category : 'api - cursors' } +{ #category : #'api - cursors' } GtTextualCoderViewModel >> cursors: aBrTextEditorCursor [ self cursors: aBrTextEditorCursor from: self ] -{ #category : 'api - cursors' } +{ #category : #'api - cursors' } GtTextualCoderViewModel >> cursors: aBrTextEditorCursor from: aSourceObject [ cursors = aBrTextEditorCursor ifTrue: [ ^ self ]. @@ -303,27 +310,27 @@ GtTextualCoderViewModel >> cursors: aBrTextEditorCursor from: aSourceObject [ self notifyCursorsChanged: cursors from: aSourceObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModel >> elementClass [ ^ GtTextualCoderEditorElement ] -{ #category : 'api - add-ons' } +{ #category : #'api - add-ons' } GtTextualCoderViewModel >> ensureAddOns [ self addOnsAsyncDo: [ :theAddOns | ] ] -{ #category : 'api - expansion' } +{ #category : #'api - expansion' } GtTextualCoderViewModel >> expand [ self expanded: true ] -{ #category : 'api - expansion' } +{ #category : #'api - expansion' } GtTextualCoderViewModel >> expanded [ ^ expanded ] -{ #category : 'api - expansion' } +{ #category : #'api - expansion' } GtTextualCoderViewModel >> expanded: aBoolean [ expanded = aBoolean ifTrue: [ ^ self ]. @@ -332,24 +339,24 @@ GtTextualCoderViewModel >> expanded: aBoolean [ self notifyExpansionChanged: expanded ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModel >> extraTextAttributes [ ^ extraTextAttributes ] -{ #category : 'api - focus' } +{ #category : #'api - focus' } GtTextualCoderViewModel >> focused [ ^ hasFocus ] -{ #category : 'api - focus' } +{ #category : #'api - focus' } GtTextualCoderViewModel >> focused: aBoolean [ self focused: aBoolean from: self ] -{ #category : 'api - focus' } +{ #category : #'api - focus' } GtTextualCoderViewModel >> focused: aBoolean from: aSourceObject [ hasFocus = aBoolean ifTrue: [ ^ self ]. @@ -363,7 +370,7 @@ GtTextualCoderViewModel >> focused: aBoolean from: aSourceObject [ ifFalse: [ theCoders unfocusCoderUIModel: self ] ] ] -{ #category : 'gt-extension' } +{ #category : #'gt-extension' } GtTextualCoderViewModel >> gtInfo [ ^ Array streamContents: [ :aStream | aStream nextPut: (#coderModel -> self coderModel). @@ -380,7 +387,7 @@ GtTextualCoderViewModel >> gtInfo [ aStream nextPut: (#expanded -> self expanded) ] ] -{ #category : 'gt-extension' } +{ #category : #'gt-extension' } GtTextualCoderViewModel >> gtInfoFor: aView [ @@ -398,12 +405,12 @@ GtTextualCoderViewModel >> gtInfoFor: aView [ updateWhen: GtTextualCoderViewModelAnnouncement in: self announcer ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtTextualCoderViewModel >> hasSelection [ ^ self selection isNotEmpty ] -{ #category : 'api - styled text' } +{ #category : #'api - styled text' } GtTextualCoderViewModel >> hasStyledText [ @@ -412,7 +419,7 @@ GtTextualCoderViewModel >> hasStyledText [ ^ styledText notNil ] -{ #category : 'initialization' } +{ #category : #initialization } GtTextualCoderViewModel >> initialize [ super initialize. @@ -432,12 +439,12 @@ GtTextualCoderViewModel >> initialize [ expanded := true ] -{ #category : 'api - add-ons' } +{ #category : #'api - add-ons' } GtTextualCoderViewModel >> mainActions [ ^ mainActions ] -{ #category : 'api - add-ons' } +{ #category : #'api - add-ons' } GtTextualCoderViewModel >> mainActions: theMainActions [ mainActions = theMainActions ifTrue: [ ^ self ]. @@ -446,48 +453,48 @@ GtTextualCoderViewModel >> mainActions: theMainActions [ self announce: GtTextualCoderViewModelMainActionsChanged new ] -{ #category : 'api - cursors' } +{ #category : #'api - cursors' } GtTextualCoderViewModel >> moveCursorAtEnd [ "Move the cursor at the end of the textual snippet" self moveCursorTo: self sourceText size ] -{ #category : 'api - cursors' } +{ #category : #'api - cursors' } GtTextualCoderViewModel >> moveCursorAtStart [ "Move the cursor at the end of the textual snippet" self moveCursorTo: 0 ] -{ #category : 'api - cursors' } +{ #category : #'api - cursors' } GtTextualCoderViewModel >> moveCursorTo: aCursorIndex [ self cursors: (BrTextEditorCursor at: aCursorIndex) ] -{ #category : 'private - notifying' } +{ #category : #'private - notifying' } GtTextualCoderViewModel >> notifyCursorsChanged: aBrTextEditorCursor from: aSourceObject [ self announce: (GtTextualCoderViewModelCursorsChanged new cursors: aBrTextEditorCursor; source: aSourceObject) ] -{ #category : 'private - notifying' } +{ #category : #'private - notifying' } GtTextualCoderViewModel >> notifyExpansionChanged: aBoolean [ self announce: (GtTextualCoderViewModelExpansionChanged new expanded: aBoolean) ] -{ #category : 'private - notifying' } +{ #category : #'private - notifying' } GtTextualCoderViewModel >> notifyFocusChanged: aBoolean from: aSourceObject [ self announcerUIModel announce: (GtSourceCoderFocusChanged new focused: aBoolean; source: aSourceObject) ] -{ #category : 'private - notifying' } +{ #category : #'private - notifying' } GtTextualCoderViewModel >> notifySelectionChanged: aBlCompositeSelection from: aSourceObject [ self announce: (GtTextualCoderViewModelSelectionChanged new selection: aBlCompositeSelection; source: aSourceObject) ] -{ #category : 'api - styled text' } +{ #category : #'api - styled text' } GtTextualCoderViewModel >> notifyStyledTextChanged [ "Override this notify method to announce changes to the property" @@ -496,7 +503,7 @@ GtTextualCoderViewModel >> notifyStyledTextChanged [ styledText: self styledText). ] -{ #category : 'private - addons' } +{ #category : #'private - addons' } GtTextualCoderViewModel >> onAddOnsChanged: theAddOns [ "Is sent when new add-ons are computed" @@ -507,7 +514,7 @@ GtTextualCoderViewModel >> onAddOnsChanged: theAddOns [ self contextMenuActions: theAddOns contextMenuActions ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderViewModel >> onAstChanged: anAstChangedAnnouncement [ "ast changed, the styled text may not be valid anymore" @@ -520,21 +527,21 @@ GtTextualCoderViewModel >> onAstChanged: anAstChangedAnnouncement [ self addOnsAsyncDo: [ :theAddOns | self announce: GtTextualCoderViewModelReadyToRestyle new ] ] -{ #category : 'api - styled text' } +{ #category : #'api - styled text' } GtTextualCoderViewModel >> onNewStyledTextSet: aNewStyledText [ "Is sent after a new value of the styledText is assigned" >#onNewPropertySetHookTemplate'> ] -{ #category : 'api - styled text' } +{ #category : #'api - styled text' } GtTextualCoderViewModel >> onPreviousStyledTextUnset: aPreviousStyledText [ "Is sent after a previous value of the styledText is de-assigned" >#onPreviousPropertyUnsetHookTemplate'> ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderViewModel >> onSourceCodeChanged: anSourceCodeChangedAnnouncement [ "source code changed, meaning that the styled text is no longer correct" @@ -550,20 +557,20 @@ GtTextualCoderViewModel >> onSourceCodeChanged: anSourceCodeChangedAnnouncement self coderModel ensureAst ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtTextualCoderViewModel >> removeAllCoderTextAttributes: aCollectionOfGtTextualCoderTextAttributes [ aCollectionOfGtTextualCoderTextAttributes do: [ :eachCoderTextAttribute | self removeCoderTextAttributes: eachCoderTextAttribute ] ] -{ #category : 'api - refactorings' } +{ #category : #'api - refactorings' } GtTextualCoderViewModel >> removeAttribute: anAttribute [ | attributes | attributes := self extraTextAttributes select: [ :each | each textAttributes includes: anAttribute ]. self removeAllCoderTextAttributes: attributes ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtTextualCoderViewModel >> removeCoderTextAttributes: aGtTextualCoderTextAttributes [ | aCurrentText | @@ -578,31 +585,31 @@ GtTextualCoderViewModel >> removeCoderTextAttributes: aGtTextualCoderTextAttribu self announce: (GtTextualCoderViewModelTextAttributesRemoved new coderTextAttributes: aGtTextualCoderTextAttributes) ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtTextualCoderViewModel >> select: aFromCursorIndex to: aToCursorIndex [ self selection: (self selection copy select: aFromCursorIndex to: aToCursorIndex) ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtTextualCoderViewModel >> selectNone [ self selection: BlCompositeSelection new ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtTextualCoderViewModel >> selection [ ^ selection ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtTextualCoderViewModel >> selection: aBlCompositeSelection [ self selection: aBlCompositeSelection from: self ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtTextualCoderViewModel >> selection: aBlCompositeSelection from: aSourceObject [ selection = aBlCompositeSelection ifTrue: [ ^ self ]. @@ -611,7 +618,7 @@ GtTextualCoderViewModel >> selection: aBlCompositeSelection from: aSourceObject self notifySelectionChanged: selection from: aSourceObject ] -{ #category : 'api - shortcuts' } +{ #category : #'api - shortcuts' } GtTextualCoderViewModel >> shortcuts [ "Return a collection of current editor shortcuts that are computed based on the coder add-ons and extra view-model add-ons. Do not modify the returned collection as it will be recomputed when ast or add-ons change; instead use #addShortcut:" @@ -620,7 +627,7 @@ GtTextualCoderViewModel >> shortcuts [ ^ shortcuts ] -{ #category : 'api - shortcuts' } +{ #category : #'api - shortcuts' } GtTextualCoderViewModel >> shortcuts: aCollectionOfShortcuts [ shortcuts = aCollectionOfShortcuts ifTrue: [ ^ self ]. @@ -629,7 +636,7 @@ GtTextualCoderViewModel >> shortcuts: aCollectionOfShortcuts [ self announce: GtTextualCoderViewModelShortcutsChanged new ] -{ #category : 'api - add-ons' } +{ #category : #'api - add-ons' } GtTextualCoderViewModel >> shouldAddOnsBeUpdated [ "Return true if addons should be updated, false otherwise. When a Coder Model is attached to the corresponding Element that element should check if addons need to be updated and if it is the case start the update with the help of ${method:GtCoderModel>>#updateAddOnsFrom:}$" @@ -641,14 +648,14 @@ GtTextualCoderViewModel >> shouldAddOnsBeUpdated [ ifNotNil: [ :theAddOns | theAddOns shouldBeUpdated ] ] ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtTextualCoderViewModel >> sourceText [ ^ self coderModel sourceText ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtTextualCoderViewModel >> sourceText: aNewSourceText from: aSourceObject synchronously: isSynchronous [ self coderModel currentSourceText: aNewSourceText @@ -657,7 +664,7 @@ GtTextualCoderViewModel >> sourceText: aNewSourceText from: aSourceObject synch isSynchronous: isSynchronous) ] -{ #category : 'api - styled text' } +{ #category : #'api - styled text' } GtTextualCoderViewModel >> styledText [ @@ -666,7 +673,7 @@ GtTextualCoderViewModel >> styledText [ ^ styledText ] -{ #category : 'api - styled text' } +{ #category : #'api - styled text' } GtTextualCoderViewModel >> styledText: aNewStyledText [ @@ -687,12 +694,12 @@ GtTextualCoderViewModel >> styledText: aNewStyledText [ self notifyStyledTextChanged ] -{ #category : 'api - stylers' } +{ #category : #'api - stylers' } GtTextualCoderViewModel >> stylers [ ^ stylers ] -{ #category : 'api - stylers' } +{ #category : #'api - stylers' } GtTextualCoderViewModel >> stylers: theStylers [ stylers = theStylers ifTrue: [ ^ self ]. @@ -707,7 +714,7 @@ GtTextualCoderViewModel >> stylers: theStylers [ self announce: GtTextualCoderViewModelStylersChanged new ] -{ #category : 'api - coder model' } +{ #category : #'api - coder model' } GtTextualCoderViewModel >> subscribeToCoderModel [ super subscribeToCoderModel. @@ -722,7 +729,7 @@ GtTextualCoderViewModel >> subscribeToCoderModel [ to: self ] -{ #category : 'api - add-ons' } +{ #category : #'api - add-ons' } GtTextualCoderViewModel >> terminateAddOnsCommand [ addOnMonitor critical: [ addOnCommand ifNotNil: [ :anAddOnsCommand | anAddOnsCommand terminate ]. @@ -730,7 +737,7 @@ GtTextualCoderViewModel >> terminateAddOnsCommand [ addOnCommandBlock := nil ] ] -{ #category : 'api - styled text' } +{ #category : #'api - styled text' } GtTextualCoderViewModel >> unsetStyledText [ >#propertyUnsetterTemplate'> @@ -745,7 +752,7 @@ GtTextualCoderViewModel >> unsetStyledText [ self notifyStyledTextChanged ] -{ #category : 'api - coder model' } +{ #category : #'api - coder model' } GtTextualCoderViewModel >> unsubscribeFromCoderModel [ super unsubscribeFromCoderModel. diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelAddOnsChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelAddOnsChanged.class.st index 2ebdf2585..442b0dac8 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelAddOnsChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelAddOnsChanged.class.st @@ -1,18 +1,18 @@ Class { - #name : 'GtTextualCoderViewModelAddOnsChanged', - #superclass : 'GtTextualCoderViewModelAnnouncement', + #name : #GtTextualCoderViewModelAddOnsChanged, + #superclass : #GtTextualCoderViewModelAnnouncement, #instVars : [ 'addOns' ], #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelAddOnsChanged >> addOns [ ^ addOns ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelAddOnsChanged >> addOns: anObject [ addOns := anObject ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelAnnouncement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelAnnouncement.class.st index 25e571df2..baebada4f 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelAnnouncement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelAnnouncement.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtTextualCoderViewModelAnnouncement', - #superclass : 'Announcement', + #name : #GtTextualCoderViewModelAnnouncement, + #superclass : #Announcement, #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelAstChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelAstChanged.class.st index 60dd1173d..8b4857d01 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelAstChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelAstChanged.class.st @@ -1,18 +1,18 @@ Class { - #name : 'GtTextualCoderViewModelAstChanged', - #superclass : 'GtTextualCoderViewModelAnnouncement', + #name : #GtTextualCoderViewModelAstChanged, + #superclass : #GtTextualCoderViewModelAnnouncement, #instVars : [ 'ast' ], #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelAstChanged >> ast [ ^ ast ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelAstChanged >> ast: anObject [ ast := anObject ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelContextActionsChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelContextActionsChanged.class.st index 6b006b2f7..31bea0d2d 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelContextActionsChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelContextActionsChanged.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtTextualCoderViewModelContextActionsChanged', - #superclass : 'GtTextualCoderViewModelAnnouncement', + #name : #GtTextualCoderViewModelContextActionsChanged, + #superclass : #GtTextualCoderViewModelAnnouncement, #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelContextMenuActionsChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelContextMenuActionsChanged.class.st index 35eff09fd..e4037d396 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelContextMenuActionsChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelContextMenuActionsChanged.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtTextualCoderViewModelContextMenuActionsChanged', - #superclass : 'GtTextualCoderViewModelAnnouncement', + #name : #GtTextualCoderViewModelContextMenuActionsChanged, + #superclass : #GtTextualCoderViewModelAnnouncement, #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelCursorsChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelCursorsChanged.class.st index e1721c0cd..48f217f5c 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelCursorsChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelCursorsChanged.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtTextualCoderViewModelCursorsChanged', - #superclass : 'GtTextualCoderViewModelAnnouncement', + #name : #GtTextualCoderViewModelCursorsChanged, + #superclass : #GtTextualCoderViewModelAnnouncement, #instVars : [ 'source', 'cursors' @@ -8,22 +8,22 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelCursorsChanged >> cursors [ ^ cursors ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelCursorsChanged >> cursors: anObject [ cursors := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelCursorsChanged >> source [ ^ source ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelCursorsChanged >> source: anObject [ source := anObject ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelExpansionChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelExpansionChanged.class.st index 0e793da52..1e47fbb7c 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelExpansionChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelExpansionChanged.class.st @@ -1,18 +1,18 @@ Class { - #name : 'GtTextualCoderViewModelExpansionChanged', - #superclass : 'GtTextualCoderViewModelAnnouncement', + #name : #GtTextualCoderViewModelExpansionChanged, + #superclass : #GtTextualCoderViewModelAnnouncement, #instVars : [ 'expanded' ], #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelExpansionChanged >> expanded [ ^ expanded ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelExpansionChanged >> expanded: aBoolean [ expanded := aBoolean ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelMainActionsChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelMainActionsChanged.class.st index ad3a090f6..43330f290 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelMainActionsChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelMainActionsChanged.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtTextualCoderViewModelMainActionsChanged', - #superclass : 'GtTextualCoderViewModelAnnouncement', + #name : #GtTextualCoderViewModelMainActionsChanged, + #superclass : #GtTextualCoderViewModelAnnouncement, #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelReadyToRestyle.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelReadyToRestyle.class.st index 4203b075b..cd570bfdf 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelReadyToRestyle.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelReadyToRestyle.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtTextualCoderViewModelReadyToRestyle', - #superclass : 'GtTextualCoderViewModelAnnouncement', + #name : #GtTextualCoderViewModelReadyToRestyle, + #superclass : #GtTextualCoderViewModelAnnouncement, #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelSelectionChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelSelectionChanged.class.st index c9b976a50..fbdc887da 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelSelectionChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelSelectionChanged.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtTextualCoderViewModelSelectionChanged', - #superclass : 'GtTextualCoderViewModelAnnouncement', + #name : #GtTextualCoderViewModelSelectionChanged, + #superclass : #GtTextualCoderViewModelAnnouncement, #instVars : [ 'source', 'selection' @@ -8,22 +8,22 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelSelectionChanged >> selection [ ^ selection ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelSelectionChanged >> selection: anObject [ selection := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelSelectionChanged >> source [ ^ source ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelSelectionChanged >> source: anObject [ source := anObject ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelShortcutsChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelShortcutsChanged.class.st index 49b725897..6b6fa3cb9 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelShortcutsChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelShortcutsChanged.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtTextualCoderViewModelShortcutsChanged', - #superclass : 'GtTextualCoderViewModelAnnouncement', + #name : #GtTextualCoderViewModelShortcutsChanged, + #superclass : #GtTextualCoderViewModelAnnouncement, #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelStyledTextChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelStyledTextChanged.class.st index 290eda7f9..a33fdc44b 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelStyledTextChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelStyledTextChanged.class.st @@ -1,13 +1,13 @@ Class { - #name : 'GtTextualCoderViewModelStyledTextChanged', - #superclass : 'GtTextualCoderViewModelAnnouncement', + #name : #GtTextualCoderViewModelStyledTextChanged, + #superclass : #GtTextualCoderViewModelAnnouncement, #instVars : [ 'styledText' ], #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } -{ #category : 'generated' } +{ #category : #generated } GtTextualCoderViewModelStyledTextChanged >> styledText [ >#objectGetterTemplate'> @@ -15,7 +15,7 @@ GtTextualCoderViewModelStyledTextChanged >> styledText [ ^ styledText ] -{ #category : 'generated' } +{ #category : #generated } GtTextualCoderViewModelStyledTextChanged >> styledText: aStyledText [ >#objectSetterTemplate'> diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelStylersChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelStylersChanged.class.st index 8abca3996..1be39f84c 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelStylersChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelStylersChanged.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtTextualCoderViewModelStylersChanged', - #superclass : 'GtTextualCoderViewModelAnnouncement', + #name : #GtTextualCoderViewModelStylersChanged, + #superclass : #GtTextualCoderViewModelAnnouncement, #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextAttributesAdded.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextAttributesAdded.class.st index 69f35f6d9..559a65547 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextAttributesAdded.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextAttributesAdded.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtTextualCoderViewModelTextAttributesAdded', - #superclass : 'GtTextualCoderViewModelAnnouncement', + #name : #GtTextualCoderViewModelTextAttributesAdded, + #superclass : #GtTextualCoderViewModelAnnouncement, #instVars : [ 'coderTextAttributes', 'startPosition', @@ -9,32 +9,32 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelTextAttributesAdded >> coderTextAttributes [ ^ coderTextAttributes ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelTextAttributesAdded >> coderTextAttributes: anObject [ coderTextAttributes := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelTextAttributesAdded >> startPosition [ ^ startPosition ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelTextAttributesAdded >> startPosition: anObject [ startPosition := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelTextAttributesAdded >> stopPosition [ ^ stopPosition ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelTextAttributesAdded >> stopPosition: anObject [ stopPosition := anObject ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextAttributesRemoved.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextAttributesRemoved.class.st index e6e8241e6..effd1f400 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextAttributesRemoved.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextAttributesRemoved.class.st @@ -1,18 +1,18 @@ Class { - #name : 'GtTextualCoderViewModelTextAttributesRemoved', - #superclass : 'GtTextualCoderViewModelAnnouncement', + #name : #GtTextualCoderViewModelTextAttributesRemoved, + #superclass : #GtTextualCoderViewModelAnnouncement, #instVars : [ 'coderTextAttributes' ], #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelTextAttributesRemoved >> coderTextAttributes [ ^ coderTextAttributes ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelTextAttributesRemoved >> coderTextAttributes: anObject [ coderTextAttributes := anObject ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextChanged.class.st index 5d1e95353..0e6d1aa30 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextChanged.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtTextualCoderViewModelTextChanged', - #superclass : 'GtTextualCoderViewModelAnnouncement', + #name : #GtTextualCoderViewModelTextChanged, + #superclass : #GtTextualCoderViewModelAnnouncement, #instVars : [ 'text', 'updateStrategy' @@ -8,32 +8,32 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelTextChanged >> isSynchronous [ ^ self updateStrategy isSynchronous ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelTextChanged >> source [ ^ self updateStrategy source ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelTextChanged >> text [ ^ text ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelTextChanged >> text: anObject [ text := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelTextChanged >> updateStrategy [ ^ updateStrategy ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelTextChanged >> updateStrategy: anObject [ updateStrategy := anObject ] diff --git a/src/GToolkit-Coder-UI/RBAddClassVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBAddClassVariableRefactoring.extension.st index dc4dae786..3afe79dd1 100644 --- a/src/GToolkit-Coder-UI/RBAddClassVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBAddClassVariableRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBAddClassVariableRefactoring' } +Extension { #name : #RBAddClassVariableRefactoring } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } RBAddClassVariableRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/RBAddInstanceVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBAddInstanceVariableRefactoring.extension.st index 1e6342e68..c54c63196 100644 --- a/src/GToolkit-Coder-UI/RBAddInstanceVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBAddInstanceVariableRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBAddInstanceVariableRefactoring' } +Extension { #name : #RBAddInstanceVariableRefactoring } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } RBAddInstanceVariableRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/RBRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRefactoring.extension.st index 5acca20e2..5dfe0ecf1 100644 --- a/src/GToolkit-Coder-UI/RBRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBRefactoring' } +Extension { #name : #RBRefactoring } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } RBRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/RBRemoveClassVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRemoveClassVariableRefactoring.extension.st index 91780cc1c..515063afb 100644 --- a/src/GToolkit-Coder-UI/RBRemoveClassVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBRemoveClassVariableRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBRemoveClassVariableRefactoring' } +Extension { #name : #RBRemoveClassVariableRefactoring } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } RBRemoveClassVariableRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/RBRemoveInstanceVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRemoveInstanceVariableRefactoring.extension.st index 661def9e9..54daab99c 100644 --- a/src/GToolkit-Coder-UI/RBRemoveInstanceVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBRemoveInstanceVariableRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBRemoveInstanceVariableRefactoring' } +Extension { #name : #RBRemoveInstanceVariableRefactoring } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } RBRemoveInstanceVariableRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/RBRenameClassRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRenameClassRefactoring.extension.st index a3377598d..9e8c10631 100644 --- a/src/GToolkit-Coder-UI/RBRenameClassRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBRenameClassRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBRenameClassRefactoring' } +Extension { #name : #RBRenameClassRefactoring } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } RBRenameClassRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/RBRenameClassVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRenameClassVariableRefactoring.extension.st index 009ed66f1..fd3f38aa4 100644 --- a/src/GToolkit-Coder-UI/RBRenameClassVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBRenameClassVariableRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBRenameClassVariableRefactoring' } +Extension { #name : #RBRenameClassVariableRefactoring } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } RBRenameClassVariableRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/RBRenameInstanceVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRenameInstanceVariableRefactoring.extension.st index e1732c3f1..2b29bcf97 100644 --- a/src/GToolkit-Coder-UI/RBRenameInstanceVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBRenameInstanceVariableRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBRenameInstanceVariableRefactoring' } +Extension { #name : #RBRenameInstanceVariableRefactoring } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } RBRenameInstanceVariableRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/RBTransformation.extension.st b/src/GToolkit-Coder-UI/RBTransformation.extension.st index 85e4edab8..2da892fec 100644 --- a/src/GToolkit-Coder-UI/RBTransformation.extension.st +++ b/src/GToolkit-Coder-UI/RBTransformation.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBTransformation' } +Extension { #name : #RBTransformation } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } RBTransformation >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/TBlDevScripterTarget.extension.st b/src/GToolkit-Coder-UI/TBlDevScripterTarget.extension.st index fdda33985..ac516b20c 100644 --- a/src/GToolkit-Coder-UI/TBlDevScripterTarget.extension.st +++ b/src/GToolkit-Coder-UI/TBlDevScripterTarget.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'TBlDevScripterTarget' } +Extension { #name : #TBlDevScripterTarget } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } TBlDevScripterTarget >> onGtPharoSnippetDestinationButton [ self onChildNamed: #content; @@ -8,7 +8,7 @@ TBlDevScripterTarget >> onGtPharoSnippetDestinationButton [ onChildNamed: #switchButton ] -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } TBlDevScripterTarget >> onGtPharoSnippetEvaluateButton [ self "onChildOfClass: GtExpandableCoderElement;" @@ -20,7 +20,7 @@ TBlDevScripterTarget >> onGtPharoSnippetEvaluateButton [ onChildAt: 1 ] -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } TBlDevScripterTarget >> onGtPharoSnippetPlayButton [ self onChildNamed: #content; diff --git a/src/GToolkit-Coder-UI/TGtCoderNavigationClassesHelper.trait.st b/src/GToolkit-Coder-UI/TGtCoderNavigationClassesHelper.trait.st index c30cf9ec1..f71942481 100644 --- a/src/GToolkit-Coder-UI/TGtCoderNavigationClassesHelper.trait.st +++ b/src/GToolkit-Coder-UI/TGtCoderNavigationClassesHelper.trait.st @@ -1,9 +1,9 @@ Trait { - #name : 'TGtCoderNavigationClassesHelper', + #name : #TGtCoderNavigationClassesHelper, #category : 'GToolkit-Coder-UI-Navigation' } -{ #category : 'private - ui' } +{ #category : #'private - ui' } TGtCoderNavigationClassesHelper >> buildClassLabel: aClass [ | aLook aText | aLook := (BrGlamorousLabelAptitude new fontSize: 12). @@ -23,12 +23,12 @@ TGtCoderNavigationClassesHelper >> buildClassLabel: aClass [ text: aText. ] -{ #category : 'private - testing' } +{ #category : #'private - testing' } TGtCoderNavigationClassesHelper >> isAbstractClass: aClass [ ^ aClass isAbstract or: [ aClass hasAbstractMethods ] ] -{ #category : 'private - testing' } +{ #category : #'private - testing' } TGtCoderNavigationClassesHelper >> isDeprecatedClass: aClass [ ^ aClass isDeprecated ] diff --git a/src/GToolkit-Coder-UI/TGtWithCoderModel.trait.st b/src/GToolkit-Coder-UI/TGtWithCoderModel.trait.st index 8af096e17..0f6494a9d 100644 --- a/src/GToolkit-Coder-UI/TGtWithCoderModel.trait.st +++ b/src/GToolkit-Coder-UI/TGtWithCoderModel.trait.st @@ -1,12 +1,12 @@ Trait { - #name : 'TGtWithCoderModel', + #name : #TGtWithCoderModel, #instVars : [ 'coderModel' ], #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'api - coder model' } +{ #category : #'api - coder model' } TGtWithCoderModel >> coderModel [ "Return a not-null coder model assigned to the receiver view model" self @@ -16,7 +16,7 @@ TGtWithCoderModel >> coderModel [ ^ coderModel ] -{ #category : 'api - coder model' } +{ #category : #'api - coder model' } TGtWithCoderModel >> coderModel: aCoderModel [ "Set a not-null coder domain model assigned to the receiver view model" self @@ -33,7 +33,7 @@ TGtWithCoderModel >> coderModel: aCoderModel [ self subscribeToCoderModel ] -{ #category : 'api - coder model' } +{ #category : #'api - coder model' } TGtWithCoderModel >> hasCoder [ "Return a true if coder model is assigned to the receiver, false otherwise" @@ -41,21 +41,21 @@ TGtWithCoderModel >> hasCoder [ ^ coderModel notNil ] -{ #category : 'api - coder model' } +{ #category : #'api - coder model' } TGtWithCoderModel >> onCoderModelChanged [ "Is sent when a new coder model is assigned to the view model" self explicitRequirement ] -{ #category : 'api - coder model' } +{ #category : #'api - coder model' } TGtWithCoderModel >> subscribeToCoderModel [ "Is sent after a new coder model is assigned to the view model. It is required to unsubscribe from the domain model by implementing #unsubscribeFromCoderModel if view model subscribes to them" ] -{ #category : 'api - coder model' } +{ #category : #'api - coder model' } TGtWithCoderModel >> unsubscribeFromCoderModel [ "Is sent before a new coder model is assigned to the view model. View models that subscribe to coder model are required to implement this methods" diff --git a/src/GToolkit-Coder-UI/TGtWithCoderToolViewModel.trait.st b/src/GToolkit-Coder-UI/TGtWithCoderToolViewModel.trait.st index 2fe498778..17a7c89df 100644 --- a/src/GToolkit-Coder-UI/TGtWithCoderToolViewModel.trait.st +++ b/src/GToolkit-Coder-UI/TGtWithCoderToolViewModel.trait.st @@ -1,12 +1,12 @@ Trait { - #name : 'TGtWithCoderToolViewModel', + #name : #TGtWithCoderToolViewModel, #instVars : [ 'coderToolViewModel' ], #category : 'GToolkit-Coder-UI-! Core - View Models' } -{ #category : 'api - coder tool view model' } +{ #category : #'api - coder tool view model' } TGtWithCoderToolViewModel >> coderToolViewModel [ "Return a not-null coderTool view model assigned to the receiver element" self @@ -16,7 +16,7 @@ TGtWithCoderToolViewModel >> coderToolViewModel [ ^ coderToolViewModel ] -{ #category : 'api - coder tool view model' } +{ #category : #'api - coder tool view model' } TGtWithCoderToolViewModel >> coderToolViewModel: aCoderToolViewModel [ "Set a not-null coderTool view model assigned to the receiver element" self @@ -34,7 +34,7 @@ TGtWithCoderToolViewModel >> coderToolViewModel: aCoderToolViewModel [ self onPostCoderToolViewModelChanged ] -{ #category : 'api - coder tool view model' } +{ #category : #'api - coder tool view model' } TGtWithCoderToolViewModel >> hasCoderToolViewModel [ "Return a true if coderTool view model is assigned to the receiver element, false otherwise" @@ -42,7 +42,7 @@ TGtWithCoderToolViewModel >> hasCoderToolViewModel [ ^ coderToolViewModel notNil ] -{ #category : 'api - coder tool view model' } +{ #category : #'api - coder tool view model' } TGtWithCoderToolViewModel >> onCoderToolViewModelChanged [ "Is sent when a new coderTool view model is assigned to the element. Note: #onCoderToolViewModelChanged is sent before #subscribeToCoderToolViewModel @@ -53,21 +53,21 @@ TGtWithCoderToolViewModel >> onCoderToolViewModelChanged [ self explicitRequirement ] -{ #category : 'api - coder tool view model' } +{ #category : #'api - coder tool view model' } TGtWithCoderToolViewModel >> onPostCoderToolViewModelChanged [ "I am an optional hook method that is sent after #subscribeToCoderToolViewModel. I do nothing by default but allow users to perform update operations when a receiver object is already subscribed to announcements." ] -{ #category : 'api - coder tool view model' } +{ #category : #'api - coder tool view model' } TGtWithCoderToolViewModel >> subscribeToCoderToolViewModel [ "Is sent after a new coderTool view model is assigned to the element. It is required to unsubscribe from the view model or domain model by implementing #unsubscribeFromCoderToolViewModel if elements subscribe to them" ] -{ #category : 'api - coder tool view model' } +{ #category : #'api - coder tool view model' } TGtWithCoderToolViewModel >> unsubscribeFromCoderToolViewModel [ "Is sent before a new coderTool view model is assigned to the element. Elements that subscribe to coderTool view model in domain model are required to implement this methods." diff --git a/src/GToolkit-Coder-UI/TGtWithTextualCoderViewModel.trait.st b/src/GToolkit-Coder-UI/TGtWithTextualCoderViewModel.trait.st index ce8a7ea3c..cf4932b1a 100644 --- a/src/GToolkit-Coder-UI/TGtWithTextualCoderViewModel.trait.st +++ b/src/GToolkit-Coder-UI/TGtWithTextualCoderViewModel.trait.st @@ -1,12 +1,12 @@ Trait { - #name : 'TGtWithTextualCoderViewModel', + #name : #TGtWithTextualCoderViewModel, #instVars : [ 'textualCoderViewModel' ], #category : 'GToolkit-Coder-UI-Coder - Textual' } -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } TGtWithTextualCoderViewModel >> hasTextualCoderViewModel [ "Return a true if textualCoder view model is assigned to the receiver element, false otherwise" @@ -14,14 +14,14 @@ TGtWithTextualCoderViewModel >> hasTextualCoderViewModel [ ^ textualCoderViewModel notNil ] -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } TGtWithTextualCoderViewModel >> onPostTextualCoderViewModelChanged [ "I am an optional hook method that is sent after #subscribeToTextualCoderViewModel. I do nothing by default but allow users to perform update operations when a receiver object is already subscribed to announcements." ] -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } TGtWithTextualCoderViewModel >> onTextualCoderViewModelChanged [ "Is sent when a new textualCoder view model is assigned to the element. Note: #onTextualCoderViewModelChanged is sent before #subscribeToTextualCoderViewModel @@ -32,14 +32,14 @@ TGtWithTextualCoderViewModel >> onTextualCoderViewModelChanged [ self explicitRequirement ] -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } TGtWithTextualCoderViewModel >> subscribeToTextualCoderViewModel [ "Is sent after a new textualCoder view model is assigned to the element. It is required to unsubscribe from the view model or domain model by implementing #unsubscribeFromTextualCoderViewModel if elements subscribe to them" ] -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } TGtWithTextualCoderViewModel >> textualCoderViewModel [ "Return a not-null textualCoder view model assigned to the receiver element" self @@ -49,7 +49,7 @@ TGtWithTextualCoderViewModel >> textualCoderViewModel [ ^ textualCoderViewModel ] -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } TGtWithTextualCoderViewModel >> textualCoderViewModel: aTextualCoderViewModel [ "Set a not-null textualCoder view model assigned to the receiver element" self @@ -67,7 +67,7 @@ TGtWithTextualCoderViewModel >> textualCoderViewModel: aTextualCoderViewModel [ self onPostTextualCoderViewModelChanged ] -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } TGtWithTextualCoderViewModel >> unsubscribeFromTextualCoderViewModel [ "Is sent before a new textualCoder view model is assigned to the element. Elements that subscribe to textualCoder view model in domain model are required to implement this methods." diff --git a/src/GToolkit-Coder-UI/package.st b/src/GToolkit-Coder-UI/package.st index 433afab60..1af08cc70 100644 --- a/src/GToolkit-Coder-UI/package.st +++ b/src/GToolkit-Coder-UI/package.st @@ -1 +1 @@ -Package { #name : 'GToolkit-Coder-UI' } +Package { #name : #'GToolkit-Coder-UI' } From 5bb836d66aca75ef37fe3ccfce892cd3b05b57bf Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 12 Oct 2021 14:32:39 -0300 Subject: [PATCH 0037/1268] fix `GtFilterRunExampleButtonFourStateIconAptitude` class comment --- ...ilterRunExampleButtonFourStateIconAptitude.class.st | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonFourStateIconAptitude.class.st b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonFourStateIconAptitude.class.st index 63b2a094d..455a7a80b 100644 --- a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonFourStateIconAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonFourStateIconAptitude.class.st @@ -2,17 +2,17 @@ I am a {{gtClass:GtFilterRunExampleButtonIconAptitude}}. I display a colored icon that represents an {{gtClass:GtExampleWithResult}} execution and result state. If there are examples with different execution states, I display several colors. -1. # Examples +#Examples The following examples show example status icons. -1. ## All States +##All States I display all states at once as follows: {{gtExample:GtFilterRunExampleButtonLookExamples>>#fourIconLookButton_WithoutCoder|codeExpanded=false|previewExpanded=true|previewShow=#gtLiveFor:|previewHeight=65}} -1. ## Not Executed Examples +##Not Executed Examples If all examples have same state, only one icon (color) is displayed: {{gtExample:GtFilterRunExampleButtonLookExamples>>#fourIconLookButton_NotExecuted|codeExpanded=false|previewExpanded=true|previewShow=#gtLiveFor:|previewHeight=65}} -1. ## Examples With Two Execution States +##Examples With Two Execution States {{gtExample:GtFilterRunExampleButtonLookExamples>>#fourIconLookButton_SuccessAndNotExecutedStates|codeExpanded=false|previewExpanded=true|previewShow=#gtLiveFor:|previewHeight=65}} @@ -29,7 +29,7 @@ Class { 'successIconElement', 'neutralIconElement' ], - #category : 'GToolkit-Coder-UI-Filters' + #category : #'GToolkit-Coder-UI-Filters' } { #category : #'private - accessing' } From 2453575b3f0f1bcbc82462db954d4a9c8b5b79f2 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 12 Oct 2021 15:10:56 -0300 Subject: [PATCH 0038/1268] fix `GtCoderExampleStateElement` class comment --- .../GtCoderExampleStateElement.class.st | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st index 06e1ea410..1cd360391 100644 --- a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st @@ -1,16 +1,16 @@ " I am an {{gtClass:BlElement}}. I am an icon that represents an {{gtClass:GtExampleWithResult}} result state. -1. # Not Executed State +#Not Executed State {{gtExample:GtCoderExampleStateElementExamples>>#exampleStateElement_NotExecuted|codeExpanded=false|previewExpanded=true|previewShow=#gtLiveFor:|previewHeight=50}} -1. # Success State +#Success State {{gtExample:GtCoderExampleStateElementExamples>>#exampleStateElement_Success|codeExpanded=false|previewExpanded=true|previewShow=#gtLiveFor:|previewHeight=50}} -1. # Failure State +#Failure State {{gtExample:GtCoderExampleStateElementExamples>>#exampleStateElement_Failure|codeExpanded=false|previewExpanded=true|previewShow=#gtLiveFor:|previewHeight=50}} -1. # Error State +#Error State {{gtExample:GtCoderExampleStateElementExamples>>#exampleStateElement_Error|codeExpanded=false|previewExpanded=true|previewShow=#gtLiveFor:|previewHeight=50}} @@ -25,7 +25,7 @@ Class { 'example', 'styleLook' ], - #category : 'GToolkit-Coder-UI-Basic' + #category : #'GToolkit-Coder-UI-Basic' } { #category : #'private - asserting' } From 43678f9c2a25f112b59213165d6722955faef27d Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 12 Oct 2021 15:57:42 -0500 Subject: [PATCH 0039/1268] [feenkcom/gtoolkit#2176] use styled text for rename attributes --- .../GtCompositeRenameAction.class.st | 26 ++--- .../GtFixItAction.class.st | 26 ++--- .../GtFixItActionElementId.class.st | 6 +- .../GtFixItAttribute.class.st | 10 +- .../GtFixItButton.class.st | 4 +- .../GtRenameAction.class.st | 96 +++++++++---------- .../GtRenameAction2.class.st | 96 +++++++++---------- .../GtRenameActionAnnouncement.class.st | 14 +-- .../GtRenameEditor.class.st | 4 +- .../GtRenameEditorAttribute.class.st | 32 +++---- .../GtRenamePreviewAttribute.class.st | 24 ++--- ...GtSourceCoderInlineRenameShortcut.class.st | 12 +-- ...tSourceCoderRefactoringController.class.st | 32 +++---- .../GtTextualCoder.extension.st | 4 +- src/GToolkit-Coder-AddOns/package.st | 2 +- 15 files changed, 194 insertions(+), 194 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtCompositeRenameAction.class.st b/src/GToolkit-Coder-AddOns/GtCompositeRenameAction.class.st index 8face5ebc..5c37593b4 100644 --- a/src/GToolkit-Coder-AddOns/GtCompositeRenameAction.class.st +++ b/src/GToolkit-Coder-AddOns/GtCompositeRenameAction.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCompositeRenameAction', - #superclass : 'GtRenameAction', + #name : #GtCompositeRenameAction, + #superclass : #GtRenameAction, #instVars : [ 'otherTextIntervals', 'otherTextAttributes' @@ -8,25 +8,25 @@ Class { #category : 'GToolkit-Coder-AddOns-Inline rename' } -{ #category : 'private' } +{ #category : #private } GtCompositeRenameAction >> addLocations: intervals to: anEditor [ self addLocations: intervals toText: anEditor text ] -{ #category : 'private' } +{ #category : #private } GtCompositeRenameAction >> addLocations: intervals toText: ropedText [ otherTextIntervals at: ropedText put: (intervals asSortedCollection: [ :a :b | a first < b first ]) ] -{ #category : 'private' } +{ #category : #private } GtCompositeRenameAction >> addRenameAttributes [ super addRenameAttributes. self addRenameAttributesToOtherEditors ] -{ #category : 'private' } +{ #category : #private } GtCompositeRenameAction >> addRenameAttributesToOtherEditors [ | size | size := self originalName size. @@ -48,40 +48,40 @@ GtCompositeRenameAction >> addRenameAttributesToOtherEditors [ attribute ]) ] ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtCompositeRenameAction >> initialize [ super initialize. otherTextIntervals := IdentityDictionary new. otherTextAttributes := IdentityDictionary new ] -{ #category : 'private' } +{ #category : #private } GtCompositeRenameAction >> removeAttributes [ super removeAttributes. self removeOtherAttributes ] -{ #category : 'private' } +{ #category : #private } GtCompositeRenameAction >> removeOtherAttributes [ otherTextAttributes keysDo: [ :text | text clearAttributes: [ :each | self isRenameAttribute: each ] ] ] -{ #category : 'private' } +{ #category : #private } GtCompositeRenameAction >> undoChanges [ super undoChanges. self removeOtherAttributes ] -{ #category : 'actions' } +{ #category : #actions } GtCompositeRenameAction >> updateName: blText [ super updateName: blText. otherTextAttributes do: [ :attrs | attrs do: [ :each | each updateText: blText ] ] ] -{ #category : 'private' } +{ #category : #private } GtCompositeRenameAction >> updateOtherEditors [ self newName = self originalName ifTrue: [ ^ self ]. @@ -93,7 +93,7 @@ GtCompositeRenameAction >> updateOtherEditors [ attributes: (otherTextAttributes at: text) ] ] -{ #category : 'private' } +{ #category : #private } GtCompositeRenameAction >> updateSource [ super updateSource. self updateOtherEditors diff --git a/src/GToolkit-Coder-AddOns/GtFixItAction.class.st b/src/GToolkit-Coder-AddOns/GtFixItAction.class.st index 107dbcc13..769fc01a5 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItAction.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItAction.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtFixItAction', - #superclass : 'Object', + #name : #GtFixItAction, + #superclass : #Object, #instVars : [ 'node', 'sourceCoder' @@ -8,7 +8,7 @@ Class { #category : 'GToolkit-Coder-AddOns-FixIt' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtFixItAction class >> forCoder: aSourceCoder node: aRBProgramNode [ ^ self new sourceCoder: aSourceCoder; @@ -16,12 +16,12 @@ GtFixItAction class >> forCoder: aSourceCoder node: aRBProgramNode [ yourself ] -{ #category : 'api - node' } +{ #category : #'api - node' } GtFixItAction >> attributePosition [ ^ node name stopPosition ] -{ #category : 'private' } +{ #category : #private } GtFixItAction >> clearFixItAttributeInEditor: aBrTextEditor [ | position | position := self attributePosition. @@ -29,24 +29,24 @@ GtFixItAction >> clearFixItAttributeInEditor: aBrTextEditor [ clearAttributes: [ :each | each isKindOf: GtFixItAttribute ] ] -{ #category : 'api - action' } +{ #category : #'api - action' } GtFixItAction >> description [ self subclassResponsibility ] -{ #category : 'executing' } +{ #category : #executing } GtFixItAction >> executeOn: anEditorElement [ self subclassResponsibility ] -{ #category : 'api - action' } +{ #category : #'api - action' } GtFixItAction >> id [ ^ self subclassResponsibility ] -{ #category : 'private' } +{ #category : #private } GtFixItAction >> menuActionWithIndex: anIndex [ ^ GtCoderContextMenuAction new action: [ :aCoderViewModel :anEditorElement | @@ -56,22 +56,22 @@ GtFixItAction >> menuActionWithIndex: anIndex [ id: (self id indexed: anIndex) ] -{ #category : 'initialization' } +{ #category : #initialization } GtFixItAction >> node: aRBProgramNode [ node := aRBProgramNode ] -{ #category : 'initialization' } +{ #category : #initialization } GtFixItAction >> sourceCoder: aCoder [ sourceCoder := aCoder ] -{ #category : 'api - node' } +{ #category : #'api - node' } GtFixItAction >> startPosition [ ^ node name startPosition ] -{ #category : 'api - node' } +{ #category : #'api - node' } GtFixItAction >> stopPosition [ ^ node name stopPosition ] diff --git a/src/GToolkit-Coder-AddOns/GtFixItActionElementId.class.st b/src/GToolkit-Coder-AddOns/GtFixItActionElementId.class.st index 6a146fc5a..ae4bf27e6 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItActionElementId.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItActionElementId.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtFixItActionElementId', - #superclass : 'GtCoderElementId', + #name : #GtFixItActionElementId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-AddOns-FixIt' } -{ #category : 'testing' } +{ #category : #testing } GtFixItActionElementId class >> isAbstract [ ^ self = GtFixItActionElementId ] diff --git a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st index f3ba7a772..d34c08b2f 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st @@ -1,13 +1,13 @@ Class { - #name : 'GtFixItAttribute', - #superclass : 'BrTextAdornmentAttribute', + #name : #GtFixItAttribute, + #superclass : #BrTextAdornmentAttribute, #instVars : [ 'fixItActionsBlock' ], #category : 'GToolkit-Coder-AddOns-FixIt' } -{ #category : 'accessing' } +{ #category : #accessing } GtFixItAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ "Return an element that should affect (either append or replace) a provided text piece" @@ -34,12 +34,12 @@ GtFixItAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ yourself ] -{ #category : 'initialization' } +{ #category : #initialization } GtFixItAttribute >> fixItActions: aCollection [ fixItActionsBlock := aCollection ] -{ #category : 'accessing' } +{ #category : #accessing } GtFixItAttribute >> initialize [ super initialize. diff --git a/src/GToolkit-Coder-AddOns/GtFixItButton.class.st b/src/GToolkit-Coder-AddOns/GtFixItButton.class.st index 4bb08be43..2989baa6b 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItButton.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItButton.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtFixItButton', - #superclass : 'BrButton', + #name : #GtFixItButton, + #superclass : #BrButton, #category : 'GToolkit-Coder-AddOns-FixIt' } diff --git a/src/GToolkit-Coder-AddOns/GtRenameAction.class.st b/src/GToolkit-Coder-AddOns/GtRenameAction.class.st index 06bd74641..59f61dcee 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameAction.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameAction.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtRenameAction', - #superclass : 'Object', + #name : #GtRenameAction, + #superclass : #Object, #traits : 'TGtAnnouncer', #classTraits : 'TGtAnnouncer classTrait', #instVars : [ @@ -18,7 +18,7 @@ Class { #category : 'GToolkit-Coder-AddOns-Inline rename' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtRenameAction class >> locations: aCollectionOfIntervals element: aTextEditorElement [ ^ self new textElement: aTextEditorElement; @@ -26,7 +26,7 @@ GtRenameAction class >> locations: aCollectionOfIntervals element: aTextEditorEl yourself ] -{ #category : 'actions' } +{ #category : #actions } GtRenameAction >> accept [ self updateSource. self uninstall. @@ -34,7 +34,7 @@ GtRenameAction >> accept [ self announceEvent: #accept ] -{ #category : 'private' } +{ #category : #private } GtRenameAction >> addRenameAttributes [ | text cursorInLocation | text := self text. @@ -60,22 +60,22 @@ GtRenameAction >> addRenameAttributes [ attribute ] ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtRenameAction >> allowSave [ textElement textualCoderViewModel allowSaveDueTo: self ] -{ #category : 'private' } +{ #category : #private } GtRenameAction >> announceEvent: aSymbol [ ^ self announce: (GtRenameActionAnnouncement for: self type: aSymbol) ] -{ #category : 'announcer' } +{ #category : #announcer } GtRenameAction >> announcer [ ^ announcer ifNil: [ announcer := Announcer new ] ] -{ #category : 'actions' } +{ #category : #actions } GtRenameAction >> cancel [ self uninstall. self undoChanges. @@ -83,12 +83,12 @@ GtRenameAction >> cancel [ self announceEvent: #cancel ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenameAction >> editor [ ^ self editorAttribute editor ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenameAction >> editorAttribute [ ^ renameAttributes notNil ifTrue: [ renameAttributes @@ -96,30 +96,30 @@ GtRenameAction >> editorAttribute [ ifNone: [ ] ] ] -{ #category : 'private' } +{ #category : #private } GtRenameAction >> filter: aTextEditorInputFilter [ filter := aTextEditorInputFilter. self primaryRenameAttribute ifNotNil: [ :attr | attr filter: aTextEditorInputFilter ] ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtRenameAction >> forBinaryOrKeyword [ validationBlock := [ :str | (self validateKeyword: str) or: [ self validateBinary: str ] ] ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtRenameAction >> forKeyword [ validationBlock := [ :str | self validateKeyword: str ] ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtRenameAction >> forVariableOrUnaryMessage [ validationBlock := [ :str | self validateVariable: str ]. self filter: BrTextEditorAlphaNumericInputFilter new ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtRenameAction >> initialize [ super initialize. originalLocations := #(). @@ -128,7 +128,7 @@ GtRenameAction >> initialize [ filter := BrTextEditorNoInputFilter new ] -{ #category : 'installation' } +{ #category : #installation } GtRenameAction >> install [ originalLocations isEmpty ifTrue: [ ^ self ]. @@ -139,54 +139,54 @@ GtRenameAction >> install [ self announceEvent: #install ] -{ #category : 'testing' } +{ #category : #testing } GtRenameAction >> isInstalled [ ^ isInstalled ] -{ #category : 'testing' } +{ #category : #testing } GtRenameAction >> isRenameAttribute: anAttribute [ ^ anAttribute isKindOf: GtRenamePreviewAttribute ] -{ #category : 'private-validation' } +{ #category : #'private-validation' } GtRenameAction >> isValid [ validationBlock isNil ifTrue: [ ^ true ]. ^ validationBlock value: self newName ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenameAction >> locations: aCollectionOfIntervals [ originalLocations := aCollectionOfIntervals asSortedCollection: [ :a :b | a first < b first ]. self validateLocations ] -{ #category : 'actions' } +{ #category : #actions } GtRenameAction >> lostFocus [ self isValid ifTrue: [ self accept ] ifFalse: [ self cancel ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenameAction >> newName [ ^ renameAttributes first text asString ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenameAction >> originalName [ ^ (originalText copyFrom: originalLocations first first to: originalLocations first last) asString ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtRenameAction >> preventSave [ textElement textualCoderViewModel preventSaveDueTo: self ] -{ #category : 'private' } +{ #category : #private } GtRenameAction >> primaryRenameAttribute [ renameAttributes isNil ifTrue: [ ^ nil ]. @@ -195,25 +195,25 @@ GtRenameAction >> primaryRenameAttribute [ ifNone: [ nil ] ] -{ #category : 'private' } +{ #category : #private } GtRenameAction >> removeAttributeHandlers [ renameAttributes do: [ :each | each uninstallEventHandlers ] ] -{ #category : 'private' } +{ #category : #private } GtRenameAction >> removeAttributes [ self text clearAttributes: [ :each | self isRenameAttribute: each ]. self removeAttributeHandlers ] -{ #category : 'actions' } +{ #category : #actions } GtRenameAction >> returnAccept [ self isValid ifFalse: [ ^ self ]. self accept ] -{ #category : 'private' } +{ #category : #private } GtRenameAction >> saveOriginalState [ | text | text := self text. @@ -221,17 +221,17 @@ GtRenameAction >> saveOriginalState [ originalCursorPosition := self textEditor cursors first position ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenameAction >> selectAll [ ^ selectAll ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenameAction >> selectAll: anObject [ selectAll := anObject ] -{ #category : 'actions' } +{ #category : #actions } GtRenameAction >> tabAccept: forward [ self isValid ifFalse: [ ^ self ]. @@ -243,27 +243,27 @@ GtRenameAction >> tabAccept: forward [ ifFalse: [ #shiftTab ]) ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenameAction >> text [ ^ self textEditor text ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenameAction >> textEditor [ ^ self textElement editor ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenameAction >> textElement [ ^ textElement ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenameAction >> textElement: aTextEditorElement [ textElement := aTextEditorElement ] -{ #category : 'private' } +{ #category : #private } GtRenameAction >> undoChanges [ self textElement text: originalText; @@ -272,7 +272,7 @@ GtRenameAction >> undoChanges [ self textEditor moveCursorTo: originalCursorPosition ] -{ #category : 'installation' } +{ #category : #installation } GtRenameAction >> uninstall [ self removeAttributes. isInstalled := false. @@ -282,7 +282,7 @@ GtRenameAction >> uninstall [ enqueueTask: (BlTaskAction new action: [ textElement requestFocus ]) ] -{ #category : 'private' } +{ #category : #private } GtRenameAction >> updateCursorLocation [ | sizeDifference offset | sizeDifference := self newName size - self originalName size. @@ -299,13 +299,13 @@ GtRenameAction >> updateCursorLocation [ offset := offset + sizeDifference ] ] -{ #category : 'actions' } +{ #category : #actions } GtRenameAction >> updateName: blText [ renameAttributes do: [ :each | each updateText: blText ]. self announceEvent: #textUpdated ] -{ #category : 'private' } +{ #category : #private } GtRenameAction >> updateSource [ self newName = self originalName ifTrue: [ ^ self removeAttributes ]. @@ -316,7 +316,7 @@ GtRenameAction >> updateSource [ self updateCursorLocation ] -{ #category : 'private' } +{ #category : #private } GtRenameAction >> updateSourceIn: editor at: intervals attributes: attributeCollection [ self updateText: editor text @@ -324,7 +324,7 @@ GtRenameAction >> updateSourceIn: editor at: intervals attributes: attributeColl attributes: attributeCollection ] -{ #category : 'private' } +{ #category : #private } GtRenameAction >> updateText: text at: intervals attributes: attributeCollection [ | newText index | newText := '' asRopedText. @@ -345,14 +345,14 @@ GtRenameAction >> updateText: text at: intervals attributes: attributeCollection onTextModified ] -{ #category : 'private-validation' } +{ #category : #'private-validation' } GtRenameAction >> validateBinary: aString [ aString isEmpty ifTrue: [ ^ false ]. ^ (RBScanner isSelector: aString) and: [ aString asSymbol isBinary ] ] -{ #category : 'private-validation' } +{ #category : #'private-validation' } GtRenameAction >> validateKeyword: aString [ aString isEmpty ifTrue: [ ^ false ]. @@ -362,7 +362,7 @@ GtRenameAction >> validateKeyword: aString [ and: [ aString asSymbol numArgs = 1 ] ] -{ #category : 'private' } +{ #category : #private } GtRenameAction >> validateLocations [ | lastLocation size | originalLocations isEmpty @@ -378,7 +378,7 @@ GtRenameAction >> validateLocations [ ifTrue: [ self error: 'Cannot rename items of different sizes' ] ] ] -{ #category : 'private-validation' } +{ #category : #'private-validation' } GtRenameAction >> validateVariable: aString [ ^ RBScanner isVariable: aString ] diff --git a/src/GToolkit-Coder-AddOns/GtRenameAction2.class.st b/src/GToolkit-Coder-AddOns/GtRenameAction2.class.st index aad9376ce..b0310f500 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameAction2.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameAction2.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtRenameAction2', - #superclass : 'Object', + #name : #GtRenameAction2, + #superclass : #Object, #traits : 'TGtAnnouncer', #classTraits : 'TGtAnnouncer classTrait', #instVars : [ @@ -16,10 +16,10 @@ Class { 'originalCursors', 'coderAttributes' ], - #category : 'GToolkit-Coder-AddOns-Inline rename' + #category : #'GToolkit-Coder-AddOns-Inline rename' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtRenameAction2 class >> locations: aCollectionOfIntervals textualCoderViewModel: aTextualCoderViewModel [ ^ self new locations: aCollectionOfIntervals; @@ -27,7 +27,7 @@ GtRenameAction2 class >> locations: aCollectionOfIntervals textualCoderViewModel yourself ] -{ #category : 'actions' } +{ #category : #actions } GtRenameAction2 >> accept [ self updateSource. self uninstall. @@ -35,11 +35,11 @@ GtRenameAction2 >> accept [ self announceEvent: #accept ] -{ #category : 'private - attributes' } +{ #category : #'private - attributes' } GtRenameAction2 >> addRenameAttributes [ | text cursorInLocation | - text := self pharoSourceCoderViewModel sourceText. + text := self pharoSourceCoderViewModel styledText ifNil: [ self pharoSourceCoderViewModel sourceText ]. cursorInLocation := originalLocations anySatisfy: [ :each | originalCursors anySatisfy: [ :eachCursor | eachCursor position between: each first - 1 and: each last ] ]. @@ -73,22 +73,22 @@ GtRenameAction2 >> addRenameAttributes [ description: [ 'There must not be more than one editor attribute' ] ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtRenameAction2 >> allowSave [ pharoSourceCoderViewModel allowSaveDueTo: self ] -{ #category : 'private' } +{ #category : #private } GtRenameAction2 >> announceEvent: aSymbol [ ^ self announce: (GtRenameActionAnnouncement for: self type: aSymbol) ] -{ #category : 'announcer' } +{ #category : #announcer } GtRenameAction2 >> announcer [ ^ announcer ifNil: [ announcer := Announcer new ] ] -{ #category : 'actions' } +{ #category : #actions } GtRenameAction2 >> cancel [ self uninstall. self undoChanges. @@ -96,12 +96,12 @@ GtRenameAction2 >> cancel [ self announceEvent: #cancel ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenameAction2 >> editor [ ^ self editorAttribute editor ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenameAction2 >> editorAttribute [ ^ renameAttributes notNil ifTrue: [ renameAttributes @@ -109,30 +109,30 @@ GtRenameAction2 >> editorAttribute [ ifNone: [ ] ] ] -{ #category : 'private' } +{ #category : #private } GtRenameAction2 >> filter: aTextEditorInputFilter [ filter := aTextEditorInputFilter. self primaryRenameAttribute ifNotNil: [ :attr | attr filter: aTextEditorInputFilter ] ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtRenameAction2 >> forBinaryOrKeyword [ validationBlock := [ :str | (self validateKeyword: str) or: [ self validateBinary: str ] ] ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtRenameAction2 >> forKeyword [ validationBlock := [ :str | self validateKeyword: str ] ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtRenameAction2 >> forVariableOrUnaryMessage [ validationBlock := [ :str | self validateVariable: str ]. self filter: BrTextEditorAlphaNumericInputFilter new ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtRenameAction2 >> initialize [ super initialize. originalLocations := #(). @@ -143,7 +143,7 @@ GtRenameAction2 >> initialize [ coderAttributes := #(). ] -{ #category : 'installation' } +{ #category : #installation } GtRenameAction2 >> install [ originalLocations isEmpty ifTrue: [ ^ self ]. @@ -157,64 +157,64 @@ GtRenameAction2 >> install [ self announceEvent: #install ] -{ #category : 'testing' } +{ #category : #testing } GtRenameAction2 >> isInstalled [ ^ isInstalled ] -{ #category : 'testing' } +{ #category : #testing } GtRenameAction2 >> isRenameAttribute: anAttribute [ ^ anAttribute isKindOf: GtRenamePreviewAttribute ] -{ #category : 'private-validation' } +{ #category : #'private-validation' } GtRenameAction2 >> isValid [ validationBlock isNil ifTrue: [ ^ true ]. ^ validationBlock value: self newName ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenameAction2 >> locations: aCollectionOfIntervals [ originalLocations := aCollectionOfIntervals asSortedCollection: [ :a :b | a first < b first ]. self validateLocations ] -{ #category : 'actions' } +{ #category : #actions } GtRenameAction2 >> lostFocus [ self isValid ifTrue: [ self accept ] ifFalse: [ self cancel ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenameAction2 >> newName [ ^ renameAttributes first text asString ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenameAction2 >> originalName [ ^ (originalText copyFrom: originalLocations first first to: originalLocations first last) asString ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenameAction2 >> pharoSourceCoderViewModel [ ^ pharoSourceCoderViewModel ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenameAction2 >> pharoSourceCoderViewModel: anObject [ pharoSourceCoderViewModel := anObject ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtRenameAction2 >> preventSave [ pharoSourceCoderViewModel preventSaveDueTo: self ] -{ #category : 'private - attributes' } +{ #category : #'private - attributes' } GtRenameAction2 >> primaryRenameAttribute [ renameAttributes isNil ifTrue: [ ^ nil ]. @@ -223,41 +223,41 @@ GtRenameAction2 >> primaryRenameAttribute [ ifNone: [ nil ] ] -{ #category : 'private - attributes' } +{ #category : #'private - attributes' } GtRenameAction2 >> removeAttributeHandlers [ renameAttributes do: [ :each | each uninstallEventHandlers ] ] -{ #category : 'private - attributes' } +{ #category : #'private - attributes' } GtRenameAction2 >> removeAttributes [ self pharoSourceCoderViewModel removeAllCoderTextAttributes: coderAttributes. self removeAttributeHandlers ] -{ #category : 'actions' } +{ #category : #actions } GtRenameAction2 >> returnAccept [ self isValid ifFalse: [ ^ self ]. self accept ] -{ #category : 'private' } +{ #category : #private } GtRenameAction2 >> saveOriginalState [ originalText := self pharoSourceCoderViewModel sourceText copy. originalCursors := self pharoSourceCoderViewModel cursors copy ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenameAction2 >> selectAll [ ^ selectAll ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenameAction2 >> selectAll: anObject [ selectAll := anObject ] -{ #category : 'actions' } +{ #category : #actions } GtRenameAction2 >> tabAccept: forward [ self isValid ifFalse: [ ^ self ]. @@ -269,12 +269,12 @@ GtRenameAction2 >> tabAccept: forward [ ifFalse: [ #shiftTab ]) ] -{ #category : 'private' } +{ #category : #private } GtRenameAction2 >> undoChanges [ self pharoSourceCoderViewModel cursors: originalCursors ] -{ #category : 'installation' } +{ #category : #installation } GtRenameAction2 >> uninstall [ self removeAttributes. isInstalled := false. @@ -284,7 +284,7 @@ GtRenameAction2 >> uninstall [ pharoSourceCoderViewModel focused: true ] -{ #category : 'private' } +{ #category : #private } GtRenameAction2 >> updateCursorLocation [ | sizeDifference offset | sizeDifference := self newName size - self originalName size. @@ -303,13 +303,13 @@ GtRenameAction2 >> updateCursorLocation [ offset := offset + sizeDifference ] ] -{ #category : 'actions' } +{ #category : #actions } GtRenameAction2 >> updateName: blText [ renameAttributes do: [ :each | each updateText: blText ]. self announceEvent: #textUpdated ] -{ #category : 'private' } +{ #category : #private } GtRenameAction2 >> updateSource [ self newName = self originalName ifTrue: [ ^ self removeAttributes ]. @@ -322,7 +322,7 @@ GtRenameAction2 >> updateSource [ self updateCursorLocation ] -{ #category : 'private' } +{ #category : #private } GtRenameAction2 >> updateSourceIn: aTextualSourceCoderViewModel at: intervals attributes: attributeCollection [ self updateText: aTextualSourceCoderViewModel sourceText @@ -330,7 +330,7 @@ GtRenameAction2 >> updateSourceIn: aTextualSourceCoderViewModel at: intervals at attributes: attributeCollection ] -{ #category : 'private' } +{ #category : #private } GtRenameAction2 >> updateText: text at: intervals attributes: attributeCollection [ | newText index | newText := '' asRopedText. @@ -352,14 +352,14 @@ GtRenameAction2 >> updateText: text at: intervals attributes: attributeCollectio synchronously: true ] -{ #category : 'private-validation' } +{ #category : #'private-validation' } GtRenameAction2 >> validateBinary: aString [ aString isEmpty ifTrue: [ ^ false ]. ^ (RBScanner isSelector: aString) and: [ aString asSymbol isBinary ] ] -{ #category : 'private-validation' } +{ #category : #'private-validation' } GtRenameAction2 >> validateKeyword: aString [ aString isEmpty ifTrue: [ ^ false ]. @@ -369,7 +369,7 @@ GtRenameAction2 >> validateKeyword: aString [ and: [ aString asSymbol numArgs = 1 ] ] -{ #category : 'private' } +{ #category : #private } GtRenameAction2 >> validateLocations [ | lastLocation size | originalLocations isEmpty @@ -385,7 +385,7 @@ GtRenameAction2 >> validateLocations [ ifTrue: [ self error: 'Cannot rename items of different sizes' ] ] ] -{ #category : 'private-validation' } +{ #category : #'private-validation' } GtRenameAction2 >> validateVariable: aString [ ^ RBScanner isVariable: aString ] diff --git a/src/GToolkit-Coder-AddOns/GtRenameActionAnnouncement.class.st b/src/GToolkit-Coder-AddOns/GtRenameActionAnnouncement.class.st index 96a233d5b..e564d10f5 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameActionAnnouncement.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameActionAnnouncement.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtRenameActionAnnouncement', - #superclass : 'Announcement', + #name : #GtRenameActionAnnouncement, + #superclass : #Announcement, #instVars : [ 'renameAction', 'eventType' @@ -8,7 +8,7 @@ Class { #category : 'GToolkit-Coder-AddOns-Inline rename' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtRenameActionAnnouncement class >> for: aRenameAction type: aSymbol [ ^ self new renameAction: aRenameAction; @@ -16,22 +16,22 @@ GtRenameActionAnnouncement class >> for: aRenameAction type: aSymbol [ yourself ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenameActionAnnouncement >> eventType [ ^ eventType ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenameActionAnnouncement >> eventType: aSymbol [ eventType := aSymbol ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenameActionAnnouncement >> renameAction [ ^ renameAction ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenameActionAnnouncement >> renameAction: aRenameAction [ renameAction := aRenameAction ] diff --git a/src/GToolkit-Coder-AddOns/GtRenameEditor.class.st b/src/GToolkit-Coder-AddOns/GtRenameEditor.class.st index 974bedc9e..2c8d69fc9 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameEditor.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameEditor.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtRenameEditor', - #superclass : 'BrEditableLabel', + #name : #GtRenameEditor, + #superclass : #BrEditableLabel, #category : 'GToolkit-Coder-AddOns-Inline rename' } diff --git a/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st b/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st index 718dd81f3..e269613fa 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtRenameEditorAttribute', - #superclass : 'GtRenamePreviewAttribute', + #name : #GtRenameEditorAttribute, + #superclass : #GtRenamePreviewAttribute, #instVars : [ 'cursorLocation', 'selectAll', @@ -10,17 +10,17 @@ Class { #category : 'GToolkit-Coder-AddOns-Inline rename' } -{ #category : 'accessing' } +{ #category : #accessing } GtRenameEditorAttribute >> additionalAttributes [ ^ #() ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenameEditorAttribute >> cursorLocation: anInteger [ cursorLocation := anInteger ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenameEditorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ renameEditor := GtRenameEditor new fitContent; @@ -50,14 +50,14 @@ GtRenameEditorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElem ^ renameEditor ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenameEditorAttribute >> editorCursorLocation [ renameEditor notNil ifTrue: [ renameEditor editor cursors do: [ :cursor | ^ cursor position ] ]. ^ text size ] -{ #category : 'private' } +{ #category : #private } GtRenameEditorAttribute >> editorShortcuts [ ^ editorShortcuts ifNil: [ editorShortcuts := { @@ -75,14 +75,14 @@ GtRenameEditorAttribute >> editorShortcuts [ action: [ :aShortcutEvent | self renameAction accept ])} ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenameEditorAttribute >> filter: aTextEditorInputFilter [ filter := aTextEditorInputFilter. renameEditor notNil ifTrue: [ renameEditor inputFilter: aTextEditorInputFilter ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtRenameEditorAttribute >> initialize [ super initialize. @@ -91,38 +91,38 @@ GtRenameEditorAttribute >> initialize [ self cache: self newPooledCache ] -{ #category : 'testing' } +{ #category : #testing } GtRenameEditorAttribute >> isEditorAttribute [ ^ true ] -{ #category : 'testing' } +{ #category : #testing } GtRenameEditorAttribute >> isFocusable [ ^ true ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenameEditorAttribute >> renameAction [ ^ renameAction ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenameEditorAttribute >> selectAll [ ^ selectAll ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenameEditorAttribute >> selectAll: aBoolean [ selectAll := aBoolean ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenameEditorAttribute >> uninstallEventHandlers [ renameEditor notNil ifTrue: [ renameEditor editor removeEditorShortcuts: self editorShortcuts ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenameEditorAttribute >> updateFocus: event [ renameAction isInstalled ifTrue: [ renameAction lostFocus ] diff --git a/src/GToolkit-Coder-AddOns/GtRenamePreviewAttribute.class.st b/src/GToolkit-Coder-AddOns/GtRenamePreviewAttribute.class.st index 8ae8a253f..b51626415 100644 --- a/src/GToolkit-Coder-AddOns/GtRenamePreviewAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenamePreviewAttribute.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtRenamePreviewAttribute', - #superclass : 'BrTextAdornmentAttribute', + #name : #GtRenamePreviewAttribute, + #superclass : #BrTextAdornmentAttribute, #instVars : [ 'text', 'originalAttributes', @@ -10,19 +10,19 @@ Class { #category : 'GToolkit-Coder-AddOns-Inline rename' } -{ #category : 'accessing' } +{ #category : #accessing } GtRenamePreviewAttribute >> action: aRenameAction [ renameAction := aRenameAction ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenamePreviewAttribute >> additionalAttributes [ ^ { BlTextDecorationAttribute new underline color: BrGlamorousColors textHighlightColor } ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenamePreviewAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ | editor | @@ -39,12 +39,12 @@ GtRenamePreviewAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorEle ^ renameEditor ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenamePreviewAttribute >> editor [ ^ renameEditor editor ] -{ #category : 'initialization' } +{ #category : #initialization } GtRenamePreviewAttribute >> initialize [ super initialize. @@ -52,17 +52,17 @@ GtRenamePreviewAttribute >> initialize [ self beReplace ] -{ #category : 'testing' } +{ #category : #testing } GtRenamePreviewAttribute >> isEditorAttribute [ ^ false ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenamePreviewAttribute >> text [ ^ text ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenamePreviewAttribute >> text: blText [ text := blText asString asRopedText. originalAttributes isNil @@ -72,11 +72,11 @@ GtRenamePreviewAttribute >> text: blText [ text attributes: originalAttributes , self additionalAttributes ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenamePreviewAttribute >> uninstallEventHandlers [ ] -{ #category : 'accessing' } +{ #category : #accessing } GtRenamePreviewAttribute >> updateText: blText [ self text: blText. renameEditor notNil diff --git a/src/GToolkit-Coder-AddOns/GtSourceCoderInlineRenameShortcut.class.st b/src/GToolkit-Coder-AddOns/GtSourceCoderInlineRenameShortcut.class.st index fd975abf9..03d807cd8 100644 --- a/src/GToolkit-Coder-AddOns/GtSourceCoderInlineRenameShortcut.class.st +++ b/src/GToolkit-Coder-AddOns/GtSourceCoderInlineRenameShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : 'GtSourceCoderInlineRenameShortcut', - #superclass : 'GtSourceCoderShortcut', + #name : #GtSourceCoderInlineRenameShortcut, + #superclass : #GtSourceCoderShortcut, #category : 'GToolkit-Coder-AddOns-Inline rename' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderInlineRenameShortcut >> description [ ^ 'Performs the rename refactoring of the selected variable/class/method.' ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderInlineRenameShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryR ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderInlineRenameShortcut >> name [ ^ 'Rename' ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderInlineRenameShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ self forEditor: aBrTextEditor diff --git a/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st b/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st index 49543b330..3ef65020a 100644 --- a/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st +++ b/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st @@ -5,8 +5,8 @@ Is applied on a specific instance of the source coder editor and plays a role of " Class { - #name : 'GtSourceCoderRefactoringController', - #superclass : 'Object', + #name : #GtSourceCoderRefactoringController, + #superclass : #Object, #instVars : [ 'originalSource', 'sourceCoderViewModel', @@ -15,12 +15,12 @@ Class { #category : 'GToolkit-Coder-AddOns-! Core' } -{ #category : 'private' } +{ #category : #private } GtSourceCoderRefactoringController >> allowSave [ self sourceCoderViewModel allowSaveDueTo: self ] -{ #category : 'executing' } +{ #category : #executing } GtSourceCoderRefactoringController >> execute [ [ self saveSource. @@ -40,46 +40,46 @@ GtSourceCoderRefactoringController >> execute [ ex return ] ] -{ #category : 'private' } +{ #category : #private } GtSourceCoderRefactoringController >> preventSave [ self sourceCoderViewModel preventSaveDueTo: self ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderRefactoringController >> refactoring [ ^ self subclassResponsibility ] -{ #category : 'executing' } +{ #category : #executing } GtSourceCoderRefactoringController >> refactoringFailed [ ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderRefactoringController >> refactoringName [ ^ self subclassResponsibility ] -{ #category : 'private - attributes' } +{ #category : #'private - attributes' } GtSourceCoderRefactoringController >> removeRefactoringAttribute [ self sourceCoderViewModel removeCoderTextAttributes: refactoringPreviewAttributes ] -{ #category : 'private' } +{ #category : #private } GtSourceCoderRefactoringController >> restoreText [ self setText: originalSource ] -{ #category : 'executing' } +{ #category : #executing } GtSourceCoderRefactoringController >> safelyExecute [ self subclassResponsibility ] -{ #category : 'executing' } +{ #category : #executing } GtSourceCoderRefactoringController >> saveSource [ originalSource := self sourceText copy ] -{ #category : 'private' } +{ #category : #private } GtSourceCoderRefactoringController >> setText: aStringOrText [ self sourceCoderViewModel sourceText: aStringOrText asRopedText @@ -87,19 +87,19 @@ GtSourceCoderRefactoringController >> setText: aStringOrText [ synchronously: true ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderRefactoringController >> sourceCoderViewModel [ ^ sourceCoderViewModel ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderRefactoringController >> sourceCoderViewModel: aSourceCoderViewModel [ sourceCoderViewModel := aSourceCoderViewModel ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderRefactoringController >> sourceText [ ^ self sourceCoderViewModel sourceText copy ] diff --git a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st index 181a98ada..7054e5823 100644 --- a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st +++ b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'GtTextualCoder' } +Extension { #name : #GtTextualCoder } -{ #category : '*GToolkit-Coder-AddOns' } +{ #category : #'*GToolkit-Coder-AddOns' } GtTextualCoder >> addCopyCutPasteContextMenuAddOnsAst: anAst to: coderAddOns [ coderAddOns diff --git a/src/GToolkit-Coder-AddOns/package.st b/src/GToolkit-Coder-AddOns/package.st index b81ef9a60..0792a8a8b 100644 --- a/src/GToolkit-Coder-AddOns/package.st +++ b/src/GToolkit-Coder-AddOns/package.st @@ -1 +1 @@ -Package { #name : 'GToolkit-Coder-AddOns' } +Package { #name : #'GToolkit-Coder-AddOns' } From 80dc6ad1327a08af6174ae8249f2233e94424961 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 12 Oct 2021 21:02:24 -0300 Subject: [PATCH 0040/1268] remove old code --- src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st index 1cd360391..7e4531f81 100644 --- a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st @@ -261,10 +261,6 @@ GtCoderExampleStateElement >> updateIcon [ { #category : #'private - updating' } GtCoderExampleStateElement >> updateStyleLook [ - "the following nil check can be removed anytime later. - It is useful for a couple of days until the next image build (instead of update)." - self styleLook ifNil: [ ^ self ]. - self styleLook default: [ :aStyle | aStyle background: self exampleState color ]; hovered: [ :aStyle | aStyle background: self exampleState color darker ]. From 75ad6e2409bd4f86caea681f9149ca632eeda74a Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 13 Oct 2021 11:44:10 -0300 Subject: [PATCH 0041/1268] use `BrGlamorousWithTooltipAptitude` --- src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st index 7e4531f81..a41326d1d 100644 --- a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st @@ -105,7 +105,7 @@ GtCoderExampleStateElement >> initializeInteractiveLook [ { #category : #initialization } GtCoderExampleStateElement >> initializeTooltipLook [ self addAptitude: - (BrGlamorousWithTooltipAptitude2 content: [ + (BrGlamorousWithTooltipAptitude content: [ self newTooltipContent ]) ] From 2265849dc843e9ffc31e204cf82791dd00e8ee5e Mon Sep 17 00:00:00 2001 From: John Brant Date: Wed, 13 Oct 2021 13:19:04 -0500 Subject: [PATCH 0042/1268] [feenkcom/gtoolkit#2177] don't display fixit for extracted method message send --- .../GtSourceCoderRefactoringController.class.st | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st b/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st index 3ef65020a..0dd6d5d42 100644 --- a/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st +++ b/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st @@ -12,7 +12,7 @@ Class { 'sourceCoderViewModel', 'refactoringPreviewAttributes' ], - #category : 'GToolkit-Coder-AddOns-! Core' + #category : #'GToolkit-Coder-AddOns-! Core' } { #category : #private } @@ -61,6 +61,7 @@ GtSourceCoderRefactoringController >> refactoringName [ { #category : #'private - attributes' } GtSourceCoderRefactoringController >> removeRefactoringAttribute [ + refactoringPreviewAttributes ifNil: [ ^ self ]. self sourceCoderViewModel removeCoderTextAttributes: refactoringPreviewAttributes ] From 09dfb846068c68fa2d8f2e017c0f39d9c969224d Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 13 Oct 2021 17:07:50 -0300 Subject: [PATCH 0043/1268] add `GtCoderPreview` and `GtSourceCoderCollapsedAddOnsAptitude` [feenkcom/gtoolkit#2175] --- .../GtExpandableSourceCoderElement.class.st | 4 +- ...ourceCoderCollapsedAddOnsAptitude.class.st | 52 ++++++++ .../GtSourceCoderCollapsedAddOnsId.class.st | 10 ++ ...erCollapsedTextAndExampleAptitude.class.st | 8 +- src/GToolkit-Coder/Announcement.extension.st | 4 +- .../BlTktWorkerProvider.extension.st | 14 +-- src/GToolkit-Coder/Class.extension.st | 6 +- .../ClassDescription.extension.st | 4 +- .../ClassDiffBuilder.extension.st | 8 +- .../CompiledMethod.extension.st | 6 +- src/GToolkit-Coder/DebugSession.extension.st | 6 +- src/GToolkit-Coder/GtAstCache.class.st | 12 +- .../GtAsyncSearchGroupStream.class.st | 34 +++--- .../GtAsyncSearchNullGroupStream.class.st | 10 +- .../GtAsyncSearchTypedGroupStream.class.st | 14 +-- ...CoderMethodNavigationAnnouncement.class.st | 8 +- ...hodProtocolNavigationAnnouncement.class.st | 12 +- ...sCoderPackagesFilterStringChanged.class.st | 12 +- .../GtClassesCompletionStrategy.class.st | 16 +-- src/GToolkit-Coder/GtCoderAction.class.st | 38 +++--- .../GtCoderActivatableAction.class.st | 10 +- src/GToolkit-Coder/GtCoderAddOns.class.st | 115 +++++++++++------- ...derAddOnsContextActionsDifference.class.st | 4 +- ...tCoderAddOnsContextMenuDifference.class.st | 4 +- .../GtCoderAddOnsDifference.class.st | 4 +- ...tCoderAddOnsMainActionsDifference.class.st | 4 +- .../GtCoderAddOnsShortcutsDifference.class.st | 4 +- .../GtCoderAddOnsStylersDifference.class.st | 4 +- .../GtCoderAddOnsUpdateRequest.class.st | 4 +- .../GtCoderAnnouncement.class.st | 8 +- src/GToolkit-Coder/GtCoderAnnouncer.class.st | 10 +- src/GToolkit-Coder/GtCoderAstChanged.class.st | 8 +- .../GtCoderAstCompositeStyler.class.st | 12 +- .../GtCoderAstSmaCCParserStyler.class.st | 10 +- src/GToolkit-Coder/GtCoderAstStyler.class.st | 18 +-- src/GToolkit-Coder/GtCoderClassAdded.class.st | 4 +- .../GtCoderClassRemoved.class.st | 4 +- .../GtCoderClassRenamed.class.st | 4 +- ...lassWithPackageCompletionStrategy.class.st | 16 +-- .../GtCoderClassesHierarchyTree.class.st | 36 +++--- .../GtCoderCollapsedLabelChanged.class.st | 4 +- .../GtCoderCommentStyler.class.st | 6 +- .../GtCoderCompiledMethodSourceCode.class.st | 16 +-- .../GtCoderContextActionsChanged.class.st | 4 +- .../GtCoderContextMenuAction.class.st | 12 +- .../GtCoderContextVariableStyler.class.st | 26 ++-- .../GtCoderCorrectionRequest.class.st | 16 +-- .../GtCoderDropDownAction.class.st | 8 +- .../GtCoderDropDownWithPreviewAction.class.st | 12 +- .../GtCoderEvaluationAnnouncement.class.st | 12 +- .../GtCoderEvaluationUnhandledError.class.st | 20 +-- .../GtCoderExampleExecuted.class.st | 14 +-- src/GToolkit-Coder/GtCoderExampler.class.st | 52 ++++---- .../GtCoderExplicitSourceCode.class.st | 16 +-- .../GtCoderExplicitSourceText.class.st | 16 +-- ...tCoderGrowingClassesHierarchyTree.class.st | 18 +-- .../GtCoderInstanceVariableStyler.class.st | 8 +- .../GtCoderMainActionsChanged.class.st | 4 +- .../GtCoderMethodAdded.class.st | 4 +- .../GtCoderMethodModified.class.st | 4 +- .../GtCoderMethodRemoved.class.st | 4 +- src/GToolkit-Coder/GtCoderModel.class.st | 64 +++++----- .../GtCoderNavigationAnnouncement.class.st | 8 +- ...GtCoderNavigationClassAnnoucement.class.st | 16 +-- .../GtCoderNavigationClassModified.class.st | 4 +- .../GtCoderNavigationClassRenamed.class.st | 12 +- .../GtCoderNavigationClassSelected.class.st | 16 +-- .../GtCoderNavigationModel.class.st | 36 +++--- ...avigationModelChangedAnnouncement.class.st | 4 +- ...CoderNavigationPackageAnnoucement.class.st | 10 +- ...tCoderNavigationPackageRegistered.class.st | 4 +- .../GtCoderNavigationPackageRenamed.class.st | 12 +- .../GtCoderNavigationPackageSelected.class.st | 8 +- .../GtCoderNavigationPackageTagAdded.class.st | 4 +- ...erNavigationPackageTagAnnoucement.class.st | 12 +- ...tCoderNavigationPackageTagRemoved.class.st | 4 +- ...CoderNavigationPackageTagSelected.class.st | 12 +- ...oderNavigationPackageUnregistered.class.st | 4 +- ...GtCoderNavigationPackagesSelected.class.st | 4 +- ...erNavigationSelectionAnnouncement.class.st | 4 +- ...vigationSystemChangesAnnouncement.class.st | 4 +- .../GtCoderNullNavigationModel.class.st | 32 ++--- .../GtCoderObjectSpawnRequest.class.st | 12 +- .../GtCoderPackageExtentionTag.class.st | 22 ++-- .../GtCoderPackageRegistered.class.st | 4 +- .../GtCoderPackageRenamed.class.st | 4 +- .../GtCoderPackageUncategorizedTag.class.st | 22 ++-- .../GtCoderPackageUnregistered.class.st | 4 +- ...GtCoderPackageUpdatedAnnouncement.class.st | 8 +- src/GToolkit-Coder/GtCoderParseError.class.st | 12 +- src/GToolkit-Coder/GtCoderPreview.class.st | 34 ++++++ .../GtCoderPreviewStencilBuilder.class.st | 38 ++++++ .../GtCoderPrintAnnouncement.class.st | 8 +- .../GtCoderRefreshStackAnnouncement.class.st | 4 +- .../GtCoderRenameMethodChange.class.st | 22 ++-- .../GtCoderRenameMethodRefactoring.class.st | 10 +- ...ameTemporaryRequestedAnnouncement.class.st | 12 +- .../GtCoderRequestFocus.class.st | 4 +- .../GtCoderShowDebuggerRequest.class.st | 20 +-- src/GToolkit-Coder/GtCoderSourceCode.class.st | 54 ++++---- .../GtCoderSourceCodeChanged.class.st | 12 +- .../GtCoderStyleTextRequest.class.st | 8 +- .../GtCoderStylerChanged.class.st | 8 +- .../GtCoderToolSpawnRequest.class.st | 12 +- .../GtCoderUpdateStrategy.class.st | 16 +-- .../GtCodersAnnouncement.class.st | 12 +- .../GtCodersCoderAdded.class.st | 4 +- .../GtCodersCoderAnnouncement.class.st | 8 +- .../GtCodersCoderRemoved.class.st | 4 +- .../GtCodersCodersChanged.class.st | 4 +- .../GtCodersFiltersChanged.class.st | 10 +- src/GToolkit-Coder/GtCodersModel.class.st | 40 +++--- .../GtCodersScrollToCoder.class.st | 8 +- .../GtCompositeHighlighter.class.st | 10 +- src/GToolkit-Coder/GtDebugContext.class.st | 12 +- .../GtFilterExampleAllState.class.st | 14 +-- .../GtFilterExampleErrorState.class.st | 16 +-- .../GtFilterExampleFailureState.class.st | 16 +-- .../GtFilterExampleNotExecutedState.class.st | 16 +-- .../GtFilterExampleState.class.st | 26 ++-- .../GtFilterExampleSuccessState.class.st | 16 +-- ...tMethodProtocolCompletionStrategy.class.st | 8 +- .../GtMethodsCoderExampler.class.st | 10 +- ...tPackageClassesCompletionStrategy.class.st | 18 +-- src/GToolkit-Coder/GtPackageCoder.class.st | 28 ++--- src/GToolkit-Coder/GtPackagesCoder.class.st | 18 +-- .../GtPackagesCompletionStrategy.class.st | 18 +-- .../GtPharoAssociation.class.st | 14 +-- .../GtPharoClassExtension.class.st | 14 +-- .../GtPharoClassReference.class.st | 18 +-- .../GtPharoInheritance.class.st | 16 +-- src/GToolkit-Coder/GtPharoTraitUsage.class.st | 16 +-- .../GtPhlowContext.extension.st | 14 +-- .../GtPhlowExecutionContext.extension.st | 6 +- .../GtPoolsCompletionStrategy.class.st | 12 +- src/GToolkit-Coder/GtRBASTStyler.class.st | 22 ++-- .../GtRefactoringDanger.class.st | 12 +- .../GtReplaceTextCompletionAction.class.st | 22 ++-- .../GtSearchBinaryFilter.class.st | 16 +-- .../GtSearchBlockFilter.class.st | 12 +- src/GToolkit-Coder/GtSearchFilter.class.st | 50 ++++---- .../GtSearchGroupResult.class.st | 50 ++++---- .../GtSearchIntersectionFilter.class.st | 12 +- .../GtSearchNegationFilter.class.st | 18 +-- .../GtSearchNullFilter.class.st | 12 +- .../GtSearchNullGroupResult.class.st | 10 +- .../GtSearchTypedEntitiesFilter.class.st | 12 +- .../GtSearchTypedGroupResult.class.st | 14 +-- .../GtSearchUnionFilter.class.st | 14 +-- src/GToolkit-Coder/GtSourceCoder.class.st | 62 +++++----- .../GtSourceCoderAnnouncement.class.st | 4 +- .../GtSourceCoderEvaluationAllSource.class.st | 8 +- .../GtSourceCoderEvaluationContext.class.st | 34 +++--- ...ourceCoderEvaluationPartialSource.class.st | 16 +-- .../GtSourceCoderEvaluationResult.class.st | 28 ++--- ...rEvaluationResultWithRuntimeError.class.st | 14 +-- ...erEvaluationResultWithSyntaxError.class.st | 6 +- ...rceCoderEvaluationResultWithValue.class.st | 10 +- ...urceCoderEvaluationSourceInterval.class.st | 8 +- .../GtSourceReferenceHighlighter.class.st | 6 +- src/GToolkit-Coder/GtTextCoder.class.st | 20 +-- src/GToolkit-Coder/GtTextualCoder.class.st | 98 +++++++-------- .../GtTextualCoderAddOns.class.st | 20 +-- .../GtTraitsCompletionStrategy.class.st | 12 +- src/GToolkit-Coder/GtWatchExpression.class.st | 24 ++-- .../PrettyTextDiffBuilder.extension.st | 4 +- .../RBAbstractCondition.extension.st | 6 +- .../RBAddPoolVariableChange.extension.st | 4 +- src/GToolkit-Coder/RBArrayNode.extension.st | 4 +- .../RBAssignmentNode.extension.st | 4 +- src/GToolkit-Coder/RBBlockNode.extension.st | 4 +- src/GToolkit-Coder/RBCascadeNode.extension.st | 4 +- ...RBChangeMethodNameRefactoring.extension.st | 4 +- src/GToolkit-Coder/RBClass.extension.st | 4 +- .../RBCommentChange.extension.st | 4 +- .../RBCompositeRefactoryChange.extension.st | 4 +- src/GToolkit-Coder/RBCondition.extension.st | 6 +- .../RBConjunctiveCondition.extension.st | 6 +- src/GToolkit-Coder/RBLiteralNode.extension.st | 4 +- src/GToolkit-Coder/RBMessageNode.extension.st | 4 +- src/GToolkit-Coder/RBMethod.extension.st | 4 +- src/GToolkit-Coder/RBMethodNode.extension.st | 4 +- src/GToolkit-Coder/RBNamespace.extension.st | 12 +- .../RBNegationCondition.extension.st | 4 +- .../RBParseErrorNode.extension.st | 4 +- src/GToolkit-Coder/RBPragmaNode.extension.st | 4 +- src/GToolkit-Coder/RBProgramNode.extension.st | 8 +- src/GToolkit-Coder/RBRefactoring.extension.st | 10 +- .../RBRefactoryChange.extension.st | 4 +- ...veInstanceVariableRefactoring.extension.st | 4 +- .../RBRemovePoolVariableChange.extension.st | 4 +- .../RBReplaceMethodRefactoring.extension.st | 4 +- .../RBSequenceNode.extension.st | 4 +- .../RBTransformation.extension.st | 8 +- src/GToolkit-Coder/RBValueNode.extension.st | 4 +- .../RBVariableNode.extension.st | 6 +- src/GToolkit-Coder/RPackage.extension.st | 26 ++-- src/GToolkit-Coder/RPackageTag.extension.st | 4 +- src/GToolkit-Coder/SharedPool.extension.st | 4 +- src/GToolkit-Coder/Slot.extension.st | 4 +- src/GToolkit-Coder/String.extension.st | 4 +- src/GToolkit-Coder/Symbol.extension.st | 6 +- src/GToolkit-Coder/TGtCoderTrait.trait.st | 14 +-- .../TextDiffBuilder.extension.st | 8 +- src/GToolkit-Coder/package.st | 2 +- 205 files changed, 1462 insertions(+), 1297 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderCollapsedAddOnsAptitude.class.st create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderCollapsedAddOnsId.class.st create mode 100644 src/GToolkit-Coder/GtCoderPreview.class.st create mode 100644 src/GToolkit-Coder/GtCoderPreviewStencilBuilder.class.st diff --git a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st index c8ebe091e..6f2447049 100644 --- a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st @@ -6,7 +6,7 @@ Class { 'expandedElement', 'coderUIModel' ], - #category : 'GToolkit-Coder-UI-Coder - Source' + #category : #'GToolkit-Coder-UI-Coder - Source' } { #category : #private } @@ -28,7 +28,7 @@ GtExpandableSourceCoderElement >> assignCollapsedCoder: aSourceCoder to: aCollap aCollapsedElement aptitude ifNil: [ self addCodersCoderLook: aSourceCoder to: aCollapsedElement. - aCollapsedElement addAptitude: GtSourceCoderCollapsedTextAndExampleAptitude ] + aCollapsedElement addAptitude: GtSourceCoderCollapsedAddOnsAptitude ] ] { #category : #private } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedAddOnsAptitude.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedAddOnsAptitude.class.st new file mode 100644 index 000000000..21c53c80a --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedAddOnsAptitude.class.st @@ -0,0 +1,52 @@ +Class { + #name : #GtSourceCoderCollapsedAddOnsAptitude, + #superclass : #GtSourceCoderCollapsedTextAndExampleAptitude, + #instVars : [ + 'addOnsContainer' + ], + #category : #'GToolkit-Coder-UI-Coder - Source Look' +} + +{ #category : #accessing } +GtSourceCoderCollapsedAddOnsAptitude >> initialize [ + + super initialize. + + addOnsContainer := self newAddOnsContainer. + + container addChild: addOnsContainer. +] + +{ #category : #'instance creation' } +GtSourceCoderCollapsedAddOnsAptitude >> newAddOnsContainer [ + + ^ BrHorizontalPane new fitContent + addChild: (BrGlamorousIcons inspect asElement) +] + +{ #category : #'private - hooks' } +GtSourceCoderCollapsedAddOnsAptitude >> onCoderChanged: aGtSourceCoderUIModel [ + super onCoderChanged: aGtSourceCoderUIModel. + self widget coderUIModel + ifNotNil: [ :aPreviousCoder | aPreviousCoder coder announcer unsubscribe: self ]. + self updateAddonsFor: aGtSourceCoderUIModel. +] + +{ #category : #'private - updating' } +GtSourceCoderCollapsedAddOnsAptitude >> updateAddon: anAddOn coderUIModel: aGtSourceCoderUIModel [ + | anElement | + anElement := anAddOn stencilBuilder + coderUIModel: aGtSourceCoderUIModel; + build. + anElement ifNil: [ ^ self ]. + addOnsContainer addChild: anElement asElement. +] + +{ #category : #'private - updating' } +GtSourceCoderCollapsedAddOnsAptitude >> updateAddonsFor: aGtSourceCoderUIModel [ + + self sourceCoderUIModel addOnsAsyncDo: [ :theComputedAddOns | + addOnsContainer removeChildren. + theComputedAddOns previews do: [ :eachAddOn | + self updateAddon: eachAddOn coderUIModel: aGtSourceCoderUIModel ] ] +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedAddOnsId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedAddOnsId.class.st new file mode 100644 index 000000000..5b2858d0a --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedAddOnsId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtSourceCoderCollapsedAddOnsId, + #superclass : #GtCoderElementId, + #category : #'GToolkit-Coder-UI-Coder - Basic' +} + +{ #category : #accessing } +GtSourceCoderCollapsedAddOnsId >> asSymbol [ + ^ 'source-coder--collapsed-addons' +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAndExampleAptitude.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAndExampleAptitude.class.st index 71441361f..cdf2a8843 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAndExampleAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAndExampleAptitude.class.st @@ -4,10 +4,10 @@ I am a {{gtClass:GtSourceCoderAptitude}}. I attach two labels: 1. a {{gtMethod:GtSourceCoderCollapsedTextAndExampleAptitude>>#methodLabel|label=method name}}, and 2. example {{gtMethod:GtSourceCoderCollapsedTextAndExampleAptitude>>#exampleElement|label=execution state}}. -1. # Examples +#Examples If a method is an example, I display the method name and example result: {{gtExample:GtCoderCollapsedContentElementExamples>>#textAndExampleLook_withExampleMethod|codeExpanded=false|previewExpanded=true|previewHeight=150}} -If a method is ** an example, I omit displaying the example result: {{gtExample:GtCoderCollapsedContentElementExamples>>#textAndExampleLook_withRegularMethod|codeExpanded=false|previewExpanded=true|previewHeight=150}} +If a method is *not* an example, I omit displaying the example result: {{gtExample:GtCoderCollapsedContentElementExamples>>#textAndExampleLook_withRegularMethod|codeExpanded=false|previewExpanded=true|previewHeight=150}} " @@ -19,7 +19,7 @@ Class { 'methodLabel', 'exampleElement' ], - #category : 'GToolkit-Coder-UI-Coder - Source Look' + #category : #'GToolkit-Coder-UI-Coder - Source Look' } { #category : #'private - accessing' } @@ -36,7 +36,7 @@ GtSourceCoderCollapsedTextAndExampleAptitude >> exampleElement [ { #category : #'private - updating' } GtSourceCoderCollapsedTextAndExampleAptitude >> hide [ - self exampleElement visibility: BlVisibility hidden + self exampleElement visibility: BlVisibility gone ] { #category : #initialization } diff --git a/src/GToolkit-Coder/Announcement.extension.st b/src/GToolkit-Coder/Announcement.extension.st index 21c114753..31da0f484 100644 --- a/src/GToolkit-Coder/Announcement.extension.st +++ b/src/GToolkit-Coder/Announcement.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'Announcement' } +Extension { #name : #Announcement } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } Announcement class >> gtAllKindOfReferencesFor: aView [ ^ aView explicit diff --git a/src/GToolkit-Coder/BlTktWorkerProvider.extension.st b/src/GToolkit-Coder/BlTktWorkerProvider.extension.st index 0d2193909..ebef3f5a2 100644 --- a/src/GToolkit-Coder/BlTktWorkerProvider.extension.st +++ b/src/GToolkit-Coder/BlTktWorkerProvider.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'BlTktWorkerProvider' } +Extension { #name : #BlTktWorkerProvider } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } BlTktWorkerProvider class >> coderAddOnsPool [ ^ self @@ -8,7 +8,7 @@ BlTktWorkerProvider class >> coderAddOnsPool [ ifMissing: [ self new coderAddOnsPool; service ] ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } BlTktWorkerProvider >> coderAddOnsPool [ "Coder addons computation: maxPoolSize: 2, priority: 30" self @@ -18,13 +18,13 @@ BlTktWorkerProvider >> coderAddOnsPool [ nonUIPriority ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } BlTktWorkerProvider class >> coderAddOnsPoolName [ ^ 'Coder addons' ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } BlTktWorkerProvider class >> coderAstPool [ ^ self @@ -32,7 +32,7 @@ BlTktWorkerProvider class >> coderAstPool [ ifMissing: [ self new coderAstPool; service ] ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } BlTktWorkerProvider >> coderAstPool [ "Coder computation processing: maxPoolSize: 2, priority: 30" self @@ -42,7 +42,7 @@ BlTktWorkerProvider >> coderAstPool [ nonUIPriority ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } BlTktWorkerProvider class >> coderAstPoolName [ ^ 'Coder ast' diff --git a/src/GToolkit-Coder/Class.extension.st b/src/GToolkit-Coder/Class.extension.st index 131175fc7..6d4dbc34c 100644 --- a/src/GToolkit-Coder/Class.extension.st +++ b/src/GToolkit-Coder/Class.extension.st @@ -1,11 +1,11 @@ -Extension { #name : 'Class' } +Extension { #name : #Class } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } Class >> gtInheritance [ ^ GtPharoInheritance new subclass: self; superclass: self superclass ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } Class >> gtTraitUsages [ ^ self traits collect: [ :each | GtPharoTraitUsage new baseBehavior: self; usedTrait: each ] ] diff --git a/src/GToolkit-Coder/ClassDescription.extension.st b/src/GToolkit-Coder/ClassDescription.extension.st index e51db9b7d..c7ee1dafc 100644 --- a/src/GToolkit-Coder/ClassDescription.extension.st +++ b/src/GToolkit-Coder/ClassDescription.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'ClassDescription' } +Extension { #name : #ClassDescription } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } ClassDescription >> gtPackageScope [ ^ self package ] diff --git a/src/GToolkit-Coder/ClassDiffBuilder.extension.st b/src/GToolkit-Coder/ClassDiffBuilder.extension.st index 3ecfed0b0..cbbe0f832 100644 --- a/src/GToolkit-Coder/ClassDiffBuilder.extension.st +++ b/src/GToolkit-Coder/ClassDiffBuilder.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'ClassDiffBuilder' } +Extension { #name : #ClassDiffBuilder } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } ClassDiffBuilder >> attributedRopedFrom: aString do: aBlock [ | aTrimmedLeft aTrimmedRight aTrimmedString aTrimmedText | @@ -33,7 +33,7 @@ ClassDiffBuilder >> attributedRopedFrom: aString do: aBlock [ yourself ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } ClassDiffBuilder >> newRopedText [ | text | text := '' asRopedText. @@ -48,7 +48,7 @@ ClassDiffBuilder >> newRopedText [ ^ text ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } ClassDiffBuilder >> previousRopedText [ | text | text := '' asRopedText. diff --git a/src/GToolkit-Coder/CompiledMethod.extension.st b/src/GToolkit-Coder/CompiledMethod.extension.st index 023e9fcb5..cda7baa95 100644 --- a/src/GToolkit-Coder/CompiledMethod.extension.st +++ b/src/GToolkit-Coder/CompiledMethod.extension.st @@ -1,11 +1,11 @@ -Extension { #name : 'CompiledMethod' } +Extension { #name : #CompiledMethod } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } CompiledMethod >> gtPackageScope [ ^ self package ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } CompiledMethod >> gtReferencedClasses [ "Return classes that are directly referenced by this method. Compared to #referencedClasses I do not count a value of the ClassVariable as a reference" diff --git a/src/GToolkit-Coder/DebugSession.extension.st b/src/GToolkit-Coder/DebugSession.extension.st index 0f49b187c..487fed66d 100644 --- a/src/GToolkit-Coder/DebugSession.extension.st +++ b/src/GToolkit-Coder/DebugSession.extension.st @@ -1,12 +1,12 @@ -Extension { #name : 'DebugSession' } +Extension { #name : #DebugSession } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } DebugSession >> gtCreateModelForContext: aContext [ ^ (GtDebugContext forContext: aContext) topContext: interruptedContext ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } DebugSession >> gtRecompileMethodTo: text inContext: aContext notifying: aNotifyer [ "The retrieved information has changed and its source must now be updated. In this case, the retrieved information is the method of the given context." diff --git a/src/GToolkit-Coder/GtAstCache.class.st b/src/GToolkit-Coder/GtAstCache.class.st index b56a5022c..4c9a4c350 100644 --- a/src/GToolkit-Coder/GtAstCache.class.st +++ b/src/GToolkit-Coder/GtAstCache.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtAstCache', - #superclass : 'Object', + #name : #GtAstCache, + #superclass : #Object, #instVars : [ 'dictionary' ], @@ -10,24 +10,24 @@ Class { #category : 'GToolkit-Coder-Ast' } -{ #category : 'accessing' } +{ #category : #accessing } GtAstCache class >> cleanUp [ default := nil ] -{ #category : 'accessing' } +{ #category : #accessing } GtAstCache class >> default [ ^ default ifNil: [ default := self new ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtAstCache >> cachedAstAt: anAstKey ifAbsentPut: anAbsentBlock [ ^ dictionary at: anAstKey ifAbsentPut: anAbsentBlock ] -{ #category : 'initialization' } +{ #category : #initialization } GtAstCache >> initialize [ super initialize. diff --git a/src/GToolkit-Coder/GtAsyncSearchGroupStream.class.st b/src/GToolkit-Coder/GtAsyncSearchGroupStream.class.st index b3c1b129a..aca4863bb 100644 --- a/src/GToolkit-Coder/GtAsyncSearchGroupStream.class.st +++ b/src/GToolkit-Coder/GtAsyncSearchGroupStream.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtAsyncSearchGroupStream', - #superclass : 'Object', + #name : #GtAsyncSearchGroupStream, + #superclass : #Object, #traits : 'TAsyncStream', #classTraits : 'TAsyncStream classTrait', #instVars : [ @@ -12,34 +12,34 @@ Class { #category : 'GToolkit-Coder-Filters - Streams' } -{ #category : 'as yet unclassified' } +{ #category : #'as yet unclassified' } GtAsyncSearchGroupStream class >> mergeTypeWith: aGroupResultClass [ ^ aGroupResultClass mergeTypeWithDefaultGroup ] -{ #category : 'as yet unclassified' } +{ #category : #'as yet unclassified' } GtAsyncSearchGroupStream class >> mergeTypeWithDefaultGroup [ "The common type between the default group and any other group is the other group." ^ self ] -{ #category : 'as yet unclassified' } +{ #category : #'as yet unclassified' } GtAsyncSearchGroupStream class >> mergeTypeWithGenericGroup [ "The common type between a generic group and any other group is the other group." ^ self ] -{ #category : 'as yet unclassified' } +{ #category : #'as yet unclassified' } GtAsyncSearchGroupStream class >> mergeTypeWithTypedGroup: aGroupType [ ^ self ] -{ #category : 'accessing' } +{ #category : #accessing } GtAsyncSearchGroupStream >> filter [ ^ filter ] -{ #category : 'initialization' } +{ #category : #initialization } GtAsyncSearchGroupStream >> forFilter: aFilter [ self forFilter: aFilter @@ -48,14 +48,14 @@ GtAsyncSearchGroupStream >> forFilter: aFilter [ ifNotNil: [ aFilter defaultFilterScopeStream ]) ] -{ #category : 'initialization' } +{ #category : #initialization } GtAsyncSearchGroupStream >> forFilter: aFilter scope: aScopeStream [ filter := aFilter. scope := aScopeStream. self updateItems ] -{ #category : 'as yet unclassified' } +{ #category : #'as yet unclassified' } GtAsyncSearchGroupStream >> gtItemsFor: aView [ | anAnnouncer theItems aListView | @@ -93,21 +93,21 @@ GtAsyncSearchGroupStream >> gtItemsFor: aView [ updateWhen: Announcement in: anAnnouncer ] -{ #category : 'accessing' } +{ #category : #accessing } GtAsyncSearchGroupStream >> highlighter [ ^ filter notNil ifTrue: [ filter highlighter ] ifFalse: [ nil ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtAsyncSearchGroupStream >> initialize [ super initialize. itemsStream := AsyncEmptyStream new. ] -{ #category : 'api - stream' } +{ #category : #'api - stream' } GtAsyncSearchGroupStream >> pollNext: anAsynchronousContext [ "Attempt to pull out the next value of this stream, registering the current task for wakeup if the value is not yet available, and returning None if the stream is exhausted. There are several possible return values, each indicating a distinct stream state: @@ -119,24 +119,24 @@ GtAsyncSearchGroupStream >> pollNext: anAsynchronousContext [ ^ itemsStream pollNext: anAsynchronousContext ] -{ #category : 'initialization' } +{ #category : #initialization } GtAsyncSearchGroupStream >> refreshItems [ self forFilter: self filter ] -{ #category : 'accessing' } +{ #category : #accessing } GtAsyncSearchGroupStream >> scope [ ^ scope ] -{ #category : 'api - stream' } +{ #category : #'api - stream' } GtAsyncSearchGroupStream >> sizeHint [ ^ itemsStream sizeHint ] -{ #category : 'initialization' } +{ #category : #initialization } GtAsyncSearchGroupStream >> updateItems [ itemsStream := scope filter: filter ] diff --git a/src/GToolkit-Coder/GtAsyncSearchNullGroupStream.class.st b/src/GToolkit-Coder/GtAsyncSearchNullGroupStream.class.st index 3e4439df4..01b534b87 100644 --- a/src/GToolkit-Coder/GtAsyncSearchNullGroupStream.class.st +++ b/src/GToolkit-Coder/GtAsyncSearchNullGroupStream.class.st @@ -1,20 +1,20 @@ Class { - #name : 'GtAsyncSearchNullGroupStream', - #superclass : 'GtSearchGroupResult', + #name : #GtAsyncSearchNullGroupStream, + #superclass : #GtSearchGroupResult, #category : 'GToolkit-Coder-Filters - Streams' } -{ #category : 'as yet unclassified' } +{ #category : #'as yet unclassified' } GtAsyncSearchNullGroupStream class >> mergeTypeWith: aGroupResultClass [ ^ aGroupResultClass mergeTypeWithGenericGroup. ] -{ #category : 'as yet unclassified' } +{ #category : #'as yet unclassified' } GtAsyncSearchNullGroupStream class >> mergeTypeWithTypedGroup: aGroupType [ ^ aGroupType ] -{ #category : 'enumerating' } +{ #category : #enumerating } GtAsyncSearchNullGroupStream >> refreshItems [ filtered ifTrue: [ ^ self ]. diff --git a/src/GToolkit-Coder/GtAsyncSearchTypedGroupStream.class.st b/src/GToolkit-Coder/GtAsyncSearchTypedGroupStream.class.st index 4aaa5b935..602103e50 100644 --- a/src/GToolkit-Coder/GtAsyncSearchTypedGroupStream.class.st +++ b/src/GToolkit-Coder/GtAsyncSearchTypedGroupStream.class.st @@ -1,36 +1,36 @@ Class { - #name : 'GtAsyncSearchTypedGroupStream', - #superclass : 'GtAsyncSearchGroupStream', + #name : #GtAsyncSearchTypedGroupStream, + #superclass : #GtAsyncSearchGroupStream, #instVars : [ 'announcer' ], #category : 'GToolkit-Coder-Filters - Streams' } -{ #category : 'as yet unclassified' } +{ #category : #'as yet unclassified' } GtAsyncSearchTypedGroupStream class >> mergeTypeWith: aGroupResultClass [ ^ aGroupResultClass mergeTypeWithTypedGroup: self. ] -{ #category : 'as yet unclassified' } +{ #category : #'as yet unclassified' } GtAsyncSearchTypedGroupStream class >> mergeTypeWithTypedGroup: aGroupType [ ^ aGroupType = self ifTrue: [ self ] ifFalse: [ GtSearchGroupResult ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtAsyncSearchTypedGroupStream >> announcer [ ^ announcer ] -{ #category : 'initialization' } +{ #category : #initialization } GtAsyncSearchTypedGroupStream >> initialize [ super initialize. announcer := Announcer new. self subscribe ] -{ #category : 'subscription' } +{ #category : #subscription } GtAsyncSearchTypedGroupStream >> subscribe [ ] diff --git a/src/GToolkit-Coder/GtClassCoderMethodNavigationAnnouncement.class.st b/src/GToolkit-Coder/GtClassCoderMethodNavigationAnnouncement.class.st index 5b1a10b8c..7fcdf2135 100644 --- a/src/GToolkit-Coder/GtClassCoderMethodNavigationAnnouncement.class.st +++ b/src/GToolkit-Coder/GtClassCoderMethodNavigationAnnouncement.class.st @@ -1,18 +1,18 @@ Class { - #name : 'GtClassCoderMethodNavigationAnnouncement', - #superclass : 'Announcement', + #name : #GtClassCoderMethodNavigationAnnouncement, + #superclass : #Announcement, #instVars : [ 'method' ], #category : 'GToolkit-Coder-Event' } -{ #category : 'accessing' } +{ #category : #accessing } GtClassCoderMethodNavigationAnnouncement >> method [ ^ method ] -{ #category : 'accessing' } +{ #category : #accessing } GtClassCoderMethodNavigationAnnouncement >> method: aMethod [ method := aMethod ] diff --git a/src/GToolkit-Coder/GtClassCoderMethodProtocolNavigationAnnouncement.class.st b/src/GToolkit-Coder/GtClassCoderMethodProtocolNavigationAnnouncement.class.st index 2a96093f2..b11d3c471 100644 --- a/src/GToolkit-Coder/GtClassCoderMethodProtocolNavigationAnnouncement.class.st +++ b/src/GToolkit-Coder/GtClassCoderMethodProtocolNavigationAnnouncement.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtClassCoderMethodProtocolNavigationAnnouncement', - #superclass : 'Announcement', + #name : #GtClassCoderMethodProtocolNavigationAnnouncement, + #superclass : #Announcement, #instVars : [ 'methodProtocol', 'source' @@ -8,22 +8,22 @@ Class { #category : 'GToolkit-Coder-Event' } -{ #category : 'accessing' } +{ #category : #accessing } GtClassCoderMethodProtocolNavigationAnnouncement >> methodProtocol [ ^ methodProtocol ] -{ #category : 'accessing' } +{ #category : #accessing } GtClassCoderMethodProtocolNavigationAnnouncement >> methodProtocol: anObject [ methodProtocol := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtClassCoderMethodProtocolNavigationAnnouncement >> source [ ^ source ] -{ #category : 'accessing' } +{ #category : #accessing } GtClassCoderMethodProtocolNavigationAnnouncement >> source: anObject [ source := anObject ] diff --git a/src/GToolkit-Coder/GtClassCoderPackagesFilterStringChanged.class.st b/src/GToolkit-Coder/GtClassCoderPackagesFilterStringChanged.class.st index 881683364..d8f758916 100644 --- a/src/GToolkit-Coder/GtClassCoderPackagesFilterStringChanged.class.st +++ b/src/GToolkit-Coder/GtClassCoderPackagesFilterStringChanged.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtClassCoderPackagesFilterStringChanged', - #superclass : 'Announcement', + #name : #GtClassCoderPackagesFilterStringChanged, + #superclass : #Announcement, #instVars : [ 'navigationModel', 'packagesFilterString' @@ -8,22 +8,22 @@ Class { #category : 'GToolkit-Coder' } -{ #category : 'accessing' } +{ #category : #accessing } GtClassCoderPackagesFilterStringChanged >> navigationModel [ ^ navigationModel ] -{ #category : 'accessing' } +{ #category : #accessing } GtClassCoderPackagesFilterStringChanged >> navigationModel: anObject [ navigationModel := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtClassCoderPackagesFilterStringChanged >> packagesFilterString [ ^ packagesFilterString ] -{ #category : 'accessing' } +{ #category : #accessing } GtClassCoderPackagesFilterStringChanged >> packagesFilterString: anObject [ packagesFilterString := anObject ] diff --git a/src/GToolkit-Coder/GtClassesCompletionStrategy.class.st b/src/GToolkit-Coder/GtClassesCompletionStrategy.class.st index f002474dd..55e32a5b7 100644 --- a/src/GToolkit-Coder/GtClassesCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtClassesCompletionStrategy.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtClassesCompletionStrategy', - #superclass : 'GtCompletionStrategy', + #name : #GtClassesCompletionStrategy, + #superclass : #GtCompletionStrategy, #instVars : [ 'excludedClasses', 'candidateClasses' @@ -8,7 +8,7 @@ Class { #category : 'GToolkit-Coder-Completion' } -{ #category : 'accessing' } +{ #category : #accessing } GtClassesCompletionStrategy >> candidateClasses [ ^ candidateClasses ifNil: [ | theInterestingClassNames | @@ -16,7 +16,7 @@ GtClassesCompletionStrategy >> candidateClasses [ candidateClasses := GtPrefixTree withAll: theInterestingClassNames ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtClassesCompletionStrategy >> completionActionsFor: aText at: positionInteger max: maxInteger [ | currentInput completionActions | currentInput := aText asString. @@ -46,22 +46,22 @@ GtClassesCompletionStrategy >> completionActionsFor: aText at: positionInteger m ^ completionActions ] -{ #category : 'initialization' } +{ #category : #initialization } GtClassesCompletionStrategy >> excludeClasses: aCollectionOfClasses [ excludedClasses := aCollectionOfClasses asSet ] -{ #category : 'testing' } +{ #category : #testing } GtClassesCompletionStrategy >> hasCompletionEntryFor: aString [ ^ true ] -{ #category : 'testing' } +{ #category : #testing } GtClassesCompletionStrategy >> hasCompletionsAt: anInteger in: aText [ ^ true ] -{ #category : 'initialization' } +{ #category : #initialization } GtClassesCompletionStrategy >> initialize [ super initialize. diff --git a/src/GToolkit-Coder/GtCoderAction.class.st b/src/GToolkit-Coder/GtCoderAction.class.st index 87c42cea2..a1d5c9947 100644 --- a/src/GToolkit-Coder/GtCoderAction.class.st +++ b/src/GToolkit-Coder/GtCoderAction.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderAction', - #superclass : 'Object', + #name : #GtCoderAction, + #superclass : #Object, #instVars : [ 'title', 'icon', @@ -10,7 +10,7 @@ Class { #category : 'GToolkit-Coder' } -{ #category : 'comparing' } +{ #category : #comparing } GtCoderAction >> = anObject [ "Answer whether the receiver and anObject represent the same object." @@ -21,71 +21,71 @@ GtCoderAction >> = anObject [ ^ id = anObject id and: [ title = anObject title ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderAction >> action [ ^ action ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderAction >> action: anObject [ action := anObject ] -{ #category : 'evaluating' } +{ #category : #evaluating } GtCoderAction >> glamourValueWithArgs: aSequenceOfArguments [ ^ self action glamourValueWithArgs: aSequenceOfArguments ] -{ #category : 'comparing' } +{ #category : #comparing } GtCoderAction >> hash [ "Answer an integer value that is related to the identity of the receiver." ^ id hash bitXor: title hash ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderAction >> hoverAction [ ^ nil ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderAction >> icon [ ^ icon ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderAction >> icon: anObject [ icon := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderAction >> id [ ^ id ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderAction >> id: anObject [ id := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderAction >> leaveAction [ ^ nil ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderAction >> name [ ^ id ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderAction >> name: anObject [ id := anObject ] -{ #category : 'printing' } +{ #category : #printing } GtCoderAction >> printOn: aStream [ super printOn: aStream. aStream @@ -94,17 +94,17 @@ GtCoderAction >> printOn: aStream [ nextPut: $) ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderAction >> title [ ^ title ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderAction >> title: anObject [ title := anObject ] -{ #category : 'evaluating' } +{ #category : #evaluating } GtCoderAction >> valueWithArguments: aSequenceOfArguments [ ^ self action valueWithArguments: aSequenceOfArguments ] diff --git a/src/GToolkit-Coder/GtCoderActivatableAction.class.st b/src/GToolkit-Coder/GtCoderActivatableAction.class.st index baa631ef1..5b412952b 100644 --- a/src/GToolkit-Coder/GtCoderActivatableAction.class.st +++ b/src/GToolkit-Coder/GtCoderActivatableAction.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderActivatableAction', - #superclass : 'GtCoderAction', + #name : #GtCoderActivatableAction, + #superclass : #GtCoderAction, #instVars : [ 'enabledBlock', 'updateAnnouncement' @@ -8,12 +8,12 @@ Class { #category : 'GToolkit-Coder' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderActivatableAction >> enabled: aBlock [ enabledBlock := aBlock ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderActivatableAction >> initialize [ super initialize. @@ -21,7 +21,7 @@ GtCoderActivatableAction >> initialize [ updateAnnouncement := nil ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderActivatableAction >> updateWhen: anAnnouncementClass [ updateAnnouncement := anAnnouncementClass ] diff --git a/src/GToolkit-Coder/GtCoderAddOns.class.st b/src/GToolkit-Coder/GtCoderAddOns.class.st index 9882759c8..f5ac12375 100644 --- a/src/GToolkit-Coder/GtCoderAddOns.class.st +++ b/src/GToolkit-Coder/GtCoderAddOns.class.st @@ -1,25 +1,27 @@ Class { - #name : 'GtCoderAddOns', - #superclass : 'Object', + #name : #GtCoderAddOns, + #superclass : #Object, #instVars : [ 'contextActions', 'mainActions', 'contextMenuActions', 'shortcuts', - 'updateRequested' + 'updateRequested', + 'previews' ], - #category : 'GToolkit-Coder-Coders - Addons' + #category : #'GToolkit-Coder-Coders - Addons' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderAddOns >> addAddOns: aGtCoderAddOns [ self addShortcuts: aGtCoderAddOns shortcuts. self addMainActions: aGtCoderAddOns mainActions. self addContextActions: aGtCoderAddOns contextActions. - self addContextMenuActions: aGtCoderAddOns contextMenuActions + self addContextMenuActions: aGtCoderAddOns contextMenuActions. + self addPreviews: aGtCoderAddOns previews. ] -{ #category : 'api - context actions' } +{ #category : #'api - context actions' } GtCoderAddOns >> addContextAction: aGtCoderAction [ self updateActionList: #contextActions @@ -27,7 +29,7 @@ GtCoderAddOns >> addContextAction: aGtCoderAction [ onlyNew: true ] -{ #category : 'api - context actions' } +{ #category : #'api - context actions' } GtCoderAddOns >> addContextAction: aTitleString icon: anIcon action: aBlock [ self addContextAction: aTitleString @@ -36,7 +38,7 @@ GtCoderAddOns >> addContextAction: aTitleString icon: anIcon action: aBlock [ id: nil ] -{ #category : 'api - context actions' } +{ #category : #'api - context actions' } GtCoderAddOns >> addContextAction: aTitleString icon: anIcon action: aBlock id: aBlElementId [ self updateActionList: #contextActions @@ -48,22 +50,22 @@ GtCoderAddOns >> addContextAction: aTitleString icon: anIcon action: aBlock id: onlyNew: true ] -{ #category : 'api - context actions' } +{ #category : #'api - context actions' } GtCoderAddOns >> addContextActions: aCollectionOfContextActions [ aCollectionOfContextActions do: [ :eachContextAction | self addContextAction: eachContextAction ] ] -{ #category : 'api - context menu' } +{ #category : #'api - context menu' } GtCoderAddOns >> addContextMenuAction: aContextMenuAction [ contextMenuActions add: aContextMenuAction ] -{ #category : 'api - context menu' } +{ #category : #'api - context menu' } GtCoderAddOns >> addContextMenuActions: aCollectionOfContextMenuActions [ aCollectionOfContextMenuActions do: [ :eachContextMenuAction | self addContextMenuAction: eachContextMenuAction ] ] -{ #category : 'api - context menu' } +{ #category : #'api - context menu' } GtCoderAddOns >> addContextMenuItem: aString action: aBlock [ ^ self addContextMenuItem: aString @@ -72,7 +74,7 @@ GtCoderAddOns >> addContextMenuItem: aString action: aBlock [ action: aBlock ] -{ #category : 'api - context menu' } +{ #category : #'api - context menu' } GtCoderAddOns >> addContextMenuItem: aString action: aBlock id: aSymbol [ ^ self addContextMenuItem: aString @@ -82,7 +84,7 @@ GtCoderAddOns >> addContextMenuItem: aString action: aBlock id: aSymbol [ id: aSymbol ] -{ #category : 'api - context menu' } +{ #category : #'api - context menu' } GtCoderAddOns >> addContextMenuItem: aString hover: hoverBlock leave: leaveBlock action: aBlock [ self addContextMenuItem: aString @@ -92,7 +94,7 @@ GtCoderAddOns >> addContextMenuItem: aString hover: hoverBlock leave: leaveBlock id: nil ] -{ #category : 'api - context menu' } +{ #category : #'api - context menu' } GtCoderAddOns >> addContextMenuItem: aString hover: hoverBlock leave: leaveBlock action: aBlock id: aSymbol [ | newAction | newAction := GtCoderContextMenuAction new @@ -104,7 +106,7 @@ GtCoderAddOns >> addContextMenuItem: aString hover: hoverBlock leave: leaveBlock self addContextMenuAction: newAction ] -{ #category : 'api - main actions' } +{ #category : #'api - main actions' } GtCoderAddOns >> addDropDownAction: aString icon: anIcon stencil: aBlock [ | newAction | newAction := GtCoderDropDownAction new @@ -114,7 +116,7 @@ GtCoderAddOns >> addDropDownAction: aString icon: anIcon stencil: aBlock [ mainActions add: newAction ] -{ #category : 'api - main actions' } +{ #category : #'api - main actions' } GtCoderAddOns >> addDropDownWithPreviewAction: aString icon: anIcon action: actionBlock stencil: stencilBlock [ | newAction | newAction := GtCoderDropDownWithPreviewAction new @@ -125,7 +127,7 @@ GtCoderAddOns >> addDropDownWithPreviewAction: aString icon: anIcon action: acti mainActions add: newAction ] -{ #category : 'api - main actions' } +{ #category : #'api - main actions' } GtCoderAddOns >> addMainAction: aGtCoderAction [ self updateActionList: #mainActions @@ -133,7 +135,7 @@ GtCoderAddOns >> addMainAction: aGtCoderAction [ onlyNew: true ] -{ #category : 'api - main actions' } +{ #category : #'api - main actions' } GtCoderAddOns >> addMainAction: aString icon: anIcon action: aBlock [ self updateActionList: #mainActions @@ -143,7 +145,7 @@ GtCoderAddOns >> addMainAction: aString icon: anIcon action: aBlock [ onlyNew: true ] -{ #category : 'api - main actions' } +{ #category : #'api - main actions' } GtCoderAddOns >> addMainAction: aTitleString icon: anIcon action: aBlock id: aNameSymbol [ self updateActionList: #mainActions @@ -155,12 +157,12 @@ GtCoderAddOns >> addMainAction: aTitleString icon: anIcon action: aBlock id: aNa onlyNew: true ] -{ #category : 'api - main actions' } +{ #category : #'api - main actions' } GtCoderAddOns >> addMainActions: aCollectionOfMainActions [ aCollectionOfMainActions do: [ :eachMainAction | self addMainAction: eachMainAction ] ] -{ #category : 'private' } +{ #category : #private } GtCoderAddOns >> addOrUpdateShortcut: aBlShortcut to: aCollection [ 1 to: aCollection size do: [ :i | (aCollection at: i) combination = aBlShortcut combination @@ -168,32 +170,54 @@ GtCoderAddOns >> addOrUpdateShortcut: aBlShortcut to: aCollection [ aCollection add: aBlShortcut ] -{ #category : 'api - shortcuts' } +{ #category : #'api - previews' } +GtCoderAddOns >> addPreview: aCoderPreview [ + + self previews add: aCoderPreview + +] + +{ #category : #'api - previews' } +GtCoderAddOns >> addPreview: aString stencil: aStencilBuilder [ + + self addPreview: (GtCoderPreview new + title: aString; + stencil: aStencilBuilder). +] + +{ #category : #'api - previews' } +GtCoderAddOns >> addPreviews: aCollectionOfPreviews [ + + aCollectionOfPreviews do: [ :eachPreview | + self addPreview: eachPreview ] +] + +{ #category : #'api - shortcuts' } GtCoderAddOns >> addShortcut: aBlShortcut [ self addOrUpdateShortcut: aBlShortcut to: shortcuts ] -{ #category : 'api - shortcuts' } +{ #category : #'api - shortcuts' } GtCoderAddOns >> addShortcuts: aCollectionOfShortcuts [ aCollectionOfShortcuts do: [ :eachShortcut | self addShortcut: eachShortcut ] ] -{ #category : 'api - context actions' } +{ #category : #'api - context actions' } GtCoderAddOns >> contextActions [ ^ contextActions ] -{ #category : 'api - context menu' } +{ #category : #'api - context menu' } GtCoderAddOns >> contextMenuActions [ ^ contextMenuActions ] -{ #category : 'changes' } +{ #category : #changes } GtCoderAddOns >> differenceWith: aGtCoderAddOns [ ^ Array streamContents: [ :aStream | self differenceWith: aGtCoderAddOns on: aStream ] ] -{ #category : 'changes' } +{ #category : #changes } GtCoderAddOns >> differenceWith: aGtCoderAddOns on: aStream [ self assert: [ self class = aGtCoderAddOns class ] @@ -212,7 +236,7 @@ GtCoderAddOns >> differenceWith: aGtCoderAddOns on: aStream [ ifFalse: [ aStream nextPut: GtCoderAddOnsShortcutsDifference new ]. ] -{ #category : 'gt-extensions' } +{ #category : #'gt-extensions' } GtCoderAddOns >> gtViewContextActionsFor: aView [ ^ aView columnedList @@ -223,7 +247,7 @@ GtCoderAddOns >> gtViewContextActionsFor: aView [ column: 'Action' text: [ :anAction | anAction action ] ] -{ #category : 'gt-extensions' } +{ #category : #'gt-extensions' } GtCoderAddOns >> gtViewKeybindingsFor: aView [ self shortcuts ifEmpty: [ ^ aView empty ]. @@ -235,7 +259,7 @@ GtCoderAddOns >> gtViewKeybindingsFor: aView [ column: 'Combination' text: [ :each | each combination gtDisplayString ] ] -{ #category : 'gt-extensions' } +{ #category : #'gt-extensions' } GtCoderAddOns >> gtViewMainActionsFor: aView [ ^ aView columnedList @@ -249,48 +273,55 @@ GtCoderAddOns >> gtViewMainActionsFor: aView [ weight: 3 ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtCoderAddOns >> initialize [ super initialize. contextActions := OrderedCollection new. mainActions := OrderedCollection new. contextMenuActions := OrderedCollection new. shortcuts := OrderedCollection new. + previews := OrderedCollection new. updateRequested := true ] -{ #category : 'api - main actions' } +{ #category : #'api - main actions' } GtCoderAddOns >> mainActions [ ^ mainActions ] -{ #category : 'changes' } +{ #category : #changes } GtCoderAddOns >> markAsUpdated [ updateRequested := false ] -{ #category : 'copying' } +{ #category : #copying } GtCoderAddOns >> postCopy [ super postCopy. contextActions := contextActions copy. mainActions := mainActions copy. contextMenuActions := contextMenuActions copy. - shortcuts := shortcuts copy + shortcuts := shortcuts copy. + previews := previews copy. +] + +{ #category : #'api - previews' } +GtCoderAddOns >> previews [ + ^ previews ifNil: [ previews := OrderedCollection new ] ] -{ #category : 'changes' } +{ #category : #changes } GtCoderAddOns >> requestUpdate [ "Mark coder addons as potentially needed to be updated" updateRequested := true ] -{ #category : 'api - shortcuts' } +{ #category : #'api - shortcuts' } GtCoderAddOns >> shortcuts [ ^ shortcuts ] -{ #category : 'testing' } +{ #category : #testing } GtCoderAddOns >> shouldBeUpdated [ "Return true if addons should be updated, false otherwise" @@ -298,7 +329,7 @@ GtCoderAddOns >> shouldBeUpdated [ ^ updateRequested ] -{ #category : 'private' } +{ #category : #private } GtCoderAddOns >> updateActionList: listSymbol title: aString icon: anIcon action: aBlock onlyNew: aBoolean [ self updateActionList: listSymbol @@ -309,7 +340,7 @@ GtCoderAddOns >> updateActionList: listSymbol title: aString icon: anIcon action onlyNew: aBoolean ] -{ #category : 'private' } +{ #category : #private } GtCoderAddOns >> updateActionList: listSymbol withAction: aGtCoderAction onlyNew: aBoolean [ | index actions | diff --git a/src/GToolkit-Coder/GtCoderAddOnsContextActionsDifference.class.st b/src/GToolkit-Coder/GtCoderAddOnsContextActionsDifference.class.st index 8adf0f428..3c0128383 100644 --- a/src/GToolkit-Coder/GtCoderAddOnsContextActionsDifference.class.st +++ b/src/GToolkit-Coder/GtCoderAddOnsContextActionsDifference.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtCoderAddOnsContextActionsDifference', - #superclass : 'GtCoderAddOnsDifference', + #name : #GtCoderAddOnsContextActionsDifference, + #superclass : #GtCoderAddOnsDifference, #category : 'GToolkit-Coder-Coders - Addons' } diff --git a/src/GToolkit-Coder/GtCoderAddOnsContextMenuDifference.class.st b/src/GToolkit-Coder/GtCoderAddOnsContextMenuDifference.class.st index df97c0e27..060ba11ad 100644 --- a/src/GToolkit-Coder/GtCoderAddOnsContextMenuDifference.class.st +++ b/src/GToolkit-Coder/GtCoderAddOnsContextMenuDifference.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtCoderAddOnsContextMenuDifference', - #superclass : 'GtCoderAddOnsDifference', + #name : #GtCoderAddOnsContextMenuDifference, + #superclass : #GtCoderAddOnsDifference, #category : 'GToolkit-Coder-Coders - Addons' } diff --git a/src/GToolkit-Coder/GtCoderAddOnsDifference.class.st b/src/GToolkit-Coder/GtCoderAddOnsDifference.class.st index 41fe2d3fb..81b13bdf7 100644 --- a/src/GToolkit-Coder/GtCoderAddOnsDifference.class.st +++ b/src/GToolkit-Coder/GtCoderAddOnsDifference.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtCoderAddOnsDifference', - #superclass : 'Object', + #name : #GtCoderAddOnsDifference, + #superclass : #Object, #category : 'GToolkit-Coder-Coders - Addons' } diff --git a/src/GToolkit-Coder/GtCoderAddOnsMainActionsDifference.class.st b/src/GToolkit-Coder/GtCoderAddOnsMainActionsDifference.class.st index d3c1dd0ea..4419f0ce6 100644 --- a/src/GToolkit-Coder/GtCoderAddOnsMainActionsDifference.class.st +++ b/src/GToolkit-Coder/GtCoderAddOnsMainActionsDifference.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtCoderAddOnsMainActionsDifference', - #superclass : 'GtCoderAddOnsDifference', + #name : #GtCoderAddOnsMainActionsDifference, + #superclass : #GtCoderAddOnsDifference, #category : 'GToolkit-Coder-Coders - Addons' } diff --git a/src/GToolkit-Coder/GtCoderAddOnsShortcutsDifference.class.st b/src/GToolkit-Coder/GtCoderAddOnsShortcutsDifference.class.st index 70565137f..5a6fe71bc 100644 --- a/src/GToolkit-Coder/GtCoderAddOnsShortcutsDifference.class.st +++ b/src/GToolkit-Coder/GtCoderAddOnsShortcutsDifference.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtCoderAddOnsShortcutsDifference', - #superclass : 'GtCoderAddOnsDifference', + #name : #GtCoderAddOnsShortcutsDifference, + #superclass : #GtCoderAddOnsDifference, #category : 'GToolkit-Coder-Coders - Addons' } diff --git a/src/GToolkit-Coder/GtCoderAddOnsStylersDifference.class.st b/src/GToolkit-Coder/GtCoderAddOnsStylersDifference.class.st index 18a860163..a7d3d76ee 100644 --- a/src/GToolkit-Coder/GtCoderAddOnsStylersDifference.class.st +++ b/src/GToolkit-Coder/GtCoderAddOnsStylersDifference.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtCoderAddOnsStylersDifference', - #superclass : 'GtCoderAddOnsDifference', + #name : #GtCoderAddOnsStylersDifference, + #superclass : #GtCoderAddOnsDifference, #category : 'GToolkit-Coder-Coders - Addons' } diff --git a/src/GToolkit-Coder/GtCoderAddOnsUpdateRequest.class.st b/src/GToolkit-Coder/GtCoderAddOnsUpdateRequest.class.st index 0cdca7652..b1896d665 100644 --- a/src/GToolkit-Coder/GtCoderAddOnsUpdateRequest.class.st +++ b/src/GToolkit-Coder/GtCoderAddOnsUpdateRequest.class.st @@ -10,7 +10,7 @@ It works like this: " Class { - #name : 'GtCoderAddOnsUpdateRequest', - #superclass : 'GtCoderAnnouncement', + #name : #GtCoderAddOnsUpdateRequest, + #superclass : #GtCoderAnnouncement, #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCoderAnnouncement.class.st b/src/GToolkit-Coder/GtCoderAnnouncement.class.st index 64c7d07e6..be4a02c00 100644 --- a/src/GToolkit-Coder/GtCoderAnnouncement.class.st +++ b/src/GToolkit-Coder/GtCoderAnnouncement.class.st @@ -1,18 +1,18 @@ Class { - #name : 'GtCoderAnnouncement', - #superclass : 'Announcement', + #name : #GtCoderAnnouncement, + #superclass : #Announcement, #instVars : [ 'coder' ], #category : 'GToolkit-Coder-Event' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderAnnouncement >> coder [ ^ coder ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderAnnouncement >> coder: methodCoder [ coder := methodCoder ] diff --git a/src/GToolkit-Coder/GtCoderAnnouncer.class.st b/src/GToolkit-Coder/GtCoderAnnouncer.class.st index 762dc7a62..4646dc462 100644 --- a/src/GToolkit-Coder/GtCoderAnnouncer.class.st +++ b/src/GToolkit-Coder/GtCoderAnnouncer.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderAnnouncer', - #superclass : 'Announcer', + #name : #GtCoderAnnouncer, + #superclass : #Announcer, #instVars : [ 'suppressedAnnouncements', 'monitor' @@ -8,7 +8,7 @@ Class { #category : 'GToolkit-Coder-Coders' } -{ #category : 'announce' } +{ #category : #announce } GtCoderAnnouncer >> announce: anAnnouncement [ monitor critical: [ (suppressedAnnouncements includes: anAnnouncement class) @@ -16,7 +16,7 @@ GtCoderAnnouncer >> announce: anAnnouncement [ super announce: anAnnouncement ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderAnnouncer >> initialize [ super initialize. @@ -24,7 +24,7 @@ GtCoderAnnouncer >> initialize [ suppressedAnnouncements := #() ] -{ #category : 'announce' } +{ #category : #announce } GtCoderAnnouncer >> suppress: aCollectionOfAnnouncementClasses during: aBlock [ monitor critical: [ | aPreviousSuppressedAnnouncements | diff --git a/src/GToolkit-Coder/GtCoderAstChanged.class.st b/src/GToolkit-Coder/GtCoderAstChanged.class.st index f3f8ce6ca..1973bab7e 100644 --- a/src/GToolkit-Coder/GtCoderAstChanged.class.st +++ b/src/GToolkit-Coder/GtCoderAstChanged.class.st @@ -1,18 +1,18 @@ Class { - #name : 'GtCoderAstChanged', - #superclass : 'GtCoderAnnouncement', + #name : #GtCoderAstChanged, + #superclass : #GtCoderAnnouncement, #instVars : [ 'ast' ], #category : 'GToolkit-Coder-Event' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderAstChanged >> ast [ ^ ast ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderAstChanged >> ast: anObject [ ast := anObject ] diff --git a/src/GToolkit-Coder/GtCoderAstCompositeStyler.class.st b/src/GToolkit-Coder/GtCoderAstCompositeStyler.class.st index 350eb6ce4..98d183fd0 100644 --- a/src/GToolkit-Coder/GtCoderAstCompositeStyler.class.st +++ b/src/GToolkit-Coder/GtCoderAstCompositeStyler.class.st @@ -1,13 +1,13 @@ Class { - #name : 'GtCoderAstCompositeStyler', - #superclass : 'GtCoderAstStyler', + #name : #GtCoderAstCompositeStyler, + #superclass : #GtCoderAstStyler, #instVars : [ 'stylers' ], #category : 'GToolkit-Coder-Styler/Highlighter' } -{ #category : 'api - styling' } +{ #category : #'api - styling' } GtCoderAstCompositeStyler >> extraStyle: aText ast: theAst [ self stylers do: [ :eachStyler | BlTextStylerTelemetry @@ -15,7 +15,7 @@ GtCoderAstCompositeStyler >> extraStyle: aText ast: theAst [ during: [ eachStyler extraStyle: aText ast: theAst ] ] ] -{ #category : 'api - styling' } +{ #category : #'api - styling' } GtCoderAstCompositeStyler >> style: aText ast: theAst [ self stylers do: [ :eachStyler | [ @@ -39,12 +39,12 @@ GtCoderAstCompositeStyler >> style: aText ast: theAst [ cr ] ] ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderAstCompositeStyler >> stylers [ ^ stylers ifNil: [ #() ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderAstCompositeStyler >> stylers: anObject [ stylers := anObject ] diff --git a/src/GToolkit-Coder/GtCoderAstSmaCCParserStyler.class.st b/src/GToolkit-Coder/GtCoderAstSmaCCParserStyler.class.st index a5c4a4caf..c49a026ee 100644 --- a/src/GToolkit-Coder/GtCoderAstSmaCCParserStyler.class.st +++ b/src/GToolkit-Coder/GtCoderAstSmaCCParserStyler.class.st @@ -1,23 +1,23 @@ Class { - #name : 'GtCoderAstSmaCCParserStyler', - #superclass : 'GtCoderAstStyler', + #name : #GtCoderAstSmaCCParserStyler, + #superclass : #GtCoderAstStyler, #instVars : [ 'smaccStyler' ], #category : 'GToolkit-Coder-Styler/Highlighter' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderAstSmaCCParserStyler >> smaccStyler [ ^ smaccStyler ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderAstSmaCCParserStyler >> smaccStyler: anObject [ smaccStyler := anObject ] -{ #category : 'api - styling' } +{ #category : #'api - styling' } GtCoderAstSmaCCParserStyler >> style: aText ast: theAst [ self smaccStyler style: aText using: theAst ] diff --git a/src/GToolkit-Coder/GtCoderAstStyler.class.st b/src/GToolkit-Coder/GtCoderAstStyler.class.st index 989fe9e8c..8af025242 100644 --- a/src/GToolkit-Coder/GtCoderAstStyler.class.st +++ b/src/GToolkit-Coder/GtCoderAstStyler.class.st @@ -1,18 +1,18 @@ Class { - #name : 'GtCoderAstStyler', - #superclass : 'BlTextStyler', + #name : #GtCoderAstStyler, + #superclass : #BlTextStyler, #instVars : [ 'coderViewModel' ], #category : 'GToolkit-Coder-Styler/Highlighter' } -{ #category : 'api - styling' } +{ #category : #'api - styling' } GtCoderAstStyler >> attribute: aTextAttribute from: aStart to: anEnd [ self attributes: { aTextAttribute } from: aStart to: anEnd ] -{ #category : 'api - styling' } +{ #category : #'api - styling' } GtCoderAstStyler >> attributes: anAttributesCollection from: aStart to: anEnd [ [ text attributes: anAttributesCollection from: aStart to: anEnd. ] @@ -35,21 +35,21 @@ GtCoderAstStyler >> attributes: anAttributesCollection from: aStart to: anEnd [ cr ]. ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderAstStyler >> coderViewModel [ ^ coderViewModel ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderAstStyler >> coderViewModel: anObject [ coderViewModel := anObject ] -{ #category : 'api - styling' } +{ #category : #'api - styling' } GtCoderAstStyler >> extraStyle: aText ast: theAst [ ] -{ #category : 'private' } +{ #category : #private } GtCoderAstStyler >> privateStyle: aText [ | theAst | @@ -75,7 +75,7 @@ GtCoderAstStyler >> privateStyle: aText [ ^ aText ] -{ #category : 'api - styling' } +{ #category : #'api - styling' } GtCoderAstStyler >> style: aText ast: theAst [ self subclassResponsibility ] diff --git a/src/GToolkit-Coder/GtCoderClassAdded.class.st b/src/GToolkit-Coder/GtCoderClassAdded.class.st index 673dfcdf3..392ddc817 100644 --- a/src/GToolkit-Coder/GtCoderClassAdded.class.st +++ b/src/GToolkit-Coder/GtCoderClassAdded.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtCoderClassAdded', - #superclass : 'GtCoderAnnouncement', + #name : #GtCoderClassAdded, + #superclass : #GtCoderAnnouncement, #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCoderClassRemoved.class.st b/src/GToolkit-Coder/GtCoderClassRemoved.class.st index 25e5d6e61..d516bfbad 100644 --- a/src/GToolkit-Coder/GtCoderClassRemoved.class.st +++ b/src/GToolkit-Coder/GtCoderClassRemoved.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtCoderClassRemoved', - #superclass : 'GtCoderAnnouncement', + #name : #GtCoderClassRemoved, + #superclass : #GtCoderAnnouncement, #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCoderClassRenamed.class.st b/src/GToolkit-Coder/GtCoderClassRenamed.class.st index 9431aa061..422dd580e 100644 --- a/src/GToolkit-Coder/GtCoderClassRenamed.class.st +++ b/src/GToolkit-Coder/GtCoderClassRenamed.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtCoderClassRenamed', - #superclass : 'GtCoderAnnouncement', + #name : #GtCoderClassRenamed, + #superclass : #GtCoderAnnouncement, #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCoderClassWithPackageCompletionStrategy.class.st b/src/GToolkit-Coder/GtCoderClassWithPackageCompletionStrategy.class.st index 9d82dfe54..084bfd05f 100644 --- a/src/GToolkit-Coder/GtCoderClassWithPackageCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtCoderClassWithPackageCompletionStrategy.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderClassWithPackageCompletionStrategy', - #superclass : 'GtCompletionStrategy', + #name : #GtCoderClassWithPackageCompletionStrategy, + #superclass : #GtCompletionStrategy, #instVars : [ 'allPackages', 'allClasses' @@ -8,24 +8,24 @@ Class { #category : 'GToolkit-Coder-Completion' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderClassWithPackageCompletionStrategy >> allClasses [ ^ allClasses ifNil: [ allClasses := GtPrefixTree withAll: Smalltalk globals classNames ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderClassWithPackageCompletionStrategy >> allPackages [ ^ allPackages ifNil: [ allPackages := GtPrefixTree withAll: RPackage organizer packageNames ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderClassWithPackageCompletionStrategy >> classesIn: aPackage [ ^ GtPrefixTree withAll: aPackage definedClassNames ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderClassWithPackageCompletionStrategy >> completionActionsFor: aText at: positionInteger max: maxInteger [ | currentInput completionActions delimitedIndex | currentInput := aText asString. @@ -62,12 +62,12 @@ GtCoderClassWithPackageCompletionStrategy >> completionActionsFor: aText at: pos ] -{ #category : 'testing' } +{ #category : #testing } GtCoderClassWithPackageCompletionStrategy >> hasCompletionEntryFor: aString [ ^ true ] -{ #category : 'testing' } +{ #category : #testing } GtCoderClassWithPackageCompletionStrategy >> hasCompletionsAt: anInteger in: aText [ ^ true ] diff --git a/src/GToolkit-Coder/GtCoderClassesHierarchyTree.class.st b/src/GToolkit-Coder/GtCoderClassesHierarchyTree.class.st index 9b8285b10..2a5aac34c 100644 --- a/src/GToolkit-Coder/GtCoderClassesHierarchyTree.class.st +++ b/src/GToolkit-Coder/GtCoderClassesHierarchyTree.class.st @@ -6,8 +6,8 @@ I am an inheritance hierachy tree that can be built from a collection of classes " Class { - #name : 'GtCoderClassesHierarchyTree', - #superclass : 'Object', + #name : #GtCoderClassesHierarchyTree, + #superclass : #Object, #instVars : [ 'rootClass', 'subclassTrees' @@ -15,7 +15,7 @@ Class { #category : 'GToolkit-Coder-Navigation - Model' } -{ #category : 'factory' } +{ #category : #factory } GtCoderClassesHierarchyTree class >> fromClasses: aCollectionOfClasses [ | aRootItem theSetOfClasses theRootTrees theSubclassTrees | @@ -32,7 +32,7 @@ GtCoderClassesHierarchyTree class >> fromClasses: aCollectionOfClasses [ ^ aRootItem ] -{ #category : 'factory' } +{ #category : #factory } GtCoderClassesHierarchyTree class >> hierarchyForClass: aClass [ | aRootNode aCurrentNode | aRootNode := self new. @@ -47,28 +47,28 @@ GtCoderClassesHierarchyTree class >> hierarchyForClass: aClass [ ^ aRootNode. ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderClassesHierarchyTree >> at: anIndex [ ^ self subclassTrees at: anIndex ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderClassesHierarchyTree >> classes [ ^ self subclassTrees collect: [ :eachTree | eachTree rootClass ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderClassesHierarchyTree >> first [ ^ self at: 1 ] -{ #category : 'gt-extension' } +{ #category : #'gt-extension' } GtCoderClassesHierarchyTree >> gtTreeFor: aView [ @@ -80,20 +80,20 @@ GtCoderClassesHierarchyTree >> gtTreeFor: aView [ expandUpTo: 1 ] -{ #category : 'testing' } +{ #category : #testing } GtCoderClassesHierarchyTree >> hasRootClass [ ^ rootClass isNotNil ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderClassesHierarchyTree >> initialize [ super initialize. subclassTrees := Array empty. ] -{ #category : 'printing' } +{ #category : #printing } GtCoderClassesHierarchyTree >> printOn: aStream [ self hasRootClass ifTrue: [ aStream print: self rootClass ] @@ -108,43 +108,43 @@ GtCoderClassesHierarchyTree >> printOn: aStream [ nextPut: $) ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderClassesHierarchyTree >> rootClass [ ^ rootClass ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderClassesHierarchyTree >> rootClass: aClass [ rootClass := aClass ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderClassesHierarchyTree >> size [ ^ subclassTrees size ] -{ #category : 'sorting' } +{ #category : #sorting } GtCoderClassesHierarchyTree >> sort: aBlock [ subclassTrees := subclassTrees sorted: [ :treeA :treeB | aBlock value: treeA rootClass value: treeB rootClass ]. subclassTrees do: [ :eachTree | eachTree sort: aBlock ] ] -{ #category : 'sorting' } +{ #category : #sorting } GtCoderClassesHierarchyTree >> sortByClassName [ self sort: [ :classA :classB | classA name < classB name ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderClassesHierarchyTree >> subclassTrees [ ^ subclassTrees ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderClassesHierarchyTree >> subclassTrees: aCollection [ subclassTrees := aCollection ] diff --git a/src/GToolkit-Coder/GtCoderCollapsedLabelChanged.class.st b/src/GToolkit-Coder/GtCoderCollapsedLabelChanged.class.st index 85a893297..8e0710b63 100644 --- a/src/GToolkit-Coder/GtCoderCollapsedLabelChanged.class.st +++ b/src/GToolkit-Coder/GtCoderCollapsedLabelChanged.class.st @@ -4,7 +4,7 @@ Is sent by the {{gtClass:GtSourceCoder}} when it thinks that the collapsed text " Class { - #name : 'GtCoderCollapsedLabelChanged', - #superclass : 'GtSourceCoderAnnouncement', + #name : #GtCoderCollapsedLabelChanged, + #superclass : #GtSourceCoderAnnouncement, #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCoderCommentStyler.class.st b/src/GToolkit-Coder/GtCoderCommentStyler.class.st index d718b4885..f1d9e6ad8 100644 --- a/src/GToolkit-Coder/GtCoderCommentStyler.class.st +++ b/src/GToolkit-Coder/GtCoderCommentStyler.class.st @@ -1,12 +1,12 @@ Class { - #name : 'GtCoderCommentStyler', - #superclass : 'GtRBASTStyler', + #name : #GtCoderCommentStyler, + #superclass : #GtRBASTStyler, #traits : 'TRBProgramNodeVisitor', #classTraits : 'TRBProgramNodeVisitor classTrait', #category : 'GToolkit-Coder-Styler/Highlighter' } -{ #category : 'visiting' } +{ #category : #visiting } GtCoderCommentStyler >> visitNode: aNode [ | comments | comments := aNode comments. diff --git a/src/GToolkit-Coder/GtCoderCompiledMethodSourceCode.class.st b/src/GToolkit-Coder/GtCoderCompiledMethodSourceCode.class.st index e36be9f99..389d8b8a2 100644 --- a/src/GToolkit-Coder/GtCoderCompiledMethodSourceCode.class.st +++ b/src/GToolkit-Coder/GtCoderCompiledMethodSourceCode.class.st @@ -4,44 +4,44 @@ I represent a source code of a method defined by a class and a selector " Class { - #name : 'GtCoderCompiledMethodSourceCode', - #superclass : 'GtCoderSourceCode', + #name : #GtCoderCompiledMethodSourceCode, + #superclass : #GtCoderSourceCode, #instVars : [ 'compiledMethod' ], #category : 'GToolkit-Coder-Coders' } -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderCompiledMethodSourceCode >> asAstCacheKey [ ^ compiledMethod ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderCompiledMethodSourceCode >> buildCollapsedText [ ^ compiledMethod selector asRopedText ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderCompiledMethodSourceCode >> buildSourceText [ ^ compiledMethod sourceCode asRopedText ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderCompiledMethodSourceCode >> compiledMethod [ ^ compiledMethod ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderCompiledMethodSourceCode >> compiledMethod: aCompiledMethod [ compiledMethod := aCompiledMethod ] -{ #category : 'testing' } +{ #category : #testing } GtCoderCompiledMethodSourceCode >> isModified [ ^ compiledMethod sourceCode ~= self sourceString ] diff --git a/src/GToolkit-Coder/GtCoderContextActionsChanged.class.st b/src/GToolkit-Coder/GtCoderContextActionsChanged.class.st index f2dd14ca3..9a2e6496f 100644 --- a/src/GToolkit-Coder/GtCoderContextActionsChanged.class.st +++ b/src/GToolkit-Coder/GtCoderContextActionsChanged.class.st @@ -7,7 +7,7 @@ Is announced by the {{gtClass:GtCoderModel}} when context actions change. " Class { - #name : 'GtCoderContextActionsChanged', - #superclass : 'GtCoderAnnouncement', + #name : #GtCoderContextActionsChanged, + #superclass : #GtCoderAnnouncement, #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCoderContextMenuAction.class.st b/src/GToolkit-Coder/GtCoderContextMenuAction.class.st index 3cc1e115e..2ae2a5fc2 100644 --- a/src/GToolkit-Coder/GtCoderContextMenuAction.class.st +++ b/src/GToolkit-Coder/GtCoderContextMenuAction.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderContextMenuAction', - #superclass : 'GtCoderAction', + #name : #GtCoderContextMenuAction, + #superclass : #GtCoderAction, #instVars : [ 'hoverAction', 'leaveAction' @@ -8,22 +8,22 @@ Class { #category : 'GToolkit-Coder' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderContextMenuAction >> hoverAction [ ^ hoverAction ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderContextMenuAction >> hoverAction: aBlock [ hoverAction := aBlock ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderContextMenuAction >> leaveAction [ ^ leaveAction ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderContextMenuAction >> leaveAction: aBlock [ leaveAction := aBlock ] diff --git a/src/GToolkit-Coder/GtCoderContextVariableStyler.class.st b/src/GToolkit-Coder/GtCoderContextVariableStyler.class.st index 52db6820c..f833f6b8b 100644 --- a/src/GToolkit-Coder/GtCoderContextVariableStyler.class.st +++ b/src/GToolkit-Coder/GtCoderContextVariableStyler.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderContextVariableStyler', - #superclass : 'GtRBASTStyler', + #name : #GtCoderContextVariableStyler, + #superclass : #GtRBASTStyler, #traits : 'TRBProgramNodeVisitor', #classTraits : 'TRBProgramNodeVisitor classTrait', #instVars : [ @@ -11,7 +11,7 @@ Class { #category : 'GToolkit-Coder-Styler/Highlighter' } -{ #category : 'testing' } +{ #category : #testing } GtCoderContextVariableStyler >> hasValueForVariableNamed: aVariableName [ ^ self valueForVariableNamed: aVariableName @@ -19,7 +19,7 @@ GtCoderContextVariableStyler >> hasValueForVariableNamed: aVariableName [ ifAbsent: [ false ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderContextVariableStyler >> initializeVariables [ variables notNil ifTrue: [ ^ self ]. @@ -31,29 +31,29 @@ GtCoderContextVariableStyler >> initializeVariables [ interval := methodCoder session pcRangeForContext: methodCoder context ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderContextVariableStyler >> methodCoder [ ^ methodCoder ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderContextVariableStyler >> methodCoder: aMethodCoder [ methodCoder := aMethodCoder ] -{ #category : 'styling' } +{ #category : #styling } GtCoderContextVariableStyler >> style: aText ast: ast [ aText clearAttributes: [ :each | each isKindOf: GtPlaygroundEvaluatedCodeButtonAttribute ]. self initializeVariables. super style: aText ast: ast ] -{ #category : 'styling' } +{ #category : #styling } GtCoderContextVariableStyler >> styleVariableNode: aVariableNode [ self subclassResponsibility ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderContextVariableStyler >> valueForVariableNamed: aVariableName ifPresent: presentBlock [ ^ self valueForVariableNamed: aVariableName @@ -61,7 +61,7 @@ GtCoderContextVariableStyler >> valueForVariableNamed: aVariableName ifPresent: ifAbsent: [ ^ self ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderContextVariableStyler >> valueForVariableNamed: aVariableName ifPresent: presentBlock ifAbsent: absentBloc [ ^ variables at: aVariableName @@ -70,17 +70,17 @@ GtCoderContextVariableStyler >> valueForVariableNamed: aVariableName ifPresent: ifAbsent: absentBloc ] -{ #category : 'visiting' } +{ #category : #visiting } GtCoderContextVariableStyler >> visitArgumentNode: anArgumentNode [ self styleVariableNode: anArgumentNode ] -{ #category : 'visiting' } +{ #category : #visiting } GtCoderContextVariableStyler >> visitInstanceVariableNode: aSelfNode [ self styleVariableNode: aSelfNode ] -{ #category : 'visiting' } +{ #category : #visiting } GtCoderContextVariableStyler >> visitTemporaryNode: aNode [ self styleVariableNode: aNode ] diff --git a/src/GToolkit-Coder/GtCoderCorrectionRequest.class.st b/src/GToolkit-Coder/GtCoderCorrectionRequest.class.st index d4ef80a2a..7cb9c603e 100644 --- a/src/GToolkit-Coder/GtCoderCorrectionRequest.class.st +++ b/src/GToolkit-Coder/GtCoderCorrectionRequest.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderCorrectionRequest', - #superclass : 'GtSourceCoderAnnouncement', + #name : #GtCoderCorrectionRequest, + #superclass : #GtSourceCoderAnnouncement, #instVars : [ 'fromIndex', 'toIndex', @@ -9,32 +9,32 @@ Class { #category : 'GToolkit-Coder-Event' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderCorrectionRequest >> correctionString [ ^ correctionString ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderCorrectionRequest >> correctionString: anObject [ correctionString := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderCorrectionRequest >> fromIndex [ ^ fromIndex ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderCorrectionRequest >> fromIndex: anObject [ fromIndex := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderCorrectionRequest >> toIndex [ ^ toIndex ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderCorrectionRequest >> toIndex: anObject [ toIndex := anObject ] diff --git a/src/GToolkit-Coder/GtCoderDropDownAction.class.st b/src/GToolkit-Coder/GtCoderDropDownAction.class.st index dd7b1dd2c..80309a279 100644 --- a/src/GToolkit-Coder/GtCoderDropDownAction.class.st +++ b/src/GToolkit-Coder/GtCoderDropDownAction.class.st @@ -1,18 +1,18 @@ Class { - #name : 'GtCoderDropDownAction', - #superclass : 'GtCoderAction', + #name : #GtCoderDropDownAction, + #superclass : #GtCoderAction, #instVars : [ 'stencil' ], #category : 'GToolkit-Coder' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderDropDownAction >> stencil [ ^ stencil ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderDropDownAction >> stencil: anObject [ stencil := anObject ] diff --git a/src/GToolkit-Coder/GtCoderDropDownWithPreviewAction.class.st b/src/GToolkit-Coder/GtCoderDropDownWithPreviewAction.class.st index eac38e52a..511bbd02f 100644 --- a/src/GToolkit-Coder/GtCoderDropDownWithPreviewAction.class.st +++ b/src/GToolkit-Coder/GtCoderDropDownWithPreviewAction.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderDropDownWithPreviewAction', - #superclass : 'GtCoderAction', + #name : #GtCoderDropDownWithPreviewAction, + #superclass : #GtCoderAction, #instVars : [ 'changeAction', 'changeStencil' @@ -8,22 +8,22 @@ Class { #category : 'GToolkit-Coder-GToolkit-Coder' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderDropDownWithPreviewAction >> changeAction [ ^ changeAction ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderDropDownWithPreviewAction >> changeAction: aBlock [ changeAction := aBlock ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderDropDownWithPreviewAction >> changeStencil [ ^ changeStencil ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderDropDownWithPreviewAction >> changeStencil: aBlock [ changeStencil := aBlock ] diff --git a/src/GToolkit-Coder/GtCoderEvaluationAnnouncement.class.st b/src/GToolkit-Coder/GtCoderEvaluationAnnouncement.class.st index 81f8cd05b..483616dbd 100644 --- a/src/GToolkit-Coder/GtCoderEvaluationAnnouncement.class.st +++ b/src/GToolkit-Coder/GtCoderEvaluationAnnouncement.class.st @@ -1,25 +1,25 @@ Class { - #name : 'GtCoderEvaluationAnnouncement', - #superclass : 'GtSourceCoderAnnouncement', + #name : #GtCoderEvaluationAnnouncement, + #superclass : #GtSourceCoderAnnouncement, #instVars : [ 'evaluationResult' ], #category : 'GToolkit-Coder-Event' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderEvaluationAnnouncement >> evaluationResult [ ^ evaluationResult ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderEvaluationAnnouncement >> evaluationResult: aGtSourceCoderEvaluationResult [ evaluationResult := aGtSourceCoderEvaluationResult ] -{ #category : 'testing' } +{ #category : #testing } GtCoderEvaluationAnnouncement >> isRequestedByElementOrItsChild: anElement [ "Return true if the evaluation ws requested by a given visual element or any of its children" @@ -33,7 +33,7 @@ GtCoderEvaluationAnnouncement >> isRequestedByElementOrItsChild: anElement [ ^ self requesterObject hasParent: anElement ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderEvaluationAnnouncement >> requesterObject [ ^ self evaluationResult requesterObject ] diff --git a/src/GToolkit-Coder/GtCoderEvaluationUnhandledError.class.st b/src/GToolkit-Coder/GtCoderEvaluationUnhandledError.class.st index 7a8cd1b09..0806ec52d 100644 --- a/src/GToolkit-Coder/GtCoderEvaluationUnhandledError.class.st +++ b/src/GToolkit-Coder/GtCoderEvaluationUnhandledError.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderEvaluationUnhandledError', - #superclass : 'UnhandledError', + #name : #GtCoderEvaluationUnhandledError, + #superclass : #UnhandledError, #instVars : [ 'sourceCoder', 'sourceString', @@ -9,7 +9,7 @@ Class { #category : 'GToolkit-Coder-Coders' } -{ #category : 'handling' } +{ #category : #handling } GtCoderEvaluationUnhandledError >> debug [ "Request a debugger on myself embedded in the given text editor" @@ -22,38 +22,38 @@ GtCoderEvaluationUnhandledError >> debug [ forException: self exception ] -{ #category : 'priv handling' } +{ #category : #'priv handling' } GtCoderEvaluationUnhandledError >> defaultAction [ ^ UIManager default unhandledErrorDefaultAction: self ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderEvaluationUnhandledError >> sourceCoder [ ^ sourceCoder ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderEvaluationUnhandledError >> sourceCoder: aSourceCoder [ sourceCoder := aSourceCoder ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderEvaluationUnhandledError >> sourceInterval [ ^ sourceInterval ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderEvaluationUnhandledError >> sourceInterval: anObject [ sourceInterval := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderEvaluationUnhandledError >> sourceString [ ^ sourceString ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderEvaluationUnhandledError >> sourceString: anObject [ sourceString := anObject ] diff --git a/src/GToolkit-Coder/GtCoderExampleExecuted.class.st b/src/GToolkit-Coder/GtCoderExampleExecuted.class.st index 19149fcfc..959cc9f79 100644 --- a/src/GToolkit-Coder/GtCoderExampleExecuted.class.st +++ b/src/GToolkit-Coder/GtCoderExampleExecuted.class.st @@ -5,21 +5,21 @@ I am used by {{gtClass:GtPharoMethodCoder}}, see {{gtMethod:GtPharoMethodCoder>> " Class { - #name : 'GtCoderExampleExecuted', - #superclass : 'GtSourceCoderAnnouncement', + #name : #GtCoderExampleExecuted, + #superclass : #GtSourceCoderAnnouncement, #instVars : [ 'example' ], #category : 'GToolkit-Coder-Event' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExampleExecuted >> example [ ^ example ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExampleExecuted >> example: aGtExampleWithResult [ self assert: [ aGtExampleWithResult isNotNil ] @@ -27,19 +27,19 @@ GtCoderExampleExecuted >> example: aGtExampleWithResult [ example := aGtExampleWithResult ] -{ #category : 'testing' } +{ #category : #testing } GtCoderExampleExecuted >> hasResult [ ^ self example hasResult ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExampleExecuted >> result [ ^ self example result ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExampleExecuted >> returnValue [ ^ self example returnValue ] diff --git a/src/GToolkit-Coder/GtCoderExampler.class.st b/src/GToolkit-Coder/GtCoderExampler.class.st index c00a67697..d08d697b9 100644 --- a/src/GToolkit-Coder/GtCoderExampler.class.st +++ b/src/GToolkit-Coder/GtCoderExampler.class.st @@ -5,57 +5,57 @@ I am used by {{gtClass:GtCodersModel}}, see: {{gtMethod:Behavior>>#gtCoderMethod " Class { - #name : 'GtCoderExampler', - #superclass : 'Object', + #name : #GtCoderExampler, + #superclass : #Object, #instVars : [ 'coder' ], #category : 'GToolkit-Coder-Exampler' } -{ #category : 'api - instance creation' } +{ #category : #'api - instance creation' } GtCoderExampler class >> coder: aCoder [ ^ self new coder: aCoder ] -{ #category : 'api - enumeration' } +{ #category : #'api - enumeration' } GtCoderExampler >> allExampleCodersDo: aBlock [ "iterate all coders with examples" self subclassResponsibility ] -{ #category : 'api - enumeration' } +{ #category : #'api - enumeration' } GtCoderExampler >> allExecutableExampleCodersDo: aBlock [ self allExampleCodersDo: [ :aCoder :anExample | aCoder canExecuteExample ifTrue: [ aBlock cull: aCoder cull: anExample ] ] ] -{ #category : 'api - enumeration' } +{ #category : #'api - enumeration' } GtCoderExampler >> allExecutableExampleCodersWithResultsDo: aBlock [ self allExecutableExampleCodersDo: [ :aCoder :anExample | aCoder exampleResult ifNotNil: [ :aResult | aBlock cull: aCoder cull: anExample cull: aResult ] ] ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderExampler >> coder [ ^ coder ] -{ #category : 'api - initialization' } +{ #category : #'api - initialization' } GtCoderExampler >> coder: anObject [ coder := anObject ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderExampler >> coderFor: aCompiledMethod [ ^ self subclassResponsibility ] -{ #category : 'api - testing' } +{ #category : #'api - testing' } GtCoderExampler >> hasErrorExamples [ self allExecutableExampleCodersWithResultsDo: [ :eachCoder | @@ -64,13 +64,13 @@ GtCoderExampler >> hasErrorExamples [ ^ false ] -{ #category : 'api - testing' } +{ #category : #'api - testing' } GtCoderExampler >> hasExamples [ self allExecutableExampleCodersDo: [ ^ true ]. ^ false ] -{ #category : 'api - testing' } +{ #category : #'api - testing' } GtCoderExampler >> hasFailureExamples [ self allExecutableExampleCodersWithResultsDo: [ :eachCoder | @@ -79,7 +79,7 @@ GtCoderExampler >> hasFailureExamples [ ^ false ] -{ #category : 'api - testing' } +{ #category : #'api - testing' } GtCoderExampler >> hasNotExecutedExamples [ self allExecutableExampleCodersDo: [ :eachCoder | @@ -88,13 +88,13 @@ GtCoderExampler >> hasNotExecutedExamples [ ^ false ] -{ #category : 'api - testing' } +{ #category : #'api - testing' } GtCoderExampler >> hasSelectedExecutableExamples [ self selectedExecutableExampleCodersDo: [ ^ true ]. ^ false ] -{ #category : 'api - testing' } +{ #category : #'api - testing' } GtCoderExampler >> hasSuccessExamples [ self allExecutableExampleCodersWithResultsDo: [ :eachCoder | @@ -103,7 +103,7 @@ GtCoderExampler >> hasSuccessExamples [ ^ false ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderExampler >> numberOfAllExamples [ | aTotal | @@ -113,7 +113,7 @@ GtCoderExampler >> numberOfAllExamples [ ^ aTotal ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderExampler >> numberOfErrorExamples [ | aTotal | @@ -124,7 +124,7 @@ GtCoderExampler >> numberOfErrorExamples [ ^ aTotal ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderExampler >> numberOfFailureExamples [ | aTotal | @@ -135,7 +135,7 @@ GtCoderExampler >> numberOfFailureExamples [ ^ aTotal ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderExampler >> numberOfNotExecutedExamples [ | aTotal | @@ -146,7 +146,7 @@ GtCoderExampler >> numberOfNotExecutedExamples [ ^ aTotal ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderExampler >> numberOfSuccessExamples [ | aTotal | @@ -157,39 +157,39 @@ GtCoderExampler >> numberOfSuccessExamples [ ^ aTotal ] -{ #category : 'api - execution' } +{ #category : #'api - execution' } GtCoderExampler >> runExamples [ self selectedExecutableExampleCodersDo: [ :eachCoder | (eachCoder isModified or: [ eachCoder example hasNoTestPragma ]) ifFalse: [ eachCoder example run ] ] ] -{ #category : 'api - execution' } +{ #category : #'api - execution' } GtCoderExampler >> runExamplesFrom: anElement [ self runExamples. ] -{ #category : 'api - execution' } +{ #category : #'api - execution' } GtCoderExampler >> runNoTestExamples [ self selectedExecutableExampleCodersDo: [ :eachCoder | (eachCoder isModified not and: [ eachCoder example hasNoTestPragma ]) ifTrue: [ eachCoder example run ] ] ] -{ #category : 'api - enumeration' } +{ #category : #'api - enumeration' } GtCoderExampler >> selectedExampleCodersDo: aBlock [ "iterate selected coders with examples" self subclassResponsibility ] -{ #category : 'api - enumeration' } +{ #category : #'api - enumeration' } GtCoderExampler >> selectedExecutableExampleCodersDo: aBlock [ self selectedExampleCodersDo: [ :aCoder :anExample | aCoder canExecuteExample ifTrue: [ aBlock cull: aCoder cull: anExample ] ] ] -{ #category : 'api - enumeration' } +{ #category : #'api - enumeration' } GtCoderExampler >> selectedExecutableExampleCodersWithResultsDo: aBlock [ self selectedExecutableExampleCodersDo: [ :aCoder :anExample | aCoder exampleResult ifNotNil: [ :aResult | diff --git a/src/GToolkit-Coder/GtCoderExplicitSourceCode.class.st b/src/GToolkit-Coder/GtCoderExplicitSourceCode.class.st index cfb32548c..24b790194 100644 --- a/src/GToolkit-Coder/GtCoderExplicitSourceCode.class.st +++ b/src/GToolkit-Coder/GtCoderExplicitSourceCode.class.st @@ -4,44 +4,44 @@ I represent an explicit source code that was provided as a string " Class { - #name : 'GtCoderExplicitSourceCode', - #superclass : 'GtCoderSourceCode', + #name : #GtCoderExplicitSourceCode, + #superclass : #GtCoderSourceCode, #instVars : [ 'source' ], #category : 'GToolkit-Coder-Coders' } -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderExplicitSourceCode >> asAstCacheKey [ ^ source ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderExplicitSourceCode >> buildCollapsedText [ ^ (self sourceString linesDo: [ :eachLine | eachLine trimmed ifNotEmpty: [ :aNonEmptyLine | ^ aNonEmptyLine ] ]) asRopedText ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderExplicitSourceCode >> buildSourceText [ ^ source asRopedText ] -{ #category : 'api - testing' } +{ #category : #'api - testing' } GtCoderExplicitSourceCode >> isModified [ ^ self source ~= self sourceString ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExplicitSourceCode >> source [ ^ source ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExplicitSourceCode >> source: aString [ source := aString ] diff --git a/src/GToolkit-Coder/GtCoderExplicitSourceText.class.st b/src/GToolkit-Coder/GtCoderExplicitSourceText.class.st index 2dad598c8..857aa4a04 100644 --- a/src/GToolkit-Coder/GtCoderExplicitSourceText.class.st +++ b/src/GToolkit-Coder/GtCoderExplicitSourceText.class.st @@ -1,42 +1,42 @@ Class { - #name : 'GtCoderExplicitSourceText', - #superclass : 'GtCoderSourceCode', + #name : #GtCoderExplicitSourceText, + #superclass : #GtCoderSourceCode, #instVars : [ 'text' ], #category : 'GToolkit-Coder-Coders' } -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderExplicitSourceText >> asAstCacheKey [ ^ text ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderExplicitSourceText >> buildCollapsedText [ ^ (self sourceString linesDo: [ :eachLine | eachLine trimmed ifNotEmpty: [ :aNonEmptyLine | ^ aNonEmptyLine ] ]) asRopedText ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderExplicitSourceText >> buildSourceText [ ^ text copy ] -{ #category : 'api - testing' } +{ #category : #'api - testing' } GtCoderExplicitSourceText >> isModified [ ^ self text rope ~= self sourceText rope ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExplicitSourceText >> text [ ^ text ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExplicitSourceText >> text: aStringOrText [ text := aStringOrText asRopedText ] diff --git a/src/GToolkit-Coder/GtCoderGrowingClassesHierarchyTree.class.st b/src/GToolkit-Coder/GtCoderGrowingClassesHierarchyTree.class.st index 6fdb07e47..1c3d6d4c9 100644 --- a/src/GToolkit-Coder/GtCoderGrowingClassesHierarchyTree.class.st +++ b/src/GToolkit-Coder/GtCoderGrowingClassesHierarchyTree.class.st @@ -7,26 +7,26 @@ I automatically compute subclasses on demand. " Class { - #name : 'GtCoderGrowingClassesHierarchyTree', - #superclass : 'GtCoderClassesHierarchyTree', + #name : #GtCoderGrowingClassesHierarchyTree, + #superclass : #GtCoderClassesHierarchyTree, #category : 'GToolkit-Coder-Navigation - Model' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderGrowingClassesHierarchyTree >> currentSize [ ^ self currentSubclassTrees size ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderGrowingClassesHierarchyTree >> currentSubclassTrees [ ^ subclassTrees ] -{ #category : 'gt-extension' } +{ #category : #'gt-extension' } GtCoderGrowingClassesHierarchyTree >> gtFixedTreeFor: aView [ @@ -38,7 +38,7 @@ GtCoderGrowingClassesHierarchyTree >> gtFixedTreeFor: aView [ expandUpTo: 1 ] -{ #category : 'gt-extension' } +{ #category : #'gt-extension' } GtCoderGrowingClassesHierarchyTree >> gtTreeFor: aView [ ^ (super gtTreeFor: aView) @@ -46,7 +46,7 @@ GtCoderGrowingClassesHierarchyTree >> gtTreeFor: aView [ priority: 2 ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderGrowingClassesHierarchyTree >> size [ @@ -55,7 +55,7 @@ GtCoderGrowingClassesHierarchyTree >> size [ ifFalse: [ super size ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderGrowingClassesHierarchyTree >> subclassTrees [ @@ -63,7 +63,7 @@ GtCoderGrowingClassesHierarchyTree >> subclassTrees [ ^ super subclassTrees ] -{ #category : 'updating' } +{ #category : #updating } GtCoderGrowingClassesHierarchyTree >> updateSubclasses [ self rootClass instanceSide hasSubclasses ifFalse: [ ^ self ]. subclassTrees := (self rootClass subclasses diff --git a/src/GToolkit-Coder/GtCoderInstanceVariableStyler.class.st b/src/GToolkit-Coder/GtCoderInstanceVariableStyler.class.st index eb1c16317..ec49111bf 100644 --- a/src/GToolkit-Coder/GtCoderInstanceVariableStyler.class.st +++ b/src/GToolkit-Coder/GtCoderInstanceVariableStyler.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtCoderInstanceVariableStyler', - #superclass : 'BlTextStyler', + #name : #GtCoderInstanceVariableStyler, + #superclass : #BlTextStyler, #category : 'GToolkit-Coder-Styler/Highlighter' } -{ #category : 'testing' } +{ #category : #testing } GtCoderInstanceVariableStyler >> isValidVariableName: aText [ @@ -16,7 +16,7 @@ GtCoderInstanceVariableStyler >> isValidVariableName: aText [ do: [ :anError | false ] ] -{ #category : 'private' } +{ #category : #private } GtCoderInstanceVariableStyler >> privateStyle: aText [ diff --git a/src/GToolkit-Coder/GtCoderMainActionsChanged.class.st b/src/GToolkit-Coder/GtCoderMainActionsChanged.class.st index 6be2a7373..fa49c8e87 100644 --- a/src/GToolkit-Coder/GtCoderMainActionsChanged.class.st +++ b/src/GToolkit-Coder/GtCoderMainActionsChanged.class.st @@ -7,7 +7,7 @@ Is announced by the {{gtClass:GtCoderModel}} when main actions change. " Class { - #name : 'GtCoderMainActionsChanged', - #superclass : 'GtCoderAnnouncement', + #name : #GtCoderMainActionsChanged, + #superclass : #GtCoderAnnouncement, #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCoderMethodAdded.class.st b/src/GToolkit-Coder/GtCoderMethodAdded.class.st index bfd538b8d..6d3119139 100644 --- a/src/GToolkit-Coder/GtCoderMethodAdded.class.st +++ b/src/GToolkit-Coder/GtCoderMethodAdded.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtCoderMethodAdded', - #superclass : 'GtCoderAnnouncement', + #name : #GtCoderMethodAdded, + #superclass : #GtCoderAnnouncement, #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCoderMethodModified.class.st b/src/GToolkit-Coder/GtCoderMethodModified.class.st index b2ebbf7c8..ed81d93a9 100644 --- a/src/GToolkit-Coder/GtCoderMethodModified.class.st +++ b/src/GToolkit-Coder/GtCoderMethodModified.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtCoderMethodModified', - #superclass : 'GtCoderAnnouncement', + #name : #GtCoderMethodModified, + #superclass : #GtCoderAnnouncement, #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCoderMethodRemoved.class.st b/src/GToolkit-Coder/GtCoderMethodRemoved.class.st index 456e5a506..6756a0f26 100644 --- a/src/GToolkit-Coder/GtCoderMethodRemoved.class.st +++ b/src/GToolkit-Coder/GtCoderMethodRemoved.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtCoderMethodRemoved', - #superclass : 'GtCoderAnnouncement', + #name : #GtCoderMethodRemoved, + #superclass : #GtCoderAnnouncement, #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCoderModel.class.st b/src/GToolkit-Coder/GtCoderModel.class.st index 19c350b8c..fd3895417 100644 --- a/src/GToolkit-Coder/GtCoderModel.class.st +++ b/src/GToolkit-Coder/GtCoderModel.class.st @@ -17,8 +17,8 @@ By default there are the following types of add-ons: " Class { - #name : 'GtCoderModel', - #superclass : 'Object', + #name : #GtCoderModel, + #superclass : #Object, #traits : 'TGtAnnouncer', #classTraits : 'TGtAnnouncer classTrait', #instVars : [ @@ -35,66 +35,66 @@ Class { #category : 'GToolkit-Coder-Coders' } -{ #category : 'class initialization' } +{ #category : #'class initialization' } GtCoderModel class >> initialize [ UniqueIdGenerator := BlUniqueIdGenerator new ] -{ #category : 'api - addons' } +{ #category : #'api - addons' } GtCoderModel >> addOns [ ^ extraAddOns ifNil: [ extraAddOns := self newAddOns ] ] -{ #category : 'api - addons' } +{ #category : #'api - addons' } GtCoderModel >> addOnsClass [ ^ GtCoderAddOns ] -{ #category : 'api - announcer' } +{ #category : #'api - announcer' } GtCoderModel >> announcer [ ^ announcer ] -{ #category : 'api - converting' } +{ #category : #'api - converting' } GtCoderModel >> asNewCoderModelWithSameSubject [ "Return new coder model with same subject (e.g., package, class, method)" ^ self subclassResponsibility ] -{ #category : 'api - attributes' } +{ #category : #'api - attributes' } GtCoderModel >> attributeNamed: aSymbol [ ^ attributes notNil ifTrue: [ attributes at: aSymbol ifAbsent: [ ] ] ] -{ #category : 'api - attributes' } +{ #category : #'api - attributes' } GtCoderModel >> attributeNamed: aSymbol ifAbsent: aBlock [ ^ attributes notNil ifTrue: [ attributes at: aSymbol ifAbsent: aBlock ] ifFalse: [ aBlock value ] ] -{ #category : 'api - attributes' } +{ #category : #'api - attributes' } GtCoderModel >> attributeNamed: aSymbol ifPresent: aPresentBlock ifAbsent: anAbsentBlock [ ^ attributes notNil ifTrue: [ attributes at: aSymbol ifPresent: aPresentBlock ifAbsent: anAbsentBlock ] ifFalse: [ anAbsentBlock value ] ] -{ #category : 'api - attributes' } +{ #category : #'api - attributes' } GtCoderModel >> attributeNamed: aSymbol put: anObject [ ^ self attributes at: aSymbol put: anObject ] -{ #category : 'api - attributes' } +{ #category : #'api - attributes' } GtCoderModel >> attributes [ ^ attributes ifNil: [ attributes := IdentityDictionary new ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderModel >> coderName [ "Return a short textual name of the coder. For example, class coder would return a class name, package coder returns a package name." @@ -103,17 +103,17 @@ GtCoderModel >> coderName [ ^ self class name ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderModel >> coders [ ^ self attributeNamed: #coders ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderModel >> coders: aCoders [ ^ self attributeNamed: #coders put: aCoders ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtCoderModel >> contextActions [ "Return a collection of contextual actions in the coder. They are renderred separately from mainActions" @@ -121,34 +121,34 @@ GtCoderModel >> contextActions [ ^ self addOns contextActions ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtCoderModel >> contextMenuActions [ ^ self addOns contextMenuActions ] -{ #category : 'mutual exclusion' } +{ #category : #'mutual exclusion' } GtCoderModel >> critical: aBlock [ ^ monitor critical: aBlock ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderModel >> expanded [ self deprecated: 'The expansion state was moved to the ViewModel' ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderModel >> expanded: aBoolean [ self deprecated: 'The expansion state was moved to the ViewModel' ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderModel >> id [ ^ id ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderModel >> initialize [ super initialize. @@ -159,15 +159,15 @@ GtCoderModel >> initialize [ self coderLook: self defaultCoderLook ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderModel >> initializeAddOns: addOns [ ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderModel >> initializeShortcuts: addOns [ ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtCoderModel >> mainActions [ "Return a collection of main actions in the coder, for example save" @@ -175,12 +175,12 @@ GtCoderModel >> mainActions [ ^ self addOns mainActions ] -{ #category : 'api - addons' } +{ #category : #'api - addons' } GtCoderModel >> newAddOns [ ^ self addOnsClass new ] -{ #category : 'elements' } +{ #category : #elements } GtCoderModel >> previewElement [ "Return a preview element for the Spotter" @@ -188,19 +188,19 @@ GtCoderModel >> previewElement [ ^ self asElement ] -{ #category : 'api - attributes' } +{ #category : #'api - attributes' } GtCoderModel >> removeAttributeNamed: aSymbol [ attributes isNil ifTrue: [ ^ self ]. attributes removeKey: aSymbol ifAbsent: [ ] ] -{ #category : 'elements' } +{ #category : #elements } GtCoderModel >> requestFocus [ self announce: (GtCoderRequestFocus new coder: self) ] -{ #category : 'api - addons' } +{ #category : #'api - addons' } GtCoderModel >> requestUpdateAddOns [ "Request addons to update due to some environmental changes (similar to requesting text to restyle). It is a responsibility of the Coder's Element to start the actual addon update (${method:GtCoderModel>>#updateAddOnsFrom:}$) which may happen in @@ -212,12 +212,12 @@ GtCoderModel >> requestUpdateAddOns [ self announce: (GtCoderAddOnsUpdateRequest new coder: self)" ] -{ #category : 'subscriptions' } +{ #category : #subscriptions } GtCoderModel >> subscribeToSystem [ "do nothing" ] -{ #category : 'subscriptions' } +{ #category : #subscriptions } GtCoderModel >> unsubscribeFromSystem [ SystemAnnouncer uniqueInstance unsubscribe: self ] diff --git a/src/GToolkit-Coder/GtCoderNavigationAnnouncement.class.st b/src/GToolkit-Coder/GtCoderNavigationAnnouncement.class.st index 481e96d99..8b47fd60a 100644 --- a/src/GToolkit-Coder/GtCoderNavigationAnnouncement.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationAnnouncement.class.st @@ -1,18 +1,18 @@ Class { - #name : 'GtCoderNavigationAnnouncement', - #superclass : 'Announcement', + #name : #GtCoderNavigationAnnouncement, + #superclass : #Announcement, #instVars : [ 'coder' ], #category : 'GToolkit-Coder-Navigation - Events' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationAnnouncement >> coder [ ^ coder ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationAnnouncement >> coder: aCoder [ coder := aCoder ] diff --git a/src/GToolkit-Coder/GtCoderNavigationClassAnnoucement.class.st b/src/GToolkit-Coder/GtCoderNavigationClassAnnoucement.class.st index 2bc79a5df..2e59f5fc4 100644 --- a/src/GToolkit-Coder/GtCoderNavigationClassAnnoucement.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationClassAnnoucement.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderNavigationClassAnnoucement', - #superclass : 'GtCoderNavigationSystemChangesAnnouncement', + #name : #GtCoderNavigationClassAnnoucement, + #superclass : #GtCoderNavigationSystemChangesAnnouncement, #instVars : [ 'package', 'tag', @@ -9,32 +9,32 @@ Class { #category : 'GToolkit-Coder-Navigation - Events' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationClassAnnoucement >> package [ ^ package ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationClassAnnoucement >> package: anObject [ package := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationClassAnnoucement >> tag [ ^ tag ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationClassAnnoucement >> tag: anObject [ tag := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationClassAnnoucement >> theClass [ ^ theClass ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationClassAnnoucement >> theClass: anObject [ theClass := anObject ] diff --git a/src/GToolkit-Coder/GtCoderNavigationClassModified.class.st b/src/GToolkit-Coder/GtCoderNavigationClassModified.class.st index f3364e6d4..77b59927f 100644 --- a/src/GToolkit-Coder/GtCoderNavigationClassModified.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationClassModified.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtCoderNavigationClassModified', - #superclass : 'GtCoderNavigationClassAnnoucement', + #name : #GtCoderNavigationClassModified, + #superclass : #GtCoderNavigationClassAnnoucement, #category : 'GToolkit-Coder-Navigation - Events' } diff --git a/src/GToolkit-Coder/GtCoderNavigationClassRenamed.class.st b/src/GToolkit-Coder/GtCoderNavigationClassRenamed.class.st index 682f8005a..3a629723f 100644 --- a/src/GToolkit-Coder/GtCoderNavigationClassRenamed.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationClassRenamed.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderNavigationClassRenamed', - #superclass : 'GtCoderNavigationClassAnnoucement', + #name : #GtCoderNavigationClassRenamed, + #superclass : #GtCoderNavigationClassAnnoucement, #instVars : [ 'oldName', 'newName' @@ -8,22 +8,22 @@ Class { #category : 'GToolkit-Coder-Navigation - Events' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationClassRenamed >> newName [ ^ newName ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationClassRenamed >> newName: anObject [ newName := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationClassRenamed >> oldName [ ^ oldName ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationClassRenamed >> oldName: anObject [ oldName := anObject ] diff --git a/src/GToolkit-Coder/GtCoderNavigationClassSelected.class.st b/src/GToolkit-Coder/GtCoderNavigationClassSelected.class.st index 5e97edf1b..49f8d5a18 100644 --- a/src/GToolkit-Coder/GtCoderNavigationClassSelected.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationClassSelected.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderNavigationClassSelected', - #superclass : 'GtCoderNavigationSelectionAnnouncement', + #name : #GtCoderNavigationClassSelected, + #superclass : #GtCoderNavigationSelectionAnnouncement, #instVars : [ 'theClass', 'package', @@ -9,34 +9,34 @@ Class { #category : 'GToolkit-Coder-Navigation - Events' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationClassSelected >> package [ ^ package ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationClassSelected >> package: anObject [ package := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationClassSelected >> tag [ ^ tag ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationClassSelected >> tag: anObject [ tag := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationClassSelected >> theClass [ ^ theClass ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationClassSelected >> theClass: anObject [ theClass := anObject ] diff --git a/src/GToolkit-Coder/GtCoderNavigationModel.class.st b/src/GToolkit-Coder/GtCoderNavigationModel.class.st index 74a58a353..44e62a2b3 100644 --- a/src/GToolkit-Coder/GtCoderNavigationModel.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationModel.class.st @@ -1,90 +1,90 @@ Class { - #name : 'GtCoderNavigationModel', - #superclass : 'Object', + #name : #GtCoderNavigationModel, + #superclass : #Object, #category : 'GToolkit-Coder-Navigation - Model' } -{ #category : 'factory' } +{ #category : #factory } GtCoderNavigationModel class >> null [ ^ GtCoderNullNavigationModel default ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderNavigationModel >> classesToShow [ ^ self subclassResponsibility ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderNavigationModel >> coderDo: aBlock [ self subclassResponsibility ] -{ #category : 'api - testing' } +{ #category : #'api - testing' } GtCoderNavigationModel >> hasSelectedClass [ ^ self subclassResponsibility ] -{ #category : 'api - testing' } +{ #category : #'api - testing' } GtCoderNavigationModel >> hasSelectedPackage [ ^ self subclassResponsibility ] -{ #category : 'api - testing' } +{ #category : #'api - testing' } GtCoderNavigationModel >> hasSelectedTag [ ^ self subclassResponsibility ] -{ #category : 'api - testing' } +{ #category : #'api - testing' } GtCoderNavigationModel >> isNavigationModel [ ^ true ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderNavigationModel >> packagesToShow [ ^ self subclassResponsibility ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtCoderNavigationModel >> selectClass: aClass [ self subclassResponsibility ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtCoderNavigationModel >> selectMethod: aCompiledMethod [ self subclassResponsibility ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtCoderNavigationModel >> selectPackage: aPackage [ self subclassResponsibility ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtCoderNavigationModel >> selectedClassDo: aBlock [ self subclassResponsibility ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtCoderNavigationModel >> selectedPackageDo: aBlock [ self subclassResponsibility ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtCoderNavigationModel >> selectedTagDo: aBlock [ self subclassResponsibility ] -{ #category : 'api - subscriptions' } +{ #category : #'api - subscriptions' } GtCoderNavigationModel >> subscribeToSystem [ "concrete models can subscribe to the system" ] -{ #category : 'api - subscriptions' } +{ #category : #'api - subscriptions' } GtCoderNavigationModel >> unsubscribeFromSystem [ "concrete models can unsubscribe from the system" ] diff --git a/src/GToolkit-Coder/GtCoderNavigationModelChangedAnnouncement.class.st b/src/GToolkit-Coder/GtCoderNavigationModelChangedAnnouncement.class.st index 19a13e314..4b422220d 100644 --- a/src/GToolkit-Coder/GtCoderNavigationModelChangedAnnouncement.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationModelChangedAnnouncement.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtCoderNavigationModelChangedAnnouncement', - #superclass : 'Announcement', + #name : #GtCoderNavigationModelChangedAnnouncement, + #superclass : #Announcement, #category : 'GToolkit-Coder-Announcements' } diff --git a/src/GToolkit-Coder/GtCoderNavigationPackageAnnoucement.class.st b/src/GToolkit-Coder/GtCoderNavigationPackageAnnoucement.class.st index cab85c271..3b7e7af2e 100644 --- a/src/GToolkit-Coder/GtCoderNavigationPackageAnnoucement.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationPackageAnnoucement.class.st @@ -1,23 +1,23 @@ Class { - #name : 'GtCoderNavigationPackageAnnoucement', - #superclass : 'GtCoderNavigationSystemChangesAnnouncement', + #name : #GtCoderNavigationPackageAnnoucement, + #superclass : #GtCoderNavigationSystemChangesAnnouncement, #instVars : [ 'package' ], #category : 'GToolkit-Coder-Navigation - Events' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationPackageAnnoucement class >> package: aRPackage [ ^ self new package: aRPackage ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationPackageAnnoucement >> package [ ^ package ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationPackageAnnoucement >> package: anObject [ package := anObject ] diff --git a/src/GToolkit-Coder/GtCoderNavigationPackageRegistered.class.st b/src/GToolkit-Coder/GtCoderNavigationPackageRegistered.class.st index be812256f..45739fc2e 100644 --- a/src/GToolkit-Coder/GtCoderNavigationPackageRegistered.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationPackageRegistered.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtCoderNavigationPackageRegistered', - #superclass : 'GtCoderNavigationPackageAnnoucement', + #name : #GtCoderNavigationPackageRegistered, + #superclass : #GtCoderNavigationPackageAnnoucement, #category : 'GToolkit-Coder-Navigation - Events' } diff --git a/src/GToolkit-Coder/GtCoderNavigationPackageRenamed.class.st b/src/GToolkit-Coder/GtCoderNavigationPackageRenamed.class.st index 1ddca6c28..65c2a77f6 100644 --- a/src/GToolkit-Coder/GtCoderNavigationPackageRenamed.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationPackageRenamed.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderNavigationPackageRenamed', - #superclass : 'GtCoderNavigationPackageAnnoucement', + #name : #GtCoderNavigationPackageRenamed, + #superclass : #GtCoderNavigationPackageAnnoucement, #instVars : [ 'oldName', 'newName' @@ -8,22 +8,22 @@ Class { #category : 'GToolkit-Coder-Navigation - Events' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationPackageRenamed >> newName [ ^ newName ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationPackageRenamed >> newName: anObject [ newName := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationPackageRenamed >> oldName [ ^ oldName ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationPackageRenamed >> oldName: anObject [ oldName := anObject ] diff --git a/src/GToolkit-Coder/GtCoderNavigationPackageSelected.class.st b/src/GToolkit-Coder/GtCoderNavigationPackageSelected.class.st index ce1d7bf31..fb3294d49 100644 --- a/src/GToolkit-Coder/GtCoderNavigationPackageSelected.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationPackageSelected.class.st @@ -1,20 +1,20 @@ Class { - #name : 'GtCoderNavigationPackageSelected', - #superclass : 'GtCoderNavigationSelectionAnnouncement', + #name : #GtCoderNavigationPackageSelected, + #superclass : #GtCoderNavigationSelectionAnnouncement, #instVars : [ 'package' ], #category : 'GToolkit-Coder-Navigation - Events' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationPackageSelected >> package [ ^ package ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationPackageSelected >> package: anObject [ package := anObject ] diff --git a/src/GToolkit-Coder/GtCoderNavigationPackageTagAdded.class.st b/src/GToolkit-Coder/GtCoderNavigationPackageTagAdded.class.st index 39238d681..4f29da578 100644 --- a/src/GToolkit-Coder/GtCoderNavigationPackageTagAdded.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationPackageTagAdded.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtCoderNavigationPackageTagAdded', - #superclass : 'GtCoderNavigationPackageTagAnnoucement', + #name : #GtCoderNavigationPackageTagAdded, + #superclass : #GtCoderNavigationPackageTagAnnoucement, #category : 'GToolkit-Coder-Navigation - Events' } diff --git a/src/GToolkit-Coder/GtCoderNavigationPackageTagAnnoucement.class.st b/src/GToolkit-Coder/GtCoderNavigationPackageTagAnnoucement.class.st index 5ef3119d0..ba7f0d612 100644 --- a/src/GToolkit-Coder/GtCoderNavigationPackageTagAnnoucement.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationPackageTagAnnoucement.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderNavigationPackageTagAnnoucement', - #superclass : 'GtCoderNavigationSystemChangesAnnouncement', + #name : #GtCoderNavigationPackageTagAnnoucement, + #superclass : #GtCoderNavigationSystemChangesAnnouncement, #instVars : [ 'package', 'tag' @@ -8,22 +8,22 @@ Class { #category : 'GToolkit-Coder-Navigation - Events' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationPackageTagAnnoucement >> package [ ^ package ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationPackageTagAnnoucement >> package: anObject [ package := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationPackageTagAnnoucement >> tag [ ^ tag ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationPackageTagAnnoucement >> tag: anObject [ tag := anObject ] diff --git a/src/GToolkit-Coder/GtCoderNavigationPackageTagRemoved.class.st b/src/GToolkit-Coder/GtCoderNavigationPackageTagRemoved.class.st index ab52de09a..b43a771db 100644 --- a/src/GToolkit-Coder/GtCoderNavigationPackageTagRemoved.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationPackageTagRemoved.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtCoderNavigationPackageTagRemoved', - #superclass : 'GtCoderNavigationPackageTagAnnoucement', + #name : #GtCoderNavigationPackageTagRemoved, + #superclass : #GtCoderNavigationPackageTagAnnoucement, #category : 'GToolkit-Coder-Navigation - Events' } diff --git a/src/GToolkit-Coder/GtCoderNavigationPackageTagSelected.class.st b/src/GToolkit-Coder/GtCoderNavigationPackageTagSelected.class.st index 9b901f1fc..079b12645 100644 --- a/src/GToolkit-Coder/GtCoderNavigationPackageTagSelected.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationPackageTagSelected.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderNavigationPackageTagSelected', - #superclass : 'GtCoderNavigationSelectionAnnouncement', + #name : #GtCoderNavigationPackageTagSelected, + #superclass : #GtCoderNavigationSelectionAnnouncement, #instVars : [ 'package', 'tag' @@ -8,24 +8,24 @@ Class { #category : 'GToolkit-Coder-Navigation - Events' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationPackageTagSelected >> package [ ^ package ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationPackageTagSelected >> package: anObject [ package := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationPackageTagSelected >> tag [ ^ tag ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationPackageTagSelected >> tag: anObject [ tag := anObject ] diff --git a/src/GToolkit-Coder/GtCoderNavigationPackageUnregistered.class.st b/src/GToolkit-Coder/GtCoderNavigationPackageUnregistered.class.st index 5dbca0b6d..3698d4622 100644 --- a/src/GToolkit-Coder/GtCoderNavigationPackageUnregistered.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationPackageUnregistered.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtCoderNavigationPackageUnregistered', - #superclass : 'GtCoderNavigationPackageAnnoucement', + #name : #GtCoderNavigationPackageUnregistered, + #superclass : #GtCoderNavigationPackageAnnoucement, #category : 'GToolkit-Coder-Navigation - Events' } diff --git a/src/GToolkit-Coder/GtCoderNavigationPackagesSelected.class.st b/src/GToolkit-Coder/GtCoderNavigationPackagesSelected.class.st index 33998a1ac..b08045679 100644 --- a/src/GToolkit-Coder/GtCoderNavigationPackagesSelected.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationPackagesSelected.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtCoderNavigationPackagesSelected', - #superclass : 'GtCoderNavigationSelectionAnnouncement', + #name : #GtCoderNavigationPackagesSelected, + #superclass : #GtCoderNavigationSelectionAnnouncement, #category : 'GToolkit-Coder-Navigation - Events' } diff --git a/src/GToolkit-Coder/GtCoderNavigationSelectionAnnouncement.class.st b/src/GToolkit-Coder/GtCoderNavigationSelectionAnnouncement.class.st index 08d1da9e9..35525460a 100644 --- a/src/GToolkit-Coder/GtCoderNavigationSelectionAnnouncement.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationSelectionAnnouncement.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtCoderNavigationSelectionAnnouncement', - #superclass : 'GtCoderNavigationAnnouncement', + #name : #GtCoderNavigationSelectionAnnouncement, + #superclass : #GtCoderNavigationAnnouncement, #category : 'GToolkit-Coder-Navigation - Events' } diff --git a/src/GToolkit-Coder/GtCoderNavigationSystemChangesAnnouncement.class.st b/src/GToolkit-Coder/GtCoderNavigationSystemChangesAnnouncement.class.st index d076cff07..506b36015 100644 --- a/src/GToolkit-Coder/GtCoderNavigationSystemChangesAnnouncement.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationSystemChangesAnnouncement.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtCoderNavigationSystemChangesAnnouncement', - #superclass : 'GtCoderNavigationAnnouncement', + #name : #GtCoderNavigationSystemChangesAnnouncement, + #superclass : #GtCoderNavigationAnnouncement, #category : 'GToolkit-Coder-Navigation - Events' } diff --git a/src/GToolkit-Coder/GtCoderNullNavigationModel.class.st b/src/GToolkit-Coder/GtCoderNullNavigationModel.class.st index ab0fb3eb5..c0afdd7b7 100644 --- a/src/GToolkit-Coder/GtCoderNullNavigationModel.class.st +++ b/src/GToolkit-Coder/GtCoderNullNavigationModel.class.st @@ -1,77 +1,77 @@ Class { - #name : 'GtCoderNullNavigationModel', - #superclass : 'GtCoderNavigationModel', + #name : #GtCoderNullNavigationModel, + #superclass : #GtCoderNavigationModel, #traits : 'TGtUniqueInstance', #classTraits : 'TGtUniqueInstance classTrait', #category : 'GToolkit-Coder-Navigation - Model' } -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderNullNavigationModel >> classesToShow [ ^ #() ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderNullNavigationModel >> coderDo: aBlock [ "do nothing" ] -{ #category : 'api - testing' } +{ #category : #'api - testing' } GtCoderNullNavigationModel >> hasSelectedClass [ ^ false ] -{ #category : 'api - testing' } +{ #category : #'api - testing' } GtCoderNullNavigationModel >> hasSelectedPackage [ ^ false ] -{ #category : 'api - testing' } +{ #category : #'api - testing' } GtCoderNullNavigationModel >> hasSelectedTag [ ^ false ] -{ #category : 'api - testing' } +{ #category : #'api - testing' } GtCoderNullNavigationModel >> isNavigationModel [ ^ false ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderNullNavigationModel >> packagesToShow [ ^ #() ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtCoderNullNavigationModel >> selectClass: aClass [ "do nothing" ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtCoderNullNavigationModel >> selectMethod: aCompiledMethod [ "do nothing" ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtCoderNullNavigationModel >> selectMethodProtocol: aMethodProtocol [ "do nothing" ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtCoderNullNavigationModel >> selectPackage: aPackage [ "do nothing" ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtCoderNullNavigationModel >> selectedClassDo: aBlock [ "do nothing" ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtCoderNullNavigationModel >> selectedPackageDo: aBlock [ "do nothing" ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtCoderNullNavigationModel >> selectedTagDo: aBlock [ "do nothing" ] diff --git a/src/GToolkit-Coder/GtCoderObjectSpawnRequest.class.st b/src/GToolkit-Coder/GtCoderObjectSpawnRequest.class.st index 766d7fe23..d55a7d84d 100644 --- a/src/GToolkit-Coder/GtCoderObjectSpawnRequest.class.st +++ b/src/GToolkit-Coder/GtCoderObjectSpawnRequest.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderObjectSpawnRequest', - #superclass : 'GtSourceCoderAnnouncement', + #name : #GtCoderObjectSpawnRequest, + #superclass : #GtSourceCoderAnnouncement, #instVars : [ 'object', 'spawnDestination' @@ -8,22 +8,22 @@ Class { #category : 'GToolkit-Coder-Event' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderObjectSpawnRequest >> object [ ^ object ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderObjectSpawnRequest >> object: anObject [ object := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderObjectSpawnRequest >> spawnDestination [ ^ spawnDestination ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderObjectSpawnRequest >> spawnDestination: anObject [ spawnDestination := anObject ] diff --git a/src/GToolkit-Coder/GtCoderPackageExtentionTag.class.st b/src/GToolkit-Coder/GtCoderPackageExtentionTag.class.st index 35a84beb5..bc0a9a2ae 100644 --- a/src/GToolkit-Coder/GtCoderPackageExtentionTag.class.st +++ b/src/GToolkit-Coder/GtCoderPackageExtentionTag.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderPackageExtentionTag', - #superclass : 'Object', + #name : #GtCoderPackageExtentionTag, + #superclass : #Object, #traits : 'TBlDebug', #classTraits : 'TBlDebug classTrait', #instVars : [ @@ -10,51 +10,51 @@ Class { #category : 'GToolkit-Coder-Navigation - Model' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtCoderPackageExtentionTag class >> forPackage: aRPackage [ ^ self new package: aRPackage. ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderPackageExtentionTag >> classes [ ^ classes ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderPackageExtentionTag >> classes: anObject [ classes := anObject ] -{ #category : 'testing' } +{ #category : #testing } GtCoderPackageExtentionTag >> hasExtendedClasses [ ^ self classes isNotEmpty ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderPackageExtentionTag >> name [ ^ 'Extensions' ] -{ #category : 'hooks' } +{ #category : #hooks } GtCoderPackageExtentionTag >> onPackageChange [ self classes: self package extendedClasses asArray ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderPackageExtentionTag >> package [ ^ package ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderPackageExtentionTag >> package: aRPackage [ package := aRPackage. self onPackageChange. ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderPackageExtentionTag >> packageName [ ^ self package name. ] diff --git a/src/GToolkit-Coder/GtCoderPackageRegistered.class.st b/src/GToolkit-Coder/GtCoderPackageRegistered.class.st index 27a9e61e3..5af3636fc 100644 --- a/src/GToolkit-Coder/GtCoderPackageRegistered.class.st +++ b/src/GToolkit-Coder/GtCoderPackageRegistered.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtCoderPackageRegistered', - #superclass : 'GtCoderAnnouncement', + #name : #GtCoderPackageRegistered, + #superclass : #GtCoderAnnouncement, #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCoderPackageRenamed.class.st b/src/GToolkit-Coder/GtCoderPackageRenamed.class.st index 16ce5be9d..6c73d3f61 100644 --- a/src/GToolkit-Coder/GtCoderPackageRenamed.class.st +++ b/src/GToolkit-Coder/GtCoderPackageRenamed.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtCoderPackageRenamed', - #superclass : 'GtCoderAnnouncement', + #name : #GtCoderPackageRenamed, + #superclass : #GtCoderAnnouncement, #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st b/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st index c1bbb2c4f..842b8a794 100644 --- a/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st +++ b/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderPackageUncategorizedTag', - #superclass : 'Object', + #name : #GtCoderPackageUncategorizedTag, + #superclass : #Object, #traits : 'TBlDebug', #classTraits : 'TBlDebug classTrait', #instVars : [ @@ -9,49 +9,49 @@ Class { #category : 'GToolkit-Coder-Navigation - Model' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtCoderPackageUncategorizedTag class >> forPackageTag: aRPackage [ ^ self new packageTag: aRPackage. ] -{ #category : 'comparing' } +{ #category : #comparing } GtCoderPackageUncategorizedTag >> = anObject [ ^ (self class = anObject class and: [ self packageTagName = anObject packageTagName ]) or: [ (anObject isKindOf: RPackageTag) and: [ self packageTagName = anObject name ] ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderPackageUncategorizedTag >> classes [ ^ self packageTag classes ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderPackageUncategorizedTag >> name [ ^ 'Uncategorized' ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderPackageUncategorizedTag >> package [ ^ self packageTag package ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderPackageUncategorizedTag >> packageName [ ^ self package name ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderPackageUncategorizedTag >> packageTag [ ^ packageTag ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderPackageUncategorizedTag >> packageTag: aRPackageTag [ packageTag := aRPackageTag. ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderPackageUncategorizedTag >> packageTagName [ ^ self packageTag name diff --git a/src/GToolkit-Coder/GtCoderPackageUnregistered.class.st b/src/GToolkit-Coder/GtCoderPackageUnregistered.class.st index b81d0b806..23927db82 100644 --- a/src/GToolkit-Coder/GtCoderPackageUnregistered.class.st +++ b/src/GToolkit-Coder/GtCoderPackageUnregistered.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtCoderPackageUnregistered', - #superclass : 'GtCoderAnnouncement', + #name : #GtCoderPackageUnregistered, + #superclass : #GtCoderAnnouncement, #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCoderPackageUpdatedAnnouncement.class.st b/src/GToolkit-Coder/GtCoderPackageUpdatedAnnouncement.class.st index 87222837a..ca8735ab2 100644 --- a/src/GToolkit-Coder/GtCoderPackageUpdatedAnnouncement.class.st +++ b/src/GToolkit-Coder/GtCoderPackageUpdatedAnnouncement.class.st @@ -4,20 +4,20 @@ I am sent by the {{gtClass:GtPharoBehaviorCoder}} when the current package chang " Class { - #name : 'GtCoderPackageUpdatedAnnouncement', - #superclass : 'Announcement', + #name : #GtCoderPackageUpdatedAnnouncement, + #superclass : #Announcement, #instVars : [ 'package' ], #category : 'GToolkit-Coder-Announcements' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderPackageUpdatedAnnouncement >> package [ ^ package ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderPackageUpdatedAnnouncement >> package: aRPackage [ package := aRPackage ] diff --git a/src/GToolkit-Coder/GtCoderParseError.class.st b/src/GToolkit-Coder/GtCoderParseError.class.st index c57cceb73..f2bae6aa3 100644 --- a/src/GToolkit-Coder/GtCoderParseError.class.st +++ b/src/GToolkit-Coder/GtCoderParseError.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderParseError', - #superclass : 'GtSourceCoderAnnouncement', + #name : #GtCoderParseError, + #superclass : #GtSourceCoderAnnouncement, #instVars : [ 'errorMessage', 'location' @@ -8,22 +8,22 @@ Class { #category : 'GToolkit-Coder-Event' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderParseError >> errorMessage [ ^ errorMessage ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderParseError >> errorMessage: anObject [ errorMessage := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderParseError >> location [ ^ location ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderParseError >> location: anObject [ location := anObject ] diff --git a/src/GToolkit-Coder/GtCoderPreview.class.st b/src/GToolkit-Coder/GtCoderPreview.class.st new file mode 100644 index 000000000..558368f9f --- /dev/null +++ b/src/GToolkit-Coder/GtCoderPreview.class.st @@ -0,0 +1,34 @@ +Class { + #name : #GtCoderPreview, + #superclass : #Object, + #instVars : [ + 'title', + 'stencilBuilder' + ], + #category : #'GToolkit-Coder' +} + +{ #category : #accessing } +GtCoderPreview >> stencil: aStencilBuilder [ + + stencilBuilder := aStencilBuilder asStencilBuilder: + GtCoderPreviewStencilBuilder +] + +{ #category : #accessing } +GtCoderPreview >> stencilBuilder [ + + ^ stencilBuilder +] + +{ #category : #accessing } +GtCoderPreview >> title [ + + ^ title +] + +{ #category : #accessing } +GtCoderPreview >> title: aString [ + + title := aString +] diff --git a/src/GToolkit-Coder/GtCoderPreviewStencilBuilder.class.st b/src/GToolkit-Coder/GtCoderPreviewStencilBuilder.class.st new file mode 100644 index 000000000..e51b07986 --- /dev/null +++ b/src/GToolkit-Coder/GtCoderPreviewStencilBuilder.class.st @@ -0,0 +1,38 @@ +Class { + #name : #GtCoderPreviewStencilBuilder, + #superclass : #BrStencilBuilder, + #instVars : [ + 'coderUIModel' + ], + #category : #'GToolkit-Coder' +} + +{ #category : #'api - instantiation' } +GtCoderPreviewStencilBuilder >> buildDefault [ + + + ^ BlElement new size: 0@0 +] + +{ #category : #accessing } +GtCoderPreviewStencilBuilder >> coderUIModel [ + ^ coderUIModel +] + +{ #category : #accessing } +GtCoderPreviewStencilBuilder >> coderUIModel: aCoderUIModel [ + coderUIModel := aCoderUIModel +] + +{ #category : #'api - instantiation' } +GtCoderPreviewStencilBuilder >> paramsOn: aStencilExecutor [ + super paramsOn: aStencilExecutor. + aStencilExecutor + push: self coderUIModel +] + +{ #category : #initialization } +GtCoderPreviewStencilBuilder >> reset [ + super reset. + coderUIModel := nil. +] diff --git a/src/GToolkit-Coder/GtCoderPrintAnnouncement.class.st b/src/GToolkit-Coder/GtCoderPrintAnnouncement.class.st index d7709d682..d75306ec6 100644 --- a/src/GToolkit-Coder/GtCoderPrintAnnouncement.class.st +++ b/src/GToolkit-Coder/GtCoderPrintAnnouncement.class.st @@ -1,20 +1,20 @@ Class { - #name : 'GtCoderPrintAnnouncement', - #superclass : 'GtSourceCoderAnnouncement', + #name : #GtCoderPrintAnnouncement, + #superclass : #GtSourceCoderAnnouncement, #instVars : [ 'evaluationResult' ], #category : 'GToolkit-Coder-Event' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderPrintAnnouncement >> evaluationResult [ ^ evaluationResult ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderPrintAnnouncement >> evaluationResult: aGtSourceCoderEvaluationResult [ evaluationResult := aGtSourceCoderEvaluationResult ] diff --git a/src/GToolkit-Coder/GtCoderRefreshStackAnnouncement.class.st b/src/GToolkit-Coder/GtCoderRefreshStackAnnouncement.class.st index 86aeadd4f..381a2d11c 100644 --- a/src/GToolkit-Coder/GtCoderRefreshStackAnnouncement.class.st +++ b/src/GToolkit-Coder/GtCoderRefreshStackAnnouncement.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtCoderRefreshStackAnnouncement', - #superclass : 'Announcement', + #name : #GtCoderRefreshStackAnnouncement, + #superclass : #Announcement, #category : 'GToolkit-Coder-Announcements' } diff --git a/src/GToolkit-Coder/GtCoderRenameMethodChange.class.st b/src/GToolkit-Coder/GtCoderRenameMethodChange.class.st index 8a56dc522..21155dad1 100644 --- a/src/GToolkit-Coder/GtCoderRenameMethodChange.class.st +++ b/src/GToolkit-Coder/GtCoderRenameMethodChange.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderRenameMethodChange', - #superclass : 'RBRefactoryChange', + #name : #GtCoderRenameMethodChange, + #superclass : #RBRefactoryChange, #instVars : [ 'methodCoder', 'newSelector', @@ -9,7 +9,7 @@ Class { #category : 'GToolkit-Coder-Refactoring' } -{ #category : 'private' } +{ #category : #private } GtCoderRenameMethodChange >> executeNotifying: aBlock [ | undo | undo := self class new @@ -25,42 +25,42 @@ GtCoderRenameMethodChange >> executeNotifying: aBlock [ ^ undo ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderRenameMethodChange >> methodCoder [ ^ methodCoder ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderRenameMethodChange >> methodCoder: anObject [ methodCoder := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderRenameMethodChange >> newSelector [ ^ newSelector ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderRenameMethodChange >> newSelector: anObject [ newSelector := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderRenameMethodChange >> oldSelector [ ^ oldSelector ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderRenameMethodChange >> oldSelector: anObject [ oldSelector := anObject ] -{ #category : 'private' } +{ #category : #private } GtCoderRenameMethodChange >> primitiveExecute [ methodCoder selector: self newSelector ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderRenameMethodChange >> renameChangesForClass: oldClassName to: newClassName [ ] diff --git a/src/GToolkit-Coder/GtCoderRenameMethodRefactoring.class.st b/src/GToolkit-Coder/GtCoderRenameMethodRefactoring.class.st index b6fb1d6da..5553974bd 100644 --- a/src/GToolkit-Coder/GtCoderRenameMethodRefactoring.class.st +++ b/src/GToolkit-Coder/GtCoderRenameMethodRefactoring.class.st @@ -1,23 +1,23 @@ Class { - #name : 'GtCoderRenameMethodRefactoring', - #superclass : 'RBRenameMethodRefactoring', + #name : #GtCoderRenameMethodRefactoring, + #superclass : #RBRenameMethodRefactoring, #instVars : [ 'methodCoder' ], #category : 'GToolkit-Coder-Refactoring' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderRenameMethodRefactoring >> methodCoder [ ^ methodCoder ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderRenameMethodRefactoring >> methodCoder: anObject [ methodCoder := anObject ] -{ #category : 'transforming' } +{ #category : #transforming } GtCoderRenameMethodRefactoring >> transform [ self changes addChange: (GtCoderRenameMethodChange new methodCoder: self methodCoder; diff --git a/src/GToolkit-Coder/GtCoderRenameTemporaryRequestedAnnouncement.class.st b/src/GToolkit-Coder/GtCoderRenameTemporaryRequestedAnnouncement.class.st index a2ae354b1..bb7a6940e 100644 --- a/src/GToolkit-Coder/GtCoderRenameTemporaryRequestedAnnouncement.class.st +++ b/src/GToolkit-Coder/GtCoderRenameTemporaryRequestedAnnouncement.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderRenameTemporaryRequestedAnnouncement', - #superclass : 'GtSourceCoderAnnouncement', + #name : #GtCoderRenameTemporaryRequestedAnnouncement, + #superclass : #GtSourceCoderAnnouncement, #instVars : [ 'variableName', 'interestedCoders' @@ -8,23 +8,23 @@ Class { #category : 'GToolkit-Coder-Event' } -{ #category : 'initialization' } +{ #category : #initialization } GtCoderRenameTemporaryRequestedAnnouncement >> initialize [ super initialize. interestedCoders := OrderedCollection new ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderRenameTemporaryRequestedAnnouncement >> interestedCoders [ ^ interestedCoders ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderRenameTemporaryRequestedAnnouncement >> variableName [ ^ variableName ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderRenameTemporaryRequestedAnnouncement >> variableName: aString [ variableName := aString ] diff --git a/src/GToolkit-Coder/GtCoderRequestFocus.class.st b/src/GToolkit-Coder/GtCoderRequestFocus.class.st index 1e44404fe..983d1a7a2 100644 --- a/src/GToolkit-Coder/GtCoderRequestFocus.class.st +++ b/src/GToolkit-Coder/GtCoderRequestFocus.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtCoderRequestFocus', - #superclass : 'GtCoderAnnouncement', + #name : #GtCoderRequestFocus, + #superclass : #GtCoderAnnouncement, #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCoderShowDebuggerRequest.class.st b/src/GToolkit-Coder/GtCoderShowDebuggerRequest.class.st index 71283ae0b..6940fc406 100644 --- a/src/GToolkit-Coder/GtCoderShowDebuggerRequest.class.st +++ b/src/GToolkit-Coder/GtCoderShowDebuggerRequest.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderShowDebuggerRequest', - #superclass : 'GtSourceCoderAnnouncement', + #name : #GtCoderShowDebuggerRequest, + #superclass : #GtSourceCoderAnnouncement, #instVars : [ 'debugSession', 'exception', @@ -10,42 +10,42 @@ Class { #category : 'GToolkit-Coder-Event' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderShowDebuggerRequest >> debugSession [ ^ debugSession ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderShowDebuggerRequest >> debugSession: anObject [ debugSession := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderShowDebuggerRequest >> exception [ ^ exception ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderShowDebuggerRequest >> exception: anObject [ exception := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderShowDebuggerRequest >> sourceInterval [ ^ sourceInterval ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderShowDebuggerRequest >> sourceInterval: anObject [ sourceInterval := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderShowDebuggerRequest >> sourceString [ ^ sourceString ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderShowDebuggerRequest >> sourceString: anObject [ sourceString := anObject ] diff --git a/src/GToolkit-Coder/GtCoderSourceCode.class.st b/src/GToolkit-Coder/GtCoderSourceCode.class.st index f46ce0cd4..13e4477cf 100644 --- a/src/GToolkit-Coder/GtCoderSourceCode.class.st +++ b/src/GToolkit-Coder/GtCoderSourceCode.class.st @@ -4,8 +4,8 @@ I represent a source code of the {{gtClass:GtSourceCoder}}. For performance reas " Class { - #name : 'GtCoderSourceCode', - #superclass : 'Object', + #name : #GtCoderSourceCode, + #superclass : #Object, #instVars : [ 'monitor', 'sourceText', @@ -14,84 +14,84 @@ Class { #category : 'GToolkit-Coder-Coders' } -{ #category : 'api - text' } +{ #category : #'api - text' } GtCoderSourceCode >> appendString: aString [ self critical: [ self sourceText appendString: aString ] ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtCoderSourceCode >> appendText: aText [ self critical: [ self sourceText append: aText ] ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderSourceCode >> asAstCacheKey [ ^ self subclassResponsibility ] -{ #category : 'api - converting' } +{ #category : #'api - converting' } GtCoderSourceCode >> asCompiledMethodSourceCode: aCompiledMethod [ ^ (GtCoderCompiledMethodSourceCode new fromSourceCode: self) compiledMethod: aCompiledMethod ] -{ #category : 'api - converting' } +{ #category : #'api - converting' } GtCoderSourceCode >> asExplicitSourceCode: aString [ ^ (GtCoderExplicitSourceCode new fromSourceCode: self) source: aString ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderSourceCode >> buildCollapsedText [ ^ self subclassResponsibility ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderSourceCode >> buildSourceText [ ^ self subclassResponsibility ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderSourceCode >> collapsedText [ ^ self critical: [ collapsedText ifNil: [ collapsedText := self buildCollapsedText ] ] ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderSourceCode >> collapsedTextDo: aBlock [ "Evaluate a given block with my source code if present" ^ self critical: [ collapsedText ifNotNil: aBlock ] ] -{ #category : 'mutual exclusion' } +{ #category : #'mutual exclusion' } GtCoderSourceCode >> critical: aBlock [ ^ monitor critical: aBlock ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtCoderSourceCode >> currentSourceString: aString [ "Set a new source text" self critical: [ sourceText := aString asRopedText ] ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtCoderSourceCode >> currentSourceText: aText [ "Set a new source text" self critical: [ sourceText := aText copyWithoutExternalReferences ] ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtCoderSourceCode >> delete: aFromIndex to: aToIndex [ self sourceTextDo: [ :aText | aText delete: aFromIndex to: aToIndex ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderSourceCode >> fromSourceCode: aGtCoderSourceCode [ sourceText := nil. collapsedText := nil. @@ -100,52 +100,52 @@ GtCoderSourceCode >> fromSourceCode: aGtCoderSourceCode [ aGtCoderSourceCode collapsedTextDo: [ :aCollapsedText | collapsedText := aCollapsedText ]. ] -{ #category : 'api - testing' } +{ #category : #'api - testing' } GtCoderSourceCode >> hasCollapsedText [ ^ self critical: [ collapsedText notNil ] ] -{ #category : 'api - testing' } +{ #category : #'api - testing' } GtCoderSourceCode >> hasSourceText [ ^ self critical: [ sourceText notNil ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderSourceCode >> initialize [ super initialize. monitor := Monitor new ] -{ #category : 'api - testing' } +{ #category : #'api - testing' } GtCoderSourceCode >> isModified [ ^ self subclassResponsibility ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtCoderSourceCode >> replaceFrom: aFromIndex to: aToIndex withString: aString [ self critical: [ self sourceText replace: aFromIndex to: aToIndex withString: aString ] ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtCoderSourceCode >> resetCollapsedText [ "Remove the cached collapsed text forcing it to be recomputed next time it is accessed" collapsedText := nil ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtCoderSourceCode >> resetSourceText [ "Remove the cached source text forcing it to be recomputed next time it is accessed" sourceText := nil ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderSourceCode >> sourceString [ "Return a string representation of the current source text" @@ -153,19 +153,19 @@ GtCoderSourceCode >> sourceString [ ^ self critical: [ self sourceText asString ] ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderSourceCode >> sourceText [ ^ self critical: [ sourceText ifNil: [ sourceText := self buildSourceText ] ] ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderSourceCode >> sourceText: aText [ self critical: [ sourceText := aText copyWithoutExternalReferences ] ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderSourceCode >> sourceTextDo: aBlock [ "Evaluate a given block with my source code if present" diff --git a/src/GToolkit-Coder/GtCoderSourceCodeChanged.class.st b/src/GToolkit-Coder/GtCoderSourceCodeChanged.class.st index 65c8100ac..230ab207e 100644 --- a/src/GToolkit-Coder/GtCoderSourceCodeChanged.class.st +++ b/src/GToolkit-Coder/GtCoderSourceCodeChanged.class.st @@ -4,31 +4,31 @@ Is sent when coder's source code changes " Class { - #name : 'GtCoderSourceCodeChanged', - #superclass : 'GtSourceCoderAnnouncement', + #name : #GtCoderSourceCodeChanged, + #superclass : #GtSourceCoderAnnouncement, #instVars : [ 'updateStragegy' ], #category : 'GToolkit-Coder-Event' } -{ #category : 'testing' } +{ #category : #testing } GtCoderSourceCodeChanged >> isSynchronous [ ^ self updateStrategy notNil and: [ self updateStrategy isSynchronous ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderSourceCodeChanged >> source [ ^ self updateStrategy source ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderSourceCodeChanged >> updateStrategy [ ^ updateStragegy ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderSourceCodeChanged >> updateStrategy: anUpdateStragegy [ updateStragegy := anUpdateStragegy ] diff --git a/src/GToolkit-Coder/GtCoderStyleTextRequest.class.st b/src/GToolkit-Coder/GtCoderStyleTextRequest.class.st index 46158f28c..e6c4a7bf4 100644 --- a/src/GToolkit-Coder/GtCoderStyleTextRequest.class.st +++ b/src/GToolkit-Coder/GtCoderStyleTextRequest.class.st @@ -5,20 +5,20 @@ One of the usecases is to restyle the text after execution of a `gtExample` " Class { - #name : 'GtCoderStyleTextRequest', - #superclass : 'GtSourceCoderAnnouncement', + #name : #GtCoderStyleTextRequest, + #superclass : #GtSourceCoderAnnouncement, #instVars : [ 'afterAction' ], #category : 'GToolkit-Coder-Event' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderStyleTextRequest >> afterAction [ ^ afterAction ifNil: [ [ :aStyleText | "do nothing" ] ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderStyleTextRequest >> afterAction: aBlock [ afterAction := aBlock ] diff --git a/src/GToolkit-Coder/GtCoderStylerChanged.class.st b/src/GToolkit-Coder/GtCoderStylerChanged.class.st index 06a2d9c34..6dbd5d37a 100644 --- a/src/GToolkit-Coder/GtCoderStylerChanged.class.st +++ b/src/GToolkit-Coder/GtCoderStylerChanged.class.st @@ -7,20 +7,20 @@ Is announced by the {{gtClass:GtCoderModel}} when stylers change. " Class { - #name : 'GtCoderStylerChanged', - #superclass : 'GtSourceCoderAnnouncement', + #name : #GtCoderStylerChanged, + #superclass : #GtSourceCoderAnnouncement, #instVars : [ 'stylers' ], #category : 'GToolkit-Coder-Event' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderStylerChanged >> stylers [ ^ stylers ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderStylerChanged >> stylers: anObject [ stylers := anObject ] diff --git a/src/GToolkit-Coder/GtCoderToolSpawnRequest.class.st b/src/GToolkit-Coder/GtCoderToolSpawnRequest.class.st index d33c0db17..6e421e2e4 100644 --- a/src/GToolkit-Coder/GtCoderToolSpawnRequest.class.st +++ b/src/GToolkit-Coder/GtCoderToolSpawnRequest.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderToolSpawnRequest', - #superclass : 'GtSourceCoderAnnouncement', + #name : #GtCoderToolSpawnRequest, + #superclass : #GtSourceCoderAnnouncement, #instVars : [ 'tool', 'spawnDestination' @@ -8,22 +8,22 @@ Class { #category : 'GToolkit-Coder-Event' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderToolSpawnRequest >> spawnDestination [ ^ spawnDestination ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderToolSpawnRequest >> spawnDestination: anObject [ spawnDestination := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderToolSpawnRequest >> tool [ ^ tool ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderToolSpawnRequest >> tool: anObject [ tool := anObject ] diff --git a/src/GToolkit-Coder/GtCoderUpdateStrategy.class.st b/src/GToolkit-Coder/GtCoderUpdateStrategy.class.st index e1da74298..9041987fd 100644 --- a/src/GToolkit-Coder/GtCoderUpdateStrategy.class.st +++ b/src/GToolkit-Coder/GtCoderUpdateStrategy.class.st @@ -6,8 +6,8 @@ Currently I indicate if code should be changed syncronously or asyncronously. " Class { - #name : 'GtCoderUpdateStrategy', - #superclass : 'Object', + #name : #GtCoderUpdateStrategy, + #superclass : #Object, #instVars : [ 'announcementSource', 'isSynchronous' @@ -15,32 +15,32 @@ Class { #category : 'GToolkit-Coder-Coders' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderUpdateStrategy >> isSynchronous [ ^ isSynchronous ifNil: [ false ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderUpdateStrategy >> isSynchronous: anObject [ isSynchronous := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderUpdateStrategy >> makeAsynchronous [ isSynchronous := false ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderUpdateStrategy >> makeSynchronous [ isSynchronous := true ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderUpdateStrategy >> source [ ^ announcementSource ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderUpdateStrategy >> source: anObject [ announcementSource := anObject ] diff --git a/src/GToolkit-Coder/GtCodersAnnouncement.class.st b/src/GToolkit-Coder/GtCodersAnnouncement.class.st index 5375266d8..f4c8b8b22 100644 --- a/src/GToolkit-Coder/GtCodersAnnouncement.class.st +++ b/src/GToolkit-Coder/GtCodersAnnouncement.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCodersAnnouncement', - #superclass : 'Announcement', + #name : #GtCodersAnnouncement, + #superclass : #Announcement, #instVars : [ 'coders', 'source' @@ -8,22 +8,22 @@ Class { #category : 'GToolkit-Coder-Event' } -{ #category : 'accessing' } +{ #category : #accessing } GtCodersAnnouncement >> coders [ ^ coders ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodersAnnouncement >> coders: anObject [ coders := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodersAnnouncement >> source [ ^ source ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodersAnnouncement >> source: anObject [ source := anObject ] diff --git a/src/GToolkit-Coder/GtCodersCoderAdded.class.st b/src/GToolkit-Coder/GtCodersCoderAdded.class.st index d833e5523..bd369ec15 100644 --- a/src/GToolkit-Coder/GtCodersCoderAdded.class.st +++ b/src/GToolkit-Coder/GtCodersCoderAdded.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtCodersCoderAdded', - #superclass : 'GtCodersCoderAnnouncement', + #name : #GtCodersCoderAdded, + #superclass : #GtCodersCoderAnnouncement, #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCodersCoderAnnouncement.class.st b/src/GToolkit-Coder/GtCodersCoderAnnouncement.class.st index 1677998ce..03cbc279b 100644 --- a/src/GToolkit-Coder/GtCodersCoderAnnouncement.class.st +++ b/src/GToolkit-Coder/GtCodersCoderAnnouncement.class.st @@ -1,18 +1,18 @@ Class { - #name : 'GtCodersCoderAnnouncement', - #superclass : 'GtCodersAnnouncement', + #name : #GtCodersCoderAnnouncement, + #superclass : #GtCodersAnnouncement, #instVars : [ 'coder' ], #category : 'GToolkit-Coder-Event' } -{ #category : 'accessing' } +{ #category : #accessing } GtCodersCoderAnnouncement >> coder [ ^ coder ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodersCoderAnnouncement >> coder: anObject [ coder := anObject ] diff --git a/src/GToolkit-Coder/GtCodersCoderRemoved.class.st b/src/GToolkit-Coder/GtCodersCoderRemoved.class.st index da15d1598..987b66328 100644 --- a/src/GToolkit-Coder/GtCodersCoderRemoved.class.st +++ b/src/GToolkit-Coder/GtCodersCoderRemoved.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtCodersCoderRemoved', - #superclass : 'GtCodersCoderAnnouncement', + #name : #GtCodersCoderRemoved, + #superclass : #GtCodersCoderAnnouncement, #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCodersCodersChanged.class.st b/src/GToolkit-Coder/GtCodersCodersChanged.class.st index 2711eb767..2b0feba21 100644 --- a/src/GToolkit-Coder/GtCodersCodersChanged.class.st +++ b/src/GToolkit-Coder/GtCodersCodersChanged.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtCodersCodersChanged', - #superclass : 'GtCodersAnnouncement', + #name : #GtCodersCodersChanged, + #superclass : #GtCodersAnnouncement, #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCodersFiltersChanged.class.st b/src/GToolkit-Coder/GtCodersFiltersChanged.class.st index a5069f423..b2065a36c 100644 --- a/src/GToolkit-Coder/GtCodersFiltersChanged.class.st +++ b/src/GToolkit-Coder/GtCodersFiltersChanged.class.st @@ -1,23 +1,23 @@ Class { - #name : 'GtCodersFiltersChanged', - #superclass : 'GtCodersAnnouncement', + #name : #GtCodersFiltersChanged, + #superclass : #GtCodersAnnouncement, #instVars : [ 'filters' ], #category : 'GToolkit-Coder-Event' } -{ #category : 'accessing' } +{ #category : #accessing } GtCodersFiltersChanged >> filters [ ^ filters ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodersFiltersChanged >> filters: anObject [ filters := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodersFiltersChanged >> gtFiltesFor: aView [ self filters ifNil: [ ^ aView empty ]. diff --git a/src/GToolkit-Coder/GtCodersModel.class.st b/src/GToolkit-Coder/GtCodersModel.class.st index 8ad7887ea..d991ac661 100644 --- a/src/GToolkit-Coder/GtCodersModel.class.st +++ b/src/GToolkit-Coder/GtCodersModel.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCodersModel', - #superclass : 'Object', + #name : #GtCodersModel, + #superclass : #Object, #traits : 'TGtAnnouncer + TGtOptions', #classTraits : 'TGtAnnouncer classTrait + TGtOptions classTrait', #instVars : [ @@ -11,49 +11,49 @@ Class { #category : 'GToolkit-Coder-Coders' } -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtCodersModel class >> forItems: aCollection [ ^ self new forItems: aCollection; yourself ] -{ #category : 'private - adding / removing' } +{ #category : #'private - adding / removing' } GtCodersModel >> addCoder: aCoder [ coders add: aCoder. self subscribeToCoder: aCoder. self notifyCoderAdded: aCoder. ] -{ #category : 'private - adding / removing' } +{ #category : #'private - adding / removing' } GtCodersModel >> addFirstCoder: aCoder [ coders addFirst: aCoder. self subscribeToCoder: aCoder. self notifyCoderAdded: aCoder ] -{ #category : 'announcer' } +{ #category : #announcer } GtCodersModel >> announcer [ ^ announcer ifNil: [ announcer := Announcer new ] ] -{ #category : 'testing' } +{ #category : #testing } GtCodersModel >> canFilter [ ^ false ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodersModel >> coders [ ^ coders ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtCodersModel >> forItems: aCollection [ items := aCollection. coders := items collect: [ :each | self newCoderFor: each ] ] -{ #category : 'ui' } +{ #category : #ui } GtCodersModel >> gtLiveFor: aView [ ^ aView explicit @@ -62,59 +62,59 @@ GtCodersModel >> gtLiveFor: aView [ stencil: [ self ] ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtCodersModel >> initialize [ super initialize. coders := #(). items := #() ] -{ #category : 'private' } +{ #category : #private } GtCodersModel >> newCoderFor: anObject [ self subclassResponsibility ] -{ #category : 'private - notifying' } +{ #category : #'private - notifying' } GtCodersModel >> notifyCoderAdded: aCoder [ self announce: (GtCodersCoderAdded new coders: self; coder: aCoder) ] -{ #category : 'private - notifying' } +{ #category : #'private - notifying' } GtCodersModel >> notifyCoderRemoved: aCoder [ self announce: (GtCodersCoderRemoved new coders: self; coder: aCoder) ] -{ #category : 'private - adding / removing' } +{ #category : #'private - adding / removing' } GtCodersModel >> removeCoder: aCoder [ self unsubscribeFromCoder: aCoder. coders remove: aCoder ifAbsent: [ ^ self ]. self notifyCoderRemoved: aCoder ] -{ #category : 'private - subscriptions' } +{ #category : #'private - subscriptions' } GtCodersModel >> subscribeToCoder: eachCoder [ ] -{ #category : 'private - subscriptions' } +{ #category : #'private - subscriptions' } GtCodersModel >> subscribeToSystem [ "do nothing" ] -{ #category : 'private - subscriptions' } +{ #category : #'private - subscriptions' } GtCodersModel >> unsubscribeFromCoder: aCoder [ aCoder unsubscribe: self ] -{ #category : 'private - subscriptions' } +{ #category : #'private - subscriptions' } GtCodersModel >> unsubscribeFromSystem [ SystemAnnouncer uniqueInstance unsubscribe: self ] -{ #category : 'updating' } +{ #category : #updating } GtCodersModel >> updateCoders [ coders := items collect: [ :each | self newCoderFor: each ]. self diff --git a/src/GToolkit-Coder/GtCodersScrollToCoder.class.st b/src/GToolkit-Coder/GtCodersScrollToCoder.class.st index 2f4b6e97d..8d888610b 100644 --- a/src/GToolkit-Coder/GtCodersScrollToCoder.class.st +++ b/src/GToolkit-Coder/GtCodersScrollToCoder.class.st @@ -1,18 +1,18 @@ Class { - #name : 'GtCodersScrollToCoder', - #superclass : 'GtCodersAnnouncement', + #name : #GtCodersScrollToCoder, + #superclass : #GtCodersAnnouncement, #instVars : [ 'sourceCoder' ], #category : 'GToolkit-Coder-Event' } -{ #category : 'accessing' } +{ #category : #accessing } GtCodersScrollToCoder >> sourceCoder [ ^ sourceCoder ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodersScrollToCoder >> sourceCoder: anObject [ sourceCoder := anObject ] diff --git a/src/GToolkit-Coder/GtCompositeHighlighter.class.st b/src/GToolkit-Coder/GtCompositeHighlighter.class.st index 0f28c0cc8..3eb25ffc6 100644 --- a/src/GToolkit-Coder/GtCompositeHighlighter.class.st +++ b/src/GToolkit-Coder/GtCompositeHighlighter.class.st @@ -1,25 +1,25 @@ Class { - #name : 'GtCompositeHighlighter', - #superclass : 'GtSourceReferenceHighlighter', + #name : #GtCompositeHighlighter, + #superclass : #GtSourceReferenceHighlighter, #instVars : [ 'highlighters' ], #category : 'GToolkit-Coder-Styler/Highlighter' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtCompositeHighlighter class >> forHighlighters: aCollection [ ^ self new forHighlighters: aCollection; yourself ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtCompositeHighlighter >> forHighlighters: aCollection [ highlighters := aCollection ] -{ #category : 'styling' } +{ #category : #styling } GtCompositeHighlighter >> style: aText ast: ast [ highlighters do: [ :each | each style: aText ast: ast ] ] diff --git a/src/GToolkit-Coder/GtDebugContext.class.st b/src/GToolkit-Coder/GtDebugContext.class.st index 98e36befb..37ee49036 100644 --- a/src/GToolkit-Coder/GtDebugContext.class.st +++ b/src/GToolkit-Coder/GtDebugContext.class.st @@ -1,31 +1,31 @@ Class { - #name : 'GtDebugContext', - #superclass : 'DebugContext', + #name : #GtDebugContext, + #superclass : #DebugContext, #category : 'GToolkit-Coder' } -{ #category : 'private' } +{ #category : #private } GtDebugContext >> blockNotFoundDialog: aMethod with: aText [ aMethod selector isDoIt ifTrue: [ "shouldn't edit doits" ^ self ]. self recompileCurrentMethodTo: aText notifying: nil ] -{ #category : 'private' } +{ #category : #private } GtDebugContext >> checkSelectorUnchanged: aSelector [ ^ aSelector == self selectedMessageName or: [ self selectedMessageName isDoIt and: [ aSelector numArgs = self selectedMessageName numArgs ] ] ] -{ #category : 'private' } +{ #category : #private } GtDebugContext >> confirmOnTraitOverwrite: aSelector inClass: aClass [ | method | method := aClass methodNamed: aSelector. ^ method origin ] -{ #category : 'accessing' } +{ #category : #accessing } GtDebugContext >> locateClosureHomeWithContent: aText [ context isBlockContext ifTrue: [ ^ context activeHome diff --git a/src/GToolkit-Coder/GtFilterExampleAllState.class.st b/src/GToolkit-Coder/GtFilterExampleAllState.class.st index cbff7ffd4..d54af83ee 100644 --- a/src/GToolkit-Coder/GtFilterExampleAllState.class.st +++ b/src/GToolkit-Coder/GtFilterExampleAllState.class.st @@ -1,30 +1,30 @@ Class { - #name : 'GtFilterExampleAllState', - #superclass : 'GtFilterExampleState', + #name : #GtFilterExampleAllState, + #superclass : #GtFilterExampleState, #category : 'GToolkit-Coder-Filters - Support' } -{ #category : 'api - testing' } +{ #category : #'api - testing' } GtFilterExampleAllState >> includesCoder: aCoder [ ^ aCoder example isNotNil ] -{ #category : 'api - testing' } +{ #category : #'api - testing' } GtFilterExampleAllState >> isStatusFor: aGtExampleWithResult [ ^ false ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtFilterExampleAllState >> label [ ^ 'All' ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtFilterExampleAllState >> numberOfExamplesFor: anExampler [ ^ anExampler numberOfAllExamples ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtFilterExampleAllState >> order [ ^ 1 ] diff --git a/src/GToolkit-Coder/GtFilterExampleErrorState.class.st b/src/GToolkit-Coder/GtFilterExampleErrorState.class.st index cdd44160a..465a1de51 100644 --- a/src/GToolkit-Coder/GtFilterExampleErrorState.class.st +++ b/src/GToolkit-Coder/GtFilterExampleErrorState.class.st @@ -1,39 +1,39 @@ Class { - #name : 'GtFilterExampleErrorState', - #superclass : 'GtFilterExampleState', + #name : #GtFilterExampleErrorState, + #superclass : #GtFilterExampleState, #category : 'GToolkit-Coder-Filters - Support' } -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtFilterExampleErrorState >> color [ ^ BrGlamorousColors errorBackgroundColor ] -{ #category : 'api - testing' } +{ #category : #'api - testing' } GtFilterExampleErrorState >> includesCoder: aCoder [ ^ aCoder canExecuteExample and: [ aCoder exampleResult isNotNil and: [ aCoder exampleResult isError ] ] ] -{ #category : 'api - testing' } +{ #category : #'api - testing' } GtFilterExampleErrorState >> isStatusFor: aGtExampleWithResult [ ^ aGtExampleWithResult isNotNil and: [ aGtExampleWithResult hasResult and: [ aGtExampleWithResult isError ] ] ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtFilterExampleErrorState >> label [ ^ 'Error' ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtFilterExampleErrorState >> numberOfExamplesFor: anExampler [ ^ anExampler numberOfErrorExamples ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtFilterExampleErrorState >> order [ ^ 4 ] diff --git a/src/GToolkit-Coder/GtFilterExampleFailureState.class.st b/src/GToolkit-Coder/GtFilterExampleFailureState.class.st index 433f0377b..ecf961d98 100644 --- a/src/GToolkit-Coder/GtFilterExampleFailureState.class.st +++ b/src/GToolkit-Coder/GtFilterExampleFailureState.class.st @@ -1,39 +1,39 @@ Class { - #name : 'GtFilterExampleFailureState', - #superclass : 'GtFilterExampleState', + #name : #GtFilterExampleFailureState, + #superclass : #GtFilterExampleState, #category : 'GToolkit-Coder-Filters - Support' } -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtFilterExampleFailureState >> color [ ^ BrGlamorousColors failureBackgroundColor ] -{ #category : 'api - testing' } +{ #category : #'api - testing' } GtFilterExampleFailureState >> includesCoder: aCoder [ ^ aCoder canExecuteExample and: [ aCoder exampleResult isNotNil and: [ aCoder exampleResult isFailure ] ] ] -{ #category : 'api - testing' } +{ #category : #'api - testing' } GtFilterExampleFailureState >> isStatusFor: aGtExampleWithResult [ ^ aGtExampleWithResult isNotNil and: [ aGtExampleWithResult hasResult and: [ aGtExampleWithResult isFailure ] ] ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtFilterExampleFailureState >> label [ ^ 'Failure' ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtFilterExampleFailureState >> numberOfExamplesFor: anExampler [ ^ anExampler numberOfFailureExamples ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtFilterExampleFailureState >> order [ ^ 3 ] diff --git a/src/GToolkit-Coder/GtFilterExampleNotExecutedState.class.st b/src/GToolkit-Coder/GtFilterExampleNotExecutedState.class.st index 071d08d74..9ddae9d13 100644 --- a/src/GToolkit-Coder/GtFilterExampleNotExecutedState.class.st +++ b/src/GToolkit-Coder/GtFilterExampleNotExecutedState.class.st @@ -1,36 +1,36 @@ Class { - #name : 'GtFilterExampleNotExecutedState', - #superclass : 'GtFilterExampleState', + #name : #GtFilterExampleNotExecutedState, + #superclass : #GtFilterExampleState, #category : 'GToolkit-Coder-Filters - Support' } -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtFilterExampleNotExecutedState >> color [ ^ BrGlamorousColors neutralBackgroundColor ] -{ #category : 'api - testing' } +{ #category : #'api - testing' } GtFilterExampleNotExecutedState >> includesCoder: aCoder [ ^ aCoder exampleResult isNil ] -{ #category : 'api - testing' } +{ #category : #'api - testing' } GtFilterExampleNotExecutedState >> isStatusFor: aGtExampleWithResult [ ^ aGtExampleWithResult isNotNil and: [ aGtExampleWithResult hasResult not ] ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtFilterExampleNotExecutedState >> label [ ^ 'Not Executed' ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtFilterExampleNotExecutedState >> numberOfExamplesFor: anExampler [ ^ anExampler numberOfNotExecutedExamples ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtFilterExampleNotExecutedState >> order [ ^ 5 ] diff --git a/src/GToolkit-Coder/GtFilterExampleState.class.st b/src/GToolkit-Coder/GtFilterExampleState.class.st index 552d74d45..e4e693b4e 100644 --- a/src/GToolkit-Coder/GtFilterExampleState.class.st +++ b/src/GToolkit-Coder/GtFilterExampleState.class.st @@ -1,19 +1,19 @@ Class { - #name : 'GtFilterExampleState', - #superclass : 'Object', + #name : #GtFilterExampleState, + #superclass : #Object, #traits : 'TBlDebug + TGtUniqueInstance', #classTraits : 'TBlDebug classTrait + TGtUniqueInstance classTrait', #category : 'GToolkit-Coder-Filters - Support' } -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtFilterExampleState >> allLabels [ "Return all available labels" ^ self allStates collect: #label ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtFilterExampleState >> allStates [ | allInstances | allInstances := self class allSubclasses collect: #default. @@ -21,28 +21,28 @@ GtFilterExampleState >> allStates [ ^ allInstances ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtFilterExampleState >> color [ "Return a color that represents given state" ^ Color transparent ] -{ #category : 'api - testing' } +{ #category : #'api - testing' } GtFilterExampleState >> includesCoder: aCoder [ "Return true if a method filter should be displayed. Return false otherwise." ^ true ] -{ #category : 'api - testing' } +{ #category : #'api - testing' } GtFilterExampleState >> isStatusFor: aGtExampleWithResult [ "Return true if the status is equal to the example result status" ^ self subclassResponsibility ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtFilterExampleState >> label [ "Return a name that is used by ${class:GtSearchExamplesFilter}$ to display available example filters in ${class:GtFiltersElement}$." @@ -50,7 +50,7 @@ GtFilterExampleState >> label [ ^ self className ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtFilterExampleState >> labelWithAmountFor: anExampler [ | aTotal aTotalString aTotalText | @@ -61,13 +61,13 @@ GtFilterExampleState >> labelWithAmountFor: anExampler [ append: aTotalText. ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtFilterExampleState >> numberOfExamplesFor: anExampler [ "Return number of examples with a given state" ^ 0 ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtFilterExampleState >> order [ "Return a number that is used by ${class:GtSearchExamplesFilter}$ to display available example filters in ${class:GtFiltersElement}$ @@ -76,7 +76,7 @@ GtFilterExampleState >> order [ ^ 50 ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtFilterExampleState >> stateFromExample: aGtExampleWithResult [ aGtExampleWithResult ifNotNil: [ self allStates do: [ :eachStatus | @@ -85,7 +85,7 @@ GtFilterExampleState >> stateFromExample: aGtExampleWithResult [ ^ GtFilterExampleNotExecutedState default ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtFilterExampleState >> stateFromLabel: aLabel [ | aString | diff --git a/src/GToolkit-Coder/GtFilterExampleSuccessState.class.st b/src/GToolkit-Coder/GtFilterExampleSuccessState.class.st index 17319296b..7419e28df 100644 --- a/src/GToolkit-Coder/GtFilterExampleSuccessState.class.st +++ b/src/GToolkit-Coder/GtFilterExampleSuccessState.class.st @@ -1,39 +1,39 @@ Class { - #name : 'GtFilterExampleSuccessState', - #superclass : 'GtFilterExampleState', + #name : #GtFilterExampleSuccessState, + #superclass : #GtFilterExampleState, #category : 'GToolkit-Coder-Filters - Support' } -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtFilterExampleSuccessState >> color [ ^ BrGlamorousColors successBackgroundColor ] -{ #category : 'api - testing' } +{ #category : #'api - testing' } GtFilterExampleSuccessState >> includesCoder: aCoder [ ^ aCoder canExecuteExample and: [ aCoder exampleResult isNotNil and: [ aCoder exampleResult isSuccess ] ] ] -{ #category : 'api - testing' } +{ #category : #'api - testing' } GtFilterExampleSuccessState >> isStatusFor: aGtExampleWithResult [ ^ aGtExampleWithResult isNotNil and: [ aGtExampleWithResult hasResult and: [ aGtExampleWithResult isSuccess ] ] ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtFilterExampleSuccessState >> label [ ^ 'Success' ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtFilterExampleSuccessState >> numberOfExamplesFor: anExampler [ ^ anExampler numberOfSuccessExamples ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtFilterExampleSuccessState >> order [ ^ 2 ] diff --git a/src/GToolkit-Coder/GtMethodProtocolCompletionStrategy.class.st b/src/GToolkit-Coder/GtMethodProtocolCompletionStrategy.class.st index a2affd066..963317495 100644 --- a/src/GToolkit-Coder/GtMethodProtocolCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtMethodProtocolCompletionStrategy.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtMethodProtocolCompletionStrategy', - #superclass : 'GtStringsCompletionStrategy', + #name : #GtMethodProtocolCompletionStrategy, + #superclass : #GtStringsCompletionStrategy, #category : 'GToolkit-Coder-Completion' } -{ #category : 'private' } +{ #category : #private } GtMethodProtocolCompletionStrategy >> buildCompletions [ | protocols | protocols := GtPrefixTree new. @@ -15,7 +15,7 @@ GtMethodProtocolCompletionStrategy >> buildCompletions [ ^ protocols ] -{ #category : 'accessing' } +{ #category : #accessing } GtMethodProtocolCompletionStrategy >> completionPrefixAt: anIndex in: blText [ anIndex < self minimumPrefixLength ifTrue: [ ^ nil ]. diff --git a/src/GToolkit-Coder/GtMethodsCoderExampler.class.st b/src/GToolkit-Coder/GtMethodsCoderExampler.class.st index 11b53de01..1818294c5 100644 --- a/src/GToolkit-Coder/GtMethodsCoderExampler.class.st +++ b/src/GToolkit-Coder/GtMethodsCoderExampler.class.st @@ -5,25 +5,25 @@ I am used by {{gtClass:GtPharoMethodsCoder}}, see: {{gtMethod:Behavior>>#gtCoder " Class { - #name : 'GtMethodsCoderExampler', - #superclass : 'GtCoderExampler', + #name : #GtMethodsCoderExampler, + #superclass : #GtCoderExampler, #category : 'GToolkit-Coder-Exampler' } -{ #category : 'api - enumeration' } +{ #category : #'api - enumeration' } GtMethodsCoderExampler >> allExampleCodersDo: aBlock [ self coder allCoders do: [ :eachCoder | eachCoder example ifNotNil: [ :anExample | aBlock cull: eachCoder cull: anExample ] ] ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtMethodsCoderExampler >> coderFor: aCompiledMethod [ ^ self coder coderFor: aCompiledMethod ] -{ #category : 'api - enumeration' } +{ #category : #'api - enumeration' } GtMethodsCoderExampler >> selectedExampleCodersDo: aBlock [ self coder coders do: [ :eachCoder | eachCoder example ifNotNil: [ :anExample | diff --git a/src/GToolkit-Coder/GtPackageClassesCompletionStrategy.class.st b/src/GToolkit-Coder/GtPackageClassesCompletionStrategy.class.st index e9fda664d..b45286747 100644 --- a/src/GToolkit-Coder/GtPackageClassesCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtPackageClassesCompletionStrategy.class.st @@ -1,13 +1,13 @@ Class { - #name : 'GtPackageClassesCompletionStrategy', - #superclass : 'GtCompletionStrategy', + #name : #GtPackageClassesCompletionStrategy, + #superclass : #GtCompletionStrategy, #instVars : [ 'packageSearchString' ], #category : 'GToolkit-Coder-Completion' } -{ #category : 'accessing' } +{ #category : #accessing } GtPackageClassesCompletionStrategy >> classesMatching: aString [ | classNamePattern matchedClasses | matchedClasses := Set new. @@ -19,7 +19,7 @@ GtPackageClassesCompletionStrategy >> classesMatching: aString [ ^ matchedClasses select: [ :each | classNamePattern match: each name ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtPackageClassesCompletionStrategy >> completionActionsFor: aText at: positionInteger max: maxInteger [ | string | string := aText asString. @@ -28,28 +28,28 @@ GtPackageClassesCompletionStrategy >> completionActionsFor: aText at: positionIn asSortedCollection: [ :a :b | a text < b text ] ] -{ #category : 'testing' } +{ #category : #testing } GtPackageClassesCompletionStrategy >> hasCompletionEntryFor: aString [ ^ true ] -{ #category : 'testing' } +{ #category : #testing } GtPackageClassesCompletionStrategy >> hasCompletionsAt: anInteger in: aText [ ^ true ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtPackageClassesCompletionStrategy >> initialize [ super initialize. packageSearchString := '' ] -{ #category : 'accessing' } +{ #category : #accessing } GtPackageClassesCompletionStrategy >> packageSearchString [ ^ packageSearchString ] -{ #category : 'accessing' } +{ #category : #accessing } GtPackageClassesCompletionStrategy >> packageSearchString: anObject [ packageSearchString := anObject ] diff --git a/src/GToolkit-Coder/GtPackageCoder.class.st b/src/GToolkit-Coder/GtPackageCoder.class.st index ac770aeaa..6ad6f4372 100644 --- a/src/GToolkit-Coder/GtPackageCoder.class.st +++ b/src/GToolkit-Coder/GtPackageCoder.class.st @@ -1,52 +1,52 @@ Class { - #name : 'GtPackageCoder', - #superclass : 'GtCoderModel', + #name : #GtPackageCoder, + #superclass : #GtCoderModel, #traits : 'TGtCoderTrait', #classTraits : 'TGtCoderTrait classTrait', #category : 'GToolkit-Coder-Coders' } -{ #category : 'testing' } +{ #category : #testing } GtPackageCoder >> isForPackage [ ^ true ] -{ #category : 'private - notifying' } +{ #category : #'private - notifying' } GtPackageCoder >> notifyPackageRegistered [ self announce: (GtCoderPackageRegistered new coder: self) ] -{ #category : 'private - notifying' } +{ #category : #'private - notifying' } GtPackageCoder >> notifyPackageRenamed [ self announce: (GtCoderPackageRenamed new coder: self) ] -{ #category : 'private - notifying' } +{ #category : #'private - notifying' } GtPackageCoder >> notifyPackageUnregistered [ self announce: (GtCoderPackageUnregistered new coder: self) ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtPackageCoder >> primitiveRegisterPackage [ self subclassResponsibility ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtPackageCoder >> primitiveRemovePackage [ self subclassResponsibility ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtPackageCoder >> primitiveRenamePackageTo: aNewPackageName [ self subclassResponsibility ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtPackageCoder >> primitiveUnregisterPackage [ self subclassResponsibility ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtPackageCoder >> register [ "Register a package in the system, and announce ${class:GtCoderPackageRegistered}$ if it was registered" self isRegistered @@ -59,7 +59,7 @@ GtPackageCoder >> register [ self notifyPackageRegistered ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtPackageCoder >> renameTo: aNewPackageName [ self isRegistered @@ -74,7 +74,7 @@ GtPackageCoder >> renameTo: aNewPackageName [ self notifyPackageRenamed ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtPackageCoder >> unload [ "Remove package from the system including all defined classes and extension methods" | wasRegistered | @@ -90,7 +90,7 @@ GtPackageCoder >> unload [ ifTrue: [ self notifyPackageUnregistered ] ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtPackageCoder >> unregister [ "Register a package in the system, and announce ${class:GtCoderPackageUnregistered}$ if it was unregistered. Unregistering a package does not remove its classes (quite dangerous!)" diff --git a/src/GToolkit-Coder/GtPackagesCoder.class.st b/src/GToolkit-Coder/GtPackagesCoder.class.st index 62d303d35..a1c9aa300 100644 --- a/src/GToolkit-Coder/GtPackagesCoder.class.st +++ b/src/GToolkit-Coder/GtPackagesCoder.class.st @@ -1,23 +1,23 @@ Class { - #name : 'GtPackagesCoder', - #superclass : 'GtCodersModel', + #name : #GtPackagesCoder, + #superclass : #GtCodersModel, #traits : 'TGtCoderTrait', #classTraits : 'TGtCoderTrait classTrait', #category : 'GToolkit-Coder-Coders' } -{ #category : 'comparing' } +{ #category : #comparing } GtPackagesCoder >> = anObject [ ^ self class = anObject class ] -{ #category : 'accessing' } +{ #category : #accessing } GtPackagesCoder >> coderForClass: aClass [ ^ (self coderForPackage: aClass package) ifNotNil: [ :coder | coder coderForClass: aClass ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtPackagesCoder >> coderForPackage: aPackage [ ^ self coders detect: [ :each | each package = aPackage ] @@ -28,22 +28,22 @@ GtPackagesCoder >> coderForPackage: aPackage [ coder ] ] -{ #category : 'comparing' } +{ #category : #comparing } GtPackagesCoder >> hash [ ^ self class hash ] -{ #category : 'accessing' } +{ #category : #accessing } GtPackagesCoder >> icon [ ^ BrGlamorousIcons packageicon asElement ] -{ #category : 'accessing' } +{ #category : #accessing } GtPackagesCoder >> name [ ^ 'Pharo' ] -{ #category : 'private' } +{ #category : #private } GtPackagesCoder >> newCoderFor: aPackage [ ^ self subclassResponsibility ] diff --git a/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st b/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st index abd200b08..5a2267d15 100644 --- a/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st @@ -1,20 +1,20 @@ Class { - #name : 'GtPackagesCompletionStrategy', - #superclass : 'GtCompletionStrategy', + #name : #GtPackagesCompletionStrategy, + #superclass : #GtCompletionStrategy, #category : 'GToolkit-Coder-Completion' } -{ #category : 'private' } +{ #category : #private } GtPackagesCompletionStrategy class >> allPackages [ ^ RPackageOrganizer default packages ] -{ #category : 'private' } +{ #category : #private } GtPackagesCompletionStrategy class >> allPackagesDo: aBlock [ ^ RPackageOrganizer default packagesDo: aBlock ] -{ #category : 'querying' } +{ #category : #querying } GtPackagesCompletionStrategy class >> findPackageTagsMatching: aString [ | searchString results | searchString := '*' , aString , '*'. @@ -27,7 +27,7 @@ GtPackagesCompletionStrategy class >> findPackageTagsMatching: aString [ ^ results ] -{ #category : 'querying' } +{ #category : #querying } GtPackagesCompletionStrategy class >> findPackagesMatching: aString [ | searchString results | searchString := '*' , aString , '*'. @@ -38,7 +38,7 @@ GtPackagesCompletionStrategy class >> findPackagesMatching: aString [ ^ results ] -{ #category : 'accessing' } +{ #category : #accessing } GtPackagesCompletionStrategy >> completionActionsFor: aText at: positionInteger max: maxInteger [ | string completionActions | string := aText asString. @@ -53,12 +53,12 @@ GtPackagesCompletionStrategy >> completionActionsFor: aText at: positionInteger a text < b text ] ] -{ #category : 'testing' } +{ #category : #testing } GtPackagesCompletionStrategy >> hasCompletionEntryFor: aString [ ^ true ] -{ #category : 'testing' } +{ #category : #testing } GtPackagesCompletionStrategy >> hasCompletionsAt: anInteger in: aText [ ^ true ] diff --git a/src/GToolkit-Coder/GtPharoAssociation.class.st b/src/GToolkit-Coder/GtPharoAssociation.class.st index acd05e1d4..4171331a2 100644 --- a/src/GToolkit-Coder/GtPharoAssociation.class.st +++ b/src/GToolkit-Coder/GtPharoAssociation.class.st @@ -1,32 +1,32 @@ Class { - #name : 'GtPharoAssociation', - #superclass : 'Object', + #name : #GtPharoAssociation, + #superclass : #Object, #category : 'GToolkit-Coder-Support-Pharo' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtPharoAssociation >> from [ ^ self subclassResponsibility ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtPharoAssociation >> fromPackage [ ^ self from gtPackageScope ] -{ #category : 'printing' } +{ #category : #printing } GtPharoAssociation >> gtDisplayOn: stream [ self from gtDisplayOn: stream. stream nextPutAll: '->'. self to gtDisplayOn: stream. ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtPharoAssociation >> to [ ^ self subclassResponsibility ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtPharoAssociation >> toPackage [ ^ self to gtPackageScope ] diff --git a/src/GToolkit-Coder/GtPharoClassExtension.class.st b/src/GToolkit-Coder/GtPharoClassExtension.class.st index 2e1b8ce3c..e1afbb78c 100644 --- a/src/GToolkit-Coder/GtPharoClassExtension.class.st +++ b/src/GToolkit-Coder/GtPharoClassExtension.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtPharoClassExtension', - #superclass : 'GtPharoAssociation', + #name : #GtPharoClassExtension, + #superclass : #GtPharoAssociation, #instVars : [ 'extendedClass', 'extendingMethod' @@ -8,27 +8,27 @@ Class { #category : 'GToolkit-Coder-Support-Pharo' } -{ #category : 'accessing' } +{ #category : #accessing } GtPharoClassExtension >> extendedClass [ ^ self extendingMethod methodClass ] -{ #category : 'accessing' } +{ #category : #accessing } GtPharoClassExtension >> extendingMethod [ ^ extendingMethod ] -{ #category : 'accessing' } +{ #category : #accessing } GtPharoClassExtension >> extendingMethod: anObject [ extendingMethod := anObject ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtPharoClassExtension >> from [ ^ self extendingMethod ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtPharoClassExtension >> to [ ^ self extendedClass ] diff --git a/src/GToolkit-Coder/GtPharoClassReference.class.st b/src/GToolkit-Coder/GtPharoClassReference.class.st index c88356a6f..7aa0e83e0 100644 --- a/src/GToolkit-Coder/GtPharoClassReference.class.st +++ b/src/GToolkit-Coder/GtPharoClassReference.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtPharoClassReference', - #superclass : 'GtPharoAssociation', + #name : #GtPharoClassReference, + #superclass : #GtPharoAssociation, #instVars : [ 'referencingMethod', 'referencedClass' @@ -8,12 +8,12 @@ Class { #category : 'GToolkit-Coder-Support-Pharo' } -{ #category : 'accessing' } +{ #category : #accessing } GtPharoClassReference >> from [ ^ self referencingMethod ] -{ #category : 'accessing' } +{ #category : #accessing } GtPharoClassReference >> gtSourceFor: aView [ ^ aView forward @@ -22,27 +22,27 @@ GtPharoClassReference >> gtSourceFor: aView [ view: #gtSourceFor: ] -{ #category : 'accessing' } +{ #category : #accessing } GtPharoClassReference >> referencedClass [ ^ referencedClass ] -{ #category : 'accessing' } +{ #category : #accessing } GtPharoClassReference >> referencedClass: anObject [ referencedClass := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtPharoClassReference >> referencingMethod [ ^ referencingMethod ] -{ #category : 'accessing' } +{ #category : #accessing } GtPharoClassReference >> referencingMethod: anObject [ referencingMethod := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtPharoClassReference >> to [ ^ self referencedClass ] diff --git a/src/GToolkit-Coder/GtPharoInheritance.class.st b/src/GToolkit-Coder/GtPharoInheritance.class.st index eb280e8c0..e15a99750 100644 --- a/src/GToolkit-Coder/GtPharoInheritance.class.st +++ b/src/GToolkit-Coder/GtPharoInheritance.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtPharoInheritance', - #superclass : 'GtPharoAssociation', + #name : #GtPharoInheritance, + #superclass : #GtPharoAssociation, #instVars : [ 'superclass', 'subclass' @@ -8,32 +8,32 @@ Class { #category : 'GToolkit-Coder-Support-Pharo' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtPharoInheritance >> from [ ^ self subclass ] -{ #category : 'accessing' } +{ #category : #accessing } GtPharoInheritance >> subclass [ ^ subclass ] -{ #category : 'accessing' } +{ #category : #accessing } GtPharoInheritance >> subclass: anObject [ subclass := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtPharoInheritance >> superclass [ ^ superclass ] -{ #category : 'accessing' } +{ #category : #accessing } GtPharoInheritance >> superclass: anObject [ superclass := anObject ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtPharoInheritance >> to [ ^ self superclass ] diff --git a/src/GToolkit-Coder/GtPharoTraitUsage.class.st b/src/GToolkit-Coder/GtPharoTraitUsage.class.st index 939a69fa4..379d42f72 100644 --- a/src/GToolkit-Coder/GtPharoTraitUsage.class.st +++ b/src/GToolkit-Coder/GtPharoTraitUsage.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtPharoTraitUsage', - #superclass : 'GtPharoAssociation', + #name : #GtPharoTraitUsage, + #superclass : #GtPharoAssociation, #instVars : [ 'trait', 'baseBehavior' @@ -8,32 +8,32 @@ Class { #category : 'GToolkit-Coder-Support-Pharo' } -{ #category : 'accessing' } +{ #category : #accessing } GtPharoTraitUsage >> baseBehavior [ ^ baseBehavior ] -{ #category : 'accessing' } +{ #category : #accessing } GtPharoTraitUsage >> baseBehavior: aBehavior [ baseBehavior := aBehavior ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtPharoTraitUsage >> from [ ^ self baseBehavior ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtPharoTraitUsage >> to [ ^ self usedTrait ] -{ #category : 'accessing' } +{ #category : #accessing } GtPharoTraitUsage >> usedTrait [ ^ trait ] -{ #category : 'accessing' } +{ #category : #accessing } GtPharoTraitUsage >> usedTrait: aTrait [ trait := aTrait ] diff --git a/src/GToolkit-Coder/GtPhlowContext.extension.st b/src/GToolkit-Coder/GtPhlowContext.extension.st index 008b5f434..34240c73c 100644 --- a/src/GToolkit-Coder/GtPhlowContext.extension.st +++ b/src/GToolkit-Coder/GtPhlowContext.extension.st @@ -1,36 +1,36 @@ -Extension { #name : 'GtPhlowContext' } +Extension { #name : #GtPhlowContext } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } GtPhlowContext >> hasPackageCoder [ ^ self hasOptionAt: #packageCoder ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } GtPhlowContext >> hasPackageTagCoder [ ^ self hasOptionAt: #packageTagCoder ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } GtPhlowContext >> packageCoder [ ^ self optionAt: #packageCoder ifAbsent: [ nil ] ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } GtPhlowContext >> packageCoder: aCoder [ self optionAt: #packageCoder put: aCoder ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } GtPhlowContext >> packageTagCoder [ ^ self optionAt: #packageTagCoder ifAbsent: [ nil ] ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } GtPhlowContext >> packageTagCoder: aCoder [ self optionAt: #packageTagCoder put: aCoder diff --git a/src/GToolkit-Coder/GtPhlowExecutionContext.extension.st b/src/GToolkit-Coder/GtPhlowExecutionContext.extension.st index 26eb9e0d5..08d93fe2d 100644 --- a/src/GToolkit-Coder/GtPhlowExecutionContext.extension.st +++ b/src/GToolkit-Coder/GtPhlowExecutionContext.extension.st @@ -1,11 +1,11 @@ -Extension { #name : 'GtPhlowExecutionContext' } +Extension { #name : #GtPhlowExecutionContext } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } GtPhlowExecutionContext >> hasPackageCoder [ ^ false ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } GtPhlowExecutionContext >> hasPackageTagCoder [ ^ false ] diff --git a/src/GToolkit-Coder/GtPoolsCompletionStrategy.class.st b/src/GToolkit-Coder/GtPoolsCompletionStrategy.class.st index ea8ce7707..9929de55d 100644 --- a/src/GToolkit-Coder/GtPoolsCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtPoolsCompletionStrategy.class.st @@ -1,13 +1,13 @@ Class { - #name : 'GtPoolsCompletionStrategy', - #superclass : 'GtCompletionStrategy', + #name : #GtPoolsCompletionStrategy, + #superclass : #GtCompletionStrategy, #instVars : [ 'candidatePools' ], #category : 'GToolkit-Coder-Completion' } -{ #category : 'accessing' } +{ #category : #accessing } GtPoolsCompletionStrategy >> candidatePools [ ^ candidatePools ifNil: [ | theInterestingPoolNames | @@ -17,7 +17,7 @@ GtPoolsCompletionStrategy >> candidatePools [ candidatePools := GtPrefixTree withAll: theInterestingPoolNames ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtPoolsCompletionStrategy >> completionActionsFor: aText at: positionInteger max: maxInteger [ | currentInput completionActions | @@ -32,12 +32,12 @@ GtPoolsCompletionStrategy >> completionActionsFor: aText at: positionInteger max ^ completionActions ] -{ #category : 'testing' } +{ #category : #testing } GtPoolsCompletionStrategy >> hasCompletionEntryFor: aString [ ^ true ] -{ #category : 'testing' } +{ #category : #testing } GtPoolsCompletionStrategy >> hasCompletionsAt: anInteger in: aText [ ^ true ] diff --git a/src/GToolkit-Coder/GtRBASTStyler.class.st b/src/GToolkit-Coder/GtRBASTStyler.class.st index 2368f06c0..84021eb82 100644 --- a/src/GToolkit-Coder/GtRBASTStyler.class.st +++ b/src/GToolkit-Coder/GtRBASTStyler.class.st @@ -1,16 +1,16 @@ Class { - #name : 'GtRBASTStyler', - #superclass : 'BlTextStyler', + #name : #GtRBASTStyler, + #superclass : #BlTextStyler, #classTraits : 'TRBProgramNodeVisitor classTrait', #category : 'GToolkit-Coder-Styler/Highlighter' } -{ #category : 'styling' } +{ #category : #styling } GtRBASTStyler >> extraStyle: aText ast: ast [ ] -{ #category : 'gt-extension' } +{ #category : #'gt-extension' } GtRBASTStyler >> gtViewTextFor: aView [ text ifNil: [ ^ aView empty ]. @@ -20,14 +20,14 @@ GtRBASTStyler >> gtViewTextFor: aView [ text: [ text ] ] -{ #category : 'private' } +{ #category : #private } GtRBASTStyler >> parse: aText [ | code | code := aText asString. ^ RBParser parseFaultyMethod: code ] -{ #category : 'private' } +{ #category : #private } GtRBASTStyler >> privateStyle: aText [ | ast | ast := self parse: aText. @@ -40,18 +40,18 @@ GtRBASTStyler >> privateStyle: aText [ ^ aText ] -{ #category : 'styling' } +{ #category : #styling } GtRBASTStyler >> style: aText ast: ast [ text := aText. self visitNode: ast ] -{ #category : 'private' } +{ #category : #private } GtRBASTStyler >> styleFrom: from to: to with: attributes [ (text from: from to: to) attributes: attributes ] -{ #category : 'accessing' } +{ #category : #accessing } GtRBASTStyler >> typeOf: aNode in: aClass [ aNode isSelf ifTrue: [ ^ aClass ]. @@ -78,13 +78,13 @@ GtRBASTStyler >> typeOf: aNode in: aClass [ ^ nil ] -{ #category : 'visiting' } +{ #category : #visiting } GtRBASTStyler >> visitArgumentNodes: aNodeCollection [ "Sent *once* when visiting method and block nodes" ^aNodeCollection do: [ :each | self visitNode: each ] ] -{ #category : 'visiting' } +{ #category : #visiting } GtRBASTStyler >> visitTemporaryDeclarationNode: aTemporaryDeclarationNode [ "| temp | temp is a temporary node as we can find in the body of methods, but it can't be visited the same way. diff --git a/src/GToolkit-Coder/GtRefactoringDanger.class.st b/src/GToolkit-Coder/GtRefactoringDanger.class.st index 3b67d6db7..218b9bef9 100644 --- a/src/GToolkit-Coder/GtRefactoringDanger.class.st +++ b/src/GToolkit-Coder/GtRefactoringDanger.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtRefactoringDanger', - #superclass : 'Object', + #name : #GtRefactoringDanger, + #superclass : #Object, #instVars : [ 'condition', 'description' @@ -8,22 +8,22 @@ Class { #category : 'GToolkit-Coder-Refactoring' } -{ #category : 'accessing' } +{ #category : #accessing } GtRefactoringDanger >> condition [ ^ condition ] -{ #category : 'accessing' } +{ #category : #accessing } GtRefactoringDanger >> condition: anObject [ condition := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtRefactoringDanger >> description [ ^ description ] -{ #category : 'accessing' } +{ #category : #accessing } GtRefactoringDanger >> description: anObject [ description := anObject ] diff --git a/src/GToolkit-Coder/GtReplaceTextCompletionAction.class.st b/src/GToolkit-Coder/GtReplaceTextCompletionAction.class.st index a90d68a5f..3f1ea576b 100644 --- a/src/GToolkit-Coder/GtReplaceTextCompletionAction.class.st +++ b/src/GToolkit-Coder/GtReplaceTextCompletionAction.class.st @@ -1,25 +1,25 @@ Class { - #name : 'GtReplaceTextCompletionAction', - #superclass : 'GtCompletionAction', + #name : #GtReplaceTextCompletionAction, + #superclass : #GtCompletionAction, #instVars : [ 'text' ], #category : 'GToolkit-Coder-Completion' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtReplaceTextCompletionAction class >> forText: aString [ ^ (self labeled: aString) text: aString; yourself ] -{ #category : 'comparing' } +{ #category : #comparing } GtReplaceTextCompletionAction >> = anObject [ ^ super = anObject and: [ self text = anObject text ] ] -{ #category : 'executing' } +{ #category : #executing } GtReplaceTextCompletionAction >> finishCompletionOn: aCompletionController moveCursor: aBoolean [ aCompletionController textEditor deleter from: 0 to: aCompletionController textEditor text size; @@ -30,30 +30,30 @@ GtReplaceTextCompletionAction >> finishCompletionOn: aCompletionController moveC insert ] -{ #category : 'comparing' } +{ #category : #comparing } GtReplaceTextCompletionAction >> hash [ ^ super hash bitXor: text hash ] -{ #category : 'executing' } +{ #category : #executing } GtReplaceTextCompletionAction >> previewOn: aCompletionController [ ] -{ #category : 'accessing' } +{ #category : #accessing } GtReplaceTextCompletionAction >> searchStartPosition [ ^ 1 ] -{ #category : 'accessing' } +{ #category : #accessing } GtReplaceTextCompletionAction >> text [ ^ text ] -{ #category : 'accessing' } +{ #category : #accessing } GtReplaceTextCompletionAction >> text: anObject [ text := anObject ] -{ #category : 'executing' } +{ #category : #executing } GtReplaceTextCompletionAction >> undoPreviewOn: aCompletionController [ ] diff --git a/src/GToolkit-Coder/GtSearchBinaryFilter.class.st b/src/GToolkit-Coder/GtSearchBinaryFilter.class.st index f07d67f74..b6d6c08b1 100644 --- a/src/GToolkit-Coder/GtSearchBinaryFilter.class.st +++ b/src/GToolkit-Coder/GtSearchBinaryFilter.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtSearchBinaryFilter', - #superclass : 'GtSearchFilter', + #name : #GtSearchBinaryFilter, + #superclass : #GtSearchFilter, #instVars : [ 'left', 'right' @@ -8,20 +8,20 @@ Class { #category : 'GToolkit-Coder-Filters' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtSearchBinaryFilter class >> forFilter: leftFilter filter: rightFilter [ ^ self new filter: leftFilter filter: rightFilter; yourself ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtSearchBinaryFilter >> filter: leftFilter filter: rightFilter [ left := leftFilter. right := rightFilter ] -{ #category : 'accessing' } +{ #category : #accessing } GtSearchBinaryFilter >> highlighter [ ^ left highlighter ifNil: [ right highlighter ] @@ -32,17 +32,17 @@ GtSearchBinaryFilter >> highlighter [ [ :rh | GtCompositeHighlighter forHighlighters: (Array with: lh with: rh) ] ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtSearchBinaryFilter >> leftFilter [ ^ left ] -{ #category : 'accessing' } +{ #category : #accessing } GtSearchBinaryFilter >> resultType [ ^ left resultType mergeTypeWith: right resultType ] -{ #category : 'accessing' } +{ #category : #accessing } GtSearchBinaryFilter >> rightFilter [ ^ right ] diff --git a/src/GToolkit-Coder/GtSearchBlockFilter.class.st b/src/GToolkit-Coder/GtSearchBlockFilter.class.st index b9c02df4c..e4d93fb39 100644 --- a/src/GToolkit-Coder/GtSearchBlockFilter.class.st +++ b/src/GToolkit-Coder/GtSearchBlockFilter.class.st @@ -1,30 +1,30 @@ Class { - #name : 'GtSearchBlockFilter', - #superclass : 'GtSearchFilter', + #name : #GtSearchBlockFilter, + #superclass : #GtSearchFilter, #instVars : [ 'block' ], #category : 'GToolkit-Coder-Filters' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtSearchBlockFilter class >> forBlock: aBlock [ ^ self new block: aBlock; yourself ] -{ #category : 'accessing' } +{ #category : #accessing } GtSearchBlockFilter >> block [ ^ block ] -{ #category : 'accessing' } +{ #category : #accessing } GtSearchBlockFilter >> block: aBlock [ block := aBlock ] -{ #category : 'testing' } +{ #category : #testing } GtSearchBlockFilter >> matches: anObject [ ^ block value: anObject ] diff --git a/src/GToolkit-Coder/GtSearchFilter.class.st b/src/GToolkit-Coder/GtSearchFilter.class.st index 93788cde9..7047846ca 100644 --- a/src/GToolkit-Coder/GtSearchFilter.class.st +++ b/src/GToolkit-Coder/GtSearchFilter.class.st @@ -1,54 +1,54 @@ Class { - #name : 'GtSearchFilter', - #superclass : 'Object', + #name : #GtSearchFilter, + #superclass : #Object, #category : 'GToolkit-Coder-Filters' } -{ #category : 'logical operations' } +{ #category : #'logical operations' } GtSearchFilter >> & aFilter [ ^ GtSearchIntersectionFilter forFilter: self filter: aFilter ] -{ #category : 'evaluating' } +{ #category : #evaluating } GtSearchFilter >> applyInScope: aSearchScope [ ^ self resultType new scope: aSearchScope; filter: self ] -{ #category : 'evaluating' } +{ #category : #evaluating } GtSearchFilter >> applyInScopeStream: aStream [ ^ self resultTypeStream new forFilter: self scope: aStream ] -{ #category : 'converting' } +{ #category : #converting } GtSearchFilter >> asCoder [ ^ self result asCoder ] -{ #category : 'converting' } +{ #category : #converting } GtSearchFilter >> asElement [ ^ self asCoder asElement ] -{ #category : 'accessing' } +{ #category : #accessing } GtSearchFilter >> defaultFilterScope [ ^ GtSearchNullFilter new ] -{ #category : 'accessing' } +{ #category : #accessing } GtSearchFilter >> defaultFilterScopeStream [ ^ AsyncEmptyStream new ] -{ #category : 'iterating' } +{ #category : #iterating } GtSearchFilter >> do: aBlock [ self result do: aBlock ] -{ #category : 'converting' } +{ #category : #converting } GtSearchFilter >> gtExamples [ | examples | examples := OrderedCollection new. @@ -56,7 +56,7 @@ GtSearchFilter >> gtExamples [ ^ GtExampleGroup withAll: examples ] -{ #category : 'ui' } +{ #category : #ui } GtSearchFilter >> gtItemsFor: aView [ "this is a view that is polymorphic with the one defined in ${method:Collection>>#gtItemsFor:}$" @@ -67,69 +67,69 @@ GtSearchFilter >> gtItemsFor: aView [ view: #gtItemsFor: ] -{ #category : 'accessing' } +{ #category : #accessing } GtSearchFilter >> highlighter [ ^ nil ] -{ #category : 'accessing' } +{ #category : #accessing } GtSearchFilter >> isEmpty [ ^ self result isEmpty ] -{ #category : 'testing' } +{ #category : #testing } GtSearchFilter >> matches: anObject [ self subclassResponsibility ] -{ #category : 'logical operations' } +{ #category : #'logical operations' } GtSearchFilter >> not [ ^ GtSearchNegationFilter new originalFilter: self ] -{ #category : 'testing' } +{ #category : #testing } GtSearchFilter >> notEmpty [ ^ self isEmpty not ] -{ #category : 'converting' } +{ #category : #converting } GtSearchFilter >> result [ ^ self applyInScope: self defaultFilterScope ] -{ #category : 'converting' } +{ #category : #converting } GtSearchFilter >> resultStream [ ^ self applyInScopeStream: self defaultFilterScopeStream ] -{ #category : 'accessing' } +{ #category : #accessing } GtSearchFilter >> resultType [ ^ GtSearchNullGroupResult ] -{ #category : 'accessing' } +{ #category : #accessing } GtSearchFilter >> resultTypeStream [ ^ GtAsyncSearchNullGroupStream ] -{ #category : 'logical operations' } +{ #category : #'logical operations' } GtSearchFilter >> select: aBlock [ ^ self & (GtSearchBlockFilter forBlock: aBlock) ] -{ #category : 'accessing' } +{ #category : #accessing } GtSearchFilter >> size [ ^ self result size ] -{ #category : 'testing' } +{ #category : #testing } GtSearchFilter >> value: anObject [ "To be polymorphic with block closures" ^ self matches: anObject ] -{ #category : 'logical operations' } +{ #category : #'logical operations' } GtSearchFilter >> | aFilter [ ^ GtSearchUnionFilter forFilter: self filter: aFilter ] diff --git a/src/GToolkit-Coder/GtSearchGroupResult.class.st b/src/GToolkit-Coder/GtSearchGroupResult.class.st index 619aae714..a3bab008b 100644 --- a/src/GToolkit-Coder/GtSearchGroupResult.class.st +++ b/src/GToolkit-Coder/GtSearchGroupResult.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtSearchGroupResult', - #superclass : 'Object', + #name : #GtSearchGroupResult, + #superclass : #Object, #instVars : [ 'items', 'filter', @@ -10,59 +10,59 @@ Class { #category : 'GToolkit-Coder-Filters' } -{ #category : 'as yet unclassified' } +{ #category : #'as yet unclassified' } GtSearchGroupResult class >> mergeTypeWith: aGroupResultClass [ ^ aGroupResultClass mergeTypeWithDefaultGroup ] -{ #category : 'as yet unclassified' } +{ #category : #'as yet unclassified' } GtSearchGroupResult class >> mergeTypeWithDefaultGroup [ "The common type between the default group and any other group is the other group." ^ self ] -{ #category : 'as yet unclassified' } +{ #category : #'as yet unclassified' } GtSearchGroupResult class >> mergeTypeWithGenericGroup [ "The common type between a generic group and any other group is the other group." ^ self ] -{ #category : 'as yet unclassified' } +{ #category : #'as yet unclassified' } GtSearchGroupResult class >> mergeTypeWithTypedGroup: aGroupType [ ^ self ] -{ #category : 'adding' } +{ #category : #adding } GtSearchGroupResult >> add: anObject [ self refreshItems. ^ items add: anObject ] -{ #category : 'enumerating' } +{ #category : #enumerating } GtSearchGroupResult >> collect: aBlock [ self refreshItems. ^ items collect: aBlock ] -{ #category : 'enumerating' } +{ #category : #enumerating } GtSearchGroupResult >> do: aBlock [ self refreshItems. ^ items do: aBlock ] -{ #category : 'accessing' } +{ #category : #accessing } GtSearchGroupResult >> filter [ ^ filter ] -{ #category : 'accessing' } +{ #category : #accessing } GtSearchGroupResult >> filter: methodsFilter [ filtered := false. items := OrderedCollection new. filter := methodsFilter ] -{ #category : 'enumerating' } +{ #category : #enumerating } GtSearchGroupResult >> groupedBy: aBlockClosureOrSymbol [ "Group the filteres items using the given block. The returned groups are just a copy based on the current items at the time of the call. They are not updated if the filtered items change." @@ -70,7 +70,7 @@ GtSearchGroupResult >> groupedBy: aBlockClosureOrSymbol [ ^ items groupedBy: aBlockClosureOrSymbol ] -{ #category : 'ui' } +{ #category : #ui } GtSearchGroupResult >> gtItemsFor: aView [ self refreshItems. @@ -80,33 +80,33 @@ GtSearchGroupResult >> gtItemsFor: aView [ items: [ items ifNil: [ #() ] ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtSearchGroupResult >> highlighter [ ^ filter notNil ifTrue: [ filter highlighter ] ifFalse: [ nil ] ] -{ #category : 'as yet unclassified' } +{ #category : #'as yet unclassified' } GtSearchGroupResult >> includes: aCollection [ self refreshItems. ^ items includes: aCollection ] -{ #category : 'initialization' } +{ #category : #initialization } GtSearchGroupResult >> initialize [ super initialize. filtered := false. items := OrderedCollection new. ] -{ #category : 'testing' } +{ #category : #testing } GtSearchGroupResult >> isEmpty [ "Answer whether the receiver contains any elements." ^ self size = 0 ] -{ #category : 'enumerating' } +{ #category : #enumerating } GtSearchGroupResult >> refreshItems [ | filteredItems | filtered @@ -120,41 +120,41 @@ GtSearchGroupResult >> refreshItems [ filtered := true. ] -{ #category : 'removing' } +{ #category : #removing } GtSearchGroupResult >> remove: anItem ifAbsent: aBlock [ self refreshItems. ^ items remove: anItem ifAbsent: aBlock ] -{ #category : 'accessing' } +{ #category : #accessing } GtSearchGroupResult >> scope [ ^ scope ] -{ #category : 'accessing' } +{ #category : #accessing } GtSearchGroupResult >> scope: aSearchScope [ scope := aSearchScope ] -{ #category : 'accessing' } +{ #category : #accessing } GtSearchGroupResult >> size [ self refreshItems. ^ items size ] -{ #category : 'private' } +{ #category : #private } GtSearchGroupResult >> species [ self refreshItems. ^ items class ] -{ #category : 'enumerating' } +{ #category : #enumerating } GtSearchGroupResult >> sumNumbers: aBlock [ self refreshItems. ^ items sumNumbers: aBlock ] -{ #category : 'initialization' } +{ #category : #initialization } GtSearchGroupResult >> updateForFilter: aFilter [ self filter: aFilter. self scope: (aFilter diff --git a/src/GToolkit-Coder/GtSearchIntersectionFilter.class.st b/src/GToolkit-Coder/GtSearchIntersectionFilter.class.st index 519943ec6..38dc9af3f 100644 --- a/src/GToolkit-Coder/GtSearchIntersectionFilter.class.st +++ b/src/GToolkit-Coder/GtSearchIntersectionFilter.class.st @@ -1,27 +1,27 @@ Class { - #name : 'GtSearchIntersectionFilter', - #superclass : 'GtSearchBinaryFilter', + #name : #GtSearchIntersectionFilter, + #superclass : #GtSearchBinaryFilter, #category : 'GToolkit-Coder-Filters' } -{ #category : 'accessing' } +{ #category : #accessing } GtSearchIntersectionFilter >> defaultFilterScope [ ^ left defaultFilterScope ] -{ #category : 'printing' } +{ #category : #printing } GtSearchIntersectionFilter >> gtDisplayOn: stream [ left gtDisplayOn: stream. stream nextPutAll: ' & '. right gtDisplayOn: stream. ] -{ #category : 'testing' } +{ #category : #testing } GtSearchIntersectionFilter >> matches: anObject [ ^ (left matches: anObject) and: [ right matches: anObject ] ] -{ #category : 'printing' } +{ #category : #printing } GtSearchIntersectionFilter >> printOn: stream [ left printOn: stream. stream nextPutAll: ' & '. diff --git a/src/GToolkit-Coder/GtSearchNegationFilter.class.st b/src/GToolkit-Coder/GtSearchNegationFilter.class.st index 4898417bf..379ea350b 100644 --- a/src/GToolkit-Coder/GtSearchNegationFilter.class.st +++ b/src/GToolkit-Coder/GtSearchNegationFilter.class.st @@ -1,45 +1,45 @@ Class { - #name : 'GtSearchNegationFilter', - #superclass : 'GtSearchFilter', + #name : #GtSearchNegationFilter, + #superclass : #GtSearchFilter, #instVars : [ 'originalFilter' ], #category : 'GToolkit-Coder-Filters' } -{ #category : 'accessing' } +{ #category : #accessing } GtSearchNegationFilter >> defaultFilterScope [ ^ originalFilter defaultFilterScope ] -{ #category : 'printing' } +{ #category : #printing } GtSearchNegationFilter >> gtDisplayOn: stream [ self originalFilter gtDisplayOn: stream. stream nextPutAll: ' not' ] -{ #category : 'testing' } +{ #category : #testing } GtSearchNegationFilter >> matches: anObject [ ^ (self originalFilter matches: anObject) not ] -{ #category : 'accessing' } +{ #category : #accessing } GtSearchNegationFilter >> originalFilter [ ^ originalFilter ] -{ #category : 'accessing' } +{ #category : #accessing } GtSearchNegationFilter >> originalFilter: anObject [ originalFilter := anObject ] -{ #category : 'printing' } +{ #category : #printing } GtSearchNegationFilter >> printOn: stream [ self originalFilter printOn: stream. stream nextPutAll: ' not' ] -{ #category : 'accessing' } +{ #category : #accessing } GtSearchNegationFilter >> resultType [ ^ originalFilter resultType ] diff --git a/src/GToolkit-Coder/GtSearchNullFilter.class.st b/src/GToolkit-Coder/GtSearchNullFilter.class.st index 7c0f3349f..8496f68ac 100644 --- a/src/GToolkit-Coder/GtSearchNullFilter.class.st +++ b/src/GToolkit-Coder/GtSearchNullFilter.class.st @@ -1,26 +1,26 @@ Class { - #name : 'GtSearchNullFilter', - #superclass : 'GtSearchFilter', + #name : #GtSearchNullFilter, + #superclass : #GtSearchFilter, #category : 'GToolkit-Coder-Filters' } -{ #category : 'comparing' } +{ #category : #comparing } GtSearchNullFilter >> = anObject [ self == anObject ifTrue: [ ^ true ]. self class = anObject class ifFalse: [ ^ false ]. ^ true ] -{ #category : 'accessing' } +{ #category : #accessing } GtSearchNullFilter >> defaultFilterScope [ ^ self ] -{ #category : 'enumerating' } +{ #category : #enumerating } GtSearchNullFilter >> itemsDo: aBloc [ ] -{ #category : 'testing' } +{ #category : #testing } GtSearchNullFilter >> matches: anObject [ ^ false ] diff --git a/src/GToolkit-Coder/GtSearchNullGroupResult.class.st b/src/GToolkit-Coder/GtSearchNullGroupResult.class.st index 66a794410..f8990c7df 100644 --- a/src/GToolkit-Coder/GtSearchNullGroupResult.class.st +++ b/src/GToolkit-Coder/GtSearchNullGroupResult.class.st @@ -1,20 +1,20 @@ Class { - #name : 'GtSearchNullGroupResult', - #superclass : 'GtSearchGroupResult', + #name : #GtSearchNullGroupResult, + #superclass : #GtSearchGroupResult, #category : 'GToolkit-Coder-Filters' } -{ #category : 'as yet unclassified' } +{ #category : #'as yet unclassified' } GtSearchNullGroupResult class >> mergeTypeWith: aGroupResultClass [ ^ aGroupResultClass mergeTypeWithGenericGroup. ] -{ #category : 'as yet unclassified' } +{ #category : #'as yet unclassified' } GtSearchNullGroupResult class >> mergeTypeWithTypedGroup: aGroupType [ ^ aGroupType ] -{ #category : 'enumerating' } +{ #category : #enumerating } GtSearchNullGroupResult >> refreshItems [ filtered ifTrue: [ ^ self ]. diff --git a/src/GToolkit-Coder/GtSearchTypedEntitiesFilter.class.st b/src/GToolkit-Coder/GtSearchTypedEntitiesFilter.class.st index 845c3a165..356520c79 100644 --- a/src/GToolkit-Coder/GtSearchTypedEntitiesFilter.class.st +++ b/src/GToolkit-Coder/GtSearchTypedEntitiesFilter.class.st @@ -1,25 +1,25 @@ Class { - #name : 'GtSearchTypedEntitiesFilter', - #superclass : 'GtSearchFilter', + #name : #GtSearchTypedEntitiesFilter, + #superclass : #GtSearchFilter, #category : 'GToolkit-Coder-Filters' } -{ #category : 'accessing' } +{ #category : #accessing } GtSearchTypedEntitiesFilter class >> resultType [ self subclassResponsibility ] -{ #category : 'accessing' } +{ #category : #accessing } GtSearchTypedEntitiesFilter class >> resultTypeStream [ self subclassResponsibility ] -{ #category : 'accessing' } +{ #category : #accessing } GtSearchTypedEntitiesFilter >> resultType [ ^ self class resultType ] -{ #category : 'accessing' } +{ #category : #accessing } GtSearchTypedEntitiesFilter >> resultTypeStream [ ^ self class resultTypeStream ] diff --git a/src/GToolkit-Coder/GtSearchTypedGroupResult.class.st b/src/GToolkit-Coder/GtSearchTypedGroupResult.class.st index 9683e2937..4b339f15a 100644 --- a/src/GToolkit-Coder/GtSearchTypedGroupResult.class.st +++ b/src/GToolkit-Coder/GtSearchTypedGroupResult.class.st @@ -1,36 +1,36 @@ Class { - #name : 'GtSearchTypedGroupResult', - #superclass : 'GtSearchGroupResult', + #name : #GtSearchTypedGroupResult, + #superclass : #GtSearchGroupResult, #instVars : [ 'announcer' ], #category : 'GToolkit-Coder-Filters' } -{ #category : 'as yet unclassified' } +{ #category : #'as yet unclassified' } GtSearchTypedGroupResult class >> mergeTypeWith: aGroupResultClass [ ^ aGroupResultClass mergeTypeWithTypedGroup: self. ] -{ #category : 'as yet unclassified' } +{ #category : #'as yet unclassified' } GtSearchTypedGroupResult class >> mergeTypeWithTypedGroup: aGroupType [ ^ aGroupType = self ifTrue: [ self ] ifFalse: [ GtSearchGroupResult ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtSearchTypedGroupResult >> announcer [ ^ announcer ] -{ #category : 'initialization' } +{ #category : #initialization } GtSearchTypedGroupResult >> initialize [ super initialize. announcer := Announcer new. self subscribe ] -{ #category : 'subscription' } +{ #category : #subscription } GtSearchTypedGroupResult >> subscribe [ ] diff --git a/src/GToolkit-Coder/GtSearchUnionFilter.class.st b/src/GToolkit-Coder/GtSearchUnionFilter.class.st index 8fca1002d..b32162580 100644 --- a/src/GToolkit-Coder/GtSearchUnionFilter.class.st +++ b/src/GToolkit-Coder/GtSearchUnionFilter.class.st @@ -1,17 +1,17 @@ Class { - #name : 'GtSearchUnionFilter', - #superclass : 'GtSearchBinaryFilter', + #name : #GtSearchUnionFilter, + #superclass : #GtSearchBinaryFilter, #category : 'GToolkit-Coder-Filters' } -{ #category : 'accessing' } +{ #category : #accessing } GtSearchUnionFilter >> defaultFilterScope [ ^ left defaultFilterScope = right defaultFilterScope ifTrue: [ left defaultFilterScope ] ifFalse: [ self ] ] -{ #category : 'printing' } +{ #category : #printing } GtSearchUnionFilter >> gtDisplayOn: stream [ left gtDisplayOn: stream. stream nextPutAll: ' | '. @@ -19,7 +19,7 @@ GtSearchUnionFilter >> gtDisplayOn: stream [ ] -{ #category : 'enumerating' } +{ #category : #enumerating } GtSearchUnionFilter >> itemsDo: aBlock [ | seen | seen := IdentitySet new. @@ -33,12 +33,12 @@ GtSearchUnionFilter >> itemsDo: aBlock [ ifFalse: [ aBlock value: each ] ] ] -{ #category : 'testing' } +{ #category : #testing } GtSearchUnionFilter >> matches: anObject [ ^ (left matches: anObject) or: [ right matches: anObject ] ] -{ #category : 'printing' } +{ #category : #printing } GtSearchUnionFilter >> printOn: stream [ left printOn: stream. stream nextPutAll: ' | '. diff --git a/src/GToolkit-Coder/GtSourceCoder.class.st b/src/GToolkit-Coder/GtSourceCoder.class.st index 45c42279c..09e840592 100644 --- a/src/GToolkit-Coder/GtSourceCoder.class.st +++ b/src/GToolkit-Coder/GtSourceCoder.class.st @@ -15,17 +15,17 @@ To add support for code debugging the subclasses must implement " Class { - #name : 'GtSourceCoder', - #superclass : 'GtTextualCoder', + #name : #GtSourceCoder, + #superclass : #GtTextualCoder, #category : 'GToolkit-Coder-Coders' } -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoder >> debug [ self debugInContext: self evaluationContext ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtSourceCoder >> debug: aSourceStringOrBlock inContext: aGtSourceCoderEvaluationContext [ | aSourceString aSourceInterval aCompleteSourceString | @@ -47,12 +47,12 @@ GtSourceCoder >> debug: aSourceStringOrBlock inContext: aGtSourceCoderEvaluation onFailDo: [ self error: 'Failed to debug' ] ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoder >> debugInContext: aGtSourceCoderEvaluationContext [ self debug: self currentSourceString inContext: aGtSourceCoderEvaluationContext ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoder >> discardChanges [ "Discard not-accepted changes." @@ -65,7 +65,7 @@ GtSourceCoder >> discardChanges [ self sourceChanged ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoder >> doItAll [ "Evaluate the whole source code in a default evaluation context and return the result. See the implementation of #evaluationContext to find the default state" @@ -73,7 +73,7 @@ GtSourceCoder >> doItAll [ ^ self doItInContext: self evaluationContext ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoder >> doItAndGo [ "Evaluate and inspect the whole source code in a default evaluation context and return the result. See the implementation of #evaluationContext to find the default state" @@ -81,7 +81,7 @@ GtSourceCoder >> doItAndGo [ ^ self doItAndGoInContext: self evaluationContext ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoder >> doItAndGoInContext: aGtSourceCoderEvaluationContext [ ^ self evaluate: [ :thisCoder | thisCoder currentSourceString ] @@ -91,14 +91,14 @@ GtSourceCoder >> doItAndGoInContext: aGtSourceCoderEvaluationContext [ self notifyObjectSpawnFromEvaluationResult: anEvaluationResult ] ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoder >> doItInContext: aGtSourceCoderEvaluationContext [ ^ self doItInContext: aGtSourceCoderEvaluationContext thenDo: [ :aResult | self notifyEvaluatedWithResult: aResult ] ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoder >> doItInContext: aGtSourceCoderEvaluationContext thenDo: aBlock [ ^ self evaluate: [ :thisCoder | thisCoder currentSourceString ] @@ -106,7 +106,7 @@ GtSourceCoder >> doItInContext: aGtSourceCoderEvaluationContext thenDo: aBlock [ thenDo: aBlock ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtSourceCoder >> evaluate: aSourceStringOrBlock [ "Evaluate a given source code and show the print string if needed" @@ -115,7 +115,7 @@ GtSourceCoder >> evaluate: aSourceStringOrBlock [ thenDo: [ ] ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtSourceCoder >> evaluate: aSourceStringOrBlock decorated: aSourceCodeDecorator inContext: aSourceCoderEvaluationContext thenDo: aThenBlock [ "Evaluate a given source code" | aCompleteSourceString aSourceString aSourceInterval aResult aDecoratedSourceString | @@ -158,7 +158,7 @@ GtSourceCoder >> evaluate: aSourceStringOrBlock decorated: aSourceCodeDecorator ^ aResult ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtSourceCoder >> evaluate: aSourceStringOrBlock inContext: aGtSourceCoderEvaluationContext thenDo: aThenBlock [ ^ self evaluate: aSourceStringOrBlock @@ -167,7 +167,7 @@ GtSourceCoder >> evaluate: aSourceStringOrBlock inContext: aGtSourceCoderEvaluat thenDo: aThenBlock ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtSourceCoder >> evaluate: aSourceStringOrBlock thenDo: aThenBlock [ "Evaluate a given source code and show the print string if needed" @@ -177,7 +177,7 @@ GtSourceCoder >> evaluate: aSourceStringOrBlock thenDo: aThenBlock [ thenDo: aThenBlock ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtSourceCoder >> evaluateBlock: aBlock onErrorDo: anErrorBlock [ | aResult wasErrorAlreadySignaled | @@ -228,7 +228,7 @@ GtSourceCoder >> evaluateBlock: aBlock onErrorDo: anErrorBlock [ ^ GtSourceCoderEvaluationResultWithValue new value: aResult ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtSourceCoder >> evaluationContext [ @@ -237,34 +237,34 @@ GtSourceCoder >> evaluationContext [ coder: self ] -{ #category : 'testing' } +{ #category : #testing } GtSourceCoder >> hasImplicitVariableReferenceTo: aString [ self implicitVariableReferencesTo: aString do: [ :each | ^ true ]. ^ false ] -{ #category : 'api - ast' } +{ #category : #'api - ast' } GtSourceCoder >> implicitVariableReferencesTo: aString do: aBlock [ "Evaluate aBlock for every ast node that is a variable reference to an implicitly defined variable named aString." ] -{ #category : 'private - notifying' } +{ #category : #'private - notifying' } GtSourceCoder >> notifyEvaluatedWithResult: anEvaluationResult [ self announce: (GtCoderEvaluationAnnouncement new evaluationResult: anEvaluationResult; coder: self) ] -{ #category : 'private - notifying' } +{ #category : #'private - notifying' } GtSourceCoder >> notifyObjectSpawn: anObject [ self notifyObjectSpawn: anObject withDestination: self spawnDestination ] -{ #category : 'private - notifying' } +{ #category : #'private - notifying' } GtSourceCoder >> notifyObjectSpawn: anObject withDestination: aSpawnDestination [ self announce: (GtCoderObjectSpawnRequest new object: anObject; @@ -272,7 +272,7 @@ GtSourceCoder >> notifyObjectSpawn: anObject withDestination: aSpawnDestination coder: self) ] -{ #category : 'private - notifying' } +{ #category : #'private - notifying' } GtSourceCoder >> notifyObjectSpawnFromEvaluationResult: anEvaluationResult [ anEvaluationResult isSuccess @@ -282,14 +282,14 @@ GtSourceCoder >> notifyObjectSpawnFromEvaluationResult: anEvaluationResult [ notifyObjectSpawn: anEvaluationResult value ] -{ #category : 'private - notifying' } +{ #category : #'private - notifying' } GtSourceCoder >> notifyPrintResult: anEvaluationResult [ self announce: (GtCoderPrintAnnouncement new evaluationResult: anEvaluationResult; coder: self) ] -{ #category : 'private - notifying' } +{ #category : #'private - notifying' } GtSourceCoder >> notifyShowDebuggerRequest: aDebugSession dueTo: anException sourceString: aSourceString sourceInterval: aSourceInterval [ (self announcer subscriptionsForClass: GtCoderShowDebuggerRequest) size isZero ifTrue: [ @@ -305,17 +305,17 @@ GtSourceCoder >> notifyShowDebuggerRequest: aDebugSession dueTo: anException sou sourceInterval: aSourceInterval) ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtSourceCoder >> primitiveDebug: aSourceString inContext: aGtSourceCoderEvaluationContext onFailDo: anEvaluationFailBlock [ ^ self subclassResponsibility ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtSourceCoder >> primitiveEvaluate: aSourceString inContext: aGtSourceCoderEvaluationContext onFailDo: anEvaluationFailBlock [ ^ self subclassResponsibility ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoder >> printItInContext: aGtSourceCoderEvaluationContext [ ^ self evaluate: [ :thisCoder | thisCoder currentSourceString ] @@ -323,7 +323,7 @@ GtSourceCoder >> printItInContext: aGtSourceCoderEvaluationContext [ thenDo: [ :aResult | self notifyPrintResult: aResult ] ] -{ #category : 'api - ast' } +{ #category : #'api - ast' } GtSourceCoder >> renameImplicitTemporary: oldName to: newName [ | source | source := SmaCCString on: self currentSourceString. @@ -338,14 +338,14 @@ GtSourceCoder >> renameImplicitTemporary: oldName to: newName [ self currentSourceString: source asString ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoder >> spawnDestination [ ^ self attributeNamed: #spawnDestination ifAbsent: [ GtPhlowSpawnDesiredDestination defaultDestination ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoder >> spawnDestination: aSpawnDestination [ self attributeNamed: #spawnDestination put: aSpawnDestination ] diff --git a/src/GToolkit-Coder/GtSourceCoderAnnouncement.class.st b/src/GToolkit-Coder/GtSourceCoderAnnouncement.class.st index 6fd415fb2..463dae0e3 100644 --- a/src/GToolkit-Coder/GtSourceCoderAnnouncement.class.st +++ b/src/GToolkit-Coder/GtSourceCoderAnnouncement.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtSourceCoderAnnouncement', - #superclass : 'GtCoderAnnouncement', + #name : #GtSourceCoderAnnouncement, + #superclass : #GtCoderAnnouncement, #category : 'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtSourceCoderEvaluationAllSource.class.st b/src/GToolkit-Coder/GtSourceCoderEvaluationAllSource.class.st index ec51439c4..b10c4daea 100644 --- a/src/GToolkit-Coder/GtSourceCoderEvaluationAllSource.class.st +++ b/src/GToolkit-Coder/GtSourceCoderEvaluationAllSource.class.st @@ -1,17 +1,17 @@ Class { - #name : 'GtSourceCoderEvaluationAllSource', - #superclass : 'GtSourceCoderEvaluationSourceInterval', + #name : #GtSourceCoderEvaluationAllSource, + #superclass : #GtSourceCoderEvaluationSourceInterval, #category : 'GToolkit-Coder-Coders - Evaluation' } -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderEvaluationAllSource >> computeSourceInterval: aCompleteCoderSourceTextOrString [ ^ 1 to: aCompleteCoderSourceTextOrString size ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderEvaluationAllSource >> computeSourceString: aCompleteCoderSourceTextOrString [ diff --git a/src/GToolkit-Coder/GtSourceCoderEvaluationContext.class.st b/src/GToolkit-Coder/GtSourceCoderEvaluationContext.class.st index 9402d962d..7d6ea1ec2 100644 --- a/src/GToolkit-Coder/GtSourceCoderEvaluationContext.class.st +++ b/src/GToolkit-Coder/GtSourceCoderEvaluationContext.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtSourceCoderEvaluationContext', - #superclass : 'Object', + #name : #GtSourceCoderEvaluationContext, + #superclass : #Object, #instVars : [ 'coder', 'requesterObject', @@ -12,44 +12,44 @@ Class { #category : 'GToolkit-Coder-Coders - Evaluation' } -{ #category : 'api - context' } +{ #category : #'api - context' } GtSourceCoderEvaluationContext >> all [ sourceInterval := GtSourceCoderEvaluationAllSource new ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationContext >> coder [ ^ coder ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationContext >> coder: aGtSourceCoder [ coder := aGtSourceCoder ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationContext >> evaluatedInterval [ ^ evaluatedInterval ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationContext >> evaluatedInterval: anObject [ evaluatedInterval := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationContext >> evaluatedSourceString [ ^ evaluatedSourceString ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationContext >> evaluatedSourceString: anObject [ evaluatedSourceString := anObject ] -{ #category : 'api - context' } +{ #category : #'api - context' } GtSourceCoderEvaluationContext >> from: aStartPosition to: aStopPosition [ sourceInterval := GtSourceCoderEvaluationPartialSource new startPosition: aStartPosition; @@ -57,41 +57,41 @@ GtSourceCoderEvaluationContext >> from: aStartPosition to: aStopPosition [ yourself ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderEvaluationContext >> initialize [ super initialize. sourceInterval := GtSourceCoderEvaluationAllSource new ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationContext >> requesterObject [ ^ requesterObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationContext >> requesterObject: anObject [ requesterObject := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationContext >> sourceInterval [ ^ sourceInterval ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationContext >> sourceInterval: aGtSourceCoderEvaluationSourceInterval [ sourceInterval := aGtSourceCoderEvaluationSourceInterval ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationContext >> sourceString [ ^ sourceString ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationContext >> sourceString: anObject [ "Set the complete source string of the coder at the moment of the evaluation" diff --git a/src/GToolkit-Coder/GtSourceCoderEvaluationPartialSource.class.st b/src/GToolkit-Coder/GtSourceCoderEvaluationPartialSource.class.st index 57ef3cf5d..de404c59b 100644 --- a/src/GToolkit-Coder/GtSourceCoderEvaluationPartialSource.class.st +++ b/src/GToolkit-Coder/GtSourceCoderEvaluationPartialSource.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtSourceCoderEvaluationPartialSource', - #superclass : 'GtSourceCoderEvaluationSourceInterval', + #name : #GtSourceCoderEvaluationPartialSource, + #superclass : #GtSourceCoderEvaluationSourceInterval, #instVars : [ 'startPosition', 'stopPosition' @@ -8,7 +8,7 @@ Class { #category : 'GToolkit-Coder-Coders - Evaluation' } -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderEvaluationPartialSource >> computeSourceInterval: aCompleteCoderSourceTextOrString [ @@ -16,7 +16,7 @@ GtSourceCoderEvaluationPartialSource >> computeSourceInterval: aCompleteCoderSou to: (self stopPosition min: aCompleteCoderSourceTextOrString size) ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderEvaluationPartialSource >> computeSourceString: aCompleteCoderSourceTextOrString [ | anInterval | @@ -26,22 +26,22 @@ GtSourceCoderEvaluationPartialSource >> computeSourceString: aCompleteCoderSourc ^ (aCompleteCoderSourceTextOrString copyFrom: anInterval first to: anInterval last) asString ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationPartialSource >> startPosition [ ^ startPosition ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationPartialSource >> startPosition: anObject [ startPosition := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationPartialSource >> stopPosition [ ^ stopPosition ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationPartialSource >> stopPosition: anObject [ stopPosition := anObject ] diff --git a/src/GToolkit-Coder/GtSourceCoderEvaluationResult.class.st b/src/GToolkit-Coder/GtSourceCoderEvaluationResult.class.st index c2c41c65b..b843f9fa8 100644 --- a/src/GToolkit-Coder/GtSourceCoderEvaluationResult.class.st +++ b/src/GToolkit-Coder/GtSourceCoderEvaluationResult.class.st @@ -1,66 +1,66 @@ Class { - #name : 'GtSourceCoderEvaluationResult', - #superclass : 'Object', + #name : #GtSourceCoderEvaluationResult, + #superclass : #Object, #instVars : [ 'evaluationContext' ], #category : 'GToolkit-Coder-Coders - Evaluation' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationResult >> evaluationContext [ ^ evaluationContext ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationResult >> evaluationContext: anObject [ evaluationContext := anObject ] -{ #category : 'testing' } +{ #category : #testing } GtSourceCoderEvaluationResult >> isError [ ^ self isRuntimeError or: [ self isSyntaxError ] ] -{ #category : 'testing' } +{ #category : #testing } GtSourceCoderEvaluationResult >> isRuntimeError [ ^ false ] -{ #category : 'testing' } +{ #category : #testing } GtSourceCoderEvaluationResult >> isSuccess [ ^ false ] -{ #category : 'testing' } +{ #category : #testing } GtSourceCoderEvaluationResult >> isSyntaxError [ ^ false ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationResult >> requesterObject [ ^ self evaluationContext requesterObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationResult >> sourceCoder [ ^ self evaluationContext coder ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationResult >> sourceInterval [ ^ self evaluationContext evaluatedInterval ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationResult >> sourceInterval: anObject [ ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationResult >> sourceString [ ^ self evaluationContext evaluatedSourceString ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationResult >> sourceString: anObject [ ] diff --git a/src/GToolkit-Coder/GtSourceCoderEvaluationResultWithRuntimeError.class.st b/src/GToolkit-Coder/GtSourceCoderEvaluationResultWithRuntimeError.class.st index c9de298f5..41ba6bcbd 100644 --- a/src/GToolkit-Coder/GtSourceCoderEvaluationResultWithRuntimeError.class.st +++ b/src/GToolkit-Coder/GtSourceCoderEvaluationResultWithRuntimeError.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtSourceCoderEvaluationResultWithRuntimeError', - #superclass : 'GtSourceCoderEvaluationResult', + #name : #GtSourceCoderEvaluationResultWithRuntimeError, + #superclass : #GtSourceCoderEvaluationResult, #instVars : [ 'error', 'isResignaled' @@ -8,27 +8,27 @@ Class { #category : 'GToolkit-Coder-Coders - Evaluation' } -{ #category : 'error handling' } +{ #category : #'error handling' } GtSourceCoderEvaluationResultWithRuntimeError >> error [ ^ error ] -{ #category : 'error handling' } +{ #category : #'error handling' } GtSourceCoderEvaluationResultWithRuntimeError >> error: anError [ error := anError ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationResultWithRuntimeError >> isResignaled [ ^ isResignaled ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationResultWithRuntimeError >> isResignaled: anObject [ isResignaled := anObject ] -{ #category : 'testing' } +{ #category : #testing } GtSourceCoderEvaluationResultWithRuntimeError >> isRuntimeError [ ^ true ] diff --git a/src/GToolkit-Coder/GtSourceCoderEvaluationResultWithSyntaxError.class.st b/src/GToolkit-Coder/GtSourceCoderEvaluationResultWithSyntaxError.class.st index b9f1ef3c5..f512a0e7e 100644 --- a/src/GToolkit-Coder/GtSourceCoderEvaluationResultWithSyntaxError.class.st +++ b/src/GToolkit-Coder/GtSourceCoderEvaluationResultWithSyntaxError.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtSourceCoderEvaluationResultWithSyntaxError', - #superclass : 'GtSourceCoderEvaluationResult', + #name : #GtSourceCoderEvaluationResultWithSyntaxError, + #superclass : #GtSourceCoderEvaluationResult, #category : 'GToolkit-Coder-Coders - Evaluation' } -{ #category : 'testing' } +{ #category : #testing } GtSourceCoderEvaluationResultWithSyntaxError >> isSyntaxError [ ^ true ] diff --git a/src/GToolkit-Coder/GtSourceCoderEvaluationResultWithValue.class.st b/src/GToolkit-Coder/GtSourceCoderEvaluationResultWithValue.class.st index 936127fb1..4451b21a0 100644 --- a/src/GToolkit-Coder/GtSourceCoderEvaluationResultWithValue.class.st +++ b/src/GToolkit-Coder/GtSourceCoderEvaluationResultWithValue.class.st @@ -1,23 +1,23 @@ Class { - #name : 'GtSourceCoderEvaluationResultWithValue', - #superclass : 'GtSourceCoderEvaluationResult', + #name : #GtSourceCoderEvaluationResultWithValue, + #superclass : #GtSourceCoderEvaluationResult, #instVars : [ 'value' ], #category : 'GToolkit-Coder-Coders - Evaluation' } -{ #category : 'testing' } +{ #category : #testing } GtSourceCoderEvaluationResultWithValue >> isSuccess [ ^ true ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationResultWithValue >> value [ ^ value ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationResultWithValue >> value: anObject [ value := anObject ] diff --git a/src/GToolkit-Coder/GtSourceCoderEvaluationSourceInterval.class.st b/src/GToolkit-Coder/GtSourceCoderEvaluationSourceInterval.class.st index 791f12207..a0e07f8c9 100644 --- a/src/GToolkit-Coder/GtSourceCoderEvaluationSourceInterval.class.st +++ b/src/GToolkit-Coder/GtSourceCoderEvaluationSourceInterval.class.st @@ -1,17 +1,17 @@ Class { - #name : 'GtSourceCoderEvaluationSourceInterval', - #superclass : 'Object', + #name : #GtSourceCoderEvaluationSourceInterval, + #superclass : #Object, #category : 'GToolkit-Coder-Coders - Evaluation' } -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderEvaluationSourceInterval >> computeSourceInterval: aCompleteCoderSourceTextOrString [ ^ self subclassResponsibility ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderEvaluationSourceInterval >> computeSourceString: aCompleteCoderSourceTextOrString [ diff --git a/src/GToolkit-Coder/GtSourceReferenceHighlighter.class.st b/src/GToolkit-Coder/GtSourceReferenceHighlighter.class.st index 8f2799231..64eb3e69d 100644 --- a/src/GToolkit-Coder/GtSourceReferenceHighlighter.class.st +++ b/src/GToolkit-Coder/GtSourceReferenceHighlighter.class.st @@ -1,13 +1,13 @@ Class { - #name : 'GtSourceReferenceHighlighter', - #superclass : 'GtCoderAstStyler', + #name : #GtSourceReferenceHighlighter, + #superclass : #GtCoderAstStyler, #classVars : [ 'HighlightAttributes' ], #category : 'GToolkit-Coder-Styler/Highlighter' } -{ #category : 'class initialization' } +{ #category : #'class initialization' } GtSourceReferenceHighlighter class >> initialize [ HighlightAttributes := { BlTextDecorationAttribute new diff --git a/src/GToolkit-Coder/GtTextCoder.class.st b/src/GToolkit-Coder/GtTextCoder.class.st index 7dd0bd82d..8adf480fe 100644 --- a/src/GToolkit-Coder/GtTextCoder.class.st +++ b/src/GToolkit-Coder/GtTextCoder.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtTextCoder', - #superclass : 'GtTextualCoder', + #name : #GtTextCoder, + #superclass : #GtTextualCoder, #instVars : [ 'parser', 'parserStartingState' @@ -8,7 +8,7 @@ Class { #category : 'GToolkit-Coder-Coders' } -{ #category : 'api - ast' } +{ #category : #'api - ast' } GtTextCoder >> computeAst: theSourceString [ ^ parser ifNil: [ theSourceString ] @@ -18,37 +18,37 @@ GtTextCoder >> computeAst: theSourceString [ ifNotNil: [ parser parseWithErrors: theSourceString startingAt: parserStartingState ] ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtTextCoder >> forString: aString [ self sourceCode: (GtCoderExplicitSourceCode new source: aString) ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtTextCoder >> newCompletionStrategy [ ^ GtCompletionStrategy new ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextCoder >> parser [ ^ parser ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextCoder >> parser: anObject [ parser := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextCoder >> parserStartingState [ ^ parserStartingState ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextCoder >> parserStartingState: anObject [ parserStartingState := anObject ] -{ #category : 'api - ast' } +{ #category : #'api - ast' } GtTextCoder >> supportsAstCache [ ^ false ] diff --git a/src/GToolkit-Coder/GtTextualCoder.class.st b/src/GToolkit-Coder/GtTextualCoder.class.st index cff7c3f19..7336bd77d 100644 --- a/src/GToolkit-Coder/GtTextualCoder.class.st +++ b/src/GToolkit-Coder/GtTextualCoder.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtTextualCoder', - #superclass : 'GtCoderModel', + #name : #GtTextualCoder, + #superclass : #GtCoderModel, #instVars : [ 'sourceCode', 'completionStrategy', @@ -13,33 +13,33 @@ Class { #category : 'GToolkit-Coder-Coders' } -{ #category : 'private - addons' } +{ #category : #'private - addons' } GtTextualCoder >> addOnsClass [ ^ GtTextualCoderAddOns ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtTextualCoder >> appendString: aString [ self critical: [ self sourceCode appendString: aString. self sourceChanged ] ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtTextualCoder >> appendText: aText [ self critical: [ self sourceCode appendText: aText. self sourceChanged ] ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtTextualCoder >> appendText: aText with: aGtCoderUpdateStragegy [ self critical: [ self sourceCode appendText: aText. self sourceChangedWith: aGtCoderUpdateStragegy ] ] -{ #category : 'api - converting' } +{ #category : #'api - converting' } GtTextualCoder >> asNewCoderModelWithSameSubject [ "Return new coder model with same subject (e.g., package, class, method)" @@ -47,7 +47,7 @@ GtTextualCoder >> asNewCoderModelWithSameSubject [ ^ self shouldNotImplement ] -{ #category : 'api - ast' } +{ #category : #'api - ast' } GtTextualCoder >> astAsyncDo: aBlock [ astMonitor critical: [ astCommand ifNotNil: [ @@ -92,7 +92,7 @@ GtTextualCoder >> astAsyncDo: aBlock [ otherwise: [ astCommand execute ] ] ] -{ #category : 'api - ast' } +{ #category : #'api - ast' } GtTextualCoder >> astAwait [ | theAst | @@ -101,7 +101,7 @@ GtTextualCoder >> astAwait [ ^ theAst ] -{ #category : 'api - ast' } +{ #category : #'api - ast' } GtTextualCoder >> astAwaitDo: aBlock [ | aSemaphore anAst | @@ -115,25 +115,25 @@ GtTextualCoder >> astAwaitDo: aBlock [ aBlock value: anAst ] -{ #category : 'private - ast' } +{ #category : #'private - ast' } GtTextualCoder >> astCache [ ^ astMonitor critical: [ astCache ] ] -{ #category : 'private - ast' } +{ #category : #'private - ast' } GtTextualCoder >> astCache: anAssociation [ astMonitor critical: [ astCache := anAssociation ]. self onAstChanged ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtTextualCoder >> collapsedText [ ^ self sourceCode collapsedText ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtTextualCoder >> completionStrategy [ @@ -141,22 +141,22 @@ GtTextualCoder >> completionStrategy [ ifNil: [ completionStrategy := self newCompletionStrategy ] ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtTextualCoder >> completionStrategy: aGtCompletionStrategy [ completionStrategy := aGtCompletionStrategy ] -{ #category : 'api - ast' } +{ #category : #'api - ast' } GtTextualCoder >> computeAst [ ^ self computeAst: self currentSourceString ] -{ #category : 'api - ast' } +{ #category : #'api - ast' } GtTextualCoder >> computeAst: theSourceString [ ^ self subclassResponsibility ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtTextualCoder >> correctFrom: aFromIndex to: aToIndex with: aString [ self critical: [ self sourceCode @@ -167,7 +167,7 @@ GtTextualCoder >> correctFrom: aFromIndex to: aToIndex with: aString [ self notifyCorrectionFrom: aFromIndex to: aToIndex with: aString ] ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtTextualCoder >> currentSourceString [ "Return a String representation of the current source text" @@ -175,7 +175,7 @@ GtTextualCoder >> currentSourceString [ ^ self critical: [ self sourceCode sourceString ] ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtTextualCoder >> currentSourceString: aString [ "Set a new source text" @@ -184,7 +184,7 @@ GtTextualCoder >> currentSourceString: aString [ self sourceChanged ] ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtTextualCoder >> currentSourceText: aText [ "Set a new source text" @@ -193,7 +193,7 @@ GtTextualCoder >> currentSourceText: aText [ self sourceChanged ] ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtTextualCoder >> currentSourceText: aText with: aGtCoderUpdateStragegy [ "Set a new source text" @@ -202,7 +202,7 @@ GtTextualCoder >> currentSourceText: aText with: aGtCoderUpdateStragegy [ self sourceChangedWith: aGtCoderUpdateStragegy ] ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtTextualCoder >> currentSourceTextSynchronously: aText [ "Set a new source text" @@ -211,19 +211,19 @@ GtTextualCoder >> currentSourceTextSynchronously: aText [ self sourceChangedWith: GtCoderUpdateStrategy new makeSynchronous ] ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtTextualCoder >> deleteSourceTextFrom: aFromIndex to: aToIndex [ self critical: [ self sourceCode delete: aFromIndex to: aToIndex. self sourceChanged ] ] -{ #category : 'api - ast' } +{ #category : #'api - ast' } GtTextualCoder >> ensureAst [ self astAsyncDo: [ :theAst | ] ] -{ #category : 'initialize' } +{ #category : #initialize } GtTextualCoder >> initialize [ super initialize. @@ -231,19 +231,19 @@ GtTextualCoder >> initialize [ self reset ] -{ #category : 'testing' } +{ #category : #testing } GtTextualCoder >> isModified [ ^ self sourceCode isModified ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtTextualCoder >> newCompletionStrategy [ ^ self subclassResponsibility ] -{ #category : 'private - notifying' } +{ #category : #'private - notifying' } GtTextualCoder >> notifyCorrectionFrom: aFromIndex to: aToIndex with: aString [ self announce: (GtCoderCorrectionRequest new coder: self; @@ -252,7 +252,7 @@ GtTextualCoder >> notifyCorrectionFrom: aFromIndex to: aToIndex with: aString [ correctionString: aString) ] -{ #category : 'private - notifying' } +{ #category : #'private - notifying' } GtTextualCoder >> notifySourceChangedWith: anUpdateStragegy [ "Notify the text editor that it should update the text (for example due to refactoring changes)" @@ -261,7 +261,7 @@ GtTextualCoder >> notifySourceChangedWith: anUpdateStragegy [ coder: self) ] -{ #category : 'private - notifying' } +{ #category : #'private - notifying' } GtTextualCoder >> notifyStylersUpdated [ "Is sent when AddOn stylers changed. It also means that the text editor should restyle the text" @@ -270,11 +270,11 @@ GtTextualCoder >> notifyStylersUpdated [ stylers: self addOns stylers copy) ] -{ #category : 'private - ast' } +{ #category : #'private - ast' } GtTextualCoder >> onAstChanged [ ] -{ #category : 'private' } +{ #category : #private } GtTextualCoder >> pragmasNamed: aSymbol inHierarchy: aClass [ | actions | actions := OrderedCollection new. @@ -283,7 +283,7 @@ GtTextualCoder >> pragmasNamed: aSymbol inHierarchy: aClass [ ^ actions ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtTextualCoder >> requestStyleSourceText [ "Request the text editor to restyle the text (for example due to environmental changes)" @@ -291,7 +291,7 @@ GtTextualCoder >> requestStyleSourceText [ self announce: (GtCoderStyleTextRequest new coder: self) ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtTextualCoder >> requestStyleSourceTextAndAfterDo: aBlock [ "Request the text editor to restyle the text (for example due to environmental changes)" @@ -303,7 +303,7 @@ GtTextualCoder >> requestStyleSourceTextAndAfterDo: aBlock [ afterAction: aBlock) ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtTextualCoder >> requestUpdateCollapsedText [ "Request to update the collapsed text, for example due to changes in the current source text. It is not guaranteed that the collapsed text actually changes as for example in the method coder @@ -313,7 +313,7 @@ GtTextualCoder >> requestUpdateCollapsedText [ self announce: (GtCoderCollapsedLabelChanged new coder: self) ] -{ #category : 'initialize' } +{ #category : #initialize } GtTextualCoder >> reset [ self resetASTCache. @@ -322,17 +322,17 @@ GtTextualCoder >> reset [ completionStrategy := nil ] -{ #category : 'private - ast' } +{ #category : #'private - ast' } GtTextualCoder >> resetASTCache [ self astCache: (nil -> nil) ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtTextualCoder >> sourceChanged [ self sourceChangedWith: GtCoderUpdateStrategy new makeAsynchronous ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtTextualCoder >> sourceChangedWith: anUpdateStrategy [ "if there is an ast computation that was triggered before source code change we re-schedule the computation. Any #astAsyncDo: caller will be waiting for the result with the new ast" @@ -357,7 +357,7 @@ GtTextualCoder >> sourceChangedWith: anUpdateStrategy [ self requestUpdateCollapsedText ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtTextualCoder >> sourceCode [ @@ -365,7 +365,7 @@ GtTextualCoder >> sourceCode [ ^ sourceCode ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtTextualCoder >> sourceCode: aGtCoderSourceCode [ "Set the source code of this coder to a given one and notify about the changes" @@ -374,7 +374,7 @@ GtTextualCoder >> sourceCode: aGtCoderSourceCode [ withStrategy: GtCoderUpdateStrategy new makeAsynchronous ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtTextualCoder >> sourceCode: aGtCoderSourceCode withStrategy: anUpdateStragegy [ "Set the source code of this coder to a given one and notify about the changes" @@ -382,14 +382,14 @@ GtTextualCoder >> sourceCode: aGtCoderSourceCode withStrategy: anUpdateStragegy self sourceChangedWith: anUpdateStragegy. ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtTextualCoder >> sourceCodeSynchronously: aGtCoderSourceCode [ self sourceCode: aGtCoderSourceCode withStrategy: GtCoderUpdateStrategy new makeSynchronous ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtTextualCoder >> sourceText [ "Return the source text of this coder. The computation of the source text may be expensive, use me with caution. If the operation you would like to perform on the source text is optional consider using #sourceTextDo:" @@ -398,26 +398,26 @@ GtTextualCoder >> sourceText [ ^ self sourceCode sourceText ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtTextualCoder >> sourceTextDo: aBlock [ "Evaluate a given block with my source code text if present" ^ self sourceCode sourceTextDo: aBlock ] -{ #category : 'api - addons' } +{ #category : #'api - addons' } GtTextualCoder >> stylers [ ^ #() ] -{ #category : 'api - ast' } +{ #category : #'api - ast' } GtTextualCoder >> supportsAstCache [ "Return true if ast cache should be used, false otherwise" ^ true ] -{ #category : 'api - ast' } +{ #category : #'api - ast' } GtTextualCoder >> terminateAstCommand [ astMonitor critical: [ astCommand ifNotNil: [ :anAstCommand | anAstCommand terminate ]. diff --git a/src/GToolkit-Coder/GtTextualCoderAddOns.class.st b/src/GToolkit-Coder/GtTextualCoderAddOns.class.st index c49ac9074..7d8a4cb84 100644 --- a/src/GToolkit-Coder/GtTextualCoderAddOns.class.st +++ b/src/GToolkit-Coder/GtTextualCoderAddOns.class.st @@ -1,20 +1,20 @@ Class { - #name : 'GtTextualCoderAddOns', - #superclass : 'GtCoderAddOns', + #name : #GtTextualCoderAddOns, + #superclass : #GtCoderAddOns, #instVars : [ 'stylers' ], #category : 'GToolkit-Coder-Coders - Addons' } -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderAddOns >> addAddOns: aGtCoderAddOns [ super addAddOns: aGtCoderAddOns. self addStylers: aGtCoderAddOns stylers ] -{ #category : 'api - stylers' } +{ #category : #'api - stylers' } GtTextualCoderAddOns >> addStyler: aStyler [ (stylers anySatisfy: [ :each | each class = aStyler class ]) ifTrue: [ ^ self ]. @@ -22,12 +22,12 @@ GtTextualCoderAddOns >> addStyler: aStyler [ stylers add: aStyler ] -{ #category : 'api - stylers' } +{ #category : #'api - stylers' } GtTextualCoderAddOns >> addStylers: aCollectionOfStylers [ aCollectionOfStylers do: [ :eachStyler | self addStyler: eachStyler ] ] -{ #category : 'changes' } +{ #category : #changes } GtTextualCoderAddOns >> differenceWith: aGtCoderAddOns on: aStream [ super differenceWith: aGtCoderAddOns on: aStream. @@ -35,7 +35,7 @@ GtTextualCoderAddOns >> differenceWith: aGtCoderAddOns on: aStream [ ifFalse: [ aStream nextPut: GtCoderAddOnsStylersDifference new ] ] -{ #category : 'gt-extensions' } +{ #category : #'gt-extensions' } GtTextualCoderAddOns >> gtViewStylersFor: aView [ ^ aView list @@ -44,19 +44,19 @@ GtTextualCoderAddOns >> gtViewStylersFor: aView [ items: [ self stylers ] ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtTextualCoderAddOns >> initialize [ super initialize. stylers := OrderedCollection new ] -{ #category : 'copying' } +{ #category : #copying } GtTextualCoderAddOns >> postCopy [ super postCopy. stylers := stylers copy ] -{ #category : 'api - stylers' } +{ #category : #'api - stylers' } GtTextualCoderAddOns >> stylers [ ^ stylers ] diff --git a/src/GToolkit-Coder/GtTraitsCompletionStrategy.class.st b/src/GToolkit-Coder/GtTraitsCompletionStrategy.class.st index 4cee42d13..7c9d48f4d 100644 --- a/src/GToolkit-Coder/GtTraitsCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtTraitsCompletionStrategy.class.st @@ -1,13 +1,13 @@ Class { - #name : 'GtTraitsCompletionStrategy', - #superclass : 'GtCompletionStrategy', + #name : #GtTraitsCompletionStrategy, + #superclass : #GtCompletionStrategy, #instVars : [ 'candidateTraits' ], #category : 'GToolkit-Coder-Completion' } -{ #category : 'accessing' } +{ #category : #accessing } GtTraitsCompletionStrategy >> candidateTraits [ ^ candidateTraits ifNil: [ | theInterestingTraitNames | @@ -15,7 +15,7 @@ GtTraitsCompletionStrategy >> candidateTraits [ candidateTraits := GtPrefixTree withAll: theInterestingTraitNames ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtTraitsCompletionStrategy >> completionActionsFor: aText at: positionInteger max: maxInteger [ | currentInput completionActions | @@ -30,12 +30,12 @@ GtTraitsCompletionStrategy >> completionActionsFor: aText at: positionInteger ma ^ completionActions ] -{ #category : 'testing' } +{ #category : #testing } GtTraitsCompletionStrategy >> hasCompletionEntryFor: aString [ ^ true ] -{ #category : 'testing' } +{ #category : #testing } GtTraitsCompletionStrategy >> hasCompletionsAt: anInteger in: aText [ ^ true ] diff --git a/src/GToolkit-Coder/GtWatchExpression.class.st b/src/GToolkit-Coder/GtWatchExpression.class.st index 3b9914ffc..9fe47e302 100644 --- a/src/GToolkit-Coder/GtWatchExpression.class.st +++ b/src/GToolkit-Coder/GtWatchExpression.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtWatchExpression', - #superclass : 'Object', + #name : #GtWatchExpression, + #superclass : #Object, #instVars : [ 'expression' ], @@ -10,56 +10,56 @@ Class { #category : 'GToolkit-Coder' } -{ #category : 'accessing' } +{ #category : #accessing } GtWatchExpression class >> addExpression: aString for: aCompiledMethod [ ^ ((self methodExpressions at: aCompiledMethod methodClass ifAbsentPut: [ WeakKeyDictionary new ]) at: aCompiledMethod selector ifAbsentPut: [ Set new ]) add: (self new expression: aString) ] -{ #category : 'accessing' } +{ #category : #accessing } GtWatchExpression class >> expressionsFor: aCompiledMethod [ ^ (self methodExpressions at: aCompiledMethod methodClass ifAbsent: [ ^ #() ]) at: aCompiledMethod selector ifAbsent: [ #() ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtWatchExpression class >> methodExpressions [ ^ MethodExpressions ifNil: [ MethodExpressions := WeakKeyDictionary new ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtWatchExpression class >> removeExpression: aWatchExpression for: aCompiledMethod [ ((self methodExpressions at: aCompiledMethod methodClass ifAbsent: [ ^ self ]) at: aCompiledMethod selector ifAbsent: [ ^ self ]) remove: aWatchExpression ifAbsent: [ ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtWatchExpression class >> reset [ MethodExpressions := nil ] -{ #category : 'comparing' } +{ #category : #comparing } GtWatchExpression >> = anObject [ ^ self class = anObject class and: [ self expression = anObject expression ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtWatchExpression >> expression [ ^ expression ] -{ #category : 'accessing' } +{ #category : #accessing } GtWatchExpression >> expression: aString [ expression := aString ] -{ #category : 'comparing' } +{ #category : #comparing } GtWatchExpression >> hash [ ^ expression hash ] -{ #category : 'evaluating' } +{ #category : #evaluating } GtWatchExpression >> valueIn: aContext [ ^ [ aContext receiver class compiler source: expression; diff --git a/src/GToolkit-Coder/PrettyTextDiffBuilder.extension.st b/src/GToolkit-Coder/PrettyTextDiffBuilder.extension.st index d692c1379..01c9c29cb 100644 --- a/src/GToolkit-Coder/PrettyTextDiffBuilder.extension.st +++ b/src/GToolkit-Coder/PrettyTextDiffBuilder.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'PrettyTextDiffBuilder' } +Extension { #name : #PrettyTextDiffBuilder } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } PrettyTextDiffBuilder >> newStyler [ ^ BrRBTextStyler new classOrMetaClass: sourceClass ] diff --git a/src/GToolkit-Coder/RBAbstractCondition.extension.st b/src/GToolkit-Coder/RBAbstractCondition.extension.st index c7f77eb26..e9012c497 100644 --- a/src/GToolkit-Coder/RBAbstractCondition.extension.st +++ b/src/GToolkit-Coder/RBAbstractCondition.extension.st @@ -1,11 +1,11 @@ -Extension { #name : 'RBAbstractCondition' } +Extension { #name : #RBAbstractCondition } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBAbstractCondition >> gtChildren [ ^ #() ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBAbstractCondition >> gtLeafChildren [ ^ { self } ] diff --git a/src/GToolkit-Coder/RBAddPoolVariableChange.extension.st b/src/GToolkit-Coder/RBAddPoolVariableChange.extension.st index cd354fbc4..21b503f5a 100644 --- a/src/GToolkit-Coder/RBAddPoolVariableChange.extension.st +++ b/src/GToolkit-Coder/RBAddPoolVariableChange.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBAddPoolVariableChange' } +Extension { #name : #RBAddPoolVariableChange } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBAddPoolVariableChange >> changeObject [ ^ Smalltalk globals at: self variable asSymbol ] diff --git a/src/GToolkit-Coder/RBArrayNode.extension.st b/src/GToolkit-Coder/RBArrayNode.extension.st index 15687f2ee..8cf8c00b2 100644 --- a/src/GToolkit-Coder/RBArrayNode.extension.st +++ b/src/GToolkit-Coder/RBArrayNode.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBArrayNode' } +Extension { #name : #RBArrayNode } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBArrayNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. periods diff --git a/src/GToolkit-Coder/RBAssignmentNode.extension.st b/src/GToolkit-Coder/RBAssignmentNode.extension.st index 568551cf9..932ce03eb 100644 --- a/src/GToolkit-Coder/RBAssignmentNode.extension.st +++ b/src/GToolkit-Coder/RBAssignmentNode.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBAssignmentNode' } +Extension { #name : #RBAssignmentNode } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBAssignmentNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. assignment ifNotNil: [ assignment := assignment + anInteger ] diff --git a/src/GToolkit-Coder/RBBlockNode.extension.st b/src/GToolkit-Coder/RBBlockNode.extension.st index 9ab4f3f4c..9d93e4028 100644 --- a/src/GToolkit-Coder/RBBlockNode.extension.st +++ b/src/GToolkit-Coder/RBBlockNode.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBBlockNode' } +Extension { #name : #RBBlockNode } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBBlockNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. colons ifNotNil: [ colons := colons collect: [ :f | f + anInteger ] ]. diff --git a/src/GToolkit-Coder/RBCascadeNode.extension.st b/src/GToolkit-Coder/RBCascadeNode.extension.st index b1f9dcba2..acb9718b5 100644 --- a/src/GToolkit-Coder/RBCascadeNode.extension.st +++ b/src/GToolkit-Coder/RBCascadeNode.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBCascadeNode' } +Extension { #name : #RBCascadeNode } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBCascadeNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. (messages size - 1) timesRepeat: [ self receiver gtMoveBy: 0 - anInteger ]. diff --git a/src/GToolkit-Coder/RBChangeMethodNameRefactoring.extension.st b/src/GToolkit-Coder/RBChangeMethodNameRefactoring.extension.st index 938d66c3a..894a9d830 100644 --- a/src/GToolkit-Coder/RBChangeMethodNameRefactoring.extension.st +++ b/src/GToolkit-Coder/RBChangeMethodNameRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBChangeMethodNameRefactoring' } +Extension { #name : #RBChangeMethodNameRefactoring } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBChangeMethodNameRefactoring >> gtPreconditions [ "This refactoring only preserves behavior if all implementors are renamed." diff --git a/src/GToolkit-Coder/RBClass.extension.st b/src/GToolkit-Coder/RBClass.extension.st index 5ce845758..059f01568 100644 --- a/src/GToolkit-Coder/RBClass.extension.st +++ b/src/GToolkit-Coder/RBClass.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBClass' } +Extension { #name : #RBClass } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBClass >> traitExpression [ ^ (self isDefined and: [ self realClass hasTraitComposition ]) ifTrue: [ self realClass traitComposition printString ] diff --git a/src/GToolkit-Coder/RBCommentChange.extension.st b/src/GToolkit-Coder/RBCommentChange.extension.st index 263d3c613..7d0dc9f5f 100644 --- a/src/GToolkit-Coder/RBCommentChange.extension.st +++ b/src/GToolkit-Coder/RBCommentChange.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBCommentChange' } +Extension { #name : #RBCommentChange } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBCommentChange >> gtChangesFor: aView [ ^ aView explicit diff --git a/src/GToolkit-Coder/RBCompositeRefactoryChange.extension.st b/src/GToolkit-Coder/RBCompositeRefactoryChange.extension.st index f95cd5f74..21e075d5d 100644 --- a/src/GToolkit-Coder/RBCompositeRefactoryChange.extension.st +++ b/src/GToolkit-Coder/RBCompositeRefactoryChange.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBCompositeRefactoryChange' } +Extension { #name : #RBCompositeRefactoryChange } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBCompositeRefactoryChange >> gtWithoutChanges [ ^ self shallowCopy changes: #(); diff --git a/src/GToolkit-Coder/RBCondition.extension.st b/src/GToolkit-Coder/RBCondition.extension.st index 35e793293..4a4297077 100644 --- a/src/GToolkit-Coder/RBCondition.extension.st +++ b/src/GToolkit-Coder/RBCondition.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBCondition' } +Extension { #name : #RBCondition } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBCondition class >> includesPoolDictionary: aString in: aClass [ ^ self new type: (Array with: #includesPool with: aString with: aClass) @@ -8,7 +8,7 @@ RBCondition class >> includesPoolDictionary: aString in: aClass [ errorString: aString , ' is <1?:not >included in ' , aClass name ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBCondition class >> isPoolDictionary: aString in: aRBSmalltalk [ ^ self new type: (Array with: #isPoolDictionary with: aString) diff --git a/src/GToolkit-Coder/RBConjunctiveCondition.extension.st b/src/GToolkit-Coder/RBConjunctiveCondition.extension.st index 404c184aa..431dbd0ed 100644 --- a/src/GToolkit-Coder/RBConjunctiveCondition.extension.st +++ b/src/GToolkit-Coder/RBConjunctiveCondition.extension.st @@ -1,11 +1,11 @@ -Extension { #name : 'RBConjunctiveCondition' } +Extension { #name : #RBConjunctiveCondition } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBConjunctiveCondition >> gtChildren [ ^ { left . right } ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBConjunctiveCondition >> gtLeafChildren [ ^ left gtLeafChildren, right gtLeafChildren ] diff --git a/src/GToolkit-Coder/RBLiteralNode.extension.st b/src/GToolkit-Coder/RBLiteralNode.extension.st index 0fe573913..78ecb4692 100644 --- a/src/GToolkit-Coder/RBLiteralNode.extension.st +++ b/src/GToolkit-Coder/RBLiteralNode.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBLiteralNode' } +Extension { #name : #RBLiteralNode } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBLiteralNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. start ifNotNil: [ start := start + anInteger ]. diff --git a/src/GToolkit-Coder/RBMessageNode.extension.st b/src/GToolkit-Coder/RBMessageNode.extension.st index abb4e529e..7dfab62f7 100644 --- a/src/GToolkit-Coder/RBMessageNode.extension.st +++ b/src/GToolkit-Coder/RBMessageNode.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBMessageNode' } +Extension { #name : #RBMessageNode } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBMessageNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. keywordsPositions diff --git a/src/GToolkit-Coder/RBMethod.extension.st b/src/GToolkit-Coder/RBMethod.extension.st index d5a1ebe14..7e89bb03d 100644 --- a/src/GToolkit-Coder/RBMethod.extension.st +++ b/src/GToolkit-Coder/RBMethod.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBMethod' } +Extension { #name : #RBMethod } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBMethod >> containsSubstring: aString [ ^ (source ifNil: [ (class realClass sourceCodeAt: selector) asString ]) diff --git a/src/GToolkit-Coder/RBMethodNode.extension.st b/src/GToolkit-Coder/RBMethodNode.extension.st index dd71d79e1..74564e5e0 100644 --- a/src/GToolkit-Coder/RBMethodNode.extension.st +++ b/src/GToolkit-Coder/RBMethodNode.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBMethodNode' } +Extension { #name : #RBMethodNode } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBMethodNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. keywordsPositions diff --git a/src/GToolkit-Coder/RBNamespace.extension.st b/src/GToolkit-Coder/RBNamespace.extension.st index 4bef3e181..10504677a 100644 --- a/src/GToolkit-Coder/RBNamespace.extension.st +++ b/src/GToolkit-Coder/RBNamespace.extension.st @@ -1,17 +1,17 @@ -Extension { #name : 'RBNamespace' } +Extension { #name : #RBNamespace } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBNamespace >> category: aString for: aClass [ ^ changes addChange: (RBClassCategoryChange category: aString for: aClass) ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBNamespace >> changedClasses [ ^ changedClasses ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBNamespace >> classObjectFor: anObject [ (anObject isBehavior or: [anObject isTrait]) @@ -21,12 +21,12 @@ RBNamespace >> classObjectFor: anObject [ ^ anObject ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBNamespace >> newClasses [ ^ newClasses ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBNamespace >> removePool: aString from: aRBClass [ ^changes removePool: aString from: aRBClass ] diff --git a/src/GToolkit-Coder/RBNegationCondition.extension.st b/src/GToolkit-Coder/RBNegationCondition.extension.st index 0bac28baf..ffc0131c4 100644 --- a/src/GToolkit-Coder/RBNegationCondition.extension.st +++ b/src/GToolkit-Coder/RBNegationCondition.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBNegationCondition' } +Extension { #name : #RBNegationCondition } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBNegationCondition >> gtChildren [ ^ condition gtChildren collect: [ :eachCondition | eachCondition not ] ] diff --git a/src/GToolkit-Coder/RBParseErrorNode.extension.st b/src/GToolkit-Coder/RBParseErrorNode.extension.st index ec2105973..89fc9c541 100644 --- a/src/GToolkit-Coder/RBParseErrorNode.extension.st +++ b/src/GToolkit-Coder/RBParseErrorNode.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBParseErrorNode' } +Extension { #name : #RBParseErrorNode } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBParseErrorNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. start ifNotNil: [ start := start + anInteger ] diff --git a/src/GToolkit-Coder/RBPragmaNode.extension.st b/src/GToolkit-Coder/RBPragmaNode.extension.st index e94fa8a51..963884f68 100644 --- a/src/GToolkit-Coder/RBPragmaNode.extension.st +++ b/src/GToolkit-Coder/RBPragmaNode.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBPragmaNode' } +Extension { #name : #RBPragmaNode } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBPragmaNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. keywordsPositions diff --git a/src/GToolkit-Coder/RBProgramNode.extension.st b/src/GToolkit-Coder/RBProgramNode.extension.st index 94bed7f6b..62eb9d6ae 100644 --- a/src/GToolkit-Coder/RBProgramNode.extension.st +++ b/src/GToolkit-Coder/RBProgramNode.extension.st @@ -1,17 +1,17 @@ -Extension { #name : 'RBProgramNode' } +Extension { #name : #RBProgramNode } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBProgramNode >> gtMoveAllBy: anInteger [ self gtMoveBy: anInteger. self children do: [ :e | e gtMoveAllBy: anInteger ] ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBProgramNode >> gtMoveBy: anInteger [ self comments do: [ :f | f with: f contents at: f start + anInteger ] ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBProgramNode >> withAllParentsDo: aBlock [ | node | node := self. diff --git a/src/GToolkit-Coder/RBRefactoring.extension.st b/src/GToolkit-Coder/RBRefactoring.extension.st index f8d20516f..cb782cb97 100644 --- a/src/GToolkit-Coder/RBRefactoring.extension.st +++ b/src/GToolkit-Coder/RBRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBRefactoring' } +Extension { #name : #RBRefactoring } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBRefactoring >> gtDangers [ @@ -11,7 +11,7 @@ RBRefactoring >> gtDangers [ description: (eachCondition errorMacro expandMacrosWith: false) ] ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBRefactoring >> gtExecute: isForce [ isForce ifTrue: [ self transform ] @@ -19,12 +19,12 @@ RBRefactoring >> gtExecute: isForce [ RBRefactoryChangeManager instance performChange: self changes; addUndoPointer: 1 ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBRefactoring >> gtPreconditions [ ^ self preconditions ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBRefactoring >> gtTransform [ self transform ] diff --git a/src/GToolkit-Coder/RBRefactoryChange.extension.st b/src/GToolkit-Coder/RBRefactoryChange.extension.st index ef9dfd56d..1d1a47fd3 100644 --- a/src/GToolkit-Coder/RBRefactoryChange.extension.st +++ b/src/GToolkit-Coder/RBRefactoryChange.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBRefactoryChange' } +Extension { #name : #RBRefactoryChange } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBRefactoryChange >> gtWithoutChanges [ ^ self ] diff --git a/src/GToolkit-Coder/RBRemoveInstanceVariableRefactoring.extension.st b/src/GToolkit-Coder/RBRemoveInstanceVariableRefactoring.extension.st index c490bedb7..80a3fe941 100644 --- a/src/GToolkit-Coder/RBRemoveInstanceVariableRefactoring.extension.st +++ b/src/GToolkit-Coder/RBRemoveInstanceVariableRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBRemoveInstanceVariableRefactoring' } +Extension { #name : #RBRemoveInstanceVariableRefactoring } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBRemoveInstanceVariableRefactoring >> gtPreconditions [ | references | diff --git a/src/GToolkit-Coder/RBRemovePoolVariableChange.extension.st b/src/GToolkit-Coder/RBRemovePoolVariableChange.extension.st index a91439049..bd8df502d 100644 --- a/src/GToolkit-Coder/RBRemovePoolVariableChange.extension.st +++ b/src/GToolkit-Coder/RBRemovePoolVariableChange.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBRemovePoolVariableChange' } +Extension { #name : #RBRemovePoolVariableChange } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBRemovePoolVariableChange >> changeObject [ ^ Smalltalk globals at: self variable asSymbol ] diff --git a/src/GToolkit-Coder/RBReplaceMethodRefactoring.extension.st b/src/GToolkit-Coder/RBReplaceMethodRefactoring.extension.st index 9a36492f5..5f7e3047b 100644 --- a/src/GToolkit-Coder/RBReplaceMethodRefactoring.extension.st +++ b/src/GToolkit-Coder/RBReplaceMethodRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBReplaceMethodRefactoring' } +Extension { #name : #RBReplaceMethodRefactoring } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBReplaceMethodRefactoring >> gtPreconditions [ |conditions| conditions := (RBCondition withBlock: [ self haveSameNumberOfArgs. true]) diff --git a/src/GToolkit-Coder/RBSequenceNode.extension.st b/src/GToolkit-Coder/RBSequenceNode.extension.st index d6064d954..2e06f438e 100644 --- a/src/GToolkit-Coder/RBSequenceNode.extension.st +++ b/src/GToolkit-Coder/RBSequenceNode.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBSequenceNode' } +Extension { #name : #RBSequenceNode } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBSequenceNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. periods ifNotNil: [ periods := periods collect: [ :f | f + anInteger ] ]. diff --git a/src/GToolkit-Coder/RBTransformation.extension.st b/src/GToolkit-Coder/RBTransformation.extension.st index ccc3f6381..4a00240ab 100644 --- a/src/GToolkit-Coder/RBTransformation.extension.st +++ b/src/GToolkit-Coder/RBTransformation.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBTransformation' } +Extension { #name : #RBTransformation } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBTransformation >> gtDangers [ @@ -11,12 +11,12 @@ RBTransformation >> gtDangers [ description: (eachCondition errorMacro expandMacrosWith: false) ] ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBTransformation >> gtPreconditions [ ^ self preconditions ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBTransformation >> gtTransform [ self privateTransform ] diff --git a/src/GToolkit-Coder/RBValueNode.extension.st b/src/GToolkit-Coder/RBValueNode.extension.st index e6516c42d..3d8f74ea1 100644 --- a/src/GToolkit-Coder/RBValueNode.extension.st +++ b/src/GToolkit-Coder/RBValueNode.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBValueNode' } +Extension { #name : #RBValueNode } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBValueNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. parentheses ifNotNil: [ parentheses := parentheses collect: [ :f | f + anInteger ] ]. diff --git a/src/GToolkit-Coder/RBVariableNode.extension.st b/src/GToolkit-Coder/RBVariableNode.extension.st index 3e32a054e..aa4a6fd38 100644 --- a/src/GToolkit-Coder/RBVariableNode.extension.st +++ b/src/GToolkit-Coder/RBVariableNode.extension.st @@ -1,11 +1,11 @@ -Extension { #name : 'RBVariableNode' } +Extension { #name : #RBVariableNode } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBVariableNode >> gtIsLocal [ ^ (self whoDefines: self name) notNil ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RBVariableNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. start ifNotNil: [ start := start + anInteger ] diff --git a/src/GToolkit-Coder/RPackage.extension.st b/src/GToolkit-Coder/RPackage.extension.st index 18f2978af..724adf04f 100644 --- a/src/GToolkit-Coder/RPackage.extension.st +++ b/src/GToolkit-Coder/RPackage.extension.st @@ -1,11 +1,11 @@ -Extension { #name : 'RPackage' } +Extension { #name : #RPackage } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RPackage >> gtClassExtensions [ ^ self extensionMethods collect: [ :each | GtPharoClassExtension new extendingMethod: each ] ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RPackage >> gtClassReferences [ ^ self gtMethodReferences flatCollectAsSet: [ :m | m method gtReferencedClasses collect: [ :each | @@ -14,7 +14,7 @@ RPackage >> gtClassReferences [ referencedClass: each ]] ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RPackage >> gtDependencies [ | all | all := Set new. @@ -25,24 +25,24 @@ RPackage >> gtDependencies [ ^ all select: [ :each | each toPackage ~= self ] ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RPackage >> gtInheritances [ ^ self definedClasses select: [ : each | each isClass and: [ each superclass notNil ] ] thenCollect: [ :each | each gtInheritance ] ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RPackage >> gtMethodReferences [ ^ self methods collect: [:each | each methodReference] thenSelect: [:each| each isValid and: [each isLocalSelector]]. ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RPackage >> gtPackageScope [ ^ self ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RPackage >> gtPackagesUsed [ | result | result := Set new. @@ -54,33 +54,33 @@ RPackage >> gtPackagesUsed [ ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RPackage >> gtPackagesUsedThroughClassExtensions [ ^ self gtClassExtensions collectAsSet: [ :each | each toPackage ] ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RPackage >> gtPackagesUsedThroughClassReferences [ ^ (self gtClassReferences collectAsSet: [ :each | each toPackage ]) remove: self ifAbsent: []; yourself ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RPackage >> gtPackagesUsedThroughSubclassing [ ^ (self gtInheritances collectAsSet: [ :each | each toPackage ]) remove: self ifAbsent: []; yourself ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RPackage >> gtPackagesUsedThroughTraitUsages [ ^ (self gtTraitUsages collectAsSet: [ :each | each toPackage ]) remove: self ifAbsent: []; yourself ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RPackage >> gtTraitUsages [ ^ self definedClasses flatCollect: [ :each | each gtTraitUsages ] ] diff --git a/src/GToolkit-Coder/RPackageTag.extension.st b/src/GToolkit-Coder/RPackageTag.extension.st index 512789389..5bfacab0a 100644 --- a/src/GToolkit-Coder/RPackageTag.extension.st +++ b/src/GToolkit-Coder/RPackageTag.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RPackageTag' } +Extension { #name : #RPackageTag } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } RPackageTag >> gtClassesCoderFor: aView context: aPhlowContext [ (aPhlowContext isKindOf: GtPhlowExecutionContext) ifFalse: [ ^ aView empty ]. diff --git a/src/GToolkit-Coder/SharedPool.extension.st b/src/GToolkit-Coder/SharedPool.extension.st index de70fa4a5..c9e76c1f5 100644 --- a/src/GToolkit-Coder/SharedPool.extension.st +++ b/src/GToolkit-Coder/SharedPool.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'SharedPool' } +Extension { #name : #SharedPool } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } SharedPool class >> associationsDo: aBlock [ ^ self bindingsDo: aBlock ] diff --git a/src/GToolkit-Coder/Slot.extension.st b/src/GToolkit-Coder/Slot.extension.st index 369203875..84dc58ce9 100644 --- a/src/GToolkit-Coder/Slot.extension.st +++ b/src/GToolkit-Coder/Slot.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'Slot' } +Extension { #name : #Slot } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } Slot class >> gtIsValidName: aSymbol [ diff --git a/src/GToolkit-Coder/String.extension.st b/src/GToolkit-Coder/String.extension.st index a5acbb5b4..ce5e5b68b 100644 --- a/src/GToolkit-Coder/String.extension.st +++ b/src/GToolkit-Coder/String.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'String' } +Extension { #name : #String } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } String >> gtMethodCategories [ ^ self gtMethodProtocols ] diff --git a/src/GToolkit-Coder/Symbol.extension.st b/src/GToolkit-Coder/Symbol.extension.st index 3540fafb7..2f7d22bf9 100644 --- a/src/GToolkit-Coder/Symbol.extension.st +++ b/src/GToolkit-Coder/Symbol.extension.st @@ -1,11 +1,11 @@ -Extension { #name : 'Symbol' } +Extension { #name : #Symbol } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } Symbol >> asGlobalVariable [ ^ Smalltalk globals associationAt: self ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } Symbol >> gtSenders [ ^ self gtReferences ] diff --git a/src/GToolkit-Coder/TGtCoderTrait.trait.st b/src/GToolkit-Coder/TGtCoderTrait.trait.st index 549250a1a..ac95c07db 100644 --- a/src/GToolkit-Coder/TGtCoderTrait.trait.st +++ b/src/GToolkit-Coder/TGtCoderTrait.trait.st @@ -1,34 +1,34 @@ Trait { - #name : 'TGtCoderTrait', + #name : #TGtCoderTrait, #category : 'GToolkit-Coder-Coders' } -{ #category : 'testing' } +{ #category : #testing } TGtCoderTrait >> isForClass [ ^ false ] -{ #category : 'testing' } +{ #category : #testing } TGtCoderTrait >> isForPackage [ ^ false ] -{ #category : 'testing' } +{ #category : #testing } TGtCoderTrait >> isForPackageTag [ ^ false ] -{ #category : 'accessing' } +{ #category : #accessing } TGtCoderTrait >> package [ ^ nil ] -{ #category : 'accessing' } +{ #category : #accessing } TGtCoderTrait >> packageTag [ ^ nil ] -{ #category : 'accessing' } +{ #category : #accessing } TGtCoderTrait >> theClass [ ^ nil ] diff --git a/src/GToolkit-Coder/TextDiffBuilder.extension.st b/src/GToolkit-Coder/TextDiffBuilder.extension.st index 10c567082..b5dd16f8b 100644 --- a/src/GToolkit-Coder/TextDiffBuilder.extension.st +++ b/src/GToolkit-Coder/TextDiffBuilder.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'TextDiffBuilder' } +Extension { #name : #TextDiffBuilder } -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } TextDiffBuilder >> newRopedText [ | text | text := '' asRopedText. @@ -17,12 +17,12 @@ TextDiffBuilder >> newRopedText [ ^ text ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } TextDiffBuilder >> newStyler [ ^ nil ] -{ #category : '*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder' } TextDiffBuilder >> previousRopedText [ | text | text := '' asRopedText. diff --git a/src/GToolkit-Coder/package.st b/src/GToolkit-Coder/package.st index 42396c66c..1585672da 100644 --- a/src/GToolkit-Coder/package.st +++ b/src/GToolkit-Coder/package.st @@ -1 +1 @@ -Package { #name : 'GToolkit-Coder' } +Package { #name : #'GToolkit-Coder' } From 929987ab51bc700ca85f5f347975466a634522e4 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 14 Oct 2021 09:55:35 +0200 Subject: [PATCH 0044/1268] add a source coder based on promises --- .../GtCoderAst.class.st | 33 + .../GtCoderExplicitTextSource.class.st | 30 + .../GtCoderFutureTextSource.class.st | 25 + .../GtCoderSourceEpoch.class.st | 25 + .../GtCoderSourceString.class.st | 33 + .../GtCoderSourceText.class.st | 46 ++ .../GtCoderTextSource.class.st | 129 ++++ .../GtSourceCoderViewModelPromised.class.st | 163 +++++ ...TextualCoderEditorElementPromised.class.st | 509 +++++++++++++ .../GtTextualCoderViewModelPromised.class.st | 666 ++++++++++++++++++ src/GToolkit-Coder-Promised/package.st | 1 + ...orCoderBehaviorNameApplyPreviewId.class.st | 6 +- .../GtBehaviorCoderBehaviorNameId.class.st | 6 +- .../GtBehaviorDefinitionCoderUIModel.class.st | 6 +- .../GtCategoryToggleAptitude.class.st | 6 +- .../GtClassBreadcrumbToggleAptitude.class.st | 6 +- .../GtClassCardElement.class.st | 6 +- .../GtClassCoderTool.class.st | 16 +- .../GtClassesCoderUIModel.class.st | 6 +- .../GtClassesElement.class.st | 12 +- ...deDefinitionCompositeEntityViewer.class.st | 20 +- .../GtCodeDefinitionEntityViewer.class.st | 32 +- ...tCodeDefinitionNestedEntityViewer.class.st | 14 +- .../GtCodeDefinitionPluralEditor.class.st | 18 +- .../GtCodeDefinitionPluralReader.class.st | 6 +- .../GtCodeDefinitionPluralViewer.class.st | 20 +- ...CodeDefinitionSectionLabelStencil.class.st | 10 +- .../GtCodeDefinitionSingleEditor.class.st | 16 +- .../GtCodeDefinitionSingleReader.class.st | 6 +- .../GtCodeDefinitionSingleViewer.class.st | 12 +- .../GtCodeDefinitionViewer.class.st | 20 +- src/GToolkit-Coder-UI/GtCoder.class.st | 38 +- src/GToolkit-Coder-UI/GtCoder2.class.st | 32 +- .../GtCoderAction.extension.st | 4 +- .../GtCoderActionsElement.class.st | 42 +- .../GtCoderActivatableAction.extension.st | 4 +- .../GtCoderCardElement.class.st | 18 +- .../GtCoderCodeExecutor.class.st | 38 +- .../GtCoderContentElement.class.st | 16 +- .../GtCoderContextMenuContent.class.st | 14 +- .../GtCoderDropDownAction.extension.st | 4 +- ...oderDropDownWithPreviewAction.extension.st | 4 +- src/GToolkit-Coder-UI/GtCoderElement.class.st | 6 +- .../GtCoderElementId.class.st | 6 +- .../GtCoderExampleStateElement.class.st | 62 +- .../GtCoderExecutionContextVariable.class.st | 12 +- .../GtCoderExpanderAptitude.class.st | 6 +- .../GtCoderExpanderShadowAptitude.class.st | 6 +- ...oderExpanderWithoutShadowAptitude.class.st | 46 +- .../GtCoderFilterList.class.st | 10 +- .../GtCoderFilterListItem.class.st | 18 +- .../GtCoderFilterListItemElement.class.st | 14 +- .../GtCoderModel.extension.st | 18 +- ...derNavigationClassHierachyElement.class.st | 30 +- ...gationClassesHierarchyTreeElement.class.st | 18 +- ...CoderNavigationClassesListElement.class.st | 14 +- .../GtCoderNavigationElement.class.st | 68 +- ...vigationMethodProtocolListElement.class.st | 16 +- .../GtCoderNavigationModelElement.class.st | 30 +- ...igationPackagesTagsClassesElement.class.st | 96 +-- ...oderNavigationPackagesTreeElement.class.st | 24 +- .../GtCoderNavigationTabsStencil.class.st | 26 +- .../GtCoderPlaygroundElement.class.st | 32 +- .../GtCoderPrintStringAttribute.class.st | 34 +- .../GtCoderSpotterStart.class.st | 22 +- .../GtCoderToReplace.class.st | 8 +- src/GToolkit-Coder-UI/GtCoderToSpawn.class.st | 8 +- .../GtCoderToSpawnInSpace.class.st | 4 +- .../GtCoderToggleAptitude.class.st | 10 +- src/GToolkit-Coder-UI/GtCoderTool.class.st | 14 +- .../GtCoderToolViewModel.class.st | 22 +- .../GtCoderToolViewModelCoderPopped.class.st | 4 +- .../GtCoderToolViewModelCoderPushed.class.st | 4 +- ...derToolViewModelCoderStackChanged.class.st | 8 +- .../GtCoderToolbarElement.class.st | 28 +- .../GtCodersModel.extension.st | 6 +- .../GtContextCoderVariableAptitude.class.st | 14 +- .../GtCreateElement.class.st | 12 +- src/GToolkit-Coder-UI/GtDiffAptitude.class.st | 6 +- src/GToolkit-Coder-UI/GtDiffElement.class.st | 66 +- .../GtDiffElementId.class.st | 6 +- .../GtDiffFlatAptitude.class.st | 8 +- .../GtDiffNewTextId.class.st | 6 +- .../GtDiffOldTextId.class.st | 6 +- .../GtDiffSeparatorId.class.st | 6 +- .../GtDiffShadowAptitude.class.st | 12 +- .../GtExpandableSourceCoderElement.class.st | 40 +- .../GtExpandedOnlyCoderElement.class.st | 22 +- .../GtFilterDescriptor.class.st | 44 +- .../GtFilterRunExampleButtonAptitude.class.st | 50 +- ...xampleButtonFourStateIconAptitude.class.st | 34 +- ...ilterRunExampleButtonIconAptitude.class.st | 26 +- ...erRunExampleButtonTooltipAptitude.class.st | 16 +- .../GtFilterTagElement.class.st | 38 +- .../GtFiltersChangedEvent.class.st | 8 +- .../GtFiltersElement.class.st | 26 +- ...tMethodCoderContextPCRangeChanged.class.st | 8 +- ...GtMethodCoderDebugExampleActionId.class.st | 6 +- ...MethodCoderDiscardChangesActionId.class.st | 6 +- ...derExtractMethodContextMenuItemId.class.st | 6 +- ...oderPlayAndInspectExampleActionId.class.st | 6 +- .../GtMethodCoderPlayExampleActionId.class.st | 6 +- .../GtMethodCoderSaveAbilityChanged.class.st | 4 +- .../GtMethodCoderSaveActionId.class.st | 6 +- .../GtMethodCoderSaveDisabled.class.st | 10 +- .../GtMethodCoderSaveEnabled.class.st | 6 +- .../GtMethodCoderTool.class.st | 14 +- .../GtMultipleCodersViewModel.class.st | 28 +- .../GtPackageCardElement.class.st | 8 +- .../GtPackageCoderPackageNameId.class.st | 6 +- .../GtPackageCoderTool.class.st | 14 +- .../GtPackageCoderViewModel.class.st | 4 +- .../GtPackageTagCardElement.class.st | 6 +- .../GtPackagesCoderElement.class.st | 16 +- .../GtPackagesCoderUIModel.class.st | 6 +- ...roundEvaluatedCodeButtonAttribute.class.st | 26 +- .../GtPreviewChangeButton.class.st | 16 +- ...tRBAddPoolVariableRefactoring.extension.st | 4 +- .../GtRBAddTraitUsageRefactoring.extension.st | 4 +- ...RBChangeSuperclassRefactoring.extension.st | 4 +- ...RemovePoolVariableRefactoring.extension.st | 4 +- ...RBRemoveTraitUsageRefactoring.extension.st | 4 +- .../GtReadyCoderTool.class.st | 20 +- .../GtRefactoringsPreviewAcceptId.class.st | 6 +- .../GtSingleCoderViewModel.class.st | 38 +- .../GtSourceCoderAptitude.class.st | 14 +- .../GtSourceCoderBreadcrumbAction.class.st | 10 +- ...oderBreadcrumbSpawnBehaviorAction.class.st | 16 +- ...CoderBreadcrumbSpawnPackageAction.class.st | 14 +- ...SourceCoderBrowseBehaviorShortcut.class.st | 12 +- ...ceCoderBrowseImplementorsShortcut.class.st | 12 +- ...urceCoderBrowseReferencesShortcut.class.st | 12 +- ...ourceCoderCollapsedContentElement.class.st | 4 +- ...erCollapsedTextAndExampleAptitude.class.st | 36 +- ...tSourceCoderCollapsedTextAptitude.class.st | 16 +- .../GtSourceCoderCollapsedTextId.class.st | 6 +- .../GtSourceCoderContentCoderChanged.class.st | 8 +- .../GtSourceCoderContentCoderRequest.class.st | 6 +- .../GtSourceCoderContentElement.class.st | 16 +- .../GtSourceCoderContentModel.class.st | 18 +- .../GtSourceCoderDebugActionId.class.st | 6 +- ...SourceCoderDiscardChangesShortcut.class.st | 12 +- .../GtSourceCoderDoItActionId.class.st | 6 +- .../GtSourceCoderDoItAndGoActionId.class.st | 6 +- ...SourceCoderDoItAndInspectShortcut.class.st | 12 +- .../GtSourceCoderDoItShortcut.class.st | 12 +- .../GtSourceCoderEditorAptitude.class.st | 14 +- .../GtSourceCoderEditorElement.class.st | 6 +- .../GtSourceCoderEditorId.class.st | 6 +- ...urceCoderEmbeddedExpanderToggleId.class.st | 6 +- .../GtSourceCoderErrorAttribute.class.st | 10 +- ...tSourceCoderEvaluationHighlighter.class.st | 6 +- .../GtSourceCoderEvaluationPrinter.class.st | 6 +- ...rceCoderEvaluationResultDisplayer.class.st | 30 +- ...SourceCoderExpandedContentElement.class.st | 4 +- .../GtSourceCoderExpanderToggleId.class.st | 6 +- ...tSourceCoderExtractMethodShortcut.class.st | 12 +- ...erExtractTempVarContextMenuItemId.class.st | 6 +- .../GtSourceCoderFocusChanged.class.st | 12 +- .../GtSourceCoderFormatShortcut.class.st | 12 +- ...SourceCoderPlayAndInspectShortcut.class.st | 12 +- .../GtSourceCoderPlayShortcut.class.st | 12 +- .../GtSourceCoderPrintItShortcut.class.st | 12 +- .../GtSourceCoderProfileActionId.class.st | 6 +- .../GtSourceCoderSaveShortcut.class.st | 12 +- .../GtSourceCoderShortcut.class.st | 16 +- ...urceCoderSpawnDestinationAptitude.class.st | 14 +- .../GtSourceCoderViewModel.class.st | 46 +- .../GtSyncScrollRange.class.st | 36 +- .../GtSyncScrollRanges.class.st | 30 +- .../GtTextCoder.extension.st | 4 +- .../GtTextualCoder.extension.st | 4 +- ...TextualCoderCopyContextMenuItemId.class.st | 6 +- ...tTextualCoderCutContextMenuItemId.class.st | 6 +- .../GtTextualCoderEditorElement.class.st | 80 +-- ...extualCoderPasteContextMenuItemId.class.st | 6 +- .../GtTextualCoderTextAttributes.class.st | 18 +- .../GtTextualCoderViewModel.class.st | 148 ++-- ...extualCoderViewModelAddOnsChanged.class.st | 8 +- ...TextualCoderViewModelAnnouncement.class.st | 4 +- ...GtTextualCoderViewModelAstChanged.class.st | 8 +- ...derViewModelContextActionsChanged.class.st | 4 +- ...iewModelContextMenuActionsChanged.class.st | 4 +- ...xtualCoderViewModelCursorsChanged.class.st | 12 +- ...ualCoderViewModelExpansionChanged.class.st | 8 +- ...lCoderViewModelMainActionsChanged.class.st | 4 +- ...xtualCoderViewModelReadyToRestyle.class.st | 4 +- ...ualCoderViewModelSelectionChanged.class.st | 12 +- ...ualCoderViewModelShortcutsChanged.class.st | 4 +- ...alCoderViewModelStyledTextChanged.class.st | 8 +- ...xtualCoderViewModelStylersChanged.class.st | 4 +- ...CoderViewModelTextAttributesAdded.class.st | 16 +- ...derViewModelTextAttributesRemoved.class.st | 8 +- ...tTextualCoderViewModelTextChanged.class.st | 16 +- ...RBAddClassVariableRefactoring.extension.st | 4 +- ...ddInstanceVariableRefactoring.extension.st | 4 +- .../RBRefactoring.extension.st | 4 +- ...emoveClassVariableRefactoring.extension.st | 4 +- ...veInstanceVariableRefactoring.extension.st | 4 +- .../RBRenameClassRefactoring.extension.st | 4 +- ...enameClassVariableRefactoring.extension.st | 4 +- ...meInstanceVariableRefactoring.extension.st | 4 +- .../RBTransformation.extension.st | 4 +- .../TBlDevScripterTarget.extension.st | 8 +- .../TGtCoderNavigationClassesHelper.trait.st | 8 +- .../TGtWithCoderModel.trait.st | 14 +- .../TGtWithCoderToolViewModel.trait.st | 16 +- .../TGtWithTextualCoderViewModel.trait.st | 16 +- src/GToolkit-Coder-UI/package.st | 2 +- 209 files changed, 3165 insertions(+), 1503 deletions(-) create mode 100644 src/GToolkit-Coder-Promised/GtCoderAst.class.st create mode 100644 src/GToolkit-Coder-Promised/GtCoderExplicitTextSource.class.st create mode 100644 src/GToolkit-Coder-Promised/GtCoderFutureTextSource.class.st create mode 100644 src/GToolkit-Coder-Promised/GtCoderSourceEpoch.class.st create mode 100644 src/GToolkit-Coder-Promised/GtCoderSourceString.class.st create mode 100644 src/GToolkit-Coder-Promised/GtCoderSourceText.class.st create mode 100644 src/GToolkit-Coder-Promised/GtCoderTextSource.class.st create mode 100644 src/GToolkit-Coder-Promised/GtSourceCoderViewModelPromised.class.st create mode 100644 src/GToolkit-Coder-Promised/GtTextualCoderEditorElementPromised.class.st create mode 100644 src/GToolkit-Coder-Promised/GtTextualCoderViewModelPromised.class.st create mode 100644 src/GToolkit-Coder-Promised/package.st diff --git a/src/GToolkit-Coder-Promised/GtCoderAst.class.st b/src/GToolkit-Coder-Promised/GtCoderAst.class.st new file mode 100644 index 000000000..8303c157d --- /dev/null +++ b/src/GToolkit-Coder-Promised/GtCoderAst.class.st @@ -0,0 +1,33 @@ +Class { + #name : #GtCoderAst, + #superclass : #Object, + #instVars : [ + 'ast', + 'epoch' + ], + #category : #'GToolkit-Coder-Promised' +} + +{ #category : #accessing } +GtCoderAst >> ast [ + + ^ ast +] + +{ #category : #accessing } +GtCoderAst >> ast: anObject [ + + ast := anObject +] + +{ #category : #accessing } +GtCoderAst >> epoch [ + + ^ epoch +] + +{ #category : #accessing } +GtCoderAst >> epoch: anObject [ + + epoch := anObject +] diff --git a/src/GToolkit-Coder-Promised/GtCoderExplicitTextSource.class.st b/src/GToolkit-Coder-Promised/GtCoderExplicitTextSource.class.st new file mode 100644 index 000000000..c30dabdf9 --- /dev/null +++ b/src/GToolkit-Coder-Promised/GtCoderExplicitTextSource.class.st @@ -0,0 +1,30 @@ +Class { + #name : #GtCoderExplicitTextSource, + #superclass : #GtCoderTextSource, + #instVars : [ + 'text' + ], + #category : #'GToolkit-Coder-Promised' +} + +{ #category : #'api - accessing' } +GtCoderExplicitTextSource >> asAstCacheKey [ + ^ text +] + +{ #category : #initialization } +GtCoderExplicitTextSource >> originalSourceTextFuture [ + + + ^ [ text copy ] asAsyncFuture +] + +{ #category : #accessing } +GtCoderExplicitTextSource >> text [ + ^ text +] + +{ #category : #accessing } +GtCoderExplicitTextSource >> text: aStringOrText [ + text := aStringOrText asRopedText +] diff --git a/src/GToolkit-Coder-Promised/GtCoderFutureTextSource.class.st b/src/GToolkit-Coder-Promised/GtCoderFutureTextSource.class.st new file mode 100644 index 000000000..1c04f9926 --- /dev/null +++ b/src/GToolkit-Coder-Promised/GtCoderFutureTextSource.class.st @@ -0,0 +1,25 @@ +Class { + #name : #GtCoderFutureTextSource, + #superclass : #GtCoderTextSource, + #instVars : [ + 'futureBlock' + ], + #category : #'GToolkit-Coder-Promised' +} + +{ #category : #'api - accessing' } +GtCoderFutureTextSource >> asAstCacheKey [ + ^ nil +] + +{ #category : #accessing } +GtCoderFutureTextSource >> future: aBlock [ + futureBlock := aBlock +] + +{ #category : #initialization } +GtCoderFutureTextSource >> originalSourceTextFuture [ + + + ^ futureBlock value map: [ :aString | aString asRopedText ] +] diff --git a/src/GToolkit-Coder-Promised/GtCoderSourceEpoch.class.st b/src/GToolkit-Coder-Promised/GtCoderSourceEpoch.class.st new file mode 100644 index 000000000..b45406b4f --- /dev/null +++ b/src/GToolkit-Coder-Promised/GtCoderSourceEpoch.class.st @@ -0,0 +1,25 @@ +Class { + #name : #GtCoderSourceEpoch, + #superclass : #Object, + #instVars : [ + 'timestamp' + ], + #category : #'GToolkit-Coder-Promised' +} + +{ #category : #accessing } +GtCoderSourceEpoch >> age [ + ^ DateAndTime now - timestamp +] + +{ #category : #initialization } +GtCoderSourceEpoch >> initialize [ + super initialize. + + timestamp := DateAndTime now +] + +{ #category : #accessing } +GtCoderSourceEpoch >> nextEpoch [ + ^ self class new +] diff --git a/src/GToolkit-Coder-Promised/GtCoderSourceString.class.st b/src/GToolkit-Coder-Promised/GtCoderSourceString.class.st new file mode 100644 index 000000000..1369ccdfe --- /dev/null +++ b/src/GToolkit-Coder-Promised/GtCoderSourceString.class.st @@ -0,0 +1,33 @@ +Class { + #name : #GtCoderSourceString, + #superclass : #Object, + #instVars : [ + 'string', + 'epoch' + ], + #category : #'GToolkit-Coder-Promised' +} + +{ #category : #accessing } +GtCoderSourceString >> epoch [ + + ^ epoch +] + +{ #category : #accessing } +GtCoderSourceString >> epoch: anObject [ + + epoch := anObject +] + +{ #category : #accessing } +GtCoderSourceString >> string [ + + ^ string +] + +{ #category : #accessing } +GtCoderSourceString >> string: anObject [ + + string := anObject +] diff --git a/src/GToolkit-Coder-Promised/GtCoderSourceText.class.st b/src/GToolkit-Coder-Promised/GtCoderSourceText.class.st new file mode 100644 index 000000000..d37508f5e --- /dev/null +++ b/src/GToolkit-Coder-Promised/GtCoderSourceText.class.st @@ -0,0 +1,46 @@ +Class { + #name : #GtCoderSourceText, + #superclass : #Object, + #instVars : [ + 'text', + 'epoch' + ], + #category : #'GToolkit-Coder-Promised' +} + +{ #category : #converting } +GtCoderSourceText >> asSourceString [ + + + ^ GtCoderSourceString new + string: text asString; + epoch: epoch +] + +{ #category : #accessing } +GtCoderSourceText >> epoch [ + ^ epoch +] + +{ #category : #initialization } +GtCoderSourceText >> initialize [ + super initialize. + + epoch := GtCoderSourceEpoch new +] + +{ #category : #accessing } +GtCoderSourceText >> text [ + + ^ text +] + +{ #category : #accessing } +GtCoderSourceText >> text: aBlText [ + self + assert: [ text isNil ] + description: [ 'Source text can not be modified' ]. + + text := aBlText. + epoch := epoch nextEpoch +] diff --git a/src/GToolkit-Coder-Promised/GtCoderTextSource.class.st b/src/GToolkit-Coder-Promised/GtCoderTextSource.class.st new file mode 100644 index 000000000..35cbb75e8 --- /dev/null +++ b/src/GToolkit-Coder-Promised/GtCoderTextSource.class.st @@ -0,0 +1,129 @@ +Class { + #name : #GtCoderTextSource, + #superclass : #Object, + #instVars : [ + 'monitor', + 'originalSourceTextPromise', + 'currentSourceText' + ], + #category : #'GToolkit-Coder-Promised' +} + +{ #category : #'api - accessing' } +GtCoderTextSource >> asAstCacheKey [ + ^ self subclassResponsibility +] + +{ #category : #'api - converting' } +GtCoderTextSource >> asCompiledMethodSourceCode: aCompiledMethod [ + ^ (GtCoderCompiledMethodSourceCode new fromSourceCode: self) compiledMethod: aCompiledMethod +] + +{ #category : #'mutual exclusion' } +GtCoderTextSource >> critical: aBlock [ + ^ monitor critical: aBlock +] + +{ #category : #'api - accessing' } +GtCoderTextSource >> currentSourceString [ + "Return a string representation of the current source text" + + + ^ self critical: [ self currentSourceText then: [ :aGtCoderSourceText | aGtCoderSourceText asSourceString ] ] +] + +{ #category : #'api - accessing' } +GtCoderTextSource >> currentSourceString: aString [ + "Set a new source text" + + self critical: [ currentSourceText := GtCoderSourceText new text: aString asRopedText ] +] + +{ #category : #'api - accessing' } +GtCoderTextSource >> currentSourceText [ + + + ^ self critical: [ + currentSourceText + ifNotNil: [ :aSourceText | aSourceText asAsyncPromise ] + ifNil: [ originalSourceTextPromise ifNil: [ originalSourceTextPromise := self originalSourceTextPromise ] ] ] +] + +{ #category : #'api - accessing' } +GtCoderTextSource >> currentSourceText: aText [ + "Set a new source text" + + self critical: [ currentSourceText := GtCoderSourceText new text: aText copyWithoutExternalReferences ] +] + +{ #category : #initialization } +GtCoderTextSource >> fromSourceCode: aGtCoderSourceCode [ + originalSourceTextPromise := aGtCoderSourceCode sourceText +] + +{ #category : #'api - testing' } +GtCoderTextSource >> hasSourceText [ + + + ^ self critical: [ originalSourceTextPromise notNil ] +] + +{ #category : #initialization } +GtCoderTextSource >> initialize [ + super initialize. + + monitor := Monitor new. + currentSourceText := nil. + originalSourceTextPromise := nil +] + +{ #category : #'api - testing' } +GtCoderTextSource >> isModified [ + ^ currentSourceText notNil +] + +{ #category : #'private - initialization' } +GtCoderTextSource >> originalSourceTextFuture [ + + + ^ self subclassResponsibility +] + +{ #category : #'private - initialization' } +GtCoderTextSource >> originalSourceTextPromise [ + + + ^ (self originalSourceTextFuture map: [ :aText | GtCoderSourceText new text: aText ]) asAsyncPromise +] + +{ #category : #'api - accessing' } +GtCoderTextSource >> resetSourceText [ + "Remove the cached source text forcing it to be recomputed next time it is accessed" + + self critical: [ + originalSourceTextPromise := nil. + currentSourceText := nil ] +] + +{ #category : #'api - accessing' } +GtCoderTextSource >> sourceString [ + "Return a string representation of the current source text" + + + self + deprecated: 'Use #currentSourceString' + transformWith: '`@receiver sourceString' -> '`@receiver currentSourceString'. + + ^ self currentSourceString +] + +{ #category : #'api - accessing' } +GtCoderTextSource >> sourceText [ + + + self + deprecated: 'Use #currentSourceText' + transformWith: '`@receiver sourceText' -> '`@receiver currentSourceText'. + + ^ self currentSourceText +] diff --git a/src/GToolkit-Coder-Promised/GtSourceCoderViewModelPromised.class.st b/src/GToolkit-Coder-Promised/GtSourceCoderViewModelPromised.class.st new file mode 100644 index 000000000..6e22a57f4 --- /dev/null +++ b/src/GToolkit-Coder-Promised/GtSourceCoderViewModelPromised.class.st @@ -0,0 +1,163 @@ +Class { + #name : #GtSourceCoderViewModelPromised, + #superclass : #GtTextualCoderViewModelPromised, + #instVars : [ + 'evaluationResult' + ], + #category : #'GToolkit-Coder-Promised' +} + +{ #category : #'api - actions' } +GtSourceCoderViewModelPromised >> debug [ + ^ self selection isEmpty + ifTrue: [ self debugAll ] + ifFalse: [ self debugIt: self selectedTextInterval ] +] + +{ #category : #'api - actions' } +GtSourceCoderViewModelPromised >> debugAll [ + ^ self coderModel debugInContext: self evaluationContext all +] + +{ #category : #'api - actions' } +GtSourceCoderViewModelPromised >> debugIt: aTextInterval [ + ^ self coderModel debugInContext: (self evaluationContext + from: aTextInterval first to: aTextInterval last) +] + +{ #category : #'api - actions' } +GtSourceCoderViewModelPromised >> discardChanges [ + self coder discardChanges +] + +{ #category : #'api - actions' } +GtSourceCoderViewModelPromised >> doIt [ + "Evaluate a piece of source code within a selection interval or everything if nothing is selected and return a result" + + + ^ self doItRequestedBy: self +] + +{ #category : #'api - actions' } +GtSourceCoderViewModelPromised >> doIt: aTextInterval [ + "Evaluate a piece of source code within an interval and return a result. + I am also able to evaluate an empty or only consisting of whitespace + source code in which case the result is nil" + + + ^ self doIt: aTextInterval requestedBy: self +] + +{ #category : #'api - actions' } +GtSourceCoderViewModelPromised >> doIt: aTextInterval requestedBy: aRequesterObject [ + "Evaluate source code within given text interval and return the result" + + ^ self coderModel doItInContext: (self evaluationContext + from: aTextInterval first to: aTextInterval last; + requesterObject: aRequesterObject) +] + +{ #category : #'api - actions' } +GtSourceCoderViewModelPromised >> doItAll [ + "Evaluate the whole source code and return the result" + + ^ self doItAllRequestedBy: self +] + +{ #category : #'api - actions' } +GtSourceCoderViewModelPromised >> doItAllRequestedBy: aRequesterObject [ + "Evaluate the whole source code independent from the selection and return the result" + + ^ self coder doItInContext: (self evaluationContext + all; + requesterObject: aRequesterObject) +] + +{ #category : #'api - actions' } +GtSourceCoderViewModelPromised >> doItAndGo [ + "Evaluate selected source code or everything if there is nothing selected and inspect the result" + + ^ self selection isEmpty + ifTrue: [ self doItAndGoAll ] + ifFalse: [ self doItAndGo: self selectedTextInterval ] +] + +{ #category : #'api - actions' } +GtSourceCoderViewModelPromised >> doItAndGo: aTextInterval [ + "Evaluate a piece of source code within an interval and inspect a result." + + ^ self coder doItAndGoInContext: (self evaluationContext from: aTextInterval first to: aTextInterval last) +] + +{ #category : #'api - actions' } +GtSourceCoderViewModelPromised >> doItAndGoAll [ + "Evaluate the whole source code and inspect the result" + + ^ self coder doItAndGoInContext: self evaluationContext all +] + +{ #category : #'api - actions' } +GtSourceCoderViewModelPromised >> doItRequestedBy: aRequesterObject [ + "Evaluate selected source code or everything if there is nothing selected and return the result" + + ^ self selection isEmpty + ifTrue: [ self doItAllRequestedBy: aRequesterObject ] + ifFalse: [ self doIt: self selectedTextInterval requestedBy: aRequesterObject ] +] + +{ #category : #accessing } +GtSourceCoderViewModelPromised >> elementClass [ + ^ super elementClass + "^ GtExpandableSourceCoderElement" +] + +{ #category : #'private - evaluation' } +GtSourceCoderViewModelPromised >> evaluationContext [ + + + ^ self coderModel evaluationContext + requesterObject: self +] + +{ #category : #accessing } +GtSourceCoderViewModelPromised >> evaluationResult [ + ^ evaluationResult +] + +{ #category : #accessing } +GtSourceCoderViewModelPromised >> evaluationResult: anObject [ + evaluationResult := anObject +] + +{ #category : #'api - actions' } +GtSourceCoderViewModelPromised >> printIt [ + "Evaluate selected source code or everything if there is nothing selected and print the result" + + ^ self selection isEmpty + ifTrue: [ self printItAll ] + ifFalse: [ self printIt: self selectedTextInterval ] +] + +{ #category : #'api - actions' } +GtSourceCoderViewModelPromised >> printIt: aTextInterval [ + "Evaluate a piece of source code within an interval and print a result." + + ^ self coder printItInContext: (self evaluationContext from: aTextInterval first to: aTextInterval last) +] + +{ #category : #'api - actions' } +GtSourceCoderViewModelPromised >> printItAll [ + "Evaluate the whole source code and print the result" + + ^ self coder printItInContext: self evaluationContext all +] + +{ #category : #'private - evaluation' } +GtSourceCoderViewModelPromised >> selectedTextInterval [ + + | anInterval | + anInterval := 1 to: 0. + self selection do: [ :eachMonotoneSelection | + anInterval := eachMonotoneSelection from + 1 to: eachMonotoneSelection to ]. + ^ anInterval +] diff --git a/src/GToolkit-Coder-Promised/GtTextualCoderEditorElementPromised.class.st b/src/GToolkit-Coder-Promised/GtTextualCoderEditorElementPromised.class.st new file mode 100644 index 000000000..c51fbd941 --- /dev/null +++ b/src/GToolkit-Coder-Promised/GtTextualCoderEditorElementPromised.class.st @@ -0,0 +1,509 @@ +Class { + #name : #GtTextualCoderEditorElementPromised, + #superclass : #BrEditor, + #traits : 'TBlAssertUIProcess + TGtWithTextualCoderViewModel', + #classTraits : 'TBlAssertUIProcess classTrait + TGtWithTextualCoderViewModel classTrait', + #instVars : [ + 'completion', + 'evaluationHighlighter', + 'evaluationPrinter', + 'shortcuts' + ], + #category : #'GToolkit-Coder-Promised' +} + +{ #category : #'api - textual coder view model' } +GtTextualCoderEditorElementPromised >> coderUIModel: aTextualCoderViewModel [ + self textualCoderViewModel: aTextualCoderViewModel +] + +{ #category : #'instance creation' } +GtTextualCoderEditorElementPromised >> createContextMenuContent [ + "wait for the addons to be computed" + | theContextMenu | + + theContextMenu := GtCoderContextMenuContent new + editorElement: self. + + self textualCoderViewModel addOnsAsyncDo: [ :theAddOns | + | theItems theContextMenuAstAddons | + + "extra context menu items that depend on ast and view model state such as selection" + theContextMenuAstAddons := self textualCoderViewModel computeContextMenuAstAddOns. + + theItems := theAddOns contextMenuActions, theAddOns mainActions, theContextMenuAstAddons contextMenuActions. + theItems := theItems reject: [ :e | e title isNil ]. + + theContextMenu enqueueTask: (BlTaskAction new action: [ theContextMenu items: theItems ]) ]. + + ^ theContextMenu +] + +{ #category : #private } +GtTextualCoderEditorElementPromised >> hideHighlighters [ + self text clearAttributes: [ :eachAttribute | + eachAttribute isKindOf: GtSourceCoderErrorAttribute ]. + evaluationHighlighter hideResultSynchronously. + evaluationPrinter hideResultSynchronously. +] + +{ #category : #private } +GtTextualCoderEditorElementPromised >> highlightPCRangeForInterval: aSelectionInterval [ + self textualCoderViewModel isModified + ifTrue: [ ^ self ]. + self text + clearAttributes: [ :each | each class = BlTextDecorationAttribute ]. + (self text from: aSelectionInterval first to: aSelectionInterval last) + underlineDo: [ :anAttribute | + anAttribute + color: self theme status errorBackgroundColor; + thickness: 1.5; + beNotOverwritableByStyler ] +] + +{ #category : #initialization } +GtTextualCoderEditorElementPromised >> initialize [ + super initialize. + + self + aptitude: BrGlamorousCodeEditorAptitude + (BrGlamorousWithContextMenuAptitude content: [ self createContextMenuContent ]); + padding: BlInsets empty; + hMatchParent; + vFitContent. + + self editor + beEditableCode; + disableStyleTextWhenModified. + + shortcuts := #(). + completion := GtCompletionController on: self. + + evaluationHighlighter := GtSourceCoderEvaluationHighlighter new editorElement: self. + evaluationPrinter := GtSourceCoderEvaluationPrinter new editorElement: self. + + self initializeListeners +] + +{ #category : #initialization } +GtTextualCoderEditorElementPromised >> initializeListeners [ + self when: BlFocusInEvent do: [ :anEvent | + self textualCoderViewModel focused: true from: self ]. + self when: BlFocusOutEvent do: [ :anEvent | + "when elements are removed from the scene graph due to tab switching or scrolling they lose focus. + We are only interested when focus is lost explicitly via user interaction" + anEvent isDueToRemoval + ifFalse: [ self textualCoderViewModel focused: false from: self ] ]. + + self editor + when: BrTextEditorModifiedEvent + do: [ :anEvent | self onTextModified ]. + + self editor + when: BrTextEditorCursorChangedEvent + do: [ :anEvent | self textualCoderViewModel cursors: anEvent cursors from: self ]. + + self editor + when: BrTextEditorSelectionChangedEvent + do: [ :anEvent | self textualCoderViewModel selection: anEvent selection from: self ]. + + "self editor + when: BrTextEditorTextStyledEvent + do: [ :anEvent | self textualCoderViewModel styledText: anEvent styledText ]" +] + +{ #category : #'private - event handling' } +GtTextualCoderEditorElementPromised >> onCodeEvaluated: anEvaluationAnnouncement [ + evaluationHighlighter displayResult: anEvaluationAnnouncement evaluationResult. + evaluationPrinter hideResult +] + +{ #category : #'private - event handling' } +GtTextualCoderEditorElementPromised >> onCoderParseError: aGtCoderParseError [ + "A parse error can be notifying from a non-UI thread" + + self enqueueTask: (BlTaskAction new action: [ + self + reportParseError: aGtCoderParseError errorMessage + at: aGtCoderParseError location ]) +] + +{ #category : #'private - event handling' } +GtTextualCoderEditorElementPromised >> onCoderViewModelFocused: aBoolean [ + aBoolean + ifTrue: [ self requestFocus ] + ifFalse: [ self loseFocus ] +] + +{ #category : #'private - event handling' } +GtTextualCoderEditorElementPromised >> onContextPCRangeChanged: aContextPCRangeChangedAnnouncement [ + | selectionInterval | + + selectionInterval := aContextPCRangeChangedAnnouncement pcRange. + self highlightPCRangeForInterval: selectionInterval +] + +{ #category : #'private - event handling' } +GtTextualCoderEditorElementPromised >> onCursorsChanged: aCursorsChangedAnnouncement [ + "Is sent when the cursors change in the View Model. + May be sent from a non-UI thread" + + "if the source of the announcement is myself, do nothing to break the change cycle" + aCursorsChangedAnnouncement source = self + ifTrue: [ ^ self ]. + + "since it may be sent from a non-UI process make sure to wrap in the action" + self enqueueTask: (BlTaskAction new action: [ + self navigator + withoutResettingDesiredCoordinate; + removeAll; + addAll: aCursorsChangedAnnouncement cursors; + apply ]) +] + +{ #category : #'private - event handling' } +GtTextualCoderEditorElementPromised >> onFocusChangedAnnouncement: anAnnouncement [ + self assertUIProcess. + + anAnnouncement source == self + ifTrue: [ ^ self ]. + + anAnnouncement source == self textualCoderViewModel + ifFalse: [ ^ self ]. + + self onCoderViewModelFocused: anAnnouncement focused +] + +{ #category : #'private - event handling' } +GtTextualCoderEditorElementPromised >> onObjectSpawnRequest: anAnnouncement [ + self enqueueTask: (BlTaskAction new action: [ + self phlow + spawnObject: anAnnouncement object + withDestination: anAnnouncement spawnDestination ]) +] + +{ #category : #'api - textual coder view model' } +GtTextualCoderEditorElementPromised >> onPostTextualCoderViewModelChanged [ + "I am an optional hook method that is sent after #subscribeToTextualCoderViewModel. + I do nothing by default but allow users to perform update operations when a receiver object is already + subscribed to announcements." + + self textualCoderViewModel hasStyledText + ifTrue: [ ^ self ]. + + "the add-ons will not compute themselves unless we tell them to" + self textualCoderViewModel addOns then: [ :theAddOns | self onViewModelReadyToStyle ] +] + +{ #category : #'private - event handling' } +GtTextualCoderEditorElementPromised >> onPrintRequest: anEvaluationAnnouncement [ + evaluationHighlighter hideResult. + evaluationPrinter displayResult: anEvaluationAnnouncement evaluationResult. +] + +{ #category : #'private - event handling' } +GtTextualCoderEditorElementPromised >> onShowDebuggerRequest: aShowDebuggerAnnouncement [ + | sharedDebugSession anEvaluatedSource anEvaluatedInterval theSourceStartInText theSourceEndInText | + + evaluationHighlighter hideResult. + evaluationPrinter hideResult. + + sharedDebugSession := GtSharedDebugSession new + session: aShowDebuggerAnnouncement debugSession. + + self showNotification: (GtNotificationDebugSession new debugSession: sharedDebugSession). + + anEvaluatedSource := aShowDebuggerAnnouncement sourceString. + anEvaluatedInterval := aShowDebuggerAnnouncement sourceInterval. + + theSourceStartInText := self text finder + caseSensitiveSubstring: anEvaluatedSource; + startAtPosition: anEvaluatedInterval first; + searchClosest. + + "what did we evaluate?" + theSourceStartInText isZero + ifTrue: [ ^ self ]. + + theSourceEndInText := (theSourceStartInText + anEvaluatedSource size - 1) min: self text size. + + self text + clearAttributes: [ :each | + { GtEmbeddedDebuggerAttribute } anySatisfy: [ :cls | each isKindOf: cls ] ]. + + (self text from: theSourceStartInText to: theSourceEndInText) + attribute: (GtEmbeddedDebuggerAttribute new + signaledException: aShowDebuggerAnnouncement exception; + debugSession: sharedDebugSession) +] + +{ #category : #'private - event handling' } +GtTextualCoderEditorElementPromised >> onStyleTextRequest: anEvent [ + "onStyleTextRequest: may be sent from a non-UI thread" + + self enqueueTask: (BlTaskAction new action: [ self styleTextAndAfterDo: anEvent afterAction ]) +] + +{ #category : #'private - event handling' } +GtTextualCoderEditorElementPromised >> onStylersUpdated: anAnnouncement [ + +] + +{ #category : #'private - event handling' } +GtTextualCoderEditorElementPromised >> onTextModified [ + "Is sent when the text changes in the editor. Here we should synchronise the UI and the model." + + self textualCoderViewModel + sourceText: self text + from: self + synchronously: true +] + +{ #category : #'api - textual coder view model' } +GtTextualCoderEditorElementPromised >> onTextualCoderViewModelChanged [ + "Is sent when a new textualCoder view model is assigned to the element. + Note: #onTextualCoderViewModelChanged is sent before #subscribeToTextualCoderViewModel + which means that if you perform any operation that triggers an announcement it will be ignored because the receiver + didn't get a chance to subscribe to any announcement. Override #onPostTextualCoderViewModelChanged if you + wish to perform an operation that requires an announcement, but keep in mind that this is not the most efficient way" + + self onCoderViewModelFocused: self textualCoderViewModel focused. + + "Setting text may change cursor and selection because text editor makes sure + that they have valid values. That is why we create a snaphot of the editor's state + which we will restore once new text is set" + self textualCoderViewModel asEditorState then: [ :anEditorState :isSynchronous | + isSynchronous + ifTrue: [ self editor restoreState: anEditorState ] + ifFalse: [ self enqueueTask: (BlTaskAction new action: [ self editor restoreState: anEditorState ]) ] ]. + + self editor model: self textualCoderViewModel. + + shortcuts := self textualCoderViewModel shortcuts copy. + self editor addEditorShortcuts: shortcuts. + + completion strategy: self textualCoderViewModel coderModel completionStrategy +] + +{ #category : #'private - event handling' } +GtTextualCoderEditorElementPromised >> onToolSpawnRequest: anAnnouncement [ + self enqueueTask: (BlTaskAction new action: [ + self phlow + spawnTool: anAnnouncement tool + withDestination: anAnnouncement spawnDestination ]) +] + +{ #category : #'private - event handling' } +GtTextualCoderEditorElementPromised >> onUpdateAddOnsRequest: anAnnouncement [ + +] + +{ #category : #'private - event handling' } +GtTextualCoderEditorElementPromised >> onViewModelCursorsChanged: aCursorsChangedAnnouncement [ + "Is sent when the cursors changes in the View Model. + May be sent from a non-UI thread" + + "if the source of the announcement is myself, do nothing to break the change cycle" + aCursorsChangedAnnouncement source = self + ifTrue: [ ^ self ]. + + aCursorsChangedAnnouncement source == self textualCoderViewModel + ifFalse: [ ^ self ]. + + "since it may be sent from a non-UI process make sure to wrap in the action" + self enqueueTask: (BlTaskAction new action: [ + self navigator + withoutResettingDesiredCoordinate; + removeAll; + addAll: aCursorsChangedAnnouncement cursors; + apply ]) +] + +{ #category : #'private - event handling' } +GtTextualCoderEditorElementPromised >> onViewModelReadyToStyle [ + self enqueueTask: (BlTaskAction new action: [ self editor styleText ]) +] + +{ #category : #'private - event handling' } +GtTextualCoderEditorElementPromised >> onViewModelSelectionChanged: aSelectionChangedAnnouncement [ + "Is sent when the selection changes in the View Model. + May be sent from a non-UI thread" + + "if the source of the announcement is myself, do nothing to break the change cycle" + aSelectionChangedAnnouncement source = self + ifTrue: [ ^ self ]. + + aSelectionChangedAnnouncement source == self textualCoderViewModel + ifFalse: [ ^ self ]. + + "since it may be sent from a non-UI process make sure to wrap in the action" + self enqueueTask: (BlTaskAction new action: [ + self deselecter all deselect. + self selecter + withoutCursorUpdate; + all: aSelectionChangedAnnouncement selection; + select ]) +] + +{ #category : #'private - event handling' } +GtTextualCoderEditorElementPromised >> onViewModelShortcutsChanged [ + "Is sent when the shortcuts change in the View Model. + May be sent from a non-UI thread" + + "since it may be sent from a non-UI process make sure to wrap in the action" + self enqueueTask: (BlTaskAction new action: [ + self editor removeEditorShortcuts: shortcuts. + shortcuts := self textualCoderViewModel shortcuts copy. + self editor addEditorShortcuts: shortcuts ]) +] + +{ #category : #'private - event handling' } +GtTextualCoderEditorElementPromised >> onViewModelStyledTextChanged: anAnnouncement [ +] + +{ #category : #'private - event handling' } +GtTextualCoderEditorElementPromised >> onViewModelStylersChanged [ + self enqueueTask: (BlTaskAction new + action: [ self styler: self textualCoderViewModel compositeStyler ]) +] + +{ #category : #'private - event handling' } +GtTextualCoderEditorElementPromised >> onViewModelTextAttributesAdded: anAnnouncement [ + self enqueueTask: (BlTaskAction new action: [ + anAnnouncement coderTextAttributes + applyOnEditorText: self text + from: anAnnouncement startPosition + to: anAnnouncement stopPosition ]) +] + +{ #category : #'private - event handling' } +GtTextualCoderEditorElementPromised >> onViewModelTextAttributesRemoved: anAnnouncement [ + self enqueueTask: (BlTaskAction new action: [ + anAnnouncement coderTextAttributes removeFromEditorText: self text ]) +] + +{ #category : #'private - event handling' } +GtTextualCoderEditorElementPromised >> onViewModelTextChanged: aGtTextualCoderViewModelTextChanged [ + + aGtTextualCoderViewModelTextChanged source == self + ifTrue: [ ^ self hideHighlighters ]. + + aGtTextualCoderViewModelTextChanged isSynchronous + ifTrue: [ + self text: aGtTextualCoderViewModelTextChanged text copy. + self hideHighlighters ] + ifFalse: [ self enqueueTask: (BlTaskAction new action: [ + self text: aGtTextualCoderViewModelTextChanged text copy. + self hideHighlighters ]) ] +] + +{ #category : #registration } +GtTextualCoderEditorElementPromised >> registerCoderModelAnnouncementsFor: aCoderModel [ + aCoderModel announcer weak + when: GtCoderAddOnsUpdateRequest + send: #onUpdateAddOnsRequest: + to: self; + when: GtCoderStylerChanged send: #onStylersUpdated: to: self; + when: GtCoderStyleTextRequest send: #onStyleTextRequest: to: self; + when: GtCoderParseError send: #onCoderParseError: to: self; + when: GtCoderObjectSpawnRequest + send: #onObjectSpawnRequest: + to: self; + when: GtCoderToolSpawnRequest send: #onToolSpawnRequest: to: self; + when: GtCoderEvaluationAnnouncement + send: #onCodeEvaluated: + to: self; + when: GtCoderPrintAnnouncement send: #onPrintRequest: to: self; + when: GtCoderShowDebuggerRequest + send: #onShowDebuggerRequest: + to: self +] + +{ #category : #registration } +GtTextualCoderEditorElementPromised >> registerCoderViewModelAnnouncementsFor: aGtSourceCoderUIModel [ + aGtSourceCoderUIModel weak + when: GtMethodCoderContextPCRangeChanged + send: #onContextPCRangeChanged: + to: self; + when: GtSourceCoderFocusChanged + send: #onFocusChangedAnnouncement: + to: self; + + when: GtTextualCoderViewModelTextChanged + send: #onViewModelTextChanged: + to: self; + when: GtTextualCoderViewModelCursorsChanged + send: #onViewModelCursorsChanged: + to: self; + when: GtTextualCoderViewModelSelectionChanged + send: #onViewModelSelectionChanged: + to: self; + when: GtTextualCoderViewModelStylersChanged + send: #onViewModelStylersChanged + to: self; + when: GtTextualCoderViewModelShortcutsChanged + send: #onViewModelShortcutsChanged + to: self; + when: GtTextualCoderViewModelReadyToRestyle + send: #onViewModelReadyToStyle + to: self; + when: GtTextualCoderViewModelTextAttributesAdded + send: #onViewModelTextAttributesAdded: + to: self; + when: GtTextualCoderViewModelTextAttributesRemoved + send: #onViewModelTextAttributesRemoved: + to: self; + when: GtTextualCoderViewModelStyledTextChanged + send: #onViewModelStyledTextChanged: + to: self. +] + +{ #category : #private } +GtTextualCoderEditorElementPromised >> reportParseError: aString at: anInteger [ + | text position | + + text := self editor text. + + position := anInteger - 1 max: 1. + text size < position + ifTrue: [ ^ self ]. + + text clearAttributesOfClass: GtSourceCoderErrorAttribute. + text + attribute: (GtSourceCoderErrorAttribute for: aString) + from: position + to: position +] + +{ #category : #private } +GtTextualCoderEditorElementPromised >> styleText [ + self editor styleText +] + +{ #category : #private } +GtTextualCoderEditorElementPromised >> styleTextAndAfterDo: aBlock [ + self editor styleTextAndAfterDo: aBlock +] + +{ #category : #'api - textual coder view model' } +GtTextualCoderEditorElementPromised >> subscribeToTextualCoderViewModel [ + "Is sent after a new textualCoder view model is assigned to the element. + It is required to unsubscribe from the view model or domain model by implementing + #unsubscribeFromTextualCoderViewModel if elements subscribe to them" + + self registerCoderModelAnnouncementsFor: self textualCoderViewModel coderModel. + self registerCoderViewModelAnnouncementsFor: self textualCoderViewModel. + + completion install +] + +{ #category : #'api - textual coder view model' } +GtTextualCoderEditorElementPromised >> unsubscribeFromTextualCoderViewModel [ + "Is sent before a new textualCoder view model is assigned to the element. + Elements that subscribe to textualCoder view model in domain model are required to implement this methods." + + self textualCoderViewModel unsubscribe: self. + self textualCoderViewModel coderModel unsubscribe: self. + + completion uninstall. + self editor removeEditorShortcuts: shortcuts +] diff --git a/src/GToolkit-Coder-Promised/GtTextualCoderViewModelPromised.class.st b/src/GToolkit-Coder-Promised/GtTextualCoderViewModelPromised.class.st new file mode 100644 index 000000000..8f9db2b45 --- /dev/null +++ b/src/GToolkit-Coder-Promised/GtTextualCoderViewModelPromised.class.st @@ -0,0 +1,666 @@ +Class { + #name : #GtTextualCoderViewModelPromised, + #superclass : #GtSingleCoderViewModel, + #instVars : [ + 'addOnPromise', + 'extraAddOns', + 'stylers', + 'mainActions', + 'contextActions', + 'contextMenuActions', + 'shortcuts', + 'hasFocus', + 'expanded', + 'cursors', + 'selection', + 'extraTextAttributes', + 'styledText' + ], + #category : #'GToolkit-Coder-Promised' +} + +{ #category : #'api - add-ons' } +GtTextualCoderViewModelPromised >> addOns [ + ^ self ensureAddOns +] + +{ #category : #'api - shortcuts' } +GtTextualCoderViewModelPromised >> addShortcut: aShortcut [ + "Add an extra shortcut add-on independent from the dynamically computed add-ons" + + extraAddOns addShortcut: aShortcut +] + +{ #category : #'api - shortcuts' } +GtTextualCoderViewModelPromised >> addStyler: aGtCoderStyler [ + "Add an extra styler add-on independent from the dynamically computed add-ons" + + extraAddOns addStyler: aGtCoderStyler +] + +{ #category : #'api - shortcuts' } +GtTextualCoderViewModelPromised >> addStylers: aCollectionOfGtCoderStyler [ + "Add extra styler add-ons independent from the dynamically computed add-ons" + + aCollectionOfGtCoderStyler do: [ :eachStyler | self addStyler: eachStyler ] +] + +{ #category : #'api - text' } +GtTextualCoderViewModelPromised >> addTextAttribute: aTextAttribute from: aStartPosition to: anEndPosition [ + + ^ self + addTextAttributes: { aTextAttribute } + from: aStartPosition + to: anEndPosition +] + +{ #category : #'api - text' } +GtTextualCoderViewModelPromised >> addTextAttributes: aCollectionOfTextAttributes from: aStartPosition to: anEndPosition [ + + | aCurrentText aMarkerAttribute newCoderTextAttributes | + + aMarkerAttribute := BrTextInvisibleMarkerAttribute new beNotOverwritableByStyler. + + "we change the sourceText directly to not trigger the styler recomputation" + aCurrentText := self sourceText. + aCurrentText attribute: aMarkerAttribute from: aStartPosition to: anEndPosition. + + newCoderTextAttributes := GtTextualCoderTextAttributes new + markerAttribute: aMarkerAttribute; + textAttributes: aCollectionOfTextAttributes. + + extraTextAttributes add: newCoderTextAttributes. + self announce: (GtTextualCoderViewModelTextAttributesAdded new + coderTextAttributes: newCoderTextAttributes; + startPosition: aStartPosition; + stopPosition: anEndPosition). + + ^ newCoderTextAttributes +] + +{ #category : #converting } +GtTextualCoderViewModelPromised >> asEditorState [ + + + ^ self coderModel currentSourceText then: [ :aText | + | anEditorText aMemento | + + anEditorText := aText copy. + + self extraTextAttributes do: [ :eachCoderAttributes | + eachCoderAttributes applyOnEditorText: anEditorText ]. + + aMemento := BrTextEditorCompositeMemento new + addMemento: (BrTextEditorCursorsMemento new cursors: cursors copy); + addMemento: (BrTextEditorSelectionMemento new selection: selection copy). + + self hasStyledText + ifTrue: [ + aMemento addMemento: (BrTextEditorStyledTextMemento new + text: self styledText; + styler: self compositeStyler) ] + ifFalse: [ + aMemento + addMemento: (BrTextEditorTextMemento new text: anEditorText); + addMemento: (BrTextEditorStylerMemento new styler: self compositeStyler) ]. + aMemento ] +] + +{ #category : #'api - expansion' } +GtTextualCoderViewModelPromised >> collapse [ + self expanded: false +] + +{ #category : #'api - stylers' } +GtTextualCoderViewModelPromised >> compositeStyler [ + ^ GtCoderAstCompositeStyler new + coderViewModel: self; + stylers: self stylers; + yourself +] + +{ #category : #'private - addons' } +GtTextualCoderViewModelPromised >> computeAddOns [ + | aCoderModel | + + aCoderModel := self coderModel. + + ^ aCoderModel ast asyncThen: [ :aCoderAst | + | theAst newAddOns pragmas | + + theAst := aCoderAst ast. + + pragmas := aCoderModel + pragmasNamed: #gtAstCoderAddOns: + inHierarchy: aCoderModel class. + + newAddOns := aCoderModel newAddOns. + "extra addons" + newAddOns addAddOns: aCoderModel addOns. + aCoderModel initializeShortcuts: newAddOns. + aCoderModel initializeAddOns: newAddOns. + theAst ifNotNil: [ + pragmas reverseDo: [ :eachPragma | + [ aCoderModel + perform: eachPragma methodSelector + withEnoughArguments: { theAst . newAddOns . self } ] + on: Error + do: [ :anError | + "emit as a beacon signal" + anError emit. + + NonInteractiveTranscript stderr + nextPut: $[; + print: eachPragma method printString; + nextPut: $]; + space; + print: anError; + cr ] ] ]. + + "view model add-ons override coder model add-ons" + newAddOns addAddOns: extraAddOns. + newAddOns markAsUpdated. + newAddOns ]. +] + +{ #category : #'private - addons' } +GtTextualCoderViewModelPromised >> computeContextMenuAstAddOns [ + | aCoderModel newAddOns pragmas theAst | + + aCoderModel := self coderModel. + + theAst := aCoderModel astAwait. + pragmas := aCoderModel + pragmasNamed: #gtCoderContextMenuAddOns: + inHierarchy: aCoderModel class. + + newAddOns := aCoderModel newAddOns. + theAst ifNotNil: [ + pragmas reverseDo: [ :eachPragma | + [ aCoderModel + perform: eachPragma methodSelector + withEnoughArguments: { theAst . newAddOns . self } ] + on: Error + do: [ :anError | + "emit as a beacon signal" + anError emit. + + NonInteractiveTranscript stderr + nextPut: $[; + print: eachPragma method printString; + nextPut: $]; + space; + print: anError; + cr ] ] ]. + + ^ newAddOns +] + +{ #category : #'api - add-ons' } +GtTextualCoderViewModelPromised >> contextActions [ + ^ contextActions +] + +{ #category : #'api - add-ons' } +GtTextualCoderViewModelPromised >> contextActions: theContextActions [ + contextActions = theContextActions + ifTrue: [ ^ self ]. + + contextActions := theContextActions. + self announce: GtTextualCoderViewModelContextActionsChanged new +] + +{ #category : #'api - add-ons' } +GtTextualCoderViewModelPromised >> contextMenuActions [ + ^ contextMenuActions +] + +{ #category : #'api - add-ons' } +GtTextualCoderViewModelPromised >> contextMenuActions: theContextMenuActions [ + contextMenuActions = theContextMenuActions + ifTrue: [ ^ self ]. + + contextMenuActions := theContextMenuActions. + self announce: GtTextualCoderViewModelContextMenuActionsChanged new +] + +{ #category : #'api - cursors' } +GtTextualCoderViewModelPromised >> cursors [ + + + ^ cursors +] + +{ #category : #'api - cursors' } +GtTextualCoderViewModelPromised >> cursors: aBrTextEditorCursor [ + self cursors: aBrTextEditorCursor from: self +] + +{ #category : #'api - cursors' } +GtTextualCoderViewModelPromised >> cursors: aBrTextEditorCursor from: aSourceObject [ + cursors = aBrTextEditorCursor + ifTrue: [ ^ self ]. + + cursors := aBrTextEditorCursor copy. + self notifyCursorsChanged: cursors from: aSourceObject +] + +{ #category : #accessing } +GtTextualCoderViewModelPromised >> elementClass [ + ^ GtTextualCoderEditorElementPromised +] + +{ #category : #'private - addons' } +GtTextualCoderViewModelPromised >> ensureAddOns [ + ^ addOnPromise ifNil: [ addOnPromise := self computeAddOns then: [ :theAddOns | self onAddOnsChanged: theAddOns ]; yourself ] +] + +{ #category : #'api - expansion' } +GtTextualCoderViewModelPromised >> expand [ + self expanded: true +] + +{ #category : #'api - expansion' } +GtTextualCoderViewModelPromised >> expanded [ + ^ expanded +] + +{ #category : #'api - expansion' } +GtTextualCoderViewModelPromised >> expanded: aBoolean [ + expanded = aBoolean + ifTrue: [ ^ self ]. + + expanded := aBoolean. + self notifyExpansionChanged: expanded +] + +{ #category : #accessing } +GtTextualCoderViewModelPromised >> extraTextAttributes [ + ^ extraTextAttributes +] + +{ #category : #'api - focus' } +GtTextualCoderViewModelPromised >> focused [ + + + ^ hasFocus +] + +{ #category : #'api - focus' } +GtTextualCoderViewModelPromised >> focused: aBoolean [ + self focused: aBoolean from: self +] + +{ #category : #'api - focus' } +GtTextualCoderViewModelPromised >> focused: aBoolean from: aSourceObject [ + hasFocus = aBoolean + ifTrue: [ ^ self ]. + + hasFocus := aBoolean. + self notifyFocusChanged: hasFocus from: aSourceObject. + + codersUIModel ifNotNil: [ :theCoders | + aBoolean + ifTrue: [ theCoders focusCoderUIModel: self ] + ifFalse: [ theCoders unfocusCoderUIModel: self ] ] +] + +{ #category : #'gt-extension' } +GtTextualCoderViewModelPromised >> gtInfo [ + ^ Array streamContents: [ :aStream | + aStream nextPut: (#coderModel -> self coderModel). + aStream nextPut: (#cursors -> self cursors). + aStream nextPut: (#selection -> self selection). + aStream nextPut: (#ast -> self coderModel ast wait). + aStream nextPut: (#stylers -> self stylers). + aStream nextPut: (#mainActions -> self mainActions). + aStream nextPut: (#contextActions -> self contextActions). + aStream nextPut: (#contextMenuActions -> self contextMenuActions). + aStream nextPut: (#shortcuts -> self shortcuts). + aStream nextPut: (#attributes -> self extraTextAttributes). + aStream nextPut: (#hasFocus -> self focused). + aStream nextPut: (#expanded -> self expanded) ] +] + +{ #category : #'gt-extension' } +GtTextualCoderViewModelPromised >> gtInfoFor: aView [ + + + ^ aView columnedList + title: 'Info'; + priority: 0; + items: [ self gtInfo ]; + actionUpdateButtonTooltip: 'Refresh'; + column: 'Property' + text: [ :eachItem :eachIndex | eachItem key asRopedText foreground: Color gray ] + width: 150; + column: 'Value' + text: [ :eachItem | eachItem value gtDisplayText ]; + send: [ :assoc | assoc value ]; + updateWhen: GtTextualCoderViewModelAnnouncement in: self announcer +] + +{ #category : #'api - selection' } +GtTextualCoderViewModelPromised >> hasSelection [ + ^ self selection isNotEmpty +] + +{ #category : #'api - styled text' } +GtTextualCoderViewModelPromised >> hasStyledText [ + + + >#propertyTesterTemplate'> + + ^ styledText notNil +] + +{ #category : #initialization } +GtTextualCoderViewModelPromised >> initialize [ + super initialize. + + extraAddOns := GtTextualCoderAddOns new. + stylers := #(). + shortcuts := #(). + mainActions := #(). + contextActions := #(). + contextMenuActions := #(). + + cursors := BrTextEditorMultipleCursor new. + selection := BlCompositeSelection new. + extraTextAttributes := OrderedCollection new. + + hasFocus := false. + expanded := true +] + +{ #category : #'api - add-ons' } +GtTextualCoderViewModelPromised >> mainActions [ + ^ mainActions +] + +{ #category : #'api - add-ons' } +GtTextualCoderViewModelPromised >> mainActions: theMainActions [ + mainActions = theMainActions + ifTrue: [ ^ self ]. + + mainActions := theMainActions. + self announce: GtTextualCoderViewModelMainActionsChanged new +] + +{ #category : #'api - cursors' } +GtTextualCoderViewModelPromised >> moveCursorAtEnd [ + "Move the cursor at the end of the textual snippet" + + self moveCursorTo: self sourceText size +] + +{ #category : #'api - cursors' } +GtTextualCoderViewModelPromised >> moveCursorAtStart [ + "Move the cursor at the end of the textual snippet" + + self moveCursorTo: 0 +] + +{ #category : #'api - cursors' } +GtTextualCoderViewModelPromised >> moveCursorTo: aCursorIndex [ + self cursors: (BrTextEditorCursor at: aCursorIndex) +] + +{ #category : #'private - notifying' } +GtTextualCoderViewModelPromised >> notifyCursorsChanged: aBrTextEditorCursor from: aSourceObject [ + self announce: (GtTextualCoderViewModelCursorsChanged new cursors: aBrTextEditorCursor; source: aSourceObject) +] + +{ #category : #'private - notifying' } +GtTextualCoderViewModelPromised >> notifyExpansionChanged: aBoolean [ + self announce: (GtTextualCoderViewModelExpansionChanged new expanded: aBoolean) +] + +{ #category : #'private - notifying' } +GtTextualCoderViewModelPromised >> notifyFocusChanged: aBoolean from: aSourceObject [ + self announcerUIModel announce: (GtSourceCoderFocusChanged new + focused: aBoolean; + source: aSourceObject) +] + +{ #category : #'private - notifying' } +GtTextualCoderViewModelPromised >> notifySelectionChanged: aBlCompositeSelection from: aSourceObject [ + self announce: (GtTextualCoderViewModelSelectionChanged new selection: aBlCompositeSelection; source: aSourceObject) +] + +{ #category : #'api - styled text' } +GtTextualCoderViewModelPromised >> notifyStyledTextChanged [ + "Override this notify method to announce changes to the property" + + >#notifyPropertyChangedTemplate'> + self announce: (GtTextualCoderViewModelStyledTextChanged new + styledText: self styledText). +] + +{ #category : #'private - event handling' } +GtTextualCoderViewModelPromised >> onAddOnsChanged: theAddOns [ + "Is sent when new add-ons are computed" + + self stylers: theAddOns stylers. + self shortcuts: theAddOns shortcuts. + self mainActions: theAddOns mainActions. + self contextActions: theAddOns contextActions. + self contextMenuActions: theAddOns contextMenuActions. + + self announce: GtTextualCoderViewModelReadyToRestyle new +] + +{ #category : #'api - styled text' } +GtTextualCoderViewModelPromised >> onNewStyledTextSet: aNewStyledText [ + "Is sent after a new value of the styledText is assigned" + + >#onNewPropertySetHookTemplate'> +] + +{ #category : #'api - styled text' } +GtTextualCoderViewModelPromised >> onPreviousStyledTextUnset: aPreviousStyledText [ + "Is sent after a previous value of the styledText is de-assigned" + + >#onPreviousPropertyUnsetHookTemplate'> +] + +{ #category : #'private - event handling' } +GtTextualCoderViewModelPromised >> onSourceCodeChanged: anSourceCodeChangedAnnouncement [ + "source code changed, meaning that the styled text is no longer correct" + self unsetStyledText. + + addOnPromise := nil. + self ensureAddOns. + + self announce: (GtTextualCoderViewModelTextChanged new + text: self coderModel currentSourceText; + updateStrategy: anSourceCodeChangedAnnouncement updateStrategy) +] + +{ #category : #'api - text' } +GtTextualCoderViewModelPromised >> removeAllCoderTextAttributes: aCollectionOfGtTextualCoderTextAttributes [ + aCollectionOfGtTextualCoderTextAttributes do: [ :eachCoderTextAttribute | + self removeCoderTextAttributes: eachCoderTextAttribute ] +] + +{ #category : #'api - refactorings' } +GtTextualCoderViewModelPromised >> removeAttribute: anAttribute [ + | attributes | + attributes := self extraTextAttributes select: [ :each | each textAttributes includes: anAttribute ]. + self removeAllCoderTextAttributes: attributes +] + +{ #category : #'api - text' } +GtTextualCoderViewModelPromised >> removeCoderTextAttributes: aGtTextualCoderTextAttributes [ + | aCurrentText | + + self extraTextAttributes + remove: aGtTextualCoderTextAttributes + ifAbsent: [ ^ self ]. + + "we change the sourceText directly to not trigger the styler recomputation" + aCurrentText := self sourceText. + aCurrentText removeAttributes: { aGtTextualCoderTextAttributes markerAttribute }, aGtTextualCoderTextAttributes textAttributes. + + self announce: (GtTextualCoderViewModelTextAttributesRemoved new coderTextAttributes: aGtTextualCoderTextAttributes) +] + +{ #category : #'api - selection' } +GtTextualCoderViewModelPromised >> select: aFromCursorIndex to: aToCursorIndex [ + self selection: (self selection copy select: aFromCursorIndex to: aToCursorIndex) +] + +{ #category : #'api - selection' } +GtTextualCoderViewModelPromised >> selectNone [ + self selection: BlCompositeSelection new +] + +{ #category : #'api - selection' } +GtTextualCoderViewModelPromised >> selection [ + + + ^ selection +] + +{ #category : #'api - selection' } +GtTextualCoderViewModelPromised >> selection: aBlCompositeSelection [ + self + selection: aBlCompositeSelection + from: self +] + +{ #category : #'api - selection' } +GtTextualCoderViewModelPromised >> selection: aBlCompositeSelection from: aSourceObject [ + selection = aBlCompositeSelection + ifTrue: [ ^ self ]. + + selection := aBlCompositeSelection copy. + self notifySelectionChanged: selection from: aSourceObject +] + +{ #category : #'api - shortcuts' } +GtTextualCoderViewModelPromised >> shortcuts [ + "Return a collection of current editor shortcuts that are computed based on the coder add-ons and extra view-model add-ons. + Do not modify the returned collection as it will be recomputed when ast or add-ons change; instead use #addShortcut:" + + + ^ shortcuts +] + +{ #category : #'api - shortcuts' } +GtTextualCoderViewModelPromised >> shortcuts: aCollectionOfShortcuts [ + shortcuts = aCollectionOfShortcuts + ifTrue: [ ^ self ]. + + shortcuts := aCollectionOfShortcuts. + self announce: GtTextualCoderViewModelShortcutsChanged new +] + +{ #category : #'api - add-ons' } +GtTextualCoderViewModelPromised >> shouldAddOnsBeUpdated [ + "Return true if addons should be updated, false otherwise. When a Coder Model is attached to the corresponding Element + that element should check if addons need to be updated and if it is the case start the update with the help of ${method:GtCoderModel>>#updateAddOnsFrom:}$" + + + ^ addOnPromise + ifNil: [ true ] + ifNotNil: [ :theAddOns | theAddOns shouldBeUpdated ] +] + +{ #category : #'api - text' } +GtTextualCoderViewModelPromised >> sourceText [ + + + ^ self coderModel sourceText +] + +{ #category : #'api - text' } +GtTextualCoderViewModelPromised >> sourceText: aNewSourceText from: aSourceObject synchronously: isSynchronous [ + self coderModel + currentSourceText: aNewSourceText + with: (GtCoderUpdateStrategy new + source: aSourceObject; + isSynchronous: isSynchronous) +] + +{ #category : #'api - styled text' } +GtTextualCoderViewModelPromised >> styledText [ + + + >#propertyGetterTemplate'> + + ^ styledText +] + +{ #category : #'api - styled text' } +GtTextualCoderViewModelPromised >> styledText: aNewStyledText [ + + + >#propertySetterTemplate'> + + (self hasStyledText + and: [ self styledText = aNewStyledText ]) + ifTrue: [ ^ self ]. + + self hasStyledText + ifTrue: [ + | aPreviousStyledText | + aPreviousStyledText := styledText. + styledText := nil. + self onPreviousStyledTextUnset: aPreviousStyledText ]. + styledText := aNewStyledText. + self onNewStyledTextSet: aNewStyledText. + self notifyStyledTextChanged +] + +{ #category : #'api - stylers' } +GtTextualCoderViewModelPromised >> stylers [ + ^ stylers +] + +{ #category : #'api - stylers' } +GtTextualCoderViewModelPromised >> stylers: theStylers [ + stylers = theStylers + ifTrue: [ ^ self ]. + + stylers := theStylers. + theStylers do: [ :eachStyler | + (eachStyler respondsTo: #coderViewModel:) + ifTrue: [ eachStyler coderViewModel: self ] ]. + + "when stylers change we should reset the styled text, since there is no guarantee it will be a valid one" + self unsetStyledText. + self announce: GtTextualCoderViewModelStylersChanged new +] + +{ #category : #'api - coder model' } +GtTextualCoderViewModelPromised >> subscribeToCoderModel [ + super subscribeToCoderModel. + + self coderModel weak + when: GtCoderSourceCodeChanged + send: #onSourceCodeChanged: + to: self +] + +{ #category : #'api - styled text' } +GtTextualCoderViewModelPromised >> unsetStyledText [ + + >#propertyUnsetterTemplate'> + | aPreviousStyledText | + + self hasStyledText + ifFalse: [ ^ self ]. + + aPreviousStyledText := styledText. + styledText := nil. + self onPreviousStyledTextUnset: aPreviousStyledText. + self notifyStyledTextChanged +] + +{ #category : #'api - coder model' } +GtTextualCoderViewModelPromised >> unsubscribeFromCoderModel [ + super unsubscribeFromCoderModel. + + self coderModel unsubscribe: self +] diff --git a/src/GToolkit-Coder-Promised/package.st b/src/GToolkit-Coder-Promised/package.st new file mode 100644 index 000000000..8cef20419 --- /dev/null +++ b/src/GToolkit-Coder-Promised/package.st @@ -0,0 +1 @@ +Package { #name : #'GToolkit-Coder-Promised' } diff --git a/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorNameApplyPreviewId.class.st b/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorNameApplyPreviewId.class.st index dd3660795..e9f225c9e 100644 --- a/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorNameApplyPreviewId.class.st +++ b/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorNameApplyPreviewId.class.st @@ -4,12 +4,12 @@ A button that appears when behavior name is modified to open a popup with the re " Class { - #name : 'GtBehaviorCoderBehaviorNameApplyPreviewId', - #superclass : 'GtCoderElementId', + #name : #GtBehaviorCoderBehaviorNameApplyPreviewId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtBehaviorCoderBehaviorNameApplyPreviewId >> asSymbol [ ^ #'behavior-coder--behavior-name-apply-preview' ] diff --git a/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorNameId.class.st b/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorNameId.class.st index 6f8f12fa9..ada7779a4 100644 --- a/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorNameId.class.st +++ b/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorNameId.class.st @@ -4,12 +4,12 @@ An editable label with behavior's name " Class { - #name : 'GtBehaviorCoderBehaviorNameId', - #superclass : 'GtCoderElementId', + #name : #GtBehaviorCoderBehaviorNameId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtBehaviorCoderBehaviorNameId >> asSymbol [ ^ #'behavior-coder--behavior-name-editor' ] diff --git a/src/GToolkit-Coder-UI/GtBehaviorDefinitionCoderUIModel.class.st b/src/GToolkit-Coder-UI/GtBehaviorDefinitionCoderUIModel.class.st index 7a879ac8e..6a55a2a1a 100644 --- a/src/GToolkit-Coder-UI/GtBehaviorDefinitionCoderUIModel.class.st +++ b/src/GToolkit-Coder-UI/GtBehaviorDefinitionCoderUIModel.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtBehaviorDefinitionCoderUIModel', - #superclass : 'GtSingleCoderViewModel', + #name : #GtBehaviorDefinitionCoderUIModel, + #superclass : #GtSingleCoderViewModel, #category : 'GToolkit-Coder-UI-Coder - Behavior-Definition Model' } -{ #category : 'accessing' } +{ #category : #accessing } GtBehaviorDefinitionCoderUIModel >> elementClass [ ^ GtPharoBehaviorDefinitionCoderElement ] diff --git a/src/GToolkit-Coder-UI/GtCategoryToggleAptitude.class.st b/src/GToolkit-Coder-UI/GtCategoryToggleAptitude.class.st index 6a1191936..524b4fffe 100644 --- a/src/GToolkit-Coder-UI/GtCategoryToggleAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtCategoryToggleAptitude.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtCategoryToggleAptitude', - #superclass : 'GtCoderToggleAptitude', + #name : #GtCategoryToggleAptitude, + #superclass : #GtCoderToggleAptitude, #category : 'GToolkit-Coder-UI-Looks' } -{ #category : 'accessing' } +{ #category : #accessing } GtCategoryToggleAptitude >> initialize [ super initialize. self diff --git a/src/GToolkit-Coder-UI/GtClassBreadcrumbToggleAptitude.class.st b/src/GToolkit-Coder-UI/GtClassBreadcrumbToggleAptitude.class.st index 01a6c9cbf..3f4a5c6ba 100644 --- a/src/GToolkit-Coder-UI/GtClassBreadcrumbToggleAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtClassBreadcrumbToggleAptitude.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtClassBreadcrumbToggleAptitude', - #superclass : 'BrAptitude', + #name : #GtClassBreadcrumbToggleAptitude, + #superclass : #BrAptitude, #category : 'GToolkit-Coder-UI-Looks' } -{ #category : 'accessing' } +{ #category : #accessing } GtClassBreadcrumbToggleAptitude >> initialize [ super initialize. self diff --git a/src/GToolkit-Coder-UI/GtClassCardElement.class.st b/src/GToolkit-Coder-UI/GtClassCardElement.class.st index 725e0d9e5..1d3d587b0 100644 --- a/src/GToolkit-Coder-UI/GtClassCardElement.class.st +++ b/src/GToolkit-Coder-UI/GtClassCardElement.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtClassCardElement', - #superclass : 'GtCoderCardElement', + #name : #GtClassCardElement, + #superclass : #GtCoderCardElement, #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'building ui' } +{ #category : #'building ui' } GtClassCardElement >> detailsLabel [ | comment | comment := coder theClass organization comment. diff --git a/src/GToolkit-Coder-UI/GtClassCoderTool.class.st b/src/GToolkit-Coder-UI/GtClassCoderTool.class.st index c4485ccd8..42eea5265 100644 --- a/src/GToolkit-Coder-UI/GtClassCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtClassCoderTool.class.st @@ -1,39 +1,39 @@ Class { - #name : 'GtClassCoderTool', - #superclass : 'GtCoderTool', + #name : #GtClassCoderTool, + #superclass : #GtCoderTool, #instVars : [ 'observedClass' ], #category : 'GToolkit-Coder-UI-Tools' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtClassCoderTool class >> forClass: aClass [ ^ self new observedClass: aClass ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtClassCoderTool class >> observedClass: aClass [ ^ self new observedClass: aClass ] -{ #category : 'converting' } +{ #category : #converting } GtClassCoderTool >> newCoder [ ^ GtCoder forClass: self observedClass instanceSide ] -{ #category : 'accessing' } +{ #category : #accessing } GtClassCoderTool >> object [ "compatibility method for ${GLMBlocObjectToSelect}$" ^ self observedClass ] -{ #category : 'accessing' } +{ #category : #accessing } GtClassCoderTool >> observedClass [ ^ observedClass ] -{ #category : 'accessing' } +{ #category : #accessing } GtClassCoderTool >> observedClass: anObject [ observedClass := anObject ] diff --git a/src/GToolkit-Coder-UI/GtClassesCoderUIModel.class.st b/src/GToolkit-Coder-UI/GtClassesCoderUIModel.class.st index a9245d8fa..52af41890 100644 --- a/src/GToolkit-Coder-UI/GtClassesCoderUIModel.class.st +++ b/src/GToolkit-Coder-UI/GtClassesCoderUIModel.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtClassesCoderUIModel', - #superclass : 'GtMultipleCodersViewModel', + #name : #GtClassesCoderUIModel, + #superclass : #GtMultipleCodersViewModel, #category : 'GToolkit-Coder-UI-Coder - Classes Model' } -{ #category : 'accessing' } +{ #category : #accessing } GtClassesCoderUIModel >> elementClass [ ^ GtClassesElement ] diff --git a/src/GToolkit-Coder-UI/GtClassesElement.class.st b/src/GToolkit-Coder-UI/GtClassesElement.class.st index 8ef17c709..ddf1ba370 100644 --- a/src/GToolkit-Coder-UI/GtClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtClassesElement.class.st @@ -1,13 +1,13 @@ Class { - #name : 'GtClassesElement', - #superclass : 'BlElement', + #name : #GtClassesElement, + #superclass : #BlElement, #instVars : [ 'coder' ], #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'building ui' } +{ #category : #'building ui' } GtClassesElement >> buildContainer [ | aClassList | self removeChildren. @@ -21,19 +21,19 @@ GtClassesElement >> buildContainer [ self addChild: aClassList ] -{ #category : 'accessing' } +{ #category : #accessing } GtClassesElement >> coders: aCoder [ coder := aCoder. self buildContainer ] -{ #category : 'accessing' } +{ #category : #accessing } GtClassesElement >> codersUIModel: aCoder [ coder := aCoder coder. self buildContainer ] -{ #category : 'initialization' } +{ #category : #initialization } GtClassesElement >> initialize [ super initialize. self diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionCompositeEntityViewer.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionCompositeEntityViewer.class.st index b965b17e3..a69921235 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionCompositeEntityViewer.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionCompositeEntityViewer.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCodeDefinitionCompositeEntityViewer', - #superclass : 'GtCodeDefinitionViewer', + #name : #GtCodeDefinitionCompositeEntityViewer, + #superclass : #GtCodeDefinitionViewer, #instVars : [ 'editors', 'separatorStencil', @@ -9,12 +9,12 @@ Class { #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtCodeDefinitionCompositeEntityViewer class >> withAll: aCollectionOfEditors [ ^ self new editors: aCollectionOfEditors ] -{ #category : 'api - instantiation' } +{ #category : #'api - instantiation' } GtCodeDefinitionCompositeEntityViewer >> create [ @@ -45,18 +45,18 @@ GtCodeDefinitionCompositeEntityViewer >> create [ aStream nextPut: (self buildSectionLabel: (editors at: aCurrentIndex) title) ] ] ]) ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionCompositeEntityViewer >> editors [ ^ editors ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionCompositeEntityViewer >> editors: anObject [ editors := anObject. self title: editors first title ] -{ #category : 'initialization' } +{ #category : #initialization } GtCodeDefinitionCompositeEntityViewer >> initialize [ super initialize. @@ -64,17 +64,17 @@ GtCodeDefinitionCompositeEntityViewer >> initialize [ showSectionNames := true ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionCompositeEntityViewer >> separator: aStencil [ separatorStencil := aStencil asStencil ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionCompositeEntityViewer >> withSectionNames [ showSectionNames := true ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionCompositeEntityViewer >> withoutSectionNames [ showSectionNames := false ] diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionEntityViewer.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionEntityViewer.class.st index 5c3965006..7b7c83cdc 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionEntityViewer.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionEntityViewer.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCodeDefinitionEntityViewer', - #superclass : 'GtCodeDefinitionViewer', + #name : #GtCodeDefinitionEntityViewer, + #superclass : #GtCodeDefinitionViewer, #instVars : [ 'definition', 'owner', @@ -15,32 +15,32 @@ Class { #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' } -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionEntityViewer >> completion: aStencil [ completionStencil := aStencil asStencil ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionEntityViewer >> containerName [ ^ containerName ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionEntityViewer >> containerName: anObject [ containerName := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionEntityViewer >> definition [ ^ definition ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionEntityViewer >> definition: anObject [ definition := anObject ] -{ #category : 'initialization' } +{ #category : #initialization } GtCodeDefinitionEntityViewer >> initialize [ super initialize. @@ -59,34 +59,34 @@ GtCodeDefinitionEntityViewer >> initialize [ modelSelector := nil ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionEntityViewer >> modelSelector [ ^ modelSelector ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionEntityViewer >> modelSelector: anObject [ modelSelector := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionEntityViewer >> owner [ ^ owner ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionEntityViewer >> owner: anObject [ owner := anObject ] -{ #category : 'interactions' } +{ #category : #interactions } GtCodeDefinitionEntityViewer >> when: aBlEvent do: aBlock [ "aBlock is in form [ :anEvent :aCodeDefinition ]" eventHandlers add: (aBlEvent -> aBlock) ] -{ #category : 'interactions' } +{ #category : #interactions } GtCodeDefinitionEntityViewer >> whenClickDo: aBlock [ "I do not react to primary+click" "aBlock is in form [ :anEvent :aCodeDefinition ]" @@ -100,14 +100,14 @@ GtCodeDefinitionEntityViewer >> whenClickDo: aBlock [ aBlock cull: anEvent cull: aDefinition ] ] ] -{ #category : 'interactions' } +{ #category : #interactions } GtCodeDefinitionEntityViewer >> whenKey: aBlKeyCombination do: aBlock [ "aBlock is in form [ :anEvent :aCodeDefinition ]" interactions add: (aBlKeyCombination -> aBlock) ] -{ #category : 'interactions' } +{ #category : #interactions } GtCodeDefinitionEntityViewer >> whenPrimaryClickDo: aBlock [ "aBlock is in form [ :anEvent :aCodeDefinition ]" diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionNestedEntityViewer.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionNestedEntityViewer.class.st index 9ebb72bbd..0683cdf6d 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionNestedEntityViewer.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionNestedEntityViewer.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCodeDefinitionNestedEntityViewer', - #superclass : 'GtCodeDefinitionViewer', + #name : #GtCodeDefinitionNestedEntityViewer, + #superclass : #GtCodeDefinitionViewer, #instVars : [ 'editor', 'nestedEditors' @@ -8,7 +8,7 @@ Class { #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' } -{ #category : 'api - instantiation' } +{ #category : #'api - instantiation' } GtCodeDefinitionNestedEntityViewer >> create [ | aContainer theNestedEditors | @@ -44,23 +44,23 @@ GtCodeDefinitionNestedEntityViewer >> create [ ^ aContainer ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionNestedEntityViewer >> editor [ ^ editor ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionNestedEntityViewer >> editor: anObject [ editor := anObject. self title: editor title ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionNestedEntityViewer >> nestedEditors [ ^ nestedEditors ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionNestedEntityViewer >> nestedEditors: anObject [ nestedEditors := anObject ] diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st index b57a2f609..71c51a1ac 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCodeDefinitionPluralEditor', - #superclass : 'GtCodeDefinitionPluralViewer', + #name : #GtCodeDefinitionPluralEditor, + #superclass : #GtCodeDefinitionPluralViewer, #instVars : [ 'addSelector', 'renameSelector', @@ -9,17 +9,17 @@ Class { #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' } -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionPluralEditor >> addSelector [ ^ addSelector ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionPluralEditor >> addSelector: anObject [ addSelector := anObject ] -{ #category : 'api - instantiation' } +{ #category : #'api - instantiation' } GtCodeDefinitionPluralEditor >> create [ | aDefinition anOwner theInitialNames addAction removeAction renameAction aTagger | @@ -114,22 +114,22 @@ GtCodeDefinitionPluralEditor >> create [ ^ aTagger ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionPluralEditor >> removeSelector [ ^ removeSelector ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionPluralEditor >> removeSelector: anObject [ removeSelector := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionPluralEditor >> renameSelector [ ^ renameSelector ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionPluralEditor >> renameSelector: anObject [ renameSelector := anObject ] diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralReader.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionPluralReader.class.st index 68c3f82d9..d6db61be9 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralReader.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionPluralReader.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtCodeDefinitionPluralReader', - #superclass : 'GtCodeDefinitionPluralViewer', + #name : #GtCodeDefinitionPluralReader, + #superclass : #GtCodeDefinitionPluralViewer, #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' } -{ #category : 'api - instantiation' } +{ #category : #'api - instantiation' } GtCodeDefinitionPluralReader >> create [ | aDefinition anOwner theInitialNames aTagger | diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralViewer.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionPluralViewer.class.st index 0af717cce..51227cf9a 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralViewer.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionPluralViewer.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCodeDefinitionPluralViewer', - #superclass : 'GtCodeDefinitionEntityViewer', + #name : #GtCodeDefinitionPluralViewer, + #superclass : #GtCodeDefinitionEntityViewer, #instVars : [ 'separatorStencil', 'getSelector', @@ -11,29 +11,29 @@ Class { #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' } -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionPluralViewer >> addEvent: anObject [ addAnnouncement := anObject ] -{ #category : 'api - instantiation' } +{ #category : #'api - instantiation' } GtCodeDefinitionPluralViewer >> create [ ^ self subclassResponsibility ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionPluralViewer >> getSelector [ ^ getSelector ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionPluralViewer >> getSelector: anObject [ getSelector := anObject ] -{ #category : 'initialization' } +{ #category : #initialization } GtCodeDefinitionPluralViewer >> initialize [ super initialize. @@ -41,17 +41,17 @@ GtCodeDefinitionPluralViewer >> initialize [ separatorStencil := nil ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionPluralViewer >> removeEvent: anObject [ removeAnnouncement := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionPluralViewer >> renameEvent: anObject [ renameAnnouncement := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionPluralViewer >> separator: aStencil [ separatorStencil := aStencil asStencil ] diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionSectionLabelStencil.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionSectionLabelStencil.class.st index 6f39c1643..4e43408fe 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionSectionLabelStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionSectionLabelStencil.class.st @@ -1,13 +1,13 @@ Class { - #name : 'GtCodeDefinitionSectionLabelStencil', - #superclass : 'BrStencil', + #name : #GtCodeDefinitionSectionLabelStencil, + #superclass : #BrStencil, #instVars : [ 'name' ], #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' } -{ #category : 'api - instantiation' } +{ #category : #'api - instantiation' } GtCodeDefinitionSectionLabelStencil >> create [ @@ -18,12 +18,12 @@ GtCodeDefinitionSectionLabelStencil >> create [ constraintsDo: [ :c | c grid horizontal alignLeft ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionSectionLabelStencil >> name [ ^ name ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionSectionLabelStencil >> name: anObject [ name := anObject ] diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionSingleEditor.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionSingleEditor.class.st index ee32a337b..f12dc74db 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionSingleEditor.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionSingleEditor.class.st @@ -1,13 +1,13 @@ Class { - #name : 'GtCodeDefinitionSingleEditor', - #superclass : 'GtCodeDefinitionSingleViewer', + #name : #GtCodeDefinitionSingleEditor, + #superclass : #GtCodeDefinitionSingleViewer, #instVars : [ 'setSelector' ], #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' } -{ #category : 'private' } +{ #category : #private } GtCodeDefinitionSingleEditor >> addErrorOverlayTo: aTagElement [ | anOverlay anAnimation | @@ -27,7 +27,7 @@ GtCodeDefinitionSingleEditor >> addErrorOverlayTo: aTagElement [ ifTrue: [ aTagElement parent addChild: anOverlay ] ] -{ #category : 'api - instantiation' } +{ #category : #'api - instantiation' } GtCodeDefinitionSingleEditor >> create [ | aDefinition theInitialName anEditableLabel anOwner | @@ -80,7 +80,7 @@ GtCodeDefinitionSingleEditor >> create [ ^ anEditableLabel ] -{ #category : 'private' } +{ #category : #private } GtCodeDefinitionSingleEditor >> handleRenameError: anError to: aNewName from: aTagElement [ anError description traceCr. @@ -95,7 +95,7 @@ GtCodeDefinitionSingleEditor >> handleRenameError: anError to: aNewName from: aT self addErrorOverlayTo: aTagElement ] -{ #category : 'private' } +{ #category : #private } GtCodeDefinitionSingleEditor >> requestRename: aDefinition to: aNewName from: aTagElement [ setSelector ifNil: [ ^ self ]. @@ -113,12 +113,12 @@ GtCodeDefinitionSingleEditor >> requestRename: aDefinition to: aNewName from: aT from: aTagElement ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionSingleEditor >> setSelector [ ^ setSelector ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionSingleEditor >> setSelector: anObject [ setSelector := anObject ] diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionSingleReader.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionSingleReader.class.st index 0ce3d6dd5..48fee669d 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionSingleReader.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionSingleReader.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtCodeDefinitionSingleReader', - #superclass : 'GtCodeDefinitionSingleViewer', + #name : #GtCodeDefinitionSingleReader, + #superclass : #GtCodeDefinitionSingleViewer, #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' } -{ #category : 'api - instantiation' } +{ #category : #'api - instantiation' } GtCodeDefinitionSingleReader >> create [ | aDefinition theInitialName aLabel anOwner | diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionSingleViewer.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionSingleViewer.class.st index de7b44968..357eefc64 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionSingleViewer.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionSingleViewer.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCodeDefinitionSingleViewer', - #superclass : 'GtCodeDefinitionEntityViewer', + #name : #GtCodeDefinitionSingleViewer, + #superclass : #GtCodeDefinitionEntityViewer, #instVars : [ 'getSelector', 'renameAnnouncement' @@ -8,24 +8,24 @@ Class { #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' } -{ #category : 'api - instantiation' } +{ #category : #'api - instantiation' } GtCodeDefinitionSingleViewer >> create [ ^ self subclassResponsibility ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionSingleViewer >> getSelector [ ^ getSelector ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionSingleViewer >> getSelector: anObject [ getSelector := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionSingleViewer >> renameEvent: anObject [ renameAnnouncement := anObject ] diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionViewer.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionViewer.class.st index 43a9ffcbc..347d1b704 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionViewer.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionViewer.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCodeDefinitionViewer', - #superclass : 'BrStencil', + #name : #GtCodeDefinitionViewer, + #superclass : #BrStencil, #instVars : [ 'title', 'margin', @@ -9,12 +9,12 @@ Class { #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' } -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionViewer >> aptitude: aStencil [ lookStencil := aStencil asStencil ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCodeDefinitionViewer >> buildSectionLabel: aSectionName [ ^ BrLabel new @@ -25,7 +25,7 @@ GtCodeDefinitionViewer >> buildSectionLabel: aSectionName [ constraintsDo: [ :c | c grid horizontal alignLeft ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtCodeDefinitionViewer >> initialize [ super initialize. @@ -36,27 +36,27 @@ GtCodeDefinitionViewer >> initialize [ fontSize: 10 ] asStencil. ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionViewer >> margin [ ^ margin ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionViewer >> margin: anObject [ margin := anObject ] -{ #category : 'printing' } +{ #category : #printing } GtCodeDefinitionViewer >> printOn: aStream [ aStream print: self title ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionViewer >> title [ ^ title ] -{ #category : 'accessing' } +{ #category : #accessing } GtCodeDefinitionViewer >> title: anObject [ title := anObject ] diff --git a/src/GToolkit-Coder-UI/GtCoder.class.st b/src/GToolkit-Coder-UI/GtCoder.class.st index f9e04c0be..1aad20f56 100644 --- a/src/GToolkit-Coder-UI/GtCoder.class.st +++ b/src/GToolkit-Coder-UI/GtCoder.class.st @@ -12,8 +12,8 @@ I am the entrance point into the coder as a tool. To instantiate me, use one of " Class { - #name : 'GtCoder', - #superclass : 'GtCoderNavigationModelElement', + #name : #GtCoder, + #superclass : #GtCoderNavigationModelElement, #traits : 'TGtPagerPageInstantiator + TGtPhlowToolDetailAdjustable', #classTraits : 'TGtPagerPageInstantiator classTrait + TGtPhlowToolDetailAdjustable classTrait', #instVars : [ @@ -25,13 +25,13 @@ Class { #category : 'GToolkit-Coder-UI-! Core' } -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoder >> contentElement [ ^ contentElement ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoder >> initialize [ super initialize. self initializeTitleNotifier. @@ -50,12 +50,12 @@ GtCoder >> initialize [ self addAptitude: (BrLayoutResizerAptitude inherit). ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoder >> initializeContentElement [ contentElement := GtCoderPlaygroundElement new. ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoder >> initializeSidebarElement [ sidebarElement := GtPhlowHorizontalSidebarElement new beLeft. self addAptitude: (GtPhlowToolDetailAptitude new @@ -63,7 +63,7 @@ GtCoder >> initializeSidebarElement [ detailed: [ :theInstance | sidebarElement show ]). ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoder >> initializeTitleNotifier [ titleNotifier := GtPhlowTitleIconAndLabelNotifier new shortLabel: [ self shortTitle ifEmpty: [ 'Coder' asRopedText ] ]; @@ -71,7 +71,7 @@ GtCoder >> initializeTitleNotifier [ self addEventHandler: titleNotifier. ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoder >> initializeToolbarElement [ toolbarElement := GtCoderToolbarElement new constraintsDo: [ :c | @@ -80,7 +80,7 @@ GtCoder >> initializeToolbarElement [ c ignored vertical alignTop ]. ] -{ #category : 'private - hooks' } +{ #category : #'private - hooks' } GtCoder >> onNavigationModelChanged [ super onNavigationModelChanged. self contentElement navigationModel: self navigationModel. @@ -89,32 +89,32 @@ GtCoder >> onNavigationModelChanged [ self updateTabLabel ] -{ #category : 'private - announcement handling' } +{ #category : #'private - announcement handling' } GtCoder >> onNavigationModelSubjectChange [ self enqueueTask: (BlTaskAction new action: [ self updateTabLabel ]) ] -{ #category : 'opening' } +{ #category : #opening } GtCoder >> pagerWindowTitle [ ^ self shortTitle ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoder >> shortTitle [ ^ (GtPhlowTitleLabelBuilder longLabel: self subjectTitle) build ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoder >> sidebarElement [ ^ sidebarElement ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoder >> subjectTitle [ self navigationModel selectedClassDo: [ :aClass | ^ aClass name ]. @@ -123,7 +123,7 @@ GtCoder >> subjectTitle [ ^ nil ] -{ #category : 'private - subscriptions' } +{ #category : #'private - subscriptions' } GtCoder >> subscribeToNavigationModel [ super subscribeToNavigationModel. self navigationModel weak @@ -137,26 +137,26 @@ GtCoder >> subscribeToNavigationModel [ send: #onNavigationModelSubjectChange to: self ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoder >> titleNotifier [ ^ titleNotifier ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoder >> toolbarElement [ ^ toolbarElement ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtCoder >> updateSidebarContent [ self sidebarElement contentStencil: (GtCoderNavigationTabsStencil new navigationModel: self navigationModel) ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtCoder >> updateTabLabel [ self titleNotifier notifyIfFocused ] diff --git a/src/GToolkit-Coder-UI/GtCoder2.class.st b/src/GToolkit-Coder-UI/GtCoder2.class.st index 81eaa8b74..f26172e3a 100644 --- a/src/GToolkit-Coder-UI/GtCoder2.class.st +++ b/src/GToolkit-Coder-UI/GtCoder2.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoder2', - #superclass : 'BlElement', + #name : #GtCoder2, + #superclass : #BlElement, #traits : 'TGtPagerPageInstantiator + TGtPhlowToolDetailAdjustable + TGtWithCoderToolViewModel + TBrLayoutResizable', #classTraits : 'TGtPagerPageInstantiator classTrait + TGtPhlowToolDetailAdjustable classTrait + TGtWithCoderToolViewModel classTrait + TBrLayoutResizable classTrait', #instVars : [ @@ -12,7 +12,7 @@ Class { #category : 'GToolkit-Coder-UI-! Core' } -{ #category : 'initialization' } +{ #category : #initialization } GtCoder2 >> createCoderContainer [ "A container that contains an actual current coder element. The content of the container is replaced every time a coder is pushed or popped" @@ -21,7 +21,7 @@ GtCoder2 >> createCoderContainer [ matchParent ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoder2 >> createGoBackButton [ ^ BrButton new aptitude: BrGlamorousButtonWithLabelAptitude; @@ -29,19 +29,19 @@ GtCoder2 >> createGoBackButton [ action: [ self coderToolViewModel popCoderViewModel ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoder2 >> createNavigationBreadcrumb [ ^ BrHorizontalPane new hMatchParent; vFitContent ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoder2 >> createNavigationSidebar [ ^ GtPhlowHorizontalSidebarElement new beLeft ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoder2 >> initialize [ super initialize. @@ -80,12 +80,12 @@ GtCoder2 >> initialize [ ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoder2 >> navigationStencil: aStencil [ navigationSidebar contentStencil: aStencil ] -{ #category : 'api - coder tool view model' } +{ #category : #'api - coder tool view model' } GtCoder2 >> onCoderToolViewModelChanged [ "Is sent when a new coderTool view model is assigned to the element. Note: #onCoderToolViewModelChanged is sent before #subscribeToCoderToolViewModel @@ -97,25 +97,25 @@ GtCoder2 >> onCoderToolViewModelChanged [ self rebuildTopCoderElement ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtCoder2 >> onViewModelCoderPopped: anAnnouncement [ self updateGoBackButton. self rebuildTopCoderElement. ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtCoder2 >> onViewModelCoderPushed: anAnnouncement [ self updateGoBackButton. self rebuildTopCoderElement ] -{ #category : 'opening' } +{ #category : #opening } GtCoder2 >> pagerWindowTitle [ ^ self shortTitle ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtCoder2 >> rebuildTopCoderElement [ coderContainer removeChildren. @@ -123,7 +123,7 @@ GtCoder2 >> rebuildTopCoderElement [ ifTrue: [ coderContainer addChild: self coderToolViewModel currentCoderViewModel asElement ] ] -{ #category : 'api - coder tool view model' } +{ #category : #'api - coder tool view model' } GtCoder2 >> subscribeToCoderToolViewModel [ "Is sent after a new coderTool view model is assigned to the element. It is required to unsubscribe from the view model or domain model by implementing @@ -134,7 +134,7 @@ GtCoder2 >> subscribeToCoderToolViewModel [ when: GtCoderToolViewModelCoderPopped send: #onViewModelCoderPopped: to: self ] -{ #category : 'api - coder tool view model' } +{ #category : #'api - coder tool view model' } GtCoder2 >> unsubscribeFromCoderToolViewModel [ "Is sent before a new coderTool view model is assigned to the element. Elements that subscribe to coderTool view model in domain model are required to implement this methods." @@ -142,7 +142,7 @@ GtCoder2 >> unsubscribeFromCoderToolViewModel [ self coderToolViewModel unsubscribe: self ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtCoder2 >> updateGoBackButton [ goBackButton enabled: self coderToolViewModel canGoBack ] diff --git a/src/GToolkit-Coder-UI/GtCoderAction.extension.st b/src/GToolkit-Coder-UI/GtCoderAction.extension.st index e5e276824..b19504a76 100644 --- a/src/GToolkit-Coder-UI/GtCoderAction.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderAction.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'GtCoderAction' } +Extension { #name : #GtCoderAction } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtCoderAction >> buildElementIn: aCoderActionsElement [ ^ aCoderActionsElement newButtonForAction: self ] diff --git a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st index 156bca59f..2d464fe2e 100644 --- a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderActionsElement', - #superclass : 'BlElement', + #name : #GtCoderActionsElement, + #superclass : #BlElement, #traits : 'TGtWithTextualCoderViewModel', #classTraits : 'TGtWithTextualCoderViewModel classTrait', #instVars : [ @@ -12,7 +12,7 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'private' } +{ #category : #private } GtCoderActionsElement >> addContextToolbarActions [ contextToolbar addItems: (self textualCoderViewModel contextActions collect: [ :aGtCoderAction | self newButtonForAction: aGtCoderAction ]). separator @@ -22,7 +22,7 @@ GtCoderActionsElement >> addContextToolbarActions [ ifFalse: [ BlVisibility gone ]) ] -{ #category : 'private' } +{ #category : #private } GtCoderActionsElement >> addMainToolbarActions [ mainToolbar addItems: @@ -32,17 +32,17 @@ GtCoderActionsElement >> addMainToolbarActions [ aGtCoderAction buildElementIn: self ]) ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderActionsElement >> coderUIModel [ ^ self textualCoderViewModel ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderActionsElement >> coderUIModel: aCoderUIModel [ self textualCoderViewModel: aCoderUIModel ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtCoderActionsElement >> disableButton: aButtonElement action: aGtCoderAction [ aButtonElement icon: @@ -52,7 +52,7 @@ GtCoderActionsElement >> disableButton: aButtonElement action: aGtCoderAction [ disable ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtCoderActionsElement >> enqueueEnableButton: aButtonElement action: aGtCoderAction [ ^ aButtonElement enqueueTask: @@ -63,7 +63,7 @@ GtCoderActionsElement >> enqueueEnableButton: aButtonElement action: aGtCoderAct enable ]) ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtCoderActionsElement >> handleButton: aButtonElement action: aGtCoderAction onEvent: anEvent [ self disableButton: aButtonElement action: aGtCoderAction. GtCoderExecutionContextVariable @@ -78,7 +78,7 @@ GtCoderActionsElement >> handleButton: aButtonElement action: aGtCoderAction onE ensure: [ self enqueueEnableButton: aButtonElement action: aGtCoderAction ] ]) ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderActionsElement >> initialize [ super initialize. @@ -102,7 +102,7 @@ GtCoderActionsElement >> initialize [ self addChildren: { mainToolbar . separator . contextToolbar } ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtCoderActionsElement >> newButtonForAction: aGtCoderAction [ ^ BrButton new @@ -118,7 +118,7 @@ GtCoderActionsElement >> newButtonForAction: aGtCoderAction [ onEvent: anEvent ] ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtCoderActionsElement >> newDropButtonForAction: aGtCoderAction [ | button aContentStencil | @@ -178,7 +178,7 @@ GtCoderActionsElement >> newDropButtonForAction: aGtCoderAction [ yourself ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtCoderActionsElement >> newToolbar [ @@ -187,7 +187,7 @@ GtCoderActionsElement >> newToolbar [ padding: (BlInsets left: -4) ] -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } GtCoderActionsElement >> onPostTextualCoderViewModelChanged [ "I am an optional hook method that is sent after #subscribeToTextualCoderViewModel. I do nothing by default but allow users to perform update operations when a receiver object is already @@ -196,7 +196,7 @@ GtCoderActionsElement >> onPostTextualCoderViewModelChanged [ self textualCoderViewModel ensureAddOns ] -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } GtCoderActionsElement >> onTextualCoderViewModelChanged [ "Is sent when a new textualCoder view model is assigned to the element. Note: #onTextualCoderViewModelChanged is sent before #subscribeToTextualCoderViewModel @@ -210,17 +210,17 @@ GtCoderActionsElement >> onTextualCoderViewModelChanged [ self addContextToolbarActions ] -{ #category : 'private' } +{ #category : #private } GtCoderActionsElement >> removeContextToolbarActions [ contextToolbar numberOfItems timesRepeat: [ contextToolbar removeItemAt: 1 ] ] -{ #category : 'private' } +{ #category : #private } GtCoderActionsElement >> removeMainToolbarActions [ mainToolbar numberOfItems timesRepeat: [ mainToolbar removeItemAt: 1 ] ] -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } GtCoderActionsElement >> subscribeToTextualCoderViewModel [ "Is sent after a new textualCoder view model is assigned to the element. It is required to unsubscribe from the view model or domain model by implementing @@ -231,7 +231,7 @@ GtCoderActionsElement >> subscribeToTextualCoderViewModel [ when: GtTextualCoderViewModelContextActionsChanged send: #updateContextToolbar to: self ] -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } GtCoderActionsElement >> unsubscribeFromTextualCoderViewModel [ "Is sent before a new textualCoder view model is assigned to the element. Elements that subscribe to textualCoder view model in domain model are required to implement this methods." @@ -239,7 +239,7 @@ GtCoderActionsElement >> unsubscribeFromTextualCoderViewModel [ self textualCoderViewModel unsubscribe: self ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtCoderActionsElement >> updateContextToolbar [ self enqueueTask: (BlTaskAction new @@ -248,7 +248,7 @@ GtCoderActionsElement >> updateContextToolbar [ self addContextToolbarActions ]) ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtCoderActionsElement >> updateMainToolbar [ self enqueueTask: (BlTaskAction new action: [ diff --git a/src/GToolkit-Coder-UI/GtCoderActivatableAction.extension.st b/src/GToolkit-Coder-UI/GtCoderActivatableAction.extension.st index 25467fbae..7393539ad 100644 --- a/src/GToolkit-Coder-UI/GtCoderActivatableAction.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderActivatableAction.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'GtCoderActivatableAction' } +Extension { #name : #GtCoderActivatableAction } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtCoderActivatableAction >> buildElementIn: aCoderActionsElement [ | aButton | diff --git a/src/GToolkit-Coder-UI/GtCoderCardElement.class.st b/src/GToolkit-Coder-UI/GtCoderCardElement.class.st index 2ec945777..0bba78c46 100644 --- a/src/GToolkit-Coder-UI/GtCoderCardElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderCardElement.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderCardElement', - #superclass : 'BlElement', + #name : #GtCoderCardElement, + #superclass : #BlElement, #instVars : [ 'coder', 'coderNameLabel', @@ -9,12 +9,12 @@ Class { #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderCardElement >> coder [ ^ coder ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderCardElement >> coder: anObject [ coder := anObject. coderNameLabel text: (self coderNameTextFrom: coder coderName). @@ -26,7 +26,7 @@ GtCoderCardElement >> coder: anObject [ text: (self coderDetailsTextFrom: aDetailsString) ] ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderCardElement >> coderDetailsTextFrom: aString [ "Convert a coder's details to a styled text" @@ -35,7 +35,7 @@ GtCoderCardElement >> coderDetailsTextFrom: aString [ foreground: self theme button defaultTextColor ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderCardElement >> coderNameTextFrom: aString [ "Convert a coder's name to a styled text" @@ -43,12 +43,12 @@ GtCoderCardElement >> coderNameTextFrom: aString [ ^ aString asRopedText glamorousCodeFont bold ] -{ #category : 'building ui' } +{ #category : #'building ui' } GtCoderCardElement >> detailsLabel [ ^ '' ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderCardElement >> initialize [ super initialize. self aptitude: (BrGlamorousButtonExteriorAptitude new borderPaint: Color transparent). @@ -81,7 +81,7 @@ GtCoderCardElement >> initialize [ self addChildren: { coderNameLabel . coderDetailsLabel } ] -{ #category : 'private' } +{ #category : #private } GtCoderCardElement >> selectCoder [ | anEvent | diff --git a/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st b/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st index 1dea8df19..1cf8deea1 100644 --- a/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st +++ b/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st @@ -6,8 +6,8 @@ If a code is selected, I execute the selection. If there is no selection, I exec " Class { - #name : 'GtCoderCodeExecutor', - #superclass : 'Object', + #name : #GtCoderCodeExecutor, + #superclass : #Object, #instVars : [ 'coderUIModel', 'action', @@ -16,65 +16,65 @@ Class { #category : 'GToolkit-Coder-UI-Execution' } -{ #category : 'api - instance creation' } +{ #category : #'api - instance creation' } GtCoderCodeExecutor class >> doIt [ "Execute a code (and do not display the execution result)" ^ self new doIt ] -{ #category : 'api - instance creation' } +{ #category : #'api - instance creation' } GtCoderCodeExecutor class >> doItAndGo [ "Execute a code and display the execution result" ^ self new doItAndGo ] -{ #category : 'api - instance creation' } +{ #category : #'api - instance creation' } GtCoderCodeExecutor class >> playAll [ "Execute a method code (and do not display the execution result)" ^ self new playAll ] -{ #category : 'api - instance creation' } +{ #category : #'api - instance creation' } GtCoderCodeExecutor class >> playAllAndInspect [ "Execute a method code and display the execution result" ^ self new playAllAndInspect ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoderCodeExecutor >> coder [ ^ self coderUIModel coder ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderCodeExecutor >> coderUIModel [ ^ coderUIModel ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderCodeExecutor >> coderUIModel: anObject [ coderUIModel := anObject ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderCodeExecutor >> doIt [ "Execute a code (and do not display the execution result)" action := #doIt ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderCodeExecutor >> doItAndGo [ "Execute a code and display the execution result" action := #doItAndGo ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderCodeExecutor >> element [ ^ element ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderCodeExecutor >> element: anElement [ self assert: [ anElement isKindOf: BlElement ] @@ -83,41 +83,41 @@ GtCoderCodeExecutor >> element: anElement [ element := anElement ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderCodeExecutor >> event [ self flag: 'I should not keep events, but rather #element'. self halt. ^ nil ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderCodeExecutor >> event: anObject [ self halt. self flag: 'I should not receive events, but rather #element:'. ] -{ #category : 'api - execution' } +{ #category : #'api - execution' } GtCoderCodeExecutor >> execute [ GtCoderExecutionContextVariable element: self element do: [ self coderUIModel perform: action ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderCodeExecutor >> initialize [ super initialize. self doItAndGo. ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderCodeExecutor >> playAll [ "Execute a method code (and do not display the execution result)" action := #playAll ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderCodeExecutor >> playAllAndInspect [ "Execute a method code and display the execution result" diff --git a/src/GToolkit-Coder-UI/GtCoderContentElement.class.st b/src/GToolkit-Coder-UI/GtCoderContentElement.class.st index 80597961f..f9d7f2114 100644 --- a/src/GToolkit-Coder-UI/GtCoderContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderContentElement.class.st @@ -7,18 +7,18 @@ I display a {{gtClass:GtPharoBehaviorCoder}}, {{gtClass:GtPharoPackageTagCoder}} " Class { - #name : 'GtCoderContentElement', - #superclass : 'GtCoderNavigationModelElement', + #name : #GtCoderContentElement, + #superclass : #GtCoderNavigationModelElement, #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'factory' } +{ #category : #factory } GtCoderContentElement class >> default [ ^ self new navigationModel: GtCoderNavigationModel default ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderContentElement >> initialize [ super initialize. self layout: BlFrameLayout new. @@ -26,26 +26,26 @@ GtCoderContentElement >> initialize [ self addAptitude: (BrLayoutResizerAptitude inherit). ] -{ #category : 'hooks - children' } +{ #category : #'hooks - children' } GtCoderContentElement >> onAddedToSceneGraph [ super onAddedToSceneGraph. self navigationModel subscribeToSystem. ] -{ #category : 'hooks - children' } +{ #category : #'hooks - children' } GtCoderContentElement >> onRemovedFromSceneGraph [ super onRemovedFromSceneGraph. self navigationModel unsubscribeFromSystem. ] -{ #category : 'private - subscriptions' } +{ #category : #'private - subscriptions' } GtCoderContentElement >> subscribeToNavigationModel [ super subscribeToNavigationModel. self navigationModel weak when: GtCoderNavigationSelectionAnnouncement send: #updateCoder: to: self. ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtCoderContentElement >> updateCoder: anAnnouncement [ self removeChildren. self addChild: anAnnouncement coder asElement. diff --git a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st index 59bf18a8f..39bbc311f 100644 --- a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st +++ b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st @@ -1,29 +1,29 @@ Class { - #name : 'GtCoderContextMenuContent', - #superclass : 'BrSimpleList', + #name : #GtCoderContextMenuContent, + #superclass : #BrSimpleList, #instVars : [ 'editorElement' ], #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'defaults' } +{ #category : #defaults } GtCoderContextMenuContent >> defaultContextMenuActionName [ ^ #contextMenuAction ] -{ #category : 'defaults' } +{ #category : #defaults } GtCoderContextMenuContent >> defaultLabelChildName [ ^ #label ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderContextMenuContent >> editorElement [ ^ editorElement ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderContextMenuContent >> editorElement: anEditorElement [ self assert: [ anEditorElement isNotNil ] @@ -31,7 +31,7 @@ GtCoderContextMenuContent >> editorElement: anEditorElement [ editorElement := anEditorElement ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderContextMenuContent >> initialize [ super initialize. self diff --git a/src/GToolkit-Coder-UI/GtCoderDropDownAction.extension.st b/src/GToolkit-Coder-UI/GtCoderDropDownAction.extension.st index 4e40b4785..bf916cea4 100644 --- a/src/GToolkit-Coder-UI/GtCoderDropDownAction.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderDropDownAction.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'GtCoderDropDownAction' } +Extension { #name : #GtCoderDropDownAction } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtCoderDropDownAction >> buildElementIn: aCoderActionsElement [ ^ aCoderActionsElement newDropButtonForAction: self ] diff --git a/src/GToolkit-Coder-UI/GtCoderDropDownWithPreviewAction.extension.st b/src/GToolkit-Coder-UI/GtCoderDropDownWithPreviewAction.extension.st index 564533f98..c2697730e 100644 --- a/src/GToolkit-Coder-UI/GtCoderDropDownWithPreviewAction.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderDropDownWithPreviewAction.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'GtCoderDropDownWithPreviewAction' } +Extension { #name : #GtCoderDropDownWithPreviewAction } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtCoderDropDownWithPreviewAction >> buildElementIn: aCoderActionsElement [ ^ GtPreviewChangeButton new icon: self icon; diff --git a/src/GToolkit-Coder-UI/GtCoderElement.class.st b/src/GToolkit-Coder-UI/GtCoderElement.class.st index 31437e42f..7f138c307 100644 --- a/src/GToolkit-Coder-UI/GtCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderElement.class.st @@ -7,14 +7,14 @@ See my {{gtClass:GtCoderElement|expanded|show=#gtSubclassesFor:}} for concrete i " Class { - #name : 'GtCoderElement', - #superclass : 'BlElement', + #name : #GtCoderElement, + #superclass : #BlElement, #traits : 'TBrLayoutResizable', #classTraits : 'TBrLayoutResizable classTrait', #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'initialization' } +{ #category : #initialization } GtCoderElement >> initialize [ super initialize. diff --git a/src/GToolkit-Coder-UI/GtCoderElementId.class.st b/src/GToolkit-Coder-UI/GtCoderElementId.class.st index 283895420..1f4cc6504 100644 --- a/src/GToolkit-Coder-UI/GtCoderElementId.class.st +++ b/src/GToolkit-Coder-UI/GtCoderElementId.class.st @@ -3,12 +3,12 @@ " Class { - #name : 'GtCoderElementId', - #superclass : 'BlElementUniqueId', + #name : #GtCoderElementId, + #superclass : #BlElementUniqueId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'testing' } +{ #category : #testing } GtCoderElementId class >> isAbstract [ ^ self = GtCoderElementId ] diff --git a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st index 575f7ddf2..06e1ea410 100644 --- a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st @@ -17,8 +17,8 @@ I am an icon that represents an {{gtClass:GtExampleWithResult}} result state. " Class { - #name : 'GtCoderExampleStateElement', - #superclass : 'BlElement', + #name : #GtCoderExampleStateElement, + #superclass : #BlElement, #traits : 'TBrLayoutResizable + TBrEnableable', #classTraits : 'TBrLayoutResizable classTrait + TBrEnableable classTrait', #instVars : [ @@ -28,26 +28,26 @@ Class { #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'private - asserting' } +{ #category : #'private - asserting' } GtCoderExampleStateElement >> assertExample: aGtExampleWithResult [ self assert: [ aGtExampleWithResult isNotNil ] description: [ 'Example must be non-nil' ]. ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtCoderExampleStateElement >> debugExampleFrom: aButton [ self exampleDo: [ :anExample | anExample openingDebugger result ] ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderExampleStateElement >> example [ ^ example ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderExampleStateElement >> example: aGtExampleWithResult [ self assertExample: aGtExampleWithResult. self unsubscribeFromExample. @@ -56,23 +56,23 @@ GtCoderExampleStateElement >> example: aGtExampleWithResult [ self onExampleChanged. ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoderExampleStateElement >> exampleDo: aBlock [ self example ifNotNil: aBlock ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoderExampleStateElement >> exampleResult [ ^ self example ifNotNil: #result ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoderExampleStateElement >> exampleState [ ^ GtFilterExampleState default stateFromExample: self example ] -{ #category : 'private - testing' } +{ #category : #'private - testing' } GtCoderExampleStateElement >> hasExampleResult [ ^ self example @@ -80,7 +80,7 @@ GtCoderExampleStateElement >> hasExampleResult [ ifNil: [ false ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderExampleStateElement >> initialize [ super initialize. self initializeViewModels. @@ -96,20 +96,20 @@ GtCoderExampleStateElement >> initialize [ self addAptitude: BrLayoutResizerAptitude inherit. ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderExampleStateElement >> initializeInteractiveLook [ self addAptitude: (styleLook := BrStyleCommonAptitude new). self updateStyleLook. ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderExampleStateElement >> initializeTooltipLook [ self addAptitude: (BrGlamorousWithTooltipAptitude2 content: [ self newTooltipContent ]) ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderExampleStateElement >> initializeViewModels [ | aButtonModel | @@ -118,14 +118,14 @@ GtCoderExampleStateElement >> initializeViewModels [ self viewModel: aButtonModel. ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderExampleStateElement >> newInspectorWithExampleResult [ ^ ((GtInspector forObject: self tooltipObject) exact: 400@400) asScalableElement size: 200@200. ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderExampleStateElement >> newNotExecutedLabel [ ^ BrLabel new aptitude: BrGlamorousLabelAptitude; @@ -133,7 +133,7 @@ GtCoderExampleStateElement >> newNotExecutedLabel [ padding: (BlInsets all: 5) ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderExampleStateElement >> newNotExecutedToolbar [ ^ BrToolbar new aptitude: BrGlamorousToolbarAptitude new; @@ -157,7 +157,7 @@ GtCoderExampleStateElement >> newNotExecutedToolbar [ beSmallSize) ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderExampleStateElement >> newNotExecutedTooltipContent [ ^ BrVerticalPane new fitContent; @@ -171,7 +171,7 @@ GtCoderExampleStateElement >> newNotExecutedTooltipContent [ margin: (BlInsets top: 3)). ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderExampleStateElement >> newTooltipContent [ | aContainer | aContainer := BrFrame new @@ -185,7 +185,7 @@ GtCoderExampleStateElement >> newTooltipContent [ ^ aContainer ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtCoderExampleStateElement >> onClick: aButton [ self exampleDo: [ :anExample | anExample hasResult ifFalse: [ ^ self ]. @@ -193,12 +193,12 @@ GtCoderExampleStateElement >> onClick: aButton [ self debugExampleFrom: aButton ] ] -{ #category : 'private - hooks' } +{ #category : #'private - hooks' } GtCoderExampleStateElement >> onExampleChanged [ self updateIcon. ] -{ #category : 'private - announcement handling' } +{ #category : #'private - announcement handling' } GtCoderExampleStateElement >> onExampleExecuted: aGtExampleExecuted [ BlUseAsyncFeatures ifEnabledDo: [ @@ -207,32 +207,32 @@ GtCoderExampleStateElement >> onExampleExecuted: aGtExampleExecuted [ otherwise: [ self updateIcon ] ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtCoderExampleStateElement >> playAndInspectExampleFrom: aButton [ self playExampleFrom: aButton. self spawnExampleFrom: aButton. ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtCoderExampleStateElement >> playExampleFrom: aButton [ self exampleDo: [ :anExample | anExample run ] ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtCoderExampleStateElement >> spawnExampleFrom: anElement [ self exampleDo: [ :anExample | anExample hasResult ifTrue: [ anElement phlow spawnObject: anExample result returnValueOrExampleException ] ] ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoderExampleStateElement >> styleLook [ ^ styleLook ] -{ #category : 'private - subscriptions' } +{ #category : #'private - subscriptions' } GtCoderExampleStateElement >> subscribeToExample [ self example announcer when: GtExampleExecuted @@ -240,25 +240,25 @@ GtCoderExampleStateElement >> subscribeToExample [ to: self. ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoderExampleStateElement >> tooltipObject [ self exampleResult ifNotNil: [ :aResult | ^ aResult returnValueOrExampleException ]. ^ self example ] -{ #category : 'private - subscriptions' } +{ #category : #'private - subscriptions' } GtCoderExampleStateElement >> unsubscribeFromExample [ self example ifNil: [ ^ self ]. self example announcer unsubscribe: self. ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtCoderExampleStateElement >> updateIcon [ self background: self exampleState color. self updateStyleLook. ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtCoderExampleStateElement >> updateStyleLook [ "the following nil check can be removed anytime later. diff --git a/src/GToolkit-Coder-UI/GtCoderExecutionContextVariable.class.st b/src/GToolkit-Coder-UI/GtCoderExecutionContextVariable.class.st index a841c5170..29211d4b4 100644 --- a/src/GToolkit-Coder-UI/GtCoderExecutionContextVariable.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExecutionContextVariable.class.st @@ -13,12 +13,12 @@ To obtain the execution context, use {{gtMethod:GtCoderExecutionContextVariable " Class { - #name : 'GtCoderExecutionContextVariable', - #superclass : 'DynamicVariable', + #name : #GtCoderExecutionContextVariable, + #superclass : #DynamicVariable, #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'api - execution' } +{ #category : #'api - execution' } GtCoderExecutionContextVariable class >> element: anElement do: aBlock [ "Initialize a Space ID using the element and evaluate the block" | aSpaceId | @@ -28,19 +28,19 @@ GtCoderExecutionContextVariable class >> element: anElement do: aBlock [ during: aBlock ] -{ #category : 'testing' } +{ #category : #testing } GtCoderExecutionContextVariable class >> isInheritable [ ^true ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderExecutionContextVariable class >> newSpaceIdFromElement: anElement [ anElement spaceDo: [ :aSpace | ^ aSpace id ]. ^ nil ] -{ #category : 'api - execution' } +{ #category : #'api - execution' } GtCoderExecutionContextVariable class >> spaceDo: aSpaceBlock ifClosed: aClosedBlock [ self value ifNotNil: [ :aSpaceId | BlSpace diff --git a/src/GToolkit-Coder-UI/GtCoderExpanderAptitude.class.st b/src/GToolkit-Coder-UI/GtCoderExpanderAptitude.class.st index c530ac07e..67fc932ff 100644 --- a/src/GToolkit-Coder-UI/GtCoderExpanderAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExpanderAptitude.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtCoderExpanderAptitude', - #superclass : 'GtCoderExpanderWithoutShadowAptitude', + #name : #GtCoderExpanderAptitude, + #superclass : #GtCoderExpanderWithoutShadowAptitude, #category : 'GToolkit-Coder-UI-Looks' } -{ #category : 'initialization' } +{ #category : #initialization } GtCoderExpanderAptitude >> initialize [ super initialize. diff --git a/src/GToolkit-Coder-UI/GtCoderExpanderShadowAptitude.class.st b/src/GToolkit-Coder-UI/GtCoderExpanderShadowAptitude.class.st index 836f9b332..b963c9028 100644 --- a/src/GToolkit-Coder-UI/GtCoderExpanderShadowAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExpanderShadowAptitude.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtCoderExpanderShadowAptitude', - #superclass : 'BrStyleCommonAptitude', + #name : #GtCoderExpanderShadowAptitude, + #superclass : #BrStyleCommonAptitude, #category : 'GToolkit-Coder-UI-Looks' } -{ #category : 'initialization' } +{ #category : #initialization } GtCoderExpanderShadowAptitude >> initialize [ super initialize. diff --git a/src/GToolkit-Coder-UI/GtCoderExpanderWithoutShadowAptitude.class.st b/src/GToolkit-Coder-UI/GtCoderExpanderWithoutShadowAptitude.class.st index 8ff90c1ee..de1e714c2 100644 --- a/src/GToolkit-Coder-UI/GtCoderExpanderWithoutShadowAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExpanderWithoutShadowAptitude.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderExpanderWithoutShadowAptitude', - #superclass : 'BrExpanderAptitude', + #name : #GtCoderExpanderWithoutShadowAptitude, + #superclass : #BrExpanderAptitude, #instVars : [ 'sidebar', 'toggle', @@ -16,70 +16,70 @@ Class { #category : 'GToolkit-Coder-UI-Looks' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExpanderWithoutShadowAptitude >> borderFocusedPaint [ ^ borderFocusedPaint ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExpanderWithoutShadowAptitude >> borderFocusedPaint: aPaintOrColor [ borderFocusedPaint := aPaintOrColor ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExpanderWithoutShadowAptitude >> borderPaint [ ^ borderPaint ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExpanderWithoutShadowAptitude >> borderPaint: aPaintOrColor [ borderPaint := aPaintOrColor ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExpanderWithoutShadowAptitude >> borderWidth [ ^ borderWidth ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExpanderWithoutShadowAptitude >> borderWidth: anInteger [ borderWidth := anInteger ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExpanderWithoutShadowAptitude >> cornerRadius [ ^ cornerRadius ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExpanderWithoutShadowAptitude >> cornerRadius: aNumber [ cornerRadius := aNumber ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderExpanderWithoutShadowAptitude >> defaultBorderPaint [ ^ self theme default lightBorderColor ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderExpanderWithoutShadowAptitude >> defaultFocusedBorderPaint [ ^ (self theme default primaryBorderColor alpha: 0.4) gtOpaqueColorOnWhite ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExpanderWithoutShadowAptitude >> expandedBorderWidth [ ^ expandedBorderWidth ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExpanderWithoutShadowAptitude >> expandedBorderWidth: aNumber [ expandedBorderWidth := aNumber ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderExpanderWithoutShadowAptitude >> initialize [ | aTriangle | super initialize. @@ -131,7 +131,7 @@ GtCoderExpanderWithoutShadowAptitude >> initialize [ with: [ BlRoundedRectangleGeometry cornerRadius: self cornerRadius ] ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderExpanderWithoutShadowAptitude >> newCollapsedTriangleGeometry [ ^ BlPolygon vertices: { (0 @ 0). @@ -140,7 +140,7 @@ GtCoderExpanderWithoutShadowAptitude >> newCollapsedTriangleGeometry [ } ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderExpanderWithoutShadowAptitude >> newExpandedTriangleGeometry [ ^ BlPolygon vertices: { (0 @ 0). @@ -149,7 +149,7 @@ GtCoderExpanderWithoutShadowAptitude >> newExpandedTriangleGeometry [ } ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderExpanderWithoutShadowAptitude >> newSidebar [ ^ BlElement new layout: BlLinearLayout vertical; @@ -159,7 +159,7 @@ GtCoderExpanderWithoutShadowAptitude >> newSidebar [ background: Color veryVeryLightGray ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderExpanderWithoutShadowAptitude >> newToggle [ ^ BlElement new id: GtSourceCoderExpanderToggleId; @@ -175,7 +175,7 @@ GtCoderExpanderWithoutShadowAptitude >> newToggle [ self dispatchEvent: BrExpansionToggleWish new ] ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderExpanderWithoutShadowAptitude >> newTriangle [ ^ BlElement new size: 8 @ 8; @@ -183,18 +183,18 @@ GtCoderExpanderWithoutShadowAptitude >> newTriangle [ constraintsDo: [ :c | c linear vertical alignTop ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExpanderWithoutShadowAptitude >> padding [ ^ padding ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExpanderWithoutShadowAptitude >> padding: aBlInsets [ padding := aBlInsets. container padding: aBlInsets ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderExpanderWithoutShadowAptitude >> resizableElementsDo: aBlock [ super resizableElementsDo: aBlock. aBlock value: container diff --git a/src/GToolkit-Coder-UI/GtCoderFilterList.class.st b/src/GToolkit-Coder-UI/GtCoderFilterList.class.st index ddc436431..7b05a43f3 100644 --- a/src/GToolkit-Coder-UI/GtCoderFilterList.class.st +++ b/src/GToolkit-Coder-UI/GtCoderFilterList.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtCoderFilterList', - #superclass : 'BrSimpleList', + #name : #GtCoderFilterList, + #superclass : #BrSimpleList, #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'initialization' } +{ #category : #initialization } GtCoderFilterList >> initialize [ super initialize. self @@ -22,7 +22,7 @@ GtCoderFilterList >> initialize [ self vFitContent. ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderFilterList >> items: anItemCollection title: aTitleBlock action: anActionBlock [ | anActionCollection | anActionCollection := anItemCollection collect: [ :eachItem | @@ -33,7 +33,7 @@ GtCoderFilterList >> items: anItemCollection title: aTitleBlock action: anAction self items: anActionCollection. ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtCoderFilterList >> onSelectionChanged: anEvent [ self selectedItemDo: [ :anItem | anEvent consumed: true. diff --git a/src/GToolkit-Coder-UI/GtCoderFilterListItem.class.st b/src/GToolkit-Coder-UI/GtCoderFilterListItem.class.st index a4604bb0a..bbe58da5e 100644 --- a/src/GToolkit-Coder-UI/GtCoderFilterListItem.class.st +++ b/src/GToolkit-Coder-UI/GtCoderFilterListItem.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderFilterListItem', - #superclass : 'BrHorizontalPane', + #name : #GtCoderFilterListItem, + #superclass : #BrHorizontalPane, #instVars : [ 'item', 'title', @@ -9,37 +9,37 @@ Class { #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtCoderFilterListItem >> actOnEvent: anEvent [ self action cull: self item cull: self cull: anEvent ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderFilterListItem >> action [ ^ action ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderFilterListItem >> action: anObject [ action := anObject ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderFilterListItem >> item [ ^ item ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderFilterListItem >> item: anObject [ item := anObject ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderFilterListItem >> title [ ^ title cull: self item cull: self ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderFilterListItem >> title: anObject [ title := anObject ] diff --git a/src/GToolkit-Coder-UI/GtCoderFilterListItemElement.class.st b/src/GToolkit-Coder-UI/GtCoderFilterListItemElement.class.st index e12ea4098..d8895d846 100644 --- a/src/GToolkit-Coder-UI/GtCoderFilterListItemElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderFilterListItemElement.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderFilterListItemElement', - #superclass : 'BrHorizontalPane', + #name : #GtCoderFilterListItemElement, + #superclass : #BrHorizontalPane, #instVars : [ 'item', 'labelElement' @@ -8,7 +8,7 @@ Class { #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'initialization' } +{ #category : #initialization } GtCoderFilterListItemElement >> initialize [ super initialize. @@ -18,25 +18,25 @@ GtCoderFilterListItemElement >> initialize [ self vFitContent. ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderFilterListItemElement >> item [ ^ item ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderFilterListItemElement >> item: anObject [ item == anObject ifTrue: [ ^ self ]. item := anObject. self onItemChanged. ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderFilterListItemElement >> newLabelElement [ ^ BrLabel new aptitude: BrGlamorousLabelAptitude ] -{ #category : 'private - hooks' } +{ #category : #'private - hooks' } GtCoderFilterListItemElement >> onItemChanged [ labelElement text: self item title ] diff --git a/src/GToolkit-Coder-UI/GtCoderModel.extension.st b/src/GToolkit-Coder-UI/GtCoderModel.extension.st index 03a9f8397..e11830871 100644 --- a/src/GToolkit-Coder-UI/GtCoderModel.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderModel.extension.st @@ -1,21 +1,21 @@ -Extension { #name : 'GtCoderModel' } +Extension { #name : #GtCoderModel } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtCoderModel >> asCoderUIModel [ ^ self subclassResponsibility ] -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtCoderModel >> asCoderViewModel [ ^ self asCoderUIModel ] -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtCoderModel >> asElement [ ^ self asCoderUIModel asElement ] -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtCoderModel >> asExpandedOnlyElement [ "Create an element for just the expanded coder without expander" @@ -24,24 +24,24 @@ GtCoderModel >> asExpandedOnlyElement [ yourself ] -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtCoderModel >> coderLook [ ^ (self attributeNamed: #coderLook ifAbsent: [ nil ]) value ] -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtCoderModel >> coderLook: aLookOrBlock [ self attributeNamed: #coderLook put: aLookOrBlock ] -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtCoderModel >> defaultCoderLook [ ^ nil ] -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtCoderModel >> elementClass [ ^ GtExpandableSourceCoderElement ] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassHierachyElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassHierachyElement.class.st index 52fe25b64..834d11849 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassHierachyElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassHierachyElement.class.st @@ -1,16 +1,16 @@ Class { - #name : 'GtCoderNavigationClassHierachyElement', - #superclass : 'GtCoderNavigationElement', + #name : #GtCoderNavigationClassHierachyElement, + #superclass : #GtCoderNavigationElement, #category : 'GToolkit-Coder-UI-Navigation' } -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationClassHierachyElement >> initializeElement [ super initializeElement. self addChild: classesList ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationClassHierachyElement >> initializeLayout [ super initializeLayout. self layout: BlLinearLayout vertical. @@ -19,7 +19,7 @@ GtCoderNavigationClassHierachyElement >> initializeLayout [ c vertical matchParent ]. ] -{ #category : 'subscriptions' } +{ #category : #subscriptions } GtCoderNavigationClassHierachyElement >> onClassModified: anAnnouncement [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -29,7 +29,7 @@ GtCoderNavigationClassHierachyElement >> onClassModified: anAnnouncement [ tag: anAnnouncement tag ] ] -{ #category : 'subscriptions' } +{ #category : #subscriptions } GtCoderNavigationClassHierachyElement >> onClassRenamed: anAnnouncement [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -41,7 +41,7 @@ GtCoderNavigationClassHierachyElement >> onClassRenamed: anAnnouncement [ tag: anAnnouncement tag ] ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationClassHierachyElement >> onClassSelected: anAnnouncement [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -49,7 +49,7 @@ GtCoderNavigationClassHierachyElement >> onClassSelected: anAnnouncement [ self selectClass: anAnnouncement theClass ]. ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationClassHierachyElement >> onPackageSelected: anAnnouncer [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -57,7 +57,7 @@ GtCoderNavigationClassHierachyElement >> onPackageSelected: anAnnouncer [ self deselectClasses. ] ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationClassHierachyElement >> onPackageTagSelected: anAnnouncer [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -65,7 +65,7 @@ GtCoderNavigationClassHierachyElement >> onPackageTagSelected: anAnnouncer [ self deselectClasses. ]. ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationClassHierachyElement >> onPackagesSelected: anAnnouncer [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -73,13 +73,13 @@ GtCoderNavigationClassHierachyElement >> onPackagesSelected: anAnnouncer [ self deselectClasses. ] ] -{ #category : 'subscriptions' } +{ #category : #subscriptions } GtCoderNavigationClassHierachyElement >> subscribeToContent [ super subscribeToContent. self subscribeToClassList. ] -{ #category : 'subscriptions' } +{ #category : #subscriptions } GtCoderNavigationClassHierachyElement >> subscribeToNavigationModel [ self hasNavigationModel ifFalse: [ ^ self ]. super subscribeToNavigationModel. @@ -88,7 +88,7 @@ GtCoderNavigationClassHierachyElement >> subscribeToNavigationModel [ navigationModel when: GtCoderNavigationPackageTagSelected send: #onPackageTagSelected: to: self. ] -{ #category : 'updating lists' } +{ #category : #'updating lists' } GtCoderNavigationClassHierachyElement >> updateClassLists [ self hasNavigationModel ifFalse: [ ^ self ]. navigationModel hasSelectedClass @@ -96,12 +96,12 @@ GtCoderNavigationClassHierachyElement >> updateClassLists [ ifFalse: [ self emptyClassList ]. ] -{ #category : 'updating lists' } +{ #category : #'updating lists' } GtCoderNavigationClassHierachyElement >> updateClassListsWith: aClass [ classesList initializeWithHierachyForClass: aClass. ] -{ #category : 'updating lists' } +{ #category : #'updating lists' } GtCoderNavigationClassHierachyElement >> updateContent [ self updateClassLists. self updateSelectedClass diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st index 8e7cdfbb6..192f6d552 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st @@ -4,20 +4,20 @@ I show a list of classes grouping them based on the inheritance hierarchy and so " Class { - #name : 'GtCoderNavigationClassesHierarchyTreeElement', - #superclass : 'BrSimpleTree', + #name : #GtCoderNavigationClassesHierarchyTreeElement, + #superclass : #BrSimpleTree, #instVars : [ 'classesTree' ], #category : 'GToolkit-Coder-UI-Navigation' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtCoderNavigationClassesHierarchyTreeElement class >> fromClasses: aCollectionOfClasses [ ^ self new initializeWithClasses: aCollectionOfClasses ] -{ #category : 'private - ui' } +{ #category : #'private - ui' } GtCoderNavigationClassesHierarchyTreeElement >> expandClass: aClass [ | aClassDepth | aClassDepth := 0. @@ -26,7 +26,7 @@ GtCoderNavigationClassesHierarchyTreeElement >> expandClass: aClass [ self expandUpTo: aClassDepth + 1 ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationClassesHierarchyTreeElement >> initialize [ super initialize. @@ -51,7 +51,7 @@ GtCoderNavigationClassesHierarchyTreeElement >> initialize [ aText ]) ] ] -{ #category : 'api - initialization' } +{ #category : #'api - initialization' } GtCoderNavigationClassesHierarchyTreeElement >> initializeWithClasses: aCollectionOfClasses [ classesTree := (GtCoderClassesHierarchyTree fromClasses: aCollectionOfClasses) sortByClassName. @@ -61,7 +61,7 @@ GtCoderNavigationClassesHierarchyTreeElement >> initializeWithClasses: aCollecti self expandAll ] -{ #category : 'api - initialization' } +{ #category : #'api - initialization' } GtCoderNavigationClassesHierarchyTreeElement >> initializeWithHierachyForClass: aClass [ classesTree := (GtCoderGrowingClassesHierarchyTree hierarchyForClass: aClass) sortByClassName. @@ -71,14 +71,14 @@ GtCoderNavigationClassesHierarchyTreeElement >> initializeWithHierachyForClass: self expandAll ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtCoderNavigationClassesHierarchyTreeElement >> selectedClass [ self selectedNodeDo: [ :aNode | ^ aNode value rootClass ]. ^ nil ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtCoderNavigationClassesHierarchyTreeElement >> selectedIndice [ "Return selected indice or zero" diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassesListElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassesListElement.class.st index d388d9197..eaee18d05 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassesListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassesListElement.class.st @@ -4,19 +4,19 @@ I show a simple list of classes sorting alphabetically " Class { - #name : 'GtCoderNavigationClassesListElement', - #superclass : 'BrSimpleList', + #name : #GtCoderNavigationClassesListElement, + #superclass : #BrSimpleList, #traits : 'TGtCoderNavigationClassesHelper', #classTraits : 'TGtCoderNavigationClassesHelper classTrait', #category : 'GToolkit-Coder-UI-Navigation' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtCoderNavigationClassesListElement class >> fromClasses: aCollectionOfClasses [ ^ self new initializeWithClasses: aCollectionOfClasses ] -{ #category : 'private - ui' } +{ #category : #'private - ui' } GtCoderNavigationClassesListElement >> buildClassLabel: aClass [ | aLook aText | aLook := (BrGlamorousLabelAptitude new fontSize: 12). @@ -36,7 +36,7 @@ GtCoderNavigationClassesListElement >> buildClassLabel: aClass [ text: aText. ] -{ #category : 'private - ui' } +{ #category : #'private - ui' } GtCoderNavigationClassesListElement >> buildClassRow: aClass index: aRowIndex list: aListElement [ ^ BrWidgetContainer new layout: BlLinearLayout horizontal; @@ -66,14 +66,14 @@ GtCoderNavigationClassesListElement >> buildClassRow: aClass index: aRowIndex li addChild: (self buildClassLabel: aClass) ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationClassesListElement >> initialize [ super initialize. self stencil: [ :eachClass :eachIndex :aListElement | self buildClassRow: eachClass index: eachIndex list: aListElement ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationClassesListElement >> initializeWithClasses: aCollectionOfClasses [ self items: (aCollectionOfClasses sorted: [ :classA :classB | classA name < classB name ]) ] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st index b7feadf37..5a01cbe6d 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderNavigationElement', - #superclass : 'BlElement', + #name : #GtCoderNavigationElement, + #superclass : #BlElement, #instVars : [ 'navigationModel', 'supressNavigationChanges', @@ -10,30 +10,30 @@ Class { #category : 'GToolkit-Coder-UI-Navigation' } -{ #category : 'asserting' } +{ #category : #asserting } GtCoderNavigationElement >> assertNavigationModel: aGtCoderNavigationPackagesTagsClassesModel [ self assert: [ aGtCoderNavigationPackagesTagsClassesModel isNotNil ] description: [ 'Navigation model must be non-nil' ]. ] -{ #category : 'api - class selections' } +{ #category : #'api - class selections' } GtCoderNavigationElement >> deselectClasses [ classesList deselectAll ] -{ #category : 'updating lists' } +{ #category : #'updating lists' } GtCoderNavigationElement >> emptyClassList [ classesList initializeWithClasses: #(). ] -{ #category : 'testing' } +{ #category : #testing } GtCoderNavigationElement >> hasNavigationModel [ ^ self navigationModel isNotNil and: [ self navigationModel isNavigationModel ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationElement >> initialize [ super initialize. supressListChanges := false. @@ -43,29 +43,29 @@ GtCoderNavigationElement >> initialize [ self initializeElement. ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationElement >> initializeContent [ classesList := GtCoderNavigationClassesHierarchyTreeElement new. ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationElement >> initializeElement [ "subclasses may initialize element" ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationElement >> initializeLayout [ "subclasses may define its layout" ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationElement >> navigationModel [ ^ navigationModel ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationElement >> navigationModel: aGtCoderNavigationPackagesTagsClassesModel [ self assertNavigationModel: aGtCoderNavigationPackagesTagsClassesModel. self unsubscribeFromNavigationModel. @@ -73,7 +73,7 @@ GtCoderNavigationElement >> navigationModel: aGtCoderNavigationPackagesTagsClass self onNavigationModelChanged. ] -{ #category : 'hooks - children' } +{ #category : #'hooks - children' } GtCoderNavigationElement >> onAddedToSceneGraph [ super onAddedToSceneGraph. self updateContent. @@ -81,7 +81,7 @@ GtCoderNavigationElement >> onAddedToSceneGraph [ self subscribeToContent. ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationElement >> onClassListSelectionChanged [ | anIndex aSelectedItem theIndices | supressListChanges ifTrue: [ ^ self ]. @@ -94,7 +94,7 @@ GtCoderNavigationElement >> onClassListSelectionChanged [ self navigationModel selectClass: aSelectedItem ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationElement >> onClassModified: anAnnouncement [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -104,7 +104,7 @@ GtCoderNavigationElement >> onClassModified: anAnnouncement [ tag: anAnnouncement tag ] ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationElement >> onClassRenamed: anAnnouncement [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -116,7 +116,7 @@ GtCoderNavigationElement >> onClassRenamed: anAnnouncement [ tag: anAnnouncement tag ] ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationElement >> onClassSelected: anAnnouncement [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -126,7 +126,7 @@ GtCoderNavigationElement >> onClassSelected: anAnnouncement [ tag: anAnnouncement tag ]. ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationElement >> onNavigationModelChanged [ "subclasses may perform actions on navigation model changes" self isAttachedToSceneGraph ifFalse: [ ^ self ]. @@ -134,14 +134,14 @@ GtCoderNavigationElement >> onNavigationModelChanged [ self updateContent. ] -{ #category : 'hooks - children' } +{ #category : #'hooks - children' } GtCoderNavigationElement >> onRemovedFromSceneGraph [ super onRemovedFromSceneGraph. self unsuscribeFromContent. self unsubscribeFromNavigationModel. ] -{ #category : 'api - class updates' } +{ #category : #'api - class updates' } GtCoderNavigationElement >> renameClass: aClass oldName: anOldName newName: aNewName inPackage: aPackage tag: aTag [ classesList viewModel @@ -152,14 +152,14 @@ GtCoderNavigationElement >> renameClass: aClass oldName: anOldName newName: aNew self updateSelectedClass ]. ] -{ #category : 'private - selection' } +{ #category : #'private - selection' } GtCoderNavigationElement >> scrollIndexFrom: aNodeIndex [ "TODO: does not work if an index is at a bottom: aNodeIndex - 5 max: 1" ^ aNodeIndex ] -{ #category : 'private - selection' } +{ #category : #'private - selection' } GtCoderNavigationElement >> scrollIndexFromPrevious: aPreviousIndex current: aNewIndex max: aNumberOfItems [ ^ (aPreviousIndex isZero or: [ aPreviousIndex >= aNewIndex ]) @@ -167,7 +167,7 @@ GtCoderNavigationElement >> scrollIndexFromPrevious: aPreviousIndex current: aNe ifFalse: [ aNewIndex + 5 min: aNumberOfItems ]. ] -{ #category : 'api - class selections' } +{ #category : #'api - class selections' } GtCoderNavigationElement >> selectClass: aClass [ | aPreviousIndex | aPreviousIndex := classesList selectedIndice. @@ -183,18 +183,18 @@ GtCoderNavigationElement >> selectClass: aClass [ max: classesList viewModel itemCount) ] ] -{ #category : 'subscriptions' } +{ #category : #subscriptions } GtCoderNavigationElement >> subscribeToClassList [ classesList when: BrSelectionChanged do: [ :anEvent | self onClassListSelectionChanged ]. ] -{ #category : 'subscriptions' } +{ #category : #subscriptions } GtCoderNavigationElement >> subscribeToContent [ ] -{ #category : 'subscriptions' } +{ #category : #subscriptions } GtCoderNavigationElement >> subscribeToNavigationModel [ self hasNavigationModel ifFalse: [ ^ self ]. navigationModel when: GtCoderNavigationClassSelected send: #onClassSelected: to: self. @@ -202,7 +202,7 @@ GtCoderNavigationElement >> subscribeToNavigationModel [ navigationModel when: GtCoderNavigationClassModified send: #onClassModified: to: self. ] -{ #category : 'subscriptions' } +{ #category : #subscriptions } GtCoderNavigationElement >> suppressListChangeEventsDuring: aBlock [ | anOldValue | anOldValue := supressListChanges. @@ -210,7 +210,7 @@ GtCoderNavigationElement >> suppressListChangeEventsDuring: aBlock [ aBlock ensure: [ supressListChanges := anOldValue ]. ] -{ #category : 'subscriptions' } +{ #category : #subscriptions } GtCoderNavigationElement >> suppressNavigationChangeEventsDuring: aBlock [ | anOldValue | anOldValue := supressNavigationChanges. @@ -218,17 +218,17 @@ GtCoderNavigationElement >> suppressNavigationChangeEventsDuring: aBlock [ aBlock ensure: [ supressNavigationChanges := anOldValue ]. ] -{ #category : 'subscriptions' } +{ #category : #subscriptions } GtCoderNavigationElement >> unsubscribeFromNavigationModel [ self hasNavigationModel ifFalse: [ ^ self ]. navigationModel ifNotNil: [ :aModel | aModel unsubscribe: self ]. ] -{ #category : 'subscriptions' } +{ #category : #subscriptions } GtCoderNavigationElement >> unsuscribeFromContent [ ] -{ #category : 'api - class updates' } +{ #category : #'api - class updates' } GtCoderNavigationElement >> updateClass: aClass inPackage: aPackage tag: aTag [ classesList viewModel @@ -239,16 +239,16 @@ GtCoderNavigationElement >> updateClass: aClass inPackage: aPackage tag: aTag [ self updateSelectedClass ]. ] -{ #category : 'updating lists' } +{ #category : #'updating lists' } GtCoderNavigationElement >> updateClassLists [ "Update class list" ] -{ #category : 'updating' } +{ #category : #updating } GtCoderNavigationElement >> updateContent [ ] -{ #category : 'updating lists' } +{ #category : #'updating lists' } GtCoderNavigationElement >> updateSelectedClass [ self hasNavigationModel ifFalse: [ ^ self ]. navigationModel selectedClassDo: [ :aClass | diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationMethodProtocolListElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationMethodProtocolListElement.class.st index 98ff43b07..dba2554a6 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationMethodProtocolListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationMethodProtocolListElement.class.st @@ -1,15 +1,15 @@ Class { - #name : 'GtCoderNavigationMethodProtocolListElement', - #superclass : 'BrSimpleList', + #name : #GtCoderNavigationMethodProtocolListElement, + #superclass : #BrSimpleList, #category : 'GToolkit-Coder-UI-Navigation' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtCoderNavigationMethodProtocolListElement class >> fromClass: aClass [ ^ self new initializeWithClass: aClass ] -{ #category : 'private - ui' } +{ #category : #'private - ui' } GtCoderNavigationMethodProtocolListElement >> buildProtocolLabel: aProtocol [ ^ BrLabel new aptitude: BrGlamorousLabelAptitude; @@ -17,7 +17,7 @@ GtCoderNavigationMethodProtocolListElement >> buildProtocolLabel: aProtocol [ text: aProtocol name ] -{ #category : 'private - ui' } +{ #category : #'private - ui' } GtCoderNavigationMethodProtocolListElement >> buildProtocolRow: aProtocol index: aRowIndex list: aListElement [ ^ BrWidgetContainer new layout: BlLinearLayout horizontal; @@ -47,19 +47,19 @@ GtCoderNavigationMethodProtocolListElement >> buildProtocolRow: aProtocol index: addChild: (self buildProtocolLabel: aProtocol) ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationMethodProtocolListElement >> initialize [ super initialize. self stencil: [ :eachProtocol :eachIndex :aListElement | self buildProtocolRow: eachProtocol index: eachIndex list: aListElement ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationMethodProtocolListElement >> initializeWithClass: aClass [ self initializeWithProtocols: aClass organization allProtocols ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationMethodProtocolListElement >> initializeWithProtocols: aCollection [ self items: (aCollection sorted: [ :protocolA :protocolB | protocolA name < protocolB name ]) ] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationModelElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationModelElement.class.st index f9d4eea17..1b61e7643 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationModelElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationModelElement.class.st @@ -6,15 +6,15 @@ See my {{gtClass:GtCoderNavigationModelElement|expanded|show=#gtSubclassesFor:}} " Class { - #name : 'GtCoderNavigationModelElement', - #superclass : 'GtCoderElement', + #name : #GtCoderNavigationModelElement, + #superclass : #GtCoderElement, #instVars : [ 'navigationModel' ], #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'private - asserting' } +{ #category : #'private - asserting' } GtCoderNavigationModelElement >> assertNavigationModel: aGtCoderNavigationModel [ self assert: [ aGtCoderNavigationModel isNotNil ] @@ -25,12 +25,12 @@ GtCoderNavigationModelElement >> assertNavigationModel: aGtCoderNavigationModel ] -{ #category : 'defaults' } +{ #category : #defaults } GtCoderNavigationModelElement >> defaultNavigationModel [ ^ GtCoderNavigationModel null ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationModelElement >> initialize [ super initialize. navigationModel := self defaultNavigationModel. @@ -38,7 +38,7 @@ GtCoderNavigationModelElement >> initialize [ ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationModelElement >> initializeListeners [ self when: GtCoderToReplace @@ -53,13 +53,13 @@ GtCoderNavigationModelElement >> initializeListeners [ do: [ :anEvent | self spawnInSpaceFrom: anEvent ]. ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderNavigationModelElement >> navigationModel [ ^ navigationModel ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderNavigationModelElement >> navigationModel: aGtCoderNavigationModel [ navigationModel = aGtCoderNavigationModel ifTrue: [ ^ self ]. self assertNavigationModel: aGtCoderNavigationModel. @@ -69,42 +69,42 @@ GtCoderNavigationModelElement >> navigationModel: aGtCoderNavigationModel [ self onNavigationModelChanged. ] -{ #category : 'private - hooks' } +{ #category : #'private - hooks' } GtCoderNavigationModelElement >> onNavigationModelChanged [ "Subclasses can react to navigation model changes." ] -{ #category : 'api - updating' } +{ #category : #'api - updating' } GtCoderNavigationModelElement >> pushCoder: aCoderOrCoders [ self assertNavigationModel: self navigationModel. self navigationModel selectCoder: aCoderOrCoders ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtCoderNavigationModelElement >> replaceFrom: aGtCoderToReplaceEvent [ aGtCoderToReplaceEvent consumed: true. self pushCoder: aGtCoderToReplaceEvent coder ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtCoderNavigationModelElement >> spawnFrom: aGtCoderToSpawnEvent [ aGtCoderToSpawnEvent consumed: true. self phlow spawnTool: (GtReadyCoderTool coder: (aGtCoderToSpawnEvent coder)) ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtCoderNavigationModelElement >> spawnInSpaceFrom: aGtCoderToSpawnInSpaceEvent [ aGtCoderToSpawnInSpaceEvent consumed: true. ] -{ #category : 'private - subscriptions' } +{ #category : #'private - subscriptions' } GtCoderNavigationModelElement >> subscribeToNavigationModel [ "Subclasses can subscribe to the navigation model" ] -{ #category : 'private - subscriptions' } +{ #category : #'private - subscriptions' } GtCoderNavigationModelElement >> unsubscribeFromNavigationModel [ self navigationModel = GtCoderNavigationModel null ifTrue: [ ^ self ]. self navigationModel unsubscribe: self. diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 99c49a852..3450e70f3 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderNavigationPackagesTagsClassesElement', - #superclass : 'GtCoderNavigationElement', + #name : #GtCoderNavigationPackagesTagsClassesElement, + #superclass : #GtCoderNavigationElement, #instVars : [ 'packagesList', 'classesLabel', @@ -12,7 +12,7 @@ Class { #category : 'GToolkit-Coder-UI-Navigation' } -{ #category : 'api - package updates' } +{ #category : #'api - package updates' } GtCoderNavigationPackagesTagsClassesElement >> addPackage: aPackage [ | aSelectedPackageOrTag | @@ -24,7 +24,7 @@ GtCoderNavigationPackagesTagsClassesElement >> addPackage: aPackage [ self selectPackageOrTag: aSelectedPackageOrTag ]. ] -{ #category : 'api - package updates' } +{ #category : #'api - package updates' } GtCoderNavigationPackagesTagsClassesElement >> addPackage: aPackage tag: aPackageTag [ | aSelectedPackageOrTag | @@ -36,17 +36,17 @@ GtCoderNavigationPackagesTagsClassesElement >> addPackage: aPackage tag: aPackag self selectPackageOrTag: aSelectedPackageOrTag ]. ] -{ #category : 'api - package selections' } +{ #category : #'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> deselectPackages [ packagesList deselectAll ] -{ #category : 'updating lists' } +{ #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> emptyMethodProtocolList [ methodProtocolsList initializeWithProtocols: #(). ] -{ #category : 'api - package selections' } +{ #category : #'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> expandPackage: aRPackage [ packagesList viewModel root allChildrenNodesBreadthFirstDo: [ :eachTreeNode | @@ -54,7 +54,7 @@ GtCoderNavigationPackagesTagsClassesElement >> expandPackage: aRPackage [ ifTrue: [ eachTreeNode expand ] ] ] -{ #category : 'private - testing' } +{ #category : #'private - testing' } GtCoderNavigationPackagesTagsClassesElement >> hasPackageTagsIn: aRPackage [ | noTags noExtensions | @@ -63,21 +63,21 @@ GtCoderNavigationPackagesTagsClassesElement >> hasPackageTagsIn: aRPackage [ ^ noTags not or: [ noExtensions not ] ] -{ #category : 'showing / hiding' } +{ #category : #'showing / hiding' } GtCoderNavigationPackagesTagsClassesElement >> hideClassList [ classAndMethodProtocolList visibility: BlVisibility gone. classesLabel visibility: BlVisibility gone. self layout columnCount: 1. ] -{ #category : 'showing / hiding' } +{ #category : #'showing / hiding' } GtCoderNavigationPackagesTagsClassesElement >> hideOrShowClassList [ classesList maxSelectionIndex isZero ifTrue: [ self hideClassList ] ifFalse: [ self showClassList ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> initializeContent [ super initializeContent. packagesList := GtCoderNavigationPackagesTreeElement new. @@ -94,7 +94,7 @@ GtCoderNavigationPackagesTagsClassesElement >> initializeContent [ addChild: methodProtocolsList. ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> initializeElement [ super initializeElement. self addChildren: { @@ -111,7 +111,7 @@ GtCoderNavigationPackagesTagsClassesElement >> initializeElement [ } ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> initializeLayout [ super initializeLayout. self layout: (BlGridLayout horizontal columnCount: 2; cellSpacing: 5). @@ -120,7 +120,7 @@ GtCoderNavigationPackagesTagsClassesElement >> initializeLayout [ c vertical matchParent ]. ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onMethodsCoderFiltersChanged: aGtCodersFiltersChanged [ aGtCodersFiltersChanged source = self ifTrue: [ ^ self ]. @@ -145,7 +145,7 @@ GtCoderNavigationPackagesTagsClassesElement >> onMethodsCoderFiltersChanged: aGt methodProtocolsList deselectAll ]. ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageListSelectionChanged [ | anIndex aSelectedItem theIndices | supressListChanges ifTrue: [ ^ self ]. @@ -160,14 +160,14 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackageListSelectionChanged [ ifFalse: [ self navigationModel selectTag: aSelectedItem ] ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageRegistered: anAnnouncement [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ self addPackage: anAnnouncement package ] ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageRenamed: anAnnouncement [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -177,7 +177,7 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackageRenamed: anAnnouncement newName: anAnnouncement newName ] ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageSelected: anAnnouncer [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -185,21 +185,21 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackageSelected: anAnnouncer [ self deselectClasses. ] ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageTagAdded: anAnnouncement [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ self addPackage: anAnnouncement package tag: anAnnouncement tag ] ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageTagRemoved: anAnnouncement [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ self removePackage: anAnnouncement package tag: anAnnouncement tag ] ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageTagSelected: anAnnouncer [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -209,14 +209,14 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackageTagSelected: anAnnouncer self deselectClasses. ]. ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageUnregistered: anAnnouncement [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ self removePackage: anAnnouncement package ] ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackagesSelected: anAnnouncer [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ @@ -224,7 +224,7 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackagesSelected: anAnnouncer [ self deselectClasses. ] ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onProtocolListSelectionChanged [ | anIndex aSelectedItem theIndices | supressListChanges ifTrue: [ ^ self ]. @@ -237,7 +237,7 @@ GtCoderNavigationPackagesTagsClassesElement >> onProtocolListSelectionChanged [ self navigationModel selectMethodProtocol: aSelectedItem source: self. ] -{ #category : 'api - package updates' } +{ #category : #'api - package updates' } GtCoderNavigationPackagesTagsClassesElement >> removePackage: aPackage [ | aSelectedPackageOrTag anIndex | @@ -251,7 +251,7 @@ GtCoderNavigationPackagesTagsClassesElement >> removePackage: aPackage [ self reselectPackageOrTag: aSelectedPackageOrTag afterRemovalOfPackageNamed: aPackage name. ] -{ #category : 'api - package updates' } +{ #category : #'api - package updates' } GtCoderNavigationPackagesTagsClassesElement >> removePackage: aPackage tag: aPackageTagName [ | aSelectedPackageOrTag anIndex | anIndex := packagesList viewModel indexOf: aPackage. @@ -262,7 +262,7 @@ GtCoderNavigationPackagesTagsClassesElement >> removePackage: aPackage tag: aPac self reselectPackageOrTag: aSelectedPackageOrTag afterRemovalOfTagNamed: aPackageTagName. ] -{ #category : 'api - package updates' } +{ #category : #'api - package updates' } GtCoderNavigationPackagesTagsClassesElement >> renamePackage: aPackage oldName: anOldName newName: aNewName [ | aSelectedPackageOrTag | @@ -274,7 +274,7 @@ GtCoderNavigationPackagesTagsClassesElement >> renamePackage: aPackage oldName: self selectPackageOrTag: aSelectedPackageOrTag ]. ] -{ #category : 'api - package reselections' } +{ #category : #'api - package reselections' } GtCoderNavigationPackagesTagsClassesElement >> reselectPackageOrTag: aSelectedPackageOrTag afterRemovalOfPackageNamed: aRemovedPackageOrTagName [ aSelectedPackageOrTag ifNotNil: [ self deselectPackages. @@ -285,7 +285,7 @@ GtCoderNavigationPackagesTagsClassesElement >> reselectPackageOrTag: aSelectedPa self selectPackageOrTag: aSelectedPackageOrTag ] ] ] -{ #category : 'api - package reselections' } +{ #category : #'api - package reselections' } GtCoderNavigationPackagesTagsClassesElement >> reselectPackageOrTag: aSelectedPackageOrTag afterRemovalOfTagNamed: aRemovedTagName [ aSelectedPackageOrTag ifNotNil: [ self deselectPackages. @@ -297,7 +297,7 @@ GtCoderNavigationPackagesTagsClassesElement >> reselectPackageOrTag: aSelectedPa self selectPackageOrTag: aSelectedPackageOrTag ] ] ] -{ #category : 'api - class selections' } +{ #category : #'api - class selections' } GtCoderNavigationPackagesTagsClassesElement >> selectClass: aClass inPackage: aPackage tag: aPackageTag [ (self selectedPackage ~= aPackage or: [ self selectedPackageTag ~= aPackageTag ]) @@ -305,7 +305,7 @@ GtCoderNavigationPackagesTagsClassesElement >> selectClass: aClass inPackage: aP self selectClass: aClass ] -{ #category : 'api - package selections' } +{ #category : #'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> selectPackage: aPackage [ | aPreviousIndex | aPreviousIndex := packagesList selectedIndice. @@ -323,7 +323,7 @@ GtCoderNavigationPackagesTagsClassesElement >> selectPackage: aPackage [ self hideOrShowClassList ] -{ #category : 'api - package selections' } +{ #category : #'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> selectPackage: aPackage tag: aPackageTag [ | aPreviousIndex | (self hasPackageTagsIn: aPackage) @@ -344,49 +344,49 @@ GtCoderNavigationPackagesTagsClassesElement >> selectPackage: aPackage tag: aPac self hideOrShowClassList ] -{ #category : 'api - package selections' } +{ #category : #'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> selectPackageOrTag: aPackageOrTag [ (aPackageOrTag isKindOf: RPackage) ifTrue: [ self selectPackage: aPackageOrTag ] ifFalse: [ self selectPackage: aPackageOrTag package tag: aPackageOrTag ] ] -{ #category : 'api - class selections' } +{ #category : #'api - class selections' } GtCoderNavigationPackagesTagsClassesElement >> selectedClass [ ^ classesList selectedClass ] -{ #category : 'api - package selections' } +{ #category : #'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> selectedPackage [ ^ packagesList selectedPackage ] -{ #category : 'api - package selections' } +{ #category : #'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> selectedPackageNodeDo: aBlock [ ^ packagesList selectedPackageNodeDo: aBlock ] -{ #category : 'api - package selections' } +{ #category : #'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> selectedPackageTag [ ^ packagesList selectedPackageTag ] -{ #category : 'api - package selections' } +{ #category : #'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> selectedPackageTagNodeDo: aBlock [ ^ packagesList selectedPackageTagNodeDo: aBlock ] -{ #category : 'showing / hiding' } +{ #category : #'showing / hiding' } GtCoderNavigationPackagesTagsClassesElement >> showClassList [ classAndMethodProtocolList visibility: BlVisibility visible. classesLabel visibility: BlVisibility visible. self layout columnCount: 2. ] -{ #category : 'subscriptions' } +{ #category : #subscriptions } GtCoderNavigationPackagesTagsClassesElement >> subscribeToContent [ super subscribeToContent. self subscribeToPackageList. @@ -394,7 +394,7 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToContent [ self subscribeToProtocolList. ] -{ #category : 'subscriptions' } +{ #category : #subscriptions } GtCoderNavigationPackagesTagsClassesElement >> subscribeToNavigationModel [ self hasNavigationModel ifFalse: [ ^ self ]. super subscribeToNavigationModel. @@ -409,21 +409,21 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToNavigationModel [ navigationModel when: GtCodersFiltersChanged send: #onMethodsCoderFiltersChanged: to: self. ] -{ #category : 'subscriptions' } +{ #category : #subscriptions } GtCoderNavigationPackagesTagsClassesElement >> subscribeToPackageList [ packagesList when: BrSelectionChanged do: [ :anEvent | self onPackageListSelectionChanged ]. ] -{ #category : 'subscriptions' } +{ #category : #subscriptions } GtCoderNavigationPackagesTagsClassesElement >> subscribeToProtocolList [ methodProtocolsList when: BrSelectionChanged do: [ :anEvent | self onProtocolListSelectionChanged ]. ] -{ #category : 'updating lists' } +{ #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updateClassLists [ self hasNavigationModel ifFalse: [ ^ self ]. classesList initializeWithClasses: navigationModel classesToShow. @@ -441,7 +441,7 @@ GtCoderNavigationPackagesTagsClassesElement >> updateClassLists [ methodProtocolsList visibility: BlVisibility gone. ] ] -{ #category : 'updating lists' } +{ #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updateContent [ self updatePackageAndClassLists. self updateSelectedPackageAndTag. @@ -449,19 +449,19 @@ GtCoderNavigationPackagesTagsClassesElement >> updateContent [ self hideOrShowClassList ] -{ #category : 'updating lists' } +{ #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updatePackageAndClassLists [ self updatePackageLists. self updateClassLists. ] -{ #category : 'updating lists' } +{ #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updatePackageLists [ self hasNavigationModel ifFalse: [ ^ self ]. packagesList initializeWithPackages: navigationModel packagesToShow. ] -{ #category : 'updating lists' } +{ #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updateSelectedPackageAndTag [ self hasNavigationModel ifFalse: [ ^ self ]. navigationModel hasSelectedPackage diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st index d4b689bd6..241d454c1 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st @@ -4,17 +4,17 @@ I show a simple list of packages sorting alphabetically " Class { - #name : 'GtCoderNavigationPackagesTreeElement', - #superclass : 'BrSimpleTree', + #name : #GtCoderNavigationPackagesTreeElement, + #superclass : #BrSimpleTree, #category : 'GToolkit-Coder-UI-Navigation' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtCoderNavigationPackagesTreeElement class >> fromPackages: aCollectionOfPackages [ ^ self new initializeWithPackages: aCollectionOfPackages ] -{ #category : 'private - enumeration' } +{ #category : #'private - enumeration' } GtCoderNavigationPackagesTreeElement >> childrenForPackageOrTag: aPackageOrTag [ | theTags anExtension | (aPackageOrTag isKindOf: RPackage) ifFalse: [ ^ #() ]. @@ -33,7 +33,7 @@ GtCoderNavigationPackagesTreeElement >> childrenForPackageOrTag: aPackageOrTag [ ^ theTags ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderNavigationPackagesTreeElement >> initialize [ super initialize. @@ -50,7 +50,7 @@ GtCoderNavigationPackagesTreeElement >> initialize [ ifNotNil: [ aPackage name ]) ] ] -{ #category : 'api - initialization' } +{ #category : #'api - initialization' } GtCoderNavigationPackagesTreeElement >> initializeWithPackages: aCollectionOfPackages [ | theSortedPackages | theSortedPackages := aCollectionOfPackages asArray @@ -62,7 +62,7 @@ GtCoderNavigationPackagesTreeElement >> initializeWithPackages: aCollectionOfPac [ :eachPackageOrTag | self childrenForPackageOrTag: eachPackageOrTag ] ] -{ #category : 'private - testing' } +{ #category : #'private - testing' } GtCoderNavigationPackagesTreeElement >> isTag: tagA lessThan: tagB [ tagA class = GtCoderPackageUncategorizedTag ifTrue: [ ^ true ]. tagB class = GtCoderPackageUncategorizedTag ifTrue: [ ^ false ]. @@ -70,7 +70,7 @@ GtCoderNavigationPackagesTreeElement >> isTag: tagA lessThan: tagB [ ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtCoderNavigationPackagesTreeElement >> selectedIndice [ "Return selected indice or zero" @@ -81,26 +81,26 @@ GtCoderNavigationPackagesTreeElement >> selectedIndice [ ^ 0 ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtCoderNavigationPackagesTreeElement >> selectedPackage [ ^ self selectedPackageNodeDo: #value ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtCoderNavigationPackagesTreeElement >> selectedPackageNodeDo: aBlock [ self selectedNodeDo: [ :aNode | aNode depth = 0 ifTrue: [ ^ aBlock cull: aNode ] ]. ^ nil ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtCoderNavigationPackagesTreeElement >> selectedPackageTag [ ^ self selectedPackageTagNodeDo: #value ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtCoderNavigationPackagesTreeElement >> selectedPackageTagNodeDo: aBlock [ self selectedNodeDo: [ :aNode | aNode depth = 1 ifTrue: [ ^ aBlock cull: aNode ] ]. diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index ae02cb259..c708e315c 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderNavigationTabsStencil', - #superclass : 'BrStencil', + #name : #GtCoderNavigationTabsStencil, + #superclass : #BrStencil, #instVars : [ 'navigations', 'navigationModel' @@ -8,27 +8,27 @@ Class { #category : 'GToolkit-Coder-UI-Navigation' } -{ #category : 'adding' } +{ #category : #adding } GtCoderNavigationTabsStencil >> addNavigation: aNavigationElement [ self assertNavigationView: aNavigationElement. self navigations: (self navigations copyWith: aNavigationElement) ] -{ #category : 'asserting' } +{ #category : #asserting } GtCoderNavigationTabsStencil >> assertNavigationModel: aGtCoderNavigationPackagesTagsClassesModel [ self assert: [ aGtCoderNavigationPackagesTagsClassesModel isNotNil ] description: [ 'Navigation model must be non-nil' ]. ] -{ #category : 'asserting' } +{ #category : #asserting } GtCoderNavigationTabsStencil >> assertNavigationView: aNavigationView [ self assert: [ aNavigationView isKindOf: GtPhlowProtoView ] description: [ 'Navigation must be kind of ', GtPhlowView name ]. ] -{ #category : 'api - instantiation' } +{ #category : #'api - instantiation' } GtCoderNavigationTabsStencil >> create [ ^ GtPhlowCompositeView new @@ -39,7 +39,7 @@ GtCoderNavigationTabsStencil >> create [ matchParent ] ] -{ #category : 'defaults' } +{ #category : #defaults } GtCoderNavigationTabsStencil >> defaultNavigations [ ^ GtPhlowViewsCollector new @@ -48,7 +48,7 @@ GtCoderNavigationTabsStencil >> defaultNavigations [ collect ] -{ #category : 'gt-extensions' } +{ #category : #'gt-extensions' } GtCoderNavigationTabsStencil >> gtClassHierarchyFor: aView [ self navigationModel ifNil: [ ^ aView empty ]. @@ -58,7 +58,7 @@ GtCoderNavigationTabsStencil >> gtClassHierarchyFor: aView [ stencil: [ GtCoderNavigationClassHierachyElement new navigationModel: self navigationModel ] ] -{ #category : 'gt-extensions' } +{ #category : #'gt-extensions' } GtCoderNavigationTabsStencil >> gtPackagesTagsClassesFor: aView [ self navigationModel ifNil: [ ^ aView empty ]. @@ -69,25 +69,25 @@ GtCoderNavigationTabsStencil >> gtPackagesTagsClassesFor: aView [ navigationModel: self navigationModel ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationTabsStencil >> navigationModel [ ^ navigationModel ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationTabsStencil >> navigationModel: aGtCoderNavigationPackagesTagsClassesModel [ self assertNavigationModel: aGtCoderNavigationPackagesTagsClassesModel. navigationModel := aGtCoderNavigationPackagesTagsClassesModel. ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationTabsStencil >> navigations [ ^ navigations ifNil: [ navigations := self defaultNavigations ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderNavigationTabsStencil >> navigations: anArrayOfPhlowViews [ navigations := anArrayOfPhlowViews ] diff --git a/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st b/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st index 3fb20c1fe..44feb7796 100644 --- a/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st @@ -7,8 +7,8 @@ I display {{gtClass:GtCoderContentElement}} and an embedded playground. " Class { - #name : 'GtCoderPlaygroundElement', - #superclass : 'GtCoderNavigationModelElement', + #name : #GtCoderPlaygroundElement, + #superclass : #GtCoderNavigationModelElement, #instVars : [ 'contentElement', 'playgroundElement' @@ -16,13 +16,13 @@ Class { #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoderPlaygroundElement >> contentElement [ ^ contentElement ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderPlaygroundElement >> initialize [ super initialize. @@ -35,12 +35,12 @@ GtCoderPlaygroundElement >> initialize [ self addChild: self playPageElement as: #playPage ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderPlaygroundElement >> initializeContentElement [ contentElement := GtCoderContentElement new. ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderPlaygroundElement >> initializePlayPageElement [ playgroundElement := (GtInspector environment at: GtInspector embeddedPlaygroundName) new. @@ -49,45 +49,45 @@ GtCoderPlaygroundElement >> initializePlayPageElement [ playgroundElement objectHolder: self objectHolder ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoderPlaygroundElement >> objectHolder [ ^ GtInspectorObject new object: self receiver ] -{ #category : 'private - hooks' } +{ #category : #'private - hooks' } GtCoderPlaygroundElement >> onClassSelected: anEvent [ self updatePlayground ] -{ #category : 'private - hooks' } +{ #category : #'private - hooks' } GtCoderPlaygroundElement >> onNavigationModelChanged [ super onNavigationModelChanged. self contentElement navigationModel: self navigationModel. self updatePlayground. ] -{ #category : 'private - hooks' } +{ #category : #'private - hooks' } GtCoderPlaygroundElement >> onPackageSelected: anEvent [ self updatePlayground ] -{ #category : 'private - hooks' } +{ #category : #'private - hooks' } GtCoderPlaygroundElement >> onPackageTagSelected: anEvent [ self updatePlayground ] -{ #category : 'private - hooks' } +{ #category : #'private - hooks' } GtCoderPlaygroundElement >> onPackagesSelected: anEvent [ self updatePlayground ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoderPlaygroundElement >> playPageElement [ ^ playgroundElement ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoderPlaygroundElement >> receiver [ self navigationModel selectedClassDo: [ :aClass | ^ aClass ]. self navigationModel selectedTagDo: [ :aPackageTag | ^ aPackageTag ]. @@ -95,7 +95,7 @@ GtCoderPlaygroundElement >> receiver [ ^ Smalltalk ] -{ #category : 'private - subscriptions' } +{ #category : #'private - subscriptions' } GtCoderPlaygroundElement >> subscribeToNavigationModel [ super subscribeToNavigationModel. self navigationModel weak @@ -105,7 +105,7 @@ GtCoderPlaygroundElement >> subscribeToNavigationModel [ when: GtCoderNavigationClassSelected send: #onClassSelected: to: self. ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtCoderPlaygroundElement >> updatePlayground [ self playPageElement objectHolder: self objectHolder ] diff --git a/src/GToolkit-Coder-UI/GtCoderPrintStringAttribute.class.st b/src/GToolkit-Coder-UI/GtCoderPrintStringAttribute.class.st index 032e8a827..bcb36635b 100644 --- a/src/GToolkit-Coder-UI/GtCoderPrintStringAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPrintStringAttribute.class.st @@ -1,27 +1,27 @@ Class { - #name : 'GtCoderPrintStringAttribute', - #superclass : 'BrTextAdornmentAttribute', + #name : #GtCoderPrintStringAttribute, + #superclass : #BrTextAdornmentAttribute, #instVars : [ 'object' ], #category : 'GToolkit-Coder-UI-Coder - Source Attributes' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtCoderPrintStringAttribute class >> forObject: anObject [ ^ self new object: anObject; yourself ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtCoderPrintStringAttribute class >> forString: aString [ ^ self new object: aString; yourself ] -{ #category : 'private' } +{ #category : #private } GtCoderPrintStringAttribute >> actionButtonLook [ ^ BrGlamorousButtonIconAptitude + BrGlamorousButtonLayoutAptitude + (BrStyleCommonAptitude new default: [ :aStyle | aStyle geometry: BlCircle new ]; @@ -29,7 +29,7 @@ GtCoderPrintStringAttribute >> actionButtonLook [ pressed: [ :aStyle | aStyle background: BrGlamorousColors neutralBackgroundColor darker darker ]) ] -{ #category : 'private' } +{ #category : #private } GtCoderPrintStringAttribute >> buildMenuFor: aHamburgerButton fromEditorElement: anEditorElement [ ^ BrVerticalPane new @@ -78,7 +78,7 @@ GtCoderPrintStringAttribute >> buildMenuFor: aHamburgerButton fromEditorElement: } ] -{ #category : 'private' } +{ #category : #private } GtCoderPrintStringAttribute >> buildTooltip [ ^ BrEditor new aptitude: BrGlamorousEditorAptitude new glamorousRegularSmallSize; @@ -91,17 +91,17 @@ GtCoderPrintStringAttribute >> buildTooltip [ 'Press ' asRopedText, 'backspace' asRopedText glamorousRoundedBackground, ' to remove this popup.' asRopedText ] -{ #category : 'private' } +{ #category : #private } GtCoderPrintStringAttribute >> closeMenuFromElement: anElement [ anElement fireEvent: BrDropdownHideWish new ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtCoderPrintStringAttribute >> copyFromEditorElement: anEditorElement [ Clipboard clipboardText: object printString ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderPrintStringAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ | hamburgerButton | @@ -149,13 +149,13 @@ GtCoderPrintStringAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditor exact: 12@12) ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderPrintStringAttribute >> initialize [ super initialize. self beAppend ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtCoderPrintStringAttribute >> insertIntoTheEditorElement: anEditorElement [ anEditorElement text findAttribute: self @@ -181,12 +181,12 @@ GtCoderPrintStringAttribute >> insertIntoTheEditorElement: anEditorElement [ anEditorElement requestFocus ] -{ #category : 'testing' } +{ #category : #testing } GtCoderPrintStringAttribute >> isFocusable [ ^ true ] -{ #category : 'private' } +{ #category : #private } GtCoderPrintStringAttribute >> menuButtonLook [ ^ (BrGlamorousButtonRectangularAptitude new cornerRadius: 0) + BrGlamorousButtonIconAptitude @@ -194,12 +194,12 @@ GtCoderPrintStringAttribute >> menuButtonLook [ + BrGlamorousListItemAptitude ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderPrintStringAttribute >> object: anObject [ object := anObject ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtCoderPrintStringAttribute >> removeFromEditorElement: anEditorElement [ anEditorElement text findAttribute: self @@ -211,7 +211,7 @@ GtCoderPrintStringAttribute >> removeFromEditorElement: anEditorElement [ anEditorElement requestFocus ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtCoderPrintStringAttribute >> spawnFromElement: anElement [ anElement phlow spawnObject: object ] diff --git a/src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st b/src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st index 13a5a9073..83ead3802 100644 --- a/src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st +++ b/src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st @@ -1,13 +1,13 @@ Class { - #name : 'GtCoderSpotterStart', - #superclass : 'Object', + #name : #GtCoderSpotterStart, + #superclass : #Object, #instVars : [ 'navigationModelBlock' ], #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'searching' } +{ #category : #searching } GtCoderSpotterStart >> gtSpotterForClassMethodsInCurrentClassFor: aStep [ self navigationModel hasSelectedClass @@ -20,7 +20,7 @@ GtCoderSpotterStart >> gtSpotterForClassMethodsInCurrentClassFor: aStep [ wantsToDisplayOnEmptyQuery: true ] -{ #category : 'searching' } +{ #category : #searching } GtCoderSpotterStart >> gtSpotterForClassesFor: aStep [ aStep listProcessor @@ -33,7 +33,7 @@ GtCoderSpotterStart >> gtSpotterForClassesFor: aStep [ wantsToDisplayOnEmptyQuery: self navigationModel hasSelectedClass not ] -{ #category : 'searching' } +{ #category : #searching } GtCoderSpotterStart >> gtSpotterForInstanceMethodsInCurrentClassFor: aStep [ self navigationModel hasSelectedClass @@ -46,7 +46,7 @@ GtCoderSpotterStart >> gtSpotterForInstanceMethodsInCurrentClassFor: aStep [ wantsToDisplayOnEmptyQuery: true ] -{ #category : 'searching' } +{ #category : #searching } GtCoderSpotterStart >> gtSpotterForMessagesFor: aStep [ aStep listProcessor @@ -62,7 +62,7 @@ GtCoderSpotterStart >> gtSpotterForMessagesFor: aStep [ wantsToDisplayOnEmptyQuery: false ] -{ #category : 'searching' } +{ #category : #searching } GtCoderSpotterStart >> gtSpotterForPackagesFor: aStep [ aStep listProcessor @@ -75,7 +75,7 @@ GtCoderSpotterStart >> gtSpotterForPackagesFor: aStep [ wantsToDisplayOnEmptyQuery: self navigationModel hasSelectedPackage not ] -{ #category : 'searching' } +{ #category : #searching } GtCoderSpotterStart >> gtSpotterImplementorsFor: aStep [ self flag: #specialFilter. @@ -90,17 +90,17 @@ GtCoderSpotterStart >> gtSpotterImplementorsFor: aStep [ wantsToDisplayOnEmptyQuery: false ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderSpotterStart >> navigationModel [ ^ navigationModelBlock value ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderSpotterStart >> navigationModelBlock: aBlock [ navigationModelBlock := aBlock ] -{ #category : 'printing' } +{ #category : #printing } GtCoderSpotterStart >> printOn: aStream [ aStream nextPutAll: 'Spotter' ] diff --git a/src/GToolkit-Coder-UI/GtCoderToReplace.class.st b/src/GToolkit-Coder-UI/GtCoderToReplace.class.st index 5d53fe746..75af71889 100644 --- a/src/GToolkit-Coder-UI/GtCoderToReplace.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToReplace.class.st @@ -4,22 +4,22 @@ I am fired by inner coders to tell {{gtClass:GtCoder}} to replace its current co " Class { - #name : 'GtCoderToReplace', - #superclass : 'BlEvent', + #name : #GtCoderToReplace, + #superclass : #BlEvent, #instVars : [ 'coder' ], #category : 'GToolkit-Coder-UI-! Core' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderToReplace >> coder [ ^ coder ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderToReplace >> coder: aGtCoderModel [ coder := aGtCoderModel ] diff --git a/src/GToolkit-Coder-UI/GtCoderToSpawn.class.st b/src/GToolkit-Coder-UI/GtCoderToSpawn.class.st index c4d68324a..0c4672baa 100644 --- a/src/GToolkit-Coder-UI/GtCoderToSpawn.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToSpawn.class.st @@ -4,22 +4,22 @@ I am fired by inner coders to tell {{gtClass:GtCoder}} to spawn a new coder usin " Class { - #name : 'GtCoderToSpawn', - #superclass : 'BlEvent', + #name : #GtCoderToSpawn, + #superclass : #BlEvent, #instVars : [ 'coder' ], #category : 'GToolkit-Coder-UI-! Core' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderToSpawn >> coder [ ^ coder ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderToSpawn >> coder: aGtCoderModel [ coder := aGtCoderModel ] diff --git a/src/GToolkit-Coder-UI/GtCoderToSpawnInSpace.class.st b/src/GToolkit-Coder-UI/GtCoderToSpawnInSpace.class.st index fce2c694a..8090598fa 100644 --- a/src/GToolkit-Coder-UI/GtCoderToSpawnInSpace.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToSpawnInSpace.class.st @@ -4,7 +4,7 @@ I am fired by inner coders to tell {{gtClass:GtCoder}} to spawn a new coder in a " Class { - #name : 'GtCoderToSpawnInSpace', - #superclass : 'BlEvent', + #name : #GtCoderToSpawnInSpace, + #superclass : #BlEvent, #category : 'GToolkit-Coder-UI-! Core' } diff --git a/src/GToolkit-Coder-UI/GtCoderToggleAptitude.class.st b/src/GToolkit-Coder-UI/GtCoderToggleAptitude.class.st index 9f44f0d34..3473263dd 100644 --- a/src/GToolkit-Coder-UI/GtCoderToggleAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToggleAptitude.class.st @@ -1,15 +1,15 @@ Class { - #name : 'GtCoderToggleAptitude', - #superclass : 'BrMaterialToggleBackgroundAptitude', + #name : #GtCoderToggleAptitude, + #superclass : #BrMaterialToggleBackgroundAptitude, #category : 'GToolkit-Coder-UI-Looks' } -{ #category : 'initialization' } +{ #category : #initialization } GtCoderToggleAptitude >> defaultNormalBackground [ ^ Color transparent ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderToggleAptitude >> initialize [ | interactiveLook | super initialize. @@ -37,7 +37,7 @@ GtCoderToggleAptitude >> initialize [ yourself) ] -{ #category : 'private' } +{ #category : #private } GtCoderToggleAptitude >> updateActivatedBackground [ self widget isActivated ifTrue: [ self toggleActivated ] diff --git a/src/GToolkit-Coder-UI/GtCoderTool.class.st b/src/GToolkit-Coder-UI/GtCoderTool.class.st index 6c86c1ad0..337a9f711 100644 --- a/src/GToolkit-Coder-UI/GtCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtCoderTool.class.st @@ -1,32 +1,32 @@ Class { - #name : 'GtCoderTool', - #superclass : 'GtPhlowTool', + #name : #GtCoderTool, + #superclass : #GtPhlowTool, #category : 'GToolkit-Coder-UI-Tools' } -{ #category : 'converting' } +{ #category : #converting } GtCoderTool >> asElementDo: aOneArgBlock [ "Create a tool element and execute the block." ^ aOneArgBlock cull: self newCoder asPagerPageElement ] -{ #category : 'api - converting' } +{ #category : #'api - converting' } GtCoderTool >> icon [ ^ BrGlamorousVectorIcons browse ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtCoderTool >> name [ ^ 'coder' ] -{ #category : 'converting' } +{ #category : #converting } GtCoderTool >> newCoder [ ^ self subclassResponsibility ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtCoderTool >> tabLook [ ^ BrGlamorousTabSwitcherWithIconAptitude ] diff --git a/src/GToolkit-Coder-UI/GtCoderToolViewModel.class.st b/src/GToolkit-Coder-UI/GtCoderToolViewModel.class.st index 7dd419e53..28e3ef62b 100644 --- a/src/GToolkit-Coder-UI/GtCoderToolViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToolViewModel.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCoderToolViewModel', - #superclass : 'Object', + #name : #GtCoderToolViewModel, + #superclass : #Object, #traits : 'TGtAnnouncer', #classTraits : 'TGtAnnouncer classTrait', #instVars : [ @@ -10,47 +10,47 @@ Class { #category : 'GToolkit-Coder-UI-! Core - View Models' } -{ #category : 'announcer' } +{ #category : #announcer } GtCoderToolViewModel >> announcer [ ^ announcer ifNil: [ announcer := Announcer new ] ] -{ #category : 'api - coder tool' } +{ #category : #'api - coder tool' } GtCoderToolViewModel >> canGoBack [ ^ coderViewModelsStack size > 1 ] -{ #category : 'api - coder tool' } +{ #category : #'api - coder tool' } GtCoderToolViewModel >> currentCoderViewModel [ ^ coderViewModelsStack top ] -{ #category : 'api - coder tool' } +{ #category : #'api - coder tool' } GtCoderToolViewModel >> hasCoderViewModel [ ^ coderViewModelsStack isNotEmpty ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderToolViewModel >> initialize [ super initialize. coderViewModelsStack := Stack new ] -{ #category : 'private - notifying' } +{ #category : #'private - notifying' } GtCoderToolViewModel >> notifyCoderViewModelPopped: aCoderViewModel [ self announce: (GtCoderToolViewModelCoderPopped new coderViewModel: aCoderViewModel) ] -{ #category : 'private - notifying' } +{ #category : #'private - notifying' } GtCoderToolViewModel >> notifyCoderViewModelPushed: aCoderViewModel [ self announce: (GtCoderToolViewModelCoderPushed new coderViewModel: aCoderViewModel) ] -{ #category : 'api - coder tool' } +{ #category : #'api - coder tool' } GtCoderToolViewModel >> popCoderViewModel [ | aPoppedCoder | @@ -61,7 +61,7 @@ GtCoderToolViewModel >> popCoderViewModel [ self notifyCoderViewModelPopped: aPoppedCoder ] -{ #category : 'api - coder tool' } +{ #category : #'api - coder tool' } GtCoderToolViewModel >> pushCoderViewModel: aCoderViewModel [ coderViewModelsStack push: aCoderViewModel. self notifyCoderViewModelPushed: aCoderViewModel diff --git a/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderPopped.class.st b/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderPopped.class.st index 99bcb2e55..dabd318a6 100644 --- a/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderPopped.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderPopped.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtCoderToolViewModelCoderPopped', - #superclass : 'GtCoderToolViewModelCoderStackChanged', + #name : #GtCoderToolViewModelCoderPopped, + #superclass : #GtCoderToolViewModelCoderStackChanged, #category : 'GToolkit-Coder-UI-! Core - View Models' } diff --git a/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderPushed.class.st b/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderPushed.class.st index a360f4f28..8d2527886 100644 --- a/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderPushed.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderPushed.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtCoderToolViewModelCoderPushed', - #superclass : 'GtCoderToolViewModelCoderStackChanged', + #name : #GtCoderToolViewModelCoderPushed, + #superclass : #GtCoderToolViewModelCoderStackChanged, #category : 'GToolkit-Coder-UI-! Core - View Models' } diff --git a/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderStackChanged.class.st b/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderStackChanged.class.st index c097c5472..769187382 100644 --- a/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderStackChanged.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToolViewModelCoderStackChanged.class.st @@ -1,18 +1,18 @@ Class { - #name : 'GtCoderToolViewModelCoderStackChanged', - #superclass : 'Announcement', + #name : #GtCoderToolViewModelCoderStackChanged, + #superclass : #Announcement, #instVars : [ 'coderViewModel' ], #category : 'GToolkit-Coder-UI-! Core - View Models' } -{ #category : 'accessing' } +{ #category : #accessing } GtCoderToolViewModelCoderStackChanged >> coderViewModel [ ^ coderViewModel ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderToolViewModelCoderStackChanged >> coderViewModel: anObject [ coderViewModel := anObject ] diff --git a/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st b/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st index a131ee193..90b8c9c35 100644 --- a/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st @@ -7,15 +7,15 @@ I display a {{gtClass:BrToolbar}}. " Class { - #name : 'GtCoderToolbarElement', - #superclass : 'GtCoderNavigationModelElement', + #name : #GtCoderToolbarElement, + #superclass : #GtCoderNavigationModelElement, #instVars : [ 'toolbarElement' ], #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'gt-extensions' } +{ #category : #'gt-extensions' } GtCoderToolbarElement >> addClassTab: look [ ^ BrTab new @@ -35,7 +35,7 @@ GtCoderToolbarElement >> addClassTab: look [ element ] ] -{ #category : 'gt-extensions' } +{ #category : #'gt-extensions' } GtCoderToolbarElement >> addPackageTab: look [ ^ BrTab new @@ -54,7 +54,7 @@ GtCoderToolbarElement >> addPackageTab: look [ element ] ] -{ #category : 'gt-extensions' } +{ #category : #'gt-extensions' } GtCoderToolbarElement >> addTraitTab: look [ ^ BrTab new @@ -74,7 +74,7 @@ GtCoderToolbarElement >> addTraitTab: look [ element ] ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtCoderToolbarElement >> browseFrom: anElement [ "Do we want to share the same coder model?" self navigationModel coderDo: [ :aCoder | @@ -83,7 +83,7 @@ GtCoderToolbarElement >> browseFrom: anElement [ maximized ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderToolbarElement >> initialize [ super initialize. self initializeToolbarElement. @@ -97,7 +97,7 @@ GtCoderToolbarElement >> initialize [ anyToFitContent: self toolbarElement) ] -{ #category : 'initialization' } +{ #category : #initialization } GtCoderToolbarElement >> initializeToolbarElement [ toolbarElement := BrToolbar new aptitude: BrGlamorousToolbarAptitude new; @@ -114,7 +114,7 @@ GtCoderToolbarElement >> initializeToolbarElement [ yourself ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderToolbarElement >> newAddButton [ | look | ^ BrButton new @@ -141,7 +141,7 @@ GtCoderToolbarElement >> newAddButton [ yourself ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderToolbarElement >> newAddInterface: look [ | contentTabs tabMethods | contentTabs := BrTabGroup new. @@ -158,7 +158,7 @@ GtCoderToolbarElement >> newAddInterface: look [ ^ contentTabs ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderToolbarElement >> newBrowseButton [ ^ BrButton new aptitude: BrGlamorousButtonWithIconAptitude; @@ -167,7 +167,7 @@ GtCoderToolbarElement >> newBrowseButton [ action: [ :aButton | self browseFrom: aButton ] ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderToolbarElement >> newHierarchyButton [ ^ BrButton new label: 'Show Package and Class Hierarchies'; @@ -187,7 +187,7 @@ GtCoderToolbarElement >> newHierarchyButton [ yourself ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCoderToolbarElement >> newSpotterButton [ @@ -207,7 +207,7 @@ GtCoderToolbarElement >> newSpotterButton [ asElement. ] -{ #category : 'accessing' } +{ #category : #accessing } GtCoderToolbarElement >> toolbarElement [ ^ toolbarElement diff --git a/src/GToolkit-Coder-UI/GtCodersModel.extension.st b/src/GToolkit-Coder-UI/GtCodersModel.extension.st index b3a373ec1..b144255a3 100644 --- a/src/GToolkit-Coder-UI/GtCodersModel.extension.st +++ b/src/GToolkit-Coder-UI/GtCodersModel.extension.st @@ -1,11 +1,11 @@ -Extension { #name : 'GtCodersModel' } +Extension { #name : #GtCodersModel } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtCodersModel >> asCoderUIModel [ ^ self subclassResponsibility ] -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtCodersModel >> asElement [ ^ self asCoderUIModel asElement ] diff --git a/src/GToolkit-Coder-UI/GtContextCoderVariableAptitude.class.st b/src/GToolkit-Coder-UI/GtContextCoderVariableAptitude.class.st index 65a2d7746..a8e9d0d4a 100644 --- a/src/GToolkit-Coder-UI/GtContextCoderVariableAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtContextCoderVariableAptitude.class.st @@ -1,13 +1,13 @@ Class { - #name : 'GtContextCoderVariableAptitude', - #superclass : 'BrAptitude', + #name : #GtContextCoderVariableAptitude, + #superclass : #BrAptitude, #instVars : [ 'methodCoder' ], #category : 'GToolkit-Coder-UI-Looks' } -{ #category : 'initialization' } +{ #category : #initialization } GtContextCoderVariableAptitude >> initialize [ super initialize. self @@ -22,17 +22,17 @@ GtContextCoderVariableAptitude >> initialize [ yourself) ] -{ #category : 'accessing' } +{ #category : #accessing } GtContextCoderVariableAptitude >> methodCoder [ ^ methodCoder ] -{ #category : 'accessing' } +{ #category : #accessing } GtContextCoderVariableAptitude >> methodCoder: contextCoder [ methodCoder := contextCoder ] -{ #category : 'private' } +{ #category : #private } GtContextCoderVariableAptitude >> variables [ | vars | vars := OrderedCollection new. @@ -44,7 +44,7 @@ GtContextCoderVariableAptitude >> variables [ ^ vars ] -{ #category : 'initialization' } +{ #category : #initialization } GtContextCoderVariableAptitude >> variablesElement [ | variablesElement | variablesElement := BrColumnedList new. diff --git a/src/GToolkit-Coder-UI/GtCreateElement.class.st b/src/GToolkit-Coder-UI/GtCreateElement.class.st index 634652361..e436f2014 100644 --- a/src/GToolkit-Coder-UI/GtCreateElement.class.st +++ b/src/GToolkit-Coder-UI/GtCreateElement.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCreateElement', - #superclass : 'BlElement', + #name : #GtCreateElement, + #superclass : #BlElement, #traits : 'TBrLayoutResizable', #classTraits : 'TBrLayoutResizable classTrait', #instVars : [ @@ -9,7 +9,7 @@ Class { #category : 'GToolkit-Coder-UI-Behaviour' } -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtCreateElement >> buildSectionLabel: aSectionName [ ^ BrLabel new @@ -20,12 +20,12 @@ GtCreateElement >> buildSectionLabel: aSectionName [ constraintsDo: [ :c | c grid horizontal alignLeft ] ] -{ #category : 'private - ui' } +{ #category : #'private - ui' } GtCreateElement >> buttonMargin [ ^ BlInsets top: 3 left: 0 bottom: 3 right: 5 ] -{ #category : 'private - ui' } +{ #category : #'private - ui' } GtCreateElement >> editableLabelLook [ ^ BrGlamorousEditableLabelAptitude new glamorousCodeFont; @@ -33,7 +33,7 @@ GtCreateElement >> editableLabelLook [ fontSize: 10 ] -{ #category : 'initialization' } +{ #category : #initialization } GtCreateElement >> initialize [ super initialize. self layout: BlFlowLayout vertical. diff --git a/src/GToolkit-Coder-UI/GtDiffAptitude.class.st b/src/GToolkit-Coder-UI/GtDiffAptitude.class.st index e0e3d02ec..0594edcaf 100644 --- a/src/GToolkit-Coder-UI/GtDiffAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtDiffAptitude.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtDiffAptitude', - #superclass : 'BrAptitude', + #name : #GtDiffAptitude, + #superclass : #BrAptitude, #category : 'GToolkit-Coder-UI-Diff' } -{ #category : 'initialization' } +{ #category : #initialization } GtDiffAptitude >> initialize [ super initialize. diff --git a/src/GToolkit-Coder-UI/GtDiffElement.class.st b/src/GToolkit-Coder-UI/GtDiffElement.class.st index 24c23fc49..63902a371 100644 --- a/src/GToolkit-Coder-UI/GtDiffElement.class.st +++ b/src/GToolkit-Coder-UI/GtDiffElement.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtDiffElement', - #superclass : 'BlElement', + #name : #GtDiffElement, + #superclass : #BlElement, #traits : 'TBrLayoutResizable + TBrSizeAdjustable', #classTraits : 'TBrLayoutResizable classTrait + TBrSizeAdjustable classTrait', #instVars : [ @@ -14,34 +14,34 @@ Class { #category : 'GToolkit-Coder-UI-Diff' } -{ #category : 'examples' } +{ #category : #examples } GtDiffElement class >> example [ ^ self on: self exampleDiff ] -{ #category : 'examples' } +{ #category : #examples } GtDiffElement class >> exampleDiff [ ^ TextDiffBuilder from: self originalString to: self newString ] -{ #category : 'examples' } +{ #category : #examples } GtDiffElement class >> exampleFlat [ ^ (self on: self exampleDiff) aptitude: GtDiffFlatAptitude ] -{ #category : 'examples' } +{ #category : #examples } GtDiffElement class >> exampleShadow [ ^ (self on: self exampleDiff) aptitude: GtDiffShadowAptitude ] -{ #category : 'examples' } +{ #category : #examples } GtDiffElement class >> newString [ ^ String @@ -56,14 +56,14 @@ GtDiffElement class >> newString [ cr ] ] ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtDiffElement class >> on: aDiffBuilder [ ^ self new diff: aDiffBuilder; yourself ] -{ #category : 'examples' } +{ #category : #examples } GtDiffElement class >> originalString [ ^ String @@ -78,7 +78,7 @@ GtDiffElement class >> originalString [ cr ] ] ] -{ #category : 'private' } +{ #category : #private } GtDiffElement >> buildInterface [ syncScrollRanges := GtSyncScrollRanges createFromDiff: diff. @@ -91,13 +91,13 @@ GtDiffElement >> buildInterface [ self updateOutlines ] -{ #category : 'initialize' } +{ #category : #initialize } GtDiffElement >> diff: aDiffBuilder [ diff := aDiffBuilder. self buildInterface ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtDiffElement >> drawMeAndChildrenOnSpartaCanvas: aCanvas [ | stroke fill | super drawMeAndChildrenOnSpartaCanvas: aCanvas. @@ -118,12 +118,12 @@ GtDiffElement >> drawMeAndChildrenOnSpartaCanvas: aCanvas [ draw ] ] -{ #category : 'initialize' } +{ #category : #initialize } GtDiffElement >> editorLook [ ^ BrGlamorousCodeEditorAptitude ] -{ #category : 'initialize' } +{ #category : #initialize } GtDiffElement >> initialize [ super initialize. @@ -152,7 +152,7 @@ GtDiffElement >> initialize [ }. ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtDiffElement >> leftBottomFor: anInteger [ | range element | range := self leftRange. @@ -165,12 +165,12 @@ GtDiffElement >> leftBottomFor: anInteger [ max: 0 ] -{ #category : 'accessing' } +{ #category : #accessing } GtDiffElement >> leftEditorLook: aLook [ leftElement aptitude: aLook ] -{ #category : 'private' } +{ #category : #private } GtDiffElement >> leftRange [ | first | first := (leftElement instVarNamed: 'layoutPositionsRange') @@ -179,7 +179,7 @@ GtDiffElement >> leftRange [ ^ first to: first + leftElement children size - 1 ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtDiffElement >> leftScrolled [ | newPosition | newPosition := syncScrollRanges rightLineFor: self leftRange first. @@ -194,12 +194,12 @@ GtDiffElement >> leftScrolled [ self updateOutlines ] -{ #category : 'accessing' } +{ #category : #accessing } GtDiffElement >> leftStyler: aStyler [ leftElement editor styler: aStyler ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtDiffElement >> leftTopFor: anInteger [ | range element | range := self leftRange. @@ -212,12 +212,12 @@ GtDiffElement >> leftTopFor: anInteger [ max: 0 ] -{ #category : 'private' } +{ #category : #private } GtDiffElement >> newRopedText [ ^ diff newRopedText ] -{ #category : 'initialize' } +{ #category : #initialize } GtDiffElement >> newSeparatorElement [ ^ BlElement new constraintsDo: [ :c | @@ -226,7 +226,7 @@ GtDiffElement >> newSeparatorElement [ yourself ] -{ #category : 'initialize' } +{ #category : #initialize } GtDiffElement >> newTextElement [ ^ BrEditor new focusability: BlFocusability none; @@ -235,14 +235,14 @@ GtDiffElement >> newTextElement [ aptitude: self editorLook ] -{ #category : 'geometry hooks' } +{ #category : #'geometry hooks' } GtDiffElement >> notifyExtentChanged [ super notifyExtentChanged. outlines := #(). self updateOutlines ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtDiffElement >> outlineFor: aSyncScrollRange [ | leftTop leftBottom rightTop rightBottom vertices leftBounds rightBounds | leftTop := self leftTopFor: aSyncScrollRange leftFirst + 1. @@ -265,12 +265,12 @@ GtDiffElement >> outlineFor: aSyncScrollRange [ ^ BlPolyline vertices: vertices ] -{ #category : 'private' } +{ #category : #private } GtDiffElement >> previousRopedText [ ^ diff previousRopedText ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtDiffElement >> rightBottomFor: anInteger [ | range element | range := self rightRange. @@ -283,12 +283,12 @@ GtDiffElement >> rightBottomFor: anInteger [ max: 0 ] -{ #category : 'accessing' } +{ #category : #accessing } GtDiffElement >> rightEditorLook: aLook [ rightElement aptitude: aLook ] -{ #category : 'private' } +{ #category : #private } GtDiffElement >> rightRange [ | first | first := (rightElement instVarNamed: 'layoutPositionsRange') @@ -297,7 +297,7 @@ GtDiffElement >> rightRange [ ^ first to: first + rightElement children size - 1 ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtDiffElement >> rightScrolled [ | newPosition | newPosition := syncScrollRanges leftLineFor: self rightRange first. @@ -312,12 +312,12 @@ GtDiffElement >> rightScrolled [ self updateOutlines ] -{ #category : 'accessing' } +{ #category : #accessing } GtDiffElement >> rightStyler: aStyler [ rightElement editor styler: aStyler ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtDiffElement >> rightTopFor: anInteger [ | range element | range := self rightRange. @@ -330,7 +330,7 @@ GtDiffElement >> rightTopFor: anInteger [ max: 0 ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtDiffElement >> updateOutlines [ | ranges | outlines := OrderedCollection new. diff --git a/src/GToolkit-Coder-UI/GtDiffElementId.class.st b/src/GToolkit-Coder-UI/GtDiffElementId.class.st index a0387ad4c..813107782 100644 --- a/src/GToolkit-Coder-UI/GtDiffElementId.class.st +++ b/src/GToolkit-Coder-UI/GtDiffElementId.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtDiffElementId', - #superclass : 'BlElementUniqueId', + #name : #GtDiffElementId, + #superclass : #BlElementUniqueId, #category : 'GToolkit-Coder-UI-Diff' } -{ #category : 'testing' } +{ #category : #testing } GtDiffElementId class >> isAbstract [ ^ self = GtDiffElementId ] diff --git a/src/GToolkit-Coder-UI/GtDiffFlatAptitude.class.st b/src/GToolkit-Coder-UI/GtDiffFlatAptitude.class.st index 801c24966..2bdf234e0 100644 --- a/src/GToolkit-Coder-UI/GtDiffFlatAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtDiffFlatAptitude.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtDiffFlatAptitude', - #superclass : 'GtDiffAptitude', + #name : #GtDiffFlatAptitude, + #superclass : #GtDiffAptitude, #category : 'GToolkit-Coder-UI-Diff' } -{ #category : 'initialization' } +{ #category : #initialization } GtDiffFlatAptitude >> initialize [ super initialize. @@ -17,7 +17,7 @@ GtDiffFlatAptitude >> initialize [ self add: (self newTextLook // GtDiffNewTextId) ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtDiffFlatAptitude >> newTextLook [ ^ BrSizeAdjustmentAptitude new normal: [ :aStyle | diff --git a/src/GToolkit-Coder-UI/GtDiffNewTextId.class.st b/src/GToolkit-Coder-UI/GtDiffNewTextId.class.st index 881e3034f..7dcae2b56 100644 --- a/src/GToolkit-Coder-UI/GtDiffNewTextId.class.st +++ b/src/GToolkit-Coder-UI/GtDiffNewTextId.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtDiffNewTextId', - #superclass : 'GtDiffElementId', + #name : #GtDiffNewTextId, + #superclass : #GtDiffElementId, #category : 'GToolkit-Coder-UI-Diff' } -{ #category : 'converting' } +{ #category : #converting } GtDiffNewTextId >> asSymbol [ ^ #'diff--new-text' ] diff --git a/src/GToolkit-Coder-UI/GtDiffOldTextId.class.st b/src/GToolkit-Coder-UI/GtDiffOldTextId.class.st index 325a7f201..c4fefeaa6 100644 --- a/src/GToolkit-Coder-UI/GtDiffOldTextId.class.st +++ b/src/GToolkit-Coder-UI/GtDiffOldTextId.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtDiffOldTextId', - #superclass : 'GtDiffElementId', + #name : #GtDiffOldTextId, + #superclass : #GtDiffElementId, #category : 'GToolkit-Coder-UI-Diff' } -{ #category : 'converting' } +{ #category : #converting } GtDiffOldTextId >> asSymbol [ ^ #'diff--old-text' ] diff --git a/src/GToolkit-Coder-UI/GtDiffSeparatorId.class.st b/src/GToolkit-Coder-UI/GtDiffSeparatorId.class.st index ce30ee8c2..00a7c7818 100644 --- a/src/GToolkit-Coder-UI/GtDiffSeparatorId.class.st +++ b/src/GToolkit-Coder-UI/GtDiffSeparatorId.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtDiffSeparatorId', - #superclass : 'GtDiffElementId', + #name : #GtDiffSeparatorId, + #superclass : #GtDiffElementId, #category : 'GToolkit-Coder-UI-Diff' } -{ #category : 'converting' } +{ #category : #converting } GtDiffSeparatorId >> asSymbol [ ^ #'diff--separator' ] diff --git a/src/GToolkit-Coder-UI/GtDiffShadowAptitude.class.st b/src/GToolkit-Coder-UI/GtDiffShadowAptitude.class.st index 8aa7fff1a..870009dca 100644 --- a/src/GToolkit-Coder-UI/GtDiffShadowAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtDiffShadowAptitude.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtDiffShadowAptitude', - #superclass : 'GtDiffAptitude', + #name : #GtDiffShadowAptitude, + #superclass : #GtDiffAptitude, #category : 'GToolkit-Coder-UI-Diff' } -{ #category : 'initialization' } +{ #category : #initialization } GtDiffShadowAptitude >> initialize [ super initialize. @@ -28,7 +28,7 @@ GtDiffShadowAptitude >> initialize [ self add: (self newShadowLook // GtDiffNewTextId) ] -{ #category : 'initialization' } +{ #category : #initialization } GtDiffShadowAptitude >> newSeparatorLook [ ^ BrSizeAdjustmentAptitude new normal: [ :aStyle | aStyle hExact: 40 ]; @@ -37,7 +37,7 @@ GtDiffShadowAptitude >> newSeparatorLook [ mini: [ :aStyle | aStyle hExact: 10 ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtDiffShadowAptitude >> newShadowLook [ ^ BrStyleCommonAptitude new default: [ :aStyle | @@ -47,7 +47,7 @@ GtDiffShadowAptitude >> newShadowLook [ yourself ] -{ #category : 'initialization' } +{ #category : #initialization } GtDiffShadowAptitude >> newTextLook [ ^ BrSizeAdjustmentAptitude new normal: [ :aStyle | diff --git a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st index 51a78598e..c8ebe091e 100644 --- a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtExpandableSourceCoderElement', - #superclass : 'BrExpander', + #name : #GtExpandableSourceCoderElement, + #superclass : #BrExpander, #instVars : [ 'collapsedElement', 'expandedElement', @@ -9,18 +9,18 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Source' } -{ #category : 'private' } +{ #category : #private } GtExpandableSourceCoderElement >> addCodersCoderLook: aSourceCoder to: anElement [ aSourceCoder coderLook ifNotNil: [ :aCoderLook | anElement addAptitude: aCoderLook ] ] -{ #category : 'converting' } +{ #category : #converting } GtExpandableSourceCoderElement >> asVerticallyResizableDo: aBlock [ ^ self ] -{ #category : 'private' } +{ #category : #private } GtExpandableSourceCoderElement >> assignCollapsedCoder: aSourceCoder to: aCollapsedElement [ aCollapsedElement coderUIModel: aSourceCoder. @@ -31,7 +31,7 @@ GtExpandableSourceCoderElement >> assignCollapsedCoder: aSourceCoder to: aCollap aCollapsedElement addAptitude: GtSourceCoderCollapsedTextAndExampleAptitude ] ] -{ #category : 'private' } +{ #category : #private } GtExpandableSourceCoderElement >> assignExpandedCoder: aSourceCoder to: anExpandedElement [ anExpandedElement coderUIModel: aSourceCoder. @@ -42,7 +42,7 @@ GtExpandableSourceCoderElement >> assignExpandedCoder: aSourceCoder to: anExpand anExpandedElement addAptitude: GtSourceCoderEditorAptitude ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtExpandableSourceCoderElement >> coderUIModel [ self @@ -52,7 +52,7 @@ GtExpandableSourceCoderElement >> coderUIModel [ ^ coderUIModel ] -{ #category : 'accessing' } +{ #category : #accessing } GtExpandableSourceCoderElement >> coderUIModel: aCoderUIModel [ self assert: [ aCoderUIModel isNotNil ] @@ -93,7 +93,7 @@ GtExpandableSourceCoderElement >> coderUIModel: aCoderUIModel [ when: GtTextualCoderViewModelExpansionChanged send: #onViewModelExpansionChanged: to: self ] -{ #category : 'accessing' } +{ #category : #accessing } GtExpandableSourceCoderElement >> gtAllShortcutsFor: aView [ self shortcuts ifEmpty: [ ^ aView empty ]. @@ -106,7 +106,7 @@ GtExpandableSourceCoderElement >> gtAllShortcutsFor: aView [ column: 'Action' text: [ :each | each action asString ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtExpandableSourceCoderElement >> initialize [ super initialize. @@ -127,19 +127,19 @@ GtExpandableSourceCoderElement >> initialize [ content: [ expandedElement := self newExpandedElement ] ] -{ #category : 'private' } +{ #category : #private } GtExpandableSourceCoderElement >> isDirty: anElement [ ^ anElement userData at: #coderDirty ifAbsent: [ false ] ] -{ #category : 'private' } +{ #category : #private } GtExpandableSourceCoderElement >> markDirty: anElement as: aBoolean [ anElement userData at: #coderDirty put: aBoolean ] -{ #category : 'private' } +{ #category : #private } GtExpandableSourceCoderElement >> newCollapsedElement [ | aCollapsedElement | aCollapsedElement := GtSourceCoderCollapsedContentElement new. @@ -150,7 +150,7 @@ GtExpandableSourceCoderElement >> newCollapsedElement [ ^ aCollapsedElement ] -{ #category : 'private' } +{ #category : #private } GtExpandableSourceCoderElement >> newExpandedElement [ | anExpandedElement | anExpandedElement := GtSourceCoderExpandedContentElement new. @@ -161,7 +161,7 @@ GtExpandableSourceCoderElement >> newExpandedElement [ ^ anExpandedElement ] -{ #category : 'private' } +{ #category : #private } GtExpandableSourceCoderElement >> onCollapsed [ self beInSingleCompositionLayer. @@ -171,7 +171,7 @@ GtExpandableSourceCoderElement >> onCollapsed [ ifTrue: [ self assignCollapsedCoder: aCoderUIModel to: collapsedElement ] ] ] -{ #category : 'private' } +{ #category : #private } GtExpandableSourceCoderElement >> onExpanded [ self beInSeparateCompositionLayer. @@ -181,16 +181,16 @@ GtExpandableSourceCoderElement >> onExpanded [ ifTrue: [ self assignExpandedCoder: aCoderUIModel to: expandedElement ] ] ] -{ #category : 'events' } +{ #category : #events } GtExpandableSourceCoderElement >> onMethodRemoved: anAnnouncement [ ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtExpandableSourceCoderElement >> onViewModelExpansionChanged: anAnnouncement [ self expanded: anAnnouncement expanded ] -{ #category : 'focus requesting' } +{ #category : #'focus requesting' } GtExpandableSourceCoderElement >> requestFocus [ self childNamed: #editor @@ -198,7 +198,7 @@ GtExpandableSourceCoderElement >> requestFocus [ ifNone: [ super requestFocus ] ] -{ #category : 'focus requesting' } +{ #category : #'focus requesting' } GtExpandableSourceCoderElement >> requestFocusAsyncronously [ ^ self enqueueTask: diff --git a/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st b/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st index bbf85d8cf..2c647a1ef 100644 --- a/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtExpandedOnlyCoderElement', - #superclass : 'BrVerticalPane', + #name : #GtExpandedOnlyCoderElement, + #superclass : #BrVerticalPane, #instVars : [ 'coderUIModel', 'expandedElement' @@ -8,18 +8,18 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Source' } -{ #category : 'adding' } +{ #category : #adding } GtExpandedOnlyCoderElement >> addCodersCoderLook: aSourceCoder to: anElement [ aSourceCoder coderLook ifNotNil: [ :aCoderLook | anElement addAptitude: aCoderLook ] ] -{ #category : 'converting' } +{ #category : #converting } GtExpandedOnlyCoderElement >> asVerticallyResizableDo: aBlock [ ^ self ] -{ #category : 'accessing' } +{ #category : #accessing } GtExpandedOnlyCoderElement >> coder: aCoderUIModel [ self @@ -29,12 +29,12 @@ GtExpandedOnlyCoderElement >> coder: aCoderUIModel [ ^ self coderUIModel: aCoderUIModel ] -{ #category : 'accessing' } +{ #category : #accessing } GtExpandedOnlyCoderElement >> coderUIModel [ ^ coderUIModel ] -{ #category : 'accessing' } +{ #category : #accessing } GtExpandedOnlyCoderElement >> coderUIModel: aCoderUIModel [ self @@ -59,7 +59,7 @@ GtExpandedOnlyCoderElement >> coderUIModel: aCoderUIModel [ to: self ] -{ #category : 'initialization' } +{ #category : #initialization } GtExpandedOnlyCoderElement >> initialize [ super initialize. @@ -69,7 +69,7 @@ GtExpandedOnlyCoderElement >> initialize [ margin: (BlInsets all: 10) ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtExpandedOnlyCoderElement >> newExpandedElement: aCoderModel [ ^ GtSourceCoderExpandedContentElement new coderUIModel: aCoderModel; @@ -78,7 +78,7 @@ GtExpandedOnlyCoderElement >> newExpandedElement: aCoderModel [ yourself ] -{ #category : 'focus requesting' } +{ #category : #'focus requesting' } GtExpandedOnlyCoderElement >> requestFocus [ self childNamed: #editor @@ -86,7 +86,7 @@ GtExpandedOnlyCoderElement >> requestFocus [ ifNone: [ super requestFocus ] ] -{ #category : 'focus requesting' } +{ #category : #'focus requesting' } GtExpandedOnlyCoderElement >> requestFocusAsyncronously [ ^ self enqueueTask: diff --git a/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st b/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st index a3c17cb3a..37de44938 100644 --- a/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st +++ b/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st @@ -9,8 +9,8 @@ See {{gtClass:GtFiltersElement}} for an example. " Class { - #name : 'GtFilterDescriptor', - #superclass : 'Object', + #name : #GtFilterDescriptor, + #superclass : #Object, #instVars : [ 'name', 'order', @@ -23,7 +23,7 @@ Class { #category : 'GToolkit-Coder-UI-Filters' } -{ #category : 'instace creation' } +{ #category : #'instace creation' } GtFilterDescriptor class >> creator: aBlock named: aString order: anInteger [ ^ self new creationBlock: aBlock; @@ -32,7 +32,7 @@ GtFilterDescriptor class >> creator: aBlock named: aString order: anInteger [ yourself ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtFilterDescriptor class >> creator: aBlock named: aString order: anInteger completion: completionStrategy [ ^ self new creationBlock: aBlock; @@ -42,7 +42,7 @@ GtFilterDescriptor class >> creator: aBlock named: aString order: anInteger comp yourself ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtFilterDescriptor class >> creator: aBlock named: aString order: anInteger completion: completionStrategy emptyDefaultValue: defaultValueString [ ^ self new creationBlock: aBlock; @@ -53,38 +53,38 @@ GtFilterDescriptor class >> creator: aBlock named: aString order: anInteger comp yourself ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtFilterDescriptor >> beNotDefault [ "Do not display this particular descriptor filter as a default filter" isDefault := false ] -{ #category : 'accessing' } +{ #category : #accessing } GtFilterDescriptor >> completion [ ^ completion ] -{ #category : 'accessing' } +{ #category : #accessing } GtFilterDescriptor >> completion: completionStrategy [ completion := completionStrategy ] -{ #category : 'accessing' } +{ #category : #accessing } GtFilterDescriptor >> creationBlock: aBlock [ creationBlock := aBlock ] -{ #category : 'accessing' } +{ #category : #accessing } GtFilterDescriptor >> emptyDefaultValue [ ^ emptyDefaultValue ] -{ #category : 'accessing' } +{ #category : #accessing } GtFilterDescriptor >> emptyDefaultValue: aString [ emptyDefaultValue := aString ] -{ #category : 'gt-extensions' } +{ #category : #'gt-extensions' } GtFilterDescriptor >> gtCompletionsFor: aView [ self completion ifNil: [ ^ aView empty ]. @@ -96,39 +96,39 @@ GtFilterDescriptor >> gtCompletionsFor: aView [ view: #gtCompletionsFor: ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtFilterDescriptor >> initialize [ super initialize. valueIsRequired := true. isDefault := true. ] -{ #category : 'accessing' } +{ #category : #accessing } GtFilterDescriptor >> name [ ^ name ] -{ #category : 'accessing' } +{ #category : #accessing } GtFilterDescriptor >> name: aString [ name := aString ] -{ #category : 'filters' } +{ #category : #filters } GtFilterDescriptor >> newFilterWithValue: aString [ ^ creationBlock value: aString ] -{ #category : 'accessing' } +{ #category : #accessing } GtFilterDescriptor >> order [ ^ order ] -{ #category : 'accessing' } +{ #category : #accessing } GtFilterDescriptor >> order: anInteger [ order := anInteger ] -{ #category : 'printing' } +{ #category : #printing } GtFilterDescriptor >> printOn: aStream [ self name ifNil: [ ^ super printOn: aStream ]. aStream @@ -139,17 +139,17 @@ GtFilterDescriptor >> printOn: aStream [ nextPutAll: ')' ] -{ #category : 'testing' } +{ #category : #testing } GtFilterDescriptor >> showAsDefaultWhenEmpty [ ^ isDefault and: [ emptyDefaultValue notNil ] ] -{ #category : 'testing' } +{ #category : #testing } GtFilterDescriptor >> valueIsRequired [ ^ valueIsRequired ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtFilterDescriptor >> valueNotRequired [ valueIsRequired := false ] diff --git a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonAptitude.class.st b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonAptitude.class.st index 2f5b11cdf..ff92a6cd9 100644 --- a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonAptitude.class.st @@ -7,8 +7,8 @@ Look at my {{gtClass:GtFilterRunExampleButtonAptitude|show=#gtSubclassesFor:|exp " Class { - #name : 'GtFilterRunExampleButtonAptitude', - #superclass : 'BrAptitude', + #name : #GtFilterRunExampleButtonAptitude, + #superclass : #BrAptitude, #instVars : [ 'coder', 'mutex', @@ -17,20 +17,20 @@ Class { #category : 'GToolkit-Coder-UI-Filters' } -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtFilterRunExampleButtonAptitude >> beUpdateRequestedIfDoneEarlierDo: aBlock [ mutex critical: [ self isUpdateRequested ifTrue: aBlock. isUpdateRequested := true. ] ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtFilterRunExampleButtonAptitude >> coder [ ^ coder ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtFilterRunExampleButtonAptitude >> coder: aGtFilteredMethodsCoder [ coder = aGtFilteredMethodsCoder ifTrue: [ ^ self ]. self unsubscribeFromCoder. @@ -39,38 +39,38 @@ GtFilterRunExampleButtonAptitude >> coder: aGtFilteredMethodsCoder [ self onCoderChanged. ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtFilterRunExampleButtonAptitude >> coderDo: aBlock [ self coder ifNotNil: aBlock ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtFilterRunExampleButtonAptitude >> enqueueUpdate [ self widgetAndCoderDo: [ :aWidget :aCoder | aWidget enqueueTask: (BlTaskAction new action: [ self updateNow ]) ]. ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtFilterRunExampleButtonAptitude >> exampler [ ^ self coder exampler ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtFilterRunExampleButtonAptitude >> examplerDo: aBlock [ self coderDo: [ :aCoder | aBlock cull: aCoder exampler ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtFilterRunExampleButtonAptitude >> initialize [ super initialize. isUpdateRequested := false. mutex := Mutex new. ] -{ #category : 'initialization' } +{ #category : #initialization } GtFilterRunExampleButtonAptitude >> initializeIconElement: anElement [ anElement geometry: BlCircle new; @@ -78,43 +78,43 @@ GtFilterRunExampleButtonAptitude >> initializeIconElement: anElement [ size: 8 @ 8. ] -{ #category : 'private - testing' } +{ #category : #'private - testing' } GtFilterRunExampleButtonAptitude >> isUpdateRequested [ ^ isUpdateRequested ] -{ #category : 'api - hooks' } +{ #category : #'api - hooks' } GtFilterRunExampleButtonAptitude >> onAttachedTo: anElement [ super onAttachedTo: anElement. self postponeUpdate. ] -{ #category : 'private - hooks' } +{ #category : #'private - hooks' } GtFilterRunExampleButtonAptitude >> onCoderChanged [ "We expect that the Coder is changed just once before the look is attached." self beUpdateRequestedIfDoneEarlierDo: [ ^ self ]. self updateNow. ] -{ #category : 'private - announcement handling' } +{ #category : #'private - announcement handling' } GtFilterRunExampleButtonAptitude >> onCoderChanged: aGtCodersCodersChanged [ self postponeUpdate. ] -{ #category : 'private - announcement handling' } +{ #category : #'private - announcement handling' } GtFilterRunExampleButtonAptitude >> onExampleExecuted: aGtCoderExampleExecuted [ self postponeUpdate. ] -{ #category : 'api - hooks' } +{ #category : #'api - hooks' } GtFilterRunExampleButtonAptitude >> onUninstalledIn: anElement [ super onUninstalledIn: anElement. self resetUpdateRequested. ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtFilterRunExampleButtonAptitude >> postponeUpdate [ self widgetAndCoderDo: [ :aWidget :aCoder | self beUpdateRequestedIfDoneEarlierDo: [ ^ self ]. @@ -127,7 +127,7 @@ GtFilterRunExampleButtonAptitude >> postponeUpdate [ self updateNow ] ] ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtFilterRunExampleButtonAptitude >> postponedTime [ | aNow | self widgetDo: [ :aWidget | @@ -138,13 +138,13 @@ GtFilterRunExampleButtonAptitude >> postponedTime [ ^ aNow + 300 milliSeconds. ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtFilterRunExampleButtonAptitude >> resetUpdateRequested [ mutex critical: [ isUpdateRequested := false ]. ] -{ #category : 'private - subscriptions' } +{ #category : #'private - subscriptions' } GtFilterRunExampleButtonAptitude >> subscribeToCoder [ self coder weak when: GtCoderExampleExecuted @@ -156,25 +156,25 @@ GtFilterRunExampleButtonAptitude >> subscribeToCoder [ to: self ] -{ #category : 'private - subscriptions' } +{ #category : #'private - subscriptions' } GtFilterRunExampleButtonAptitude >> unsubscribeFromCoder [ self coderDo: [ :aCoder | aCoder unsubscribe: self ]. ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtFilterRunExampleButtonAptitude >> updateNow [ self resetUpdateRequested. self updateWidget. ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtFilterRunExampleButtonAptitude >> updateWidget [ "Subclasses may perform update actions. I should be called from a UI process." ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtFilterRunExampleButtonAptitude >> widgetAndCoderDo: aTwoArgBlock [ self widgetDo: [ :aWidget | self coderDo: [ :aCoder | diff --git a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonFourStateIconAptitude.class.st b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonFourStateIconAptitude.class.st index 8cfe86170..63b2a094d 100644 --- a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonFourStateIconAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonFourStateIconAptitude.class.st @@ -20,8 +20,8 @@ If all examples have same state, only one icon (color) is displayed: {{gtExample " Class { - #name : 'GtFilterRunExampleButtonFourStateIconAptitude', - #superclass : 'GtFilterRunExampleButtonIconAptitude', + #name : #GtFilterRunExampleButtonFourStateIconAptitude, + #superclass : #GtFilterRunExampleButtonIconAptitude, #instVars : [ 'fourIconElement', 'failureIconElement', @@ -32,22 +32,22 @@ Class { #category : 'GToolkit-Coder-UI-Filters' } -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtFilterRunExampleButtonFourStateIconAptitude >> errorIconElement [ ^ errorIconElement ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtFilterRunExampleButtonFourStateIconAptitude >> failureIconElement [ ^ failureIconElement ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtFilterRunExampleButtonFourStateIconAptitude >> fourIconElement [ ^ fourIconElement ] -{ #category : 'initialization' } +{ #category : #initialization } GtFilterRunExampleButtonFourStateIconAptitude >> initialize [ super initialize. self initializeFourStateIconElement. @@ -64,27 +64,27 @@ GtFilterRunExampleButtonFourStateIconAptitude >> initialize [ self addChangeAddChildAs: #(content fourStateExample) with: [ self fourIconElement ]. ] -{ #category : 'initialization' } +{ #category : #initialization } GtFilterRunExampleButtonFourStateIconAptitude >> initializeErrorIconElement [ errorIconElement := BlElement new background: self newErrorBackground. self initializeIconElement: errorIconElement. ] -{ #category : 'initialization' } +{ #category : #initialization } GtFilterRunExampleButtonFourStateIconAptitude >> initializeExampleElement [ super initializeExampleElement. self exampleElement visibility: BlVisibility gone. ] -{ #category : 'initialization' } +{ #category : #initialization } GtFilterRunExampleButtonFourStateIconAptitude >> initializeFailureIconElement [ failureIconElement := BlElement new background: self newFailureBackground. self initializeIconElement: failureIconElement ] -{ #category : 'initialization' } +{ #category : #initialization } GtFilterRunExampleButtonFourStateIconAptitude >> initializeFourStateIconElement [ fourIconElement := BlElement new layout: (BlGridLayout new @@ -96,31 +96,31 @@ GtFilterRunExampleButtonFourStateIconAptitude >> initializeFourStateIconElement c vertical fitContent ]. ] -{ #category : 'initialization' } +{ #category : #initialization } GtFilterRunExampleButtonFourStateIconAptitude >> initializeNeutralIconElement [ neutralIconElement := BlElement new background: self newNotExecutedBackground. self initializeIconElement: neutralIconElement. ] -{ #category : 'initialization' } +{ #category : #initialization } GtFilterRunExampleButtonFourStateIconAptitude >> initializeSuccessIconElement [ successIconElement := BlElement new background: self newSuccessBackground. self initializeIconElement: successIconElement ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtFilterRunExampleButtonFourStateIconAptitude >> neutralIconElement [ ^ neutralIconElement ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtFilterRunExampleButtonFourStateIconAptitude >> successIconElement [ ^ successIconElement ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtFilterRunExampleButtonFourStateIconAptitude >> updateFourIconElement [ | isNeutralVisible isErrorVisible isFailureVisible isSuccessVisible | self updateIconElement: self neutralIconElement status: (isNeutralVisible := self exampler hasNotExecutedExamples). @@ -136,7 +136,7 @@ GtFilterRunExampleButtonFourStateIconAptitude >> updateFourIconElement [ self exampleElement visibility: BlVisibility gone ] ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtFilterRunExampleButtonFourStateIconAptitude >> updateIconElement: anElement status: aBoolean [ aBoolean ifTrue: [ @@ -145,7 +145,7 @@ GtFilterRunExampleButtonFourStateIconAptitude >> updateIconElement: anElement st anElement visibility: BlVisibility hidden ]. ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtFilterRunExampleButtonFourStateIconAptitude >> updateWidget [ super updateWidget. self updateFourIconElement. diff --git a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonIconAptitude.class.st b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonIconAptitude.class.st index ac123fea3..0f540813a 100644 --- a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonIconAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonIconAptitude.class.st @@ -20,21 +20,21 @@ The following examples shows a colored icon as a part of a button in four possib " Class { - #name : 'GtFilterRunExampleButtonIconAptitude', - #superclass : 'GtFilterRunExampleButtonAptitude', + #name : #GtFilterRunExampleButtonIconAptitude, + #superclass : #GtFilterRunExampleButtonAptitude, #instVars : [ 'exampleElement' ], #category : 'GToolkit-Coder-UI-Filters' } -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtFilterRunExampleButtonIconAptitude >> exampleElement [ ^ exampleElement ] -{ #category : 'initialization' } +{ #category : #initialization } GtFilterRunExampleButtonIconAptitude >> initialize [ super initialize. self initializeExampleElement. @@ -42,14 +42,14 @@ GtFilterRunExampleButtonIconAptitude >> initialize [ self addChangeAddChildAs: #(content example) with: [ self exampleElement ]. ] -{ #category : 'initialization' } +{ #category : #initialization } GtFilterRunExampleButtonIconAptitude >> initializeExampleElement [ exampleElement := BlElement new background: self newNotExecutedBackground. self initializeIconElement: exampleElement. ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtFilterRunExampleButtonIconAptitude >> newBackground [ self coder exampler hasNotExecutedExamples ifTrue: [ ^ self newNotExecutedBackground ]. @@ -62,27 +62,27 @@ GtFilterRunExampleButtonIconAptitude >> newBackground [ ^ self newNotExecutedBackground. ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtFilterRunExampleButtonIconAptitude >> newErrorBackground [ ^ GtFilterExampleErrorState default color ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtFilterRunExampleButtonIconAptitude >> newFailureBackground [ ^ GtFilterExampleFailureState default color ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtFilterRunExampleButtonIconAptitude >> newNotExecutedBackground [ ^ GtFilterExampleNotExecutedState default color ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtFilterRunExampleButtonIconAptitude >> newSuccessBackground [ ^ GtFilterExampleSuccessState default color ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtFilterRunExampleButtonIconAptitude >> updateButtonStatus [ "I must be called in a UI process". self widgetDo: [ :aWidget | @@ -95,14 +95,14 @@ GtFilterRunExampleButtonIconAptitude >> updateButtonStatus [ ifTrue: [ aWidget visibility: BlVisibility visible] ] ] ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtFilterRunExampleButtonIconAptitude >> updateExampleStatus [ "I must be called in a UI process". self exampleElement background: self newBackground ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtFilterRunExampleButtonIconAptitude >> updateWidget [ super updateWidget. self updateExampleStatus. diff --git a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonTooltipAptitude.class.st b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonTooltipAptitude.class.st index 2a5c8f572..885ce0b9e 100644 --- a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonTooltipAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonTooltipAptitude.class.st @@ -1,13 +1,13 @@ Class { - #name : 'GtFilterRunExampleButtonTooltipAptitude', - #superclass : 'GtFilterRunExampleButtonAptitude', + #name : #GtFilterRunExampleButtonTooltipAptitude, + #superclass : #GtFilterRunExampleButtonAptitude, #instVars : [ 'tooltipContent' ], #category : 'GToolkit-Coder-UI-Filters' } -{ #category : 'initialization' } +{ #category : #initialization } GtFilterRunExampleButtonTooltipAptitude >> initialize [ super initialize. self initializeTooltipContent. @@ -15,7 +15,7 @@ GtFilterRunExampleButtonTooltipAptitude >> initialize [ self add: (BrGlamorousWithTooltipAptitude content: [self initializeTooltipContent]). ] -{ #category : 'initialization' } +{ #category : #initialization } GtFilterRunExampleButtonTooltipAptitude >> initializeTooltipContent [ tooltipContent := BrColumnedList new. tooltipContent @@ -77,7 +77,7 @@ GtFilterRunExampleButtonTooltipAptitude >> initializeTooltipContent [ ^ tooltipContent ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtFilterRunExampleButtonTooltipAptitude >> listItems [ | states | states := GtFilterExampleState default allStates. @@ -85,13 +85,13 @@ GtFilterRunExampleButtonTooltipAptitude >> listItems [ eachState labelWithAmountFor: self coder exampler ]. ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtFilterRunExampleButtonTooltipAptitude >> tooltipContent [ ^ tooltipContent ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtFilterRunExampleButtonTooltipAptitude >> updateList [ | statusesToDisplay | statusesToDisplay := GtFilterExampleState default allStates reject: [ :eachStatus | @@ -101,7 +101,7 @@ GtFilterRunExampleButtonTooltipAptitude >> updateList [ items: statusesToDisplay ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtFilterRunExampleButtonTooltipAptitude >> updateWidget [ super updateWidget. self updateList. diff --git a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st index c0cbbc52f..1b0ce38ae 100644 --- a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st @@ -12,8 +12,8 @@ The following example shows a coder with default filters element that you can ch " Class { - #name : 'GtFilterTagElement', - #superclass : 'BrHorizontalPane', + #name : #GtFilterTagElement, + #superclass : #BrHorizontalPane, #instVars : [ 'descriptor', 'valueString', @@ -22,7 +22,7 @@ Class { #category : 'GToolkit-Coder-UI-Filters' } -{ #category : 'actions' } +{ #category : #actions } GtFilterTagElement >> activateEditor [ self childNamed: #editableLabel @@ -33,14 +33,14 @@ GtFilterTagElement >> activateEditor [ ifNone: [ (self childNamed: #dropDown) requestFocus ] ] -{ #category : 'private' } +{ #category : #private } GtFilterTagElement >> applyDescriptor: aDescriptor [ self descriptor: aDescriptor. self activateEditor. filterElement applyFilters ] -{ #category : 'elements' } +{ #category : #elements } GtFilterTagElement >> buildTagElements [ self removeChildren. self addChild: self createDropDown as: #dropDown. @@ -48,7 +48,7 @@ GtFilterTagElement >> buildTagElements [ ifTrue: [ self addChild: self createEditableLabel as: #editableLabel ] ] -{ #category : 'elements' } +{ #category : #elements } GtFilterTagElement >> createDropDown [ | button dropDownLook | button := self createDropDownButton. @@ -98,7 +98,7 @@ GtFilterTagElement >> createDropDown [ ^ button ] -{ #category : 'elements' } +{ #category : #elements } GtFilterTagElement >> createDropDownButton [ | button | button := BrButton new. @@ -114,7 +114,7 @@ GtFilterTagElement >> createDropDownButton [ ^ button ] -{ #category : 'elements' } +{ #category : #elements } GtFilterTagElement >> createEditableLabel [ | label | label := BrEditableLabel new. @@ -154,29 +154,29 @@ GtFilterTagElement >> createEditableLabel [ ^ label ] -{ #category : 'accessing' } +{ #category : #accessing } GtFilterTagElement >> descriptor [ ^ descriptor ] -{ #category : 'accessing' } +{ #category : #accessing } GtFilterTagElement >> descriptor: aFilterDescriptor [ descriptor := aFilterDescriptor. valueString := ''. self buildTagElements ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtFilterTagElement >> emptyDefaultValueLabel [ ^ descriptor emptyDefaultValue ] -{ #category : 'accessing' } +{ #category : #accessing } GtFilterTagElement >> filter: aGtMethodsFilter [ filterElement := aGtMethodsFilter ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtFilterTagElement >> initialize [ super initialize. self fitContent. @@ -193,7 +193,7 @@ GtFilterTagElement >> initialize [ self theme status neutralBackgroundColor darker ]) ] -{ #category : 'testing' } +{ #category : #testing } GtFilterTagElement >> isDefaultAllFilter [ ^ self descriptor showAsDefaultWhenEmpty and: [ valueString isEmpty @@ -201,18 +201,18 @@ GtFilterTagElement >> isDefaultAllFilter [ [ (self childNamed: #editableLabel) text asString = self emptyDefaultValueLabel ] ] ] -{ #category : 'testing' } +{ #category : #testing } GtFilterTagElement >> isValid [ ^ descriptor valueIsRequired not or: [ self valueString notEmpty ] ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtFilterTagElement >> makeDefaultFilter [ valueString := ''. self setLabelText: self emptyDefaultValueLabel ] -{ #category : 'private' } +{ #category : #private } GtFilterTagElement >> setLabelText: aString [ self childNamed: #editableLabel @@ -223,12 +223,12 @@ GtFilterTagElement >> setLabelText: aString [ append: aString asRopedText glamorousRegularFont glamorousRegularSmallSize ] ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtFilterTagElement >> valueString [ ^ valueString ] -{ #category : 'accessing' } +{ #category : #accessing } GtFilterTagElement >> valueString: aString [ valueString := aString. self setLabelText: aString diff --git a/src/GToolkit-Coder-UI/GtFiltersChangedEvent.class.st b/src/GToolkit-Coder-UI/GtFiltersChangedEvent.class.st index 4ca407cc2..ddbae2ac5 100644 --- a/src/GToolkit-Coder-UI/GtFiltersChangedEvent.class.st +++ b/src/GToolkit-Coder-UI/GtFiltersChangedEvent.class.st @@ -1,18 +1,18 @@ Class { - #name : 'GtFiltersChangedEvent', - #superclass : 'BlEvent', + #name : #GtFiltersChangedEvent, + #superclass : #BlEvent, #instVars : [ 'filterElement' ], #category : 'GToolkit-Coder-UI-Filters' } -{ #category : 'accessing' } +{ #category : #accessing } GtFiltersChangedEvent >> filterElement [ ^ filterElement ] -{ #category : 'accessing' } +{ #category : #accessing } GtFiltersChangedEvent >> filterElement: anElement [ filterElement := anElement ] diff --git a/src/GToolkit-Coder-UI/GtFiltersElement.class.st b/src/GToolkit-Coder-UI/GtFiltersElement.class.st index d08ea6325..fded05c69 100644 --- a/src/GToolkit-Coder-UI/GtFiltersElement.class.st +++ b/src/GToolkit-Coder-UI/GtFiltersElement.class.st @@ -11,15 +11,15 @@ The following example shows a coder with default filters element that you can ch " Class { - #name : 'GtFiltersElement', - #superclass : 'BrHorizontalFlow', + #name : #GtFiltersElement, + #superclass : #BrHorizontalFlow, #instVars : [ 'descriptors' ], #category : 'GToolkit-Coder-UI-Filters' } -{ #category : 'accessing' } +{ #category : #accessing } GtFiltersElement >> addEmptyDefault [ | filterElement defaultDescriptor | self childrenCount = 1 @@ -34,7 +34,7 @@ GtFiltersElement >> addEmptyDefault [ self addChild: filterElement at: self childrenCount ] -{ #category : 'accessing' } +{ #category : #accessing } GtFiltersElement >> addFilterForDescriptor: aFilterDescriptor andValue: aString [ | element | element := GtFilterTagElement new. @@ -45,25 +45,25 @@ GtFiltersElement >> addFilterForDescriptor: aFilterDescriptor andValue: aString self addChild: element at: self childrenCount ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtFiltersElement >> applyFilters [ self fireEvent: (GtFiltersChangedEvent new filterElement: self). self addEmptyDefault ] -{ #category : 'accessing' } +{ #category : #accessing } GtFiltersElement >> buildFilters: aBlock [ self clearFilters. aBlock value. self addEmptyDefault ] -{ #category : 'accessing' } +{ #category : #accessing } GtFiltersElement >> clearFilters [ [ self childrenCount > 1 ] whileTrue: [ self removeChildAt: 1 ] ] -{ #category : 'private - actions' } +{ #category : #'private - actions' } GtFiltersElement >> createNewTag [ | tag | self descriptors isEmptyOrNil ifTrue: [ ^ self ]. @@ -77,18 +77,18 @@ GtFiltersElement >> createNewTag [ tag activateEditor ] -{ #category : 'accessing' } +{ #category : #accessing } GtFiltersElement >> descriptors [ ^ descriptors ] -{ #category : 'accessing' } +{ #category : #accessing } GtFiltersElement >> descriptors: aCollection [ descriptors := aCollection. self addEmptyDefault ] -{ #category : 'accessing' } +{ #category : #accessing } GtFiltersElement >> filtersDo: aBlock [ 1 to: self childrenCount - 1 do: [ :i | | filterTagElement | @@ -99,7 +99,7 @@ GtFiltersElement >> filtersDo: aBlock [ value: filterTagElement valueString ] ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtFiltersElement >> initialize [ super initialize. self hMatchParent. @@ -107,7 +107,7 @@ GtFiltersElement >> initialize [ self addChild: self newAddTagButton as: #newButton ] -{ #category : 'private - instance creation' } +{ #category : #'private - instance creation' } GtFiltersElement >> newAddTagButton [ ^ BrButton new aptitude: diff --git a/src/GToolkit-Coder-UI/GtMethodCoderContextPCRangeChanged.class.st b/src/GToolkit-Coder-UI/GtMethodCoderContextPCRangeChanged.class.st index 19e97b4d7..27036d49c 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderContextPCRangeChanged.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderContextPCRangeChanged.class.st @@ -1,18 +1,18 @@ Class { - #name : 'GtMethodCoderContextPCRangeChanged', - #superclass : 'Announcement', + #name : #GtMethodCoderContextPCRangeChanged, + #superclass : #Announcement, #instVars : [ 'pcRange' ], #category : 'GToolkit-Coder-UI-Coder - Method Events' } -{ #category : 'accessing' } +{ #category : #accessing } GtMethodCoderContextPCRangeChanged >> pcRange [ ^ pcRange ] -{ #category : 'accessing' } +{ #category : #accessing } GtMethodCoderContextPCRangeChanged >> pcRange: anObject [ pcRange := anObject ] diff --git a/src/GToolkit-Coder-UI/GtMethodCoderDebugExampleActionId.class.st b/src/GToolkit-Coder-UI/GtMethodCoderDebugExampleActionId.class.st index bb3c520ff..b47ffedaf 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderDebugExampleActionId.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderDebugExampleActionId.class.st @@ -4,12 +4,12 @@ A button to debug an example " Class { - #name : 'GtMethodCoderDebugExampleActionId', - #superclass : 'GtCoderElementId', + #name : #GtMethodCoderDebugExampleActionId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtMethodCoderDebugExampleActionId >> asSymbol [ ^ #'context-action--debug-example' ] diff --git a/src/GToolkit-Coder-UI/GtMethodCoderDiscardChangesActionId.class.st b/src/GToolkit-Coder-UI/GtMethodCoderDiscardChangesActionId.class.st index 56373e2e8..feaab2c50 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderDiscardChangesActionId.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderDiscardChangesActionId.class.st @@ -4,12 +4,12 @@ A button to discard changes " Class { - #name : 'GtMethodCoderDiscardChangesActionId', - #superclass : 'GtCoderElementId', + #name : #GtMethodCoderDiscardChangesActionId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtMethodCoderDiscardChangesActionId >> asSymbol [ ^ #'main-action--discard-changes' ] diff --git a/src/GToolkit-Coder-UI/GtMethodCoderExtractMethodContextMenuItemId.class.st b/src/GToolkit-Coder-UI/GtMethodCoderExtractMethodContextMenuItemId.class.st index ed0753ce4..2c2c2b666 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderExtractMethodContextMenuItemId.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderExtractMethodContextMenuItemId.class.st @@ -4,12 +4,12 @@ A context menu action to extract a method " Class { - #name : 'GtMethodCoderExtractMethodContextMenuItemId', - #superclass : 'GtCoderElementId', + #name : #GtMethodCoderExtractMethodContextMenuItemId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtMethodCoderExtractMethodContextMenuItemId >> asSymbol [ ^ #'context-menu-item--extract-method' ] diff --git a/src/GToolkit-Coder-UI/GtMethodCoderPlayAndInspectExampleActionId.class.st b/src/GToolkit-Coder-UI/GtMethodCoderPlayAndInspectExampleActionId.class.st index 128044784..997d18135 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderPlayAndInspectExampleActionId.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderPlayAndInspectExampleActionId.class.st @@ -4,12 +4,12 @@ A button to play and inspect an example " Class { - #name : 'GtMethodCoderPlayAndInspectExampleActionId', - #superclass : 'GtCoderElementId', + #name : #GtMethodCoderPlayAndInspectExampleActionId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtMethodCoderPlayAndInspectExampleActionId >> asSymbol [ ^ #'context-action--play-and-inspect-example' ] diff --git a/src/GToolkit-Coder-UI/GtMethodCoderPlayExampleActionId.class.st b/src/GToolkit-Coder-UI/GtMethodCoderPlayExampleActionId.class.st index 955d1fa77..ac6815b8a 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderPlayExampleActionId.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderPlayExampleActionId.class.st @@ -4,12 +4,12 @@ A button to play an example " Class { - #name : 'GtMethodCoderPlayExampleActionId', - #superclass : 'GtCoderElementId', + #name : #GtMethodCoderPlayExampleActionId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtMethodCoderPlayExampleActionId >> asSymbol [ ^ #'context-action--play-example' ] diff --git a/src/GToolkit-Coder-UI/GtMethodCoderSaveAbilityChanged.class.st b/src/GToolkit-Coder-UI/GtMethodCoderSaveAbilityChanged.class.st index a2ad0736f..d6d38647c 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderSaveAbilityChanged.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderSaveAbilityChanged.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtMethodCoderSaveAbilityChanged', - #superclass : 'GtTextualCoderViewModelAnnouncement', + #name : #GtMethodCoderSaveAbilityChanged, + #superclass : #GtTextualCoderViewModelAnnouncement, #category : 'GToolkit-Coder-UI-Coder - Method Events' } diff --git a/src/GToolkit-Coder-UI/GtMethodCoderSaveActionId.class.st b/src/GToolkit-Coder-UI/GtMethodCoderSaveActionId.class.st index b7a2158f7..6ae3d408d 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderSaveActionId.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderSaveActionId.class.st @@ -4,12 +4,12 @@ A button to save a method " Class { - #name : 'GtMethodCoderSaveActionId', - #superclass : 'GtCoderElementId', + #name : #GtMethodCoderSaveActionId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtMethodCoderSaveActionId >> asSymbol [ ^ #'main-action--save' ] diff --git a/src/GToolkit-Coder-UI/GtMethodCoderSaveDisabled.class.st b/src/GToolkit-Coder-UI/GtMethodCoderSaveDisabled.class.st index 9f80acdf6..e1e94dd63 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderSaveDisabled.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderSaveDisabled.class.st @@ -1,23 +1,23 @@ Class { - #name : 'GtMethodCoderSaveDisabled', - #superclass : 'GtMethodCoderSaveAbilityChanged', + #name : #GtMethodCoderSaveDisabled, + #superclass : #GtMethodCoderSaveAbilityChanged, #instVars : [ 'preventors' ], #category : 'GToolkit-Coder-UI-Coder - Method Events' } -{ #category : 'accessing' } +{ #category : #accessing } GtMethodCoderSaveDisabled >> preventors [ ^ preventors ] -{ #category : 'accessing' } +{ #category : #accessing } GtMethodCoderSaveDisabled >> preventors: anObject [ preventors := anObject ] -{ #category : 'evaluating' } +{ #category : #evaluating } GtMethodCoderSaveDisabled >> value [ ^ false ] diff --git a/src/GToolkit-Coder-UI/GtMethodCoderSaveEnabled.class.st b/src/GToolkit-Coder-UI/GtMethodCoderSaveEnabled.class.st index 9245baaa0..043e809f2 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderSaveEnabled.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderSaveEnabled.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtMethodCoderSaveEnabled', - #superclass : 'GtMethodCoderSaveAbilityChanged', + #name : #GtMethodCoderSaveEnabled, + #superclass : #GtMethodCoderSaveAbilityChanged, #category : 'GToolkit-Coder-UI-Coder - Method Events' } -{ #category : 'evaluating' } +{ #category : #evaluating } GtMethodCoderSaveEnabled >> value [ ^ true ] diff --git a/src/GToolkit-Coder-UI/GtMethodCoderTool.class.st b/src/GToolkit-Coder-UI/GtMethodCoderTool.class.st index f8d5a91b9..31b17c2d0 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderTool.class.st @@ -1,33 +1,33 @@ Class { - #name : 'GtMethodCoderTool', - #superclass : 'GtCoderTool', + #name : #GtMethodCoderTool, + #superclass : #GtCoderTool, #instVars : [ 'compiledMethod' ], #category : 'GToolkit-Coder-UI-Tools' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtMethodCoderTool class >> compiledMethod: aMethod [ ^ self new compiledMethod: aMethod ] -{ #category : 'accessing' } +{ #category : #accessing } GtMethodCoderTool >> compiledMethod [ ^ compiledMethod ] -{ #category : 'accessing' } +{ #category : #accessing } GtMethodCoderTool >> compiledMethod: anObject [ compiledMethod := anObject ] -{ #category : 'converting' } +{ #category : #converting } GtMethodCoderTool >> newCoder [ ^ GtCoder forMethod: self compiledMethod ] -{ #category : 'accessing' } +{ #category : #accessing } GtMethodCoderTool >> object [ "compatibility method for ${GLMBlocObjectToSelect}$" ^ self compiledMethod diff --git a/src/GToolkit-Coder-UI/GtMultipleCodersViewModel.class.st b/src/GToolkit-Coder-UI/GtMultipleCodersViewModel.class.st index 825513fb0..8b18e6f5a 100644 --- a/src/GToolkit-Coder-UI/GtMultipleCodersViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtMultipleCodersViewModel.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtMultipleCodersViewModel', - #superclass : 'Object', + #name : #GtMultipleCodersViewModel, + #superclass : #Object, #instVars : [ 'coder', 'coderUIModels' @@ -8,7 +8,7 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'accessing' } +{ #category : #accessing } GtMultipleCodersViewModel >> announcer [ self deprecated: 'Use #coder announcer instead.' @@ -17,42 +17,42 @@ GtMultipleCodersViewModel >> announcer [ ^ self coder announcer ] -{ #category : 'converting' } +{ #category : #converting } GtMultipleCodersViewModel >> asCoderUIModel [ ^ self ] -{ #category : 'converting' } +{ #category : #converting } GtMultipleCodersViewModel >> asElement [ ^ self elementClass new codersUIModel: self; yourself ] -{ #category : 'accessing' } +{ #category : #accessing } GtMultipleCodersViewModel >> coder [ ^ coder ] -{ #category : 'accessing' } +{ #category : #accessing } GtMultipleCodersViewModel >> coder: aGtCodersModel [ coder := aGtCodersModel. self updateCoderUIModels ] -{ #category : 'updating' } +{ #category : #updating } GtMultipleCodersViewModel >> coderUIModelFor: aCoder [ ^ aCoder asCoderUIModel ] -{ #category : 'accessing' } +{ #category : #accessing } GtMultipleCodersViewModel >> coderUIModels [ ^ coderUIModels ] -{ #category : 'accessing' } +{ #category : #accessing } GtMultipleCodersViewModel >> coders [ @@ -63,7 +63,7 @@ GtMultipleCodersViewModel >> coders [ ^ coder ] -{ #category : 'accessing' } +{ #category : #accessing } GtMultipleCodersViewModel >> coders: aGtCodersModel [ self deprecated: 'Please use coder: instead.' @@ -74,19 +74,19 @@ GtMultipleCodersViewModel >> coders: aGtCodersModel [ self coder: aGtCodersModel ] -{ #category : 'accessing' } +{ #category : #accessing } GtMultipleCodersViewModel >> elementClass [ ^ self subclassResponsibility ] -{ #category : 'initialization' } +{ #category : #initialization } GtMultipleCodersViewModel >> initialize [ super initialize. coderUIModels := #() ] -{ #category : 'updating' } +{ #category : #updating } GtMultipleCodersViewModel >> updateCoderUIModels [ | aMappingOfCoderToCoderUI | diff --git a/src/GToolkit-Coder-UI/GtPackageCardElement.class.st b/src/GToolkit-Coder-UI/GtPackageCardElement.class.st index b661591b3..1542c96f0 100644 --- a/src/GToolkit-Coder-UI/GtPackageCardElement.class.st +++ b/src/GToolkit-Coder-UI/GtPackageCardElement.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtPackageCardElement', - #superclass : 'GtCoderCardElement', + #name : #GtPackageCardElement, + #superclass : #GtCoderCardElement, #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'building ui' } +{ #category : #'building ui' } GtPackageCardElement >> detailsLabel [ | extensionMethodsCount | extensionMethodsCount := self extensionMethodsCount. @@ -15,7 +15,7 @@ GtPackageCardElement >> detailsLabel [ ifFalse: [ '' ]) ] -{ #category : 'building ui' } +{ #category : #'building ui' } GtPackageCardElement >> extensionMethodsCount [ | count | count := 0. diff --git a/src/GToolkit-Coder-UI/GtPackageCoderPackageNameId.class.st b/src/GToolkit-Coder-UI/GtPackageCoderPackageNameId.class.st index 9b8a027fb..a8fd5fd30 100644 --- a/src/GToolkit-Coder-UI/GtPackageCoderPackageNameId.class.st +++ b/src/GToolkit-Coder-UI/GtPackageCoderPackageNameId.class.st @@ -4,12 +4,12 @@ An editable label with package name " Class { - #name : 'GtPackageCoderPackageNameId', - #superclass : 'GtCoderElementId', + #name : #GtPackageCoderPackageNameId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtPackageCoderPackageNameId >> asSymbol [ ^ #'package-coder--package-name-editor' ] diff --git a/src/GToolkit-Coder-UI/GtPackageCoderTool.class.st b/src/GToolkit-Coder-UI/GtPackageCoderTool.class.st index 50cbbdca1..cfaa37b26 100644 --- a/src/GToolkit-Coder-UI/GtPackageCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtPackageCoderTool.class.st @@ -1,34 +1,34 @@ Class { - #name : 'GtPackageCoderTool', - #superclass : 'GtCoderTool', + #name : #GtPackageCoderTool, + #superclass : #GtCoderTool, #instVars : [ 'package' ], #category : 'GToolkit-Coder-UI-Tools' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtPackageCoderTool class >> package: aPackage [ ^ self new package: aPackage ] -{ #category : 'converting' } +{ #category : #converting } GtPackageCoderTool >> newCoder [ ^ GtCoder forPackage: self package ] -{ #category : 'accessing' } +{ #category : #accessing } GtPackageCoderTool >> object [ "compatibility method for ${GLMBlocObjectToSelect}$" ^ self package ] -{ #category : 'accessing' } +{ #category : #accessing } GtPackageCoderTool >> package [ ^ package ] -{ #category : 'accessing' } +{ #category : #accessing } GtPackageCoderTool >> package: aPackage [ package := aPackage ] diff --git a/src/GToolkit-Coder-UI/GtPackageCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtPackageCoderViewModel.class.st index 2340a83fd..88ef267a5 100644 --- a/src/GToolkit-Coder-UI/GtPackageCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtPackageCoderViewModel.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtPackageCoderViewModel', - #superclass : 'GtSingleCoderViewModel', + #name : #GtPackageCoderViewModel, + #superclass : #GtSingleCoderViewModel, #category : 'GToolkit-Coder-UI-Coder - Package Model' } diff --git a/src/GToolkit-Coder-UI/GtPackageTagCardElement.class.st b/src/GToolkit-Coder-UI/GtPackageTagCardElement.class.st index 687dacde1..9222d0409 100644 --- a/src/GToolkit-Coder-UI/GtPackageTagCardElement.class.st +++ b/src/GToolkit-Coder-UI/GtPackageTagCardElement.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtPackageTagCardElement', - #superclass : 'GtCoderCardElement', + #name : #GtPackageTagCardElement, + #superclass : #GtCoderCardElement, #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'building ui' } +{ #category : #'building ui' } GtPackageTagCardElement >> detailsLabel [ ^ coder packageTag classes size printString , ' Classes' ] diff --git a/src/GToolkit-Coder-UI/GtPackagesCoderElement.class.st b/src/GToolkit-Coder-UI/GtPackagesCoderElement.class.st index 510d90656..a9a39a4ab 100644 --- a/src/GToolkit-Coder-UI/GtPackagesCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtPackagesCoderElement.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtPackagesCoderElement', - #superclass : 'BlElement', + #name : #GtPackagesCoderElement, + #superclass : #BlElement, #instVars : [ 'packagesCoder', 'contentPane' @@ -8,7 +8,7 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Packages' } -{ #category : 'private - ui' } +{ #category : #'private - ui' } GtPackagesCoderElement >> buildContentPane [ contentPane := BlElement new. contentPane layout: BlLinearLayout horizontal. @@ -20,7 +20,7 @@ GtPackagesCoderElement >> buildContentPane [ ^ contentPane ] -{ #category : 'private - ui' } +{ #category : #'private - ui' } GtPackagesCoderElement >> buildPackageList [ ^ BrSimpleList new itemStencil: [ GtPackageCardElement new ]; @@ -32,7 +32,7 @@ GtPackagesCoderElement >> buildPackageList [ addEventFilterOn: BlClickEvent do: [ :anEvent | self requestFocus ] ] -{ #category : 'private - ui' } +{ #category : #'private - ui' } GtPackagesCoderElement >> buildPackagesElement [ | element | element := BlElement new. @@ -61,7 +61,7 @@ GtPackagesCoderElement >> buildPackagesElement [ ^ element ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtPackagesCoderElement >> coders: aPackagesCoder [ | coderElement | @@ -74,7 +74,7 @@ GtPackagesCoderElement >> coders: aPackagesCoder [ addChild: coderElement as: #coder. ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtPackagesCoderElement >> codersUIModel: aPackagesCoder [ | coderElement | @@ -87,7 +87,7 @@ GtPackagesCoderElement >> codersUIModel: aPackagesCoder [ addChild: coderElement as: #coder. ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtPackagesCoderElement >> initialize [ super initialize. self diff --git a/src/GToolkit-Coder-UI/GtPackagesCoderUIModel.class.st b/src/GToolkit-Coder-UI/GtPackagesCoderUIModel.class.st index e8ce72f9d..9c26d3c71 100644 --- a/src/GToolkit-Coder-UI/GtPackagesCoderUIModel.class.st +++ b/src/GToolkit-Coder-UI/GtPackagesCoderUIModel.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtPackagesCoderUIModel', - #superclass : 'GtMultipleCodersViewModel', + #name : #GtPackagesCoderUIModel, + #superclass : #GtMultipleCodersViewModel, #category : 'GToolkit-Coder-UI-Coder - Packages Model' } -{ #category : 'accessing' } +{ #category : #accessing } GtPackagesCoderUIModel >> elementClass [ ^ GtPackagesCoderElement ] diff --git a/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st b/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st index 4c456c810..bdc69db3c 100644 --- a/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtPlaygroundEvaluatedCodeButtonAttribute', - #superclass : 'BrTextAdornmentAttribute', + #name : #GtPlaygroundEvaluatedCodeButtonAttribute, + #superclass : #BrTextAdornmentAttribute, #instVars : [ 'result', 'action', @@ -9,17 +9,17 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Source Attributes' } -{ #category : 'accessing' } +{ #category : #accessing } GtPlaygroundEvaluatedCodeButtonAttribute >> action [ ^ action ] -{ #category : 'accessing' } +{ #category : #accessing } GtPlaygroundEvaluatedCodeButtonAttribute >> action: aBlock [ action := aBlock ] -{ #category : 'initialization' } +{ #category : #initialization } GtPlaygroundEvaluatedCodeButtonAttribute >> affect: aTBrTextEditorTextualPiece in: anEditorElement [ | aButton | @@ -55,22 +55,22 @@ GtPlaygroundEvaluatedCodeButtonAttribute >> affect: aTBrTextEditorTextualPiece i yourself ] -{ #category : 'event handling' } +{ #category : #'event handling' } GtPlaygroundEvaluatedCodeButtonAttribute >> clickEvent: anEvent from: aButton [ self action cull: aButton cull: anEvent ] -{ #category : 'accessing' } +{ #category : #accessing } GtPlaygroundEvaluatedCodeButtonAttribute >> coder [ ^ coder ] -{ #category : 'accessing' } +{ #category : #accessing } GtPlaygroundEvaluatedCodeButtonAttribute >> coder: anObject [ coder := anObject ] -{ #category : 'initialization' } +{ #category : #initialization } GtPlaygroundEvaluatedCodeButtonAttribute >> initialize [ super initialize. self beAppend. @@ -80,22 +80,22 @@ GtPlaygroundEvaluatedCodeButtonAttribute >> initialize [ withDestination: self spawnDestination ] ] -{ #category : 'testing' } +{ #category : #testing } GtPlaygroundEvaluatedCodeButtonAttribute >> mayHaveExternalReferences [ ^ true ] -{ #category : 'accessing' } +{ #category : #accessing } GtPlaygroundEvaluatedCodeButtonAttribute >> result [ ^ result ] -{ #category : 'accessing' } +{ #category : #accessing } GtPlaygroundEvaluatedCodeButtonAttribute >> result: anObject [ result := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtPlaygroundEvaluatedCodeButtonAttribute >> spawnDestination [ ^ self coder ifNil: [ GtPhlowSpawnDesiredDestination defaultDestination ] diff --git a/src/GToolkit-Coder-UI/GtPreviewChangeButton.class.st b/src/GToolkit-Coder-UI/GtPreviewChangeButton.class.st index 8a75841f1..f81c75b18 100644 --- a/src/GToolkit-Coder-UI/GtPreviewChangeButton.class.st +++ b/src/GToolkit-Coder-UI/GtPreviewChangeButton.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtPreviewChangeButton', - #superclass : 'BrButton', + #name : #GtPreviewChangeButton, + #superclass : #BrButton, #instVars : [ 'changeAction', 'changeStencil' @@ -8,7 +8,7 @@ Class { #category : 'GToolkit-Coder-UI-Basic' } -{ #category : 'ui' } +{ #category : #ui } GtPreviewChangeButton >> buildDropDownElement [ | element unloadButton | element := BrVerticalPane new @@ -36,27 +36,27 @@ GtPreviewChangeButton >> buildDropDownElement [ ^ element ] -{ #category : 'accessing' } +{ #category : #accessing } GtPreviewChangeButton >> changeAction [ ^ changeAction ] -{ #category : 'accessing' } +{ #category : #accessing } GtPreviewChangeButton >> changeAction: aBlock [ changeAction := aBlock ] -{ #category : 'accessing' } +{ #category : #accessing } GtPreviewChangeButton >> changeStencil [ ^ changeStencil ] -{ #category : 'accessing' } +{ #category : #accessing } GtPreviewChangeButton >> changeStencil: aStencil [ changeStencil := aStencil asStencil ] -{ #category : 'ui' } +{ #category : #ui } GtPreviewChangeButton >> initialize [ super initialize. diff --git a/src/GToolkit-Coder-UI/GtRBAddPoolVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/GtRBAddPoolVariableRefactoring.extension.st index acb8c6364..b96c948fc 100644 --- a/src/GToolkit-Coder-UI/GtRBAddPoolVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/GtRBAddPoolVariableRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'GtRBAddPoolVariableRefactoring' } +Extension { #name : #GtRBAddPoolVariableRefactoring } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtRBAddPoolVariableRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/GtRBAddTraitUsageRefactoring.extension.st b/src/GToolkit-Coder-UI/GtRBAddTraitUsageRefactoring.extension.st index e4955350b..e382afddd 100644 --- a/src/GToolkit-Coder-UI/GtRBAddTraitUsageRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/GtRBAddTraitUsageRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'GtRBAddTraitUsageRefactoring' } +Extension { #name : #GtRBAddTraitUsageRefactoring } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtRBAddTraitUsageRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/GtRBChangeSuperclassRefactoring.extension.st b/src/GToolkit-Coder-UI/GtRBChangeSuperclassRefactoring.extension.st index f8e47f96a..09f61b996 100644 --- a/src/GToolkit-Coder-UI/GtRBChangeSuperclassRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/GtRBChangeSuperclassRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'GtRBChangeSuperclassRefactoring' } +Extension { #name : #GtRBChangeSuperclassRefactoring } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtRBChangeSuperclassRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/GtRBRemovePoolVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/GtRBRemovePoolVariableRefactoring.extension.st index 4d065f953..c4b8628ad 100644 --- a/src/GToolkit-Coder-UI/GtRBRemovePoolVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/GtRBRemovePoolVariableRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'GtRBRemovePoolVariableRefactoring' } +Extension { #name : #GtRBRemovePoolVariableRefactoring } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtRBRemovePoolVariableRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/GtRBRemoveTraitUsageRefactoring.extension.st b/src/GToolkit-Coder-UI/GtRBRemoveTraitUsageRefactoring.extension.st index 29f986d53..c52704dd8 100644 --- a/src/GToolkit-Coder-UI/GtRBRemoveTraitUsageRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/GtRBRemoveTraitUsageRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'GtRBRemoveTraitUsageRefactoring' } +Extension { #name : #GtRBRemoveTraitUsageRefactoring } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtRBRemoveTraitUsageRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/GtReadyCoderTool.class.st b/src/GToolkit-Coder-UI/GtReadyCoderTool.class.st index bf85f7c01..ac71d2f72 100644 --- a/src/GToolkit-Coder-UI/GtReadyCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtReadyCoderTool.class.st @@ -1,25 +1,25 @@ Class { - #name : 'GtReadyCoderTool', - #superclass : 'GtPhlowTool', + #name : #GtReadyCoderTool, + #superclass : #GtPhlowTool, #instVars : [ 'coder' ], #category : 'GToolkit-Coder-UI-Tools' } -{ #category : 'accessing' } +{ #category : #accessing } GtReadyCoderTool class >> coder: aCoder [ ^ self new coder: aCoder ] -{ #category : 'converting' } +{ #category : #converting } GtReadyCoderTool >> asElementDo: aOneArgBlock [ "Create a tool element and execute the block." ^ aOneArgBlock cull: (GtCoder forCoder: self coder) asPagerPageElement ] -{ #category : 'accessing' } +{ #category : #accessing } GtReadyCoderTool >> assertCoder: aCoder [ self assert: [ aCoder isNotNil ] @@ -29,28 +29,28 @@ GtReadyCoderTool >> assertCoder: aCoder [ description: [ 'Coder cannot be an element because it may be added to a space graph several times' ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtReadyCoderTool >> coder [ ^ coder ] -{ #category : 'accessing' } +{ #category : #accessing } GtReadyCoderTool >> coder: aCoder [ self assertCoder: aCoder. coder := aCoder ] -{ #category : 'api - converting' } +{ #category : #'api - converting' } GtReadyCoderTool >> icon [ ^ BrGlamorousVectorIcons browse ] -{ #category : 'api - accessing' } +{ #category : #'api - accessing' } GtReadyCoderTool >> name [ ^ 'coder' ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtReadyCoderTool >> tabLook [ ^ BrGlamorousTabSwitcherWithIconAptitude ] diff --git a/src/GToolkit-Coder-UI/GtRefactoringsPreviewAcceptId.class.st b/src/GToolkit-Coder-UI/GtRefactoringsPreviewAcceptId.class.st index 238fde373..59d8faa1d 100644 --- a/src/GToolkit-Coder-UI/GtRefactoringsPreviewAcceptId.class.st +++ b/src/GToolkit-Coder-UI/GtRefactoringsPreviewAcceptId.class.st @@ -4,12 +4,12 @@ A button to apply refactorings from a preview dropdown " Class { - #name : 'GtRefactoringsPreviewAcceptId', - #superclass : 'GtCoderElementId', + #name : #GtRefactoringsPreviewAcceptId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtRefactoringsPreviewAcceptId >> asSymbol [ ^ #'refactorings-preview--accept' ] diff --git a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st index 15d456983..d1ab1d432 100644 --- a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st @@ -5,8 +5,8 @@ Wraps {{gtClass:GtCoderModel}} and optionally adds UI related api and state. Cod " Class { - #name : 'GtSingleCoderViewModel', - #superclass : 'Object', + #name : #GtSingleCoderViewModel, + #superclass : #Object, #traits : 'TGtAnnouncer + TGtWithCoderModel', #classTraits : 'TGtAnnouncer classTrait + TGtWithCoderModel classTrait', #instVars : [ @@ -16,64 +16,64 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'accessing' } +{ #category : #accessing } GtSingleCoderViewModel >> announcer [ ^ announcer ifNil: [ announcer := Announcer new ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtSingleCoderViewModel >> announcerUIModel [ ^ self announcer ] -{ #category : 'converting' } +{ #category : #converting } GtSingleCoderViewModel >> asCoderUIModel [ ^ self ] -{ #category : 'converting' } +{ #category : #converting } GtSingleCoderViewModel >> asElement [ ^ self elementClass new coderUIModel: self; yourself ] -{ #category : 'accessing' } +{ #category : #accessing } GtSingleCoderViewModel >> coder [ ^ self coderModel ] -{ #category : 'accessing' } +{ #category : #accessing } GtSingleCoderViewModel >> coder: anObject [ self coderModel: anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtSingleCoderViewModel >> coderLook [ ^ self coder coderLook ] -{ #category : 'accessing' } +{ #category : #accessing } GtSingleCoderViewModel >> coders [ ^ self coder coders ] -{ #category : 'accessing' } +{ #category : #accessing } GtSingleCoderViewModel >> codersUIModel [ ^ codersUIModel ] -{ #category : 'accessing' } +{ #category : #accessing } GtSingleCoderViewModel >> codersUIModel: anObject [ codersUIModel := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtSingleCoderViewModel >> elementClass [ ^ self subclassResponsibility ] -{ #category : 'gt-extension' } +{ #category : #'gt-extension' } GtSingleCoderViewModel >> gtLiveFor: aView [ @@ -84,7 +84,7 @@ GtSingleCoderViewModel >> gtLiveFor: aView [ view: #gtLiveFor: ] -{ #category : 'accessing' } +{ #category : #accessing } GtSingleCoderViewModel >> hasFocus [ self @@ -94,7 +94,7 @@ GtSingleCoderViewModel >> hasFocus [ ^ self focused ] -{ #category : 'accessing' } +{ #category : #accessing } GtSingleCoderViewModel >> hasFocus: aBoolean [ self deprecated: 'Please use #focused: instead.' @@ -105,17 +105,17 @@ GtSingleCoderViewModel >> hasFocus: aBoolean [ self focused: aBoolean ] -{ #category : 'testing' } +{ #category : #testing } GtSingleCoderViewModel >> isModified [ ^ self coder isModified ] -{ #category : 'api - coder model' } +{ #category : #'api - coder model' } GtSingleCoderViewModel >> onCoderModelChanged [ "Is sent when a new coder model is assigned to the view model" ] -{ #category : 'accessing' } +{ #category : #accessing } GtSingleCoderViewModel >> programCounterRange [ "This is workwound util the method coder context had a dedicated element. Now the element for displaying a coder is shared between all types of coders." diff --git a/src/GToolkit-Coder-UI/GtSourceCoderAptitude.class.st b/src/GToolkit-Coder-UI/GtSourceCoderAptitude.class.st index fb736b5fe..7e976497c 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderAptitude.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtSourceCoderAptitude', - #superclass : 'BrAptitude', + #name : #GtSourceCoderAptitude, + #superclass : #BrAptitude, #category : 'GToolkit-Coder-UI-Coder - Source Look' } -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtSourceCoderAptitude >> coder [ self deprecated: 'Please use #sourceCoderUIModel instead' @@ -13,7 +13,7 @@ GtSourceCoderAptitude >> coder [ ^ self sourceCoderUIModel ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderAptitude >> initializeListeners [ super initializeListeners. @@ -22,18 +22,18 @@ GtSourceCoderAptitude >> initializeListeners [ ifNotNil: [ :aSourceCoder | self onCoderChanged: aSourceCoder ] ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderAptitude >> initializeRequests [ super initializeRequests. self request: GtSourceCoderContentCoderRequest new ] -{ #category : 'hooks' } +{ #category : #hooks } GtSourceCoderAptitude >> onCoderChanged: aGtSourceCoder [ ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtSourceCoderAptitude >> sourceCoderUIModel [ diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbAction.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbAction.class.st index d8a04fc9a..e35501f0f 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbAction.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbAction.class.st @@ -1,22 +1,22 @@ Class { - #name : 'GtSourceCoderBreadcrumbAction', - #superclass : 'Object', + #name : #GtSourceCoderBreadcrumbAction, + #superclass : #Object, #category : 'GToolkit-Coder-UI-Coder - Source Model' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderBreadcrumbAction >> foreground [ ^ BrGlamorousColors defaultButtonTextColor ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderBreadcrumbAction >> name [ ^ self subclassResponsibility ] -{ #category : 'action' } +{ #category : #action } GtSourceCoderBreadcrumbAction >> performSourceCoderActionFrom: anElement [ self subclassResponsibility ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbSpawnBehaviorAction.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbSpawnBehaviorAction.class.st index 90fd336b5..3c2b3d555 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbSpawnBehaviorAction.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbSpawnBehaviorAction.class.st @@ -1,30 +1,30 @@ Class { - #name : 'GtSourceCoderBreadcrumbSpawnBehaviorAction', - #superclass : 'GtSourceCoderBreadcrumbAction', + #name : #GtSourceCoderBreadcrumbSpawnBehaviorAction, + #superclass : #GtSourceCoderBreadcrumbAction, #instVars : [ 'methodBehavior' ], #category : 'GToolkit-Coder-UI-Coder - Source Model' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderBreadcrumbSpawnBehaviorAction >> foreground [ ^ self methodBehavior exists ifTrue: [ BrGlamorousColors defaultButtonTextColor ] ifFalse: [ BrGlamorousColors linkWithErrorColor ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderBreadcrumbSpawnBehaviorAction >> methodBehavior [ ^ methodBehavior ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderBreadcrumbSpawnBehaviorAction >> methodBehavior: anObject [ methodBehavior := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderBreadcrumbSpawnBehaviorAction >> name [ @@ -36,7 +36,7 @@ GtSourceCoderBreadcrumbSpawnBehaviorAction >> name [ ifAbsent: [ '(Unspecified)' ] ] -{ #category : 'action' } +{ #category : #action } GtSourceCoderBreadcrumbSpawnBehaviorAction >> performSourceCoderActionFrom: anElement [ self methodBehavior realBehaviorDo: [ :aBehavior | @@ -46,7 +46,7 @@ GtSourceCoderBreadcrumbSpawnBehaviorAction >> performSourceCoderActionFrom: anEl anElement phlow spawnTool: (GtInspectorTool forObject: self methodBehavior). ] -{ #category : 'printing' } +{ #category : #printing } GtSourceCoderBreadcrumbSpawnBehaviorAction >> printOn: aStream [ aStream nextPutAll: 'Spawn '; diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbSpawnPackageAction.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbSpawnPackageAction.class.st index c60509a6e..ce3708db7 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbSpawnPackageAction.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbSpawnPackageAction.class.st @@ -1,25 +1,25 @@ Class { - #name : 'GtSourceCoderBreadcrumbSpawnPackageAction', - #superclass : 'GtSourceCoderBreadcrumbAction', + #name : #GtSourceCoderBreadcrumbSpawnPackageAction, + #superclass : #GtSourceCoderBreadcrumbAction, #instVars : [ 'package' ], #category : 'GToolkit-Coder-UI-Coder - Source Model' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderBreadcrumbSpawnPackageAction >> name [ ^ self package name ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderBreadcrumbSpawnPackageAction >> package [ ^ package ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderBreadcrumbSpawnPackageAction >> package: aPackage [ self assert: [ aPackage notNil ] @@ -28,12 +28,12 @@ GtSourceCoderBreadcrumbSpawnPackageAction >> package: aPackage [ package := aPackage ] -{ #category : 'action' } +{ #category : #action } GtSourceCoderBreadcrumbSpawnPackageAction >> performSourceCoderActionFrom: anElement [ anElement phlow spawnTool: (GtPackageCoderTool package: self package) ] -{ #category : 'printing' } +{ #category : #printing } GtSourceCoderBreadcrumbSpawnPackageAction >> printOn: aStream [ aStream nextPutAll: 'Spawn '; diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBrowseBehaviorShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBrowseBehaviorShortcut.class.st index 598813cc0..0865b9658 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderBrowseBehaviorShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderBrowseBehaviorShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : 'GtSourceCoderBrowseBehaviorShortcut', - #superclass : 'GtSourceCoderShortcut', + #name : #GtSourceCoderBrowseBehaviorShortcut, + #superclass : #GtSourceCoderShortcut, #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderBrowseBehaviorShortcut >> description [ ^ 'Browses behavior (class, method, pool etc) near the cursor or selection.' ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderBrowseBehaviorShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryB ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderBrowseBehaviorShortcut >> name [ ^ 'Browse behavior' ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderBrowseBehaviorShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent [ self diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBrowseImplementorsShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBrowseImplementorsShortcut.class.st index 5d783a67f..07055ec6e 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderBrowseImplementorsShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderBrowseImplementorsShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : 'GtSourceCoderBrowseImplementorsShortcut', - #superclass : 'GtSourceCoderShortcut', + #name : #GtSourceCoderBrowseImplementorsShortcut, + #superclass : #GtSourceCoderShortcut, #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderBrowseImplementorsShortcut >> description [ ^ 'Browses implementors of the method near the cursor or selection.' ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderBrowseImplementorsShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryM ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderBrowseImplementorsShortcut >> name [ ^ 'Browse implementors' ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderBrowseImplementorsShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent [ self forEditor: aBrTextEditor diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBrowseReferencesShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBrowseReferencesShortcut.class.st index 739026dcb..7ebf707d4 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderBrowseReferencesShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderBrowseReferencesShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : 'GtSourceCoderBrowseReferencesShortcut', - #superclass : 'GtSourceCoderShortcut', + #name : #GtSourceCoderBrowseReferencesShortcut, + #superclass : #GtSourceCoderShortcut, #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderBrowseReferencesShortcut >> description [ ^ 'Browses references of the class or sender of the method near the cursor or selection.' ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderBrowseReferencesShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryN ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderBrowseReferencesShortcut >> name [ ^ 'Browse references' ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderBrowseReferencesShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent [ self forEditor: aBrTextEditor diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st index d4e718ee8..cda0c0d36 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtSourceCoderCollapsedContentElement', - #superclass : 'GtSourceCoderContentElement', + #name : #GtSourceCoderCollapsedContentElement, + #superclass : #GtSourceCoderContentElement, #category : 'GToolkit-Coder-UI-Coder - Source' } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAndExampleAptitude.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAndExampleAptitude.class.st index 3e5af1e1f..71441361f 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAndExampleAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAndExampleAptitude.class.st @@ -12,8 +12,8 @@ If a method is ** an example, I omit displaying the example result: {{gtExample: " Class { - #name : 'GtSourceCoderCollapsedTextAndExampleAptitude', - #superclass : 'GtSourceCoderAptitude', + #name : #GtSourceCoderCollapsedTextAndExampleAptitude, + #superclass : #GtSourceCoderAptitude, #instVars : [ 'container', 'methodLabel', @@ -22,24 +22,24 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Source Look' } -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtSourceCoderCollapsedTextAndExampleAptitude >> container [ ^ container ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtSourceCoderCollapsedTextAndExampleAptitude >> exampleElement [ ^ exampleElement ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtSourceCoderCollapsedTextAndExampleAptitude >> hide [ self exampleElement visibility: BlVisibility hidden ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderCollapsedTextAndExampleAptitude >> initialize [ super initialize. self initializeMethodLabel. @@ -53,20 +53,20 @@ GtSourceCoderCollapsedTextAndExampleAptitude >> initialize [ self addChangeAddChildAs: #(content label) with: [ self container ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderCollapsedTextAndExampleAptitude >> initializeContainer [ container := BrHorizontalPane new fitContent; alignCenterLeft ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderCollapsedTextAndExampleAptitude >> initializeExampleElement [ exampleElement := GtCoderExampleStateElement new margin: (BlInsets top: 4 left: 1 bottom: 1 right: 1). ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderCollapsedTextAndExampleAptitude >> initializeListeners [ super initializeListeners. @@ -77,19 +77,19 @@ GtSourceCoderCollapsedTextAndExampleAptitude >> initializeListeners [ focused: true ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderCollapsedTextAndExampleAptitude >> initializeMethodLabel [ methodLabel := BrLabel new aptitude: BrGlamorousLabelAptitude new editorMeasurement bold glamorousCodeFont ] -{ #category : 'private - accessing' } +{ #category : #'private - accessing' } GtSourceCoderCollapsedTextAndExampleAptitude >> methodLabel [ ^ methodLabel ] -{ #category : 'hooks' } +{ #category : #hooks } GtSourceCoderCollapsedTextAndExampleAptitude >> onCoderChanged: aGtSourceCoderUIModel [ self widget coderUIModel ifNotNil: [ :aPreviousCoder | aPreviousCoder coder announcer unsubscribe: self ]. @@ -104,22 +104,22 @@ GtSourceCoderCollapsedTextAndExampleAptitude >> onCoderChanged: aGtSourceCoderUI to: self ] -{ #category : 'private - announcement handling' } +{ #category : #'private - announcement handling' } GtSourceCoderCollapsedTextAndExampleAptitude >> onCollapsedLabelChanged: anAnnouncement [ self updateLabelsFor: anAnnouncement coder ] -{ #category : 'private - announcement handling' } +{ #category : #'private - announcement handling' } GtSourceCoderCollapsedTextAndExampleAptitude >> onExampleExecuted: anAnnouncement [ self updateExampleElementFor: anAnnouncement coder ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtSourceCoderCollapsedTextAndExampleAptitude >> show [ self exampleElement visibility: BlVisibility visible ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtSourceCoderCollapsedTextAndExampleAptitude >> updateExampleElementFor: aSourceCoder [ aSourceCoder canExecuteExample ifFalse: [ self hide. @@ -129,13 +129,13 @@ GtSourceCoderCollapsedTextAndExampleAptitude >> updateExampleElementFor: aSource self exampleElement example: aSourceCoder example ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtSourceCoderCollapsedTextAndExampleAptitude >> updateLabelsFor: aSourceCoder [ self updateMethodLabelFor: aSourceCoder. self updateExampleElementFor: aSourceCoder. ] -{ #category : 'private - updating' } +{ #category : #'private - updating' } GtSourceCoderCollapsedTextAndExampleAptitude >> updateMethodLabelFor: aSourceCoder [ self methodLabel text: aSourceCoder collapsedText ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAptitude.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAptitude.class.st index 058be9f4f..56a1594fb 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAptitude.class.st @@ -1,13 +1,13 @@ Class { - #name : 'GtSourceCoderCollapsedTextAptitude', - #superclass : 'GtSourceCoderAptitude', + #name : #GtSourceCoderCollapsedTextAptitude, + #superclass : #GtSourceCoderAptitude, #instVars : [ 'label' ], #category : 'GToolkit-Coder-UI-Coder - Source Look' } -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderCollapsedTextAptitude >> initialize [ super initialize. @@ -15,7 +15,7 @@ GtSourceCoderCollapsedTextAptitude >> initialize [ self addChangeAddChildAs: { #content . GtSourceCoderCollapsedTextId } with: [ label ]. ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderCollapsedTextAptitude >> initializeListeners [ super initializeListeners. @@ -26,13 +26,13 @@ GtSourceCoderCollapsedTextAptitude >> initializeListeners [ focused: true ] ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtSourceCoderCollapsedTextAptitude >> newLabel [ ^ BrLabel new aptitude: BrGlamorousLabelAptitude new editorMeasurement bold glamorousCodeFont ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderCollapsedTextAptitude >> onCoderChanged: aGtSourceCoderUIModel [ self widget coderUIModel ifNotNil: [ :aPreviousCoder | aPreviousCoder coder announcer unsubscribe: self ]. @@ -43,12 +43,12 @@ GtSourceCoderCollapsedTextAptitude >> onCoderChanged: aGtSourceCoderUIModel [ to: self ] -{ #category : 'private' } +{ #category : #private } GtSourceCoderCollapsedTextAptitude >> updateLabel: anAnnouncement [ self updateLabelFor: anAnnouncement coder ] -{ #category : 'private' } +{ #category : #private } GtSourceCoderCollapsedTextAptitude >> updateLabelFor: aSourceCoder [ label text: aSourceCoder collapsedText ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextId.class.st index ca1fac794..787a7450e 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextId.class.st @@ -4,12 +4,12 @@ A label that shows a collapsed text of the source coder " Class { - #name : 'GtSourceCoderCollapsedTextId', - #superclass : 'GtCoderElementId', + #name : #GtSourceCoderCollapsedTextId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtSourceCoderCollapsedTextId >> asSymbol [ ^ 'source-coder--collapsed-text' ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderContentCoderChanged.class.st b/src/GToolkit-Coder-UI/GtSourceCoderContentCoderChanged.class.st index c771f5621..b2c0ddcf9 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderContentCoderChanged.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderContentCoderChanged.class.st @@ -1,18 +1,18 @@ Class { - #name : 'GtSourceCoderContentCoderChanged', - #superclass : 'BrChangeEvent', + #name : #GtSourceCoderContentCoderChanged, + #superclass : #BrChangeEvent, #instVars : [ 'sourceCoder' ], #category : 'GToolkit-Coder-UI-Coder - Source Events' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderContentCoderChanged >> sourceCoder [ ^ sourceCoder ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderContentCoderChanged >> sourceCoder: anObject [ sourceCoder := anObject ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderContentCoderRequest.class.st b/src/GToolkit-Coder-UI/GtSourceCoderContentCoderRequest.class.st index 486e2c629..158fc6092 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderContentCoderRequest.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderContentCoderRequest.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtSourceCoderContentCoderRequest', - #superclass : 'BrRequest', + #name : #GtSourceCoderContentCoderRequest, + #superclass : #BrRequest, #category : 'GToolkit-Coder-UI-Coder - Source Events' } -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderContentCoderRequest >> responseClass [ ^ GtSourceCoderContentCoderChanged ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st index 87866461c..a1ce2405d 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st @@ -1,12 +1,12 @@ Class { - #name : 'GtSourceCoderContentElement', - #superclass : 'BlElement', + #name : #GtSourceCoderContentElement, + #superclass : #BlElement, #traits : 'TBrLayoutResizable', #classTraits : 'TBrLayoutResizable classTrait', #category : 'GToolkit-Coder-UI-Coder - Source' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderContentElement >> coder [ self deprecated: 'Use #coderUIModel instead.' @@ -15,7 +15,7 @@ GtSourceCoderContentElement >> coder [ ^ self coderUIModel ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderContentElement >> coder: aCoder [ self @@ -25,14 +25,14 @@ GtSourceCoderContentElement >> coder: aCoder [ self coderUIModel: aCoder ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderContentElement >> coderUIModel [ ^ self viewModel sourceCoder ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderContentElement >> coderUIModel: aGtSourceCoderUIModel [ self telemetry @@ -40,7 +40,7 @@ GtSourceCoderContentElement >> coderUIModel: aGtSourceCoderUIModel [ during: [ self viewModel sourceCoder: aGtSourceCoderUIModel ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderContentElement >> gtAllShortcutsFor: aView [ self shortcuts ifEmpty: [ ^ aView empty ]. @@ -52,7 +52,7 @@ GtSourceCoderContentElement >> gtAllShortcutsFor: aView [ column: 'Action' text: [ :each | each action asString ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderContentElement >> initialize [ super initialize. self diff --git a/src/GToolkit-Coder-UI/GtSourceCoderContentModel.class.st b/src/GToolkit-Coder-UI/GtSourceCoderContentModel.class.st index 479413d8b..06267a140 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderContentModel.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderContentModel.class.st @@ -1,35 +1,37 @@ Class { - #name : 'GtSourceCoderContentModel', - #superclass : 'BrWidgetModel', + #name : #GtSourceCoderContentModel, + #superclass : #BrWidgetModel, #instVars : [ 'sourceCoder' ], - #category : 'GToolkit-Coder-UI-Coder - Source' + #category : #'GToolkit-Coder-UI-Coder - Source' } -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderContentModel >> initializeListeners [ super initializeListeners. self when: GtSourceCoderContentCoderRequest reply: [ :aResponse | aResponse sourceCoder: self sourceCoder ] ] -{ #category : 'private - notifying' } +{ #category : #'private - notifying' } GtSourceCoderContentModel >> notifySourceCoderChanged: aGtSourceCoderUIModel [ self dispatchEvent: (GtSourceCoderContentCoderChanged new sourceCoder: aGtSourceCoderUIModel) ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderContentModel >> sourceCoder [ ^ sourceCoder ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderContentModel >> sourceCoder: aGtSourceCoderUIModel [ self - assert: [ aGtSourceCoderUIModel isKindOf: GtSourceCoderViewModel ] + assert: [ + (aGtSourceCoderUIModel isKindOf: GtSourceCoderViewModel) + or: [aGtSourceCoderUIModel isKindOf: GtSourceCoderViewModelPromised] ] description: [ 'Should be a Source Coder UI Model' ]. sourceCoder := aGtSourceCoderUIModel. diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDebugActionId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDebugActionId.class.st index 992cf5b6c..0792ab00a 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderDebugActionId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderDebugActionId.class.st @@ -4,12 +4,12 @@ A button to debug a piece of code " Class { - #name : 'GtSourceCoderDebugActionId', - #superclass : 'GtCoderElementId', + #name : #GtSourceCoderDebugActionId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtSourceCoderDebugActionId >> asSymbol [ ^ #'source-coder--debug-action' ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDiscardChangesShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDiscardChangesShortcut.class.st index 6cd905866..98e151ee5 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderDiscardChangesShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderDiscardChangesShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : 'GtSourceCoderDiscardChangesShortcut', - #superclass : 'GtSourceCoderShortcut', + #name : #GtSourceCoderDiscardChangesShortcut, + #superclass : #GtSourceCoderShortcut, #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderDiscardChangesShortcut >> description [ ^ 'Discards changes done to the source code.' ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderDiscardChangesShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryL ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderDiscardChangesShortcut >> name [ ^ 'Discard changes' ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderDiscardChangesShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ aSourceCoderViewModel discardChanges ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDoItActionId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDoItActionId.class.st index a7fd16ded..88cf554d0 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderDoItActionId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderDoItActionId.class.st @@ -4,12 +4,12 @@ A button to evaluate a source code " Class { - #name : 'GtSourceCoderDoItActionId', - #superclass : 'GtCoderElementId', + #name : #GtSourceCoderDoItActionId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtSourceCoderDoItActionId >> asSymbol [ ^ 'source-coder--doit-action' ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDoItAndGoActionId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDoItAndGoActionId.class.st index 1f0f8e1fb..d1fcc813a 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderDoItAndGoActionId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderDoItAndGoActionId.class.st @@ -4,12 +4,12 @@ A button to evaluate and inspect the result " Class { - #name : 'GtSourceCoderDoItAndGoActionId', - #superclass : 'GtCoderElementId', + #name : #GtSourceCoderDoItAndGoActionId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtSourceCoderDoItAndGoActionId >> asSymbol [ ^ #'source-coder--doit-and-go-action' ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectShortcut.class.st index 25c1c5eff..9fe5585b6 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : 'GtSourceCoderDoItAndInspectShortcut', - #superclass : 'GtSourceCoderShortcut', + #name : #GtSourceCoderDoItAndInspectShortcut, + #superclass : #GtSourceCoderShortcut, #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderDoItAndInspectShortcut >> description [ ^ 'Evaluates the whole source code or just the selection and inspects the result.' ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderDoItAndInspectShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryG ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderDoItAndInspectShortcut >> name [ ^ 'Do it and inspect' ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderDoItAndInspectShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ GtCoderExecutionContextVariable element: aBrEditorElement diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDoItShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDoItShortcut.class.st index 01aadb3b2..edfc70fb3 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderDoItShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderDoItShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : 'GtSourceCoderDoItShortcut', - #superclass : 'GtSourceCoderShortcut', + #name : #GtSourceCoderDoItShortcut, + #superclass : #GtSourceCoderShortcut, #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderDoItShortcut >> description [ ^ 'Evaluates the whole source code (method) or just the selection.' ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderDoItShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryD ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderDoItShortcut >> name [ ^ 'Do it' ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderDoItShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ GtCoderExecutionContextVariable element: aBrEditorElement diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEditorAptitude.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEditorAptitude.class.st index fe63c8fe8..2b2d678b0 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEditorAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEditorAptitude.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtSourceCoderEditorAptitude', - #superclass : 'GtSourceCoderAptitude', + #name : #GtSourceCoderEditorAptitude, + #superclass : #GtSourceCoderAptitude, #instVars : [ 'sourceCoderUIModel', 'editorElement', @@ -11,14 +11,14 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Source Look' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEditorAptitude >> editorElement [ ^ editorElement ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderEditorAptitude >> initialize [ super initialize. @@ -31,19 +31,19 @@ GtSourceCoderEditorAptitude >> initialize [ self add: (BrLayoutResizerAptitude new inherit: editorElement) ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtSourceCoderEditorAptitude >> newActionsElement [ ^ GtCoderActionsElement new margin: (BlInsets top: 5); yourself ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtSourceCoderEditorAptitude >> newEditorElement [ ^ GtSourceCoderEditorElement new ] -{ #category : 'hooks' } +{ #category : #hooks } GtSourceCoderEditorAptitude >> onCoderChanged: aGtSourceCoderUIModel [ actions coderUIModel: aGtSourceCoderUIModel. editorElement textualCoderViewModel: aGtSourceCoderUIModel diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st index 744235ca7..c72b0da14 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtSourceCoderEditorElement', - #superclass : 'GtTextualCoderEditorElement', + #name : #GtSourceCoderEditorElement, + #superclass : #GtTextualCoderEditorElement, #category : 'GToolkit-Coder-UI-Coder - Textual' } -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } GtSourceCoderEditorElement >> onTextualCoderViewModelChanged [ super onTextualCoderViewModelChanged. diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEditorId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEditorId.class.st index dd9300106..da201c803 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEditorId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEditorId.class.st @@ -4,12 +4,12 @@ Text editor within the source coder " Class { - #name : 'GtSourceCoderEditorId', - #superclass : 'GtCoderElementId', + #name : #GtSourceCoderEditorId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtSourceCoderEditorId >> asSymbol [ ^ #editor ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEmbeddedExpanderToggleId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEmbeddedExpanderToggleId.class.st index 3c4ee2c79..33398803a 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEmbeddedExpanderToggleId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEmbeddedExpanderToggleId.class.st @@ -2,12 +2,12 @@ An element to toggle an embedded expandable element within the text of the source coder. An examples can be an expandable method or a baseline name. " Class { - #name : 'GtSourceCoderEmbeddedExpanderToggleId', - #superclass : 'GtCoderElementId', + #name : #GtSourceCoderEmbeddedExpanderToggleId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtSourceCoderEmbeddedExpanderToggleId >> asSymbol [ ^ #'source-coder--embedded-expander-toggle' ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st index 18287f433..915e2ce4c 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st @@ -1,13 +1,13 @@ Class { - #name : 'GtSourceCoderErrorAttribute', - #superclass : 'BrTextAdornmentAttribute', + #name : #GtSourceCoderErrorAttribute, + #superclass : #BrTextAdornmentAttribute, #instVars : [ 'string' ], #category : 'GToolkit-Coder-UI-Coder - Source Attributes' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtSourceCoderErrorAttribute class >> for: aString [ ^ self new for: aString; @@ -16,7 +16,7 @@ GtSourceCoderErrorAttribute class >> for: aString [ yourself ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderErrorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ | text | @@ -33,7 +33,7 @@ GtSourceCoderErrorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditor yourself ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtSourceCoderErrorAttribute >> for: aString [ string := aString ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEvaluationHighlighter.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEvaluationHighlighter.class.st index 6d10dc68f..076e87f48 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEvaluationHighlighter.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEvaluationHighlighter.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtSourceCoderEvaluationHighlighter', - #superclass : 'GtSourceCoderEvaluationResultDisplayer', + #name : #GtSourceCoderEvaluationHighlighter, + #superclass : #GtSourceCoderEvaluationResultDisplayer, #category : 'GToolkit-Coder-UI-Coder - Source' } -{ #category : 'private - ui' } +{ #category : #'private - ui' } GtSourceCoderEvaluationHighlighter >> addAttributesFor: anEvaluationResult within: aTextInterval [ | theAttributes | diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEvaluationPrinter.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEvaluationPrinter.class.st index 023388714..997b4cbc1 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEvaluationPrinter.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEvaluationPrinter.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtSourceCoderEvaluationPrinter', - #superclass : 'GtSourceCoderEvaluationResultDisplayer', + #name : #GtSourceCoderEvaluationPrinter, + #superclass : #GtSourceCoderEvaluationResultDisplayer, #category : 'GToolkit-Coder-UI-Coder - Source' } -{ #category : 'private' } +{ #category : #private } GtSourceCoderEvaluationPrinter >> addAttributesFor: anEvaluationResult within: aTextInterval [ | theAttributes | diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEvaluationResultDisplayer.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEvaluationResultDisplayer.class.st index 7aa8bbe16..d008f37fa 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEvaluationResultDisplayer.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEvaluationResultDisplayer.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtSourceCoderEvaluationResultDisplayer', - #superclass : 'Object', + #name : #GtSourceCoderEvaluationResultDisplayer, + #superclass : #Object, #instVars : [ 'editorElement', 'updateRequester', @@ -10,12 +10,12 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Source' } -{ #category : 'private' } +{ #category : #private } GtSourceCoderEvaluationResultDisplayer >> addAttributesFor: anEvaluationResult within: aTextInterval [ self subclassResponsibility ] -{ #category : 'api - evaluation result' } +{ #category : #'api - evaluation result' } GtSourceCoderEvaluationResultDisplayer >> displayResult: anEvaluationResult [ self assert: [ anEvaluationResult notNil ] @@ -27,7 +27,7 @@ GtSourceCoderEvaluationResultDisplayer >> displayResult: anEvaluationResult [ updateRequester requestUpdate ] -{ #category : 'api - evaluation result' } +{ #category : #'api - evaluation result' } GtSourceCoderEvaluationResultDisplayer >> displayResultSynchronously: anEvaluationResult [ self assert: [ anEvaluationResult notNil ] @@ -39,23 +39,23 @@ GtSourceCoderEvaluationResultDisplayer >> displayResultSynchronously: anEvaluati self primitiveUpdateResult ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationResultDisplayer >> editorElement [ ^ editorElement ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationResultDisplayer >> editorElement: anObject [ editorElement := anObject. updateRequester element: editorElement ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationResultDisplayer >> evaluationResult [ ^ evaluationResult ] -{ #category : 'api - evaluation result' } +{ #category : #'api - evaluation result' } GtSourceCoderEvaluationResultDisplayer >> hideResult [ evaluationResult ifNil: [ ^ self ]. @@ -63,7 +63,7 @@ GtSourceCoderEvaluationResultDisplayer >> hideResult [ updateRequester requestUpdate ] -{ #category : 'api - evaluation result' } +{ #category : #'api - evaluation result' } GtSourceCoderEvaluationResultDisplayer >> hideResultSynchronously [ evaluationResult ifNil: [ ^ self ]. @@ -71,7 +71,7 @@ GtSourceCoderEvaluationResultDisplayer >> hideResultSynchronously [ self primitiveUpdateResult ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderEvaluationResultDisplayer >> initialize [ super initialize. @@ -83,7 +83,7 @@ GtSourceCoderEvaluationResultDisplayer >> initialize [ evaluationAttributes := #() ] -{ #category : 'private' } +{ #category : #private } GtSourceCoderEvaluationResultDisplayer >> primitiveAddResult: anEvaluationResult [ | anEvaluatedSource anEvaluatedInterval theSourceStartInText theSourceEndInText | @@ -107,20 +107,20 @@ GtSourceCoderEvaluationResultDisplayer >> primitiveAddResult: anEvaluationResult within: (theSourceStartInText to: theSourceEndInText) ] -{ #category : 'private' } +{ #category : #private } GtSourceCoderEvaluationResultDisplayer >> primitiveRemoveResult [ self text removeAttributes: evaluationAttributes. evaluationAttributes := #() ] -{ #category : 'private' } +{ #category : #private } GtSourceCoderEvaluationResultDisplayer >> primitiveUpdateResult [ self primitiveRemoveResult. evaluationResult ifNotNil: [ :anEvaluationResult | self primitiveAddResult: anEvaluationResult ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderEvaluationResultDisplayer >> text [ ^ self editorElement text ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st index 27a4f53fa..b4a21fe09 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtSourceCoderExpandedContentElement', - #superclass : 'GtSourceCoderContentElement', + #name : #GtSourceCoderExpandedContentElement, + #superclass : #GtSourceCoderContentElement, #category : 'GToolkit-Coder-UI-Coder - Source' } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpanderToggleId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpanderToggleId.class.st index 6c55e9260..91f6e0159 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExpanderToggleId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpanderToggleId.class.st @@ -3,12 +3,12 @@ An element to toggle {{gtClass:BrExpander}}'s state on click. In a context of a Do not confuse with an embedded expander within the text which is usually represented by a triangle. " Class { - #name : 'GtSourceCoderExpanderToggleId', - #superclass : 'GtCoderElementId', + #name : #GtSourceCoderExpanderToggleId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtSourceCoderExpanderToggleId >> asSymbol [ ^ #'source-coder--expander-toggle' ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExtractMethodShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExtractMethodShortcut.class.st index 46a8dc534..87823ed24 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExtractMethodShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExtractMethodShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : 'GtSourceCoderExtractMethodShortcut', - #superclass : 'GtSourceCoderShortcut', + #name : #GtSourceCoderExtractMethodShortcut, + #superclass : #GtSourceCoderShortcut, #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderExtractMethodShortcut >> description [ ^ 'Extracts the selected code into a new method.' ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderExtractMethodShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryE ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderExtractMethodShortcut >> name [ ^ 'Extract method' ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderExtractMethodShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ (GtExtractMethodController new sourceCoderViewModel: aSourceCoderViewModel) execute ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExtractTempVarContextMenuItemId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExtractTempVarContextMenuItemId.class.st index bd0f4a144..9a0862a06 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExtractTempVarContextMenuItemId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExtractTempVarContextMenuItemId.class.st @@ -2,12 +2,12 @@ A context menu action to extract a temporary variable " Class { - #name : 'GtSourceCoderExtractTempVarContextMenuItemId', - #superclass : 'GtCoderElementId', + #name : #GtSourceCoderExtractTempVarContextMenuItemId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtSourceCoderExtractTempVarContextMenuItemId >> asSymbol [ ^ #'context-menu--extract-temp' ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderFocusChanged.class.st b/src/GToolkit-Coder-UI/GtSourceCoderFocusChanged.class.st index 9cec071a1..3615e8c25 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderFocusChanged.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderFocusChanged.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtSourceCoderFocusChanged', - #superclass : 'Announcement', + #name : #GtSourceCoderFocusChanged, + #superclass : #Announcement, #instVars : [ 'source', 'focused' @@ -8,22 +8,22 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Source Events' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderFocusChanged >> focused [ ^ focused ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderFocusChanged >> focused: anObject [ focused := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderFocusChanged >> source [ ^ source ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderFocusChanged >> source: anObject [ source := anObject ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderFormatShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderFormatShortcut.class.st index 816839d5e..1ea942834 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderFormatShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderFormatShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : 'GtSourceCoderFormatShortcut', - #superclass : 'GtSourceCoderShortcut', + #name : #GtSourceCoderFormatShortcut, + #superclass : #GtSourceCoderShortcut, #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderFormatShortcut >> description [ ^ 'Formats and saves the source code.' ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderFormatShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryShiftF ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderFormatShortcut >> name [ ^ 'Format' ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderFormatShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent [ aGtSourceCoder format ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderPlayAndInspectShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderPlayAndInspectShortcut.class.st index f373cd3c3..7040118d6 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderPlayAndInspectShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderPlayAndInspectShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : 'GtSourceCoderPlayAndInspectShortcut', - #superclass : 'GtSourceCoderShortcut', + #name : #GtSourceCoderPlayAndInspectShortcut, + #superclass : #GtSourceCoderShortcut, #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderPlayAndInspectShortcut >> description [ ^ 'Compiles, saves and evaluates the whole source code (method) or just the selection and inspects the result.' ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderPlayAndInspectShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryG ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderPlayAndInspectShortcut >> name [ ^ 'Save, play and inspect' ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderPlayAndInspectShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent [ GtCoderExecutionContextVariable element: aBrEditorElement diff --git a/src/GToolkit-Coder-UI/GtSourceCoderPlayShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderPlayShortcut.class.st index b58e26a00..de6cec80d 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderPlayShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderPlayShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : 'GtSourceCoderPlayShortcut', - #superclass : 'GtSourceCoderShortcut', + #name : #GtSourceCoderPlayShortcut, + #superclass : #GtSourceCoderShortcut, #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderPlayShortcut >> description [ ^ 'Compiles, saves and evaluates the whole source code (method) or just the selection.' ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderPlayShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryD ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderPlayShortcut >> name [ ^ 'Save and play' ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderPlayShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent [ GtCoderExecutionContextVariable element: aBrEditorElement diff --git a/src/GToolkit-Coder-UI/GtSourceCoderPrintItShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderPrintItShortcut.class.st index 7e6522943..6b18b26ce 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderPrintItShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderPrintItShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : 'GtSourceCoderPrintItShortcut', - #superclass : 'GtSourceCoderShortcut', + #name : #GtSourceCoderPrintItShortcut, + #superclass : #GtSourceCoderShortcut, #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderPrintItShortcut >> description [ ^ 'Evaluates the whole source code (method) or just the selection and prints it in the editor.' ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderPrintItShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryP ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderPrintItShortcut >> name [ ^ 'Print' ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderPrintItShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aGtSourceCoderViewModel dueTo: aShortcutEvent [ GtCoderExecutionContextVariable element: aBrEditorElement diff --git a/src/GToolkit-Coder-UI/GtSourceCoderProfileActionId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderProfileActionId.class.st index 5be41e41a..b58273d60 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderProfileActionId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderProfileActionId.class.st @@ -4,12 +4,12 @@ A button to profile a piece of code " Class { - #name : 'GtSourceCoderProfileActionId', - #superclass : 'GtCoderElementId', + #name : #GtSourceCoderProfileActionId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtSourceCoderProfileActionId >> asSymbol [ ^ #'source-coder--profile-action' ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderSaveShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderSaveShortcut.class.st index 0676aae5e..83bbd6b9a 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderSaveShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderSaveShortcut.class.st @@ -1,27 +1,27 @@ Class { - #name : 'GtSourceCoderSaveShortcut', - #superclass : 'GtSourceCoderShortcut', + #name : #GtSourceCoderSaveShortcut, + #superclass : #GtSourceCoderShortcut, #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderSaveShortcut >> description [ ^ 'Apply changes and save the source code (compile).' ] -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderSaveShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryS ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderSaveShortcut >> name [ ^ 'Save' ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderSaveShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ aSourceCoderViewModel save ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderShortcut.class.st index 69994ee62..4133a9ccc 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderShortcut.class.st @@ -1,10 +1,10 @@ Class { - #name : 'GtSourceCoderShortcut', - #superclass : 'BrEditorShortcut', + #name : #GtSourceCoderShortcut, + #superclass : #BrEditorShortcut, #category : 'GToolkit-Coder-UI-Shortcuts' } -{ #category : 'private' } +{ #category : #private } GtSourceCoderShortcut >> forEditor: aBrTextEditor selectedStringDo: aSelectedTextBlock orCursorStringPositionDo: aCursorTextPositionBlock [ aBrTextEditor selectedText ifEmpty: [ aBrTextEditor hasCursors @@ -18,7 +18,7 @@ GtSourceCoderShortcut >> forEditor: aBrTextEditor selectedStringDo: aSelectedTex ifNotEmpty: [ :aSelectedText | aSelectedTextBlock value: aSelectedText asString ] ] -{ #category : 'private' } +{ #category : #private } GtSourceCoderShortcut >> forEditor: aBrTextEditor selectionIntervalDo: aSelectionIntervalBlock orCursorStringPositionDo: aCursorTextPositionBlock [ aBrTextEditor hasSelection ifTrue: [ @@ -36,12 +36,12 @@ GtSourceCoderShortcut >> forEditor: aBrTextEditor selectionIntervalDo: aSelectio aCursorTextPositionBlock value: aTextPosition ] ] ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent [ self subclassResponsibility ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ self performOnEditor: aBrTextEditor @@ -50,13 +50,13 @@ GtSourceCoderShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElemen dueTo: aShortcutEvent ] -{ #category : 'evaluation' } +{ #category : #evaluation } GtSourceCoderShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement dueTo: aShortcutEvent [ aBrTextEditor model ifNotNil: [ :aSourceCoderViewModel | self performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent ] ] -{ #category : 'private' } +{ #category : #private } GtSourceCoderShortcut >> selectionIntervalIn: aBrTextEditor [ aBrTextEditor selection do: [ :eachMonotoneSelection | ^ eachMonotoneSelection from + 1 to: eachMonotoneSelection to ]. diff --git a/src/GToolkit-Coder-UI/GtSourceCoderSpawnDestinationAptitude.class.st b/src/GToolkit-Coder-UI/GtSourceCoderSpawnDestinationAptitude.class.st index 70e698715..1b790c2b1 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderSpawnDestinationAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderSpawnDestinationAptitude.class.st @@ -6,15 +6,15 @@ Each coder holds to its destination. Available destinations are modeled as subcl " Class { - #name : 'GtSourceCoderSpawnDestinationAptitude', - #superclass : 'GtSourceCoderAptitude', + #name : #GtSourceCoderSpawnDestinationAptitude, + #superclass : #GtSourceCoderAptitude, #instVars : [ 'switchButton' ], #category : 'GToolkit-Coder-UI-Coder - Source Look' } -{ #category : 'initialization' } +{ #category : #initialization } GtSourceCoderSpawnDestinationAptitude >> initialize [ super initialize. @@ -23,7 +23,7 @@ GtSourceCoderSpawnDestinationAptitude >> initialize [ self addChangeAddChildAs: #(content switchButton) with: [ switchButton ] ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtSourceCoderSpawnDestinationAptitude >> newSwitchButton [ ^ BrButton new aptitude: BrGlamorousButtonWithIconAptitude - BrGlamorousButtonExteriorAptitude; @@ -36,18 +36,18 @@ GtSourceCoderSpawnDestinationAptitude >> newSwitchButton [ zIndex: 10 ] -{ #category : 'hooks' } +{ #category : #hooks } GtSourceCoderSpawnDestinationAptitude >> onCoderChanged: aGtSourceCoderUIModel [ self switchButton icon: aGtSourceCoderUIModel coder spawnDestination icon ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderSpawnDestinationAptitude >> switchButton [ ^ switchButton ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtSourceCoderSpawnDestinationAptitude >> switchSpawnDestination [ | aSourceCoder | diff --git a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st index a0c7271d2..8fb01389b 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st @@ -1,36 +1,36 @@ Class { - #name : 'GtSourceCoderViewModel', - #superclass : 'GtTextualCoderViewModel', + #name : #GtSourceCoderViewModel, + #superclass : #GtTextualCoderViewModel, #instVars : [ 'evaluationResult' ], #category : 'GToolkit-Coder-UI-Coder - Source Model' } -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoderViewModel >> debug [ ^ self selection isEmpty ifTrue: [ self debugAll ] ifFalse: [ self debugIt: self selectedTextInterval ] ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoderViewModel >> debugAll [ ^ self coderModel debugInContext: self evaluationContext all ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoderViewModel >> debugIt: aTextInterval [ ^ self coderModel debugInContext: (self evaluationContext from: aTextInterval first to: aTextInterval last) ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoderViewModel >> discardChanges [ self coder discardChanges ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoderViewModel >> doIt [ "Evaluate a piece of source code within a selection interval or everything if nothing is selected and return a result" @@ -38,7 +38,7 @@ GtSourceCoderViewModel >> doIt [ ^ self doItRequestedBy: self ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoderViewModel >> doIt: aTextInterval [ "Evaluate a piece of source code within an interval and return a result. I am also able to evaluate an empty or only consisting of whitespace @@ -48,7 +48,7 @@ GtSourceCoderViewModel >> doIt: aTextInterval [ ^ self doIt: aTextInterval requestedBy: self ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoderViewModel >> doIt: aTextInterval requestedBy: aRequesterObject [ "Evaluate source code within given text interval and return the result" @@ -57,14 +57,14 @@ GtSourceCoderViewModel >> doIt: aTextInterval requestedBy: aRequesterObject [ requesterObject: aRequesterObject) ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoderViewModel >> doItAll [ "Evaluate the whole source code and return the result" ^ self doItAllRequestedBy: self ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoderViewModel >> doItAllRequestedBy: aRequesterObject [ "Evaluate the whole source code independent from the selection and return the result" @@ -73,7 +73,7 @@ GtSourceCoderViewModel >> doItAllRequestedBy: aRequesterObject [ requesterObject: aRequesterObject) ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoderViewModel >> doItAndGo [ "Evaluate selected source code or everything if there is nothing selected and inspect the result" @@ -82,21 +82,21 @@ GtSourceCoderViewModel >> doItAndGo [ ifFalse: [ self doItAndGo: self selectedTextInterval ] ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoderViewModel >> doItAndGo: aTextInterval [ "Evaluate a piece of source code within an interval and inspect a result." ^ self coder doItAndGoInContext: (self evaluationContext from: aTextInterval first to: aTextInterval last) ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoderViewModel >> doItAndGoAll [ "Evaluate the whole source code and inspect the result" ^ self coder doItAndGoInContext: self evaluationContext all ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoderViewModel >> doItRequestedBy: aRequesterObject [ "Evaluate selected source code or everything if there is nothing selected and return the result" @@ -105,12 +105,12 @@ GtSourceCoderViewModel >> doItRequestedBy: aRequesterObject [ ifFalse: [ self doIt: self selectedTextInterval requestedBy: aRequesterObject ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderViewModel >> elementClass [ ^ GtExpandableSourceCoderElement ] -{ #category : 'private - evaluation' } +{ #category : #'private - evaluation' } GtSourceCoderViewModel >> evaluationContext [ @@ -118,17 +118,17 @@ GtSourceCoderViewModel >> evaluationContext [ requesterObject: self ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderViewModel >> evaluationResult [ ^ evaluationResult ] -{ #category : 'accessing' } +{ #category : #accessing } GtSourceCoderViewModel >> evaluationResult: anObject [ evaluationResult := anObject ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoderViewModel >> printIt [ "Evaluate selected source code or everything if there is nothing selected and print the result" @@ -137,21 +137,21 @@ GtSourceCoderViewModel >> printIt [ ifFalse: [ self printIt: self selectedTextInterval ] ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoderViewModel >> printIt: aTextInterval [ "Evaluate a piece of source code within an interval and print a result." ^ self coder printItInContext: (self evaluationContext from: aTextInterval first to: aTextInterval last) ] -{ #category : 'api - actions' } +{ #category : #'api - actions' } GtSourceCoderViewModel >> printItAll [ "Evaluate the whole source code and print the result" ^ self coder printItInContext: self evaluationContext all ] -{ #category : 'private - evaluation' } +{ #category : #'private - evaluation' } GtSourceCoderViewModel >> selectedTextInterval [ | anInterval | diff --git a/src/GToolkit-Coder-UI/GtSyncScrollRange.class.st b/src/GToolkit-Coder-UI/GtSyncScrollRange.class.st index 6b6af4542..673f672b5 100644 --- a/src/GToolkit-Coder-UI/GtSyncScrollRange.class.st +++ b/src/GToolkit-Coder-UI/GtSyncScrollRange.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtSyncScrollRange', - #superclass : 'Object', + #name : #GtSyncScrollRange, + #superclass : #Object, #instVars : [ 'leftFirst', 'leftLast', @@ -11,14 +11,14 @@ Class { #category : 'GToolkit-Coder-UI-Diff' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtSyncScrollRange class >> left: leftInteger right: rightInteger [ ^ self new initializeLeft: leftInteger right: rightInteger; yourself ] -{ #category : 'syncing' } +{ #category : #syncing } GtSyncScrollRange >> advanceBoth [ self leftSize = self rightSize ifTrue: [ leftLast := leftLast + 1. @@ -29,7 +29,7 @@ GtSyncScrollRange >> advanceBoth [ yourself ] -{ #category : 'syncing' } +{ #category : #syncing } GtSyncScrollRange >> advanceLeft [ self rightSize = 0 ifTrue: [ isDifference := true. @@ -40,7 +40,7 @@ GtSyncScrollRange >> advanceLeft [ yourself ] -{ #category : 'syncing' } +{ #category : #syncing } GtSyncScrollRange >> advanceRight [ self leftSize = 0 ifTrue: [ isDifference := true. @@ -51,7 +51,7 @@ GtSyncScrollRange >> advanceRight [ yourself ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtSyncScrollRange >> initialize [ super initialize. isDifference := false. @@ -61,7 +61,7 @@ GtSyncScrollRange >> initialize [ rightLast := 0 ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtSyncScrollRange >> initializeLeft: leftInteger right: rightInteger [ leftFirst := leftInteger. leftLast := leftInteger. @@ -69,27 +69,27 @@ GtSyncScrollRange >> initializeLeft: leftInteger right: rightInteger [ rightLast := rightInteger ] -{ #category : 'testing' } +{ #category : #testing } GtSyncScrollRange >> isDifference [ ^ isDifference ] -{ #category : 'accessing' } +{ #category : #accessing } GtSyncScrollRange >> leftFirst [ ^ leftFirst ] -{ #category : 'accessing' } +{ #category : #accessing } GtSyncScrollRange >> leftLast [ ^ leftLast ] -{ #category : 'accessing' } +{ #category : #accessing } GtSyncScrollRange >> leftSize [ ^ leftLast - leftFirst ] -{ #category : 'syncing' } +{ #category : #syncing } GtSyncScrollRange >> mergeWith: aRange [ leftFirst := leftFirst min: aRange leftFirst. leftLast := leftLast max: aRange leftLast. @@ -97,7 +97,7 @@ GtSyncScrollRange >> mergeWith: aRange [ rightLast := rightLast max: aRange rightLast ] -{ #category : 'testing' } +{ #category : #testing } GtSyncScrollRange >> overlapsLeft: leftInterval orRight: rightInterval [ ^ ((self leftLast < leftInterval first or: [ self leftFirst > leftInterval last ]) @@ -105,7 +105,7 @@ GtSyncScrollRange >> overlapsLeft: leftInterval orRight: rightInterval [ or: [ self rightFirst > rightInterval last ] ]) not ] -{ #category : 'printing' } +{ #category : #printing } GtSyncScrollRange >> printOn: aStream [ super printOn: aStream. aStream @@ -123,17 +123,17 @@ GtSyncScrollRange >> printOn: aStream [ nextPut: $] ] -{ #category : 'accessing' } +{ #category : #accessing } GtSyncScrollRange >> rightFirst [ ^ rightFirst ] -{ #category : 'accessing' } +{ #category : #accessing } GtSyncScrollRange >> rightLast [ ^ rightLast ] -{ #category : 'accessing' } +{ #category : #accessing } GtSyncScrollRange >> rightSize [ ^ rightLast - rightFirst ] diff --git a/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st b/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st index 271416dbb..d730e7043 100644 --- a/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st +++ b/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st @@ -1,13 +1,13 @@ Class { - #name : 'GtSyncScrollRanges', - #superclass : 'Object', + #name : #GtSyncScrollRanges, + #superclass : #Object, #instVars : [ 'ranges' ], #category : 'GToolkit-Coder-UI-Diff' } -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtSyncScrollRanges class >> createFromDiff: aDiffBuilder [ | syncScroll | syncScroll := self new. @@ -19,19 +19,19 @@ GtSyncScrollRanges class >> createFromDiff: aDiffBuilder [ ^ syncScroll ] -{ #category : 'examples' } +{ #category : #examples } GtSyncScrollRanges class >> example [ ^ self createFromDiff: self exampleDiff ] -{ #category : 'examples' } +{ #category : #examples } GtSyncScrollRanges class >> exampleDiff [ ^ TextDiffBuilder from: self originalString to: self newString ] -{ #category : 'examples' } +{ #category : #examples } GtSyncScrollRanges class >> newString [ ^ '1 @@ -43,7 +43,7 @@ GtSyncScrollRanges class >> newString [ 9' ] -{ #category : 'examples' } +{ #category : #examples } GtSyncScrollRanges class >> originalString [ ^ '1 @@ -56,28 +56,28 @@ GtSyncScrollRanges class >> originalString [ 10' ] -{ #category : 'private-creation' } +{ #category : #'private-creation' } GtSyncScrollRanges >> advanceBoth [ ranges last advanceBoth ifNotNil: [ :range | ranges add: range ] ] -{ #category : 'private-creation' } +{ #category : #'private-creation' } GtSyncScrollRanges >> advanceLeft [ ranges last advanceLeft ifNotNil: [ :range | ranges add: range ] ] -{ #category : 'private-creation' } +{ #category : #'private-creation' } GtSyncScrollRanges >> advanceRight [ ranges last advanceRight ifNotNil: [ :range | ranges add: range ] ] -{ #category : 'initialize-release' } +{ #category : #'initialize-release' } GtSyncScrollRanges >> initialize [ super initialize. ranges := OrderedCollection with: GtSyncScrollRange new ] -{ #category : 'accessing' } +{ #category : #accessing } GtSyncScrollRanges >> leftLineFor: rightIndex [ | range | range := ranges @@ -89,7 +89,7 @@ GtSyncScrollRanges >> leftLineFor: rightIndex [ * range leftSize + range leftFirst) rounded ] -{ #category : 'private-creation' } +{ #category : #'private-creation' } GtSyncScrollRanges >> mergeDifferences [ | index current previous | index := ranges size. @@ -103,13 +103,13 @@ GtSyncScrollRanges >> mergeDifferences [ current := previous ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtSyncScrollRanges >> rangesForLeft: leftInterval andRight: rightInterval [ ^ ranges select: [ :each | each overlapsLeft: leftInterval orRight: rightInterval ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtSyncScrollRanges >> rightLineFor: leftIndex [ | range | range := ranges diff --git a/src/GToolkit-Coder-UI/GtTextCoder.extension.st b/src/GToolkit-Coder-UI/GtTextCoder.extension.st index d63f91914..6f65a9f19 100644 --- a/src/GToolkit-Coder-UI/GtTextCoder.extension.st +++ b/src/GToolkit-Coder-UI/GtTextCoder.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'GtTextCoder' } +Extension { #name : #GtTextCoder } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtTextCoder >> asCoderUIModel [ ^ GtTextualCoderViewModel new coder: self ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoder.extension.st b/src/GToolkit-Coder-UI/GtTextualCoder.extension.st index 9191fb99d..53c367312 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoder.extension.st +++ b/src/GToolkit-Coder-UI/GtTextualCoder.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'GtTextualCoder' } +Extension { #name : #GtTextualCoder } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } GtTextualCoder >> breadcrumbActions [ diff --git a/src/GToolkit-Coder-UI/GtTextualCoderCopyContextMenuItemId.class.st b/src/GToolkit-Coder-UI/GtTextualCoderCopyContextMenuItemId.class.st index 863af42aa..b06a40fcb 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderCopyContextMenuItemId.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderCopyContextMenuItemId.class.st @@ -4,12 +4,12 @@ A context menu action to copy a text " Class { - #name : 'GtTextualCoderCopyContextMenuItemId', - #superclass : 'GtCoderElementId', + #name : #GtTextualCoderCopyContextMenuItemId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtTextualCoderCopyContextMenuItemId >> asSymbol [ ^ #'context-menu-item--copy' ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderCutContextMenuItemId.class.st b/src/GToolkit-Coder-UI/GtTextualCoderCutContextMenuItemId.class.st index 72db20acb..c1c6e896a 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderCutContextMenuItemId.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderCutContextMenuItemId.class.st @@ -4,12 +4,12 @@ A context menu action to cut text " Class { - #name : 'GtTextualCoderCutContextMenuItemId', - #superclass : 'GtCoderElementId', + #name : #GtTextualCoderCutContextMenuItemId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtTextualCoderCutContextMenuItemId >> asSymbol [ ^ #'context-menu-item--cut' ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index eabc0cff2..ba8ade5e0 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtTextualCoderEditorElement', - #superclass : 'BrEditor', + #name : #GtTextualCoderEditorElement, + #superclass : #BrEditor, #traits : 'TBlAssertUIProcess + TGtWithTextualCoderViewModel', #classTraits : 'TBlAssertUIProcess classTrait + TGtWithTextualCoderViewModel classTrait', #instVars : [ @@ -12,12 +12,12 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Textual' } -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } GtTextualCoderEditorElement >> coderUIModel: aTextualCoderViewModel [ self textualCoderViewModel: aTextualCoderViewModel ] -{ #category : 'instance creation' } +{ #category : #'instance creation' } GtTextualCoderEditorElement >> createContextMenuContent [ "wait for the addons to be computed" | theContextMenu | @@ -39,7 +39,7 @@ GtTextualCoderEditorElement >> createContextMenuContent [ ^ theContextMenu ] -{ #category : 'private' } +{ #category : #private } GtTextualCoderEditorElement >> hideHighlighters [ self text clearAttributes: [ :eachAttribute | eachAttribute isKindOf: GtSourceCoderErrorAttribute ]. @@ -47,7 +47,7 @@ GtTextualCoderEditorElement >> hideHighlighters [ evaluationPrinter hideResultSynchronously. ] -{ #category : 'private' } +{ #category : #private } GtTextualCoderEditorElement >> highlightPCRangeForInterval: aSelectionInterval [ self textualCoderViewModel isModified ifTrue: [ ^ self ]. @@ -61,7 +61,7 @@ GtTextualCoderEditorElement >> highlightPCRangeForInterval: aSelectionInterval [ beNotOverwritableByStyler ] ] -{ #category : 'initialization' } +{ #category : #initialization } GtTextualCoderEditorElement >> initialize [ super initialize. @@ -84,7 +84,7 @@ GtTextualCoderEditorElement >> initialize [ self initializeListeners ] -{ #category : 'initialization' } +{ #category : #initialization } GtTextualCoderEditorElement >> initializeListeners [ self when: BlFocusInEvent do: [ :anEvent | self textualCoderViewModel focused: true from: self ]. @@ -111,13 +111,13 @@ GtTextualCoderEditorElement >> initializeListeners [ do: [ :anEvent | self textualCoderViewModel styledText: anEvent styledText ] ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onCodeEvaluated: anEvaluationAnnouncement [ evaluationHighlighter displayResult: anEvaluationAnnouncement evaluationResult. evaluationPrinter hideResult ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onCoderParseError: aGtCoderParseError [ "A parse error can be notifying from a non-UI thread" @@ -127,14 +127,14 @@ GtTextualCoderEditorElement >> onCoderParseError: aGtCoderParseError [ at: aGtCoderParseError location ]) ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onCoderViewModelFocused: aBoolean [ aBoolean ifTrue: [ self requestFocus ] ifFalse: [ self loseFocus ] ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onContextPCRangeChanged: aContextPCRangeChangedAnnouncement [ | selectionInterval | @@ -142,7 +142,7 @@ GtTextualCoderEditorElement >> onContextPCRangeChanged: aContextPCRangeChangedAn self highlightPCRangeForInterval: selectionInterval ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onCursorsChanged: aCursorsChangedAnnouncement [ "Is sent when the cursors change in the View Model. May be sent from a non-UI thread" @@ -160,7 +160,7 @@ GtTextualCoderEditorElement >> onCursorsChanged: aCursorsChangedAnnouncement [ apply ]) ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onFocusChangedAnnouncement: anAnnouncement [ self assertUIProcess. @@ -173,7 +173,7 @@ GtTextualCoderEditorElement >> onFocusChangedAnnouncement: anAnnouncement [ self onCoderViewModelFocused: anAnnouncement focused ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onObjectSpawnRequest: anAnnouncement [ self enqueueTask: (BlTaskAction new action: [ self phlow @@ -181,7 +181,7 @@ GtTextualCoderEditorElement >> onObjectSpawnRequest: anAnnouncement [ withDestination: anAnnouncement spawnDestination ]) ] -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } GtTextualCoderEditorElement >> onPostTextualCoderViewModelChanged [ "I am an optional hook method that is sent after #subscribeToTextualCoderViewModel. I do nothing by default but allow users to perform update operations when a receiver object is already @@ -194,13 +194,13 @@ GtTextualCoderEditorElement >> onPostTextualCoderViewModelChanged [ self textualCoderViewModel addOnsAsyncDo: [ :theAddOns | self onViewModelReadyToStyle ] ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onPrintRequest: anEvaluationAnnouncement [ evaluationHighlighter hideResult. evaluationPrinter displayResult: anEvaluationAnnouncement evaluationResult. ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onShowDebuggerRequest: aShowDebuggerAnnouncement [ | sharedDebugSession anEvaluatedSource anEvaluatedInterval theSourceStartInText theSourceEndInText | @@ -236,19 +236,19 @@ GtTextualCoderEditorElement >> onShowDebuggerRequest: aShowDebuggerAnnouncement debugSession: sharedDebugSession) ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onStyleTextRequest: anEvent [ "onStyleTextRequest: may be sent from a non-UI thread" self enqueueTask: (BlTaskAction new action: [ self styleTextAndAfterDo: anEvent afterAction ]) ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onStylersUpdated: anAnnouncement [ ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onTextModified [ "Is sent when the text changes in the editor. Here we should synchronise the UI and the model." @@ -258,7 +258,7 @@ GtTextualCoderEditorElement >> onTextModified [ synchronously: true ] -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } GtTextualCoderEditorElement >> onTextualCoderViewModelChanged [ "Is sent when a new textualCoder view model is assigned to the element. Note: #onTextualCoderViewModelChanged is sent before #subscribeToTextualCoderViewModel @@ -281,7 +281,7 @@ GtTextualCoderEditorElement >> onTextualCoderViewModelChanged [ completion strategy: self textualCoderViewModel coderModel completionStrategy ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onToolSpawnRequest: anAnnouncement [ self enqueueTask: (BlTaskAction new action: [ self phlow @@ -289,12 +289,12 @@ GtTextualCoderEditorElement >> onToolSpawnRequest: anAnnouncement [ withDestination: anAnnouncement spawnDestination ]) ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onUpdateAddOnsRequest: anAnnouncement [ ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onViewModelCursorsChanged: aCursorsChangedAnnouncement [ "Is sent when the cursors changes in the View Model. May be sent from a non-UI thread" @@ -315,12 +315,12 @@ GtTextualCoderEditorElement >> onViewModelCursorsChanged: aCursorsChangedAnnounc apply ]) ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onViewModelReadyToStyle [ self enqueueTask: (BlTaskAction new action: [ self editor styleText ]) ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onViewModelSelectionChanged: aSelectionChangedAnnouncement [ "Is sent when the selection changes in the View Model. May be sent from a non-UI thread" @@ -341,7 +341,7 @@ GtTextualCoderEditorElement >> onViewModelSelectionChanged: aSelectionChangedAnn select ]) ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onViewModelShortcutsChanged [ "Is sent when the shortcuts change in the View Model. May be sent from a non-UI thread" @@ -353,17 +353,17 @@ GtTextualCoderEditorElement >> onViewModelShortcutsChanged [ self editor addEditorShortcuts: shortcuts ]) ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onViewModelStyledTextChanged: anAnnouncement [ ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onViewModelStylersChanged [ self enqueueTask: (BlTaskAction new action: [ self styler: self textualCoderViewModel compositeStyler ]) ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onViewModelTextAttributesAdded: anAnnouncement [ self enqueueTask: (BlTaskAction new action: [ anAnnouncement coderTextAttributes @@ -372,13 +372,13 @@ GtTextualCoderEditorElement >> onViewModelTextAttributesAdded: anAnnouncement [ to: anAnnouncement stopPosition ]) ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onViewModelTextAttributesRemoved: anAnnouncement [ self enqueueTask: (BlTaskAction new action: [ anAnnouncement coderTextAttributes removeFromEditorText: self text ]) ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderEditorElement >> onViewModelTextChanged: aGtTextualCoderViewModelTextChanged [ aGtTextualCoderViewModelTextChanged source == self @@ -393,7 +393,7 @@ GtTextualCoderEditorElement >> onViewModelTextChanged: aGtTextualCoderViewModelT self hideHighlighters ]) ] ] -{ #category : 'registration' } +{ #category : #registration } GtTextualCoderEditorElement >> registerCoderModelAnnouncementsFor: aCoderModel [ aCoderModel announcer weak when: GtCoderAddOnsUpdateRequest @@ -415,7 +415,7 @@ GtTextualCoderEditorElement >> registerCoderModelAnnouncementsFor: aCoderModel [ to: self ] -{ #category : 'registration' } +{ #category : #registration } GtTextualCoderEditorElement >> registerCoderViewModelAnnouncementsFor: aGtSourceCoderUIModel [ aGtSourceCoderUIModel weak when: GtMethodCoderContextPCRangeChanged @@ -454,7 +454,7 @@ GtTextualCoderEditorElement >> registerCoderViewModelAnnouncementsFor: aGtSource to: self. ] -{ #category : 'private' } +{ #category : #private } GtTextualCoderEditorElement >> reportParseError: aString at: anInteger [ | text position | @@ -471,17 +471,17 @@ GtTextualCoderEditorElement >> reportParseError: aString at: anInteger [ to: position ] -{ #category : 'private' } +{ #category : #private } GtTextualCoderEditorElement >> styleText [ self editor styleText ] -{ #category : 'private' } +{ #category : #private } GtTextualCoderEditorElement >> styleTextAndAfterDo: aBlock [ self editor styleTextAndAfterDo: aBlock ] -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } GtTextualCoderEditorElement >> subscribeToTextualCoderViewModel [ "Is sent after a new textualCoder view model is assigned to the element. It is required to unsubscribe from the view model or domain model by implementing @@ -493,7 +493,7 @@ GtTextualCoderEditorElement >> subscribeToTextualCoderViewModel [ completion install ] -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } GtTextualCoderEditorElement >> unsubscribeFromTextualCoderViewModel [ "Is sent before a new textualCoder view model is assigned to the element. Elements that subscribe to textualCoder view model in domain model are required to implement this methods." diff --git a/src/GToolkit-Coder-UI/GtTextualCoderPasteContextMenuItemId.class.st b/src/GToolkit-Coder-UI/GtTextualCoderPasteContextMenuItemId.class.st index 37ba25bea..76d2c5631 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderPasteContextMenuItemId.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderPasteContextMenuItemId.class.st @@ -4,12 +4,12 @@ A context menu action to paste a text " Class { - #name : 'GtTextualCoderPasteContextMenuItemId', - #superclass : 'GtCoderElementId', + #name : #GtTextualCoderPasteContextMenuItemId, + #superclass : #GtCoderElementId, #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'converting' } +{ #category : #converting } GtTextualCoderPasteContextMenuItemId >> asSymbol [ ^ #'context-menu-item--paste' ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st b/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st index ac1c1f77e..86ea200ac 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtTextualCoderTextAttributes', - #superclass : 'Object', + #name : #GtTextualCoderTextAttributes, + #superclass : #Object, #instVars : [ 'markerAttribute', 'textAttributes' @@ -8,7 +8,7 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Textual Model' } -{ #category : 'api - attribute' } +{ #category : #'api - attribute' } GtTextualCoderTextAttributes >> applyOnEditorText: aText [ aText findAttribute: markerAttribute @@ -16,7 +16,7 @@ GtTextualCoderTextAttributes >> applyOnEditorText: aText [ aText attributes: textAttributes from: aStartPosition to: anEndPosition ] ] -{ #category : 'api - attribute' } +{ #category : #'api - attribute' } GtTextualCoderTextAttributes >> applyOnEditorText: aText from: aStartPosition to: anEndPosition [ aText findAttribute: markerAttribute @@ -26,27 +26,27 @@ GtTextualCoderTextAttributes >> applyOnEditorText: aText from: aStartPosition to aText attributes: { markerAttribute }, textAttributes from: aStartPosition to: anEndPosition ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderTextAttributes >> markerAttribute [ ^ markerAttribute ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderTextAttributes >> markerAttribute: anObject [ markerAttribute := anObject ] -{ #category : 'api - attribute' } +{ #category : #'api - attribute' } GtTextualCoderTextAttributes >> removeFromEditorText: aText [ aText removeAttributes: { self markerAttribute }, self textAttributes ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderTextAttributes >> textAttributes [ ^ textAttributes ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderTextAttributes >> textAttributes: anObject [ textAttributes := anObject ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 80c8d0621..814456f67 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtTextualCoderViewModel', - #superclass : 'GtSingleCoderViewModel', + #name : #GtTextualCoderViewModel, + #superclass : #GtSingleCoderViewModel, #instVars : [ 'addOns', 'addOnMonitor', @@ -22,7 +22,7 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Textual Model' } -{ #category : 'api - add-ons' } +{ #category : #'api - add-ons' } GtTextualCoderViewModel >> addOnsAsyncDo: aBlock [ addOnMonitor critical: [ addOnCommand ifNotNil: [ @@ -55,7 +55,7 @@ GtTextualCoderViewModel >> addOnsAsyncDo: aBlock [ otherwise: [ addOnCommand execute ] ] ] -{ #category : 'api - add-ons' } +{ #category : #'api - add-ons' } GtTextualCoderViewModel >> addOnsAwait [ | theAddOns | @@ -64,7 +64,7 @@ GtTextualCoderViewModel >> addOnsAwait [ ^ theAddOns ] -{ #category : 'api - add-ons' } +{ #category : #'api - add-ons' } GtTextualCoderViewModel >> addOnsAwaitDo: aBlock [ | aSemaphore theAddOns | @@ -78,28 +78,28 @@ GtTextualCoderViewModel >> addOnsAwaitDo: aBlock [ aBlock value: theAddOns ] -{ #category : 'api - shortcuts' } +{ #category : #'api - shortcuts' } GtTextualCoderViewModel >> addShortcut: aShortcut [ "Add an extra shortcut add-on independent from the dynamically computed add-ons" extraAddOns addShortcut: aShortcut ] -{ #category : 'api - shortcuts' } +{ #category : #'api - shortcuts' } GtTextualCoderViewModel >> addStyler: aGtCoderStyler [ "Add an extra styler add-on independent from the dynamically computed add-ons" extraAddOns addStyler: aGtCoderStyler ] -{ #category : 'api - shortcuts' } +{ #category : #'api - shortcuts' } GtTextualCoderViewModel >> addStylers: aCollectionOfGtCoderStyler [ "Add extra styler add-ons independent from the dynamically computed add-ons" aCollectionOfGtCoderStyler do: [ :eachStyler | self addStyler: eachStyler ] ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtTextualCoderViewModel >> addTextAttribute: aTextAttribute from: aStartPosition to: anEndPosition [ ^ self @@ -108,7 +108,7 @@ GtTextualCoderViewModel >> addTextAttribute: aTextAttribute from: aStartPosition to: anEndPosition ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtTextualCoderViewModel >> addTextAttributes: aCollectionOfTextAttributes from: aStartPosition to: anEndPosition [ | aCurrentText aMarkerAttribute newCoderTextAttributes | @@ -132,7 +132,7 @@ GtTextualCoderViewModel >> addTextAttributes: aCollectionOfTextAttributes from: ^ newCoderTextAttributes ] -{ #category : 'converting' } +{ #category : #converting } GtTextualCoderViewModel >> asEditorState [ | anEditorText aMemento | @@ -158,22 +158,22 @@ GtTextualCoderViewModel >> asEditorState [ ^ aMemento ] -{ #category : 'api - coder model' } +{ #category : #'api - coder model' } GtTextualCoderViewModel >> astAsyncDo: aBlock [ ^ self coderModel astAsyncDo: aBlock ] -{ #category : 'api - coder model' } +{ #category : #'api - coder model' } GtTextualCoderViewModel >> astAwait [ ^ self coderModel astAwait ] -{ #category : 'api - expansion' } +{ #category : #'api - expansion' } GtTextualCoderViewModel >> collapse [ self expanded: false ] -{ #category : 'api - stylers' } +{ #category : #'api - stylers' } GtTextualCoderViewModel >> compositeStyler [ ^ GtCoderAstCompositeStyler new coderViewModel: self; @@ -181,7 +181,7 @@ GtTextualCoderViewModel >> compositeStyler [ yourself ] -{ #category : 'private - addons' } +{ #category : #'private - addons' } GtTextualCoderViewModel >> computeAddOns [ | aCoderModel newAddOns pragmas theAst | @@ -221,7 +221,7 @@ GtTextualCoderViewModel >> computeAddOns [ ^ newAddOns ] -{ #category : 'private - addons' } +{ #category : #'private - addons' } GtTextualCoderViewModel >> computeContextMenuAstAddOns [ | aCoderModel newAddOns pragmas theAst | @@ -254,12 +254,12 @@ GtTextualCoderViewModel >> computeContextMenuAstAddOns [ ^ newAddOns ] -{ #category : 'api - add-ons' } +{ #category : #'api - add-ons' } GtTextualCoderViewModel >> contextActions [ ^ contextActions ] -{ #category : 'api - add-ons' } +{ #category : #'api - add-ons' } GtTextualCoderViewModel >> contextActions: theContextActions [ contextActions = theContextActions ifTrue: [ ^ self ]. @@ -268,12 +268,12 @@ GtTextualCoderViewModel >> contextActions: theContextActions [ self announce: GtTextualCoderViewModelContextActionsChanged new ] -{ #category : 'api - add-ons' } +{ #category : #'api - add-ons' } GtTextualCoderViewModel >> contextMenuActions [ ^ contextMenuActions ] -{ #category : 'api - add-ons' } +{ #category : #'api - add-ons' } GtTextualCoderViewModel >> contextMenuActions: theContextMenuActions [ contextMenuActions = theContextMenuActions ifTrue: [ ^ self ]. @@ -282,19 +282,19 @@ GtTextualCoderViewModel >> contextMenuActions: theContextMenuActions [ self announce: GtTextualCoderViewModelContextMenuActionsChanged new ] -{ #category : 'api - cursors' } +{ #category : #'api - cursors' } GtTextualCoderViewModel >> cursors [ ^ cursors ] -{ #category : 'api - cursors' } +{ #category : #'api - cursors' } GtTextualCoderViewModel >> cursors: aBrTextEditorCursor [ self cursors: aBrTextEditorCursor from: self ] -{ #category : 'api - cursors' } +{ #category : #'api - cursors' } GtTextualCoderViewModel >> cursors: aBrTextEditorCursor from: aSourceObject [ cursors = aBrTextEditorCursor ifTrue: [ ^ self ]. @@ -303,27 +303,27 @@ GtTextualCoderViewModel >> cursors: aBrTextEditorCursor from: aSourceObject [ self notifyCursorsChanged: cursors from: aSourceObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModel >> elementClass [ ^ GtTextualCoderEditorElement ] -{ #category : 'api - add-ons' } +{ #category : #'api - add-ons' } GtTextualCoderViewModel >> ensureAddOns [ self addOnsAsyncDo: [ :theAddOns | ] ] -{ #category : 'api - expansion' } +{ #category : #'api - expansion' } GtTextualCoderViewModel >> expand [ self expanded: true ] -{ #category : 'api - expansion' } +{ #category : #'api - expansion' } GtTextualCoderViewModel >> expanded [ ^ expanded ] -{ #category : 'api - expansion' } +{ #category : #'api - expansion' } GtTextualCoderViewModel >> expanded: aBoolean [ expanded = aBoolean ifTrue: [ ^ self ]. @@ -332,24 +332,24 @@ GtTextualCoderViewModel >> expanded: aBoolean [ self notifyExpansionChanged: expanded ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModel >> extraTextAttributes [ ^ extraTextAttributes ] -{ #category : 'api - focus' } +{ #category : #'api - focus' } GtTextualCoderViewModel >> focused [ ^ hasFocus ] -{ #category : 'api - focus' } +{ #category : #'api - focus' } GtTextualCoderViewModel >> focused: aBoolean [ self focused: aBoolean from: self ] -{ #category : 'api - focus' } +{ #category : #'api - focus' } GtTextualCoderViewModel >> focused: aBoolean from: aSourceObject [ hasFocus = aBoolean ifTrue: [ ^ self ]. @@ -363,7 +363,7 @@ GtTextualCoderViewModel >> focused: aBoolean from: aSourceObject [ ifFalse: [ theCoders unfocusCoderUIModel: self ] ] ] -{ #category : 'gt-extension' } +{ #category : #'gt-extension' } GtTextualCoderViewModel >> gtInfo [ ^ Array streamContents: [ :aStream | aStream nextPut: (#coderModel -> self coderModel). @@ -380,7 +380,7 @@ GtTextualCoderViewModel >> gtInfo [ aStream nextPut: (#expanded -> self expanded) ] ] -{ #category : 'gt-extension' } +{ #category : #'gt-extension' } GtTextualCoderViewModel >> gtInfoFor: aView [ @@ -398,12 +398,12 @@ GtTextualCoderViewModel >> gtInfoFor: aView [ updateWhen: GtTextualCoderViewModelAnnouncement in: self announcer ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtTextualCoderViewModel >> hasSelection [ ^ self selection isNotEmpty ] -{ #category : 'api - styled text' } +{ #category : #'api - styled text' } GtTextualCoderViewModel >> hasStyledText [ @@ -412,7 +412,7 @@ GtTextualCoderViewModel >> hasStyledText [ ^ styledText notNil ] -{ #category : 'initialization' } +{ #category : #initialization } GtTextualCoderViewModel >> initialize [ super initialize. @@ -432,12 +432,12 @@ GtTextualCoderViewModel >> initialize [ expanded := true ] -{ #category : 'api - add-ons' } +{ #category : #'api - add-ons' } GtTextualCoderViewModel >> mainActions [ ^ mainActions ] -{ #category : 'api - add-ons' } +{ #category : #'api - add-ons' } GtTextualCoderViewModel >> mainActions: theMainActions [ mainActions = theMainActions ifTrue: [ ^ self ]. @@ -446,48 +446,48 @@ GtTextualCoderViewModel >> mainActions: theMainActions [ self announce: GtTextualCoderViewModelMainActionsChanged new ] -{ #category : 'api - cursors' } +{ #category : #'api - cursors' } GtTextualCoderViewModel >> moveCursorAtEnd [ "Move the cursor at the end of the textual snippet" self moveCursorTo: self sourceText size ] -{ #category : 'api - cursors' } +{ #category : #'api - cursors' } GtTextualCoderViewModel >> moveCursorAtStart [ "Move the cursor at the end of the textual snippet" self moveCursorTo: 0 ] -{ #category : 'api - cursors' } +{ #category : #'api - cursors' } GtTextualCoderViewModel >> moveCursorTo: aCursorIndex [ self cursors: (BrTextEditorCursor at: aCursorIndex) ] -{ #category : 'private - notifying' } +{ #category : #'private - notifying' } GtTextualCoderViewModel >> notifyCursorsChanged: aBrTextEditorCursor from: aSourceObject [ self announce: (GtTextualCoderViewModelCursorsChanged new cursors: aBrTextEditorCursor; source: aSourceObject) ] -{ #category : 'private - notifying' } +{ #category : #'private - notifying' } GtTextualCoderViewModel >> notifyExpansionChanged: aBoolean [ self announce: (GtTextualCoderViewModelExpansionChanged new expanded: aBoolean) ] -{ #category : 'private - notifying' } +{ #category : #'private - notifying' } GtTextualCoderViewModel >> notifyFocusChanged: aBoolean from: aSourceObject [ self announcerUIModel announce: (GtSourceCoderFocusChanged new focused: aBoolean; source: aSourceObject) ] -{ #category : 'private - notifying' } +{ #category : #'private - notifying' } GtTextualCoderViewModel >> notifySelectionChanged: aBlCompositeSelection from: aSourceObject [ self announce: (GtTextualCoderViewModelSelectionChanged new selection: aBlCompositeSelection; source: aSourceObject) ] -{ #category : 'api - styled text' } +{ #category : #'api - styled text' } GtTextualCoderViewModel >> notifyStyledTextChanged [ "Override this notify method to announce changes to the property" @@ -496,7 +496,7 @@ GtTextualCoderViewModel >> notifyStyledTextChanged [ styledText: self styledText). ] -{ #category : 'private - addons' } +{ #category : #'private - addons' } GtTextualCoderViewModel >> onAddOnsChanged: theAddOns [ "Is sent when new add-ons are computed" @@ -507,7 +507,7 @@ GtTextualCoderViewModel >> onAddOnsChanged: theAddOns [ self contextMenuActions: theAddOns contextMenuActions ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderViewModel >> onAstChanged: anAstChangedAnnouncement [ "ast changed, the styled text may not be valid anymore" @@ -520,21 +520,21 @@ GtTextualCoderViewModel >> onAstChanged: anAstChangedAnnouncement [ self addOnsAsyncDo: [ :theAddOns | self announce: GtTextualCoderViewModelReadyToRestyle new ] ] -{ #category : 'api - styled text' } +{ #category : #'api - styled text' } GtTextualCoderViewModel >> onNewStyledTextSet: aNewStyledText [ "Is sent after a new value of the styledText is assigned" >#onNewPropertySetHookTemplate'> ] -{ #category : 'api - styled text' } +{ #category : #'api - styled text' } GtTextualCoderViewModel >> onPreviousStyledTextUnset: aPreviousStyledText [ "Is sent after a previous value of the styledText is de-assigned" >#onPreviousPropertyUnsetHookTemplate'> ] -{ #category : 'private - event handling' } +{ #category : #'private - event handling' } GtTextualCoderViewModel >> onSourceCodeChanged: anSourceCodeChangedAnnouncement [ "source code changed, meaning that the styled text is no longer correct" @@ -550,20 +550,20 @@ GtTextualCoderViewModel >> onSourceCodeChanged: anSourceCodeChangedAnnouncement self coderModel ensureAst ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtTextualCoderViewModel >> removeAllCoderTextAttributes: aCollectionOfGtTextualCoderTextAttributes [ aCollectionOfGtTextualCoderTextAttributes do: [ :eachCoderTextAttribute | self removeCoderTextAttributes: eachCoderTextAttribute ] ] -{ #category : 'api - refactorings' } +{ #category : #'api - refactorings' } GtTextualCoderViewModel >> removeAttribute: anAttribute [ | attributes | attributes := self extraTextAttributes select: [ :each | each textAttributes includes: anAttribute ]. self removeAllCoderTextAttributes: attributes ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtTextualCoderViewModel >> removeCoderTextAttributes: aGtTextualCoderTextAttributes [ | aCurrentText | @@ -578,31 +578,31 @@ GtTextualCoderViewModel >> removeCoderTextAttributes: aGtTextualCoderTextAttribu self announce: (GtTextualCoderViewModelTextAttributesRemoved new coderTextAttributes: aGtTextualCoderTextAttributes) ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtTextualCoderViewModel >> select: aFromCursorIndex to: aToCursorIndex [ self selection: (self selection copy select: aFromCursorIndex to: aToCursorIndex) ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtTextualCoderViewModel >> selectNone [ self selection: BlCompositeSelection new ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtTextualCoderViewModel >> selection [ ^ selection ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtTextualCoderViewModel >> selection: aBlCompositeSelection [ self selection: aBlCompositeSelection from: self ] -{ #category : 'api - selection' } +{ #category : #'api - selection' } GtTextualCoderViewModel >> selection: aBlCompositeSelection from: aSourceObject [ selection = aBlCompositeSelection ifTrue: [ ^ self ]. @@ -611,7 +611,7 @@ GtTextualCoderViewModel >> selection: aBlCompositeSelection from: aSourceObject self notifySelectionChanged: selection from: aSourceObject ] -{ #category : 'api - shortcuts' } +{ #category : #'api - shortcuts' } GtTextualCoderViewModel >> shortcuts [ "Return a collection of current editor shortcuts that are computed based on the coder add-ons and extra view-model add-ons. Do not modify the returned collection as it will be recomputed when ast or add-ons change; instead use #addShortcut:" @@ -620,7 +620,7 @@ GtTextualCoderViewModel >> shortcuts [ ^ shortcuts ] -{ #category : 'api - shortcuts' } +{ #category : #'api - shortcuts' } GtTextualCoderViewModel >> shortcuts: aCollectionOfShortcuts [ shortcuts = aCollectionOfShortcuts ifTrue: [ ^ self ]. @@ -629,7 +629,7 @@ GtTextualCoderViewModel >> shortcuts: aCollectionOfShortcuts [ self announce: GtTextualCoderViewModelShortcutsChanged new ] -{ #category : 'api - add-ons' } +{ #category : #'api - add-ons' } GtTextualCoderViewModel >> shouldAddOnsBeUpdated [ "Return true if addons should be updated, false otherwise. When a Coder Model is attached to the corresponding Element that element should check if addons need to be updated and if it is the case start the update with the help of ${method:GtCoderModel>>#updateAddOnsFrom:}$" @@ -641,14 +641,14 @@ GtTextualCoderViewModel >> shouldAddOnsBeUpdated [ ifNotNil: [ :theAddOns | theAddOns shouldBeUpdated ] ] ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtTextualCoderViewModel >> sourceText [ ^ self coderModel sourceText ] -{ #category : 'api - text' } +{ #category : #'api - text' } GtTextualCoderViewModel >> sourceText: aNewSourceText from: aSourceObject synchronously: isSynchronous [ self coderModel currentSourceText: aNewSourceText @@ -657,7 +657,7 @@ GtTextualCoderViewModel >> sourceText: aNewSourceText from: aSourceObject synch isSynchronous: isSynchronous) ] -{ #category : 'api - styled text' } +{ #category : #'api - styled text' } GtTextualCoderViewModel >> styledText [ @@ -666,7 +666,7 @@ GtTextualCoderViewModel >> styledText [ ^ styledText ] -{ #category : 'api - styled text' } +{ #category : #'api - styled text' } GtTextualCoderViewModel >> styledText: aNewStyledText [ @@ -687,12 +687,12 @@ GtTextualCoderViewModel >> styledText: aNewStyledText [ self notifyStyledTextChanged ] -{ #category : 'api - stylers' } +{ #category : #'api - stylers' } GtTextualCoderViewModel >> stylers [ ^ stylers ] -{ #category : 'api - stylers' } +{ #category : #'api - stylers' } GtTextualCoderViewModel >> stylers: theStylers [ stylers = theStylers ifTrue: [ ^ self ]. @@ -707,7 +707,7 @@ GtTextualCoderViewModel >> stylers: theStylers [ self announce: GtTextualCoderViewModelStylersChanged new ] -{ #category : 'api - coder model' } +{ #category : #'api - coder model' } GtTextualCoderViewModel >> subscribeToCoderModel [ super subscribeToCoderModel. @@ -722,7 +722,7 @@ GtTextualCoderViewModel >> subscribeToCoderModel [ to: self ] -{ #category : 'api - add-ons' } +{ #category : #'api - add-ons' } GtTextualCoderViewModel >> terminateAddOnsCommand [ addOnMonitor critical: [ addOnCommand ifNotNil: [ :anAddOnsCommand | anAddOnsCommand terminate ]. @@ -730,7 +730,7 @@ GtTextualCoderViewModel >> terminateAddOnsCommand [ addOnCommandBlock := nil ] ] -{ #category : 'api - styled text' } +{ #category : #'api - styled text' } GtTextualCoderViewModel >> unsetStyledText [ >#propertyUnsetterTemplate'> @@ -745,7 +745,7 @@ GtTextualCoderViewModel >> unsetStyledText [ self notifyStyledTextChanged ] -{ #category : 'api - coder model' } +{ #category : #'api - coder model' } GtTextualCoderViewModel >> unsubscribeFromCoderModel [ super unsubscribeFromCoderModel. diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelAddOnsChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelAddOnsChanged.class.st index 2ebdf2585..442b0dac8 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelAddOnsChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelAddOnsChanged.class.st @@ -1,18 +1,18 @@ Class { - #name : 'GtTextualCoderViewModelAddOnsChanged', - #superclass : 'GtTextualCoderViewModelAnnouncement', + #name : #GtTextualCoderViewModelAddOnsChanged, + #superclass : #GtTextualCoderViewModelAnnouncement, #instVars : [ 'addOns' ], #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelAddOnsChanged >> addOns [ ^ addOns ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelAddOnsChanged >> addOns: anObject [ addOns := anObject ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelAnnouncement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelAnnouncement.class.st index 25e571df2..baebada4f 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelAnnouncement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelAnnouncement.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtTextualCoderViewModelAnnouncement', - #superclass : 'Announcement', + #name : #GtTextualCoderViewModelAnnouncement, + #superclass : #Announcement, #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelAstChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelAstChanged.class.st index 60dd1173d..8b4857d01 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelAstChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelAstChanged.class.st @@ -1,18 +1,18 @@ Class { - #name : 'GtTextualCoderViewModelAstChanged', - #superclass : 'GtTextualCoderViewModelAnnouncement', + #name : #GtTextualCoderViewModelAstChanged, + #superclass : #GtTextualCoderViewModelAnnouncement, #instVars : [ 'ast' ], #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelAstChanged >> ast [ ^ ast ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelAstChanged >> ast: anObject [ ast := anObject ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelContextActionsChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelContextActionsChanged.class.st index 6b006b2f7..31bea0d2d 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelContextActionsChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelContextActionsChanged.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtTextualCoderViewModelContextActionsChanged', - #superclass : 'GtTextualCoderViewModelAnnouncement', + #name : #GtTextualCoderViewModelContextActionsChanged, + #superclass : #GtTextualCoderViewModelAnnouncement, #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelContextMenuActionsChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelContextMenuActionsChanged.class.st index 35eff09fd..e4037d396 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelContextMenuActionsChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelContextMenuActionsChanged.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtTextualCoderViewModelContextMenuActionsChanged', - #superclass : 'GtTextualCoderViewModelAnnouncement', + #name : #GtTextualCoderViewModelContextMenuActionsChanged, + #superclass : #GtTextualCoderViewModelAnnouncement, #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelCursorsChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelCursorsChanged.class.st index e1721c0cd..48f217f5c 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelCursorsChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelCursorsChanged.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtTextualCoderViewModelCursorsChanged', - #superclass : 'GtTextualCoderViewModelAnnouncement', + #name : #GtTextualCoderViewModelCursorsChanged, + #superclass : #GtTextualCoderViewModelAnnouncement, #instVars : [ 'source', 'cursors' @@ -8,22 +8,22 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelCursorsChanged >> cursors [ ^ cursors ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelCursorsChanged >> cursors: anObject [ cursors := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelCursorsChanged >> source [ ^ source ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelCursorsChanged >> source: anObject [ source := anObject ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelExpansionChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelExpansionChanged.class.st index 0e793da52..1e47fbb7c 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelExpansionChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelExpansionChanged.class.st @@ -1,18 +1,18 @@ Class { - #name : 'GtTextualCoderViewModelExpansionChanged', - #superclass : 'GtTextualCoderViewModelAnnouncement', + #name : #GtTextualCoderViewModelExpansionChanged, + #superclass : #GtTextualCoderViewModelAnnouncement, #instVars : [ 'expanded' ], #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelExpansionChanged >> expanded [ ^ expanded ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelExpansionChanged >> expanded: aBoolean [ expanded := aBoolean ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelMainActionsChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelMainActionsChanged.class.st index ad3a090f6..43330f290 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelMainActionsChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelMainActionsChanged.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtTextualCoderViewModelMainActionsChanged', - #superclass : 'GtTextualCoderViewModelAnnouncement', + #name : #GtTextualCoderViewModelMainActionsChanged, + #superclass : #GtTextualCoderViewModelAnnouncement, #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelReadyToRestyle.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelReadyToRestyle.class.st index 4203b075b..cd570bfdf 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelReadyToRestyle.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelReadyToRestyle.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtTextualCoderViewModelReadyToRestyle', - #superclass : 'GtTextualCoderViewModelAnnouncement', + #name : #GtTextualCoderViewModelReadyToRestyle, + #superclass : #GtTextualCoderViewModelAnnouncement, #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelSelectionChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelSelectionChanged.class.st index c9b976a50..fbdc887da 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelSelectionChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelSelectionChanged.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtTextualCoderViewModelSelectionChanged', - #superclass : 'GtTextualCoderViewModelAnnouncement', + #name : #GtTextualCoderViewModelSelectionChanged, + #superclass : #GtTextualCoderViewModelAnnouncement, #instVars : [ 'source', 'selection' @@ -8,22 +8,22 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelSelectionChanged >> selection [ ^ selection ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelSelectionChanged >> selection: anObject [ selection := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelSelectionChanged >> source [ ^ source ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelSelectionChanged >> source: anObject [ source := anObject ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelShortcutsChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelShortcutsChanged.class.st index 49b725897..6b6fa3cb9 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelShortcutsChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelShortcutsChanged.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtTextualCoderViewModelShortcutsChanged', - #superclass : 'GtTextualCoderViewModelAnnouncement', + #name : #GtTextualCoderViewModelShortcutsChanged, + #superclass : #GtTextualCoderViewModelAnnouncement, #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelStyledTextChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelStyledTextChanged.class.st index 290eda7f9..a33fdc44b 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelStyledTextChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelStyledTextChanged.class.st @@ -1,13 +1,13 @@ Class { - #name : 'GtTextualCoderViewModelStyledTextChanged', - #superclass : 'GtTextualCoderViewModelAnnouncement', + #name : #GtTextualCoderViewModelStyledTextChanged, + #superclass : #GtTextualCoderViewModelAnnouncement, #instVars : [ 'styledText' ], #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } -{ #category : 'generated' } +{ #category : #generated } GtTextualCoderViewModelStyledTextChanged >> styledText [ >#objectGetterTemplate'> @@ -15,7 +15,7 @@ GtTextualCoderViewModelStyledTextChanged >> styledText [ ^ styledText ] -{ #category : 'generated' } +{ #category : #generated } GtTextualCoderViewModelStyledTextChanged >> styledText: aStyledText [ >#objectSetterTemplate'> diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelStylersChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelStylersChanged.class.st index 8abca3996..1be39f84c 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelStylersChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelStylersChanged.class.st @@ -1,5 +1,5 @@ Class { - #name : 'GtTextualCoderViewModelStylersChanged', - #superclass : 'GtTextualCoderViewModelAnnouncement', + #name : #GtTextualCoderViewModelStylersChanged, + #superclass : #GtTextualCoderViewModelAnnouncement, #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextAttributesAdded.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextAttributesAdded.class.st index 69f35f6d9..559a65547 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextAttributesAdded.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextAttributesAdded.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtTextualCoderViewModelTextAttributesAdded', - #superclass : 'GtTextualCoderViewModelAnnouncement', + #name : #GtTextualCoderViewModelTextAttributesAdded, + #superclass : #GtTextualCoderViewModelAnnouncement, #instVars : [ 'coderTextAttributes', 'startPosition', @@ -9,32 +9,32 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelTextAttributesAdded >> coderTextAttributes [ ^ coderTextAttributes ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelTextAttributesAdded >> coderTextAttributes: anObject [ coderTextAttributes := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelTextAttributesAdded >> startPosition [ ^ startPosition ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelTextAttributesAdded >> startPosition: anObject [ startPosition := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelTextAttributesAdded >> stopPosition [ ^ stopPosition ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelTextAttributesAdded >> stopPosition: anObject [ stopPosition := anObject ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextAttributesRemoved.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextAttributesRemoved.class.st index e6e8241e6..effd1f400 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextAttributesRemoved.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextAttributesRemoved.class.st @@ -1,18 +1,18 @@ Class { - #name : 'GtTextualCoderViewModelTextAttributesRemoved', - #superclass : 'GtTextualCoderViewModelAnnouncement', + #name : #GtTextualCoderViewModelTextAttributesRemoved, + #superclass : #GtTextualCoderViewModelAnnouncement, #instVars : [ 'coderTextAttributes' ], #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelTextAttributesRemoved >> coderTextAttributes [ ^ coderTextAttributes ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelTextAttributesRemoved >> coderTextAttributes: anObject [ coderTextAttributes := anObject ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextChanged.class.st index 5d1e95353..0e6d1aa30 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextChanged.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtTextualCoderViewModelTextChanged', - #superclass : 'GtTextualCoderViewModelAnnouncement', + #name : #GtTextualCoderViewModelTextChanged, + #superclass : #GtTextualCoderViewModelAnnouncement, #instVars : [ 'text', 'updateStrategy' @@ -8,32 +8,32 @@ Class { #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' } -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelTextChanged >> isSynchronous [ ^ self updateStrategy isSynchronous ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelTextChanged >> source [ ^ self updateStrategy source ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelTextChanged >> text [ ^ text ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelTextChanged >> text: anObject [ text := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelTextChanged >> updateStrategy [ ^ updateStrategy ] -{ #category : 'accessing' } +{ #category : #accessing } GtTextualCoderViewModelTextChanged >> updateStrategy: anObject [ updateStrategy := anObject ] diff --git a/src/GToolkit-Coder-UI/RBAddClassVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBAddClassVariableRefactoring.extension.st index dc4dae786..3afe79dd1 100644 --- a/src/GToolkit-Coder-UI/RBAddClassVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBAddClassVariableRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBAddClassVariableRefactoring' } +Extension { #name : #RBAddClassVariableRefactoring } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } RBAddClassVariableRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/RBAddInstanceVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBAddInstanceVariableRefactoring.extension.st index 1e6342e68..c54c63196 100644 --- a/src/GToolkit-Coder-UI/RBAddInstanceVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBAddInstanceVariableRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBAddInstanceVariableRefactoring' } +Extension { #name : #RBAddInstanceVariableRefactoring } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } RBAddInstanceVariableRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/RBRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRefactoring.extension.st index 5acca20e2..5dfe0ecf1 100644 --- a/src/GToolkit-Coder-UI/RBRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBRefactoring' } +Extension { #name : #RBRefactoring } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } RBRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/RBRemoveClassVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRemoveClassVariableRefactoring.extension.st index 91780cc1c..515063afb 100644 --- a/src/GToolkit-Coder-UI/RBRemoveClassVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBRemoveClassVariableRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBRemoveClassVariableRefactoring' } +Extension { #name : #RBRemoveClassVariableRefactoring } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } RBRemoveClassVariableRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/RBRemoveInstanceVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRemoveInstanceVariableRefactoring.extension.st index 661def9e9..54daab99c 100644 --- a/src/GToolkit-Coder-UI/RBRemoveInstanceVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBRemoveInstanceVariableRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBRemoveInstanceVariableRefactoring' } +Extension { #name : #RBRemoveInstanceVariableRefactoring } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } RBRemoveInstanceVariableRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/RBRenameClassRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRenameClassRefactoring.extension.st index a3377598d..9e8c10631 100644 --- a/src/GToolkit-Coder-UI/RBRenameClassRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBRenameClassRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBRenameClassRefactoring' } +Extension { #name : #RBRenameClassRefactoring } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } RBRenameClassRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/RBRenameClassVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRenameClassVariableRefactoring.extension.st index 009ed66f1..fd3f38aa4 100644 --- a/src/GToolkit-Coder-UI/RBRenameClassVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBRenameClassVariableRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBRenameClassVariableRefactoring' } +Extension { #name : #RBRenameClassVariableRefactoring } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } RBRenameClassVariableRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/RBRenameInstanceVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRenameInstanceVariableRefactoring.extension.st index e1732c3f1..2b29bcf97 100644 --- a/src/GToolkit-Coder-UI/RBRenameInstanceVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBRenameInstanceVariableRefactoring.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBRenameInstanceVariableRefactoring' } +Extension { #name : #RBRenameInstanceVariableRefactoring } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } RBRenameInstanceVariableRefactoring >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/RBTransformation.extension.st b/src/GToolkit-Coder-UI/RBTransformation.extension.st index 85e4edab8..2da892fec 100644 --- a/src/GToolkit-Coder-UI/RBTransformation.extension.st +++ b/src/GToolkit-Coder-UI/RBTransformation.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'RBTransformation' } +Extension { #name : #RBTransformation } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } RBTransformation >> gtDescription [ diff --git a/src/GToolkit-Coder-UI/TBlDevScripterTarget.extension.st b/src/GToolkit-Coder-UI/TBlDevScripterTarget.extension.st index fdda33985..ac516b20c 100644 --- a/src/GToolkit-Coder-UI/TBlDevScripterTarget.extension.st +++ b/src/GToolkit-Coder-UI/TBlDevScripterTarget.extension.st @@ -1,6 +1,6 @@ -Extension { #name : 'TBlDevScripterTarget' } +Extension { #name : #TBlDevScripterTarget } -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } TBlDevScripterTarget >> onGtPharoSnippetDestinationButton [ self onChildNamed: #content; @@ -8,7 +8,7 @@ TBlDevScripterTarget >> onGtPharoSnippetDestinationButton [ onChildNamed: #switchButton ] -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } TBlDevScripterTarget >> onGtPharoSnippetEvaluateButton [ self "onChildOfClass: GtExpandableCoderElement;" @@ -20,7 +20,7 @@ TBlDevScripterTarget >> onGtPharoSnippetEvaluateButton [ onChildAt: 1 ] -{ #category : '*GToolkit-Coder-UI' } +{ #category : #'*GToolkit-Coder-UI' } TBlDevScripterTarget >> onGtPharoSnippetPlayButton [ self onChildNamed: #content; diff --git a/src/GToolkit-Coder-UI/TGtCoderNavigationClassesHelper.trait.st b/src/GToolkit-Coder-UI/TGtCoderNavigationClassesHelper.trait.st index c30cf9ec1..f71942481 100644 --- a/src/GToolkit-Coder-UI/TGtCoderNavigationClassesHelper.trait.st +++ b/src/GToolkit-Coder-UI/TGtCoderNavigationClassesHelper.trait.st @@ -1,9 +1,9 @@ Trait { - #name : 'TGtCoderNavigationClassesHelper', + #name : #TGtCoderNavigationClassesHelper, #category : 'GToolkit-Coder-UI-Navigation' } -{ #category : 'private - ui' } +{ #category : #'private - ui' } TGtCoderNavigationClassesHelper >> buildClassLabel: aClass [ | aLook aText | aLook := (BrGlamorousLabelAptitude new fontSize: 12). @@ -23,12 +23,12 @@ TGtCoderNavigationClassesHelper >> buildClassLabel: aClass [ text: aText. ] -{ #category : 'private - testing' } +{ #category : #'private - testing' } TGtCoderNavigationClassesHelper >> isAbstractClass: aClass [ ^ aClass isAbstract or: [ aClass hasAbstractMethods ] ] -{ #category : 'private - testing' } +{ #category : #'private - testing' } TGtCoderNavigationClassesHelper >> isDeprecatedClass: aClass [ ^ aClass isDeprecated ] diff --git a/src/GToolkit-Coder-UI/TGtWithCoderModel.trait.st b/src/GToolkit-Coder-UI/TGtWithCoderModel.trait.st index 8af096e17..0f6494a9d 100644 --- a/src/GToolkit-Coder-UI/TGtWithCoderModel.trait.st +++ b/src/GToolkit-Coder-UI/TGtWithCoderModel.trait.st @@ -1,12 +1,12 @@ Trait { - #name : 'TGtWithCoderModel', + #name : #TGtWithCoderModel, #instVars : [ 'coderModel' ], #category : 'GToolkit-Coder-UI-Coder - Basic' } -{ #category : 'api - coder model' } +{ #category : #'api - coder model' } TGtWithCoderModel >> coderModel [ "Return a not-null coder model assigned to the receiver view model" self @@ -16,7 +16,7 @@ TGtWithCoderModel >> coderModel [ ^ coderModel ] -{ #category : 'api - coder model' } +{ #category : #'api - coder model' } TGtWithCoderModel >> coderModel: aCoderModel [ "Set a not-null coder domain model assigned to the receiver view model" self @@ -33,7 +33,7 @@ TGtWithCoderModel >> coderModel: aCoderModel [ self subscribeToCoderModel ] -{ #category : 'api - coder model' } +{ #category : #'api - coder model' } TGtWithCoderModel >> hasCoder [ "Return a true if coder model is assigned to the receiver, false otherwise" @@ -41,21 +41,21 @@ TGtWithCoderModel >> hasCoder [ ^ coderModel notNil ] -{ #category : 'api - coder model' } +{ #category : #'api - coder model' } TGtWithCoderModel >> onCoderModelChanged [ "Is sent when a new coder model is assigned to the view model" self explicitRequirement ] -{ #category : 'api - coder model' } +{ #category : #'api - coder model' } TGtWithCoderModel >> subscribeToCoderModel [ "Is sent after a new coder model is assigned to the view model. It is required to unsubscribe from the domain model by implementing #unsubscribeFromCoderModel if view model subscribes to them" ] -{ #category : 'api - coder model' } +{ #category : #'api - coder model' } TGtWithCoderModel >> unsubscribeFromCoderModel [ "Is sent before a new coder model is assigned to the view model. View models that subscribe to coder model are required to implement this methods" diff --git a/src/GToolkit-Coder-UI/TGtWithCoderToolViewModel.trait.st b/src/GToolkit-Coder-UI/TGtWithCoderToolViewModel.trait.st index 2fe498778..17a7c89df 100644 --- a/src/GToolkit-Coder-UI/TGtWithCoderToolViewModel.trait.st +++ b/src/GToolkit-Coder-UI/TGtWithCoderToolViewModel.trait.st @@ -1,12 +1,12 @@ Trait { - #name : 'TGtWithCoderToolViewModel', + #name : #TGtWithCoderToolViewModel, #instVars : [ 'coderToolViewModel' ], #category : 'GToolkit-Coder-UI-! Core - View Models' } -{ #category : 'api - coder tool view model' } +{ #category : #'api - coder tool view model' } TGtWithCoderToolViewModel >> coderToolViewModel [ "Return a not-null coderTool view model assigned to the receiver element" self @@ -16,7 +16,7 @@ TGtWithCoderToolViewModel >> coderToolViewModel [ ^ coderToolViewModel ] -{ #category : 'api - coder tool view model' } +{ #category : #'api - coder tool view model' } TGtWithCoderToolViewModel >> coderToolViewModel: aCoderToolViewModel [ "Set a not-null coderTool view model assigned to the receiver element" self @@ -34,7 +34,7 @@ TGtWithCoderToolViewModel >> coderToolViewModel: aCoderToolViewModel [ self onPostCoderToolViewModelChanged ] -{ #category : 'api - coder tool view model' } +{ #category : #'api - coder tool view model' } TGtWithCoderToolViewModel >> hasCoderToolViewModel [ "Return a true if coderTool view model is assigned to the receiver element, false otherwise" @@ -42,7 +42,7 @@ TGtWithCoderToolViewModel >> hasCoderToolViewModel [ ^ coderToolViewModel notNil ] -{ #category : 'api - coder tool view model' } +{ #category : #'api - coder tool view model' } TGtWithCoderToolViewModel >> onCoderToolViewModelChanged [ "Is sent when a new coderTool view model is assigned to the element. Note: #onCoderToolViewModelChanged is sent before #subscribeToCoderToolViewModel @@ -53,21 +53,21 @@ TGtWithCoderToolViewModel >> onCoderToolViewModelChanged [ self explicitRequirement ] -{ #category : 'api - coder tool view model' } +{ #category : #'api - coder tool view model' } TGtWithCoderToolViewModel >> onPostCoderToolViewModelChanged [ "I am an optional hook method that is sent after #subscribeToCoderToolViewModel. I do nothing by default but allow users to perform update operations when a receiver object is already subscribed to announcements." ] -{ #category : 'api - coder tool view model' } +{ #category : #'api - coder tool view model' } TGtWithCoderToolViewModel >> subscribeToCoderToolViewModel [ "Is sent after a new coderTool view model is assigned to the element. It is required to unsubscribe from the view model or domain model by implementing #unsubscribeFromCoderToolViewModel if elements subscribe to them" ] -{ #category : 'api - coder tool view model' } +{ #category : #'api - coder tool view model' } TGtWithCoderToolViewModel >> unsubscribeFromCoderToolViewModel [ "Is sent before a new coderTool view model is assigned to the element. Elements that subscribe to coderTool view model in domain model are required to implement this methods." diff --git a/src/GToolkit-Coder-UI/TGtWithTextualCoderViewModel.trait.st b/src/GToolkit-Coder-UI/TGtWithTextualCoderViewModel.trait.st index ce8a7ea3c..cf4932b1a 100644 --- a/src/GToolkit-Coder-UI/TGtWithTextualCoderViewModel.trait.st +++ b/src/GToolkit-Coder-UI/TGtWithTextualCoderViewModel.trait.st @@ -1,12 +1,12 @@ Trait { - #name : 'TGtWithTextualCoderViewModel', + #name : #TGtWithTextualCoderViewModel, #instVars : [ 'textualCoderViewModel' ], #category : 'GToolkit-Coder-UI-Coder - Textual' } -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } TGtWithTextualCoderViewModel >> hasTextualCoderViewModel [ "Return a true if textualCoder view model is assigned to the receiver element, false otherwise" @@ -14,14 +14,14 @@ TGtWithTextualCoderViewModel >> hasTextualCoderViewModel [ ^ textualCoderViewModel notNil ] -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } TGtWithTextualCoderViewModel >> onPostTextualCoderViewModelChanged [ "I am an optional hook method that is sent after #subscribeToTextualCoderViewModel. I do nothing by default but allow users to perform update operations when a receiver object is already subscribed to announcements." ] -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } TGtWithTextualCoderViewModel >> onTextualCoderViewModelChanged [ "Is sent when a new textualCoder view model is assigned to the element. Note: #onTextualCoderViewModelChanged is sent before #subscribeToTextualCoderViewModel @@ -32,14 +32,14 @@ TGtWithTextualCoderViewModel >> onTextualCoderViewModelChanged [ self explicitRequirement ] -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } TGtWithTextualCoderViewModel >> subscribeToTextualCoderViewModel [ "Is sent after a new textualCoder view model is assigned to the element. It is required to unsubscribe from the view model or domain model by implementing #unsubscribeFromTextualCoderViewModel if elements subscribe to them" ] -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } TGtWithTextualCoderViewModel >> textualCoderViewModel [ "Return a not-null textualCoder view model assigned to the receiver element" self @@ -49,7 +49,7 @@ TGtWithTextualCoderViewModel >> textualCoderViewModel [ ^ textualCoderViewModel ] -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } TGtWithTextualCoderViewModel >> textualCoderViewModel: aTextualCoderViewModel [ "Set a not-null textualCoder view model assigned to the receiver element" self @@ -67,7 +67,7 @@ TGtWithTextualCoderViewModel >> textualCoderViewModel: aTextualCoderViewModel [ self onPostTextualCoderViewModelChanged ] -{ #category : 'api - textual coder view model' } +{ #category : #'api - textual coder view model' } TGtWithTextualCoderViewModel >> unsubscribeFromTextualCoderViewModel [ "Is sent before a new textualCoder view model is assigned to the element. Elements that subscribe to textualCoder view model in domain model are required to implement this methods." diff --git a/src/GToolkit-Coder-UI/package.st b/src/GToolkit-Coder-UI/package.st index 433afab60..1af08cc70 100644 --- a/src/GToolkit-Coder-UI/package.st +++ b/src/GToolkit-Coder-UI/package.st @@ -1 +1 @@ -Package { #name : 'GToolkit-Coder-UI' } +Package { #name : #'GToolkit-Coder-UI' } From a097f2a52ac2d6ee7e7ea7e2e6ea286dc2de7893 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 14 Oct 2021 09:58:46 +0200 Subject: [PATCH 0045/1268] add promised source coder --- .../GtSourceCoderPromised.class.st | 335 ++++++++++++++++++ .../GtTextCoderPromised.class.st | 64 ++++ .../GtTextualCoderPromised.class.st | 274 ++++++++++++++ 3 files changed, 673 insertions(+) create mode 100644 src/GToolkit-Coder-Promised/GtSourceCoderPromised.class.st create mode 100644 src/GToolkit-Coder-Promised/GtTextCoderPromised.class.st create mode 100644 src/GToolkit-Coder-Promised/GtTextualCoderPromised.class.st diff --git a/src/GToolkit-Coder-Promised/GtSourceCoderPromised.class.st b/src/GToolkit-Coder-Promised/GtSourceCoderPromised.class.st new file mode 100644 index 000000000..ed7fb4105 --- /dev/null +++ b/src/GToolkit-Coder-Promised/GtSourceCoderPromised.class.st @@ -0,0 +1,335 @@ +Class { + #name : #GtSourceCoderPromised, + #superclass : #GtTextualCoderPromised, + #category : #'GToolkit-Coder-Promised' +} + +{ #category : #'api - actions' } +GtSourceCoderPromised >> debug [ + self debugInContext: self evaluationContext +] + +{ #category : #'private - actions' } +GtSourceCoderPromised >> debug: aSourceStringOrBlock inContext: aGtSourceCoderEvaluationContext [ + | aSourceString aSourceInterval aCompleteSourceString | + + self critical: [ + aCompleteSourceString := aSourceStringOrBlock isClosure + ifTrue: [ aSourceStringOrBlock cull: self ] + ifFalse: [ aSourceStringOrBlock ]. + aSourceString := aGtSourceCoderEvaluationContext sourceInterval computeSourceString: aCompleteSourceString. + aSourceInterval := aGtSourceCoderEvaluationContext sourceInterval computeSourceInterval: aCompleteSourceString. ]. + + aGtSourceCoderEvaluationContext + sourceString: aCompleteSourceString; + evaluatedSourceString: aSourceString; + evaluatedInterval: aSourceInterval. + + self + primitiveDebug: aSourceString + inContext: aGtSourceCoderEvaluationContext + onFailDo: [ self error: 'Failed to debug' ] +] + +{ #category : #'api - actions' } +GtSourceCoderPromised >> debugInContext: aGtSourceCoderEvaluationContext [ + self debug: self currentSourceString inContext: aGtSourceCoderEvaluationContext +] + +{ #category : #'api - actions' } +GtSourceCoderPromised >> discardChanges [ + "Discard not-accepted changes." + + self isModified + ifFalse: [ ^ self ]. + + self sourceCode resetCollapsedText. + self sourceCode resetSourceText. + + self sourceChanged +] + +{ #category : #'api - actions' } +GtSourceCoderPromised >> doItAll [ + "Evaluate the whole source code in a default evaluation context and return the result. + See the implementation of #evaluationContext to find the default state" + + ^ self doItInContext: self evaluationContext +] + +{ #category : #'api - actions' } +GtSourceCoderPromised >> doItAndGo [ + "Evaluate and inspect the whole source code in a default evaluation context and return the result. + See the implementation of #evaluationContext to find the default state" + + ^ self doItAndGoInContext: self evaluationContext +] + +{ #category : #'api - actions' } +GtSourceCoderPromised >> doItAndGoInContext: aGtSourceCoderEvaluationContext [ + ^ self + evaluate: [ :thisCoder | thisCoder currentSourceString ] + inContext: aGtSourceCoderEvaluationContext + thenDo: [ :anEvaluationResult | + self notifyEvaluatedWithResult: anEvaluationResult. + self notifyObjectSpawnFromEvaluationResult: anEvaluationResult ] +] + +{ #category : #'api - actions' } +GtSourceCoderPromised >> doItInContext: aGtSourceCoderEvaluationContext [ + ^ self + doItInContext: aGtSourceCoderEvaluationContext + thenDo: [ :aResult | self notifyEvaluatedWithResult: aResult ] +] + +{ #category : #'api - actions' } +GtSourceCoderPromised >> doItInContext: aGtSourceCoderEvaluationContext thenDo: aBlock [ + ^ self + evaluate: [ :thisCoder | thisCoder currentSourceString ] + inContext: aGtSourceCoderEvaluationContext + thenDo: aBlock +] + +{ #category : #'private - actions' } +GtSourceCoderPromised >> evaluate: aSourceStringOrBlock [ + "Evaluate a given source code and show the print string if needed" + + ^ self + evaluate: aSourceStringOrBlock + thenDo: [ ] +] + +{ #category : #'private - actions' } +GtSourceCoderPromised >> evaluate: aSourceStringOrBlock decorated: aSourceCodeDecorator inContext: aSourceCoderEvaluationContext thenDo: aThenBlock [ + "Evaluate a given source code" + | aCompleteSourceString aSourceString aSourceInterval aResult aDecoratedSourceString | + + "we can not wrap everything in a critical: because if there is an exception while evaluating + the source code the current running process will be suspended, meaning that the very next evaluation + will indefinitely wait when trying to enter a critical section." + self critical: [ + aCompleteSourceString := aSourceStringOrBlock isClosure + ifTrue: [ aSourceStringOrBlock cull: self ] + ifFalse: [ aSourceStringOrBlock ]. + + aSourceString := aSourceCoderEvaluationContext sourceInterval computeSourceString: aCompleteSourceString. + aSourceInterval := aSourceCoderEvaluationContext sourceInterval computeSourceInterval: aCompleteSourceString ]. + + aDecoratedSourceString := aSourceCodeDecorator value: aSourceString. + + aSourceCoderEvaluationContext + sourceString: aCompleteSourceString; + evaluatedSourceString: aSourceString; + evaluatedInterval: aSourceInterval. + + aResult := self evaluateBlock: [ + self + primitiveEvaluate: aDecoratedSourceString + inContext: aSourceCoderEvaluationContext + onFailDo: [ + | aResultWithSyntaxError | + + aResultWithSyntaxError := GtSourceCoderEvaluationResultWithSyntaxError new + evaluationContext: aSourceCoderEvaluationContext. + aThenBlock cull: aResultWithSyntaxError. + ^ aResultWithSyntaxError ] ] + onErrorDo: [ :aResultWithError | + aResultWithError + evaluationContext: aSourceCoderEvaluationContext ]. + + aResult evaluationContext: aSourceCoderEvaluationContext. + aThenBlock cull: aResult. + ^ aResult +] + +{ #category : #'private - actions' } +GtSourceCoderPromised >> evaluate: aSourceStringOrBlock inContext: aGtSourceCoderEvaluationContext thenDo: aThenBlock [ + ^ self + evaluate: aSourceStringOrBlock + decorated: [ :aSourceString | aSourceString ] + inContext: aGtSourceCoderEvaluationContext + thenDo: aThenBlock +] + +{ #category : #'private - actions' } +GtSourceCoderPromised >> evaluate: aSourceStringOrBlock thenDo: aThenBlock [ + "Evaluate a given source code and show the print string if needed" + + ^ self + evaluate: aSourceStringOrBlock + inContext: self evaluationContext + thenDo: aThenBlock +] + +{ #category : #'private - actions' } +GtSourceCoderPromised >> evaluateBlock: aBlock onErrorDo: anErrorBlock [ + + | aResult wasErrorAlreadySignaled | + + wasErrorAlreadySignaled := false. + aResult := aBlock + on: Error + do: [ :anError | + | aResultWithError | + + NonInteractiveTranscript stdout + nextPut: $[; + nextPutAll: self class name; + nextPut: $]; + space; + print: anError; + cr. + + aResultWithError := GtSourceCoderEvaluationResultWithRuntimeError new + isResignaled: wasErrorAlreadySignaled; + error: anError. + + "let the caller to set source string and source interval" + anErrorBlock value: aResultWithError. + + wasErrorAlreadySignaled + ifTrue: [ + "Continue the handling of this exception. This will open a debugger + if the error is not caught elsewhere." + anError pass. + ^ nil ] + ifFalse: [ + wasErrorAlreadySignaled := true. + + aResultWithError error: (GtCoderEvaluationUnhandledError new + exception: anError; + sourceCoder: self; + sourceString: aResultWithError sourceString; + sourceInterval: aResultWithError sourceInterval). + + anError resignalAs: aResultWithError error. + ^ nil ]. + + "Normally, the process will be terminated during error handling, however if debugger fails to open + it may not be terminated, so we should return a result with an explicit error " + ^ aResultWithError ]. + + ^ GtSourceCoderEvaluationResultWithValue new value: aResult +] + +{ #category : #'private - actions' } +GtSourceCoderPromised >> evaluationContext [ + + + ^ GtSourceCoderEvaluationContext new + requesterObject: self; + coder: self +] + +{ #category : #testing } +GtSourceCoderPromised >> hasImplicitVariableReferenceTo: aString [ + self implicitVariableReferencesTo: aString do: [ :each | ^ true ]. + ^ false +] + +{ #category : #'api - ast' } +GtSourceCoderPromised >> implicitVariableReferencesTo: aString do: aBlock [ + "Evaluate aBlock for every ast node that is a variable reference to an implicitly defined variable named aString." + + +] + +{ #category : #'private - notifying' } +GtSourceCoderPromised >> notifyEvaluatedWithResult: anEvaluationResult [ + self announce: (GtCoderEvaluationAnnouncement new + evaluationResult: anEvaluationResult; + coder: self) +] + +{ #category : #'private - notifying' } +GtSourceCoderPromised >> notifyObjectSpawn: anObject [ + self + notifyObjectSpawn: anObject + withDestination: self spawnDestination +] + +{ #category : #'private - notifying' } +GtSourceCoderPromised >> notifyObjectSpawn: anObject withDestination: aSpawnDestination [ + self announce: (GtCoderObjectSpawnRequest new + object: anObject; + spawnDestination: aSpawnDestination; + coder: self) +] + +{ #category : #'private - notifying' } +GtSourceCoderPromised >> notifyObjectSpawnFromEvaluationResult: anEvaluationResult [ + + anEvaluationResult isSuccess + ifFalse: [ ^ self ]. + + self + notifyObjectSpawn: anEvaluationResult value +] + +{ #category : #'private - notifying' } +GtSourceCoderPromised >> notifyPrintResult: anEvaluationResult [ + self announce: (GtCoderPrintAnnouncement new + evaluationResult: anEvaluationResult; + coder: self) +] + +{ #category : #'private - notifying' } +GtSourceCoderPromised >> notifyShowDebuggerRequest: aDebugSession dueTo: anException sourceString: aSourceString sourceInterval: aSourceInterval [ + (self announcer subscriptionsForClass: GtCoderShowDebuggerRequest) size isZero + ifTrue: [ + ^ Smalltalk tools debugger + openOn: aDebugSession + withFullView: true ]. + + self announce: (GtCoderShowDebuggerRequest new + coder: self; + debugSession: aDebugSession; + exception: anException; + sourceString: aSourceString; + sourceInterval: aSourceInterval) +] + +{ #category : #'private - actions' } +GtSourceCoderPromised >> primitiveDebug: aSourceString inContext: aGtSourceCoderEvaluationContext onFailDo: anEvaluationFailBlock [ + ^ self subclassResponsibility +] + +{ #category : #'private - actions' } +GtSourceCoderPromised >> primitiveEvaluate: aSourceString inContext: aGtSourceCoderEvaluationContext onFailDo: anEvaluationFailBlock [ + ^ self subclassResponsibility +] + +{ #category : #'api - actions' } +GtSourceCoderPromised >> printItInContext: aGtSourceCoderEvaluationContext [ + ^ self + evaluate: [ :thisCoder | thisCoder currentSourceString ] + inContext: aGtSourceCoderEvaluationContext + thenDo: [ :aResult | self notifyPrintResult: aResult ] +] + +{ #category : #'api - ast' } +GtSourceCoderPromised >> renameImplicitTemporary: oldName to: newName [ + | source | + source := SmaCCString on: self currentSourceString. + self + implicitVariableReferencesTo: oldName + do: + [ :node | + source + replaceFrom: node startPosition + to: node stopPosition + with: newName ]. + self currentSourceString: source asString +] + +{ #category : #accessing } +GtSourceCoderPromised >> spawnDestination [ + ^ self + attributeNamed: #spawnDestination + ifAbsent: [ GtPhlowSpawnDesiredDestination defaultDestination ] +] + +{ #category : #accessing } +GtSourceCoderPromised >> spawnDestination: aSpawnDestination [ + self attributeNamed: #spawnDestination put: aSpawnDestination +] diff --git a/src/GToolkit-Coder-Promised/GtTextCoderPromised.class.st b/src/GToolkit-Coder-Promised/GtTextCoderPromised.class.st new file mode 100644 index 000000000..18422766f --- /dev/null +++ b/src/GToolkit-Coder-Promised/GtTextCoderPromised.class.st @@ -0,0 +1,64 @@ +Class { + #name : #GtTextCoderPromised, + #superclass : #GtTextualCoderPromised, + #instVars : [ + 'parser', + 'parserStartingState' + ], + #category : #'GToolkit-Coder-Promised' +} + +{ #category : #'as yet unclassified' } +GtTextCoderPromised >> asCoderUIModel [ + ^ GtTextualCoderViewModel new coder: self +] + +{ #category : #'api - ast' } +GtTextCoderPromised >> computeAst: theSourceString [ + ^ parser + ifNil: [ theSourceString ] + ifNotNil: [ + parserStartingState + ifNil: [ parser parseWithErrors: theSourceString ] + ifNotNil: [ parser parseWithErrors: theSourceString startingAt: parserStartingState ] ] +] + +{ #category : #initialization } +GtTextCoderPromised >> forString: aString [ + self sourceCode: (GtCoderExplicitSourceCode new source: aString) +] + +{ #category : #initialization } +GtTextCoderPromised >> forText: aText [ + self sourceCode: (GtCoderExplicitTextSource new text: aText) +] + +{ #category : #'instance creation' } +GtTextCoderPromised >> newCompletionStrategy [ + ^ GtCompletionStrategy new +] + +{ #category : #accessing } +GtTextCoderPromised >> parser [ + ^ parser +] + +{ #category : #accessing } +GtTextCoderPromised >> parser: anObject [ + parser := anObject +] + +{ #category : #accessing } +GtTextCoderPromised >> parserStartingState [ + ^ parserStartingState +] + +{ #category : #accessing } +GtTextCoderPromised >> parserStartingState: anObject [ + parserStartingState := anObject +] + +{ #category : #'api - ast' } +GtTextCoderPromised >> supportsAstCache [ + ^ false +] diff --git a/src/GToolkit-Coder-Promised/GtTextualCoderPromised.class.st b/src/GToolkit-Coder-Promised/GtTextualCoderPromised.class.st new file mode 100644 index 000000000..5d2693467 --- /dev/null +++ b/src/GToolkit-Coder-Promised/GtTextualCoderPromised.class.st @@ -0,0 +1,274 @@ +Class { + #name : #GtTextualCoderPromised, + #superclass : #GtCoderModel, + #instVars : [ + 'sourceCode', + 'completionStrategy', + 'astPromise' + ], + #category : #'GToolkit-Coder-Promised' +} + +{ #category : #'as yet unclassified' } +GtTextualCoderPromised >> addCopyCutPasteContextMenuAddOnsAst: anAst to: coderAddOns [ + + coderAddOns + addContextMenuItem: 'Cut' + action: [ :aCoderViewModel :anEditorElement | anEditorElement editor cutSelected ] + id: GtTextualCoderCutContextMenuItemId; + addContextMenuItem: 'Copy' + action: [ :aCoderViewModel :anEditorElement | anEditorElement editor copySelected ] + id: GtTextualCoderCopyContextMenuItemId; + addContextMenuItem: 'Paste' + action: [ :aCoderViewModel :anEditorElement | anEditorElement editor paste ] + id: GtTextualCoderPasteContextMenuItemId +] + +{ #category : #'private - addons' } +GtTextualCoderPromised >> addOnsClass [ + ^ GtTextualCoderAddOns +] + +{ #category : #converting } +GtTextualCoderPromised >> asCoderViewModel [ + ^ GtTextualCoderViewModelPromised new coder: self +] + +{ #category : #'api - converting' } +GtTextualCoderPromised >> asNewCoderModelWithSameSubject [ + "Return new coder model with same subject (e.g., package, class, method)" + + + ^ self shouldNotImplement +] + +{ #category : #'api - ast' } +GtTextualCoderPromised >> ast [ + + + ^ self critical: [ astPromise ifNil: [ astPromise := self sourceCode currentSourceString asyncThen: [ :aGtCoderSourceString | + GtCoderAst new + ast: (self computeAst: aGtCoderSourceString string); + epoch: aGtCoderSourceString epoch ] ] ] +] + +{ #category : #'api - ast' } +GtTextualCoderPromised >> astAwait [ + ^ self ast wait ast +] + +{ #category : #'as yet unclassified' } +GtTextualCoderPromised >> breadcrumbActions [ + + + ^ #() +] + +{ #category : #'api - accessing' } +GtTextualCoderPromised >> completionStrategy [ + + + ^ completionStrategy + ifNil: [ completionStrategy := self newCompletionStrategy ] +] + +{ #category : #'api - accessing' } +GtTextualCoderPromised >> completionStrategy: aGtCompletionStrategy [ + completionStrategy := aGtCompletionStrategy +] + +{ #category : #'api - ast' } +GtTextualCoderPromised >> computeAst: aString [ + ^ self subclassResponsibility +] + +{ #category : #'api - text' } +GtTextualCoderPromised >> correctFrom: aFromIndex to: aToIndex with: aString [ + self critical: [ + self sourceCode + replaceFrom: aFromIndex + to: aToIndex + withString: aString. + self sourceChanged. + self notifyCorrectionFrom: aFromIndex to: aToIndex with: aString ] +] + +{ #category : #'api - text' } +GtTextualCoderPromised >> currentSourceString [ + "Return a String representation of the current source text" + + + ^ self critical: [ self sourceCode currentSourceString then: [ :aGtCoderSourceString | aGtCoderSourceString string ] ] +] + +{ #category : #'api - text' } +GtTextualCoderPromised >> currentSourceString: aString [ + "Set a new source text" + + self critical: [ + self sourceCode currentSourceString: aString. + self sourceChanged ] +] + +{ #category : #'api - text' } +GtTextualCoderPromised >> currentSourceText [ + + + ^ self critical: [ self sourceCode currentSourceText then: [ :aGtCoderSourceText | aGtCoderSourceText text ] ] +] + +{ #category : #'api - text' } +GtTextualCoderPromised >> currentSourceText: aText [ + "Set a new source text" + + self critical: [ + self sourceCode currentSourceText: aText. + self sourceChanged ] +] + +{ #category : #'api - text' } +GtTextualCoderPromised >> currentSourceText: aText with: aGtCoderUpdateStragegy [ + "Set a new source text" + + self critical: [ + self sourceCode currentSourceText: aText. + self sourceChangedWith: aGtCoderUpdateStragegy ] +] + +{ #category : #'api - text' } +GtTextualCoderPromised >> currentSourceTextSynchronously: aText [ + "Set a new source text" + + self critical: [ + self sourceCode currentSourceText: aText. + self sourceChangedWith: GtCoderUpdateStrategy new makeSynchronous ] +] + +{ #category : #initialize } +GtTextualCoderPromised >> initialize [ + super initialize. + + self reset +] + +{ #category : #testing } +GtTextualCoderPromised >> isModified [ + + + ^ self sourceCode isModified +] + +{ #category : #'instance creation' } +GtTextualCoderPromised >> newCompletionStrategy [ + ^ self subclassResponsibility +] + +{ #category : #'private - notifying' } +GtTextualCoderPromised >> notifyCorrectionFrom: aFromIndex to: aToIndex with: aString [ + self announce: (GtCoderCorrectionRequest new + coder: self; + fromIndex: aFromIndex; + toIndex: aToIndex; + correctionString: aString) +] + +{ #category : #'private - notifying' } +GtTextualCoderPromised >> notifySourceChangedWith: anUpdateStragegy [ + "Notify the text editor that it should update the text (for example due to refactoring changes)" + + self announce: (GtCoderSourceCodeChanged new + updateStrategy: anUpdateStragegy; + coder: self) +] + +{ #category : #private } +GtTextualCoderPromised >> pragmasNamed: aSymbol inHierarchy: aClass [ + | actions | + actions := OrderedCollection new. + aClass withAllSuperclassesDo: [ :each | actions addAll: (Pragma allNamed: aSymbol in: each) ]. + actions sort: [ :a :b | a arguments first < b arguments first ]. + ^ actions +] + +{ #category : #'api - text' } +GtTextualCoderPromised >> requestStyleSourceText [ + "Request the text editor to restyle the text (for example due to environmental changes)" + + self resetAstCache. + self announce: (GtCoderStyleTextRequest new coder: self) +] + +{ #category : #initialize } +GtTextualCoderPromised >> reset [ + self resetAstCache. + + "initialized lazily in #sourceCode" + sourceCode := nil. + completionStrategy := nil +] + +{ #category : #'private - ast' } +GtTextualCoderPromised >> resetAstCache [ + astPromise := nil +] + +{ #category : #'private - notifying' } +GtTextualCoderPromised >> sourceChanged [ + self sourceChangedWith: GtCoderUpdateStrategy new makeAsynchronous +] + +{ #category : #'private - notifying' } +GtTextualCoderPromised >> sourceChangedWith: anUpdateStrategy [ + astPromise := nil. + self notifySourceChangedWith: anUpdateStrategy. +] + +{ #category : #'api - accessing' } +GtTextualCoderPromised >> sourceCode [ + + + sourceCode ifNil: [ self sourceCode: (GtCoderExplicitSourceCode new source: '') ]. + ^ sourceCode +] + +{ #category : #'api - accessing' } +GtTextualCoderPromised >> sourceCode: aGtCoderSourceCode [ + "Set the source code of this coder to a given one and notify about the changes" + + self + sourceCode: aGtCoderSourceCode + withStrategy: GtCoderUpdateStrategy new makeAsynchronous +] + +{ #category : #'api - accessing' } +GtTextualCoderPromised >> sourceCode: aGtCoderSourceCode withStrategy: anUpdateStragegy [ + "Set the source code of this coder to a given one and notify about the changes" + + sourceCode := aGtCoderSourceCode. + self sourceChangedWith: anUpdateStragegy. +] + +{ #category : #'api - accessing' } +GtTextualCoderPromised >> sourceCodeSynchronously: aGtCoderSourceCode [ + self + sourceCode: aGtCoderSourceCode + withStrategy: GtCoderUpdateStrategy new makeSynchronous +] + +{ #category : #'api - text' } +GtTextualCoderPromised >> sourceText [ + + + self + deprecated: 'Use #currentSourceText' + transformWith: '`@receiver sourceText' -> '`@receiver currentSourceText'. + + ^ self currentSourceText +] + +{ #category : #'api - ast' } +GtTextualCoderPromised >> supportsAstCache [ + "Return true if ast cache should be used, false otherwise" + + ^ true +] From 8fdf69bb6655b46f25036f5d3272e29ef8689184 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 14 Oct 2021 10:00:53 +0200 Subject: [PATCH 0046/1268] remove assertion --- src/GToolkit-Coder-UI/GtSourceCoderContentModel.class.st | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderContentModel.class.st b/src/GToolkit-Coder-UI/GtSourceCoderContentModel.class.st index 06267a140..586f25644 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderContentModel.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderContentModel.class.st @@ -28,12 +28,6 @@ GtSourceCoderContentModel >> sourceCoder [ { #category : #accessing } GtSourceCoderContentModel >> sourceCoder: aGtSourceCoderUIModel [ - self - assert: [ - (aGtSourceCoderUIModel isKindOf: GtSourceCoderViewModel) - or: [aGtSourceCoderUIModel isKindOf: GtSourceCoderViewModelPromised] ] - description: [ 'Should be a Source Coder UI Model' ]. - sourceCoder := aGtSourceCoderUIModel. self notifySourceCoderChanged: aGtSourceCoderUIModel ] From d7f3c4a52ef73209c0ba62924a1477a2def9eb79 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 14 Oct 2021 15:56:35 -0300 Subject: [PATCH 0047/1268] make example status icons as squares --- src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st | 4 ++-- .../GtFilterRunExampleButtonAptitude.class.st | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st index a41326d1d..a2f977a0d 100644 --- a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st @@ -87,9 +87,9 @@ GtCoderExampleStateElement >> initialize [ self layout: BlLinearLayout horizontal; - geometry: BlCircle new; + geometry: BlSquare new; margin: (BlInsets all: 1); - exact: 8@8. + exact: 12@12. self initializeInteractiveLook. self initializeTooltipLook. diff --git a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonAptitude.class.st b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonAptitude.class.st index ff92a6cd9..39ddc675b 100644 --- a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonAptitude.class.st @@ -14,7 +14,7 @@ Class { 'mutex', 'isUpdateRequested' ], - #category : 'GToolkit-Coder-UI-Filters' + #category : #'GToolkit-Coder-UI-Filters' } { #category : #'private - updating' } @@ -73,7 +73,7 @@ GtFilterRunExampleButtonAptitude >> initialize [ { #category : #initialization } GtFilterRunExampleButtonAptitude >> initializeIconElement: anElement [ anElement - geometry: BlCircle new; + geometry: BlSquare new; margin: (BlInsets all: 1); size: 8 @ 8. ] From b279333987f7b76ce62c29d1c30d749bbcae04d9 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 18 Oct 2021 10:37:56 -0300 Subject: [PATCH 0048/1268] add "play all methods coder test cases" button [feenkcom/gtoolkit#2175] --- .../Behavior.extension.st | 14 +++++++ .../GtCodersCodersChanged.class.st | 40 ++++++++++++++++++- src/GToolkit-Coder/GtCodersModel.class.st | 6 ++- 3 files changed, 58 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-Extensions/Behavior.extension.st b/src/GToolkit-Coder-Extensions/Behavior.extension.st index 0b0dddf58..88bc62ae2 100644 --- a/src/GToolkit-Coder-Extensions/Behavior.extension.st +++ b/src/GToolkit-Coder-Extensions/Behavior.extension.st @@ -63,6 +63,8 @@ Behavior >> gtCoderMethodsFor: aView context: aPhlowContext [ content: [ :element | aMethodsCoder codeGeneratorsDropDown: element for: aMethodsCoderUIModel ]; actionStencil: [ self runAllExamplesButtonForMethodsCoder: aMethodsCoder ]; + actionStencil: + [ self newTestSuiteButtonForMethodsCoder: aMethodsCoder ]; stencil: [ aMethodsCoderUIModel asElement ] ] @@ -76,6 +78,18 @@ Behavior >> methodsCoderFromContext: aPhlowContext [ ifAbsentPut: [ (GtClassMethodsCoder forClass: self) asCoderUIModel ] ] +{ #category : #'*GToolkit-Coder-Extensions' } +Behavior >> newTestSuiteButtonForMethodsCoder: aMethodsCoder [ + ^ BrButton new + addAptitude: + (GtPharoTestSuiteAptitude new coder: aMethodsCoder); + addAptitude: BrGlamorousButtonWithIconAptitude - BrGlamorousButtonWithLabelTooltipAptitude; + "addAptitude: (GtFilterRunExampleButtonTooltipAptitude new coder: aMethodsCoder);" + icon: BrGlamorousVectorIcons play; + label: 'Run Test Cases'; + action: [ :element | aMethodsCoder testSuite playSelectedFrom: element ] +] + { #category : #'*GToolkit-Coder-Extensions' } Behavior >> runAllExamplesButtonForMethodsCoder: aMethodsCoder [ ^ BrButton new diff --git a/src/GToolkit-Coder/GtCodersCodersChanged.class.st b/src/GToolkit-Coder/GtCodersCodersChanged.class.st index 2b0feba21..eae03a050 100644 --- a/src/GToolkit-Coder/GtCodersCodersChanged.class.st +++ b/src/GToolkit-Coder/GtCodersCodersChanged.class.st @@ -1,5 +1,43 @@ Class { #name : #GtCodersCodersChanged, #superclass : #GtCodersAnnouncement, - #category : 'GToolkit-Coder-Event' + #instVars : [ + 'newCoders', + 'oldCoders' + ], + #category : #'GToolkit-Coder-Event' } + +{ #category : #accessing } +GtCodersCodersChanged >> addedCoders [ + + ^ self newCoders reject: [ :aCoder | + self oldCoders identityIncludes: aCoder ] +] + +{ #category : #accessing } +GtCodersCodersChanged >> newCoders [ + ^ newCoders +] + +{ #category : #accessing } +GtCodersCodersChanged >> newCoders: aCollection [ + oldCoders := aCollection +] + +{ #category : #accessing } +GtCodersCodersChanged >> oldCoders [ + ^ oldCoders +] + +{ #category : #accessing } +GtCodersCodersChanged >> oldCoders: aCollection [ + oldCoders := aCollection +] + +{ #category : #accessing } +GtCodersCodersChanged >> removedCoders [ + + ^ self oldCoders reject: [ :aCoder | + self newCoders identityIncludes: aCoder ] +] diff --git a/src/GToolkit-Coder/GtCodersModel.class.st b/src/GToolkit-Coder/GtCodersModel.class.st index d991ac661..fee752fe0 100644 --- a/src/GToolkit-Coder/GtCodersModel.class.st +++ b/src/GToolkit-Coder/GtCodersModel.class.st @@ -8,7 +8,7 @@ Class { 'items', 'coders' ], - #category : 'GToolkit-Coder-Coders' + #category : #'GToolkit-Coder-Coders' } { #category : #'initialize-release' } @@ -116,10 +116,14 @@ GtCodersModel >> unsubscribeFromSystem [ { #category : #updating } GtCodersModel >> updateCoders [ + | oldCoders | + oldCoders := coders. coders := items collect: [ :each | self newCoderFor: each ]. self announce: (GtCodersCodersChanged new coders: self; + oldCoders: oldCoders; + newCoders: coders; yourself) ] From 4d42bdc23b9d1a6ee84840037d7175caa2e22336 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 19 Oct 2021 08:45:50 -0300 Subject: [PATCH 0049/1268] properly test which example to execute --- src/GToolkit-Coder/GtCoderExampler.class.st | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder/GtCoderExampler.class.st b/src/GToolkit-Coder/GtCoderExampler.class.st index d08d697b9..58b045dd5 100644 --- a/src/GToolkit-Coder/GtCoderExampler.class.st +++ b/src/GToolkit-Coder/GtCoderExampler.class.st @@ -10,7 +10,7 @@ Class { #instVars : [ 'coder' ], - #category : 'GToolkit-Coder-Exampler' + #category : #'GToolkit-Coder-Exampler' } { #category : #'api - instance creation' } @@ -171,8 +171,10 @@ GtCoderExampler >> runExamplesFrom: anElement [ { #category : #'api - execution' } GtCoderExampler >> runNoTestExamples [ + self selectedExecutableExampleCodersDo: [ :eachCoder | - (eachCoder isModified not and: [ eachCoder example hasNoTestPragma ]) ifTrue: [ + (eachCoder isModified not and: [ + eachCoder example hasNoTestPragma not ]) ifTrue: [ eachCoder example run ] ] ] From 9ea6e2fa2479f0be17c6fcd4afd3fa310b1ab417 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 19 Oct 2021 11:23:40 -0300 Subject: [PATCH 0050/1268] revert the previous commit --- src/GToolkit-Coder/GtCoderExampler.class.st | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/GToolkit-Coder/GtCoderExampler.class.st b/src/GToolkit-Coder/GtCoderExampler.class.st index 58b045dd5..70b12c3c5 100644 --- a/src/GToolkit-Coder/GtCoderExampler.class.st +++ b/src/GToolkit-Coder/GtCoderExampler.class.st @@ -171,10 +171,8 @@ GtCoderExampler >> runExamplesFrom: anElement [ { #category : #'api - execution' } GtCoderExampler >> runNoTestExamples [ - self selectedExecutableExampleCodersDo: [ :eachCoder | - (eachCoder isModified not and: [ - eachCoder example hasNoTestPragma not ]) ifTrue: [ + (eachCoder isModified not and: [ eachCoder example hasNoTestPragma ]) ifTrue: [ eachCoder example run ] ] ] From 78beb2296ef5cc71c1009e6639a10569d482ddbe Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 20 Oct 2021 10:07:27 -0300 Subject: [PATCH 0051/1268] add `GtTextualCoderViewModel>>#asExpandedOnlyElement` [feenkcom/gtoolkit#2175] --- src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st | 9 +++++++++ .../GtTextualCoderViewModel.extension.st | 10 ++++++++++ 2 files changed, 19 insertions(+) create mode 100644 src/GToolkit-Coder-UI/GtTextualCoderViewModel.extension.st diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 5e4992e63..428c9d49a 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -165,6 +165,15 @@ GtTextualCoderViewModel >> asEditorState [ ^ aMemento ] +{ #category : #'*GToolkit-Coder-UI' } +GtTextualCoderViewModel >> asExpandedOnlyElement [ + "Create an element for just the expanded coder without expander" + + ^ GtExpandedOnlyCoderElement new + coderUIModel: self asCoderUIModel; + yourself +] + { #category : #'api - coder model' } GtTextualCoderViewModel >> astAsyncDo: aBlock [ ^ self coderModel astAsyncDo: aBlock diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.extension.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.extension.st new file mode 100644 index 000000000..95bbf7fd7 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.extension.st @@ -0,0 +1,10 @@ +Extension { #name : #GtTextualCoderViewModel } + +{ #category : #'*GToolkit-Coder-UI' } +GtTextualCoderViewModel >> asExpandedOnlyElement [ + "Create an element for just the expanded coder without expander" + + ^ GtExpandedOnlyCoderElement new + coderUIModel: self asCoderUIModel; + yourself +] From 2a66e3df3ee663611b2ef5747843b2d9fdce276b Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 20 Oct 2021 12:13:07 -0300 Subject: [PATCH 0052/1268] add `GtCoderUIUtility` [feenkcom/gtoolkit#2175] --- .../Behavior.extension.st | 11 +++-------- .../GtCoderUIUtility.class.st | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 src/GToolkit-Coder-Extensions/GtCoderUIUtility.class.st diff --git a/src/GToolkit-Coder-Extensions/Behavior.extension.st b/src/GToolkit-Coder-Extensions/Behavior.extension.st index 88bc62ae2..ed703be4c 100644 --- a/src/GToolkit-Coder-Extensions/Behavior.extension.st +++ b/src/GToolkit-Coder-Extensions/Behavior.extension.st @@ -80,14 +80,9 @@ Behavior >> methodsCoderFromContext: aPhlowContext [ { #category : #'*GToolkit-Coder-Extensions' } Behavior >> newTestSuiteButtonForMethodsCoder: aMethodsCoder [ - ^ BrButton new - addAptitude: - (GtPharoTestSuiteAptitude new coder: aMethodsCoder); - addAptitude: BrGlamorousButtonWithIconAptitude - BrGlamorousButtonWithLabelTooltipAptitude; - "addAptitude: (GtFilterRunExampleButtonTooltipAptitude new coder: aMethodsCoder);" - icon: BrGlamorousVectorIcons play; - label: 'Run Test Cases'; - action: [ :element | aMethodsCoder testSuite playSelectedFrom: element ] + + ^ GtCoderUIUtility newTestSuiteButtonForMethodsCoder: + aMethodsCoder ] { #category : #'*GToolkit-Coder-Extensions' } diff --git a/src/GToolkit-Coder-Extensions/GtCoderUIUtility.class.st b/src/GToolkit-Coder-Extensions/GtCoderUIUtility.class.st new file mode 100644 index 000000000..cda7cc6c3 --- /dev/null +++ b/src/GToolkit-Coder-Extensions/GtCoderUIUtility.class.st @@ -0,0 +1,19 @@ +Class { + #name : #GtCoderUIUtility, + #superclass : #Object, + #category : #'GToolkit-Coder-Extensions' +} + +{ #category : #'instance creation' } +GtCoderUIUtility class >> newTestSuiteButtonForMethodsCoder: aMethodsCoder [ + + ^ BrButton new + addAptitude: (GtPharoTestSuiteAptitude new coder: aMethodsCoder); + addAptitude: BrGlamorousButtonWithIconAptitude + - BrGlamorousButtonWithLabelTooltipAptitude; + "addAptitude: (GtFilterRunExampleButtonTooltipAptitude new coder: aMethodsCoder);" + icon: BrGlamorousVectorIcons play; + label: 'Run Test Cases'; + action: [ :element | + aMethodsCoder testSuite playSelectedFrom: element ] +] From 4cf3612c05b234773b29c8bee5006bea189f4d95 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 20 Oct 2021 23:10:59 -0300 Subject: [PATCH 0053/1268] move `GtSearchFilter>>#gtHierarchyFor:` into `GToolkit-Extensions` --- .../GtSearchFilter.extension.st | 58 ------------------- 1 file changed, 58 deletions(-) delete mode 100644 src/GToolkit-Coder-Extensions/GtSearchFilter.extension.st diff --git a/src/GToolkit-Coder-Extensions/GtSearchFilter.extension.st b/src/GToolkit-Coder-Extensions/GtSearchFilter.extension.st deleted file mode 100644 index b4b5ba62e..000000000 --- a/src/GToolkit-Coder-Extensions/GtSearchFilter.extension.st +++ /dev/null @@ -1,58 +0,0 @@ -Extension { #name : #GtSearchFilter } - -{ #category : #'*GToolkit-Coder-Extensions' } -GtSearchFilter class >> gtHierarchyFor: aView [ - - - ^ aView mondrian - title: 'Hierarchy'; - priority: 10; - painting: [ :m | - m nodes - stencil: [ :eachClass | - | anExpander text | - text := (eachClass = GtSearchFilter - ifTrue: ['Filter'] - ifFalse: [ - (eachClass name gtRemovePrefix: 'GtSearch') - gtRemoveSuffix: 'Filter' ]) - asRopedText - glamorousRegularFont; - fontSize: 18. - anExpander := BrExpander new. - anExpander vFitContent; hExact: 300. - anExpander aptitude: GtCoderExpanderAptitude new. - anExpander header: [ BlTextElement new - padding: (BlInsets left: 5 right: 5); - text: text ]. - anExpander content: [ - | container methods | - container := BlElement new - layout: BlLinearLayout vertical; - constraintsDo: [ :c | c vertical fitContent. c horizontal fitContent]. - container addChild: (BlTextElement new - padding: (BlInsets left: 5 right: 5); - text: text). - methods := eachClass = GtSearchFilter - ifTrue: [ (GtSearchFilter methods select: #isOverridden) ] - ifFalse: [ eachClass methods select: [:method | - method gtIsOverridingUpTo: GtSearchFilter ] ]. - methods do: [:aMethod | - container addChild: ((GtPharoMethodCoder forMethod: aMethod) asElement)]. - container ]. - anExpander margin: (BlInsets all: 10). - ]; - with: self withAllSubclasses. - m edges - stencil: [ :each | - BlLineElement new - zIndex: -1; - border: (BlBorder paint: (Color gray alpha: 0.5) width: 1); - fromHead: (BlArrowheadTriangle new scale: 4; background: Color white; - border: (BlBorder paint: (Color gray alpha: 0.5) width: 1))]; - fromRightCenter; - toLeftCenter; - connectFrom: #superclass. - m layout explicit: (GtGraphHorizontalTreeLayout new layered horizontalGap: 20; verticalGap: 10). - ] -] From 3e7dd6ec8df3766c62f00d871fa98f866c979bb6 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 21 Oct 2021 13:57:13 -0300 Subject: [PATCH 0054/1268] add play all test cases button tooltip [feenkcom/gtoolkit#2175] --- src/GToolkit-Coder-Extensions/GtCoderUIUtility.class.st | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-Extensions/GtCoderUIUtility.class.st b/src/GToolkit-Coder-Extensions/GtCoderUIUtility.class.st index cda7cc6c3..4f13db3f3 100644 --- a/src/GToolkit-Coder-Extensions/GtCoderUIUtility.class.st +++ b/src/GToolkit-Coder-Extensions/GtCoderUIUtility.class.st @@ -11,9 +11,11 @@ GtCoderUIUtility class >> newTestSuiteButtonForMethodsCoder: aMethodsCoder [ addAptitude: (GtPharoTestSuiteAptitude new coder: aMethodsCoder); addAptitude: BrGlamorousButtonWithIconAptitude - BrGlamorousButtonWithLabelTooltipAptitude; - "addAptitude: (GtFilterRunExampleButtonTooltipAptitude new coder: aMethodsCoder);" + addAptitude: (GtPharoStateTooltipAptitude new + coder: aMethodsCoder; + statesProvider: GtPharoTestCaseStateProvider new); icon: BrGlamorousVectorIcons play; label: 'Run Test Cases'; action: [ :element | - aMethodsCoder testSuite playSelectedFrom: element ] + aMethodsCoder testSuite playSelectedFrom: element ] ] From 405228b344c972fa64d620ee806a0af67b2a59ab Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 21 Oct 2021 23:58:48 -0300 Subject: [PATCH 0055/1268] refactor play all examples button creation into an utility class [feenkcom/gtoolkit#2175] --- .../Behavior.extension.st | 10 ++-------- .../GtCoderUIUtility.class.st | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/GToolkit-Coder-Extensions/Behavior.extension.st b/src/GToolkit-Coder-Extensions/Behavior.extension.st index ed703be4c..6be487984 100644 --- a/src/GToolkit-Coder-Extensions/Behavior.extension.st +++ b/src/GToolkit-Coder-Extensions/Behavior.extension.st @@ -87,12 +87,6 @@ Behavior >> newTestSuiteButtonForMethodsCoder: aMethodsCoder [ { #category : #'*GToolkit-Coder-Extensions' } Behavior >> runAllExamplesButtonForMethodsCoder: aMethodsCoder [ - ^ BrButton new - addAptitude: - (GtFilterRunExampleButtonFourStateIconAptitude new coder: aMethodsCoder); - addAptitude: BrGlamorousButtonWithIconAptitude - BrGlamorousButtonWithLabelTooltipAptitude; - addAptitude: (GtFilterRunExampleButtonTooltipAptitude new coder: aMethodsCoder); - icon: BrGlamorousVectorIcons play; - label: 'Run All Examples'; - action: [ :element | aMethodsCoder exampler runExamplesFrom: element ] + + ^ GtCoderUIUtility newExamplesButtonForMethodsCoder: aMethodsCoder ] diff --git a/src/GToolkit-Coder-Extensions/GtCoderUIUtility.class.st b/src/GToolkit-Coder-Extensions/GtCoderUIUtility.class.st index 4f13db3f3..25b12cb84 100644 --- a/src/GToolkit-Coder-Extensions/GtCoderUIUtility.class.st +++ b/src/GToolkit-Coder-Extensions/GtCoderUIUtility.class.st @@ -4,6 +4,23 @@ Class { #category : #'GToolkit-Coder-Extensions' } +{ #category : #'instance creation' } +GtCoderUIUtility class >> newExamplesButtonForMethodsCoder: aMethodsCoder [ + + ^ BrButton new + addAptitude: + (GtFilterRunExampleButtonFourStateIconAptitude new coder: + aMethodsCoder); + addAptitude: BrGlamorousButtonWithIconAptitude + - BrGlamorousButtonWithLabelTooltipAptitude; + addAptitude: + (GtFilterRunExampleButtonTooltipAptitude new coder: aMethodsCoder); + icon: BrGlamorousVectorIcons play; + label: 'Run All Examples'; + action: [ :element | + aMethodsCoder exampler runExamplesFrom: element ] +] + { #category : #'instance creation' } GtCoderUIUtility class >> newTestSuiteButtonForMethodsCoder: aMethodsCoder [ From 557ef96674dc5074659810852cb2d330b47984f7 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 25 Oct 2021 15:13:12 -0300 Subject: [PATCH 0056/1268] add `GtCoderExampler>>#allExampleStates` [feenkcom/gtoolkit#2175] - overall code cleaning --- .../Behavior.extension.st | 44 ------------------- .../Class.extension.st | 31 ------------- .../GtCoderUIUtility.class.st | 38 ---------------- src/GToolkit-Coder/GtCoderExampler.class.st | 14 ++++++ 4 files changed, 14 insertions(+), 113 deletions(-) delete mode 100644 src/GToolkit-Coder-Extensions/Class.extension.st delete mode 100644 src/GToolkit-Coder-Extensions/GtCoderUIUtility.class.st diff --git a/src/GToolkit-Coder-Extensions/Behavior.extension.st b/src/GToolkit-Coder-Extensions/Behavior.extension.st index 6be487984..c70024979 100644 --- a/src/GToolkit-Coder-Extensions/Behavior.extension.st +++ b/src/GToolkit-Coder-Extensions/Behavior.extension.st @@ -37,37 +37,6 @@ Behavior >> gtCoderExamplesFor: aView context: aDictionary [ ifAbsent: [ aView empty ] ] -{ #category : #'*GToolkit-Coder-Extensions' } -Behavior >> gtCoderMethodsFor: aView context: aPhlowContext [ - - | aMethodsCoderUIModel aMethodsCoder | - - aMethodsCoderUIModel := self methodsCoderFromContext: aPhlowContext. - aMethodsCoder := aMethodsCoderUIModel coder. - - ^ aView explicit - priority: 10; - title: 'Methods'; - disableAsync; - actionDropdownButtonIcon: BrGlamorousVectorIcons filter - tooltip: 'Filter' - content: [ :element | aMethodsCoder filterDropDown: element ]; - actionButtonDo: [ :aButtonAction | - aButtonAction - icon: BrGlamorousVectorIcons add; - tooltip: 'Add new method'; - action: [ aMethodsCoderUIModel addNewCoder ]; - name: GtPharoBehaviorCoder addNewMethodButtonName ]; - actionDropdownButtonIcon: BrGlamorousVectorIcons robot - tooltip: 'Generate' - content: [ :element | aMethodsCoder codeGeneratorsDropDown: element for: aMethodsCoderUIModel ]; - actionStencil: - [ self runAllExamplesButtonForMethodsCoder: aMethodsCoder ]; - actionStencil: - [ self newTestSuiteButtonForMethodsCoder: aMethodsCoder ]; - stencil: [ aMethodsCoderUIModel asElement ] -] - { #category : #'*GToolkit-Coder-Extensions' } Behavior >> methodsCoderFromContext: aPhlowContext [ @@ -77,16 +46,3 @@ Behavior >> methodsCoderFromContext: aPhlowContext [ ifPresent: [ :aBehaviorCoderUIModel | aBehaviorCoderUIModel methodsCoderUIModel ] ifAbsentPut: [ (GtClassMethodsCoder forClass: self) asCoderUIModel ] ] - -{ #category : #'*GToolkit-Coder-Extensions' } -Behavior >> newTestSuiteButtonForMethodsCoder: aMethodsCoder [ - - ^ GtCoderUIUtility newTestSuiteButtonForMethodsCoder: - aMethodsCoder -] - -{ #category : #'*GToolkit-Coder-Extensions' } -Behavior >> runAllExamplesButtonForMethodsCoder: aMethodsCoder [ - - ^ GtCoderUIUtility newExamplesButtonForMethodsCoder: aMethodsCoder -] diff --git a/src/GToolkit-Coder-Extensions/Class.extension.st b/src/GToolkit-Coder-Extensions/Class.extension.st deleted file mode 100644 index 2ba2a1b2b..000000000 --- a/src/GToolkit-Coder-Extensions/Class.extension.st +++ /dev/null @@ -1,31 +0,0 @@ -Extension { #name : #Class } - -{ #category : #'*GToolkit-Coder-Extensions' } -Class >> gtExamplesMapFor: aView context: aPhlowContext [ - - - | aMethodsCoderUIModel aMethodsCoder | - aMethodsCoderUIModel := self methodsCoderFromContext: aPhlowContext. - aMethodsCoder := aMethodsCoderUIModel coder. - aMethodsCoder exampler hasExamples - ifFalse: [ ^ aView empty ]. - ^ aView forward - title: 'Examples map'; - priority: 11; - object: [ | allExamples | - allExamples := Array - streamContents: [ :aStream | - aMethodsCoder exampler - allExecutableExampleCodersDo: [ :aCoder :anExample | aStream nextPut: anExample ] ]. - GtExampleGroup withAll: allExamples ]; - view: #gtMapFor:; - actionStencilDo: [ :anExplicitAction | - anExplicitAction - priority: 80; - stencil: [ self runAllExamplesButtonForMethodsCoder: aMethodsCoder ] ]; - updateWhen: - GtCodersCoderAdded , GtCodersCoderRemoved , GtCodersCodersChanged - , GtCoderSourceCodeChanged - in: [ aMethodsCoder ]; - addAutoUpdate: GtPhlowUpdateViewOnAddedToScene -] diff --git a/src/GToolkit-Coder-Extensions/GtCoderUIUtility.class.st b/src/GToolkit-Coder-Extensions/GtCoderUIUtility.class.st deleted file mode 100644 index 25b12cb84..000000000 --- a/src/GToolkit-Coder-Extensions/GtCoderUIUtility.class.st +++ /dev/null @@ -1,38 +0,0 @@ -Class { - #name : #GtCoderUIUtility, - #superclass : #Object, - #category : #'GToolkit-Coder-Extensions' -} - -{ #category : #'instance creation' } -GtCoderUIUtility class >> newExamplesButtonForMethodsCoder: aMethodsCoder [ - - ^ BrButton new - addAptitude: - (GtFilterRunExampleButtonFourStateIconAptitude new coder: - aMethodsCoder); - addAptitude: BrGlamorousButtonWithIconAptitude - - BrGlamorousButtonWithLabelTooltipAptitude; - addAptitude: - (GtFilterRunExampleButtonTooltipAptitude new coder: aMethodsCoder); - icon: BrGlamorousVectorIcons play; - label: 'Run All Examples'; - action: [ :element | - aMethodsCoder exampler runExamplesFrom: element ] -] - -{ #category : #'instance creation' } -GtCoderUIUtility class >> newTestSuiteButtonForMethodsCoder: aMethodsCoder [ - - ^ BrButton new - addAptitude: (GtPharoTestSuiteAptitude new coder: aMethodsCoder); - addAptitude: BrGlamorousButtonWithIconAptitude - - BrGlamorousButtonWithLabelTooltipAptitude; - addAptitude: (GtPharoStateTooltipAptitude new - coder: aMethodsCoder; - statesProvider: GtPharoTestCaseStateProvider new); - icon: BrGlamorousVectorIcons play; - label: 'Run Test Cases'; - action: [ :element | - aMethodsCoder testSuite playSelectedFrom: element ] -] diff --git a/src/GToolkit-Coder/GtCoderExampler.class.st b/src/GToolkit-Coder/GtCoderExampler.class.st index 70b12c3c5..2fc91d105 100644 --- a/src/GToolkit-Coder/GtCoderExampler.class.st +++ b/src/GToolkit-Coder/GtCoderExampler.class.st @@ -24,6 +24,20 @@ GtCoderExampler >> allExampleCodersDo: aBlock [ self subclassResponsibility ] +{ #category : #'api - accessing' } +GtCoderExampler >> allExampleStates [ + + | aSet | + aSet := Set new. + + self allExecutableExampleCodersDo: [ :aCoder :anExample | + | aState | + aState := GtFilterExampleState default stateFromExample: anExample. + aSet add: aState ]. + + ^ aSet +] + { #category : #'api - enumeration' } GtCoderExampler >> allExecutableExampleCodersDo: aBlock [ self allExampleCodersDo: [ :aCoder :anExample | From bd9a9ac556f018ac2cddc34cad1b230aaf8987e5 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 25 Oct 2021 15:47:18 -0300 Subject: [PATCH 0057/1268] add addOns container margins in `GtSourceCoderCollapsedAddOnsAptitude` [feenkcom/gtoolkit#2175] --- .../GtSourceCoderCollapsedAddOnsAptitude.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedAddOnsAptitude.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedAddOnsAptitude.class.st index 21c53c80a..3f2da29f7 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedAddOnsAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedAddOnsAptitude.class.st @@ -21,7 +21,7 @@ GtSourceCoderCollapsedAddOnsAptitude >> initialize [ GtSourceCoderCollapsedAddOnsAptitude >> newAddOnsContainer [ ^ BrHorizontalPane new fitContent - addChild: (BrGlamorousIcons inspect asElement) + margin: (BlInsets top: 4 left: 1 bottom: 1 right: 1) ] { #category : #'private - hooks' } From 74c0b2e8f431af953c0db76c5583c5443ded03ff Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 28 Oct 2021 16:49:00 -0300 Subject: [PATCH 0058/1268] add assertions in `GtCodersCodersChanged` [feenkcom/gtoolkit#2175] --- src/GToolkit-Coder/GtCodersCodersChanged.class.st | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder/GtCodersCodersChanged.class.st b/src/GToolkit-Coder/GtCodersCodersChanged.class.st index eae03a050..85025c36e 100644 --- a/src/GToolkit-Coder/GtCodersCodersChanged.class.st +++ b/src/GToolkit-Coder/GtCodersCodersChanged.class.st @@ -22,16 +22,27 @@ GtCodersCodersChanged >> newCoders [ { #category : #accessing } GtCodersCodersChanged >> newCoders: aCollection [ - oldCoders := aCollection + + self + assert: [ aCollection isNotNil ] + description: [ 'New coders collection must be non-nil' ]. + + newCoders := aCollection ] { #category : #accessing } GtCodersCodersChanged >> oldCoders [ + ^ oldCoders ] { #category : #accessing } GtCodersCodersChanged >> oldCoders: aCollection [ + + self + assert: [ aCollection isNotNil ] + description: [ 'Old coders collection must be non-nil' ]. + oldCoders := aCollection ] From bf15a956c814867da444b6c8cda62e89ea6acca7 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Thu, 28 Oct 2021 16:17:11 -0400 Subject: [PATCH 0059/1268] Remove GtCoderCommentStyler [feenkcom/gtoolkit#2198] --- .../GtCoderCommentStyler.class.st | 27 ------------------- 1 file changed, 27 deletions(-) delete mode 100644 src/GToolkit-Coder/GtCoderCommentStyler.class.st diff --git a/src/GToolkit-Coder/GtCoderCommentStyler.class.st b/src/GToolkit-Coder/GtCoderCommentStyler.class.st deleted file mode 100644 index f1d9e6ad8..000000000 --- a/src/GToolkit-Coder/GtCoderCommentStyler.class.st +++ /dev/null @@ -1,27 +0,0 @@ -Class { - #name : #GtCoderCommentStyler, - #superclass : #GtRBASTStyler, - #traits : 'TRBProgramNodeVisitor', - #classTraits : 'TRBProgramNodeVisitor classTrait', - #category : 'GToolkit-Coder-Styler/Highlighter' -} - -{ #category : #visiting } -GtCoderCommentStyler >> visitNode: aNode [ - | comments | - comments := aNode comments. - comments notEmpty - ifTrue: [ comments - do: [ :each | - | comment document | - "Hack to make sure we have the same indices for the part we are formatting" - comment := ((String new: each start withAll: Character cr) , each contents) asRopedText. - (text from: each start + 1 to: comment size) - attributes: {(GtCompletionStrategyAttribute new strategy: GtDocumentCompletionStrategy new)}. - document := GtDocumenter new. - document editor useSyncStylerStrategy. - document text: comment. - comment := document text. - each start + 1 to: comment size do: [ :i | (text from: i to: i) attributes: (comment attributesAt: i) ] ] ]. - ^ super visitNode: aNode -] From b499f96cd6e977b9be9a0917d3bdde47f46f6c95 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 29 Oct 2021 17:59:48 -0300 Subject: [PATCH 0060/1268] add `GToolkitCompleter` dependency [feenkcom/gtoolkit#2198] --- .../BaselineOfGToolkitCoder.class.st | 60 ++++++++++++------- src/BaselineOfGToolkitCoder/package.st | 2 +- 2 files changed, 38 insertions(+), 24 deletions(-) diff --git a/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st b/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st index 1b2d63a47..7810751c6 100644 --- a/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st +++ b/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st @@ -23,36 +23,50 @@ See {{gtClass:GtSearchMethodFilterExamples}} for more details. " Class { - #name : 'BaselineOfGToolkitCoder', - #superclass : 'BaselineOf', - #category : 'BaselineOfGToolkitCoder' + #name : #BaselineOfGToolkitCoder, + #superclass : #BaselineOf, + #category : #BaselineOfGToolkitCoder } -{ #category : 'baseline' } +{ #category : #baseline } BaselineOfGToolkitCoder >> baseline: spec [ + - spec for: #'common' do: [ - spec - baseline: 'Futures' with: [ + spec for: #common do: [ + spec + baseline: 'Futures' + with: [ spec repository: 'github://feenkcom/pharo-futures:main/src' ]; - baseline: 'GToolkitBasicUtility' with: [ + baseline: 'GToolkitBasicUtility' + with: [ spec repository: 'github://feenkcom/gtoolkit-utility:main/src' ]; - baseline: 'GToolkitAnnouncerUtility' with: [ + baseline: 'GToolkitAnnouncerUtility' + with: [ spec repository: 'github://feenkcom/gtoolkit-utility:main/src' ]; - baseline: 'GToolkitPager' with: [ - spec repository: 'github://feenkcom/gtoolkit-pager:main/src' ]. - spec + baseline: 'GToolkitPager' + with: [ + spec repository: 'github://feenkcom/gtoolkit-pager:main/src' ]; + baseline: 'GToolkitCompleter' + with: [ + spec repository: 'github://feenkcom/gtoolkit-completer:main/src' ]. + + spec package: 'GToolkit-VariableBindings'; - package: 'GToolkit-Coder' with: [ - spec requires: #('Futures' 'GToolkitBasicUtility' 'GToolkitAnnouncerUtility' 'GToolkitPager' ). ]; - package: 'GToolkit-Coder-UI' with: [ - spec requires: #('GToolkit-Coder' 'GToolkit-VariableBindings' 'GToolkitBasicUtility' 'GToolkitPager' ). ]; - package: 'GToolkit-Coder-AddOns' with: [ - spec requires: #('GToolkit-Coder' 'GToolkit-Coder-UI' ). ]; - package: 'GToolkit-Coder-Extensions' with: [ - spec requires: #('GToolkit-Coder' 'GToolkit-Coder-UI' 'GToolkit-Coder-AddOns' ). ]; + package: 'GToolkit-Coder' with: [ + spec requires: + #( 'Futures' 'GToolkitBasicUtility' 'GToolkitAnnouncerUtility' + 'GToolkitPager' 'GToolkitCompleter' ) ]; + package: 'GToolkit-Coder-UI' with: [ + spec requires: #( 'GToolkit-Coder' 'GToolkit-VariableBindings' + 'GToolkitBasicUtility' 'GToolkitPager' ) ]; + package: 'GToolkit-Coder-AddOns' + with: [ spec requires: #( 'GToolkit-Coder' 'GToolkit-Coder-UI' ) ]; + package: 'GToolkit-Coder-Extensions' with: [ + spec requires: + #( 'GToolkit-Coder' 'GToolkit-Coder-UI' 'GToolkit-Coder-AddOns' ) ]; package: 'GToolkit-Coder-Examples-SystemS1'; - package: 'GToolkit-Coder-Examples' with: [ - spec requires: #('GToolkit-Coder' 'GToolkit-Coder-UI' 'GToolkit-Coder-AddOns' 'GToolkit-Coder-Examples-SystemS1' ). ]. ]. - + package: 'GToolkit-Coder-Examples' with: [ + spec requires: + #( 'GToolkit-Coder' 'GToolkit-Coder-UI' 'GToolkit-Coder-AddOns' + 'GToolkit-Coder-Examples-SystemS1' ) ] ] ] diff --git a/src/BaselineOfGToolkitCoder/package.st b/src/BaselineOfGToolkitCoder/package.st index 5ddc1cde6..489a47034 100644 --- a/src/BaselineOfGToolkitCoder/package.st +++ b/src/BaselineOfGToolkitCoder/package.st @@ -1 +1 @@ -Package { #name : 'BaselineOfGToolkitCoder' } +Package { #name : #BaselineOfGToolkitCoder } From e31360cb60e8d53b37da099319556d0f9fb4e638 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Sun, 31 Oct 2021 09:12:20 +0100 Subject: [PATCH 0061/1268] rename BlCircle to BlCircleGeometry --- src/GToolkit-Coder-UI/GtCoderPrintStringAttribute.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderPrintStringAttribute.class.st b/src/GToolkit-Coder-UI/GtCoderPrintStringAttribute.class.st index bcb36635b..106d87e42 100644 --- a/src/GToolkit-Coder-UI/GtCoderPrintStringAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPrintStringAttribute.class.st @@ -4,7 +4,7 @@ Class { #instVars : [ 'object' ], - #category : 'GToolkit-Coder-UI-Coder - Source Attributes' + #category : #'GToolkit-Coder-UI-Coder - Source Attributes' } { #category : #'instance creation' } @@ -24,7 +24,7 @@ GtCoderPrintStringAttribute class >> forString: aString [ { #category : #private } GtCoderPrintStringAttribute >> actionButtonLook [ ^ BrGlamorousButtonIconAptitude + BrGlamorousButtonLayoutAptitude + (BrStyleCommonAptitude new - default: [ :aStyle | aStyle geometry: BlCircle new ]; + default: [ :aStyle | aStyle geometry: BlCircleGeometry new ]; hovered: [ :aStyle | aStyle background: BrGlamorousColors neutralBackgroundColor darker ]; pressed: [ :aStyle | aStyle background: BrGlamorousColors neutralBackgroundColor darker darker ]) ] From fb156c9aaaa3c76795834e27a60f065410d39735 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Sun, 31 Oct 2021 10:20:44 +0100 Subject: [PATCH 0062/1268] fix class comment of GtSourceCoder and GtCoderCodeExecutor --- .../GtCoderShortcutsExplanation.class.st | 26 ------------------- .../GtCoderCodeExecutor.class.st | 4 +-- src/GToolkit-Coder/GtSourceCoder.class.st | 15 +++++------ 3 files changed, 8 insertions(+), 37 deletions(-) delete mode 100644 src/GToolkit-Coder-Examples/GtCoderShortcutsExplanation.class.st diff --git a/src/GToolkit-Coder-Examples/GtCoderShortcutsExplanation.class.st b/src/GToolkit-Coder-Examples/GtCoderShortcutsExplanation.class.st deleted file mode 100644 index e02a1dfc6..000000000 --- a/src/GToolkit-Coder-Examples/GtCoderShortcutsExplanation.class.st +++ /dev/null @@ -1,26 +0,0 @@ -" -1. What are the editor shortcuts? - -What shortcuts are availabe in a method coder? - -{{gtExample:GtMethodCoderExamples>>#emptyMethodCoder|previewShow=##gtLiveFor:|previewExpanded=|noCode=|previewHeight=100}} - -These ones: - -{{gtExample:GtMethodCoderExamples>>#emptyMethodCoder|previewShow=#gtViewKeybindingsFor:|previewExpanded=|noCode=}} - -And what about a Playground snippet? - -{{gtExample:GtPlaygroundPharoSnippetExamples>>#pharoSnippet|previewShow=#gtLiveFor:|previewHeight=100|noCode=}} - -These ones. - -{{gtExample:GtPlaygroundPharoSnippetExamples>>#pharoSnippet|previewShow=#gtKeybindingsFor:|previewHeight=400|noCode=}} - - -" -Class { - #name : #GtCoderShortcutsExplanation, - #superclass : #Object, - #category : #'GToolkit-Coder-Examples-! Explanation' -} diff --git a/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st b/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st index 1cf8deea1..2a5c976c9 100644 --- a/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st +++ b/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st @@ -1,5 +1,5 @@ " -I {{gtMethod:GtCoderCodeExecutor>>#execute|label=#selector}} a Pharo code provided by {{gtClass:GtCoderUIModel}}. +I {{gtMethod:GtCoderCodeExecutor>>#execute|label=#selector}} a Pharo code provided by {{gtClass:GtPharoSourceCoderViewModel}}. If a code is selected, I execute the selection. If there is no selection, I execute all code: - {{gtMethod:GtCoderCodeExecutor class>>#doIt}} - {{gtMethod:GtCoderCodeExecutor class>>#doIt}} @@ -13,7 +13,7 @@ Class { 'action', 'element' ], - #category : 'GToolkit-Coder-UI-Execution' + #category : #'GToolkit-Coder-UI-Execution' } { #category : #'api - instance creation' } diff --git a/src/GToolkit-Coder/GtSourceCoder.class.st b/src/GToolkit-Coder/GtSourceCoder.class.st index 09e840592..27fb04d95 100644 --- a/src/GToolkit-Coder/GtSourceCoder.class.st +++ b/src/GToolkit-Coder/GtSourceCoder.class.st @@ -1,23 +1,20 @@ " -1. Source coder +# Source coder Is a language agnostic model of a source coder. My subclasses extend my by adding support for a specific language. -1. # Code execution +### Code execution To add support for code execution the subclasses must implement -- {{gtMethod:GtSourceCoder>>#evaluationRequester}}. -- {{gtMethod:GtSourceCoder>>#evaluationRequesterWithInterval}}. -- {{gtMethod:GtSourceCoder>>#primitiveEvaluate:requester:onFailDo:}}. -1. # Code debugging +- {{gtMethod:GtSourceCoder>>#primitiveEvaluate:inContext:onFailDo:}}. +### Code debugging To add support for code debugging the subclasses must implement -- {{gtMethod:GtSourceCoder>>#debug:}} - +- {{gtMethod:GtSourceCoder>>#primitiveDebug:inContext:onFailDo:}} " Class { #name : #GtSourceCoder, #superclass : #GtTextualCoder, - #category : 'GToolkit-Coder-Coders' + #category : #'GToolkit-Coder-Coders' } { #category : #'api - actions' } From 30736e8fb7c08368a5ba5e0537004587c9da79e2 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 1 Nov 2021 15:08:24 +0100 Subject: [PATCH 0063/1268] [feenkcom/gtoolkit#2204] move dependency analysis to the DependencyAnalyzer --- src/GToolkit-Coder/Class.extension.st | 11 --- .../CompiledMethod.extension.st | 10 --- .../GtPharoAssociation.class.st | 32 ------- .../GtPharoClassExtension.class.st | 34 -------- .../GtPharoClassReference.class.st | 48 ----------- .../GtPharoInheritance.class.st | 39 --------- src/GToolkit-Coder/GtPharoTraitUsage.class.st | 39 --------- src/GToolkit-Coder/RPackage.extension.st | 86 ------------------- 8 files changed, 299 deletions(-) delete mode 100644 src/GToolkit-Coder/Class.extension.st delete mode 100644 src/GToolkit-Coder/GtPharoAssociation.class.st delete mode 100644 src/GToolkit-Coder/GtPharoClassExtension.class.st delete mode 100644 src/GToolkit-Coder/GtPharoClassReference.class.st delete mode 100644 src/GToolkit-Coder/GtPharoInheritance.class.st delete mode 100644 src/GToolkit-Coder/GtPharoTraitUsage.class.st delete mode 100644 src/GToolkit-Coder/RPackage.extension.st diff --git a/src/GToolkit-Coder/Class.extension.st b/src/GToolkit-Coder/Class.extension.st deleted file mode 100644 index 6d4dbc34c..000000000 --- a/src/GToolkit-Coder/Class.extension.st +++ /dev/null @@ -1,11 +0,0 @@ -Extension { #name : #Class } - -{ #category : #'*GToolkit-Coder' } -Class >> gtInheritance [ - ^ GtPharoInheritance new subclass: self; superclass: self superclass -] - -{ #category : #'*GToolkit-Coder' } -Class >> gtTraitUsages [ - ^ self traits collect: [ :each | GtPharoTraitUsage new baseBehavior: self; usedTrait: each ] -] diff --git a/src/GToolkit-Coder/CompiledMethod.extension.st b/src/GToolkit-Coder/CompiledMethod.extension.st index cda7baa95..49c1bf106 100644 --- a/src/GToolkit-Coder/CompiledMethod.extension.st +++ b/src/GToolkit-Coder/CompiledMethod.extension.st @@ -4,13 +4,3 @@ Extension { #name : #CompiledMethod } CompiledMethod >> gtPackageScope [ ^ self package ] - -{ #category : #'*GToolkit-Coder' } -CompiledMethod >> gtReferencedClasses [ - "Return classes that are directly referenced by this method. - Compared to #referencedClasses I do not count a value of the ClassVariable as a reference" - - ^ self literals - select: [ :l | (l isKindOf: ClassVariable) not and: [ l value isClass ] ] - thenCollect: [:v | v value ]. -] diff --git a/src/GToolkit-Coder/GtPharoAssociation.class.st b/src/GToolkit-Coder/GtPharoAssociation.class.st deleted file mode 100644 index 4171331a2..000000000 --- a/src/GToolkit-Coder/GtPharoAssociation.class.st +++ /dev/null @@ -1,32 +0,0 @@ -Class { - #name : #GtPharoAssociation, - #superclass : #Object, - #category : 'GToolkit-Coder-Support-Pharo' -} - -{ #category : #'instance creation' } -GtPharoAssociation >> from [ - ^ self subclassResponsibility -] - -{ #category : #'instance creation' } -GtPharoAssociation >> fromPackage [ - ^ self from gtPackageScope -] - -{ #category : #printing } -GtPharoAssociation >> gtDisplayOn: stream [ - self from gtDisplayOn: stream. - stream nextPutAll: '->'. - self to gtDisplayOn: stream. -] - -{ #category : #'instance creation' } -GtPharoAssociation >> to [ - ^ self subclassResponsibility -] - -{ #category : #'instance creation' } -GtPharoAssociation >> toPackage [ - ^ self to gtPackageScope -] diff --git a/src/GToolkit-Coder/GtPharoClassExtension.class.st b/src/GToolkit-Coder/GtPharoClassExtension.class.st deleted file mode 100644 index e1afbb78c..000000000 --- a/src/GToolkit-Coder/GtPharoClassExtension.class.st +++ /dev/null @@ -1,34 +0,0 @@ -Class { - #name : #GtPharoClassExtension, - #superclass : #GtPharoAssociation, - #instVars : [ - 'extendedClass', - 'extendingMethod' - ], - #category : 'GToolkit-Coder-Support-Pharo' -} - -{ #category : #accessing } -GtPharoClassExtension >> extendedClass [ - ^ self extendingMethod methodClass -] - -{ #category : #accessing } -GtPharoClassExtension >> extendingMethod [ - ^ extendingMethod -] - -{ #category : #accessing } -GtPharoClassExtension >> extendingMethod: anObject [ - extendingMethod := anObject -] - -{ #category : #'instance creation' } -GtPharoClassExtension >> from [ - ^ self extendingMethod -] - -{ #category : #'instance creation' } -GtPharoClassExtension >> to [ - ^ self extendedClass -] diff --git a/src/GToolkit-Coder/GtPharoClassReference.class.st b/src/GToolkit-Coder/GtPharoClassReference.class.st deleted file mode 100644 index 7aa0e83e0..000000000 --- a/src/GToolkit-Coder/GtPharoClassReference.class.st +++ /dev/null @@ -1,48 +0,0 @@ -Class { - #name : #GtPharoClassReference, - #superclass : #GtPharoAssociation, - #instVars : [ - 'referencingMethod', - 'referencedClass' - ], - #category : 'GToolkit-Coder-Support-Pharo' -} - -{ #category : #accessing } -GtPharoClassReference >> from [ - ^ self referencingMethod -] - -{ #category : #accessing } -GtPharoClassReference >> gtSourceFor: aView [ - - ^ aView forward - title: 'Source'; - object: [self referencingMethod]; - view: #gtSourceFor: -] - -{ #category : #accessing } -GtPharoClassReference >> referencedClass [ - ^ referencedClass -] - -{ #category : #accessing } -GtPharoClassReference >> referencedClass: anObject [ - referencedClass := anObject -] - -{ #category : #accessing } -GtPharoClassReference >> referencingMethod [ - ^ referencingMethod -] - -{ #category : #accessing } -GtPharoClassReference >> referencingMethod: anObject [ - referencingMethod := anObject -] - -{ #category : #accessing } -GtPharoClassReference >> to [ - ^ self referencedClass -] diff --git a/src/GToolkit-Coder/GtPharoInheritance.class.st b/src/GToolkit-Coder/GtPharoInheritance.class.st deleted file mode 100644 index e15a99750..000000000 --- a/src/GToolkit-Coder/GtPharoInheritance.class.st +++ /dev/null @@ -1,39 +0,0 @@ -Class { - #name : #GtPharoInheritance, - #superclass : #GtPharoAssociation, - #instVars : [ - 'superclass', - 'subclass' - ], - #category : 'GToolkit-Coder-Support-Pharo' -} - -{ #category : #'instance creation' } -GtPharoInheritance >> from [ - ^ self subclass -] - -{ #category : #accessing } -GtPharoInheritance >> subclass [ - ^ subclass -] - -{ #category : #accessing } -GtPharoInheritance >> subclass: anObject [ - subclass := anObject -] - -{ #category : #accessing } -GtPharoInheritance >> superclass [ - ^ superclass -] - -{ #category : #accessing } -GtPharoInheritance >> superclass: anObject [ - superclass := anObject -] - -{ #category : #'instance creation' } -GtPharoInheritance >> to [ - ^ self superclass -] diff --git a/src/GToolkit-Coder/GtPharoTraitUsage.class.st b/src/GToolkit-Coder/GtPharoTraitUsage.class.st deleted file mode 100644 index 379d42f72..000000000 --- a/src/GToolkit-Coder/GtPharoTraitUsage.class.st +++ /dev/null @@ -1,39 +0,0 @@ -Class { - #name : #GtPharoTraitUsage, - #superclass : #GtPharoAssociation, - #instVars : [ - 'trait', - 'baseBehavior' - ], - #category : 'GToolkit-Coder-Support-Pharo' -} - -{ #category : #accessing } -GtPharoTraitUsage >> baseBehavior [ - ^ baseBehavior -] - -{ #category : #accessing } -GtPharoTraitUsage >> baseBehavior: aBehavior [ - baseBehavior := aBehavior -] - -{ #category : #'instance creation' } -GtPharoTraitUsage >> from [ - ^ self baseBehavior -] - -{ #category : #'instance creation' } -GtPharoTraitUsage >> to [ - ^ self usedTrait -] - -{ #category : #accessing } -GtPharoTraitUsage >> usedTrait [ - ^ trait -] - -{ #category : #accessing } -GtPharoTraitUsage >> usedTrait: aTrait [ - trait := aTrait -] diff --git a/src/GToolkit-Coder/RPackage.extension.st b/src/GToolkit-Coder/RPackage.extension.st deleted file mode 100644 index 724adf04f..000000000 --- a/src/GToolkit-Coder/RPackage.extension.st +++ /dev/null @@ -1,86 +0,0 @@ -Extension { #name : #RPackage } - -{ #category : #'*GToolkit-Coder' } -RPackage >> gtClassExtensions [ - ^ self extensionMethods collect: [ :each | GtPharoClassExtension new extendingMethod: each ] -] - -{ #category : #'*GToolkit-Coder' } -RPackage >> gtClassReferences [ - ^ self gtMethodReferences flatCollectAsSet: [ :m | - m method gtReferencedClasses collect: [ :each | - GtPharoClassReference new - referencingMethod: m; - referencedClass: each ]] -] - -{ #category : #'*GToolkit-Coder' } -RPackage >> gtDependencies [ - | all | - all := Set new. - all addAll: self gtClassExtensions. - all addAll: self gtInheritances. - all addAll: self gtTraitUsages. - all addAll: self gtClassReferences. - ^ all select: [ :each | each toPackage ~= self ] -] - -{ #category : #'*GToolkit-Coder' } -RPackage >> gtInheritances [ - ^ self definedClasses - select: [ : each | each isClass and: [ each superclass notNil ] ] - thenCollect: [ :each | each gtInheritance ] -] - -{ #category : #'*GToolkit-Coder' } -RPackage >> gtMethodReferences [ - ^ self methods collect: [:each | each methodReference] thenSelect: [:each| each isValid and: [each isLocalSelector]]. -] - -{ #category : #'*GToolkit-Coder' } -RPackage >> gtPackageScope [ - ^ self -] - -{ #category : #'*GToolkit-Coder' } -RPackage >> gtPackagesUsed [ - | result | - result := Set new. - result addAll: self gtPackagesUsedThroughClassExtensions. - result addAll: self gtPackagesUsedThroughSubclassing. - result addAll: self gtPackagesUsedThroughTraitUsages. - result addAll: self gtPackagesUsedThroughClassReferences. - ^ result - -] - -{ #category : #'*GToolkit-Coder' } -RPackage >> gtPackagesUsedThroughClassExtensions [ - ^ self gtClassExtensions collectAsSet: [ :each | each toPackage ] -] - -{ #category : #'*GToolkit-Coder' } -RPackage >> gtPackagesUsedThroughClassReferences [ - ^ (self gtClassReferences collectAsSet: [ :each | each toPackage ]) - remove: self ifAbsent: []; - yourself -] - -{ #category : #'*GToolkit-Coder' } -RPackage >> gtPackagesUsedThroughSubclassing [ - ^ (self gtInheritances collectAsSet: [ :each | each toPackage ]) - remove: self ifAbsent: []; - yourself -] - -{ #category : #'*GToolkit-Coder' } -RPackage >> gtPackagesUsedThroughTraitUsages [ - ^ (self gtTraitUsages collectAsSet: [ :each | each toPackage ]) - remove: self ifAbsent: []; - yourself -] - -{ #category : #'*GToolkit-Coder' } -RPackage >> gtTraitUsages [ - ^ self definedClasses flatCollect: [ :each | each gtTraitUsages ] -] From 82c7e7255fcb9caa840f5ebfcea4f6ff11039813 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Tue, 2 Nov 2021 14:40:41 +0100 Subject: [PATCH 0064/1268] [feenkcom/gtoolkit#2205] migrate coder source text and ast computation to promises --- .../GtTextualCoderPromised.class.st | 2 +- .../GtTextualCoderViewModel.class.st | 2 +- .../GtCoderAst.class.st | 2 +- .../GtCoderCompiledMethodSourceCode.class.st | 40 +--- .../GtCoderCompiledMethodTextSource.class.st | 27 +++ .../GtCoderExplicitSourceCode.class.st | 42 +--- .../GtCoderExplicitSourceText.class.st | 42 +--- .../GtCoderExplicitStringSource.class.st | 27 +++ .../GtCoderExplicitTextSource.class.st | 7 +- .../GtCoderFutureTextSource.class.st | 7 +- src/GToolkit-Coder/GtCoderSourceCode.class.st | 173 --------------- .../GtCoderSourceEpoch.class.st | 2 +- .../GtCoderSourceString.class.st | 2 +- .../GtCoderSourceText.class.st | 2 +- .../GtCoderTextSource.class.st | 10 +- src/GToolkit-Coder/GtTextualCoder.class.st | 207 +++++------------- 16 files changed, 140 insertions(+), 454 deletions(-) rename src/{GToolkit-Coder-Promised => GToolkit-Coder}/GtCoderAst.class.st (90%) create mode 100644 src/GToolkit-Coder/GtCoderCompiledMethodTextSource.class.st create mode 100644 src/GToolkit-Coder/GtCoderExplicitStringSource.class.st rename src/{GToolkit-Coder-Promised => GToolkit-Coder}/GtCoderExplicitTextSource.class.st (77%) rename src/{GToolkit-Coder-Promised => GToolkit-Coder}/GtCoderFutureTextSource.class.st (75%) delete mode 100644 src/GToolkit-Coder/GtCoderSourceCode.class.st rename src/{GToolkit-Coder-Promised => GToolkit-Coder}/GtCoderSourceEpoch.class.st (88%) rename src/{GToolkit-Coder-Promised => GToolkit-Coder}/GtCoderSourceString.class.st (89%) rename src/{GToolkit-Coder-Promised => GToolkit-Coder}/GtCoderSourceText.class.st (93%) rename src/{GToolkit-Coder-Promised => GToolkit-Coder}/GtCoderTextSource.class.st (92%) diff --git a/src/GToolkit-Coder-Promised/GtTextualCoderPromised.class.st b/src/GToolkit-Coder-Promised/GtTextualCoderPromised.class.st index 5d2693467..c651c1076 100644 --- a/src/GToolkit-Coder-Promised/GtTextualCoderPromised.class.st +++ b/src/GToolkit-Coder-Promised/GtTextualCoderPromised.class.st @@ -225,7 +225,7 @@ GtTextualCoderPromised >> sourceChangedWith: anUpdateStrategy [ { #category : #'api - accessing' } GtTextualCoderPromised >> sourceCode [ - + sourceCode ifNil: [ self sourceCode: (GtCoderExplicitSourceCode new source: '') ]. ^ sourceCode diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 428c9d49a..9ea624f84 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -143,7 +143,7 @@ GtTextualCoderViewModel >> addTextAttributes: aCollectionOfTextAttributes from: GtTextualCoderViewModel >> asEditorState [ | anEditorText aMemento | - anEditorText := self coderModel sourceText copy. + anEditorText := self coderModel currentSourceText copy. self extraTextAttributes do: [ :eachCoderAttributes | eachCoderAttributes applyOnEditorText: anEditorText ]. diff --git a/src/GToolkit-Coder-Promised/GtCoderAst.class.st b/src/GToolkit-Coder/GtCoderAst.class.st similarity index 90% rename from src/GToolkit-Coder-Promised/GtCoderAst.class.st rename to src/GToolkit-Coder/GtCoderAst.class.st index 8303c157d..409544390 100644 --- a/src/GToolkit-Coder-Promised/GtCoderAst.class.st +++ b/src/GToolkit-Coder/GtCoderAst.class.st @@ -5,7 +5,7 @@ Class { 'ast', 'epoch' ], - #category : #'GToolkit-Coder-Promised' + #category : #'GToolkit-Coder-Ast' } { #category : #accessing } diff --git a/src/GToolkit-Coder/GtCoderCompiledMethodSourceCode.class.st b/src/GToolkit-Coder/GtCoderCompiledMethodSourceCode.class.st index 389d8b8a2..6fbc82923 100644 --- a/src/GToolkit-Coder/GtCoderCompiledMethodSourceCode.class.st +++ b/src/GToolkit-Coder/GtCoderCompiledMethodSourceCode.class.st @@ -5,43 +5,11 @@ I represent a source code of a method defined by a class and a selector " Class { #name : #GtCoderCompiledMethodSourceCode, - #superclass : #GtCoderSourceCode, - #instVars : [ - 'compiledMethod' - ], - #category : 'GToolkit-Coder-Coders' + #superclass : #GtCoderCompiledMethodTextSource, + #category : #'GToolkit-Coder-Coders - Source Text' } -{ #category : #'api - accessing' } -GtCoderCompiledMethodSourceCode >> asAstCacheKey [ - ^ compiledMethod -] - -{ #category : #initialization } -GtCoderCompiledMethodSourceCode >> buildCollapsedText [ - - - ^ compiledMethod selector asRopedText -] - -{ #category : #initialization } -GtCoderCompiledMethodSourceCode >> buildSourceText [ - - - ^ compiledMethod sourceCode asRopedText -] - -{ #category : #accessing } -GtCoderCompiledMethodSourceCode >> compiledMethod [ - ^ compiledMethod -] - -{ #category : #accessing } -GtCoderCompiledMethodSourceCode >> compiledMethod: aCompiledMethod [ - compiledMethod := aCompiledMethod -] - { #category : #testing } -GtCoderCompiledMethodSourceCode >> isModified [ - ^ compiledMethod sourceCode ~= self sourceString +GtCoderCompiledMethodSourceCode class >> isDeprecated [ + ^ true ] diff --git a/src/GToolkit-Coder/GtCoderCompiledMethodTextSource.class.st b/src/GToolkit-Coder/GtCoderCompiledMethodTextSource.class.st new file mode 100644 index 000000000..1c87925e7 --- /dev/null +++ b/src/GToolkit-Coder/GtCoderCompiledMethodTextSource.class.st @@ -0,0 +1,27 @@ +Class { + #name : #GtCoderCompiledMethodTextSource, + #superclass : #GtCoderTextSource, + #instVars : [ + 'compiledMethod' + ], + #category : #'GToolkit-Coder-Coders - Source Text' +} + +{ #category : #accessing } +GtCoderCompiledMethodTextSource >> compiledMethod [ + + ^ compiledMethod +] + +{ #category : #accessing } +GtCoderCompiledMethodTextSource >> compiledMethod: anObject [ + + compiledMethod := anObject +] + +{ #category : #initialization } +GtCoderCompiledMethodTextSource >> originalSourceTextFuture [ + + + ^ [ compiledMethod sourceCode asRopedText ] asAsyncFuture +] diff --git a/src/GToolkit-Coder/GtCoderExplicitSourceCode.class.st b/src/GToolkit-Coder/GtCoderExplicitSourceCode.class.st index 24b790194..24b846ac8 100644 --- a/src/GToolkit-Coder/GtCoderExplicitSourceCode.class.st +++ b/src/GToolkit-Coder/GtCoderExplicitSourceCode.class.st @@ -5,43 +5,11 @@ I represent an explicit source code that was provided as a string " Class { #name : #GtCoderExplicitSourceCode, - #superclass : #GtCoderSourceCode, - #instVars : [ - 'source' - ], - #category : 'GToolkit-Coder-Coders' + #superclass : #GtCoderExplicitStringSource, + #category : #'GToolkit-Coder-Coders - Source Text' } -{ #category : #'api - accessing' } -GtCoderExplicitSourceCode >> asAstCacheKey [ - ^ source -] - -{ #category : #initialization } -GtCoderExplicitSourceCode >> buildCollapsedText [ - - - ^ (self sourceString linesDo: [ :eachLine | eachLine trimmed ifNotEmpty: [ :aNonEmptyLine | ^ aNonEmptyLine ] ]) asRopedText -] - -{ #category : #initialization } -GtCoderExplicitSourceCode >> buildSourceText [ - - - ^ source asRopedText -] - -{ #category : #'api - testing' } -GtCoderExplicitSourceCode >> isModified [ - ^ self source ~= self sourceString -] - -{ #category : #accessing } -GtCoderExplicitSourceCode >> source [ - ^ source -] - -{ #category : #accessing } -GtCoderExplicitSourceCode >> source: aString [ - source := aString +{ #category : #testing } +GtCoderExplicitSourceCode class >> isDeprecated [ + ^ true ] diff --git a/src/GToolkit-Coder/GtCoderExplicitSourceText.class.st b/src/GToolkit-Coder/GtCoderExplicitSourceText.class.st index 857aa4a04..f9b8c1cec 100644 --- a/src/GToolkit-Coder/GtCoderExplicitSourceText.class.st +++ b/src/GToolkit-Coder/GtCoderExplicitSourceText.class.st @@ -1,42 +1,10 @@ Class { #name : #GtCoderExplicitSourceText, - #superclass : #GtCoderSourceCode, - #instVars : [ - 'text' - ], - #category : 'GToolkit-Coder-Coders' + #superclass : #GtCoderExplicitTextSource, + #category : #'GToolkit-Coder-Coders - Source Text' } -{ #category : #'api - accessing' } -GtCoderExplicitSourceText >> asAstCacheKey [ - ^ text -] - -{ #category : #initialization } -GtCoderExplicitSourceText >> buildCollapsedText [ - - - ^ (self sourceString linesDo: [ :eachLine | eachLine trimmed ifNotEmpty: [ :aNonEmptyLine | ^ aNonEmptyLine ] ]) asRopedText -] - -{ #category : #initialization } -GtCoderExplicitSourceText >> buildSourceText [ - - - ^ text copy -] - -{ #category : #'api - testing' } -GtCoderExplicitSourceText >> isModified [ - ^ self text rope ~= self sourceText rope -] - -{ #category : #accessing } -GtCoderExplicitSourceText >> text [ - ^ text -] - -{ #category : #accessing } -GtCoderExplicitSourceText >> text: aStringOrText [ - text := aStringOrText asRopedText +{ #category : #testing } +GtCoderExplicitSourceText class >> isDeprecated [ + ^ true ] diff --git a/src/GToolkit-Coder/GtCoderExplicitStringSource.class.st b/src/GToolkit-Coder/GtCoderExplicitStringSource.class.st new file mode 100644 index 000000000..6818b33b8 --- /dev/null +++ b/src/GToolkit-Coder/GtCoderExplicitStringSource.class.st @@ -0,0 +1,27 @@ +Class { + #name : #GtCoderExplicitStringSource, + #superclass : #GtCoderTextSource, + #instVars : [ + 'source' + ], + #category : #'GToolkit-Coder-Coders - Source Text' +} + +{ #category : #initialization } +GtCoderExplicitStringSource >> originalSourceTextFuture [ + + + ^ [ source asRopedText ] asAsyncFuture +] + +{ #category : #accessing } +GtCoderExplicitStringSource >> source [ + + ^ source +] + +{ #category : #accessing } +GtCoderExplicitStringSource >> source: anObject [ + + source := anObject +] diff --git a/src/GToolkit-Coder-Promised/GtCoderExplicitTextSource.class.st b/src/GToolkit-Coder/GtCoderExplicitTextSource.class.st similarity index 77% rename from src/GToolkit-Coder-Promised/GtCoderExplicitTextSource.class.st rename to src/GToolkit-Coder/GtCoderExplicitTextSource.class.st index c30dabdf9..e075a5aa0 100644 --- a/src/GToolkit-Coder-Promised/GtCoderExplicitTextSource.class.st +++ b/src/GToolkit-Coder/GtCoderExplicitTextSource.class.st @@ -4,14 +4,9 @@ Class { #instVars : [ 'text' ], - #category : #'GToolkit-Coder-Promised' + #category : #'GToolkit-Coder-Coders - Source Text' } -{ #category : #'api - accessing' } -GtCoderExplicitTextSource >> asAstCacheKey [ - ^ text -] - { #category : #initialization } GtCoderExplicitTextSource >> originalSourceTextFuture [ diff --git a/src/GToolkit-Coder-Promised/GtCoderFutureTextSource.class.st b/src/GToolkit-Coder/GtCoderFutureTextSource.class.st similarity index 75% rename from src/GToolkit-Coder-Promised/GtCoderFutureTextSource.class.st rename to src/GToolkit-Coder/GtCoderFutureTextSource.class.st index 1c04f9926..90ba1337a 100644 --- a/src/GToolkit-Coder-Promised/GtCoderFutureTextSource.class.st +++ b/src/GToolkit-Coder/GtCoderFutureTextSource.class.st @@ -4,14 +4,9 @@ Class { #instVars : [ 'futureBlock' ], - #category : #'GToolkit-Coder-Promised' + #category : #'GToolkit-Coder-Coders - Source Text' } -{ #category : #'api - accessing' } -GtCoderFutureTextSource >> asAstCacheKey [ - ^ nil -] - { #category : #accessing } GtCoderFutureTextSource >> future: aBlock [ futureBlock := aBlock diff --git a/src/GToolkit-Coder/GtCoderSourceCode.class.st b/src/GToolkit-Coder/GtCoderSourceCode.class.st deleted file mode 100644 index 13e4477cf..000000000 --- a/src/GToolkit-Coder/GtCoderSourceCode.class.st +++ /dev/null @@ -1,173 +0,0 @@ -" -I represent a source code of the {{gtClass:GtSourceCoder}}. For performance reasons the computation of the actual source code in the coder is done lazily. I am to provide a necessary abstraction to support it - - -" -Class { - #name : #GtCoderSourceCode, - #superclass : #Object, - #instVars : [ - 'monitor', - 'sourceText', - 'collapsedText' - ], - #category : 'GToolkit-Coder-Coders' -} - -{ #category : #'api - text' } -GtCoderSourceCode >> appendString: aString [ - self critical: [ self sourceText appendString: aString ] -] - -{ #category : #'api - text' } -GtCoderSourceCode >> appendText: aText [ - self critical: [ self sourceText append: aText ] -] - -{ #category : #'api - accessing' } -GtCoderSourceCode >> asAstCacheKey [ - ^ self subclassResponsibility -] - -{ #category : #'api - converting' } -GtCoderSourceCode >> asCompiledMethodSourceCode: aCompiledMethod [ - ^ (GtCoderCompiledMethodSourceCode new fromSourceCode: self) compiledMethod: aCompiledMethod -] - -{ #category : #'api - converting' } -GtCoderSourceCode >> asExplicitSourceCode: aString [ - ^ (GtCoderExplicitSourceCode new fromSourceCode: self) source: aString -] - -{ #category : #initialization } -GtCoderSourceCode >> buildCollapsedText [ - - - ^ self subclassResponsibility -] - -{ #category : #initialization } -GtCoderSourceCode >> buildSourceText [ - - - ^ self subclassResponsibility -] - -{ #category : #'api - accessing' } -GtCoderSourceCode >> collapsedText [ - - - ^ self critical: [ collapsedText ifNil: [ collapsedText := self buildCollapsedText ] ] -] - -{ #category : #'api - accessing' } -GtCoderSourceCode >> collapsedTextDo: aBlock [ - "Evaluate a given block with my source code if present" - - ^ self critical: [ collapsedText ifNotNil: aBlock ] -] - -{ #category : #'mutual exclusion' } -GtCoderSourceCode >> critical: aBlock [ - ^ monitor critical: aBlock -] - -{ #category : #'api - text' } -GtCoderSourceCode >> currentSourceString: aString [ - "Set a new source text" - - self critical: [ sourceText := aString asRopedText ] -] - -{ #category : #'api - text' } -GtCoderSourceCode >> currentSourceText: aText [ - "Set a new source text" - - self critical: [ sourceText := aText copyWithoutExternalReferences ] -] - -{ #category : #'api - text' } -GtCoderSourceCode >> delete: aFromIndex to: aToIndex [ - self sourceTextDo: [ :aText | aText delete: aFromIndex to: aToIndex ] -] - -{ #category : #initialization } -GtCoderSourceCode >> fromSourceCode: aGtCoderSourceCode [ - sourceText := nil. - collapsedText := nil. - - aGtCoderSourceCode sourceTextDo: [ :aSourceText | sourceText := aSourceText ]. - aGtCoderSourceCode collapsedTextDo: [ :aCollapsedText | collapsedText := aCollapsedText ]. -] - -{ #category : #'api - testing' } -GtCoderSourceCode >> hasCollapsedText [ - - - ^ self critical: [ collapsedText notNil ] -] - -{ #category : #'api - testing' } -GtCoderSourceCode >> hasSourceText [ - - - ^ self critical: [ sourceText notNil ] -] - -{ #category : #initialization } -GtCoderSourceCode >> initialize [ - super initialize. - - monitor := Monitor new -] - -{ #category : #'api - testing' } -GtCoderSourceCode >> isModified [ - ^ self subclassResponsibility -] - -{ #category : #'api - text' } -GtCoderSourceCode >> replaceFrom: aFromIndex to: aToIndex withString: aString [ - self critical: [ self sourceText replace: aFromIndex to: aToIndex withString: aString ] -] - -{ #category : #'api - text' } -GtCoderSourceCode >> resetCollapsedText [ - "Remove the cached collapsed text forcing it to be recomputed next time it is accessed" - - collapsedText := nil -] - -{ #category : #'api - text' } -GtCoderSourceCode >> resetSourceText [ - "Remove the cached source text forcing it to be recomputed next time it is accessed" - - sourceText := nil -] - -{ #category : #'api - accessing' } -GtCoderSourceCode >> sourceString [ - "Return a string representation of the current source text" - - - ^ self critical: [ self sourceText asString ] -] - -{ #category : #'api - accessing' } -GtCoderSourceCode >> sourceText [ - - - ^ self critical: [ sourceText ifNil: [ sourceText := self buildSourceText ] ] -] - -{ #category : #'api - accessing' } -GtCoderSourceCode >> sourceText: aText [ - self critical: [ sourceText := aText copyWithoutExternalReferences ] -] - -{ #category : #'api - accessing' } -GtCoderSourceCode >> sourceTextDo: aBlock [ - "Evaluate a given block with my source code if present" - - ^ self critical: [ sourceText ifNotNil: [ :aText | aBlock value: aText ] ] -] diff --git a/src/GToolkit-Coder-Promised/GtCoderSourceEpoch.class.st b/src/GToolkit-Coder/GtCoderSourceEpoch.class.st similarity index 88% rename from src/GToolkit-Coder-Promised/GtCoderSourceEpoch.class.st rename to src/GToolkit-Coder/GtCoderSourceEpoch.class.st index b45406b4f..74849c67e 100644 --- a/src/GToolkit-Coder-Promised/GtCoderSourceEpoch.class.st +++ b/src/GToolkit-Coder/GtCoderSourceEpoch.class.st @@ -4,7 +4,7 @@ Class { #instVars : [ 'timestamp' ], - #category : #'GToolkit-Coder-Promised' + #category : #'GToolkit-Coder-Coders - Source Text' } { #category : #accessing } diff --git a/src/GToolkit-Coder-Promised/GtCoderSourceString.class.st b/src/GToolkit-Coder/GtCoderSourceString.class.st similarity index 89% rename from src/GToolkit-Coder-Promised/GtCoderSourceString.class.st rename to src/GToolkit-Coder/GtCoderSourceString.class.st index 1369ccdfe..b65c03016 100644 --- a/src/GToolkit-Coder-Promised/GtCoderSourceString.class.st +++ b/src/GToolkit-Coder/GtCoderSourceString.class.st @@ -5,7 +5,7 @@ Class { 'string', 'epoch' ], - #category : #'GToolkit-Coder-Promised' + #category : #'GToolkit-Coder-Coders - Source Text' } { #category : #accessing } diff --git a/src/GToolkit-Coder-Promised/GtCoderSourceText.class.st b/src/GToolkit-Coder/GtCoderSourceText.class.st similarity index 93% rename from src/GToolkit-Coder-Promised/GtCoderSourceText.class.st rename to src/GToolkit-Coder/GtCoderSourceText.class.st index d37508f5e..1061f94f1 100644 --- a/src/GToolkit-Coder-Promised/GtCoderSourceText.class.st +++ b/src/GToolkit-Coder/GtCoderSourceText.class.st @@ -5,7 +5,7 @@ Class { 'text', 'epoch' ], - #category : #'GToolkit-Coder-Promised' + #category : #'GToolkit-Coder-Coders - Source Text' } { #category : #converting } diff --git a/src/GToolkit-Coder-Promised/GtCoderTextSource.class.st b/src/GToolkit-Coder/GtCoderTextSource.class.st similarity index 92% rename from src/GToolkit-Coder-Promised/GtCoderTextSource.class.st rename to src/GToolkit-Coder/GtCoderTextSource.class.st index 35cbb75e8..99772c4cd 100644 --- a/src/GToolkit-Coder-Promised/GtCoderTextSource.class.st +++ b/src/GToolkit-Coder/GtCoderTextSource.class.st @@ -1,3 +1,6 @@ +" +I represent a source code of the {{gtClass:GtTextualCoder}}. For performance reasons the computation of the actual source code in the coder is done lazily. I am to provide a necessary abstraction to support it +" Class { #name : #GtCoderTextSource, #superclass : #Object, @@ -6,14 +9,9 @@ Class { 'originalSourceTextPromise', 'currentSourceText' ], - #category : #'GToolkit-Coder-Promised' + #category : #'GToolkit-Coder-Coders - Source Text' } -{ #category : #'api - accessing' } -GtCoderTextSource >> asAstCacheKey [ - ^ self subclassResponsibility -] - { #category : #'api - converting' } GtCoderTextSource >> asCompiledMethodSourceCode: aCompiledMethod [ ^ (GtCoderCompiledMethodSourceCode new fromSourceCode: self) compiledMethod: aCompiledMethod diff --git a/src/GToolkit-Coder/GtTextualCoder.class.st b/src/GToolkit-Coder/GtTextualCoder.class.st index 7336bd77d..1f9a2aa1c 100644 --- a/src/GToolkit-Coder/GtTextualCoder.class.st +++ b/src/GToolkit-Coder/GtTextualCoder.class.st @@ -4,13 +4,9 @@ Class { #instVars : [ 'sourceCode', 'completionStrategy', - 'astCache', - 'newAstCache', - 'astMonitor', - 'astCommand', - 'astCommandBlock' + 'astPromise' ], - #category : 'GToolkit-Coder-Coders' + #category : #'GToolkit-Coder-Coders' } { #category : #'private - addons' } @@ -47,90 +43,46 @@ GtTextualCoder >> asNewCoderModelWithSameSubject [ ^ self shouldNotImplement ] +{ #category : #'api - ast' } +GtTextualCoder >> ast [ + + + ^ self critical: [ astPromise ifNil: [ astPromise := self sourceCode currentSourceString asyncThen: [ :aGtCoderSourceString | + GtCoderAst new + ast: (self computeAst: aGtCoderSourceString string); + epoch: aGtCoderSourceString epoch ] ] ] +] + { #category : #'api - ast' } GtTextualCoder >> astAsyncDo: aBlock [ - astMonitor critical: [ - astCommand ifNotNil: [ - "the ast is being computed, subscribe to the ast changed announcement to wait until is finishes" - ^ self - when: GtCoderAstChanged - doOnce: [ :anAnnouncement | - aBlock value: anAnnouncement ast ] - for: #astChanged ]. - - "the ast is already computed, return it directly" - newAstCache ifNotNil: [ :anAST | ^ aBlock value: anAST ]. - - astCommandBlock := [ - | theSourceString isModified astCacheKey aComputedAst | - - self critical: [ - theSourceString := self currentSourceString. - isModified := self isModified. - astCacheKey := self sourceCode asAstCacheKey ]. - - aComputedAst := isModified - ifTrue: [ self computeAst: theSourceString ] - ifFalse: [ - self supportsAstCache - ifTrue: [ - GtAstCache default - cachedAstAt: astCacheKey - ifAbsentPut: [ self computeAst: theSourceString ] ] - ifFalse: [ self computeAst: theSourceString ] ]. - - astMonitor critical: [ - newAstCache := aComputedAst. - astCommand := nil. - astCommandBlock := nil ]. - self announce: (GtCoderAstChanged new coder: self; ast: aComputedAst). - aBlock value: aComputedAst ]. - astCommand := astCommandBlock asBlTktTerminableCommand asBlTktLoggingCommand. - - BlUseAsyncFeatures - ifEnabledDo: [ BlTktWorkerProvider coderAstPool schedule: astCommand ] - otherwise: [ astCommand execute ] ] + self ast asyncThen: [ :aGtCoderAst | aBlock value: aGtCoderAst ast ] ] { #category : #'api - ast' } GtTextualCoder >> astAwait [ - | theAst | - - theAst := nil. - self astAwaitDo: [ :aComputedAst | theAst := aComputedAst ]. - ^ theAst + ^ self ast wait ast ] { #category : #'api - ast' } GtTextualCoder >> astAwaitDo: aBlock [ - | aSemaphore anAst | - - aSemaphore := Semaphore new. - anAst := nil. - self astAsyncDo: [ :aComputedAst | - anAst := aComputedAst. - aSemaphore signal ]. - - aSemaphore wait: 5 seconds. - aBlock value: anAst + aBlock value: self astAwait ] -{ #category : #'private - ast' } -GtTextualCoder >> astCache [ - ^ astMonitor critical: [ astCache ] -] +{ #category : #'api - text' } +GtTextualCoder >> collapsedText [ + -{ #category : #'private - ast' } -GtTextualCoder >> astCache: anAssociation [ - astMonitor critical: [ astCache := anAssociation ]. - self onAstChanged + ^ self collapsedTextPromise wait ] { #category : #'api - text' } -GtTextualCoder >> collapsedText [ - +GtTextualCoder >> collapsedTextPromise [ + - ^ self sourceCode collapsedText + ^ self currentSourceTextPromise asyncThen: [ :aCurrentText | + aCurrentText + ifEmpty: [ '' asRopedText ] + ifNotEmpty: [ aCurrentText iterator nextLine ] ] ] { #category : #'api - accessing' } @@ -172,7 +124,7 @@ GtTextualCoder >> currentSourceString [ "Return a String representation of the current source text" - ^ self critical: [ self sourceCode sourceString ] + ^ self currentSourceStringPromise wait ] { #category : #'api - text' } @@ -184,6 +136,21 @@ GtTextualCoder >> currentSourceString: aString [ self sourceChanged ] ] +{ #category : #'api - text' } +GtTextualCoder >> currentSourceStringPromise [ + "Return a String representation of the current source text" + + + ^ self critical: [ self sourceCode currentSourceString then: [ :aGtCoderSourceString | aGtCoderSourceString string ] ] +] + +{ #category : #'api - text' } +GtTextualCoder >> currentSourceText [ + "Set a new source text" + + ^ self currentSourceTextPromise wait +] + { #category : #'api - text' } GtTextualCoder >> currentSourceText: aText [ "Set a new source text" @@ -202,6 +169,13 @@ GtTextualCoder >> currentSourceText: aText with: aGtCoderUpdateStragegy [ self sourceChangedWith: aGtCoderUpdateStragegy ] ] +{ #category : #'api - text' } +GtTextualCoder >> currentSourceTextPromise [ + + + ^ self critical: [ self sourceCode currentSourceText then: [ :aGtCoderSourceText | aGtCoderSourceText text ] ] +] + { #category : #'api - text' } GtTextualCoder >> currentSourceTextSynchronously: aText [ "Set a new source text" @@ -227,7 +201,6 @@ GtTextualCoder >> ensureAst [ GtTextualCoder >> initialize [ super initialize. - astMonitor := Monitor new. self reset ] @@ -261,19 +234,6 @@ GtTextualCoder >> notifySourceChangedWith: anUpdateStragegy [ coder: self) ] -{ #category : #'private - notifying' } -GtTextualCoder >> notifyStylersUpdated [ - "Is sent when AddOn stylers changed. It also means that the text editor should restyle the text" - - self announce: (GtCoderStylerChanged new - coder: self; - stylers: self addOns stylers copy) -] - -{ #category : #'private - ast' } -GtTextualCoder >> onAstChanged [ -] - { #category : #private } GtTextualCoder >> pragmasNamed: aSymbol inHierarchy: aClass [ | actions | @@ -287,35 +247,13 @@ GtTextualCoder >> pragmasNamed: aSymbol inHierarchy: aClass [ GtTextualCoder >> requestStyleSourceText [ "Request the text editor to restyle the text (for example due to environmental changes)" - self resetASTCache. + self resetAstCache. self announce: (GtCoderStyleTextRequest new coder: self) ] -{ #category : #'api - text' } -GtTextualCoder >> requestStyleSourceTextAndAfterDo: aBlock [ - "Request the text editor to restyle the text (for example due to environmental changes)" - - self resetASTCache. - self - announce: - (GtCoderStyleTextRequest new - coder: self; - afterAction: aBlock) -] - -{ #category : #'api - text' } -GtTextualCoder >> requestUpdateCollapsedText [ - "Request to update the collapsed text, for example due to changes in the current source text. - It is not guaranteed that the collapsed text actually changes as for example in the method coder - opened on a compiled method" - - self sourceCode resetCollapsedText. - self announce: (GtCoderCollapsedLabelChanged new coder: self) -] - { #category : #initialize } GtTextualCoder >> reset [ - self resetASTCache. + self resetAstCache. "initialized lazily in #sourceCode" sourceCode := nil. @@ -323,8 +261,8 @@ GtTextualCoder >> reset [ ] { #category : #'private - ast' } -GtTextualCoder >> resetASTCache [ - self astCache: (nil -> nil) +GtTextualCoder >> resetAstCache [ + astPromise := nil ] { #category : #'event handling' } @@ -334,32 +272,13 @@ GtTextualCoder >> sourceChanged [ { #category : #'event handling' } GtTextualCoder >> sourceChangedWith: anUpdateStrategy [ - "if there is an ast computation that was triggered before source code change we re-schedule - the computation. Any #astAsyncDo: caller will be waiting for the result with the new ast" - - astMonitor critical: [ - newAstCache := nil. - astCommand ifNotNil: [ :anAstCommand | - anAstCommand terminate. - astCommand := astCommandBlock asBlTktTerminableCommand asBlTktLoggingCommand. - [ BlTktWorkerProvider coderAstPool schedule: astCommand ] on: Error do: [ :anError | - astCommand := nil. - anError emit. - NonInteractiveTranscript stderr - nextPut: $[; - nextPutAll: self class name; - nextPutAll: '#>>sourceChangedWith:'; - nextPut: $]; - nextPutAll: ' Failed to schedule an ast computation command' ] ] ]. - + astPromise := nil. self notifySourceChangedWith: anUpdateStrategy. - - self requestUpdateCollapsedText ] { #category : #'api - accessing' } GtTextualCoder >> sourceCode [ - + sourceCode ifNil: [ self sourceCode: (GtCoderExplicitSourceCode new source: '') ]. ^ sourceCode @@ -391,11 +310,13 @@ GtTextualCoder >> sourceCodeSynchronously: aGtCoderSourceCode [ { #category : #'api - text' } GtTextualCoder >> sourceText [ - "Return the source text of this coder. The computation of the source text may be expensive, use me with caution. - If the operation you would like to perform on the source text is optional consider using #sourceTextDo:" - + + + self + deprecated: 'Use #currentSourceText' + transformWith: '`@receiver sourceText' -> '`@receiver currentSourceText'. - ^ self sourceCode sourceText + ^ self currentSourceText ] { #category : #'api - text' } @@ -416,11 +337,3 @@ GtTextualCoder >> supportsAstCache [ ^ true ] - -{ #category : #'api - ast' } -GtTextualCoder >> terminateAstCommand [ - astMonitor critical: [ - astCommand ifNotNil: [ :anAstCommand | anAstCommand terminate ]. - astCommand := nil. - astCommandBlock := nil ] -] From e7bf5cbcc58cd64da7d10a7ff597e2c77f3de836 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 3 Nov 2021 14:09:03 -0300 Subject: [PATCH 0065/1268] modify message calls as we introduced `TGtExampleResultValue` [feenkcom/gtoolkit#2175] --- src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st index a2f977a0d..b9ca55261 100644 --- a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st @@ -221,9 +221,10 @@ GtCoderExampleStateElement >> playExampleFrom: aButton [ { #category : #'private - actions' } GtCoderExampleStateElement >> spawnExampleFrom: anElement [ - self exampleDo: [ :anExample | + + self exampleDo: [ :anExample | anExample hasResult ifTrue: [ - anElement phlow spawnObject: anExample result returnValueOrExampleException ] ] + anElement phlow spawnObject: anExample result returnValue ] ] ] { #category : #'private - accessing' } @@ -242,7 +243,8 @@ GtCoderExampleStateElement >> subscribeToExample [ { #category : #'private - accessing' } GtCoderExampleStateElement >> tooltipObject [ - self exampleResult ifNotNil: [ :aResult | ^ aResult returnValueOrExampleException ]. + + self exampleResult ifNotNil: [ :aResult | ^ aResult returnValue ]. ^ self example ] From 575d79b07f8c9aeee3f5f6b21ebd24011aafb46b Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 3 Nov 2021 19:52:12 -0300 Subject: [PATCH 0066/1268] example result values may define tooltips [feenkcom/gtoolkit#2175] --- .../GtCoderExampleStateElement.class.st | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st index b9ca55261..39cf5cd6a 100644 --- a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st @@ -120,9 +120,15 @@ GtCoderExampleStateElement >> initializeViewModels [ { #category : #'private - instance creation' } GtCoderExampleStateElement >> newInspectorWithExampleResult [ - ^ ((GtInspector forObject: self tooltipObject) - exact: 400@400) - asScalableElement size: 200@200. + + | anElement | + anElement := self exampleResult + ifNotNil: [ :aResult | + aResult asGtExampleResultPreviewElement ] + ifNil: [ ((GtInspector forObject: self example) + exact: 400 @ 400) asScalableElement size: 200 @ 200 ]. + + ^ anElement ] { #category : #'private - instance creation' } @@ -241,13 +247,6 @@ GtCoderExampleStateElement >> subscribeToExample [ to: self. ] -{ #category : #'private - accessing' } -GtCoderExampleStateElement >> tooltipObject [ - - self exampleResult ifNotNil: [ :aResult | ^ aResult returnValue ]. - ^ self example -] - { #category : #'private - subscriptions' } GtCoderExampleStateElement >> unsubscribeFromExample [ self example ifNil: [ ^ self ]. From e31e922fd8f9ca86e41674fc1df663e2a34fdab2 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 3 Nov 2021 20:39:08 -0300 Subject: [PATCH 0067/1268] add `GtEampleWithResult>>#asGtExampleResultPreviewElement` [feenkcom/gtoolkit#2175] --- .../GtCoderExampleStateElement.class.st | 9 ++--- .../GtCoderUIUtility.class.st | 33 +++++++++++++++++++ .../GtExampleResult.extension.st | 6 ++++ .../GtExampleWithResult.extension.st | 7 ++++ .../TGtExampleResultValue.extension.st | 8 +++++ 5 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderUIUtility.class.st create mode 100644 src/GToolkit-Coder-UI/GtExampleResult.extension.st create mode 100644 src/GToolkit-Coder-UI/GtExampleWithResult.extension.st create mode 100644 src/GToolkit-Coder-UI/TGtExampleResultValue.extension.st diff --git a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st index 39cf5cd6a..54fdcdeed 100644 --- a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st @@ -123,10 +123,11 @@ GtCoderExampleStateElement >> newInspectorWithExampleResult [ | anElement | anElement := self exampleResult - ifNotNil: [ :aResult | - aResult asGtExampleResultPreviewElement ] - ifNil: [ ((GtInspector forObject: self example) - exact: 400 @ 400) asScalableElement size: 200 @ 200 ]. + ifNotNil: [ :anExampleResult | + self example asGtExampleResultPreviewElement ] + ifNil: [ + ((GtInspector forObject: self example) exact: + 400 @ 400) asScalableElement size: 200 @ 200 ]. ^ anElement ] diff --git a/src/GToolkit-Coder-UI/GtCoderUIUtility.class.st b/src/GToolkit-Coder-UI/GtCoderUIUtility.class.st new file mode 100644 index 000000000..e8bc4b56c --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderUIUtility.class.st @@ -0,0 +1,33 @@ +Class { + #name : #GtCoderUIUtility, + #superclass : #Object, + #category : #'GToolkit-Coder-UI-Utilities' +} + +{ #category : #'api - instance creation' } +GtCoderUIUtility class >> exampleExecutionToolbarFor: anExampleWithResult [ + + ^ BrToolbar new + aptitude: BrGlamorousToolbarAptitude new; + addItem: (BrButton new + aptitude: BrGlamorousButtonWithIconAptitude; + icon: BrGlamorousVectorIcons play; + label: 'Play'; + action: [ :aButton | anExampleWithResult run ]; + beTinySize); + addItem: (BrButton new + aptitude: BrGlamorousButtonWithIconAptitude; + icon: BrGlamorousVectorIcons playinspect; + label: 'Play and Inspect'; + action: [ :aButton | + anExampleWithResult run. + aButton phlow spawnObject: anExampleWithResult result ]; + beTinySize); + addChild: (BrButton new + aptitude: BrGlamorousButtonWithIconAptitude; + icon: BrGlamorousVectorIcons debug; + label: 'Debug'; + action: [ :aButton | + anExampleWithResult openingDebugger result ]; + beTinySize) +] diff --git a/src/GToolkit-Coder-UI/GtExampleResult.extension.st b/src/GToolkit-Coder-UI/GtExampleResult.extension.st new file mode 100644 index 000000000..955b4ee17 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtExampleResult.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #GtExampleResult } + +{ #category : #'*GToolkit-Coder-UI' } +GtExampleResult >> asGtExampleResultPreviewElementFor: anExample [ + ^ returnValue asGtExampleResultPreviewElementFor: anExample +] diff --git a/src/GToolkit-Coder-UI/GtExampleWithResult.extension.st b/src/GToolkit-Coder-UI/GtExampleWithResult.extension.st new file mode 100644 index 000000000..24c7deff6 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtExampleWithResult.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #GtExampleWithResult } + +{ #category : #'*GToolkit-Coder-UI' } +GtExampleWithResult >> asGtExampleResultPreviewElement [ + + ^ self result asGtExampleResultPreviewElementFor: self +] diff --git a/src/GToolkit-Coder-UI/TGtExampleResultValue.extension.st b/src/GToolkit-Coder-UI/TGtExampleResultValue.extension.st new file mode 100644 index 000000000..b8b302137 --- /dev/null +++ b/src/GToolkit-Coder-UI/TGtExampleResultValue.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #TGtExampleResultValue } + +{ #category : #'*GToolkit-Coder-UI' } +TGtExampleResultValue >> asGtExampleResultPreviewElementFor: anExample [ + + ^ ((GtInspector forObject: self value) exact: 400 @ 400) + asScalableElement size: 200 @ 200 +] From c9bf1a5d366c51c53d6eaf98dcfd35f09dc06d96 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 4 Nov 2021 13:21:09 +0100 Subject: [PATCH 0068/1268] [feenkcom/gtoolkit#2205] adapt appendText:, appendString: and appendText:with: --- src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st | 9 +++++---- src/GToolkit-Coder/GtTextualCoder.class.st | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 9ea624f84..3bcb7a31f 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -552,15 +552,16 @@ GtTextualCoderViewModel >> onPreviousStyledTextUnset: aPreviousStyledText [ { #category : #'private - event handling' } GtTextualCoderViewModel >> onSourceCodeChanged: anSourceCodeChangedAnnouncement [ - + "source code changed, meaning that the styled text is no longer correct" + self unsetStyledText. self announce: (GtTextualCoderViewModelTextChanged new - text: self coderModel sourceText; - updateStrategy: anSourceCodeChangedAnnouncement updateStrategy). + text: self coderModel currentSourceText; + updateStrategy: anSourceCodeChangedAnnouncement updateStrategy). - self coderModel terminateAstCommand. + "self coderModel terminateAstCommand." self terminateAddOnsCommand. self coderModel ensureAst diff --git a/src/GToolkit-Coder/GtTextualCoder.class.st b/src/GToolkit-Coder/GtTextualCoder.class.st index 1f9a2aa1c..eeaf88ec7 100644 --- a/src/GToolkit-Coder/GtTextualCoder.class.st +++ b/src/GToolkit-Coder/GtTextualCoder.class.st @@ -17,21 +17,21 @@ GtTextualCoder >> addOnsClass [ { #category : #'api - text' } GtTextualCoder >> appendString: aString [ self critical: [ - self sourceCode appendString: aString. + self currentSourceText: (self currentSourceText copy appendString: aString). self sourceChanged ] ] { #category : #'api - text' } GtTextualCoder >> appendText: aText [ self critical: [ - self sourceCode appendText: aText. + self currentSourceText: (self currentSourceText copy append: aText). self sourceChanged ] ] { #category : #'api - text' } GtTextualCoder >> appendText: aText with: aGtCoderUpdateStragegy [ self critical: [ - self sourceCode appendText: aText. + self currentSourceText: (self currentSourceText copy append: aText). self sourceChangedWith: aGtCoderUpdateStragegy ] ] From e7a2a50da4ea09169779573caddc270ae16fa082 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 4 Nov 2021 17:18:25 +0100 Subject: [PATCH 0069/1268] [feenkcom/gtoolkit#2205] adapt textual coder view model to promise based api --- .../GtTextualCoderViewModel.class.st | 189 ++++++------------ .../GtCoderSourceCodeChanged.class.st | 17 +- src/GToolkit-Coder/GtCoderTextSource.class.st | 31 ++- src/GToolkit-Coder/GtSourceCoder.class.st | 3 +- src/GToolkit-Coder/GtTextCoder.class.st | 4 +- src/GToolkit-Coder/GtTextualCoder.class.st | 52 +++-- 6 files changed, 129 insertions(+), 167 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 3bcb7a31f..040e20402 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -2,10 +2,7 @@ Class { #name : #GtTextualCoderViewModel, #superclass : #GtSingleCoderViewModel, #instVars : [ - 'addOns', - 'addOnMonitor', - 'addOnCommand', - 'addOnCommandBlock', + 'addOnPromise', 'extraAddOns', 'stylers', 'mainActions', @@ -29,60 +26,24 @@ GtTextualCoderViewModel >> addMainAction: aGtCoderAction [ extraAddOns addMainAction: aGtCoderAction ] +{ #category : #'api - add-ons' } +GtTextualCoderViewModel >> addOns [ + ^ self ensureAddOns +] + { #category : #'api - add-ons' } GtTextualCoderViewModel >> addOnsAsyncDo: aBlock [ - addOnMonitor critical: [ - addOnCommand ifNotNil: [ - | aUniqueSubscriber | - aUniqueSubscriber := Object new. - "the add-ons are being computed, subscribe to the ast changed announcement to wait until is finishes" - ^ self - when: GtTextualCoderViewModelAddOnsChanged - doOnce: [ :anAnnouncement | aBlock value: anAnnouncement addOns ] - for: aUniqueSubscriber ]. - - "the add-ons are already computed, return it directly" - addOns ifNotNil: [ :theAddOns | ^ aBlock value: theAddOns ]. - - addOnCommandBlock := [ - | theComputedAddOns | - - theComputedAddOns := self computeAddOns. - addOnMonitor critical: [ - addOns := theComputedAddOns. - addOnCommand := nil. - addOnCommandBlock := nil ]. - self onAddOnsChanged: theComputedAddOns. - aBlock value: theComputedAddOns. - self announce: (GtTextualCoderViewModelAddOnsChanged new addOns: theComputedAddOns) ]. - addOnCommand := addOnCommandBlock asBlTktTerminableCommand asBlTktLoggingCommand. - - BlUseAsyncFeatures - ifEnabledDo: [ BlTktWorkerProvider coderAddOnsPool schedule: addOnCommand ] - otherwise: [ addOnCommand execute ] ] + self addOns asyncThen: [ :theAddOns | aBlock value: theAddOns ] ] { #category : #'api - add-ons' } GtTextualCoderViewModel >> addOnsAwait [ - | theAddOns | - - theAddOns := nil. - self addOnsAwaitDo: [ :theComputedAddOns | theAddOns := theComputedAddOns ]. - ^ theAddOns + ^ self addOns wait ] { #category : #'api - add-ons' } GtTextualCoderViewModel >> addOnsAwaitDo: aBlock [ - | aSemaphore theAddOns | - - aSemaphore := Semaphore new. - theAddOns := nil. - self addOnsAsyncDo: [ :theComputedAddOns | - theAddOns := theComputedAddOns. - aSemaphore signal ]. - - aSemaphore wait: 5 seconds. - aBlock value: theAddOns + aBlock value: self addOns wait ] { #category : #'api - shortcuts' } @@ -199,42 +160,46 @@ GtTextualCoderViewModel >> compositeStyler [ { #category : #'private - addons' } GtTextualCoderViewModel >> computeAddOns [ - | aCoderModel newAddOns pragmas theAst | - - aCoderModel := self coderModel. - - theAst := aCoderModel astAwait. - pragmas := aCoderModel - pragmasNamed: #gtAstCoderAddOns: - inHierarchy: aCoderModel class. + | aCoderModel | - newAddOns := aCoderModel newAddOns. - "extra addons" - newAddOns addAddOns: aCoderModel addOns. - aCoderModel initializeShortcuts: newAddOns. - aCoderModel initializeAddOns: newAddOns. - theAst ifNotNil: [ - pragmas reverseDo: [ :eachPragma | - [ aCoderModel - perform: eachPragma methodSelector - withEnoughArguments: { theAst . newAddOns . self } ] - on: Error - do: [ :anError | - "emit as a beacon signal" - anError emit. - - NonInteractiveTranscript stderr - nextPut: $[; - print: eachPragma method printString; - nextPut: $]; - space; - print: anError; - cr ] ] ]. + aCoderModel := self coderModel. - "view model add-ons override coder model add-ons" - newAddOns addAddOns: extraAddOns. - newAddOns markAsUpdated. - ^ newAddOns + ^ aCoderModel ast asyncThen: [ :aCoderAst | + | theAst newAddOns pragmas | + + theAst := aCoderAst ast. + + pragmas := aCoderModel + pragmasNamed: #gtAstCoderAddOns: + inHierarchy: aCoderModel class. + + newAddOns := aCoderModel newAddOns. + "extra addons" + newAddOns addAddOns: aCoderModel addOns. + aCoderModel initializeShortcuts: newAddOns. + aCoderModel initializeAddOns: newAddOns. + theAst ifNotNil: [ + pragmas reverseDo: [ :eachPragma | + [ aCoderModel + perform: eachPragma methodSelector + withEnoughArguments: { theAst . newAddOns . self } ] + on: Error + do: [ :anError | + "emit as a beacon signal" + anError emit. + + NonInteractiveTranscript stderr + nextPut: $[; + print: eachPragma method printString; + nextPut: $]; + space; + print: anError; + cr ] ] ]. + + "view model add-ons override coder model add-ons" + newAddOns addAddOns: extraAddOns. + newAddOns markAsUpdated. + newAddOns ]. ] { #category : #'private - addons' } @@ -324,9 +289,9 @@ GtTextualCoderViewModel >> elementClass [ ^ GtTextualCoderEditorElement ] -{ #category : #'api - add-ons' } +{ #category : #'private - addons' } GtTextualCoderViewModel >> ensureAddOns [ - self addOnsAsyncDo: [ :theAddOns | ] + ^ addOnPromise ifNil: [ addOnPromise := self computeAddOns then: [ :theAddOns | self onAddOnsChanged: theAddOns ]; yourself ] ] { #category : #'api - expansion' } @@ -433,7 +398,6 @@ GtTextualCoderViewModel >> initialize [ super initialize. extraAddOns := GtTextualCoderAddOns new. - addOnMonitor := Monitor new. stylers := #(). shortcuts := #(). mainActions := #(). @@ -512,7 +476,7 @@ GtTextualCoderViewModel >> notifyStyledTextChanged [ styledText: self styledText). ] -{ #category : #'private - addons' } +{ #category : #'private - event handling' } GtTextualCoderViewModel >> onAddOnsChanged: theAddOns [ "Is sent when new add-ons are computed" @@ -520,20 +484,9 @@ GtTextualCoderViewModel >> onAddOnsChanged: theAddOns [ self shortcuts: theAddOns shortcuts. self mainActions: theAddOns mainActions. self contextActions: theAddOns contextActions. - self contextMenuActions: theAddOns contextMenuActions -] - -{ #category : #'private - event handling' } -GtTextualCoderViewModel >> onAstChanged: anAstChangedAnnouncement [ - - "ast changed, the styled text may not be valid anymore" - self unsetStyledText. - - self announce: (GtTextualCoderViewModelAstChanged new ast: anAstChangedAnnouncement ast). - - addOnMonitor critical: [ addOns := nil ]. - - self addOnsAsyncDo: [ :theAddOns | self announce: GtTextualCoderViewModelReadyToRestyle new ] + self contextMenuActions: theAddOns contextMenuActions. + + self announce: GtTextualCoderViewModelReadyToRestyle new ] { #category : #'api - styled text' } @@ -552,19 +505,15 @@ GtTextualCoderViewModel >> onPreviousStyledTextUnset: aPreviousStyledText [ { #category : #'private - event handling' } GtTextualCoderViewModel >> onSourceCodeChanged: anSourceCodeChangedAnnouncement [ - "source code changed, meaning that the styled text is no longer correct" - self unsetStyledText. + + addOnPromise := nil. + self ensureAddOns. self announce: (GtTextualCoderViewModelTextChanged new - text: self coderModel currentSourceText; - updateStrategy: anSourceCodeChangedAnnouncement updateStrategy). - - "self coderModel terminateAstCommand." - self terminateAddOnsCommand. - - self coderModel ensureAst + text: self coderModel currentSourceText; + updateStrategy: anSourceCodeChangedAnnouncement updateStrategy) ] { #category : #'api - text' } @@ -652,17 +601,16 @@ GtTextualCoderViewModel >> shouldAddOnsBeUpdated [ that element should check if addons need to be updated and if it is the case start the update with the help of ${method:GtCoderModel>>#updateAddOnsFrom:}$" - ^ addOnMonitor critical: [ - addOns - ifNil: [ true ] - ifNotNil: [ :theAddOns | theAddOns shouldBeUpdated ] ] + ^ addOnPromise + ifNil: [ true ] + ifNotNil: [ :theAddOns | theAddOns shouldBeUpdated ] ] { #category : #'api - text' } GtTextualCoderViewModel >> sourceText [ - ^ self coderModel sourceText + ^ self coderModel currentSourceText ] { #category : #'api - text' } @@ -727,11 +675,6 @@ GtTextualCoderViewModel >> stylers: theStylers [ { #category : #'api - coder model' } GtTextualCoderViewModel >> subscribeToCoderModel [ super subscribeToCoderModel. - - self coderModel weak - when: GtCoderAstChanged - send: #onAstChanged: - to: self. self coderModel weak when: GtCoderSourceCodeChanged @@ -739,14 +682,6 @@ GtTextualCoderViewModel >> subscribeToCoderModel [ to: self ] -{ #category : #'api - add-ons' } -GtTextualCoderViewModel >> terminateAddOnsCommand [ - addOnMonitor critical: [ - addOnCommand ifNotNil: [ :anAddOnsCommand | anAddOnsCommand terminate ]. - addOnCommand := nil. - addOnCommandBlock := nil ] -] - { #category : #'api - styled text' } GtTextualCoderViewModel >> unsetStyledText [ diff --git a/src/GToolkit-Coder/GtCoderSourceCodeChanged.class.st b/src/GToolkit-Coder/GtCoderSourceCodeChanged.class.st index 230ab207e..66bd4f5d6 100644 --- a/src/GToolkit-Coder/GtCoderSourceCodeChanged.class.st +++ b/src/GToolkit-Coder/GtCoderSourceCodeChanged.class.st @@ -7,9 +7,10 @@ Class { #name : #GtCoderSourceCodeChanged, #superclass : #GtSourceCoderAnnouncement, #instVars : [ - 'updateStragegy' + 'updateStragegy', + 'newText' ], - #category : 'GToolkit-Coder-Event' + #category : #'GToolkit-Coder-Event' } { #category : #testing } @@ -18,6 +19,18 @@ GtCoderSourceCodeChanged >> isSynchronous [ and: [ self updateStrategy isSynchronous ] ] +{ #category : #accessing } +GtCoderSourceCodeChanged >> newText [ + + ^ newText +] + +{ #category : #accessing } +GtCoderSourceCodeChanged >> newText: anObject [ + + newText := anObject +] + { #category : #accessing } GtCoderSourceCodeChanged >> source [ ^ self updateStrategy source diff --git a/src/GToolkit-Coder/GtCoderTextSource.class.st b/src/GToolkit-Coder/GtCoderTextSource.class.st index 99772c4cd..24b49567a 100644 --- a/src/GToolkit-Coder/GtCoderTextSource.class.st +++ b/src/GToolkit-Coder/GtCoderTextSource.class.st @@ -14,7 +14,7 @@ Class { { #category : #'api - converting' } GtCoderTextSource >> asCompiledMethodSourceCode: aCompiledMethod [ - ^ (GtCoderCompiledMethodSourceCode new fromSourceCode: self) compiledMethod: aCompiledMethod + ^ (GtCoderCompiledMethodTextSource new fromSourceCode: self) compiledMethod: aCompiledMethod ] { #category : #'mutual exclusion' } @@ -55,8 +55,9 @@ GtCoderTextSource >> currentSourceText: aText [ ] { #category : #initialization } -GtCoderTextSource >> fromSourceCode: aGtCoderSourceCode [ - originalSourceTextPromise := aGtCoderSourceCode sourceText +GtCoderTextSource >> fromSourceCode: aGtCoderTextSource [ + originalSourceTextPromise := aGtCoderTextSource privateGetOriginalSourceTextPromise. + currentSourceText := aGtCoderTextSource privateGetCurrentSourceText ] { #category : #'api - testing' } @@ -77,23 +78,41 @@ GtCoderTextSource >> initialize [ { #category : #'api - testing' } GtCoderTextSource >> isModified [ - ^ currentSourceText notNil + ^ self isModifiedPromise wait ] -{ #category : #'private - initialization' } +{ #category : #'api - testing' } +GtCoderTextSource >> isModifiedPromise [ + currentSourceText + ifNil: [ ^ false asAsyncPromise ]. + + ^ self originalSourceTextPromise then: [ :anOriginalSourceText | self currentSourceText then: [ :aCurrentSourceText | anOriginalSourceText text characters ~= aCurrentSourceText text characters ] ] +] + +{ #category : #initialization } GtCoderTextSource >> originalSourceTextFuture [ ^ self subclassResponsibility ] -{ #category : #'private - initialization' } +{ #category : #initialization } GtCoderTextSource >> originalSourceTextPromise [ ^ (self originalSourceTextFuture map: [ :aText | GtCoderSourceText new text: aText ]) asAsyncPromise ] +{ #category : #'private - accessing' } +GtCoderTextSource >> privateGetCurrentSourceText [ + ^ currentSourceText +] + +{ #category : #'private - accessing' } +GtCoderTextSource >> privateGetOriginalSourceTextPromise [ + ^ originalSourceTextPromise +] + { #category : #'api - accessing' } GtCoderTextSource >> resetSourceText [ "Remove the cached source text forcing it to be recomputed next time it is accessed" diff --git a/src/GToolkit-Coder/GtSourceCoder.class.st b/src/GToolkit-Coder/GtSourceCoder.class.st index 27fb04d95..e2c875109 100644 --- a/src/GToolkit-Coder/GtSourceCoder.class.st +++ b/src/GToolkit-Coder/GtSourceCoder.class.st @@ -56,10 +56,9 @@ GtSourceCoder >> discardChanges [ self isModified ifFalse: [ ^ self ]. - self sourceCode resetCollapsedText. self sourceCode resetSourceText. - self sourceChanged + self sourceChangedTo: nil ] { #category : #'api - actions' } diff --git a/src/GToolkit-Coder/GtTextCoder.class.st b/src/GToolkit-Coder/GtTextCoder.class.st index 8adf480fe..e708db033 100644 --- a/src/GToolkit-Coder/GtTextCoder.class.st +++ b/src/GToolkit-Coder/GtTextCoder.class.st @@ -5,7 +5,7 @@ Class { 'parser', 'parserStartingState' ], - #category : 'GToolkit-Coder-Coders' + #category : #'GToolkit-Coder-Coders' } { #category : #'api - ast' } @@ -20,7 +20,7 @@ GtTextCoder >> computeAst: theSourceString [ { #category : #initialization } GtTextCoder >> forString: aString [ - self sourceCode: (GtCoderExplicitSourceCode new source: aString) + self sourceCode: (GtCoderExplicitStringSource new source: aString) ] { #category : #'instance creation' } diff --git a/src/GToolkit-Coder/GtTextualCoder.class.st b/src/GToolkit-Coder/GtTextualCoder.class.st index eeaf88ec7..f1cc80984 100644 --- a/src/GToolkit-Coder/GtTextualCoder.class.st +++ b/src/GToolkit-Coder/GtTextualCoder.class.st @@ -15,24 +15,20 @@ GtTextualCoder >> addOnsClass [ ] { #category : #'api - text' } -GtTextualCoder >> appendString: aString [ - self critical: [ - self currentSourceText: (self currentSourceText copy appendString: aString). - self sourceChanged ] +GtTextualCoder >> appendString: aString [ + self currentSourceText: (self currentSourceText copy appendString: aString) ] { #category : #'api - text' } GtTextualCoder >> appendText: aText [ - self critical: [ - self currentSourceText: (self currentSourceText copy append: aText). - self sourceChanged ] + self currentSourceText: (self currentSourceText copy append: aText) ] { #category : #'api - text' } GtTextualCoder >> appendText: aText with: aGtCoderUpdateStragegy [ - self critical: [ - self currentSourceText: (self currentSourceText copy append: aText). - self sourceChangedWith: aGtCoderUpdateStragegy ] + self + currentSourceText: (self currentSourceText copy append: aText) + with: aGtCoderUpdateStragegy ] { #category : #'api - converting' } @@ -110,13 +106,14 @@ GtTextualCoder >> computeAst: theSourceString [ { #category : #'api - text' } GtTextualCoder >> correctFrom: aFromIndex to: aToIndex with: aString [ - self critical: [ + self flag: #TODO. + "self critical: [ self sourceCode replaceFrom: aFromIndex to: aToIndex withString: aString. self sourceChanged. - self notifyCorrectionFrom: aFromIndex to: aToIndex with: aString ] + self notifyCorrectionFrom: aFromIndex to: aToIndex with: aString ]" ] { #category : #'api - text' } @@ -131,9 +128,7 @@ GtTextualCoder >> currentSourceString [ GtTextualCoder >> currentSourceString: aString [ "Set a new source text" - self critical: [ - self sourceCode currentSourceString: aString. - self sourceChanged ] + self currentSourceText: aString asRopedText ] { #category : #'api - text' } @@ -157,7 +152,7 @@ GtTextualCoder >> currentSourceText: aText [ self critical: [ self sourceCode currentSourceText: aText. - self sourceChanged ] + self sourceChangedTo: aText ] ] { #category : #'api - text' } @@ -166,7 +161,7 @@ GtTextualCoder >> currentSourceText: aText with: aGtCoderUpdateStragegy [ self critical: [ self sourceCode currentSourceText: aText. - self sourceChangedWith: aGtCoderUpdateStragegy ] + self sourceChangedTo: aText with: aGtCoderUpdateStragegy ] ] { #category : #'api - text' } @@ -182,14 +177,12 @@ GtTextualCoder >> currentSourceTextSynchronously: aText [ self critical: [ self sourceCode currentSourceText: aText. - self sourceChangedWith: GtCoderUpdateStrategy new makeSynchronous ] + self sourceChangedTo: aText with: GtCoderUpdateStrategy new makeSynchronous ] ] { #category : #'api - text' } GtTextualCoder >> deleteSourceTextFrom: aFromIndex to: aToIndex [ - self critical: [ - self sourceCode delete: aFromIndex to: aToIndex. - self sourceChanged ] + self currentSourceText: (self currentSourceText copy delete: aFromIndex to: aToIndex) ] { #category : #'api - ast' } @@ -226,11 +219,12 @@ GtTextualCoder >> notifyCorrectionFrom: aFromIndex to: aToIndex with: aString [ ] { #category : #'private - notifying' } -GtTextualCoder >> notifySourceChangedWith: anUpdateStragegy [ +GtTextualCoder >> notifySourceChangedTo: aNewText with: anUpdateStragegy [ "Notify the text editor that it should update the text (for example due to refactoring changes)" self announce: (GtCoderSourceCodeChanged new updateStrategy: anUpdateStragegy; + newText: aNewText; coder: self) ] @@ -266,21 +260,23 @@ GtTextualCoder >> resetAstCache [ ] { #category : #'event handling' } -GtTextualCoder >> sourceChanged [ - self sourceChangedWith: GtCoderUpdateStrategy new makeAsynchronous +GtTextualCoder >> sourceChangedTo: aNewText [ + self + sourceChangedTo: aNewText + with: GtCoderUpdateStrategy new makeAsynchronous ] { #category : #'event handling' } -GtTextualCoder >> sourceChangedWith: anUpdateStrategy [ +GtTextualCoder >> sourceChangedTo: aNewText with: anUpdateStrategy [ astPromise := nil. - self notifySourceChangedWith: anUpdateStrategy. + self notifySourceChangedTo: aNewText with: anUpdateStrategy ] { #category : #'api - accessing' } GtTextualCoder >> sourceCode [ - sourceCode ifNil: [ self sourceCode: (GtCoderExplicitSourceCode new source: '') ]. + sourceCode ifNil: [ self sourceCode: (GtCoderExplicitStringSource new source: '') ]. ^ sourceCode ] @@ -298,7 +294,7 @@ GtTextualCoder >> sourceCode: aGtCoderSourceCode withStrategy: anUpdateStragegy "Set the source code of this coder to a given one and notify about the changes" sourceCode := aGtCoderSourceCode. - self sourceChangedWith: anUpdateStragegy. + self sourceChangedTo: nil with: anUpdateStragegy ] { #category : #'api - accessing' } From 3f9dd6af50a88d11e112429ab77f34edd21fdfcc Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 4 Nov 2021 18:39:30 -0300 Subject: [PATCH 0070/1268] it may happend that object is a class, we want to ask for class variables only to instance-side classes --- .../ClassDescription.extension.st | 6 ++--- .../GtCompositeVariablesBindings.class.st | 22 ++++++++-------- .../GtContextVariablesBindings.class.st | 18 ++++++------- .../GtEmptyVariablesBindings.class.st | 14 +++++----- .../GtGlobalVariablesBindings.class.st | 14 +++++----- .../GtLocalVariablesBindings.class.st | 20 +++++++------- .../GtReservedVariablesBindings.class.st | 14 +++++----- .../GtSharedVariablesBindings.class.st | 18 ++++++------- .../GtSlotVariablesBindings.class.st | 26 ++++++++++--------- .../TGtVariablesBindings.trait.st | 12 ++++----- src/GToolkit-VariableBindings/package.st | 2 +- 11 files changed, 84 insertions(+), 82 deletions(-) diff --git a/src/GToolkit-VariableBindings/ClassDescription.extension.st b/src/GToolkit-VariableBindings/ClassDescription.extension.st index 92ecc7194..3e40e10a4 100644 --- a/src/GToolkit-VariableBindings/ClassDescription.extension.st +++ b/src/GToolkit-VariableBindings/ClassDescription.extension.st @@ -1,12 +1,12 @@ -Extension { #name : 'ClassDescription' } +Extension { #name : #ClassDescription } -{ #category : '*GToolkit-VariableBindings' } +{ #category : #'*GToolkit-VariableBindings' } ClassDescription >> gtSlotNamed: aName ifFound: foundBlock ifNone: exceptionBlock [ "By default, searches through all the slots in the object, however proxies may want to override this to display a different set (e.g. none)" ^self classLayout resolveSlot: aName asSymbol ifFound: foundBlock ifNone: exceptionBlock ] -{ #category : '*GToolkit-VariableBindings' } +{ #category : #'*GToolkit-VariableBindings' } ClassDescription >> gtSlotNames [ "Answer the slot names to be bound by GtPharoSourceCoderViewModel. By default, this is all the slots in the object, however proxies may want to override this to display a different set (e.g. none)." diff --git a/src/GToolkit-VariableBindings/GtCompositeVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtCompositeVariablesBindings.class.st index c8514e634..ed057ddb4 100644 --- a/src/GToolkit-VariableBindings/GtCompositeVariablesBindings.class.st +++ b/src/GToolkit-VariableBindings/GtCompositeVariablesBindings.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtCompositeVariablesBindings', - #superclass : 'Object', + #name : #GtCompositeVariablesBindings, + #superclass : #Object, #traits : 'TGtVariablesBindings', #classTraits : 'TGtVariablesBindings classTrait', #instVars : [ @@ -9,7 +9,7 @@ Class { #category : 'GToolkit-VariableBindings-Bindings' } -{ #category : 'comparing' } +{ #category : #comparing } GtCompositeVariablesBindings >> = anObject [ "Answer whether the receiver and anObject represent the same object." @@ -19,17 +19,17 @@ GtCompositeVariablesBindings >> = anObject [ ^ bindings = anObject bindings ] -{ #category : 'adding' } +{ #category : #adding } GtCompositeVariablesBindings >> addBindings: aGtVariablesBindings [ bindings add: aGtVariablesBindings ] -{ #category : 'binding' } +{ #category : #binding } GtCompositeVariablesBindings >> bindingNames [ ^ bindings flatCollect: [ :eachVariableBindings | eachVariableBindings bindingNames ] ] -{ #category : 'binding' } +{ #category : #binding } GtCompositeVariablesBindings >> bindingOf: aSymbol [ "aSymbol is a variable name. Return a literal variable if the variable has a value assigned. @@ -43,7 +43,7 @@ GtCompositeVariablesBindings >> bindingOf: aSymbol [ ^ nil ] -{ #category : 'binding' } +{ #category : #binding } GtCompositeVariablesBindings >> bindingValueOf: aSymbol [ "aSymbol is a variable name. Return a value of the variable." @@ -56,20 +56,20 @@ GtCompositeVariablesBindings >> bindingValueOf: aSymbol [ ^ nil ] -{ #category : 'accessing' } +{ #category : #accessing } GtCompositeVariablesBindings >> bindings [ ^ bindings ] -{ #category : 'testing' } +{ #category : #testing } GtCompositeVariablesBindings >> hasBindingOf: aSymbol [ ^ bindings anySatisfy: [ :eachVariableBindings | eachVariableBindings hasBindingOf: aSymbol ] ] -{ #category : 'comparing' } +{ #category : #comparing } GtCompositeVariablesBindings >> hash [ "Answer an integer value that is related to the identity of the receiver." @@ -77,7 +77,7 @@ GtCompositeVariablesBindings >> hash [ ^ bindings hash ] -{ #category : 'initialization' } +{ #category : #initialization } GtCompositeVariablesBindings >> initialize [ super initialize. diff --git a/src/GToolkit-VariableBindings/GtContextVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtContextVariablesBindings.class.st index 0512db9ee..64f4b0ba6 100644 --- a/src/GToolkit-VariableBindings/GtContextVariablesBindings.class.st +++ b/src/GToolkit-VariableBindings/GtContextVariablesBindings.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtContextVariablesBindings', - #superclass : 'Object', + #name : #GtContextVariablesBindings, + #superclass : #Object, #traits : 'TGtVariablesBindings', #classTraits : 'TGtVariablesBindings classTrait', #instVars : [ @@ -9,7 +9,7 @@ Class { #category : 'GToolkit-VariableBindings-Bindings' } -{ #category : 'comparing' } +{ #category : #comparing } GtContextVariablesBindings >> = anObject [ "Answer whether the receiver and anObject represent the same object." @@ -19,12 +19,12 @@ GtContextVariablesBindings >> = anObject [ ^ context = anObject context ] -{ #category : 'binding' } +{ #category : #binding } GtContextVariablesBindings >> bindingNames [ ^ context tempNames ] -{ #category : 'binding' } +{ #category : #binding } GtContextVariablesBindings >> bindingOf: aSymbol [ "aSymbol is a variable name. Return a literal variable if the variable has a value assigned. @@ -41,26 +41,26 @@ GtContextVariablesBindings >> bindingOf: aSymbol [ ^ var ] -{ #category : 'accessing' } +{ #category : #accessing } GtContextVariablesBindings >> context [ ^ context ] -{ #category : 'accessing' } +{ #category : #accessing } GtContextVariablesBindings >> context: anObject [ context := anObject ] -{ #category : 'testing' } +{ #category : #testing } GtContextVariablesBindings >> hasBindingOf: aSymbol [ ^ (self bindingOf: aSymbol) notNil ] -{ #category : 'comparing' } +{ #category : #comparing } GtContextVariablesBindings >> hash [ "Answer an integer value that is related to the identity of the receiver." diff --git a/src/GToolkit-VariableBindings/GtEmptyVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtEmptyVariablesBindings.class.st index 8c0be714c..ef15a7ad2 100644 --- a/src/GToolkit-VariableBindings/GtEmptyVariablesBindings.class.st +++ b/src/GToolkit-VariableBindings/GtEmptyVariablesBindings.class.st @@ -1,23 +1,23 @@ Class { - #name : 'GtEmptyVariablesBindings', - #superclass : 'Object', + #name : #GtEmptyVariablesBindings, + #superclass : #Object, #traits : 'TGtVariablesBindings', #classTraits : 'TGtVariablesBindings classTrait', #category : 'GToolkit-VariableBindings-Bindings' } -{ #category : 'comparing' } +{ #category : #comparing } GtEmptyVariablesBindings >> = anObject [ self == anObject ifTrue: [ ^ true ]. ^ self class = anObject class ] -{ #category : 'binding' } +{ #category : #binding } GtEmptyVariablesBindings >> bindingNames [ ^ #() ] -{ #category : 'binding' } +{ #category : #binding } GtEmptyVariablesBindings >> bindingOf: aSymbol [ "aSymbol is a variable name. Return a literal variable if the variable has a value assigned. @@ -27,14 +27,14 @@ GtEmptyVariablesBindings >> bindingOf: aSymbol [ ^ nil ] -{ #category : 'testing' } +{ #category : #testing } GtEmptyVariablesBindings >> hasBindingOf: aSymbol [ ^ false ] -{ #category : 'comparing' } +{ #category : #comparing } GtEmptyVariablesBindings >> hash [ ^ self class hash ] diff --git a/src/GToolkit-VariableBindings/GtGlobalVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtGlobalVariablesBindings.class.st index b5e87ec3e..78739860b 100644 --- a/src/GToolkit-VariableBindings/GtGlobalVariablesBindings.class.st +++ b/src/GToolkit-VariableBindings/GtGlobalVariablesBindings.class.st @@ -1,23 +1,23 @@ Class { - #name : 'GtGlobalVariablesBindings', - #superclass : 'Object', + #name : #GtGlobalVariablesBindings, + #superclass : #Object, #traits : 'TGtVariablesBindings', #classTraits : 'TGtVariablesBindings classTrait', #category : 'GToolkit-VariableBindings-Bindings' } -{ #category : 'comparing' } +{ #category : #comparing } GtGlobalVariablesBindings >> = anObject [ self == anObject ifTrue: [ ^ true ]. ^ self class = anObject class ] -{ #category : 'binding' } +{ #category : #binding } GtGlobalVariablesBindings >> bindingNames [ ^ self class environment keys ] -{ #category : 'binding' } +{ #category : #binding } GtGlobalVariablesBindings >> bindingOf: aSymbol [ "aSymbol is a variable name. Return a literal variable if the variable has a value assigned. @@ -27,14 +27,14 @@ GtGlobalVariablesBindings >> bindingOf: aSymbol [ ^ self class environment bindingOf: aSymbol ] -{ #category : 'testing' } +{ #category : #testing } GtGlobalVariablesBindings >> hasBindingOf: aSymbol [ ^ self class environment includesKey: aSymbol ] -{ #category : 'comparing' } +{ #category : #comparing } GtGlobalVariablesBindings >> hash [ ^ self class hash ] diff --git a/src/GToolkit-VariableBindings/GtLocalVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtLocalVariablesBindings.class.st index d1daa2d27..f065adc90 100644 --- a/src/GToolkit-VariableBindings/GtLocalVariablesBindings.class.st +++ b/src/GToolkit-VariableBindings/GtLocalVariablesBindings.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtLocalVariablesBindings', - #superclass : 'Object', + #name : #GtLocalVariablesBindings, + #superclass : #Object, #traits : 'TGtVariablesBindings', #classTraits : 'TGtVariablesBindings classTrait', #instVars : [ @@ -9,7 +9,7 @@ Class { #category : 'GToolkit-VariableBindings-Bindings' } -{ #category : 'comparing' } +{ #category : #comparing } GtLocalVariablesBindings >> = anObject [ "Answer whether the receiver and anObject represent the same object." @@ -19,12 +19,12 @@ GtLocalVariablesBindings >> = anObject [ ^ bindings = anObject bindings ] -{ #category : 'binding' } +{ #category : #binding } GtLocalVariablesBindings >> bindingNames [ ^ bindings keys ] -{ #category : 'binding' } +{ #category : #binding } GtLocalVariablesBindings >> bindingOf: aSymbol [ "aSymbol is a variable name. Return a literal variable if the variable has a value assigned. @@ -36,20 +36,20 @@ GtLocalVariablesBindings >> bindingOf: aSymbol [ ifAbsent: [ nil ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtLocalVariablesBindings >> bindings [ ^ bindings ] -{ #category : 'testing' } +{ #category : #testing } GtLocalVariablesBindings >> hasBindingOf: aSymbol [ ^ bindings includesKey: aSymbol ] -{ #category : 'comparing' } +{ #category : #comparing } GtLocalVariablesBindings >> hash [ "Answer an integer value that is related to the identity of the receiver." @@ -57,14 +57,14 @@ GtLocalVariablesBindings >> hash [ ^ bindings hash ] -{ #category : 'initialization' } +{ #category : #initialization } GtLocalVariablesBindings >> initialize [ super initialize. bindings := Dictionary new ] -{ #category : 'accessing' } +{ #category : #accessing } GtLocalVariablesBindings >> localAt: aSymbol put: anObject [ self assert: [ aSymbol isSymbol ] diff --git a/src/GToolkit-VariableBindings/GtReservedVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtReservedVariablesBindings.class.st index 7b47b4c89..f9c73be59 100644 --- a/src/GToolkit-VariableBindings/GtReservedVariablesBindings.class.st +++ b/src/GToolkit-VariableBindings/GtReservedVariablesBindings.class.st @@ -1,23 +1,23 @@ Class { - #name : 'GtReservedVariablesBindings', - #superclass : 'Object', + #name : #GtReservedVariablesBindings, + #superclass : #Object, #traits : 'TGtVariablesBindings', #classTraits : 'TGtVariablesBindings classTrait', #category : 'GToolkit-VariableBindings-Bindings' } -{ #category : 'comparing' } +{ #category : #comparing } GtReservedVariablesBindings >> = anObject [ self == anObject ifTrue: [ ^ true ]. ^ self class = anObject class ] -{ #category : 'binding' } +{ #category : #binding } GtReservedVariablesBindings >> bindingNames [ ^ self class environment reservedVariables keys collect: [ :each | each asSymbol ] ] -{ #category : 'binding' } +{ #category : #binding } GtReservedVariablesBindings >> bindingOf: aSymbol [ "aSymbol is a variable name. Return a literal variable if the variable has a value assigned. @@ -29,14 +29,14 @@ GtReservedVariablesBindings >> bindingOf: aSymbol [ ifAbsent: [ nil ] ] -{ #category : 'testing' } +{ #category : #testing } GtReservedVariablesBindings >> hasBindingOf: aSymbol [ ^ self class environment reservedVariables includesKey: aSymbol ] -{ #category : 'comparing' } +{ #category : #comparing } GtReservedVariablesBindings >> hash [ ^ self class hash ] diff --git a/src/GToolkit-VariableBindings/GtSharedVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtSharedVariablesBindings.class.st index 4a819be67..1abc054a9 100644 --- a/src/GToolkit-VariableBindings/GtSharedVariablesBindings.class.st +++ b/src/GToolkit-VariableBindings/GtSharedVariablesBindings.class.st @@ -1,6 +1,6 @@ Class { - #name : 'GtSharedVariablesBindings', - #superclass : 'Object', + #name : #GtSharedVariablesBindings, + #superclass : #Object, #traits : 'TGtVariablesBindings', #classTraits : 'TGtVariablesBindings classTrait', #instVars : [ @@ -9,7 +9,7 @@ Class { #category : 'GToolkit-VariableBindings-Bindings' } -{ #category : 'comparing' } +{ #category : #comparing } GtSharedVariablesBindings >> = anObject [ "Answer whether the receiver and anObject represent the same object." @@ -19,12 +19,12 @@ GtSharedVariablesBindings >> = anObject [ ^ bindings = anObject bindings ] -{ #category : 'binding' } +{ #category : #binding } GtSharedVariablesBindings >> bindingNames [ ^ bindings keys ] -{ #category : 'binding' } +{ #category : #binding } GtSharedVariablesBindings >> bindingOf: aSymbol [ "aSymbol is a variable name. Return a literal variable if the variable has a value assigned. @@ -36,20 +36,20 @@ GtSharedVariablesBindings >> bindingOf: aSymbol [ ifAbsentPut: [ WorkspaceVariable key: aSymbol ] ] -{ #category : 'accessing' } +{ #category : #accessing } GtSharedVariablesBindings >> bindings [ ^ bindings ] -{ #category : 'testing' } +{ #category : #testing } GtSharedVariablesBindings >> hasBindingOf: aSymbol [ ^ bindings includesKey: aSymbol ] -{ #category : 'comparing' } +{ #category : #comparing } GtSharedVariablesBindings >> hash [ "Answer an integer value that is related to the identity of the receiver." @@ -57,7 +57,7 @@ GtSharedVariablesBindings >> hash [ ^ bindings hash ] -{ #category : 'initialization' } +{ #category : #initialization } GtSharedVariablesBindings >> initialize [ super initialize. diff --git a/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st index d13b22ae7..fa4413734 100644 --- a/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st +++ b/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st @@ -1,15 +1,15 @@ Class { - #name : 'GtSlotVariablesBindings', - #superclass : 'Object', + #name : #GtSlotVariablesBindings, + #superclass : #Object, #traits : 'TGtVariablesBindings', #classTraits : 'TGtVariablesBindings classTrait', #instVars : [ 'object' ], - #category : 'GToolkit-VariableBindings-Bindings' + #category : #'GToolkit-VariableBindings-Bindings' } -{ #category : 'comparing' } +{ #category : #comparing } GtSlotVariablesBindings >> = anObject [ "Answer whether the receiver and anObject represent the same object." @@ -19,12 +19,12 @@ GtSlotVariablesBindings >> = anObject [ ^ object = anObject object ] -{ #category : 'binding' } +{ #category : #binding } GtSlotVariablesBindings >> bindingNames [ ^ object class gtSlotNames, object class classVarNames ] -{ #category : 'binding' } +{ #category : #binding } GtSlotVariablesBindings >> bindingOf: aSymbol [ "aSymbol is a variable name. Return a literal variable if the variable has a value assigned. @@ -40,7 +40,7 @@ GtSlotVariablesBindings >> bindingOf: aSymbol [ ifAbsent: [ nil ] ] ] -{ #category : 'binding' } +{ #category : #binding } GtSlotVariablesBindings >> bindingValueOf: aSymbol [ "aSymbol is a variable name. Return a value of the variable." @@ -49,17 +49,19 @@ GtSlotVariablesBindings >> bindingValueOf: aSymbol [ ^ (self bindingOf: aSymbol) ifNotNil: [ :aSlot | aSlot read: self object ] ] -{ #category : 'testing' } +{ #category : #testing } GtSlotVariablesBindings >> hasBindingOf: aSymbol [ ^ object class gtSlotNamed: aSymbol ifFound: [ :slot | true ] - ifNone: [ object class hasClassVarNamed: aSymbol ] + ifNone: [ object class = object class instanceSide + ifTrue: [ object class hasClassVarNamed: aSymbol ] + ifFalse: [ false ] ] ] -{ #category : 'comparing' } +{ #category : #comparing } GtSlotVariablesBindings >> hash [ "Answer an integer value that is related to the identity of the receiver." @@ -67,13 +69,13 @@ GtSlotVariablesBindings >> hash [ ^ object hash ] -{ #category : 'accessing' } +{ #category : #accessing } GtSlotVariablesBindings >> object [ ^ object ] -{ #category : 'accessing' } +{ #category : #accessing } GtSlotVariablesBindings >> object: anObject [ object := anObject diff --git a/src/GToolkit-VariableBindings/TGtVariablesBindings.trait.st b/src/GToolkit-VariableBindings/TGtVariablesBindings.trait.st index 899bed92f..5fe7506fa 100644 --- a/src/GToolkit-VariableBindings/TGtVariablesBindings.trait.st +++ b/src/GToolkit-VariableBindings/TGtVariablesBindings.trait.st @@ -1,9 +1,9 @@ Trait { - #name : 'TGtVariablesBindings', + #name : #TGtVariablesBindings, #category : 'GToolkit-VariableBindings-Bindings' } -{ #category : 'converting' } +{ #category : #converting } TGtVariablesBindings >> asDictionary [ | aDictionary | @@ -14,12 +14,12 @@ TGtVariablesBindings >> asDictionary [ ^ aDictionary ] -{ #category : 'binding' } +{ #category : #binding } TGtVariablesBindings >> bindingNames [ ^ self explicitRequirement ] -{ #category : 'binding' } +{ #category : #binding } TGtVariablesBindings >> bindingOf: aSymbol [ "aSymbol is a variable name. Return a literal variable if the variable has a value assigned. @@ -29,7 +29,7 @@ TGtVariablesBindings >> bindingOf: aSymbol [ ^ self explicitRequirement ] -{ #category : 'binding' } +{ #category : #binding } TGtVariablesBindings >> bindingValueOf: aSymbol [ "aSymbol is a variable name. Return a value of the variable." @@ -39,7 +39,7 @@ TGtVariablesBindings >> bindingValueOf: aSymbol [ ifNotNil: [ :aBinding | aBinding value ] ] -{ #category : 'testing' } +{ #category : #testing } TGtVariablesBindings >> hasBindingOf: aSymbol [ diff --git a/src/GToolkit-VariableBindings/package.st b/src/GToolkit-VariableBindings/package.st index f16e575b7..0c31d5739 100644 --- a/src/GToolkit-VariableBindings/package.st +++ b/src/GToolkit-VariableBindings/package.st @@ -1 +1 @@ -Package { #name : 'GToolkit-VariableBindings' } +Package { #name : #'GToolkit-VariableBindings' } From a0e1fef6a69726e1ea6c08ca0d36c9252ad71306 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Fri, 5 Nov 2021 12:23:17 +0100 Subject: [PATCH 0071/1268] [feenkcom/gtoolkit#2205] migrate addOns to promise --- .../TCoderByScripterExamples.trait.st | 16 ++--- ...ourceCoderCollapsedAddOnsAptitude.class.st | 10 +-- .../GtTextualCoderEditorElement.class.st | 24 +++++--- .../GtTextualCoderViewModel.class.st | 61 ++++++++----------- 4 files changed, 53 insertions(+), 58 deletions(-) diff --git a/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st b/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st index c97357663..d5277f7de 100644 --- a/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st +++ b/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st @@ -8,10 +8,9 @@ TCoderByScripterExamples >> openAndClickOnContextMenuItemFor: aScripterOrStep id aScripterOrStep secondaryClick label: 'Open context menu'; - onChildNamed: GtSourceCoderEditorId. + onChildNamed: GtSourceCoderEditorId; + play. - aScripterOrStep wait forEmptySpaceTaskQueue. - aScripterOrStep mouseMoveOver label: 'Hover ', aBlElementId asSymbol; onSpaceRoot; @@ -46,14 +45,15 @@ TCoderByScripterExamples >> scripterForBlock: aBlock [ aScripter substep: 'Initialize Coder Model and UI' do: [ :aStep | aStep set label: 'Initialize Coder Model'; - model: aBlock. + model: aBlock; + play. aStep set label: 'Initialize Coder UI'; element: [ :aCoder | aCoder asElement ]; - onModel ]. - - aScripter wait forEmptySpaceTaskQueue. - ^ aScripter syncContinue + onModel; + play ]. + + ^ aScripter ] { #category : #utilities } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedAddOnsAptitude.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedAddOnsAptitude.class.st index 3f2da29f7..8a6ad96c2 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedAddOnsAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedAddOnsAptitude.class.st @@ -44,9 +44,9 @@ GtSourceCoderCollapsedAddOnsAptitude >> updateAddon: anAddOn coderUIModel: aGtSo { #category : #'private - updating' } GtSourceCoderCollapsedAddOnsAptitude >> updateAddonsFor: aGtSourceCoderUIModel [ - - self sourceCoderUIModel addOnsAsyncDo: [ :theComputedAddOns | - addOnsContainer removeChildren. - theComputedAddOns previews do: [ :eachAddOn | - self updateAddon: eachAddOn coderUIModel: aGtSourceCoderUIModel ] ] + self sourceCoderUIModel addOns then: [ :theComputedAddOns | + addOnsContainer enqueueTask: (BlTaskAction new action: [ + addOnsContainer removeChildren. + theComputedAddOns previews do: [ :eachAddOn | + self updateAddon: eachAddOn coderUIModel: aGtSourceCoderUIModel ] ])] ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index ba8ade5e0..c6dc63c9e 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -9,7 +9,7 @@ Class { 'evaluationPrinter', 'shortcuts' ], - #category : 'GToolkit-Coder-UI-Coder - Textual' + #category : #'GToolkit-Coder-UI-Coder - Textual' } { #category : #'api - textual coder view model' } @@ -20,12 +20,12 @@ GtTextualCoderEditorElement >> coderUIModel: aTextualCoderViewModel [ { #category : #'instance creation' } GtTextualCoderEditorElement >> createContextMenuContent [ "wait for the addons to be computed" - | theContextMenu | + | theContextMenu aContextMenuPromise | theContextMenu := GtCoderContextMenuContent new editorElement: self. - self textualCoderViewModel addOnsAsyncDo: [ :theAddOns | + aContextMenuPromise := self textualCoderViewModel addOns asyncThen: [ :theAddOns | | theItems theContextMenuAstAddons | "extra context menu items that depend on ast and view model state such as selection" @@ -36,6 +36,8 @@ GtTextualCoderEditorElement >> createContextMenuContent [ theContextMenu enqueueTask: (BlTaskAction new action: [ theContextMenu items: theItems ]) ]. + self enqueueTask: (BlPromiseTask new promise: aContextMenuPromise). + ^ theContextMenu ] @@ -49,7 +51,7 @@ GtTextualCoderEditorElement >> hideHighlighters [ { #category : #private } GtTextualCoderEditorElement >> highlightPCRangeForInterval: aSelectionInterval [ - self textualCoderViewModel isModified + "self textualCoderViewModel isModified ifTrue: [ ^ self ]. self text clearAttributes: [ :each | each class = BlTextDecorationAttribute ]. @@ -58,7 +60,7 @@ GtTextualCoderEditorElement >> highlightPCRangeForInterval: aSelectionInterval [ anAttribute color: self theme status errorBackgroundColor; thickness: 1.5; - beNotOverwritableByStyler ] + beNotOverwritableByStyler ]" ] { #category : #initialization } @@ -186,12 +188,15 @@ GtTextualCoderEditorElement >> onPostTextualCoderViewModelChanged [ "I am an optional hook method that is sent after #subscribeToTextualCoderViewModel. I do nothing by default but allow users to perform update operations when a receiver object is already subscribed to announcements." + | anAddOnsPromise | self textualCoderViewModel hasStyledText ifTrue: [ ^ self ]. - + "the add-ons will not compute themselves unless we tell them to" - self textualCoderViewModel addOnsAsyncDo: [ :theAddOns | self onViewModelReadyToStyle ] + anAddOnsPromise := self textualCoderViewModel addOns then: [ :theAddOns | self onViewModelReadyToStyle ]. + "this works as a marker to indicate that we are waiting for the promise to finish" + self enqueueTask: (BlPromiseTask new promise: anAddOnsPromise) ] { #category : #'private - event handling' } @@ -271,7 +276,10 @@ GtTextualCoderEditorElement >> onTextualCoderViewModelChanged [ "Setting text may change cursor and selection because text editor makes sure that they have valid values. That is why we create a snaphot of the editor's state which we will restore once new text is set" - self editor restoreState: self textualCoderViewModel asEditorState. + self textualCoderViewModel asEditorState then: [ :anEditorState :isSynchronous | + isSynchronous + ifTrue: [ self editor restoreState: anEditorState ] + ifFalse: [ self enqueueTask: (BlTaskAction new action: [ self editor restoreState: anEditorState ]) ] ]. self editor model: self textualCoderViewModel. diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 040e20402..0cf542f7b 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -31,21 +31,6 @@ GtTextualCoderViewModel >> addOns [ ^ self ensureAddOns ] -{ #category : #'api - add-ons' } -GtTextualCoderViewModel >> addOnsAsyncDo: aBlock [ - self addOns asyncThen: [ :theAddOns | aBlock value: theAddOns ] -] - -{ #category : #'api - add-ons' } -GtTextualCoderViewModel >> addOnsAwait [ - ^ self addOns wait -] - -{ #category : #'api - add-ons' } -GtTextualCoderViewModel >> addOnsAwaitDo: aBlock [ - aBlock value: self addOns wait -] - { #category : #'api - shortcuts' } GtTextualCoderViewModel >> addShortcut: aShortcut [ "Add an extra shortcut add-on independent from the dynamically computed add-ons" @@ -102,28 +87,30 @@ GtTextualCoderViewModel >> addTextAttributes: aCollectionOfTextAttributes from: { #category : #converting } GtTextualCoderViewModel >> asEditorState [ - | anEditorText aMemento | - - anEditorText := self coderModel currentSourceText copy. - - self extraTextAttributes do: [ :eachCoderAttributes | - eachCoderAttributes applyOnEditorText: anEditorText ]. - - aMemento := BrTextEditorCompositeMemento new - addMemento: (BrTextEditorCursorsMemento new cursors: cursors copy); - addMemento: (BrTextEditorSelectionMemento new selection: selection copy). - - self hasStyledText - ifTrue: [ - aMemento addMemento: (BrTextEditorStyledTextMemento new - text: self styledText; - styler: self compositeStyler) ] - ifFalse: [ - aMemento - addMemento: (BrTextEditorTextMemento new text: anEditorText); - addMemento: (BrTextEditorStylerMemento new styler: self compositeStyler) ]. - - ^ aMemento + + + ^ self coderModel currentSourceTextPromise then: [ :aText | + | anEditorText aMemento | + + anEditorText := aText copy. + + self extraTextAttributes do: [ :eachCoderAttributes | + eachCoderAttributes applyOnEditorText: anEditorText ]. + + aMemento := BrTextEditorCompositeMemento new + addMemento: (BrTextEditorCursorsMemento new cursors: cursors copy); + addMemento: (BrTextEditorSelectionMemento new selection: selection copy). + + self hasStyledText + ifTrue: [ + aMemento addMemento: (BrTextEditorStyledTextMemento new + text: self styledText; + styler: self compositeStyler) ] + ifFalse: [ + aMemento + addMemento: (BrTextEditorTextMemento new text: anEditorText); + addMemento: (BrTextEditorStylerMemento new styler: self compositeStyler) ]. + aMemento ] ] { #category : #'*GToolkit-Coder-UI' } From f0f8168bd80ef9b159b24e48f23f835506099bd3 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Fri, 5 Nov 2021 13:30:45 +0100 Subject: [PATCH 0072/1268] adjust TCoderByScripterExamples>>#selectTextFor: --- .../TCoderByScripterExamples.trait.st | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st b/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st index d5277f7de..7121785bb 100644 --- a/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st +++ b/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st @@ -64,14 +64,12 @@ TCoderByScripterExamples >> selectTextFor: aScripterOrStep from: aStartPosition aSourceEditor selecter from: aStartPosition to: aToPosition; select ]; - onChildNamed: GtSourceCoderEditorId. - - aScripterOrStep wait forEmptySpaceTaskQueue. + onChildNamed: GtSourceCoderEditorId; + play. aScripterOrStep check label: 'Check selected text'; value: [ :aSourceEditor | aSourceEditor editor selectedText asString ] equals: aSelectedString; - onChildNamed: GtSourceCoderEditorId. - - aScripterOrStep syncContinue + onChildNamed: GtSourceCoderEditorId; + play ] From dc4716f86ff3d913312aa388552ddeca4314f935 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Fri, 5 Nov 2021 15:06:51 +0100 Subject: [PATCH 0073/1268] fix GtTextualCoderViewModel>>#shouldAddOnsBeUpdated --- src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 0cf542f7b..5b7a181e7 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -590,7 +590,7 @@ GtTextualCoderViewModel >> shouldAddOnsBeUpdated [ ^ addOnPromise ifNil: [ true ] - ifNotNil: [ :theAddOns | theAddOns shouldBeUpdated ] + ifNotNil: [ :theAddOns | theAddOns wait shouldBeUpdated ] ] { #category : #'api - text' } From c0f5a21df1865d444a3b23dd12da4e533ae1ef32 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Sun, 7 Nov 2021 12:53:07 +0100 Subject: [PATCH 0074/1268] handle requestUpdateAddOns by the editor element --- .../GtTextualCoderEditorElement.class.st | 5 ++++- src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st | 8 ++++++++ src/GToolkit-Coder/GtCoderModel.class.st | 7 ++----- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index c6dc63c9e..b34048612 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -299,7 +299,7 @@ GtTextualCoderEditorElement >> onToolSpawnRequest: anAnnouncement [ { #category : #'private - event handling' } GtTextualCoderEditorElement >> onUpdateAddOnsRequest: anAnnouncement [ - + self enqueueTask: (BlPromiseTask new promise: self textualCoderViewModel requestUpdateAddOns) ] { #category : #'private - event handling' } @@ -389,6 +389,9 @@ GtTextualCoderEditorElement >> onViewModelTextAttributesRemoved: anAnnouncement { #category : #'private - event handling' } GtTextualCoderEditorElement >> onViewModelTextChanged: aGtTextualCoderViewModelTextChanged [ + "When text is modified, the view model starts to recompute addOns" + self enqueueTask: (BlPromiseTask new promise: self textualCoderViewModel addOns). + aGtTextualCoderViewModelTextChanged source == self ifTrue: [ ^ self hideHighlighters ]. diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 5b7a181e7..f1be00e39 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -531,6 +531,14 @@ GtTextualCoderViewModel >> removeCoderTextAttributes: aGtTextualCoderTextAttribu self announce: (GtTextualCoderViewModelTextAttributesRemoved new coderTextAttributes: aGtTextualCoderTextAttributes) ] +{ #category : #'api - add-ons' } +GtTextualCoderViewModel >> requestUpdateAddOns [ + + + addOnPromise := nil. + ^ self ensureAddOns +] + { #category : #'api - selection' } GtTextualCoderViewModel >> select: aFromCursorIndex to: aToCursorIndex [ self selection: (self selection copy select: aFromCursorIndex to: aToCursorIndex) diff --git a/src/GToolkit-Coder/GtCoderModel.class.st b/src/GToolkit-Coder/GtCoderModel.class.st index fd3895417..f4705131b 100644 --- a/src/GToolkit-Coder/GtCoderModel.class.st +++ b/src/GToolkit-Coder/GtCoderModel.class.st @@ -32,7 +32,7 @@ Class { #classVars : [ 'UniqueIdGenerator' ], - #category : 'GToolkit-Coder-Coders' + #category : #'GToolkit-Coder-Coders' } { #category : #'class initialization' } @@ -206,10 +206,7 @@ GtCoderModel >> requestUpdateAddOns [ It is a responsibility of the Coder's Element to start the actual addon update (${method:GtCoderModel>>#updateAddOnsFrom:}$) which may happen in a background thread, that is why we can not start the update directly - we must have a reference to the element" - "addOns - ifNil: [ ^ self ]. - self addOns requestUpdate. - self announce: (GtCoderAddOnsUpdateRequest new coder: self)" + self announce: (GtCoderAddOnsUpdateRequest new coder: self) ] { #category : #subscriptions } From 45c329763a78a1a479e485fe38c05ad4a729b140 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Sun, 7 Nov 2021 21:02:58 +0100 Subject: [PATCH 0075/1268] [feenkcom/gtoolkit#2207] extend async support in the filters --- .../GtAsyncSearchGroupStream.class.st | 38 +++---------------- 1 file changed, 6 insertions(+), 32 deletions(-) diff --git a/src/GToolkit-Coder/GtAsyncSearchGroupStream.class.st b/src/GToolkit-Coder/GtAsyncSearchGroupStream.class.st index aca4863bb..645cb1ba3 100644 --- a/src/GToolkit-Coder/GtAsyncSearchGroupStream.class.st +++ b/src/GToolkit-Coder/GtAsyncSearchGroupStream.class.st @@ -9,7 +9,7 @@ Class { 'filter', 'scope' ], - #category : 'GToolkit-Coder-Filters - Streams' + #category : #'GToolkit-Coder-Filters - Streams' } { #category : #'as yet unclassified' } @@ -55,42 +55,16 @@ GtAsyncSearchGroupStream >> forFilter: aFilter scope: aScopeStream [ self updateItems ] -{ #category : #'as yet unclassified' } +{ #category : #'gt - extensions' } GtAsyncSearchGroupStream >> gtItemsFor: aView [ - | anAnnouncer theItems aListView | - - anAnnouncer := Announcer new. - theItems := nil. - - aListView := aView list. - ^ aListView + + ^ aView list title: 'Items' translated; priority: 10; items: [ - theItems ifNil: [ - self refreshItems. - (itemsFuture map: [ :computedItems | computedItems collect: [ :each | #item -> each ] ]) await - onSuccessDo: [ :theLoadedItems | - theItems := theLoadedItems. - anAnnouncer announce: Announcement new ]; - onFailureDo: [ :anError | ] ]. - theItems ifNil: [ { #loading -> 'Loading..' } ] ]; - itemType: [ :anItemTypeFactory :eachItem | eachItem key ]; - itemStencil: [ :anItemType | - (anItemType = #item) - ifTrue: [ aListView newItemLabel ] - ifFalse: [ - BrLabel new - alignCenter; - hMatchParent; - aptitude: (BrGlamorousLabelAptitude new italic; foreground: Color gray) ] ]; - itemDataBinder: [ :aLabel :anItem :anItemNode | - | aText | - aText := anItem value. - aLabel text: aText gtDisplayText asRopedText. ]; - disableAsync; - updateWhen: Announcement in: anAnnouncer + self updateItems. + itemsStream ] ] { #category : #accessing } From 6d1f54cf505199031d38a7c4e3938aa54326a26f Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Wed, 10 Nov 2021 14:30:46 +0100 Subject: [PATCH 0076/1268] [feenkcom/gtoolkit#2212] revisit pc range highlighting --- ...tMethodCoderContextPCRangeChanged.class.st | 18 ---------- .../GtSingleCoderViewModel.class.st | 10 +----- .../GtSourceCoderEditorElement.class.st | 6 ++-- .../GtTextualCoderEditorElement.class.st | 36 ++++--------------- .../GtTextualCoderViewModel.class.st | 27 ++++++++++++-- ...CoderViewModelTextAttributesAdded.class.st | 17 +++++++-- .../GtCoderSourceCodeReplaced.class.st | 20 +++++++++++ src/GToolkit-Coder/GtTextualCoder.class.st | 8 +++++ 8 files changed, 76 insertions(+), 66 deletions(-) delete mode 100644 src/GToolkit-Coder-UI/GtMethodCoderContextPCRangeChanged.class.st create mode 100644 src/GToolkit-Coder/GtCoderSourceCodeReplaced.class.st diff --git a/src/GToolkit-Coder-UI/GtMethodCoderContextPCRangeChanged.class.st b/src/GToolkit-Coder-UI/GtMethodCoderContextPCRangeChanged.class.st deleted file mode 100644 index 27036d49c..000000000 --- a/src/GToolkit-Coder-UI/GtMethodCoderContextPCRangeChanged.class.st +++ /dev/null @@ -1,18 +0,0 @@ -Class { - #name : #GtMethodCoderContextPCRangeChanged, - #superclass : #Announcement, - #instVars : [ - 'pcRange' - ], - #category : 'GToolkit-Coder-UI-Coder - Method Events' -} - -{ #category : #accessing } -GtMethodCoderContextPCRangeChanged >> pcRange [ - ^ pcRange -] - -{ #category : #accessing } -GtMethodCoderContextPCRangeChanged >> pcRange: anObject [ - pcRange := anObject -] diff --git a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st index d1ab1d432..ad3c86e80 100644 --- a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st @@ -13,7 +13,7 @@ Class { 'announcer', 'codersUIModel' ], - #category : 'GToolkit-Coder-UI-Coder - Basic' + #category : #'GToolkit-Coder-UI-Coder - Basic' } { #category : #accessing } @@ -114,11 +114,3 @@ GtSingleCoderViewModel >> isModified [ GtSingleCoderViewModel >> onCoderModelChanged [ "Is sent when a new coder model is assigned to the view model" ] - -{ #category : #accessing } -GtSingleCoderViewModel >> programCounterRange [ - "This is workwound util the method coder context had a dedicated element. - Now the element for displaying a coder is shared between all types of coders." - - ^ nil -] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st index c72b0da14..2dedbc9a5 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st @@ -1,7 +1,7 @@ Class { #name : #GtSourceCoderEditorElement, #superclass : #GtTextualCoderEditorElement, - #category : 'GToolkit-Coder-UI-Coder - Textual' + #category : #'GToolkit-Coder-UI-Coder - Textual' } { #category : #'api - textual coder view model' } @@ -10,7 +10,5 @@ GtSourceCoderEditorElement >> onTextualCoderViewModelChanged [ self textualCoderViewModel evaluationResult ifNil: [ evaluationHighlighter hideResult ] - ifNotNil: [ :aResult | evaluationHighlighter displayResult: aResult ]. - self textualCoderViewModel programCounterRange - ifNotNil: [ :aRange | self highlightPCRangeForInterval: aRange ] + ifNotNil: [ :aResult | evaluationHighlighter displayResult: aResult ] ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index b34048612..82e4bf023 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -49,20 +49,6 @@ GtTextualCoderEditorElement >> hideHighlighters [ evaluationPrinter hideResultSynchronously. ] -{ #category : #private } -GtTextualCoderEditorElement >> highlightPCRangeForInterval: aSelectionInterval [ - "self textualCoderViewModel isModified - ifTrue: [ ^ self ]. - self text - clearAttributes: [ :each | each class = BlTextDecorationAttribute ]. - (self text from: aSelectionInterval first to: aSelectionInterval last) - underlineDo: [ :anAttribute | - anAttribute - color: self theme status errorBackgroundColor; - thickness: 1.5; - beNotOverwritableByStyler ]" -] - { #category : #initialization } GtTextualCoderEditorElement >> initialize [ super initialize. @@ -136,14 +122,6 @@ GtTextualCoderEditorElement >> onCoderViewModelFocused: aBoolean [ ifFalse: [ self loseFocus ] ] -{ #category : #'private - event handling' } -GtTextualCoderEditorElement >> onContextPCRangeChanged: aContextPCRangeChangedAnnouncement [ - | selectionInterval | - - selectionInterval := aContextPCRangeChangedAnnouncement pcRange. - self highlightPCRangeForInterval: selectionInterval -] - { #category : #'private - event handling' } GtTextualCoderEditorElement >> onCursorsChanged: aCursorsChangedAnnouncement [ "Is sent when the cursors change in the View Model. @@ -374,10 +352,12 @@ GtTextualCoderEditorElement >> onViewModelStylersChanged [ { #category : #'private - event handling' } GtTextualCoderEditorElement >> onViewModelTextAttributesAdded: anAnnouncement [ self enqueueTask: (BlTaskAction new action: [ - anAnnouncement coderTextAttributes - applyOnEditorText: self text - from: anAnnouncement startPosition - to: anAnnouncement stopPosition ]) + anAnnouncement text characters = self text characters + ifTrue: [ + anAnnouncement coderTextAttributes + applyOnEditorText: self text + from: anAnnouncement startPosition + to: anAnnouncement stopPosition ] ]) ] { #category : #'private - event handling' } @@ -429,13 +409,9 @@ GtTextualCoderEditorElement >> registerCoderModelAnnouncementsFor: aCoderModel [ { #category : #registration } GtTextualCoderEditorElement >> registerCoderViewModelAnnouncementsFor: aGtSourceCoderUIModel [ aGtSourceCoderUIModel weak - when: GtMethodCoderContextPCRangeChanged - send: #onContextPCRangeChanged: - to: self; when: GtSourceCoderFocusChanged send: #onFocusChangedAnnouncement: to: self; - when: GtTextualCoderViewModelTextChanged send: #onViewModelTextChanged: to: self; diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index f1be00e39..caf494ad4 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -61,16 +61,36 @@ GtTextualCoderViewModel >> addTextAttribute: aTextAttribute from: aStartPosition to: anEndPosition ] +{ #category : #'api - text' } +GtTextualCoderViewModel >> addTextAttribute: aTextAttribute onText: aText from: aStartPosition to: anEndPosition [ + + ^ self + addTextAttributes: { aTextAttribute } + onText: aText + from: aStartPosition + to: anEndPosition +] + { #category : #'api - text' } GtTextualCoderViewModel >> addTextAttributes: aCollectionOfTextAttributes from: aStartPosition to: anEndPosition [ - | aCurrentText aMarkerAttribute newCoderTextAttributes | + + ^ self + addTextAttributes: aCollectionOfTextAttributes + onText: self sourceText + from: aStartPosition + to: anEndPosition +] + +{ #category : #'api - text' } +GtTextualCoderViewModel >> addTextAttributes: aCollectionOfTextAttributes onText: aText from: aStartPosition to: anEndPosition [ + + | aMarkerAttribute newCoderTextAttributes | aMarkerAttribute := BrTextInvisibleMarkerAttribute new beNotOverwritableByStyler. "we change the sourceText directly to not trigger the styler recomputation" - aCurrentText := self sourceText. - aCurrentText attribute: aMarkerAttribute from: aStartPosition to: anEndPosition. + aText attribute: aMarkerAttribute from: aStartPosition to: anEndPosition. newCoderTextAttributes := GtTextualCoderTextAttributes new markerAttribute: aMarkerAttribute; @@ -79,6 +99,7 @@ GtTextualCoderViewModel >> addTextAttributes: aCollectionOfTextAttributes from: extraTextAttributes add: newCoderTextAttributes. self announce: (GtTextualCoderViewModelTextAttributesAdded new coderTextAttributes: newCoderTextAttributes; + text: aText; startPosition: aStartPosition; stopPosition: anEndPosition). diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextAttributesAdded.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextAttributesAdded.class.st index 559a65547..8b8cf6316 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextAttributesAdded.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextAttributesAdded.class.st @@ -4,9 +4,10 @@ Class { #instVars : [ 'coderTextAttributes', 'startPosition', - 'stopPosition' + 'stopPosition', + 'text' ], - #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' + #category : #'GToolkit-Coder-UI-Coder - Textual Model - Events' } { #category : #accessing } @@ -38,3 +39,15 @@ GtTextualCoderViewModelTextAttributesAdded >> stopPosition [ GtTextualCoderViewModelTextAttributesAdded >> stopPosition: anObject [ stopPosition := anObject ] + +{ #category : #accessing } +GtTextualCoderViewModelTextAttributesAdded >> text [ + + ^ text +] + +{ #category : #accessing } +GtTextualCoderViewModelTextAttributesAdded >> text: anObject [ + + text := anObject +] diff --git a/src/GToolkit-Coder/GtCoderSourceCodeReplaced.class.st b/src/GToolkit-Coder/GtCoderSourceCodeReplaced.class.st new file mode 100644 index 000000000..982e187c2 --- /dev/null +++ b/src/GToolkit-Coder/GtCoderSourceCodeReplaced.class.st @@ -0,0 +1,20 @@ +Class { + #name : #GtCoderSourceCodeReplaced, + #superclass : #GtSourceCoderAnnouncement, + #instVars : [ + 'sourceCode' + ], + #category : #'GToolkit-Coder-Event' +} + +{ #category : #accessing } +GtCoderSourceCodeReplaced >> sourceCode [ + + ^ sourceCode +] + +{ #category : #accessing } +GtCoderSourceCodeReplaced >> sourceCode: anObject [ + + sourceCode := anObject +] diff --git a/src/GToolkit-Coder/GtTextualCoder.class.st b/src/GToolkit-Coder/GtTextualCoder.class.st index f1cc80984..c5776a202 100644 --- a/src/GToolkit-Coder/GtTextualCoder.class.st +++ b/src/GToolkit-Coder/GtTextualCoder.class.st @@ -228,6 +228,13 @@ GtTextualCoder >> notifySourceChangedTo: aNewText with: anUpdateStragegy [ coder: self) ] +{ #category : #'private - notifying' } +GtTextualCoder >> notifySourceCodeReplaced: aSourceCode [ + self announce: (GtCoderSourceCodeReplaced new + sourceCode: aSourceCode; + coder: self) +] + { #category : #private } GtTextualCoder >> pragmasNamed: aSymbol inHierarchy: aClass [ | actions | @@ -294,6 +301,7 @@ GtTextualCoder >> sourceCode: aGtCoderSourceCode withStrategy: anUpdateStragegy "Set the source code of this coder to a given one and notify about the changes" sourceCode := aGtCoderSourceCode. + self notifySourceCodeReplaced: aGtCoderSourceCode. self sourceChangedTo: nil with: anUpdateStragegy ] From 84caa336b435836e10817c1c2049e6a3d99c5b30 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 11 Nov 2021 20:08:09 -0300 Subject: [PATCH 0077/1268] use string literal match instead of the substring literal match --- src/GToolkit-Coder-Extensions/RPackage.extension.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-Extensions/RPackage.extension.st b/src/GToolkit-Coder-Extensions/RPackage.extension.st index f1d0fd8bf..e72651193 100644 --- a/src/GToolkit-Coder-Extensions/RPackage.extension.st +++ b/src/GToolkit-Coder-Extensions/RPackage.extension.st @@ -6,7 +6,7 @@ RPackage >> gtBaselinesFor: aView [ ^ aView explicit title: 'References'; priority: 30; - stencil: [ self name gtSubstringLiteralCaseSensitiveMatch ] + stencil: [ self name gtStringLiteralCaseSensitiveMatch ] ] { #category : #'*GToolkit-Coder-Extensions' } From 062d9ac990230779f551ff5d8bf21d7fe8d5d1dc Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Sat, 13 Nov 2021 21:58:30 +0100 Subject: [PATCH 0078/1268] [feenkcom/gtoolkit#2207] migrating filters to streams --- .../GtAsyncSearchGroupStream.class.st | 43 ++++++++++++++----- .../GtAsyncSearchNullGroupStream.class.st | 13 +++--- .../GtAsyncSearchTypedGroupStream.class.st | 2 +- src/GToolkit-Coder/GtSearchFilter.class.st | 43 ++++++------------- .../GtSearchGroupResult.class.st | 4 +- .../GtSearchNullFilter.class.st | 4 +- .../GtSearchNullGroupResult.class.st | 23 ---------- .../GtSearchTypedEntitiesFilter.class.st | 12 +----- .../GtSearchUnionFilter.class.st | 4 +- 9 files changed, 58 insertions(+), 90 deletions(-) delete mode 100644 src/GToolkit-Coder/GtSearchNullGroupResult.class.st diff --git a/src/GToolkit-Coder/GtAsyncSearchGroupStream.class.st b/src/GToolkit-Coder/GtAsyncSearchGroupStream.class.st index 645cb1ba3..489b049f9 100644 --- a/src/GToolkit-Coder/GtAsyncSearchGroupStream.class.st +++ b/src/GToolkit-Coder/GtAsyncSearchGroupStream.class.st @@ -5,7 +5,6 @@ Class { #classTraits : 'TAsyncStream classTrait', #instVars : [ 'itemsStream', - 'itemsFuture', 'filter', 'scope' ], @@ -39,13 +38,18 @@ GtAsyncSearchGroupStream >> filter [ ^ filter ] +{ #category : #'private - updating' } +GtAsyncSearchGroupStream >> filteredItemsStream [ + ^ scope asyncSimilarCopy filter: filter +] + { #category : #initialization } GtAsyncSearchGroupStream >> forFilter: aFilter [ self forFilter: aFilter scope: (aFilter ifNil: [ AsyncEmptyStream new ] - ifNotNil: [ aFilter defaultFilterScopeStream ]) + ifNotNil: [ aFilter defaultFilterScope ]) ] { #category : #initialization } @@ -62,9 +66,14 @@ GtAsyncSearchGroupStream >> gtItemsFor: aView [ ^ aView list title: 'Items' translated; priority: 10; - items: [ - self updateItems. - itemsStream ] + items: [ self asyncSimilarCopy ] +] + +{ #category : #'gt - extensions' } +GtAsyncSearchGroupStream >> gtMetricsFor: aView [ + + + ^ aView empty ] { #category : #accessing } @@ -78,7 +87,7 @@ GtAsyncSearchGroupStream >> highlighter [ GtAsyncSearchGroupStream >> initialize [ super initialize. - itemsStream := AsyncEmptyStream new. + itemsStream := AsyncEmptyStream new ] { #category : #'api - stream' } @@ -93,9 +102,16 @@ GtAsyncSearchGroupStream >> pollNext: anAsynchronousContext [ ^ itemsStream pollNext: anAsynchronousContext ] -{ #category : #initialization } +{ #category : #'api - stream copy' } +GtAsyncSearchGroupStream >> postSimilarCopy [ + "Is called by similarCopy. self is a shallow copy, implementors should set the fields as necessary to complete the similar copy" + scope := scope asyncSimilarCopy. + self updateItems +] + +{ #category : #'private - updating' } GtAsyncSearchGroupStream >> refreshItems [ - self forFilter: self filter + self updateItems ] { #category : #accessing } @@ -103,6 +119,13 @@ GtAsyncSearchGroupStream >> scope [ ^ scope ] +{ #category : #'api - stream' } +GtAsyncSearchGroupStream >> size [ + + + ^ self asyncSimilarCopy inject: 0 into: [ :counter :eachItem | counter + 1 ] +] + { #category : #'api - stream' } GtAsyncSearchGroupStream >> sizeHint [ @@ -110,7 +133,7 @@ GtAsyncSearchGroupStream >> sizeHint [ ^ itemsStream sizeHint ] -{ #category : #initialization } +{ #category : #'private - updating' } GtAsyncSearchGroupStream >> updateItems [ - itemsStream := scope filter: filter + itemsStream := self filteredItemsStream ] diff --git a/src/GToolkit-Coder/GtAsyncSearchNullGroupStream.class.st b/src/GToolkit-Coder/GtAsyncSearchNullGroupStream.class.st index 01b534b87..07346bdb2 100644 --- a/src/GToolkit-Coder/GtAsyncSearchNullGroupStream.class.st +++ b/src/GToolkit-Coder/GtAsyncSearchNullGroupStream.class.st @@ -1,7 +1,7 @@ Class { #name : #GtAsyncSearchNullGroupStream, - #superclass : #GtSearchGroupResult, - #category : 'GToolkit-Coder-Filters - Streams' + #superclass : #GtAsyncSearchGroupStream, + #category : #'GToolkit-Coder-Filters - Streams' } { #category : #'as yet unclassified' } @@ -14,10 +14,7 @@ GtAsyncSearchNullGroupStream class >> mergeTypeWithTypedGroup: aGroupType [ ^ aGroupType ] -{ #category : #enumerating } -GtAsyncSearchNullGroupStream >> refreshItems [ - filtered - ifTrue: [ ^ self ]. - items := OrderedCollection new. - filtered := true. +{ #category : #'private - updating' } +GtAsyncSearchNullGroupStream >> filteredItemsStream [ + ^ AsyncEmptyStream new ] diff --git a/src/GToolkit-Coder/GtAsyncSearchTypedGroupStream.class.st b/src/GToolkit-Coder/GtAsyncSearchTypedGroupStream.class.st index 602103e50..9f61e02cc 100644 --- a/src/GToolkit-Coder/GtAsyncSearchTypedGroupStream.class.st +++ b/src/GToolkit-Coder/GtAsyncSearchTypedGroupStream.class.st @@ -16,7 +16,7 @@ GtAsyncSearchTypedGroupStream class >> mergeTypeWith: aGroupResultClass [ GtAsyncSearchTypedGroupStream class >> mergeTypeWithTypedGroup: aGroupType [ ^ aGroupType = self ifTrue: [ self ] - ifFalse: [ GtSearchGroupResult ] + ifFalse: [ GtAsyncSearchGroupStream ] ] { #category : #accessing } diff --git a/src/GToolkit-Coder/GtSearchFilter.class.st b/src/GToolkit-Coder/GtSearchFilter.class.st index 7047846ca..38c6c7e1f 100644 --- a/src/GToolkit-Coder/GtSearchFilter.class.st +++ b/src/GToolkit-Coder/GtSearchFilter.class.st @@ -1,7 +1,7 @@ Class { #name : #GtSearchFilter, #superclass : #Object, - #category : 'GToolkit-Coder-Filters' + #category : #'GToolkit-Coder-Filters' } { #category : #'logical operations' } @@ -18,11 +18,16 @@ GtSearchFilter >> applyInScope: aSearchScope [ { #category : #evaluating } GtSearchFilter >> applyInScopeStream: aStream [ - ^ self resultTypeStream new + ^ self resultType new forFilter: self scope: aStream ] +{ #category : #converting } +GtSearchFilter >> asAsyncStream [ + ^ self result +] + { #category : #converting } GtSearchFilter >> asCoder [ ^ self result asCoder @@ -35,17 +40,14 @@ GtSearchFilter >> asElement [ { #category : #accessing } GtSearchFilter >> defaultFilterScope [ - ^ GtSearchNullFilter new -] - -{ #category : #accessing } -GtSearchFilter >> defaultFilterScopeStream [ ^ AsyncEmptyStream new ] { #category : #iterating } GtSearchFilter >> do: aBlock [ - self result do: aBlock + ((self result do: aBlock) + inject: 0 into: [ :total :each | total + 1 ]) + wait ] { #category : #converting } @@ -56,17 +58,6 @@ GtSearchFilter >> gtExamples [ ^ GtExampleGroup withAll: examples ] -{ #category : #ui } -GtSearchFilter >> gtItemsFor: aView [ - "this is a view that is polymorphic with the one defined in ${method:Collection>>#gtItemsFor:}$" - - ^ aView forward - title: 'Live'; - priority: 10; - object: [ self result ]; - view: #gtItemsFor: -] - { #category : #accessing } GtSearchFilter >> highlighter [ ^ nil @@ -89,26 +80,16 @@ GtSearchFilter >> not [ { #category : #testing } GtSearchFilter >> notEmpty [ - ^ self isEmpty not + ^ self result hasNext wait ] { #category : #converting } GtSearchFilter >> result [ - ^ self applyInScope: self defaultFilterScope -] - -{ #category : #converting } -GtSearchFilter >> resultStream [ - ^ self applyInScopeStream: self defaultFilterScopeStream + ^ self applyInScopeStream: self defaultFilterScope ] { #category : #accessing } GtSearchFilter >> resultType [ - ^ GtSearchNullGroupResult -] - -{ #category : #accessing } -GtSearchFilter >> resultTypeStream [ ^ GtAsyncSearchNullGroupStream ] diff --git a/src/GToolkit-Coder/GtSearchGroupResult.class.st b/src/GToolkit-Coder/GtSearchGroupResult.class.st index a3bab008b..8f6a6f92a 100644 --- a/src/GToolkit-Coder/GtSearchGroupResult.class.st +++ b/src/GToolkit-Coder/GtSearchGroupResult.class.st @@ -7,7 +7,7 @@ Class { 'filtered', 'scope' ], - #category : 'GToolkit-Coder-Filters' + #category : #'GToolkit-Coder-Filters' } { #category : #'as yet unclassified' } @@ -158,6 +158,6 @@ GtSearchGroupResult >> sumNumbers: aBlock [ GtSearchGroupResult >> updateForFilter: aFilter [ self filter: aFilter. self scope: (aFilter - ifNil: [ GtSearchNullFilter new ] + ifNil: [ AsyncEmptyStream new ] ifNotNil: [ aFilter defaultFilterScope ]) ] diff --git a/src/GToolkit-Coder/GtSearchNullFilter.class.st b/src/GToolkit-Coder/GtSearchNullFilter.class.st index 8496f68ac..72a15a353 100644 --- a/src/GToolkit-Coder/GtSearchNullFilter.class.st +++ b/src/GToolkit-Coder/GtSearchNullFilter.class.st @@ -1,7 +1,7 @@ Class { #name : #GtSearchNullFilter, #superclass : #GtSearchFilter, - #category : 'GToolkit-Coder-Filters' + #category : #'GToolkit-Coder-Filters' } { #category : #comparing } @@ -13,7 +13,7 @@ GtSearchNullFilter >> = anObject [ { #category : #accessing } GtSearchNullFilter >> defaultFilterScope [ - ^ self + ^ AsyncEmptyStream new ] { #category : #enumerating } diff --git a/src/GToolkit-Coder/GtSearchNullGroupResult.class.st b/src/GToolkit-Coder/GtSearchNullGroupResult.class.st deleted file mode 100644 index f8990c7df..000000000 --- a/src/GToolkit-Coder/GtSearchNullGroupResult.class.st +++ /dev/null @@ -1,23 +0,0 @@ -Class { - #name : #GtSearchNullGroupResult, - #superclass : #GtSearchGroupResult, - #category : 'GToolkit-Coder-Filters' -} - -{ #category : #'as yet unclassified' } -GtSearchNullGroupResult class >> mergeTypeWith: aGroupResultClass [ - ^ aGroupResultClass mergeTypeWithGenericGroup. -] - -{ #category : #'as yet unclassified' } -GtSearchNullGroupResult class >> mergeTypeWithTypedGroup: aGroupType [ - ^ aGroupType -] - -{ #category : #enumerating } -GtSearchNullGroupResult >> refreshItems [ - filtered - ifTrue: [ ^ self ]. - items := OrderedCollection new. - filtered := true. -] diff --git a/src/GToolkit-Coder/GtSearchTypedEntitiesFilter.class.st b/src/GToolkit-Coder/GtSearchTypedEntitiesFilter.class.st index 356520c79..29e1b8345 100644 --- a/src/GToolkit-Coder/GtSearchTypedEntitiesFilter.class.st +++ b/src/GToolkit-Coder/GtSearchTypedEntitiesFilter.class.st @@ -1,7 +1,7 @@ Class { #name : #GtSearchTypedEntitiesFilter, #superclass : #GtSearchFilter, - #category : 'GToolkit-Coder-Filters' + #category : #'GToolkit-Coder-Filters' } { #category : #accessing } @@ -9,17 +9,7 @@ GtSearchTypedEntitiesFilter class >> resultType [ self subclassResponsibility ] -{ #category : #accessing } -GtSearchTypedEntitiesFilter class >> resultTypeStream [ - self subclassResponsibility -] - { #category : #accessing } GtSearchTypedEntitiesFilter >> resultType [ ^ self class resultType ] - -{ #category : #accessing } -GtSearchTypedEntitiesFilter >> resultTypeStream [ - ^ self class resultTypeStream -] diff --git a/src/GToolkit-Coder/GtSearchUnionFilter.class.st b/src/GToolkit-Coder/GtSearchUnionFilter.class.st index b32162580..96ab09333 100644 --- a/src/GToolkit-Coder/GtSearchUnionFilter.class.st +++ b/src/GToolkit-Coder/GtSearchUnionFilter.class.st @@ -1,14 +1,14 @@ Class { #name : #GtSearchUnionFilter, #superclass : #GtSearchBinaryFilter, - #category : 'GToolkit-Coder-Filters' + #category : #'GToolkit-Coder-Filters' } { #category : #accessing } GtSearchUnionFilter >> defaultFilterScope [ ^ left defaultFilterScope = right defaultFilterScope ifTrue: [ left defaultFilterScope ] - ifFalse: [ self ] + ifFalse: [ left defaultFilterScope merge: right defaultFilterScope ] ] { #category : #printing } From 9a39f0fc412dc9cfff20f156e718ad961300a8a8 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Sat, 13 Nov 2021 22:20:06 +0100 Subject: [PATCH 0079/1268] [feenkcom/gtoolkit#2207] extract filters into GToolkit-SearchFilters --- .../BaselineOfGToolkitCoder.class.st | 6 +- .../GtUnionFilterExamples.class.st | 3 +- .../GtSearchFilter.extension.st | 6 ++ .../GtSearchBinaryFilter.class.st | 30 +----- .../GtSearchBinaryFilter.extension.st | 12 +++ src/GToolkit-Coder/GtSearchFilter.class.st | 99 +------------------ .../GtSearchFilter.extension.st | 19 ++++ .../GtAsyncSearchGroupStream.class.st | 9 +- .../GtAsyncSearchNullGroupStream.class.st | 2 +- .../GtAsyncSearchTypedGroupStream.class.st | 2 +- .../GtFilterExampleAllState.class.st | 2 +- .../GtFilterExampleErrorState.class.st | 2 +- .../GtFilterExampleFailureState.class.st | 2 +- .../GtFilterExampleNotExecutedState.class.st | 2 +- .../GtFilterExampleState.class.st | 6 +- .../GtFilterExampleSuccessState.class.st | 2 +- .../GtSearchBinaryFilter.class.st | 37 +++++++ .../GtSearchBlockFilter.class.st | 2 +- .../GtSearchFilter.class.st | 86 ++++++++++++++++ .../GtSearchGroupResult.class.st | 2 +- .../GtSearchIntersectionFilter.class.st | 2 +- .../GtSearchNegationFilter.class.st | 2 +- .../GtSearchNullFilter.class.st | 2 +- .../GtSearchTypedEntitiesFilter.class.st | 2 +- .../GtSearchTypedGroupResult.class.st | 2 +- .../GtSearchUnionFilter.class.st | 2 +- src/GToolkit-SearchFilters/package.st | 1 + 27 files changed, 190 insertions(+), 154 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtSearchFilter.extension.st create mode 100644 src/GToolkit-Coder/GtSearchBinaryFilter.extension.st create mode 100644 src/GToolkit-Coder/GtSearchFilter.extension.st rename src/{GToolkit-Coder => GToolkit-SearchFilters}/GtAsyncSearchGroupStream.class.st (94%) rename src/{GToolkit-Coder => GToolkit-SearchFilters}/GtAsyncSearchNullGroupStream.class.st (91%) rename src/{GToolkit-Coder => GToolkit-SearchFilters}/GtAsyncSearchTypedGroupStream.class.st (94%) rename src/{GToolkit-Coder => GToolkit-SearchFilters}/GtFilterExampleAllState.class.st (92%) rename src/{GToolkit-Coder => GToolkit-SearchFilters}/GtFilterExampleErrorState.class.st (95%) rename src/{GToolkit-Coder => GToolkit-SearchFilters}/GtFilterExampleFailureState.class.st (95%) rename src/{GToolkit-Coder => GToolkit-SearchFilters}/GtFilterExampleNotExecutedState.class.st (94%) rename src/{GToolkit-Coder => GToolkit-SearchFilters}/GtFilterExampleState.class.st (94%) rename src/{GToolkit-Coder => GToolkit-SearchFilters}/GtFilterExampleSuccessState.class.st (95%) create mode 100644 src/GToolkit-SearchFilters/GtSearchBinaryFilter.class.st rename src/{GToolkit-Coder => GToolkit-SearchFilters}/GtSearchBlockFilter.class.st (91%) create mode 100644 src/GToolkit-SearchFilters/GtSearchFilter.class.st rename src/{GToolkit-Coder => GToolkit-SearchFilters}/GtSearchGroupResult.class.st (98%) rename src/{GToolkit-Coder => GToolkit-SearchFilters}/GtSearchIntersectionFilter.class.st (93%) rename src/{GToolkit-Coder => GToolkit-SearchFilters}/GtSearchNegationFilter.class.st (95%) rename src/{GToolkit-Coder => GToolkit-SearchFilters}/GtSearchNullFilter.class.st (91%) rename src/{GToolkit-Coder => GToolkit-SearchFilters}/GtSearchTypedEntitiesFilter.class.st (86%) rename src/{GToolkit-Coder => GToolkit-SearchFilters}/GtSearchTypedGroupResult.class.st (94%) rename src/{GToolkit-Coder => GToolkit-SearchFilters}/GtSearchUnionFilter.class.st (95%) create mode 100644 src/GToolkit-SearchFilters/package.st diff --git a/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st b/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st index 7810751c6..ac016c523 100644 --- a/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st +++ b/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st @@ -49,13 +49,15 @@ BaselineOfGToolkitCoder >> baseline: spec [ baseline: 'GToolkitCompleter' with: [ spec repository: 'github://feenkcom/gtoolkit-completer:main/src' ]. - + spec package: 'GToolkit-VariableBindings'; + package: 'GToolkit-SearchFilters' + with: [ spec requires: #( 'Futures' 'GToolkitBasicUtility' ) ]; package: 'GToolkit-Coder' with: [ spec requires: #( 'Futures' 'GToolkitBasicUtility' 'GToolkitAnnouncerUtility' - 'GToolkitPager' 'GToolkitCompleter' ) ]; + 'GToolkitPager' 'GToolkitCompleter' 'GToolkit-SearchFilters' ) ]; package: 'GToolkit-Coder-UI' with: [ spec requires: #( 'GToolkit-Coder' 'GToolkit-VariableBindings' 'GToolkitBasicUtility' 'GToolkitPager' ) ]; diff --git a/src/GToolkit-Coder-Examples/GtUnionFilterExamples.class.st b/src/GToolkit-Coder-Examples/GtUnionFilterExamples.class.st index f95783abf..0e007572c 100644 --- a/src/GToolkit-Coder-Examples/GtUnionFilterExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtUnionFilterExamples.class.st @@ -19,10 +19,11 @@ GtUnionFilterExamples >> unionDifferentMethods [ { #category : #examples } GtUnionFilterExamples >> unionNullFilter [ + | filter union | filter := thisContext method selector gtImplementors. union := GtSearchNullFilter new | filter | filter. - self assert: union size = filter size. + self assert: union size equals: filter size. self assert: (union matches: thisContext method). ^ union ] diff --git a/src/GToolkit-Coder-UI/GtSearchFilter.extension.st b/src/GToolkit-Coder-UI/GtSearchFilter.extension.st new file mode 100644 index 000000000..d99058f8e --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSearchFilter.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #GtSearchFilter } + +{ #category : #'*GToolkit-Coder-UI' } +GtSearchFilter >> asElement [ + ^ self asCoder asElement +] diff --git a/src/GToolkit-Coder/GtSearchBinaryFilter.class.st b/src/GToolkit-Coder/GtSearchBinaryFilter.class.st index b6d6c08b1..a294d1c68 100644 --- a/src/GToolkit-Coder/GtSearchBinaryFilter.class.st +++ b/src/GToolkit-Coder/GtSearchBinaryFilter.class.st @@ -8,20 +8,7 @@ Class { #category : 'GToolkit-Coder-Filters' } -{ #category : #'instance creation' } -GtSearchBinaryFilter class >> forFilter: leftFilter filter: rightFilter [ - ^ self new - filter: leftFilter filter: rightFilter; - yourself -] - -{ #category : #'initialize-release' } -GtSearchBinaryFilter >> filter: leftFilter filter: rightFilter [ - left := leftFilter. - right := rightFilter -] - -{ #category : #accessing } +{ #category : #'*GToolkit-Coder' } GtSearchBinaryFilter >> highlighter [ ^ left highlighter ifNil: [ right highlighter ] @@ -31,18 +18,3 @@ GtSearchBinaryFilter >> highlighter [ ifNotNil: [ :rh | GtCompositeHighlighter forHighlighters: (Array with: lh with: rh) ] ] ] - -{ #category : #accessing } -GtSearchBinaryFilter >> leftFilter [ - ^ left -] - -{ #category : #accessing } -GtSearchBinaryFilter >> resultType [ - ^ left resultType mergeTypeWith: right resultType -] - -{ #category : #accessing } -GtSearchBinaryFilter >> rightFilter [ - ^ right -] diff --git a/src/GToolkit-Coder/GtSearchBinaryFilter.extension.st b/src/GToolkit-Coder/GtSearchBinaryFilter.extension.st new file mode 100644 index 000000000..2d6da1a29 --- /dev/null +++ b/src/GToolkit-Coder/GtSearchBinaryFilter.extension.st @@ -0,0 +1,12 @@ +Extension { #name : #GtSearchBinaryFilter } + +{ #category : #'*GToolkit-Coder' } +GtSearchBinaryFilter >> highlighter [ + ^ left highlighter + ifNil: [ right highlighter ] + ifNotNil: [ :lh | + right highlighter + ifNil: [ lh ] + ifNotNil: + [ :rh | GtCompositeHighlighter forHighlighters: (Array with: lh with: rh) ] ] +] diff --git a/src/GToolkit-Coder/GtSearchFilter.class.st b/src/GToolkit-Coder/GtSearchFilter.class.st index 38c6c7e1f..0b0e26b29 100644 --- a/src/GToolkit-Coder/GtSearchFilter.class.st +++ b/src/GToolkit-Coder/GtSearchFilter.class.st @@ -4,53 +4,12 @@ Class { #category : #'GToolkit-Coder-Filters' } -{ #category : #'logical operations' } -GtSearchFilter >> & aFilter [ - ^ GtSearchIntersectionFilter forFilter: self filter: aFilter -] - -{ #category : #evaluating } -GtSearchFilter >> applyInScope: aSearchScope [ - ^ self resultType new - scope: aSearchScope; - filter: self -] - -{ #category : #evaluating } -GtSearchFilter >> applyInScopeStream: aStream [ - ^ self resultType new - forFilter: self - scope: aStream -] - -{ #category : #converting } -GtSearchFilter >> asAsyncStream [ - ^ self result -] - -{ #category : #converting } +{ #category : #'*GToolkit-Coder' } GtSearchFilter >> asCoder [ ^ self result asCoder ] -{ #category : #converting } -GtSearchFilter >> asElement [ - ^ self asCoder asElement -] - -{ #category : #accessing } -GtSearchFilter >> defaultFilterScope [ - ^ AsyncEmptyStream new -] - -{ #category : #iterating } -GtSearchFilter >> do: aBlock [ - ((self result do: aBlock) - inject: 0 into: [ :total :each | total + 1 ]) - wait -] - -{ #category : #converting } +{ #category : #'*GToolkit-Coder' } GtSearchFilter >> gtExamples [ | examples | examples := OrderedCollection new. @@ -58,59 +17,7 @@ GtSearchFilter >> gtExamples [ ^ GtExampleGroup withAll: examples ] -{ #category : #accessing } +{ #category : #'*GToolkit-Coder' } GtSearchFilter >> highlighter [ ^ nil ] - -{ #category : #accessing } -GtSearchFilter >> isEmpty [ - ^ self result isEmpty -] - -{ #category : #testing } -GtSearchFilter >> matches: anObject [ - self subclassResponsibility -] - -{ #category : #'logical operations' } -GtSearchFilter >> not [ - ^ GtSearchNegationFilter new originalFilter: self -] - -{ #category : #testing } -GtSearchFilter >> notEmpty [ - ^ self result hasNext wait -] - -{ #category : #converting } -GtSearchFilter >> result [ - ^ self applyInScopeStream: self defaultFilterScope -] - -{ #category : #accessing } -GtSearchFilter >> resultType [ - ^ GtAsyncSearchNullGroupStream -] - -{ #category : #'logical operations' } -GtSearchFilter >> select: aBlock [ - ^ self & (GtSearchBlockFilter forBlock: aBlock) -] - -{ #category : #accessing } -GtSearchFilter >> size [ - ^ self result size -] - -{ #category : #testing } -GtSearchFilter >> value: anObject [ - "To be polymorphic with block closures" - - ^ self matches: anObject -] - -{ #category : #'logical operations' } -GtSearchFilter >> | aFilter [ - ^ GtSearchUnionFilter forFilter: self filter: aFilter -] diff --git a/src/GToolkit-Coder/GtSearchFilter.extension.st b/src/GToolkit-Coder/GtSearchFilter.extension.st new file mode 100644 index 000000000..369c2fc18 --- /dev/null +++ b/src/GToolkit-Coder/GtSearchFilter.extension.st @@ -0,0 +1,19 @@ +Extension { #name : #GtSearchFilter } + +{ #category : #'*GToolkit-Coder' } +GtSearchFilter >> asCoder [ + ^ self result asCoder +] + +{ #category : #'*GToolkit-Coder' } +GtSearchFilter >> gtExamples [ + | examples | + examples := OrderedCollection new. + self result do: [ :each | examples addAll: each gtExamples ]. + ^ GtExampleGroup withAll: examples +] + +{ #category : #'*GToolkit-Coder' } +GtSearchFilter >> highlighter [ + ^ nil +] diff --git a/src/GToolkit-Coder/GtAsyncSearchGroupStream.class.st b/src/GToolkit-SearchFilters/GtAsyncSearchGroupStream.class.st similarity index 94% rename from src/GToolkit-Coder/GtAsyncSearchGroupStream.class.st rename to src/GToolkit-SearchFilters/GtAsyncSearchGroupStream.class.st index 489b049f9..d94b94cc7 100644 --- a/src/GToolkit-Coder/GtAsyncSearchGroupStream.class.st +++ b/src/GToolkit-SearchFilters/GtAsyncSearchGroupStream.class.st @@ -8,7 +8,7 @@ Class { 'filter', 'scope' ], - #category : #'GToolkit-Coder-Filters - Streams' + #category : #'GToolkit-SearchFilters-Results' } { #category : #'as yet unclassified' } @@ -119,13 +119,6 @@ GtAsyncSearchGroupStream >> scope [ ^ scope ] -{ #category : #'api - stream' } -GtAsyncSearchGroupStream >> size [ - - - ^ self asyncSimilarCopy inject: 0 into: [ :counter :eachItem | counter + 1 ] -] - { #category : #'api - stream' } GtAsyncSearchGroupStream >> sizeHint [ diff --git a/src/GToolkit-Coder/GtAsyncSearchNullGroupStream.class.st b/src/GToolkit-SearchFilters/GtAsyncSearchNullGroupStream.class.st similarity index 91% rename from src/GToolkit-Coder/GtAsyncSearchNullGroupStream.class.st rename to src/GToolkit-SearchFilters/GtAsyncSearchNullGroupStream.class.st index 07346bdb2..fa0c8a051 100644 --- a/src/GToolkit-Coder/GtAsyncSearchNullGroupStream.class.st +++ b/src/GToolkit-SearchFilters/GtAsyncSearchNullGroupStream.class.st @@ -1,7 +1,7 @@ Class { #name : #GtAsyncSearchNullGroupStream, #superclass : #GtAsyncSearchGroupStream, - #category : #'GToolkit-Coder-Filters - Streams' + #category : #'GToolkit-SearchFilters-Results' } { #category : #'as yet unclassified' } diff --git a/src/GToolkit-Coder/GtAsyncSearchTypedGroupStream.class.st b/src/GToolkit-SearchFilters/GtAsyncSearchTypedGroupStream.class.st similarity index 94% rename from src/GToolkit-Coder/GtAsyncSearchTypedGroupStream.class.st rename to src/GToolkit-SearchFilters/GtAsyncSearchTypedGroupStream.class.st index 9f61e02cc..1ba4bbfe2 100644 --- a/src/GToolkit-Coder/GtAsyncSearchTypedGroupStream.class.st +++ b/src/GToolkit-SearchFilters/GtAsyncSearchTypedGroupStream.class.st @@ -4,7 +4,7 @@ Class { #instVars : [ 'announcer' ], - #category : 'GToolkit-Coder-Filters - Streams' + #category : #'GToolkit-SearchFilters-Results' } { #category : #'as yet unclassified' } diff --git a/src/GToolkit-Coder/GtFilterExampleAllState.class.st b/src/GToolkit-SearchFilters/GtFilterExampleAllState.class.st similarity index 92% rename from src/GToolkit-Coder/GtFilterExampleAllState.class.st rename to src/GToolkit-SearchFilters/GtFilterExampleAllState.class.st index d54af83ee..d561f4b7d 100644 --- a/src/GToolkit-Coder/GtFilterExampleAllState.class.st +++ b/src/GToolkit-SearchFilters/GtFilterExampleAllState.class.st @@ -1,7 +1,7 @@ Class { #name : #GtFilterExampleAllState, #superclass : #GtFilterExampleState, - #category : 'GToolkit-Coder-Filters - Support' + #category : #'GToolkit-SearchFilters-Support' } { #category : #'api - testing' } diff --git a/src/GToolkit-Coder/GtFilterExampleErrorState.class.st b/src/GToolkit-SearchFilters/GtFilterExampleErrorState.class.st similarity index 95% rename from src/GToolkit-Coder/GtFilterExampleErrorState.class.st rename to src/GToolkit-SearchFilters/GtFilterExampleErrorState.class.st index 465a1de51..63d437e8c 100644 --- a/src/GToolkit-Coder/GtFilterExampleErrorState.class.st +++ b/src/GToolkit-SearchFilters/GtFilterExampleErrorState.class.st @@ -1,7 +1,7 @@ Class { #name : #GtFilterExampleErrorState, #superclass : #GtFilterExampleState, - #category : 'GToolkit-Coder-Filters - Support' + #category : #'GToolkit-SearchFilters-Support' } { #category : #'api - accessing' } diff --git a/src/GToolkit-Coder/GtFilterExampleFailureState.class.st b/src/GToolkit-SearchFilters/GtFilterExampleFailureState.class.st similarity index 95% rename from src/GToolkit-Coder/GtFilterExampleFailureState.class.st rename to src/GToolkit-SearchFilters/GtFilterExampleFailureState.class.st index ecf961d98..ad34b3baf 100644 --- a/src/GToolkit-Coder/GtFilterExampleFailureState.class.st +++ b/src/GToolkit-SearchFilters/GtFilterExampleFailureState.class.st @@ -1,7 +1,7 @@ Class { #name : #GtFilterExampleFailureState, #superclass : #GtFilterExampleState, - #category : 'GToolkit-Coder-Filters - Support' + #category : #'GToolkit-SearchFilters-Support' } { #category : #'api - accessing' } diff --git a/src/GToolkit-Coder/GtFilterExampleNotExecutedState.class.st b/src/GToolkit-SearchFilters/GtFilterExampleNotExecutedState.class.st similarity index 94% rename from src/GToolkit-Coder/GtFilterExampleNotExecutedState.class.st rename to src/GToolkit-SearchFilters/GtFilterExampleNotExecutedState.class.st index 9ddae9d13..82d53ceb3 100644 --- a/src/GToolkit-Coder/GtFilterExampleNotExecutedState.class.st +++ b/src/GToolkit-SearchFilters/GtFilterExampleNotExecutedState.class.st @@ -1,7 +1,7 @@ Class { #name : #GtFilterExampleNotExecutedState, #superclass : #GtFilterExampleState, - #category : 'GToolkit-Coder-Filters - Support' + #category : #'GToolkit-SearchFilters-Support' } { #category : #'api - accessing' } diff --git a/src/GToolkit-Coder/GtFilterExampleState.class.st b/src/GToolkit-SearchFilters/GtFilterExampleState.class.st similarity index 94% rename from src/GToolkit-Coder/GtFilterExampleState.class.st rename to src/GToolkit-SearchFilters/GtFilterExampleState.class.st index e4e693b4e..aca0a2c58 100644 --- a/src/GToolkit-Coder/GtFilterExampleState.class.st +++ b/src/GToolkit-SearchFilters/GtFilterExampleState.class.st @@ -1,9 +1,9 @@ Class { #name : #GtFilterExampleState, #superclass : #Object, - #traits : 'TBlDebug + TGtUniqueInstance', - #classTraits : 'TBlDebug classTrait + TGtUniqueInstance classTrait', - #category : 'GToolkit-Coder-Filters - Support' + #traits : 'TGtUniqueInstance', + #classTraits : 'TGtUniqueInstance classTrait', + #category : #'GToolkit-SearchFilters-Support' } { #category : #'api - accessing' } diff --git a/src/GToolkit-Coder/GtFilterExampleSuccessState.class.st b/src/GToolkit-SearchFilters/GtFilterExampleSuccessState.class.st similarity index 95% rename from src/GToolkit-Coder/GtFilterExampleSuccessState.class.st rename to src/GToolkit-SearchFilters/GtFilterExampleSuccessState.class.st index 7419e28df..ef842c9d9 100644 --- a/src/GToolkit-Coder/GtFilterExampleSuccessState.class.st +++ b/src/GToolkit-SearchFilters/GtFilterExampleSuccessState.class.st @@ -1,7 +1,7 @@ Class { #name : #GtFilterExampleSuccessState, #superclass : #GtFilterExampleState, - #category : 'GToolkit-Coder-Filters - Support' + #category : #'GToolkit-SearchFilters-Support' } { #category : #'api - accessing' } diff --git a/src/GToolkit-SearchFilters/GtSearchBinaryFilter.class.st b/src/GToolkit-SearchFilters/GtSearchBinaryFilter.class.st new file mode 100644 index 000000000..ec0e1bef6 --- /dev/null +++ b/src/GToolkit-SearchFilters/GtSearchBinaryFilter.class.st @@ -0,0 +1,37 @@ +Class { + #name : #GtSearchBinaryFilter, + #superclass : #GtSearchFilter, + #instVars : [ + 'left', + 'right' + ], + #category : #'GToolkit-SearchFilters-Filters' +} + +{ #category : #'instance creation' } +GtSearchBinaryFilter class >> forFilter: leftFilter filter: rightFilter [ + ^ self new + filter: leftFilter filter: rightFilter; + yourself +] + +{ #category : #'initialize-release' } +GtSearchBinaryFilter >> filter: leftFilter filter: rightFilter [ + left := leftFilter. + right := rightFilter +] + +{ #category : #accessing } +GtSearchBinaryFilter >> leftFilter [ + ^ left +] + +{ #category : #accessing } +GtSearchBinaryFilter >> resultType [ + ^ left resultType mergeTypeWith: right resultType +] + +{ #category : #accessing } +GtSearchBinaryFilter >> rightFilter [ + ^ right +] diff --git a/src/GToolkit-Coder/GtSearchBlockFilter.class.st b/src/GToolkit-SearchFilters/GtSearchBlockFilter.class.st similarity index 91% rename from src/GToolkit-Coder/GtSearchBlockFilter.class.st rename to src/GToolkit-SearchFilters/GtSearchBlockFilter.class.st index e4d93fb39..7e622c9d4 100644 --- a/src/GToolkit-Coder/GtSearchBlockFilter.class.st +++ b/src/GToolkit-SearchFilters/GtSearchBlockFilter.class.st @@ -4,7 +4,7 @@ Class { #instVars : [ 'block' ], - #category : 'GToolkit-Coder-Filters' + #category : #'GToolkit-SearchFilters-Filters' } { #category : #'instance creation' } diff --git a/src/GToolkit-SearchFilters/GtSearchFilter.class.st b/src/GToolkit-SearchFilters/GtSearchFilter.class.st new file mode 100644 index 000000000..01d0d160d --- /dev/null +++ b/src/GToolkit-SearchFilters/GtSearchFilter.class.st @@ -0,0 +1,86 @@ +Class { + #name : #GtSearchFilter, + #superclass : #Object, + #category : #'GToolkit-SearchFilters-Filters' +} + +{ #category : #'logical operations' } +GtSearchFilter >> & aFilter [ + ^ GtSearchIntersectionFilter forFilter: self filter: aFilter +] + +{ #category : #evaluating } +GtSearchFilter >> applyInScope: aStream [ + ^ self resultType new + forFilter: self + scope: aStream +] + +{ #category : #converting } +GtSearchFilter >> asAsyncStream [ + ^ self result +] + +{ #category : #accessing } +GtSearchFilter >> defaultFilterScope [ + ^ AsyncEmptyStream new +] + +{ #category : #iterating } +GtSearchFilter >> do: aBlock [ + ((self result do: aBlock) + inject: 0 into: [ :total :each | total + 1 ]) + wait +] + +{ #category : #testing } +GtSearchFilter >> isEmpty [ + ^ self notEmpty not +] + +{ #category : #testing } +GtSearchFilter >> matches: anObject [ + self subclassResponsibility +] + +{ #category : #'logical operations' } +GtSearchFilter >> not [ + ^ GtSearchNegationFilter new originalFilter: self +] + +{ #category : #testing } +GtSearchFilter >> notEmpty [ + ^ self result hasNext wait +] + +{ #category : #converting } +GtSearchFilter >> result [ + ^ self applyInScope: self defaultFilterScope +] + +{ #category : #accessing } +GtSearchFilter >> resultType [ + ^ GtAsyncSearchNullGroupStream +] + +{ #category : #'logical operations' } +GtSearchFilter >> select: aBlock [ + ^ self & (GtSearchBlockFilter forBlock: aBlock) +] + +{ #category : #accessing } +GtSearchFilter >> size [ + ^ (self result inject: 0 into: [ :counter :eachItem | counter + 1 ]) wait +] + +{ #category : #testing } +GtSearchFilter >> value: anObject [ + "To be polymorphic with block closures" + + ^ self matches: anObject +] + +{ #category : #'logical operations' } +GtSearchFilter >> | aFilter [ + ^ GtSearchUnionFilter forFilter: self filter: aFilter +] diff --git a/src/GToolkit-Coder/GtSearchGroupResult.class.st b/src/GToolkit-SearchFilters/GtSearchGroupResult.class.st similarity index 98% rename from src/GToolkit-Coder/GtSearchGroupResult.class.st rename to src/GToolkit-SearchFilters/GtSearchGroupResult.class.st index 8f6a6f92a..326f1c29c 100644 --- a/src/GToolkit-Coder/GtSearchGroupResult.class.st +++ b/src/GToolkit-SearchFilters/GtSearchGroupResult.class.st @@ -7,7 +7,7 @@ Class { 'filtered', 'scope' ], - #category : #'GToolkit-Coder-Filters' + #category : #'GToolkit-SearchFilters-Results' } { #category : #'as yet unclassified' } diff --git a/src/GToolkit-Coder/GtSearchIntersectionFilter.class.st b/src/GToolkit-SearchFilters/GtSearchIntersectionFilter.class.st similarity index 93% rename from src/GToolkit-Coder/GtSearchIntersectionFilter.class.st rename to src/GToolkit-SearchFilters/GtSearchIntersectionFilter.class.st index 38dc9af3f..61b4cd672 100644 --- a/src/GToolkit-Coder/GtSearchIntersectionFilter.class.st +++ b/src/GToolkit-SearchFilters/GtSearchIntersectionFilter.class.st @@ -1,7 +1,7 @@ Class { #name : #GtSearchIntersectionFilter, #superclass : #GtSearchBinaryFilter, - #category : 'GToolkit-Coder-Filters' + #category : #'GToolkit-SearchFilters-Filters' } { #category : #accessing } diff --git a/src/GToolkit-Coder/GtSearchNegationFilter.class.st b/src/GToolkit-SearchFilters/GtSearchNegationFilter.class.st similarity index 95% rename from src/GToolkit-Coder/GtSearchNegationFilter.class.st rename to src/GToolkit-SearchFilters/GtSearchNegationFilter.class.st index 379ea350b..63fea9182 100644 --- a/src/GToolkit-Coder/GtSearchNegationFilter.class.st +++ b/src/GToolkit-SearchFilters/GtSearchNegationFilter.class.st @@ -4,7 +4,7 @@ Class { #instVars : [ 'originalFilter' ], - #category : 'GToolkit-Coder-Filters' + #category : #'GToolkit-SearchFilters-Filters' } { #category : #accessing } diff --git a/src/GToolkit-Coder/GtSearchNullFilter.class.st b/src/GToolkit-SearchFilters/GtSearchNullFilter.class.st similarity index 91% rename from src/GToolkit-Coder/GtSearchNullFilter.class.st rename to src/GToolkit-SearchFilters/GtSearchNullFilter.class.st index 72a15a353..72113ccce 100644 --- a/src/GToolkit-Coder/GtSearchNullFilter.class.st +++ b/src/GToolkit-SearchFilters/GtSearchNullFilter.class.st @@ -1,7 +1,7 @@ Class { #name : #GtSearchNullFilter, #superclass : #GtSearchFilter, - #category : #'GToolkit-Coder-Filters' + #category : #'GToolkit-SearchFilters-Filters' } { #category : #comparing } diff --git a/src/GToolkit-Coder/GtSearchTypedEntitiesFilter.class.st b/src/GToolkit-SearchFilters/GtSearchTypedEntitiesFilter.class.st similarity index 86% rename from src/GToolkit-Coder/GtSearchTypedEntitiesFilter.class.st rename to src/GToolkit-SearchFilters/GtSearchTypedEntitiesFilter.class.st index 29e1b8345..b9e802d42 100644 --- a/src/GToolkit-Coder/GtSearchTypedEntitiesFilter.class.st +++ b/src/GToolkit-SearchFilters/GtSearchTypedEntitiesFilter.class.st @@ -1,7 +1,7 @@ Class { #name : #GtSearchTypedEntitiesFilter, #superclass : #GtSearchFilter, - #category : #'GToolkit-Coder-Filters' + #category : #'GToolkit-SearchFilters-Filters' } { #category : #accessing } diff --git a/src/GToolkit-Coder/GtSearchTypedGroupResult.class.st b/src/GToolkit-SearchFilters/GtSearchTypedGroupResult.class.st similarity index 94% rename from src/GToolkit-Coder/GtSearchTypedGroupResult.class.st rename to src/GToolkit-SearchFilters/GtSearchTypedGroupResult.class.st index 4b339f15a..5aebdf9fd 100644 --- a/src/GToolkit-Coder/GtSearchTypedGroupResult.class.st +++ b/src/GToolkit-SearchFilters/GtSearchTypedGroupResult.class.st @@ -4,7 +4,7 @@ Class { #instVars : [ 'announcer' ], - #category : 'GToolkit-Coder-Filters' + #category : #'GToolkit-SearchFilters-Results' } { #category : #'as yet unclassified' } diff --git a/src/GToolkit-Coder/GtSearchUnionFilter.class.st b/src/GToolkit-SearchFilters/GtSearchUnionFilter.class.st similarity index 95% rename from src/GToolkit-Coder/GtSearchUnionFilter.class.st rename to src/GToolkit-SearchFilters/GtSearchUnionFilter.class.st index 96ab09333..f96d1458a 100644 --- a/src/GToolkit-Coder/GtSearchUnionFilter.class.st +++ b/src/GToolkit-SearchFilters/GtSearchUnionFilter.class.st @@ -1,7 +1,7 @@ Class { #name : #GtSearchUnionFilter, #superclass : #GtSearchBinaryFilter, - #category : #'GToolkit-Coder-Filters' + #category : #'GToolkit-SearchFilters-Filters' } { #category : #accessing } diff --git a/src/GToolkit-SearchFilters/package.st b/src/GToolkit-SearchFilters/package.st new file mode 100644 index 000000000..7323e7880 --- /dev/null +++ b/src/GToolkit-SearchFilters/package.st @@ -0,0 +1 @@ +Package { #name : #'GToolkit-SearchFilters' } From 2ac79b94595520845f98e92f6b0fc6d4cae7de8a Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Sat, 13 Nov 2021 22:26:32 +0100 Subject: [PATCH 0080/1268] fix repository --- .../GtSearchBinaryFilter.class.st | 20 ---------------- src/GToolkit-Coder/GtSearchFilter.class.st | 23 ------------------- 2 files changed, 43 deletions(-) delete mode 100644 src/GToolkit-Coder/GtSearchBinaryFilter.class.st delete mode 100644 src/GToolkit-Coder/GtSearchFilter.class.st diff --git a/src/GToolkit-Coder/GtSearchBinaryFilter.class.st b/src/GToolkit-Coder/GtSearchBinaryFilter.class.st deleted file mode 100644 index a294d1c68..000000000 --- a/src/GToolkit-Coder/GtSearchBinaryFilter.class.st +++ /dev/null @@ -1,20 +0,0 @@ -Class { - #name : #GtSearchBinaryFilter, - #superclass : #GtSearchFilter, - #instVars : [ - 'left', - 'right' - ], - #category : 'GToolkit-Coder-Filters' -} - -{ #category : #'*GToolkit-Coder' } -GtSearchBinaryFilter >> highlighter [ - ^ left highlighter - ifNil: [ right highlighter ] - ifNotNil: [ :lh | - right highlighter - ifNil: [ lh ] - ifNotNil: - [ :rh | GtCompositeHighlighter forHighlighters: (Array with: lh with: rh) ] ] -] diff --git a/src/GToolkit-Coder/GtSearchFilter.class.st b/src/GToolkit-Coder/GtSearchFilter.class.st deleted file mode 100644 index 0b0e26b29..000000000 --- a/src/GToolkit-Coder/GtSearchFilter.class.st +++ /dev/null @@ -1,23 +0,0 @@ -Class { - #name : #GtSearchFilter, - #superclass : #Object, - #category : #'GToolkit-Coder-Filters' -} - -{ #category : #'*GToolkit-Coder' } -GtSearchFilter >> asCoder [ - ^ self result asCoder -] - -{ #category : #'*GToolkit-Coder' } -GtSearchFilter >> gtExamples [ - | examples | - examples := OrderedCollection new. - self result do: [ :each | examples addAll: each gtExamples ]. - ^ GtExampleGroup withAll: examples -] - -{ #category : #'*GToolkit-Coder' } -GtSearchFilter >> highlighter [ - ^ nil -] From 32fdc008d64dbc7f7efa24aab8bd47e267da1a47 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Sun, 14 Nov 2021 11:39:34 +0100 Subject: [PATCH 0081/1268] [feenkcom/gtoolkit#2207] remove obsolete GtSearchGroupResult --- .../GtSearchGroupResult.class.st | 163 ------------------ .../GtSearchTypedGroupResult.class.st | 36 ---- 2 files changed, 199 deletions(-) delete mode 100644 src/GToolkit-SearchFilters/GtSearchGroupResult.class.st delete mode 100644 src/GToolkit-SearchFilters/GtSearchTypedGroupResult.class.st diff --git a/src/GToolkit-SearchFilters/GtSearchGroupResult.class.st b/src/GToolkit-SearchFilters/GtSearchGroupResult.class.st deleted file mode 100644 index 326f1c29c..000000000 --- a/src/GToolkit-SearchFilters/GtSearchGroupResult.class.st +++ /dev/null @@ -1,163 +0,0 @@ -Class { - #name : #GtSearchGroupResult, - #superclass : #Object, - #instVars : [ - 'items', - 'filter', - 'filtered', - 'scope' - ], - #category : #'GToolkit-SearchFilters-Results' -} - -{ #category : #'as yet unclassified' } -GtSearchGroupResult class >> mergeTypeWith: aGroupResultClass [ - ^ aGroupResultClass mergeTypeWithDefaultGroup -] - -{ #category : #'as yet unclassified' } -GtSearchGroupResult class >> mergeTypeWithDefaultGroup [ - "The common type between the default group and any other group is the other group." - ^ self -] - -{ #category : #'as yet unclassified' } -GtSearchGroupResult class >> mergeTypeWithGenericGroup [ - "The common type between a generic group and any other group is the other group." - ^ self -] - -{ #category : #'as yet unclassified' } -GtSearchGroupResult class >> mergeTypeWithTypedGroup: aGroupType [ - ^ self -] - -{ #category : #adding } -GtSearchGroupResult >> add: anObject [ - self refreshItems. - ^ items add: anObject -] - -{ #category : #enumerating } -GtSearchGroupResult >> collect: aBlock [ - self refreshItems. - ^ items collect: aBlock -] - -{ #category : #enumerating } -GtSearchGroupResult >> do: aBlock [ - self refreshItems. - ^ items do: aBlock -] - -{ #category : #accessing } -GtSearchGroupResult >> filter [ - ^ filter -] - -{ #category : #accessing } -GtSearchGroupResult >> filter: methodsFilter [ - filtered := false. - items := OrderedCollection new. - filter := methodsFilter -] - -{ #category : #enumerating } -GtSearchGroupResult >> groupedBy: aBlockClosureOrSymbol [ - "Group the filteres items using the given block. The returned groups are just a copy based on - the current items at the time of the call. They are not updated if the filtered items change." - self refreshItems. - ^ items groupedBy: aBlockClosureOrSymbol -] - -{ #category : #ui } -GtSearchGroupResult >> gtItemsFor: aView [ - - self refreshItems. - ^ aView list - title: 'Items' translated; - priority: 10; - items: [ items ifNil: [ #() ] ] -] - -{ #category : #accessing } -GtSearchGroupResult >> highlighter [ - ^ filter notNil - ifTrue: [ filter highlighter ] - ifFalse: [ nil ] -] - -{ #category : #'as yet unclassified' } -GtSearchGroupResult >> includes: aCollection [ - self refreshItems. - ^ items includes: aCollection -] - -{ #category : #initialization } -GtSearchGroupResult >> initialize [ - super initialize. - filtered := false. - items := OrderedCollection new. -] - -{ #category : #testing } -GtSearchGroupResult >> isEmpty [ - "Answer whether the receiver contains any elements." - ^ self size = 0 -] - -{ #category : #enumerating } -GtSearchGroupResult >> refreshItems [ - | filteredItems | - filtered - ifTrue: [ ^ self ]. - filteredItems := OrderedCollection new. - filter ifNotNil: [ - scope itemsDo: [ :anObject | - (filter matches: anObject) ifTrue: [ - filteredItems add: anObject ] ] ]. - items := filteredItems. - filtered := true. -] - -{ #category : #removing } -GtSearchGroupResult >> remove: anItem ifAbsent: aBlock [ - self refreshItems. - ^ items remove: anItem ifAbsent: aBlock -] - -{ #category : #accessing } -GtSearchGroupResult >> scope [ - ^ scope -] - -{ #category : #accessing } -GtSearchGroupResult >> scope: aSearchScope [ - scope := aSearchScope -] - -{ #category : #accessing } -GtSearchGroupResult >> size [ - self refreshItems. - ^ items size -] - -{ #category : #private } -GtSearchGroupResult >> species [ - self refreshItems. - ^ items class -] - -{ #category : #enumerating } -GtSearchGroupResult >> sumNumbers: aBlock [ - self refreshItems. - ^ items sumNumbers: aBlock -] - -{ #category : #initialization } -GtSearchGroupResult >> updateForFilter: aFilter [ - self filter: aFilter. - self scope: (aFilter - ifNil: [ AsyncEmptyStream new ] - ifNotNil: [ aFilter defaultFilterScope ]) -] diff --git a/src/GToolkit-SearchFilters/GtSearchTypedGroupResult.class.st b/src/GToolkit-SearchFilters/GtSearchTypedGroupResult.class.st deleted file mode 100644 index 5aebdf9fd..000000000 --- a/src/GToolkit-SearchFilters/GtSearchTypedGroupResult.class.st +++ /dev/null @@ -1,36 +0,0 @@ -Class { - #name : #GtSearchTypedGroupResult, - #superclass : #GtSearchGroupResult, - #instVars : [ - 'announcer' - ], - #category : #'GToolkit-SearchFilters-Results' -} - -{ #category : #'as yet unclassified' } -GtSearchTypedGroupResult class >> mergeTypeWith: aGroupResultClass [ - ^ aGroupResultClass mergeTypeWithTypedGroup: self. -] - -{ #category : #'as yet unclassified' } -GtSearchTypedGroupResult class >> mergeTypeWithTypedGroup: aGroupType [ - ^ aGroupType = self - ifTrue: [ self ] - ifFalse: [ GtSearchGroupResult ] -] - -{ #category : #accessing } -GtSearchTypedGroupResult >> announcer [ - ^ announcer -] - -{ #category : #initialization } -GtSearchTypedGroupResult >> initialize [ - super initialize. - announcer := Announcer new. - self subscribe -] - -{ #category : #subscription } -GtSearchTypedGroupResult >> subscribe [ -] From 1f2e81f037e3e491635b0aaf83393b45aa0614fd Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Sun, 14 Nov 2021 16:06:44 +0100 Subject: [PATCH 0082/1268] [feenkcom/gtoolkit#2207] removing source coder aptitudes --- .../GtExpandableSourceCoderElement.class.st | 129 ++++++++-------- .../GtExpandedOnlyCoderElement.class.st | 19 +-- ...ourceCoderCollapsedAddOnsAptitude.class.st | 52 ------- ...ourceCoderCollapsedContentElement.class.st | 67 ++++++++- ...erCollapsedTextAndExampleAptitude.class.st | 141 ------------------ ...tSourceCoderCollapsedTextAptitude.class.st | 54 ------- .../GtSourceCoderContentElement.class.st | 27 +++- .../GtSourceCoderEditorAptitude.class.st | 50 ------- ...SourceCoderExpandedContentElement.class.st | 40 ++++- .../GtTextualCoderViewModel.class.st | 4 + src/GToolkit-Coder/GtCoderModel.class.st | 5 - .../GtCoderRequestFocus.class.st | 5 - 12 files changed, 194 insertions(+), 399 deletions(-) delete mode 100644 src/GToolkit-Coder-UI/GtSourceCoderCollapsedAddOnsAptitude.class.st delete mode 100644 src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAndExampleAptitude.class.st delete mode 100644 src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAptitude.class.st delete mode 100644 src/GToolkit-Coder-UI/GtSourceCoderEditorAptitude.class.st delete mode 100644 src/GToolkit-Coder/GtCoderRequestFocus.class.st diff --git a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st index 6f2447049..7dd7cf369 100644 --- a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st @@ -1,10 +1,11 @@ Class { #name : #GtExpandableSourceCoderElement, #superclass : #BrExpander, + #traits : 'TGtWithTextualCoderViewModel', + #classTraits : 'TGtWithTextualCoderViewModel classTrait', #instVars : [ 'collapsedElement', - 'expandedElement', - 'coderUIModel' + 'expandedElement' ], #category : #'GToolkit-Coder-UI-Coder - Source' } @@ -21,76 +22,35 @@ GtExpandableSourceCoderElement >> asVerticallyResizableDo: aBlock [ ] { #category : #private } -GtExpandableSourceCoderElement >> assignCollapsedCoder: aSourceCoder to: aCollapsedElement [ - aCollapsedElement coderUIModel: aSourceCoder. +GtExpandableSourceCoderElement >> assignCollapsedCoder: aTextualCoderViewModel to: aCollapsedElement [ + aCollapsedElement textualCoderViewModel: aTextualCoderViewModel. "Initialize look just once" aCollapsedElement aptitude ifNil: [ - self addCodersCoderLook: aSourceCoder to: aCollapsedElement. - aCollapsedElement addAptitude: GtSourceCoderCollapsedAddOnsAptitude ] + self addCodersCoderLook: aTextualCoderViewModel to: aCollapsedElement. + "aCollapsedElement addAptitude: GtSourceCoderCollapsedAddOnsAptitude" ] ] { #category : #private } -GtExpandableSourceCoderElement >> assignExpandedCoder: aSourceCoder to: anExpandedElement [ - anExpandedElement coderUIModel: aSourceCoder. +GtExpandableSourceCoderElement >> assignExpandedCoder: aTextualCoderViewModel to: anExpandedElement [ + anExpandedElement textualCoderViewModel: aTextualCoderViewModel. "Initialize look just once" anExpandedElement aptitude ifNil: [ - self addCodersCoderLook: aSourceCoder to: anExpandedElement. - anExpandedElement addAptitude: GtSourceCoderEditorAptitude ] + self addCodersCoderLook: aTextualCoderViewModel to: anExpandedElement ] ] { #category : #accessing } GtExpandableSourceCoderElement >> coderUIModel [ - - self - assert: [ coderUIModel isNotNil ] - description: [ 'Coder is not set!' ]. - - ^ coderUIModel + + ^ self textualCoderViewModel ] { #category : #accessing } GtExpandableSourceCoderElement >> coderUIModel: aCoderUIModel [ - self - assert: [ aCoderUIModel isNotNil ] - description: [ 'Coder must not be nil' ]. - - coderUIModel == aCoderUIModel - ifTrue: [ ^ self ]. - - coderUIModel - ifNotNil: [ :aPreviousCoder | - aPreviousCoder unsubscribe: self. - aPreviousCoder coderModel unsubscribe: self ]. - - coderUIModel := aCoderUIModel. - - coderUIModel expanded - ifTrue: [ expandedElement - ifNotNil: [ :anElement | self assignExpandedCoder: aCoderUIModel to: anElement ]. - collapsedElement - ifNotNil: [ :anElement | self markDirty: anElement as: true ] ] - ifFalse: [ collapsedElement - ifNotNil: - [ :anElement | self assignCollapsedCoder: aCoderUIModel to: anElement ]. - expandedElement - ifNotNil: [ :anElement | self markDirty: anElement as: true ] ]. - - coderUIModel focused - ifFalse: [ self loseFocus ]. - - self expanded: coderUIModel expanded. - - coderUIModel coder subscribeToSystem. - coderUIModel coder announcer weak - when: GtCoderRequestFocus send: #requestFocusAsyncronously to: self; - when: GtCoderMethodRemoved send: #onMethodRemoved: to: self. - - coderUIModel weak - when: GtTextualCoderViewModelExpansionChanged send: #onViewModelExpansionChanged: to: self + self textualCoderViewModel: aCoderUIModel ] { #category : #accessing } @@ -101,7 +61,7 @@ GtExpandableSourceCoderElement >> gtAllShortcutsFor: aView [ ^ aView columnedList title: 'All shortcuts' translated; priority: 10; - items: [ self shortcuts , coderUIModel addOns shortcuts ]; + items: [ self shortcuts , textualCoderViewModel addOns wait shortcuts ]; column: 'Key' text: [ :each | each combination gtDisplayString ]; column: 'Action' text: [ :each | each action asString ] ] @@ -144,7 +104,7 @@ GtExpandableSourceCoderElement >> newCollapsedElement [ | aCollapsedElement | aCollapsedElement := GtSourceCoderCollapsedContentElement new. - coderUIModel + textualCoderViewModel ifNotNil: [ :aCoder | self assignCollapsedCoder: aCoder to: aCollapsedElement ]. ^ aCollapsedElement @@ -155,7 +115,7 @@ GtExpandableSourceCoderElement >> newExpandedElement [ | anExpandedElement | anExpandedElement := GtSourceCoderExpandedContentElement new. - coderUIModel + textualCoderViewModel ifNotNil: [ :aCoder | self assignExpandedCoder: aCoder to: anExpandedElement ]. ^ anExpandedElement @@ -165,7 +125,7 @@ GtExpandableSourceCoderElement >> newExpandedElement [ GtExpandableSourceCoderElement >> onCollapsed [ self beInSingleCompositionLayer. - coderUIModel ifNotNil: [ :aCoderUIModel | + textualCoderViewModel ifNotNil: [ :aCoderUIModel | aCoderUIModel expanded: false. (collapsedElement notNil and: [ self isDirty: collapsedElement ]) ifTrue: [ self assignCollapsedCoder: aCoderUIModel to: collapsedElement ] ] @@ -175,14 +135,35 @@ GtExpandableSourceCoderElement >> onCollapsed [ GtExpandableSourceCoderElement >> onExpanded [ self beInSeparateCompositionLayer. - coderUIModel ifNotNil: [ :aCoderUIModel | + textualCoderViewModel ifNotNil: [ :aCoderUIModel | aCoderUIModel expanded: true. (expandedElement notNil and: [ self isDirty: expandedElement ]) ifTrue: [ self assignExpandedCoder: aCoderUIModel to: expandedElement ] ] ] -{ #category : #events } -GtExpandableSourceCoderElement >> onMethodRemoved: anAnnouncement [ +{ #category : #'api - textual coder view model' } +GtExpandableSourceCoderElement >> onTextualCoderViewModelChanged [ + "Is sent when a new textualCoder view model is assigned to the element. + Note: #onTextualCoderViewModelChanged is sent before #subscribeToTextualCoderViewModel + which means that if you perform any operation that triggers an announcement it will be ignored because the receiver + didn't get a chance to subscribe to any announcement. Override #onPostTextualCoderViewModelChanged if you + wish to perform an operation that requires an announcement, but keep in mind that this is not the most efficient way" + + textualCoderViewModel expanded + ifTrue: [ expandedElement + ifNotNil: [ :anElement | self assignExpandedCoder: textualCoderViewModel to: anElement ]. + collapsedElement + ifNotNil: [ :anElement | self markDirty: anElement as: true ] ] + ifFalse: [ collapsedElement + ifNotNil: + [ :anElement | self assignCollapsedCoder: textualCoderViewModel to: anElement ]. + expandedElement + ifNotNil: [ :anElement | self markDirty: anElement as: true ] ]. + + textualCoderViewModel focused + ifFalse: [ self loseFocus ]. + + self expanded: textualCoderViewModel expanded. ] { #category : #'private - event handling' } @@ -195,13 +176,27 @@ GtExpandableSourceCoderElement >> requestFocus [ self childNamed: #editor ifFound: [ :anEditorElement | anEditorElement requestFocus ] - ifNone: [ super requestFocus ] + ifNone: [ super requestFocus ] ] -{ #category : #'focus requesting' } -GtExpandableSourceCoderElement >> requestFocusAsyncronously [ - ^ self - enqueueTask: - (BlTaskAction new - action: [ self requestFocus ]) +{ #category : #'api - textual coder view model' } +GtExpandableSourceCoderElement >> subscribeToTextualCoderViewModel [ + "Is sent after a new textualCoder view model is assigned to the element. + It is required to unsubscribe from the view model or domain model by implementing + #unsubscribeFromTextualCoderViewModel if elements subscribe to them" + + "textualCoderViewModel coder subscribeToSystem." + textualCoderViewModel weak + when: GtTextualCoderViewModelExpansionChanged + send: #onViewModelExpansionChanged: + to: self +] + +{ #category : #'api - textual coder view model' } +GtExpandableSourceCoderElement >> unsubscribeFromTextualCoderViewModel [ + "Is sent before a new textualCoder view model is assigned to the element. + Elements that subscribe to textualCoder view model in domain model are required to implement this methods." + + "textualCoderViewModel coder unsubscribeFromSystem." + textualCoderViewModel unsubscribe: self ] diff --git a/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st b/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st index 2c647a1ef..05327d8da 100644 --- a/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st @@ -5,7 +5,7 @@ Class { 'coderUIModel', 'expandedElement' ], - #category : 'GToolkit-Coder-UI-Coder - Source' + #category : #'GToolkit-Coder-UI-Coder - Source' } { #category : #adding } @@ -52,11 +52,7 @@ GtExpandedOnlyCoderElement >> coderUIModel: aCoderUIModel [ expandedElement := self newExpandedElement: aCoderUIModel. self addChild: expandedElement. self addAptitude: (BrLayoutResizerAptitude new inherit: expandedElement). - aCoderUIModel expanded: true. - aCoderUIModel coder announcer weak - when: GtCoderRequestFocus - send: #requestFocusAsyncronously - to: self + aCoderUIModel expanded: true ] { #category : #initialization } @@ -72,9 +68,8 @@ GtExpandedOnlyCoderElement >> initialize [ { #category : #'instance creation' } GtExpandedOnlyCoderElement >> newExpandedElement: aCoderModel [ ^ GtSourceCoderExpandedContentElement new - coderUIModel: aCoderModel; + textualCoderViewModel: aCoderModel; in: [ :anElement | self addCodersCoderLook: aCoderModel to: anElement ]; - addAptitude: GtSourceCoderEditorAptitude; yourself ] @@ -85,11 +80,3 @@ GtExpandedOnlyCoderElement >> requestFocus [ ifFound: [ :anEditorElement | anEditorElement requestFocus ] ifNone: [ super requestFocus ] ] - -{ #category : #'focus requesting' } -GtExpandedOnlyCoderElement >> requestFocusAsyncronously [ - ^ self - enqueueTask: - (BlTaskAction new - action: [ self requestFocus ]) -] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedAddOnsAptitude.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedAddOnsAptitude.class.st deleted file mode 100644 index 8a6ad96c2..000000000 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedAddOnsAptitude.class.st +++ /dev/null @@ -1,52 +0,0 @@ -Class { - #name : #GtSourceCoderCollapsedAddOnsAptitude, - #superclass : #GtSourceCoderCollapsedTextAndExampleAptitude, - #instVars : [ - 'addOnsContainer' - ], - #category : #'GToolkit-Coder-UI-Coder - Source Look' -} - -{ #category : #accessing } -GtSourceCoderCollapsedAddOnsAptitude >> initialize [ - - super initialize. - - addOnsContainer := self newAddOnsContainer. - - container addChild: addOnsContainer. -] - -{ #category : #'instance creation' } -GtSourceCoderCollapsedAddOnsAptitude >> newAddOnsContainer [ - - ^ BrHorizontalPane new fitContent - margin: (BlInsets top: 4 left: 1 bottom: 1 right: 1) -] - -{ #category : #'private - hooks' } -GtSourceCoderCollapsedAddOnsAptitude >> onCoderChanged: aGtSourceCoderUIModel [ - super onCoderChanged: aGtSourceCoderUIModel. - self widget coderUIModel - ifNotNil: [ :aPreviousCoder | aPreviousCoder coder announcer unsubscribe: self ]. - self updateAddonsFor: aGtSourceCoderUIModel. -] - -{ #category : #'private - updating' } -GtSourceCoderCollapsedAddOnsAptitude >> updateAddon: anAddOn coderUIModel: aGtSourceCoderUIModel [ - | anElement | - anElement := anAddOn stencilBuilder - coderUIModel: aGtSourceCoderUIModel; - build. - anElement ifNil: [ ^ self ]. - addOnsContainer addChild: anElement asElement. -] - -{ #category : #'private - updating' } -GtSourceCoderCollapsedAddOnsAptitude >> updateAddonsFor: aGtSourceCoderUIModel [ - self sourceCoderUIModel addOns then: [ :theComputedAddOns | - addOnsContainer enqueueTask: (BlTaskAction new action: [ - addOnsContainer removeChildren. - theComputedAddOns previews do: [ :eachAddOn | - self updateAddon: eachAddOn coderUIModel: aGtSourceCoderUIModel ] ])] -] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st index cda0c0d36..1f4b6502b 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st @@ -1,5 +1,70 @@ Class { #name : #GtSourceCoderCollapsedContentElement, #superclass : #GtSourceCoderContentElement, - #category : 'GToolkit-Coder-UI-Coder - Source' + #instVars : [ + 'label', + 'addOns' + ], + #category : #'GToolkit-Coder-UI-Coder - Source' } + +{ #category : #initialization } +GtSourceCoderCollapsedContentElement >> defaultLayout [ + ^ BlLinearLayout horizontal +] + +{ #category : #initialization } +GtSourceCoderCollapsedContentElement >> initialize [ + super initialize. + + label := self newLabel. + addOns := self newAddOnsContainer. + + self addChildren: { label. addOns } +] + +{ #category : #'instance creation' } +GtSourceCoderCollapsedContentElement >> newAddOnsContainer [ + ^ BrFromPromise new + fitContent; + stencil: [ + BrHorizontalPane new + fitContent; + margin: (BlInsets top: 4 left: 1 bottom: 1 right: 1) ]; + dataBinder: [ :anAddOnsContainer :aData | + anAddOnsContainer removeChildren. + aData + ifSuccess: [ :theAddOns | + theAddOns previews do: [ :eachAddOn | + (eachAddOn stencilBuilder + coderUIModel: textualCoderViewModel; + build) ifNotNil: [ :eachAddOnStencil | + anAddOnsContainer addChild: eachAddOnStencil asElement ] ] ] + ifError: [ :anError | anAddOnsContainer addChild: (BrLabel new aptitude: BrGlamorousLabelAptitude; text: anError printString) ] + ifPending: [ ] ] +] + +{ #category : #'instance creation' } +GtSourceCoderCollapsedContentElement >> newLabel [ + ^ BrFromPromise new + fitContent; + stencil: [ + BlAttributedTextElement new + id: #label; + editorMeasurement; + bold; + glamorousCodeFont ]; + dataBinder: [ :aLabel :aData | + aData + ifSuccess: [ :aText | aLabel text: aText asRopedText ] + ifError: [ :anError | aLabel text: anError printString asRopedText ] + ifPending: [ aLabel text: '' asRopedText ] ] +] + +{ #category : #'api - textual coder view model' } +GtSourceCoderCollapsedContentElement >> onTextualCoderViewModelChanged [ + super onTextualCoderViewModelChanged. + + label promise: textualCoderViewModel coderModel collapsedTextPromise. + addOns promise: textualCoderViewModel addOns +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAndExampleAptitude.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAndExampleAptitude.class.st deleted file mode 100644 index cdf2a8843..000000000 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAndExampleAptitude.class.st +++ /dev/null @@ -1,141 +0,0 @@ -" -I am a {{gtClass:BrLook}}. -I am a {{gtClass:GtSourceCoderAptitude}}. -I attach two labels: -1. a {{gtMethod:GtSourceCoderCollapsedTextAndExampleAptitude>>#methodLabel|label=method name}}, and -2. example {{gtMethod:GtSourceCoderCollapsedTextAndExampleAptitude>>#exampleElement|label=execution state}}. -#Examples - -If a method is an example, I display the method name and example result: {{gtExample:GtCoderCollapsedContentElementExamples>>#textAndExampleLook_withExampleMethod|codeExpanded=false|previewExpanded=true|previewHeight=150}} -If a method is *not* an example, I omit displaying the example result: {{gtExample:GtCoderCollapsedContentElementExamples>>#textAndExampleLook_withRegularMethod|codeExpanded=false|previewExpanded=true|previewHeight=150}} - - -" -Class { - #name : #GtSourceCoderCollapsedTextAndExampleAptitude, - #superclass : #GtSourceCoderAptitude, - #instVars : [ - 'container', - 'methodLabel', - 'exampleElement' - ], - #category : #'GToolkit-Coder-UI-Coder - Source Look' -} - -{ #category : #'private - accessing' } -GtSourceCoderCollapsedTextAndExampleAptitude >> container [ - - ^ container -] - -{ #category : #'private - accessing' } -GtSourceCoderCollapsedTextAndExampleAptitude >> exampleElement [ - - ^ exampleElement -] - -{ #category : #'private - updating' } -GtSourceCoderCollapsedTextAndExampleAptitude >> hide [ - self exampleElement visibility: BlVisibility gone -] - -{ #category : #initialization } -GtSourceCoderCollapsedTextAndExampleAptitude >> initialize [ - super initialize. - self initializeMethodLabel. - self initializeExampleElement. - self initializeContainer. - - self container - addChild: self methodLabel as: GtSourceCoderCollapsedTextId; - addChild: self exampleElement as: #exampleElement. - - self addChangeAddChildAs: #(content label) with: [ self container ] -] - -{ #category : #initialization } -GtSourceCoderCollapsedTextAndExampleAptitude >> initializeContainer [ - container := BrHorizontalPane new - fitContent; - alignCenterLeft -] - -{ #category : #initialization } -GtSourceCoderCollapsedTextAndExampleAptitude >> initializeExampleElement [ - exampleElement := GtCoderExampleStateElement new - margin: (BlInsets top: 4 left: 1 bottom: 1 right: 1). -] - -{ #category : #initialization } -GtSourceCoderCollapsedTextAndExampleAptitude >> initializeListeners [ - super initializeListeners. - - self when: BlClickEvent do: [ :anEvent | - anEvent consumed: true. - self sourceCoderUIModel - expanded: true; - focused: true ] -] - -{ #category : #initialization } -GtSourceCoderCollapsedTextAndExampleAptitude >> initializeMethodLabel [ - methodLabel := BrLabel new - aptitude: BrGlamorousLabelAptitude new editorMeasurement bold glamorousCodeFont -] - -{ #category : #'private - accessing' } -GtSourceCoderCollapsedTextAndExampleAptitude >> methodLabel [ - - ^ methodLabel -] - -{ #category : #hooks } -GtSourceCoderCollapsedTextAndExampleAptitude >> onCoderChanged: aGtSourceCoderUIModel [ - self widget coderUIModel - ifNotNil: [ :aPreviousCoder | aPreviousCoder coder announcer unsubscribe: self ]. - self updateLabelsFor: aGtSourceCoderUIModel coder. - aGtSourceCoderUIModel coder announcer weak - when: GtCoderCollapsedLabelChanged - send: #onCollapsedLabelChanged: - to: self. - aGtSourceCoderUIModel coder announcer weak - when: GtCoderExampleExecuted - send: #onExampleExecuted: - to: self -] - -{ #category : #'private - announcement handling' } -GtSourceCoderCollapsedTextAndExampleAptitude >> onCollapsedLabelChanged: anAnnouncement [ - self updateLabelsFor: anAnnouncement coder -] - -{ #category : #'private - announcement handling' } -GtSourceCoderCollapsedTextAndExampleAptitude >> onExampleExecuted: anAnnouncement [ - self updateExampleElementFor: anAnnouncement coder -] - -{ #category : #'private - updating' } -GtSourceCoderCollapsedTextAndExampleAptitude >> show [ - self exampleElement visibility: BlVisibility visible -] - -{ #category : #'private - updating' } -GtSourceCoderCollapsedTextAndExampleAptitude >> updateExampleElementFor: aSourceCoder [ - aSourceCoder canExecuteExample - ifFalse: [ self hide. - ^ self ]. - self show. - - self exampleElement example: aSourceCoder example -] - -{ #category : #'private - updating' } -GtSourceCoderCollapsedTextAndExampleAptitude >> updateLabelsFor: aSourceCoder [ - self updateMethodLabelFor: aSourceCoder. - self updateExampleElementFor: aSourceCoder. -] - -{ #category : #'private - updating' } -GtSourceCoderCollapsedTextAndExampleAptitude >> updateMethodLabelFor: aSourceCoder [ - self methodLabel text: aSourceCoder collapsedText -] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAptitude.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAptitude.class.st deleted file mode 100644 index 56a1594fb..000000000 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextAptitude.class.st +++ /dev/null @@ -1,54 +0,0 @@ -Class { - #name : #GtSourceCoderCollapsedTextAptitude, - #superclass : #GtSourceCoderAptitude, - #instVars : [ - 'label' - ], - #category : 'GToolkit-Coder-UI-Coder - Source Look' -} - -{ #category : #initialization } -GtSourceCoderCollapsedTextAptitude >> initialize [ - super initialize. - - label := self newLabel. - self addChangeAddChildAs: { #content . GtSourceCoderCollapsedTextId } with: [ label ]. -] - -{ #category : #accessing } -GtSourceCoderCollapsedTextAptitude >> initializeListeners [ - super initializeListeners. - - self when: BlClickEvent do: [ :anEvent | - anEvent consumed: true. - self sourceCoderUIModel - expanded: true; - focused: true ] -] - -{ #category : #'instance creation' } -GtSourceCoderCollapsedTextAptitude >> newLabel [ - ^ BrLabel new - aptitude: BrGlamorousLabelAptitude new editorMeasurement bold glamorousCodeFont -] - -{ #category : #initialization } -GtSourceCoderCollapsedTextAptitude >> onCoderChanged: aGtSourceCoderUIModel [ - self widget coderUIModel - ifNotNil: [ :aPreviousCoder | aPreviousCoder coder announcer unsubscribe: self ]. - self updateLabelFor: aGtSourceCoderUIModel coder. - aGtSourceCoderUIModel coder announcer weak - when: GtCoderCollapsedLabelChanged - send: #updateLabel: - to: self -] - -{ #category : #private } -GtSourceCoderCollapsedTextAptitude >> updateLabel: anAnnouncement [ - self updateLabelFor: anAnnouncement coder -] - -{ #category : #private } -GtSourceCoderCollapsedTextAptitude >> updateLabelFor: aSourceCoder [ - label text: aSourceCoder collapsedText -] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st index a1ce2405d..dafc2687a 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st @@ -1,9 +1,9 @@ Class { #name : #GtSourceCoderContentElement, #superclass : #BlElement, - #traits : 'TBrLayoutResizable', - #classTraits : 'TBrLayoutResizable classTrait', - #category : 'GToolkit-Coder-UI-Coder - Source' + #traits : 'TBrLayoutResizable + TGtWithTextualCoderViewModel', + #classTraits : 'TBrLayoutResizable classTrait + TGtWithTextualCoderViewModel classTrait', + #category : #'GToolkit-Coder-UI-Coder - Source' } { #category : #accessing } @@ -37,7 +37,12 @@ GtSourceCoderContentElement >> coderUIModel: aGtSourceCoderUIModel [ self telemetry timeSync: [ 'Assign coder to {1}' format: { self class name } ] - during: [ self viewModel sourceCoder: aGtSourceCoderUIModel ] + during: [ self textualCoderViewModel: aGtSourceCoderUIModel ] +] + +{ #category : #initialization } +GtSourceCoderContentElement >> defaultLayout [ + ^ BlLinearLayout vertical ] { #category : #accessing } @@ -56,10 +61,18 @@ GtSourceCoderContentElement >> gtAllShortcutsFor: aView [ GtSourceCoderContentElement >> initialize [ super initialize. self - layout: BlLinearLayout vertical; margin: (BlInsets left: 5); hMatchParent; - vFitContentLimited. + vFitContentLimited +] + +{ #category : #'api - textual coder view model' } +GtSourceCoderContentElement >> onTextualCoderViewModelChanged [ + "Is sent when a new textualCoder view model is assigned to the element. + Note: #onTextualCoderViewModelChanged is sent before #subscribeToTextualCoderViewModel + which means that if you perform any operation that triggers an announcement it will be ignored because the receiver + didn't get a chance to subscribe to any announcement. Override #onPostTextualCoderViewModelChanged if you + wish to perform an operation that requires an announcement, but keep in mind that this is not the most efficient way" - self viewModel: (GtSourceCoderContentModel new) + ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEditorAptitude.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEditorAptitude.class.st deleted file mode 100644 index 2b2d678b0..000000000 --- a/src/GToolkit-Coder-UI/GtSourceCoderEditorAptitude.class.st +++ /dev/null @@ -1,50 +0,0 @@ -Class { - #name : #GtSourceCoderEditorAptitude, - #superclass : #GtSourceCoderAptitude, - #instVars : [ - 'sourceCoderUIModel', - 'editorElement', - 'interactions', - 'completion', - 'actions' - ], - #category : 'GToolkit-Coder-UI-Coder - Source Look' -} - -{ #category : #accessing } -GtSourceCoderEditorAptitude >> editorElement [ - - - ^ editorElement -] - -{ #category : #initialization } -GtSourceCoderEditorAptitude >> initialize [ - super initialize. - - editorElement := self newEditorElement. - actions := self newActionsElement. - - self addChangeAddChildAs: { #content . GtSourceCoderEditorId uniqueInstance asSymbol } with: [ editorElement ]. - self addChangeAddChildAs: #(content actions) with: [ actions ]. - - self add: (BrLayoutResizerAptitude new inherit: editorElement) -] - -{ #category : #'instance creation' } -GtSourceCoderEditorAptitude >> newActionsElement [ - ^ GtCoderActionsElement new - margin: (BlInsets top: 5); - yourself -] - -{ #category : #'instance creation' } -GtSourceCoderEditorAptitude >> newEditorElement [ - ^ GtSourceCoderEditorElement new -] - -{ #category : #hooks } -GtSourceCoderEditorAptitude >> onCoderChanged: aGtSourceCoderUIModel [ - actions coderUIModel: aGtSourceCoderUIModel. - editorElement textualCoderViewModel: aGtSourceCoderUIModel -] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st index b4a21fe09..f7f3ce0d8 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st @@ -1,5 +1,43 @@ Class { #name : #GtSourceCoderExpandedContentElement, #superclass : #GtSourceCoderContentElement, - #category : 'GToolkit-Coder-UI-Coder - Source' + #instVars : [ + 'editorElement', + 'actions' + ], + #category : #'GToolkit-Coder-UI-Coder - Source' } + +{ #category : #initialization } +GtSourceCoderExpandedContentElement >> initialize [ + super initialize. + + editorElement := self newEditorElement. + actions := self newActionsElement. + + self addChildren: { editorElement . actions }. + + self addAptitude: (BrLayoutResizerAptitude new inherit: editorElement) +] + +{ #category : #'instance creation' } +GtSourceCoderExpandedContentElement >> newActionsElement [ + ^ GtCoderActionsElement new + margin: (BlInsets top: 5); + id: #actions; + yourself +] + +{ #category : #'instance creation' } +GtSourceCoderExpandedContentElement >> newEditorElement [ + ^ GtSourceCoderEditorElement new + id: GtSourceCoderEditorId uniqueInstance +] + +{ #category : #'api - textual coder view model' } +GtSourceCoderExpandedContentElement >> onTextualCoderViewModelChanged [ + super onTextualCoderViewModelChanged. + + actions coderUIModel: textualCoderViewModel. + editorElement textualCoderViewModel: textualCoderViewModel +] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index caf494ad4..5dbd2951d 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -28,6 +28,8 @@ GtTextualCoderViewModel >> addMainAction: aGtCoderAction [ { #category : #'api - add-ons' } GtTextualCoderViewModel >> addOns [ + + ^ self ensureAddOns ] @@ -299,6 +301,8 @@ GtTextualCoderViewModel >> elementClass [ { #category : #'private - addons' } GtTextualCoderViewModel >> ensureAddOns [ + + ^ addOnPromise ifNil: [ addOnPromise := self computeAddOns then: [ :theAddOns | self onAddOnsChanged: theAddOns ]; yourself ] ] diff --git a/src/GToolkit-Coder/GtCoderModel.class.st b/src/GToolkit-Coder/GtCoderModel.class.st index f4705131b..4c273fb6a 100644 --- a/src/GToolkit-Coder/GtCoderModel.class.st +++ b/src/GToolkit-Coder/GtCoderModel.class.st @@ -195,11 +195,6 @@ GtCoderModel >> removeAttributeNamed: aSymbol [ attributes removeKey: aSymbol ifAbsent: [ ] ] -{ #category : #elements } -GtCoderModel >> requestFocus [ - self announce: (GtCoderRequestFocus new coder: self) -] - { #category : #'api - addons' } GtCoderModel >> requestUpdateAddOns [ "Request addons to update due to some environmental changes (similar to requesting text to restyle). diff --git a/src/GToolkit-Coder/GtCoderRequestFocus.class.st b/src/GToolkit-Coder/GtCoderRequestFocus.class.st deleted file mode 100644 index 983d1a7a2..000000000 --- a/src/GToolkit-Coder/GtCoderRequestFocus.class.st +++ /dev/null @@ -1,5 +0,0 @@ -Class { - #name : #GtCoderRequestFocus, - #superclass : #GtCoderAnnouncement, - #category : 'GToolkit-Coder-Event' -} From 7079209f88b6de1a82a304373741dce4a8299991 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Sun, 14 Nov 2021 20:50:13 +0100 Subject: [PATCH 0083/1268] rename stream collect to toArray --- .../GtCoderModel.extension.st | 5 ----- .../GtSourceCoderContentElement.class.st | 21 ++++++++++++++++++- src/GToolkit-Coder/GtCoderModel.class.st | 4 +--- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderModel.extension.st b/src/GToolkit-Coder-UI/GtCoderModel.extension.st index e11830871..a89ef444d 100644 --- a/src/GToolkit-Coder-UI/GtCoderModel.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderModel.extension.st @@ -36,11 +36,6 @@ GtCoderModel >> coderLook: aLookOrBlock [ self attributeNamed: #coderLook put: aLookOrBlock ] -{ #category : #'*GToolkit-Coder-UI' } -GtCoderModel >> defaultCoderLook [ - ^ nil -] - { #category : #'*GToolkit-Coder-UI' } GtCoderModel >> elementClass [ ^ GtExpandableSourceCoderElement diff --git a/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st index dafc2687a..24bae6c91 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st @@ -3,6 +3,9 @@ Class { #superclass : #BlElement, #traits : 'TBrLayoutResizable + TGtWithTextualCoderViewModel', #classTraits : 'TBrLayoutResizable classTrait + TGtWithTextualCoderViewModel classTrait', + #instVars : [ + 'header' + ], #category : #'GToolkit-Coder-UI-Coder - Source' } @@ -66,6 +69,16 @@ GtSourceCoderContentElement >> initialize [ vFitContentLimited ] +{ #category : #initialization } +GtSourceCoderContentElement >> newHeaderElement [ + ^ GtMethodCoderBreadcrumbElement new + constraintsDo: [ :c | + c margin: (BlInsets top: 2). + c frame horizontal alignLeft. + c frame vertical alignCenter ]; + yourself +] + { #category : #'api - textual coder view model' } GtSourceCoderContentElement >> onTextualCoderViewModelChanged [ "Is sent when a new textualCoder view model is assigned to the element. @@ -74,5 +87,11 @@ GtSourceCoderContentElement >> onTextualCoderViewModelChanged [ didn't get a chance to subscribe to any announcement. Override #onPostTextualCoderViewModelChanged if you wish to perform an operation that requires an announcement, but keep in mind that this is not the most efficient way" - + textualCoderViewModel coderModel wantsHeader + ifTrue: [ + header ifNil: [ + header := self newHeaderElement. + self addChildFirst: header ]. + header visibility: BlVisibility visible ] + ifFalse: [ header ifNotNil: [ :aHeader | aHeader visibility: BlVisibility gone ] ] ] diff --git a/src/GToolkit-Coder/GtCoderModel.class.st b/src/GToolkit-Coder/GtCoderModel.class.st index 4c273fb6a..342d1f328 100644 --- a/src/GToolkit-Coder/GtCoderModel.class.st +++ b/src/GToolkit-Coder/GtCoderModel.class.st @@ -154,9 +154,7 @@ GtCoderModel >> initialize [ id := UniqueIdGenerator generateUniqueId. monitor := Monitor new. - announcer := GtCoderAnnouncer new. - - self coderLook: self defaultCoderLook + announcer := GtCoderAnnouncer new ] { #category : #initialization } From 46f55982226e07ba691930e31d54d0c36f1919ae Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Sun, 14 Nov 2021 22:20:14 +0100 Subject: [PATCH 0084/1268] Rework source coder's header element --- .../GtSourceCoderBreadcrumbAction.class.st | 22 -------- ...oderBreadcrumbSpawnBehaviorAction.class.st | 56 ------------------- ...CoderBreadcrumbSpawnPackageAction.class.st | 43 -------------- ...ourceCoderCollapsedContentElement.class.st | 17 +++--- .../GtSourceCoderContentElement.class.st | 3 +- .../GtTextualCoder.extension.st | 8 --- .../GtTextualCoderViewModel.class.st | 5 ++ 7 files changed, 17 insertions(+), 137 deletions(-) delete mode 100644 src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbAction.class.st delete mode 100644 src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbSpawnBehaviorAction.class.st delete mode 100644 src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbSpawnPackageAction.class.st delete mode 100644 src/GToolkit-Coder-UI/GtTextualCoder.extension.st diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbAction.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbAction.class.st deleted file mode 100644 index e35501f0f..000000000 --- a/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbAction.class.st +++ /dev/null @@ -1,22 +0,0 @@ -Class { - #name : #GtSourceCoderBreadcrumbAction, - #superclass : #Object, - #category : 'GToolkit-Coder-UI-Coder - Source Model' -} - -{ #category : #accessing } -GtSourceCoderBreadcrumbAction >> foreground [ - ^ BrGlamorousColors defaultButtonTextColor -] - -{ #category : #accessing } -GtSourceCoderBreadcrumbAction >> name [ - - - ^ self subclassResponsibility -] - -{ #category : #action } -GtSourceCoderBreadcrumbAction >> performSourceCoderActionFrom: anElement [ - self subclassResponsibility -] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbSpawnBehaviorAction.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbSpawnBehaviorAction.class.st deleted file mode 100644 index 3c2b3d555..000000000 --- a/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbSpawnBehaviorAction.class.st +++ /dev/null @@ -1,56 +0,0 @@ -Class { - #name : #GtSourceCoderBreadcrumbSpawnBehaviorAction, - #superclass : #GtSourceCoderBreadcrumbAction, - #instVars : [ - 'methodBehavior' - ], - #category : 'GToolkit-Coder-UI-Coder - Source Model' -} - -{ #category : #accessing } -GtSourceCoderBreadcrumbSpawnBehaviorAction >> foreground [ - ^ self methodBehavior exists - ifTrue: [ BrGlamorousColors defaultButtonTextColor ] - ifFalse: [ BrGlamorousColors linkWithErrorColor ] -] - -{ #category : #accessing } -GtSourceCoderBreadcrumbSpawnBehaviorAction >> methodBehavior [ - ^ methodBehavior -] - -{ #category : #accessing } -GtSourceCoderBreadcrumbSpawnBehaviorAction >> methodBehavior: anObject [ - methodBehavior := anObject -] - -{ #category : #accessing } -GtSourceCoderBreadcrumbSpawnBehaviorAction >> name [ - - - ^ self methodBehavior - behaviorNameDo: [ :aName | - self methodBehavior exists - ifTrue: [ aName ] - ifFalse: [ aName, ' (Deleted)' ] ] - ifAbsent: [ '(Unspecified)' ] -] - -{ #category : #action } -GtSourceCoderBreadcrumbSpawnBehaviorAction >> performSourceCoderActionFrom: anElement [ - - self methodBehavior realBehaviorDo: [ :aBehavior | - anElement phlow spawnTool: (GtClassCoderTool observedClass: aBehavior). - ^ self ]. - - anElement phlow spawnTool: (GtInspectorTool forObject: self methodBehavior). -] - -{ #category : #printing } -GtSourceCoderBreadcrumbSpawnBehaviorAction >> printOn: aStream [ - aStream - nextPutAll: 'Spawn '; - nextPutAll: self name; - space; - nextPutAll: 'class' -] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbSpawnPackageAction.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbSpawnPackageAction.class.st deleted file mode 100644 index ce3708db7..000000000 --- a/src/GToolkit-Coder-UI/GtSourceCoderBreadcrumbSpawnPackageAction.class.st +++ /dev/null @@ -1,43 +0,0 @@ -Class { - #name : #GtSourceCoderBreadcrumbSpawnPackageAction, - #superclass : #GtSourceCoderBreadcrumbAction, - #instVars : [ - 'package' - ], - #category : 'GToolkit-Coder-UI-Coder - Source Model' -} - -{ #category : #accessing } -GtSourceCoderBreadcrumbSpawnPackageAction >> name [ - - - ^ self package name -] - -{ #category : #accessing } -GtSourceCoderBreadcrumbSpawnPackageAction >> package [ - ^ package -] - -{ #category : #accessing } -GtSourceCoderBreadcrumbSpawnPackageAction >> package: aPackage [ - self - assert: [ aPackage notNil ] - description: [ 'Package must not be nil' ]. - - package := aPackage -] - -{ #category : #action } -GtSourceCoderBreadcrumbSpawnPackageAction >> performSourceCoderActionFrom: anElement [ - anElement phlow spawnTool: (GtPackageCoderTool package: self package) -] - -{ #category : #printing } -GtSourceCoderBreadcrumbSpawnPackageAction >> printOn: aStream [ - aStream - nextPutAll: 'Spawn '; - nextPutAll: self package name; - space; - nextPutAll: 'package' -] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st index 1f4b6502b..5eac45913 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st @@ -3,24 +3,27 @@ Class { #superclass : #GtSourceCoderContentElement, #instVars : [ 'label', - 'addOns' + 'addOns', + 'content' ], #category : #'GToolkit-Coder-UI-Coder - Source' } -{ #category : #initialization } -GtSourceCoderCollapsedContentElement >> defaultLayout [ - ^ BlLinearLayout horizontal -] - { #category : #initialization } GtSourceCoderCollapsedContentElement >> initialize [ super initialize. + + content := BlElement new + layout: BlLinearLayout horizontal; + constraintsDo: [ :c | + c horizontal matchParent. + c vertical fitContent ]. label := self newLabel. addOns := self newAddOnsContainer. - self addChildren: { label. addOns } + content addChildren: { label. addOns }. + self addChild: content ] { #category : #'instance creation' } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st index 24bae6c91..7cf550290 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st @@ -71,7 +71,7 @@ GtSourceCoderContentElement >> initialize [ { #category : #initialization } GtSourceCoderContentElement >> newHeaderElement [ - ^ GtMethodCoderBreadcrumbElement new + ^ self textualCoderViewModel headerElementClass new constraintsDo: [ :c | c margin: (BlInsets top: 2). c frame horizontal alignLeft. @@ -92,6 +92,7 @@ GtSourceCoderContentElement >> onTextualCoderViewModelChanged [ header ifNil: [ header := self newHeaderElement. self addChildFirst: header ]. + header textualCoderViewModel: textualCoderViewModel. header visibility: BlVisibility visible ] ifFalse: [ header ifNotNil: [ :aHeader | aHeader visibility: BlVisibility gone ] ] ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoder.extension.st b/src/GToolkit-Coder-UI/GtTextualCoder.extension.st deleted file mode 100644 index 53c367312..000000000 --- a/src/GToolkit-Coder-UI/GtTextualCoder.extension.st +++ /dev/null @@ -1,8 +0,0 @@ -Extension { #name : #GtTextualCoder } - -{ #category : #'*GToolkit-Coder-UI' } -GtTextualCoder >> breadcrumbActions [ - - - ^ #() -] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 5dbd2951d..f84c548a4 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -405,6 +405,11 @@ GtTextualCoderViewModel >> hasStyledText [ ^ styledText notNil ] +{ #category : #accessing } +GtTextualCoderViewModel >> headerElementClass [ + ^ nil +] + { #category : #initialization } GtTextualCoderViewModel >> initialize [ super initialize. From dcec15d2ff7d843ffa825d5dc2538b5c9c0f5dfa Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 15 Nov 2021 11:08:24 +0100 Subject: [PATCH 0085/1268] make the view model responsible for deciding about the header --- .../GtSourceCoderContentElement.class.st | 2 +- .../GtTextualCoder.extension.st | 16 ++++++++++++++++ .../GtTextualCoderViewModel.class.st | 7 +++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 src/GToolkit-Coder-UI/GtTextualCoder.extension.st diff --git a/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st index 7cf550290..e2d87165d 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st @@ -87,7 +87,7 @@ GtSourceCoderContentElement >> onTextualCoderViewModelChanged [ didn't get a chance to subscribe to any announcement. Override #onPostTextualCoderViewModelChanged if you wish to perform an operation that requires an announcement, but keep in mind that this is not the most efficient way" - textualCoderViewModel coderModel wantsHeader + textualCoderViewModel wantsHeader ifTrue: [ header ifNil: [ header := self newHeaderElement. diff --git a/src/GToolkit-Coder-UI/GtTextualCoder.extension.st b/src/GToolkit-Coder-UI/GtTextualCoder.extension.st new file mode 100644 index 000000000..167db31e0 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtTextualCoder.extension.st @@ -0,0 +1,16 @@ +Extension { #name : #GtTextualCoder } + +{ #category : #'*GToolkit-Coder-UI' } +GtTextualCoder >> wantsHeader [ + ^ self attributeNamed: #withHeader ifAbsent: [ true ] +] + +{ #category : #'*GToolkit-Coder-UI' } +GtTextualCoder >> withHeader [ + self attributeNamed: #withHeader put: true +] + +{ #category : #'*GToolkit-Coder-UI' } +GtTextualCoder >> withoutHeader [ + self attributeNamed: #withHeader put: false +] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index f84c548a4..497d81555 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -728,3 +728,10 @@ GtTextualCoderViewModel >> unsubscribeFromCoderModel [ self coderModel unsubscribe: self ] + +{ #category : #accessing } +GtTextualCoderViewModel >> wantsHeader [ + + + ^ self coderModel wantsHeader and: [ self headerElementClass notNil ] +] From 5de3e625939cac7500f5f7c14046df050d936ba3 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 15 Nov 2021 11:43:05 +0100 Subject: [PATCH 0086/1268] assign id to the collapsed label element --- .../GtSourceCoderCollapsedContentElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st index 5eac45913..a363265b7 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st @@ -53,7 +53,7 @@ GtSourceCoderCollapsedContentElement >> newLabel [ fitContent; stencil: [ BlAttributedTextElement new - id: #label; + id: GtSourceCoderCollapsedTextId; editorMeasurement; bold; glamorousCodeFont ]; From 49ebbf3ef92cffd963d525d66a0de09a715e82e5 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 15 Nov 2021 12:40:02 +0100 Subject: [PATCH 0087/1268] rename the id of the source coder editor --- src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st | 4 ++-- src/GToolkit-Coder-UI/GtSourceCoderEditorId.class.st | 4 ++-- .../GtSourceCoderExpandedContentElement.class.st | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st b/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st index 7121785bb..cd13d1423 100644 --- a/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st +++ b/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st @@ -64,12 +64,12 @@ TCoderByScripterExamples >> selectTextFor: aScripterOrStep from: aStartPosition aSourceEditor selecter from: aStartPosition to: aToPosition; select ]; - onChildNamed: GtSourceCoderEditorId; + id: GtSourceCoderEditorId; play. aScripterOrStep check label: 'Check selected text'; value: [ :aSourceEditor | aSourceEditor editor selectedText asString ] equals: aSelectedString; - onChildNamed: GtSourceCoderEditorId; + id: GtSourceCoderEditorId; play ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEditorId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEditorId.class.st index da201c803..0e760ac55 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEditorId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEditorId.class.st @@ -6,10 +6,10 @@ Text editor within the source coder Class { #name : #GtSourceCoderEditorId, #superclass : #GtCoderElementId, - #category : 'GToolkit-Coder-UI-Coder - Basic' + #category : #'GToolkit-Coder-UI-Coder - Basic' } { #category : #converting } GtSourceCoderEditorId >> asSymbol [ - ^ #editor + ^ #'source-coder--editor' ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st index f7f3ce0d8..537ea6bdf 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st @@ -31,7 +31,7 @@ GtSourceCoderExpandedContentElement >> newActionsElement [ { #category : #'instance creation' } GtSourceCoderExpandedContentElement >> newEditorElement [ ^ GtSourceCoderEditorElement new - id: GtSourceCoderEditorId uniqueInstance + id: GtSourceCoderEditorId ] { #category : #'api - textual coder view model' } From 7da8193f45957afff1d789922f51b63ba927d753 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 15 Nov 2021 18:18:03 +0100 Subject: [PATCH 0088/1268] remove GtSourceCoderContentModel --- .../GtSourceCoderContentModel.class.st | 33 ------------------- .../GtSourceCoderViewModel.class.st | 8 ++--- 2 files changed, 4 insertions(+), 37 deletions(-) delete mode 100644 src/GToolkit-Coder-UI/GtSourceCoderContentModel.class.st diff --git a/src/GToolkit-Coder-UI/GtSourceCoderContentModel.class.st b/src/GToolkit-Coder-UI/GtSourceCoderContentModel.class.st deleted file mode 100644 index 586f25644..000000000 --- a/src/GToolkit-Coder-UI/GtSourceCoderContentModel.class.st +++ /dev/null @@ -1,33 +0,0 @@ -Class { - #name : #GtSourceCoderContentModel, - #superclass : #BrWidgetModel, - #instVars : [ - 'sourceCoder' - ], - #category : #'GToolkit-Coder-UI-Coder - Source' -} - -{ #category : #initialization } -GtSourceCoderContentModel >> initializeListeners [ - super initializeListeners. - - self when: GtSourceCoderContentCoderRequest reply: [ :aResponse | aResponse sourceCoder: self sourceCoder ] -] - -{ #category : #'private - notifying' } -GtSourceCoderContentModel >> notifySourceCoderChanged: aGtSourceCoderUIModel [ - self dispatchEvent: (GtSourceCoderContentCoderChanged new sourceCoder: aGtSourceCoderUIModel) -] - -{ #category : #accessing } -GtSourceCoderContentModel >> sourceCoder [ - - - ^ sourceCoder -] - -{ #category : #accessing } -GtSourceCoderContentModel >> sourceCoder: aGtSourceCoderUIModel [ - sourceCoder := aGtSourceCoderUIModel. - self notifySourceCoderChanged: aGtSourceCoderUIModel -] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st index 8fb01389b..76d9aac20 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st @@ -4,7 +4,7 @@ Class { #instVars : [ 'evaluationResult' ], - #category : 'GToolkit-Coder-UI-Coder - Source Model' + #category : #'GToolkit-Coder-UI-Coder - Source Model' } { #category : #'api - actions' } @@ -105,7 +105,7 @@ GtSourceCoderViewModel >> doItRequestedBy: aRequesterObject [ ifFalse: [ self doIt: self selectedTextInterval requestedBy: aRequesterObject ] ] -{ #category : #accessing } +{ #category : #'api - accessing' } GtSourceCoderViewModel >> elementClass [ ^ GtExpandableSourceCoderElement ] @@ -118,12 +118,12 @@ GtSourceCoderViewModel >> evaluationContext [ requesterObject: self ] -{ #category : #accessing } +{ #category : #'api - accessing' } GtSourceCoderViewModel >> evaluationResult [ ^ evaluationResult ] -{ #category : #accessing } +{ #category : #'api - accessing' } GtSourceCoderViewModel >> evaluationResult: anObject [ evaluationResult := anObject ] From a0274167d1a8cfe4d34dc714bd17437b656d7d23 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 15 Nov 2021 18:42:07 +0100 Subject: [PATCH 0089/1268] remove obsolete events and widget model --- .../GtSourceCoderAptitude.class.st | 41 ------------- .../GtSourceCoderContentCoderChanged.class.st | 18 ------ .../GtSourceCoderContentCoderRequest.class.st | 10 ---- .../GtSourceCoderFocusChanged.class.st | 29 ---------- ...urceCoderSpawnDestinationAptitude.class.st | 57 ------------------- .../GtTextualCoderEditorElement.class.st | 2 +- .../GtTextualCoderViewModel.class.st | 2 +- ...TextualCoderViewModelFocusChanged.class.st | 29 ++++++++++ 8 files changed, 31 insertions(+), 157 deletions(-) delete mode 100644 src/GToolkit-Coder-UI/GtSourceCoderAptitude.class.st delete mode 100644 src/GToolkit-Coder-UI/GtSourceCoderContentCoderChanged.class.st delete mode 100644 src/GToolkit-Coder-UI/GtSourceCoderContentCoderRequest.class.st delete mode 100644 src/GToolkit-Coder-UI/GtSourceCoderFocusChanged.class.st delete mode 100644 src/GToolkit-Coder-UI/GtSourceCoderSpawnDestinationAptitude.class.st create mode 100644 src/GToolkit-Coder-UI/GtTextualCoderViewModelFocusChanged.class.st diff --git a/src/GToolkit-Coder-UI/GtSourceCoderAptitude.class.st b/src/GToolkit-Coder-UI/GtSourceCoderAptitude.class.st deleted file mode 100644 index 7e976497c..000000000 --- a/src/GToolkit-Coder-UI/GtSourceCoderAptitude.class.st +++ /dev/null @@ -1,41 +0,0 @@ -Class { - #name : #GtSourceCoderAptitude, - #superclass : #BrAptitude, - #category : 'GToolkit-Coder-UI-Coder - Source Look' -} - -{ #category : #'private - accessing' } -GtSourceCoderAptitude >> coder [ - self - deprecated: 'Please use #sourceCoderUIModel instead' - transformWith: '`@receiver coder' -> '`@receiver sourceCoderUIModel'. - - ^ self sourceCoderUIModel -] - -{ #category : #initialization } -GtSourceCoderAptitude >> initializeListeners [ - super initializeListeners. - - self when: GtSourceCoderContentCoderChanged do: [ :anEvent | - anEvent sourceCoder - ifNotNil: [ :aSourceCoder | self onCoderChanged: aSourceCoder ] ] -] - -{ #category : #initialization } -GtSourceCoderAptitude >> initializeRequests [ - super initializeRequests. - - self request: GtSourceCoderContentCoderRequest new -] - -{ #category : #hooks } -GtSourceCoderAptitude >> onCoderChanged: aGtSourceCoder [ -] - -{ #category : #'private - accessing' } -GtSourceCoderAptitude >> sourceCoderUIModel [ - - - ^ (self request: GtSourceCoderContentCoderRequest oneWay) sourceCoder -] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderContentCoderChanged.class.st b/src/GToolkit-Coder-UI/GtSourceCoderContentCoderChanged.class.st deleted file mode 100644 index b2c0ddcf9..000000000 --- a/src/GToolkit-Coder-UI/GtSourceCoderContentCoderChanged.class.st +++ /dev/null @@ -1,18 +0,0 @@ -Class { - #name : #GtSourceCoderContentCoderChanged, - #superclass : #BrChangeEvent, - #instVars : [ - 'sourceCoder' - ], - #category : 'GToolkit-Coder-UI-Coder - Source Events' -} - -{ #category : #accessing } -GtSourceCoderContentCoderChanged >> sourceCoder [ - ^ sourceCoder -] - -{ #category : #accessing } -GtSourceCoderContentCoderChanged >> sourceCoder: anObject [ - sourceCoder := anObject -] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderContentCoderRequest.class.st b/src/GToolkit-Coder-UI/GtSourceCoderContentCoderRequest.class.st deleted file mode 100644 index 158fc6092..000000000 --- a/src/GToolkit-Coder-UI/GtSourceCoderContentCoderRequest.class.st +++ /dev/null @@ -1,10 +0,0 @@ -Class { - #name : #GtSourceCoderContentCoderRequest, - #superclass : #BrRequest, - #category : 'GToolkit-Coder-UI-Coder - Source Events' -} - -{ #category : #initialization } -GtSourceCoderContentCoderRequest >> responseClass [ - ^ GtSourceCoderContentCoderChanged -] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderFocusChanged.class.st b/src/GToolkit-Coder-UI/GtSourceCoderFocusChanged.class.st deleted file mode 100644 index 3615e8c25..000000000 --- a/src/GToolkit-Coder-UI/GtSourceCoderFocusChanged.class.st +++ /dev/null @@ -1,29 +0,0 @@ -Class { - #name : #GtSourceCoderFocusChanged, - #superclass : #Announcement, - #instVars : [ - 'source', - 'focused' - ], - #category : 'GToolkit-Coder-UI-Coder - Source Events' -} - -{ #category : #accessing } -GtSourceCoderFocusChanged >> focused [ - ^ focused -] - -{ #category : #accessing } -GtSourceCoderFocusChanged >> focused: anObject [ - focused := anObject -] - -{ #category : #accessing } -GtSourceCoderFocusChanged >> source [ - ^ source -] - -{ #category : #accessing } -GtSourceCoderFocusChanged >> source: anObject [ - source := anObject -] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderSpawnDestinationAptitude.class.st b/src/GToolkit-Coder-UI/GtSourceCoderSpawnDestinationAptitude.class.st deleted file mode 100644 index 1b790c2b1..000000000 --- a/src/GToolkit-Coder-UI/GtSourceCoderSpawnDestinationAptitude.class.st +++ /dev/null @@ -1,57 +0,0 @@ -" -I add to a coder a way to change the destination where inspected objects are shown. - -Each coder holds to its destination. Available destinations are modeled as subclasses of {{gtClass:GtPhlowSpawnDesiredDestination}} - - -" -Class { - #name : #GtSourceCoderSpawnDestinationAptitude, - #superclass : #GtSourceCoderAptitude, - #instVars : [ - 'switchButton' - ], - #category : 'GToolkit-Coder-UI-Coder - Source Look' -} - -{ #category : #initialization } -GtSourceCoderSpawnDestinationAptitude >> initialize [ - super initialize. - - switchButton := self newSwitchButton. - - self addChangeAddChildAs: #(content switchButton) with: [ switchButton ] -] - -{ #category : #'instance creation' } -GtSourceCoderSpawnDestinationAptitude >> newSwitchButton [ - ^ BrButton new - aptitude: BrGlamorousButtonWithIconAptitude - BrGlamorousButtonExteriorAptitude; - action: [ self switchSpawnDestination ]; - label: 'Change the place where inspected objects are shown.'; - constraintsDo: [ :c | - c ignoreByLayout. - c ignored horizontal alignRight. - c ignored vertical alignBottom ]; - zIndex: 10 -] - -{ #category : #hooks } -GtSourceCoderSpawnDestinationAptitude >> onCoderChanged: aGtSourceCoderUIModel [ - self switchButton - icon: aGtSourceCoderUIModel coder spawnDestination icon -] - -{ #category : #accessing } -GtSourceCoderSpawnDestinationAptitude >> switchButton [ - ^ switchButton -] - -{ #category : #'instance creation' } -GtSourceCoderSpawnDestinationAptitude >> switchSpawnDestination [ - | aSourceCoder | - - aSourceCoder := self sourceCoderUIModel coder. - aSourceCoder spawnDestination: aSourceCoder spawnDestination followingDestination. - self switchButton icon: aSourceCoder spawnDestination icon -] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 82e4bf023..1123469f3 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -409,7 +409,7 @@ GtTextualCoderEditorElement >> registerCoderModelAnnouncementsFor: aCoderModel [ { #category : #registration } GtTextualCoderEditorElement >> registerCoderViewModelAnnouncementsFor: aGtSourceCoderUIModel [ aGtSourceCoderUIModel weak - when: GtSourceCoderFocusChanged + when: GtTextualCoderViewModelFocusChanged send: #onFocusChangedAnnouncement: to: self; when: GtTextualCoderViewModelTextChanged diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 497d81555..cebb08dfd 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -474,7 +474,7 @@ GtTextualCoderViewModel >> notifyExpansionChanged: aBoolean [ { #category : #'private - notifying' } GtTextualCoderViewModel >> notifyFocusChanged: aBoolean from: aSourceObject [ - self announcerUIModel announce: (GtSourceCoderFocusChanged new + self announcerUIModel announce: (GtTextualCoderViewModelFocusChanged new focused: aBoolean; source: aSourceObject) ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelFocusChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelFocusChanged.class.st new file mode 100644 index 000000000..7d7ac1992 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelFocusChanged.class.st @@ -0,0 +1,29 @@ +Class { + #name : #GtTextualCoderViewModelFocusChanged, + #superclass : #GtTextualCoderViewModelAnnouncement, + #instVars : [ + 'source', + 'focused' + ], + #category : #'GToolkit-Coder-UI-Coder - Textual Model - Events' +} + +{ #category : #accessing } +GtTextualCoderViewModelFocusChanged >> focused [ + ^ focused +] + +{ #category : #accessing } +GtTextualCoderViewModelFocusChanged >> focused: anObject [ + focused := anObject +] + +{ #category : #accessing } +GtTextualCoderViewModelFocusChanged >> source [ + ^ source +] + +{ #category : #accessing } +GtTextualCoderViewModelFocusChanged >> source: anObject [ + source := anObject +] From 51daa0d394f573ffeef5d5812f0d5ead14eea98c Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 15 Nov 2021 19:36:32 +0100 Subject: [PATCH 0090/1268] expand and focus a coder when clicking on the collapsed content. subscribe to the coder model from the view model --- .../GtExpandableSourceCoderElement.class.st | 13 +++++++++++-- .../GtSingleCoderViewModel.class.st | 17 +++++++++++++++++ .../GtSourceCoderEditorElement.class.st | 2 +- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st index 7dd7cf369..684ed9e37 100644 --- a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st @@ -84,7 +84,16 @@ GtExpandableSourceCoderElement >> initialize [ self header: [ collapsedElement := self newCollapsedElement ]; - content: [ expandedElement := self newExpandedElement ] + content: [ expandedElement := self newExpandedElement ]. + + self + when: BlClickEvent + do: [ :anEvent | + self isCollapsed + ifTrue: [ + anEvent consumed: true. + self expand. + self textualCoderViewModel focused: true ] ] ] { #category : #private } @@ -163,7 +172,7 @@ GtExpandableSourceCoderElement >> onTextualCoderViewModelChanged [ textualCoderViewModel focused ifFalse: [ self loseFocus ]. - self expanded: textualCoderViewModel expanded. + self expanded: textualCoderViewModel expanded ] { #category : #'private - event handling' } diff --git a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st index ad3c86e80..d4e9b5cd7 100644 --- a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st @@ -114,3 +114,20 @@ GtSingleCoderViewModel >> isModified [ GtSingleCoderViewModel >> onCoderModelChanged [ "Is sent when a new coder model is assigned to the view model" ] + +{ #category : #'api - coder model' } +GtSingleCoderViewModel >> subscribeToCoderModel [ + "Is sent after a new coder model is assigned to the view model. + It is required to unsubscribe from the domain model by implementing + #unsubscribeFromCoderModel if view model subscribes to them" + + self coderModel subscribeToSystem +] + +{ #category : #'api - coder model' } +GtSingleCoderViewModel >> unsubscribeFromCoderModel [ + "Is sent before a new coder model is assigned to the view model. + View models that subscribe to coder model are required to implement this methods" + + self coderModel unsubscribeFromSystem +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st index 2dedbc9a5..cb484d8ee 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st @@ -1,7 +1,7 @@ Class { #name : #GtSourceCoderEditorElement, #superclass : #GtTextualCoderEditorElement, - #category : #'GToolkit-Coder-UI-Coder - Textual' + #category : #'GToolkit-Coder-UI-Coder - Source' } { #category : #'api - textual coder view model' } From 58c7dd1f7db8e108ed4ecb21bc48c46d9188b70c Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 15 Nov 2021 19:38:22 +0100 Subject: [PATCH 0091/1268] do not unsubscribeFromSystem in #unsubscribeFromCoderModel --- src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st index d4e9b5cd7..e9ec13517 100644 --- a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st @@ -129,5 +129,6 @@ GtSingleCoderViewModel >> unsubscribeFromCoderModel [ "Is sent before a new coder model is assigned to the view model. View models that subscribe to coder model are required to implement this methods" - self coderModel unsubscribeFromSystem + "unsubscribing here is not good, what if there are multiple view models on the same coder model?" + "self coderModel unsubscribeFromSystem" ] From feac4010b2f0c41f85f1cabf66fe1822e9bb9fc2 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Wed, 17 Nov 2021 20:23:27 +0100 Subject: [PATCH 0092/1268] [feenkcom/gtoolkit#2224] initial streaming coders model --- ...orCoderBehaviorNameApplyPreviewId.class.st | 2 +- .../GtBehaviorCoderBehaviorNameId.class.st | 2 +- .../GtCoderElementId.class.st | 2 +- ...GtMethodCoderDebugExampleActionId.class.st | 2 +- ...MethodCoderDiscardChangesActionId.class.st | 2 +- ...derExtractMethodContextMenuItemId.class.st | 2 +- ...oderPlayAndInspectExampleActionId.class.st | 2 +- .../GtMethodCoderPlayExampleActionId.class.st | 2 +- .../GtMethodCoderSaveActionId.class.st | 2 +- .../GtPackageCoderPackageNameId.class.st | 2 +- ...FilteredStreamingMethodsCoder.extension.st | 6 + .../GtRefactoringsPreviewAcceptId.class.st | 2 +- .../GtSourceCoderCollapsedAddOnsId.class.st | 2 +- .../GtSourceCoderCollapsedTextId.class.st | 2 +- .../GtSourceCoderDebugActionId.class.st | 2 +- .../GtSourceCoderDoItActionId.class.st | 2 +- .../GtSourceCoderDoItAndGoActionId.class.st | 2 +- .../GtSourceCoderEditorId.class.st | 2 +- ...urceCoderEmbeddedExpanderToggleId.class.st | 2 +- .../GtSourceCoderExpanderToggleId.class.st | 2 +- ...erExtractTempVarContextMenuItemId.class.st | 2 +- .../GtSourceCoderProfileActionId.class.st | 2 +- .../GtStreamingCodersChanged.class.st | 5 + .../GtStreamingCodersViewModel.class.st | 142 ++++++++++++++++++ ...GtStreamingCodersViewModelCommand.class.st | 15 ++ ...TextualCoderCopyContextMenuItemId.class.st | 2 +- ...tTextualCoderCutContextMenuItemId.class.st | 2 +- ...extualCoderPasteContextMenuItemId.class.st | 2 +- .../TGtWithCoderModel.trait.st | 2 +- .../TGtWithCodersModel.trait.st | 84 +++++++++++ 30 files changed, 277 insertions(+), 25 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtPharoFilteredStreamingMethodsCoder.extension.st create mode 100644 src/GToolkit-Coder-UI/GtStreamingCodersChanged.class.st create mode 100644 src/GToolkit-Coder-UI/GtStreamingCodersViewModel.class.st create mode 100644 src/GToolkit-Coder-UI/GtStreamingCodersViewModelCommand.class.st rename src/{GToolkit-Coder-UI => GToolkit-Coder}/TGtWithCoderModel.trait.st (97%) create mode 100644 src/GToolkit-Coder/TGtWithCodersModel.trait.st diff --git a/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorNameApplyPreviewId.class.st b/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorNameApplyPreviewId.class.st index e9f225c9e..a76836e53 100644 --- a/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorNameApplyPreviewId.class.st +++ b/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorNameApplyPreviewId.class.st @@ -6,7 +6,7 @@ A button that appears when behavior name is modified to open a popup with the re Class { #name : #GtBehaviorCoderBehaviorNameApplyPreviewId, #superclass : #GtCoderElementId, - #category : 'GToolkit-Coder-UI-Coder - Basic' + #category : #'GToolkit-Coder-UI-Coder - Ids' } { #category : #converting } diff --git a/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorNameId.class.st b/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorNameId.class.st index ada7779a4..96d362ded 100644 --- a/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorNameId.class.st +++ b/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorNameId.class.st @@ -6,7 +6,7 @@ An editable label with behavior's name Class { #name : #GtBehaviorCoderBehaviorNameId, #superclass : #GtCoderElementId, - #category : 'GToolkit-Coder-UI-Coder - Basic' + #category : #'GToolkit-Coder-UI-Coder - Ids' } { #category : #converting } diff --git a/src/GToolkit-Coder-UI/GtCoderElementId.class.st b/src/GToolkit-Coder-UI/GtCoderElementId.class.st index 1f4cc6504..eae0f0478 100644 --- a/src/GToolkit-Coder-UI/GtCoderElementId.class.st +++ b/src/GToolkit-Coder-UI/GtCoderElementId.class.st @@ -5,7 +5,7 @@ Class { #name : #GtCoderElementId, #superclass : #BlElementUniqueId, - #category : 'GToolkit-Coder-UI-Coder - Basic' + #category : #'GToolkit-Coder-UI-Coder - Ids' } { #category : #testing } diff --git a/src/GToolkit-Coder-UI/GtMethodCoderDebugExampleActionId.class.st b/src/GToolkit-Coder-UI/GtMethodCoderDebugExampleActionId.class.st index b47ffedaf..f4a02d0c4 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderDebugExampleActionId.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderDebugExampleActionId.class.st @@ -6,7 +6,7 @@ A button to debug an example Class { #name : #GtMethodCoderDebugExampleActionId, #superclass : #GtCoderElementId, - #category : 'GToolkit-Coder-UI-Coder - Basic' + #category : #'GToolkit-Coder-UI-Coder - Ids' } { #category : #converting } diff --git a/src/GToolkit-Coder-UI/GtMethodCoderDiscardChangesActionId.class.st b/src/GToolkit-Coder-UI/GtMethodCoderDiscardChangesActionId.class.st index feaab2c50..fed352a23 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderDiscardChangesActionId.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderDiscardChangesActionId.class.st @@ -6,7 +6,7 @@ A button to discard changes Class { #name : #GtMethodCoderDiscardChangesActionId, #superclass : #GtCoderElementId, - #category : 'GToolkit-Coder-UI-Coder - Basic' + #category : #'GToolkit-Coder-UI-Coder - Ids' } { #category : #converting } diff --git a/src/GToolkit-Coder-UI/GtMethodCoderExtractMethodContextMenuItemId.class.st b/src/GToolkit-Coder-UI/GtMethodCoderExtractMethodContextMenuItemId.class.st index 2c2c2b666..b03a39b66 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderExtractMethodContextMenuItemId.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderExtractMethodContextMenuItemId.class.st @@ -6,7 +6,7 @@ A context menu action to extract a method Class { #name : #GtMethodCoderExtractMethodContextMenuItemId, #superclass : #GtCoderElementId, - #category : 'GToolkit-Coder-UI-Coder - Basic' + #category : #'GToolkit-Coder-UI-Coder - Ids' } { #category : #converting } diff --git a/src/GToolkit-Coder-UI/GtMethodCoderPlayAndInspectExampleActionId.class.st b/src/GToolkit-Coder-UI/GtMethodCoderPlayAndInspectExampleActionId.class.st index 997d18135..893f876c5 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderPlayAndInspectExampleActionId.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderPlayAndInspectExampleActionId.class.st @@ -6,7 +6,7 @@ A button to play and inspect an example Class { #name : #GtMethodCoderPlayAndInspectExampleActionId, #superclass : #GtCoderElementId, - #category : 'GToolkit-Coder-UI-Coder - Basic' + #category : #'GToolkit-Coder-UI-Coder - Ids' } { #category : #converting } diff --git a/src/GToolkit-Coder-UI/GtMethodCoderPlayExampleActionId.class.st b/src/GToolkit-Coder-UI/GtMethodCoderPlayExampleActionId.class.st index ac6815b8a..cb81ebdc6 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderPlayExampleActionId.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderPlayExampleActionId.class.st @@ -6,7 +6,7 @@ A button to play an example Class { #name : #GtMethodCoderPlayExampleActionId, #superclass : #GtCoderElementId, - #category : 'GToolkit-Coder-UI-Coder - Basic' + #category : #'GToolkit-Coder-UI-Coder - Ids' } { #category : #converting } diff --git a/src/GToolkit-Coder-UI/GtMethodCoderSaveActionId.class.st b/src/GToolkit-Coder-UI/GtMethodCoderSaveActionId.class.st index 6ae3d408d..549350dc6 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderSaveActionId.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderSaveActionId.class.st @@ -6,7 +6,7 @@ A button to save a method Class { #name : #GtMethodCoderSaveActionId, #superclass : #GtCoderElementId, - #category : 'GToolkit-Coder-UI-Coder - Basic' + #category : #'GToolkit-Coder-UI-Coder - Ids' } { #category : #converting } diff --git a/src/GToolkit-Coder-UI/GtPackageCoderPackageNameId.class.st b/src/GToolkit-Coder-UI/GtPackageCoderPackageNameId.class.st index a8fd5fd30..6abcfb05e 100644 --- a/src/GToolkit-Coder-UI/GtPackageCoderPackageNameId.class.st +++ b/src/GToolkit-Coder-UI/GtPackageCoderPackageNameId.class.st @@ -6,7 +6,7 @@ An editable label with package name Class { #name : #GtPackageCoderPackageNameId, #superclass : #GtCoderElementId, - #category : 'GToolkit-Coder-UI-Coder - Basic' + #category : #'GToolkit-Coder-UI-Coder - Ids' } { #category : #converting } diff --git a/src/GToolkit-Coder-UI/GtPharoFilteredStreamingMethodsCoder.extension.st b/src/GToolkit-Coder-UI/GtPharoFilteredStreamingMethodsCoder.extension.st new file mode 100644 index 000000000..497e4e1f4 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtPharoFilteredStreamingMethodsCoder.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #GtPharoFilteredStreamingMethodsCoder } + +{ #category : #'*GToolkit-Coder-UI' } +GtPharoFilteredStreamingMethodsCoder >> asCoderUIModel [ + ^ GtPharoFilteredStreamingMethodsCoderViewModel new codersModel: self +] diff --git a/src/GToolkit-Coder-UI/GtRefactoringsPreviewAcceptId.class.st b/src/GToolkit-Coder-UI/GtRefactoringsPreviewAcceptId.class.st index 59d8faa1d..036a9b650 100644 --- a/src/GToolkit-Coder-UI/GtRefactoringsPreviewAcceptId.class.st +++ b/src/GToolkit-Coder-UI/GtRefactoringsPreviewAcceptId.class.st @@ -6,7 +6,7 @@ A button to apply refactorings from a preview dropdown Class { #name : #GtRefactoringsPreviewAcceptId, #superclass : #GtCoderElementId, - #category : 'GToolkit-Coder-UI-Coder - Basic' + #category : #'GToolkit-Coder-UI-Coder - Ids' } { #category : #converting } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedAddOnsId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedAddOnsId.class.st index 5b2858d0a..ee4c46818 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedAddOnsId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedAddOnsId.class.st @@ -1,7 +1,7 @@ Class { #name : #GtSourceCoderCollapsedAddOnsId, #superclass : #GtCoderElementId, - #category : #'GToolkit-Coder-UI-Coder - Basic' + #category : #'GToolkit-Coder-UI-Coder - Ids' } { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextId.class.st index 787a7450e..1c8a1e80e 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedTextId.class.st @@ -6,7 +6,7 @@ A label that shows a collapsed text of the source coder Class { #name : #GtSourceCoderCollapsedTextId, #superclass : #GtCoderElementId, - #category : 'GToolkit-Coder-UI-Coder - Basic' + #category : #'GToolkit-Coder-UI-Coder - Ids' } { #category : #converting } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDebugActionId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDebugActionId.class.st index 0792ab00a..09f7cfd63 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderDebugActionId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderDebugActionId.class.st @@ -6,7 +6,7 @@ A button to debug a piece of code Class { #name : #GtSourceCoderDebugActionId, #superclass : #GtCoderElementId, - #category : 'GToolkit-Coder-UI-Coder - Basic' + #category : #'GToolkit-Coder-UI-Coder - Ids' } { #category : #converting } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDoItActionId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDoItActionId.class.st index 88cf554d0..bf48c822d 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderDoItActionId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderDoItActionId.class.st @@ -6,7 +6,7 @@ A button to evaluate a source code Class { #name : #GtSourceCoderDoItActionId, #superclass : #GtCoderElementId, - #category : 'GToolkit-Coder-UI-Coder - Basic' + #category : #'GToolkit-Coder-UI-Coder - Ids' } { #category : #converting } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDoItAndGoActionId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDoItAndGoActionId.class.st index d1fcc813a..246afd151 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderDoItAndGoActionId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderDoItAndGoActionId.class.st @@ -6,7 +6,7 @@ A button to evaluate and inspect the result Class { #name : #GtSourceCoderDoItAndGoActionId, #superclass : #GtCoderElementId, - #category : 'GToolkit-Coder-UI-Coder - Basic' + #category : #'GToolkit-Coder-UI-Coder - Ids' } { #category : #converting } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEditorId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEditorId.class.st index 0e760ac55..5568befb4 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEditorId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEditorId.class.st @@ -6,7 +6,7 @@ Text editor within the source coder Class { #name : #GtSourceCoderEditorId, #superclass : #GtCoderElementId, - #category : #'GToolkit-Coder-UI-Coder - Basic' + #category : #'GToolkit-Coder-UI-Coder - Ids' } { #category : #converting } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEmbeddedExpanderToggleId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEmbeddedExpanderToggleId.class.st index 33398803a..d7c06d0ef 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEmbeddedExpanderToggleId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEmbeddedExpanderToggleId.class.st @@ -4,7 +4,7 @@ An element to toggle an embedded expandable element within the text of the sourc Class { #name : #GtSourceCoderEmbeddedExpanderToggleId, #superclass : #GtCoderElementId, - #category : 'GToolkit-Coder-UI-Coder - Basic' + #category : #'GToolkit-Coder-UI-Coder - Ids' } { #category : #converting } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpanderToggleId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpanderToggleId.class.st index 91f6e0159..17ea6be93 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExpanderToggleId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpanderToggleId.class.st @@ -5,7 +5,7 @@ Do not confuse with an embedded expander within the text which is usually repres Class { #name : #GtSourceCoderExpanderToggleId, #superclass : #GtCoderElementId, - #category : 'GToolkit-Coder-UI-Coder - Basic' + #category : #'GToolkit-Coder-UI-Coder - Ids' } { #category : #converting } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExtractTempVarContextMenuItemId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExtractTempVarContextMenuItemId.class.st index 9a0862a06..cba04ee9b 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExtractTempVarContextMenuItemId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExtractTempVarContextMenuItemId.class.st @@ -4,7 +4,7 @@ A context menu action to extract a temporary variable Class { #name : #GtSourceCoderExtractTempVarContextMenuItemId, #superclass : #GtCoderElementId, - #category : 'GToolkit-Coder-UI-Coder - Basic' + #category : #'GToolkit-Coder-UI-Coder - Ids' } { #category : #converting } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderProfileActionId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderProfileActionId.class.st index b58273d60..37e8d2ce8 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderProfileActionId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderProfileActionId.class.st @@ -6,7 +6,7 @@ A button to profile a piece of code Class { #name : #GtSourceCoderProfileActionId, #superclass : #GtCoderElementId, - #category : 'GToolkit-Coder-UI-Coder - Basic' + #category : #'GToolkit-Coder-UI-Coder - Ids' } { #category : #converting } diff --git a/src/GToolkit-Coder-UI/GtStreamingCodersChanged.class.st b/src/GToolkit-Coder-UI/GtStreamingCodersChanged.class.st new file mode 100644 index 000000000..fe0dd2ace --- /dev/null +++ b/src/GToolkit-Coder-UI/GtStreamingCodersChanged.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtStreamingCodersChanged, + #superclass : #Announcement, + #category : #'GToolkit-Coder-UI-Coder - Basic' +} diff --git a/src/GToolkit-Coder-UI/GtStreamingCodersViewModel.class.st b/src/GToolkit-Coder-UI/GtStreamingCodersViewModel.class.st new file mode 100644 index 000000000..7a38651be --- /dev/null +++ b/src/GToolkit-Coder-UI/GtStreamingCodersViewModel.class.st @@ -0,0 +1,142 @@ +Class { + #name : #GtStreamingCodersViewModel, + #superclass : #Object, + #traits : 'TGtWithCodersModel', + #classTraits : 'TGtWithCodersModel classTrait', + #instVars : [ + 'announcer', + 'monitor', + 'coderViewModels', + 'pendingCommands' + ], + #category : #'GToolkit-Coder-UI-Coder - Basic' +} + +{ #category : #'api - commands' } +GtStreamingCodersViewModel >> addNewCoder: aCoderModel [ + | aCoderViewModel | + + codersModel addNewCoder: aCoderModel. + aCoderViewModel := self privateFetchCoderViewModelFor: aCoderModel. + aCoderViewModel expand; focused: true. + + ^ aCoderViewModel +] + +{ #category : #'api - announcer' } +GtStreamingCodersViewModel >> announce: anAnnouncement [ + >#announceTemplate'> + announcer ifNotNil: [ :anAnnouncer | anAnnouncer announce: anAnnouncement ]. +] + +{ #category : #'api - accessing' } +GtStreamingCodersViewModel >> coderViewModelsStream [ + ^ codersModel codersStream asyncSimilarCopy + map: [ :eachCoder | self privateFetchCoderViewModelFor: eachCoder ] +] + +{ #category : #'api - commands' } +GtStreamingCodersViewModel >> enqueueCommand: aViewModelCommand [ + monitor critical: [ + | theApplicableCoderViewModels | + + theApplicableCoderViewModels := OrderedCollection new. + + coderViewModels valuesDo: [ :eachCoderViewModel | + (aViewModelCommand applicableTo: eachCoderViewModel) + ifTrue: [ theApplicableCoderViewModels add: eachCoderViewModel ] ]. + + theApplicableCoderViewModels + ifEmpty: [ pendingCommands add: aViewModelCommand ] + ifNotEmpty: [ theApplicableCoderViewModels do: [ :eachCoderViewModel | aViewModelCommand applyOn: eachCoderViewModel ] ] ] +] + +{ #category : #initialization } +GtStreamingCodersViewModel >> initialize [ + super initialize. + + monitor := Monitor new. + coderViewModels := Dictionary new. + pendingCommands := OrderedCollection new +] + +{ #category : #'instance creation' } +GtStreamingCodersViewModel >> newCoderViewModelFor: aCoderModel [ + ^ aCoderModel asCoderViewModel +] + +{ #category : #'private - event handling' } +GtStreamingCodersViewModel >> onCoderAdded: anAnnouncement [ + self privateFetchCoderViewModelFor: anAnnouncement coder. + self announce: GtStreamingCodersChanged new +] + +{ #category : #private } +GtStreamingCodersViewModel >> privateFetchCoderViewModelFor: aCoderModel [ + ^ monitor critical: [ + coderViewModels + at: aCoderModel + ifAbsentPut: [ + | aCoderViewModel theApplicableCommands | + aCoderViewModel := self newCoderViewModelFor: aCoderModel. + + theApplicableCommands := pendingCommands select: [ :eachCommand | eachCommand applicableTo: aCoderViewModel ]. + pendingCommands removeAll: theApplicableCommands. + theApplicableCommands do: [ :eachCommand | eachCommand applyOn: aCoderViewModel ]. + + aCoderViewModel ] ] +] + +{ #category : #'api - coders model' } +GtStreamingCodersViewModel >> subscribeToCodersModel [ + "Is sent after a new codersModel is assigned to the receiver. + It is required to unsubscribe from the previously subscribed objects by implementing + #unsubscribeFromCodersModel if the receiver subscribes to them" + + >#subscribeToObjectTemplate'> + + codersModel weak + when: GtCodersCoderAdded + send: #onCoderAdded: + to: self +] + +{ #category : #'api - announcer' } +GtStreamingCodersViewModel >> unsubscribe: anObject [ + "Unsubscribe all subscriptions of anObject from the receiver" + + >#unsubscribeTemplate'> + ^ announcer ifNotNil: [ :anAnnouncer | anAnnouncer unsubscribe: anObject ] +] + +{ #category : #'api - coders model' } +GtStreamingCodersViewModel >> unsubscribeFromCodersModel [ + "Is sent before a new codersModel is assigned to the receiver. + Objects that subscribe to codersModel are required to implement this method." + + >#unsubscribeFromObjectTemplate'> + + codersModel unsubscribe: self +] + +{ #category : #'api - announcer' } +GtStreamingCodersViewModel >> when: anAnnouncementClass do: aBlock [ + >#whenDoTemplate'> + ^ (announcer ifNil: [ announcer := Announcer new ]) + when: anAnnouncementClass do: aBlock +] + +{ #category : #'api - announcer' } +GtStreamingCodersViewModel >> when: anAnnouncementClass do: aBlock for: aSubscriber [ + >#whenDoForTemplate'> + ^ (self when: anAnnouncementClass do: aBlock) + subscriber: aSubscriber; + yourself +] + +{ #category : #'api - announcer' } +GtStreamingCodersViewModel >> when: anAnnouncementClass send: aSelector to: anObject [ + >#whenSendToTemplate'> + ^ (announcer ifNil: [ announcer := Announcer new ]) weak + when: anAnnouncementClass send: aSelector to: anObject +] diff --git a/src/GToolkit-Coder-UI/GtStreamingCodersViewModelCommand.class.st b/src/GToolkit-Coder-UI/GtStreamingCodersViewModelCommand.class.st new file mode 100644 index 000000000..71923bc62 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtStreamingCodersViewModelCommand.class.st @@ -0,0 +1,15 @@ +Class { + #name : #GtStreamingCodersViewModelCommand, + #superclass : #Object, + #category : #'GToolkit-Coder-UI-Coder - Basic' +} + +{ #category : #'api - testing' } +GtStreamingCodersViewModelCommand >> applicableTo: aCoderViewModel [ + ^ false +] + +{ #category : #'api - testing' } +GtStreamingCodersViewModelCommand >> applyOn: aCoderViewModel [ + +] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderCopyContextMenuItemId.class.st b/src/GToolkit-Coder-UI/GtTextualCoderCopyContextMenuItemId.class.st index b06a40fcb..ec64e95df 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderCopyContextMenuItemId.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderCopyContextMenuItemId.class.st @@ -6,7 +6,7 @@ A context menu action to copy a text Class { #name : #GtTextualCoderCopyContextMenuItemId, #superclass : #GtCoderElementId, - #category : 'GToolkit-Coder-UI-Coder - Basic' + #category : #'GToolkit-Coder-UI-Coder - Ids' } { #category : #converting } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderCutContextMenuItemId.class.st b/src/GToolkit-Coder-UI/GtTextualCoderCutContextMenuItemId.class.st index c1c6e896a..3fa3fb43d 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderCutContextMenuItemId.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderCutContextMenuItemId.class.st @@ -6,7 +6,7 @@ A context menu action to cut text Class { #name : #GtTextualCoderCutContextMenuItemId, #superclass : #GtCoderElementId, - #category : 'GToolkit-Coder-UI-Coder - Basic' + #category : #'GToolkit-Coder-UI-Coder - Ids' } { #category : #converting } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderPasteContextMenuItemId.class.st b/src/GToolkit-Coder-UI/GtTextualCoderPasteContextMenuItemId.class.st index 76d2c5631..7bfe3a349 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderPasteContextMenuItemId.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderPasteContextMenuItemId.class.st @@ -6,7 +6,7 @@ A context menu action to paste a text Class { #name : #GtTextualCoderPasteContextMenuItemId, #superclass : #GtCoderElementId, - #category : 'GToolkit-Coder-UI-Coder - Basic' + #category : #'GToolkit-Coder-UI-Coder - Ids' } { #category : #converting } diff --git a/src/GToolkit-Coder-UI/TGtWithCoderModel.trait.st b/src/GToolkit-Coder/TGtWithCoderModel.trait.st similarity index 97% rename from src/GToolkit-Coder-UI/TGtWithCoderModel.trait.st rename to src/GToolkit-Coder/TGtWithCoderModel.trait.st index 0f6494a9d..c54bb8907 100644 --- a/src/GToolkit-Coder-UI/TGtWithCoderModel.trait.st +++ b/src/GToolkit-Coder/TGtWithCoderModel.trait.st @@ -3,7 +3,7 @@ Trait { #instVars : [ 'coderModel' ], - #category : 'GToolkit-Coder-UI-Coder - Basic' + #category : #'GToolkit-Coder-Coders' } { #category : #'api - coder model' } diff --git a/src/GToolkit-Coder/TGtWithCodersModel.trait.st b/src/GToolkit-Coder/TGtWithCodersModel.trait.st new file mode 100644 index 000000000..7eb1f06f2 --- /dev/null +++ b/src/GToolkit-Coder/TGtWithCodersModel.trait.st @@ -0,0 +1,84 @@ +Trait { + #name : #TGtWithCodersModel, + #instVars : [ + 'codersModel' + ], + #category : #'GToolkit-Coder-Coders' +} + +{ #category : #'api - coders model' } +TGtWithCodersModel >> codersModel [ + "Return a not-null codersModel assigned to the receiver" + + >#objectGetterTemplate'> + self + assert: [ codersModel notNil ] + description: [ 'codersModel should be initialized' ]. + + ^ codersModel +] + +{ #category : #'api - coders model' } +TGtWithCodersModel >> codersModel: aCodersModel [ + "Set a not-null codersModel assigned to the receiver" + + >#objectSetterTemplate'> + self + assert: [ aCodersModel notNil ] + description: [ 'codersModel must not be nil' ]. + + codersModel == aCodersModel + ifTrue: [ ^ self ]. + + codersModel ifNotNil: [ self unsubscribeFromCodersModel ]. + codersModel := aCodersModel. + + self onCodersModelChanged. + self subscribeToCodersModel. + self onPostCodersModelChanged +] + +{ #category : #'api - coders model' } +TGtWithCodersModel >> hasCodersModel [ + "Return a true if nil is assigned to the receiver, false otherwise" + + + >#hasObjectTemplate'> + + ^ codersModel notNil +] + +{ #category : #'api - coders model' } +TGtWithCodersModel >> onCodersModelChanged [ + "Is sent when a new codersModel is assigned to the receiver. + Note: #onCodersModelChanged is sent before #subscribeToCodersModel + which means that if you perform any operation that triggers an announcement it will be ignored because the receiver + didn't get a chance to subscribe to any announcement. Override #onPostCodersModelChanged if you + wish to perform an operation that requires an announcement, but keep in mind that this is not the most efficient way" + >#onObjectChangedTemplate'> +] + +{ #category : #'api - coders model' } +TGtWithCodersModel >> onPostCodersModelChanged [ + "I am an optional hook method that is sent after #subscribeToCodersModel. + I do nothing by default but allow users to perform update operations when a receiver object is already + subscribed to announcements." + >#onPostObjectChangedTemplate'> +] + +{ #category : #'api - coders model' } +TGtWithCodersModel >> subscribeToCodersModel [ + "Is sent after a new codersModel is assigned to the receiver. + It is required to unsubscribe from the previously subscribed objects by implementing + #unsubscribeFromCodersModel if the receiver subscribes to them" + + >#subscribeToObjectTemplate'> +] + +{ #category : #'api - coders model' } +TGtWithCodersModel >> unsubscribeFromCodersModel [ + "Is sent before a new codersModel is assigned to the receiver. + Objects that subscribe to codersModel are required to implement this method." + + >#unsubscribeFromObjectTemplate'> +] From 14f62b2af434e8c5fcd6cdda1a387166041d98cc Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 18 Nov 2021 10:56:35 -0300 Subject: [PATCH 0093/1268] remove `GtPhlowUpdateRequester` users [feenkcom/gtoolkit#2226] --- ...SourceCoderEvaluationResultDisplayer.class.st | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEvaluationResultDisplayer.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEvaluationResultDisplayer.class.st index d008f37fa..fe3664a70 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEvaluationResultDisplayer.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEvaluationResultDisplayer.class.st @@ -3,11 +3,11 @@ Class { #superclass : #Object, #instVars : [ 'editorElement', - 'updateRequester', 'evaluationResult', - 'evaluationAttributes' + 'evaluationAttributes', + 'updater' ], - #category : 'GToolkit-Coder-UI-Coder - Source' + #category : #'GToolkit-Coder-UI-Coder - Source' } { #category : #private } @@ -24,7 +24,7 @@ GtSourceCoderEvaluationResultDisplayer >> displayResult: anEvaluationResult [ evaluationResult = anEvaluationResult ifTrue: [ ^ self ]. evaluationResult := anEvaluationResult. - updateRequester requestUpdate + updater requestUpdate ] { #category : #'api - evaluation result' } @@ -47,7 +47,7 @@ GtSourceCoderEvaluationResultDisplayer >> editorElement [ { #category : #accessing } GtSourceCoderEvaluationResultDisplayer >> editorElement: anObject [ editorElement := anObject. - updateRequester element: editorElement + updater element: editorElement ] { #category : #accessing } @@ -60,7 +60,7 @@ GtSourceCoderEvaluationResultDisplayer >> hideResult [ evaluationResult ifNil: [ ^ self ]. evaluationResult := nil. - updateRequester requestUpdate + updater requestUpdate ] { #category : #'api - evaluation result' } @@ -78,8 +78,8 @@ GtSourceCoderEvaluationResultDisplayer >> initialize [ editorElement := nil. evaluationResult := nil. - updateRequester := GtPhlowUpdateRequester new. - updateRequester action: [ self primitiveUpdateResult ]. + updater := BrElementUpdater new. + updater action: [ self primitiveUpdateResult ]. evaluationAttributes := #() ] From fdf17f7ef0dd37e286c136157d9f16fc4a6a6870 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 18 Nov 2021 22:58:12 +0100 Subject: [PATCH 0094/1268] refactor streaming and filtered coders model --- .../GtMethodCoderSaved.class.st | 20 +++++ ...FilteredStreamingMethodsCoder.extension.st | 6 -- .../GtSearchBinaryFilter.extension.st | 2 +- .../GtSearchFilter.extension.st | 18 +++++ .../GtStreamingCodersViewModel.class.st | 29 +++---- ...tStreamingCodersViewModelChanged.class.st} | 2 +- .../GtFilteredCodersModel.class.st | 56 +++++++++++++ .../GtSearchBinaryFilter.class.st | 20 ----- src/GToolkit-Coder/GtSearchFilter.class.st | 23 ------ .../GtSearchFilter.extension.st | 19 ----- .../GtStreamingCodersModel.class.st | 81 +++++++++++++++++++ .../GtSearchBinaryFilter.class.st | 2 +- .../GtSearchFilter.class.st | 2 +- 13 files changed, 192 insertions(+), 88 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtMethodCoderSaved.class.st delete mode 100644 src/GToolkit-Coder-UI/GtPharoFilteredStreamingMethodsCoder.extension.st rename src/{GToolkit-Coder => GToolkit-Coder-UI}/GtSearchBinaryFilter.extension.st (88%) rename src/GToolkit-Coder-UI/{GtStreamingCodersChanged.class.st => GtStreamingCodersViewModelChanged.class.st} (66%) create mode 100644 src/GToolkit-Coder/GtFilteredCodersModel.class.st delete mode 100644 src/GToolkit-Coder/GtSearchBinaryFilter.class.st delete mode 100644 src/GToolkit-Coder/GtSearchFilter.class.st delete mode 100644 src/GToolkit-Coder/GtSearchFilter.extension.st create mode 100644 src/GToolkit-Coder/GtStreamingCodersModel.class.st diff --git a/src/GToolkit-Coder-UI/GtMethodCoderSaved.class.st b/src/GToolkit-Coder-UI/GtMethodCoderSaved.class.st new file mode 100644 index 000000000..9f0635de6 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtMethodCoderSaved.class.st @@ -0,0 +1,20 @@ +Class { + #name : #GtMethodCoderSaved, + #superclass : #GtTextualCoderViewModelAnnouncement, + #instVars : [ + 'method' + ], + #category : #'GToolkit-Coder-UI-Coder - Method Events' +} + +{ #category : #accessing } +GtMethodCoderSaved >> method [ + + ^ method +] + +{ #category : #accessing } +GtMethodCoderSaved >> method: anObject [ + + method := anObject +] diff --git a/src/GToolkit-Coder-UI/GtPharoFilteredStreamingMethodsCoder.extension.st b/src/GToolkit-Coder-UI/GtPharoFilteredStreamingMethodsCoder.extension.st deleted file mode 100644 index 497e4e1f4..000000000 --- a/src/GToolkit-Coder-UI/GtPharoFilteredStreamingMethodsCoder.extension.st +++ /dev/null @@ -1,6 +0,0 @@ -Extension { #name : #GtPharoFilteredStreamingMethodsCoder } - -{ #category : #'*GToolkit-Coder-UI' } -GtPharoFilteredStreamingMethodsCoder >> asCoderUIModel [ - ^ GtPharoFilteredStreamingMethodsCoderViewModel new codersModel: self -] diff --git a/src/GToolkit-Coder/GtSearchBinaryFilter.extension.st b/src/GToolkit-Coder-UI/GtSearchBinaryFilter.extension.st similarity index 88% rename from src/GToolkit-Coder/GtSearchBinaryFilter.extension.st rename to src/GToolkit-Coder-UI/GtSearchBinaryFilter.extension.st index 2d6da1a29..790873798 100644 --- a/src/GToolkit-Coder/GtSearchBinaryFilter.extension.st +++ b/src/GToolkit-Coder-UI/GtSearchBinaryFilter.extension.st @@ -1,6 +1,6 @@ Extension { #name : #GtSearchBinaryFilter } -{ #category : #'*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder-UI' } GtSearchBinaryFilter >> highlighter [ ^ left highlighter ifNil: [ right highlighter ] diff --git a/src/GToolkit-Coder-UI/GtSearchFilter.extension.st b/src/GToolkit-Coder-UI/GtSearchFilter.extension.st index d99058f8e..0608a1487 100644 --- a/src/GToolkit-Coder-UI/GtSearchFilter.extension.st +++ b/src/GToolkit-Coder-UI/GtSearchFilter.extension.st @@ -1,6 +1,24 @@ Extension { #name : #GtSearchFilter } +{ #category : #'*GToolkit-Coder-UI' } +GtSearchFilter >> asCoder [ + ^ self result asCoder +] + { #category : #'*GToolkit-Coder-UI' } GtSearchFilter >> asElement [ ^ self asCoder asElement ] + +{ #category : #'*GToolkit-Coder-UI' } +GtSearchFilter >> gtExamples [ + | examples | + examples := OrderedCollection new. + self result do: [ :each | examples addAll: each gtExamples ]. + ^ GtExampleGroup withAll: examples +] + +{ #category : #'*GToolkit-Coder-UI' } +GtSearchFilter >> highlighter [ + ^ nil +] diff --git a/src/GToolkit-Coder-UI/GtStreamingCodersViewModel.class.st b/src/GToolkit-Coder-UI/GtStreamingCodersViewModel.class.st index 7a38651be..ef1a2f7a0 100644 --- a/src/GToolkit-Coder-UI/GtStreamingCodersViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtStreamingCodersViewModel.class.st @@ -12,17 +12,6 @@ Class { #category : #'GToolkit-Coder-UI-Coder - Basic' } -{ #category : #'api - commands' } -GtStreamingCodersViewModel >> addNewCoder: aCoderModel [ - | aCoderViewModel | - - codersModel addNewCoder: aCoderModel. - aCoderViewModel := self privateFetchCoderViewModelFor: aCoderModel. - aCoderViewModel expand; focused: true. - - ^ aCoderViewModel -] - { #category : #'api - announcer' } GtStreamingCodersViewModel >> announce: anAnnouncement [ >#announceTemplate'> @@ -31,7 +20,7 @@ GtStreamingCodersViewModel >> announce: anAnnouncement [ { #category : #'api - accessing' } GtStreamingCodersViewModel >> coderViewModelsStream [ - ^ codersModel codersStream asyncSimilarCopy + ^ codersModel asAsyncStream map: [ :eachCoder | self privateFetchCoderViewModelFor: eachCoder ] ] @@ -68,7 +57,12 @@ GtStreamingCodersViewModel >> newCoderViewModelFor: aCoderModel [ { #category : #'private - event handling' } GtStreamingCodersViewModel >> onCoderAdded: anAnnouncement [ self privateFetchCoderViewModelFor: anAnnouncement coder. - self announce: GtStreamingCodersChanged new + self announce: GtStreamingCodersViewModelChanged new +] + +{ #category : #'private - event handling' } +GtStreamingCodersViewModel >> onCodersChanged: anAnnouncement [ + self announce: GtStreamingCodersViewModelChanged new ] { #category : #private } @@ -95,10 +89,13 @@ GtStreamingCodersViewModel >> subscribeToCodersModel [ >#subscribeToObjectTemplate'> - codersModel weak + codersModel when: GtCodersCoderAdded - send: #onCoderAdded: - to: self + send: #onCoderAdded: + to: self; + when: GtCodersCodersChanged + send: #onCodersChanged: + to: self ] { #category : #'api - announcer' } diff --git a/src/GToolkit-Coder-UI/GtStreamingCodersChanged.class.st b/src/GToolkit-Coder-UI/GtStreamingCodersViewModelChanged.class.st similarity index 66% rename from src/GToolkit-Coder-UI/GtStreamingCodersChanged.class.st rename to src/GToolkit-Coder-UI/GtStreamingCodersViewModelChanged.class.st index fe0dd2ace..93c818492 100644 --- a/src/GToolkit-Coder-UI/GtStreamingCodersChanged.class.st +++ b/src/GToolkit-Coder-UI/GtStreamingCodersViewModelChanged.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtStreamingCodersChanged, + #name : #GtStreamingCodersViewModelChanged, #superclass : #Announcement, #category : #'GToolkit-Coder-UI-Coder - Basic' } diff --git a/src/GToolkit-Coder/GtFilteredCodersModel.class.st b/src/GToolkit-Coder/GtFilteredCodersModel.class.st new file mode 100644 index 000000000..dff5e4367 --- /dev/null +++ b/src/GToolkit-Coder/GtFilteredCodersModel.class.st @@ -0,0 +1,56 @@ +Class { + #name : #GtFilteredCodersModel, + #superclass : #GtStreamingCodersModel, + #instVars : [ + 'filter', + 'additionalFilters' + ], + #category : #'GToolkit-Coder-Coders' +} + +{ #category : #'instance creation' } +GtFilteredCodersModel class >> forFilter: aGtSearchFilter [ + ^ self new filter: aGtSearchFilter +] + +{ #category : #'api - accessing' } +GtFilteredCodersModel >> additionalFilters: aCollectionOfFilters [ + monitor critical: [ + additionalFilters := aCollectionOfFilters asArray. + self notifyChanged ] +] + +{ #category : #'api - converting' } +GtFilteredCodersModel >> asAsyncStream [ + + | aCompositeFilter | + + aCompositeFilter := additionalFilters + inject: nil + into: [ :sum :each | sum ifNil: [ each ] ifNotNil: [ sum | each ] ]. + + aCompositeFilter := aCompositeFilter + ifNil: [ filter ] + ifNotNil: [ filter & aCompositeFilter ]. + + ^ aCompositeFilter asAsyncStream map: [ :eachItem | self privateFetchCoderFor: eachItem ] +] + +{ #category : #'api - accessing' } +GtFilteredCodersModel >> filter [ + ^ filter +] + +{ #category : #'api - accessing' } +GtFilteredCodersModel >> filter: aGtSearchFilter [ + monitor critical: [ + filter := aGtSearchFilter. + self notifyChanged ] +] + +{ #category : #initialization } +GtFilteredCodersModel >> initialize [ + super initialize. + + additionalFilters := #() +] diff --git a/src/GToolkit-Coder/GtSearchBinaryFilter.class.st b/src/GToolkit-Coder/GtSearchBinaryFilter.class.st deleted file mode 100644 index a294d1c68..000000000 --- a/src/GToolkit-Coder/GtSearchBinaryFilter.class.st +++ /dev/null @@ -1,20 +0,0 @@ -Class { - #name : #GtSearchBinaryFilter, - #superclass : #GtSearchFilter, - #instVars : [ - 'left', - 'right' - ], - #category : 'GToolkit-Coder-Filters' -} - -{ #category : #'*GToolkit-Coder' } -GtSearchBinaryFilter >> highlighter [ - ^ left highlighter - ifNil: [ right highlighter ] - ifNotNil: [ :lh | - right highlighter - ifNil: [ lh ] - ifNotNil: - [ :rh | GtCompositeHighlighter forHighlighters: (Array with: lh with: rh) ] ] -] diff --git a/src/GToolkit-Coder/GtSearchFilter.class.st b/src/GToolkit-Coder/GtSearchFilter.class.st deleted file mode 100644 index 72ee3ec64..000000000 --- a/src/GToolkit-Coder/GtSearchFilter.class.st +++ /dev/null @@ -1,23 +0,0 @@ -Class { - #name : #GtSearchFilter, - #superclass : #Object, - #category : 'GToolkit-Coder-Filters' -} - -{ #category : #'*GToolkit-Coder' } -GtSearchFilter >> asCoder [ - ^ self result asCoder -] - -{ #category : #'*GToolkit-Coder' } -GtSearchFilter >> gtExamples [ - | examples | - examples := OrderedCollection new. - self result do: [ :each | examples addAll: each gtExamples ]. - ^ GtExampleGroup withAll: examples -] - -{ #category : #'*GToolkit-Coder' } -GtSearchFilter >> highlighter [ - ^ nil -] diff --git a/src/GToolkit-Coder/GtSearchFilter.extension.st b/src/GToolkit-Coder/GtSearchFilter.extension.st deleted file mode 100644 index 369c2fc18..000000000 --- a/src/GToolkit-Coder/GtSearchFilter.extension.st +++ /dev/null @@ -1,19 +0,0 @@ -Extension { #name : #GtSearchFilter } - -{ #category : #'*GToolkit-Coder' } -GtSearchFilter >> asCoder [ - ^ self result asCoder -] - -{ #category : #'*GToolkit-Coder' } -GtSearchFilter >> gtExamples [ - | examples | - examples := OrderedCollection new. - self result do: [ :each | examples addAll: each gtExamples ]. - ^ GtExampleGroup withAll: examples -] - -{ #category : #'*GToolkit-Coder' } -GtSearchFilter >> highlighter [ - ^ nil -] diff --git a/src/GToolkit-Coder/GtStreamingCodersModel.class.st b/src/GToolkit-Coder/GtStreamingCodersModel.class.st new file mode 100644 index 000000000..986e309a0 --- /dev/null +++ b/src/GToolkit-Coder/GtStreamingCodersModel.class.st @@ -0,0 +1,81 @@ +Class { + #name : #GtStreamingCodersModel, + #superclass : #Object, + #traits : 'TGtOptions', + #classTraits : 'TGtOptions classTrait', + #instVars : [ + 'announcer', + 'monitor', + 'coders' + ], + #category : #'GToolkit-Coder-Coders' +} + +{ #category : #'api - announcer' } +GtStreamingCodersModel >> announce: anAnnouncement [ + >#announceTemplate'> + announcer ifNotNil: [ :anAnnouncer | anAnnouncer announce: anAnnouncement ]. +] + +{ #category : #'api - converting' } +GtStreamingCodersModel >> asAsyncStream [ + + + ^ self subclassResponsibility +] + +{ #category : #initialization } +GtStreamingCodersModel >> initialize [ + super initialize. + + monitor := Monitor new. + coders := Dictionary new +] + +{ #category : #'private - instance creation' } +GtStreamingCodersModel >> newCoderFor: anObject [ + ^ self subclassResponsibility +] + +{ #category : #'private - notifying' } +GtStreamingCodersModel >> notifyChanged [ + self announce: (GtCodersCodersChanged new coders: self) +] + +{ #category : #'private - instance creation' } +GtStreamingCodersModel >> privateFetchCoderFor: anObject [ + ^ monitor critical: [ + coders + at: anObject + ifAbsentPut: [ self newCoderFor: anObject ] ] +] + +{ #category : #'api - announcer' } +GtStreamingCodersModel >> unsubscribe: anObject [ + "Unsubscribe all subscriptions of anObject from the receiver" + + >#unsubscribeTemplate'> + ^ announcer ifNotNil: [ :anAnnouncer | anAnnouncer unsubscribe: anObject ] +] + +{ #category : #'api - announcer' } +GtStreamingCodersModel >> when: anAnnouncementClass do: aBlock [ + >#whenDoTemplate'> + ^ (announcer ifNil: [ announcer := Announcer new ]) + when: anAnnouncementClass do: aBlock +] + +{ #category : #'api - announcer' } +GtStreamingCodersModel >> when: anAnnouncementClass do: aBlock for: aSubscriber [ + >#whenDoForTemplate'> + ^ (self when: anAnnouncementClass do: aBlock) + subscriber: aSubscriber; + yourself +] + +{ #category : #'api - announcer' } +GtStreamingCodersModel >> when: anAnnouncementClass send: aSelector to: anObject [ + >#whenSendToTemplate'> + ^ (announcer ifNil: [ announcer := Announcer new ]) weak + when: anAnnouncementClass send: aSelector to: anObject +] diff --git a/src/GToolkit-SearchFilters/GtSearchBinaryFilter.class.st b/src/GToolkit-SearchFilters/GtSearchBinaryFilter.class.st index ec0e1bef6..cabb75984 100644 --- a/src/GToolkit-SearchFilters/GtSearchBinaryFilter.class.st +++ b/src/GToolkit-SearchFilters/GtSearchBinaryFilter.class.st @@ -5,7 +5,7 @@ Class { 'left', 'right' ], - #category : #'GToolkit-SearchFilters-Filters' + #category : #'GToolkit-SearchFilters' } { #category : #'instance creation' } diff --git a/src/GToolkit-SearchFilters/GtSearchFilter.class.st b/src/GToolkit-SearchFilters/GtSearchFilter.class.st index 01d0d160d..0c27ec341 100644 --- a/src/GToolkit-SearchFilters/GtSearchFilter.class.st +++ b/src/GToolkit-SearchFilters/GtSearchFilter.class.st @@ -1,7 +1,7 @@ Class { #name : #GtSearchFilter, #superclass : #Object, - #category : #'GToolkit-SearchFilters-Filters' + #category : #'GToolkit-SearchFilters' } { #category : #'logical operations' } From 1812923b25881449a7de1f37665cd70899465932 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Sat, 27 Nov 2021 12:54:23 +0100 Subject: [PATCH 0095/1268] [feenkcom/gtoolkit#2224] migrating to the stream based coder --- .../GtCoderExampleStateElement.class.st | 2 +- .../GtExpandableSourceCoderElement.class.st | 37 +-- .../GtFilterRunExampleButtonAptitude.class.st | 2 +- ...erRunExampleButtonTooltipAptitude.class.st | 10 +- .../GtSourceCoderContentElement.class.st | 4 +- .../GtCoderAstCompositeStyler.class.st | 8 +- src/GToolkit-Coder/GtCoderExampler.class.st | 211 ------------------ .../GtFilteredCodersModel.class.st | 26 ++- .../GtMethodsCoderExampler.class.st | 31 --- .../GtFilterExampleAllState.class.st | 30 --- .../GtFilterExampleErrorState.class.st | 39 ---- .../GtFilterExampleFailureState.class.st | 39 ---- .../GtFilterExampleNotExecutedState.class.st | 36 --- .../GtFilterExampleState.class.st | 96 -------- .../GtFilterExampleSuccessState.class.st | 39 ---- .../GtSearchFilter.class.st | 4 +- 16 files changed, 52 insertions(+), 562 deletions(-) delete mode 100644 src/GToolkit-Coder/GtCoderExampler.class.st delete mode 100644 src/GToolkit-Coder/GtMethodsCoderExampler.class.st delete mode 100644 src/GToolkit-SearchFilters/GtFilterExampleAllState.class.st delete mode 100644 src/GToolkit-SearchFilters/GtFilterExampleErrorState.class.st delete mode 100644 src/GToolkit-SearchFilters/GtFilterExampleFailureState.class.st delete mode 100644 src/GToolkit-SearchFilters/GtFilterExampleNotExecutedState.class.st delete mode 100644 src/GToolkit-SearchFilters/GtFilterExampleState.class.st delete mode 100644 src/GToolkit-SearchFilters/GtFilterExampleSuccessState.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st index 54fdcdeed..751e01911 100644 --- a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st @@ -69,7 +69,7 @@ GtCoderExampleStateElement >> exampleResult [ { #category : #'private - accessing' } GtCoderExampleStateElement >> exampleState [ - ^ GtFilterExampleState default stateFromExample: self example + ^ GtExampleState default stateFromExample: self example ] { #category : #'private - testing' } diff --git a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st index 684ed9e37..d46d25874 100644 --- a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st @@ -158,21 +158,9 @@ GtExpandableSourceCoderElement >> onTextualCoderViewModelChanged [ didn't get a chance to subscribe to any announcement. Override #onPostTextualCoderViewModelChanged if you wish to perform an operation that requires an announcement, but keep in mind that this is not the most efficient way" - textualCoderViewModel expanded - ifTrue: [ expandedElement - ifNotNil: [ :anElement | self assignExpandedCoder: textualCoderViewModel to: anElement ]. - collapsedElement - ifNotNil: [ :anElement | self markDirty: anElement as: true ] ] - ifFalse: [ collapsedElement - ifNotNil: - [ :anElement | self assignCollapsedCoder: textualCoderViewModel to: anElement ]. - expandedElement - ifNotNil: [ :anElement | self markDirty: anElement as: true ] ]. - - textualCoderViewModel focused - ifFalse: [ self loseFocus ]. - - self expanded: textualCoderViewModel expanded + BlFrameTelemetry + time: [ self class name, ' ', #onTextualCoderViewModelChanged ] + during: [ self updateElement ] ] { #category : #'private - event handling' } @@ -209,3 +197,22 @@ GtExpandableSourceCoderElement >> unsubscribeFromTextualCoderViewModel [ "textualCoderViewModel coder unsubscribeFromSystem." textualCoderViewModel unsubscribe: self ] + +{ #category : #'private - update' } +GtExpandableSourceCoderElement >> updateElement [ + textualCoderViewModel expanded + ifTrue: [ expandedElement + ifNotNil: [ :anElement | self assignExpandedCoder: textualCoderViewModel to: anElement ]. + collapsedElement + ifNotNil: [ :anElement | self markDirty: anElement as: true ] ] + ifFalse: [ collapsedElement + ifNotNil: + [ :anElement | self assignCollapsedCoder: textualCoderViewModel to: anElement ]. + expandedElement + ifNotNil: [ :anElement | self markDirty: anElement as: true ] ]. + + textualCoderViewModel focused + ifFalse: [ self loseFocus ]. + + self expanded: textualCoderViewModel expanded +] diff --git a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonAptitude.class.st b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonAptitude.class.st index 39ddc675b..9c90ae21c 100644 --- a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonAptitude.class.st @@ -53,7 +53,7 @@ GtFilterRunExampleButtonAptitude >> enqueueUpdate [ { #category : #'private - accessing' } GtFilterRunExampleButtonAptitude >> exampler [ - + ^ self coder exampler ] diff --git a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonTooltipAptitude.class.st b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonTooltipAptitude.class.st index 885ce0b9e..e7d323071 100644 --- a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonTooltipAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonTooltipAptitude.class.st @@ -4,7 +4,7 @@ Class { #instVars : [ 'tooltipContent' ], - #category : 'GToolkit-Coder-UI-Filters' + #category : #'GToolkit-Coder-UI-Filters' } { #category : #initialization } @@ -19,7 +19,7 @@ GtFilterRunExampleButtonTooltipAptitude >> initialize [ GtFilterRunExampleButtonTooltipAptitude >> initializeTooltipContent [ tooltipContent := BrColumnedList new. tooltipContent - items: GtFilterExampleState default allStates; + items: GtExampleState default allStates; padding: (BlInsets all: 10); fitContent. @@ -33,7 +33,7 @@ GtFilterRunExampleButtonTooltipAptitude >> initializeTooltipContent [ self coder setFilters: { - ((GtSearchExamplesFilter new + ((GtPharoExampleStateFilter new resultState: aSelectedObject) coder: self coder)} source: self @@ -80,7 +80,7 @@ GtFilterRunExampleButtonTooltipAptitude >> initializeTooltipContent [ { #category : #'private - accessing' } GtFilterRunExampleButtonTooltipAptitude >> listItems [ | states | - states := GtFilterExampleState default allStates. + states := GtExampleState default allStates. ^ states collect: [ :eachState | eachState labelWithAmountFor: self coder exampler ]. ] @@ -94,7 +94,7 @@ GtFilterRunExampleButtonTooltipAptitude >> tooltipContent [ { #category : #'private - updating' } GtFilterRunExampleButtonTooltipAptitude >> updateList [ | statusesToDisplay | - statusesToDisplay := GtFilterExampleState default allStates reject: [ :eachStatus | + statusesToDisplay := GtExampleState default allStates reject: [ :eachStatus | (eachStatus numberOfExamplesFor: self exampler) isZero ]. self tooltipContent diff --git a/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st index e2d87165d..7ebb846ca 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st @@ -38,8 +38,8 @@ GtSourceCoderContentElement >> coderUIModel [ { #category : #accessing } GtSourceCoderContentElement >> coderUIModel: aGtSourceCoderUIModel [ - self telemetry - timeSync: [ 'Assign coder to {1}' format: { self class name } ] + BlFrameTelemetry + time: [ 'Assign coder to {1}' format: { self class name } ] during: [ self textualCoderViewModel: aGtSourceCoderUIModel ] ] diff --git a/src/GToolkit-Coder/GtCoderAstCompositeStyler.class.st b/src/GToolkit-Coder/GtCoderAstCompositeStyler.class.st index 98d183fd0..9ef068d9c 100644 --- a/src/GToolkit-Coder/GtCoderAstCompositeStyler.class.st +++ b/src/GToolkit-Coder/GtCoderAstCompositeStyler.class.st @@ -4,14 +4,14 @@ Class { #instVars : [ 'stylers' ], - #category : 'GToolkit-Coder-Styler/Highlighter' + #category : #'GToolkit-Coder-Styler/Highlighter' } { #category : #'api - styling' } GtCoderAstCompositeStyler >> extraStyle: aText ast: theAst [ self stylers do: [ :eachStyler | BlTextStylerTelemetry - timeSync: [ 'Extra style using ', eachStyler class name ] + time: [ 'Extra style using ', eachStyler class name ] during: [ eachStyler extraStyle: aText ast: theAst ] ] ] @@ -20,12 +20,12 @@ GtCoderAstCompositeStyler >> style: aText ast: theAst [ self stylers do: [ :eachStyler | [ BlTextStylerTelemetry - timeSync: [ 'Style using ', eachStyler class name ] + time: [ 'Style using ', eachStyler class name ] during: [ eachStyler style: aText ast: theAst ] ] on: Error do: [ :anError | BlTextStylerTelemetry - timeSync: [ 'Handle an error in ', eachStyler class name ] + time: [ 'Handle an error in ', eachStyler class name ] during: [ anError emit. diff --git a/src/GToolkit-Coder/GtCoderExampler.class.st b/src/GToolkit-Coder/GtCoderExampler.class.st deleted file mode 100644 index 2fc91d105..000000000 --- a/src/GToolkit-Coder/GtCoderExampler.class.st +++ /dev/null @@ -1,211 +0,0 @@ -" -I am an example executor. -I am used by {{gtClass:GtCodersModel}}, see: {{gtMethod:Behavior>>#gtCoderMethodsFor:context:}} for a usage. - - -" -Class { - #name : #GtCoderExampler, - #superclass : #Object, - #instVars : [ - 'coder' - ], - #category : #'GToolkit-Coder-Exampler' -} - -{ #category : #'api - instance creation' } -GtCoderExampler class >> coder: aCoder [ - ^ self new coder: aCoder -] - -{ #category : #'api - enumeration' } -GtCoderExampler >> allExampleCodersDo: aBlock [ - "iterate all coders with examples" - self subclassResponsibility -] - -{ #category : #'api - accessing' } -GtCoderExampler >> allExampleStates [ - - | aSet | - aSet := Set new. - - self allExecutableExampleCodersDo: [ :aCoder :anExample | - | aState | - aState := GtFilterExampleState default stateFromExample: anExample. - aSet add: aState ]. - - ^ aSet -] - -{ #category : #'api - enumeration' } -GtCoderExampler >> allExecutableExampleCodersDo: aBlock [ - self allExampleCodersDo: [ :aCoder :anExample | - aCoder canExecuteExample ifTrue: [ - aBlock cull: aCoder cull: anExample ] ] -] - -{ #category : #'api - enumeration' } -GtCoderExampler >> allExecutableExampleCodersWithResultsDo: aBlock [ - self allExecutableExampleCodersDo: [ :aCoder :anExample | - aCoder exampleResult ifNotNil: [ :aResult | - aBlock cull: aCoder cull: anExample cull: aResult ] ] -] - -{ #category : #'api - accessing' } -GtCoderExampler >> coder [ - - ^ coder -] - -{ #category : #'api - initialization' } -GtCoderExampler >> coder: anObject [ - coder := anObject -] - -{ #category : #'api - accessing' } -GtCoderExampler >> coderFor: aCompiledMethod [ - - ^ self subclassResponsibility -] - -{ #category : #'api - testing' } -GtCoderExampler >> hasErrorExamples [ - - self allExecutableExampleCodersWithResultsDo: [ :eachCoder | - eachCoder exampleResult isError ifTrue: [ - ^ true ] ]. - ^ false -] - -{ #category : #'api - testing' } -GtCoderExampler >> hasExamples [ - self allExecutableExampleCodersDo: [ ^ true ]. - ^ false -] - -{ #category : #'api - testing' } -GtCoderExampler >> hasFailureExamples [ - - self allExecutableExampleCodersWithResultsDo: [ :eachCoder | - eachCoder exampleResult isFailure ifTrue: [ - ^ true ] ]. - ^ false -] - -{ #category : #'api - testing' } -GtCoderExampler >> hasNotExecutedExamples [ - - self allExecutableExampleCodersDo: [ :eachCoder | - eachCoder exampleResult ifNil: [ - ^ true ] ]. - ^ false -] - -{ #category : #'api - testing' } -GtCoderExampler >> hasSelectedExecutableExamples [ - self selectedExecutableExampleCodersDo: [ ^ true ]. - ^ false -] - -{ #category : #'api - testing' } -GtCoderExampler >> hasSuccessExamples [ - - self allExecutableExampleCodersWithResultsDo: [ :eachCoder | - eachCoder exampleResult isSuccess ifTrue: [ - ^ true ] ]. - ^ false -] - -{ #category : #'api - accessing' } -GtCoderExampler >> numberOfAllExamples [ - - | aTotal | - aTotal := 0. - self allExecutableExampleCodersDo: [ :eachCoder | - aTotal := aTotal + 1 ]. - ^ aTotal -] - -{ #category : #'api - accessing' } -GtCoderExampler >> numberOfErrorExamples [ - - | aTotal | - aTotal := 0. - self allExecutableExampleCodersWithResultsDo: [ :eachCoder | - eachCoder exampleResult isError ifTrue: [ - aTotal := aTotal + 1 ] ]. - ^ aTotal -] - -{ #category : #'api - accessing' } -GtCoderExampler >> numberOfFailureExamples [ - - | aTotal | - aTotal := 0. - self allExecutableExampleCodersWithResultsDo: [ :eachCoder | - eachCoder exampleResult isFailure ifTrue: [ - aTotal := aTotal + 1 ] ]. - ^ aTotal -] - -{ #category : #'api - accessing' } -GtCoderExampler >> numberOfNotExecutedExamples [ - - | aTotal | - aTotal := 0. - self allExecutableExampleCodersDo: [ :eachCoder | - eachCoder exampleResult ifNil: [ - aTotal := aTotal + 1 ] ]. - ^ aTotal -] - -{ #category : #'api - accessing' } -GtCoderExampler >> numberOfSuccessExamples [ - - | aTotal | - aTotal := 0. - self allExecutableExampleCodersWithResultsDo: [ :eachCoder | - eachCoder exampleResult isSuccess ifTrue: [ - aTotal := aTotal + 1 ] ]. - ^ aTotal -] - -{ #category : #'api - execution' } -GtCoderExampler >> runExamples [ - self selectedExecutableExampleCodersDo: [ :eachCoder | - (eachCoder isModified or: [ eachCoder example hasNoTestPragma ]) ifFalse: [ - eachCoder example run ] ] -] - -{ #category : #'api - execution' } -GtCoderExampler >> runExamplesFrom: anElement [ - self runExamples. -] - -{ #category : #'api - execution' } -GtCoderExampler >> runNoTestExamples [ - self selectedExecutableExampleCodersDo: [ :eachCoder | - (eachCoder isModified not and: [ eachCoder example hasNoTestPragma ]) ifTrue: [ - eachCoder example run ] ] -] - -{ #category : #'api - enumeration' } -GtCoderExampler >> selectedExampleCodersDo: aBlock [ - "iterate selected coders with examples" - self subclassResponsibility -] - -{ #category : #'api - enumeration' } -GtCoderExampler >> selectedExecutableExampleCodersDo: aBlock [ - self selectedExampleCodersDo: [ :aCoder :anExample | - aCoder canExecuteExample ifTrue: [ - aBlock cull: aCoder cull: anExample ] ] -] - -{ #category : #'api - enumeration' } -GtCoderExampler >> selectedExecutableExampleCodersWithResultsDo: aBlock [ - self selectedExecutableExampleCodersDo: [ :aCoder :anExample | - aCoder exampleResult ifNotNil: [ :aResult | - aBlock cull: aCoder cull: anExample cull: aResult ] ] -] diff --git a/src/GToolkit-Coder/GtFilteredCodersModel.class.st b/src/GToolkit-Coder/GtFilteredCodersModel.class.st index dff5e4367..2e2caa966 100644 --- a/src/GToolkit-Coder/GtFilteredCodersModel.class.st +++ b/src/GToolkit-Coder/GtFilteredCodersModel.class.st @@ -23,17 +23,8 @@ GtFilteredCodersModel >> additionalFilters: aCollectionOfFilters [ { #category : #'api - converting' } GtFilteredCodersModel >> asAsyncStream [ - | aCompositeFilter | - - aCompositeFilter := additionalFilters - inject: nil - into: [ :sum :each | sum ifNil: [ each ] ifNotNil: [ sum | each ] ]. - - aCompositeFilter := aCompositeFilter - ifNil: [ filter ] - ifNotNil: [ filter & aCompositeFilter ]. - ^ aCompositeFilter asAsyncStream map: [ :eachItem | self privateFetchCoderFor: eachItem ] + ^ self filteredItemsStream map: [ :eachItem | self privateFetchCoderFor: eachItem ] ] { #category : #'api - accessing' } @@ -48,6 +39,21 @@ GtFilteredCodersModel >> filter: aGtSearchFilter [ self notifyChanged ] ] +{ #category : #'api - converting' } +GtFilteredCodersModel >> filteredItemsStream [ + | aCompositeFilter | + + aCompositeFilter := additionalFilters + inject: nil + into: [ :sum :each | sum ifNil: [ each ] ifNotNil: [ sum | each ] ]. + + aCompositeFilter := aCompositeFilter + ifNil: [ filter ] + ifNotNil: [ filter & aCompositeFilter ]. + + ^ aCompositeFilter asAsyncStream +] + { #category : #initialization } GtFilteredCodersModel >> initialize [ super initialize. diff --git a/src/GToolkit-Coder/GtMethodsCoderExampler.class.st b/src/GToolkit-Coder/GtMethodsCoderExampler.class.st deleted file mode 100644 index 1818294c5..000000000 --- a/src/GToolkit-Coder/GtMethodsCoderExampler.class.st +++ /dev/null @@ -1,31 +0,0 @@ -" -I am an example executor. -I am used by {{gtClass:GtPharoMethodsCoder}}, see: {{gtMethod:Behavior>>#gtCoderMethodsFor:context:}} for a usage. - - -" -Class { - #name : #GtMethodsCoderExampler, - #superclass : #GtCoderExampler, - #category : 'GToolkit-Coder-Exampler' -} - -{ #category : #'api - enumeration' } -GtMethodsCoderExampler >> allExampleCodersDo: aBlock [ - self coder allCoders do: [ :eachCoder | - eachCoder example ifNotNil: [ :anExample | - aBlock cull: eachCoder cull: anExample ] ] -] - -{ #category : #'api - accessing' } -GtMethodsCoderExampler >> coderFor: aCompiledMethod [ - - ^ self coder coderFor: aCompiledMethod -] - -{ #category : #'api - enumeration' } -GtMethodsCoderExampler >> selectedExampleCodersDo: aBlock [ - self coder coders do: [ :eachCoder | - eachCoder example ifNotNil: [ :anExample | - aBlock cull: eachCoder cull: anExample ] ] -] diff --git a/src/GToolkit-SearchFilters/GtFilterExampleAllState.class.st b/src/GToolkit-SearchFilters/GtFilterExampleAllState.class.st deleted file mode 100644 index d561f4b7d..000000000 --- a/src/GToolkit-SearchFilters/GtFilterExampleAllState.class.st +++ /dev/null @@ -1,30 +0,0 @@ -Class { - #name : #GtFilterExampleAllState, - #superclass : #GtFilterExampleState, - #category : #'GToolkit-SearchFilters-Support' -} - -{ #category : #'api - testing' } -GtFilterExampleAllState >> includesCoder: aCoder [ - ^ aCoder example isNotNil -] - -{ #category : #'api - testing' } -GtFilterExampleAllState >> isStatusFor: aGtExampleWithResult [ - ^ false -] - -{ #category : #'api - accessing' } -GtFilterExampleAllState >> label [ - ^ 'All' -] - -{ #category : #'api - accessing' } -GtFilterExampleAllState >> numberOfExamplesFor: anExampler [ - ^ anExampler numberOfAllExamples -] - -{ #category : #'api - accessing' } -GtFilterExampleAllState >> order [ - ^ 1 -] diff --git a/src/GToolkit-SearchFilters/GtFilterExampleErrorState.class.st b/src/GToolkit-SearchFilters/GtFilterExampleErrorState.class.st deleted file mode 100644 index 63d437e8c..000000000 --- a/src/GToolkit-SearchFilters/GtFilterExampleErrorState.class.st +++ /dev/null @@ -1,39 +0,0 @@ -Class { - #name : #GtFilterExampleErrorState, - #superclass : #GtFilterExampleState, - #category : #'GToolkit-SearchFilters-Support' -} - -{ #category : #'api - accessing' } -GtFilterExampleErrorState >> color [ - ^ BrGlamorousColors errorBackgroundColor -] - -{ #category : #'api - testing' } -GtFilterExampleErrorState >> includesCoder: aCoder [ - ^ aCoder canExecuteExample and: [ - aCoder exampleResult isNotNil and: [ - aCoder exampleResult isError ] ] -] - -{ #category : #'api - testing' } -GtFilterExampleErrorState >> isStatusFor: aGtExampleWithResult [ - ^ aGtExampleWithResult isNotNil and: [ - aGtExampleWithResult hasResult and: [ - aGtExampleWithResult isError ] ] -] - -{ #category : #'api - accessing' } -GtFilterExampleErrorState >> label [ - ^ 'Error' -] - -{ #category : #'api - accessing' } -GtFilterExampleErrorState >> numberOfExamplesFor: anExampler [ - ^ anExampler numberOfErrorExamples -] - -{ #category : #'api - accessing' } -GtFilterExampleErrorState >> order [ - ^ 4 -] diff --git a/src/GToolkit-SearchFilters/GtFilterExampleFailureState.class.st b/src/GToolkit-SearchFilters/GtFilterExampleFailureState.class.st deleted file mode 100644 index ad34b3baf..000000000 --- a/src/GToolkit-SearchFilters/GtFilterExampleFailureState.class.st +++ /dev/null @@ -1,39 +0,0 @@ -Class { - #name : #GtFilterExampleFailureState, - #superclass : #GtFilterExampleState, - #category : #'GToolkit-SearchFilters-Support' -} - -{ #category : #'api - accessing' } -GtFilterExampleFailureState >> color [ - ^ BrGlamorousColors failureBackgroundColor -] - -{ #category : #'api - testing' } -GtFilterExampleFailureState >> includesCoder: aCoder [ - ^ aCoder canExecuteExample and: [ - aCoder exampleResult isNotNil and: [ - aCoder exampleResult isFailure ] ] -] - -{ #category : #'api - testing' } -GtFilterExampleFailureState >> isStatusFor: aGtExampleWithResult [ - ^ aGtExampleWithResult isNotNil and: [ - aGtExampleWithResult hasResult and: [ - aGtExampleWithResult isFailure ] ] -] - -{ #category : #'api - accessing' } -GtFilterExampleFailureState >> label [ - ^ 'Failure' -] - -{ #category : #'api - accessing' } -GtFilterExampleFailureState >> numberOfExamplesFor: anExampler [ - ^ anExampler numberOfFailureExamples -] - -{ #category : #'api - accessing' } -GtFilterExampleFailureState >> order [ - ^ 3 -] diff --git a/src/GToolkit-SearchFilters/GtFilterExampleNotExecutedState.class.st b/src/GToolkit-SearchFilters/GtFilterExampleNotExecutedState.class.st deleted file mode 100644 index 82d53ceb3..000000000 --- a/src/GToolkit-SearchFilters/GtFilterExampleNotExecutedState.class.st +++ /dev/null @@ -1,36 +0,0 @@ -Class { - #name : #GtFilterExampleNotExecutedState, - #superclass : #GtFilterExampleState, - #category : #'GToolkit-SearchFilters-Support' -} - -{ #category : #'api - accessing' } -GtFilterExampleNotExecutedState >> color [ - ^ BrGlamorousColors neutralBackgroundColor -] - -{ #category : #'api - testing' } -GtFilterExampleNotExecutedState >> includesCoder: aCoder [ - ^ aCoder exampleResult isNil -] - -{ #category : #'api - testing' } -GtFilterExampleNotExecutedState >> isStatusFor: aGtExampleWithResult [ - ^ aGtExampleWithResult isNotNil and: [ - aGtExampleWithResult hasResult not ] -] - -{ #category : #'api - accessing' } -GtFilterExampleNotExecutedState >> label [ - ^ 'Not Executed' -] - -{ #category : #'api - accessing' } -GtFilterExampleNotExecutedState >> numberOfExamplesFor: anExampler [ - ^ anExampler numberOfNotExecutedExamples -] - -{ #category : #'api - accessing' } -GtFilterExampleNotExecutedState >> order [ - ^ 5 -] diff --git a/src/GToolkit-SearchFilters/GtFilterExampleState.class.st b/src/GToolkit-SearchFilters/GtFilterExampleState.class.st deleted file mode 100644 index aca0a2c58..000000000 --- a/src/GToolkit-SearchFilters/GtFilterExampleState.class.st +++ /dev/null @@ -1,96 +0,0 @@ -Class { - #name : #GtFilterExampleState, - #superclass : #Object, - #traits : 'TGtUniqueInstance', - #classTraits : 'TGtUniqueInstance classTrait', - #category : #'GToolkit-SearchFilters-Support' -} - -{ #category : #'api - accessing' } -GtFilterExampleState >> allLabels [ - "Return all available labels" - - ^ self allStates collect: #label -] - -{ #category : #'api - accessing' } -GtFilterExampleState >> allStates [ - | allInstances | - allInstances := self class allSubclasses collect: #default. - allInstances sort: [ :a :b | a order < b order ]. - ^ allInstances -] - -{ #category : #'api - accessing' } -GtFilterExampleState >> color [ - "Return a color that represents given state" - - ^ Color transparent -] - -{ #category : #'api - testing' } -GtFilterExampleState >> includesCoder: aCoder [ - "Return true if a method filter should be displayed. - Return false otherwise." - ^ true -] - -{ #category : #'api - testing' } -GtFilterExampleState >> isStatusFor: aGtExampleWithResult [ - "Return true if the status is equal to the example result status" - - ^ self subclassResponsibility -] - -{ #category : #'api - accessing' } -GtFilterExampleState >> label [ - "Return a name that is used by ${class:GtSearchExamplesFilter}$ - to display available example filters in ${class:GtFiltersElement}$." - - ^ self className -] - -{ #category : #'api - accessing' } -GtFilterExampleState >> labelWithAmountFor: anExampler [ - - | aTotal aTotalString aTotalText | - aTotal := self numberOfExamplesFor: anExampler. - aTotalString := ' (', aTotal asString, (' example' asPluralBasedOn: aTotal), ')'. - aTotalText := aTotalString asRopedText foreground: Color gray. - ^ self label asRopedText - append: aTotalText. -] - -{ #category : #'api - accessing' } -GtFilterExampleState >> numberOfExamplesFor: anExampler [ - "Return number of examples with a given state" - ^ 0 -] - -{ #category : #'api - accessing' } -GtFilterExampleState >> order [ - "Return a number that is used by ${class:GtSearchExamplesFilter}$ - to display available example filters in ${class:GtFiltersElement}$ - in a specific order (higher number, later in a list)." - - ^ 50 -] - -{ #category : #'api - accessing' } -GtFilterExampleState >> stateFromExample: aGtExampleWithResult [ - aGtExampleWithResult ifNotNil: [ - self allStates do: [ :eachStatus | - (eachStatus isStatusFor: aGtExampleWithResult) - ifTrue: [ ^ eachStatus ] ] ]. - ^ GtFilterExampleNotExecutedState default -] - -{ #category : #'api - accessing' } -GtFilterExampleState >> stateFromLabel: aLabel [ - - | aString | - aString := aLabel asString. - ^ self allStates - detect: [ :eachStatus | eachStatus label = aString ] - ifNone: [ GtFilterExampleAllState default ] -] diff --git a/src/GToolkit-SearchFilters/GtFilterExampleSuccessState.class.st b/src/GToolkit-SearchFilters/GtFilterExampleSuccessState.class.st deleted file mode 100644 index ef842c9d9..000000000 --- a/src/GToolkit-SearchFilters/GtFilterExampleSuccessState.class.st +++ /dev/null @@ -1,39 +0,0 @@ -Class { - #name : #GtFilterExampleSuccessState, - #superclass : #GtFilterExampleState, - #category : #'GToolkit-SearchFilters-Support' -} - -{ #category : #'api - accessing' } -GtFilterExampleSuccessState >> color [ - ^ BrGlamorousColors successBackgroundColor -] - -{ #category : #'api - testing' } -GtFilterExampleSuccessState >> includesCoder: aCoder [ - ^ aCoder canExecuteExample and: [ - aCoder exampleResult isNotNil and: [ - aCoder exampleResult isSuccess ] ] -] - -{ #category : #'api - testing' } -GtFilterExampleSuccessState >> isStatusFor: aGtExampleWithResult [ - ^ aGtExampleWithResult isNotNil and: [ - aGtExampleWithResult hasResult and: [ - aGtExampleWithResult isSuccess ] ] -] - -{ #category : #'api - accessing' } -GtFilterExampleSuccessState >> label [ - ^ 'Success' -] - -{ #category : #'api - accessing' } -GtFilterExampleSuccessState >> numberOfExamplesFor: anExampler [ - ^ anExampler numberOfSuccessExamples -] - -{ #category : #'api - accessing' } -GtFilterExampleSuccessState >> order [ - ^ 2 -] diff --git a/src/GToolkit-SearchFilters/GtSearchFilter.class.st b/src/GToolkit-SearchFilters/GtSearchFilter.class.st index 0c27ec341..624ca44b1 100644 --- a/src/GToolkit-SearchFilters/GtSearchFilter.class.st +++ b/src/GToolkit-SearchFilters/GtSearchFilter.class.st @@ -28,9 +28,7 @@ GtSearchFilter >> defaultFilterScope [ { #category : #iterating } GtSearchFilter >> do: aBlock [ - ((self result do: aBlock) - inject: 0 into: [ :total :each | total + 1 ]) - wait + (self result do: aBlock) wait ] { #category : #testing } From 92e3c6f45972b1badc45dcb54428c6a2984ca581 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Sat, 27 Nov 2021 20:01:21 +0100 Subject: [PATCH 0096/1268] [feenkcom/gtoolkit#2224] support scroll target by the streaming coders view model --- .../GtStreamingCodersViewModel.class.st | 19 +++++++++++++++++- ...eamingCodersViewModelScrollTarget.class.st | 10 ++++++++++ ...odersViewModelScrollTargetChanged.class.st | 20 +++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 src/GToolkit-Coder-UI/GtStreamingCodersViewModelScrollTarget.class.st create mode 100644 src/GToolkit-Coder-UI/GtStreamingCodersViewModelScrollTargetChanged.class.st diff --git a/src/GToolkit-Coder-UI/GtStreamingCodersViewModel.class.st b/src/GToolkit-Coder-UI/GtStreamingCodersViewModel.class.st index ef1a2f7a0..eba0f1408 100644 --- a/src/GToolkit-Coder-UI/GtStreamingCodersViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtStreamingCodersViewModel.class.st @@ -7,7 +7,8 @@ Class { 'announcer', 'monitor', 'coderViewModels', - 'pendingCommands' + 'pendingCommands', + 'scrollTarget' ], #category : #'GToolkit-Coder-UI-Coder - Basic' } @@ -40,6 +41,11 @@ GtStreamingCodersViewModel >> enqueueCommand: aViewModelCommand [ ifNotEmpty: [ theApplicableCoderViewModels do: [ :eachCoderViewModel | aViewModelCommand applyOn: eachCoderViewModel ] ] ] ] +{ #category : #'api - scrolling' } +GtStreamingCodersViewModel >> hasScrollTarget [ + ^ scrollTarget notNil +] + { #category : #initialization } GtStreamingCodersViewModel >> initialize [ super initialize. @@ -81,6 +87,17 @@ GtStreamingCodersViewModel >> privateFetchCoderViewModelFor: aCoderModel [ aCoderViewModel ] ] ] +{ #category : #'api - scrolling' } +GtStreamingCodersViewModel >> scrollTarget [ + ^ scrollTarget +] + +{ #category : #'api - scrolling' } +GtStreamingCodersViewModel >> scrollToTarget: aGtStreamingCoderViewModelScrollTarget [ + scrollTarget := aGtStreamingCoderViewModelScrollTarget. + self announce: (GtStreamingCodersViewModelScrollTargetChanged new scrollTarget: scrollTarget) +] + { #category : #'api - coders model' } GtStreamingCodersViewModel >> subscribeToCodersModel [ "Is sent after a new codersModel is assigned to the receiver. diff --git a/src/GToolkit-Coder-UI/GtStreamingCodersViewModelScrollTarget.class.st b/src/GToolkit-Coder-UI/GtStreamingCodersViewModelScrollTarget.class.st new file mode 100644 index 000000000..8a867090d --- /dev/null +++ b/src/GToolkit-Coder-UI/GtStreamingCodersViewModelScrollTarget.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtStreamingCodersViewModelScrollTarget, + #superclass : #Object, + #category : #'GToolkit-Coder-UI-Coder - Basic' +} + +{ #category : #'api - testing' } +GtStreamingCodersViewModelScrollTarget >> applicableTo: aCoderViewModel [ + ^ false +] diff --git a/src/GToolkit-Coder-UI/GtStreamingCodersViewModelScrollTargetChanged.class.st b/src/GToolkit-Coder-UI/GtStreamingCodersViewModelScrollTargetChanged.class.st new file mode 100644 index 000000000..1af5e6b54 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtStreamingCodersViewModelScrollTargetChanged.class.st @@ -0,0 +1,20 @@ +Class { + #name : #GtStreamingCodersViewModelScrollTargetChanged, + #superclass : #Announcement, + #instVars : [ + 'scrollTarget' + ], + #category : #'GToolkit-Coder-UI-Coder - Basic' +} + +{ #category : #accessing } +GtStreamingCodersViewModelScrollTargetChanged >> scrollTarget [ + + ^ scrollTarget +] + +{ #category : #accessing } +GtStreamingCodersViewModelScrollTargetChanged >> scrollTarget: anObject [ + + scrollTarget := anObject +] From 2beede040bb0c89280cbdb6a26328194bd3f60d0 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Sat, 27 Nov 2021 23:52:03 +0100 Subject: [PATCH 0097/1268] [feenkcom/gtoolkit#2224] extract streaming coders view model to its own package --- .../BaselineOfGToolkitCoder.class.st | 2 + .../GtStreamingCodersViewModel.class.st | 52 +++++++++++++++---- ...GtStreamingCodersViewModelCommand.class.st | 2 +- ...eamingCodersViewModelScrollTarget.class.st | 2 +- ...odersViewModelScrollTargetChanged.class.st | 2 +- ...amingCodersViewModelStreamChanged.class.st | 5 ++ .../package.st | 1 + .../GtExpandableSourceCoderElement.class.st | 6 +-- ...GtStreamingCodersViewModelChanged.class.st | 5 -- .../TGtWithTextualCoderViewModel.trait.st | 22 +++++--- .../GtCodersStreamChanged.class.st | 5 ++ .../GtFilteredCodersModel.class.st | 41 ++++++++------- .../GtStreamingCodersModel.class.st | 40 ++++++++++++-- 13 files changed, 134 insertions(+), 51 deletions(-) rename src/{GToolkit-Coder-UI => GToolkit-Coder-UI-StreamingCoders}/GtStreamingCodersViewModel.class.st (72%) rename src/{GToolkit-Coder-UI => GToolkit-Coder-UI-StreamingCoders}/GtStreamingCodersViewModelCommand.class.st (83%) rename src/{GToolkit-Coder-UI => GToolkit-Coder-UI-StreamingCoders}/GtStreamingCodersViewModelScrollTarget.class.st (77%) rename src/{GToolkit-Coder-UI => GToolkit-Coder-UI-StreamingCoders}/GtStreamingCodersViewModelScrollTargetChanged.class.st (86%) create mode 100644 src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModelStreamChanged.class.st create mode 100644 src/GToolkit-Coder-UI-StreamingCoders/package.st delete mode 100644 src/GToolkit-Coder-UI/GtStreamingCodersViewModelChanged.class.st create mode 100644 src/GToolkit-Coder/GtCodersStreamChanged.class.st diff --git a/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st b/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st index ac016c523..84a660678 100644 --- a/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st +++ b/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st @@ -61,6 +61,8 @@ BaselineOfGToolkitCoder >> baseline: spec [ package: 'GToolkit-Coder-UI' with: [ spec requires: #( 'GToolkit-Coder' 'GToolkit-VariableBindings' 'GToolkitBasicUtility' 'GToolkitPager' ) ]; + package: 'GToolkit-Coder-UI-StreamingCoders' with: [ + spec requires: #( 'Futures' 'GToolkit-Coder' ) ]; package: 'GToolkit-Coder-AddOns' with: [ spec requires: #( 'GToolkit-Coder' 'GToolkit-Coder-UI' ) ]; package: 'GToolkit-Coder-Extensions' with: [ diff --git a/src/GToolkit-Coder-UI/GtStreamingCodersViewModel.class.st b/src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModel.class.st similarity index 72% rename from src/GToolkit-Coder-UI/GtStreamingCodersViewModel.class.st rename to src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModel.class.st index eba0f1408..8af8166a8 100644 --- a/src/GToolkit-Coder-UI/GtStreamingCodersViewModel.class.st +++ b/src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModel.class.st @@ -7,10 +7,11 @@ Class { 'announcer', 'monitor', 'coderViewModels', + 'coderViewModelsStream', 'pendingCommands', 'scrollTarget' ], - #category : #'GToolkit-Coder-UI-Coder - Basic' + #category : #'GToolkit-Coder-UI-StreamingCoders-View Model' } { #category : #'api - announcer' } @@ -21,8 +22,9 @@ GtStreamingCodersViewModel >> announce: anAnnouncement [ { #category : #'api - accessing' } GtStreamingCodersViewModel >> coderViewModelsStream [ - ^ codersModel asAsyncStream - map: [ :eachCoder | self privateFetchCoderViewModelFor: eachCoder ] + + + ^ coderViewModelsStream asyncSimilarCopy ] { #category : #'api - commands' } @@ -52,7 +54,8 @@ GtStreamingCodersViewModel >> initialize [ monitor := Monitor new. coderViewModels := Dictionary new. - pendingCommands := OrderedCollection new + pendingCommands := OrderedCollection new. + coderViewModelsStream := AsyncEmptyStream new ] { #category : #'instance creation' } @@ -60,18 +63,41 @@ GtStreamingCodersViewModel >> newCoderViewModelFor: aCoderModel [ ^ aCoderModel asCoderViewModel ] +{ #category : #'private - notifying' } +GtStreamingCodersViewModel >> notifyCoderViewModelsStreamChanged [ + self announce: GtStreamingCodersViewModelStreamChanged new +] + { #category : #'private - event handling' } GtStreamingCodersViewModel >> onCoderAdded: anAnnouncement [ self privateFetchCoderViewModelFor: anAnnouncement coder. - self announce: GtStreamingCodersViewModelChanged new + self updateCoderViewModelsStream +] + +{ #category : #'api - coders model' } +GtStreamingCodersViewModel >> onCodersModelChanged [ + "Is sent when a new codersModel is assigned to the receiver. + Note: #onCodersModelChanged is sent before #subscribeToCodersModel + which means that if you perform any operation that triggers an announcement it will be ignored because the receiver + didn't get a chance to subscribe to any announcement. Override #onPostCodersModelChanged if you + wish to perform an operation that requires an announcement, but keep in mind that this is not the most efficient way" + >#onObjectChangedTemplate'> + + self updateCoderViewModelsStream ] { #category : #'private - event handling' } -GtStreamingCodersViewModel >> onCodersChanged: anAnnouncement [ - self announce: GtStreamingCodersViewModelChanged new +GtStreamingCodersViewModel >> onCodersStreamChanged: anAnnouncement [ + self notifyCoderViewModelsStreamChanged +] + +{ #category : #'private - accessing' } +GtStreamingCodersViewModel >> privateCoderViewModelsStream: anAsyncStream [ + coderViewModelsStream := anAsyncStream cached. + self notifyCoderViewModelsStreamChanged ] -{ #category : #private } +{ #category : #'private - accessing' } GtStreamingCodersViewModel >> privateFetchCoderViewModelFor: aCoderModel [ ^ monitor critical: [ coderViewModels @@ -110,8 +136,8 @@ GtStreamingCodersViewModel >> subscribeToCodersModel [ when: GtCodersCoderAdded send: #onCoderAdded: to: self; - when: GtCodersCodersChanged - send: #onCodersChanged: + when: GtCodersStreamChanged + send: #onCodersStreamChanged: to: self ] @@ -133,6 +159,12 @@ GtStreamingCodersViewModel >> unsubscribeFromCodersModel [ codersModel unsubscribe: self ] +{ #category : #'private - updating' } +GtStreamingCodersViewModel >> updateCoderViewModelsStream [ + monitor critical: [ + self privateCoderViewModelsStream: (codersModel codersStream map: [ :eachCoder | self privateFetchCoderViewModelFor: eachCoder ]) ] +] + { #category : #'api - announcer' } GtStreamingCodersViewModel >> when: anAnnouncementClass do: aBlock [ >#whenDoTemplate'> diff --git a/src/GToolkit-Coder-UI/GtStreamingCodersViewModelCommand.class.st b/src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModelCommand.class.st similarity index 83% rename from src/GToolkit-Coder-UI/GtStreamingCodersViewModelCommand.class.st rename to src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModelCommand.class.st index 71923bc62..f7313460c 100644 --- a/src/GToolkit-Coder-UI/GtStreamingCodersViewModelCommand.class.st +++ b/src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModelCommand.class.st @@ -1,7 +1,7 @@ Class { #name : #GtStreamingCodersViewModelCommand, #superclass : #Object, - #category : #'GToolkit-Coder-UI-Coder - Basic' + #category : #'GToolkit-Coder-UI-StreamingCoders-Utilities' } { #category : #'api - testing' } diff --git a/src/GToolkit-Coder-UI/GtStreamingCodersViewModelScrollTarget.class.st b/src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModelScrollTarget.class.st similarity index 77% rename from src/GToolkit-Coder-UI/GtStreamingCodersViewModelScrollTarget.class.st rename to src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModelScrollTarget.class.st index 8a867090d..ad1bb1ab5 100644 --- a/src/GToolkit-Coder-UI/GtStreamingCodersViewModelScrollTarget.class.st +++ b/src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModelScrollTarget.class.st @@ -1,7 +1,7 @@ Class { #name : #GtStreamingCodersViewModelScrollTarget, #superclass : #Object, - #category : #'GToolkit-Coder-UI-Coder - Basic' + #category : #'GToolkit-Coder-UI-StreamingCoders-Utilities' } { #category : #'api - testing' } diff --git a/src/GToolkit-Coder-UI/GtStreamingCodersViewModelScrollTargetChanged.class.st b/src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModelScrollTargetChanged.class.st similarity index 86% rename from src/GToolkit-Coder-UI/GtStreamingCodersViewModelScrollTargetChanged.class.st rename to src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModelScrollTargetChanged.class.st index 1af5e6b54..1a8c01b5e 100644 --- a/src/GToolkit-Coder-UI/GtStreamingCodersViewModelScrollTargetChanged.class.st +++ b/src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModelScrollTargetChanged.class.st @@ -4,7 +4,7 @@ Class { #instVars : [ 'scrollTarget' ], - #category : #'GToolkit-Coder-UI-Coder - Basic' + #category : #'GToolkit-Coder-UI-StreamingCoders-Events' } { #category : #accessing } diff --git a/src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModelStreamChanged.class.st b/src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModelStreamChanged.class.st new file mode 100644 index 000000000..7b8a18747 --- /dev/null +++ b/src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModelStreamChanged.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtStreamingCodersViewModelStreamChanged, + #superclass : #Announcement, + #category : #'GToolkit-Coder-UI-StreamingCoders-Events' +} diff --git a/src/GToolkit-Coder-UI-StreamingCoders/package.st b/src/GToolkit-Coder-UI-StreamingCoders/package.st new file mode 100644 index 000000000..35ef15113 --- /dev/null +++ b/src/GToolkit-Coder-UI-StreamingCoders/package.st @@ -0,0 +1 @@ +Package { #name : #'GToolkit-Coder-UI-StreamingCoders' } diff --git a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st index d46d25874..6618dced2 100644 --- a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st @@ -157,10 +157,8 @@ GtExpandableSourceCoderElement >> onTextualCoderViewModelChanged [ which means that if you perform any operation that triggers an announcement it will be ignored because the receiver didn't get a chance to subscribe to any announcement. Override #onPostTextualCoderViewModelChanged if you wish to perform an operation that requires an announcement, but keep in mind that this is not the most efficient way" - - BlFrameTelemetry - time: [ self class name, ' ', #onTextualCoderViewModelChanged ] - during: [ self updateElement ] + + self updateElement ] { #category : #'private - event handling' } diff --git a/src/GToolkit-Coder-UI/GtStreamingCodersViewModelChanged.class.st b/src/GToolkit-Coder-UI/GtStreamingCodersViewModelChanged.class.st deleted file mode 100644 index 93c818492..000000000 --- a/src/GToolkit-Coder-UI/GtStreamingCodersViewModelChanged.class.st +++ /dev/null @@ -1,5 +0,0 @@ -Class { - #name : #GtStreamingCodersViewModelChanged, - #superclass : #Announcement, - #category : #'GToolkit-Coder-UI-Coder - Basic' -} diff --git a/src/GToolkit-Coder-UI/TGtWithTextualCoderViewModel.trait.st b/src/GToolkit-Coder-UI/TGtWithTextualCoderViewModel.trait.st index cf4932b1a..2f15aff4e 100644 --- a/src/GToolkit-Coder-UI/TGtWithTextualCoderViewModel.trait.st +++ b/src/GToolkit-Coder-UI/TGtWithTextualCoderViewModel.trait.st @@ -3,7 +3,7 @@ Trait { #instVars : [ 'textualCoderViewModel' ], - #category : 'GToolkit-Coder-UI-Coder - Textual' + #category : #'GToolkit-Coder-UI-Coder - Textual' } { #category : #'api - textual coder view model' } @@ -58,13 +58,23 @@ TGtWithTextualCoderViewModel >> textualCoderViewModel: aTextualCoderViewModel [ textualCoderViewModel == aTextualCoderViewModel ifTrue: [ ^ self ]. - - textualCoderViewModel ifNotNil: [ self unsubscribeFromTextualCoderViewModel ]. + + BlFrameTelemetry + time: [ self class name, ' #unsubscribeFromTextualCoderViewModel' ] + during: [ textualCoderViewModel ifNotNil: [ self unsubscribeFromTextualCoderViewModel ] ]. textualCoderViewModel := aTextualCoderViewModel. - self onTextualCoderViewModelChanged. - self subscribeToTextualCoderViewModel. - self onPostTextualCoderViewModelChanged + BlFrameTelemetry + time: [ self class name, ' ', #onTextualCoderViewModelChanged ] + during: [ self onTextualCoderViewModelChanged ]. + + BlFrameTelemetry + time: [ self class name, ' ', #subscribeToTextualCoderViewModel ] + during: [ self subscribeToTextualCoderViewModel ]. + + BlFrameTelemetry + time: [ self class name, ' ', #onPostTextualCoderViewModelChanged ] + during: [ self onPostTextualCoderViewModelChanged ]. ] { #category : #'api - textual coder view model' } diff --git a/src/GToolkit-Coder/GtCodersStreamChanged.class.st b/src/GToolkit-Coder/GtCodersStreamChanged.class.st new file mode 100644 index 000000000..7d71dfe59 --- /dev/null +++ b/src/GToolkit-Coder/GtCodersStreamChanged.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtCodersStreamChanged, + #superclass : #GtCodersAnnouncement, + #category : #'GToolkit-Coder-Event' +} diff --git a/src/GToolkit-Coder/GtFilteredCodersModel.class.st b/src/GToolkit-Coder/GtFilteredCodersModel.class.st index 2e2caa966..46cc9de7b 100644 --- a/src/GToolkit-Coder/GtFilteredCodersModel.class.st +++ b/src/GToolkit-Coder/GtFilteredCodersModel.class.st @@ -13,18 +13,34 @@ GtFilteredCodersModel class >> forFilter: aGtSearchFilter [ ^ self new filter: aGtSearchFilter ] +{ #category : #'api - accessing' } +GtFilteredCodersModel >> additionalFilters [ + ^ additionalFilters +] + { #category : #'api - accessing' } GtFilteredCodersModel >> additionalFilters: aCollectionOfFilters [ monitor critical: [ additionalFilters := aCollectionOfFilters asArray. - self notifyChanged ] + self itemsStream: (self createItemsStreamForFilter: filter andAdditionalFilters: additionalFilters) ] ] -{ #category : #'api - converting' } -GtFilteredCodersModel >> asAsyncStream [ +{ #category : #'private - instance creation' } +GtFilteredCodersModel >> createItemsStreamForFilter: aMainSearchFilter andAdditionalFilters: aCollectionOfFilters [ + "Given a main search filter and a potentially empty collection of additional filters, + create a stream over the results of a composition of those filters" + | aCompositeFilter | + + aCompositeFilter := aCollectionOfFilters + inject: nil + into: [ :sum :each | sum ifNil: [ each ] ifNotNil: [ sum | each ] ]. - ^ self filteredItemsStream map: [ :eachItem | self privateFetchCoderFor: eachItem ] + aCompositeFilter := aCompositeFilter + ifNil: [ aMainSearchFilter ] + ifNotNil: [ aMainSearchFilter & aCompositeFilter ]. + + ^ aCompositeFilter asAsyncStream ] { #category : #'api - accessing' } @@ -36,22 +52,7 @@ GtFilteredCodersModel >> filter [ GtFilteredCodersModel >> filter: aGtSearchFilter [ monitor critical: [ filter := aGtSearchFilter. - self notifyChanged ] -] - -{ #category : #'api - converting' } -GtFilteredCodersModel >> filteredItemsStream [ - | aCompositeFilter | - - aCompositeFilter := additionalFilters - inject: nil - into: [ :sum :each | sum ifNil: [ each ] ifNotNil: [ sum | each ] ]. - - aCompositeFilter := aCompositeFilter - ifNil: [ filter ] - ifNotNil: [ filter & aCompositeFilter ]. - - ^ aCompositeFilter asAsyncStream + self itemsStream: (self createItemsStreamForFilter: filter andAdditionalFilters: additionalFilters) ] ] { #category : #initialization } diff --git a/src/GToolkit-Coder/GtStreamingCodersModel.class.st b/src/GToolkit-Coder/GtStreamingCodersModel.class.st index 986e309a0..b733a18fc 100644 --- a/src/GToolkit-Coder/GtStreamingCodersModel.class.st +++ b/src/GToolkit-Coder/GtStreamingCodersModel.class.st @@ -6,7 +6,9 @@ Class { #instVars : [ 'announcer', 'monitor', - 'coders' + 'coders', + 'itemsStream', + 'codersStream' ], #category : #'GToolkit-Coder-Coders' } @@ -21,7 +23,15 @@ GtStreamingCodersModel >> announce: anAnnouncement [ GtStreamingCodersModel >> asAsyncStream [ - ^ self subclassResponsibility + ^ self codersStream +] + +{ #category : #'api - accessing' } +GtStreamingCodersModel >> codersStream [ + "Return a stream of coders" + + + ^ codersStream asyncSimilarCopy ] { #category : #initialization } @@ -29,7 +39,26 @@ GtStreamingCodersModel >> initialize [ super initialize. monitor := Monitor new. - coders := Dictionary new + coders := Dictionary new. + itemsStream := AsyncEmptyStream new. + codersStream := AsyncEmptyStream new +] + +{ #category : #'api - accessing' } +GtStreamingCodersModel >> itemsStream [ + "Return a stream of items backing the coder" + + + ^ itemsStream asyncSimilarCopy +] + +{ #category : #'private - accessing' } +GtStreamingCodersModel >> itemsStream: anAsyncStream [ + monitor critical: [ + itemsStream := anAsyncStream cached. + codersStream := itemsStream map: [ :eachItem | self newCoderFor: eachItem ] cache: coders ]. + + self notifyStreamChanged ] { #category : #'private - instance creation' } @@ -42,6 +71,11 @@ GtStreamingCodersModel >> notifyChanged [ self announce: (GtCodersCodersChanged new coders: self) ] +{ #category : #'private - notifying' } +GtStreamingCodersModel >> notifyStreamChanged [ + self announce: (GtCodersStreamChanged new coders: self) +] + { #category : #'private - instance creation' } GtStreamingCodersModel >> privateFetchCoderFor: anObject [ ^ monitor critical: [ From 1be64b7ed63ce624295418c7bcec9a43e556c450 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Sun, 28 Nov 2021 17:05:28 +0100 Subject: [PATCH 0098/1268] extract streaming coders into its own package --- .../BaselineOfGToolkitCoder.class.st | 11 +- .../RPackage.extension.st | 31 --- .../GtStreamingCodersViewModel.class.st | 182 ++++++++++++++++++ ...GtStreamingCodersViewModelCommand.class.st | 15 ++ ...eamingCodersViewModelScrollTarget.class.st | 10 + ...odersViewModelScrollTargetChanged.class.st | 20 ++ ...amingCodersViewModelStreamChanged.class.st | 5 + ...estGToolkitCoderStreamingCodersUI.class.st | 20 ++ .../TGtWithStreamingCodersViewModel.trait.st | 84 ++++++++ .../package.st | 1 + ...eredCodersAdditionalFiltersReason.class.st | 5 + .../GtFilteredCodersFilterReason.class.st | 5 + .../GtFilteredCodersModel.class.st | 11 +- .../GtStreamingCodersAddedReason.class.st | 20 ++ .../GtStreamingCodersModel.class.st | 24 +-- .../GtStreamingCodersRemovedReason.class.st | 20 ++ .../GtStreamingCodersStreamChanged.class.st | 25 +++ ...treamingCodersStreamChangedReason.class.st | 5 + ...ifestGToolkitCoderStreamingCoders.class.st | 19 ++ .../TGtWithStreamingCodersModel.trait.st | 84 ++++++++ src/GToolkit-Coder-StreamingCoders/package.st | 1 + .../GtCodersStreamChanged.class.st | 5 - .../ManifestGToolkitSearchFilters.class.st | 18 ++ .../ManifestGToolkitVariableBindings.class.st | 17 ++ 24 files changed, 585 insertions(+), 53 deletions(-) create mode 100644 src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModel.class.st create mode 100644 src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModelCommand.class.st create mode 100644 src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModelScrollTarget.class.st create mode 100644 src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModelScrollTargetChanged.class.st create mode 100644 src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModelStreamChanged.class.st create mode 100644 src/GToolkit-Coder-StreamingCoders-UI/ManifestGToolkitCoderStreamingCodersUI.class.st create mode 100644 src/GToolkit-Coder-StreamingCoders-UI/TGtWithStreamingCodersViewModel.trait.st create mode 100644 src/GToolkit-Coder-StreamingCoders-UI/package.st create mode 100644 src/GToolkit-Coder-StreamingCoders/GtFilteredCodersAdditionalFiltersReason.class.st create mode 100644 src/GToolkit-Coder-StreamingCoders/GtFilteredCodersFilterReason.class.st rename src/{GToolkit-Coder => GToolkit-Coder-StreamingCoders}/GtFilteredCodersModel.class.st (79%) create mode 100644 src/GToolkit-Coder-StreamingCoders/GtStreamingCodersAddedReason.class.st rename src/{GToolkit-Coder => GToolkit-Coder-StreamingCoders}/GtStreamingCodersModel.class.st (82%) create mode 100644 src/GToolkit-Coder-StreamingCoders/GtStreamingCodersRemovedReason.class.st create mode 100644 src/GToolkit-Coder-StreamingCoders/GtStreamingCodersStreamChanged.class.st create mode 100644 src/GToolkit-Coder-StreamingCoders/GtStreamingCodersStreamChangedReason.class.st create mode 100644 src/GToolkit-Coder-StreamingCoders/ManifestGToolkitCoderStreamingCoders.class.st create mode 100644 src/GToolkit-Coder-StreamingCoders/TGtWithStreamingCodersModel.trait.st create mode 100644 src/GToolkit-Coder-StreamingCoders/package.st delete mode 100644 src/GToolkit-Coder/GtCodersStreamChanged.class.st create mode 100644 src/GToolkit-SearchFilters/ManifestGToolkitSearchFilters.class.st create mode 100644 src/GToolkit-VariableBindings/ManifestGToolkitVariableBindings.class.st diff --git a/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st b/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st index 84a660678..e49784db7 100644 --- a/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st +++ b/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st @@ -52,8 +52,15 @@ BaselineOfGToolkitCoder >> baseline: spec [ spec package: 'GToolkit-VariableBindings'; - package: 'GToolkit-SearchFilters' - with: [ spec requires: #( 'Futures' 'GToolkitBasicUtility' ) ]; + + package: 'GToolkit-SearchFilters' with: [ + spec requires: #('Futures') ]; + + package: 'GToolkit-Coder-StreamingCoders' with: [ + spec requires: #('Futures' 'GToolkit-SearchFilters') ]; + package: 'GToolkit-Coder-StreamingCoders-UI' with: [ + spec requires: #('Futures' 'GToolkit-Coder-StreamingCoders') ]; + package: 'GToolkit-Coder' with: [ spec requires: #( 'Futures' 'GToolkitBasicUtility' 'GToolkitAnnouncerUtility' diff --git a/src/GToolkit-Coder-Extensions/RPackage.extension.st b/src/GToolkit-Coder-Extensions/RPackage.extension.st index e72651193..6452ee3cb 100644 --- a/src/GToolkit-Coder-Extensions/RPackage.extension.st +++ b/src/GToolkit-Coder-Extensions/RPackage.extension.st @@ -51,34 +51,3 @@ RPackage >> gtDefinedTagsFor: aView context: aPhlowContext [ asSortedCollection: [ :a :b | a packageTagName < b packageTagName ]); addEventFilterOn: BlClickEvent do: [ :anEvent | anEvent currentTarget requestFocus ] ] ] - -{ #category : #'*GToolkit-Coder-Extensions' } -RPackage >> gtDependenciesMapFor: aView [ - - ^ aView mondrian - title: 'Dependencies Map'; - priority: 10; - painting: [ :mondrian | - mondrian nodes - shape: [ :each | - BrLabel new - text: each name asRopedText; - aptitude: BrGlamorousLabelAptitude - ]; - with: (self gtPackagesUsed, {self}). - mondrian edges - shape: [ - BlParabollaArcElement new - zIndex: 0; - curvatureFraction: 0.1; - border: (BlBorder paint: (Color gray alpha: 0.1) width:2 ); - toHead: (BlArrowheadSimpleArrow new - border: (BlBorder builder paint: (Color gray alpha: 0.1); width:2; build)) ]; - fromRightCenter; - toLeftCenter; - connectFrom: #yourself - toAll: [ :each | |usedPackages | - usedPackages := each gtPackagesUsed]. - mondrian layout custom: (GtGraphHorizontalDominanceTreeLayout new). - ] -] diff --git a/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModel.class.st b/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModel.class.st new file mode 100644 index 000000000..866b4efb7 --- /dev/null +++ b/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModel.class.st @@ -0,0 +1,182 @@ +Class { + #name : #GtStreamingCodersViewModel, + #superclass : #Object, + #traits : 'TGtWithStreamingCodersModel', + #classTraits : 'TGtWithStreamingCodersModel classTrait', + #instVars : [ + 'announcer', + 'monitor', + 'coderViewModels', + 'coderViewModelsStream', + 'pendingCommands', + 'scrollTarget' + ], + #category : #'GToolkit-Coder-StreamingCoders-UI-Coder' +} + +{ #category : #'api - announcer' } +GtStreamingCodersViewModel >> announce: anAnnouncement [ + >#announceTemplate'> + announcer ifNotNil: [ :anAnnouncer | anAnnouncer announce: anAnnouncement ]. +] + +{ #category : #'api - accessing' } +GtStreamingCodersViewModel >> coderViewModelsStream [ + + + ^ coderViewModelsStream asyncSimilarCopy +] + +{ #category : #'api - commands' } +GtStreamingCodersViewModel >> enqueueCommand: aViewModelCommand [ + monitor critical: [ + | theApplicableCoderViewModels | + + theApplicableCoderViewModels := OrderedCollection new. + + coderViewModels valuesDo: [ :eachCoderViewModel | + (aViewModelCommand applicableTo: eachCoderViewModel) + ifTrue: [ theApplicableCoderViewModels add: eachCoderViewModel ] ]. + + theApplicableCoderViewModels + ifEmpty: [ pendingCommands add: aViewModelCommand ] + ifNotEmpty: [ theApplicableCoderViewModels do: [ :eachCoderViewModel | aViewModelCommand applyOn: eachCoderViewModel ] ] ] +] + +{ #category : #'api - scrolling' } +GtStreamingCodersViewModel >> hasScrollTarget [ + ^ scrollTarget notNil +] + +{ #category : #initialization } +GtStreamingCodersViewModel >> initialize [ + super initialize. + + monitor := Monitor new. + coderViewModels := Dictionary new. + pendingCommands := OrderedCollection new. + coderViewModelsStream := AsyncEmptyStream new +] + +{ #category : #'instance creation' } +GtStreamingCodersViewModel >> newCoderViewModelFor: aCoderModel [ + ^ aCoderModel asCoderViewModel +] + +{ #category : #'private - notifying' } +GtStreamingCodersViewModel >> notifyCoderViewModelsStreamChanged [ + self announce: GtStreamingCodersViewModelStreamChanged new +] + +{ #category : #'private - event handling' } +GtStreamingCodersViewModel >> onCodersStreamChanged: anAnnouncement [ + (anAnnouncement isDueTo: GtStreamingCodersAddedReason) + ifTrue: [ self privateFetchCoderViewModelFor: anAnnouncement dueTo coder ]. + + self updateCoderViewModelsStream +] + +{ #category : #'api - streaming coders model' } +GtStreamingCodersViewModel >> onStreamingCodersModelChanged [ + "Is sent when a new streamingCodersModel is assigned to the receiver. + Note: #onStreamingCodersModelChanged is sent before #subscribeToStreamingCodersModel + which means that if you perform any operation that triggers an announcement it will be ignored because the receiver + didn't get a chance to subscribe to any announcement. Override #onPostStreamingCodersModelChanged if you + wish to perform an operation that requires an announcement, but keep in mind that this is not the most efficient way" + >#onObjectChangedTemplate'> + + self updateCoderViewModelsStream +] + +{ #category : #'private - accessing' } +GtStreamingCodersViewModel >> privateCoderViewModelsStream: anAsyncStream [ + coderViewModelsStream := anAsyncStream cached. + self notifyCoderViewModelsStreamChanged +] + +{ #category : #'private - accessing' } +GtStreamingCodersViewModel >> privateFetchCoderViewModelFor: aCoderModel [ + ^ monitor critical: [ + coderViewModels + at: aCoderModel + ifAbsentPut: [ + | aCoderViewModel theApplicableCommands | + aCoderViewModel := self newCoderViewModelFor: aCoderModel. + + theApplicableCommands := pendingCommands select: [ :eachCommand | eachCommand applicableTo: aCoderViewModel ]. + pendingCommands removeAll: theApplicableCommands. + theApplicableCommands do: [ :eachCommand | eachCommand applyOn: aCoderViewModel ]. + + aCoderViewModel ] ] +] + +{ #category : #'api - scrolling' } +GtStreamingCodersViewModel >> scrollTarget [ + ^ scrollTarget +] + +{ #category : #'api - scrolling' } +GtStreamingCodersViewModel >> scrollToTarget: aGtStreamingCoderViewModelScrollTarget [ + scrollTarget := aGtStreamingCoderViewModelScrollTarget. + self announce: (GtStreamingCodersViewModelScrollTargetChanged new scrollTarget: scrollTarget) +] + +{ #category : #'api - streaming coders model' } +GtStreamingCodersViewModel >> subscribeToStreamingCodersModel [ + "Is sent after a new streamingCodersModel is assigned to the receiver. + It is required to unsubscribe from the previously subscribed objects by implementing + #unsubscribeFromStreamingCodersModel if the receiver subscribes to them" + + >#subscribeToObjectTemplate'> + + streamingCodersModel + when: GtStreamingCodersStreamChanged + send: #onCodersStreamChanged: + to: self +] + +{ #category : #'api - announcer' } +GtStreamingCodersViewModel >> unsubscribe: anObject [ + "Unsubscribe all subscriptions of anObject from the receiver" + + >#unsubscribeTemplate'> + ^ announcer ifNotNil: [ :anAnnouncer | anAnnouncer unsubscribe: anObject ] +] + +{ #category : #'api - streaming coders model' } +GtStreamingCodersViewModel >> unsubscribeFromStreamingCodersModel [ + "Is sent before a new streamingCodersModel is assigned to the receiver. + Objects that subscribe to streamingCodersModel are required to implement this method." + + >#unsubscribeFromObjectTemplate'> + + streamingCodersModel unsubscribe: self +] + +{ #category : #'private - updating' } +GtStreamingCodersViewModel >> updateCoderViewModelsStream [ + monitor critical: [ + self privateCoderViewModelsStream: (streamingCodersModel codersStream map: [ :eachCoder | self privateFetchCoderViewModelFor: eachCoder ]) ] +] + +{ #category : #'api - announcer' } +GtStreamingCodersViewModel >> when: anAnnouncementClass do: aBlock [ + >#whenDoTemplate'> + ^ (announcer ifNil: [ announcer := Announcer new ]) + when: anAnnouncementClass do: aBlock +] + +{ #category : #'api - announcer' } +GtStreamingCodersViewModel >> when: anAnnouncementClass do: aBlock for: aSubscriber [ + >#whenDoForTemplate'> + ^ (self when: anAnnouncementClass do: aBlock) + subscriber: aSubscriber; + yourself +] + +{ #category : #'api - announcer' } +GtStreamingCodersViewModel >> when: anAnnouncementClass send: aSelector to: anObject [ + >#whenSendToTemplate'> + ^ (announcer ifNil: [ announcer := Announcer new ]) weak + when: anAnnouncementClass send: aSelector to: anObject +] diff --git a/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModelCommand.class.st b/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModelCommand.class.st new file mode 100644 index 000000000..15f7a1122 --- /dev/null +++ b/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModelCommand.class.st @@ -0,0 +1,15 @@ +Class { + #name : #GtStreamingCodersViewModelCommand, + #superclass : #Object, + #category : #'GToolkit-Coder-StreamingCoders-UI-Utilities' +} + +{ #category : #'api - testing' } +GtStreamingCodersViewModelCommand >> applicableTo: aCoderViewModel [ + ^ false +] + +{ #category : #'api - testing' } +GtStreamingCodersViewModelCommand >> applyOn: aCoderViewModel [ + +] diff --git a/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModelScrollTarget.class.st b/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModelScrollTarget.class.st new file mode 100644 index 000000000..13e6d8e22 --- /dev/null +++ b/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModelScrollTarget.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtStreamingCodersViewModelScrollTarget, + #superclass : #Object, + #category : #'GToolkit-Coder-StreamingCoders-UI-Utilities' +} + +{ #category : #'api - testing' } +GtStreamingCodersViewModelScrollTarget >> applicableTo: aCoderViewModel [ + ^ false +] diff --git a/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModelScrollTargetChanged.class.st b/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModelScrollTargetChanged.class.st new file mode 100644 index 000000000..969f85ba0 --- /dev/null +++ b/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModelScrollTargetChanged.class.st @@ -0,0 +1,20 @@ +Class { + #name : #GtStreamingCodersViewModelScrollTargetChanged, + #superclass : #Announcement, + #instVars : [ + 'scrollTarget' + ], + #category : #'GToolkit-Coder-StreamingCoders-UI-Events' +} + +{ #category : #accessing } +GtStreamingCodersViewModelScrollTargetChanged >> scrollTarget [ + + ^ scrollTarget +] + +{ #category : #accessing } +GtStreamingCodersViewModelScrollTargetChanged >> scrollTarget: anObject [ + + scrollTarget := anObject +] diff --git a/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModelStreamChanged.class.st b/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModelStreamChanged.class.st new file mode 100644 index 000000000..147cb619f --- /dev/null +++ b/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModelStreamChanged.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtStreamingCodersViewModelStreamChanged, + #superclass : #Announcement, + #category : #'GToolkit-Coder-StreamingCoders-UI-Events' +} diff --git a/src/GToolkit-Coder-StreamingCoders-UI/ManifestGToolkitCoderStreamingCodersUI.class.st b/src/GToolkit-Coder-StreamingCoders-UI/ManifestGToolkitCoderStreamingCodersUI.class.st new file mode 100644 index 000000000..507580d33 --- /dev/null +++ b/src/GToolkit-Coder-StreamingCoders-UI/ManifestGToolkitCoderStreamingCodersUI.class.st @@ -0,0 +1,20 @@ +" +Please describe the package using the class comment of the included manifest class. The manifest class also includes other additional metadata for the package. These meta data are used by other tools such as the SmalllintManifestChecker and the critics Browser +" +Class { + #name : #ManifestGToolkitCoderStreamingCodersUI, + #superclass : #PackageManifest, + #category : #'GToolkit-Coder-StreamingCoders-UI-Manifest' +} + +{ #category : #accessing } +ManifestGToolkitCoderStreamingCodersUI class >> mustOnlyDependOn [ + ^ { + 'Announcements-Core'. + 'Collections-Sequenceable'. + 'Collections-Unordered'. + 'Futures'. + 'GToolkit-Coder-StreamingCoders'. + 'Kernel' + } +] diff --git a/src/GToolkit-Coder-StreamingCoders-UI/TGtWithStreamingCodersViewModel.trait.st b/src/GToolkit-Coder-StreamingCoders-UI/TGtWithStreamingCodersViewModel.trait.st new file mode 100644 index 000000000..a90adfe19 --- /dev/null +++ b/src/GToolkit-Coder-StreamingCoders-UI/TGtWithStreamingCodersViewModel.trait.st @@ -0,0 +1,84 @@ +Trait { + #name : #TGtWithStreamingCodersViewModel, + #instVars : [ + 'streamingCodersViewModel' + ], + #category : #'GToolkit-Coder-StreamingCoders-UI-Coder' +} + +{ #category : #'api - streaming coders view model' } +TGtWithStreamingCodersViewModel >> hasStreamingCodersViewModel [ + "Return a true if nil is assigned to the receiver, false otherwise" + + + >#hasObjectTemplate'> + + ^ streamingCodersViewModel notNil +] + +{ #category : #'api - streaming coders view model' } +TGtWithStreamingCodersViewModel >> onPostStreamingCodersViewModelChanged [ + "I am an optional hook method that is sent after #subscribeToStreamingCodersViewModel. + I do nothing by default but allow users to perform update operations when a receiver object is already + subscribed to announcements." + >#onPostObjectChangedTemplate'> +] + +{ #category : #'api - streaming coders view model' } +TGtWithStreamingCodersViewModel >> onStreamingCodersViewModelChanged [ + "Is sent when a new streamingCodersViewModel is assigned to the receiver. + Note: #onStreamingCodersViewModelChanged is sent before #subscribeToStreamingCodersViewModel + which means that if you perform any operation that triggers an announcement it will be ignored because the receiver + didn't get a chance to subscribe to any announcement. Override #onPostStreamingCodersViewModelChanged if you + wish to perform an operation that requires an announcement, but keep in mind that this is not the most efficient way" + >#onObjectChangedTemplate'> +] + +{ #category : #'api - streaming coders view model' } +TGtWithStreamingCodersViewModel >> streamingCodersViewModel [ + "Return a not-null streamingCodersViewModel assigned to the receiver" + + >#objectGetterTemplate'> + self + assert: [ streamingCodersViewModel notNil ] + description: [ 'streamingCodersViewModel should be initialized' ]. + + ^ streamingCodersViewModel +] + +{ #category : #'api - streaming coders view model' } +TGtWithStreamingCodersViewModel >> streamingCodersViewModel: aStreamingCodersViewModel [ + "Set a not-null streamingCodersViewModel assigned to the receiver" + + >#objectSetterTemplate'> + self + assert: [ aStreamingCodersViewModel notNil ] + description: [ 'streamingCodersViewModel must not be nil' ]. + + streamingCodersViewModel == aStreamingCodersViewModel + ifTrue: [ ^ self ]. + + streamingCodersViewModel ifNotNil: [ self unsubscribeFromStreamingCodersViewModel ]. + streamingCodersViewModel := aStreamingCodersViewModel. + + self onStreamingCodersViewModelChanged. + self subscribeToStreamingCodersViewModel. + self onPostStreamingCodersViewModelChanged +] + +{ #category : #'api - streaming coders view model' } +TGtWithStreamingCodersViewModel >> subscribeToStreamingCodersViewModel [ + "Is sent after a new streamingCodersViewModel is assigned to the receiver. + It is required to unsubscribe from the previously subscribed objects by implementing + #unsubscribeFromStreamingCodersViewModel if the receiver subscribes to them" + + >#subscribeToObjectTemplate'> +] + +{ #category : #'api - streaming coders view model' } +TGtWithStreamingCodersViewModel >> unsubscribeFromStreamingCodersViewModel [ + "Is sent before a new streamingCodersViewModel is assigned to the receiver. + Objects that subscribe to streamingCodersViewModel are required to implement this method." + + >#unsubscribeFromObjectTemplate'> +] diff --git a/src/GToolkit-Coder-StreamingCoders-UI/package.st b/src/GToolkit-Coder-StreamingCoders-UI/package.st new file mode 100644 index 000000000..f5a86f2e6 --- /dev/null +++ b/src/GToolkit-Coder-StreamingCoders-UI/package.st @@ -0,0 +1 @@ +Package { #name : #'GToolkit-Coder-StreamingCoders-UI' } diff --git a/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersAdditionalFiltersReason.class.st b/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersAdditionalFiltersReason.class.st new file mode 100644 index 000000000..8853786b8 --- /dev/null +++ b/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersAdditionalFiltersReason.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtFilteredCodersAdditionalFiltersReason, + #superclass : #GtStreamingCodersStreamChangedReason, + #category : #'GToolkit-Coder-StreamingCoders-Events' +} diff --git a/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersFilterReason.class.st b/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersFilterReason.class.st new file mode 100644 index 000000000..8dd968095 --- /dev/null +++ b/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersFilterReason.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtFilteredCodersFilterReason, + #superclass : #GtStreamingCodersStreamChangedReason, + #category : #'GToolkit-Coder-StreamingCoders-Events' +} diff --git a/src/GToolkit-Coder/GtFilteredCodersModel.class.st b/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st similarity index 79% rename from src/GToolkit-Coder/GtFilteredCodersModel.class.st rename to src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st index 46cc9de7b..3f0621699 100644 --- a/src/GToolkit-Coder/GtFilteredCodersModel.class.st +++ b/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st @@ -5,7 +5,7 @@ Class { 'filter', 'additionalFilters' ], - #category : #'GToolkit-Coder-Coders' + #category : #'GToolkit-Coder-StreamingCoders-Coder' } { #category : #'instance creation' } @@ -22,7 +22,9 @@ GtFilteredCodersModel >> additionalFilters [ GtFilteredCodersModel >> additionalFilters: aCollectionOfFilters [ monitor critical: [ additionalFilters := aCollectionOfFilters asArray. - self itemsStream: (self createItemsStreamForFilter: filter andAdditionalFilters: additionalFilters) ] + self + itemsStream: (self createItemsStreamForFilter: filter andAdditionalFilters: additionalFilters) + dueTo: GtFilteredCodersAdditionalFiltersReason new ] ] { #category : #'private - instance creation' } @@ -52,12 +54,15 @@ GtFilteredCodersModel >> filter [ GtFilteredCodersModel >> filter: aGtSearchFilter [ monitor critical: [ filter := aGtSearchFilter. - self itemsStream: (self createItemsStreamForFilter: filter andAdditionalFilters: additionalFilters) ] + self + itemsStream: (self createItemsStreamForFilter: filter andAdditionalFilters: additionalFilters) + dueTo: GtFilteredCodersFilterReason new ] ] { #category : #initialization } GtFilteredCodersModel >> initialize [ super initialize. + filter := GtSearchNullFilter new. additionalFilters := #() ] diff --git a/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersAddedReason.class.st b/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersAddedReason.class.st new file mode 100644 index 000000000..3bb56fc0e --- /dev/null +++ b/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersAddedReason.class.st @@ -0,0 +1,20 @@ +Class { + #name : #GtStreamingCodersAddedReason, + #superclass : #GtStreamingCodersStreamChangedReason, + #instVars : [ + 'coder' + ], + #category : #'GToolkit-Coder-StreamingCoders-Events' +} + +{ #category : #accessing } +GtStreamingCodersAddedReason >> coder [ + + ^ coder +] + +{ #category : #accessing } +GtStreamingCodersAddedReason >> coder: anObject [ + + coder := anObject +] diff --git a/src/GToolkit-Coder/GtStreamingCodersModel.class.st b/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersModel.class.st similarity index 82% rename from src/GToolkit-Coder/GtStreamingCodersModel.class.st rename to src/GToolkit-Coder-StreamingCoders/GtStreamingCodersModel.class.st index b733a18fc..cbbcd7563 100644 --- a/src/GToolkit-Coder/GtStreamingCodersModel.class.st +++ b/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersModel.class.st @@ -1,8 +1,6 @@ Class { #name : #GtStreamingCodersModel, #superclass : #Object, - #traits : 'TGtOptions', - #classTraits : 'TGtOptions classTrait', #instVars : [ 'announcer', 'monitor', @@ -10,7 +8,7 @@ Class { 'itemsStream', 'codersStream' ], - #category : #'GToolkit-Coder-Coders' + #category : #'GToolkit-Coder-StreamingCoders-Coder' } { #category : #'api - announcer' } @@ -53,12 +51,19 @@ GtStreamingCodersModel >> itemsStream [ ] { #category : #'private - accessing' } -GtStreamingCodersModel >> itemsStream: anAsyncStream [ +GtStreamingCodersModel >> itemsStream: anAsyncStream dueTo: aReasonObject [ + "Change the items stream to a given one due to a provided reason. + Please not that the new stream must not be the same stream as an existing #itemsStream" + + self + assert: [ itemsStream ~~ anAsyncStream ] + description: [ 'Must not pass the same stream as the current one' ]. + monitor critical: [ itemsStream := anAsyncStream cached. codersStream := itemsStream map: [ :eachItem | self newCoderFor: eachItem ] cache: coders ]. - self notifyStreamChanged + self notifyStreamChangedDueTo: aReasonObject ] { #category : #'private - instance creation' } @@ -67,13 +72,8 @@ GtStreamingCodersModel >> newCoderFor: anObject [ ] { #category : #'private - notifying' } -GtStreamingCodersModel >> notifyChanged [ - self announce: (GtCodersCodersChanged new coders: self) -] - -{ #category : #'private - notifying' } -GtStreamingCodersModel >> notifyStreamChanged [ - self announce: (GtCodersStreamChanged new coders: self) +GtStreamingCodersModel >> notifyStreamChangedDueTo: aReasonObject [ + self announce: (GtStreamingCodersStreamChanged new dueTo: aReasonObject) ] { #category : #'private - instance creation' } diff --git a/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersRemovedReason.class.st b/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersRemovedReason.class.st new file mode 100644 index 000000000..d14599b6e --- /dev/null +++ b/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersRemovedReason.class.st @@ -0,0 +1,20 @@ +Class { + #name : #GtStreamingCodersRemovedReason, + #superclass : #GtStreamingCodersStreamChangedReason, + #instVars : [ + 'coder' + ], + #category : #'GToolkit-Coder-StreamingCoders-Events' +} + +{ #category : #accessing } +GtStreamingCodersRemovedReason >> coder [ + + ^ coder +] + +{ #category : #accessing } +GtStreamingCodersRemovedReason >> coder: anObject [ + + coder := anObject +] diff --git a/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersStreamChanged.class.st b/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersStreamChanged.class.st new file mode 100644 index 000000000..bece762b9 --- /dev/null +++ b/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersStreamChanged.class.st @@ -0,0 +1,25 @@ +Class { + #name : #GtStreamingCodersStreamChanged, + #superclass : #Announcement, + #instVars : [ + 'dueTo' + ], + #category : #'GToolkit-Coder-StreamingCoders-Events' +} + +{ #category : #accessing } +GtStreamingCodersStreamChanged >> dueTo [ + + ^ dueTo +] + +{ #category : #accessing } +GtStreamingCodersStreamChanged >> dueTo: anObject [ + + dueTo := anObject +] + +{ #category : #accessing } +GtStreamingCodersStreamChanged >> isDueTo: aReasonClass [ + ^ dueTo isKindOf: aReasonClass +] diff --git a/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersStreamChangedReason.class.st b/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersStreamChangedReason.class.st new file mode 100644 index 000000000..d2cd4b3c6 --- /dev/null +++ b/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersStreamChangedReason.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtStreamingCodersStreamChangedReason, + #superclass : #Object, + #category : #'GToolkit-Coder-StreamingCoders-Events' +} diff --git a/src/GToolkit-Coder-StreamingCoders/ManifestGToolkitCoderStreamingCoders.class.st b/src/GToolkit-Coder-StreamingCoders/ManifestGToolkitCoderStreamingCoders.class.st new file mode 100644 index 000000000..83c07e14c --- /dev/null +++ b/src/GToolkit-Coder-StreamingCoders/ManifestGToolkitCoderStreamingCoders.class.st @@ -0,0 +1,19 @@ +" +Please describe the package using the class comment of the included manifest class. The manifest class also includes other additional metadata for the package. These meta data are used by other tools such as the SmalllintManifestChecker and the critics Browser +" +Class { + #name : #ManifestGToolkitCoderStreamingCoders, + #superclass : #PackageManifest, + #category : #'GToolkit-Coder-StreamingCoders-Manifest' +} + +{ #category : #accessing } +ManifestGToolkitCoderStreamingCoders class >> mustOnlyDependOn [ + ^ { + 'Announcements-Core'. + 'Collections-Unordered'. + 'Futures'. + 'GToolkit-SearchFilters'. + 'Kernel' + } +] diff --git a/src/GToolkit-Coder-StreamingCoders/TGtWithStreamingCodersModel.trait.st b/src/GToolkit-Coder-StreamingCoders/TGtWithStreamingCodersModel.trait.st new file mode 100644 index 000000000..edf48d3af --- /dev/null +++ b/src/GToolkit-Coder-StreamingCoders/TGtWithStreamingCodersModel.trait.st @@ -0,0 +1,84 @@ +Trait { + #name : #TGtWithStreamingCodersModel, + #instVars : [ + 'streamingCodersModel' + ], + #category : #'GToolkit-Coder-StreamingCoders-Coder' +} + +{ #category : #'api - streaming coders model' } +TGtWithStreamingCodersModel >> hasStreamingCodersModel [ + "Return a true if nil is assigned to the receiver, false otherwise" + + + >#hasObjectTemplate'> + + ^ streamingCodersModel notNil +] + +{ #category : #'api - streaming coders model' } +TGtWithStreamingCodersModel >> onPostStreamingCodersModelChanged [ + "I am an optional hook method that is sent after #subscribeToStreamingCodersModel. + I do nothing by default but allow users to perform update operations when a receiver object is already + subscribed to announcements." + >#onPostObjectChangedTemplate'> +] + +{ #category : #'api - streaming coders model' } +TGtWithStreamingCodersModel >> onStreamingCodersModelChanged [ + "Is sent when a new streamingCodersModel is assigned to the receiver. + Note: #onStreamingCodersModelChanged is sent before #subscribeToStreamingCodersModel + which means that if you perform any operation that triggers an announcement it will be ignored because the receiver + didn't get a chance to subscribe to any announcement. Override #onPostStreamingCodersModelChanged if you + wish to perform an operation that requires an announcement, but keep in mind that this is not the most efficient way" + >#onObjectChangedTemplate'> +] + +{ #category : #'api - streaming coders model' } +TGtWithStreamingCodersModel >> streamingCodersModel [ + "Return a not-null streamingCodersModel assigned to the receiver" + + >#objectGetterTemplate'> + self + assert: [ streamingCodersModel notNil ] + description: [ 'streamingCodersModel should be initialized' ]. + + ^ streamingCodersModel +] + +{ #category : #'api - streaming coders model' } +TGtWithStreamingCodersModel >> streamingCodersModel: aStreamingCodersModel [ + "Set a not-null streamingCodersModel assigned to the receiver" + + >#objectSetterTemplate'> + self + assert: [ aStreamingCodersModel notNil ] + description: [ 'streamingCodersModel must not be nil' ]. + + streamingCodersModel == aStreamingCodersModel + ifTrue: [ ^ self ]. + + streamingCodersModel ifNotNil: [ self unsubscribeFromStreamingCodersModel ]. + streamingCodersModel := aStreamingCodersModel. + + self onStreamingCodersModelChanged. + self subscribeToStreamingCodersModel. + self onPostStreamingCodersModelChanged +] + +{ #category : #'api - streaming coders model' } +TGtWithStreamingCodersModel >> subscribeToStreamingCodersModel [ + "Is sent after a new streamingCodersModel is assigned to the receiver. + It is required to unsubscribe from the previously subscribed objects by implementing + #unsubscribeFromStreamingCodersModel if the receiver subscribes to them" + + >#subscribeToObjectTemplate'> +] + +{ #category : #'api - streaming coders model' } +TGtWithStreamingCodersModel >> unsubscribeFromStreamingCodersModel [ + "Is sent before a new streamingCodersModel is assigned to the receiver. + Objects that subscribe to streamingCodersModel are required to implement this method." + + >#unsubscribeFromObjectTemplate'> +] diff --git a/src/GToolkit-Coder-StreamingCoders/package.st b/src/GToolkit-Coder-StreamingCoders/package.st new file mode 100644 index 000000000..e57076b14 --- /dev/null +++ b/src/GToolkit-Coder-StreamingCoders/package.st @@ -0,0 +1 @@ +Package { #name : #'GToolkit-Coder-StreamingCoders' } diff --git a/src/GToolkit-Coder/GtCodersStreamChanged.class.st b/src/GToolkit-Coder/GtCodersStreamChanged.class.st deleted file mode 100644 index 7d71dfe59..000000000 --- a/src/GToolkit-Coder/GtCodersStreamChanged.class.st +++ /dev/null @@ -1,5 +0,0 @@ -Class { - #name : #GtCodersStreamChanged, - #superclass : #GtCodersAnnouncement, - #category : #'GToolkit-Coder-Event' -} diff --git a/src/GToolkit-SearchFilters/ManifestGToolkitSearchFilters.class.st b/src/GToolkit-SearchFilters/ManifestGToolkitSearchFilters.class.st new file mode 100644 index 000000000..ab27ce828 --- /dev/null +++ b/src/GToolkit-SearchFilters/ManifestGToolkitSearchFilters.class.st @@ -0,0 +1,18 @@ +" +Please describe the package using the class comment of the included manifest class. The manifest class also includes other additional metadata for the package. These meta data are used by other tools such as the SmalllintManifestChecker and the critics Browser +" +Class { + #name : #ManifestGToolkitSearchFilters, + #superclass : #PackageManifest, + #category : #'GToolkit-SearchFilters-Manifest' +} + +{ #category : #accessing } +ManifestGToolkitSearchFilters class >> mustOnlyDependOn [ + ^ { + 'Announcements-Core'. + 'Collections-Unordered'. + 'Futures'. + 'Kernel' + } +] diff --git a/src/GToolkit-VariableBindings/ManifestGToolkitVariableBindings.class.st b/src/GToolkit-VariableBindings/ManifestGToolkitVariableBindings.class.st new file mode 100644 index 000000000..f66b3720f --- /dev/null +++ b/src/GToolkit-VariableBindings/ManifestGToolkitVariableBindings.class.st @@ -0,0 +1,17 @@ +" +Please describe the package using the class comment of the included manifest class. The manifest class also includes other additional metadata for the package. These meta data are used by other tools such as the SmalllintManifestChecker and the critics Browser +" +Class { + #name : #ManifestGToolkitVariableBindings, + #superclass : #PackageManifest, + #category : #'GToolkit-VariableBindings-Manifest' +} + +{ #category : #accessing } +ManifestGToolkitVariableBindings class >> mustOnlyDependOn [ + ^ { + 'Collections-Sequenceable'. + 'Collections-Unordered'. + 'Kernel' + } +] From 1ed468b94da327aa74e2a44fb4ca42d9d256dd27 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Sun, 28 Nov 2021 18:15:41 +0100 Subject: [PATCH 0099/1268] fix BaselineOfGToolkitCoder --- src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st b/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st index e49784db7..13af24533 100644 --- a/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st +++ b/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st @@ -68,8 +68,6 @@ BaselineOfGToolkitCoder >> baseline: spec [ package: 'GToolkit-Coder-UI' with: [ spec requires: #( 'GToolkit-Coder' 'GToolkit-VariableBindings' 'GToolkitBasicUtility' 'GToolkitPager' ) ]; - package: 'GToolkit-Coder-UI-StreamingCoders' with: [ - spec requires: #( 'Futures' 'GToolkit-Coder' ) ]; package: 'GToolkit-Coder-AddOns' with: [ spec requires: #( 'GToolkit-Coder' 'GToolkit-Coder-UI' ) ]; package: 'GToolkit-Coder-Extensions' with: [ From 0668d0c8986a9716eb7b357223b76a09556fdd83 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Sun, 28 Nov 2021 21:54:02 +0100 Subject: [PATCH 0100/1268] add telemetry to the navigation elements --- ...derNavigationClassHierachyElement.class.st | 10 +++-- ...igationPackagesTagsClassesElement.class.st | 37 ++++++++++++++----- 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassHierachyElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassHierachyElement.class.st index 834d11849..5d26266e1 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassHierachyElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassHierachyElement.class.st @@ -1,7 +1,7 @@ Class { #name : #GtCoderNavigationClassHierachyElement, #superclass : #GtCoderNavigationElement, - #category : 'GToolkit-Coder-UI-Navigation' + #category : #'GToolkit-Coder-UI-Navigation' } { #category : #initialization } @@ -61,8 +61,12 @@ GtCoderNavigationClassHierachyElement >> onPackageSelected: anAnnouncer [ GtCoderNavigationClassHierachyElement >> onPackageTagSelected: anAnnouncer [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ - self emptyClassList. - self deselectClasses. ]. + BlFrameTelemetry + time: [ 'Empty class list' ] + during: [ self emptyClassList ]. + BlFrameTelemetry + time: [ 'Deselect classes' ] + during: [ self deselectClasses ] ]. ] { #category : #'event handling' } diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 3450e70f3..0b18d3a3f 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -9,7 +9,7 @@ Class { 'protocolLabel', 'coderFilterChangesSubscription' ], - #category : 'GToolkit-Coder-UI-Navigation' + #category : #'GToolkit-Coder-UI-Navigation' } { #category : #'api - package updates' } @@ -156,8 +156,14 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackageListSelectionChanged [ ifFalse: [ ^ self ]. aSelectedItem := (packagesList viewModel itemAt: anIndex) value. (aSelectedItem isKindOf: RPackage) - ifTrue: [ self navigationModel selectPackage: aSelectedItem ] - ifFalse: [ self navigationModel selectTag: aSelectedItem ] + ifTrue: [ + BlFrameTelemetry + time: [ 'Select package ', aSelectedItem printString ] + during: [ self navigationModel selectPackage: aSelectedItem ] ] + ifFalse: [ + BlFrameTelemetry + time: [ 'Select tag ', aSelectedItem printString ] + during: [ self navigationModel selectTag: aSelectedItem ] ] ] { #category : #'event handling' } @@ -203,9 +209,11 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackageTagRemoved: anAnnounceme GtCoderNavigationPackagesTagsClassesElement >> onPackageTagSelected: anAnnouncer [ supressNavigationChanges ifTrue: [ ^ self ]. self suppressListChangeEventsDuring: [ - self - selectPackage: anAnnouncer package - tag: anAnnouncer tag. + BlFrameTelemetry + time: [ 'Select package ', anAnnouncer package printString, ' tag ', anAnnouncer tag printString ] + during: [ self + selectPackage: anAnnouncer package + tag: anAnnouncer tag ]. self deselectClasses. ]. ] @@ -329,7 +337,9 @@ GtCoderNavigationPackagesTagsClassesElement >> selectPackage: aPackage tag: aPac (self hasPackageTagsIn: aPackage) ifFalse: [ ^ self selectPackage: aPackage ]. self expandPackage: aPackage. + aPreviousIndex := packagesList selectedIndice. + packagesList viewModel indexOf: aPackageTag do: [ :aNewIndex | @@ -340,8 +350,14 @@ GtCoderNavigationPackagesTagsClassesElement >> selectPackage: aPackage tag: aPac scrollIndexFromPrevious: aPreviousIndex current: aNewIndex max: packagesList viewModel itemCount) ]. - self updateClassLists. - self hideOrShowClassList + + BlFrameTelemetry + time: [ self class name, ' #updateClassLists' ] + during: [ self updateClassLists ]. + + BlFrameTelemetry + time: [ self class name, ' #hideOrShowClassList' ] + during: [ self hideOrShowClassList ] ] { #category : #'api - package selections' } @@ -413,7 +429,10 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToNavigationModel [ GtCoderNavigationPackagesTagsClassesElement >> subscribeToPackageList [ packagesList when: BrSelectionChanged - do: [ :anEvent | self onPackageListSelectionChanged ]. + do: [ :anEvent | + BlFrameTelemetry + time: [ self class name, ' #onPackageListSelectionChanged' ] + during: [ self onPackageListSelectionChanged ] ]. ] { #category : #subscriptions } From 2010556a971c44d76e81c32fceaef584570d1f2d Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 29 Nov 2021 16:39:01 +0100 Subject: [PATCH 0101/1268] [feenkcom/gtoolkit#2224] move header and highlighter properties to the view model --- .../GtStreamingCodersViewModel.class.st | 2 +- .../GtFilteredCodersModel.class.st | 35 ++++++++++++++----- .../GtFilterDescriptor.class.st | 23 ++++++++---- .../GtFilterTagElement.class.st | 29 +++++++-------- .../GtFiltersElement.class.st | 22 +++++++++--- .../GtTextualCoder.extension.st | 16 --------- .../GtTextualCoderViewModel.class.st | 27 +++++++++++--- 7 files changed, 100 insertions(+), 54 deletions(-) delete mode 100644 src/GToolkit-Coder-UI/GtTextualCoder.extension.st diff --git a/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModel.class.st b/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModel.class.st index 866b4efb7..92273ffde 100644 --- a/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModel.class.st +++ b/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModel.class.st @@ -53,7 +53,7 @@ GtStreamingCodersViewModel >> initialize [ super initialize. monitor := Monitor new. - coderViewModels := Dictionary new. + coderViewModels := AsyncSharedDictionary new. pendingCommands := OrderedCollection new. coderViewModelsStream := AsyncEmptyStream new ] diff --git a/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st b/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st index 3f0621699..0e0610f89 100644 --- a/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st +++ b/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st @@ -3,7 +3,8 @@ Class { #superclass : #GtStreamingCodersModel, #instVars : [ 'filter', - 'additionalFilters' + 'additionalFilters', + 'compositeFilter' ], #category : #'GToolkit-Coder-StreamingCoders-Coder' } @@ -15,6 +16,8 @@ GtFilteredCodersModel class >> forFilter: aGtSearchFilter [ { #category : #'api - accessing' } GtFilteredCodersModel >> additionalFilters [ + + ^ additionalFilters ] @@ -22,16 +25,26 @@ GtFilteredCodersModel >> additionalFilters [ GtFilteredCodersModel >> additionalFilters: aCollectionOfFilters [ monitor critical: [ additionalFilters := aCollectionOfFilters asArray. + compositeFilter := self + createCombinedFilterFor: filter + andAdditionalFilters: additionalFilters. self - itemsStream: (self createItemsStreamForFilter: filter andAdditionalFilters: additionalFilters) + itemsStream: compositeFilter asAsyncStream dueTo: GtFilteredCodersAdditionalFiltersReason new ] ] +{ #category : #'api - accessing' } +GtFilteredCodersModel >> compositeFilter [ + + + ^ compositeFilter +] + { #category : #'private - instance creation' } -GtFilteredCodersModel >> createItemsStreamForFilter: aMainSearchFilter andAdditionalFilters: aCollectionOfFilters [ +GtFilteredCodersModel >> createCombinedFilterFor: aMainSearchFilter andAdditionalFilters: aCollectionOfFilters [ "Given a main search filter and a potentially empty collection of additional filters, - create a stream over the results of a composition of those filters" - + create a composition of those filters" + | aCompositeFilter | aCompositeFilter := aCollectionOfFilters @@ -42,11 +55,13 @@ GtFilteredCodersModel >> createItemsStreamForFilter: aMainSearchFilter andAdditi ifNil: [ aMainSearchFilter ] ifNotNil: [ aMainSearchFilter & aCompositeFilter ]. - ^ aCompositeFilter asAsyncStream + ^ aCompositeFilter ] { #category : #'api - accessing' } GtFilteredCodersModel >> filter [ + + ^ filter ] @@ -54,8 +69,11 @@ GtFilteredCodersModel >> filter [ GtFilteredCodersModel >> filter: aGtSearchFilter [ monitor critical: [ filter := aGtSearchFilter. + compositeFilter := self + createCombinedFilterFor: filter + andAdditionalFilters: additionalFilters. self - itemsStream: (self createItemsStreamForFilter: filter andAdditionalFilters: additionalFilters) + itemsStream: compositeFilter asAsyncStream dueTo: GtFilteredCodersFilterReason new ] ] @@ -64,5 +82,6 @@ GtFilteredCodersModel >> initialize [ super initialize. filter := GtSearchNullFilter new. - additionalFilters := #() + additionalFilters := #(). + compositeFilter := GtSearchNullFilter new. ] diff --git a/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st b/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st index 37de44938..b8fd256d0 100644 --- a/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st +++ b/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st @@ -14,13 +14,14 @@ Class { #instVars : [ 'name', 'order', - 'completion', 'emptyDefaultValue', 'creationBlock', 'valueIsRequired', - 'isDefault' + 'isDefault', + 'completionBlock', + 'completion' ], - #category : 'GToolkit-Coder-UI-Filters' + #category : #'GToolkit-Coder-UI-Filters' } { #category : #'instace creation' } @@ -61,12 +62,12 @@ GtFilterDescriptor >> beNotDefault [ { #category : #accessing } GtFilterDescriptor >> completion [ - ^ completion + ^ completion ifNil: [ completion := completionBlock value ] ] { #category : #accessing } -GtFilterDescriptor >> completion: completionStrategy [ - completion := completionStrategy +GtFilterDescriptor >> completion: completionStrategyBlock [ + completionBlock := completionStrategyBlock ] { #category : #accessing } @@ -74,6 +75,11 @@ GtFilterDescriptor >> creationBlock: aBlock [ creationBlock := aBlock ] +{ #category : #accessing } +GtFilterDescriptor >> creator: aBlock [ + creationBlock := aBlock +] + { #category : #accessing } GtFilterDescriptor >> emptyDefaultValue [ ^ emptyDefaultValue @@ -113,6 +119,11 @@ GtFilterDescriptor >> name: aString [ name := aString ] +{ #category : #accessing } +GtFilterDescriptor >> named: aString [ + name := aString +] + { #category : #filters } GtFilterDescriptor >> newFilterWithValue: aString [ ^ creationBlock value: aString diff --git a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st index 1b0ce38ae..2bff9ebf5 100644 --- a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st @@ -19,7 +19,7 @@ Class { 'valueString', 'filterElement' ], - #category : 'GToolkit-Coder-UI-Filters' + #category : #'GToolkit-Coder-UI-Filters' } { #category : #actions } @@ -43,9 +43,16 @@ GtFilterTagElement >> applyDescriptor: aDescriptor [ { #category : #elements } GtFilterTagElement >> buildTagElements [ self removeChildren. - self addChild: self createDropDown as: #dropDown. + + BlFrameTelemetry + time: [ 'Create and add dropdown' ] + during: [ self addChild: self createDropDown as: #dropDown ]. + descriptor valueIsRequired - ifTrue: [ self addChild: self createEditableLabel as: #editableLabel ] + ifTrue: [ + BlFrameTelemetry + time: [ 'Create and add editable label' ] + during: [ self addChild: self createEditableLabel as: #editableLabel ] ] ] { #category : #elements } @@ -117,19 +124,11 @@ GtFilterTagElement >> createDropDownButton [ { #category : #elements } GtFilterTagElement >> createEditableLabel [ | label | + label := BrEditableLabel new. - label - aptitude: - BrGlamorousEditableLabelAptitude new glamorousRegularFont - glamorousRegularSmallSize. + label aptitude: BrGlamorousEditableLabelAptitude new glamorousRegularFont glamorousRegularSmallSize. label text: (valueString ifNil: [ '' ]). - label - padding: - (BlInsets - top: 2 - left: 4 - bottom: 2 - right: 4). + label padding: (BlInsets top: 2 left: 4 bottom: 2 right: 4). label when: BrEditorAcceptWish do: [ :aWish | @@ -148,9 +147,11 @@ GtFilterTagElement >> createEditableLabel [ labelDo: [ :aShortcutEvent :aShortcut | self removeFromParent. filterElement applyFilters ]. + descriptor completion ifNotNil: [ :strategy | (GtCompletionController on: label strategy: strategy) install ]. + ^ label ] diff --git a/src/GToolkit-Coder-UI/GtFiltersElement.class.st b/src/GToolkit-Coder-UI/GtFiltersElement.class.st index fded05c69..df0979054 100644 --- a/src/GToolkit-Coder-UI/GtFiltersElement.class.st +++ b/src/GToolkit-Coder-UI/GtFiltersElement.class.st @@ -16,21 +16,32 @@ Class { #instVars : [ 'descriptors' ], - #category : 'GToolkit-Coder-UI-Filters' + #category : #'GToolkit-Coder-UI-Filters' } { #category : #accessing } GtFiltersElement >> addEmptyDefault [ | filterElement defaultDescriptor | + self childrenCount = 1 ifFalse: [ ^ self ]. + defaultDescriptor := self descriptors - detect: [ :each | each showAsDefaultWhenEmpty ] + detect: [ :each | + BlFrameTelemetry + time: [ 'Should show ', each name, ' as default when empty?' ] + during: [ each showAsDefaultWhenEmpty ] ] ifNone: [ ^ self ]. + filterElement := GtFilterTagElement new. filterElement filter: self. - filterElement descriptor: defaultDescriptor. + + BlFrameTelemetry + time: [ 'Assign default descriptor ', defaultDescriptor name, ' to the filter tag' ] + during: [ filterElement descriptor: defaultDescriptor ]. + filterElement makeDefaultFilter. + self addChild: filterElement at: self childrenCount ] @@ -85,7 +96,10 @@ GtFiltersElement >> descriptors [ { #category : #accessing } GtFiltersElement >> descriptors: aCollection [ descriptors := aCollection. - self addEmptyDefault + + BlFrameTelemetry + time: [ 'Add default filter tag' ] + during: [ self addEmptyDefault ] ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtTextualCoder.extension.st b/src/GToolkit-Coder-UI/GtTextualCoder.extension.st deleted file mode 100644 index 167db31e0..000000000 --- a/src/GToolkit-Coder-UI/GtTextualCoder.extension.st +++ /dev/null @@ -1,16 +0,0 @@ -Extension { #name : #GtTextualCoder } - -{ #category : #'*GToolkit-Coder-UI' } -GtTextualCoder >> wantsHeader [ - ^ self attributeNamed: #withHeader ifAbsent: [ true ] -] - -{ #category : #'*GToolkit-Coder-UI' } -GtTextualCoder >> withHeader [ - self attributeNamed: #withHeader put: true -] - -{ #category : #'*GToolkit-Coder-UI' } -GtTextualCoder >> withoutHeader [ - self attributeNamed: #withHeader put: false -] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index cebb08dfd..4e3627f04 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -14,7 +14,8 @@ Class { 'cursors', 'selection', 'extraTextAttributes', - 'styledText' + 'styledText', + 'shouldHaveHeader' ], #category : #'GToolkit-Coder-UI-Coder - Textual Model' } @@ -405,7 +406,7 @@ GtTextualCoderViewModel >> hasStyledText [ ^ styledText notNil ] -{ #category : #accessing } +{ #category : #'api - header' } GtTextualCoderViewModel >> headerElementClass [ ^ nil ] @@ -426,7 +427,8 @@ GtTextualCoderViewModel >> initialize [ extraTextAttributes := OrderedCollection new. hasFocus := false. - expanded := true + expanded := true. + shouldHaveHeader := false ] { #category : #'api - add-ons' } @@ -631,6 +633,11 @@ GtTextualCoderViewModel >> shouldAddOnsBeUpdated [ ifNotNil: [ :theAddOns | theAddOns wait shouldBeUpdated ] ] +{ #category : #'api - header' } +GtTextualCoderViewModel >> shouldHaveHeader: aBoolean [ + shouldHaveHeader := aBoolean +] + { #category : #'api - text' } GtTextualCoderViewModel >> sourceText [ @@ -729,9 +736,19 @@ GtTextualCoderViewModel >> unsubscribeFromCoderModel [ self coderModel unsubscribe: self ] -{ #category : #accessing } +{ #category : #'api - header' } GtTextualCoderViewModel >> wantsHeader [ - ^ self coderModel wantsHeader and: [ self headerElementClass notNil ] + ^ shouldHaveHeader and: [ self headerElementClass notNil ] +] + +{ #category : #'api - header' } +GtTextualCoderViewModel >> withHeader [ + self shouldHaveHeader: true +] + +{ #category : #'api - header' } +GtTextualCoderViewModel >> withoutHeader [ + self shouldHaveHeader: false ] From d185f636995653886902350f68b0c4cab5265fd3 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 29 Nov 2021 18:03:42 +0100 Subject: [PATCH 0102/1268] [feenkcom/gtoolkit#2224] add filtered coders view model to handle filter and highlighter updates --- .../GtFilteredCodersViewModel.class.st | 64 +++++++++++++ ...teredCodersViewModelFilterChanged.class.st | 5 + .../GtFilterTagElement.class.st | 93 ++++++++----------- .../GtSearchBinaryFilter.class.st | 6 ++ .../GtSearchFilter.class.st | 5 + .../GtSearchNegationFilter.class.st | 5 + 6 files changed, 125 insertions(+), 53 deletions(-) create mode 100644 src/GToolkit-Coder-StreamingCoders-UI/GtFilteredCodersViewModel.class.st create mode 100644 src/GToolkit-Coder-StreamingCoders-UI/GtFilteredCodersViewModelFilterChanged.class.st diff --git a/src/GToolkit-Coder-StreamingCoders-UI/GtFilteredCodersViewModel.class.st b/src/GToolkit-Coder-StreamingCoders-UI/GtFilteredCodersViewModel.class.st new file mode 100644 index 000000000..68163a418 --- /dev/null +++ b/src/GToolkit-Coder-StreamingCoders-UI/GtFilteredCodersViewModel.class.st @@ -0,0 +1,64 @@ +Class { + #name : #GtFilteredCodersViewModel, + #superclass : #GtStreamingCodersViewModel, + #instVars : [ + 'highlighter' + ], + #category : #'GToolkit-Coder-StreamingCoders-UI-Coder' +} + +{ #category : #'api - accessing' } +GtFilteredCodersViewModel >> additionalFilters [ + + + ^ streamingCodersModel additionalFilters +] + +{ #category : #'api - accessing' } +GtFilteredCodersViewModel >> compositeFilter [ + + + ^ streamingCodersModel compositeFilter +] + +{ #category : #'private - notifying' } +GtFilteredCodersViewModel >> notifyFilterChanged [ + self announce: GtFilteredCodersViewModelFilterChanged new +] + +{ #category : #'private - event handling' } +GtFilteredCodersViewModel >> onCodersStreamChanged: anAnnouncement [ + super onCodersStreamChanged: anAnnouncement. + + ((anAnnouncement isDueTo: GtFilteredCodersFilterReason) + or: [ anAnnouncement isDueTo: GtFilteredCodersAdditionalFiltersReason ]) + ifFalse: [ ^ self ]. + + self onFilterChanged +] + +{ #category : #'private - event handling' } +GtFilteredCodersViewModel >> onFilterChanged [ + self updateFiltersHighlighter. + self notifyFilterChanged +] + +{ #category : #'api - streaming coders model' } +GtFilteredCodersViewModel >> onStreamingCodersModelChanged [ + "Is sent when a new streamingCodersModel is assigned to the receiver. + Note: #onStreamingCodersModelChanged is sent before #subscribeToStreamingCodersModel + which means that if you perform any operation that triggers an announcement it will be ignored because the receiver + didn't get a chance to subscribe to any announcement. Override #onPostStreamingCodersModelChanged if you + wish to perform an operation that requires an announcement, but keep in mind that this is not the most efficient way" + >#onObjectChangedTemplate'> + super onStreamingCodersModelChanged. + + self updateFiltersHighlighter +] + +{ #category : #'private - update' } +GtFilteredCodersViewModel >> updateFiltersHighlighter [ + highlighter := streamingCodersModel compositeFilter highlighter. + coderViewModels valuesDo: [ :eachCoderViewModel | + eachCoderViewModel highlighter: highlighter ] +] diff --git a/src/GToolkit-Coder-StreamingCoders-UI/GtFilteredCodersViewModelFilterChanged.class.st b/src/GToolkit-Coder-StreamingCoders-UI/GtFilteredCodersViewModelFilterChanged.class.st new file mode 100644 index 000000000..bb84d5138 --- /dev/null +++ b/src/GToolkit-Coder-StreamingCoders-UI/GtFilteredCodersViewModelFilterChanged.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtFilteredCodersViewModelFilterChanged, + #superclass : #Announcement, + #category : #'GToolkit-Coder-StreamingCoders-UI-Events' +} diff --git a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st index 2bff9ebf5..595fc80d8 100644 --- a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st @@ -37,7 +37,9 @@ GtFilterTagElement >> activateEditor [ GtFilterTagElement >> applyDescriptor: aDescriptor [ self descriptor: aDescriptor. self activateEditor. - filterElement applyFilters + + aDescriptor valueIsRequired + ifFalse: [ filterElement applyFilters ] ] { #category : #elements } @@ -61,47 +63,35 @@ GtFilterTagElement >> createDropDown [ button := self createDropDownButton. dropDownLook := BrGlamorousWithDropdownAptitude handle: [ self createDropDownButton ] - content: [ BrSimpleList new - items: filterElement descriptors; + content: [ + BrSimpleList new + fitContent; stencil: [ :each | - | element | - element := BlElement new. - element - viewModel: - (BrInteractiveModel new - withHover; - yourself); - aptitude: - (BrInteractiveCommonAptitude new - default: [ :f | f background: Color transparent ]; - hovered: [ :f | f background: self theme button defaultBorderColor ]; - yourself); - layout: BlLinearLayout horizontal; - constraintsDo: [ :c | - c horizontal matchParent. - c vertical fitContent ]; + BrHorizontalPane new + hMatchParent; + vFitContent; padding: (BlInsets all: 5); - addEventHandlerOn: BlClickEvent - do: [ button label: each name. - dropDownLook hide. - self applyDescriptor: each ]; - addChild: - (BrLabel new - aptitude: - BrGlamorousLabelAptitude new glamorousRegularFont - glamorousCodeSmallSize; - text: each name; - yourself). - element ]; - hFitContent; - vFitContent ]. + aptitude: (BrStyleCommonAptitude new + default: [ :s | s background: Color transparent ]; + hovered: [ :s | s background: self theme button defaultBorderColor ]; + yourself); + when: BlClickEvent + do: [ :anEvent | + anEvent consumed: true. + button label: each name. + anEvent currentTarget fireEvent: BrDropdownHideWish new. + self applyDescriptor: each ]; + addChild: (BrLabel new + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont glamorousCodeSmallSize; + text: each name; + yourself); + yourself ]; + items: filterElement descriptors; + yourself ]. button addAptitude: dropDownLook. - button - addAptitude: - (BrInteractiveCommonAptitude new - default: [ button background: Color transparent ]; - hovered: [ button background: - self theme status neutralBackgroundColor darker ]). + button addAptitude: (BrStyleCommonAptitude new + default: [ :s | s background: Color transparent ]; + hovered: [ :s | s background: self theme status neutralBackgroundColor darker ]). ^ button ] @@ -109,10 +99,7 @@ GtFilterTagElement >> createDropDown [ GtFilterTagElement >> createDropDownButton [ | button | button := BrButton new. - button - aptitude: - BrTextLabelAptitude new glamorousRegularFont glamorousCodeSmallSize - + BrGlamorousButtonIconAptitude + BrGlamorousButtonLayoutAptitude. + button aptitude: BrTextLabelAptitude new glamorousRegularFont glamorousCodeSmallSize + BrGlamorousButtonIconAptitude + BrGlamorousButtonLayoutAptitude. button vExact: 20. button padding: (BlInsets left: 4 right: 2). button label: self descriptor name. @@ -180,18 +167,18 @@ GtFilterTagElement >> filter: aGtMethodsFilter [ { #category : #'initialize-release' } GtFilterTagElement >> initialize [ super initialize. + self fitContent. self margin: (BlInsets all: 3). - self - addAptitude: - (BrStyleCommonAptitude new - default: [ :aStyle | - aStyle geometry: (BlRoundedRectangleGeometry cornerRadius: 4). - aStyle background: self theme status neutralBackgroundColor. - aStyle border: BlBorder empty ]; - hovered: [ :aStyle | - aStyle background: - self theme status neutralBackgroundColor darker ]) + self addAptitude: + (BrStyleCommonAptitude new + default: [ :aStyle | + aStyle geometry: (BlRoundedRectangleGeometry cornerRadius: 4). + aStyle background: self theme status neutralBackgroundColor. + aStyle border: BlBorder empty ]; + hovered: [ :aStyle | + aStyle background: + self theme status neutralBackgroundColor darker ]) ] { #category : #testing } diff --git a/src/GToolkit-SearchFilters/GtSearchBinaryFilter.class.st b/src/GToolkit-SearchFilters/GtSearchBinaryFilter.class.st index cabb75984..dc134b4f0 100644 --- a/src/GToolkit-SearchFilters/GtSearchBinaryFilter.class.st +++ b/src/GToolkit-SearchFilters/GtSearchBinaryFilter.class.st @@ -21,6 +21,12 @@ GtSearchBinaryFilter >> filter: leftFilter filter: rightFilter [ right := rightFilter ] +{ #category : #accessing } +GtSearchBinaryFilter >> filterValueString [ + ^ left filterValueString + ifNil: [ right filterValueString ] +] + { #category : #accessing } GtSearchBinaryFilter >> leftFilter [ ^ left diff --git a/src/GToolkit-SearchFilters/GtSearchFilter.class.st b/src/GToolkit-SearchFilters/GtSearchFilter.class.st index 624ca44b1..7bc43e3f9 100644 --- a/src/GToolkit-SearchFilters/GtSearchFilter.class.st +++ b/src/GToolkit-SearchFilters/GtSearchFilter.class.st @@ -31,6 +31,11 @@ GtSearchFilter >> do: aBlock [ (self result do: aBlock) wait ] +{ #category : #accessing } +GtSearchFilter >> filterValueString [ + ^ nil +] + { #category : #testing } GtSearchFilter >> isEmpty [ ^ self notEmpty not diff --git a/src/GToolkit-SearchFilters/GtSearchNegationFilter.class.st b/src/GToolkit-SearchFilters/GtSearchNegationFilter.class.st index 63fea9182..5f1b9c942 100644 --- a/src/GToolkit-SearchFilters/GtSearchNegationFilter.class.st +++ b/src/GToolkit-SearchFilters/GtSearchNegationFilter.class.st @@ -12,6 +12,11 @@ GtSearchNegationFilter >> defaultFilterScope [ ^ originalFilter defaultFilterScope ] +{ #category : #accessing } +GtSearchNegationFilter >> filterValueString [ + ^ originalFilter filterValueString +] + { #category : #printing } GtSearchNegationFilter >> gtDisplayOn: stream [ self originalFilter gtDisplayOn: stream. From d62555dbae01e442be9380380dc747a4091ccf00 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 29 Nov 2021 20:12:08 +0100 Subject: [PATCH 0103/1268] [feenkcom/gtoolkit#2224] GtTextualCoderViewModel should have header by default --- .../GtSingleCoderViewModel.class.st | 1 + src/GToolkit-Coder-UI/GtSourceCoderId.class.st | 13 +++++++++++++ .../GtSourceCoderProfileActionId.class.st | 2 -- .../GtTextualCoderViewModel.class.st | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderId.class.st diff --git a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st index e9ec13517..ae1112a86 100644 --- a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st @@ -35,6 +35,7 @@ GtSingleCoderViewModel >> asCoderUIModel [ GtSingleCoderViewModel >> asElement [ ^ self elementClass new coderUIModel: self; + id: GtSourceCoderId; yourself ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderId.class.st new file mode 100644 index 000000000..e6b17bc23 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderId.class.st @@ -0,0 +1,13 @@ +" +An element that represents a source coder +" +Class { + #name : #GtSourceCoderId, + #superclass : #GtCoderElementId, + #category : #'GToolkit-Coder-UI-Coder - Ids' +} + +{ #category : #converting } +GtSourceCoderId >> asSymbol [ + ^ #'source-coder' +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderProfileActionId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderProfileActionId.class.st index 37e8d2ce8..1f3f2f54f 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderProfileActionId.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderProfileActionId.class.st @@ -1,7 +1,5 @@ " A button to profile a piece of code - - " Class { #name : #GtSourceCoderProfileActionId, diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 4e3627f04..73cadb202 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -428,7 +428,7 @@ GtTextualCoderViewModel >> initialize [ hasFocus := false. expanded := true. - shouldHaveHeader := false + shouldHaveHeader := true ] { #category : #'api - add-ons' } From 23315d381099e0b45d7a0e3ee5d8b1b0a23be662 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 29 Nov 2021 20:19:24 +0100 Subject: [PATCH 0104/1268] [feenkcom/gtoolkit#2224] remove obsolete classes --- .../GtCategoryToggleAptitude.class.st | 20 -- .../GtClassBreadcrumbToggleAptitude.class.st | 25 --- .../GtCoderToggleAptitude.class.st | 45 ----- .../GtContextCoderVariableAptitude.class.st | 73 ------- .../GtFilterRunExampleButtonAptitude.class.st | 182 ------------------ ...xampleButtonFourStateIconAptitude.class.st | 152 --------------- ...ilterRunExampleButtonIconAptitude.class.st | 110 ----------- ...erRunExampleButtonTooltipAptitude.class.st | 108 ----------- 8 files changed, 715 deletions(-) delete mode 100644 src/GToolkit-Coder-UI/GtCategoryToggleAptitude.class.st delete mode 100644 src/GToolkit-Coder-UI/GtClassBreadcrumbToggleAptitude.class.st delete mode 100644 src/GToolkit-Coder-UI/GtCoderToggleAptitude.class.st delete mode 100644 src/GToolkit-Coder-UI/GtContextCoderVariableAptitude.class.st delete mode 100644 src/GToolkit-Coder-UI/GtFilterRunExampleButtonAptitude.class.st delete mode 100644 src/GToolkit-Coder-UI/GtFilterRunExampleButtonFourStateIconAptitude.class.st delete mode 100644 src/GToolkit-Coder-UI/GtFilterRunExampleButtonIconAptitude.class.st delete mode 100644 src/GToolkit-Coder-UI/GtFilterRunExampleButtonTooltipAptitude.class.st diff --git a/src/GToolkit-Coder-UI/GtCategoryToggleAptitude.class.st b/src/GToolkit-Coder-UI/GtCategoryToggleAptitude.class.st deleted file mode 100644 index 524b4fffe..000000000 --- a/src/GToolkit-Coder-UI/GtCategoryToggleAptitude.class.st +++ /dev/null @@ -1,20 +0,0 @@ -Class { - #name : #GtCategoryToggleAptitude, - #superclass : #GtCoderToggleAptitude, - #category : 'GToolkit-Coder-UI-Looks' -} - -{ #category : #accessing } -GtCategoryToggleAptitude >> initialize [ - super initialize. - self - addChangeProperty: #(widget layout) - with: [ BlLinearLayout horizontal alignCenter ]. - self - addChangeProperty: #(widget constraints horizontal resizer) - with: BlLayoutResizer fitContent. - self - addChangeProperty: #(widget constraints vertical resizer) - with: [ BlLayoutResizer exact: 16 ]. - self addChangeProperty: #(widget padding) with: [ BlInsets all: 6 ] -] diff --git a/src/GToolkit-Coder-UI/GtClassBreadcrumbToggleAptitude.class.st b/src/GToolkit-Coder-UI/GtClassBreadcrumbToggleAptitude.class.st deleted file mode 100644 index 3f4a5c6ba..000000000 --- a/src/GToolkit-Coder-UI/GtClassBreadcrumbToggleAptitude.class.st +++ /dev/null @@ -1,25 +0,0 @@ -Class { - #name : #GtClassBreadcrumbToggleAptitude, - #superclass : #BrAptitude, - #category : 'GToolkit-Coder-UI-Looks' -} - -{ #category : #accessing } -GtClassBreadcrumbToggleAptitude >> initialize [ - super initialize. - self - addChangeProperty: #(widget layout) - with: [ BlLinearLayout horizontal alignCenter ]. - self - addChangeProperty: #(widget constraints horizontal resizer) - with: BlLayoutResizer fitContent. - - self add: (BrGlamorousLabelAptitude new - foreground: Color black; - yourself). - - self add: (BrToggleAptitude new - // #label; - activated: [ :aStyle | aStyle foreground: Color black ]; - deactivated: [ :aStyle | aStyle foreground: Color gray ]) -] diff --git a/src/GToolkit-Coder-UI/GtCoderToggleAptitude.class.st b/src/GToolkit-Coder-UI/GtCoderToggleAptitude.class.st deleted file mode 100644 index 3473263dd..000000000 --- a/src/GToolkit-Coder-UI/GtCoderToggleAptitude.class.st +++ /dev/null @@ -1,45 +0,0 @@ -Class { - #name : #GtCoderToggleAptitude, - #superclass : #BrMaterialToggleBackgroundAptitude, - #category : 'GToolkit-Coder-UI-Looks' -} - -{ #category : #initialization } -GtCoderToggleAptitude >> defaultNormalBackground [ - ^ Color transparent -] - -{ #category : #initialization } -GtCoderToggleAptitude >> initialize [ - | interactiveLook | - super initialize. - self flag: 'Working around a toggled display issue'. - interactiveLook := self looks - detect: [ :each | each isKindOf: BrInteractiveAptitude ] - ifNone: [ nil ]. - interactiveLook notNil - ifTrue: [ interactiveLook - style: [ :aStyler | - aStyler default: [ :aWidget | self updateActivatedBackground ]. - aStyler - pressed: - [ :aWidget | aWidget background: self defaultCheckedBackground slightlyLighter ] ] ]. - self - add: BrMaterialRoundedAptitude new; - add: BrTextLabelAptitude new. - self - addChange: - (BrLookChange new - up: [ :e | - self flag: 'Working around a toggled display issue'. - self updateActivatedBackground ]; - down: [ :e | ]; - yourself) -] - -{ #category : #private } -GtCoderToggleAptitude >> updateActivatedBackground [ - self widget isActivated - ifTrue: [ self toggleActivated ] - ifFalse: [ self toggleDeactivated ] -] diff --git a/src/GToolkit-Coder-UI/GtContextCoderVariableAptitude.class.st b/src/GToolkit-Coder-UI/GtContextCoderVariableAptitude.class.st deleted file mode 100644 index a8e9d0d4a..000000000 --- a/src/GToolkit-Coder-UI/GtContextCoderVariableAptitude.class.st +++ /dev/null @@ -1,73 +0,0 @@ -Class { - #name : #GtContextCoderVariableAptitude, - #superclass : #BrAptitude, - #instVars : [ - 'methodCoder' - ], - #category : 'GToolkit-Coder-UI-Looks' -} - -{ #category : #initialization } -GtContextCoderVariableAptitude >> initialize [ - super initialize. - self - addChange: - (BrLookChange new - up: [ :e | - self widget - childNamed: #bodyElement - ifFound: [ :element | element addChild: self variablesElement ] - ifNone: [ ] ]; - down: [ :e | ]; - yourself) -] - -{ #category : #accessing } -GtContextCoderVariableAptitude >> methodCoder [ - ^ methodCoder -] - -{ #category : #accessing } -GtContextCoderVariableAptitude >> methodCoder: contextCoder [ - methodCoder := contextCoder -] - -{ #category : #private } -GtContextCoderVariableAptitude >> variables [ - | vars | - vars := OrderedCollection new. - methodCoder tempNamesAndValuesDo: [ :name :value | vars add: {name. 'temporary'. value} ]. - methodCoder instanceVariableNamesAndValuesDo: [ :name :value | vars add: {name. 'instance'. value} ]. - vars sort: [ :a :b | a first < b first ]. - vars addFirst: {'self'. 'self'. methodCoder receiver}. - methodCoder stackVariableNamesAndValuesDo: [ :name :value | vars add: {name. 'stack'. value} ]. - ^ vars -] - -{ #category : #initialization } -GtContextCoderVariableAptitude >> variablesElement [ - | variablesElement | - variablesElement := BrColumnedList new. - variablesElement - addEventHandler: - (GtPhlowListToSelectHandler new - transformation: [ :each | each last ]). - variablesElement column - title: 'Variable'; - stencil: [ :each | - BrLabel new - aptitude: (BrGlamorousLabelAptitude new foreground: Color black); - text: each first asString; - hMatchParent; - vMatchParent ]. - variablesElement column - title: 'Value'; - stencil: [ :each | - BrLabel new - aptitude: (BrGlamorousLabelAptitude new foreground: Color black); - text: (each last printStringLimitedTo: 50); - hMatchParent; - vMatchParent ]. - variablesElement display: self variables. - ^ variablesElement -] diff --git a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonAptitude.class.st b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonAptitude.class.st deleted file mode 100644 index 9c90ae21c..000000000 --- a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonAptitude.class.st +++ /dev/null @@ -1,182 +0,0 @@ -" -I am an abstract class. -I am a {{gtClass:BrLook}}. -I provide common behavior to update a {{gtClass:BrButton}} visual apperance based on {{gtClass:GtPharoMethodsCoder}} and {{gtClass:GtExampleWithResult}} changes. See my {{gtMethod:GtFilterRunExampleButtonAptitude>>#subscribeToCoder|label=subscriptions}} for more details. -Look at my {{gtClass:GtFilterRunExampleButtonAptitude|show=#gtSubclassesFor:|expanded=true|height=150}} for more details and examples: - - -" -Class { - #name : #GtFilterRunExampleButtonAptitude, - #superclass : #BrAptitude, - #instVars : [ - 'coder', - 'mutex', - 'isUpdateRequested' - ], - #category : #'GToolkit-Coder-UI-Filters' -} - -{ #category : #'private - updating' } -GtFilterRunExampleButtonAptitude >> beUpdateRequestedIfDoneEarlierDo: aBlock [ - mutex critical: [ - self isUpdateRequested ifTrue: aBlock. - isUpdateRequested := true. ] -] - -{ #category : #'api - accessing' } -GtFilterRunExampleButtonAptitude >> coder [ - - ^ coder -] - -{ #category : #'api - accessing' } -GtFilterRunExampleButtonAptitude >> coder: aGtFilteredMethodsCoder [ - coder = aGtFilteredMethodsCoder ifTrue: [ ^ self ]. - self unsubscribeFromCoder. - coder := aGtFilteredMethodsCoder. - self subscribeToCoder. - self onCoderChanged. -] - -{ #category : #'private - accessing' } -GtFilterRunExampleButtonAptitude >> coderDo: aBlock [ - self coder ifNotNil: aBlock -] - -{ #category : #'private - updating' } -GtFilterRunExampleButtonAptitude >> enqueueUpdate [ - self widgetAndCoderDo: [ :aWidget :aCoder | - aWidget enqueueTask: (BlTaskAction new action: [ - self updateNow ]) ]. -] - -{ #category : #'private - accessing' } -GtFilterRunExampleButtonAptitude >> exampler [ - - ^ self coder exampler -] - -{ #category : #'private - accessing' } -GtFilterRunExampleButtonAptitude >> examplerDo: aBlock [ - self coderDo: [ :aCoder | - aBlock cull: aCoder exampler ] -] - -{ #category : #initialization } -GtFilterRunExampleButtonAptitude >> initialize [ - super initialize. - isUpdateRequested := false. - mutex := Mutex new. -] - -{ #category : #initialization } -GtFilterRunExampleButtonAptitude >> initializeIconElement: anElement [ - anElement - geometry: BlSquare new; - margin: (BlInsets all: 1); - size: 8 @ 8. -] - -{ #category : #'private - testing' } -GtFilterRunExampleButtonAptitude >> isUpdateRequested [ - - ^ isUpdateRequested -] - -{ #category : #'api - hooks' } -GtFilterRunExampleButtonAptitude >> onAttachedTo: anElement [ - super onAttachedTo: anElement. - - self postponeUpdate. -] - -{ #category : #'private - hooks' } -GtFilterRunExampleButtonAptitude >> onCoderChanged [ - "We expect that the Coder is changed just once before the look is attached." - self beUpdateRequestedIfDoneEarlierDo: [ ^ self ]. - self updateNow. -] - -{ #category : #'private - announcement handling' } -GtFilterRunExampleButtonAptitude >> onCoderChanged: aGtCodersCodersChanged [ - self postponeUpdate. -] - -{ #category : #'private - announcement handling' } -GtFilterRunExampleButtonAptitude >> onExampleExecuted: aGtCoderExampleExecuted [ - self postponeUpdate. -] - -{ #category : #'api - hooks' } -GtFilterRunExampleButtonAptitude >> onUninstalledIn: anElement [ - super onUninstalledIn: anElement. - self resetUpdateRequested. -] - -{ #category : #'private - updating' } -GtFilterRunExampleButtonAptitude >> postponeUpdate [ - self widgetAndCoderDo: [ :aWidget :aCoder | - self beUpdateRequestedIfDoneEarlierDo: [ ^ self ]. - BlUseAsyncFeatures - ifEnabledDo: [ - BlTaskAtQueue default - schedule: [ self enqueueUpdate ] - at: self postponedTime ] - otherwise: [ - self updateNow ] ] -] - -{ #category : #'private - updating' } -GtFilterRunExampleButtonAptitude >> postponedTime [ - | aNow | - self widgetDo: [ :aWidget | - aNow := aWidget space - ifNotNil: [ :aSpace | aSpace time now ] - ifNil: [ BlTime real now ] ]. - aNow ifNil: [ aNow := BlTime real now ]. - ^ aNow + 300 milliSeconds. -] - -{ #category : #'private - updating' } -GtFilterRunExampleButtonAptitude >> resetUpdateRequested [ - mutex critical: [ - isUpdateRequested := false ]. -] - -{ #category : #'private - subscriptions' } -GtFilterRunExampleButtonAptitude >> subscribeToCoder [ - self coder weak - when: GtCoderExampleExecuted - send: #onExampleExecuted: - to: self. - self coder weak - when: GtCodersCoderAdded , GtCodersCoderRemoved , GtCodersCodersChanged, GtCoderSourceCodeChanged - send: #onCoderChanged: - to: self -] - -{ #category : #'private - subscriptions' } -GtFilterRunExampleButtonAptitude >> unsubscribeFromCoder [ - self coderDo: [ :aCoder | - aCoder unsubscribe: self ]. -] - -{ #category : #'private - updating' } -GtFilterRunExampleButtonAptitude >> updateNow [ - self resetUpdateRequested. - self updateWidget. -] - -{ #category : #'private - updating' } -GtFilterRunExampleButtonAptitude >> updateWidget [ - "Subclasses may perform update actions. - I should be called from a UI process." -] - -{ #category : #'private - accessing' } -GtFilterRunExampleButtonAptitude >> widgetAndCoderDo: aTwoArgBlock [ - self widgetDo: [ :aWidget | - self coderDo: [ :aCoder | - aTwoArgBlock cull: aWidget cull: aCoder ] ] -] diff --git a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonFourStateIconAptitude.class.st b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonFourStateIconAptitude.class.st deleted file mode 100644 index 455a7a80b..000000000 --- a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonFourStateIconAptitude.class.st +++ /dev/null @@ -1,152 +0,0 @@ -" -I am a {{gtClass:GtFilterRunExampleButtonIconAptitude}}. -I display a colored icon that represents an {{gtClass:GtExampleWithResult}} execution and result state. -If there are examples with different execution states, I display several colors. -#Examples - -The following examples show example status icons. -##All States - -I display all states at once as follows: -{{gtExample:GtFilterRunExampleButtonLookExamples>>#fourIconLookButton_WithoutCoder|codeExpanded=false|previewExpanded=true|previewShow=#gtLiveFor:|previewHeight=65}} -##Not Executed Examples - -If all examples have same state, only one icon (color) is displayed: {{gtExample:GtFilterRunExampleButtonLookExamples>>#fourIconLookButton_NotExecuted|codeExpanded=false|previewExpanded=true|previewShow=#gtLiveFor:|previewHeight=65}} -##Examples With Two Execution States - - -{{gtExample:GtFilterRunExampleButtonLookExamples>>#fourIconLookButton_SuccessAndNotExecutedStates|codeExpanded=false|previewExpanded=true|previewShow=#gtLiveFor:|previewHeight=65}} - - -" -Class { - #name : #GtFilterRunExampleButtonFourStateIconAptitude, - #superclass : #GtFilterRunExampleButtonIconAptitude, - #instVars : [ - 'fourIconElement', - 'failureIconElement', - 'errorIconElement', - 'successIconElement', - 'neutralIconElement' - ], - #category : #'GToolkit-Coder-UI-Filters' -} - -{ #category : #'private - accessing' } -GtFilterRunExampleButtonFourStateIconAptitude >> errorIconElement [ - ^ errorIconElement -] - -{ #category : #'private - accessing' } -GtFilterRunExampleButtonFourStateIconAptitude >> failureIconElement [ - ^ failureIconElement -] - -{ #category : #'private - accessing' } -GtFilterRunExampleButtonFourStateIconAptitude >> fourIconElement [ - ^ fourIconElement -] - -{ #category : #initialization } -GtFilterRunExampleButtonFourStateIconAptitude >> initialize [ - super initialize. - self initializeFourStateIconElement. - self initializeNeutralIconElement. - self initializeErrorIconElement. - self initializeFailureIconElement. - self initializeSuccessIconElement. - - self fourIconElement addChild: self successIconElement as: #success. - self fourIconElement addChild: self failureIconElement as: #failure. - self fourIconElement addChild: self errorIconElement as: #error. - self fourIconElement addChild: self neutralIconElement as: #neutral. - - self addChangeAddChildAs: #(content fourStateExample) with: [ self fourIconElement ]. -] - -{ #category : #initialization } -GtFilterRunExampleButtonFourStateIconAptitude >> initializeErrorIconElement [ - errorIconElement := BlElement new - background: self newErrorBackground. - self initializeIconElement: errorIconElement. -] - -{ #category : #initialization } -GtFilterRunExampleButtonFourStateIconAptitude >> initializeExampleElement [ - super initializeExampleElement. - self exampleElement visibility: BlVisibility gone. -] - -{ #category : #initialization } -GtFilterRunExampleButtonFourStateIconAptitude >> initializeFailureIconElement [ - failureIconElement := BlElement new - background: self newFailureBackground. - self initializeIconElement: failureIconElement -] - -{ #category : #initialization } -GtFilterRunExampleButtonFourStateIconAptitude >> initializeFourStateIconElement [ - fourIconElement := BlElement new - layout: (BlGridLayout new - columnCount: 2; - cellSpacing: 0); - background: BlBackground transparent; - constraintsDo: [ :c | - c horizontal fitContent. - c vertical fitContent ]. -] - -{ #category : #initialization } -GtFilterRunExampleButtonFourStateIconAptitude >> initializeNeutralIconElement [ - neutralIconElement := BlElement new - background: self newNotExecutedBackground. - self initializeIconElement: neutralIconElement. -] - -{ #category : #initialization } -GtFilterRunExampleButtonFourStateIconAptitude >> initializeSuccessIconElement [ - successIconElement := BlElement new - background: self newSuccessBackground. - self initializeIconElement: successIconElement -] - -{ #category : #'private - accessing' } -GtFilterRunExampleButtonFourStateIconAptitude >> neutralIconElement [ - ^ neutralIconElement -] - -{ #category : #'private - accessing' } -GtFilterRunExampleButtonFourStateIconAptitude >> successIconElement [ - ^ successIconElement -] - -{ #category : #'private - updating' } -GtFilterRunExampleButtonFourStateIconAptitude >> updateFourIconElement [ - | isNeutralVisible isErrorVisible isFailureVisible isSuccessVisible | - self updateIconElement: self neutralIconElement status: (isNeutralVisible := self exampler hasNotExecutedExamples). - self updateIconElement: self errorIconElement status: (isErrorVisible := self exampler hasErrorExamples). - self updateIconElement: self failureIconElement status: (isFailureVisible := self exampler hasFailureExamples). - self updateIconElement: self successIconElement status: (isSuccessVisible := self exampler hasSuccessExamples). - isNeutralVisible asBit + isErrorVisible asBit + isFailureVisible asBit + isSuccessVisible asBit = 1 - ifTrue: [ - self fourIconElement visibility: BlVisibility gone. - self exampleElement visibility: BlVisibility visible ] - ifFalse: [ - self fourIconElement visibility: BlVisibility visible. - self exampleElement visibility: BlVisibility gone ] -] - -{ #category : #'private - updating' } -GtFilterRunExampleButtonFourStateIconAptitude >> updateIconElement: anElement status: aBoolean [ - aBoolean - ifTrue: [ - anElement visibility: BlVisibility visible ] - ifFalse: [ - anElement visibility: BlVisibility hidden ]. -] - -{ #category : #'private - updating' } -GtFilterRunExampleButtonFourStateIconAptitude >> updateWidget [ - super updateWidget. - self updateFourIconElement. -] diff --git a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonIconAptitude.class.st b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonIconAptitude.class.st deleted file mode 100644 index 0f540813a..000000000 --- a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonIconAptitude.class.st +++ /dev/null @@ -1,110 +0,0 @@ -" -I am a {{gtClass:GtFilterRunExampleButtonAptitude}}. -I display a colored icon that represent an {{gtClass:GtExampleWithResult}} execution and result state. -1. # Examples - -The following examples shows a colored icon as a part of a button in four possible states. -1. ## Not Executed Examples - -{{gtExample:GtFilterRunExampleButtonLookExamples>>#oneIconLookButton_SkipNoTest|codeExpanded=false|previewExpanded=true|previewShow=#gtLiveFor:|previewHeight=65}} -1. ## Examples With Successful Execution - -{{gtExample:GtFilterRunExampleButtonLookExamples>>#oneIconLookButton_Success|codeExpanded=false|previewExpanded=true|previewShow=#gtLiveFor:|previewHeight=65}} -1. ## Examples With Not Satisfying Assertions - -{{gtExample:GtFilterRunExampleButtonLookExamples>>#oneIconLookButton_Failure|codeExpanded=false|previewExpanded=true|previewShow=#gtLiveFor:|previewHeight=65}} -1. ## Examples With Execution Errors - -{{gtExample:GtFilterRunExampleButtonLookExamples>>#oneIconLookButton_Error|codeExpanded=false|previewExpanded=true|previewShow=#gtLiveFor:|previewHeight=65}} - - -" -Class { - #name : #GtFilterRunExampleButtonIconAptitude, - #superclass : #GtFilterRunExampleButtonAptitude, - #instVars : [ - 'exampleElement' - ], - #category : 'GToolkit-Coder-UI-Filters' -} - -{ #category : #'private - accessing' } -GtFilterRunExampleButtonIconAptitude >> exampleElement [ - - ^ exampleElement -] - -{ #category : #initialization } -GtFilterRunExampleButtonIconAptitude >> initialize [ - super initialize. - self initializeExampleElement. - - self addChangeAddChildAs: #(content example) with: [ self exampleElement ]. -] - -{ #category : #initialization } -GtFilterRunExampleButtonIconAptitude >> initializeExampleElement [ - exampleElement := BlElement new - background: self newNotExecutedBackground. - self initializeIconElement: exampleElement. -] - -{ #category : #'private - instance creation' } -GtFilterRunExampleButtonIconAptitude >> newBackground [ - self coder exampler hasNotExecutedExamples ifTrue: [ - ^ self newNotExecutedBackground ]. - self coder exampler hasErrorExamples ifTrue: [ - ^ self newErrorBackground ]. - self coder exampler hasFailureExamples ifTrue: [ - ^ self newFailureBackground ]. - self coder exampler hasSuccessExamples ifTrue: [ - ^ self newSuccessBackground ]. - ^ self newNotExecutedBackground. -] - -{ #category : #'private - instance creation' } -GtFilterRunExampleButtonIconAptitude >> newErrorBackground [ - ^ GtFilterExampleErrorState default color -] - -{ #category : #'private - instance creation' } -GtFilterRunExampleButtonIconAptitude >> newFailureBackground [ - ^ GtFilterExampleFailureState default color -] - -{ #category : #'private - instance creation' } -GtFilterRunExampleButtonIconAptitude >> newNotExecutedBackground [ - ^ GtFilterExampleNotExecutedState default color -] - -{ #category : #'private - instance creation' } -GtFilterRunExampleButtonIconAptitude >> newSuccessBackground [ - ^ GtFilterExampleSuccessState default color -] - -{ #category : #'private - updating' } -GtFilterRunExampleButtonIconAptitude >> updateButtonStatus [ - "I must be called in a UI process". - self widgetDo: [ :aWidget | - self examplerDo: [ :anExampler | - | aStatus | - aStatus := anExampler hasSelectedExecutableExamples. - aWidget dispatchEvent: (BrEnablementWish enabled: aStatus). - anExampler hasExamples - ifFalse: [ aWidget visibility: BlVisibility gone ] - ifTrue: [ aWidget visibility: BlVisibility visible] ] ] -] - -{ #category : #'private - updating' } -GtFilterRunExampleButtonIconAptitude >> updateExampleStatus [ - "I must be called in a UI process". - self exampleElement - background: self newBackground -] - -{ #category : #'private - updating' } -GtFilterRunExampleButtonIconAptitude >> updateWidget [ - super updateWidget. - self updateExampleStatus. - self updateButtonStatus. -] diff --git a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonTooltipAptitude.class.st b/src/GToolkit-Coder-UI/GtFilterRunExampleButtonTooltipAptitude.class.st deleted file mode 100644 index e7d323071..000000000 --- a/src/GToolkit-Coder-UI/GtFilterRunExampleButtonTooltipAptitude.class.st +++ /dev/null @@ -1,108 +0,0 @@ -Class { - #name : #GtFilterRunExampleButtonTooltipAptitude, - #superclass : #GtFilterRunExampleButtonAptitude, - #instVars : [ - 'tooltipContent' - ], - #category : #'GToolkit-Coder-UI-Filters' -} - -{ #category : #initialization } -GtFilterRunExampleButtonTooltipAptitude >> initialize [ - super initialize. - self initializeTooltipContent. - - self add: (BrGlamorousWithTooltipAptitude content: [self initializeTooltipContent]). -] - -{ #category : #initialization } -GtFilterRunExampleButtonTooltipAptitude >> initializeTooltipContent [ - tooltipContent := BrColumnedList new. - tooltipContent - items: GtExampleState default allStates; - padding: (BlInsets all: 10); - fitContent. - - tooltipContent - addEventHandlerOn: BrSelectionChanged do: [ :anEvent | - anEvent selectedDo: [ :theIndices | - | aWidgetElement aSelectedObject | - - aWidgetElement := anEvent currentTarget. - aSelectedObject := aWidgetElement viewModel itemAt: theIndices first. - - self coder - setFilters: { - ((GtPharoExampleStateFilter new - resultState: aSelectedObject) - coder: self coder)} - source: self - ] ]. - - tooltipContent column - title: 'Icon'; - cellStencil: [ - | anElement | - anElement := BlElement new - background: BlBackground transparent. - self initializeIconElement: anElement. - anElement ]; - dataBinder: [ :anElement :anItem | - anElement background: anItem color ]; - width: 10. - - tooltipContent column - title: 'Name'; - cellStencil: [ - BrLabel new - aptitude: BrGlamorousLabelAptitude ]; - dataBinder: [ :anElement :anItem | - anElement text: anItem label ]; - width: 100. - - tooltipContent column - title: 'Amount'; - cellStencil: [ - BrLabel new - aptitude: BrGlamorousLabelAptitude; - fitContent ]; - dataBinder: [ :anElement :anItem | - | aTotal aTotalString aTotalText | - self examplerDo: [ :anExampler | - aTotal := anItem numberOfExamplesFor: anExampler. - aTotalString := aTotal asString, (' example' asPluralBasedOn: aTotal) ]. - aTotalString ifNil: [ aTotalString := '? examples' ]. - aTotalText := aTotalString asRopedText foreground: Color gray. - anElement text: aTotalText ]. - ^ tooltipContent -] - -{ #category : #'private - accessing' } -GtFilterRunExampleButtonTooltipAptitude >> listItems [ - | states | - states := GtExampleState default allStates. - ^ states collect: [ :eachState | - eachState labelWithAmountFor: self coder exampler ]. -] - -{ #category : #'private - accessing' } -GtFilterRunExampleButtonTooltipAptitude >> tooltipContent [ - - ^ tooltipContent -] - -{ #category : #'private - updating' } -GtFilterRunExampleButtonTooltipAptitude >> updateList [ - | statusesToDisplay | - statusesToDisplay := GtExampleState default allStates reject: [ :eachStatus | - (eachStatus numberOfExamplesFor: self exampler) isZero ]. - - self tooltipContent - items: statusesToDisplay -] - -{ #category : #'private - updating' } -GtFilterRunExampleButtonTooltipAptitude >> updateWidget [ - super updateWidget. - self updateList. -] From 954def75c7ee212bdaa563b0a47a49c6b952cafd Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 29 Nov 2021 20:34:46 +0100 Subject: [PATCH 0105/1268] fix class comment of GtFilterDescriptor --- src/GToolkit-Coder-UI/GtFilterDescriptor.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st b/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st index b8fd256d0..f99011db6 100644 --- a/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st +++ b/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st @@ -3,7 +3,7 @@ I describe how a {{gtClass:GtSearchMethodsFilter}} should look and behave in a U I am used to build {{gtClass:GtFilterTagElement}} instances inside of {{gtClass:GtFiltersElement}}. For more details: - {{gtMethod:GtPharoMethodsCoderElement>>#buildFilter}} is a code that inittialize {{gtClass:GtFiltersElement}} using instances of myself, -- {{gtMethod:GtSearchMethodsFilter class>>#filterDescriptorFor:|show=#gtImplementorsFor:}} displays a list of various definitions of myself. +- {{gtMethod:GtSearchFilter class>>#filterDescriptorFor:|show=#gtImplementorsFor:}} displays a list of various definitions of myself. See {{gtClass:GtFiltersElement}} for an example. From 06d6e407cd3702876f143c96a13c907d0e30cca8 Mon Sep 17 00:00:00 2001 From: John Brant Date: Mon, 29 Nov 2021 16:04:40 -0600 Subject: [PATCH 0106/1268] [feenkcom/gtoolkit#2251] starting to convert some completion stategies to use async streaming --- .../GtClassesCompletionStrategy.class.st | 30 +++++++++------- .../GtPackagesCompletionStrategy.class.st | 34 ++++++++++++------- .../GtPoolsCompletionStrategy.class.st | 26 ++++++++------ .../GtTraitsCompletionStrategy.class.st | 26 ++++++++------ 4 files changed, 68 insertions(+), 48 deletions(-) diff --git a/src/GToolkit-Coder/GtClassesCompletionStrategy.class.st b/src/GToolkit-Coder/GtClassesCompletionStrategy.class.st index 55e32a5b7..ed2c1f205 100644 --- a/src/GToolkit-Coder/GtClassesCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtClassesCompletionStrategy.class.st @@ -5,7 +5,7 @@ Class { 'excludedClasses', 'candidateClasses' ], - #category : 'GToolkit-Coder-Completion' + #category : #'GToolkit-Coder-Completion' } { #category : #accessing } @@ -17,18 +17,17 @@ GtClassesCompletionStrategy >> candidateClasses [ ] { #category : #accessing } -GtClassesCompletionStrategy >> completionActionsFor: aText at: positionInteger max: maxInteger [ - | currentInput completionActions | +GtClassesCompletionStrategy >> completionActionStreamFor: aText at: positionInteger [ + | currentInput | currentInput := aText asString. - currentInput isEmpty - ifTrue: [ ^ #() ]. - completionActions := (self candidateClasses - first: maxInteger - startingWith: currentInput) - collect: [ :className | + currentInput isEmpty ifTrue: [ ^ #() ]. + ^ (self candidateClasses asyncStreamStartingWith: currentInput) + collect: + [ :className | | deletion insertion | deletion := positionInteger < currentInput size - ifTrue: [ GtDeleteTextCompletionAction + ifTrue: + [ GtDeleteTextCompletionAction labeled: className from: positionInteger + 1 to: currentInput size ]. @@ -38,12 +37,17 @@ GtClassesCompletionStrategy >> completionActionsFor: aText at: positionInteger m position: positionInteger from: 1. deletion notNil - ifTrue: [ (GtCompositeCompletionAction labeled: className) + ifTrue: + [ (GtCompositeCompletionAction labeled: className) addAction: deletion; addAction: insertion; yourself ] - ifFalse: [ insertion ] ]. - ^ completionActions + ifFalse: [ insertion ] ] +] + +{ #category : #accessing } +GtClassesCompletionStrategy >> completionActionsFor: aText at: positionInteger max: maxInteger [ + ^ ((self completionActionStreamFor: aText at: positionInteger) take: maxInteger) toArray wait ] { #category : #initialization } diff --git a/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st b/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st index 5a2267d15..676ff8798 100644 --- a/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st @@ -1,12 +1,12 @@ Class { #name : #GtPackagesCompletionStrategy, #superclass : #GtCompletionStrategy, - #category : 'GToolkit-Coder-Completion' + #category : #'GToolkit-Coder-Completion' } { #category : #private } GtPackagesCompletionStrategy class >> allPackages [ - ^ RPackageOrganizer default packages + ^ RPackageOrganizer default packages asSortedCollection: [ :a :b | a name < b name ] ] { #category : #private } @@ -39,18 +39,26 @@ GtPackagesCompletionStrategy class >> findPackagesMatching: aString [ ] { #category : #accessing } -GtPackagesCompletionStrategy >> completionActionsFor: aText at: positionInteger max: maxInteger [ - | string completionActions | +GtPackagesCompletionStrategy >> completionActionStreamFor: aText at: positionInteger [ + | string searchString | string := aText asString. - string isEmpty - ifTrue: [ ^#() ]. - completionActions := Set new. - (self class findPackagesMatching: string) do: [ :each | - completionActions add: (GtReplaceTextCompletionAction forText: each name) ]. - (self class findPackageTagsMatching: string) do: [ :each | - completionActions add: (GtReplaceTextCompletionAction forText: each categoryName) ]. - ^ completionActions asSortedCollection: [ :a :b | - a text < b text ] + string isEmpty ifTrue: [ ^ #() ]. + searchString := '*' , string , '*'. + ^ ((self class allPackages asAsyncStream + collect: + [ :each | + (searchString match: each name) + ifTrue: [ ({each} , (each classTags asSortedCollection: [ :a :b | a name < b name ])) asAsyncStream ] + ifFalse: + [ ((each classTags select: [ :tag | searchString match: tag categoryName ]) asSortedCollection: [ :a :b | a name < b name ]) + asAsyncStream ] ]) flatten + collect: [ :each | (each isKindOf: RPackage) ifTrue: [ each name ] ifFalse: [ each categoryName ] ]) withoutDuplicates + collect: [ :each | GtReplaceTextCompletionAction forText: each ] +] + +{ #category : #accessing } +GtPackagesCompletionStrategy >> completionActionsFor: aText at: positionInteger max: maxInteger [ + ^ ((self completionActionStreamFor: aText at: positionInteger) take: maxInteger) toArray wait ] { #category : #testing } diff --git a/src/GToolkit-Coder/GtPoolsCompletionStrategy.class.st b/src/GToolkit-Coder/GtPoolsCompletionStrategy.class.st index 9929de55d..f47c57677 100644 --- a/src/GToolkit-Coder/GtPoolsCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtPoolsCompletionStrategy.class.st @@ -4,7 +4,7 @@ Class { #instVars : [ 'candidatePools' ], - #category : 'GToolkit-Coder-Completion' + #category : #'GToolkit-Coder-Completion' } { #category : #accessing } @@ -18,18 +18,22 @@ GtPoolsCompletionStrategy >> candidatePools [ ] { #category : #accessing } -GtPoolsCompletionStrategy >> completionActionsFor: aText at: positionInteger max: maxInteger [ - | currentInput completionActions | - +GtPoolsCompletionStrategy >> completionActionStreamFor: aText at: positionInteger [ + | currentInput | currentInput := aText asString. - completionActions := (self candidatePools first: maxInteger startingWith: currentInput) collect: [ :poolName | - GtInsertTextCompletionAction - labeled: poolName - completion: (poolName allButFirst: currentInput size) - position: positionInteger - from: positionInteger - currentInput size + 1 ]. + ^ (self candidatePools asyncStreamStartingWith: currentInput) + collect: + [ :poolName | + GtInsertTextCompletionAction + labeled: poolName + completion: (poolName allButFirst: currentInput size) + position: positionInteger + from: positionInteger - currentInput size + 1 ] +] - ^ completionActions +{ #category : #accessing } +GtPoolsCompletionStrategy >> completionActionsFor: aText at: positionInteger max: maxInteger [ + ^ ((self completionActionStreamFor: aText at: positionInteger) take: maxInteger) toArray wait ] { #category : #testing } diff --git a/src/GToolkit-Coder/GtTraitsCompletionStrategy.class.st b/src/GToolkit-Coder/GtTraitsCompletionStrategy.class.st index 7c9d48f4d..ffb6c1cb7 100644 --- a/src/GToolkit-Coder/GtTraitsCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtTraitsCompletionStrategy.class.st @@ -4,7 +4,7 @@ Class { #instVars : [ 'candidateTraits' ], - #category : 'GToolkit-Coder-Completion' + #category : #'GToolkit-Coder-Completion' } { #category : #accessing } @@ -16,18 +16,22 @@ GtTraitsCompletionStrategy >> candidateTraits [ ] { #category : #accessing } -GtTraitsCompletionStrategy >> completionActionsFor: aText at: positionInteger max: maxInteger [ - | currentInput completionActions | - +GtTraitsCompletionStrategy >> completionActionStreamFor: aText at: positionInteger [ + | currentInput | currentInput := aText asString. - completionActions := (self candidateTraits first: maxInteger startingWith: currentInput) collect: [ :traitName | - GtInsertTextCompletionAction - labeled: traitName - completion: (traitName allButFirst: currentInput size) - position: positionInteger - from: positionInteger - currentInput size + 1 ]. + ^ (self candidateTraits asyncStreamStartingWith: currentInput) + collect: + [ :traitName | + GtInsertTextCompletionAction + labeled: traitName + completion: (traitName allButFirst: currentInput size) + position: positionInteger + from: positionInteger - currentInput size + 1 ] +] - ^ completionActions +{ #category : #accessing } +GtTraitsCompletionStrategy >> completionActionsFor: aText at: positionInteger max: maxInteger [ + ^ ((self completionActionStreamFor: aText at: positionInteger) take: maxInteger) toArray wait ] { #category : #testing } From 2f390b51322f62522ca643a5d51de40c74aa42df Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Tue, 30 Nov 2021 09:02:36 +0100 Subject: [PATCH 0107/1268] do not add GtSourceCoderId in GtSingleCoderViewModel>>#asElement since it will not necessarily be a source coder --- src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st | 1 - 1 file changed, 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st index ae1112a86..e9ec13517 100644 --- a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st @@ -35,7 +35,6 @@ GtSingleCoderViewModel >> asCoderUIModel [ GtSingleCoderViewModel >> asElement [ ^ self elementClass new coderUIModel: self; - id: GtSourceCoderId; yourself ] From 14092df0f0a8a104aeeed6b1258db3b4dde40fd1 Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 30 Nov 2021 15:25:11 -0600 Subject: [PATCH 0108/1268] [feenkcom/gtoolkit#2251] async stream changes for completer --- .../GtClassesCompletionStrategy.class.st | 5 -- ...lassWithPackageCompletionStrategy.class.st | 67 ++++++++++--------- ...tPackageClassesCompletionStrategy.class.st | 18 ++--- .../GtPackagesCompletionStrategy.class.st | 22 +++--- .../GtPoolsCompletionStrategy.class.st | 5 -- .../GtTraitsCompletionStrategy.class.st | 5 -- 6 files changed, 52 insertions(+), 70 deletions(-) diff --git a/src/GToolkit-Coder/GtClassesCompletionStrategy.class.st b/src/GToolkit-Coder/GtClassesCompletionStrategy.class.st index ed2c1f205..567d964e1 100644 --- a/src/GToolkit-Coder/GtClassesCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtClassesCompletionStrategy.class.st @@ -45,11 +45,6 @@ GtClassesCompletionStrategy >> completionActionStreamFor: aText at: positionInte ifFalse: [ insertion ] ] ] -{ #category : #accessing } -GtClassesCompletionStrategy >> completionActionsFor: aText at: positionInteger max: maxInteger [ - ^ ((self completionActionStreamFor: aText at: positionInteger) take: maxInteger) toArray wait -] - { #category : #initialization } GtClassesCompletionStrategy >> excludeClasses: aCollectionOfClasses [ excludedClasses := aCollectionOfClasses asSet diff --git a/src/GToolkit-Coder/GtCoderClassWithPackageCompletionStrategy.class.st b/src/GToolkit-Coder/GtCoderClassWithPackageCompletionStrategy.class.st index 084bfd05f..6d0f50766 100644 --- a/src/GToolkit-Coder/GtCoderClassWithPackageCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtCoderClassWithPackageCompletionStrategy.class.st @@ -5,7 +5,7 @@ Class { 'allPackages', 'allClasses' ], - #category : 'GToolkit-Coder-Completion' + #category : #'GToolkit-Coder-Completion' } { #category : #accessing } @@ -26,40 +26,41 @@ GtCoderClassWithPackageCompletionStrategy >> classesIn: aPackage [ ] { #category : #accessing } -GtCoderClassWithPackageCompletionStrategy >> completionActionsFor: aText at: positionInteger max: maxInteger [ - | currentInput completionActions delimitedIndex | +GtCoderClassWithPackageCompletionStrategy >> completionActionStreamFor: aText at: positionInteger [ + | currentInput delimitedIndex | currentInput := aText asString. delimitedIndex := currentInput indexOf: $>. - delimitedIndex > 0 ifTrue: [ - | extractedPackageName partialClassName package | - extractedPackageName := currentInput copyFrom: 1 to: delimitedIndex - 1. - partialClassName := currentInput copyFrom: delimitedIndex + 1 to: currentInput size. - package := RPackage organizer - packageNamed: extractedPackageName - ifAbsent: [ ^ #() ]. - ^ ((self classesIn: package) first: maxInteger startingWith: partialClassName) collect: [ :className | - GtInsertTextCompletionAction - labeled: className - completion: (className allButFirst: partialClassName size) - position: positionInteger - from: positionInteger - partialClassName size + 1 ] ]. - completionActions := (self allClasses first: (maxInteger/2) asInteger startingWith: currentInput) collect: [ :className | - GtInsertTextCompletionAction - labeled: className - completion: (className allButFirst: currentInput size) - position: positionInteger - from: positionInteger - currentInput size + 1 ]. - completionActions addAll: ((self allPackages first: (maxInteger/2) asInteger startingWith: currentInput) collect: [ :packageName | - GtInsertTextCompletionAction - labeled: packageName - completion: (packageName allButFirst: currentInput size) , '>' - position: positionInteger - from: positionInteger - currentInput size + 1 ]). - - ^ completionActions - "(self class findPackageTagsMatching: completionString) do: [ :each | - completionActions add: (GtReplaceTextCompletionAction forText: each categoryName) ]." - + delimitedIndex > 0 + ifTrue: + [ | extractedPackageName partialClassName package | + extractedPackageName := currentInput copyFrom: 1 to: delimitedIndex - 1. + partialClassName := currentInput copyFrom: delimitedIndex + 1 to: currentInput size. + package := RPackage organizer packageNamed: extractedPackageName ifAbsent: [ ^ #() ]. + ^ ((self classesIn: package) asyncStreamStartingWith: partialClassName) + collect: + [ :className | + GtInsertTextCompletionAction + labeled: className + completion: (className allButFirst: partialClassName size) + position: positionInteger + from: positionInteger - partialClassName size + 1 ] ]. + ^ ((self allClasses asyncStreamStartingWith: currentInput) + collect: + [ :className | + GtInsertTextCompletionAction + labeled: className + completion: (className allButFirst: currentInput size) + position: positionInteger + from: positionInteger - currentInput size + 1 ]) + merge: + ((self allPackages asyncStreamStartingWith: currentInput) + collect: + [ :packageName | + GtInsertTextCompletionAction + labeled: packageName + completion: (packageName allButFirst: currentInput size) , '>' + position: positionInteger + from: positionInteger - currentInput size + 1 ]) ] { #category : #testing } diff --git a/src/GToolkit-Coder/GtPackageClassesCompletionStrategy.class.st b/src/GToolkit-Coder/GtPackageClassesCompletionStrategy.class.st index b45286747..dfaa7af57 100644 --- a/src/GToolkit-Coder/GtPackageClassesCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtPackageClassesCompletionStrategy.class.st @@ -4,28 +4,24 @@ Class { #instVars : [ 'packageSearchString' ], - #category : 'GToolkit-Coder-Completion' + #category : #'GToolkit-Coder-Completion' } { #category : #accessing } -GtPackageClassesCompletionStrategy >> classesMatching: aString [ +GtPackageClassesCompletionStrategy >> classStreamMatching: aString [ | classNamePattern matchedClasses | matchedClasses := Set new. classNamePattern := '*' , aString , '*'. - (GtPackagesCompletionStrategy findPackagesMatching: packageSearchString) do: [ :each | - matchedClasses addAll: each classes ]. - (GtPackagesCompletionStrategy findPackageTagsMatching: packageSearchString) do: [ :each | - matchedClasses addAll: each classes ]. - ^ matchedClasses select: [ :each | classNamePattern match: each name ] + ^ (((GtPackagesCompletionStrategy packageAndTagStreamMatching: packageSearchString) + collect: [ :each | each classes asAsyncStream ]) flatten select: [ :each | classNamePattern match: each name ]) + withoutDuplicates ] { #category : #accessing } -GtPackageClassesCompletionStrategy >> completionActionsFor: aText at: positionInteger max: maxInteger [ +GtPackageClassesCompletionStrategy >> completionActionStreamFor: aText at: positionInteger [ | string | string := aText asString. - ^ ((self classesMatching: string) collect: [ :each | - GtReplaceTextCompletionAction forText: each name ]) - asSortedCollection: [ :a :b | a text < b text ] + ^ (self classStreamMatching: string) collect: [ :each | GtReplaceTextCompletionAction forText: each name ] ] { #category : #testing } diff --git a/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st b/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st index 676ff8798..cbea8b884 100644 --- a/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st @@ -38,13 +38,9 @@ GtPackagesCompletionStrategy class >> findPackagesMatching: aString [ ^ results ] -{ #category : #accessing } -GtPackagesCompletionStrategy >> completionActionStreamFor: aText at: positionInteger [ - | string searchString | - string := aText asString. - string isEmpty ifTrue: [ ^ #() ]. - searchString := '*' , string , '*'. - ^ ((self class allPackages asAsyncStream +{ #category : #querying } +GtPackagesCompletionStrategy class >> packageAndTagStreamMatching: searchString [ + ^ (self allPackages asAsyncStream collect: [ :each | (searchString match: each name) @@ -52,13 +48,17 @@ GtPackagesCompletionStrategy >> completionActionStreamFor: aText at: positionInt ifFalse: [ ((each classTags select: [ :tag | searchString match: tag categoryName ]) asSortedCollection: [ :a :b | a name < b name ]) asAsyncStream ] ]) flatten - collect: [ :each | (each isKindOf: RPackage) ifTrue: [ each name ] ifFalse: [ each categoryName ] ]) withoutDuplicates - collect: [ :each | GtReplaceTextCompletionAction forText: each ] ] { #category : #accessing } -GtPackagesCompletionStrategy >> completionActionsFor: aText at: positionInteger max: maxInteger [ - ^ ((self completionActionStreamFor: aText at: positionInteger) take: maxInteger) toArray wait +GtPackagesCompletionStrategy >> completionActionStreamFor: aText at: positionInteger [ + | string searchString | + string := aText asString. + string isEmpty ifTrue: [ ^ #() ]. + searchString := '*' , string , '*'. + ^ ((self class packageAndTagStreamMatching: searchString) + collect: [ :each | (each isKindOf: RPackage) ifTrue: [ each name ] ifFalse: [ each categoryName ] ]) withoutDuplicates + collect: [ :each | GtReplaceTextCompletionAction forText: each ] ] { #category : #testing } diff --git a/src/GToolkit-Coder/GtPoolsCompletionStrategy.class.st b/src/GToolkit-Coder/GtPoolsCompletionStrategy.class.st index f47c57677..6f038dab8 100644 --- a/src/GToolkit-Coder/GtPoolsCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtPoolsCompletionStrategy.class.st @@ -31,11 +31,6 @@ GtPoolsCompletionStrategy >> completionActionStreamFor: aText at: positionIntege from: positionInteger - currentInput size + 1 ] ] -{ #category : #accessing } -GtPoolsCompletionStrategy >> completionActionsFor: aText at: positionInteger max: maxInteger [ - ^ ((self completionActionStreamFor: aText at: positionInteger) take: maxInteger) toArray wait -] - { #category : #testing } GtPoolsCompletionStrategy >> hasCompletionEntryFor: aString [ ^ true diff --git a/src/GToolkit-Coder/GtTraitsCompletionStrategy.class.st b/src/GToolkit-Coder/GtTraitsCompletionStrategy.class.st index ffb6c1cb7..e1f13879f 100644 --- a/src/GToolkit-Coder/GtTraitsCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtTraitsCompletionStrategy.class.st @@ -29,11 +29,6 @@ GtTraitsCompletionStrategy >> completionActionStreamFor: aText at: positionInteg from: positionInteger - currentInput size + 1 ] ] -{ #category : #accessing } -GtTraitsCompletionStrategy >> completionActionsFor: aText at: positionInteger max: maxInteger [ - ^ ((self completionActionStreamFor: aText at: positionInteger) take: maxInteger) toArray wait -] - { #category : #testing } GtTraitsCompletionStrategy >> hasCompletionEntryFor: aString [ ^ true From 8a94f35ccdee653c70afcf9241cd67274d44b865 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Wed, 1 Dec 2021 16:19:14 +0100 Subject: [PATCH 0109/1268] flatten elements in GtSourceCoderCollapsedContentElement --- ...ourceCoderCollapsedContentElement.class.st | 50 +++++++++---------- .../GtTextualCoderViewModel.class.st | 8 +++ 2 files changed, 31 insertions(+), 27 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st index a363265b7..823f4f09f 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st @@ -28,46 +28,42 @@ GtSourceCoderCollapsedContentElement >> initialize [ { #category : #'instance creation' } GtSourceCoderCollapsedContentElement >> newAddOnsContainer [ - ^ BrFromPromise new + ^ BrHorizontalPane new fitContent; - stencil: [ - BrHorizontalPane new - fitContent; - margin: (BlInsets top: 4 left: 1 bottom: 1 right: 1) ]; - dataBinder: [ :anAddOnsContainer :aData | - anAddOnsContainer removeChildren. - aData - ifSuccess: [ :theAddOns | + margin: (BlInsets top: 4 left: 1 bottom: 1 right: 1); + withAsyncPromiseDo: [ :anElementPromise | + anElementPromise + whenSuccess: [ :aContainer :theAddOns | + aContainer removeChildren. theAddOns previews do: [ :eachAddOn | (eachAddOn stencilBuilder coderUIModel: textualCoderViewModel; build) ifNotNil: [ :eachAddOnStencil | - anAddOnsContainer addChild: eachAddOnStencil asElement ] ] ] - ifError: [ :anError | anAddOnsContainer addChild: (BrLabel new aptitude: BrGlamorousLabelAptitude; text: anError printString) ] - ifPending: [ ] ] + aContainer addChild: eachAddOnStencil asElement ] ] ]; + whenError: [ :aContainer :anError | + aContainer removeChildren. + aContainer addChild: (BrLabel new aptitude: BrGlamorousLabelAptitude; text: anError printString) ]; + whenPending: [ :aContainer | ] ] ] { #category : #'instance creation' } GtSourceCoderCollapsedContentElement >> newLabel [ - ^ BrFromPromise new - fitContent; - stencil: [ - BlAttributedTextElement new - id: GtSourceCoderCollapsedTextId; - editorMeasurement; - bold; - glamorousCodeFont ]; - dataBinder: [ :aLabel :aData | - aData - ifSuccess: [ :aText | aLabel text: aText asRopedText ] - ifError: [ :anError | aLabel text: anError printString asRopedText ] - ifPending: [ aLabel text: '' asRopedText ] ] + ^ BlAttributedTextElement new + id: GtSourceCoderCollapsedTextId; + editorMeasurement; + bold; + glamorousCodeFont; + withAsyncPromiseDo: [ :anElementPromise | + anElementPromise + whenSuccess: [ :aLabel :aText | aLabel text: aText asRopedText ]; + whenError: [ :aLabel :anError | aLabel text: anError printString asRopedText ]; + whenPending: [ :aLabel | aLabel text: '' asRopedText ] ] ] { #category : #'api - textual coder view model' } GtSourceCoderCollapsedContentElement >> onTextualCoderViewModelChanged [ super onTextualCoderViewModelChanged. - label promise: textualCoderViewModel coderModel collapsedTextPromise. - addOns promise: textualCoderViewModel addOns + label asyncPromise promise: textualCoderViewModel collapsedTextPromise. + addOns asyncPromise promise: textualCoderViewModel addOns ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 73cadb202..55c4d1de7 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -161,6 +161,14 @@ GtTextualCoderViewModel >> collapse [ self expanded: false ] +{ #category : #'api - text' } +GtTextualCoderViewModel >> collapsedTextPromise [ + "Return a text that should be displayed in the collapsed state" + + + ^ coderModel collapsedTextPromise +] + { #category : #'api - stylers' } GtTextualCoderViewModel >> compositeStyler [ ^ GtCoderAstCompositeStyler new From fbd2d2ba1e969e2a21e07116177b0bdb4e38d76e Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Wed, 1 Dec 2021 16:42:01 +0100 Subject: [PATCH 0110/1268] fix GtDiffElement --- src/GToolkit-Coder-UI/GtDiffElement.class.st | 42 ++++++++++++++++++-- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtDiffElement.class.st b/src/GToolkit-Coder-UI/GtDiffElement.class.st index 63902a371..c935cd2c0 100644 --- a/src/GToolkit-Coder-UI/GtDiffElement.class.st +++ b/src/GToolkit-Coder-UI/GtDiffElement.class.st @@ -11,7 +11,7 @@ Class { 'outlines', 'separatorElement' ], - #category : 'GToolkit-Coder-UI-Diff' + #category : #'GToolkit-Coder-UI-Diff' } { #category : #examples } @@ -236,8 +236,17 @@ GtDiffElement >> newTextElement [ ] { #category : #'geometry hooks' } -GtDiffElement >> notifyExtentChanged [ - super notifyExtentChanged. +GtDiffElement >> onExtentChanged [ + super onExtentChanged. + + outlines := #(). + self updateOutlines +] + +{ #category : #'geometry hooks' } +GtDiffElement >> onLayout: aBounds context: aBlElementBoundsUpdateContext [ + super onLayout: aBounds context: aBlElementBoundsUpdateContext. + outlines := #(). self updateOutlines ] @@ -265,6 +274,33 @@ GtDiffElement >> outlineFor: aSyncScrollRange [ ^ BlPolyline vertices: vertices ] +{ #category : #'event handling' } +GtDiffElement >> paintMeAndChildrenOn: aCompositorPainter offset: anOffset [ + | aCanvas stroke fill | + super paintMeAndChildrenOn: aCompositorPainter offset: anOffset. + + aCanvas := aCompositorPainter canvas. + + aCanvas transform + by: [ :t | t translateBy: anOffset ] + during: [ + stroke := aCanvas stroke + alpha: 0.2; + paint: Color black; + width: 1. + fill := aCanvas fill + alpha: 0.2; + paint: Color yellow. + outlines + do: [ :each | + fill + path: (each pathOnSpartaCanvas: aCanvas of: self); + draw. + stroke + path: (each pathOnSpartaCanvas: aCanvas of: self); + draw ] ] +] + { #category : #private } GtDiffElement >> previousRopedText [ ^ diff previousRopedText From 13c3a91ed0f9cb6fb9ee844ced5682e5f738a2f2 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Wed, 1 Dec 2021 23:03:45 +0100 Subject: [PATCH 0111/1268] [feenkcom/gtoolkit#2254] addons container should match parent --- .../GtSourceCoderCollapsedContentElement.class.st | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st index 823f4f09f..ce37f7713 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st @@ -29,8 +29,9 @@ GtSourceCoderCollapsedContentElement >> initialize [ { #category : #'instance creation' } GtSourceCoderCollapsedContentElement >> newAddOnsContainer [ ^ BrHorizontalPane new - fitContent; - margin: (BlInsets top: 4 left: 1 bottom: 1 right: 1); + matchParent; + alignCenterLeft; + margin: (BlInsets left: 5); withAsyncPromiseDo: [ :anElementPromise | anElementPromise whenSuccess: [ :aContainer :theAddOns | @@ -65,5 +66,6 @@ GtSourceCoderCollapsedContentElement >> onTextualCoderViewModelChanged [ super onTextualCoderViewModelChanged. label asyncPromise promise: textualCoderViewModel collapsedTextPromise. + addOns removeChildren. addOns asyncPromise promise: textualCoderViewModel addOns ] From 9249ab39d15067c6a7de454a43c1e0982a225fa6 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 2 Dec 2021 09:31:31 +0100 Subject: [PATCH 0112/1268] update streaming coders manifest --- .../ManifestGToolkitCoderStreamingCodersUI.class.st | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-StreamingCoders-UI/ManifestGToolkitCoderStreamingCodersUI.class.st b/src/GToolkit-Coder-StreamingCoders-UI/ManifestGToolkitCoderStreamingCodersUI.class.st index 507580d33..0afc4869a 100644 --- a/src/GToolkit-Coder-StreamingCoders-UI/ManifestGToolkitCoderStreamingCodersUI.class.st +++ b/src/GToolkit-Coder-StreamingCoders-UI/ManifestGToolkitCoderStreamingCodersUI.class.st @@ -12,9 +12,16 @@ ManifestGToolkitCoderStreamingCodersUI class >> mustOnlyDependOn [ ^ { 'Announcements-Core'. 'Collections-Sequenceable'. - 'Collections-Unordered'. 'Futures'. 'GToolkit-Coder-StreamingCoders'. 'Kernel' } ] + +{ #category : #accessing } +ManifestGToolkitCoderStreamingCodersUI class >> shouldDependOn [ + ^ { + 'Futures'. + 'GToolkit-Coder-StreamingCoders'. + } +] From 0b0bf64dbe417c08a60206bc82e5dc98e3a09fc5 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 2 Dec 2021 20:53:52 +0100 Subject: [PATCH 0113/1268] remove obsolete styler classes --- .../GtCoderContextVariableStyler.class.st | 86 ----------------- src/GToolkit-Coder/GtRBASTStyler.class.st | 94 ------------------- 2 files changed, 180 deletions(-) delete mode 100644 src/GToolkit-Coder/GtCoderContextVariableStyler.class.st delete mode 100644 src/GToolkit-Coder/GtRBASTStyler.class.st diff --git a/src/GToolkit-Coder/GtCoderContextVariableStyler.class.st b/src/GToolkit-Coder/GtCoderContextVariableStyler.class.st deleted file mode 100644 index f833f6b8b..000000000 --- a/src/GToolkit-Coder/GtCoderContextVariableStyler.class.st +++ /dev/null @@ -1,86 +0,0 @@ -Class { - #name : #GtCoderContextVariableStyler, - #superclass : #GtRBASTStyler, - #traits : 'TRBProgramNodeVisitor', - #classTraits : 'TRBProgramNodeVisitor classTrait', - #instVars : [ - 'methodCoder', - 'variables', - 'interval' - ], - #category : 'GToolkit-Coder-Styler/Highlighter' -} - -{ #category : #testing } -GtCoderContextVariableStyler >> hasValueForVariableNamed: aVariableName [ - ^ self - valueForVariableNamed: aVariableName - ifPresent: [ :value | true ] - ifAbsent: [ false ] -] - -{ #category : #initialization } -GtCoderContextVariableStyler >> initializeVariables [ - variables notNil - ifTrue: [ ^ self ]. - variables := Dictionary new. - methodCoder instanceVariableNodesDo: [ :aVariableNode | - variables at: aVariableNode key put: aVariableNode ]. - methodCoder temporaryVariableNodesDo: [ :aVariableNode | - variables at: aVariableNode key put: aVariableNode ]. - interval := methodCoder session pcRangeForContext: methodCoder context -] - -{ #category : #accessing } -GtCoderContextVariableStyler >> methodCoder [ - ^ methodCoder -] - -{ #category : #accessing } -GtCoderContextVariableStyler >> methodCoder: aMethodCoder [ - methodCoder := aMethodCoder -] - -{ #category : #styling } -GtCoderContextVariableStyler >> style: aText ast: ast [ - aText clearAttributes: [ :each | each isKindOf: GtPlaygroundEvaluatedCodeButtonAttribute ]. - self initializeVariables. - super style: aText ast: ast -] - -{ #category : #styling } -GtCoderContextVariableStyler >> styleVariableNode: aVariableNode [ - self subclassResponsibility -] - -{ #category : #accessing } -GtCoderContextVariableStyler >> valueForVariableNamed: aVariableName ifPresent: presentBlock [ - ^ self - valueForVariableNamed: aVariableName - ifPresent: presentBlock - ifAbsent: [ ^ self ] -] - -{ #category : #accessing } -GtCoderContextVariableStyler >> valueForVariableNamed: aVariableName ifPresent: presentBlock ifAbsent: absentBloc [ - ^ variables - at: aVariableName - ifPresent: [ :variableNode | - presentBlock value: variableNode value ] - ifAbsent: absentBloc -] - -{ #category : #visiting } -GtCoderContextVariableStyler >> visitArgumentNode: anArgumentNode [ - self styleVariableNode: anArgumentNode -] - -{ #category : #visiting } -GtCoderContextVariableStyler >> visitInstanceVariableNode: aSelfNode [ - self styleVariableNode: aSelfNode -] - -{ #category : #visiting } -GtCoderContextVariableStyler >> visitTemporaryNode: aNode [ - self styleVariableNode: aNode -] diff --git a/src/GToolkit-Coder/GtRBASTStyler.class.st b/src/GToolkit-Coder/GtRBASTStyler.class.st deleted file mode 100644 index 84021eb82..000000000 --- a/src/GToolkit-Coder/GtRBASTStyler.class.st +++ /dev/null @@ -1,94 +0,0 @@ -Class { - #name : #GtRBASTStyler, - #superclass : #BlTextStyler, - #classTraits : 'TRBProgramNodeVisitor classTrait', - #category : 'GToolkit-Coder-Styler/Highlighter' -} - -{ #category : #styling } -GtRBASTStyler >> extraStyle: aText ast: ast [ - -] - -{ #category : #'gt-extension' } -GtRBASTStyler >> gtViewTextFor: aView [ - - text ifNil: [ ^ aView empty ]. - ^ aView textEditor - title: 'Last styled text'; - priority: 105; - text: [ text ] -] - -{ #category : #private } -GtRBASTStyler >> parse: aText [ - | code | - code := aText asString. - ^ RBParser parseFaultyMethod: code -] - -{ #category : #private } -GtRBASTStyler >> privateStyle: aText [ - | ast | - ast := self parse: aText. - ast isNil - ifTrue: [ ^ aText ]. - [ self style: aText ast: ast. - self extraStyle: aText ast: ast ] - on: Error - do: [ :e | e return ]. - ^ aText -] - -{ #category : #styling } -GtRBASTStyler >> style: aText ast: ast [ - text := aText. - self visitNode: ast -] - -{ #category : #private } -GtRBASTStyler >> styleFrom: from to: to with: attributes [ - (text from: from to: to) attributes: attributes -] - -{ #category : #accessing } -GtRBASTStyler >> typeOf: aNode in: aClass [ - aNode isSelf - ifTrue: [ ^ aClass ]. - aNode isSuper - ifTrue: [ ^ aClass ifNotNil: [ :class | class superclass ] ]. - aNode isLiteralNode - ifTrue: [ ^ aNode value class ]. - aNode isDynamicArray - ifTrue: [ ^ {} class ]. - aNode isMessage - ifTrue: [ aNode selector = #class - ifTrue: [ ^ (self typeOf: aNode receiver in: aClass) - ifNotNil: [ :class | class class ] ]. - (#(new new:) includes: aNode selector) - ifTrue: [ ^ (self typeOf: aNode receiver in: aClass) - ifNotNil: [ :class | class instanceSide ] ] ]. - aNode isVariable - ifTrue: [ aNode binding - ifNotNil: [ :binding | - binding isLiteralVariable - ifTrue: [ binding value ifNotNil: [ :object | ^ object class ] ]. - (binding isSpecialVariable and: [ binding isThisContext ]) - ifTrue: [ ^ Context ] ] ]. - ^ nil -] - -{ #category : #visiting } -GtRBASTStyler >> visitArgumentNodes: aNodeCollection [ - "Sent *once* when visiting method and block nodes" - ^aNodeCollection do: [ :each | self visitNode: each ] -] - -{ #category : #visiting } -GtRBASTStyler >> visitTemporaryDeclarationNode: aTemporaryDeclarationNode [ - "| temp | - temp is a temporary node as we can find in the body of methods, but it can't be visited the same way. - IT redirects the message on argumentNodeVisitor as a way to keep retrocompatibility" - - ^ self visitNode: aTemporaryDeclarationNode -] From 12b6f2154ca45c864f1492f11c7c23caaa5abf12 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 2 Dec 2021 21:01:03 +0100 Subject: [PATCH 0114/1268] do not use TBlDebug --- src/GToolkit-Coder/GtCoderPackageExtentionTag.class.st | 2 -- src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/GToolkit-Coder/GtCoderPackageExtentionTag.class.st b/src/GToolkit-Coder/GtCoderPackageExtentionTag.class.st index bc0a9a2ae..124d629f2 100644 --- a/src/GToolkit-Coder/GtCoderPackageExtentionTag.class.st +++ b/src/GToolkit-Coder/GtCoderPackageExtentionTag.class.st @@ -1,8 +1,6 @@ Class { #name : #GtCoderPackageExtentionTag, #superclass : #Object, - #traits : 'TBlDebug', - #classTraits : 'TBlDebug classTrait', #instVars : [ 'package', 'classes' diff --git a/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st b/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st index 842b8a794..c43761cd3 100644 --- a/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st +++ b/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st @@ -1,8 +1,6 @@ Class { #name : #GtCoderPackageUncategorizedTag, #superclass : #Object, - #traits : 'TBlDebug', - #classTraits : 'TBlDebug classTrait', #instVars : [ 'packageTag' ], From 2538407385e85cf8522ffc239052c93239c6bb1c Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 2 Dec 2021 21:04:54 +0100 Subject: [PATCH 0115/1268] remove obsolete packages --- .../GtSourceCoderPromised.class.st | 335 --------- .../GtSourceCoderViewModelPromised.class.st | 163 ----- .../GtTextCoderPromised.class.st | 64 -- ...TextualCoderEditorElementPromised.class.st | 509 ------------- .../GtTextualCoderPromised.class.st | 274 ------- .../GtTextualCoderViewModelPromised.class.st | 666 ------------------ src/GToolkit-Coder-Promised/package.st | 1 - .../GtStreamingCodersViewModel.class.st | 188 ----- ...GtStreamingCodersViewModelCommand.class.st | 15 - ...eamingCodersViewModelScrollTarget.class.st | 10 - ...odersViewModelScrollTargetChanged.class.st | 20 - ...amingCodersViewModelStreamChanged.class.st | 5 - .../package.st | 1 - 13 files changed, 2251 deletions(-) delete mode 100644 src/GToolkit-Coder-Promised/GtSourceCoderPromised.class.st delete mode 100644 src/GToolkit-Coder-Promised/GtSourceCoderViewModelPromised.class.st delete mode 100644 src/GToolkit-Coder-Promised/GtTextCoderPromised.class.st delete mode 100644 src/GToolkit-Coder-Promised/GtTextualCoderEditorElementPromised.class.st delete mode 100644 src/GToolkit-Coder-Promised/GtTextualCoderPromised.class.st delete mode 100644 src/GToolkit-Coder-Promised/GtTextualCoderViewModelPromised.class.st delete mode 100644 src/GToolkit-Coder-Promised/package.st delete mode 100644 src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModel.class.st delete mode 100644 src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModelCommand.class.st delete mode 100644 src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModelScrollTarget.class.st delete mode 100644 src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModelScrollTargetChanged.class.st delete mode 100644 src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModelStreamChanged.class.st delete mode 100644 src/GToolkit-Coder-UI-StreamingCoders/package.st diff --git a/src/GToolkit-Coder-Promised/GtSourceCoderPromised.class.st b/src/GToolkit-Coder-Promised/GtSourceCoderPromised.class.st deleted file mode 100644 index ed7fb4105..000000000 --- a/src/GToolkit-Coder-Promised/GtSourceCoderPromised.class.st +++ /dev/null @@ -1,335 +0,0 @@ -Class { - #name : #GtSourceCoderPromised, - #superclass : #GtTextualCoderPromised, - #category : #'GToolkit-Coder-Promised' -} - -{ #category : #'api - actions' } -GtSourceCoderPromised >> debug [ - self debugInContext: self evaluationContext -] - -{ #category : #'private - actions' } -GtSourceCoderPromised >> debug: aSourceStringOrBlock inContext: aGtSourceCoderEvaluationContext [ - | aSourceString aSourceInterval aCompleteSourceString | - - self critical: [ - aCompleteSourceString := aSourceStringOrBlock isClosure - ifTrue: [ aSourceStringOrBlock cull: self ] - ifFalse: [ aSourceStringOrBlock ]. - aSourceString := aGtSourceCoderEvaluationContext sourceInterval computeSourceString: aCompleteSourceString. - aSourceInterval := aGtSourceCoderEvaluationContext sourceInterval computeSourceInterval: aCompleteSourceString. ]. - - aGtSourceCoderEvaluationContext - sourceString: aCompleteSourceString; - evaluatedSourceString: aSourceString; - evaluatedInterval: aSourceInterval. - - self - primitiveDebug: aSourceString - inContext: aGtSourceCoderEvaluationContext - onFailDo: [ self error: 'Failed to debug' ] -] - -{ #category : #'api - actions' } -GtSourceCoderPromised >> debugInContext: aGtSourceCoderEvaluationContext [ - self debug: self currentSourceString inContext: aGtSourceCoderEvaluationContext -] - -{ #category : #'api - actions' } -GtSourceCoderPromised >> discardChanges [ - "Discard not-accepted changes." - - self isModified - ifFalse: [ ^ self ]. - - self sourceCode resetCollapsedText. - self sourceCode resetSourceText. - - self sourceChanged -] - -{ #category : #'api - actions' } -GtSourceCoderPromised >> doItAll [ - "Evaluate the whole source code in a default evaluation context and return the result. - See the implementation of #evaluationContext to find the default state" - - ^ self doItInContext: self evaluationContext -] - -{ #category : #'api - actions' } -GtSourceCoderPromised >> doItAndGo [ - "Evaluate and inspect the whole source code in a default evaluation context and return the result. - See the implementation of #evaluationContext to find the default state" - - ^ self doItAndGoInContext: self evaluationContext -] - -{ #category : #'api - actions' } -GtSourceCoderPromised >> doItAndGoInContext: aGtSourceCoderEvaluationContext [ - ^ self - evaluate: [ :thisCoder | thisCoder currentSourceString ] - inContext: aGtSourceCoderEvaluationContext - thenDo: [ :anEvaluationResult | - self notifyEvaluatedWithResult: anEvaluationResult. - self notifyObjectSpawnFromEvaluationResult: anEvaluationResult ] -] - -{ #category : #'api - actions' } -GtSourceCoderPromised >> doItInContext: aGtSourceCoderEvaluationContext [ - ^ self - doItInContext: aGtSourceCoderEvaluationContext - thenDo: [ :aResult | self notifyEvaluatedWithResult: aResult ] -] - -{ #category : #'api - actions' } -GtSourceCoderPromised >> doItInContext: aGtSourceCoderEvaluationContext thenDo: aBlock [ - ^ self - evaluate: [ :thisCoder | thisCoder currentSourceString ] - inContext: aGtSourceCoderEvaluationContext - thenDo: aBlock -] - -{ #category : #'private - actions' } -GtSourceCoderPromised >> evaluate: aSourceStringOrBlock [ - "Evaluate a given source code and show the print string if needed" - - ^ self - evaluate: aSourceStringOrBlock - thenDo: [ ] -] - -{ #category : #'private - actions' } -GtSourceCoderPromised >> evaluate: aSourceStringOrBlock decorated: aSourceCodeDecorator inContext: aSourceCoderEvaluationContext thenDo: aThenBlock [ - "Evaluate a given source code" - | aCompleteSourceString aSourceString aSourceInterval aResult aDecoratedSourceString | - - "we can not wrap everything in a critical: because if there is an exception while evaluating - the source code the current running process will be suspended, meaning that the very next evaluation - will indefinitely wait when trying to enter a critical section." - self critical: [ - aCompleteSourceString := aSourceStringOrBlock isClosure - ifTrue: [ aSourceStringOrBlock cull: self ] - ifFalse: [ aSourceStringOrBlock ]. - - aSourceString := aSourceCoderEvaluationContext sourceInterval computeSourceString: aCompleteSourceString. - aSourceInterval := aSourceCoderEvaluationContext sourceInterval computeSourceInterval: aCompleteSourceString ]. - - aDecoratedSourceString := aSourceCodeDecorator value: aSourceString. - - aSourceCoderEvaluationContext - sourceString: aCompleteSourceString; - evaluatedSourceString: aSourceString; - evaluatedInterval: aSourceInterval. - - aResult := self evaluateBlock: [ - self - primitiveEvaluate: aDecoratedSourceString - inContext: aSourceCoderEvaluationContext - onFailDo: [ - | aResultWithSyntaxError | - - aResultWithSyntaxError := GtSourceCoderEvaluationResultWithSyntaxError new - evaluationContext: aSourceCoderEvaluationContext. - aThenBlock cull: aResultWithSyntaxError. - ^ aResultWithSyntaxError ] ] - onErrorDo: [ :aResultWithError | - aResultWithError - evaluationContext: aSourceCoderEvaluationContext ]. - - aResult evaluationContext: aSourceCoderEvaluationContext. - aThenBlock cull: aResult. - ^ aResult -] - -{ #category : #'private - actions' } -GtSourceCoderPromised >> evaluate: aSourceStringOrBlock inContext: aGtSourceCoderEvaluationContext thenDo: aThenBlock [ - ^ self - evaluate: aSourceStringOrBlock - decorated: [ :aSourceString | aSourceString ] - inContext: aGtSourceCoderEvaluationContext - thenDo: aThenBlock -] - -{ #category : #'private - actions' } -GtSourceCoderPromised >> evaluate: aSourceStringOrBlock thenDo: aThenBlock [ - "Evaluate a given source code and show the print string if needed" - - ^ self - evaluate: aSourceStringOrBlock - inContext: self evaluationContext - thenDo: aThenBlock -] - -{ #category : #'private - actions' } -GtSourceCoderPromised >> evaluateBlock: aBlock onErrorDo: anErrorBlock [ - - | aResult wasErrorAlreadySignaled | - - wasErrorAlreadySignaled := false. - aResult := aBlock - on: Error - do: [ :anError | - | aResultWithError | - - NonInteractiveTranscript stdout - nextPut: $[; - nextPutAll: self class name; - nextPut: $]; - space; - print: anError; - cr. - - aResultWithError := GtSourceCoderEvaluationResultWithRuntimeError new - isResignaled: wasErrorAlreadySignaled; - error: anError. - - "let the caller to set source string and source interval" - anErrorBlock value: aResultWithError. - - wasErrorAlreadySignaled - ifTrue: [ - "Continue the handling of this exception. This will open a debugger - if the error is not caught elsewhere." - anError pass. - ^ nil ] - ifFalse: [ - wasErrorAlreadySignaled := true. - - aResultWithError error: (GtCoderEvaluationUnhandledError new - exception: anError; - sourceCoder: self; - sourceString: aResultWithError sourceString; - sourceInterval: aResultWithError sourceInterval). - - anError resignalAs: aResultWithError error. - ^ nil ]. - - "Normally, the process will be terminated during error handling, however if debugger fails to open - it may not be terminated, so we should return a result with an explicit error " - ^ aResultWithError ]. - - ^ GtSourceCoderEvaluationResultWithValue new value: aResult -] - -{ #category : #'private - actions' } -GtSourceCoderPromised >> evaluationContext [ - - - ^ GtSourceCoderEvaluationContext new - requesterObject: self; - coder: self -] - -{ #category : #testing } -GtSourceCoderPromised >> hasImplicitVariableReferenceTo: aString [ - self implicitVariableReferencesTo: aString do: [ :each | ^ true ]. - ^ false -] - -{ #category : #'api - ast' } -GtSourceCoderPromised >> implicitVariableReferencesTo: aString do: aBlock [ - "Evaluate aBlock for every ast node that is a variable reference to an implicitly defined variable named aString." - - -] - -{ #category : #'private - notifying' } -GtSourceCoderPromised >> notifyEvaluatedWithResult: anEvaluationResult [ - self announce: (GtCoderEvaluationAnnouncement new - evaluationResult: anEvaluationResult; - coder: self) -] - -{ #category : #'private - notifying' } -GtSourceCoderPromised >> notifyObjectSpawn: anObject [ - self - notifyObjectSpawn: anObject - withDestination: self spawnDestination -] - -{ #category : #'private - notifying' } -GtSourceCoderPromised >> notifyObjectSpawn: anObject withDestination: aSpawnDestination [ - self announce: (GtCoderObjectSpawnRequest new - object: anObject; - spawnDestination: aSpawnDestination; - coder: self) -] - -{ #category : #'private - notifying' } -GtSourceCoderPromised >> notifyObjectSpawnFromEvaluationResult: anEvaluationResult [ - - anEvaluationResult isSuccess - ifFalse: [ ^ self ]. - - self - notifyObjectSpawn: anEvaluationResult value -] - -{ #category : #'private - notifying' } -GtSourceCoderPromised >> notifyPrintResult: anEvaluationResult [ - self announce: (GtCoderPrintAnnouncement new - evaluationResult: anEvaluationResult; - coder: self) -] - -{ #category : #'private - notifying' } -GtSourceCoderPromised >> notifyShowDebuggerRequest: aDebugSession dueTo: anException sourceString: aSourceString sourceInterval: aSourceInterval [ - (self announcer subscriptionsForClass: GtCoderShowDebuggerRequest) size isZero - ifTrue: [ - ^ Smalltalk tools debugger - openOn: aDebugSession - withFullView: true ]. - - self announce: (GtCoderShowDebuggerRequest new - coder: self; - debugSession: aDebugSession; - exception: anException; - sourceString: aSourceString; - sourceInterval: aSourceInterval) -] - -{ #category : #'private - actions' } -GtSourceCoderPromised >> primitiveDebug: aSourceString inContext: aGtSourceCoderEvaluationContext onFailDo: anEvaluationFailBlock [ - ^ self subclassResponsibility -] - -{ #category : #'private - actions' } -GtSourceCoderPromised >> primitiveEvaluate: aSourceString inContext: aGtSourceCoderEvaluationContext onFailDo: anEvaluationFailBlock [ - ^ self subclassResponsibility -] - -{ #category : #'api - actions' } -GtSourceCoderPromised >> printItInContext: aGtSourceCoderEvaluationContext [ - ^ self - evaluate: [ :thisCoder | thisCoder currentSourceString ] - inContext: aGtSourceCoderEvaluationContext - thenDo: [ :aResult | self notifyPrintResult: aResult ] -] - -{ #category : #'api - ast' } -GtSourceCoderPromised >> renameImplicitTemporary: oldName to: newName [ - | source | - source := SmaCCString on: self currentSourceString. - self - implicitVariableReferencesTo: oldName - do: - [ :node | - source - replaceFrom: node startPosition - to: node stopPosition - with: newName ]. - self currentSourceString: source asString -] - -{ #category : #accessing } -GtSourceCoderPromised >> spawnDestination [ - ^ self - attributeNamed: #spawnDestination - ifAbsent: [ GtPhlowSpawnDesiredDestination defaultDestination ] -] - -{ #category : #accessing } -GtSourceCoderPromised >> spawnDestination: aSpawnDestination [ - self attributeNamed: #spawnDestination put: aSpawnDestination -] diff --git a/src/GToolkit-Coder-Promised/GtSourceCoderViewModelPromised.class.st b/src/GToolkit-Coder-Promised/GtSourceCoderViewModelPromised.class.st deleted file mode 100644 index 6e22a57f4..000000000 --- a/src/GToolkit-Coder-Promised/GtSourceCoderViewModelPromised.class.st +++ /dev/null @@ -1,163 +0,0 @@ -Class { - #name : #GtSourceCoderViewModelPromised, - #superclass : #GtTextualCoderViewModelPromised, - #instVars : [ - 'evaluationResult' - ], - #category : #'GToolkit-Coder-Promised' -} - -{ #category : #'api - actions' } -GtSourceCoderViewModelPromised >> debug [ - ^ self selection isEmpty - ifTrue: [ self debugAll ] - ifFalse: [ self debugIt: self selectedTextInterval ] -] - -{ #category : #'api - actions' } -GtSourceCoderViewModelPromised >> debugAll [ - ^ self coderModel debugInContext: self evaluationContext all -] - -{ #category : #'api - actions' } -GtSourceCoderViewModelPromised >> debugIt: aTextInterval [ - ^ self coderModel debugInContext: (self evaluationContext - from: aTextInterval first to: aTextInterval last) -] - -{ #category : #'api - actions' } -GtSourceCoderViewModelPromised >> discardChanges [ - self coder discardChanges -] - -{ #category : #'api - actions' } -GtSourceCoderViewModelPromised >> doIt [ - "Evaluate a piece of source code within a selection interval or everything if nothing is selected and return a result" - - - ^ self doItRequestedBy: self -] - -{ #category : #'api - actions' } -GtSourceCoderViewModelPromised >> doIt: aTextInterval [ - "Evaluate a piece of source code within an interval and return a result. - I am also able to evaluate an empty or only consisting of whitespace - source code in which case the result is nil" - - - ^ self doIt: aTextInterval requestedBy: self -] - -{ #category : #'api - actions' } -GtSourceCoderViewModelPromised >> doIt: aTextInterval requestedBy: aRequesterObject [ - "Evaluate source code within given text interval and return the result" - - ^ self coderModel doItInContext: (self evaluationContext - from: aTextInterval first to: aTextInterval last; - requesterObject: aRequesterObject) -] - -{ #category : #'api - actions' } -GtSourceCoderViewModelPromised >> doItAll [ - "Evaluate the whole source code and return the result" - - ^ self doItAllRequestedBy: self -] - -{ #category : #'api - actions' } -GtSourceCoderViewModelPromised >> doItAllRequestedBy: aRequesterObject [ - "Evaluate the whole source code independent from the selection and return the result" - - ^ self coder doItInContext: (self evaluationContext - all; - requesterObject: aRequesterObject) -] - -{ #category : #'api - actions' } -GtSourceCoderViewModelPromised >> doItAndGo [ - "Evaluate selected source code or everything if there is nothing selected and inspect the result" - - ^ self selection isEmpty - ifTrue: [ self doItAndGoAll ] - ifFalse: [ self doItAndGo: self selectedTextInterval ] -] - -{ #category : #'api - actions' } -GtSourceCoderViewModelPromised >> doItAndGo: aTextInterval [ - "Evaluate a piece of source code within an interval and inspect a result." - - ^ self coder doItAndGoInContext: (self evaluationContext from: aTextInterval first to: aTextInterval last) -] - -{ #category : #'api - actions' } -GtSourceCoderViewModelPromised >> doItAndGoAll [ - "Evaluate the whole source code and inspect the result" - - ^ self coder doItAndGoInContext: self evaluationContext all -] - -{ #category : #'api - actions' } -GtSourceCoderViewModelPromised >> doItRequestedBy: aRequesterObject [ - "Evaluate selected source code or everything if there is nothing selected and return the result" - - ^ self selection isEmpty - ifTrue: [ self doItAllRequestedBy: aRequesterObject ] - ifFalse: [ self doIt: self selectedTextInterval requestedBy: aRequesterObject ] -] - -{ #category : #accessing } -GtSourceCoderViewModelPromised >> elementClass [ - ^ super elementClass - "^ GtExpandableSourceCoderElement" -] - -{ #category : #'private - evaluation' } -GtSourceCoderViewModelPromised >> evaluationContext [ - - - ^ self coderModel evaluationContext - requesterObject: self -] - -{ #category : #accessing } -GtSourceCoderViewModelPromised >> evaluationResult [ - ^ evaluationResult -] - -{ #category : #accessing } -GtSourceCoderViewModelPromised >> evaluationResult: anObject [ - evaluationResult := anObject -] - -{ #category : #'api - actions' } -GtSourceCoderViewModelPromised >> printIt [ - "Evaluate selected source code or everything if there is nothing selected and print the result" - - ^ self selection isEmpty - ifTrue: [ self printItAll ] - ifFalse: [ self printIt: self selectedTextInterval ] -] - -{ #category : #'api - actions' } -GtSourceCoderViewModelPromised >> printIt: aTextInterval [ - "Evaluate a piece of source code within an interval and print a result." - - ^ self coder printItInContext: (self evaluationContext from: aTextInterval first to: aTextInterval last) -] - -{ #category : #'api - actions' } -GtSourceCoderViewModelPromised >> printItAll [ - "Evaluate the whole source code and print the result" - - ^ self coder printItInContext: self evaluationContext all -] - -{ #category : #'private - evaluation' } -GtSourceCoderViewModelPromised >> selectedTextInterval [ - - | anInterval | - anInterval := 1 to: 0. - self selection do: [ :eachMonotoneSelection | - anInterval := eachMonotoneSelection from + 1 to: eachMonotoneSelection to ]. - ^ anInterval -] diff --git a/src/GToolkit-Coder-Promised/GtTextCoderPromised.class.st b/src/GToolkit-Coder-Promised/GtTextCoderPromised.class.st deleted file mode 100644 index 18422766f..000000000 --- a/src/GToolkit-Coder-Promised/GtTextCoderPromised.class.st +++ /dev/null @@ -1,64 +0,0 @@ -Class { - #name : #GtTextCoderPromised, - #superclass : #GtTextualCoderPromised, - #instVars : [ - 'parser', - 'parserStartingState' - ], - #category : #'GToolkit-Coder-Promised' -} - -{ #category : #'as yet unclassified' } -GtTextCoderPromised >> asCoderUIModel [ - ^ GtTextualCoderViewModel new coder: self -] - -{ #category : #'api - ast' } -GtTextCoderPromised >> computeAst: theSourceString [ - ^ parser - ifNil: [ theSourceString ] - ifNotNil: [ - parserStartingState - ifNil: [ parser parseWithErrors: theSourceString ] - ifNotNil: [ parser parseWithErrors: theSourceString startingAt: parserStartingState ] ] -] - -{ #category : #initialization } -GtTextCoderPromised >> forString: aString [ - self sourceCode: (GtCoderExplicitSourceCode new source: aString) -] - -{ #category : #initialization } -GtTextCoderPromised >> forText: aText [ - self sourceCode: (GtCoderExplicitTextSource new text: aText) -] - -{ #category : #'instance creation' } -GtTextCoderPromised >> newCompletionStrategy [ - ^ GtCompletionStrategy new -] - -{ #category : #accessing } -GtTextCoderPromised >> parser [ - ^ parser -] - -{ #category : #accessing } -GtTextCoderPromised >> parser: anObject [ - parser := anObject -] - -{ #category : #accessing } -GtTextCoderPromised >> parserStartingState [ - ^ parserStartingState -] - -{ #category : #accessing } -GtTextCoderPromised >> parserStartingState: anObject [ - parserStartingState := anObject -] - -{ #category : #'api - ast' } -GtTextCoderPromised >> supportsAstCache [ - ^ false -] diff --git a/src/GToolkit-Coder-Promised/GtTextualCoderEditorElementPromised.class.st b/src/GToolkit-Coder-Promised/GtTextualCoderEditorElementPromised.class.st deleted file mode 100644 index c51fbd941..000000000 --- a/src/GToolkit-Coder-Promised/GtTextualCoderEditorElementPromised.class.st +++ /dev/null @@ -1,509 +0,0 @@ -Class { - #name : #GtTextualCoderEditorElementPromised, - #superclass : #BrEditor, - #traits : 'TBlAssertUIProcess + TGtWithTextualCoderViewModel', - #classTraits : 'TBlAssertUIProcess classTrait + TGtWithTextualCoderViewModel classTrait', - #instVars : [ - 'completion', - 'evaluationHighlighter', - 'evaluationPrinter', - 'shortcuts' - ], - #category : #'GToolkit-Coder-Promised' -} - -{ #category : #'api - textual coder view model' } -GtTextualCoderEditorElementPromised >> coderUIModel: aTextualCoderViewModel [ - self textualCoderViewModel: aTextualCoderViewModel -] - -{ #category : #'instance creation' } -GtTextualCoderEditorElementPromised >> createContextMenuContent [ - "wait for the addons to be computed" - | theContextMenu | - - theContextMenu := GtCoderContextMenuContent new - editorElement: self. - - self textualCoderViewModel addOnsAsyncDo: [ :theAddOns | - | theItems theContextMenuAstAddons | - - "extra context menu items that depend on ast and view model state such as selection" - theContextMenuAstAddons := self textualCoderViewModel computeContextMenuAstAddOns. - - theItems := theAddOns contextMenuActions, theAddOns mainActions, theContextMenuAstAddons contextMenuActions. - theItems := theItems reject: [ :e | e title isNil ]. - - theContextMenu enqueueTask: (BlTaskAction new action: [ theContextMenu items: theItems ]) ]. - - ^ theContextMenu -] - -{ #category : #private } -GtTextualCoderEditorElementPromised >> hideHighlighters [ - self text clearAttributes: [ :eachAttribute | - eachAttribute isKindOf: GtSourceCoderErrorAttribute ]. - evaluationHighlighter hideResultSynchronously. - evaluationPrinter hideResultSynchronously. -] - -{ #category : #private } -GtTextualCoderEditorElementPromised >> highlightPCRangeForInterval: aSelectionInterval [ - self textualCoderViewModel isModified - ifTrue: [ ^ self ]. - self text - clearAttributes: [ :each | each class = BlTextDecorationAttribute ]. - (self text from: aSelectionInterval first to: aSelectionInterval last) - underlineDo: [ :anAttribute | - anAttribute - color: self theme status errorBackgroundColor; - thickness: 1.5; - beNotOverwritableByStyler ] -] - -{ #category : #initialization } -GtTextualCoderEditorElementPromised >> initialize [ - super initialize. - - self - aptitude: BrGlamorousCodeEditorAptitude + (BrGlamorousWithContextMenuAptitude content: [ self createContextMenuContent ]); - padding: BlInsets empty; - hMatchParent; - vFitContent. - - self editor - beEditableCode; - disableStyleTextWhenModified. - - shortcuts := #(). - completion := GtCompletionController on: self. - - evaluationHighlighter := GtSourceCoderEvaluationHighlighter new editorElement: self. - evaluationPrinter := GtSourceCoderEvaluationPrinter new editorElement: self. - - self initializeListeners -] - -{ #category : #initialization } -GtTextualCoderEditorElementPromised >> initializeListeners [ - self when: BlFocusInEvent do: [ :anEvent | - self textualCoderViewModel focused: true from: self ]. - self when: BlFocusOutEvent do: [ :anEvent | - "when elements are removed from the scene graph due to tab switching or scrolling they lose focus. - We are only interested when focus is lost explicitly via user interaction" - anEvent isDueToRemoval - ifFalse: [ self textualCoderViewModel focused: false from: self ] ]. - - self editor - when: BrTextEditorModifiedEvent - do: [ :anEvent | self onTextModified ]. - - self editor - when: BrTextEditorCursorChangedEvent - do: [ :anEvent | self textualCoderViewModel cursors: anEvent cursors from: self ]. - - self editor - when: BrTextEditorSelectionChangedEvent - do: [ :anEvent | self textualCoderViewModel selection: anEvent selection from: self ]. - - "self editor - when: BrTextEditorTextStyledEvent - do: [ :anEvent | self textualCoderViewModel styledText: anEvent styledText ]" -] - -{ #category : #'private - event handling' } -GtTextualCoderEditorElementPromised >> onCodeEvaluated: anEvaluationAnnouncement [ - evaluationHighlighter displayResult: anEvaluationAnnouncement evaluationResult. - evaluationPrinter hideResult -] - -{ #category : #'private - event handling' } -GtTextualCoderEditorElementPromised >> onCoderParseError: aGtCoderParseError [ - "A parse error can be notifying from a non-UI thread" - - self enqueueTask: (BlTaskAction new action: [ - self - reportParseError: aGtCoderParseError errorMessage - at: aGtCoderParseError location ]) -] - -{ #category : #'private - event handling' } -GtTextualCoderEditorElementPromised >> onCoderViewModelFocused: aBoolean [ - aBoolean - ifTrue: [ self requestFocus ] - ifFalse: [ self loseFocus ] -] - -{ #category : #'private - event handling' } -GtTextualCoderEditorElementPromised >> onContextPCRangeChanged: aContextPCRangeChangedAnnouncement [ - | selectionInterval | - - selectionInterval := aContextPCRangeChangedAnnouncement pcRange. - self highlightPCRangeForInterval: selectionInterval -] - -{ #category : #'private - event handling' } -GtTextualCoderEditorElementPromised >> onCursorsChanged: aCursorsChangedAnnouncement [ - "Is sent when the cursors change in the View Model. - May be sent from a non-UI thread" - - "if the source of the announcement is myself, do nothing to break the change cycle" - aCursorsChangedAnnouncement source = self - ifTrue: [ ^ self ]. - - "since it may be sent from a non-UI process make sure to wrap in the action" - self enqueueTask: (BlTaskAction new action: [ - self navigator - withoutResettingDesiredCoordinate; - removeAll; - addAll: aCursorsChangedAnnouncement cursors; - apply ]) -] - -{ #category : #'private - event handling' } -GtTextualCoderEditorElementPromised >> onFocusChangedAnnouncement: anAnnouncement [ - self assertUIProcess. - - anAnnouncement source == self - ifTrue: [ ^ self ]. - - anAnnouncement source == self textualCoderViewModel - ifFalse: [ ^ self ]. - - self onCoderViewModelFocused: anAnnouncement focused -] - -{ #category : #'private - event handling' } -GtTextualCoderEditorElementPromised >> onObjectSpawnRequest: anAnnouncement [ - self enqueueTask: (BlTaskAction new action: [ - self phlow - spawnObject: anAnnouncement object - withDestination: anAnnouncement spawnDestination ]) -] - -{ #category : #'api - textual coder view model' } -GtTextualCoderEditorElementPromised >> onPostTextualCoderViewModelChanged [ - "I am an optional hook method that is sent after #subscribeToTextualCoderViewModel. - I do nothing by default but allow users to perform update operations when a receiver object is already - subscribed to announcements." - - self textualCoderViewModel hasStyledText - ifTrue: [ ^ self ]. - - "the add-ons will not compute themselves unless we tell them to" - self textualCoderViewModel addOns then: [ :theAddOns | self onViewModelReadyToStyle ] -] - -{ #category : #'private - event handling' } -GtTextualCoderEditorElementPromised >> onPrintRequest: anEvaluationAnnouncement [ - evaluationHighlighter hideResult. - evaluationPrinter displayResult: anEvaluationAnnouncement evaluationResult. -] - -{ #category : #'private - event handling' } -GtTextualCoderEditorElementPromised >> onShowDebuggerRequest: aShowDebuggerAnnouncement [ - | sharedDebugSession anEvaluatedSource anEvaluatedInterval theSourceStartInText theSourceEndInText | - - evaluationHighlighter hideResult. - evaluationPrinter hideResult. - - sharedDebugSession := GtSharedDebugSession new - session: aShowDebuggerAnnouncement debugSession. - - self showNotification: (GtNotificationDebugSession new debugSession: sharedDebugSession). - - anEvaluatedSource := aShowDebuggerAnnouncement sourceString. - anEvaluatedInterval := aShowDebuggerAnnouncement sourceInterval. - - theSourceStartInText := self text finder - caseSensitiveSubstring: anEvaluatedSource; - startAtPosition: anEvaluatedInterval first; - searchClosest. - - "what did we evaluate?" - theSourceStartInText isZero - ifTrue: [ ^ self ]. - - theSourceEndInText := (theSourceStartInText + anEvaluatedSource size - 1) min: self text size. - - self text - clearAttributes: [ :each | - { GtEmbeddedDebuggerAttribute } anySatisfy: [ :cls | each isKindOf: cls ] ]. - - (self text from: theSourceStartInText to: theSourceEndInText) - attribute: (GtEmbeddedDebuggerAttribute new - signaledException: aShowDebuggerAnnouncement exception; - debugSession: sharedDebugSession) -] - -{ #category : #'private - event handling' } -GtTextualCoderEditorElementPromised >> onStyleTextRequest: anEvent [ - "onStyleTextRequest: may be sent from a non-UI thread" - - self enqueueTask: (BlTaskAction new action: [ self styleTextAndAfterDo: anEvent afterAction ]) -] - -{ #category : #'private - event handling' } -GtTextualCoderEditorElementPromised >> onStylersUpdated: anAnnouncement [ - -] - -{ #category : #'private - event handling' } -GtTextualCoderEditorElementPromised >> onTextModified [ - "Is sent when the text changes in the editor. Here we should synchronise the UI and the model." - - self textualCoderViewModel - sourceText: self text - from: self - synchronously: true -] - -{ #category : #'api - textual coder view model' } -GtTextualCoderEditorElementPromised >> onTextualCoderViewModelChanged [ - "Is sent when a new textualCoder view model is assigned to the element. - Note: #onTextualCoderViewModelChanged is sent before #subscribeToTextualCoderViewModel - which means that if you perform any operation that triggers an announcement it will be ignored because the receiver - didn't get a chance to subscribe to any announcement. Override #onPostTextualCoderViewModelChanged if you - wish to perform an operation that requires an announcement, but keep in mind that this is not the most efficient way" - - self onCoderViewModelFocused: self textualCoderViewModel focused. - - "Setting text may change cursor and selection because text editor makes sure - that they have valid values. That is why we create a snaphot of the editor's state - which we will restore once new text is set" - self textualCoderViewModel asEditorState then: [ :anEditorState :isSynchronous | - isSynchronous - ifTrue: [ self editor restoreState: anEditorState ] - ifFalse: [ self enqueueTask: (BlTaskAction new action: [ self editor restoreState: anEditorState ]) ] ]. - - self editor model: self textualCoderViewModel. - - shortcuts := self textualCoderViewModel shortcuts copy. - self editor addEditorShortcuts: shortcuts. - - completion strategy: self textualCoderViewModel coderModel completionStrategy -] - -{ #category : #'private - event handling' } -GtTextualCoderEditorElementPromised >> onToolSpawnRequest: anAnnouncement [ - self enqueueTask: (BlTaskAction new action: [ - self phlow - spawnTool: anAnnouncement tool - withDestination: anAnnouncement spawnDestination ]) -] - -{ #category : #'private - event handling' } -GtTextualCoderEditorElementPromised >> onUpdateAddOnsRequest: anAnnouncement [ - -] - -{ #category : #'private - event handling' } -GtTextualCoderEditorElementPromised >> onViewModelCursorsChanged: aCursorsChangedAnnouncement [ - "Is sent when the cursors changes in the View Model. - May be sent from a non-UI thread" - - "if the source of the announcement is myself, do nothing to break the change cycle" - aCursorsChangedAnnouncement source = self - ifTrue: [ ^ self ]. - - aCursorsChangedAnnouncement source == self textualCoderViewModel - ifFalse: [ ^ self ]. - - "since it may be sent from a non-UI process make sure to wrap in the action" - self enqueueTask: (BlTaskAction new action: [ - self navigator - withoutResettingDesiredCoordinate; - removeAll; - addAll: aCursorsChangedAnnouncement cursors; - apply ]) -] - -{ #category : #'private - event handling' } -GtTextualCoderEditorElementPromised >> onViewModelReadyToStyle [ - self enqueueTask: (BlTaskAction new action: [ self editor styleText ]) -] - -{ #category : #'private - event handling' } -GtTextualCoderEditorElementPromised >> onViewModelSelectionChanged: aSelectionChangedAnnouncement [ - "Is sent when the selection changes in the View Model. - May be sent from a non-UI thread" - - "if the source of the announcement is myself, do nothing to break the change cycle" - aSelectionChangedAnnouncement source = self - ifTrue: [ ^ self ]. - - aSelectionChangedAnnouncement source == self textualCoderViewModel - ifFalse: [ ^ self ]. - - "since it may be sent from a non-UI process make sure to wrap in the action" - self enqueueTask: (BlTaskAction new action: [ - self deselecter all deselect. - self selecter - withoutCursorUpdate; - all: aSelectionChangedAnnouncement selection; - select ]) -] - -{ #category : #'private - event handling' } -GtTextualCoderEditorElementPromised >> onViewModelShortcutsChanged [ - "Is sent when the shortcuts change in the View Model. - May be sent from a non-UI thread" - - "since it may be sent from a non-UI process make sure to wrap in the action" - self enqueueTask: (BlTaskAction new action: [ - self editor removeEditorShortcuts: shortcuts. - shortcuts := self textualCoderViewModel shortcuts copy. - self editor addEditorShortcuts: shortcuts ]) -] - -{ #category : #'private - event handling' } -GtTextualCoderEditorElementPromised >> onViewModelStyledTextChanged: anAnnouncement [ -] - -{ #category : #'private - event handling' } -GtTextualCoderEditorElementPromised >> onViewModelStylersChanged [ - self enqueueTask: (BlTaskAction new - action: [ self styler: self textualCoderViewModel compositeStyler ]) -] - -{ #category : #'private - event handling' } -GtTextualCoderEditorElementPromised >> onViewModelTextAttributesAdded: anAnnouncement [ - self enqueueTask: (BlTaskAction new action: [ - anAnnouncement coderTextAttributes - applyOnEditorText: self text - from: anAnnouncement startPosition - to: anAnnouncement stopPosition ]) -] - -{ #category : #'private - event handling' } -GtTextualCoderEditorElementPromised >> onViewModelTextAttributesRemoved: anAnnouncement [ - self enqueueTask: (BlTaskAction new action: [ - anAnnouncement coderTextAttributes removeFromEditorText: self text ]) -] - -{ #category : #'private - event handling' } -GtTextualCoderEditorElementPromised >> onViewModelTextChanged: aGtTextualCoderViewModelTextChanged [ - - aGtTextualCoderViewModelTextChanged source == self - ifTrue: [ ^ self hideHighlighters ]. - - aGtTextualCoderViewModelTextChanged isSynchronous - ifTrue: [ - self text: aGtTextualCoderViewModelTextChanged text copy. - self hideHighlighters ] - ifFalse: [ self enqueueTask: (BlTaskAction new action: [ - self text: aGtTextualCoderViewModelTextChanged text copy. - self hideHighlighters ]) ] -] - -{ #category : #registration } -GtTextualCoderEditorElementPromised >> registerCoderModelAnnouncementsFor: aCoderModel [ - aCoderModel announcer weak - when: GtCoderAddOnsUpdateRequest - send: #onUpdateAddOnsRequest: - to: self; - when: GtCoderStylerChanged send: #onStylersUpdated: to: self; - when: GtCoderStyleTextRequest send: #onStyleTextRequest: to: self; - when: GtCoderParseError send: #onCoderParseError: to: self; - when: GtCoderObjectSpawnRequest - send: #onObjectSpawnRequest: - to: self; - when: GtCoderToolSpawnRequest send: #onToolSpawnRequest: to: self; - when: GtCoderEvaluationAnnouncement - send: #onCodeEvaluated: - to: self; - when: GtCoderPrintAnnouncement send: #onPrintRequest: to: self; - when: GtCoderShowDebuggerRequest - send: #onShowDebuggerRequest: - to: self -] - -{ #category : #registration } -GtTextualCoderEditorElementPromised >> registerCoderViewModelAnnouncementsFor: aGtSourceCoderUIModel [ - aGtSourceCoderUIModel weak - when: GtMethodCoderContextPCRangeChanged - send: #onContextPCRangeChanged: - to: self; - when: GtSourceCoderFocusChanged - send: #onFocusChangedAnnouncement: - to: self; - - when: GtTextualCoderViewModelTextChanged - send: #onViewModelTextChanged: - to: self; - when: GtTextualCoderViewModelCursorsChanged - send: #onViewModelCursorsChanged: - to: self; - when: GtTextualCoderViewModelSelectionChanged - send: #onViewModelSelectionChanged: - to: self; - when: GtTextualCoderViewModelStylersChanged - send: #onViewModelStylersChanged - to: self; - when: GtTextualCoderViewModelShortcutsChanged - send: #onViewModelShortcutsChanged - to: self; - when: GtTextualCoderViewModelReadyToRestyle - send: #onViewModelReadyToStyle - to: self; - when: GtTextualCoderViewModelTextAttributesAdded - send: #onViewModelTextAttributesAdded: - to: self; - when: GtTextualCoderViewModelTextAttributesRemoved - send: #onViewModelTextAttributesRemoved: - to: self; - when: GtTextualCoderViewModelStyledTextChanged - send: #onViewModelStyledTextChanged: - to: self. -] - -{ #category : #private } -GtTextualCoderEditorElementPromised >> reportParseError: aString at: anInteger [ - | text position | - - text := self editor text. - - position := anInteger - 1 max: 1. - text size < position - ifTrue: [ ^ self ]. - - text clearAttributesOfClass: GtSourceCoderErrorAttribute. - text - attribute: (GtSourceCoderErrorAttribute for: aString) - from: position - to: position -] - -{ #category : #private } -GtTextualCoderEditorElementPromised >> styleText [ - self editor styleText -] - -{ #category : #private } -GtTextualCoderEditorElementPromised >> styleTextAndAfterDo: aBlock [ - self editor styleTextAndAfterDo: aBlock -] - -{ #category : #'api - textual coder view model' } -GtTextualCoderEditorElementPromised >> subscribeToTextualCoderViewModel [ - "Is sent after a new textualCoder view model is assigned to the element. - It is required to unsubscribe from the view model or domain model by implementing - #unsubscribeFromTextualCoderViewModel if elements subscribe to them" - - self registerCoderModelAnnouncementsFor: self textualCoderViewModel coderModel. - self registerCoderViewModelAnnouncementsFor: self textualCoderViewModel. - - completion install -] - -{ #category : #'api - textual coder view model' } -GtTextualCoderEditorElementPromised >> unsubscribeFromTextualCoderViewModel [ - "Is sent before a new textualCoder view model is assigned to the element. - Elements that subscribe to textualCoder view model in domain model are required to implement this methods." - - self textualCoderViewModel unsubscribe: self. - self textualCoderViewModel coderModel unsubscribe: self. - - completion uninstall. - self editor removeEditorShortcuts: shortcuts -] diff --git a/src/GToolkit-Coder-Promised/GtTextualCoderPromised.class.st b/src/GToolkit-Coder-Promised/GtTextualCoderPromised.class.st deleted file mode 100644 index c651c1076..000000000 --- a/src/GToolkit-Coder-Promised/GtTextualCoderPromised.class.st +++ /dev/null @@ -1,274 +0,0 @@ -Class { - #name : #GtTextualCoderPromised, - #superclass : #GtCoderModel, - #instVars : [ - 'sourceCode', - 'completionStrategy', - 'astPromise' - ], - #category : #'GToolkit-Coder-Promised' -} - -{ #category : #'as yet unclassified' } -GtTextualCoderPromised >> addCopyCutPasteContextMenuAddOnsAst: anAst to: coderAddOns [ - - coderAddOns - addContextMenuItem: 'Cut' - action: [ :aCoderViewModel :anEditorElement | anEditorElement editor cutSelected ] - id: GtTextualCoderCutContextMenuItemId; - addContextMenuItem: 'Copy' - action: [ :aCoderViewModel :anEditorElement | anEditorElement editor copySelected ] - id: GtTextualCoderCopyContextMenuItemId; - addContextMenuItem: 'Paste' - action: [ :aCoderViewModel :anEditorElement | anEditorElement editor paste ] - id: GtTextualCoderPasteContextMenuItemId -] - -{ #category : #'private - addons' } -GtTextualCoderPromised >> addOnsClass [ - ^ GtTextualCoderAddOns -] - -{ #category : #converting } -GtTextualCoderPromised >> asCoderViewModel [ - ^ GtTextualCoderViewModelPromised new coder: self -] - -{ #category : #'api - converting' } -GtTextualCoderPromised >> asNewCoderModelWithSameSubject [ - "Return new coder model with same subject (e.g., package, class, method)" - - - ^ self shouldNotImplement -] - -{ #category : #'api - ast' } -GtTextualCoderPromised >> ast [ - - - ^ self critical: [ astPromise ifNil: [ astPromise := self sourceCode currentSourceString asyncThen: [ :aGtCoderSourceString | - GtCoderAst new - ast: (self computeAst: aGtCoderSourceString string); - epoch: aGtCoderSourceString epoch ] ] ] -] - -{ #category : #'api - ast' } -GtTextualCoderPromised >> astAwait [ - ^ self ast wait ast -] - -{ #category : #'as yet unclassified' } -GtTextualCoderPromised >> breadcrumbActions [ - - - ^ #() -] - -{ #category : #'api - accessing' } -GtTextualCoderPromised >> completionStrategy [ - - - ^ completionStrategy - ifNil: [ completionStrategy := self newCompletionStrategy ] -] - -{ #category : #'api - accessing' } -GtTextualCoderPromised >> completionStrategy: aGtCompletionStrategy [ - completionStrategy := aGtCompletionStrategy -] - -{ #category : #'api - ast' } -GtTextualCoderPromised >> computeAst: aString [ - ^ self subclassResponsibility -] - -{ #category : #'api - text' } -GtTextualCoderPromised >> correctFrom: aFromIndex to: aToIndex with: aString [ - self critical: [ - self sourceCode - replaceFrom: aFromIndex - to: aToIndex - withString: aString. - self sourceChanged. - self notifyCorrectionFrom: aFromIndex to: aToIndex with: aString ] -] - -{ #category : #'api - text' } -GtTextualCoderPromised >> currentSourceString [ - "Return a String representation of the current source text" - - - ^ self critical: [ self sourceCode currentSourceString then: [ :aGtCoderSourceString | aGtCoderSourceString string ] ] -] - -{ #category : #'api - text' } -GtTextualCoderPromised >> currentSourceString: aString [ - "Set a new source text" - - self critical: [ - self sourceCode currentSourceString: aString. - self sourceChanged ] -] - -{ #category : #'api - text' } -GtTextualCoderPromised >> currentSourceText [ - - - ^ self critical: [ self sourceCode currentSourceText then: [ :aGtCoderSourceText | aGtCoderSourceText text ] ] -] - -{ #category : #'api - text' } -GtTextualCoderPromised >> currentSourceText: aText [ - "Set a new source text" - - self critical: [ - self sourceCode currentSourceText: aText. - self sourceChanged ] -] - -{ #category : #'api - text' } -GtTextualCoderPromised >> currentSourceText: aText with: aGtCoderUpdateStragegy [ - "Set a new source text" - - self critical: [ - self sourceCode currentSourceText: aText. - self sourceChangedWith: aGtCoderUpdateStragegy ] -] - -{ #category : #'api - text' } -GtTextualCoderPromised >> currentSourceTextSynchronously: aText [ - "Set a new source text" - - self critical: [ - self sourceCode currentSourceText: aText. - self sourceChangedWith: GtCoderUpdateStrategy new makeSynchronous ] -] - -{ #category : #initialize } -GtTextualCoderPromised >> initialize [ - super initialize. - - self reset -] - -{ #category : #testing } -GtTextualCoderPromised >> isModified [ - - - ^ self sourceCode isModified -] - -{ #category : #'instance creation' } -GtTextualCoderPromised >> newCompletionStrategy [ - ^ self subclassResponsibility -] - -{ #category : #'private - notifying' } -GtTextualCoderPromised >> notifyCorrectionFrom: aFromIndex to: aToIndex with: aString [ - self announce: (GtCoderCorrectionRequest new - coder: self; - fromIndex: aFromIndex; - toIndex: aToIndex; - correctionString: aString) -] - -{ #category : #'private - notifying' } -GtTextualCoderPromised >> notifySourceChangedWith: anUpdateStragegy [ - "Notify the text editor that it should update the text (for example due to refactoring changes)" - - self announce: (GtCoderSourceCodeChanged new - updateStrategy: anUpdateStragegy; - coder: self) -] - -{ #category : #private } -GtTextualCoderPromised >> pragmasNamed: aSymbol inHierarchy: aClass [ - | actions | - actions := OrderedCollection new. - aClass withAllSuperclassesDo: [ :each | actions addAll: (Pragma allNamed: aSymbol in: each) ]. - actions sort: [ :a :b | a arguments first < b arguments first ]. - ^ actions -] - -{ #category : #'api - text' } -GtTextualCoderPromised >> requestStyleSourceText [ - "Request the text editor to restyle the text (for example due to environmental changes)" - - self resetAstCache. - self announce: (GtCoderStyleTextRequest new coder: self) -] - -{ #category : #initialize } -GtTextualCoderPromised >> reset [ - self resetAstCache. - - "initialized lazily in #sourceCode" - sourceCode := nil. - completionStrategy := nil -] - -{ #category : #'private - ast' } -GtTextualCoderPromised >> resetAstCache [ - astPromise := nil -] - -{ #category : #'private - notifying' } -GtTextualCoderPromised >> sourceChanged [ - self sourceChangedWith: GtCoderUpdateStrategy new makeAsynchronous -] - -{ #category : #'private - notifying' } -GtTextualCoderPromised >> sourceChangedWith: anUpdateStrategy [ - astPromise := nil. - self notifySourceChangedWith: anUpdateStrategy. -] - -{ #category : #'api - accessing' } -GtTextualCoderPromised >> sourceCode [ - - - sourceCode ifNil: [ self sourceCode: (GtCoderExplicitSourceCode new source: '') ]. - ^ sourceCode -] - -{ #category : #'api - accessing' } -GtTextualCoderPromised >> sourceCode: aGtCoderSourceCode [ - "Set the source code of this coder to a given one and notify about the changes" - - self - sourceCode: aGtCoderSourceCode - withStrategy: GtCoderUpdateStrategy new makeAsynchronous -] - -{ #category : #'api - accessing' } -GtTextualCoderPromised >> sourceCode: aGtCoderSourceCode withStrategy: anUpdateStragegy [ - "Set the source code of this coder to a given one and notify about the changes" - - sourceCode := aGtCoderSourceCode. - self sourceChangedWith: anUpdateStragegy. -] - -{ #category : #'api - accessing' } -GtTextualCoderPromised >> sourceCodeSynchronously: aGtCoderSourceCode [ - self - sourceCode: aGtCoderSourceCode - withStrategy: GtCoderUpdateStrategy new makeSynchronous -] - -{ #category : #'api - text' } -GtTextualCoderPromised >> sourceText [ - - - self - deprecated: 'Use #currentSourceText' - transformWith: '`@receiver sourceText' -> '`@receiver currentSourceText'. - - ^ self currentSourceText -] - -{ #category : #'api - ast' } -GtTextualCoderPromised >> supportsAstCache [ - "Return true if ast cache should be used, false otherwise" - - ^ true -] diff --git a/src/GToolkit-Coder-Promised/GtTextualCoderViewModelPromised.class.st b/src/GToolkit-Coder-Promised/GtTextualCoderViewModelPromised.class.st deleted file mode 100644 index 8f9db2b45..000000000 --- a/src/GToolkit-Coder-Promised/GtTextualCoderViewModelPromised.class.st +++ /dev/null @@ -1,666 +0,0 @@ -Class { - #name : #GtTextualCoderViewModelPromised, - #superclass : #GtSingleCoderViewModel, - #instVars : [ - 'addOnPromise', - 'extraAddOns', - 'stylers', - 'mainActions', - 'contextActions', - 'contextMenuActions', - 'shortcuts', - 'hasFocus', - 'expanded', - 'cursors', - 'selection', - 'extraTextAttributes', - 'styledText' - ], - #category : #'GToolkit-Coder-Promised' -} - -{ #category : #'api - add-ons' } -GtTextualCoderViewModelPromised >> addOns [ - ^ self ensureAddOns -] - -{ #category : #'api - shortcuts' } -GtTextualCoderViewModelPromised >> addShortcut: aShortcut [ - "Add an extra shortcut add-on independent from the dynamically computed add-ons" - - extraAddOns addShortcut: aShortcut -] - -{ #category : #'api - shortcuts' } -GtTextualCoderViewModelPromised >> addStyler: aGtCoderStyler [ - "Add an extra styler add-on independent from the dynamically computed add-ons" - - extraAddOns addStyler: aGtCoderStyler -] - -{ #category : #'api - shortcuts' } -GtTextualCoderViewModelPromised >> addStylers: aCollectionOfGtCoderStyler [ - "Add extra styler add-ons independent from the dynamically computed add-ons" - - aCollectionOfGtCoderStyler do: [ :eachStyler | self addStyler: eachStyler ] -] - -{ #category : #'api - text' } -GtTextualCoderViewModelPromised >> addTextAttribute: aTextAttribute from: aStartPosition to: anEndPosition [ - - ^ self - addTextAttributes: { aTextAttribute } - from: aStartPosition - to: anEndPosition -] - -{ #category : #'api - text' } -GtTextualCoderViewModelPromised >> addTextAttributes: aCollectionOfTextAttributes from: aStartPosition to: anEndPosition [ - - | aCurrentText aMarkerAttribute newCoderTextAttributes | - - aMarkerAttribute := BrTextInvisibleMarkerAttribute new beNotOverwritableByStyler. - - "we change the sourceText directly to not trigger the styler recomputation" - aCurrentText := self sourceText. - aCurrentText attribute: aMarkerAttribute from: aStartPosition to: anEndPosition. - - newCoderTextAttributes := GtTextualCoderTextAttributes new - markerAttribute: aMarkerAttribute; - textAttributes: aCollectionOfTextAttributes. - - extraTextAttributes add: newCoderTextAttributes. - self announce: (GtTextualCoderViewModelTextAttributesAdded new - coderTextAttributes: newCoderTextAttributes; - startPosition: aStartPosition; - stopPosition: anEndPosition). - - ^ newCoderTextAttributes -] - -{ #category : #converting } -GtTextualCoderViewModelPromised >> asEditorState [ - - - ^ self coderModel currentSourceText then: [ :aText | - | anEditorText aMemento | - - anEditorText := aText copy. - - self extraTextAttributes do: [ :eachCoderAttributes | - eachCoderAttributes applyOnEditorText: anEditorText ]. - - aMemento := BrTextEditorCompositeMemento new - addMemento: (BrTextEditorCursorsMemento new cursors: cursors copy); - addMemento: (BrTextEditorSelectionMemento new selection: selection copy). - - self hasStyledText - ifTrue: [ - aMemento addMemento: (BrTextEditorStyledTextMemento new - text: self styledText; - styler: self compositeStyler) ] - ifFalse: [ - aMemento - addMemento: (BrTextEditorTextMemento new text: anEditorText); - addMemento: (BrTextEditorStylerMemento new styler: self compositeStyler) ]. - aMemento ] -] - -{ #category : #'api - expansion' } -GtTextualCoderViewModelPromised >> collapse [ - self expanded: false -] - -{ #category : #'api - stylers' } -GtTextualCoderViewModelPromised >> compositeStyler [ - ^ GtCoderAstCompositeStyler new - coderViewModel: self; - stylers: self stylers; - yourself -] - -{ #category : #'private - addons' } -GtTextualCoderViewModelPromised >> computeAddOns [ - | aCoderModel | - - aCoderModel := self coderModel. - - ^ aCoderModel ast asyncThen: [ :aCoderAst | - | theAst newAddOns pragmas | - - theAst := aCoderAst ast. - - pragmas := aCoderModel - pragmasNamed: #gtAstCoderAddOns: - inHierarchy: aCoderModel class. - - newAddOns := aCoderModel newAddOns. - "extra addons" - newAddOns addAddOns: aCoderModel addOns. - aCoderModel initializeShortcuts: newAddOns. - aCoderModel initializeAddOns: newAddOns. - theAst ifNotNil: [ - pragmas reverseDo: [ :eachPragma | - [ aCoderModel - perform: eachPragma methodSelector - withEnoughArguments: { theAst . newAddOns . self } ] - on: Error - do: [ :anError | - "emit as a beacon signal" - anError emit. - - NonInteractiveTranscript stderr - nextPut: $[; - print: eachPragma method printString; - nextPut: $]; - space; - print: anError; - cr ] ] ]. - - "view model add-ons override coder model add-ons" - newAddOns addAddOns: extraAddOns. - newAddOns markAsUpdated. - newAddOns ]. -] - -{ #category : #'private - addons' } -GtTextualCoderViewModelPromised >> computeContextMenuAstAddOns [ - | aCoderModel newAddOns pragmas theAst | - - aCoderModel := self coderModel. - - theAst := aCoderModel astAwait. - pragmas := aCoderModel - pragmasNamed: #gtCoderContextMenuAddOns: - inHierarchy: aCoderModel class. - - newAddOns := aCoderModel newAddOns. - theAst ifNotNil: [ - pragmas reverseDo: [ :eachPragma | - [ aCoderModel - perform: eachPragma methodSelector - withEnoughArguments: { theAst . newAddOns . self } ] - on: Error - do: [ :anError | - "emit as a beacon signal" - anError emit. - - NonInteractiveTranscript stderr - nextPut: $[; - print: eachPragma method printString; - nextPut: $]; - space; - print: anError; - cr ] ] ]. - - ^ newAddOns -] - -{ #category : #'api - add-ons' } -GtTextualCoderViewModelPromised >> contextActions [ - ^ contextActions -] - -{ #category : #'api - add-ons' } -GtTextualCoderViewModelPromised >> contextActions: theContextActions [ - contextActions = theContextActions - ifTrue: [ ^ self ]. - - contextActions := theContextActions. - self announce: GtTextualCoderViewModelContextActionsChanged new -] - -{ #category : #'api - add-ons' } -GtTextualCoderViewModelPromised >> contextMenuActions [ - ^ contextMenuActions -] - -{ #category : #'api - add-ons' } -GtTextualCoderViewModelPromised >> contextMenuActions: theContextMenuActions [ - contextMenuActions = theContextMenuActions - ifTrue: [ ^ self ]. - - contextMenuActions := theContextMenuActions. - self announce: GtTextualCoderViewModelContextMenuActionsChanged new -] - -{ #category : #'api - cursors' } -GtTextualCoderViewModelPromised >> cursors [ - - - ^ cursors -] - -{ #category : #'api - cursors' } -GtTextualCoderViewModelPromised >> cursors: aBrTextEditorCursor [ - self cursors: aBrTextEditorCursor from: self -] - -{ #category : #'api - cursors' } -GtTextualCoderViewModelPromised >> cursors: aBrTextEditorCursor from: aSourceObject [ - cursors = aBrTextEditorCursor - ifTrue: [ ^ self ]. - - cursors := aBrTextEditorCursor copy. - self notifyCursorsChanged: cursors from: aSourceObject -] - -{ #category : #accessing } -GtTextualCoderViewModelPromised >> elementClass [ - ^ GtTextualCoderEditorElementPromised -] - -{ #category : #'private - addons' } -GtTextualCoderViewModelPromised >> ensureAddOns [ - ^ addOnPromise ifNil: [ addOnPromise := self computeAddOns then: [ :theAddOns | self onAddOnsChanged: theAddOns ]; yourself ] -] - -{ #category : #'api - expansion' } -GtTextualCoderViewModelPromised >> expand [ - self expanded: true -] - -{ #category : #'api - expansion' } -GtTextualCoderViewModelPromised >> expanded [ - ^ expanded -] - -{ #category : #'api - expansion' } -GtTextualCoderViewModelPromised >> expanded: aBoolean [ - expanded = aBoolean - ifTrue: [ ^ self ]. - - expanded := aBoolean. - self notifyExpansionChanged: expanded -] - -{ #category : #accessing } -GtTextualCoderViewModelPromised >> extraTextAttributes [ - ^ extraTextAttributes -] - -{ #category : #'api - focus' } -GtTextualCoderViewModelPromised >> focused [ - - - ^ hasFocus -] - -{ #category : #'api - focus' } -GtTextualCoderViewModelPromised >> focused: aBoolean [ - self focused: aBoolean from: self -] - -{ #category : #'api - focus' } -GtTextualCoderViewModelPromised >> focused: aBoolean from: aSourceObject [ - hasFocus = aBoolean - ifTrue: [ ^ self ]. - - hasFocus := aBoolean. - self notifyFocusChanged: hasFocus from: aSourceObject. - - codersUIModel ifNotNil: [ :theCoders | - aBoolean - ifTrue: [ theCoders focusCoderUIModel: self ] - ifFalse: [ theCoders unfocusCoderUIModel: self ] ] -] - -{ #category : #'gt-extension' } -GtTextualCoderViewModelPromised >> gtInfo [ - ^ Array streamContents: [ :aStream | - aStream nextPut: (#coderModel -> self coderModel). - aStream nextPut: (#cursors -> self cursors). - aStream nextPut: (#selection -> self selection). - aStream nextPut: (#ast -> self coderModel ast wait). - aStream nextPut: (#stylers -> self stylers). - aStream nextPut: (#mainActions -> self mainActions). - aStream nextPut: (#contextActions -> self contextActions). - aStream nextPut: (#contextMenuActions -> self contextMenuActions). - aStream nextPut: (#shortcuts -> self shortcuts). - aStream nextPut: (#attributes -> self extraTextAttributes). - aStream nextPut: (#hasFocus -> self focused). - aStream nextPut: (#expanded -> self expanded) ] -] - -{ #category : #'gt-extension' } -GtTextualCoderViewModelPromised >> gtInfoFor: aView [ - - - ^ aView columnedList - title: 'Info'; - priority: 0; - items: [ self gtInfo ]; - actionUpdateButtonTooltip: 'Refresh'; - column: 'Property' - text: [ :eachItem :eachIndex | eachItem key asRopedText foreground: Color gray ] - width: 150; - column: 'Value' - text: [ :eachItem | eachItem value gtDisplayText ]; - send: [ :assoc | assoc value ]; - updateWhen: GtTextualCoderViewModelAnnouncement in: self announcer -] - -{ #category : #'api - selection' } -GtTextualCoderViewModelPromised >> hasSelection [ - ^ self selection isNotEmpty -] - -{ #category : #'api - styled text' } -GtTextualCoderViewModelPromised >> hasStyledText [ - - - >#propertyTesterTemplate'> - - ^ styledText notNil -] - -{ #category : #initialization } -GtTextualCoderViewModelPromised >> initialize [ - super initialize. - - extraAddOns := GtTextualCoderAddOns new. - stylers := #(). - shortcuts := #(). - mainActions := #(). - contextActions := #(). - contextMenuActions := #(). - - cursors := BrTextEditorMultipleCursor new. - selection := BlCompositeSelection new. - extraTextAttributes := OrderedCollection new. - - hasFocus := false. - expanded := true -] - -{ #category : #'api - add-ons' } -GtTextualCoderViewModelPromised >> mainActions [ - ^ mainActions -] - -{ #category : #'api - add-ons' } -GtTextualCoderViewModelPromised >> mainActions: theMainActions [ - mainActions = theMainActions - ifTrue: [ ^ self ]. - - mainActions := theMainActions. - self announce: GtTextualCoderViewModelMainActionsChanged new -] - -{ #category : #'api - cursors' } -GtTextualCoderViewModelPromised >> moveCursorAtEnd [ - "Move the cursor at the end of the textual snippet" - - self moveCursorTo: self sourceText size -] - -{ #category : #'api - cursors' } -GtTextualCoderViewModelPromised >> moveCursorAtStart [ - "Move the cursor at the end of the textual snippet" - - self moveCursorTo: 0 -] - -{ #category : #'api - cursors' } -GtTextualCoderViewModelPromised >> moveCursorTo: aCursorIndex [ - self cursors: (BrTextEditorCursor at: aCursorIndex) -] - -{ #category : #'private - notifying' } -GtTextualCoderViewModelPromised >> notifyCursorsChanged: aBrTextEditorCursor from: aSourceObject [ - self announce: (GtTextualCoderViewModelCursorsChanged new cursors: aBrTextEditorCursor; source: aSourceObject) -] - -{ #category : #'private - notifying' } -GtTextualCoderViewModelPromised >> notifyExpansionChanged: aBoolean [ - self announce: (GtTextualCoderViewModelExpansionChanged new expanded: aBoolean) -] - -{ #category : #'private - notifying' } -GtTextualCoderViewModelPromised >> notifyFocusChanged: aBoolean from: aSourceObject [ - self announcerUIModel announce: (GtSourceCoderFocusChanged new - focused: aBoolean; - source: aSourceObject) -] - -{ #category : #'private - notifying' } -GtTextualCoderViewModelPromised >> notifySelectionChanged: aBlCompositeSelection from: aSourceObject [ - self announce: (GtTextualCoderViewModelSelectionChanged new selection: aBlCompositeSelection; source: aSourceObject) -] - -{ #category : #'api - styled text' } -GtTextualCoderViewModelPromised >> notifyStyledTextChanged [ - "Override this notify method to announce changes to the property" - - >#notifyPropertyChangedTemplate'> - self announce: (GtTextualCoderViewModelStyledTextChanged new - styledText: self styledText). -] - -{ #category : #'private - event handling' } -GtTextualCoderViewModelPromised >> onAddOnsChanged: theAddOns [ - "Is sent when new add-ons are computed" - - self stylers: theAddOns stylers. - self shortcuts: theAddOns shortcuts. - self mainActions: theAddOns mainActions. - self contextActions: theAddOns contextActions. - self contextMenuActions: theAddOns contextMenuActions. - - self announce: GtTextualCoderViewModelReadyToRestyle new -] - -{ #category : #'api - styled text' } -GtTextualCoderViewModelPromised >> onNewStyledTextSet: aNewStyledText [ - "Is sent after a new value of the styledText is assigned" - - >#onNewPropertySetHookTemplate'> -] - -{ #category : #'api - styled text' } -GtTextualCoderViewModelPromised >> onPreviousStyledTextUnset: aPreviousStyledText [ - "Is sent after a previous value of the styledText is de-assigned" - - >#onPreviousPropertyUnsetHookTemplate'> -] - -{ #category : #'private - event handling' } -GtTextualCoderViewModelPromised >> onSourceCodeChanged: anSourceCodeChangedAnnouncement [ - "source code changed, meaning that the styled text is no longer correct" - self unsetStyledText. - - addOnPromise := nil. - self ensureAddOns. - - self announce: (GtTextualCoderViewModelTextChanged new - text: self coderModel currentSourceText; - updateStrategy: anSourceCodeChangedAnnouncement updateStrategy) -] - -{ #category : #'api - text' } -GtTextualCoderViewModelPromised >> removeAllCoderTextAttributes: aCollectionOfGtTextualCoderTextAttributes [ - aCollectionOfGtTextualCoderTextAttributes do: [ :eachCoderTextAttribute | - self removeCoderTextAttributes: eachCoderTextAttribute ] -] - -{ #category : #'api - refactorings' } -GtTextualCoderViewModelPromised >> removeAttribute: anAttribute [ - | attributes | - attributes := self extraTextAttributes select: [ :each | each textAttributes includes: anAttribute ]. - self removeAllCoderTextAttributes: attributes -] - -{ #category : #'api - text' } -GtTextualCoderViewModelPromised >> removeCoderTextAttributes: aGtTextualCoderTextAttributes [ - | aCurrentText | - - self extraTextAttributes - remove: aGtTextualCoderTextAttributes - ifAbsent: [ ^ self ]. - - "we change the sourceText directly to not trigger the styler recomputation" - aCurrentText := self sourceText. - aCurrentText removeAttributes: { aGtTextualCoderTextAttributes markerAttribute }, aGtTextualCoderTextAttributes textAttributes. - - self announce: (GtTextualCoderViewModelTextAttributesRemoved new coderTextAttributes: aGtTextualCoderTextAttributes) -] - -{ #category : #'api - selection' } -GtTextualCoderViewModelPromised >> select: aFromCursorIndex to: aToCursorIndex [ - self selection: (self selection copy select: aFromCursorIndex to: aToCursorIndex) -] - -{ #category : #'api - selection' } -GtTextualCoderViewModelPromised >> selectNone [ - self selection: BlCompositeSelection new -] - -{ #category : #'api - selection' } -GtTextualCoderViewModelPromised >> selection [ - - - ^ selection -] - -{ #category : #'api - selection' } -GtTextualCoderViewModelPromised >> selection: aBlCompositeSelection [ - self - selection: aBlCompositeSelection - from: self -] - -{ #category : #'api - selection' } -GtTextualCoderViewModelPromised >> selection: aBlCompositeSelection from: aSourceObject [ - selection = aBlCompositeSelection - ifTrue: [ ^ self ]. - - selection := aBlCompositeSelection copy. - self notifySelectionChanged: selection from: aSourceObject -] - -{ #category : #'api - shortcuts' } -GtTextualCoderViewModelPromised >> shortcuts [ - "Return a collection of current editor shortcuts that are computed based on the coder add-ons and extra view-model add-ons. - Do not modify the returned collection as it will be recomputed when ast or add-ons change; instead use #addShortcut:" - - - ^ shortcuts -] - -{ #category : #'api - shortcuts' } -GtTextualCoderViewModelPromised >> shortcuts: aCollectionOfShortcuts [ - shortcuts = aCollectionOfShortcuts - ifTrue: [ ^ self ]. - - shortcuts := aCollectionOfShortcuts. - self announce: GtTextualCoderViewModelShortcutsChanged new -] - -{ #category : #'api - add-ons' } -GtTextualCoderViewModelPromised >> shouldAddOnsBeUpdated [ - "Return true if addons should be updated, false otherwise. When a Coder Model is attached to the corresponding Element - that element should check if addons need to be updated and if it is the case start the update with the help of ${method:GtCoderModel>>#updateAddOnsFrom:}$" - - - ^ addOnPromise - ifNil: [ true ] - ifNotNil: [ :theAddOns | theAddOns shouldBeUpdated ] -] - -{ #category : #'api - text' } -GtTextualCoderViewModelPromised >> sourceText [ - - - ^ self coderModel sourceText -] - -{ #category : #'api - text' } -GtTextualCoderViewModelPromised >> sourceText: aNewSourceText from: aSourceObject synchronously: isSynchronous [ - self coderModel - currentSourceText: aNewSourceText - with: (GtCoderUpdateStrategy new - source: aSourceObject; - isSynchronous: isSynchronous) -] - -{ #category : #'api - styled text' } -GtTextualCoderViewModelPromised >> styledText [ - - - >#propertyGetterTemplate'> - - ^ styledText -] - -{ #category : #'api - styled text' } -GtTextualCoderViewModelPromised >> styledText: aNewStyledText [ - - - >#propertySetterTemplate'> - - (self hasStyledText - and: [ self styledText = aNewStyledText ]) - ifTrue: [ ^ self ]. - - self hasStyledText - ifTrue: [ - | aPreviousStyledText | - aPreviousStyledText := styledText. - styledText := nil. - self onPreviousStyledTextUnset: aPreviousStyledText ]. - styledText := aNewStyledText. - self onNewStyledTextSet: aNewStyledText. - self notifyStyledTextChanged -] - -{ #category : #'api - stylers' } -GtTextualCoderViewModelPromised >> stylers [ - ^ stylers -] - -{ #category : #'api - stylers' } -GtTextualCoderViewModelPromised >> stylers: theStylers [ - stylers = theStylers - ifTrue: [ ^ self ]. - - stylers := theStylers. - theStylers do: [ :eachStyler | - (eachStyler respondsTo: #coderViewModel:) - ifTrue: [ eachStyler coderViewModel: self ] ]. - - "when stylers change we should reset the styled text, since there is no guarantee it will be a valid one" - self unsetStyledText. - self announce: GtTextualCoderViewModelStylersChanged new -] - -{ #category : #'api - coder model' } -GtTextualCoderViewModelPromised >> subscribeToCoderModel [ - super subscribeToCoderModel. - - self coderModel weak - when: GtCoderSourceCodeChanged - send: #onSourceCodeChanged: - to: self -] - -{ #category : #'api - styled text' } -GtTextualCoderViewModelPromised >> unsetStyledText [ - - >#propertyUnsetterTemplate'> - | aPreviousStyledText | - - self hasStyledText - ifFalse: [ ^ self ]. - - aPreviousStyledText := styledText. - styledText := nil. - self onPreviousStyledTextUnset: aPreviousStyledText. - self notifyStyledTextChanged -] - -{ #category : #'api - coder model' } -GtTextualCoderViewModelPromised >> unsubscribeFromCoderModel [ - super unsubscribeFromCoderModel. - - self coderModel unsubscribe: self -] diff --git a/src/GToolkit-Coder-Promised/package.st b/src/GToolkit-Coder-Promised/package.st deleted file mode 100644 index 8cef20419..000000000 --- a/src/GToolkit-Coder-Promised/package.st +++ /dev/null @@ -1 +0,0 @@ -Package { #name : #'GToolkit-Coder-Promised' } diff --git a/src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModel.class.st b/src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModel.class.st deleted file mode 100644 index 8af8166a8..000000000 --- a/src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModel.class.st +++ /dev/null @@ -1,188 +0,0 @@ -Class { - #name : #GtStreamingCodersViewModel, - #superclass : #Object, - #traits : 'TGtWithCodersModel', - #classTraits : 'TGtWithCodersModel classTrait', - #instVars : [ - 'announcer', - 'monitor', - 'coderViewModels', - 'coderViewModelsStream', - 'pendingCommands', - 'scrollTarget' - ], - #category : #'GToolkit-Coder-UI-StreamingCoders-View Model' -} - -{ #category : #'api - announcer' } -GtStreamingCodersViewModel >> announce: anAnnouncement [ - >#announceTemplate'> - announcer ifNotNil: [ :anAnnouncer | anAnnouncer announce: anAnnouncement ]. -] - -{ #category : #'api - accessing' } -GtStreamingCodersViewModel >> coderViewModelsStream [ - - - ^ coderViewModelsStream asyncSimilarCopy -] - -{ #category : #'api - commands' } -GtStreamingCodersViewModel >> enqueueCommand: aViewModelCommand [ - monitor critical: [ - | theApplicableCoderViewModels | - - theApplicableCoderViewModels := OrderedCollection new. - - coderViewModels valuesDo: [ :eachCoderViewModel | - (aViewModelCommand applicableTo: eachCoderViewModel) - ifTrue: [ theApplicableCoderViewModels add: eachCoderViewModel ] ]. - - theApplicableCoderViewModels - ifEmpty: [ pendingCommands add: aViewModelCommand ] - ifNotEmpty: [ theApplicableCoderViewModels do: [ :eachCoderViewModel | aViewModelCommand applyOn: eachCoderViewModel ] ] ] -] - -{ #category : #'api - scrolling' } -GtStreamingCodersViewModel >> hasScrollTarget [ - ^ scrollTarget notNil -] - -{ #category : #initialization } -GtStreamingCodersViewModel >> initialize [ - super initialize. - - monitor := Monitor new. - coderViewModels := Dictionary new. - pendingCommands := OrderedCollection new. - coderViewModelsStream := AsyncEmptyStream new -] - -{ #category : #'instance creation' } -GtStreamingCodersViewModel >> newCoderViewModelFor: aCoderModel [ - ^ aCoderModel asCoderViewModel -] - -{ #category : #'private - notifying' } -GtStreamingCodersViewModel >> notifyCoderViewModelsStreamChanged [ - self announce: GtStreamingCodersViewModelStreamChanged new -] - -{ #category : #'private - event handling' } -GtStreamingCodersViewModel >> onCoderAdded: anAnnouncement [ - self privateFetchCoderViewModelFor: anAnnouncement coder. - self updateCoderViewModelsStream -] - -{ #category : #'api - coders model' } -GtStreamingCodersViewModel >> onCodersModelChanged [ - "Is sent when a new codersModel is assigned to the receiver. - Note: #onCodersModelChanged is sent before #subscribeToCodersModel - which means that if you perform any operation that triggers an announcement it will be ignored because the receiver - didn't get a chance to subscribe to any announcement. Override #onPostCodersModelChanged if you - wish to perform an operation that requires an announcement, but keep in mind that this is not the most efficient way" - >#onObjectChangedTemplate'> - - self updateCoderViewModelsStream -] - -{ #category : #'private - event handling' } -GtStreamingCodersViewModel >> onCodersStreamChanged: anAnnouncement [ - self notifyCoderViewModelsStreamChanged -] - -{ #category : #'private - accessing' } -GtStreamingCodersViewModel >> privateCoderViewModelsStream: anAsyncStream [ - coderViewModelsStream := anAsyncStream cached. - self notifyCoderViewModelsStreamChanged -] - -{ #category : #'private - accessing' } -GtStreamingCodersViewModel >> privateFetchCoderViewModelFor: aCoderModel [ - ^ monitor critical: [ - coderViewModels - at: aCoderModel - ifAbsentPut: [ - | aCoderViewModel theApplicableCommands | - aCoderViewModel := self newCoderViewModelFor: aCoderModel. - - theApplicableCommands := pendingCommands select: [ :eachCommand | eachCommand applicableTo: aCoderViewModel ]. - pendingCommands removeAll: theApplicableCommands. - theApplicableCommands do: [ :eachCommand | eachCommand applyOn: aCoderViewModel ]. - - aCoderViewModel ] ] -] - -{ #category : #'api - scrolling' } -GtStreamingCodersViewModel >> scrollTarget [ - ^ scrollTarget -] - -{ #category : #'api - scrolling' } -GtStreamingCodersViewModel >> scrollToTarget: aGtStreamingCoderViewModelScrollTarget [ - scrollTarget := aGtStreamingCoderViewModelScrollTarget. - self announce: (GtStreamingCodersViewModelScrollTargetChanged new scrollTarget: scrollTarget) -] - -{ #category : #'api - coders model' } -GtStreamingCodersViewModel >> subscribeToCodersModel [ - "Is sent after a new codersModel is assigned to the receiver. - It is required to unsubscribe from the previously subscribed objects by implementing - #unsubscribeFromCodersModel if the receiver subscribes to them" - - >#subscribeToObjectTemplate'> - - codersModel - when: GtCodersCoderAdded - send: #onCoderAdded: - to: self; - when: GtCodersStreamChanged - send: #onCodersStreamChanged: - to: self -] - -{ #category : #'api - announcer' } -GtStreamingCodersViewModel >> unsubscribe: anObject [ - "Unsubscribe all subscriptions of anObject from the receiver" - - >#unsubscribeTemplate'> - ^ announcer ifNotNil: [ :anAnnouncer | anAnnouncer unsubscribe: anObject ] -] - -{ #category : #'api - coders model' } -GtStreamingCodersViewModel >> unsubscribeFromCodersModel [ - "Is sent before a new codersModel is assigned to the receiver. - Objects that subscribe to codersModel are required to implement this method." - - >#unsubscribeFromObjectTemplate'> - - codersModel unsubscribe: self -] - -{ #category : #'private - updating' } -GtStreamingCodersViewModel >> updateCoderViewModelsStream [ - monitor critical: [ - self privateCoderViewModelsStream: (codersModel codersStream map: [ :eachCoder | self privateFetchCoderViewModelFor: eachCoder ]) ] -] - -{ #category : #'api - announcer' } -GtStreamingCodersViewModel >> when: anAnnouncementClass do: aBlock [ - >#whenDoTemplate'> - ^ (announcer ifNil: [ announcer := Announcer new ]) - when: anAnnouncementClass do: aBlock -] - -{ #category : #'api - announcer' } -GtStreamingCodersViewModel >> when: anAnnouncementClass do: aBlock for: aSubscriber [ - >#whenDoForTemplate'> - ^ (self when: anAnnouncementClass do: aBlock) - subscriber: aSubscriber; - yourself -] - -{ #category : #'api - announcer' } -GtStreamingCodersViewModel >> when: anAnnouncementClass send: aSelector to: anObject [ - >#whenSendToTemplate'> - ^ (announcer ifNil: [ announcer := Announcer new ]) weak - when: anAnnouncementClass send: aSelector to: anObject -] diff --git a/src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModelCommand.class.st b/src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModelCommand.class.st deleted file mode 100644 index f7313460c..000000000 --- a/src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModelCommand.class.st +++ /dev/null @@ -1,15 +0,0 @@ -Class { - #name : #GtStreamingCodersViewModelCommand, - #superclass : #Object, - #category : #'GToolkit-Coder-UI-StreamingCoders-Utilities' -} - -{ #category : #'api - testing' } -GtStreamingCodersViewModelCommand >> applicableTo: aCoderViewModel [ - ^ false -] - -{ #category : #'api - testing' } -GtStreamingCodersViewModelCommand >> applyOn: aCoderViewModel [ - -] diff --git a/src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModelScrollTarget.class.st b/src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModelScrollTarget.class.st deleted file mode 100644 index ad1bb1ab5..000000000 --- a/src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModelScrollTarget.class.st +++ /dev/null @@ -1,10 +0,0 @@ -Class { - #name : #GtStreamingCodersViewModelScrollTarget, - #superclass : #Object, - #category : #'GToolkit-Coder-UI-StreamingCoders-Utilities' -} - -{ #category : #'api - testing' } -GtStreamingCodersViewModelScrollTarget >> applicableTo: aCoderViewModel [ - ^ false -] diff --git a/src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModelScrollTargetChanged.class.st b/src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModelScrollTargetChanged.class.st deleted file mode 100644 index 1a8c01b5e..000000000 --- a/src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModelScrollTargetChanged.class.st +++ /dev/null @@ -1,20 +0,0 @@ -Class { - #name : #GtStreamingCodersViewModelScrollTargetChanged, - #superclass : #Announcement, - #instVars : [ - 'scrollTarget' - ], - #category : #'GToolkit-Coder-UI-StreamingCoders-Events' -} - -{ #category : #accessing } -GtStreamingCodersViewModelScrollTargetChanged >> scrollTarget [ - - ^ scrollTarget -] - -{ #category : #accessing } -GtStreamingCodersViewModelScrollTargetChanged >> scrollTarget: anObject [ - - scrollTarget := anObject -] diff --git a/src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModelStreamChanged.class.st b/src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModelStreamChanged.class.st deleted file mode 100644 index 7b8a18747..000000000 --- a/src/GToolkit-Coder-UI-StreamingCoders/GtStreamingCodersViewModelStreamChanged.class.st +++ /dev/null @@ -1,5 +0,0 @@ -Class { - #name : #GtStreamingCodersViewModelStreamChanged, - #superclass : #Announcement, - #category : #'GToolkit-Coder-UI-StreamingCoders-Events' -} diff --git a/src/GToolkit-Coder-UI-StreamingCoders/package.st b/src/GToolkit-Coder-UI-StreamingCoders/package.st deleted file mode 100644 index 35ef15113..000000000 --- a/src/GToolkit-Coder-UI-StreamingCoders/package.st +++ /dev/null @@ -1 +0,0 @@ -Package { #name : #'GToolkit-Coder-UI-StreamingCoders' } From d5159ceab3ac58b7ffbda7e202cff22ca58d2cad Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Fri, 3 Dec 2021 22:10:14 +0100 Subject: [PATCH 0116/1268] make package references forward to filters feenkcom/gtoolkit#2259 --- src/GToolkit-Coder-Extensions/RPackage.extension.st | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-Extensions/RPackage.extension.st b/src/GToolkit-Coder-Extensions/RPackage.extension.st index 6452ee3cb..5d61de987 100644 --- a/src/GToolkit-Coder-Extensions/RPackage.extension.st +++ b/src/GToolkit-Coder-Extensions/RPackage.extension.st @@ -3,10 +3,12 @@ Extension { #name : #RPackage } { #category : #'*GToolkit-Coder-Extensions' } RPackage >> gtBaselinesFor: aView [ - ^ aView explicit + ^ aView forward title: 'References'; + tooltip: 'References to the package name'; priority: 30; - stencil: [ self name gtStringLiteralCaseSensitiveMatch ] + object: [ self name gtStringLiteralCaseSensitiveMatch ]; + view: #gtItemsFor: ] { #category : #'*GToolkit-Coder-Extensions' } From 3cb09b51b235266f55ee6f9bd64a01a0207e8ffe Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Sun, 5 Dec 2021 09:19:00 +0100 Subject: [PATCH 0117/1268] [feenkcom/gtoolkit#2265] add request save api to the method coder --- .../GtCoderCustomAction.extension.st | 6 ++++ .../GtSourceCoderSaveShortcut.class.st | 4 +-- .../GtSourceCoderViewModel.class.st | 24 ++++++++++++++ ...SourceCoderViewModelSaveRequested.class.st | 32 +++++++++++++++++++ .../GtTextualCoderViewModel.class.st | 2 +- .../GtCoderCustomAction.class.st | 20 ++++++++++++ src/GToolkit-Coder/GtCoderModel.class.st | 5 +++ src/GToolkit-Coder/GtSourceCoder.class.st | 7 +++- 8 files changed, 96 insertions(+), 4 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderCustomAction.extension.st create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderViewModelSaveRequested.class.st create mode 100644 src/GToolkit-Coder/GtCoderCustomAction.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderCustomAction.extension.st b/src/GToolkit-Coder-UI/GtCoderCustomAction.extension.st new file mode 100644 index 000000000..4fc9cadb4 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderCustomAction.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #GtCoderCustomAction } + +{ #category : #'*GToolkit-Coder-UI' } +GtCoderCustomAction >> buildElementIn: aCoderActionsElement [ + ^ stencil asStencil asElement +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderSaveShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderSaveShortcut.class.st index 83bbd6b9a..d71934b02 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderSaveShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderSaveShortcut.class.st @@ -1,7 +1,7 @@ Class { #name : #GtSourceCoderSaveShortcut, #superclass : #GtSourceCoderShortcut, - #category : 'GToolkit-Coder-UI-Shortcuts' + #category : #'GToolkit-Coder-UI-Shortcuts' } { #category : #accessing } @@ -23,5 +23,5 @@ GtSourceCoderSaveShortcut >> name [ { #category : #evaluation } GtSourceCoderSaveShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ - aSourceCoderViewModel save + aSourceCoderViewModel requestSave ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st index 76d9aac20..58ada41d8 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st @@ -151,6 +151,30 @@ GtSourceCoderViewModel >> printItAll [ ^ self coder printItInContext: self evaluationContext all ] +{ #category : #'api - actions' } +GtSourceCoderViewModel >> requestSave [ + "Request the view model to start the saving process. We first send a corresponding announcement to + allow UI to intercept the saving request and show, for example, a confirmation dialog. If an announcement + was not consumed (= handled) proceed with the default save action" + | anAnnouncement | + + anAnnouncement := GtSourceCoderViewModelSaveRequested new. + self announce: anAnnouncement. + + anAnnouncement consumed + ifFalse: [ self save ] +] + +{ #category : #'api - actions' } +GtSourceCoderViewModel >> save [ + "Attempt to save the source code in a default context. For example in terms of a method, the changes would + be saved in the origin class of the method (trait, interface or superclass). + Return true if the source code was succesfully saved" + + + ^ false +] + { #category : #'private - evaluation' } GtSourceCoderViewModel >> selectedTextInterval [ diff --git a/src/GToolkit-Coder-UI/GtSourceCoderViewModelSaveRequested.class.st b/src/GToolkit-Coder-UI/GtSourceCoderViewModelSaveRequested.class.st new file mode 100644 index 000000000..10b053bd9 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderViewModelSaveRequested.class.st @@ -0,0 +1,32 @@ +" +Is announced by the {{gtClass:GtSourceCoderViewModel}} when a save is requested. If the announcement is not consumed, the save will happen in a default context +" +Class { + #name : #GtSourceCoderViewModelSaveRequested, + #superclass : #GtTextualCoderViewModelAnnouncement, + #instVars : [ + 'consumed' + ], + #category : #'GToolkit-Coder-UI-Coder - Source Events' +} + +{ #category : #accessing } +GtSourceCoderViewModelSaveRequested >> consumed [ + + + ^ consumed +] + +{ #category : #accessing } +GtSourceCoderViewModelSaveRequested >> consumed: aBoolean [ + "Prevents the default save action, when set to true by the event handler" + + consumed := aBoolean +] + +{ #category : #initialization } +GtSourceCoderViewModelSaveRequested >> initialize [ + super initialize. + + consumed := false +] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 55c4d1de7..838cd7fe3 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -196,7 +196,7 @@ GtTextualCoderViewModel >> computeAddOns [ "extra addons" newAddOns addAddOns: aCoderModel addOns. aCoderModel initializeShortcuts: newAddOns. - aCoderModel initializeAddOns: newAddOns. + aCoderModel initializeAddOns: newAddOns viewModel: self. theAst ifNotNil: [ pragmas reverseDo: [ :eachPragma | [ aCoderModel diff --git a/src/GToolkit-Coder/GtCoderCustomAction.class.st b/src/GToolkit-Coder/GtCoderCustomAction.class.st new file mode 100644 index 000000000..e42807ad6 --- /dev/null +++ b/src/GToolkit-Coder/GtCoderCustomAction.class.st @@ -0,0 +1,20 @@ +Class { + #name : #GtCoderCustomAction, + #superclass : #GtCoderAction, + #instVars : [ + 'stencil' + ], + #category : #'GToolkit-Coder' +} + +{ #category : #accessing } +GtCoderCustomAction >> stencil [ + + ^ stencil +] + +{ #category : #accessing } +GtCoderCustomAction >> stencil: anObject [ + + stencil := anObject +] diff --git a/src/GToolkit-Coder/GtCoderModel.class.st b/src/GToolkit-Coder/GtCoderModel.class.st index 342d1f328..d950a99a9 100644 --- a/src/GToolkit-Coder/GtCoderModel.class.st +++ b/src/GToolkit-Coder/GtCoderModel.class.st @@ -161,6 +161,11 @@ GtCoderModel >> initialize [ GtCoderModel >> initializeAddOns: addOns [ ] +{ #category : #initialization } +GtCoderModel >> initializeAddOns: addOns viewModel: aCoderViewModel [ + self initializeAddOns: addOns +] + { #category : #initialization } GtCoderModel >> initializeShortcuts: addOns [ ] diff --git a/src/GToolkit-Coder/GtSourceCoder.class.st b/src/GToolkit-Coder/GtSourceCoder.class.st index e2c875109..90fa6667f 100644 --- a/src/GToolkit-Coder/GtSourceCoder.class.st +++ b/src/GToolkit-Coder/GtSourceCoder.class.st @@ -228,7 +228,7 @@ GtSourceCoder >> evaluateBlock: aBlock onErrorDo: anErrorBlock [ GtSourceCoder >> evaluationContext [ - ^ GtSourceCoderEvaluationContext new + ^ self newEvaluationContext requesterObject: self; coder: self ] @@ -246,6 +246,11 @@ GtSourceCoder >> implicitVariableReferencesTo: aString do: aBlock [ ] +{ #category : #'private - actions' } +GtSourceCoder >> newEvaluationContext [ + ^ GtSourceCoderEvaluationContext new +] + { #category : #'private - notifying' } GtSourceCoder >> notifyEvaluatedWithResult: anEvaluationResult [ self announce: (GtCoderEvaluationAnnouncement new From e0d2448e868bc056b5b13961b5c140386e4ee3db Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 9 Dec 2021 10:13:13 +0100 Subject: [PATCH 0118/1268] disable gtCoderExamplesFor: and document headerElementClass --- src/GToolkit-Coder-Extensions/Behavior.extension.st | 7 ++----- src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st | 4 ++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/GToolkit-Coder-Extensions/Behavior.extension.st b/src/GToolkit-Coder-Extensions/Behavior.extension.st index c70024979..2c004d629 100644 --- a/src/GToolkit-Coder-Extensions/Behavior.extension.st +++ b/src/GToolkit-Coder-Extensions/Behavior.extension.st @@ -14,7 +14,7 @@ Behavior >> gtBrowseFrom: anElement [ { #category : #'*GToolkit-Coder-Extensions' } Behavior >> gtCoderExamplesFor: aView context: aDictionary [ - + "" | anExamplesClassName | anExamplesClassName := (self name , 'Examples') asSymbol. @@ -41,8 +41,5 @@ Behavior >> gtCoderExamplesFor: aView context: aDictionary [ Behavior >> methodsCoderFromContext: aPhlowContext [ - ^ aPhlowContext - optionAt: #behaviorCoder - ifPresent: [ :aBehaviorCoderUIModel | aBehaviorCoderUIModel methodsCoderUIModel ] - ifAbsentPut: [ (GtClassMethodsCoder forClass: self) asCoderUIModel ] + ^ (GtClassMethodsCoder forClass: self) asCoderUIModel ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 838cd7fe3..5249c37ed 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -416,6 +416,10 @@ GtTextualCoderViewModel >> hasStyledText [ { #category : #'api - header' } GtTextualCoderViewModel >> headerElementClass [ + "Return an class of an element that should represent a header of the coder. + The used element must implement {{gtClass:TGtWithTextualCoderViewModel}} trait." + + ^ nil ] From 6e0693c2cb040fe14d35a289e78f67cd5bb3f8c6 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 9 Dec 2021 13:15:58 +0100 Subject: [PATCH 0119/1268] remove referenced examples view --- .../Behavior.extension.st | 25 ------------------- 1 file changed, 25 deletions(-) diff --git a/src/GToolkit-Coder-Extensions/Behavior.extension.st b/src/GToolkit-Coder-Extensions/Behavior.extension.st index 2c004d629..38bd4440b 100644 --- a/src/GToolkit-Coder-Extensions/Behavior.extension.st +++ b/src/GToolkit-Coder-Extensions/Behavior.extension.st @@ -12,31 +12,6 @@ Behavior >> gtBrowseFrom: anElement [ maximized ] -{ #category : #'*GToolkit-Coder-Extensions' } -Behavior >> gtCoderExamplesFor: aView context: aDictionary [ - "" - | anExamplesClassName | - - anExamplesClassName := (self name , 'Examples') asSymbol. - - ^ self environment - at: anExamplesClassName - ifPresent: [ :aClass | - | methodsCoder | - methodsCoder := GtClassMethodsCoder forClass: aClass. - aView explicit - priority: 50; - title: 'Related examples'; - actionButtonIcon: BrGlamorousVectorIcons add - action: [ methodsCoder addNewCoder ]; - stencil: [ methodsCoder asElement ]; - actionButtonIcon: BrGlamorousIcons browse - tooltip: 'Browse ', aClass name - action: [ :aButton | - aButton phlow spawnTool: (GtClassCoderTool forClass: aClass) ] ] - ifAbsent: [ aView empty ] -] - { #category : #'*GToolkit-Coder-Extensions' } Behavior >> methodsCoderFromContext: aPhlowContext [ From a90694d4f0fc2fc8e14a232d84a16a8aa7f9e28d Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Thu, 9 Dec 2021 13:16:45 +0100 Subject: [PATCH 0120/1268] fix source code for the shortcut feenkcom/gtoolkit#2274 --- .../GtSourceCoderShortcut.extension.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-Extensions/GtSourceCoderShortcut.extension.st b/src/GToolkit-Coder-Extensions/GtSourceCoderShortcut.extension.st index 3c70a865f..fed9eee31 100644 --- a/src/GToolkit-Coder-Extensions/GtSourceCoderShortcut.extension.st +++ b/src/GToolkit-Coder-Extensions/GtSourceCoderShortcut.extension.st @@ -6,6 +6,6 @@ GtSourceCoderShortcut >> gtSourceCodeFor: aView [ ^ aView forward title: 'Source'; - object: [ self class >> #performOnEditor:element:coder:dueTo: ]; + object: [ self class >> #performOnEditor:element:coderViewModel:dueTo: ]; view: #gtSourceFor: ] From 190923ac5d54ef9760fc4d5e8e59fd74fd688db6 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Fri, 10 Dec 2021 10:09:54 +0100 Subject: [PATCH 0121/1268] add highlighter accessor to the filtered coders view model --- .../GtFilteredCodersViewModel.class.st | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/GToolkit-Coder-StreamingCoders-UI/GtFilteredCodersViewModel.class.st b/src/GToolkit-Coder-StreamingCoders-UI/GtFilteredCodersViewModel.class.st index 68163a418..8791a05cb 100644 --- a/src/GToolkit-Coder-StreamingCoders-UI/GtFilteredCodersViewModel.class.st +++ b/src/GToolkit-Coder-StreamingCoders-UI/GtFilteredCodersViewModel.class.st @@ -21,6 +21,11 @@ GtFilteredCodersViewModel >> compositeFilter [ ^ streamingCodersModel compositeFilter ] +{ #category : #'api - accessing' } +GtFilteredCodersViewModel >> highlighter [ + ^ highlighter +] + { #category : #'private - notifying' } GtFilteredCodersViewModel >> notifyFilterChanged [ self announce: GtFilteredCodersViewModelFilterChanged new From f761ff69f48b7c5a781e0be23dcf6761e7741c71 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Fri, 10 Dec 2021 20:46:23 +0100 Subject: [PATCH 0122/1268] [feenkcom/gtoolkit#2267] introduce private add / remove / swap api to the streaming coders model --- .../GtFilteredCodersViewModel.class.st | 7 ++ .../GtFilteredCodersModel.class.st | 13 ++-- .../GtStreamingCodersModel.class.st | 76 ++++++++++++++++++- .../GtStreamingCodersSwappedReason.class.st | 33 ++++++++ .../GtMethodCoderOverriddenAmountId.class.st | 13 ++++ .../GtMethodCoderOverridesAmountId.class.st | 13 ++++ ...MethodCoderOverridingOverriddenId.class.st | 13 ++++ 7 files changed, 160 insertions(+), 8 deletions(-) create mode 100644 src/GToolkit-Coder-StreamingCoders/GtStreamingCodersSwappedReason.class.st create mode 100644 src/GToolkit-Coder-UI/GtMethodCoderOverriddenAmountId.class.st create mode 100644 src/GToolkit-Coder-UI/GtMethodCoderOverridesAmountId.class.st create mode 100644 src/GToolkit-Coder-UI/GtMethodCoderOverridingOverriddenId.class.st diff --git a/src/GToolkit-Coder-StreamingCoders-UI/GtFilteredCodersViewModel.class.st b/src/GToolkit-Coder-StreamingCoders-UI/GtFilteredCodersViewModel.class.st index 8791a05cb..08b41b2ba 100644 --- a/src/GToolkit-Coder-StreamingCoders-UI/GtFilteredCodersViewModel.class.st +++ b/src/GToolkit-Coder-StreamingCoders-UI/GtFilteredCodersViewModel.class.st @@ -14,6 +14,13 @@ GtFilteredCodersViewModel >> additionalFilters [ ^ streamingCodersModel additionalFilters ] +{ #category : #accessing } +GtFilteredCodersViewModel >> additionalFilters: aCollectionOfFilter [ + "Change the additional filters of the coders model" + + streamingCodersModel additionalFilters: aCollectionOfFilter +] + { #category : #'api - accessing' } GtFilteredCodersViewModel >> compositeFilter [ diff --git a/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st b/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st index 0e0610f89..3c196cb9c 100644 --- a/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st +++ b/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st @@ -28,9 +28,7 @@ GtFilteredCodersModel >> additionalFilters: aCollectionOfFilters [ compositeFilter := self createCombinedFilterFor: filter andAdditionalFilters: additionalFilters. - self - itemsStream: compositeFilter asAsyncStream - dueTo: GtFilteredCodersAdditionalFiltersReason new ] + self refreshItemsStreamDueTo: GtFilteredCodersAdditionalFiltersReason new ] ] { #category : #'api - accessing' } @@ -72,9 +70,7 @@ GtFilteredCodersModel >> filter: aGtSearchFilter [ compositeFilter := self createCombinedFilterFor: filter andAdditionalFilters: additionalFilters. - self - itemsStream: compositeFilter asAsyncStream - dueTo: GtFilteredCodersFilterReason new ] + self refreshItemsStreamDueTo: GtFilteredCodersFilterReason new ] ] { #category : #initialization } @@ -85,3 +81,8 @@ GtFilteredCodersModel >> initialize [ additionalFilters := #(). compositeFilter := GtSearchNullFilter new. ] + +{ #category : #'private - instance creation' } +GtFilteredCodersModel >> newItemsStream [ + ^ compositeFilter asAsyncStream +] diff --git a/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersModel.class.st b/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersModel.class.st index cbbcd7563..cb9f5b87d 100644 --- a/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersModel.class.st +++ b/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersModel.class.st @@ -61,29 +61,101 @@ GtStreamingCodersModel >> itemsStream: anAsyncStream dueTo: aReasonObject [ monitor critical: [ itemsStream := anAsyncStream cached. - codersStream := itemsStream map: [ :eachItem | self newCoderFor: eachItem ] cache: coders ]. + codersStream := itemsStream + map: [ :eachItem | self newCoderFor: eachItem ] + key: [ :eachItem | self newCoderCacheKeyFor: eachItem ] + cache: coders ]. self notifyStreamChangedDueTo: aReasonObject ] +{ #category : #'private - instance creation' } +GtStreamingCodersModel >> newCoderCacheKeyFor: anObject [ + ^ anObject +] + { #category : #'private - instance creation' } GtStreamingCodersModel >> newCoderFor: anObject [ ^ self subclassResponsibility ] +{ #category : #'private - instance creation' } +GtStreamingCodersModel >> newItemsStream [ + ^ self subclassResponsibility +] + { #category : #'private - notifying' } GtStreamingCodersModel >> notifyStreamChangedDueTo: aReasonObject [ self announce: (GtStreamingCodersStreamChanged new dueTo: aReasonObject) ] +{ #category : #'private - actions' } +GtStreamingCodersModel >> privateAddCoderFor: aNewItem [ + | anAddedCoder | + + anAddedCoder := self privateFetchCoderFor: aNewItem. + self refreshItemsStreamDueTo: (GtStreamingCodersAddedReason new coder: anAddedCoder) +] + { #category : #'private - instance creation' } GtStreamingCodersModel >> privateFetchCoderFor: anObject [ ^ monitor critical: [ coders - at: anObject + at: (self newCoderCacheKeyFor: anObject) ifAbsentPut: [ self newCoderFor: anObject ] ] ] +{ #category : #'private - actions' } +GtStreamingCodersModel >> privateRemoveCoderFor: aRemovedItem [ + | aRemovedCoder | + + monitor critical: [ + aRemovedCoder := coders + removeKey: (self newCoderCacheKeyFor: aRemovedItem) + ifAbsent: [ nil ] ]. + + self refreshItemsStreamDueTo: (GtStreamingCodersRemovedReason new coder: aRemovedCoder) +] + +{ #category : #'private - actions' } +GtStreamingCodersModel >> privateSwapCodersFor: aFirstItem and: aSecondItem [ + | aFirstKey aSecondKey aFirstSwappedCoder aSecondSwappedCoder | + + aFirstKey := self newCoderCacheKeyFor: aFirstItem. + aSecondKey := self newCoderCacheKeyFor: aSecondItem. + + monitor critical: [ + coders + at: aFirstKey + ifPresent: [ :aFirstCoder | + aFirstSwappedCoder := aFirstCoder. + coders + at: aSecondKey + ifPresent: [ :aSecondCoder | + aSecondSwappedCoder := aSecondCoder. + coders at: aSecondKey put: aFirstCoder. + coders at: aFirstKey put: aSecondCoder ] + ifAbsent: [ coders at: aSecondKey put: aFirstCoder. ] ] + ifAbsent: [ + coders + at: aSecondKey + ifPresent: [ :aSecondCoder | + aSecondSwappedCoder := aSecondCoder. + coders at: aFirstKey put: aSecondCoder ] ] ]. + + "the operation changes the order of coders, therefore we must update the stream". + self refreshItemsStreamDueTo: (GtStreamingCodersSwappedReason new + coderA: aFirstSwappedCoder; + coderB: aSecondSwappedCoder) +] + +{ #category : #'private - accessing' } +GtStreamingCodersModel >> refreshItemsStreamDueTo: aReasonObject [ + self + itemsStream: self newItemsStream + dueTo: aReasonObject +] + { #category : #'api - announcer' } GtStreamingCodersModel >> unsubscribe: anObject [ "Unsubscribe all subscriptions of anObject from the receiver" diff --git a/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersSwappedReason.class.st b/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersSwappedReason.class.st new file mode 100644 index 000000000..a58d947f9 --- /dev/null +++ b/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersSwappedReason.class.st @@ -0,0 +1,33 @@ +Class { + #name : #GtStreamingCodersSwappedReason, + #superclass : #GtStreamingCodersStreamChangedReason, + #instVars : [ + 'coderA', + 'coderB' + ], + #category : #'GToolkit-Coder-StreamingCoders-Events' +} + +{ #category : #accessing } +GtStreamingCodersSwappedReason >> coderA [ + + ^ coderA +] + +{ #category : #accessing } +GtStreamingCodersSwappedReason >> coderA: anObject [ + + coderA := anObject +] + +{ #category : #accessing } +GtStreamingCodersSwappedReason >> coderB [ + + ^ coderB +] + +{ #category : #accessing } +GtStreamingCodersSwappedReason >> coderB: anObject [ + + coderB := anObject +] diff --git a/src/GToolkit-Coder-UI/GtMethodCoderOverriddenAmountId.class.st b/src/GToolkit-Coder-UI/GtMethodCoderOverriddenAmountId.class.st new file mode 100644 index 000000000..311696883 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtMethodCoderOverriddenAmountId.class.st @@ -0,0 +1,13 @@ +" +A label or button that represents an amount of methods that override a given method +" +Class { + #name : #GtMethodCoderOverriddenAmountId, + #superclass : #GtCoderElementId, + #category : #'GToolkit-Coder-UI-Coder - Ids' +} + +{ #category : #converting } +GtMethodCoderOverriddenAmountId >> asSymbol [ + ^ #'method-coder--overridden-amount' +] diff --git a/src/GToolkit-Coder-UI/GtMethodCoderOverridesAmountId.class.st b/src/GToolkit-Coder-UI/GtMethodCoderOverridesAmountId.class.st new file mode 100644 index 000000000..072d6d7c5 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtMethodCoderOverridesAmountId.class.st @@ -0,0 +1,13 @@ +" +A label or button that represents an amount of methods that a given method overrides +" +Class { + #name : #GtMethodCoderOverridesAmountId, + #superclass : #GtCoderElementId, + #category : #'GToolkit-Coder-UI-Coder - Ids' +} + +{ #category : #converting } +GtMethodCoderOverridesAmountId >> asSymbol [ + ^ #'method-coder--overrides-amount' +] diff --git a/src/GToolkit-Coder-UI/GtMethodCoderOverridingOverriddenId.class.st b/src/GToolkit-Coder-UI/GtMethodCoderOverridingOverriddenId.class.st new file mode 100644 index 000000000..dc789ec6e --- /dev/null +++ b/src/GToolkit-Coder-UI/GtMethodCoderOverridingOverriddenId.class.st @@ -0,0 +1,13 @@ +" +A buttonthat shows if a method is overriding one in the superclass or is overridden in one of the subclasses +" +Class { + #name : #GtMethodCoderOverridingOverriddenId, + #superclass : #GtCoderElementId, + #category : #'GToolkit-Coder-UI-Coder - Ids' +} + +{ #category : #converting } +GtMethodCoderOverridingOverriddenId >> asSymbol [ + ^ #'method-coder--overriding-overridden-button' +] From c27132a047a1870ff4be4773b580b54c160d63b5 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Fri, 10 Dec 2021 20:48:58 +0100 Subject: [PATCH 0123/1268] make coder's expander left border thiner --- .../GtCoderExpanderWithoutShadowAptitude.class.st | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderExpanderWithoutShadowAptitude.class.st b/src/GToolkit-Coder-UI/GtCoderExpanderWithoutShadowAptitude.class.st index de1e714c2..bc05195e1 100644 --- a/src/GToolkit-Coder-UI/GtCoderExpanderWithoutShadowAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExpanderWithoutShadowAptitude.class.st @@ -13,7 +13,7 @@ Class { 'styleLook', 'padding' ], - #category : 'GToolkit-Coder-UI-Looks' + #category : #'GToolkit-Coder-UI-Looks' } { #category : #accessing } @@ -81,7 +81,6 @@ GtCoderExpanderWithoutShadowAptitude >> expandedBorderWidth: aNumber [ { #category : #initialization } GtCoderExpanderWithoutShadowAptitude >> initialize [ - | aTriangle | super initialize. borderWidth := 0. @@ -92,9 +91,7 @@ GtCoderExpanderWithoutShadowAptitude >> initialize [ borderPaint := self defaultBorderPaint. borderFocusedPaint := self defaultFocusedBorderPaint. - aTriangle := self newTriangle. toggle := self newToggle. - toggle addChild: aTriangle. sidebar := self newSidebar. sidebar addChild: toggle. @@ -111,11 +108,6 @@ GtCoderExpanderWithoutShadowAptitude >> initialize [ aStyle border: (BlBorder paint: self borderPaint width: self expandedBorderWidth) ]; focused: [ :aStyle | (BlBorder paint: self borderFocusedPaint width: self expandedBorderWidth) ]). - self add: (BrStyleCommonAptitude new - @ aTriangle; - collapsed: [ :aStyle | aStyle geometry: self newCollapsedTriangleGeometry ]; - expanded: [ :aStyle | aStyle geometry: self newExpandedTriangleGeometry ]). - self add: (BrStyleCommonAptitude new @ sidebar; default: [ :aStyle | aStyle background: self borderPaint ]; From fc969d55846409af5404baa736e977ab4536cd75 Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Sun, 12 Dec 2021 20:33:39 +0100 Subject: [PATCH 0124/1268] bindings utility feenkcom/gtoolkit#2281 --- .../TGtVariablesBindings.trait.st | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-VariableBindings/TGtVariablesBindings.trait.st b/src/GToolkit-VariableBindings/TGtVariablesBindings.trait.st index 5fe7506fa..823217bd6 100644 --- a/src/GToolkit-VariableBindings/TGtVariablesBindings.trait.st +++ b/src/GToolkit-VariableBindings/TGtVariablesBindings.trait.st @@ -1,6 +1,6 @@ Trait { #name : #TGtVariablesBindings, - #category : 'GToolkit-VariableBindings-Bindings' + #category : #'GToolkit-VariableBindings-Bindings' } { #category : #converting } @@ -39,6 +39,18 @@ TGtVariablesBindings >> bindingValueOf: aSymbol [ ifNotNil: [ :aBinding | aBinding value ] ] +{ #category : #binding } +TGtVariablesBindings >> bindingValueOf: aSymbol ifPresent: aPresentBlock ifAbsent: anAbsentBlock [ + "aSymbol is a variable name. + Does not have side effects" + + + ^ self bindings + at: aSymbol + ifPresent: [ :aBinding | aPresentBlock value: aBinding value ] + ifAbsent: anAbsentBlock +] + { #category : #testing } TGtVariablesBindings >> hasBindingOf: aSymbol [ From 2e65f9556567b745198b028f9519e6d35112151b Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 13 Dec 2021 10:03:36 +0100 Subject: [PATCH 0125/1268] [feenkcom/gtoolkit#2282] add GtTextualCoderViewModel >> #isTextModified (promise) --- .../GtExpandableSourceCoderElement.class.st | 59 +++++++++++++++---- .../GtSourceCoderContentElement.class.st | 2 +- .../GtTextualCoderViewModel.class.st | 14 ++++- src/GToolkit-Coder/GtTextualCoder.class.st | 7 +++ 4 files changed, 69 insertions(+), 13 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st index 6618dced2..d3f19fde5 100644 --- a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st @@ -5,7 +5,8 @@ Class { #classTraits : 'TGtWithTextualCoderViewModel classTrait', #instVars : [ 'collapsedElement', - 'expandedElement' + 'expandedElement', + 'modificationIndicator' ], #category : #'GToolkit-Coder-UI-Coder - Source' } @@ -74,7 +75,7 @@ GtExpandableSourceCoderElement >> initialize [ vFitContent; hMatchParent; margin: (BlInsets all: 4); - aptitude: GtCoderExpanderAptitude; + aptitude: (GtCoderExpanderAptitude new padding: BlInsets empty); beInSingleCompositionLayer. self states withExpansion. @@ -85,7 +86,7 @@ GtExpandableSourceCoderElement >> initialize [ self header: [ collapsedElement := self newCollapsedElement ]; content: [ expandedElement := self newExpandedElement ]. - + self when: BlClickEvent do: [ :anEvent | @@ -93,7 +94,11 @@ GtExpandableSourceCoderElement >> initialize [ ifTrue: [ anEvent consumed: true. self expand. - self textualCoderViewModel focused: true ] ] + self textualCoderViewModel focused: true ] ]. + + modificationIndicator := self newModificationIndicator. + modificationIndicator visibility: BlVisibility gone. + self addChild: modificationIndicator ] { #category : #private } @@ -108,7 +113,7 @@ GtExpandableSourceCoderElement >> markDirty: anElement as: aBoolean [ anElement userData at: #coderDirty put: aBoolean ] -{ #category : #private } +{ #category : #'private - instance creation' } GtExpandableSourceCoderElement >> newCollapsedElement [ | aCollapsedElement | aCollapsedElement := GtSourceCoderCollapsedContentElement new. @@ -119,7 +124,7 @@ GtExpandableSourceCoderElement >> newCollapsedElement [ ^ aCollapsedElement ] -{ #category : #private } +{ #category : #'private - instance creation' } GtExpandableSourceCoderElement >> newExpandedElement [ | anExpandedElement | anExpandedElement := GtSourceCoderExpandedContentElement new. @@ -130,6 +135,25 @@ GtExpandableSourceCoderElement >> newExpandedElement [ ^ anExpandedElement ] +{ #category : #'private - instance creation' } +GtExpandableSourceCoderElement >> newModificationIndicator [ + ^ BlElement new + constraintsDo: [ :c | + c ignoreByLayout. + c ignored horizontal alignLeft. + c horizontal exact: 4. + c vertical matchParent. + c margin: (BlInsets left: 4) ]; + preventMeAndChildrenMouseEvents; + background: self theme status changesBackgroundColor; + withAsyncPromiseDo: [ :anElementPromise | + anElementPromise + whenSuccess: [ :anIndicator :isModified | + anIndicator visibility: (isModified + ifTrue: [ BlVisibility visible ] + ifFalse: [ BlVisibility gone ]) ] ] +] + { #category : #private } GtExpandableSourceCoderElement >> onCollapsed [ self beInSingleCompositionLayer. @@ -166,6 +190,11 @@ GtExpandableSourceCoderElement >> onViewModelExpansionChanged: anAnnouncement [ self expanded: anAnnouncement expanded ] +{ #category : #'private - event handling' } +GtExpandableSourceCoderElement >> onViewModelTextChanged: anAnnouncement [ + self updateModificationIndicator +] + { #category : #'focus requesting' } GtExpandableSourceCoderElement >> requestFocus [ self @@ -179,12 +208,14 @@ GtExpandableSourceCoderElement >> subscribeToTextualCoderViewModel [ "Is sent after a new textualCoder view model is assigned to the element. It is required to unsubscribe from the view model or domain model by implementing #unsubscribeFromTextualCoderViewModel if elements subscribe to them" - - "textualCoderViewModel coder subscribeToSystem." + textualCoderViewModel weak when: GtTextualCoderViewModelExpansionChanged - send: #onViewModelExpansionChanged: - to: self + send: #onViewModelExpansionChanged: + to: self; + when: GtTextualCoderViewModelTextChanged + send: #onViewModelTextChanged: + to: self ] { #category : #'api - textual coder view model' } @@ -212,5 +243,11 @@ GtExpandableSourceCoderElement >> updateElement [ textualCoderViewModel focused ifFalse: [ self loseFocus ]. - self expanded: textualCoderViewModel expanded + self expanded: textualCoderViewModel expanded. + self updateModificationIndicator +] + +{ #category : #'private - update' } +GtExpandableSourceCoderElement >> updateModificationIndicator [ + modificationIndicator asyncPromise promise: textualCoderViewModel isTextModified ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st index 7ebb846ca..d660f48e5 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st @@ -64,7 +64,7 @@ GtSourceCoderContentElement >> gtAllShortcutsFor: aView [ GtSourceCoderContentElement >> initialize [ super initialize. self - margin: (BlInsets left: 5); + padding: (BlInsets top: 4 right: 4 bottom: 4 left: 10); hMatchParent; vFitContentLimited ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 5249c37ed..ab694bd92 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -15,7 +15,8 @@ Class { 'selection', 'extraTextAttributes', 'styledText', - 'shouldHaveHeader' + 'shouldHaveHeader', + 'isTextModifiedPromise' ], #category : #'GToolkit-Coder-UI-Coder - Textual Model' } @@ -443,6 +444,16 @@ GtTextualCoderViewModel >> initialize [ shouldHaveHeader := true ] +{ #category : #'api - text' } +GtTextualCoderViewModel >> isTextModified [ + "Return a promise which is resolved to true if the text is modified, + false otherwise. Should be used together with {{gtClass:GtTextualCoderViewModelTextChanged}} to update + the modification status in the UI" + + + ^ isTextModifiedPromise ifNil: [ isTextModifiedPromise := self coderModel isModifiedPromise ] +] + { #category : #'api - add-ons' } GtTextualCoderViewModel >> mainActions [ ^ mainActions @@ -540,6 +551,7 @@ GtTextualCoderViewModel >> onSourceCodeChanged: anSourceCodeChangedAnnouncement self unsetStyledText. addOnPromise := nil. + isTextModifiedPromise := nil. self ensureAddOns. self announce: (GtTextualCoderViewModelTextChanged new diff --git a/src/GToolkit-Coder/GtTextualCoder.class.st b/src/GToolkit-Coder/GtTextualCoder.class.st index c5776a202..8d2352dde 100644 --- a/src/GToolkit-Coder/GtTextualCoder.class.st +++ b/src/GToolkit-Coder/GtTextualCoder.class.st @@ -204,6 +204,13 @@ GtTextualCoder >> isModified [ ^ self sourceCode isModified ] +{ #category : #testing } +GtTextualCoder >> isModifiedPromise [ + + + ^ self sourceCode isModifiedPromise +] + { #category : #'instance creation' } GtTextualCoder >> newCompletionStrategy [ ^ self subclassResponsibility From e41e868a9e2bb462c41bf9119b3f60c0f79e9361 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 13 Dec 2021 10:23:19 +0100 Subject: [PATCH 0126/1268] [feenkcom/gtoolkit#2282] add indicator to the left from the expander bar --- src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st index d3f19fde5..88d40a04b 100644 --- a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st @@ -141,9 +141,9 @@ GtExpandableSourceCoderElement >> newModificationIndicator [ constraintsDo: [ :c | c ignoreByLayout. c ignored horizontal alignLeft. - c horizontal exact: 4. + c horizontal exact: 5. c vertical matchParent. - c margin: (BlInsets left: 4) ]; + c margin: (BlInsets left: 8) ]; preventMeAndChildrenMouseEvents; background: self theme status changesBackgroundColor; withAsyncPromiseDo: [ :anElementPromise | From b2c2a35e6183d3b6b6be485e21492f28da42c0b8 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 13 Dec 2021 10:42:12 +0100 Subject: [PATCH 0127/1268] [feenkcom/gtoolkit#2282] add modified indicator id --- .../GtExpandableSourceCoderElement.class.st | 1 + .../GtTextualCoderModificationIndicatorId.class.st | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 src/GToolkit-Coder-UI/GtTextualCoderModificationIndicatorId.class.st diff --git a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st index 88d40a04b..0c87e0328 100644 --- a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st @@ -146,6 +146,7 @@ GtExpandableSourceCoderElement >> newModificationIndicator [ c margin: (BlInsets left: 8) ]; preventMeAndChildrenMouseEvents; background: self theme status changesBackgroundColor; + id: GtTextualCoderModificationIndicatorId; withAsyncPromiseDo: [ :anElementPromise | anElementPromise whenSuccess: [ :anIndicator :isModified | diff --git a/src/GToolkit-Coder-UI/GtTextualCoderModificationIndicatorId.class.st b/src/GToolkit-Coder-UI/GtTextualCoderModificationIndicatorId.class.st new file mode 100644 index 000000000..d78bc2e61 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtTextualCoderModificationIndicatorId.class.st @@ -0,0 +1,13 @@ +" +A bar that appears when a textual coder is modified +" +Class { + #name : #GtTextualCoderModificationIndicatorId, + #superclass : #GtCoderElementId, + #category : #'GToolkit-Coder-UI-Coder - Ids' +} + +{ #category : #converting } +GtTextualCoderModificationIndicatorId >> asSymbol [ + ^ #'textual-coder--modification-indicator' +] From d5d42362d2e7e162128be65ff535c8bf37cb621d Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 13 Dec 2021 20:52:24 +0100 Subject: [PATCH 0128/1268] refactoring scripter --- .../TCoderByScripterExamples.trait.st | 4 ++-- ...SourceCoderExpandedContentElement.class.st | 1 - .../GtTextualCoderEditorElement.class.st | 2 ++ .../TBlDevScripterTarget.extension.st | 24 ++----------------- 4 files changed, 6 insertions(+), 25 deletions(-) diff --git a/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st b/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st index cd13d1423..d1d348125 100644 --- a/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st +++ b/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st @@ -8,7 +8,7 @@ TCoderByScripterExamples >> openAndClickOnContextMenuItemFor: aScripterOrStep id aScripterOrStep secondaryClick label: 'Open context menu'; - onChildNamed: GtSourceCoderEditorId; + id: GtSourceCoderEditorId; play. aScripterOrStep mouseMoveOver @@ -21,7 +21,7 @@ TCoderByScripterExamples >> openAndClickOnContextMenuItemFor: aScripterOrStep id aScripterOrStep click label: 'Click ', aBlElementId asSymbol; onSpaceRoot; - onChildNamed: aBlElementId. + id: aBlElementId. aScripterOrStep wait forEmptySpaceTaskQueue. aScripterOrStep syncContinue diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st index 537ea6bdf..21f189bfa 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st @@ -31,7 +31,6 @@ GtSourceCoderExpandedContentElement >> newActionsElement [ { #category : #'instance creation' } GtSourceCoderExpandedContentElement >> newEditorElement [ ^ GtSourceCoderEditorElement new - id: GtSourceCoderEditorId ] { #category : #'api - textual coder view model' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 1123469f3..8c9afd9a7 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -62,6 +62,8 @@ GtTextualCoderEditorElement >> initialize [ self editor beEditableCode; disableStyleTextWhenModified. + + self id: GtSourceCoderEditorId. shortcuts := #(). completion := GtCompletionController on: self. diff --git a/src/GToolkit-Coder-UI/TBlDevScripterTarget.extension.st b/src/GToolkit-Coder-UI/TBlDevScripterTarget.extension.st index ac516b20c..675bdf71d 100644 --- a/src/GToolkit-Coder-UI/TBlDevScripterTarget.extension.st +++ b/src/GToolkit-Coder-UI/TBlDevScripterTarget.extension.st @@ -1,31 +1,11 @@ Extension { #name : #TBlDevScripterTarget } -{ #category : #'*GToolkit-Coder-UI' } -TBlDevScripterTarget >> onGtPharoSnippetDestinationButton [ - self - onChildNamed: #content; - onChildOfClass: GtSourceCoderExpandedContentElement; - onChildNamed: #switchButton -] - -{ #category : #'*GToolkit-Coder-UI' } -TBlDevScripterTarget >> onGtPharoSnippetEvaluateButton [ - self - "onChildOfClass: GtExpandableCoderElement;" - onChildNamed: #content; - onChildOfClass: GtSourceCoderExpandedContentElement; - onChildNamed: #actions; - onChildAt: 1; "BrToolbar" - "onChildOfClass: BrToolbar;" - onChildAt: 1 -] - { #category : #'*GToolkit-Coder-UI' } TBlDevScripterTarget >> onGtPharoSnippetPlayButton [ self - onChildNamed: #content; + id: #content; onChildOfClass: GtSourceCoderExpandedContentElement; - onChildNamed: #actions; + id: #actions; onChildAt: 1; "BrToolbar" onChildAt: 1 "BrButton" ] From 3de4240675439c31b889565351d71226ded03d80 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 16 Dec 2021 16:05:09 -0300 Subject: [PATCH 0129/1268] store `originalSourceTextPromise` as an instance variable [feenkcom/gtoolkit#2289] --- src/GToolkit-Coder/GtCoderTextSource.class.st | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder/GtCoderTextSource.class.st b/src/GToolkit-Coder/GtCoderTextSource.class.st index 24b49567a..f5620e931 100644 --- a/src/GToolkit-Coder/GtCoderTextSource.class.st +++ b/src/GToolkit-Coder/GtCoderTextSource.class.st @@ -44,7 +44,7 @@ GtCoderTextSource >> currentSourceText [ ^ self critical: [ currentSourceText ifNotNil: [ :aSourceText | aSourceText asAsyncPromise ] - ifNil: [ originalSourceTextPromise ifNil: [ originalSourceTextPromise := self originalSourceTextPromise ] ] ] + ifNil: [ self originalSourceTextPromise ] ] ] { #category : #'api - accessing' } @@ -98,9 +98,13 @@ GtCoderTextSource >> originalSourceTextFuture [ { #category : #initialization } GtCoderTextSource >> originalSourceTextPromise [ - - ^ (self originalSourceTextFuture map: [ :aText | GtCoderSourceText new text: aText ]) asAsyncPromise + + ^ self critical: [ + originalSourceTextPromise ifNil: [ + originalSourceTextPromise := ( + self originalSourceTextFuture map: [ :aText | + GtCoderSourceText new text: aText ]) asAsyncPromise ] ] ] { #category : #'private - accessing' } From 7fbef04022c8c3bcff3f5b14c01449bd24b527ec Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 16 Dec 2021 19:49:40 -0300 Subject: [PATCH 0130/1268] fix examples [feenkcom/gtoolkit#2289] --- .../GtCoderExamplesEventsRecorder.class.st | 12 ++++++++++++ .../GtCoderCompiledMethodTextSource.class.st | 4 +++- .../GtCoderExplicitStringSource.class.st | 4 +++- .../GtCoderExplicitTextSource.class.st | 5 ++++- src/GToolkit-Coder/GtCoderFutureTextSource.class.st | 5 ++++- 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-Examples/GtCoderExamplesEventsRecorder.class.st b/src/GToolkit-Coder-Examples/GtCoderExamplesEventsRecorder.class.st index 5bf09e3e4..f469ab39c 100644 --- a/src/GToolkit-Coder-Examples/GtCoderExamplesEventsRecorder.class.st +++ b/src/GToolkit-Coder-Examples/GtCoderExamplesEventsRecorder.class.st @@ -17,6 +17,18 @@ GtCoderExamplesEventsRecorder >> first [ ^ self events first ] +{ #category : #'gt-extensions' } +GtCoderExamplesEventsRecorder >> gtEventsFor: aView [ + + + self events ifNil: [ ^ aView empty ]. + + ^ aView list + title: 'Events'; + priority: 1; + items: [ self events ] +] + { #category : #initialization } GtCoderExamplesEventsRecorder >> initialize [ super initialize. diff --git a/src/GToolkit-Coder/GtCoderCompiledMethodTextSource.class.st b/src/GToolkit-Coder/GtCoderCompiledMethodTextSource.class.st index 1c87925e7..93d3ef05b 100644 --- a/src/GToolkit-Coder/GtCoderCompiledMethodTextSource.class.st +++ b/src/GToolkit-Coder/GtCoderCompiledMethodTextSource.class.st @@ -16,7 +16,9 @@ GtCoderCompiledMethodTextSource >> compiledMethod [ { #category : #accessing } GtCoderCompiledMethodTextSource >> compiledMethod: anObject [ - compiledMethod := anObject + self critical: [ + compiledMethod := anObject. + originalSourceTextPromise := nil ] ] { #category : #initialization } diff --git a/src/GToolkit-Coder/GtCoderExplicitStringSource.class.st b/src/GToolkit-Coder/GtCoderExplicitStringSource.class.st index 6818b33b8..03a305fb4 100644 --- a/src/GToolkit-Coder/GtCoderExplicitStringSource.class.st +++ b/src/GToolkit-Coder/GtCoderExplicitStringSource.class.st @@ -23,5 +23,7 @@ GtCoderExplicitStringSource >> source [ { #category : #accessing } GtCoderExplicitStringSource >> source: anObject [ - source := anObject + self critical: [ + source := anObject. + originalSourceTextPromise := nil ] ] diff --git a/src/GToolkit-Coder/GtCoderExplicitTextSource.class.st b/src/GToolkit-Coder/GtCoderExplicitTextSource.class.st index e075a5aa0..3e2af7c43 100644 --- a/src/GToolkit-Coder/GtCoderExplicitTextSource.class.st +++ b/src/GToolkit-Coder/GtCoderExplicitTextSource.class.st @@ -21,5 +21,8 @@ GtCoderExplicitTextSource >> text [ { #category : #accessing } GtCoderExplicitTextSource >> text: aStringOrText [ - text := aStringOrText asRopedText + + self critical: [ + text := aStringOrText asRopedText. + originalSourceTextPromise := nil ] ] diff --git a/src/GToolkit-Coder/GtCoderFutureTextSource.class.st b/src/GToolkit-Coder/GtCoderFutureTextSource.class.st index 90ba1337a..01a4e1f8e 100644 --- a/src/GToolkit-Coder/GtCoderFutureTextSource.class.st +++ b/src/GToolkit-Coder/GtCoderFutureTextSource.class.st @@ -9,7 +9,10 @@ Class { { #category : #accessing } GtCoderFutureTextSource >> future: aBlock [ - futureBlock := aBlock + + self critical: [ + futureBlock := aBlock. + originalSourceTextPromise := nil ] ] { #category : #initialization } From 1cad2b017f7c3deee075a0b7f94821af0ecc06d0 Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 21 Dec 2021 15:29:52 -0600 Subject: [PATCH 0131/1268] [feenkcom/gtoolkit#2303] highlight matching characters in completion list --- src/GToolkit-Coder/GtClassesCompletionStrategy.class.st | 4 ++-- .../GtCoderClassWithPackageCompletionStrategy.class.st | 6 +++--- src/GToolkit-Coder/GtPoolsCompletionStrategy.class.st | 2 +- src/GToolkit-Coder/GtTraitsCompletionStrategy.class.st | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/GToolkit-Coder/GtClassesCompletionStrategy.class.st b/src/GToolkit-Coder/GtClassesCompletionStrategy.class.st index 567d964e1..f72433a6e 100644 --- a/src/GToolkit-Coder/GtClassesCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtClassesCompletionStrategy.class.st @@ -32,13 +32,13 @@ GtClassesCompletionStrategy >> completionActionStreamFor: aText at: positionInte from: positionInteger + 1 to: currentInput size ]. insertion := GtInsertTextCompletionAction - labeled: className + labeled: (self labelFor: className withSearch: currentInput) completion: (className allButFirst: positionInteger) position: positionInteger from: 1. deletion notNil ifTrue: - [ (GtCompositeCompletionAction labeled: className) + [ (GtCompositeCompletionAction labeled: insertion displayText) addAction: deletion; addAction: insertion; yourself ] diff --git a/src/GToolkit-Coder/GtCoderClassWithPackageCompletionStrategy.class.st b/src/GToolkit-Coder/GtCoderClassWithPackageCompletionStrategy.class.st index 6d0f50766..77d4c29ee 100644 --- a/src/GToolkit-Coder/GtCoderClassWithPackageCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtCoderClassWithPackageCompletionStrategy.class.st @@ -40,7 +40,7 @@ GtCoderClassWithPackageCompletionStrategy >> completionActionStreamFor: aText at collect: [ :className | GtInsertTextCompletionAction - labeled: className + labeled: (self labelFor: className withSearch: partialClassName) completion: (className allButFirst: partialClassName size) position: positionInteger from: positionInteger - partialClassName size + 1 ] ]. @@ -48,7 +48,7 @@ GtCoderClassWithPackageCompletionStrategy >> completionActionStreamFor: aText at collect: [ :className | GtInsertTextCompletionAction - labeled: className + labeled: (self labelFor: className withSearch: currentInput) completion: (className allButFirst: currentInput size) position: positionInteger from: positionInteger - currentInput size + 1 ]) @@ -57,7 +57,7 @@ GtCoderClassWithPackageCompletionStrategy >> completionActionStreamFor: aText at collect: [ :packageName | GtInsertTextCompletionAction - labeled: packageName + labeled: (self labelFor: packageName withSearch: currentInput) completion: (packageName allButFirst: currentInput size) , '>' position: positionInteger from: positionInteger - currentInput size + 1 ]) diff --git a/src/GToolkit-Coder/GtPoolsCompletionStrategy.class.st b/src/GToolkit-Coder/GtPoolsCompletionStrategy.class.st index 6f038dab8..a1d4389bb 100644 --- a/src/GToolkit-Coder/GtPoolsCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtPoolsCompletionStrategy.class.st @@ -25,7 +25,7 @@ GtPoolsCompletionStrategy >> completionActionStreamFor: aText at: positionIntege collect: [ :poolName | GtInsertTextCompletionAction - labeled: poolName + labeled: (self labelFor: poolName withSearch: currentInput) completion: (poolName allButFirst: currentInput size) position: positionInteger from: positionInteger - currentInput size + 1 ] diff --git a/src/GToolkit-Coder/GtTraitsCompletionStrategy.class.st b/src/GToolkit-Coder/GtTraitsCompletionStrategy.class.st index e1f13879f..3cac68c85 100644 --- a/src/GToolkit-Coder/GtTraitsCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtTraitsCompletionStrategy.class.st @@ -23,7 +23,7 @@ GtTraitsCompletionStrategy >> completionActionStreamFor: aText at: positionInteg collect: [ :traitName | GtInsertTextCompletionAction - labeled: traitName + labeled: (self labelFor: traitName withSearch: currentInput) completion: (traitName allButFirst: currentInput size) position: positionInteger from: positionInteger - currentInput size + 1 ] From 3a5eee9fe8bb419b5232f477af9924ac94644510 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 28 Dec 2021 11:46:08 -0300 Subject: [PATCH 0132/1268] add create baseline dialog [feenkcom/gtoolkit#2309] --- .../GtCoderToolbarElement.class.st | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st b/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st index 90b8c9c35..ed9c30f81 100644 --- a/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st @@ -12,9 +12,27 @@ Class { #instVars : [ 'toolbarElement' ], - #category : 'GToolkit-Coder-UI-Basic' + #category : #'GToolkit-Coder-UI-Basic' } +{ #category : #'gt-extensions' } +GtCoderToolbarElement >> addBaselineTab: look [ + + ^ BrTab new + aptitude: BrGlamorousTabAptitude new; + label: 'Baseline'; + stencil: [ | element | + element := GtPharoCreateBaselineElement new. + element + behaviorBlock: [ :cls | + look hide. + navigationModel selectClass: cls ]. + element forBaselineDefinition. + navigationModel + selectedPackageDo: [ :package | element forPackageReference: package ]. + element ] +] + { #category : #'gt-extensions' } GtCoderToolbarElement >> addClassTab: look [ From 4806ce2b1ea71bc1736ae43b52fb875be7bcf48a Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 28 Dec 2021 11:52:55 -0300 Subject: [PATCH 0133/1268] move `addBaselineTab:` into `gt4pharo` [feenkcom/gtoolkit#2309] --- .../GtCoderToolbarElement.class.st | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st b/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st index ed9c30f81..37df61b05 100644 --- a/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st @@ -15,24 +15,6 @@ Class { #category : #'GToolkit-Coder-UI-Basic' } -{ #category : #'gt-extensions' } -GtCoderToolbarElement >> addBaselineTab: look [ - - ^ BrTab new - aptitude: BrGlamorousTabAptitude new; - label: 'Baseline'; - stencil: [ | element | - element := GtPharoCreateBaselineElement new. - element - behaviorBlock: [ :cls | - look hide. - navigationModel selectClass: cls ]. - element forBaselineDefinition. - navigationModel - selectedPackageDo: [ :package | element forPackageReference: package ]. - element ] -] - { #category : #'gt-extensions' } GtCoderToolbarElement >> addClassTab: look [ From af8b0267c6e048beb96ed355ec405bd4ba271eec Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 30 Dec 2021 10:52:51 +0100 Subject: [PATCH 0134/1268] [feenkcom/gtoolkit#2321] extend addons, ast and source text with views --- .../GtTextualCoderEditorElement.class.st | 6 --- .../GtTextualCoderViewModel.class.st | 2 + src/GToolkit-Coder/GtCoderAddOns.class.st | 37 ------------------- src/GToolkit-Coder/GtCoderAst.class.st | 15 +++++++- .../GtCoderSourceString.class.st | 15 +++++++- src/GToolkit-Coder/GtCoderSourceText.class.st | 1 + .../GtCoderStylerChanged.class.st | 26 ------------- src/GToolkit-Coder/GtTextualCoder.class.st | 1 + .../GtTextualCoderAddOns.class.st | 26 +++++++------ 9 files changed, 47 insertions(+), 82 deletions(-) delete mode 100644 src/GToolkit-Coder/GtCoderStylerChanged.class.st diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 8c9afd9a7..83461cd39 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -228,11 +228,6 @@ GtTextualCoderEditorElement >> onStyleTextRequest: anEvent [ self enqueueTask: (BlTaskAction new action: [ self styleTextAndAfterDo: anEvent afterAction ]) ] -{ #category : #'private - event handling' } -GtTextualCoderEditorElement >> onStylersUpdated: anAnnouncement [ - -] - { #category : #'private - event handling' } GtTextualCoderEditorElement >> onTextModified [ "Is sent when the text changes in the editor. Here we should synchronise the UI and the model." @@ -392,7 +387,6 @@ GtTextualCoderEditorElement >> registerCoderModelAnnouncementsFor: aCoderModel [ when: GtCoderAddOnsUpdateRequest send: #onUpdateAddOnsRequest: to: self; - when: GtCoderStylerChanged send: #onStylersUpdated: to: self; when: GtCoderStyleTextRequest send: #onStyleTextRequest: to: self; when: GtCoderParseError send: #onCoderParseError: to: self; when: GtCoderObjectSpawnRequest diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index ab694bd92..64e82e1d8 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -194,6 +194,7 @@ GtTextualCoderViewModel >> computeAddOns [ inHierarchy: aCoderModel class. newAddOns := aCoderModel newAddOns. + newAddOns ast: aCoderAst. "extra addons" newAddOns addAddOns: aCoderModel addOns. aCoderModel initializeShortcuts: newAddOns. @@ -372,6 +373,7 @@ GtTextualCoderViewModel >> gtInfo [ aStream nextPut: (#coderModel -> self coderModel). aStream nextPut: (#cursors -> self cursors). aStream nextPut: (#selection -> self selection). + aStream nextPut: (#addOns -> self addOns wait). aStream nextPut: (#ast -> self astAwait). aStream nextPut: (#stylers -> self stylers). aStream nextPut: (#mainActions -> self mainActions). diff --git a/src/GToolkit-Coder/GtCoderAddOns.class.st b/src/GToolkit-Coder/GtCoderAddOns.class.st index f5ac12375..4ec0c9e1a 100644 --- a/src/GToolkit-Coder/GtCoderAddOns.class.st +++ b/src/GToolkit-Coder/GtCoderAddOns.class.st @@ -236,43 +236,6 @@ GtCoderAddOns >> differenceWith: aGtCoderAddOns on: aStream [ ifFalse: [ aStream nextPut: GtCoderAddOnsShortcutsDifference new ]. ] -{ #category : #'gt-extensions' } -GtCoderAddOns >> gtViewContextActionsFor: aView [ - - ^ aView columnedList - title: 'Context actions' translated; - priority: 25; - items: [ self contextActions ]; - column: 'Title' text: [ :anAction | anAction title ifNil: [ '' ] ]; - column: 'Action' text: [ :anAction | anAction action ] -] - -{ #category : #'gt-extensions' } -GtCoderAddOns >> gtViewKeybindingsFor: aView [ - - self shortcuts ifEmpty: [ ^ aView empty ]. - ^ aView columnedList - title: 'Shortcuts' translated; - priority: 10; - items: [ self shortcuts asArray ]; - column: 'Name' text: [ :each | each name ifNil: [ each gtDisplayString ] ]; - column: 'Combination' text: [ :each | each combination gtDisplayString ] -] - -{ #category : #'gt-extensions' } -GtCoderAddOns >> gtViewMainActionsFor: aView [ - - ^ aView columnedList - title: 'Main actions' translated; - priority: 20; - items: [ self mainActions ]; - column: 'Title' - text: [ :anAction | anAction title ifNil: [ '' ] ]; - column: 'Action' - text: [ :anAction | anAction action ] - weight: 3 -] - { #category : #'initialize-release' } GtCoderAddOns >> initialize [ super initialize. diff --git a/src/GToolkit-Coder/GtCoderAst.class.st b/src/GToolkit-Coder/GtCoderAst.class.st index 409544390..2435aa6cf 100644 --- a/src/GToolkit-Coder/GtCoderAst.class.st +++ b/src/GToolkit-Coder/GtCoderAst.class.st @@ -3,7 +3,8 @@ Class { #superclass : #Object, #instVars : [ 'ast', - 'epoch' + 'epoch', + 'sourceString' ], #category : #'GToolkit-Coder-Ast' } @@ -31,3 +32,15 @@ GtCoderAst >> epoch: anObject [ epoch := anObject ] + +{ #category : #accessing } +GtCoderAst >> sourceString [ + + + ^ sourceString +] + +{ #category : #accessing } +GtCoderAst >> sourceString: aGtCoderSourceString [ + sourceString := aGtCoderSourceString +] diff --git a/src/GToolkit-Coder/GtCoderSourceString.class.st b/src/GToolkit-Coder/GtCoderSourceString.class.st index b65c03016..c1f1644e7 100644 --- a/src/GToolkit-Coder/GtCoderSourceString.class.st +++ b/src/GToolkit-Coder/GtCoderSourceString.class.st @@ -2,6 +2,7 @@ Class { #name : #GtCoderSourceString, #superclass : #Object, #instVars : [ + 'sourceText', 'string', 'epoch' ], @@ -16,10 +17,22 @@ GtCoderSourceString >> epoch [ { #category : #accessing } GtCoderSourceString >> epoch: anObject [ - epoch := anObject ] +{ #category : #accessing } +GtCoderSourceString >> sourceText [ + + + ^ sourceText +] + +{ #category : #accessing } +GtCoderSourceString >> sourceText: aGtCoderSourceText [ + + sourceText := aGtCoderSourceText +] + { #category : #accessing } GtCoderSourceString >> string [ diff --git a/src/GToolkit-Coder/GtCoderSourceText.class.st b/src/GToolkit-Coder/GtCoderSourceText.class.st index 1061f94f1..b964cb7f4 100644 --- a/src/GToolkit-Coder/GtCoderSourceText.class.st +++ b/src/GToolkit-Coder/GtCoderSourceText.class.st @@ -13,6 +13,7 @@ GtCoderSourceText >> asSourceString [ ^ GtCoderSourceString new + sourceText: self; string: text asString; epoch: epoch ] diff --git a/src/GToolkit-Coder/GtCoderStylerChanged.class.st b/src/GToolkit-Coder/GtCoderStylerChanged.class.st deleted file mode 100644 index 6dbd5d37a..000000000 --- a/src/GToolkit-Coder/GtCoderStylerChanged.class.st +++ /dev/null @@ -1,26 +0,0 @@ -" -1. Coder styler changed event -** - -Is announced by the {{gtClass:GtCoderModel}} when stylers change. - - -" -Class { - #name : #GtCoderStylerChanged, - #superclass : #GtSourceCoderAnnouncement, - #instVars : [ - 'stylers' - ], - #category : 'GToolkit-Coder-Event' -} - -{ #category : #accessing } -GtCoderStylerChanged >> stylers [ - ^ stylers -] - -{ #category : #accessing } -GtCoderStylerChanged >> stylers: anObject [ - stylers := anObject -] diff --git a/src/GToolkit-Coder/GtTextualCoder.class.st b/src/GToolkit-Coder/GtTextualCoder.class.st index 8d2352dde..d5583e532 100644 --- a/src/GToolkit-Coder/GtTextualCoder.class.st +++ b/src/GToolkit-Coder/GtTextualCoder.class.st @@ -46,6 +46,7 @@ GtTextualCoder >> ast [ ^ self critical: [ astPromise ifNil: [ astPromise := self sourceCode currentSourceString asyncThen: [ :aGtCoderSourceString | GtCoderAst new ast: (self computeAst: aGtCoderSourceString string); + sourceString: aGtCoderSourceString; epoch: aGtCoderSourceString epoch ] ] ] ] diff --git a/src/GToolkit-Coder/GtTextualCoderAddOns.class.st b/src/GToolkit-Coder/GtTextualCoderAddOns.class.st index 7d8a4cb84..45d127335 100644 --- a/src/GToolkit-Coder/GtTextualCoderAddOns.class.st +++ b/src/GToolkit-Coder/GtTextualCoderAddOns.class.st @@ -2,9 +2,10 @@ Class { #name : #GtTextualCoderAddOns, #superclass : #GtCoderAddOns, #instVars : [ - 'stylers' + 'stylers', + 'ast' ], - #category : 'GToolkit-Coder-Coders - Addons' + #category : #'GToolkit-Coder-Coders - Addons' } { #category : #accessing } @@ -27,6 +28,18 @@ GtTextualCoderAddOns >> addStylers: aCollectionOfStylers [ aCollectionOfStylers do: [ :eachStyler | self addStyler: eachStyler ] ] +{ #category : #accessing } +GtTextualCoderAddOns >> ast [ + + + ^ ast +] + +{ #category : #accessing } +GtTextualCoderAddOns >> ast: aGtCoderAst [ + ast := aGtCoderAst +] + { #category : #changes } GtTextualCoderAddOns >> differenceWith: aGtCoderAddOns on: aStream [ super differenceWith: aGtCoderAddOns on: aStream. @@ -35,15 +48,6 @@ GtTextualCoderAddOns >> differenceWith: aGtCoderAddOns on: aStream [ ifFalse: [ aStream nextPut: GtCoderAddOnsStylersDifference new ] ] -{ #category : #'gt-extensions' } -GtTextualCoderAddOns >> gtViewStylersFor: aView [ - - ^ aView list - title: 'Stylers' translated; - priority: 30; - items: [ self stylers ] -] - { #category : #'initialize-release' } GtTextualCoderAddOns >> initialize [ super initialize. From 4ec7f15399b39cc0040ef1576befd57ca533ce15 Mon Sep 17 00:00:00 2001 From: John Brant Date: Wed, 5 Jan 2022 09:56:09 -0600 Subject: [PATCH 0135/1268] [feenkcom/gtoolkit#2334] refactoring completion results --- src/GToolkit-Coder/GtClassesCompletionStrategy.class.st | 7 +------ .../GtCoderClassWithPackageCompletionStrategy.class.st | 7 +------ .../GtPackageClassesCompletionStrategy.class.st | 7 +------ src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st | 7 +------ src/GToolkit-Coder/GtPoolsCompletionStrategy.class.st | 7 +------ src/GToolkit-Coder/GtTraitsCompletionStrategy.class.st | 7 +------ 6 files changed, 6 insertions(+), 36 deletions(-) diff --git a/src/GToolkit-Coder/GtClassesCompletionStrategy.class.st b/src/GToolkit-Coder/GtClassesCompletionStrategy.class.st index f72433a6e..af6fe8f27 100644 --- a/src/GToolkit-Coder/GtClassesCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtClassesCompletionStrategy.class.st @@ -1,6 +1,6 @@ Class { #name : #GtClassesCompletionStrategy, - #superclass : #GtCompletionStrategy, + #superclass : #GtStreamedCompletionStrategy, #instVars : [ 'excludedClasses', 'candidateClasses' @@ -50,11 +50,6 @@ GtClassesCompletionStrategy >> excludeClasses: aCollectionOfClasses [ excludedClasses := aCollectionOfClasses asSet ] -{ #category : #testing } -GtClassesCompletionStrategy >> hasCompletionEntryFor: aString [ - ^ true -] - { #category : #testing } GtClassesCompletionStrategy >> hasCompletionsAt: anInteger in: aText [ ^ true diff --git a/src/GToolkit-Coder/GtCoderClassWithPackageCompletionStrategy.class.st b/src/GToolkit-Coder/GtCoderClassWithPackageCompletionStrategy.class.st index 77d4c29ee..9c213d878 100644 --- a/src/GToolkit-Coder/GtCoderClassWithPackageCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtCoderClassWithPackageCompletionStrategy.class.st @@ -1,6 +1,6 @@ Class { #name : #GtCoderClassWithPackageCompletionStrategy, - #superclass : #GtCompletionStrategy, + #superclass : #GtStreamedCompletionStrategy, #instVars : [ 'allPackages', 'allClasses' @@ -63,11 +63,6 @@ GtCoderClassWithPackageCompletionStrategy >> completionActionStreamFor: aText at from: positionInteger - currentInput size + 1 ]) ] -{ #category : #testing } -GtCoderClassWithPackageCompletionStrategy >> hasCompletionEntryFor: aString [ - ^ true -] - { #category : #testing } GtCoderClassWithPackageCompletionStrategy >> hasCompletionsAt: anInteger in: aText [ ^ true diff --git a/src/GToolkit-Coder/GtPackageClassesCompletionStrategy.class.st b/src/GToolkit-Coder/GtPackageClassesCompletionStrategy.class.st index dfaa7af57..9923bf6d8 100644 --- a/src/GToolkit-Coder/GtPackageClassesCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtPackageClassesCompletionStrategy.class.st @@ -1,6 +1,6 @@ Class { #name : #GtPackageClassesCompletionStrategy, - #superclass : #GtCompletionStrategy, + #superclass : #GtStreamedCompletionStrategy, #instVars : [ 'packageSearchString' ], @@ -24,11 +24,6 @@ GtPackageClassesCompletionStrategy >> completionActionStreamFor: aText at: posit ^ (self classStreamMatching: string) collect: [ :each | GtReplaceTextCompletionAction forText: each name ] ] -{ #category : #testing } -GtPackageClassesCompletionStrategy >> hasCompletionEntryFor: aString [ - ^ true -] - { #category : #testing } GtPackageClassesCompletionStrategy >> hasCompletionsAt: anInteger in: aText [ ^ true diff --git a/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st b/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st index cbea8b884..5edd0e4d0 100644 --- a/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st @@ -1,6 +1,6 @@ Class { #name : #GtPackagesCompletionStrategy, - #superclass : #GtCompletionStrategy, + #superclass : #GtStreamedCompletionStrategy, #category : #'GToolkit-Coder-Completion' } @@ -61,11 +61,6 @@ GtPackagesCompletionStrategy >> completionActionStreamFor: aText at: positionInt collect: [ :each | GtReplaceTextCompletionAction forText: each ] ] -{ #category : #testing } -GtPackagesCompletionStrategy >> hasCompletionEntryFor: aString [ - ^ true -] - { #category : #testing } GtPackagesCompletionStrategy >> hasCompletionsAt: anInteger in: aText [ ^ true diff --git a/src/GToolkit-Coder/GtPoolsCompletionStrategy.class.st b/src/GToolkit-Coder/GtPoolsCompletionStrategy.class.st index a1d4389bb..1e6ad48cb 100644 --- a/src/GToolkit-Coder/GtPoolsCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtPoolsCompletionStrategy.class.st @@ -1,6 +1,6 @@ Class { #name : #GtPoolsCompletionStrategy, - #superclass : #GtCompletionStrategy, + #superclass : #GtStreamedCompletionStrategy, #instVars : [ 'candidatePools' ], @@ -31,11 +31,6 @@ GtPoolsCompletionStrategy >> completionActionStreamFor: aText at: positionIntege from: positionInteger - currentInput size + 1 ] ] -{ #category : #testing } -GtPoolsCompletionStrategy >> hasCompletionEntryFor: aString [ - ^ true -] - { #category : #testing } GtPoolsCompletionStrategy >> hasCompletionsAt: anInteger in: aText [ ^ true diff --git a/src/GToolkit-Coder/GtTraitsCompletionStrategy.class.st b/src/GToolkit-Coder/GtTraitsCompletionStrategy.class.st index 3cac68c85..3f2a68c87 100644 --- a/src/GToolkit-Coder/GtTraitsCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtTraitsCompletionStrategy.class.st @@ -1,6 +1,6 @@ Class { #name : #GtTraitsCompletionStrategy, - #superclass : #GtCompletionStrategy, + #superclass : #GtStreamedCompletionStrategy, #instVars : [ 'candidateTraits' ], @@ -29,11 +29,6 @@ GtTraitsCompletionStrategy >> completionActionStreamFor: aText at: positionInteg from: positionInteger - currentInput size + 1 ] ] -{ #category : #testing } -GtTraitsCompletionStrategy >> hasCompletionEntryFor: aString [ - ^ true -] - { #category : #testing } GtTraitsCompletionStrategy >> hasCompletionsAt: anInteger in: aText [ ^ true From cd0af589a3a604a66fba53fb118e4903249b9b75 Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Thu, 6 Jan 2022 17:11:14 +0100 Subject: [PATCH 0136/1268] improve the performance of constructing the class hierarchy tree in coder (for now only showing direct superclasses) feenkcom/gtoolkit##2344 --- .../GtCoderClassesHierarchyTree.class.st | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/GToolkit-Coder/GtCoderClassesHierarchyTree.class.st b/src/GToolkit-Coder/GtCoderClassesHierarchyTree.class.st index 2a5aac34c..62b77894c 100644 --- a/src/GToolkit-Coder/GtCoderClassesHierarchyTree.class.st +++ b/src/GToolkit-Coder/GtCoderClassesHierarchyTree.class.st @@ -12,23 +12,26 @@ Class { 'rootClass', 'subclassTrees' ], - #category : 'GToolkit-Coder-Navigation - Model' + #category : #'GToolkit-Coder-Navigation - Model' } { #category : #factory } GtCoderClassesHierarchyTree class >> fromClasses: aCollectionOfClasses [ - | aRootItem theSetOfClasses theRootTrees theSubclassTrees | - - aRootItem := self new. - + + | aRootItem theSetOfClasses classToTree | + aRootItem := GtCoderClassesHierarchyTree new. theSetOfClasses := aCollectionOfClasses asSet. - - theRootTrees := theSetOfClasses - reject: [ :eachClass | theSetOfClasses anySatisfy: [ :eachSuperclass | eachClass inheritsFrom: eachSuperclass ] ] - thenCollect: [ :eachRootClass | eachRootClass -> (theSetOfClasses select: [ :eachClass | eachClass inheritsFrom: eachRootClass ]) ]. - - theSubclassTrees := theRootTrees collect: [ :eachAssoc | (self fromClasses: eachAssoc value) rootClass: eachAssoc key ] as: Array. - aRootItem subclassTrees: theSubclassTrees. + classToTree := Dictionary new. + theSetOfClasses do: [ :each | + classToTree + at: each + put: (GtCoderClassesHierarchyTree new rootClass: each) ]. + theSetOfClasses do: [ :each | + classToTree + at: each superclass + ifPresent: [ :superTree | + superTree subclassTrees add: (classToTree at: each) ] + ifAbsent: [ aRootItem subclassTrees add: (classToTree at: each) ] ]. ^ aRootItem ] @@ -90,7 +93,7 @@ GtCoderClassesHierarchyTree >> hasRootClass [ { #category : #initialization } GtCoderClassesHierarchyTree >> initialize [ super initialize. - subclassTrees := Array empty. + subclassTrees := OrderedCollection new ] { #category : #printing } From 1f19dc1e593ae43368bf975353a9a73501281d0e Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Thu, 6 Jan 2022 21:09:12 +0100 Subject: [PATCH 0137/1268] fix examples feenkcom/gtoolkit##2344 --- .../GtCoderClassesHierarchyTreeExamples.class.st | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-Examples/GtCoderClassesHierarchyTreeExamples.class.st b/src/GToolkit-Coder-Examples/GtCoderClassesHierarchyTreeExamples.class.st index c3a899fca..16f59a508 100644 --- a/src/GToolkit-Coder-Examples/GtCoderClassesHierarchyTreeExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtCoderClassesHierarchyTreeExamples.class.st @@ -27,9 +27,9 @@ GtCoderClassesHierarchyTreeExamples >> fromCollectionClasses [ aHierarchyTree := GtCoderClassesHierarchyTree fromClasses: { Collection. Array . SequenceableCollection . OrderedCollection . Set . Dictionary . OrderedDictionary }. - self assert: aHierarchyTree size equals: 1. - self assert: aHierarchyTree first classes asSet equals: { Set . SequenceableCollection . OrderedDictionary . Dictionary } asSet. - self assert: (((aHierarchyTree sort: [:a :b | a name < b name ]) first at: 3) classes asSet = { Array . OrderedCollection } asSet). + self assert: aHierarchyTree size equals: 4. + self assert: aHierarchyTree classes asSet equals: { Set . Array. Collection . Dictionary } asSet. + self assert: (((aHierarchyTree sort: [:a :b | a name < b name ]) at: 2) classes asSet = { OrderedDictionary . SequenceableCollection } asSet). ^ aHierarchyTree ] From 40a6d43898848456701ab94761cebb0fb793d720 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 11 Jan 2022 10:24:00 -0600 Subject: [PATCH 0138/1268] rename calls to asCoderViewModel --- .../GtStreamingCodersViewModel.class.st | 2 +- src/GToolkit-Coder-UI/GtCoder2.class.st | 4 ++-- src/GToolkit-Coder-UI/GtCoderModel.extension.st | 5 ----- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModel.class.st b/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModel.class.st index 92273ffde..d05519d0b 100644 --- a/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModel.class.st +++ b/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModel.class.st @@ -60,7 +60,7 @@ GtStreamingCodersViewModel >> initialize [ { #category : #'instance creation' } GtStreamingCodersViewModel >> newCoderViewModelFor: aCoderModel [ - ^ aCoderModel asCoderViewModel + ^ aCoderModel asCoderUIModel ] { #category : #'private - notifying' } diff --git a/src/GToolkit-Coder-UI/GtCoder2.class.st b/src/GToolkit-Coder-UI/GtCoder2.class.st index f26172e3a..3025da786 100644 --- a/src/GToolkit-Coder-UI/GtCoder2.class.st +++ b/src/GToolkit-Coder-UI/GtCoder2.class.st @@ -9,7 +9,7 @@ Class { 'navigationBreacrumb', 'navigationSidebar' ], - #category : 'GToolkit-Coder-UI-! Core' + #category : #'GToolkit-Coder-UI-! Core' } { #category : #initialization } @@ -75,7 +75,7 @@ GtCoder2 >> initialize [ when: GtCoderToReplace do: [ :anEvent | anEvent consumed: true. - self coderToolViewModel pushCoderViewModel: anEvent coder asCoderViewModel ]. + self coderToolViewModel pushCoderViewModel: anEvent coder asCoderUIModel ]. ] diff --git a/src/GToolkit-Coder-UI/GtCoderModel.extension.st b/src/GToolkit-Coder-UI/GtCoderModel.extension.st index a89ef444d..977615893 100644 --- a/src/GToolkit-Coder-UI/GtCoderModel.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderModel.extension.st @@ -5,11 +5,6 @@ GtCoderModel >> asCoderUIModel [ ^ self subclassResponsibility ] -{ #category : #'*GToolkit-Coder-UI' } -GtCoderModel >> asCoderViewModel [ - ^ self asCoderUIModel -] - { #category : #'*GToolkit-Coder-UI' } GtCoderModel >> asElement [ ^ self asCoderUIModel asElement From 956a184f3035e56b7368184ed42af058c7f31871 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Wed, 12 Jan 2022 10:36:06 +0100 Subject: [PATCH 0139/1268] enqueue a task while waiting for the editor state to be computed --- .../GtTextualCoderEditorElement.class.st | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 83461cd39..48a256776 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -71,7 +71,13 @@ GtTextualCoderEditorElement >> initialize [ evaluationHighlighter := GtSourceCoderEvaluationHighlighter new editorElement: self. evaluationPrinter := GtSourceCoderEvaluationPrinter new editorElement: self. - self initializeListeners + self initializeListeners. + + self withAsyncPromiseDo: [ :anElementPromise | + anElementPromise + whenSuccess: [ :anEditorElement :anEditorState | anEditorElement editor restoreState: anEditorState ]; + whenError: [ :anEditorElement :anEditorState | ]; + whenPending: [ :anEditorElement | ] ] ] { #category : #initialization } @@ -247,17 +253,14 @@ GtTextualCoderEditorElement >> onTextualCoderViewModelChanged [ wish to perform an operation that requires an announcement, but keep in mind that this is not the most efficient way" self onCoderViewModelFocused: self textualCoderViewModel focused. - + "Setting text may change cursor and selection because text editor makes sure that they have valid values. That is why we create a snaphot of the editor's state which we will restore once new text is set" - self textualCoderViewModel asEditorState then: [ :anEditorState :isSynchronous | - isSynchronous - ifTrue: [ self editor restoreState: anEditorState ] - ifFalse: [ self enqueueTask: (BlTaskAction new action: [ self editor restoreState: anEditorState ]) ] ]. + self asyncPromise promise: self textualCoderViewModel asEditorState. self editor model: self textualCoderViewModel. - + shortcuts := self textualCoderViewModel shortcuts copy. self editor addEditorShortcuts: shortcuts. From cc9bab5fab4ca9e66bb673e8b027aaec9424b088 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 12 Jan 2022 07:58:35 -0600 Subject: [PATCH 0140/1268] Rename asCoderUIModel to asCoderViewModel --- src/GToolkit-Coder-Extensions/Behavior.extension.st | 2 +- .../GtStreamingCodersViewModel.class.st | 2 +- src/GToolkit-Coder-UI/GtCoder2.class.st | 2 +- src/GToolkit-Coder-UI/GtCoderModel.extension.st | 6 +++--- src/GToolkit-Coder-UI/GtCodersModel.extension.st | 4 ++-- src/GToolkit-Coder-UI/GtMultipleCodersViewModel.class.st | 6 +++--- src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st | 2 +- src/GToolkit-Coder-UI/GtTextCoder.extension.st | 2 +- src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st | 2 +- src/GToolkit-Coder-UI/GtTextualCoderViewModel.extension.st | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/GToolkit-Coder-Extensions/Behavior.extension.st b/src/GToolkit-Coder-Extensions/Behavior.extension.st index 38bd4440b..66232e4eb 100644 --- a/src/GToolkit-Coder-Extensions/Behavior.extension.st +++ b/src/GToolkit-Coder-Extensions/Behavior.extension.st @@ -16,5 +16,5 @@ Behavior >> gtBrowseFrom: anElement [ Behavior >> methodsCoderFromContext: aPhlowContext [ - ^ (GtClassMethodsCoder forClass: self) asCoderUIModel + ^ (GtClassMethodsCoder forClass: self) asCoderViewModel ] diff --git a/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModel.class.st b/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModel.class.st index d05519d0b..92273ffde 100644 --- a/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModel.class.st +++ b/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModel.class.st @@ -60,7 +60,7 @@ GtStreamingCodersViewModel >> initialize [ { #category : #'instance creation' } GtStreamingCodersViewModel >> newCoderViewModelFor: aCoderModel [ - ^ aCoderModel asCoderUIModel + ^ aCoderModel asCoderViewModel ] { #category : #'private - notifying' } diff --git a/src/GToolkit-Coder-UI/GtCoder2.class.st b/src/GToolkit-Coder-UI/GtCoder2.class.st index 3025da786..9a75f6bb2 100644 --- a/src/GToolkit-Coder-UI/GtCoder2.class.st +++ b/src/GToolkit-Coder-UI/GtCoder2.class.st @@ -75,7 +75,7 @@ GtCoder2 >> initialize [ when: GtCoderToReplace do: [ :anEvent | anEvent consumed: true. - self coderToolViewModel pushCoderViewModel: anEvent coder asCoderUIModel ]. + self coderToolViewModel pushCoderViewModel: anEvent coder asCoderViewModel ]. ] diff --git a/src/GToolkit-Coder-UI/GtCoderModel.extension.st b/src/GToolkit-Coder-UI/GtCoderModel.extension.st index 977615893..f2a851617 100644 --- a/src/GToolkit-Coder-UI/GtCoderModel.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderModel.extension.st @@ -1,13 +1,13 @@ Extension { #name : #GtCoderModel } { #category : #'*GToolkit-Coder-UI' } -GtCoderModel >> asCoderUIModel [ +GtCoderModel >> asCoderViewModel [ ^ self subclassResponsibility ] { #category : #'*GToolkit-Coder-UI' } GtCoderModel >> asElement [ - ^ self asCoderUIModel asElement + ^ self asCoderViewModel asElement ] { #category : #'*GToolkit-Coder-UI' } @@ -15,7 +15,7 @@ GtCoderModel >> asExpandedOnlyElement [ "Create an element for just the expanded coder without expander" ^ GtExpandedOnlyCoderElement new - coderUIModel: self asCoderUIModel; + coderUIModel: self asCoderViewModel; yourself ] diff --git a/src/GToolkit-Coder-UI/GtCodersModel.extension.st b/src/GToolkit-Coder-UI/GtCodersModel.extension.st index b144255a3..b5c6fb74d 100644 --- a/src/GToolkit-Coder-UI/GtCodersModel.extension.st +++ b/src/GToolkit-Coder-UI/GtCodersModel.extension.st @@ -1,11 +1,11 @@ Extension { #name : #GtCodersModel } { #category : #'*GToolkit-Coder-UI' } -GtCodersModel >> asCoderUIModel [ +GtCodersModel >> asCoderViewModel [ ^ self subclassResponsibility ] { #category : #'*GToolkit-Coder-UI' } GtCodersModel >> asElement [ - ^ self asCoderUIModel asElement + ^ self asCoderViewModel asElement ] diff --git a/src/GToolkit-Coder-UI/GtMultipleCodersViewModel.class.st b/src/GToolkit-Coder-UI/GtMultipleCodersViewModel.class.st index 8b18e6f5a..f98e06d98 100644 --- a/src/GToolkit-Coder-UI/GtMultipleCodersViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtMultipleCodersViewModel.class.st @@ -5,7 +5,7 @@ Class { 'coder', 'coderUIModels' ], - #category : 'GToolkit-Coder-UI-Coder - Basic' + #category : #'GToolkit-Coder-UI-Coder - Basic' } { #category : #accessing } @@ -18,7 +18,7 @@ GtMultipleCodersViewModel >> announcer [ ] { #category : #converting } -GtMultipleCodersViewModel >> asCoderUIModel [ +GtMultipleCodersViewModel >> asCoderViewModel [ ^ self ] @@ -44,7 +44,7 @@ GtMultipleCodersViewModel >> coder: aGtCodersModel [ { #category : #updating } GtMultipleCodersViewModel >> coderUIModelFor: aCoder [ - ^ aCoder asCoderUIModel + ^ aCoder asCoderViewModel ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st index e9ec13517..bd0474206 100644 --- a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st @@ -27,7 +27,7 @@ GtSingleCoderViewModel >> announcerUIModel [ ] { #category : #converting } -GtSingleCoderViewModel >> asCoderUIModel [ +GtSingleCoderViewModel >> asCoderViewModel [ ^ self ] diff --git a/src/GToolkit-Coder-UI/GtTextCoder.extension.st b/src/GToolkit-Coder-UI/GtTextCoder.extension.st index 6f65a9f19..d2187b3e0 100644 --- a/src/GToolkit-Coder-UI/GtTextCoder.extension.st +++ b/src/GToolkit-Coder-UI/GtTextCoder.extension.st @@ -1,6 +1,6 @@ Extension { #name : #GtTextCoder } { #category : #'*GToolkit-Coder-UI' } -GtTextCoder >> asCoderUIModel [ +GtTextCoder >> asCoderViewModel [ ^ GtTextualCoderViewModel new coder: self ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 64e82e1d8..e0cba08d9 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -143,7 +143,7 @@ GtTextualCoderViewModel >> asExpandedOnlyElement [ "Create an element for just the expanded coder without expander" ^ GtExpandedOnlyCoderElement new - coderUIModel: self asCoderUIModel; + coderUIModel: self asCoderViewModel; yourself ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.extension.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.extension.st index 95bbf7fd7..44151f47d 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.extension.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.extension.st @@ -5,6 +5,6 @@ GtTextualCoderViewModel >> asExpandedOnlyElement [ "Create an element for just the expanded coder without expander" ^ GtExpandedOnlyCoderElement new - coderUIModel: self asCoderUIModel; + coderUIModel: self asCoderViewModel; yourself ] From afb3710f11909f7a37e5c6df85746d91033cdf55 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Wed, 12 Jan 2022 17:30:07 +0100 Subject: [PATCH 0141/1268] remove coder worker pool --- .../BlTktWorkerProvider.extension.st | 49 ------------------- 1 file changed, 49 deletions(-) delete mode 100644 src/GToolkit-Coder/BlTktWorkerProvider.extension.st diff --git a/src/GToolkit-Coder/BlTktWorkerProvider.extension.st b/src/GToolkit-Coder/BlTktWorkerProvider.extension.st deleted file mode 100644 index ebef3f5a2..000000000 --- a/src/GToolkit-Coder/BlTktWorkerProvider.extension.st +++ /dev/null @@ -1,49 +0,0 @@ -Extension { #name : #BlTktWorkerProvider } - -{ #category : #'*GToolkit-Coder' } -BlTktWorkerProvider class >> coderAddOnsPool [ - - ^ self - serviceNamed: self coderAddOnsPoolName - ifMissing: [ self new coderAddOnsPool; service ] -] - -{ #category : #'*GToolkit-Coder' } -BlTktWorkerProvider >> coderAddOnsPool [ - "Coder addons computation: maxPoolSize: 2, priority: 30" - self - name: self class coderAddOnsPoolName; - priorityQueue; - poolMaxSize: 2; - nonUIPriority -] - -{ #category : #'*GToolkit-Coder' } -BlTktWorkerProvider class >> coderAddOnsPoolName [ - - ^ 'Coder addons' -] - -{ #category : #'*GToolkit-Coder' } -BlTktWorkerProvider class >> coderAstPool [ - - ^ self - serviceNamed: self coderAstPoolName - ifMissing: [ self new coderAstPool; service ] -] - -{ #category : #'*GToolkit-Coder' } -BlTktWorkerProvider >> coderAstPool [ - "Coder computation processing: maxPoolSize: 2, priority: 30" - self - name: self class coderAstPoolName; - priorityQueue; - poolMaxSize: 2; - nonUIPriority -] - -{ #category : #'*GToolkit-Coder' } -BlTktWorkerProvider class >> coderAstPoolName [ - - ^ 'Coder ast' -] From a550e68b8fcff208153e2e22347b16eecd31d44e Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 12 Jan 2022 11:01:52 -0600 Subject: [PATCH 0142/1268] More coderUIModel renaming --- .../GtCoderActionsElement.class.st | 8 ++++---- .../GtCoderActivatableAction.extension.st | 4 ++-- .../GtCoderCodeExecutor.class.st | 8 ++++---- .../GtCoderModel.extension.st | 2 +- .../GtExpandableSourceCoderElement.class.st | 6 +++--- .../GtExpandedOnlyCoderElement.class.st | 20 +++++++++---------- .../GtSingleCoderViewModel.class.st | 2 +- ...ourceCoderCollapsedContentElement.class.st | 2 +- .../GtSourceCoderContentElement.class.st | 10 +++++----- ...SourceCoderExpandedContentElement.class.st | 2 +- .../GtTextualCoderEditorElement.class.st | 2 +- .../GtTextualCoderViewModel.class.st | 2 +- .../GtTextualCoderViewModel.extension.st | 2 +- .../GtCoderPreviewStencilBuilder.class.st | 8 ++++---- src/GToolkit-Coder/GtTextualCoder.class.st | 1 + 15 files changed, 40 insertions(+), 39 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st index 2d464fe2e..9328e869a 100644 --- a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st @@ -9,7 +9,7 @@ Class { 'separator', 'editor' ], - #category : 'GToolkit-Coder-UI-Coder - Basic' + #category : #'GToolkit-Coder-UI-Coder - Basic' } { #category : #private } @@ -33,13 +33,13 @@ GtCoderActionsElement >> addMainToolbarActions [ ] { #category : #accessing } -GtCoderActionsElement >> coderUIModel [ +GtCoderActionsElement >> coderViewModel [ ^ self textualCoderViewModel ] { #category : #accessing } -GtCoderActionsElement >> coderUIModel: aCoderUIModel [ - self textualCoderViewModel: aCoderUIModel +GtCoderActionsElement >> coderViewModel: aCoderViewModel [ + self textualCoderViewModel: aCoderViewModel ] { #category : #'private - event handling' } diff --git a/src/GToolkit-Coder-UI/GtCoderActivatableAction.extension.st b/src/GToolkit-Coder-UI/GtCoderActivatableAction.extension.st index 7393539ad..e04d30145 100644 --- a/src/GToolkit-Coder-UI/GtCoderActivatableAction.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderActivatableAction.extension.st @@ -5,10 +5,10 @@ GtCoderActivatableAction >> buildElementIn: aCoderActionsElement [ | aButton | aButton := aCoderActionsElement newButtonForAction: self. - aButton enabled: (enabledBlock cull: aCoderActionsElement coderUIModel). + aButton enabled: (enabledBlock cull: aCoderActionsElement coderViewModel). updateAnnouncement ifNotNil: [ - aCoderActionsElement coderUIModel announcerUIModel weak + aCoderActionsElement coderViewModel announcerUIModel weak when: updateAnnouncement send: #enabled: to: aButton ]. ^ aButton diff --git a/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st b/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st index 2a5c976c9..d457e3127 100644 --- a/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st +++ b/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st @@ -42,16 +42,16 @@ GtCoderCodeExecutor class >> playAllAndInspect [ { #category : #'private - accessing' } GtCoderCodeExecutor >> coder [ - ^ self coderUIModel coder + ^ self coderViewModel coder ] { #category : #'api - accessing' } -GtCoderCodeExecutor >> coderUIModel [ +GtCoderCodeExecutor >> coderViewModel [ ^ coderUIModel ] { #category : #'api - accessing' } -GtCoderCodeExecutor >> coderUIModel: anObject [ +GtCoderCodeExecutor >> coderViewModel: anObject [ coderUIModel := anObject ] @@ -100,7 +100,7 @@ GtCoderCodeExecutor >> event: anObject [ GtCoderCodeExecutor >> execute [ GtCoderExecutionContextVariable element: self element - do: [ self coderUIModel perform: action ] + do: [ self coderViewModel perform: action ] ] { #category : #initialization } diff --git a/src/GToolkit-Coder-UI/GtCoderModel.extension.st b/src/GToolkit-Coder-UI/GtCoderModel.extension.st index f2a851617..780141be3 100644 --- a/src/GToolkit-Coder-UI/GtCoderModel.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderModel.extension.st @@ -15,7 +15,7 @@ GtCoderModel >> asExpandedOnlyElement [ "Create an element for just the expanded coder without expander" ^ GtExpandedOnlyCoderElement new - coderUIModel: self asCoderViewModel; + coderViewModel: self asCoderViewModel; yourself ] diff --git a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st index 0c87e0328..c1e8b7957 100644 --- a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st @@ -44,14 +44,14 @@ GtExpandableSourceCoderElement >> assignExpandedCoder: aTextualCoderViewModel to ] { #category : #accessing } -GtExpandableSourceCoderElement >> coderUIModel [ +GtExpandableSourceCoderElement >> coderViewModel [ ^ self textualCoderViewModel ] { #category : #accessing } -GtExpandableSourceCoderElement >> coderUIModel: aCoderUIModel [ - self textualCoderViewModel: aCoderUIModel +GtExpandableSourceCoderElement >> coderViewModel: aCoderViewModel [ + self textualCoderViewModel: aCoderViewModel ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st b/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st index 05327d8da..6d11ced9e 100644 --- a/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st @@ -26,33 +26,33 @@ GtExpandedOnlyCoderElement >> coder: aCoderUIModel [ deprecated: 'Use #coderUIModel: instead.' transformWith: '`@receiver coder: `@arg' -> '`@receiver coderUIModel: `@arg'. - ^ self coderUIModel: aCoderUIModel + ^ self coderViewModel: aCoderUIModel ] { #category : #accessing } -GtExpandedOnlyCoderElement >> coderUIModel [ +GtExpandedOnlyCoderElement >> coderViewModel [ ^ coderUIModel ] { #category : #accessing } -GtExpandedOnlyCoderElement >> coderUIModel: aCoderUIModel [ +GtExpandedOnlyCoderElement >> coderViewModel: aCoderViewModel [ self - assert: [ aCoderUIModel isNotNil ] + assert: [ aCoderViewModel isNotNil ] description: [ 'Coder must not be nil' ]. - coderUIModel == aCoderUIModel ifTrue: [ ^ self ]. + coderUIModel == aCoderViewModel ifTrue: [ ^ self ]. coderUIModel ifNotNil: [ coderUIModel coder announcer unsubscribe: self. - coderUIModel := aCoderUIModel. - expandedElement coderUIModel: aCoderUIModel. + coderUIModel := aCoderViewModel. + expandedElement coderViewModel: aCoderViewModel. ^ self ]. - coderUIModel := aCoderUIModel. - expandedElement := self newExpandedElement: aCoderUIModel. + coderUIModel := aCoderViewModel. + expandedElement := self newExpandedElement: aCoderViewModel. self addChild: expandedElement. self addAptitude: (BrLayoutResizerAptitude new inherit: expandedElement). - aCoderUIModel expanded: true + aCoderViewModel expanded: true ] { #category : #initialization } diff --git a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st index bd0474206..32033a19f 100644 --- a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st @@ -34,7 +34,7 @@ GtSingleCoderViewModel >> asCoderViewModel [ { #category : #converting } GtSingleCoderViewModel >> asElement [ ^ self elementClass new - coderUIModel: self; + coderViewModel: self; yourself ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st index ce37f7713..3235d0a04 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st @@ -38,7 +38,7 @@ GtSourceCoderCollapsedContentElement >> newAddOnsContainer [ aContainer removeChildren. theAddOns previews do: [ :eachAddOn | (eachAddOn stencilBuilder - coderUIModel: textualCoderViewModel; + coderViewModel: textualCoderViewModel; build) ifNotNil: [ :eachAddOnStencil | aContainer addChild: eachAddOnStencil asElement ] ] ]; whenError: [ :aContainer :anError | diff --git a/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st index d660f48e5..7ae2fbfb7 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st @@ -15,7 +15,7 @@ GtSourceCoderContentElement >> coder [ deprecated: 'Use #coderUIModel instead.' transformWith: '`@receiver coder' -> '`@receiver coderUIModel'. - ^ self coderUIModel + ^ self coderViewModel ] { #category : #accessing } @@ -25,22 +25,22 @@ GtSourceCoderContentElement >> coder: aCoder [ deprecated: 'Use #coderUIModel: instead.' transformWith: '`@receiver coder: `@arg' -> '`@receiver coderUIModel: `@arg'. - self coderUIModel: aCoder + self coderViewModel: aCoder ] { #category : #accessing } -GtSourceCoderContentElement >> coderUIModel [ +GtSourceCoderContentElement >> coderViewModel [ ^ self viewModel sourceCoder ] { #category : #accessing } -GtSourceCoderContentElement >> coderUIModel: aGtSourceCoderUIModel [ +GtSourceCoderContentElement >> coderViewModel: aGtSourceCoderViewModel [ BlFrameTelemetry time: [ 'Assign coder to {1}' format: { self class name } ] - during: [ self textualCoderViewModel: aGtSourceCoderUIModel ] + during: [ self textualCoderViewModel: aGtSourceCoderViewModel ] ] { #category : #initialization } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st index 21f189bfa..9b59d892d 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st @@ -37,6 +37,6 @@ GtSourceCoderExpandedContentElement >> newEditorElement [ GtSourceCoderExpandedContentElement >> onTextualCoderViewModelChanged [ super onTextualCoderViewModelChanged. - actions coderUIModel: textualCoderViewModel. + actions coderViewModel: textualCoderViewModel. editorElement textualCoderViewModel: textualCoderViewModel ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 48a256776..0f6d93063 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -13,7 +13,7 @@ Class { } { #category : #'api - textual coder view model' } -GtTextualCoderEditorElement >> coderUIModel: aTextualCoderViewModel [ +GtTextualCoderEditorElement >> coderViewModel: aTextualCoderViewModel [ self textualCoderViewModel: aTextualCoderViewModel ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index e0cba08d9..562b6f2fc 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -143,7 +143,7 @@ GtTextualCoderViewModel >> asExpandedOnlyElement [ "Create an element for just the expanded coder without expander" ^ GtExpandedOnlyCoderElement new - coderUIModel: self asCoderViewModel; + coderViewModel: self asCoderViewModel; yourself ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.extension.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.extension.st index 44151f47d..d4ee61468 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.extension.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.extension.st @@ -5,6 +5,6 @@ GtTextualCoderViewModel >> asExpandedOnlyElement [ "Create an element for just the expanded coder without expander" ^ GtExpandedOnlyCoderElement new - coderUIModel: self asCoderViewModel; + coderViewModel: self asCoderViewModel; yourself ] diff --git a/src/GToolkit-Coder/GtCoderPreviewStencilBuilder.class.st b/src/GToolkit-Coder/GtCoderPreviewStencilBuilder.class.st index e51b07986..acc1df141 100644 --- a/src/GToolkit-Coder/GtCoderPreviewStencilBuilder.class.st +++ b/src/GToolkit-Coder/GtCoderPreviewStencilBuilder.class.st @@ -15,20 +15,20 @@ GtCoderPreviewStencilBuilder >> buildDefault [ ] { #category : #accessing } -GtCoderPreviewStencilBuilder >> coderUIModel [ +GtCoderPreviewStencilBuilder >> coderViewModel [ ^ coderUIModel ] { #category : #accessing } -GtCoderPreviewStencilBuilder >> coderUIModel: aCoderUIModel [ - coderUIModel := aCoderUIModel +GtCoderPreviewStencilBuilder >> coderViewModel: aCoderViewModel [ + coderUIModel := aCoderViewModel ] { #category : #'api - instantiation' } GtCoderPreviewStencilBuilder >> paramsOn: aStencilExecutor [ super paramsOn: aStencilExecutor. aStencilExecutor - push: self coderUIModel + push: self coderViewModel ] { #category : #initialization } diff --git a/src/GToolkit-Coder/GtTextualCoder.class.st b/src/GToolkit-Coder/GtTextualCoder.class.st index d5583e532..d6d2a2dce 100644 --- a/src/GToolkit-Coder/GtTextualCoder.class.st +++ b/src/GToolkit-Coder/GtTextualCoder.class.st @@ -276,6 +276,7 @@ GtTextualCoder >> resetAstCache [ { #category : #'event handling' } GtTextualCoder >> sourceChangedTo: aNewText [ + | x | self sourceChangedTo: aNewText with: GtCoderUpdateStrategy new makeAsynchronous From ec78c5560d6a9c5a9060e4a4ec037ef9246edb64 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Wed, 12 Jan 2022 22:35:41 +0100 Subject: [PATCH 0143/1268] #styleText does not have to be wrapped in a task. do not disable text styling when modified --- .../GtTextualCoderEditorElement.class.st | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 48a256776..88f4640e0 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -60,9 +60,9 @@ GtTextualCoderEditorElement >> initialize [ vFitContent. self editor - beEditableCode; - disableStyleTextWhenModified. - + beEditableCode"; + disableStyleTextWhenModified". + self id: GtSourceCoderEditorId. shortcuts := #(). @@ -303,7 +303,7 @@ GtTextualCoderEditorElement >> onViewModelCursorsChanged: aCursorsChangedAnnounc { #category : #'private - event handling' } GtTextualCoderEditorElement >> onViewModelReadyToStyle [ - self enqueueTask: (BlTaskAction new action: [ self editor styleText ]) + self styleText ] { #category : #'private - event handling' } From e9ca5ed8d732417f6ca7186fb0797bb99b110747 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Wed, 12 Jan 2022 22:37:30 +0100 Subject: [PATCH 0144/1268] remove unused temp var --- src/GToolkit-Coder/GtTextualCoder.class.st | 1 - 1 file changed, 1 deletion(-) diff --git a/src/GToolkit-Coder/GtTextualCoder.class.st b/src/GToolkit-Coder/GtTextualCoder.class.st index d6d2a2dce..d5583e532 100644 --- a/src/GToolkit-Coder/GtTextualCoder.class.st +++ b/src/GToolkit-Coder/GtTextualCoder.class.st @@ -276,7 +276,6 @@ GtTextualCoder >> resetAstCache [ { #category : #'event handling' } GtTextualCoder >> sourceChangedTo: aNewText [ - | x | self sourceChangedTo: aNewText with: GtCoderUpdateStrategy new makeAsynchronous From 3b26ef1a260ba31ad6f73ed8f5dbf28fc50fbb2a Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 13 Jan 2022 17:11:28 +0100 Subject: [PATCH 0145/1268] reuse coder preview addon elements when re-binding the coder view model --- ...ourceCoderCollapsedContentElement.class.st | 21 +++++-- src/GToolkit-Coder/GtCoderAction.class.st | 2 +- .../GtCoderActivatableAction.class.st | 2 +- src/GToolkit-Coder/GtCoderAddOns.class.st | 10 ++-- .../GtCoderContextMenuAction.class.st | 2 +- .../GtCoderCustomAction.class.st | 2 +- .../GtCoderDropDownAction.class.st | 2 +- .../GtCoderDropDownWithPreviewAction.class.st | 2 +- src/GToolkit-Coder/GtCoderPreview.class.st | 60 ++++++++++++++++--- .../GtCoderPreviewDataBinder.class.st | 53 ++++++++++++++++ .../GtCoderPreviewStencilBuilder.class.st | 38 ------------ 11 files changed, 133 insertions(+), 61 deletions(-) create mode 100644 src/GToolkit-Coder/GtCoderPreviewDataBinder.class.st delete mode 100644 src/GToolkit-Coder/GtCoderPreviewStencilBuilder.class.st diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st index 3235d0a04..7594b1cec 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st @@ -4,7 +4,8 @@ Class { #instVars : [ 'label', 'addOns', - 'content' + 'content', + 'previews' ], #category : #'GToolkit-Coder-UI-Coder - Source' } @@ -22,8 +23,10 @@ GtSourceCoderCollapsedContentElement >> initialize [ label := self newLabel. addOns := self newAddOnsContainer. + previews := Dictionary new. + content addChildren: { label. addOns }. - self addChild: content + self addChild: content. ] { #category : #'instance creation' } @@ -37,10 +40,18 @@ GtSourceCoderCollapsedContentElement >> newAddOnsContainer [ whenSuccess: [ :aContainer :theAddOns | aContainer removeChildren. theAddOns previews do: [ :eachAddOn | - (eachAddOn stencilBuilder + | eachAddOnElement | + + eachAddOnElement := previews + at: eachAddOn id + ifAbsentPut: [ eachAddOn stencil asElement ]. + + eachAddOn dataBinder + element: eachAddOnElement; coderViewModel: textualCoderViewModel; - build) ifNotNil: [ :eachAddOnStencil | - aContainer addChild: eachAddOnStencil asElement ] ] ]; + build. + + aContainer addChild: eachAddOnElement ] ]; whenError: [ :aContainer :anError | aContainer removeChildren. aContainer addChild: (BrLabel new aptitude: BrGlamorousLabelAptitude; text: anError printString) ]; diff --git a/src/GToolkit-Coder/GtCoderAction.class.st b/src/GToolkit-Coder/GtCoderAction.class.st index a1d5c9947..c9995fece 100644 --- a/src/GToolkit-Coder/GtCoderAction.class.st +++ b/src/GToolkit-Coder/GtCoderAction.class.st @@ -7,7 +7,7 @@ Class { 'action', 'id' ], - #category : 'GToolkit-Coder' + #category : #'GToolkit-Coder-Coders - Addons' } { #category : #comparing } diff --git a/src/GToolkit-Coder/GtCoderActivatableAction.class.st b/src/GToolkit-Coder/GtCoderActivatableAction.class.st index 5b412952b..0cae8b08b 100644 --- a/src/GToolkit-Coder/GtCoderActivatableAction.class.st +++ b/src/GToolkit-Coder/GtCoderActivatableAction.class.st @@ -5,7 +5,7 @@ Class { 'enabledBlock', 'updateAnnouncement' ], - #category : 'GToolkit-Coder' + #category : #'GToolkit-Coder-Coders - Addons' } { #category : #accessing } diff --git a/src/GToolkit-Coder/GtCoderAddOns.class.st b/src/GToolkit-Coder/GtCoderAddOns.class.st index 4ec0c9e1a..21680861f 100644 --- a/src/GToolkit-Coder/GtCoderAddOns.class.st +++ b/src/GToolkit-Coder/GtCoderAddOns.class.st @@ -172,17 +172,17 @@ GtCoderAddOns >> addOrUpdateShortcut: aBlShortcut to: aCollection [ { #category : #'api - previews' } GtCoderAddOns >> addPreview: aCoderPreview [ - self previews add: aCoderPreview ] { #category : #'api - previews' } -GtCoderAddOns >> addPreview: aString stencil: aStencilBuilder [ - +GtCoderAddOns >> addPreview: aString stencil: aStencil dataBinder: aCoderPreviewDataBinder [ self addPreview: (GtCoderPreview new + id: aString; title: aString; - stencil: aStencilBuilder). + stencil: aStencil; + dataBinder: aCoderPreviewDataBinder) ] { #category : #'api - previews' } @@ -222,7 +222,7 @@ GtCoderAddOns >> differenceWith: aGtCoderAddOns on: aStream [ self assert: [ self class = aGtCoderAddOns class ] description: [ 'Coder AddOns type must be identical to compute the difference' ]. - + self mainActions = aGtCoderAddOns mainActions ifFalse: [ aStream nextPut: GtCoderAddOnsMainActionsDifference new ]. diff --git a/src/GToolkit-Coder/GtCoderContextMenuAction.class.st b/src/GToolkit-Coder/GtCoderContextMenuAction.class.st index 2ae2a5fc2..3ddf2a155 100644 --- a/src/GToolkit-Coder/GtCoderContextMenuAction.class.st +++ b/src/GToolkit-Coder/GtCoderContextMenuAction.class.st @@ -5,7 +5,7 @@ Class { 'hoverAction', 'leaveAction' ], - #category : 'GToolkit-Coder' + #category : #'GToolkit-Coder-Coders - Addons' } { #category : #accessing } diff --git a/src/GToolkit-Coder/GtCoderCustomAction.class.st b/src/GToolkit-Coder/GtCoderCustomAction.class.st index e42807ad6..e5dd014c9 100644 --- a/src/GToolkit-Coder/GtCoderCustomAction.class.st +++ b/src/GToolkit-Coder/GtCoderCustomAction.class.st @@ -4,7 +4,7 @@ Class { #instVars : [ 'stencil' ], - #category : #'GToolkit-Coder' + #category : #'GToolkit-Coder-Coders - Addons' } { #category : #accessing } diff --git a/src/GToolkit-Coder/GtCoderDropDownAction.class.st b/src/GToolkit-Coder/GtCoderDropDownAction.class.st index 80309a279..83b7f461c 100644 --- a/src/GToolkit-Coder/GtCoderDropDownAction.class.st +++ b/src/GToolkit-Coder/GtCoderDropDownAction.class.st @@ -4,7 +4,7 @@ Class { #instVars : [ 'stencil' ], - #category : 'GToolkit-Coder' + #category : #'GToolkit-Coder-Coders - Addons' } { #category : #accessing } diff --git a/src/GToolkit-Coder/GtCoderDropDownWithPreviewAction.class.st b/src/GToolkit-Coder/GtCoderDropDownWithPreviewAction.class.st index 511bbd02f..f247e1c56 100644 --- a/src/GToolkit-Coder/GtCoderDropDownWithPreviewAction.class.st +++ b/src/GToolkit-Coder/GtCoderDropDownWithPreviewAction.class.st @@ -5,7 +5,7 @@ Class { 'changeAction', 'changeStencil' ], - #category : 'GToolkit-Coder-GToolkit-Coder' + #category : #'GToolkit-Coder-Coders - Addons' } { #category : #accessing } diff --git a/src/GToolkit-Coder/GtCoderPreview.class.st b/src/GToolkit-Coder/GtCoderPreview.class.st index 558368f9f..2aa5621e7 100644 --- a/src/GToolkit-Coder/GtCoderPreview.class.st +++ b/src/GToolkit-Coder/GtCoderPreview.class.st @@ -2,23 +2,69 @@ Class { #name : #GtCoderPreview, #superclass : #Object, #instVars : [ + 'id', 'title', - 'stencilBuilder' + 'stencil', + 'dataBinder' ], - #category : #'GToolkit-Coder' + #category : #'GToolkit-Coder-Coders - Addons' } +{ #category : #comparing } +GtCoderPreview >> = anObject [ + + "Answer whether the receiver and anObject represent the same object." + + self == anObject ifTrue: [ ^ true ]. + self class = anObject class ifFalse: [ ^ false ]. + ^ id = anObject id +] + { #category : #accessing } -GtCoderPreview >> stencil: aStencilBuilder [ +GtCoderPreview >> dataBinder [ - stencilBuilder := aStencilBuilder asStencilBuilder: - GtCoderPreviewStencilBuilder + ^ dataBinder ] { #category : #accessing } -GtCoderPreview >> stencilBuilder [ +GtCoderPreview >> dataBinder: aStencil [ + dataBinder := aStencil asStencilBuilder: GtCoderPreviewDataBinder +] + +{ #category : #comparing } +GtCoderPreview >> hash [ + + "Answer an integer value that is related to the identity of the receiver." + + ^ id hash +] + +{ #category : #accessing } +GtCoderPreview >> id [ + + ^ id +] + +{ #category : #accessing } +GtCoderPreview >> id: anObject [ + "Assign an action id which is used to uniquely identify an action" - ^ stencilBuilder + id := anObject +] + +{ #category : #accessing } +GtCoderPreview >> stencil [ + ^ stencil +] + +{ #category : #accessing } +GtCoderPreview >> stencil: aStencil [ + stencil := aStencil asStencil +] + +{ #category : #accessing } +GtCoderPreview >> stencilBuilder [ + ^ self stencil ] { #category : #accessing } diff --git a/src/GToolkit-Coder/GtCoderPreviewDataBinder.class.st b/src/GToolkit-Coder/GtCoderPreviewDataBinder.class.st new file mode 100644 index 000000000..d6cfc8211 --- /dev/null +++ b/src/GToolkit-Coder/GtCoderPreviewDataBinder.class.st @@ -0,0 +1,53 @@ +Class { + #name : #GtCoderPreviewDataBinder, + #superclass : #BrStencilBuilder, + #instVars : [ + 'element', + 'coderViewModel' + ], + #category : #'GToolkit-Coder-Coders - Addons' +} + +{ #category : #'api - instantiation' } +GtCoderPreviewDataBinder >> buildDefault [ + + + ^ BlElement new size: 0@0 +] + +{ #category : #accessing } +GtCoderPreviewDataBinder >> coderViewModel [ + ^ coderViewModel +] + +{ #category : #accessing } +GtCoderPreviewDataBinder >> coderViewModel: aCoderViewModel [ + coderViewModel := aCoderViewModel +] + +{ #category : #accessing } +GtCoderPreviewDataBinder >> element [ + + ^ element +] + +{ #category : #accessing } +GtCoderPreviewDataBinder >> element: anObject [ + + element := anObject +] + +{ #category : #'api - instantiation' } +GtCoderPreviewDataBinder >> paramsOn: aStencilExecutor [ + super paramsOn: aStencilExecutor. + + aStencilExecutor + push: self element; + push: self coderViewModel +] + +{ #category : #initialization } +GtCoderPreviewDataBinder >> reset [ + super reset. + coderViewModel := nil. +] diff --git a/src/GToolkit-Coder/GtCoderPreviewStencilBuilder.class.st b/src/GToolkit-Coder/GtCoderPreviewStencilBuilder.class.st deleted file mode 100644 index acc1df141..000000000 --- a/src/GToolkit-Coder/GtCoderPreviewStencilBuilder.class.st +++ /dev/null @@ -1,38 +0,0 @@ -Class { - #name : #GtCoderPreviewStencilBuilder, - #superclass : #BrStencilBuilder, - #instVars : [ - 'coderUIModel' - ], - #category : #'GToolkit-Coder' -} - -{ #category : #'api - instantiation' } -GtCoderPreviewStencilBuilder >> buildDefault [ - - - ^ BlElement new size: 0@0 -] - -{ #category : #accessing } -GtCoderPreviewStencilBuilder >> coderViewModel [ - ^ coderUIModel -] - -{ #category : #accessing } -GtCoderPreviewStencilBuilder >> coderViewModel: aCoderViewModel [ - coderUIModel := aCoderViewModel -] - -{ #category : #'api - instantiation' } -GtCoderPreviewStencilBuilder >> paramsOn: aStencilExecutor [ - super paramsOn: aStencilExecutor. - aStencilExecutor - push: self coderViewModel -] - -{ #category : #initialization } -GtCoderPreviewStencilBuilder >> reset [ - super reset. - coderUIModel := nil. -] From f2c48886129d5b3a46f8219bcc36a665777b07c6 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 13 Jan 2022 17:15:34 +0100 Subject: [PATCH 0146/1268] add back addPreview:stencil: for compatibility --- src/GToolkit-Coder/GtCoderAddOns.class.st | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/GToolkit-Coder/GtCoderAddOns.class.st b/src/GToolkit-Coder/GtCoderAddOns.class.st index 21680861f..1db6bfef8 100644 --- a/src/GToolkit-Coder/GtCoderAddOns.class.st +++ b/src/GToolkit-Coder/GtCoderAddOns.class.st @@ -176,6 +176,15 @@ GtCoderAddOns >> addPreview: aCoderPreview [ ] +{ #category : #'api - previews' } +GtCoderAddOns >> addPreview: aString stencil: aStencil [ + self addPreview: (GtCoderPreview new + id: aString; + title: aString; + stencil: [ BrFrame new fitContent ]; + dataBinder: [ :anElement :aViewModel | anElement removeChildren; addChild: aStencil asElement ]) +] + { #category : #'api - previews' } GtCoderAddOns >> addPreview: aString stencil: aStencil dataBinder: aCoderPreviewDataBinder [ self addPreview: (GtCoderPreview new From 2a456879a102c2f1ff7e845599f13efc2b1d21fe Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 14 Jan 2022 06:08:30 -0600 Subject: [PATCH 0147/1268] Make Class editors update when unlying class changes. [feenkcom/#2369] --- .../GtBehaviorDefinitionCoderUIModel.class.st | 10 ------- ...tBehaviorDefinitionCoderViewModel.class.st | 28 +++++++++++++++++++ .../GtClassesCoderUIModel.class.st | 10 ------- .../GtClassesCoderViewModel.class.st | 10 +++++++ .../GtPackagesCoderUIModel.class.st | 10 ------- .../GtPackagesCoderViewModel.class.st | 10 +++++++ src/GToolkit-Coder/GtCoderClassAdded.class.st | 4 +-- .../GtCoderClassChanged.class.st | 5 ++++ .../GtCoderClassRemoved.class.st | 4 +-- .../GtCoderClassRenamed.class.st | 4 +-- 10 files changed, 59 insertions(+), 36 deletions(-) delete mode 100644 src/GToolkit-Coder-UI/GtBehaviorDefinitionCoderUIModel.class.st create mode 100644 src/GToolkit-Coder-UI/GtBehaviorDefinitionCoderViewModel.class.st delete mode 100644 src/GToolkit-Coder-UI/GtClassesCoderUIModel.class.st create mode 100644 src/GToolkit-Coder-UI/GtClassesCoderViewModel.class.st delete mode 100644 src/GToolkit-Coder-UI/GtPackagesCoderUIModel.class.st create mode 100644 src/GToolkit-Coder-UI/GtPackagesCoderViewModel.class.st create mode 100644 src/GToolkit-Coder/GtCoderClassChanged.class.st diff --git a/src/GToolkit-Coder-UI/GtBehaviorDefinitionCoderUIModel.class.st b/src/GToolkit-Coder-UI/GtBehaviorDefinitionCoderUIModel.class.st deleted file mode 100644 index 6a55a2a1a..000000000 --- a/src/GToolkit-Coder-UI/GtBehaviorDefinitionCoderUIModel.class.st +++ /dev/null @@ -1,10 +0,0 @@ -Class { - #name : #GtBehaviorDefinitionCoderUIModel, - #superclass : #GtSingleCoderViewModel, - #category : 'GToolkit-Coder-UI-Coder - Behavior-Definition Model' -} - -{ #category : #accessing } -GtBehaviorDefinitionCoderUIModel >> elementClass [ - ^ GtPharoBehaviorDefinitionCoderElement -] diff --git a/src/GToolkit-Coder-UI/GtBehaviorDefinitionCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtBehaviorDefinitionCoderViewModel.class.st new file mode 100644 index 000000000..0804ef882 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtBehaviorDefinitionCoderViewModel.class.st @@ -0,0 +1,28 @@ +Class { + #name : #GtBehaviorDefinitionCoderViewModel, + #superclass : #GtSingleCoderViewModel, + #instVars : [ + 'foo' + ], + #category : #'GToolkit-Coder-UI-Coder - Behavior-Definition Model' +} + +{ #category : #accessing } +GtBehaviorDefinitionCoderViewModel >> elementClass [ + ^ GtPharoBehaviorDefinitionCoderElement +] + +{ #category : #accessing } +GtBehaviorDefinitionCoderViewModel >> onClassChanged: anAnnouncment [ + self announce: anAnnouncment +] + +{ #category : #accessing } +GtBehaviorDefinitionCoderViewModel >> subscribeToCoderModel [ + super subscribeToCoderModel. + + self coderModel weak + when: GtCoderClassChanged + send: #onClassChanged: + to: self +] diff --git a/src/GToolkit-Coder-UI/GtClassesCoderUIModel.class.st b/src/GToolkit-Coder-UI/GtClassesCoderUIModel.class.st deleted file mode 100644 index 52af41890..000000000 --- a/src/GToolkit-Coder-UI/GtClassesCoderUIModel.class.st +++ /dev/null @@ -1,10 +0,0 @@ -Class { - #name : #GtClassesCoderUIModel, - #superclass : #GtMultipleCodersViewModel, - #category : 'GToolkit-Coder-UI-Coder - Classes Model' -} - -{ #category : #accessing } -GtClassesCoderUIModel >> elementClass [ - ^ GtClassesElement -] diff --git a/src/GToolkit-Coder-UI/GtClassesCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtClassesCoderViewModel.class.st new file mode 100644 index 000000000..035ee8e25 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtClassesCoderViewModel.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtClassesCoderViewModel, + #superclass : #GtMultipleCodersViewModel, + #category : #'GToolkit-Coder-UI-Coder - Classes Model' +} + +{ #category : #accessing } +GtClassesCoderViewModel >> elementClass [ + ^ GtClassesElement +] diff --git a/src/GToolkit-Coder-UI/GtPackagesCoderUIModel.class.st b/src/GToolkit-Coder-UI/GtPackagesCoderUIModel.class.st deleted file mode 100644 index 9c26d3c71..000000000 --- a/src/GToolkit-Coder-UI/GtPackagesCoderUIModel.class.st +++ /dev/null @@ -1,10 +0,0 @@ -Class { - #name : #GtPackagesCoderUIModel, - #superclass : #GtMultipleCodersViewModel, - #category : 'GToolkit-Coder-UI-Coder - Packages Model' -} - -{ #category : #accessing } -GtPackagesCoderUIModel >> elementClass [ - ^ GtPackagesCoderElement -] diff --git a/src/GToolkit-Coder-UI/GtPackagesCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtPackagesCoderViewModel.class.st new file mode 100644 index 000000000..69c52039b --- /dev/null +++ b/src/GToolkit-Coder-UI/GtPackagesCoderViewModel.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtPackagesCoderViewModel, + #superclass : #GtMultipleCodersViewModel, + #category : #'GToolkit-Coder-UI-Coder - Packages Model' +} + +{ #category : #accessing } +GtPackagesCoderViewModel >> elementClass [ + ^ GtPackagesCoderElement +] diff --git a/src/GToolkit-Coder/GtCoderClassAdded.class.st b/src/GToolkit-Coder/GtCoderClassAdded.class.st index 392ddc817..dbe92b6f9 100644 --- a/src/GToolkit-Coder/GtCoderClassAdded.class.st +++ b/src/GToolkit-Coder/GtCoderClassAdded.class.st @@ -1,5 +1,5 @@ Class { #name : #GtCoderClassAdded, - #superclass : #GtCoderAnnouncement, - #category : 'GToolkit-Coder-Event' + #superclass : #GtCoderClassChanged, + #category : #'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCoderClassChanged.class.st b/src/GToolkit-Coder/GtCoderClassChanged.class.st new file mode 100644 index 000000000..dc2ebbfd8 --- /dev/null +++ b/src/GToolkit-Coder/GtCoderClassChanged.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtCoderClassChanged, + #superclass : #GtCoderAnnouncement, + #category : #'GToolkit-Coder-Event' +} diff --git a/src/GToolkit-Coder/GtCoderClassRemoved.class.st b/src/GToolkit-Coder/GtCoderClassRemoved.class.st index d516bfbad..17008d57a 100644 --- a/src/GToolkit-Coder/GtCoderClassRemoved.class.st +++ b/src/GToolkit-Coder/GtCoderClassRemoved.class.st @@ -1,5 +1,5 @@ Class { #name : #GtCoderClassRemoved, - #superclass : #GtCoderAnnouncement, - #category : 'GToolkit-Coder-Event' + #superclass : #GtCoderClassChanged, + #category : #'GToolkit-Coder-Event' } diff --git a/src/GToolkit-Coder/GtCoderClassRenamed.class.st b/src/GToolkit-Coder/GtCoderClassRenamed.class.st index 422dd580e..7aee3bfd0 100644 --- a/src/GToolkit-Coder/GtCoderClassRenamed.class.st +++ b/src/GToolkit-Coder/GtCoderClassRenamed.class.st @@ -1,5 +1,5 @@ Class { #name : #GtCoderClassRenamed, - #superclass : #GtCoderAnnouncement, - #category : 'GToolkit-Coder-Event' + #superclass : #GtCoderClassChanged, + #category : #'GToolkit-Coder-Event' } From 01e20e5f6f438d3bfabe1c5d396da5c8a13d6c1e Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Fri, 14 Jan 2022 14:54:48 +0100 Subject: [PATCH 0148/1268] add action to create method when encountering a DNU in the debugger feenkcom/gtoolkit#1690 --- ...xtualCoderViewModelBehaviorChanged.class.st | 13 +++++++++++++ .../GtCoderBehaviorChanged.class.st | 18 ++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 src/GToolkit-Coder-UI/GtTextualCoderViewModelBehaviorChanged.class.st create mode 100644 src/GToolkit-Coder/GtCoderBehaviorChanged.class.st diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelBehaviorChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelBehaviorChanged.class.st new file mode 100644 index 000000000..41739b4d8 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelBehaviorChanged.class.st @@ -0,0 +1,13 @@ +Class { + #name : #GtTextualCoderViewModelBehaviorChanged, + #superclass : #GtTextualCoderViewModelAnnouncement, + #instVars : [ + 'newBehavior' + ], + #category : #'GToolkit-Coder-UI-Coder - Textual Model - Events' +} + +{ #category : #accessing } +GtTextualCoderViewModelBehaviorChanged >> newBehavior: aBehavior [ + newBehavior := aBehavior +] diff --git a/src/GToolkit-Coder/GtCoderBehaviorChanged.class.st b/src/GToolkit-Coder/GtCoderBehaviorChanged.class.st new file mode 100644 index 000000000..9c6d3792e --- /dev/null +++ b/src/GToolkit-Coder/GtCoderBehaviorChanged.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtCoderBehaviorChanged, + #superclass : #GtSourceCoderAnnouncement, + #instVars : [ + 'newBehavior' + ], + #category : #'GToolkit-Coder-Event' +} + +{ #category : #accessing } +GtCoderBehaviorChanged >> newBehavior [ + ^ newBehavior +] + +{ #category : #accessing } +GtCoderBehaviorChanged >> newBehavior: aBehavior [ + newBehavior := aBehavior +] From 2ab5f66145eae503ebc7a071c0d1cbb9a4d7973c Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 14 Jan 2022 23:43:27 -0300 Subject: [PATCH 0149/1268] fix memory leaks due to mixed announcement subscriptions --- ...oderNavigationClassHierachyElement.class.st | 6 +++--- .../GtCoderNavigationElement.class.st | 8 ++++---- ...vigationPackagesTagsClassesElement.class.st | 18 +++++++++--------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassHierachyElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassHierachyElement.class.st index 5d26266e1..31902f685 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassHierachyElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassHierachyElement.class.st @@ -87,9 +87,9 @@ GtCoderNavigationClassHierachyElement >> subscribeToContent [ GtCoderNavigationClassHierachyElement >> subscribeToNavigationModel [ self hasNavigationModel ifFalse: [ ^ self ]. super subscribeToNavigationModel. - navigationModel when: GtCoderNavigationPackagesSelected send: #onPackagesSelected: to: self. - navigationModel when: GtCoderNavigationPackageSelected send: #onPackageSelected: to: self. - navigationModel when: GtCoderNavigationPackageTagSelected send: #onPackageTagSelected: to: self. + navigationModel weak when: GtCoderNavigationPackagesSelected send: #onPackagesSelected: to: self. + navigationModel weak when: GtCoderNavigationPackageSelected send: #onPackageSelected: to: self. + navigationModel weak when: GtCoderNavigationPackageTagSelected send: #onPackageTagSelected: to: self. ] { #category : #'updating lists' } diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st index 5a01cbe6d..4ee91341c 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st @@ -7,7 +7,7 @@ Class { 'supressListChanges', 'classesList' ], - #category : 'GToolkit-Coder-UI-Navigation' + #category : #'GToolkit-Coder-UI-Navigation' } { #category : #asserting } @@ -197,9 +197,9 @@ GtCoderNavigationElement >> subscribeToContent [ { #category : #subscriptions } GtCoderNavigationElement >> subscribeToNavigationModel [ self hasNavigationModel ifFalse: [ ^ self ]. - navigationModel when: GtCoderNavigationClassSelected send: #onClassSelected: to: self. - navigationModel when: GtCoderNavigationClassRenamed send: #onClassRenamed: to: self. - navigationModel when: GtCoderNavigationClassModified send: #onClassModified: to: self. + navigationModel weak when: GtCoderNavigationClassSelected send: #onClassSelected: to: self. + navigationModel weak when: GtCoderNavigationClassRenamed send: #onClassRenamed: to: self. + navigationModel weak when: GtCoderNavigationClassModified send: #onClassModified: to: self. ] { #category : #subscriptions } diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 0b18d3a3f..06bbab6d5 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -414,15 +414,15 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToContent [ GtCoderNavigationPackagesTagsClassesElement >> subscribeToNavigationModel [ self hasNavigationModel ifFalse: [ ^ self ]. super subscribeToNavigationModel. - navigationModel when: GtCoderNavigationPackagesSelected send: #onPackagesSelected: to: self. - navigationModel when: GtCoderNavigationPackageSelected send: #onPackageSelected: to: self. - navigationModel when: GtCoderNavigationPackageTagSelected send: #onPackageTagSelected: to: self. - navigationModel when: GtCoderNavigationPackageRegistered send: #onPackageRegistered: to: self. - navigationModel when: GtCoderNavigationPackageUnregistered send: #onPackageUnregistered: to: self. - navigationModel when: GtCoderNavigationPackageRenamed send: #onPackageRenamed: to: self. - navigationModel when: GtCoderNavigationPackageTagAdded send: #onPackageTagAdded: to: self. - navigationModel when: GtCoderNavigationPackageTagRemoved send: #onPackageTagRemoved: to: self. - navigationModel when: GtCodersFiltersChanged send: #onMethodsCoderFiltersChanged: to: self. + navigationModel weak when: GtCoderNavigationPackagesSelected send: #onPackagesSelected: to: self. + navigationModel weak when: GtCoderNavigationPackageSelected send: #onPackageSelected: to: self. + navigationModel weak when: GtCoderNavigationPackageTagSelected send: #onPackageTagSelected: to: self. + navigationModel weak when: GtCoderNavigationPackageRegistered send: #onPackageRegistered: to: self. + navigationModel weak when: GtCoderNavigationPackageUnregistered send: #onPackageUnregistered: to: self. + navigationModel weak when: GtCoderNavigationPackageRenamed send: #onPackageRenamed: to: self. + navigationModel weak when: GtCoderNavigationPackageTagAdded send: #onPackageTagAdded: to: self. + navigationModel weak when: GtCoderNavigationPackageTagRemoved send: #onPackageTagRemoved: to: self. + navigationModel weak when: GtCodersFiltersChanged send: #onMethodsCoderFiltersChanged: to: self. ] { #category : #subscriptions } From b9a1b625bebd59c27048e4168aab5ecd96d09402 Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Mon, 17 Jan 2022 07:50:57 +0100 Subject: [PATCH 0150/1268] fix API method: ensure a block is a stencil --- src/GToolkit-Coder/GtCoderAddOns.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder/GtCoderAddOns.class.st b/src/GToolkit-Coder/GtCoderAddOns.class.st index 1db6bfef8..2de14c27a 100644 --- a/src/GToolkit-Coder/GtCoderAddOns.class.st +++ b/src/GToolkit-Coder/GtCoderAddOns.class.st @@ -182,7 +182,7 @@ GtCoderAddOns >> addPreview: aString stencil: aStencil [ id: aString; title: aString; stencil: [ BrFrame new fitContent ]; - dataBinder: [ :anElement :aViewModel | anElement removeChildren; addChild: aStencil asElement ]) + dataBinder: [ :anElement :aViewModel | anElement removeChildren; addChild: aStencil asStencil asElement ]) ] { #category : #'api - previews' } From 02069df890b6bc88bda160d511e5684304f77edf Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Mon, 24 Jan 2022 11:08:56 -0600 Subject: [PATCH 0151/1268] Select placeholder '_' when extracting temporay [feenkcom/#2384] --- src/GToolkit-Coder-AddOns/GtRenameAction2.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-AddOns/GtRenameAction2.class.st b/src/GToolkit-Coder-AddOns/GtRenameAction2.class.st index b0310f500..557457ed3 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameAction2.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameAction2.class.st @@ -137,7 +137,7 @@ GtRenameAction2 >> initialize [ super initialize. originalLocations := #(). isInstalled := false. - selectAll := false. + selectAll := true. filter := BrTextEditorNoInputFilter new. coderAttributes := #(). From 4eee6b52706cc5e6adfa1e0873fa6ed376827732 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Tue, 1 Feb 2022 19:55:30 +0100 Subject: [PATCH 0152/1268] refactor scripter examples to use #play api --- .../TCoderByScripterExamples.trait.st | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st b/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st index d1d348125..f2d21f754 100644 --- a/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st +++ b/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st @@ -14,17 +14,14 @@ TCoderByScripterExamples >> openAndClickOnContextMenuItemFor: aScripterOrStep id aScripterOrStep mouseMoveOver label: 'Hover ', aBlElementId asSymbol; onSpaceRoot; - id: aBlElementId. - - aScripterOrStep wait forEmptySpaceTaskQueue. + id: aBlElementId; + play. aScripterOrStep click label: 'Click ', aBlElementId asSymbol; onSpaceRoot; - id: aBlElementId. - - aScripterOrStep wait forEmptySpaceTaskQueue. - aScripterOrStep syncContinue + id: aBlElementId; + play. ] { #category : #'examples - scripter' } From 2c5239dd1aaba08a9814e39143dbc2f6ce359b50 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Wed, 9 Feb 2022 13:08:03 +0100 Subject: [PATCH 0153/1268] fix diff aptitudes --- src/GToolkit-Coder-UI/GtDiffFlatAptitude.class.st | 14 +++++++++----- .../GtDiffShadowAptitude.class.st | 14 +++++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtDiffFlatAptitude.class.st b/src/GToolkit-Coder-UI/GtDiffFlatAptitude.class.st index 2bdf234e0..e5ba4cd04 100644 --- a/src/GToolkit-Coder-UI/GtDiffFlatAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtDiffFlatAptitude.class.st @@ -1,7 +1,7 @@ Class { #name : #GtDiffFlatAptitude, #superclass : #GtDiffAptitude, - #category : 'GToolkit-Coder-UI-Diff' + #category : #'GToolkit-Coder-UI-Diff' } { #category : #initialization } @@ -23,17 +23,21 @@ GtDiffFlatAptitude >> newTextLook [ normal: [ :aStyle | aStyle padding: (BlInsets all: 10); - do: [ :aWidget | aWidget aptitude glamorousCodeSize ] ]; + do: [ :aWidget | aWidget aptitude glamorousCodeSize ] + after: [ ] ]; small: [ :aStyle | aStyle padding: (BlInsets all: 6); - do: [ :aWidget | aWidget aptitude glamorousCodeSmallSize ] ]; + do: [ :aWidget | aWidget aptitude glamorousCodeSmallSize ] + after: [ ] ]; tiny: [ :aStyle | aStyle padding: (BlInsets all: 4); - do: [ :aWidget | aWidget aptitude glamorousCodeTinySize ] ]; + do: [ :aWidget | aWidget aptitude glamorousCodeTinySize ] + after: [ ] ]; mini: [ :aStyle | aStyle padding: (BlInsets all: 2); - do: [ :aWidget | aWidget aptitude glamorousCodeMiniSize ] ] + do: [ :aWidget | aWidget aptitude glamorousCodeMiniSize ] + after: [ ] ] ] diff --git a/src/GToolkit-Coder-UI/GtDiffShadowAptitude.class.st b/src/GToolkit-Coder-UI/GtDiffShadowAptitude.class.st index 870009dca..bcfbd135e 100644 --- a/src/GToolkit-Coder-UI/GtDiffShadowAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtDiffShadowAptitude.class.st @@ -1,7 +1,7 @@ Class { #name : #GtDiffShadowAptitude, #superclass : #GtDiffAptitude, - #category : 'GToolkit-Coder-UI-Diff' + #category : #'GToolkit-Coder-UI-Diff' } { #category : #initialization } @@ -53,17 +53,21 @@ GtDiffShadowAptitude >> newTextLook [ normal: [ :aStyle | aStyle padding: (BlInsets all: 10); - do: [ :aWidget | aWidget aptitude glamorousCodeSize ] ]; + do: [ :aWidget | aWidget aptitude glamorousCodeSize ] + after: [ ] ]; small: [ :aStyle | aStyle padding: (BlInsets all: 6); - do: [ :aWidget | aWidget aptitude glamorousCodeSmallSize ] ]; + do: [ :aWidget | aWidget aptitude glamorousCodeSmallSize ] + after: [ ] ]; tiny: [ :aStyle | aStyle padding: (BlInsets all: 4); - do: [ :aWidget | aWidget aptitude glamorousCodeTinySize ] ]; + do: [ :aWidget | aWidget aptitude glamorousCodeTinySize ] + after: [ ] ]; mini: [ :aStyle | aStyle padding: (BlInsets all: 2); - do: [ :aWidget | aWidget aptitude glamorousCodeMiniSize ] ] + do: [ :aWidget | aWidget aptitude glamorousCodeMiniSize ] + after: [ ] ] ] From 932cedcfe2df33f82a98ce79014c93b6f74c2c66 Mon Sep 17 00:00:00 2001 From: John Brant Date: Sun, 20 Feb 2022 14:22:42 -0600 Subject: [PATCH 0154/1268] renaming smacc styler method to match coder's styler method --- src/GToolkit-Coder/GtCoderAstSmaCCParserStyler.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder/GtCoderAstSmaCCParserStyler.class.st b/src/GToolkit-Coder/GtCoderAstSmaCCParserStyler.class.st index c49a026ee..a8e76fe2f 100644 --- a/src/GToolkit-Coder/GtCoderAstSmaCCParserStyler.class.st +++ b/src/GToolkit-Coder/GtCoderAstSmaCCParserStyler.class.st @@ -4,7 +4,7 @@ Class { #instVars : [ 'smaccStyler' ], - #category : 'GToolkit-Coder-Styler/Highlighter' + #category : #'GToolkit-Coder-Styler/Highlighter' } { #category : #accessing } @@ -19,5 +19,5 @@ GtCoderAstSmaCCParserStyler >> smaccStyler: anObject [ { #category : #'api - styling' } GtCoderAstSmaCCParserStyler >> style: aText ast: theAst [ - self smaccStyler style: aText using: theAst + self smaccStyler style: aText ast: theAst ] From 905c7576a4c8f6d649f941c747c7470d38736ace Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Mon, 28 Feb 2022 15:39:27 +0100 Subject: [PATCH 0155/1268] Add Git button to coder --- .../GtCoderToolbarElement.class.st | 43 +++++++++++++------ 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st b/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st index 90b8c9c35..12c116949 100644 --- a/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st @@ -12,7 +12,7 @@ Class { #instVars : [ 'toolbarElement' ], - #category : 'GToolkit-Coder-UI-Basic' + #category : #'GToolkit-Coder-UI-Basic' } { #category : #'gt-extensions' } @@ -99,19 +99,19 @@ GtCoderToolbarElement >> initialize [ { #category : #initialization } GtCoderToolbarElement >> initializeToolbarElement [ + toolbarElement := BrToolbar new - aptitude: BrGlamorousToolbarAptitude new; - padding: - (BlInsets - top: 10 - left: 0 - bottom: 0 - right: 5); - addItem: self newBrowseButton; - addItem: self newSpotterButton; - addItem: self newHierarchyButton; - addItem: self newAddButton; - yourself + aptitude: BrGlamorousToolbarAptitude new; + padding: (BlInsets + top: 10 + left: 0 + bottom: 0 + right: 5); + addItem: self newBrowseButton; + addItem: self newSpotterButton; + addItem: self newHierarchyButton; + addItem: self newGitButton; + addItem: self newAddButton ] { #category : #'private - instance creation' } @@ -167,6 +167,15 @@ GtCoderToolbarElement >> newBrowseButton [ action: [ :aButton | self browseFrom: aButton ] ] +{ #category : #initialization } +GtCoderToolbarElement >> newGitButton [ + ^ BrButton new + aptitude: BrGlamorousButtonWithIconAptitude; + label: 'Go to repository'; + icon: BrGlamorousVectorIcons branching; + action: [ :_ | self phlow spawnTool: (GtGitElement new repository: self repository) ] +] + { #category : #'private - instance creation' } GtCoderToolbarElement >> newHierarchyButton [ ^ BrButton new @@ -207,6 +216,14 @@ GtCoderToolbarElement >> newSpotterButton [ asElement. ] +{ #category : #initialization } +GtCoderToolbarElement >> repository [ + + self navigationModel hasSelectedClass ifTrue: [ + ^ self navigationModel selectedClass repository ]. + ^ self navigationModel selectedPackage repository +] + { #category : #accessing } GtCoderToolbarElement >> toolbarElement [ From ad13312556082bad1f11975046704cf093804015 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Mon, 28 Feb 2022 16:40:34 +0100 Subject: [PATCH 0156/1268] Make Git button work with un-git-ified packages/classes --- .../GtCoderToolbarElement.class.st | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st b/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st index 12c116949..4ff230069 100644 --- a/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st @@ -169,11 +169,22 @@ GtCoderToolbarElement >> newBrowseButton [ { #category : #initialization } GtCoderToolbarElement >> newGitButton [ + ^ BrButton new - aptitude: BrGlamorousButtonWithIconAptitude; - label: 'Go to repository'; - icon: BrGlamorousVectorIcons branching; - action: [ :_ | self phlow spawnTool: (GtGitElement new repository: self repository) ] + aptitude: BrGlamorousButtonWithIconAptitude; + label: 'Go to repository'; + icon: BrGlamorousVectorIcons branching; + action: [ :_ | + | repository | + repository := self repository. + repository + ifNil: [ + self phlow spawnTool: + (GtGitAddToRepositoryElement new package: + self navigationModel selectedPackage) ] + ifNotNil: [ + self phlow spawnTool: + (GtGitElement new repository: self repository) ] ] ] { #category : #'private - instance creation' } @@ -221,7 +232,9 @@ GtCoderToolbarElement >> repository [ self navigationModel hasSelectedClass ifTrue: [ ^ self navigationModel selectedClass repository ]. - ^ self navigationModel selectedPackage repository + self navigationModel hasSelectedPackage ifTrue: [ + ^ self navigationModel selectedPackage repository ]. + ^ nil ] { #category : #accessing } From 933eafb991432efd8ade74c0f4ef43b7323173d3 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 10 Mar 2022 14:26:08 -0300 Subject: [PATCH 0157/1268] use `GtPhlowValuableTool` to spawn git tools --- src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st b/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st index 4ff230069..7ce3c0071 100644 --- a/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st @@ -175,16 +175,16 @@ GtCoderToolbarElement >> newGitButton [ label: 'Go to repository'; icon: BrGlamorousVectorIcons branching; action: [ :_ | - | repository | + | repository | repository := self repository. repository ifNil: [ - self phlow spawnTool: - (GtGitAddToRepositoryElement new package: - self navigationModel selectedPackage) ] + self phlow spawnTool: (GtPhlowValuableTool new valuable: [ + GtGitAddToRepositoryElement new package: + self navigationModel selectedPackage ]) ] ifNotNil: [ - self phlow spawnTool: - (GtGitElement new repository: self repository) ] ] + self phlow spawnTool: (GtPhlowValuableTool new valuable: [ + GtGitElement new repository: self repository ]) ] ] ] { #category : #'private - instance creation' } From cee703208c266bef33b1417a8e902e0a83067dc2 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Fri, 18 Mar 2022 17:45:52 +0100 Subject: [PATCH 0158/1268] Move completer into scoder view models [feenkcom/gtoolkit#2425] --- .../GtTextualCoderEditorElement.class.st | 2 +- .../GtTextualCoderViewModel.class.st | 21 ++++++++++++++++++- src/GToolkit-Coder/GtTextCoder.class.st | 5 ----- src/GToolkit-Coder/GtTextualCoder.class.st | 18 ---------------- 4 files changed, 21 insertions(+), 25 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 9b839ca01..41a201e37 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -264,7 +264,7 @@ GtTextualCoderEditorElement >> onTextualCoderViewModelChanged [ shortcuts := self textualCoderViewModel shortcuts copy. self editor addEditorShortcuts: shortcuts. - completion strategy: self textualCoderViewModel coderModel completionStrategy + completion strategy: self textualCoderViewModel completionStrategy ] { #category : #'private - event handling' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 562b6f2fc..974f7d3d2 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -16,7 +16,8 @@ Class { 'extraTextAttributes', 'styledText', 'shouldHaveHeader', - 'isTextModifiedPromise' + 'isTextModifiedPromise', + 'completionStrategy' ], #category : #'GToolkit-Coder-UI-Coder - Textual Model' } @@ -170,6 +171,19 @@ GtTextualCoderViewModel >> collapsedTextPromise [ ^ coderModel collapsedTextPromise ] +{ #category : #accessing } +GtTextualCoderViewModel >> completionStrategy [ + + + ^ completionStrategy + ifNil: [ completionStrategy := self newCompletionStrategy ] +] + +{ #category : #accessing } +GtTextualCoderViewModel >> completionStrategy: aGtCompletionStrategy [ + completionStrategy := aGtCompletionStrategy +] + { #category : #'api - stylers' } GtTextualCoderViewModel >> compositeStyler [ ^ GtCoderAstCompositeStyler new @@ -489,6 +503,11 @@ GtTextualCoderViewModel >> moveCursorTo: aCursorIndex [ self cursors: (BrTextEditorCursor at: aCursorIndex) ] +{ #category : #accessing } +GtTextualCoderViewModel >> newCompletionStrategy [ + ^ GtCompletionStrategy new +] + { #category : #'private - notifying' } GtTextualCoderViewModel >> notifyCursorsChanged: aBrTextEditorCursor from: aSourceObject [ self announce: (GtTextualCoderViewModelCursorsChanged new cursors: aBrTextEditorCursor; source: aSourceObject) diff --git a/src/GToolkit-Coder/GtTextCoder.class.st b/src/GToolkit-Coder/GtTextCoder.class.st index e708db033..f9ea3f13d 100644 --- a/src/GToolkit-Coder/GtTextCoder.class.st +++ b/src/GToolkit-Coder/GtTextCoder.class.st @@ -23,11 +23,6 @@ GtTextCoder >> forString: aString [ self sourceCode: (GtCoderExplicitStringSource new source: aString) ] -{ #category : #'instance creation' } -GtTextCoder >> newCompletionStrategy [ - ^ GtCompletionStrategy new -] - { #category : #accessing } GtTextCoder >> parser [ ^ parser diff --git a/src/GToolkit-Coder/GtTextualCoder.class.st b/src/GToolkit-Coder/GtTextualCoder.class.st index d5583e532..9b3c3ee11 100644 --- a/src/GToolkit-Coder/GtTextualCoder.class.st +++ b/src/GToolkit-Coder/GtTextualCoder.class.st @@ -82,19 +82,6 @@ GtTextualCoder >> collapsedTextPromise [ ifNotEmpty: [ aCurrentText iterator nextLine ] ] ] -{ #category : #'api - accessing' } -GtTextualCoder >> completionStrategy [ - - - ^ completionStrategy - ifNil: [ completionStrategy := self newCompletionStrategy ] -] - -{ #category : #'api - accessing' } -GtTextualCoder >> completionStrategy: aGtCompletionStrategy [ - completionStrategy := aGtCompletionStrategy -] - { #category : #'api - ast' } GtTextualCoder >> computeAst [ ^ self computeAst: self currentSourceString @@ -212,11 +199,6 @@ GtTextualCoder >> isModifiedPromise [ ^ self sourceCode isModifiedPromise ] -{ #category : #'instance creation' } -GtTextualCoder >> newCompletionStrategy [ - ^ self subclassResponsibility -] - { #category : #'private - notifying' } GtTextualCoder >> notifyCorrectionFrom: aFromIndex to: aToIndex with: aString [ self announce: (GtCoderCorrectionRequest new From d1e02709d11989554e6c085c8309af84bf8096ba Mon Sep 17 00:00:00 2001 From: John Brant Date: Wed, 6 Apr 2022 12:28:18 -0500 Subject: [PATCH 0159/1268] don't announce restyle unless stylers have changed --- src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 974f7d3d2..7ea97dc59 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -543,13 +543,11 @@ GtTextualCoderViewModel >> notifyStyledTextChanged [ GtTextualCoderViewModel >> onAddOnsChanged: theAddOns [ "Is sent when new add-ons are computed" - self stylers: theAddOns stylers. self shortcuts: theAddOns shortcuts. self mainActions: theAddOns mainActions. self contextActions: theAddOns contextActions. self contextMenuActions: theAddOns contextMenuActions. - - self announce: GtTextualCoderViewModelReadyToRestyle new + self stylers: theAddOns stylers ] { #category : #'api - styled text' } @@ -746,7 +744,8 @@ GtTextualCoderViewModel >> stylers: theStylers [ "when stylers change we should reset the styled text, since there is no guarantee it will be a valid one" self unsetStyledText. - self announce: GtTextualCoderViewModelStylersChanged new + self announce: GtTextualCoderViewModelStylersChanged new. + self announce: GtTextualCoderViewModelReadyToRestyle new ] { #category : #'api - coder model' } From eb33e1c391839201799a80c2904ff08bf9756fa2 Mon Sep 17 00:00:00 2001 From: Oscar Nierstrasz Date: Fri, 8 Apr 2022 10:01:07 +0200 Subject: [PATCH 0160/1268] Added convenience method GtSearchFilter>>#contents so we can easily get the actual result from a search filter and not a future. --- .../GtSearchFilter.class.st | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/GToolkit-SearchFilters/GtSearchFilter.class.st b/src/GToolkit-SearchFilters/GtSearchFilter.class.st index 7bc43e3f9..f62703a3c 100644 --- a/src/GToolkit-SearchFilters/GtSearchFilter.class.st +++ b/src/GToolkit-SearchFilters/GtSearchFilter.class.st @@ -21,6 +21,23 @@ GtSearchFilter >> asAsyncStream [ ^ self result ] +{ #category : #accessing } +GtSearchFilter >> contents [ + + "Convenience method. By analogy with PositionableStream>>#contents. + Sometimes you really want the actual result, and not a future. + For example: + (#gtExample gtPragmas & #assert: gtSenders) contents + asOrderedCollection sort: [ :a :b | a size < b size ] + will return the actual result array so you can sort it. + The async way to do that would be: + ((#gtExample gtPragmas & #assert: gtSenders) result toArray + then: [ :anArray | anArray sorted: [ :a :b | a size < b size ] ]) await + " + + ^ self result toArray wait +] + { #category : #accessing } GtSearchFilter >> defaultFilterScope [ ^ AsyncEmptyStream new From 9032e34550cac72d3014aa18fedfab76a2b81375 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Wed, 27 Apr 2022 15:36:11 +0200 Subject: [PATCH 0161/1268] Allow for custom buttons to be added to the coder toolbar using the `gtCoderAction` pragma --- .../GtCoderToolbarElement.class.st | 33 +++++++------------ 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st b/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st index 7ce3c0071..c4eb60b52 100644 --- a/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st @@ -35,6 +35,15 @@ GtCoderToolbarElement >> addClassTab: look [ element ] ] +{ #category : #initialization } +GtCoderToolbarElement >> addCustomButtons [ + + | methods | + methods := (Pragma allNamed: #gtCoderAction in: self class) + collect: #methodSelector. + methods do: [ :aSelector | self perform: aSelector ] +] + { #category : #'gt-extensions' } GtCoderToolbarElement >> addPackageTab: look [ @@ -110,8 +119,8 @@ GtCoderToolbarElement >> initializeToolbarElement [ addItem: self newBrowseButton; addItem: self newSpotterButton; addItem: self newHierarchyButton; - addItem: self newGitButton; - addItem: self newAddButton + addItem: self newAddButton. + self addCustomButtons ] { #category : #'private - instance creation' } @@ -167,26 +176,6 @@ GtCoderToolbarElement >> newBrowseButton [ action: [ :aButton | self browseFrom: aButton ] ] -{ #category : #initialization } -GtCoderToolbarElement >> newGitButton [ - - ^ BrButton new - aptitude: BrGlamorousButtonWithIconAptitude; - label: 'Go to repository'; - icon: BrGlamorousVectorIcons branching; - action: [ :_ | - | repository | - repository := self repository. - repository - ifNil: [ - self phlow spawnTool: (GtPhlowValuableTool new valuable: [ - GtGitAddToRepositoryElement new package: - self navigationModel selectedPackage ]) ] - ifNotNil: [ - self phlow spawnTool: (GtPhlowValuableTool new valuable: [ - GtGitElement new repository: self repository ]) ] ] -] - { #category : #'private - instance creation' } GtCoderToolbarElement >> newHierarchyButton [ ^ BrButton new From d6c0661747cdf0f5c57abaf72ad621b52d550f69 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Thu, 28 Apr 2022 13:13:21 +0200 Subject: [PATCH 0162/1268] Show source code on alt+click on coder actions --- .../GtCoderToolbarElement.class.st | 61 +++++++++++++++---- 1 file changed, 49 insertions(+), 12 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st b/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st index c4eb60b52..dc47cd57d 100644 --- a/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st @@ -15,6 +15,13 @@ Class { #category : #'GToolkit-Coder-UI-Basic' } +{ #category : #accessing } +GtCoderToolbarElement >> addButton [ + + + toolbarElement addItem: self newAddButton +] + { #category : #'gt-extensions' } GtCoderToolbarElement >> addClassTab: look [ @@ -38,10 +45,10 @@ GtCoderToolbarElement >> addClassTab: look [ { #category : #initialization } GtCoderToolbarElement >> addCustomButtons [ - | methods | - methods := (Pragma allNamed: #gtCoderAction in: self class) - collect: #methodSelector. - methods do: [ :aSelector | self perform: aSelector ] + | pragmas | + pragmas := Pragma allNamed: #gtCoderAction: in: self class. + pragmas sort: [ :a :b | (a argumentAt: 1) <= (b argumentAt: 1) ]. + pragmas do: [ :aPragma | self perform: aPragma methodSelector ] ] { #category : #'gt-extensions' } @@ -83,6 +90,13 @@ GtCoderToolbarElement >> addTraitTab: look [ element ] ] +{ #category : #accessing } +GtCoderToolbarElement >> browseButton [ + + + toolbarElement addItem: self newBrowseButton +] + { #category : #'private - actions' } GtCoderToolbarElement >> browseFrom: anElement [ "Do we want to share the same coder model?" @@ -92,6 +106,26 @@ GtCoderToolbarElement >> browseFrom: anElement [ maximized ] ] +{ #category : #accessing } +GtCoderToolbarElement >> createActionButton [ + + | button caller | + button := BrButton new. + caller := thisContext stack second method. + button viewModel when: BlClickEvent do: [ :anEvent | + (GtPhlowUtility isDefinitionRequested: anEvent) ifTrue: [ + anEvent consumed: true. + button phlow spawnObject: caller ] ]. + ^ button +] + +{ #category : #accessing } +GtCoderToolbarElement >> hierarchyButton [ + + + toolbarElement addItem: self newHierarchyButton +] + { #category : #initialization } GtCoderToolbarElement >> initialize [ super initialize. @@ -115,18 +149,14 @@ GtCoderToolbarElement >> initializeToolbarElement [ top: 10 left: 0 bottom: 0 - right: 5); - addItem: self newBrowseButton; - addItem: self newSpotterButton; - addItem: self newHierarchyButton; - addItem: self newAddButton. + right: 5). self addCustomButtons ] { #category : #'private - instance creation' } GtCoderToolbarElement >> newAddButton [ | look | - ^ BrButton new + ^ self createActionButton label: 'Add class or package'; aptitude: BrGlamorousButtonWithIconAptitude @@ -169,7 +199,7 @@ GtCoderToolbarElement >> newAddInterface: look [ { #category : #'private - instance creation' } GtCoderToolbarElement >> newBrowseButton [ - ^ BrButton new + ^ self createActionButton aptitude: BrGlamorousButtonWithIconAptitude; label: 'Browse in another world tab'; icon: BrGlamorousVectorIcons emphasizedBrowse; @@ -178,7 +208,7 @@ GtCoderToolbarElement >> newBrowseButton [ { #category : #'private - instance creation' } GtCoderToolbarElement >> newHierarchyButton [ - ^ BrButton new + ^ self createActionButton label: 'Show Package and Class Hierarchies'; aptitude: BrGlamorousButtonWithIconAptitude + (BrGlamorousWithDropdownAptitude handle: [ @@ -226,6 +256,13 @@ GtCoderToolbarElement >> repository [ ^ nil ] +{ #category : #accessing } +GtCoderToolbarElement >> spotterButton [ + + + toolbarElement addItem: self newSpotterButton +] + { #category : #accessing } GtCoderToolbarElement >> toolbarElement [ From bf3ed25f073980fdc40877e5395f65a007734962 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 2 May 2022 21:13:06 +0200 Subject: [PATCH 0163/1268] [feenkcom/gtoolkit#2518] update the collapsed text when text changes --- ...ourceCoderCollapsedContentElement.class.st | 29 ++++++++++++++++++- .../GtTextualCoderViewModel.class.st | 18 +++++++++++- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st index 7594b1cec..97347bc09 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st @@ -76,7 +76,34 @@ GtSourceCoderCollapsedContentElement >> newLabel [ GtSourceCoderCollapsedContentElement >> onTextualCoderViewModelChanged [ super onTextualCoderViewModelChanged. - label asyncPromise promise: textualCoderViewModel collapsedTextPromise. + self updateCollapsedTextLabel. addOns removeChildren. addOns asyncPromise promise: textualCoderViewModel addOns ] + +{ #category : #'private - event handling' } +GtSourceCoderCollapsedContentElement >> onViewModelTextChanged: anAnnouncement [ + self updateCollapsedTextLabel +] + +{ #category : #'api - textual coder view model' } +GtSourceCoderCollapsedContentElement >> subscribeToTextualCoderViewModel [ + super subscribeToTextualCoderViewModel. + + textualCoderViewModel weak + when: GtTextualCoderViewModelTextChanged + send: #onViewModelTextChanged: + to: self +] + +{ #category : #'api - textual coder view model' } +GtSourceCoderCollapsedContentElement >> unsubscribeFromTextualCoderViewModel [ + super unsubscribeFromTextualCoderViewModel. + + textualCoderViewModel unsubscribe: self +] + +{ #category : #'private - update' } +GtSourceCoderCollapsedContentElement >> updateCollapsedTextLabel [ + label asyncPromise promise: textualCoderViewModel collapsedTextPromise +] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 7ea97dc59..d566fbc54 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -550,6 +550,11 @@ GtTextualCoderViewModel >> onAddOnsChanged: theAddOns [ self stylers: theAddOns stylers ] +{ #category : #'api - coder model' } +GtTextualCoderViewModel >> onCoderModelChanged [ + super onCoderModelChanged +] + { #category : #'api - styled text' } GtTextualCoderViewModel >> onNewStyledTextSet: aNewStyledText [ "Is sent after a new value of the styledText is assigned" @@ -578,6 +583,12 @@ GtTextualCoderViewModel >> onSourceCodeChanged: anSourceCodeChangedAnnouncement updateStrategy: anSourceCodeChangedAnnouncement updateStrategy) ] +{ #category : #'private - event handling' } +GtTextualCoderViewModel >> onSourceCodeReplaced: aSourceCodeReplacedAnnouncement [ + "source code replaced to a new one. It most likely means that the origin of + the source text has changed." +] + { #category : #'api - text' } GtTextualCoderViewModel >> removeAllCoderTextAttributes: aCollectionOfGtTextualCoderTextAttributes [ aCollectionOfGtTextualCoderTextAttributes do: [ :eachCoderTextAttribute | @@ -751,7 +762,12 @@ GtTextualCoderViewModel >> stylers: theStylers [ { #category : #'api - coder model' } GtTextualCoderViewModel >> subscribeToCoderModel [ super subscribeToCoderModel. - + + self coderModel weak + when: GtCoderSourceCodeReplaced + send: #onSourceCodeReplaced: + to: self. + self coderModel weak when: GtCoderSourceCodeChanged send: #onSourceCodeChanged: From 6bc85244a36ae89390b60dbab417d53c50782e39 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 3 May 2022 12:11:03 -0500 Subject: [PATCH 0164/1268] Display protocols from both the class and the metaclass in coder: [feenkcom/gtoolkit#2519] --- ...vigationMethodProtocolListElement.class.st | 21 ++++++------------- ...igationPackagesTagsClassesElement.class.st | 18 ++++++++-------- 2 files changed, 15 insertions(+), 24 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationMethodProtocolListElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationMethodProtocolListElement.class.st index dba2554a6..726e45084 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationMethodProtocolListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationMethodProtocolListElement.class.st @@ -1,20 +1,15 @@ Class { #name : #GtCoderNavigationMethodProtocolListElement, #superclass : #BrSimpleList, - #category : 'GToolkit-Coder-UI-Navigation' + #category : #'GToolkit-Coder-UI-Navigation' } -{ #category : #'instance creation' } -GtCoderNavigationMethodProtocolListElement class >> fromClass: aClass [ - ^ self new initializeWithClass: aClass -] - { #category : #'private - ui' } GtCoderNavigationMethodProtocolListElement >> buildProtocolLabel: aProtocol [ ^ BrLabel new aptitude: BrGlamorousLabelAptitude; beSmallSize; - text: aProtocol name + text: aProtocol ] { #category : #'private - ui' } @@ -50,16 +45,12 @@ GtCoderNavigationMethodProtocolListElement >> buildProtocolRow: aProtocol index: { #category : #initialization } GtCoderNavigationMethodProtocolListElement >> initialize [ super initialize. - self stencil: [ :eachProtocol :eachIndex :aListElement | self buildProtocolRow: eachProtocol index: eachIndex list: aListElement ] ] { #category : #initialization } -GtCoderNavigationMethodProtocolListElement >> initializeWithClass: aClass [ - self initializeWithProtocols: aClass organization allProtocols -] - -{ #category : #initialization } -GtCoderNavigationMethodProtocolListElement >> initializeWithProtocols: aCollection [ - self items: (aCollection sorted: [ :protocolA :protocolB | protocolA name < protocolB name ]) +GtCoderNavigationMethodProtocolListElement >> initializeWithProtocols: aCollection [ + | names | + names := (aCollection collect: #name) asSet sorted. + self items: names ] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 06bbab6d5..c2bd5c1d7 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -126,7 +126,7 @@ GtCoderNavigationPackagesTagsClassesElement >> onMethodsCoderFiltersChanged: aGt methodProtocolsList selectedItemDo: [ :aSelectedItem | | aCategoryFilter | - aCategoryFilter := GtSearchMethodCategoryFilter forCategory: aSelectedItem name. + aCategoryFilter := GtSearchMethodCategoryFilter forCategory: aSelectedItem. aGtCodersFiltersChanged filters do: [ :eachFilter | eachFilter = aCategoryFilter ifTrue: [ @@ -446,18 +446,18 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToProtocolList [ GtCoderNavigationPackagesTagsClassesElement >> updateClassLists [ self hasNavigationModel ifFalse: [ ^ self ]. classesList initializeWithClasses: navigationModel classesToShow. - navigationModel hasSelectedClass - ifTrue: [ - | methodProtocols | - methodProtocols := navigationModel selectedClass organization protocols. + ifTrue: + [ | methodProtocols | + methodProtocols := (navigationModel selectedClass organization protocols + , navigationModel selectedClass class organization protocols). methodProtocolsList initializeWithProtocols: methodProtocols. protocolLabel visibility: BlVisibility visible. - methodProtocolsList visibility: BlVisibility visible. ] - ifFalse: [ - methodProtocolsList initializeWithProtocols: Array empty. + methodProtocolsList visibility: BlVisibility visible ] + ifFalse: + [ methodProtocolsList initializeWithProtocols: Array empty. protocolLabel visibility: BlVisibility gone. - methodProtocolsList visibility: BlVisibility gone. ] + methodProtocolsList visibility: BlVisibility gone ] ] { #category : #'updating lists' } From db06595dcf4757d8866aeac7b0b11345a38cfd83 Mon Sep 17 00:00:00 2001 From: Oscar Nierstrasz Date: Fri, 6 May 2022 10:23:19 +0200 Subject: [PATCH 0165/1268] Changed self result to self contents --- src/GToolkit-Coder-UI/GtSearchFilter.extension.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtSearchFilter.extension.st b/src/GToolkit-Coder-UI/GtSearchFilter.extension.st index 0608a1487..e819e1c04 100644 --- a/src/GToolkit-Coder-UI/GtSearchFilter.extension.st +++ b/src/GToolkit-Coder-UI/GtSearchFilter.extension.st @@ -14,7 +14,7 @@ GtSearchFilter >> asElement [ GtSearchFilter >> gtExamples [ | examples | examples := OrderedCollection new. - self result do: [ :each | examples addAll: each gtExamples ]. + self contents do: [ :each | examples addAll: each gtExamples ]. ^ GtExampleGroup withAll: examples ] From a05dfa88e77b02e8c94be1c417cfa922a277fb7c Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 10 May 2022 08:02:58 -0500 Subject: [PATCH 0166/1268] Correctly deal with clearing attributes at position 0. [feenkcom/gtoolkit#2535] --- .../GtFixItAction.class.st | 8 +++-- .../GtTextualCoderEditorElement.class.st | 35 +++++++------------ 2 files changed, 18 insertions(+), 25 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtFixItAction.class.st b/src/GToolkit-Coder-AddOns/GtFixItAction.class.st index 769fc01a5..9d60c16cb 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItAction.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItAction.class.st @@ -5,7 +5,7 @@ Class { 'node', 'sourceCoder' ], - #category : 'GToolkit-Coder-AddOns-FixIt' + #category : #'GToolkit-Coder-AddOns-FixIt' } { #category : #'instance creation' } @@ -25,8 +25,10 @@ GtFixItAction >> attributePosition [ GtFixItAction >> clearFixItAttributeInEditor: aBrTextEditor [ | position | position := self attributePosition. - (aBrTextEditor text from: position to: position) - clearAttributes: [ :each | each isKindOf: GtFixItAttribute ] + aBrTextEditor text + clearAttributes: position + to: position + if: [ :each | each isKindOf: GtFixItAttribute ] ] { #category : #'api - action' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 41a201e37..50a24caa6 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -194,37 +194,28 @@ GtTextualCoderEditorElement >> onPrintRequest: anEvaluationAnnouncement [ { #category : #'private - event handling' } GtTextualCoderEditorElement >> onShowDebuggerRequest: aShowDebuggerAnnouncement [ | sharedDebugSession anEvaluatedSource anEvaluatedInterval theSourceStartInText theSourceEndInText | - evaluationHighlighter hideResult. evaluationPrinter hideResult. - - sharedDebugSession := GtSharedDebugSession new - session: aShowDebuggerAnnouncement debugSession. - + sharedDebugSession := GtSharedDebugSession new session: aShowDebuggerAnnouncement debugSession. self showNotification: (GtNotificationDebugSession new debugSession: sharedDebugSession). - anEvaluatedSource := aShowDebuggerAnnouncement sourceString. anEvaluatedInterval := aShowDebuggerAnnouncement sourceInterval. - - theSourceStartInText := self text finder + theSourceStartInText := (self text finder) caseSensitiveSubstring: anEvaluatedSource; startAtPosition: anEvaluatedInterval first; - searchClosest. - + searchClosest. + "what did we evaluate?" - theSourceStartInText isZero - ifTrue: [ ^ self ]. - - theSourceEndInText := (theSourceStartInText + anEvaluatedSource size - 1) min: self text size. - + theSourceStartInText isZero ifTrue: [ ^ self ]. + theSourceEndInText := theSourceStartInText + anEvaluatedSource size - 1 min: self text size. + self text clearAttributes: [ :each | {GtEmbeddedDebuggerAttribute} anySatisfy: [ :cls | each isKindOf: cls ] ]. self text - clearAttributes: [ :each | - { GtEmbeddedDebuggerAttribute } anySatisfy: [ :cls | each isKindOf: cls ] ]. - - (self text from: theSourceStartInText to: theSourceEndInText) - attribute: (GtEmbeddedDebuggerAttribute new - signaledException: aShowDebuggerAnnouncement exception; - debugSession: sharedDebugSession) + attribute: + ((GtEmbeddedDebuggerAttribute new) + signaledException: aShowDebuggerAnnouncement exception; + debugSession: sharedDebugSession) + from: theSourceStartInText + to: theSourceEndInText ] { #category : #'private - event handling' } From 1f018a09629100494d42808110249b2ff180a5ef Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 10 May 2022 13:19:21 -0500 Subject: [PATCH 0167/1268] possible fix for renamer disappearing when extracting method --- src/GToolkit-Coder-AddOns/GtRenameAction2.class.st | 2 +- .../GtSourceCoderRefactoringController.class.st | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtRenameAction2.class.st b/src/GToolkit-Coder-AddOns/GtRenameAction2.class.st index 557457ed3..0c63f571f 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameAction2.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameAction2.class.st @@ -349,7 +349,7 @@ GtRenameAction2 >> updateText: text at: intervals attributes: attributeCollectio self pharoSourceCoderViewModel sourceText: newText from: self - synchronously: true + synchronously: false ] { #category : #'private-validation' } diff --git a/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st b/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st index 0dd6d5d42..288b9d2fc 100644 --- a/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st +++ b/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st @@ -85,7 +85,7 @@ GtSourceCoderRefactoringController >> setText: aStringOrText [ self sourceCoderViewModel sourceText: aStringOrText asRopedText from: self - synchronously: true + synchronously: false ] { #category : #accessing } From bff585fcd8c05cfa69491fcc911545eb59a8f2ff Mon Sep 17 00:00:00 2001 From: John Brant Date: Thu, 26 May 2022 15:05:08 -0500 Subject: [PATCH 0168/1268] fix problem with union filter --- src/GToolkit-SearchFilters/GtSearchUnionFilter.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-SearchFilters/GtSearchUnionFilter.class.st b/src/GToolkit-SearchFilters/GtSearchUnionFilter.class.st index f96d1458a..a8fd6ebda 100644 --- a/src/GToolkit-SearchFilters/GtSearchUnionFilter.class.st +++ b/src/GToolkit-SearchFilters/GtSearchUnionFilter.class.st @@ -8,7 +8,7 @@ Class { GtSearchUnionFilter >> defaultFilterScope [ ^ left defaultFilterScope = right defaultFilterScope ifTrue: [ left defaultFilterScope ] - ifFalse: [ left defaultFilterScope merge: right defaultFilterScope ] + ifFalse: [ (left defaultFilterScope merge: right defaultFilterScope) withoutDuplicates ] ] { #category : #printing } From fc4d991d60f72b43497d0c6075cb7d94738bbb4c Mon Sep 17 00:00:00 2001 From: John Brant Date: Sun, 29 May 2022 01:48:39 -0500 Subject: [PATCH 0169/1268] [feenkcom/gtoolkit#2561] cache defaultFilterScope --- .../GtSearchUnionFilter.class.st | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-SearchFilters/GtSearchUnionFilter.class.st b/src/GToolkit-SearchFilters/GtSearchUnionFilter.class.st index a8fd6ebda..f7722b151 100644 --- a/src/GToolkit-SearchFilters/GtSearchUnionFilter.class.st +++ b/src/GToolkit-SearchFilters/GtSearchUnionFilter.class.st @@ -1,14 +1,19 @@ Class { #name : #GtSearchUnionFilter, #superclass : #GtSearchBinaryFilter, + #instVars : [ + 'defaultFilterScope' + ], #category : #'GToolkit-SearchFilters-Filters' } { #category : #accessing } GtSearchUnionFilter >> defaultFilterScope [ - ^ left defaultFilterScope = right defaultFilterScope - ifTrue: [ left defaultFilterScope ] - ifFalse: [ (left defaultFilterScope merge: right defaultFilterScope) withoutDuplicates ] + defaultFilterScope + ifNil: [ defaultFilterScope := left defaultFilterScope = right defaultFilterScope + ifTrue: [ left defaultFilterScope ] + ifFalse: [ (left defaultFilterScope merge: right defaultFilterScope) withoutDuplicates ] ]. + ^ defaultFilterScope asyncSimilarCopy ] { #category : #printing } From a569032ebab2819ee4f8bc49d6ab8d66d7007a52 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Tue, 31 May 2022 15:26:06 +0200 Subject: [PATCH 0170/1268] Add label to tool [feenkcom/gtoolkit#2565] --- .../GtPackagesCoderElement.class.st | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtPackagesCoderElement.class.st b/src/GToolkit-Coder-UI/GtPackagesCoderElement.class.st index a9a39a4ab..73dc78638 100644 --- a/src/GToolkit-Coder-UI/GtPackagesCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtPackagesCoderElement.class.st @@ -5,19 +5,28 @@ Class { 'packagesCoder', 'contentPane' ], - #category : 'GToolkit-Coder-UI-Coder - Packages' + #category : #'GToolkit-Coder-UI-Coder - Packages' } { #category : #'private - ui' } GtPackagesCoderElement >> buildContentPane [ + | container | + container := BlElement new + layout: BlLinearLayout vertical; + addChild: self makeLabel; + constraintsDo: [ :c | + c horizontal matchParent. + c vertical matchParent ]. + contentPane := BlElement new. contentPane layout: BlLinearLayout horizontal. - contentPane padding: (BlInsets all: 5). + contentPane padding: (BlInsets top: 0 left: 5 bottom: 5 right: 5). contentPane constraintsDo: [ :c | c horizontal matchParent. c vertical matchParent ]. - ^ contentPane + + ^ container addChild: contentPane ] { #category : #'private - ui' } @@ -98,3 +107,13 @@ GtPackagesCoderElement >> initialize [ self when: BlClickEvent do: [ self requestFocus ]. self addChild: self buildContentPane. ] + +{ #category : #'private - ui' } +GtPackagesCoderElement >> makeLabel [ + ^ BrLabel new + aptitude: (BrGlamorousLabelAptitude new glamorousRegularFontAndSize + foreground: Color gray; + fontSize: 12); + text: 'Packages'; + padding: (BlInsets top: 5 left: 20) +] From cd75a8283ad3aa03a116e99213543325b2d59549 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 2 Jun 2022 12:14:43 +0200 Subject: [PATCH 0171/1268] [feenkcom/gtoolkit#2571] fix GtCoderPreviewDataBinder >># reset --- src/GToolkit-Coder/GtCoderPreviewDataBinder.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder/GtCoderPreviewDataBinder.class.st b/src/GToolkit-Coder/GtCoderPreviewDataBinder.class.st index d6cfc8211..10e5d4434 100644 --- a/src/GToolkit-Coder/GtCoderPreviewDataBinder.class.st +++ b/src/GToolkit-Coder/GtCoderPreviewDataBinder.class.st @@ -48,6 +48,6 @@ GtCoderPreviewDataBinder >> paramsOn: aStencilExecutor [ { #category : #initialization } GtCoderPreviewDataBinder >> reset [ - super reset. + element := nil. coderViewModel := nil. ] From 0889ea3c811dbb590fa0d7b9b0f21f183b3fa637 Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Sat, 4 Jun 2022 00:01:06 +0200 Subject: [PATCH 0172/1268] removed unused completionStrategy variable feenkcom/gtoolkit#2425 --- src/GToolkit-Coder/GtTextualCoder.class.st | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/GToolkit-Coder/GtTextualCoder.class.st b/src/GToolkit-Coder/GtTextualCoder.class.st index 9b3c3ee11..de862d760 100644 --- a/src/GToolkit-Coder/GtTextualCoder.class.st +++ b/src/GToolkit-Coder/GtTextualCoder.class.st @@ -3,7 +3,6 @@ Class { #superclass : #GtCoderModel, #instVars : [ 'sourceCode', - 'completionStrategy', 'astPromise' ], #category : #'GToolkit-Coder-Coders' @@ -248,7 +247,6 @@ GtTextualCoder >> reset [ "initialized lazily in #sourceCode" sourceCode := nil. - completionStrategy := nil ] { #category : #'private - ast' } From 46125780f05a90124e997100585cb7b86cb12c32 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Sat, 11 Jun 2022 23:16:21 +0200 Subject: [PATCH 0173/1268] Add package tag coder [feenkcom/gtoolkit#2598] --- .../GtPackageTagCoderTool.class.st | 28 +++++++++++++++++++ src/GToolkit-Coder/RPackage.extension.st | 6 ++++ 2 files changed, 34 insertions(+) create mode 100644 src/GToolkit-Coder-UI/GtPackageTagCoderTool.class.st create mode 100644 src/GToolkit-Coder/RPackage.extension.st diff --git a/src/GToolkit-Coder-UI/GtPackageTagCoderTool.class.st b/src/GToolkit-Coder-UI/GtPackageTagCoderTool.class.st new file mode 100644 index 000000000..7c32dfe5e --- /dev/null +++ b/src/GToolkit-Coder-UI/GtPackageTagCoderTool.class.st @@ -0,0 +1,28 @@ +Class { + #name : #GtPackageTagCoderTool, + #superclass : #GtCoderTool, + #instVars : [ + 'packageTag' + ], + #category : #'GToolkit-Coder-UI-Tools' +} + +{ #category : #'instace creation' } +GtPackageTagCoderTool class >> packageTag: aPackageTag [ + ^ self new packageTag: aPackageTag +] + +{ #category : #accessing } +GtPackageTagCoderTool >> newCoder [ + ^ GtCoder forPackageTag: self packageTag +] + +{ #category : #accessing } +GtPackageTagCoderTool >> packageTag [ + ^ packageTag +] + +{ #category : #accessing } +GtPackageTagCoderTool >> packageTag: aPackageTag [ + packageTag := aPackageTag +] diff --git a/src/GToolkit-Coder/RPackage.extension.st b/src/GToolkit-Coder/RPackage.extension.st new file mode 100644 index 000000000..b904326af --- /dev/null +++ b/src/GToolkit-Coder/RPackage.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #RPackage } + +{ #category : #'*GToolkit-Coder' } +RPackage >> gtSpawnCoder [ + ^ GtPackageCoderTool package: self +] From 6fa58ef2a6eb16ae20b30b1fa4a74c31c92d64b7 Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 14 Jun 2022 15:01:01 -0500 Subject: [PATCH 0174/1268] refactoring fix it attribute to support other elements --- .../GtFixItAttribute.class.st | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st index d34c08b2f..d907c3b30 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st @@ -4,36 +4,41 @@ Class { #instVars : [ 'fixItActionsBlock' ], - #category : 'GToolkit-Coder-AddOns-FixIt' + #category : #'GToolkit-Coder-AddOns-FixIt' } { #category : #accessing } GtFixItAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ "Return an element that should affect (either append or replace) a provided text piece" - + ^ GtFixItButton new beTinySize; label: 'Fix it'; - aptitude: - BrGlamorousButtonWithIconAptitude - BrGlamorousButtonExteriorAptitude - + - (BrGlamorousWithDropdownAptitude + aptitude: BrGlamorousButtonWithIconAptitude - BrGlamorousButtonExteriorAptitude + + (BrGlamorousWithDropdownAptitude handle: [ BrButton new beTinySize; - aptitude: - BrGlamorousButtonWithIconAptitude - BrGlamorousButtonWithLabelTooltipAptitude + aptitude: BrGlamorousButtonWithIconAptitude - BrGlamorousButtonWithLabelTooltipAptitude - BrGlamorousButtonExteriorAptitude; icon: BrGlamorousVectorIcons repair; yourself ] - content: [ GtCoderContextMenuContent new - editorElement: anEditorElement; - items: ((fixItActionsBlock value groupedBy: [ :eachFixitAction | eachFixitAction id ]) values - flatCollect: [ :fixitActionsPerId | fixitActionsPerId collectWithIndex: [ :eachFixItAction :eachIndex | eachFixItAction menuActionWithIndex: eachIndex ] ]) ]); + content: [ self dropDownElementFor: anEditorElement ]); icon: BrGlamorousVectorIcons repair; yourself ] +{ #category : #accessing } +GtFixItAttribute >> dropDownElementFor: anEditorElement [ + ^ GtCoderContextMenuContent new + editorElement: anEditorElement; + items: ((fixItActionsBlock value groupedBy: [ :eachFixitAction | eachFixitAction id ]) + values + flatCollect: [ :fixitActionsPerId | + fixitActionsPerId + collectWithIndex: [ :eachFixItAction :eachIndex | eachFixItAction menuActionWithIndex: eachIndex ] ]) +] + { #category : #initialization } GtFixItAttribute >> fixItActions: aCollection [ fixItActionsBlock := aCollection From cf2843bd09b604d21dc5187d6836257534f3326c Mon Sep 17 00:00:00 2001 From: John Brant Date: Thu, 16 Jun 2022 13:36:31 -0500 Subject: [PATCH 0175/1268] [feenkcom/gtoolkit#2610] adding description to fix it attribute --- .../GtFixItAttribute.class.st | 39 +++++++++++++++---- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st index d907c3b30..e785fd245 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st @@ -2,11 +2,17 @@ Class { #name : #GtFixItAttribute, #superclass : #BrTextAdornmentAttribute, #instVars : [ - 'fixItActionsBlock' + 'fixItActionsBlock', + 'descriptionBlock' ], #category : #'GToolkit-Coder-AddOns-FixIt' } +{ #category : #accessing } +GtFixItAttribute >> description: aBlockReturningBlText [ + descriptionBlock := aBlockReturningBlText +] + { #category : #accessing } GtFixItAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ "Return an element that should affect (either append or replace) a provided text piece" @@ -30,13 +36,30 @@ GtFixItAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ { #category : #accessing } GtFixItAttribute >> dropDownElementFor: anEditorElement [ - ^ GtCoderContextMenuContent new - editorElement: anEditorElement; - items: ((fixItActionsBlock value groupedBy: [ :eachFixitAction | eachFixitAction id ]) - values - flatCollect: [ :fixitActionsPerId | - fixitActionsPerId - collectWithIndex: [ :eachFixItAction :eachIndex | eachFixItAction menuActionWithIndex: eachIndex ] ]) + | pane label text menu menuItems | + pane := BrVerticalPane new. + pane fitContent. + menuItems := (fixItActionsBlock value + groupedBy: [ :eachFixitAction | eachFixitAction id ]) values + flatCollect: [ :fixitActionsPerId | + fixitActionsPerId + collectWithIndex: [ :eachFixItAction :eachIndex | eachFixItAction menuActionWithIndex: eachIndex ] ]. + descriptionBlock + ifNotNil: [ text := (descriptionBlock cull: anEditorElement) asRopedText + foreground: BrGlamorousColors disabledButtonTextColor. + label := BrEditor new + vFitContent; + aptitude: BrGlamorousRegularEditorAptitude new glamorousCodeSmallSize; + text: text. + menuItems isEmpty + ifTrue: [ label width: 200 ] + ifFalse: [ label hMatchParent ]. + pane addChild: label ]. + menu := GtCoderContextMenuContent new + editorElement: anEditorElement; + items: menuItems. + pane addChild: menu. + ^ pane ] { #category : #initialization } From b90c12aa4107f585f20dc618a57bb1d128791765 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 17 Jun 2022 07:38:46 -0500 Subject: [PATCH 0176/1268] Fix diff alignment. [feenkcom/gtoolkit#2618] --- src/GToolkit-Coder-UI/GtDiffElement.class.st | 44 +++++++------------- 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtDiffElement.class.st b/src/GToolkit-Coder-UI/GtDiffElement.class.st index c935cd2c0..0d3335a5a 100644 --- a/src/GToolkit-Coder-UI/GtDiffElement.class.st +++ b/src/GToolkit-Coder-UI/GtDiffElement.class.st @@ -156,13 +156,10 @@ GtDiffElement >> initialize [ GtDiffElement >> leftBottomFor: anInteger [ | range element | range := self leftRange. - anInteger < range first - ifTrue: [ ^ 0 ]. - anInteger > range last - ifTrue: [ ^ self height ]. - element := (leftElement children at: anInteger - range first + 1). - ^ (element bounds bottom + leftElement padding top) - max: 0 + anInteger < range first ifTrue: [ ^ 0 ]. + anInteger > range last ifTrue: [ ^ self height ]. + element := leftElement children at: anInteger - range first + 1. + ^ element bounds bottom max: 0 ] { #category : #accessing } @@ -203,13 +200,10 @@ GtDiffElement >> leftStyler: aStyler [ GtDiffElement >> leftTopFor: anInteger [ | range element | range := self leftRange. - anInteger < range first - ifTrue: [ ^ 0 ]. - anInteger > range last - ifTrue: [ ^ self height ]. - element := (leftElement children at: anInteger - range first + 1). - ^ (element bounds top + leftElement padding top) - max: 0 + anInteger < range first ifTrue: [ ^ 0 ]. + anInteger > range last ifTrue: [ ^ self height ]. + element := leftElement children at: anInteger - range first + 1. + ^ element bounds top max: 0 ] { #category : #private } @@ -310,13 +304,10 @@ GtDiffElement >> previousRopedText [ GtDiffElement >> rightBottomFor: anInteger [ | range element | range := self rightRange. - anInteger < range first - ifTrue: [ ^ 0 ]. - anInteger > range last - ifTrue: [ ^ self height ]. - element := (rightElement children at: anInteger - range first + 1). - ^ (element bounds bottom + rightElement padding top) - max: 0 + anInteger < range first ifTrue: [ ^ 0 ]. + anInteger > range last ifTrue: [ ^ self height ]. + element := rightElement children at: anInteger - range first + 1. + ^ element bounds bottom max: 0 ] { #category : #accessing } @@ -357,13 +348,10 @@ GtDiffElement >> rightStyler: aStyler [ GtDiffElement >> rightTopFor: anInteger [ | range element | range := self rightRange. - anInteger < range first - ifTrue: [ ^ 0 ]. - anInteger > range last - ifTrue: [ ^ self height ]. - element := (rightElement children at: anInteger - range first + 1). - ^ (element bounds top + rightElement padding top) - max: 0 + anInteger < range first ifTrue: [ ^ 0 ]. + anInteger > range last ifTrue: [ ^ self height ]. + element := rightElement children at: anInteger - range first + 1. + ^ element bounds top max: 0 ] { #category : #'event handling' } From edb770685047204967ae9268431a16f117e7ff38 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Sat, 18 Jun 2022 13:27:56 +0200 Subject: [PATCH 0177/1268] [feenkcom/gtoolkit#2621] rename BrTextEditor to BrTextEditorModel --- src/GToolkit-Coder-AddOns/GtRenamePreviewAttribute.class.st | 4 ++-- src/GToolkit-Coder-UI/GtCoderActionsElement.class.st | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtRenamePreviewAttribute.class.st b/src/GToolkit-Coder-AddOns/GtRenamePreviewAttribute.class.st index b51626415..9cf125a9d 100644 --- a/src/GToolkit-Coder-AddOns/GtRenamePreviewAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenamePreviewAttribute.class.st @@ -7,7 +7,7 @@ Class { 'renameAction', 'renameEditor' ], - #category : 'GToolkit-Coder-AddOns-Inline rename' + #category : #'GToolkit-Coder-AddOns-Inline rename' } { #category : #accessing } @@ -31,7 +31,7 @@ GtRenamePreviewAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorEle constraintsDo: [ :c | c horizontal fitContent. c vertical fitContent ]. - editor := BrTextEditor new + editor := BrTextEditorModel new text: text; yourself. diff --git a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st index 9328e869a..098f23d20 100644 --- a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st @@ -138,7 +138,7 @@ GtCoderActionsElement >> newDropButtonForAction: aGtCoderAction [ c vertical fitContent ]. titleElement := BrEditorElement new aptitude: BrGlamorousInputFieldSpacingAptitude; - editor: (BrTextEditor new text: '' asRopedText); + editor: (BrTextEditorModel new text: '' asRopedText); requestFocus; constraintsDo: [ :c | c margin: (BlInsets top: 1). From e354616a44de2685c62cd51a884b3d42ce96f401 Mon Sep 17 00:00:00 2001 From: John Brant Date: Mon, 20 Jun 2022 15:14:30 -0500 Subject: [PATCH 0178/1268] [feenkcom/gtoolkit#2610] changing critic to highlight on hover over fix it button --- .../GtFixItAttribute.class.st | 64 ++++++++++++++++--- 1 file changed, 54 insertions(+), 10 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st index e785fd245..73f4306b6 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st @@ -3,7 +3,10 @@ Class { #superclass : #BrTextAdornmentAttribute, #instVars : [ 'fixItActionsBlock', - 'descriptionBlock' + 'descriptionBlock', + 'hoverMarker', + 'hoverAttribute', + 'label' ], #category : #'GToolkit-Coder-AddOns-FixIt' } @@ -15,12 +18,11 @@ GtFixItAttribute >> description: aBlockReturningBlText [ { #category : #accessing } GtFixItAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ - "Return an element that should affect (either append or replace) a provided text piece" - - - ^ GtFixItButton new - beTinySize; - label: 'Fix it'; + | button | + button := GtFixItButton new. + button beTinySize. + button label: (label ifNil: [ 'Fix it' ]). + button aptitude: BrGlamorousButtonWithIconAptitude - BrGlamorousButtonExteriorAptitude + (BrGlamorousWithDropdownAptitude handle: [ BrButton new @@ -29,9 +31,21 @@ GtFixItAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ - BrGlamorousButtonExteriorAptitude; icon: BrGlamorousVectorIcons repair; yourself ] - content: [ self dropDownElementFor: anEditorElement ]); - icon: BrGlamorousVectorIcons repair; - yourself + content: [ self dropDownElementFor: anEditorElement ]). + button icon: BrGlamorousVectorIcons repair. + hoverMarker + ifNotNil: [ button + when: BlMouseEnterEvent + do: [ :anEvent | + anEditorElement editor text + findAttribute: hoverMarker + indicesDo: [ :aHighlightStart :aHighlightEnd | + (anEditorElement text from: aHighlightStart to: aHighlightEnd) + attribute: hoverAttribute ] ]. + button + when: BlMouseLeaveEvent + do: [ :anEvent | anEditorElement text clearAttributes: [ :each | each == hoverAttribute ] ] ]. + ^ button ] { #category : #accessing } @@ -67,9 +81,39 @@ GtFixItAttribute >> fixItActions: aCollection [ fixItActionsBlock := aCollection ] +{ #category : #accessing } +GtFixItAttribute >> hoverAttribute [ + ^ hoverAttribute +] + +{ #category : #accessing } +GtFixItAttribute >> hoverAttribute: aTextAttribute [ + hoverAttribute := aTextAttribute +] + +{ #category : #accessing } +GtFixItAttribute >> hoverMarker [ + ^ hoverMarker +] + +{ #category : #accessing } +GtFixItAttribute >> hoverMarker: aTextAttribute [ + hoverMarker := aTextAttribute +] + { #category : #accessing } GtFixItAttribute >> initialize [ super initialize. self beAppend ] + +{ #category : #accessing } +GtFixItAttribute >> label [ + ^ label +] + +{ #category : #accessing } +GtFixItAttribute >> label: aString [ + label := aString +] From 49b3ebccd0d04438aa26d79e87236b97adccc567 Mon Sep 17 00:00:00 2001 From: John Brant Date: Mon, 20 Jun 2022 15:41:34 -0500 Subject: [PATCH 0179/1268] [feenkcom/gtoolkit#2610] keep critic node highlighted when hovering over fix it drop down actions --- .../GtFixItAttribute.class.st | 47 ++++++++++++------- 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st index 73f4306b6..f7cf03782 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st @@ -11,6 +11,22 @@ Class { #category : #'GToolkit-Coder-AddOns-FixIt' } +{ #category : #accessing } +GtFixItAttribute >> addHoveringStylingFor: anEditorElement to: anElement [ + hoverMarker ifNil: [ ^ self ]. + anElement + when: BlMouseEnterEvent + do: [ :anEvent | + anEditorElement editor text + findAttribute: hoverMarker + indicesDo: [ :aHighlightStart :aHighlightEnd | + (anEditorElement text from: aHighlightStart to: aHighlightEnd) + attribute: hoverAttribute ] ]. + anElement + when: BlMouseLeaveEvent + do: [ :anEvent | anEditorElement text clearAttributes: [ :each | each == hoverAttribute ] ] +] + { #category : #accessing } GtFixItAttribute >> description: aBlockReturningBlText [ descriptionBlock := aBlockReturningBlText @@ -25,26 +41,21 @@ GtFixItAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ button aptitude: BrGlamorousButtonWithIconAptitude - BrGlamorousButtonExteriorAptitude + (BrGlamorousWithDropdownAptitude - handle: [ BrButton new - beTinySize; + handle: [ | dropdownButton | + dropdownButton := BrButton new. + dropdownButton beTinySize. + dropdownButton aptitude: BrGlamorousButtonWithIconAptitude - BrGlamorousButtonWithLabelTooltipAptitude - - BrGlamorousButtonExteriorAptitude; - icon: BrGlamorousVectorIcons repair; - yourself ] - content: [ self dropDownElementFor: anEditorElement ]). + - BrGlamorousButtonExteriorAptitude. + dropdownButton icon: BrGlamorousVectorIcons repair. + self addHoveringStylingFor: anEditorElement to: dropdownButton. + dropdownButton ] + content: [ | element | + element := self dropDownElementFor: anEditorElement. + self addHoveringStylingFor: anEditorElement to: element. + element ]). button icon: BrGlamorousVectorIcons repair. - hoverMarker - ifNotNil: [ button - when: BlMouseEnterEvent - do: [ :anEvent | - anEditorElement editor text - findAttribute: hoverMarker - indicesDo: [ :aHighlightStart :aHighlightEnd | - (anEditorElement text from: aHighlightStart to: aHighlightEnd) - attribute: hoverAttribute ] ]. - button - when: BlMouseLeaveEvent - do: [ :anEvent | anEditorElement text clearAttributes: [ :each | each == hoverAttribute ] ] ]. + self addHoveringStylingFor: anEditorElement to: button. ^ button ] From ab916dc87e005c4bf23118c13b7e1123e1c2e1bd Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Tue, 21 Jun 2022 16:53:01 +0200 Subject: [PATCH 0180/1268] shouldAddOnsBeUpdated should return a promise --- src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st | 2 -- src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 50a24caa6..7eb93f9da 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -250,8 +250,6 @@ GtTextualCoderEditorElement >> onTextualCoderViewModelChanged [ which we will restore once new text is set" self asyncPromise promise: self textualCoderViewModel asEditorState. - self editor model: self textualCoderViewModel. - shortcuts := self textualCoderViewModel shortcuts copy. self editor addEditorShortcuts: shortcuts. diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index d566fbc54..2b9d01ab0 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -680,11 +680,11 @@ GtTextualCoderViewModel >> shortcuts: aCollectionOfShortcuts [ GtTextualCoderViewModel >> shouldAddOnsBeUpdated [ "Return true if addons should be updated, false otherwise. When a Coder Model is attached to the corresponding Element that element should check if addons need to be updated and if it is the case start the update with the help of ${method:GtCoderModel>>#updateAddOnsFrom:}$" - + ^ addOnPromise - ifNil: [ true ] - ifNotNil: [ :theAddOns | theAddOns wait shouldBeUpdated ] + ifNil: [ true asAsyncPromise ] + ifNotNil: [ :theAddOnsPromise | theAddOnsPromise then: [ :theAddOns | theAddOns shouldBeUpdated ] ] ] { #category : #'api - header' } From 8a5546525c0552a50e3087226b71116b65d3543d Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 21 Jun 2022 13:48:55 -0500 Subject: [PATCH 0181/1268] [feenkcom/gtoolkit#2610] adding primary-t to open fix it --- .../GtFixItAttribute.class.st | 52 ++++++++++++------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st index f7cf03782..b4cb949cb 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st @@ -6,7 +6,8 @@ Class { 'descriptionBlock', 'hoverMarker', 'hoverAttribute', - 'label' + 'label', + 'dropDownAptitude' ], #category : #'GToolkit-Coder-AddOns-FixIt' } @@ -38,22 +39,23 @@ GtFixItAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ button := GtFixItButton new. button beTinySize. button label: (label ifNil: [ 'Fix it' ]). + dropDownAptitude := BrGlamorousWithDropdownAptitude + handle: [ | dropdownButton | + dropdownButton := BrButton new. + dropdownButton beTinySize. + dropdownButton + aptitude: BrGlamorousButtonWithIconAptitude - BrGlamorousButtonWithLabelTooltipAptitude + - BrGlamorousButtonExteriorAptitude. + dropdownButton icon: BrGlamorousVectorIcons repair. + self addHoveringStylingFor: anEditorElement to: dropdownButton. + dropdownButton ] + content: [ | element | + element := self dropDownElementFor: anEditorElement. + self addHoveringStylingFor: anEditorElement to: element. + element ]. button aptitude: BrGlamorousButtonWithIconAptitude - BrGlamorousButtonExteriorAptitude - + (BrGlamorousWithDropdownAptitude - handle: [ | dropdownButton | - dropdownButton := BrButton new. - dropdownButton beTinySize. - dropdownButton - aptitude: BrGlamorousButtonWithIconAptitude - BrGlamorousButtonWithLabelTooltipAptitude - - BrGlamorousButtonExteriorAptitude. - dropdownButton icon: BrGlamorousVectorIcons repair. - self addHoveringStylingFor: anEditorElement to: dropdownButton. - dropdownButton ] - content: [ | element | - element := self dropDownElementFor: anEditorElement. - self addHoveringStylingFor: anEditorElement to: element. - element ]). + + dropDownAptitude. button icon: BrGlamorousVectorIcons repair. self addHoveringStylingFor: anEditorElement to: button. ^ button @@ -61,7 +63,7 @@ GtFixItAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ { #category : #accessing } GtFixItAttribute >> dropDownElementFor: anEditorElement [ - | pane label text menu menuItems | + | pane labelText text menu menuItems | pane := BrVerticalPane new. pane fitContent. menuItems := (fixItActionsBlock value @@ -72,14 +74,14 @@ GtFixItAttribute >> dropDownElementFor: anEditorElement [ descriptionBlock ifNotNil: [ text := (descriptionBlock cull: anEditorElement) asRopedText foreground: BrGlamorousColors disabledButtonTextColor. - label := BrEditor new + labelText := BrEditor new vFitContent; aptitude: BrGlamorousRegularEditorAptitude new glamorousCodeSmallSize; text: text. menuItems isEmpty - ifTrue: [ label width: 200 ] - ifFalse: [ label hMatchParent ]. - pane addChild: label ]. + ifTrue: [ labelText width: 200 ] + ifFalse: [ labelText hMatchParent ]. + pane addChild: labelText ]. menu := GtCoderContextMenuContent new editorElement: anEditorElement; items: menuItems. @@ -128,3 +130,13 @@ GtFixItAttribute >> label [ GtFixItAttribute >> label: aString [ label := aString ] + +{ #category : #opening } +GtFixItAttribute >> togglePopup [ + | visible | + dropDownAptitude ifNil: [ ^ false ]. + dropDownAptitude widgetDo: [ :aWidget | visible := aWidget isVisible ]. + visible ifNil: [ ^ false ]. + visible ifTrue: [ dropDownAptitude show ] ifFalse: [ dropDownAptitude hide ]. + ^ true +] From 9ee3717d8dad212e5b4a577483aa75057082bf0c Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 21 Jun 2022 15:49:57 -0500 Subject: [PATCH 0182/1268] reverting change to assign model --- src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 7eb93f9da..50a24caa6 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -250,6 +250,8 @@ GtTextualCoderEditorElement >> onTextualCoderViewModelChanged [ which we will restore once new text is set" self asyncPromise promise: self textualCoderViewModel asEditorState. + self editor model: self textualCoderViewModel. + shortcuts := self textualCoderViewModel shortcuts copy. self editor addEditorShortcuts: shortcuts. From 519b6eb3dd9013eb743e50801806c92c5f2619af Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Mon, 27 Jun 2022 11:38:48 +0200 Subject: [PATCH 0183/1268] Add alt click handler to code definition entity viewer [gtoolkit/feenkcom#2634] --- .../GtCodeDefinitionEntityViewer.class.st | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionEntityViewer.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionEntityViewer.class.st index 7b7c83cdc..643c83e5a 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionEntityViewer.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionEntityViewer.class.st @@ -12,7 +12,7 @@ Class { 'eventHandlers', 'containerName' ], - #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' + #category : #'GToolkit-Coder-UI-Behaviour - Editor / Reader' } { #category : #accessing } @@ -86,6 +86,19 @@ GtCodeDefinitionEntityViewer >> when: aBlEvent do: aBlock [ eventHandlers add: (aBlEvent -> aBlock) ] +{ #category : #interactions } +GtCodeDefinitionEntityViewer >> whenAltClickDo: aBlock [ + "aBlock is in form [ :anEvent :aCodeDefinition ]" + + self + when: BlClickEvent + do: [ :anEvent :aDefinition | + anEvent modifiers isAlt + ifTrue: [ + anEvent consumed: true. + aBlock cull: anEvent cull: aDefinition ] ] +] + { #category : #interactions } GtCodeDefinitionEntityViewer >> whenClickDo: aBlock [ "I do not react to primary+click" From 311ca933fb7e68c37ab93c6a0b36f89f9c27596d Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Tue, 28 Jun 2022 08:49:16 +0200 Subject: [PATCH 0184/1268] Do not forbid focusability on definition reader [feenkcom/gtoolkit#2634] --- src/GToolkit-Coder-UI/GtCodeDefinitionSingleReader.class.st | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionSingleReader.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionSingleReader.class.st index 48fee669d..6886cb918 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionSingleReader.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionSingleReader.class.st @@ -1,7 +1,7 @@ Class { #name : #GtCodeDefinitionSingleReader, #superclass : #GtCodeDefinitionSingleViewer, - #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' + #category : #'GToolkit-Coder-UI-Behaviour - Editor / Reader' } { #category : #'api - instantiation' } @@ -18,7 +18,6 @@ GtCodeDefinitionSingleReader >> create [ fitContent; aptitude: lookStencil create; margin: self margin; - focusability: BlFocusability none; text: theInitialName. self containerName From 83dde4185a82199690b558fb8f871a18176b16db Mon Sep 17 00:00:00 2001 From: Andrei Chis Date: Tue, 28 Jun 2022 22:15:02 +0200 Subject: [PATCH 0185/1268] Use #gtValueWithArgs: instead of #glamorousValueWithArgs: [feenkcom/gtoolkit#2577] --- src/GToolkit-Coder-UI/GtCoderActionsElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st index 098f23d20..96d945064 100644 --- a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st @@ -72,7 +72,7 @@ GtCoderActionsElement >> handleButton: aButtonElement action: aGtCoderAction onE enqueueTask: (BlTaskAction new action: [ [ aGtCoderAction action - glamourValueWithArgs: + gtValueWithArgs: {self textualCoderViewModel. aButtonElement} ] ensure: [ self enqueueEnableButton: aButtonElement action: aGtCoderAction ] ]) ] From 88ce5c4c17b350c150387450e6b22c290ffb425d Mon Sep 17 00:00:00 2001 From: Andrei Chis Date: Tue, 28 Jun 2022 22:15:20 +0200 Subject: [PATCH 0186/1268] Remove #glamorousValueWithArgs: in GtCoderAction [feenkcom/gtoolkit#2577] --- src/GToolkit-Coder/GtCoderAction.class.st | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/GToolkit-Coder/GtCoderAction.class.st b/src/GToolkit-Coder/GtCoderAction.class.st index c9995fece..589424937 100644 --- a/src/GToolkit-Coder/GtCoderAction.class.st +++ b/src/GToolkit-Coder/GtCoderAction.class.st @@ -31,11 +31,6 @@ GtCoderAction >> action: anObject [ action := anObject ] -{ #category : #evaluating } -GtCoderAction >> glamourValueWithArgs: aSequenceOfArguments [ - ^ self action glamourValueWithArgs: aSequenceOfArguments -] - { #category : #comparing } GtCoderAction >> hash [ "Answer an integer value that is related to the identity of the receiver." From d25292679043c25db4a5d943f96c6224fe733f7a Mon Sep 17 00:00:00 2001 From: Andrei Chis Date: Wed, 29 Jun 2022 23:10:27 +0200 Subject: [PATCH 0187/1268] Use GtSelector [feenkcom/gtoolkit#2577] --- src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st b/src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st index 83ead3802..d3e149352 100644 --- a/src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st +++ b/src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st @@ -4,7 +4,7 @@ Class { #instVars : [ 'navigationModelBlock' ], - #category : 'GToolkit-Coder-UI-Basic' + #category : #'GToolkit-Coder-UI-Basic' } { #category : #searching } @@ -49,12 +49,13 @@ GtCoderSpotterStart >> gtSpotterForInstanceMethodsInCurrentClassFor: aStep [ { #category : #searching } GtCoderSpotterStart >> gtSpotterForMessagesFor: aStep [ + aStep listProcessor priority: 35; title: 'Messages'; filter: GtNullFilter item: - [ :filter :context | GTSelector substring: context textTrimmed filter: filter ]; + [ :filter :context | GtSelector substring: context textTrimmed filter: filter ]; actLogic: [ :each :step :spotterElement | (each name asSymbol gtImplementors) gtSpotterActDefault: step From 7227c92aa3037771fb229dba20cfaa465acfddb9 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Mon, 4 Jul 2022 14:31:35 +0200 Subject: [PATCH 0188/1268] Move toolbar into coder element [feenkcom/gtoolkit#2648] --- src/GToolkit-Coder-UI/GtCoder.class.st | 21 +---------------- .../GtCoderToolbarElement.class.st | 9 ++------ .../GtPackagesCoderElement.class.st | 23 +++++++++++-------- 3 files changed, 17 insertions(+), 36 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoder.class.st b/src/GToolkit-Coder-UI/GtCoder.class.st index 1aad20f56..9a63e12da 100644 --- a/src/GToolkit-Coder-UI/GtCoder.class.st +++ b/src/GToolkit-Coder-UI/GtCoder.class.st @@ -19,10 +19,9 @@ Class { #instVars : [ 'sidebarElement', 'contentElement', - 'toolbarElement', 'titleNotifier' ], - #category : 'GToolkit-Coder-UI-! Core' + #category : #'GToolkit-Coder-UI-! Core' } { #category : #'private - accessing' } @@ -38,14 +37,12 @@ GtCoder >> initialize [ self addInteractiveModelState: GtPhlowToolDetailModel new. self initializeContentElement. self initializeSidebarElement. - self initializeToolbarElement. self initializeListeners. self layout: BlLinearLayout horizontal. self addChild: self sidebarElement as: #sidebar. self addChild: self contentElement as: #content. - self addChild: self toolbarElement as: #toolbar. self addAptitude: (BrLayoutResizerAptitude inherit). ] @@ -71,20 +68,10 @@ GtCoder >> initializeTitleNotifier [ self addEventHandler: titleNotifier. ] -{ #category : #initialization } -GtCoder >> initializeToolbarElement [ - toolbarElement := GtCoderToolbarElement new - constraintsDo: [ :c | - c ignoreByLayout. - c ignored horizontal alignRight. - c ignored vertical alignTop ]. -] - { #category : #'private - hooks' } GtCoder >> onNavigationModelChanged [ super onNavigationModelChanged. self contentElement navigationModel: self navigationModel. - self toolbarElement navigationModel: self navigationModel. self updateSidebarContent. self updateTabLabel ] @@ -143,12 +130,6 @@ GtCoder >> titleNotifier [ ^ titleNotifier ] -{ #category : #'private - accessing' } -GtCoder >> toolbarElement [ - - ^ toolbarElement -] - { #category : #'private - updating' } GtCoder >> updateSidebarContent [ self sidebarElement diff --git a/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st b/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st index dc47cd57d..9e4f7149e 100644 --- a/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st @@ -142,14 +142,9 @@ GtCoderToolbarElement >> initialize [ { #category : #initialization } GtCoderToolbarElement >> initializeToolbarElement [ - toolbarElement := BrToolbar new - aptitude: BrGlamorousToolbarAptitude new; - padding: (BlInsets - top: 10 - left: 0 - bottom: 0 - right: 5). + aptitude: BrGlamorousToolbarAptitude new; + padding: (BlInsets right: 5). self addCustomButtons ] diff --git a/src/GToolkit-Coder-UI/GtPackagesCoderElement.class.st b/src/GToolkit-Coder-UI/GtPackagesCoderElement.class.st index 73dc78638..e47a0933b 100644 --- a/src/GToolkit-Coder-UI/GtPackagesCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtPackagesCoderElement.class.st @@ -1,6 +1,8 @@ Class { #name : #GtPackagesCoderElement, #superclass : #BlElement, + #traits : 'TGtWithCoderToolbar', + #classTraits : 'TGtWithCoderToolbar classTrait', #instVars : [ 'packagesCoder', 'contentPane' @@ -52,18 +54,20 @@ GtPackagesCoderElement >> buildPackagesElement [ c horizontal matchParent. c vertical matchParent ]. element - addChild: - (BrLabel new - margin: (BlInsets left: 10); - aptitude: (BrGlamorousLabelAptitude new bold glamorousRegularFont fontSize: 18); - text: packagesCoder name). + addChild: (BrHorizontalPane new + constraintsDo: [ :c | + c horizontal matchParent. + c vertical fitContent ]; + addChild: (BrLabel new + margin: (BlInsets left: 10); + aptitude: (BrGlamorousLabelAptitude new bold glamorousRegularFont fontSize: 18); + text: packagesCoder name); + addChild: self toolbarElement). element - addChild: - (BrLabel new + addChild: (BrLabel new margin: (BlInsets left: 10); beSmallSize; - aptitude: - (BrGlamorousLabelAptitude new glamorousRegularFont + aptitude: (BrGlamorousLabelAptitude new glamorousRegularFont foreground: self theme button defaultTextColor); text: packagesCoder coders size printString , ' Packages'). element addChild: self buildPackageList. @@ -99,6 +103,7 @@ GtPackagesCoderElement >> codersUIModel: aPackagesCoder [ { #category : #'initialize-release' } GtPackagesCoderElement >> initialize [ super initialize. + self initializeToolbarElement. self constraintsDo: [ :c | c horizontal matchParent. From 4e9c9328dbee14c54ce7535a6cf70e4f6593f14f Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Mon, 4 Jul 2022 15:10:47 +0200 Subject: [PATCH 0189/1268] Add coder toolbar to inspector [feenkcom/gtoolkit#2649] --- src/GToolkit-Coder-UI/GtCoderContentElement.class.st | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderContentElement.class.st b/src/GToolkit-Coder-UI/GtCoderContentElement.class.st index f9d7f2114..a62173b23 100644 --- a/src/GToolkit-Coder-UI/GtCoderContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderContentElement.class.st @@ -9,7 +9,7 @@ I display a {{gtClass:GtPharoBehaviorCoder}}, {{gtClass:GtPharoPackageTagCoder}} Class { #name : #GtCoderContentElement, #superclass : #GtCoderNavigationModelElement, - #category : 'GToolkit-Coder-UI-Basic' + #category : #'GToolkit-Coder-UI-Basic' } { #category : #factory } @@ -48,5 +48,6 @@ GtCoderContentElement >> subscribeToNavigationModel [ { #category : #'private - event handling' } GtCoderContentElement >> updateCoder: anAnnouncement [ self removeChildren. - self addChild: anAnnouncement coder asElement. + self + addChild: (anAnnouncement coder asElement navigationModelForToolbar: self navigationModel) ] From 0cb7ce5c1e9aa5ffc4f456e5e1e111de5e4d315a Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Mon, 4 Jul 2022 15:15:50 +0200 Subject: [PATCH 0190/1268] Move `TGtWithCoderToolbar` to gtoolkit-coder --- .../TGtWithCoderToolbar.trait.st | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/GToolkit-Coder-UI/TGtWithCoderToolbar.trait.st diff --git a/src/GToolkit-Coder-UI/TGtWithCoderToolbar.trait.st b/src/GToolkit-Coder-UI/TGtWithCoderToolbar.trait.st new file mode 100644 index 000000000..23c9abf1f --- /dev/null +++ b/src/GToolkit-Coder-UI/TGtWithCoderToolbar.trait.st @@ -0,0 +1,26 @@ +Trait { + #name : #TGtWithCoderToolbar, + #instVars : [ + 'toolbarElement' + ], + #category : #'GToolkit-Coder-UI-Coder - Basic' +} + +{ #category : #accessing } +TGtWithCoderToolbar >> initializeToolbarElement [ + toolbarElement := GtCoderToolbarElement new + constraintsDo: [ :c | + c ignoreByLayout. + c ignored horizontal alignRight. + c ignored vertical alignTop ] +] + +{ #category : #accessing } +TGtWithCoderToolbar >> navigationModelForToolbar: aNavigationModel [ + self toolbarElement navigationModel: aNavigationModel +] + +{ #category : #accessing } +TGtWithCoderToolbar >> toolbarElement [ + ^ toolbarElement +] From 9e246eb9b43b4592e11a0e018145866f4a075184 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 7 Jul 2022 08:48:09 -0500 Subject: [PATCH 0191/1268] Change hover color in coder context menus [feenkcom/gtoolkit#2659] --- src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st index 39bbc311f..9ce2f08cd 100644 --- a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st +++ b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st @@ -4,7 +4,7 @@ Class { #instVars : [ 'editorElement' ], - #category : 'GToolkit-Coder-UI-Basic' + #category : #'GToolkit-Coder-UI-Basic' } { #category : #defaults } @@ -43,7 +43,7 @@ GtCoderContextMenuContent >> initialize [ addAptitude: (BrStyleCommonAptitude new hovered: - [ :aStyle | aStyle background: self theme button defaultBorderColor ]); + [ :aStyle | aStyle background: self theme item selectedColor ]); padding: (BlInsets all: 5); when: BlClickEvent do: [ :anEvent | From 6a7f548f3b92bc6abd70fc6337f300741bc7c1cf Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 7 Jul 2022 09:28:31 -0500 Subject: [PATCH 0192/1268] Tighten up spacing in coder context menus [feenkcom/gtoolkit#2659] --- .../GtCoderContextMenuContent.class.st | 44 ++++++++++--------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st index 9ce2f08cd..dc2c18f2d 100644 --- a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st +++ b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st @@ -38,27 +38,24 @@ GtCoderContextMenuContent >> initialize [ stencil: [ :eachGtCoderContextMenuAction | | element | element := BrHorizontalPane new - hMatchParent; - vFitContent; - addAptitude: - (BrStyleCommonAptitude new - hovered: - [ :aStyle | aStyle background: self theme item selectedColor ]); - padding: (BlInsets all: 5); - when: BlClickEvent - do: [ :anEvent | - anEvent consumed: true. - eachGtCoderContextMenuAction action - cull: self editorElement textualCoderViewModel - cull: self editorElement - cull: anEvent. - self fireEvent: BrDropdownHideWish new. - self fireEvent: BrContextMenuHideWish new ]; - addChild: - (BrLabel new - aptitude: BrGlamorousLabelAptitude; - text: eachGtCoderContextMenuAction title; - yourself). + hMatchParent; + vFitContent; + addAptitude: (BrStyleCommonAptitude new + hovered: [ :aStyle | aStyle background: self theme item selectedColor ]); + padding: (BlInsets top: 2 bottom: 2); + when: BlClickEvent + do: [ :anEvent | + anEvent consumed: true. + eachGtCoderContextMenuAction action + cull: self editorElement textualCoderViewModel + cull: self editorElement + cull: anEvent. + self fireEvent: BrDropdownHideWish new. + self fireEvent: BrContextMenuHideWish new ]; + addChild: (BrLabel new + aptitude: BrGlamorousLabelAptitude; + text: eachGtCoderContextMenuAction title; + yourself). eachGtCoderContextMenuAction hoverAction ifNotNil: [ :hover | element @@ -72,6 +69,11 @@ GtCoderContextMenuContent >> initialize [ eachGtCoderContextMenuAction name ifNotNil: [ :anActionName | element containerName: anActionName ]. element ]; + padding: (BlInsets + top: 8 + right: 10 + bottom: 8 + left: 10); hFitContent; vFitContent ] From 556092313f9c8e197bbfff10a84eff2310040d25 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 8 Jul 2022 10:19:59 -0500 Subject: [PATCH 0193/1268] Add shortcut keys to context menu [feenkcom/gtoolkit#2659] --- .../GtTextualCoder.extension.st | 9 +++-- .../GtCoderContextMenuContent.class.st | 19 +++++----- .../GtTextualCoderEditorElement.class.st | 29 +++++++-------- src/GToolkit-Coder/GtCoderAction.class.st | 15 +++++++- .../GtCoderActionSeparator.class.st | 12 +++++++ src/GToolkit-Coder/GtCoderAddOns.class.st | 35 +++++++++++++++++++ 6 files changed, 91 insertions(+), 28 deletions(-) create mode 100644 src/GToolkit-Coder/GtCoderActionSeparator.class.st diff --git a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st index 7054e5823..7bf2f09b9 100644 --- a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st +++ b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st @@ -3,14 +3,19 @@ Extension { #name : #GtTextualCoder } { #category : #'*GToolkit-Coder-AddOns' } GtTextualCoder >> addCopyCutPasteContextMenuAddOnsAst: anAst to: coderAddOns [ + | mod | + mod := OSPlatform current defaultModifier name. coderAddOns addContextMenuItem: 'Cut' action: [ :aCoderViewModel :anEditorElement | anEditorElement editor cutSelected ] - id: GtTextualCoderCutContextMenuItemId; + id: GtTextualCoderCutContextMenuItemId + shortcutKey: mod, '-X'; addContextMenuItem: 'Copy' action: [ :aCoderViewModel :anEditorElement | anEditorElement editor copySelected ] - id: GtTextualCoderCopyContextMenuItemId; + id: GtTextualCoderCopyContextMenuItemId + shortcutKey: mod, '-C'; addContextMenuItem: 'Paste' action: [ :aCoderViewModel :anEditorElement | anEditorElement editor paste ] id: GtTextualCoderPasteContextMenuItemId + shortcutKey: mod, '-V' ] diff --git a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st index dc2c18f2d..83568071a 100644 --- a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st +++ b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st @@ -7,16 +7,6 @@ Class { #category : #'GToolkit-Coder-UI-Basic' } -{ #category : #defaults } -GtCoderContextMenuContent >> defaultContextMenuActionName [ - ^ #contextMenuAction -] - -{ #category : #defaults } -GtCoderContextMenuContent >> defaultLabelChildName [ - ^ #label -] - { #category : #'api - accessing' } GtCoderContextMenuContent >> editorElement [ @@ -54,7 +44,14 @@ GtCoderContextMenuContent >> initialize [ self fireEvent: BrContextMenuHideWish new ]; addChild: (BrLabel new aptitude: BrGlamorousLabelAptitude; - text: eachGtCoderContextMenuAction title; + text: (eachGtCoderContextMenuAction title asRopedText + attributes: {BlFontSizeAttribute size: 12}); + hMatchParent; + yourself); + addChild: (BrLabel new + aptitude: BrGlamorousLabelAptitude; + text: (eachGtCoderContextMenuAction shortcutKey asRopedText attributes: {BlFontSizeAttribute size: 12}); + hFitContent; yourself). eachGtCoderContextMenuAction hoverAction ifNotNil: [ :hover | diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 50a24caa6..0546637a9 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -20,21 +20,22 @@ GtTextualCoderEditorElement >> coderViewModel: aTextualCoderViewModel [ { #category : #'instance creation' } GtTextualCoderEditorElement >> createContextMenuContent [ "wait for the addons to be computed" + | theContextMenu aContextMenuPromise | - - theContextMenu := GtCoderContextMenuContent new - editorElement: self. - - aContextMenuPromise := self textualCoderViewModel addOns asyncThen: [ :theAddOns | - | theItems theContextMenuAstAddons | - - "extra context menu items that depend on ast and view model state such as selection" - theContextMenuAstAddons := self textualCoderViewModel computeContextMenuAstAddOns. - - theItems := theAddOns contextMenuActions, theAddOns mainActions, theContextMenuAstAddons contextMenuActions. - theItems := theItems reject: [ :e | e title isNil ]. - - theContextMenu enqueueTask: (BlTaskAction new action: [ theContextMenu items: theItems ]) ]. + theContextMenu := GtCoderContextMenuContent new editorElement: self. + + aContextMenuPromise := self textualCoderViewModel addOns + asyncThen: [ :theAddOns | + | theItems theContextMenuAstAddons | + "extra context menu items that depend on ast and view model state such as selection" + theContextMenuAstAddons := self textualCoderViewModel + computeContextMenuAstAddOns. + theItems := theAddOns contextMenuActions , theAddOns mainActions + , theContextMenuAstAddons contextMenuActions. + theItems := theItems reject: [ :e | e title isNil ]. + + theContextMenu + enqueueTask: (BlTaskAction new action: [ theContextMenu items: theItems ]) ]. self enqueueTask: (BlPromiseTask new promise: aContextMenuPromise). diff --git a/src/GToolkit-Coder/GtCoderAction.class.st b/src/GToolkit-Coder/GtCoderAction.class.st index 589424937..d40d408ff 100644 --- a/src/GToolkit-Coder/GtCoderAction.class.st +++ b/src/GToolkit-Coder/GtCoderAction.class.st @@ -5,7 +5,8 @@ Class { 'title', 'icon', 'action', - 'id' + 'id', + 'shortcutKey' ], #category : #'GToolkit-Coder-Coders - Addons' } @@ -89,6 +90,18 @@ GtCoderAction >> printOn: aStream [ nextPut: $) ] +{ #category : #accessing } +GtCoderAction >> shortcutKey [ + + ^ shortcutKey ifNil: [shortcutKey := ''] +] + +{ #category : #accessing } +GtCoderAction >> shortcutKey: aString [ + + shortcutKey := aString +] + { #category : #accessing } GtCoderAction >> title [ ^ title diff --git a/src/GToolkit-Coder/GtCoderActionSeparator.class.st b/src/GToolkit-Coder/GtCoderActionSeparator.class.st new file mode 100644 index 000000000..48cc4d7ba --- /dev/null +++ b/src/GToolkit-Coder/GtCoderActionSeparator.class.st @@ -0,0 +1,12 @@ +Class { + #name : #GtCoderActionSeparator, + #superclass : #GtCoderAction, + #category : #'GToolkit-Coder-Coders - Addons' +} + +{ #category : #accessing } +GtCoderActionSeparator >> initialize [ + super initialize. + title := '-------------'. + action := [ ] +] diff --git a/src/GToolkit-Coder/GtCoderAddOns.class.st b/src/GToolkit-Coder/GtCoderAddOns.class.st index 2de14c27a..162feb29f 100644 --- a/src/GToolkit-Coder/GtCoderAddOns.class.st +++ b/src/GToolkit-Coder/GtCoderAddOns.class.st @@ -84,6 +84,17 @@ GtCoderAddOns >> addContextMenuItem: aString action: aBlock id: aSymbol [ id: aSymbol ] +{ #category : #'api - context menu' } +GtCoderAddOns >> addContextMenuItem: aString action: aBlock id: aSymbol shortcutKey: shortcutString [ + ^ self + addContextMenuItem: aString + hover: nil + leave: nil + action: aBlock + id: aSymbol + shortcutKey: shortcutString +] + { #category : #'api - context menu' } GtCoderAddOns >> addContextMenuItem: aString hover: hoverBlock leave: leaveBlock action: aBlock [ self @@ -106,6 +117,30 @@ GtCoderAddOns >> addContextMenuItem: aString hover: hoverBlock leave: leaveBlock self addContextMenuAction: newAction ] +{ #category : #'api - context menu' } +GtCoderAddOns >> addContextMenuItem: aString hover: hoverBlock leave: leaveBlock action: aBlock id: aSymbol shortcutKey: shortcutString [ + | newAction | + newAction := GtCoderContextMenuAction new + title: aString; + action: aBlock; + hoverAction: hoverBlock; + leaveAction: leaveBlock; + id: aSymbol; + shortcutKey: shortcutString. + self addContextMenuAction: newAction +] + +{ #category : #'api - context menu' } +GtCoderAddOns >> addContextMenuItem: aString hover: hoverBlock leave: leaveBlock action: aBlock shortcutKey: shortcutString [ + self + addContextMenuItem: aString + hover: hoverBlock + leave: leaveBlock + action: aBlock + id: nil + shortcutKey: shortcutString +] + { #category : #'api - main actions' } GtCoderAddOns >> addDropDownAction: aString icon: anIcon stencil: aBlock [ | newAction | From 89145047672bf85a07f33911aa0b1bdb614de9ee Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 8 Jul 2022 15:52:10 -0500 Subject: [PATCH 0194/1268] Fancier shortcut menus [feenkcom/gtoolkit#2659] --- .../GtCoderContextMenuContent.class.st | 35 ++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st index 83568071a..a5e4bbd53 100644 --- a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st +++ b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st @@ -30,9 +30,15 @@ GtCoderContextMenuContent >> initialize [ element := BrHorizontalPane new hMatchParent; vFitContent; + alignCenter; addAptitude: (BrStyleCommonAptitude new hovered: [ :aStyle | aStyle background: self theme item selectedColor ]); padding: (BlInsets top: 2 bottom: 2); + addChild: (BrLabel new + aptitude: BrGlamorousLabelAptitude; + text: eachGtCoderContextMenuAction title asRopedText; + hMatchParent; + yourself); when: BlClickEvent do: [ :anEvent | anEvent consumed: true. @@ -41,18 +47,23 @@ GtCoderContextMenuContent >> initialize [ cull: self editorElement cull: anEvent. self fireEvent: BrDropdownHideWish new. - self fireEvent: BrContextMenuHideWish new ]; - addChild: (BrLabel new - aptitude: BrGlamorousLabelAptitude; - text: (eachGtCoderContextMenuAction title asRopedText - attributes: {BlFontSizeAttribute size: 12}); - hMatchParent; - yourself); - addChild: (BrLabel new - aptitude: BrGlamorousLabelAptitude; - text: (eachGtCoderContextMenuAction shortcutKey asRopedText attributes: {BlFontSizeAttribute size: 12}); - hFitContent; - yourself). + self fireEvent: BrContextMenuHideWish new ]. + eachGtCoderContextMenuAction shortcutKey isEmpty + ifFalse: [ element + addChild: (BrHorizontalPane new + fitContent; + geometry: (BlRoundedRectangleGeometry cornerRadius: 4); + border: (BlBorder paint: Color gray width: 1); + padding: (BlInsets all: 1); + addChild: (BrLabel new + aptitude: BrGlamorousLabelAptitude; + text: (eachGtCoderContextMenuAction shortcutKey asRopedText + fontName: 'Source Code Pro'; + foreground: Color gray; + fontSize: 10); + hFitContent; + yourself); + yourself) ]. eachGtCoderContextMenuAction hoverAction ifNotNil: [ :hover | element From 6af325f0a05378f36c0d562d87bcccb28c1da344 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Sat, 9 Jul 2022 19:05:31 -0500 Subject: [PATCH 0195/1268] Pull key combinations from Shortcuts [feenk/gtoolkit#2659] --- src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st index 7bf2f09b9..7a927682e 100644 --- a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st +++ b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st @@ -3,19 +3,17 @@ Extension { #name : #GtTextualCoder } { #category : #'*GToolkit-Coder-AddOns' } GtTextualCoder >> addCopyCutPasteContextMenuAddOnsAst: anAst to: coderAddOns [ - | mod | - mod := OSPlatform current defaultModifier name. coderAddOns addContextMenuItem: 'Cut' action: [ :aCoderViewModel :anEditorElement | anEditorElement editor cutSelected ] id: GtTextualCoderCutContextMenuItemId - shortcutKey: mod, '-X'; + shortcutKey: BrEditorShortcut cut combinationForPlatform userPrintString; addContextMenuItem: 'Copy' action: [ :aCoderViewModel :anEditorElement | anEditorElement editor copySelected ] id: GtTextualCoderCopyContextMenuItemId - shortcutKey: mod, '-C'; + shortcutKey: BrEditorShortcut copy combinationForPlatform userPrintString; addContextMenuItem: 'Paste' action: [ :aCoderViewModel :anEditorElement | anEditorElement editor paste ] id: GtTextualCoderPasteContextMenuItemId - shortcutKey: mod, '-V' + shortcutKey: BrEditorShortcut paste combinationForPlatform userPrintString ] From e12a8695ea2544fe3288b6ed752612fbe63fb83f Mon Sep 17 00:00:00 2001 From: Andrei Chis Date: Wed, 13 Jul 2022 17:13:24 +0200 Subject: [PATCH 0196/1268] Remove specific code for handling quick methods --- src/GToolkit-Coder/DebugSession.extension.st | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder/DebugSession.extension.st b/src/GToolkit-Coder/DebugSession.extension.st index 487fed66d..8dc418983 100644 --- a/src/GToolkit-Coder/DebugSession.extension.st +++ b/src/GToolkit-Coder/DebugSession.extension.st @@ -17,11 +17,10 @@ DebugSession >> gtRecompileMethodTo: text inContext: aContext notifying: aNotify aContext method isDoIt ifTrue: [ ^ false ]. (recompilationContext := (self gtCreateModelForContext: aContext) locateClosureHomeWithContent: text) ifNil: [ ^ false ]. + newMethod := (self gtCreateModelForContext: recompilationContext) recompileCurrentMethodTo: text notifying: aNotifyer. newMethod ifNil: [ ^ false ]. - newMethod isQuick - ifTrue: [ recompilationContext := self downInContext: recompilationContext. - recompilationContext jump: recompilationContext previousPc - recompilationContext pc ]. + (self isContextPostMortem: self interruptedContext) ifFalse: [ self rewindContextToMethod: newMethod fromContext: recompilationContext ]. From a99fd95d8744c44398a1b0386aee05f9a8c5229d Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 14 Jul 2022 07:26:20 -0600 Subject: [PATCH 0197/1268] Add evaluate and inspect context menu items to coder [feenkcom/gtoolkit#2659] --- src/GToolkit-Coder/GtCoderAddOns.class.st | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/GToolkit-Coder/GtCoderAddOns.class.st b/src/GToolkit-Coder/GtCoderAddOns.class.st index 162feb29f..393d5b45d 100644 --- a/src/GToolkit-Coder/GtCoderAddOns.class.st +++ b/src/GToolkit-Coder/GtCoderAddOns.class.st @@ -95,6 +95,16 @@ GtCoderAddOns >> addContextMenuItem: aString action: aBlock id: aSymbol shortcut shortcutKey: shortcutString ] +{ #category : #'api - context menu' } +GtCoderAddOns >> addContextMenuItem: aString action: aBlock shortcutKey: shortcut [ + ^ self + addContextMenuItem: aString + hover: nil + leave: nil + action: aBlock + shortcutKey: shortcut +] + { #category : #'api - context menu' } GtCoderAddOns >> addContextMenuItem: aString hover: hoverBlock leave: leaveBlock action: aBlock [ self From 67159f94fb6341dafe67c4abff65be32505f0f1f Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Mon, 18 Jul 2022 08:06:50 -0500 Subject: [PATCH 0198/1268] Refactor to pull more information directly from shortcuts for context menus [feenkcom/gtoolkit#2659] --- .../GtTextualCoder.extension.st | 36 ++++++++++++------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st index 7a927682e..a35bf7386 100644 --- a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st +++ b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st @@ -1,19 +1,29 @@ Extension { #name : #GtTextualCoder } +{ #category : #'*GToolkit-Coder-AddOns' } +GtTextualCoder >> addContextMenuItemFrom: shortcut withId: menuId to: coderAddOns [ + coderAddOns + addContextMenuItem: shortcut name + action: [ :aCoderViewModel :anEditorElement | + shortcut + performOnEditor: anEditorElement editor + element: anEditorElement + dueTo: nil ] + id: menuId + shortcutKey: shortcut combinationForPlatform userPrintString +] + { #category : #'*GToolkit-Coder-AddOns' } GtTextualCoder >> addCopyCutPasteContextMenuAddOnsAst: anAst to: coderAddOns [ - coderAddOns - addContextMenuItem: 'Cut' - action: [ :aCoderViewModel :anEditorElement | anEditorElement editor cutSelected ] - id: GtTextualCoderCutContextMenuItemId - shortcutKey: BrEditorShortcut cut combinationForPlatform userPrintString; - addContextMenuItem: 'Copy' - action: [ :aCoderViewModel :anEditorElement | anEditorElement editor copySelected ] - id: GtTextualCoderCopyContextMenuItemId - shortcutKey: BrEditorShortcut copy combinationForPlatform userPrintString; - addContextMenuItem: 'Paste' - action: [ :aCoderViewModel :anEditorElement | anEditorElement editor paste ] - id: GtTextualCoderPasteContextMenuItemId - shortcutKey: BrEditorShortcut paste combinationForPlatform userPrintString + self + addContextMenuItemFrom: BrEditorShortcut cut + withId: GtTextualCoderCutContextMenuItemId + to: coderAddOns; + addContextMenuItemFrom: BrEditorShortcut copy + withId: GtTextualCoderCopyContextMenuItemId + to: coderAddOns; + addContextMenuItemFrom: BrEditorShortcut paste + withId: GtTextualCoderPasteContextMenuItemId + to: coderAddOns ] From f3a912a443523283c12b2b8baa819bc25d6b3bb4 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Mon, 18 Jul 2022 18:00:11 +0200 Subject: [PATCH 0199/1268] Remove filters when backspace is pressed even if there is no value [gtoolkit/issues#2678] --- src/GToolkit-Coder-UI/GtFilterTagElement.class.st | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st index 595fc80d8..360fcb05a 100644 --- a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st @@ -92,6 +92,14 @@ GtFilterTagElement >> createDropDown [ button addAptitude: (BrStyleCommonAptitude new default: [ :s | s background: Color transparent ]; hovered: [ :s | s background: self theme status neutralBackgroundColor darker ]). + + button + when: BlKeyUpEvent + do: [ :anEvent | + anEvent key = BlKeyboardKey backspace ifTrue: [ + self removeFromParent. + filterElement applyFilters ] ]. + ^ button ] From 8e4ccac034b97f1e932c5bdc096e92187175f288 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Mon, 18 Jul 2022 13:24:01 -0500 Subject: [PATCH 0200/1268] BrLabel now defaults to aptitude BrGlamorousLabelAptitude --- .../CompiledMethod.extension.st | 23 ++++++------- .../GtCoderContextMenuContent.class.st | 2 -- .../GtCoderExampleStateElement.class.st | 9 ++---- .../GtCoderFilterListItemElement.class.st | 3 +- ...gationClassesHierarchyTreeElement.class.st | 13 +++----- ...vigationMethodProtocolListElement.class.st | 1 - ...ourceCoderCollapsedContentElement.class.st | 32 +++++++++---------- 7 files changed, 37 insertions(+), 46 deletions(-) diff --git a/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st b/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st index 6dcd26072..599d687d2 100644 --- a/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st +++ b/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st @@ -22,29 +22,30 @@ CompiledMethod >> gtDisplayOn: aStream [ { #category : #'*GToolkit-Coder-Extensions' } CompiledMethod >> gtLocalVersionsFor: aView [ - ^ aView columnedList + ^ aView columnedList title: 'Local versions'; priority: 20; - items: [ - SourceFiles + items: [ SourceFiles changeRecordsFrom: self sourcePointer className: self methodClass name isMeta: self methodClass isMeta ]; - column: 'Timestamp' text: #timeStamp width: 200; + column: 'Timestamp' + text: #timeStamp + width: 200; column: 'Change' translated - icon: [ :eachItem | + icon: [ :eachItem | BrExpander new vFitContent; hMatchParent; collapse; margin: (BlInsets all: 10); aptitude: GtCoderExpanderAptitude new; - header: [ BrLabel new aptitude: BrGlamorousLabelAptitude; text: eachItem gtDisplayString ]; + header: [ BrLabel new text: eachItem gtDisplayString ]; content: [ | container | - container := BrFrame new - vExact: 400; - hMatchParent; - aptitude: BrGlamorousWithVerticalResizerAptitude; - addChild: ((eachItem gtSourceFor: GtPhlowEmptyView new) asElement) matchParent ] ] + container := BrFrame new + vExact: 400; + hMatchParent; + aptitude: BrGlamorousWithVerticalResizerAptitude; + addChild: (eachItem gtSourceFor: GtPhlowEmptyView new) asElement matchParent ] ] weight: 1 ] diff --git a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st index a5e4bbd53..e54e12b82 100644 --- a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st +++ b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st @@ -35,7 +35,6 @@ GtCoderContextMenuContent >> initialize [ hovered: [ :aStyle | aStyle background: self theme item selectedColor ]); padding: (BlInsets top: 2 bottom: 2); addChild: (BrLabel new - aptitude: BrGlamorousLabelAptitude; text: eachGtCoderContextMenuAction title asRopedText; hMatchParent; yourself); @@ -56,7 +55,6 @@ GtCoderContextMenuContent >> initialize [ border: (BlBorder paint: Color gray width: 1); padding: (BlInsets all: 1); addChild: (BrLabel new - aptitude: BrGlamorousLabelAptitude; text: (eachGtCoderContextMenuAction shortcutKey asRopedText fontName: 'Source Code Pro'; foreground: Color gray; diff --git a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st index 751e01911..c9406c0a3 100644 --- a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st @@ -135,7 +135,6 @@ GtCoderExampleStateElement >> newInspectorWithExampleResult [ { #category : #'private - instance creation' } GtCoderExampleStateElement >> newNotExecutedLabel [ ^ BrLabel new - aptitude: BrGlamorousLabelAptitude; text: 'Not Executed Example'; padding: (BlInsets all: 5) ] @@ -171,11 +170,9 @@ GtCoderExampleStateElement >> newNotExecutedTooltipContent [ alignCenterLeft; padding: (BlInsets all: 5); addChild: (BrLabel new - aptitude: BrGlamorousLabelAptitude; - margin: (BlInsets left: 2); - text: 'Example not executed'); - addChild: (self newNotExecutedToolbar - margin: (BlInsets top: 3)). + margin: (BlInsets left: 2); + text: 'Example not executed'); + addChild: (self newNotExecutedToolbar margin: (BlInsets top: 3)) ] { #category : #'private - instance creation' } diff --git a/src/GToolkit-Coder-UI/GtCoderFilterListItemElement.class.st b/src/GToolkit-Coder-UI/GtCoderFilterListItemElement.class.st index d8895d846..a3782ee8e 100644 --- a/src/GToolkit-Coder-UI/GtCoderFilterListItemElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderFilterListItemElement.class.st @@ -5,7 +5,7 @@ Class { 'item', 'labelElement' ], - #category : 'GToolkit-Coder-UI-Basic' + #category : #'GToolkit-Coder-UI-Basic' } { #category : #initialization } @@ -33,7 +33,6 @@ GtCoderFilterListItemElement >> item: anObject [ { #category : #'private - instance creation' } GtCoderFilterListItemElement >> newLabelElement [ ^ BrLabel new - aptitude: BrGlamorousLabelAptitude ] { #category : #'private - hooks' } diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st index 192f6d552..35529f924 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st @@ -9,7 +9,7 @@ Class { #instVars : [ 'classesTree' ], - #category : 'GToolkit-Coder-UI-Navigation' + #category : #'GToolkit-Coder-UI-Navigation' } { #category : #'instance creation' } @@ -29,17 +29,14 @@ GtCoderNavigationClassesHierarchyTreeElement >> expandClass: aClass [ { #category : #initialization } GtCoderNavigationClassesHierarchyTreeElement >> initialize [ super initialize. - + self rowStencil: BrGlamorousSimpleTreeSelectableRowElementStencilBuilder new. - + self - nodeStencil: [ BrLabel new - beSmallSize; - aptitude: BrGlamorousLabelAptitude ]; + nodeStencil: [ BrLabel new beSmallSize ]; nodeDataBinder: [ :aClassElement :aClassHierarchyTree | aClassElement - text: - (aClassHierarchyTree + text: (aClassHierarchyTree ifNil: [ '' asRopedText ] ifNotNil: [ | aClass aText | aClass := aClassHierarchyTree rootClass. diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationMethodProtocolListElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationMethodProtocolListElement.class.st index 726e45084..84b31e8ac 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationMethodProtocolListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationMethodProtocolListElement.class.st @@ -7,7 +7,6 @@ Class { { #category : #'private - ui' } GtCoderNavigationMethodProtocolListElement >> buildProtocolLabel: aProtocol [ ^ BrLabel new - aptitude: BrGlamorousLabelAptitude; beSmallSize; text: aProtocol ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st index 97347bc09..17f715a58 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st @@ -35,27 +35,27 @@ GtSourceCoderCollapsedContentElement >> newAddOnsContainer [ matchParent; alignCenterLeft; margin: (BlInsets left: 5); - withAsyncPromiseDo: [ :anElementPromise | + withAsyncPromiseDo: [ :anElementPromise | anElementPromise - whenSuccess: [ :aContainer :theAddOns | + whenSuccess: [ :aContainer :theAddOns | aContainer removeChildren. - theAddOns previews do: [ :eachAddOn | - | eachAddOnElement | + theAddOns previews + do: [ :eachAddOn | + | eachAddOnElement | + eachAddOnElement := previews + at: eachAddOn id + ifAbsentPut: [ eachAddOn stencil asElement ]. - eachAddOnElement := previews - at: eachAddOn id - ifAbsentPut: [ eachAddOn stencil asElement ]. - - eachAddOn dataBinder - element: eachAddOnElement; - coderViewModel: textualCoderViewModel; - build. + eachAddOn dataBinder + element: eachAddOnElement; + coderViewModel: textualCoderViewModel; + build. - aContainer addChild: eachAddOnElement ] ]; - whenError: [ :aContainer :anError | + aContainer addChild: eachAddOnElement ] ]; + whenError: [ :aContainer :anError | aContainer removeChildren. - aContainer addChild: (BrLabel new aptitude: BrGlamorousLabelAptitude; text: anError printString) ]; - whenPending: [ :aContainer | ] ] + aContainer addChild: (BrLabel new text: anError printString) ]; + whenPending: [ :aContainer | ] ] ] { #category : #'instance creation' } From efd950e0422916206d64dd1dbbc6d2fefad54111 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Mon, 18 Jul 2022 16:56:56 -0500 Subject: [PATCH 0201/1268] Revert "BrLabel now defaults to aptitude BrGlamorousLabelAptitude" This reverts commit 8e4ccac034b97f1e932c5bdc096e92187175f288. --- .../CompiledMethod.extension.st | 23 +++++++------ .../GtCoderContextMenuContent.class.st | 2 ++ .../GtCoderExampleStateElement.class.st | 9 ++++-- .../GtCoderFilterListItemElement.class.st | 3 +- ...gationClassesHierarchyTreeElement.class.st | 13 +++++--- ...vigationMethodProtocolListElement.class.st | 1 + ...ourceCoderCollapsedContentElement.class.st | 32 +++++++++---------- 7 files changed, 46 insertions(+), 37 deletions(-) diff --git a/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st b/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st index 599d687d2..6dcd26072 100644 --- a/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st +++ b/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st @@ -22,30 +22,29 @@ CompiledMethod >> gtDisplayOn: aStream [ { #category : #'*GToolkit-Coder-Extensions' } CompiledMethod >> gtLocalVersionsFor: aView [ - ^ aView columnedList + ^ aView columnedList title: 'Local versions'; priority: 20; - items: [ SourceFiles + items: [ + SourceFiles changeRecordsFrom: self sourcePointer className: self methodClass name isMeta: self methodClass isMeta ]; - column: 'Timestamp' - text: #timeStamp - width: 200; + column: 'Timestamp' text: #timeStamp width: 200; column: 'Change' translated - icon: [ :eachItem | + icon: [ :eachItem | BrExpander new vFitContent; hMatchParent; collapse; margin: (BlInsets all: 10); aptitude: GtCoderExpanderAptitude new; - header: [ BrLabel new text: eachItem gtDisplayString ]; + header: [ BrLabel new aptitude: BrGlamorousLabelAptitude; text: eachItem gtDisplayString ]; content: [ | container | - container := BrFrame new - vExact: 400; - hMatchParent; - aptitude: BrGlamorousWithVerticalResizerAptitude; - addChild: (eachItem gtSourceFor: GtPhlowEmptyView new) asElement matchParent ] ] + container := BrFrame new + vExact: 400; + hMatchParent; + aptitude: BrGlamorousWithVerticalResizerAptitude; + addChild: ((eachItem gtSourceFor: GtPhlowEmptyView new) asElement) matchParent ] ] weight: 1 ] diff --git a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st index e54e12b82..a5e4bbd53 100644 --- a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st +++ b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st @@ -35,6 +35,7 @@ GtCoderContextMenuContent >> initialize [ hovered: [ :aStyle | aStyle background: self theme item selectedColor ]); padding: (BlInsets top: 2 bottom: 2); addChild: (BrLabel new + aptitude: BrGlamorousLabelAptitude; text: eachGtCoderContextMenuAction title asRopedText; hMatchParent; yourself); @@ -55,6 +56,7 @@ GtCoderContextMenuContent >> initialize [ border: (BlBorder paint: Color gray width: 1); padding: (BlInsets all: 1); addChild: (BrLabel new + aptitude: BrGlamorousLabelAptitude; text: (eachGtCoderContextMenuAction shortcutKey asRopedText fontName: 'Source Code Pro'; foreground: Color gray; diff --git a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st index c9406c0a3..751e01911 100644 --- a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st @@ -135,6 +135,7 @@ GtCoderExampleStateElement >> newInspectorWithExampleResult [ { #category : #'private - instance creation' } GtCoderExampleStateElement >> newNotExecutedLabel [ ^ BrLabel new + aptitude: BrGlamorousLabelAptitude; text: 'Not Executed Example'; padding: (BlInsets all: 5) ] @@ -170,9 +171,11 @@ GtCoderExampleStateElement >> newNotExecutedTooltipContent [ alignCenterLeft; padding: (BlInsets all: 5); addChild: (BrLabel new - margin: (BlInsets left: 2); - text: 'Example not executed'); - addChild: (self newNotExecutedToolbar margin: (BlInsets top: 3)) + aptitude: BrGlamorousLabelAptitude; + margin: (BlInsets left: 2); + text: 'Example not executed'); + addChild: (self newNotExecutedToolbar + margin: (BlInsets top: 3)). ] { #category : #'private - instance creation' } diff --git a/src/GToolkit-Coder-UI/GtCoderFilterListItemElement.class.st b/src/GToolkit-Coder-UI/GtCoderFilterListItemElement.class.st index a3782ee8e..d8895d846 100644 --- a/src/GToolkit-Coder-UI/GtCoderFilterListItemElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderFilterListItemElement.class.st @@ -5,7 +5,7 @@ Class { 'item', 'labelElement' ], - #category : #'GToolkit-Coder-UI-Basic' + #category : 'GToolkit-Coder-UI-Basic' } { #category : #initialization } @@ -33,6 +33,7 @@ GtCoderFilterListItemElement >> item: anObject [ { #category : #'private - instance creation' } GtCoderFilterListItemElement >> newLabelElement [ ^ BrLabel new + aptitude: BrGlamorousLabelAptitude ] { #category : #'private - hooks' } diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st index 35529f924..192f6d552 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st @@ -9,7 +9,7 @@ Class { #instVars : [ 'classesTree' ], - #category : #'GToolkit-Coder-UI-Navigation' + #category : 'GToolkit-Coder-UI-Navigation' } { #category : #'instance creation' } @@ -29,14 +29,17 @@ GtCoderNavigationClassesHierarchyTreeElement >> expandClass: aClass [ { #category : #initialization } GtCoderNavigationClassesHierarchyTreeElement >> initialize [ super initialize. - + self rowStencil: BrGlamorousSimpleTreeSelectableRowElementStencilBuilder new. - + self - nodeStencil: [ BrLabel new beSmallSize ]; + nodeStencil: [ BrLabel new + beSmallSize; + aptitude: BrGlamorousLabelAptitude ]; nodeDataBinder: [ :aClassElement :aClassHierarchyTree | aClassElement - text: (aClassHierarchyTree + text: + (aClassHierarchyTree ifNil: [ '' asRopedText ] ifNotNil: [ | aClass aText | aClass := aClassHierarchyTree rootClass. diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationMethodProtocolListElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationMethodProtocolListElement.class.st index 84b31e8ac..726e45084 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationMethodProtocolListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationMethodProtocolListElement.class.st @@ -7,6 +7,7 @@ Class { { #category : #'private - ui' } GtCoderNavigationMethodProtocolListElement >> buildProtocolLabel: aProtocol [ ^ BrLabel new + aptitude: BrGlamorousLabelAptitude; beSmallSize; text: aProtocol ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st index 17f715a58..97347bc09 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st @@ -35,27 +35,27 @@ GtSourceCoderCollapsedContentElement >> newAddOnsContainer [ matchParent; alignCenterLeft; margin: (BlInsets left: 5); - withAsyncPromiseDo: [ :anElementPromise | + withAsyncPromiseDo: [ :anElementPromise | anElementPromise - whenSuccess: [ :aContainer :theAddOns | + whenSuccess: [ :aContainer :theAddOns | aContainer removeChildren. - theAddOns previews - do: [ :eachAddOn | - | eachAddOnElement | - eachAddOnElement := previews - at: eachAddOn id - ifAbsentPut: [ eachAddOn stencil asElement ]. + theAddOns previews do: [ :eachAddOn | + | eachAddOnElement | - eachAddOn dataBinder - element: eachAddOnElement; - coderViewModel: textualCoderViewModel; - build. + eachAddOnElement := previews + at: eachAddOn id + ifAbsentPut: [ eachAddOn stencil asElement ]. + + eachAddOn dataBinder + element: eachAddOnElement; + coderViewModel: textualCoderViewModel; + build. - aContainer addChild: eachAddOnElement ] ]; - whenError: [ :aContainer :anError | + aContainer addChild: eachAddOnElement ] ]; + whenError: [ :aContainer :anError | aContainer removeChildren. - aContainer addChild: (BrLabel new text: anError printString) ]; - whenPending: [ :aContainer | ] ] + aContainer addChild: (BrLabel new aptitude: BrGlamorousLabelAptitude; text: anError printString) ]; + whenPending: [ :aContainer | ] ] ] { #category : #'instance creation' } From 243e2d52d657a293a048cbd7ffe69af654858f4b Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 19 Jul 2022 10:14:39 -0500 Subject: [PATCH 0202/1268] Maintain source code font during inline renaming --- src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st b/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st index e269613fa..d84ace8dc 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st @@ -7,12 +7,12 @@ Class { 'filter', 'editorShortcuts' ], - #category : 'GToolkit-Coder-AddOns-Inline rename' + #category : #'GToolkit-Coder-AddOns-Inline rename' } { #category : #accessing } GtRenameEditorAttribute >> additionalAttributes [ - ^ #() + ^ {BlFontFamilyAttribute named: 'Source Code Pro'} ] { #category : #accessing } From 9fa058edd1254b71cb71483009d9a0e88fe0c989 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 20 Jul 2022 10:54:47 -0500 Subject: [PATCH 0203/1268] Add cancel button to the Pharo Behavior Definition coder --- .../GtBehaviorDefinitionCoderViewModel.class.st | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtBehaviorDefinitionCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtBehaviorDefinitionCoderViewModel.class.st index 0804ef882..d43991d26 100644 --- a/src/GToolkit-Coder-UI/GtBehaviorDefinitionCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtBehaviorDefinitionCoderViewModel.class.st @@ -7,6 +7,12 @@ Class { #category : #'GToolkit-Coder-UI-Coder - Behavior-Definition Model' } +{ #category : #accessing } +GtBehaviorDefinitionCoderViewModel >> discardChanges [ + self coder definitionFrom: self coder behavior. + self coder announce: (GtCoderClassChanged new coder: self coder) +] + { #category : #accessing } GtBehaviorDefinitionCoderViewModel >> elementClass [ ^ GtPharoBehaviorDefinitionCoderElement From f723eaee36aa693308e8535e77e3272defb8ef03 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 21 Jul 2022 17:06:31 -0500 Subject: [PATCH 0204/1268] Add a margin to the left of shortcut labels [feekcom/gtoolkit#2659] --- src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st | 1 + 1 file changed, 1 insertion(+) diff --git a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st index a5e4bbd53..7fa9d5394 100644 --- a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st +++ b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st @@ -55,6 +55,7 @@ GtCoderContextMenuContent >> initialize [ geometry: (BlRoundedRectangleGeometry cornerRadius: 4); border: (BlBorder paint: Color gray width: 1); padding: (BlInsets all: 1); + margin: (BlInsets left: 10); addChild: (BrLabel new aptitude: BrGlamorousLabelAptitude; text: (eachGtCoderContextMenuAction shortcutKey asRopedText From e2dcb73f42f2f95427d411d0ed123fa23fba3392 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 22 Jul 2022 07:28:48 -0500 Subject: [PATCH 0205/1268] Fix error attributes in snippets [feenkcom/gtoolkit#2688] --- ...tSourceCoderEvaluationHighlighter.class.st | 36 ++++++------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEvaluationHighlighter.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEvaluationHighlighter.class.st index 076e87f48..49bc18175 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEvaluationHighlighter.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEvaluationHighlighter.class.st @@ -1,41 +1,25 @@ Class { #name : #GtSourceCoderEvaluationHighlighter, #superclass : #GtSourceCoderEvaluationResultDisplayer, - #category : 'GToolkit-Coder-UI-Coder - Source' + #category : #'GToolkit-Coder-UI-Coder - Source' } { #category : #'private - ui' } GtSourceCoderEvaluationHighlighter >> addAttributesFor: anEvaluationResult within: aTextInterval [ | theAttributes | - theAttributes := #(). - - anEvaluationResult isSuccess - ifTrue: [ - | aResultButtonAttribute | - - aResultButtonAttribute := GtPlaygroundEvaluatedCodeButtonAttribute new - result: anEvaluationResult value; - coder: anEvaluationResult sourceCoder; "Pass the coder to get the spawn destination" - beNotOverwritableByStyler. - (self text - from: aTextInterval last - to: aTextInterval last) attribute: aResultButtonAttribute. + anEvaluationResult isSuccess + ifTrue: [ | aResultButtonAttribute | + aResultButtonAttribute := GtPlaygroundEvaluatedCodeButtonAttribute new + result: anEvaluationResult value; + coder: anEvaluationResult sourceCoder; + beNotOverwritableByStyler. "Pass the coder to get the spawn destination" - theAttributes := { aResultButtonAttribute } ] - ifFalse: [ - anEvaluationResult isSyntaxError - ifTrue: [ - theAttributes := { - BlTextDecorationAttribute new underline color: Color red; beNotOverwritableByStyler. - (GtSourceCoderErrorAttribute for: 'Syntax error') beNotOverwritableByStyler - }. + (self text from: aTextInterval last to: aTextInterval last) + attribute: aResultButtonAttribute. - self text - attributes: theAttributes - from: aTextInterval first - to: aTextInterval last ] ]. + theAttributes := {aResultButtonAttribute} ]. ^ theAttributes ] From 3fbcd470950fd486b5a4f5ea538eeff396f7a8f3 Mon Sep 17 00:00:00 2001 From: John Brant Date: Fri, 22 Jul 2022 07:32:01 -0500 Subject: [PATCH 0206/1268] fix return value for empty class completions --- src/GToolkit-Coder/GtClassesCompletionStrategy.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder/GtClassesCompletionStrategy.class.st b/src/GToolkit-Coder/GtClassesCompletionStrategy.class.st index af6fe8f27..b218fb9c1 100644 --- a/src/GToolkit-Coder/GtClassesCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtClassesCompletionStrategy.class.st @@ -20,7 +20,7 @@ GtClassesCompletionStrategy >> candidateClasses [ GtClassesCompletionStrategy >> completionActionStreamFor: aText at: positionInteger [ | currentInput | currentInput := aText asString. - currentInput isEmpty ifTrue: [ ^ #() ]. + currentInput isEmpty ifTrue: [ ^ #() asAsyncStream ]. ^ (self candidateClasses asyncStreamStartingWith: currentInput) collect: [ :className | From 1345ed684400c2444630cb9bf4b177ce0d6264f8 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Sat, 23 Jul 2022 22:41:18 +0200 Subject: [PATCH 0207/1268] Add facility to disable the playground on a coder [feenkcom/gtoolkit#2693] --- src/GToolkit-Coder-UI/GtCoder.class.st | 11 +++++++++++ .../GtCoderPlaygroundElement.class.st | 7 ++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoder.class.st b/src/GToolkit-Coder-UI/GtCoder.class.st index 9a63e12da..b9b051adb 100644 --- a/src/GToolkit-Coder-UI/GtCoder.class.st +++ b/src/GToolkit-Coder-UI/GtCoder.class.st @@ -30,6 +30,17 @@ GtCoder >> contentElement [ ^ contentElement ] +{ #category : #'private - accessing' } +GtCoder >> contentElement: anElement [ + + contentElement := anElement +] + +{ #category : #initialization } +GtCoder >> disablePlayPage [ + contentElement disablePlayPage +] + { #category : #initialization } GtCoder >> initialize [ super initialize. diff --git a/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st b/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st index 44feb7796..98063554d 100644 --- a/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st @@ -13,7 +13,7 @@ Class { 'contentElement', 'playgroundElement' ], - #category : 'GToolkit-Coder-UI-Basic' + #category : #'GToolkit-Coder-UI-Basic' } { #category : #'private - accessing' } @@ -22,6 +22,11 @@ GtCoderPlaygroundElement >> contentElement [ ^ contentElement ] +{ #category : #accessing } +GtCoderPlaygroundElement >> disablePlayPage [ + self removeChild: self playPageElement +] + { #category : #initialization } GtCoderPlaygroundElement >> initialize [ super initialize. From 68822a80f1554fc89e500dbbf99d39428daa3744 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Sat, 23 Jul 2022 21:35:14 -0500 Subject: [PATCH 0208/1268] Fix source errors in Paragraph editor [feenkcom/gtoolkit#2692] --- .../GtSourceCoderErrorAttribute.class.st | 4 ++-- src/GToolkit-Coder-UI/GtSourceErrorTextElement.class.st | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtSourceErrorTextElement.class.st diff --git a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st index 915e2ce4c..4d9cbe728 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st @@ -4,7 +4,7 @@ Class { #instVars : [ 'string' ], - #category : 'GToolkit-Coder-UI-Coder - Source Attributes' + #category : #'GToolkit-Coder-UI-Coder - Source Attributes' } { #category : #'instance creation' } @@ -25,7 +25,7 @@ GtSourceCoderErrorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditor medium; glamorousCodeFontAndSmallSize. - ^ BlTextElement new + ^ GtSourceErrorTextElement new text: text; background: (BrGlamorousColors errorBackgroundColor alpha: 0.4); padding: (BlInsets top: 3 left: 0 bottom: 3 right: 0); diff --git a/src/GToolkit-Coder-UI/GtSourceErrorTextElement.class.st b/src/GToolkit-Coder-UI/GtSourceErrorTextElement.class.st new file mode 100644 index 000000000..45818a548 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceErrorTextElement.class.st @@ -0,0 +1,8 @@ +" +This is a hack to identify error elements inside of the paragraph editor +" +Class { + #name : #GtSourceErrorTextElement, + #superclass : #BlTextElement, + #category : #'GToolkit-Coder-UI' +} From c02e0386de5b68624ba0e037a1dacb6f5a75fb6c Mon Sep 17 00:00:00 2001 From: John Brant Date: Mon, 25 Jul 2022 10:03:31 -0500 Subject: [PATCH 0209/1268] [feenkcom/gtoolkit#2697] sort class names in class hierarchy --- src/GToolkit-Coder/GtCoderGrowingClassesHierarchyTree.class.st | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder/GtCoderGrowingClassesHierarchyTree.class.st b/src/GToolkit-Coder/GtCoderGrowingClassesHierarchyTree.class.st index 1c3d6d4c9..09dfd5880 100644 --- a/src/GToolkit-Coder/GtCoderGrowingClassesHierarchyTree.class.st +++ b/src/GToolkit-Coder/GtCoderGrowingClassesHierarchyTree.class.st @@ -9,7 +9,7 @@ I automatically compute subclasses on demand. Class { #name : #GtCoderGrowingClassesHierarchyTree, #superclass : #GtCoderClassesHierarchyTree, - #category : 'GToolkit-Coder-Navigation - Model' + #category : #'GToolkit-Coder-Navigation - Model' } { #category : #accessing } @@ -71,4 +71,5 @@ GtCoderGrowingClassesHierarchyTree >> updateSubclasses [ collect: [ :eachClass | self class new rootClass: eachClass ] as: Array. + self sortByClassName ] From e473627d80a4edef3e2a650a79a84fdd82445c88 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Tue, 26 Jul 2022 12:51:25 +0200 Subject: [PATCH 0210/1268] Move to `gtAction` in coder toolbar [feenkcom/gtoolkit#2694] --- .../GtCoderToolbarElement.class.st | 179 +++++++----------- 1 file changed, 66 insertions(+), 113 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st b/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st index 9e4f7149e..8446012d5 100644 --- a/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st @@ -16,10 +16,21 @@ Class { } { #category : #accessing } -GtCoderToolbarElement >> addButton [ - - - toolbarElement addItem: self newAddButton +GtCoderToolbarElement >> addButtonFor: anAction [ + + ^ anAction dropdown + icon: BrGlamorousVectorIcons add; + tooltip: 'Add class or package'; + priority: 5; + content: [ :aDropdown | + | element | + element := BlElement new. + element + constraintsDo: [ :c | + c horizontal exact: 400. + c vertical exact: 300 ]. + element addChild: (self newAddInterface: aDropdown). + element ] ] { #category : #'gt-extensions' } @@ -32,7 +43,7 @@ GtCoderToolbarElement >> addClassTab: look [ element := GtPharoCreateBehaviorElement new. element behaviorBlock: [ :cls | - look hide. + look fireEvent: BrDropdownHideWish new. navigationModel selectClass: cls ]. element forClassDefinition. navigationModel @@ -44,11 +55,14 @@ GtCoderToolbarElement >> addClassTab: look [ { #category : #initialization } GtCoderToolbarElement >> addCustomButtons [ - - | pragmas | - pragmas := Pragma allNamed: #gtCoderAction: in: self class. - pragmas sort: [ :a :b | (a argumentAt: 1) <= (b argumentAt: 1) ]. - pragmas do: [ :aPragma | self perform: aPragma methodSelector ] + (GtPhlowActionsCollector new + pragmaName: #gtAction; + fromObject: self; + collect) + do: [ :each | + each + asElement: [ :actionElement | self toolbarElement addItem: actionElement ] + withHostElement: self ] ] { #category : #'gt-extensions' } @@ -61,7 +75,7 @@ GtCoderToolbarElement >> addPackageTab: look [ element := GtPharoCreatePackageElement new. element packageBlock: [ :pkg :tag | - look hide. + look fireEvent: BrDropdownHideWish new. tag isNil ifTrue: [ self navigationModel selectPackage: pkg ] ifFalse: [ self navigationModel selectPackageTag: tag ] ]. @@ -80,7 +94,7 @@ GtCoderToolbarElement >> addTraitTab: look [ element := GtPharoCreateBehaviorElement new. element behaviorBlock: [ :cls | - look hide. + look fireEvent: BrDropdownHideWish new. self navigationModel selectClass: cls ]. element forTraitDefinition. self navigationModel @@ -91,10 +105,13 @@ GtCoderToolbarElement >> addTraitTab: look [ ] { #category : #accessing } -GtCoderToolbarElement >> browseButton [ - - - toolbarElement addItem: self newBrowseButton +GtCoderToolbarElement >> browseButtonFor: anAction [ + + ^ anAction button + tooltip: 'Browse in another world tab'; + priority: 1; + icon: BrGlamorousVectorIcons emphasizedBrowse; + action: [ :aButton | self browseFrom: aButton ] ] { #category : #'private - actions' } @@ -107,23 +124,18 @@ GtCoderToolbarElement >> browseFrom: anElement [ ] { #category : #accessing } -GtCoderToolbarElement >> createActionButton [ - - | button caller | - button := BrButton new. - caller := thisContext stack second method. - button viewModel when: BlClickEvent do: [ :anEvent | - (GtPhlowUtility isDefinitionRequested: anEvent) ifTrue: [ - anEvent consumed: true. - button phlow spawnObject: caller ] ]. - ^ button -] - -{ #category : #accessing } -GtCoderToolbarElement >> hierarchyButton [ - - - toolbarElement addItem: self newHierarchyButton +GtCoderToolbarElement >> hierarchyButtonFor: anAction [ + + ^ anAction dropdown + tooltip: 'Show Package and Class Hierarchies'; + icon: BrGlamorousIcons tree; + priority: 3; + content: [ + BlElement new + size: 400@400; + addChild: ((GtCoderNavigationTabsStencil new + navigationModel: navigationModel; + asElement) background: Color white) ] ] { #category : #initialization } @@ -148,33 +160,6 @@ GtCoderToolbarElement >> initializeToolbarElement [ self addCustomButtons ] -{ #category : #'private - instance creation' } -GtCoderToolbarElement >> newAddButton [ - | look | - ^ self createActionButton - label: 'Add class or package'; - aptitude: - BrGlamorousButtonWithIconAptitude - + - (look := BrGlamorousWithDropdownAptitude - handle: [ BrButton new - aptitude: - BrGlamorousButtonWithIconAptitude - BrGlamorousButtonWithLabelTooltipAptitude - - BrGlamorousButtonExteriorAptitude; - icon: BrGlamorousVectorIcons add; - yourself ] - content: [ | element | - element := BlElement new. - element - constraintsDo: [ :c | - c horizontal exact: 400. - c vertical exact: 300 ]. - element addChild: (self newAddInterface: look). - element ]); - icon: BrGlamorousVectorIcons add; - yourself -] - { #category : #'private - instance creation' } GtCoderToolbarElement >> newAddInterface: look [ | contentTabs tabMethods | @@ -192,55 +177,6 @@ GtCoderToolbarElement >> newAddInterface: look [ ^ contentTabs ] -{ #category : #'private - instance creation' } -GtCoderToolbarElement >> newBrowseButton [ - ^ self createActionButton - aptitude: BrGlamorousButtonWithIconAptitude; - label: 'Browse in another world tab'; - icon: BrGlamorousVectorIcons emphasizedBrowse; - action: [ :aButton | self browseFrom: aButton ] -] - -{ #category : #'private - instance creation' } -GtCoderToolbarElement >> newHierarchyButton [ - ^ self createActionButton - label: 'Show Package and Class Hierarchies'; - aptitude: BrGlamorousButtonWithIconAptitude + (BrGlamorousWithDropdownAptitude - handle: [ - BrButton new - aptitude: BrGlamorousButtonWithIconAptitude - BrGlamorousButtonWithLabelTooltipAptitude - BrGlamorousButtonExteriorAptitude; - icon: BrGlamorousIcons tree; - yourself ] - content: [ - BlElement new - size: 400@400; - addChild: ((GtCoderNavigationTabsStencil new - navigationModel: navigationModel; - asElement) background: Color white) ]); - icon: BrGlamorousIcons tree asElement; - yourself -] - -{ #category : #'private - instance creation' } -GtCoderToolbarElement >> newSpotterButton [ - - - ^ GtSpotterDropdownButtonStencil new - valuable: (GtCoderSpotterStart new navigationModelBlock: [self navigationModel]); - tooltip: 'Search Code'; - actOn: [ :anActOnEvent :anItem :theButton | - | acted | - acted := false. - (anItem isKindOf: RPackage) ifTrue: [ - self navigationModel selectPackage: anItem. acted := true ]. - (anItem isKindOf: ClassDescription) ifTrue: [ - self navigationModel selectClass: anItem. acted := true ]. - (anItem isKindOf: CompiledMethod) ifTrue: [ - self navigationModel selectMethod: anItem. acted := true ]. - acted ifTrue: [ anActOnEvent beActed ] ]; - asElement. -] - { #category : #initialization } GtCoderToolbarElement >> repository [ @@ -252,10 +188,27 @@ GtCoderToolbarElement >> repository [ ] { #category : #accessing } -GtCoderToolbarElement >> spotterButton [ - - - toolbarElement addItem: self newSpotterButton +GtCoderToolbarElement >> spotterButtonFor: anAction [ + + ^ anAction explicit + priority: 2; + stencil: [ GtSpotterDropdownButtonStencil new + valuable: (GtCoderSpotterStart new navigationModelBlock: [ self navigationModel ]); + tooltip: 'Search Code'; + actOn: [ :anActOnEvent :anItem :theButton | + | acted | + acted := false. + (anItem isKindOf: RPackage) + ifTrue: [ self navigationModel selectPackage: anItem. + acted := true ]. + (anItem isKindOf: ClassDescription) + ifTrue: [ self navigationModel selectClass: anItem. + acted := true ]. + (anItem isKindOf: CompiledMethod) + ifTrue: [ self navigationModel selectMethod: anItem. + acted := true ]. + acted ifTrue: [ anActOnEvent beActed ] ]; + asElement ] ] { #category : #accessing } From 185a38a6904620531998f006e84213b45318dcfe Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 26 Jul 2022 06:21:14 -0500 Subject: [PATCH 0211/1268] [feenkcom/gtoolkit#2698] fix GtCoderAction for P10 changes --- src/GToolkit-Coder/GtCoderAction.class.st | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/GToolkit-Coder/GtCoderAction.class.st b/src/GToolkit-Coder/GtCoderAction.class.st index d40d408ff..d31d3eaa3 100644 --- a/src/GToolkit-Coder/GtCoderAction.class.st +++ b/src/GToolkit-Coder/GtCoderAction.class.st @@ -32,6 +32,11 @@ GtCoderAction >> action: anObject [ action := anObject ] +{ #category : #evaluating } +GtCoderAction >> gtValueWithArgs: anArray [ + ^ self action valueWithPossibleArgs: anArray +] + { #category : #comparing } GtCoderAction >> hash [ "Answer an integer value that is related to the identity of the receiver." From 1164857fa5a8b993490246daa6c9b2f2092074b8 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Tue, 26 Jul 2022 14:52:27 +0200 Subject: [PATCH 0212/1268] Restrict actions to toolbar element [feenkcom/gtoolkit#2694] --- src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st | 1 + 1 file changed, 1 insertion(+) diff --git a/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st b/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st index 8446012d5..5fbfe01e1 100644 --- a/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st @@ -58,6 +58,7 @@ GtCoderToolbarElement >> addCustomButtons [ (GtPhlowActionsCollector new pragmaName: #gtAction; fromObject: self; + to: self class; collect) do: [ :each | each From 88081a831fae5bafd2a31b8bb9ac313c69b63434 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 26 Jul 2022 08:23:33 -0500 Subject: [PATCH 0213/1268] Cleaner version of [feenkcom/gtoolkit#2692] --- .../GtSourceCoderErrorAttribute.class.st | 27 +++++++++++-------- .../GtSourceErrorTextElement.class.st | 8 ------ 2 files changed, 16 insertions(+), 19 deletions(-) delete mode 100644 src/GToolkit-Coder-UI/GtSourceErrorTextElement.class.st diff --git a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st index 4d9cbe728..057c48f81 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st @@ -18,19 +18,24 @@ GtSourceCoderErrorAttribute class >> for: aString [ { #category : #accessing } GtSourceCoderErrorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ - | text | - + | text element | text := string asRopedText - foreground: BrGlamorousColors defaultButtonTextColor; - medium; - glamorousCodeFontAndSmallSize. + foreground: BrGlamorousColors defaultButtonTextColor; + medium; + glamorousCodeFontAndSmallSize. + element := BlTextElement new + text: text; + background: (BrGlamorousColors errorBackgroundColor alpha: 0.4); + padding: (BlInsets + top: 3 + left: 0 + bottom: 3 + right: 0); + margin: (BlInsets left: 2 right: 2); + yourself. + element userData at: #sourceError put: true. - ^ GtSourceErrorTextElement new - text: text; - background: (BrGlamorousColors errorBackgroundColor alpha: 0.4); - padding: (BlInsets top: 3 left: 0 bottom: 3 right: 0); - margin: (BlInsets left: 2 right: 2); - yourself + ^ element ] { #category : #'initialize-release' } diff --git a/src/GToolkit-Coder-UI/GtSourceErrorTextElement.class.st b/src/GToolkit-Coder-UI/GtSourceErrorTextElement.class.st deleted file mode 100644 index 45818a548..000000000 --- a/src/GToolkit-Coder-UI/GtSourceErrorTextElement.class.st +++ /dev/null @@ -1,8 +0,0 @@ -" -This is a hack to identify error elements inside of the paragraph editor -" -Class { - #name : #GtSourceErrorTextElement, - #superclass : #BlTextElement, - #category : #'GToolkit-Coder-UI' -} From f0725da13a88599d840febea9e7b993db06e5448 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 27 Jul 2022 15:16:45 -0500 Subject: [PATCH 0214/1268] Add context menu refactorings to Behavior Definition Coder [feenkcom/gtoolkit#2659] --- .../GtCodeDefinitionPluralEditor.class.st | 156 +++++++++++------- 1 file changed, 92 insertions(+), 64 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st index 71c51a1ac..20bd7591e 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st @@ -4,9 +4,13 @@ Class { #instVars : [ 'addSelector', 'renameSelector', - 'removeSelector' + 'removeSelector', + 'contextMenuBlock' ], - #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' + #classInstVars : [ + 'foo' + ], + #category : #'GToolkit-Coder-UI-Behaviour - Editor / Reader' } { #category : #accessing } @@ -19,76 +23,94 @@ GtCodeDefinitionPluralEditor >> addSelector: anObject [ addSelector := anObject ] +{ #category : #accessing } +GtCodeDefinitionPluralEditor >> contextMenuBlock: aBinaryBlock [ + "Block accepts a label definition and editor and returns a GtCoderContextMenuContent" + + contextMenuBlock := aBinaryBlock +] + { #category : #'api - instantiation' } GtCodeDefinitionPluralEditor >> create [ | aDefinition anOwner theInitialNames addAction removeAction renameAction aTagger | - aDefinition := self definition. anOwner := self owner. - - theInitialNames := aDefinition perform: getSelector withEnoughArguments: { anOwner }. - addAction := [ :aNewTag | + theInitialNames := aDefinition + perform: getSelector + withEnoughArguments: {anOwner}. + + addAction := [ :aNewTag | aNewTag name - ifNotEmpty: [ aDefinition perform: addSelector withEnoughArguments: { aNewTag name . anOwner } ] ]. + ifNotEmpty: [ aDefinition + perform: addSelector + withEnoughArguments: {aNewTag name. + anOwner} ] ]. + + removeAction := [ :aTag | + aDefinition + perform: removeSelector + withEnoughArguments: {aTag name. + anOwner} ]. - removeAction := [ :aTag | aDefinition perform: removeSelector withEnoughArguments: { aTag name . anOwner } ]. - - renameAction := [ :aTag :aNewName | + renameAction := [ :aTag :aNewName | aNewName trimmed ifEmpty: [ removeAction value: aTag name ] - ifNotEmpty: [ :aTrimmedName | - aDefinition perform: renameSelector withEnoughArguments: { aTag name . aTrimmedName . anOwner } ] ]. + ifNotEmpty: [ :aTrimmedName | + aDefinition + perform: renameSelector + withEnoughArguments: {aTag name. + aTrimmedName. + anOwner} ] ]. aTagger := BrTagger new - aptitude: (BrGlamorousTaggerEditableAptitude new - margin: self margin; - tagLabel: [ :aTaggerTag | - | anEditableLabel eachLabelDefinition | - - eachLabelDefinition := aTaggerTag ifNotNil: [ - modelSelector ifNotNil: [ :aSelector | - aTaggerTag name - ifEmpty: [ nil ] - ifNotEmpty: [ :aTagName | aDefinition perform: aSelector withEnoughArguments: { aTaggerTag name } ] ] ]. - - anEditableLabel := BrEditableLabel new - text: aTaggerTag name; - styler: styler; - inputFilter: inputFilter; - aptitude: lookStencil create; - yourself. - - interactions do: [ :eachAssociation | - anEditableLabel - whenKey: eachAssociation key - labelDo: [ :aShortcutEvent :aShortcut | - aShortcutEvent consumed: true. - eachLabelDefinition - ifNotNil: [ eachAssociation value cull: aShortcutEvent cull: eachLabelDefinition ] ] ]. - - eventHandlers do: [ :eachAssociation | - anEditableLabel - when: eachAssociation key - do: [ :anEvent | - anEvent currentTarget isReadOnly - ifTrue: [ - eachLabelDefinition - ifNotNil: [ eachAssociation value cull: anEvent cull: eachLabelDefinition ] ] ] ]. - - completionStencil ifNotNil: [ :aStencil | - (GtCompletionController - on: anEditableLabel - strategy: aStencil create) install ]. - - anEditableLabel ]; - in: [ :aLook | separatorStencil ifNotNil: [ aLook separator: separatorStencil ] ]; - yourself); - namedTags: theInitialNames; - when: BrTaggerAddTagRequest do: [ :aRequest | addAction value: aRequest tag ]; - when: BrTaggerRemoveTagRequest do: [ :aRequest | removeAction value: aRequest tag ]; - when: BrTaggerRenameTagRequest do: [ :aRequest | renameAction value: aRequest tag value: aRequest newName ]. + aptitude: (BrGlamorousTaggerEditableAptitude new + margin: self margin; + tagLabel: [ :aTaggerTag | + | anEditableLabel eachLabelDefinition | + eachLabelDefinition := aTaggerTag + ifNotNil: [ modelSelector + ifNotNil: [ :aSelector | + aTaggerTag name + ifEmpty: [ nil ] + ifNotEmpty: [ :aTagName | aDefinition perform: aSelector withEnoughArguments: {aTaggerTag name} ] ] ]. + anEditableLabel := BrEditableLabel new + text: aTaggerTag name; + styler: styler; + inputFilter: inputFilter; + aptitude: lookStencil create + + (BrGlamorousWithContextMenuAptitude + content: (contextMenuBlock value: eachLabelDefinition value: self)); + yourself. + interactions + do: [ :eachAssociation | + anEditableLabel + whenKey: eachAssociation key + labelDo: [ :aShortcutEvent :aShortcut | + aShortcutEvent consumed: true. + eachLabelDefinition + ifNotNil: [ eachAssociation value cull: aShortcutEvent cull: eachLabelDefinition ] ] ]. + eventHandlers + do: [ :eachAssociation | + anEditableLabel + when: eachAssociation key + do: [ :anEvent | + anEvent currentTarget isReadOnly + ifTrue: [ eachLabelDefinition + ifNotNil: [ eachAssociation value cull: anEvent cull: eachLabelDefinition ] ] ] ]. + completionStencil + ifNotNil: [ :aStencil | (GtCompletionController on: anEditableLabel strategy: aStencil create) install ]. + anEditableLabel ]; + in: [ :aLook | separatorStencil ifNotNil: [ aLook separator: separatorStencil ] ]; + yourself); + namedTags: theInitialNames; + when: BrTaggerAddTagRequest + do: [ :aRequest | addAction value: aRequest tag ]; + when: BrTaggerRemoveTagRequest + do: [ :aRequest | removeAction value: aRequest tag ]; + when: BrTaggerRenameTagRequest + do: [ :aRequest | renameAction value: aRequest tag value: aRequest newName ]. self containerName ifNotNil: [ :aContainerName | aTagger containerName: aContainerName ]. @@ -98,19 +120,19 @@ GtCodeDefinitionPluralEditor >> create [ do: [ :anEvent | (anOwner isNil or: [ anEvent owner = anOwner ]) ifTrue: [ aTagger addTagNamed: anEvent name ] ]. - + aDefinition when: removeAnnouncement - do: [ :anEvent | + do: [ :anEvent | (anOwner isNil or: [ anEvent owner = anOwner ]) ifTrue: [ aTagger removeTagNamed: anEvent name ] ]. - + aDefinition when: renameAnnouncement - do: [ :anEvent | + do: [ :anEvent | (anOwner isNil or: [ anEvent owner = anOwner ]) ifTrue: [ aTagger renameTagNamed: anEvent oldName to: anEvent newName ] ]. - + ^ aTagger ] @@ -133,3 +155,9 @@ GtCodeDefinitionPluralEditor >> renameSelector [ GtCodeDefinitionPluralEditor >> renameSelector: anObject [ renameSelector := anObject ] + +{ #category : #accessing } +GtCodeDefinitionPluralEditor >> textualCoderViewModel [ + "Hack to use context menus" + ^self +] From 65c2d0b6968331d25242049316bd7a05f0ea6f4d Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 28 Jul 2022 08:04:54 -0500 Subject: [PATCH 0215/1268] More context menu refactorings to Behavior Definition Coder [feenkcom/gtoolkit#2659] --- .../GtCodeDefinitionPluralEditor.class.st | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st index 20bd7591e..44f8c7a1c 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st @@ -7,9 +7,6 @@ Class { 'removeSelector', 'contextMenuBlock' ], - #classInstVars : [ - 'foo' - ], #category : #'GToolkit-Coder-UI-Behaviour - Editor / Reader' } @@ -136,6 +133,12 @@ GtCodeDefinitionPluralEditor >> create [ ^ aTagger ] +{ #category : #'api - instantiation' } +GtCodeDefinitionPluralEditor >> initialize [ + super initialize. + contextMenuBlock := [ :def :edit | GtCoderContextMenuContent new editorElement: edit ] +] + { #category : #accessing } GtCodeDefinitionPluralEditor >> removeSelector [ ^ removeSelector From f1ae734ef01e4bc8129da80db8e025497b727906 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 29 Jul 2022 13:27:28 -0500 Subject: [PATCH 0216/1268] More context menu refactorings to Behavior Definition Coder [feenkcom/gtoolkit#2659] --- src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st index 44f8c7a1c..921c36639 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st @@ -136,7 +136,7 @@ GtCodeDefinitionPluralEditor >> create [ { #category : #'api - instantiation' } GtCodeDefinitionPluralEditor >> initialize [ super initialize. - contextMenuBlock := [ :def :edit | GtCoderContextMenuContent new editorElement: edit ] + contextMenuBlock := [ :def :edit | [ GtCoderContextMenuContent new editorElement: edit ] ] ] { #category : #accessing } From e86fcb913e4a8d98fbfe5b5681f2efe88e94bf83 Mon Sep 17 00:00:00 2001 From: John Brant Date: Mon, 1 Aug 2022 09:48:04 -0500 Subject: [PATCH 0217/1268] [feenkcom/gtoolkit#2449] allow renaming of uncategorized package tags --- src/GToolkit-Coder/GtCoderPackageExtentionTag.class.st | 7 ++++++- src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder/GtCoderPackageExtentionTag.class.st b/src/GToolkit-Coder/GtCoderPackageExtentionTag.class.st index 124d629f2..ced72ed10 100644 --- a/src/GToolkit-Coder/GtCoderPackageExtentionTag.class.st +++ b/src/GToolkit-Coder/GtCoderPackageExtentionTag.class.st @@ -5,7 +5,7 @@ Class { 'package', 'classes' ], - #category : 'GToolkit-Coder-Navigation - Model' + #category : #'GToolkit-Coder-Navigation - Model' } { #category : #'instance creation' } @@ -24,6 +24,11 @@ GtCoderPackageExtentionTag >> classes: anObject [ classes := anObject ] +{ #category : #accessing } +GtCoderPackageExtentionTag >> gtTagName [ + ^ self name +] + { #category : #testing } GtCoderPackageExtentionTag >> hasExtendedClasses [ diff --git a/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st b/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st index c43761cd3..fd1d11d72 100644 --- a/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st +++ b/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st @@ -4,7 +4,7 @@ Class { #instVars : [ 'packageTag' ], - #category : 'GToolkit-Coder-Navigation - Model' + #category : #'GToolkit-Coder-Navigation - Model' } { #category : #'instance creation' } @@ -23,6 +23,11 @@ GtCoderPackageUncategorizedTag >> classes [ ^ self packageTag classes ] +{ #category : #accessing } +GtCoderPackageUncategorizedTag >> gtTagName [ + ^ packageTag name +] + { #category : #accessing } GtCoderPackageUncategorizedTag >> name [ ^ 'Uncategorized' From 935a623f630ce2dedadb678563256627ce0438be Mon Sep 17 00:00:00 2001 From: John Brant Date: Mon, 1 Aug 2022 11:41:31 -0500 Subject: [PATCH 0218/1268] [feenkcom/gtoolkit#2708] show preview buttons on package/tag change --- .../GtCodeDefinitionCompositeEntityViewer.class.st | 7 ++++++- .../GtCodeDefinitionEntityViewer.class.st | 5 +++++ src/GToolkit-Coder-UI/GtCodeDefinitionViewer.class.st | 7 ++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionCompositeEntityViewer.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionCompositeEntityViewer.class.st index a69921235..02ee7d31b 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionCompositeEntityViewer.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionCompositeEntityViewer.class.st @@ -6,7 +6,7 @@ Class { 'separatorStencil', 'showSectionNames' ], - #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' + #category : #'GToolkit-Coder-UI-Behaviour - Editor / Reader' } { #category : #'instance creation' } @@ -45,6 +45,11 @@ GtCodeDefinitionCompositeEntityViewer >> create [ aStream nextPut: (self buildSectionLabel: (editors at: aCurrentIndex) title) ] ] ]) ] +{ #category : #accessing } +GtCodeDefinitionCompositeEntityViewer >> definitionsDo: aBlock [ + self editors do: [ :each | each definitionsDo: aBlock ] +] + { #category : #accessing } GtCodeDefinitionCompositeEntityViewer >> editors [ ^ editors diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionEntityViewer.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionEntityViewer.class.st index 643c83e5a..724ae068a 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionEntityViewer.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionEntityViewer.class.st @@ -40,6 +40,11 @@ GtCodeDefinitionEntityViewer >> definition: anObject [ definition := anObject ] +{ #category : #accessing } +GtCodeDefinitionEntityViewer >> definitionsDo: aBlock [ + aBlock cull: self definition +] + { #category : #initialization } GtCodeDefinitionEntityViewer >> initialize [ super initialize. diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionViewer.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionViewer.class.st index 347d1b704..de215aed3 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionViewer.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionViewer.class.st @@ -6,7 +6,7 @@ Class { 'margin', 'lookStencil' ], - #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' + #category : #'GToolkit-Coder-UI-Behaviour - Editor / Reader' } { #category : #accessing } @@ -25,6 +25,11 @@ GtCodeDefinitionViewer >> buildSectionLabel: aSectionName [ constraintsDo: [ :c | c grid horizontal alignLeft ] ] +{ #category : #accessing } +GtCodeDefinitionViewer >> definitionsDo: aBlock [ + self subclassResponsibility +] + { #category : #initialization } GtCodeDefinitionViewer >> initialize [ super initialize. From c3e3030fc8ef89c7736aa84e40e0f9da44ae7424 Mon Sep 17 00:00:00 2001 From: John Brant Date: Mon, 1 Aug 2022 11:58:24 -0500 Subject: [PATCH 0219/1268] [feenkcom/gtoolkit#2709] cancel does not revert changes in class coder --- .../GtBehaviorDefinitionCoderViewModel.class.st | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtBehaviorDefinitionCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtBehaviorDefinitionCoderViewModel.class.st index d43991d26..9262ac4ba 100644 --- a/src/GToolkit-Coder-UI/GtBehaviorDefinitionCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtBehaviorDefinitionCoderViewModel.class.st @@ -1,16 +1,12 @@ Class { #name : #GtBehaviorDefinitionCoderViewModel, #superclass : #GtSingleCoderViewModel, - #instVars : [ - 'foo' - ], #category : #'GToolkit-Coder-UI-Coder - Behavior-Definition Model' } { #category : #accessing } GtBehaviorDefinitionCoderViewModel >> discardChanges [ - self coder definitionFrom: self coder behavior. - self coder announce: (GtCoderClassChanged new coder: self coder) + self coder discardChanges ] { #category : #accessing } From dab934a9107ad4d495d0000eacd06dde1e7000cf Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 2 Aug 2022 14:37:34 -0400 Subject: [PATCH 0220/1268] convert Pillar class comments [feenkcom/gtoolkit#2711] --- src/GToolkit-Coder-UI/GtCoderToSpawnInSpace.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderToSpawnInSpace.class.st b/src/GToolkit-Coder-UI/GtCoderToSpawnInSpace.class.st index 8090598fa..8b3919aae 100644 --- a/src/GToolkit-Coder-UI/GtCoderToSpawnInSpace.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToSpawnInSpace.class.st @@ -1,10 +1,10 @@ " -I am fired by inner coders to tell {{gtClass:GtCoder}} to spawn a new coder in a new ${class:BlSpace} +I am fired by inner coders to tell {{gtClass:GtCoder}} to spawn a new coder in a new {{gtClass:BlSpace}}. " Class { #name : #GtCoderToSpawnInSpace, #superclass : #BlEvent, - #category : 'GToolkit-Coder-UI-! Core' + #category : #'GToolkit-Coder-UI-! Core' } From 4b24a7e403e2df750bf03b1ec84e69e7d57e93e4 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 4 Aug 2022 09:52:35 -0500 Subject: [PATCH 0221/1268] Add NumpadEnter as an alternative to Return [feenkcom/gtoolkit#2714] --- src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st | 2 +- src/GToolkit-Coder-UI/GtFiltersElement.class.st | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st b/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st index d84ace8dc..93995fedb 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st @@ -71,7 +71,7 @@ GtRenameEditorAttribute >> editorShortcuts [ combination: BlKeyCombination tab; action: [ :aShortcutEvent | self renameAction tabAccept: true ]). (BlShortcutWithAction new - combination: BlKeyCombination return; + combination: BlKeyCombination enter; action: [ :aShortcutEvent | self renameAction accept ])} ] ] diff --git a/src/GToolkit-Coder-UI/GtFiltersElement.class.st b/src/GToolkit-Coder-UI/GtFiltersElement.class.st index df0979054..8609b93cc 100644 --- a/src/GToolkit-Coder-UI/GtFiltersElement.class.st +++ b/src/GToolkit-Coder-UI/GtFiltersElement.class.st @@ -153,6 +153,6 @@ GtFiltersElement >> newAddTagButton [ action: [ :aButton | self createNewTag ]; addShortcut: (BlShortcutWithAction new - combination: BlKeyCombination return; + combination: BlKeyCombination enter; action: [ :anEvent | self createNewTag ]) ] From a3a0b8cabdfde3a6e25844499ab282878175a802 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Thu, 4 Aug 2022 23:08:07 +0200 Subject: [PATCH 0222/1268] Add ID to preview change button action --- src/GToolkit-Coder-UI/GtPreviewChangeButton.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtPreviewChangeButton.class.st b/src/GToolkit-Coder-UI/GtPreviewChangeButton.class.st index f81c75b18..f3e755ec1 100644 --- a/src/GToolkit-Coder-UI/GtPreviewChangeButton.class.st +++ b/src/GToolkit-Coder-UI/GtPreviewChangeButton.class.st @@ -5,7 +5,7 @@ Class { 'changeAction', 'changeStencil' ], - #category : 'GToolkit-Coder-UI-Basic' + #category : #'GToolkit-Coder-UI-Basic' } { #category : #ui } @@ -32,7 +32,7 @@ GtPreviewChangeButton >> buildDropDownElement [ changeAction cull: aButtonElement cull: aButtonModel cull: anEvent. aButtonElement fireEvent: BrDropdownHideWish new ]; yourself. - element addChild: unloadButton. + element addChild: unloadButton as: #'change-button-action'. ^ element ] From 876fe8425cd5a1269e1589fe033fb2cd0c014d37 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Mon, 8 Aug 2022 08:51:21 -0500 Subject: [PATCH 0223/1268] Start for [feenkcom/gtoolkit#2718] --- .../BrGhostTextAttribute.class.st | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/GToolkit-Coder-UI/BrGhostTextAttribute.class.st diff --git a/src/GToolkit-Coder-UI/BrGhostTextAttribute.class.st b/src/GToolkit-Coder-UI/BrGhostTextAttribute.class.st new file mode 100644 index 000000000..3b4f8c771 --- /dev/null +++ b/src/GToolkit-Coder-UI/BrGhostTextAttribute.class.st @@ -0,0 +1,33 @@ +Class { + #name : #BrGhostTextAttribute, + #superclass : #BrTextAdornmentAttribute, + #instVars : [ + 'text' + ], + #category : #'GToolkit-Coder-UI-Coder - Source Attributes' +} + +{ #category : #accessing } +BrGhostTextAttribute class >> for: aText [ + ^ self new + for: aText; + beAppend; + beNotOverwritableByStyler; + withoutCache; + yourself +] + +{ #category : #accessing } +BrGhostTextAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ + | element | + element := BlTextElement new + text: text; + yourself. + anEditorElement text isEmpty ifFalse: [ element size: 0 @ 0 ]. + ^ element +] + +{ #category : #accessing } +BrGhostTextAttribute >> for: aText [ + text := aText +] From 0f4036b4b779e800cbf9950afe4148bb09653b90 Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 9 Aug 2022 14:06:48 -0500 Subject: [PATCH 0224/1268] [feenkcom/gtoolkit#2719] add text's position to the outline boxes --- src/GToolkit-Coder-UI/GtDiffElement.class.st | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtDiffElement.class.st b/src/GToolkit-Coder-UI/GtDiffElement.class.st index 0d3335a5a..a69309860 100644 --- a/src/GToolkit-Coder-UI/GtDiffElement.class.st +++ b/src/GToolkit-Coder-UI/GtDiffElement.class.st @@ -159,7 +159,7 @@ GtDiffElement >> leftBottomFor: anInteger [ anInteger < range first ifTrue: [ ^ 0 ]. anInteger > range last ifTrue: [ ^ self height ]. element := leftElement children at: anInteger - range first + 1. - ^ element bounds bottom max: 0 + ^ element bounds bottom + leftElement bounds top max: 0 ] { #category : #accessing } @@ -203,7 +203,7 @@ GtDiffElement >> leftTopFor: anInteger [ anInteger < range first ifTrue: [ ^ 0 ]. anInteger > range last ifTrue: [ ^ self height ]. element := leftElement children at: anInteger - range first + 1. - ^ element bounds top max: 0 + ^ element bounds top + leftElement bounds top max: 0 ] { #category : #private } @@ -307,7 +307,7 @@ GtDiffElement >> rightBottomFor: anInteger [ anInteger < range first ifTrue: [ ^ 0 ]. anInteger > range last ifTrue: [ ^ self height ]. element := rightElement children at: anInteger - range first + 1. - ^ element bounds bottom max: 0 + ^ element bounds bottom + rightElement bounds top max: 0 ] { #category : #accessing } @@ -351,7 +351,7 @@ GtDiffElement >> rightTopFor: anInteger [ anInteger < range first ifTrue: [ ^ 0 ]. anInteger > range last ifTrue: [ ^ self height ]. element := rightElement children at: anInteger - range first + 1. - ^ element bounds top max: 0 + ^ element bounds top + rightElement bounds top max: 0 ] { #category : #'event handling' } From bcb6d443ffd4d036363ecdfc41a1f3e59f4c5a01 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 10 Aug 2022 08:55:40 -0500 Subject: [PATCH 0225/1268] Ghost Text Attribute, but cursor doesn't work correctly yet [feenkcom/gtoolkit#2718] --- src/GToolkit-Coder-UI/BrGhostTextAttribute.class.st | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/BrGhostTextAttribute.class.st b/src/GToolkit-Coder-UI/BrGhostTextAttribute.class.st index 3b4f8c771..c1447b506 100644 --- a/src/GToolkit-Coder-UI/BrGhostTextAttribute.class.st +++ b/src/GToolkit-Coder-UI/BrGhostTextAttribute.class.st @@ -23,7 +23,11 @@ BrGhostTextAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement element := BlTextElement new text: text; yourself. - anEditorElement text isEmpty ifFalse: [ element size: 0 @ 0 ]. + + self updateVisibilityOf: element in: anEditorElement. + element + when: BrTextEditorTextChangedRequest + do: [ :anEvent | self updateVisibilityOf: element in: anEditorElement ]. ^ element ] @@ -31,3 +35,10 @@ BrGhostTextAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement BrGhostTextAttribute >> for: aText [ text := aText ] + +{ #category : #accessing } +BrGhostTextAttribute >> updateVisibilityOf: element in: anEditorElement [ + ^ anEditorElement text isEmpty + ifTrue: [ element visibility: BlVisibility visible ] + ifFalse: [ element visibility: BlVisibility gone ] +] From 13271857d8957c9e1de1ce52afb93c0a071fa660 Mon Sep 17 00:00:00 2001 From: John Brant Date: Thu, 11 Aug 2022 06:31:56 -0500 Subject: [PATCH 0226/1268] removing unused method --- .../RBCompositeRefactoryChange.extension.st | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 src/GToolkit-Coder/RBCompositeRefactoryChange.extension.st diff --git a/src/GToolkit-Coder/RBCompositeRefactoryChange.extension.st b/src/GToolkit-Coder/RBCompositeRefactoryChange.extension.st deleted file mode 100644 index 21e075d5d..000000000 --- a/src/GToolkit-Coder/RBCompositeRefactoryChange.extension.st +++ /dev/null @@ -1,8 +0,0 @@ -Extension { #name : #RBCompositeRefactoryChange } - -{ #category : #'*GToolkit-Coder' } -RBCompositeRefactoryChange >> gtWithoutChanges [ - ^ self shallowCopy - changes: #(); - yourself -] From ed2747831a30b725158e07bd146e8dd3c5169c69 Mon Sep 17 00:00:00 2001 From: John Brant Date: Thu, 11 Aug 2022 09:44:55 -0500 Subject: [PATCH 0227/1268] removing another unused method --- src/GToolkit-Coder/RBRefactoryChange.extension.st | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 src/GToolkit-Coder/RBRefactoryChange.extension.st diff --git a/src/GToolkit-Coder/RBRefactoryChange.extension.st b/src/GToolkit-Coder/RBRefactoryChange.extension.st deleted file mode 100644 index 1d1a47fd3..000000000 --- a/src/GToolkit-Coder/RBRefactoryChange.extension.st +++ /dev/null @@ -1,6 +0,0 @@ -Extension { #name : #RBRefactoryChange } - -{ #category : #'*GToolkit-Coder' } -RBRefactoryChange >> gtWithoutChanges [ - ^ self -] From 917bc9d596d19ee41e898c4a137875f8f4cb352c Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 11 Aug 2022 13:04:44 -0500 Subject: [PATCH 0228/1268] Started implementing selector index for coder --- .../BrGhostTextAttribute.class.st | 1 + ...tCoderNavigationMethodListElement.class.st | 57 +++++++++++++ ...igationPackagesTagsClassesElement.class.st | 83 +++++++++++-------- 3 files changed, 108 insertions(+), 33 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderNavigationMethodListElement.class.st diff --git a/src/GToolkit-Coder-UI/BrGhostTextAttribute.class.st b/src/GToolkit-Coder-UI/BrGhostTextAttribute.class.st index c1447b506..94d2bb897 100644 --- a/src/GToolkit-Coder-UI/BrGhostTextAttribute.class.st +++ b/src/GToolkit-Coder-UI/BrGhostTextAttribute.class.st @@ -20,6 +20,7 @@ BrGhostTextAttribute class >> for: aText [ { #category : #accessing } BrGhostTextAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ | element | + self halt. element := BlTextElement new text: text; yourself. diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationMethodListElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationMethodListElement.class.st new file mode 100644 index 000000000..ea105607e --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderNavigationMethodListElement.class.st @@ -0,0 +1,57 @@ +Class { + #name : #GtCoderNavigationMethodListElement, + #superclass : #BrSimpleList, + #category : #'GToolkit-Coder-UI-Navigation' +} + +{ #category : #accessing } +GtCoderNavigationMethodListElement >> buildSelectorLabel: aMethod [ + ^ BrLabel new + aptitude: BrGlamorousLabelAptitude; + beSmallSize; + text: aMethod selector +] + +{ #category : #accessing } +GtCoderNavigationMethodListElement >> buildSelectorRow: aMethod index: aRowIndex list: aListElement [ + ^ BrWidgetContainer new + layout: BlLinearLayout horizontal; + aptitude: + BrHorizontalPaneAptitude new + + + (BrStyleCommonAptitude new + default: + [ :aStyle | aStyle background: self theme item deselectedColor ]; + hovered: + [ :aStyle | aStyle background: self theme item hoveredColor ]; + selected: + [ :aStyle | aStyle background: self theme item selectedColor ]; + pressed: + [ :aStyle | aStyle background: self theme item pressedColor ]; + focused: [ :aStyle | + aStyle + border: (BlBorder paint: self theme item focusedBorderColor width: 1) ]); + when: BlMouseDownEvent + do: [ :anEvent | + anEvent consumed: true. + aListElement selectOne: aRowIndex dueTo: anEvent. + aListElement requestFocus ]; + hMatchParent; + vFitContent; + padding: (BlInsets left: 3); + addChild: (self buildSelectorLabel: aMethod) +] + +{ #category : #accessing } +GtCoderNavigationMethodListElement >> initialize [ + super initialize. + self stencil: [ :eachMethod :eachIndex :aListElement | self buildSelectorRow: eachMethod index: eachIndex list: aListElement ] +] + +{ #category : #accessing } +GtCoderNavigationMethodListElement >> initializeWithMethods: aCollection [ + | names | + names := aCollection asSet + sorted: [ :a :b | a methodClass name <= b methodClass name and: [ a selector < b selector ] ]. + self items: names +] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index c2bd5c1d7..06878244c 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -7,7 +7,9 @@ Class { 'methodProtocolsList', 'classAndMethodProtocolList', 'protocolLabel', - 'coderFilterChangesSubscription' + 'coderFilterChangesSubscription', + 'selectorList', + 'selectorsLabel' ], #category : #'GToolkit-Coder-UI-Navigation' } @@ -81,40 +83,51 @@ GtCoderNavigationPackagesTagsClassesElement >> hideOrShowClassList [ GtCoderNavigationPackagesTagsClassesElement >> initializeContent [ super initializeContent. packagesList := GtCoderNavigationPackagesTreeElement new. - - methodProtocolsList := GtCoderNavigationMethodProtocolListElement new - matchParent. - + + methodProtocolsList := GtCoderNavigationMethodProtocolListElement new + matchParent. + classAndMethodProtocolList := BrVerticalPane new - matchParent; - addChild: classesList; - addChild: (protocolLabel := BrLabel new - aptitude: (BrGlamorousLabelAptitude new fontSize: 12; foreground: Color gray); - text: 'Categories'); - addChild: methodProtocolsList. + matchParent; + addChild: classesList; + addChild: (protocolLabel := BrLabel new + aptitude: (BrGlamorousLabelAptitude new + fontSize: 12; + foreground: Color gray); + text: 'Categories'); + addChild: methodProtocolsList. + + selectorList := GtCoderNavigationMethodListElement new ] { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> initializeElement [ super initializeElement. - self addChildren: { - BrLabel new - aptitude: (BrGlamorousLabelAptitude new fontSize: 12; foreground: Color gray); - text: 'Packages'. - - classesLabel := BrLabel new - aptitude: (BrGlamorousLabelAptitude new fontSize: 12; foreground: Color gray); - text: 'Classes'. - - packagesList. - classAndMethodProtocolList. - } + self + addChildren: {BrLabel new + aptitude: (BrGlamorousLabelAptitude new + fontSize: 12; + foreground: Color gray); + text: 'Packages'. + classesLabel := BrLabel new + aptitude: (BrGlamorousLabelAptitude new + fontSize: 12; + foreground: Color gray); + text: 'Classes'. + selectorsLabel := BrLabel new + aptitude: (BrGlamorousLabelAptitude new + fontSize: 12; + foreground: Color gray); + text: 'Selectors'. + packagesList. + classAndMethodProtocolList. + selectorList} ] { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> initializeLayout [ super initializeLayout. - self layout: (BlGridLayout horizontal columnCount: 2; cellSpacing: 5). + self layout: (BlGridLayout horizontal columnCount: 3; cellSpacing: 5). self constraintsDo: [ :c | c horizontal matchParent. c vertical matchParent ]. @@ -399,7 +412,7 @@ GtCoderNavigationPackagesTagsClassesElement >> selectedPackageTagNodeDo: aBlock GtCoderNavigationPackagesTagsClassesElement >> showClassList [ classAndMethodProtocolList visibility: BlVisibility visible. classesLabel visibility: BlVisibility visible. - self layout columnCount: 2. + self layout columnCount: 3. ] { #category : #subscriptions } @@ -447,17 +460,21 @@ GtCoderNavigationPackagesTagsClassesElement >> updateClassLists [ self hasNavigationModel ifFalse: [ ^ self ]. classesList initializeWithClasses: navigationModel classesToShow. navigationModel hasSelectedClass - ifTrue: - [ | methodProtocols | - methodProtocols := (navigationModel selectedClass organization protocols - , navigationModel selectedClass class organization protocols). + ifTrue: [ | methodProtocols | + methodProtocols := navigationModel selectedClass organization protocols + , navigationModel selectedClass class organization protocols. methodProtocolsList initializeWithProtocols: methodProtocols. + selectorList + initializeWithMethods: navigationModel selectedClass methods + , navigationModel selectedClass class methods. protocolLabel visibility: BlVisibility visible. - methodProtocolsList visibility: BlVisibility visible ] - ifFalse: - [ methodProtocolsList initializeWithProtocols: Array empty. + methodProtocolsList visibility: BlVisibility visible. + selectorsLabel visibility: BlVisibility visible ] + ifFalse: [ methodProtocolsList initializeWithProtocols: Array empty. + selectorList initializeWithMethods: #(). protocolLabel visibility: BlVisibility gone. - methodProtocolsList visibility: BlVisibility gone ] + methodProtocolsList visibility: BlVisibility gone. + selectorsLabel visibility: BlVisibility gone ] ] { #category : #'updating lists' } From 4e5a836c745a0573a072116fda369ed1da04c55e Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 11 Aug 2022 13:31:11 -0500 Subject: [PATCH 0229/1268] Revert "Started implementing selector index for coder" This reverts commit 917bc9d596d19ee41e898c4a137875f8f4cb352c. --- .../BrGhostTextAttribute.class.st | 1 - ...tCoderNavigationMethodListElement.class.st | 57 ------------- ...igationPackagesTagsClassesElement.class.st | 83 ++++++++----------- 3 files changed, 33 insertions(+), 108 deletions(-) delete mode 100644 src/GToolkit-Coder-UI/GtCoderNavigationMethodListElement.class.st diff --git a/src/GToolkit-Coder-UI/BrGhostTextAttribute.class.st b/src/GToolkit-Coder-UI/BrGhostTextAttribute.class.st index 94d2bb897..c1447b506 100644 --- a/src/GToolkit-Coder-UI/BrGhostTextAttribute.class.st +++ b/src/GToolkit-Coder-UI/BrGhostTextAttribute.class.st @@ -20,7 +20,6 @@ BrGhostTextAttribute class >> for: aText [ { #category : #accessing } BrGhostTextAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ | element | - self halt. element := BlTextElement new text: text; yourself. diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationMethodListElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationMethodListElement.class.st deleted file mode 100644 index ea105607e..000000000 --- a/src/GToolkit-Coder-UI/GtCoderNavigationMethodListElement.class.st +++ /dev/null @@ -1,57 +0,0 @@ -Class { - #name : #GtCoderNavigationMethodListElement, - #superclass : #BrSimpleList, - #category : #'GToolkit-Coder-UI-Navigation' -} - -{ #category : #accessing } -GtCoderNavigationMethodListElement >> buildSelectorLabel: aMethod [ - ^ BrLabel new - aptitude: BrGlamorousLabelAptitude; - beSmallSize; - text: aMethod selector -] - -{ #category : #accessing } -GtCoderNavigationMethodListElement >> buildSelectorRow: aMethod index: aRowIndex list: aListElement [ - ^ BrWidgetContainer new - layout: BlLinearLayout horizontal; - aptitude: - BrHorizontalPaneAptitude new - + - (BrStyleCommonAptitude new - default: - [ :aStyle | aStyle background: self theme item deselectedColor ]; - hovered: - [ :aStyle | aStyle background: self theme item hoveredColor ]; - selected: - [ :aStyle | aStyle background: self theme item selectedColor ]; - pressed: - [ :aStyle | aStyle background: self theme item pressedColor ]; - focused: [ :aStyle | - aStyle - border: (BlBorder paint: self theme item focusedBorderColor width: 1) ]); - when: BlMouseDownEvent - do: [ :anEvent | - anEvent consumed: true. - aListElement selectOne: aRowIndex dueTo: anEvent. - aListElement requestFocus ]; - hMatchParent; - vFitContent; - padding: (BlInsets left: 3); - addChild: (self buildSelectorLabel: aMethod) -] - -{ #category : #accessing } -GtCoderNavigationMethodListElement >> initialize [ - super initialize. - self stencil: [ :eachMethod :eachIndex :aListElement | self buildSelectorRow: eachMethod index: eachIndex list: aListElement ] -] - -{ #category : #accessing } -GtCoderNavigationMethodListElement >> initializeWithMethods: aCollection [ - | names | - names := aCollection asSet - sorted: [ :a :b | a methodClass name <= b methodClass name and: [ a selector < b selector ] ]. - self items: names -] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 06878244c..c2bd5c1d7 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -7,9 +7,7 @@ Class { 'methodProtocolsList', 'classAndMethodProtocolList', 'protocolLabel', - 'coderFilterChangesSubscription', - 'selectorList', - 'selectorsLabel' + 'coderFilterChangesSubscription' ], #category : #'GToolkit-Coder-UI-Navigation' } @@ -83,51 +81,40 @@ GtCoderNavigationPackagesTagsClassesElement >> hideOrShowClassList [ GtCoderNavigationPackagesTagsClassesElement >> initializeContent [ super initializeContent. packagesList := GtCoderNavigationPackagesTreeElement new. - - methodProtocolsList := GtCoderNavigationMethodProtocolListElement new - matchParent. - + + methodProtocolsList := GtCoderNavigationMethodProtocolListElement new + matchParent. + classAndMethodProtocolList := BrVerticalPane new - matchParent; - addChild: classesList; - addChild: (protocolLabel := BrLabel new - aptitude: (BrGlamorousLabelAptitude new - fontSize: 12; - foreground: Color gray); - text: 'Categories'); - addChild: methodProtocolsList. - - selectorList := GtCoderNavigationMethodListElement new + matchParent; + addChild: classesList; + addChild: (protocolLabel := BrLabel new + aptitude: (BrGlamorousLabelAptitude new fontSize: 12; foreground: Color gray); + text: 'Categories'); + addChild: methodProtocolsList. ] { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> initializeElement [ super initializeElement. - self - addChildren: {BrLabel new - aptitude: (BrGlamorousLabelAptitude new - fontSize: 12; - foreground: Color gray); - text: 'Packages'. - classesLabel := BrLabel new - aptitude: (BrGlamorousLabelAptitude new - fontSize: 12; - foreground: Color gray); - text: 'Classes'. - selectorsLabel := BrLabel new - aptitude: (BrGlamorousLabelAptitude new - fontSize: 12; - foreground: Color gray); - text: 'Selectors'. - packagesList. - classAndMethodProtocolList. - selectorList} + self addChildren: { + BrLabel new + aptitude: (BrGlamorousLabelAptitude new fontSize: 12; foreground: Color gray); + text: 'Packages'. + + classesLabel := BrLabel new + aptitude: (BrGlamorousLabelAptitude new fontSize: 12; foreground: Color gray); + text: 'Classes'. + + packagesList. + classAndMethodProtocolList. + } ] { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> initializeLayout [ super initializeLayout. - self layout: (BlGridLayout horizontal columnCount: 3; cellSpacing: 5). + self layout: (BlGridLayout horizontal columnCount: 2; cellSpacing: 5). self constraintsDo: [ :c | c horizontal matchParent. c vertical matchParent ]. @@ -412,7 +399,7 @@ GtCoderNavigationPackagesTagsClassesElement >> selectedPackageTagNodeDo: aBlock GtCoderNavigationPackagesTagsClassesElement >> showClassList [ classAndMethodProtocolList visibility: BlVisibility visible. classesLabel visibility: BlVisibility visible. - self layout columnCount: 3. + self layout columnCount: 2. ] { #category : #subscriptions } @@ -460,21 +447,17 @@ GtCoderNavigationPackagesTagsClassesElement >> updateClassLists [ self hasNavigationModel ifFalse: [ ^ self ]. classesList initializeWithClasses: navigationModel classesToShow. navigationModel hasSelectedClass - ifTrue: [ | methodProtocols | - methodProtocols := navigationModel selectedClass organization protocols - , navigationModel selectedClass class organization protocols. + ifTrue: + [ | methodProtocols | + methodProtocols := (navigationModel selectedClass organization protocols + , navigationModel selectedClass class organization protocols). methodProtocolsList initializeWithProtocols: methodProtocols. - selectorList - initializeWithMethods: navigationModel selectedClass methods - , navigationModel selectedClass class methods. protocolLabel visibility: BlVisibility visible. - methodProtocolsList visibility: BlVisibility visible. - selectorsLabel visibility: BlVisibility visible ] - ifFalse: [ methodProtocolsList initializeWithProtocols: Array empty. - selectorList initializeWithMethods: #(). + methodProtocolsList visibility: BlVisibility visible ] + ifFalse: + [ methodProtocolsList initializeWithProtocols: Array empty. protocolLabel visibility: BlVisibility gone. - methodProtocolsList visibility: BlVisibility gone. - selectorsLabel visibility: BlVisibility gone ] + methodProtocolsList visibility: BlVisibility gone ] ] { #category : #'updating lists' } From d1ed018b74cf8d6301e0c5ac30ead8a9cbf12128 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 11 Aug 2022 13:29:57 -0500 Subject: [PATCH 0230/1268] More implementing selector index for coder Selector list updating on protocol selection First cut working Store methods in list instead of selectors Clear selections on class/protocol change --- ...tCoderNavigationMethodListElement.class.st | 57 +++++++ ...igationPackagesTagsClassesElement.class.st | 141 ++++++++++++------ 2 files changed, 150 insertions(+), 48 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderNavigationMethodListElement.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationMethodListElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationMethodListElement.class.st new file mode 100644 index 000000000..be15fca95 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderNavigationMethodListElement.class.st @@ -0,0 +1,57 @@ +Class { + #name : #GtCoderNavigationMethodListElement, + #superclass : #BrSimpleList, + #category : #'GToolkit-Coder-UI-Navigation' +} + +{ #category : #accessing } +GtCoderNavigationMethodListElement >> buildSelectorLabel: aMethod [ + ^ BrLabel new + aptitude: BrGlamorousLabelAptitude; + beSmallSize; + text: aMethod selector +] + +{ #category : #accessing } +GtCoderNavigationMethodListElement >> buildSelectorRow: aMethod index: aRowIndex list: aListElement [ + ^ BrWidgetContainer new + layout: BlLinearLayout horizontal; + aptitude: + BrHorizontalPaneAptitude new + + + (BrStyleCommonAptitude new + default: + [ :aStyle | aStyle background: self theme item deselectedColor ]; + hovered: + [ :aStyle | aStyle background: self theme item hoveredColor ]; + selected: + [ :aStyle | aStyle background: self theme item selectedColor ]; + pressed: + [ :aStyle | aStyle background: self theme item pressedColor ]; + focused: [ :aStyle | + aStyle + border: (BlBorder paint: self theme item focusedBorderColor width: 1) ]); + when: BlMouseDownEvent + do: [ :anEvent | + anEvent consumed: true. + aListElement selectOne: aRowIndex dueTo: anEvent. + aListElement requestFocus ]; + hMatchParent; + vFitContent; + padding: (BlInsets left: 3); + addChild: (self buildSelectorLabel: aMethod) +] + +{ #category : #accessing } +GtCoderNavigationMethodListElement >> initialize [ + super initialize. + self stencil: [ :eachMethod :eachIndex :aListElement | self buildSelectorRow: eachMethod index: eachIndex list: aListElement ] +] + +{ #category : #accessing } +GtCoderNavigationMethodListElement >> initializeWithMethods: aCollection [ + | names | + names := aCollection asSet + sorted: [ :a :b | a methodClass name <= b methodClass name and: [ a selector < b selector ] ]. + self items: names +] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index c2bd5c1d7..f1fde0ec2 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -7,7 +7,10 @@ Class { 'methodProtocolsList', 'classAndMethodProtocolList', 'protocolLabel', - 'coderFilterChangesSubscription' + 'coderFilterChangesSubscription', + 'methodList', + 'methodLabel', + 'methodsLabel' ], #category : #'GToolkit-Coder-UI-Navigation' } @@ -81,45 +84,68 @@ GtCoderNavigationPackagesTagsClassesElement >> hideOrShowClassList [ GtCoderNavigationPackagesTagsClassesElement >> initializeContent [ super initializeContent. packagesList := GtCoderNavigationPackagesTreeElement new. - - methodProtocolsList := GtCoderNavigationMethodProtocolListElement new - matchParent. - + + methodProtocolsList := GtCoderNavigationMethodProtocolListElement new + matchParent. + classAndMethodProtocolList := BrVerticalPane new - matchParent; - addChild: classesList; - addChild: (protocolLabel := BrLabel new - aptitude: (BrGlamorousLabelAptitude new fontSize: 12; foreground: Color gray); - text: 'Categories'); - addChild: methodProtocolsList. + matchParent; + addChild: classesList; + addChild: (protocolLabel := BrLabel new + aptitude: (BrGlamorousLabelAptitude new + fontSize: 12; + foreground: Color gray); + text: 'Categories'); + addChild: methodProtocolsList. + + methodList := GtCoderNavigationMethodListElement new ] { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> initializeElement [ super initializeElement. - self addChildren: { - BrLabel new - aptitude: (BrGlamorousLabelAptitude new fontSize: 12; foreground: Color gray); - text: 'Packages'. - - classesLabel := BrLabel new - aptitude: (BrGlamorousLabelAptitude new fontSize: 12; foreground: Color gray); - text: 'Classes'. - - packagesList. - classAndMethodProtocolList. - } + self + addChildren: {BrLabel new + aptitude: (BrGlamorousLabelAptitude new + fontSize: 12; + foreground: Color gray); + text: 'Packages'. + classesLabel := BrLabel new + aptitude: (BrGlamorousLabelAptitude new + fontSize: 12; + foreground: Color gray); + text: 'Classes'. + methodsLabel := BrLabel new + aptitude: (BrGlamorousLabelAptitude new + fontSize: 12; + foreground: Color gray); + text: 'Methods'. + packagesList. + classAndMethodProtocolList. + methodList} ] { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> initializeLayout [ super initializeLayout. - self layout: (BlGridLayout horizontal columnCount: 2; cellSpacing: 5). + self layout: (BlGridLayout horizontal columnCount: 3; cellSpacing: 5). self constraintsDo: [ :c | c horizontal matchParent. c vertical matchParent ]. ] +{ #category : #subscriptions } +GtCoderNavigationPackagesTagsClassesElement >> onMethodListSelectionChanged [ + | anIndex aSelectedItem theIndices | + supressListChanges ifTrue: [ ^ self ]. + theIndices := methodList selectedIndices. + theIndices ifEmpty: [ ^ self ]. + anIndex := theIndices first. + (anIndex between: 1 and: methodList viewModel itemCount) ifFalse: [ ^ self ]. + aSelectedItem := (methodList viewModel itemAt: anIndex) value. + self navigationModel selectMethod: aSelectedItem +] + { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onMethodsCoderFiltersChanged: aGtCodersFiltersChanged [ aGtCodersFiltersChanged source = self ifTrue: [ ^ self ]. @@ -234,7 +260,7 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackagesSelected: anAnnouncer [ { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onProtocolListSelectionChanged [ - | anIndex aSelectedItem theIndices | + | anIndex aSelectedItem theIndices methods | supressListChanges ifTrue: [ ^ self ]. theIndices := methodProtocolsList selectedIndices. theIndices ifEmpty: [ ^ self ]. @@ -243,6 +269,15 @@ GtCoderNavigationPackagesTagsClassesElement >> onProtocolListSelectionChanged [ ifFalse: [ ^ self ]. aSelectedItem := (methodProtocolsList viewModel itemAt: anIndex) value. self navigationModel selectMethodProtocol: aSelectedItem source: self. + methods := (self selectedClass organization protocolNamed: aSelectedItem) + ifNotNil: [ :s | s methodSelectors collect: [ :sel | self selectedClass >> sel ] ] + ifNil: [ #() ]. + methods := methods + , ((self selectedClass class organization protocolNamed: aSelectedItem) + ifNotNil: [ :s | s methodSelectors collect: [ :sel | self selectedClass class >> sel ] ] + ifNil: [ #() ]). + methodList deselectAll. + methodList initializeWithMethods: methods ] { #category : #'api - package updates' } @@ -399,7 +434,7 @@ GtCoderNavigationPackagesTagsClassesElement >> selectedPackageTagNodeDo: aBlock GtCoderNavigationPackagesTagsClassesElement >> showClassList [ classAndMethodProtocolList visibility: BlVisibility visible. classesLabel visibility: BlVisibility visible. - self layout columnCount: 2. + self layout columnCount: 3. ] { #category : #subscriptions } @@ -408,21 +443,20 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToContent [ self subscribeToPackageList. self subscribeToClassList. self subscribeToProtocolList. + self subscribeToMethodList ] { #category : #subscriptions } +GtCoderNavigationPackagesTagsClassesElement >> subscribeToMethodList [ + methodList + when: BrSelectionChanged + do: [ :anEvent | self onMethodListSelectionChanged ]. +] + +{ #category : #'api - package updates' } GtCoderNavigationPackagesTagsClassesElement >> subscribeToNavigationModel [ self hasNavigationModel ifFalse: [ ^ self ]. - super subscribeToNavigationModel. - navigationModel weak when: GtCoderNavigationPackagesSelected send: #onPackagesSelected: to: self. - navigationModel weak when: GtCoderNavigationPackageSelected send: #onPackageSelected: to: self. - navigationModel weak when: GtCoderNavigationPackageTagSelected send: #onPackageTagSelected: to: self. - navigationModel weak when: GtCoderNavigationPackageRegistered send: #onPackageRegistered: to: self. - navigationModel weak when: GtCoderNavigationPackageUnregistered send: #onPackageUnregistered: to: self. - navigationModel weak when: GtCoderNavigationPackageRenamed send: #onPackageRenamed: to: self. - navigationModel weak when: GtCoderNavigationPackageTagAdded send: #onPackageTagAdded: to: self. - navigationModel weak when: GtCoderNavigationPackageTagRemoved send: #onPackageTagRemoved: to: self. - navigationModel weak when: GtCodersFiltersChanged send: #onMethodsCoderFiltersChanged: to: self. + super subscribeToNavigationModel ] { #category : #subscriptions } @@ -446,18 +480,7 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToProtocolList [ GtCoderNavigationPackagesTagsClassesElement >> updateClassLists [ self hasNavigationModel ifFalse: [ ^ self ]. classesList initializeWithClasses: navigationModel classesToShow. - navigationModel hasSelectedClass - ifTrue: - [ | methodProtocols | - methodProtocols := (navigationModel selectedClass organization protocols - , navigationModel selectedClass class organization protocols). - methodProtocolsList initializeWithProtocols: methodProtocols. - protocolLabel visibility: BlVisibility visible. - methodProtocolsList visibility: BlVisibility visible ] - ifFalse: - [ methodProtocolsList initializeWithProtocols: Array empty. - protocolLabel visibility: BlVisibility gone. - methodProtocolsList visibility: BlVisibility gone ] + self updateProtocolList ] { #category : #'updating lists' } @@ -480,6 +503,28 @@ GtCoderNavigationPackagesTagsClassesElement >> updatePackageLists [ packagesList initializeWithPackages: navigationModel packagesToShow. ] +{ #category : #'updating lists' } +GtCoderNavigationPackagesTagsClassesElement >> updateProtocolList [ + | methodProtocols | + methodProtocolsList deselectAll. + methodList deselectAll. + navigationModel hasSelectedClass + ifTrue: [ methodProtocols := navigationModel selectedClass organization protocols + , navigationModel selectedClass class organization protocols. + methodProtocolsList initializeWithProtocols: methodProtocols. + methodProtocolsList visibility: BlVisibility visible. + methodList + initializeWithMethods: navigationModel selectedClass methods + , navigationModel selectedClass class methods. + methodsLabel visibility: BlVisibility visible. + protocolLabel visibility: BlVisibility visible ] + ifFalse: [ methodProtocolsList initializeWithProtocols: Array empty. + methodList initializeWithMethods: #(). + protocolLabel visibility: BlVisibility hidden. + methodProtocolsList visibility: BlVisibility hidden. + methodsLabel visibility: BlVisibility hidden ] +] + { #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updateSelectedPackageAndTag [ self hasNavigationModel ifFalse: [ ^ self ]. From edd2791ae126642c2363ba1b5e432b93d83bce8b Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Mon, 15 Aug 2022 10:26:08 -0500 Subject: [PATCH 0231/1268] Fix subscription to GtCoderNavigation model --- ...derNavigationClassHierachyElement.class.st | 58 +++----- .../GtCoderNavigationElement.class.st | 51 +++---- ...igationPackagesTagsClassesElement.class.st | 139 +++++++++--------- 3 files changed, 116 insertions(+), 132 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassHierachyElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassHierachyElement.class.st index 31902f685..fe26d4796 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassHierachyElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassHierachyElement.class.st @@ -21,60 +21,50 @@ GtCoderNavigationClassHierachyElement >> initializeLayout [ { #category : #subscriptions } GtCoderNavigationClassHierachyElement >> onClassModified: anAnnouncement [ - supressNavigationChanges ifTrue: [ ^ self ]. - self suppressListChangeEventsDuring: [ - self - updateClass: anAnnouncement theClass - inPackage: anAnnouncement package - tag: anAnnouncement tag ] + self + suppressListChangeEventsDuring: [ self + updateClass: anAnnouncement theClass + inPackage: anAnnouncement package + tag: anAnnouncement tag ] ] { #category : #subscriptions } GtCoderNavigationClassHierachyElement >> onClassRenamed: anAnnouncement [ - supressNavigationChanges ifTrue: [ ^ self ]. - self suppressListChangeEventsDuring: [ - self - renameClass: anAnnouncement theClass - oldName: anAnnouncement oldName - newName: anAnnouncement newName - inPackage: anAnnouncement package - tag: anAnnouncement tag ] + self + suppressListChangeEventsDuring: [ self + renameClass: anAnnouncement theClass + oldName: anAnnouncement oldName + newName: anAnnouncement newName + inPackage: anAnnouncement package + tag: anAnnouncement tag ] ] { #category : #'event handling' } GtCoderNavigationClassHierachyElement >> onClassSelected: anAnnouncement [ - supressNavigationChanges ifTrue: [ ^ self ]. - self suppressListChangeEventsDuring: [ - self updateClassListsWith: anAnnouncement theClass. - self selectClass: anAnnouncement theClass ]. + self + suppressListChangeEventsDuring: [ self updateClassListsWith: anAnnouncement theClass. + self selectClass: anAnnouncement theClass ] ] { #category : #'event handling' } GtCoderNavigationClassHierachyElement >> onPackageSelected: anAnnouncer [ - supressNavigationChanges ifTrue: [ ^ self ]. - self suppressListChangeEventsDuring: [ - self emptyClassList. - self deselectClasses. ] + self + suppressListChangeEventsDuring: [ self emptyClassList. + self deselectClasses ] ] { #category : #'event handling' } GtCoderNavigationClassHierachyElement >> onPackageTagSelected: anAnnouncer [ - supressNavigationChanges ifTrue: [ ^ self ]. - self suppressListChangeEventsDuring: [ - BlFrameTelemetry - time: [ 'Empty class list' ] - during: [ self emptyClassList ]. - BlFrameTelemetry - time: [ 'Deselect classes' ] - during: [ self deselectClasses ] ]. + self + suppressListChangeEventsDuring: [ self emptyClassList. + self deselectClasses ] ] { #category : #'event handling' } GtCoderNavigationClassHierachyElement >> onPackagesSelected: anAnnouncer [ - supressNavigationChanges ifTrue: [ ^ self ]. - self suppressListChangeEventsDuring: [ - self emptyClassList. - self deselectClasses. ] + self + suppressListChangeEventsDuring: [ self emptyClassList. + self deselectClasses ] ] { #category : #subscriptions } diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st index 4ee91341c..a2cdffd91 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st @@ -3,7 +3,6 @@ Class { #superclass : #BlElement, #instVars : [ 'navigationModel', - 'supressNavigationChanges', 'supressListChanges', 'classesList' ], @@ -37,15 +36,14 @@ GtCoderNavigationElement >> hasNavigationModel [ GtCoderNavigationElement >> initialize [ super initialize. supressListChanges := false. - supressNavigationChanges := false. self initializeLayout. self initializeContent. - self initializeElement. + self initializeElement ] { #category : #initialization } GtCoderNavigationElement >> initializeContent [ - classesList := GtCoderNavigationClassesHierarchyTreeElement new. + classesList := GtCoderNavigationClassesHierarchyTreeElement new. ] { #category : #initialization } @@ -96,34 +94,31 @@ GtCoderNavigationElement >> onClassListSelectionChanged [ { #category : #'event handling' } GtCoderNavigationElement >> onClassModified: anAnnouncement [ - supressNavigationChanges ifTrue: [ ^ self ]. - self suppressListChangeEventsDuring: [ - self - updateClass: anAnnouncement theClass - inPackage: anAnnouncement package - tag: anAnnouncement tag ] + self + suppressListChangeEventsDuring: [ self + updateClass: anAnnouncement theClass + inPackage: anAnnouncement package + tag: anAnnouncement tag ] ] { #category : #'event handling' } GtCoderNavigationElement >> onClassRenamed: anAnnouncement [ - supressNavigationChanges ifTrue: [ ^ self ]. - self suppressListChangeEventsDuring: [ - self - renameClass: anAnnouncement theClass - oldName: anAnnouncement oldName - newName: anAnnouncement newName - inPackage: anAnnouncement package - tag: anAnnouncement tag ] + self + suppressListChangeEventsDuring: [ self + renameClass: anAnnouncement theClass + oldName: anAnnouncement oldName + newName: anAnnouncement newName + inPackage: anAnnouncement package + tag: anAnnouncement tag ] ] { #category : #'event handling' } GtCoderNavigationElement >> onClassSelected: anAnnouncement [ - supressNavigationChanges ifTrue: [ ^ self ]. - self suppressListChangeEventsDuring: [ - self - selectClass: anAnnouncement theClass - inPackage: anAnnouncement package - tag: anAnnouncement tag ]. + self + suppressListChangeEventsDuring: [ self + selectClass: anAnnouncement theClass + inPackage: anAnnouncement package + tag: anAnnouncement tag ] ] { #category : #'event handling' } @@ -210,14 +205,6 @@ GtCoderNavigationElement >> suppressListChangeEventsDuring: aBlock [ aBlock ensure: [ supressListChanges := anOldValue ]. ] -{ #category : #subscriptions } -GtCoderNavigationElement >> suppressNavigationChangeEventsDuring: aBlock [ - | anOldValue | - anOldValue := supressNavigationChanges. - supressNavigationChanges := true. - aBlock ensure: [ supressNavigationChanges := anOldValue ]. -] - { #category : #subscriptions } GtCoderNavigationElement >> unsubscribeFromNavigationModel [ self hasNavigationModel ifFalse: [ ^ self ]. diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index f1fde0ec2..9fee78ce5 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -68,9 +68,8 @@ GtCoderNavigationPackagesTagsClassesElement >> hasPackageTagsIn: aRPackage [ { #category : #'showing / hiding' } GtCoderNavigationPackagesTagsClassesElement >> hideClassList [ - classAndMethodProtocolList visibility: BlVisibility gone. - classesLabel visibility: BlVisibility gone. - self layout columnCount: 1. + classAndMethodProtocolList visibility: BlVisibility hidden. + classesLabel visibility: BlVisibility hidden. ] { #category : #'showing / hiding' } @@ -81,7 +80,7 @@ GtCoderNavigationPackagesTagsClassesElement >> hideOrShowClassList [ ] { #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> initializeContent [ +GtCoderNavigationPackagesTagsClassesElement >> initializeContent [ super initializeContent. packagesList := GtCoderNavigationPackagesTreeElement new. @@ -178,84 +177,68 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackageListSelectionChanged [ theIndices := packagesList selectedIndices. theIndices ifEmpty: [ ^ self ]. anIndex := theIndices first. - (anIndex between: 1 and: packagesList viewModel itemCount) - ifFalse: [ ^ self ]. + (anIndex between: 1 and: packagesList viewModel itemCount) ifFalse: [ ^ self ]. aSelectedItem := (packagesList viewModel itemAt: anIndex) value. (aSelectedItem isKindOf: RPackage) - ifTrue: [ - BlFrameTelemetry - time: [ 'Select package ', aSelectedItem printString ] - during: [ self navigationModel selectPackage: aSelectedItem ] ] - ifFalse: [ - BlFrameTelemetry - time: [ 'Select tag ', aSelectedItem printString ] - during: [ self navigationModel selectTag: aSelectedItem ] ] + ifTrue: [ self navigationModel selectPackage: aSelectedItem ] + ifFalse: [ self navigationModel selectTag: aSelectedItem ]. + self showClassList. + self deselectClasses ] { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageRegistered: anAnnouncement [ - supressNavigationChanges ifTrue: [ ^ self ]. - self suppressListChangeEventsDuring: [ - self addPackage: anAnnouncement package ] + self + suppressListChangeEventsDuring: [ self addPackage: anAnnouncement package ] ] { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageRenamed: anAnnouncement [ - supressNavigationChanges ifTrue: [ ^ self ]. - self suppressListChangeEventsDuring: [ - self - renamePackage: anAnnouncement package - oldName: anAnnouncement oldName - newName: anAnnouncement newName ] + self + suppressListChangeEventsDuring: [ self + renamePackage: anAnnouncement package + oldName: anAnnouncement oldName + newName: anAnnouncement newName ] ] { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageSelected: anAnnouncer [ - supressNavigationChanges ifTrue: [ ^ self ]. - self suppressListChangeEventsDuring: [ - self selectPackage: anAnnouncer package. - self deselectClasses. ] + self + suppressListChangeEventsDuring: [ self selectPackage: anAnnouncer package. + self showClassList. + self deselectClasses ] ] { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageTagAdded: anAnnouncement [ - supressNavigationChanges ifTrue: [ ^ self ]. - self suppressListChangeEventsDuring: [ - self addPackage: anAnnouncement package tag: anAnnouncement tag ] + self + suppressListChangeEventsDuring: [ self addPackage: anAnnouncement package tag: anAnnouncement tag ] ] { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageTagRemoved: anAnnouncement [ - supressNavigationChanges ifTrue: [ ^ self ]. - self suppressListChangeEventsDuring: [ - self removePackage: anAnnouncement package tag: anAnnouncement tag ] + self + suppressListChangeEventsDuring: [ self removePackage: anAnnouncement package tag: anAnnouncement tag ] ] { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageTagSelected: anAnnouncer [ - supressNavigationChanges ifTrue: [ ^ self ]. - self suppressListChangeEventsDuring: [ - BlFrameTelemetry - time: [ 'Select package ', anAnnouncer package printString, ' tag ', anAnnouncer tag printString ] - during: [ self - selectPackage: anAnnouncer package - tag: anAnnouncer tag ]. - self deselectClasses. ]. + self + suppressListChangeEventsDuring: [ self selectPackage: anAnnouncer package tag: anAnnouncer tag. + self deselectClasses ] ] { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageUnregistered: anAnnouncement [ - supressNavigationChanges ifTrue: [ ^ self ]. - self suppressListChangeEventsDuring: [ - self removePackage: anAnnouncement package ] + self + suppressListChangeEventsDuring: [ self removePackage: anAnnouncement package ] ] { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackagesSelected: anAnnouncer [ - supressNavigationChanges ifTrue: [ ^ self ]. - self suppressListChangeEventsDuring: [ - self deselectPackages. - self deselectClasses. ] + self + suppressListChangeEventsDuring: [ self deselectPackages. + self deselectClasses ] ] { #category : #'event handling' } @@ -369,8 +352,7 @@ GtCoderNavigationPackagesTagsClassesElement >> selectPackage: aPackage [ { #category : #'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> selectPackage: aPackage tag: aPackageTag [ | aPreviousIndex | - (self hasPackageTagsIn: aPackage) - ifFalse: [ ^ self selectPackage: aPackage ]. + (self hasPackageTagsIn: aPackage) ifFalse: [ ^ self selectPackage: aPackage ]. self expandPackage: aPackage. aPreviousIndex := packagesList selectedIndice. @@ -380,19 +362,12 @@ GtCoderNavigationPackagesTagsClassesElement >> selectPackage: aPackage tag: aPac do: [ :aNewIndex | packagesList selectOne: aNewIndex; - scrollToIndex: - (self + scrollToIndex: (self scrollIndexFromPrevious: aPreviousIndex current: aNewIndex max: packagesList viewModel itemCount) ]. - - BlFrameTelemetry - time: [ self class name, ' #updateClassLists' ] - during: [ self updateClassLists ]. - - BlFrameTelemetry - time: [ self class name, ' #hideOrShowClassList' ] - during: [ self hideOrShowClassList ] + self updateClassLists. + self hideOrShowClassList ] { #category : #'api - package selections' } @@ -434,7 +409,6 @@ GtCoderNavigationPackagesTagsClassesElement >> selectedPackageTagNodeDo: aBlock GtCoderNavigationPackagesTagsClassesElement >> showClassList [ classAndMethodProtocolList visibility: BlVisibility visible. classesLabel visibility: BlVisibility visible. - self layout columnCount: 3. ] { #category : #subscriptions } @@ -456,17 +430,50 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToMethodList [ { #category : #'api - package updates' } GtCoderNavigationPackagesTagsClassesElement >> subscribeToNavigationModel [ self hasNavigationModel ifFalse: [ ^ self ]. - super subscribeToNavigationModel + super subscribeToNavigationModel. + navigationModel weak + when: GtCoderNavigationPackagesSelected + send: #onPackagesSelected: + to: self. + navigationModel weak + when: GtCoderNavigationPackageSelected + send: #onPackageSelected: + to: self. + navigationModel weak + when: GtCoderNavigationPackageTagSelected + send: #onPackageTagSelected: + to: self. + navigationModel weak + when: GtCoderNavigationPackageRegistered + send: #onPackageRegistered: + to: self. + navigationModel weak + when: GtCoderNavigationPackageUnregistered + send: #onPackageUnregistered: + to: self. + navigationModel weak + when: GtCoderNavigationPackageRenamed + send: #onPackageRenamed: + to: self. + navigationModel weak + when: GtCoderNavigationPackageTagAdded + send: #onPackageTagAdded: + to: self. + navigationModel weak + when: GtCoderNavigationPackageTagRemoved + send: #onPackageTagRemoved: + to: self. + navigationModel weak + when: GtCodersFiltersChanged + send: #onMethodsCoderFiltersChanged: + to: self ] { #category : #subscriptions } GtCoderNavigationPackagesTagsClassesElement >> subscribeToPackageList [ packagesList when: BrSelectionChanged - do: [ :anEvent | - BlFrameTelemetry - time: [ self class name, ' #onPackageListSelectionChanged' ] - during: [ self onPackageListSelectionChanged ] ]. + do: [ :anEvent | self onPackageListSelectionChanged ] ] { #category : #subscriptions } From 88af40e5760a6c16208abfa7c18e9555e2fa6d12 Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Wed, 17 Aug 2022 12:34:40 +0200 Subject: [PATCH 0232/1268] convert set to array to ensure it can be concatenated feenkcom/gtoolkit#2734 --- .../GtCoderNavigationPackagesTagsClassesElement.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 9fee78ce5..701ee517a 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -253,11 +253,11 @@ GtCoderNavigationPackagesTagsClassesElement >> onProtocolListSelectionChanged [ aSelectedItem := (methodProtocolsList viewModel itemAt: anIndex) value. self navigationModel selectMethodProtocol: aSelectedItem source: self. methods := (self selectedClass organization protocolNamed: aSelectedItem) - ifNotNil: [ :s | s methodSelectors collect: [ :sel | self selectedClass >> sel ] ] + ifNotNil: [ :s | s methodSelectors collect: [ :sel | self selectedClass >> sel ] as: Array ] ifNil: [ #() ]. methods := methods , ((self selectedClass class organization protocolNamed: aSelectedItem) - ifNotNil: [ :s | s methodSelectors collect: [ :sel | self selectedClass class >> sel ] ] + ifNotNil: [ :s | s methodSelectors collect: [ :sel | self selectedClass class >> sel ] as: Array] ifNil: [ #() ]). methodList deselectAll. methodList initializeWithMethods: methods From f3561115c2a6b3be4cf0fe661546b4e6c1d1b1c9 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 17 Aug 2022 06:52:23 -0500 Subject: [PATCH 0233/1268] Cleanup --- .../GtCodersScrollToCoder.class.st | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 src/GToolkit-Coder/GtCodersScrollToCoder.class.st diff --git a/src/GToolkit-Coder/GtCodersScrollToCoder.class.st b/src/GToolkit-Coder/GtCodersScrollToCoder.class.st deleted file mode 100644 index 8d888610b..000000000 --- a/src/GToolkit-Coder/GtCodersScrollToCoder.class.st +++ /dev/null @@ -1,18 +0,0 @@ -Class { - #name : #GtCodersScrollToCoder, - #superclass : #GtCodersAnnouncement, - #instVars : [ - 'sourceCoder' - ], - #category : 'GToolkit-Coder-Event' -} - -{ #category : #accessing } -GtCodersScrollToCoder >> sourceCoder [ - ^ sourceCoder -] - -{ #category : #accessing } -GtCodersScrollToCoder >> sourceCoder: anObject [ - sourceCoder := anObject -] From cb26a2e0077889bf65870d4c3b006e9c2ee41754 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 17 Aug 2022 08:32:41 -0500 Subject: [PATCH 0234/1268] Revert "Cleanup" This reverts commit f3561115c2a6b3be4cf0fe661546b4e6c1d1b1c9. --- .../GtCodersScrollToCoder.class.st | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/GToolkit-Coder/GtCodersScrollToCoder.class.st diff --git a/src/GToolkit-Coder/GtCodersScrollToCoder.class.st b/src/GToolkit-Coder/GtCodersScrollToCoder.class.st new file mode 100644 index 000000000..8d888610b --- /dev/null +++ b/src/GToolkit-Coder/GtCodersScrollToCoder.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtCodersScrollToCoder, + #superclass : #GtCodersAnnouncement, + #instVars : [ + 'sourceCoder' + ], + #category : 'GToolkit-Coder-Event' +} + +{ #category : #accessing } +GtCodersScrollToCoder >> sourceCoder [ + ^ sourceCoder +] + +{ #category : #accessing } +GtCodersScrollToCoder >> sourceCoder: anObject [ + sourceCoder := anObject +] From f3f05d1bc5b34589735ee47b4d3aa8a52203ad90 Mon Sep 17 00:00:00 2001 From: John Brant Date: Thu, 18 Aug 2022 06:53:58 -0500 Subject: [PATCH 0235/1268] [feenkcom/gtoolkit#2728] renaming variables in lepiter rewrites --- .../GtCompositeRenameAction.class.st | 51 ++++++++++--------- .../GtRenameAction.class.st | 25 ++++----- 2 files changed, 39 insertions(+), 37 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtCompositeRenameAction.class.st b/src/GToolkit-Coder-AddOns/GtCompositeRenameAction.class.st index 5c37593b4..6b39f2e77 100644 --- a/src/GToolkit-Coder-AddOns/GtCompositeRenameAction.class.st +++ b/src/GToolkit-Coder-AddOns/GtCompositeRenameAction.class.st @@ -5,18 +5,13 @@ Class { 'otherTextIntervals', 'otherTextAttributes' ], - #category : 'GToolkit-Coder-AddOns-Inline rename' + #category : #'GToolkit-Coder-AddOns-Inline rename' } { #category : #private } GtCompositeRenameAction >> addLocations: intervals to: anEditor [ - self addLocations: intervals toText: anEditor text -] - -{ #category : #private } -GtCompositeRenameAction >> addLocations: intervals toText: ropedText [ otherTextIntervals - at: ropedText + at: anEditor put: (intervals asSortedCollection: [ :a :b | a first < b first ]) ] @@ -30,21 +25,19 @@ GtCompositeRenameAction >> addRenameAttributes [ GtCompositeRenameAction >> addRenameAttributesToOtherEditors [ | size | size := self originalName size. - size < 1 - ifTrue: [ ^ self ]. + size < 1 ifTrue: [ ^ self ]. self removeOtherAttributes. otherTextIntervals - keysAndValuesDo: [ :text :intervals | + keysAndValuesDo: [ :editor :intervals | otherTextAttributes - at: text - put: - (intervals + at: editor + put: (intervals collect: [ :each | | attribute | attribute := GtRenamePreviewAttribute new - action: self; - text: (text from: each first to: each last). - (text from: each first to: each last) attributes: {attribute}. + action: self; + text: (editor text from: each first to: each last). + (editor text from: each first to: each last) attributes: {attribute}. attribute ]) ] ] @@ -64,8 +57,7 @@ GtCompositeRenameAction >> removeAttributes [ { #category : #private } GtCompositeRenameAction >> removeOtherAttributes [ otherTextAttributes - keysDo: - [ :text | text clearAttributes: [ :each | self isRenameAttribute: each ] ] + keysDo: [ :editor | editor text clearAttributes: [ :each | self isRenameAttribute: each ] ] ] { #category : #private } @@ -83,14 +75,23 @@ GtCompositeRenameAction >> updateName: blText [ { #category : #private } GtCompositeRenameAction >> updateOtherEditors [ - self newName = self originalName - ifTrue: [ ^ self ]. + self newName = self originalName ifTrue: [ ^ self ]. otherTextIntervals - keysAndValuesDo: [ :text :intervals | - self - updateText: text - at: intervals - attributes: (otherTextAttributes at: text) ] + keysAndValuesDo: [ :editor :intervals | + | newText index | + newText := '' asRopedText. + index := 1. + intervals + with: (otherTextAttributes at: editor) + do: [ :each :attr | + each first = 1 + ifTrue: [ newText := newText , attr text ] + ifFalse: [ newText := newText , (editor text copyFrom: index to: each first - 1) + , attr text ]. + index := each last + 1 ]. + index > editor text size + ifFalse: [ newText := newText , (editor text copyFrom: index to: editor text size) ]. + editor text: newText ] ] { #category : #private } diff --git a/src/GToolkit-Coder-AddOns/GtRenameAction.class.st b/src/GToolkit-Coder-AddOns/GtRenameAction.class.st index 59f61dcee..b2824dd0b 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameAction.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameAction.class.st @@ -15,7 +15,7 @@ Class { 'validationBlock', 'filter' ], - #category : 'GToolkit-Coder-AddOns-Inline rename' + #category : #'GToolkit-Coder-AddOns-Inline rename' } { #category : #'instance creation' } @@ -62,7 +62,8 @@ GtRenameAction >> addRenameAttributes [ { #category : #'private - actions' } GtRenameAction >> allowSave [ - textElement textualCoderViewModel allowSaveDueTo: self + (textElement respondsTo: #textualCoderViewModel) + ifTrue: [ textElement textualCoderViewModel allowSaveDueTo: self ] ] { #category : #private } @@ -183,7 +184,8 @@ GtRenameAction >> originalName [ { #category : #'private - actions' } GtRenameAction >> preventSave [ - textElement textualCoderViewModel preventSaveDueTo: self + (textElement respondsTo: #textualCoderViewModel) + ifTrue: [ textElement textualCoderViewModel preventSaveDueTo: self ] ] { #category : #private } @@ -265,9 +267,9 @@ GtRenameAction >> textElement: aTextEditorElement [ { #category : #private } GtRenameAction >> undoChanges [ - self textElement - text: originalText; - onTextModified. + textElement text: originalText. + (textElement respondsTo: #onTextModified) + ifTrue: [ textElement onTextModified ]. self textEditor moveCursorTo: originalCursorPosition ] @@ -331,18 +333,17 @@ GtRenameAction >> updateText: text at: intervals attributes: attributeCollection index := 1. intervals with: attributeCollection - do: [ :each :attr | + do: [ :each :attr | each first = 1 ifTrue: [ newText := newText , attr text ] - ifFalse: [ newText := newText , (text copyFrom: index to: each first - 1) - , attr text ]. + ifFalse: [ newText := newText , (text copyFrom: index to: each first - 1) , attr text ]. index := each last + 1 ]. index > text size ifFalse: [ newText := newText , (text copyFrom: index to: text size) ]. - textElement - text: newText; - onTextModified + textElement text: newText. + (textElement respondsTo: #onTextModified) + ifTrue: [ textElement onTextModified ] ] { #category : #'private-validation' } From 78d009957de334bd9e5aab653b61baf57ba4e52e Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 19 Aug 2022 10:51:13 -0500 Subject: [PATCH 0236/1268] Update method list in navigator on changes [feenkcom/gtoolkit#2745] --- .../GtCoderNavigationElement.class.st | 15 ++++- ...igationPackagesTagsClassesElement.class.st | 58 +++++++------------ ...GtCoderNavigationClassAnnoucement.class.st | 40 ------------- ...tCoderNavigationClassAnnouncement.class.st | 40 +++++++++++++ .../GtCoderNavigationClassModified.class.st | 4 +- .../GtCoderNavigationClassRenamed.class.st | 4 +- ...CoderNavigationMethodModification.class.st | 20 +++++++ ...CoderNavigationPackageAnnoucement.class.st | 23 -------- ...oderNavigationPackageAnnouncement.class.st | 23 ++++++++ ...tCoderNavigationPackageRegistered.class.st | 4 +- .../GtCoderNavigationPackageRenamed.class.st | 4 +- .../GtCoderNavigationPackageTagAdded.class.st | 4 +- ...erNavigationPackageTagAnnoucement.class.st | 29 ---------- ...rNavigationPackageTagAnnouncement.class.st | 29 ++++++++++ ...tCoderNavigationPackageTagRemoved.class.st | 4 +- ...oderNavigationPackageUnregistered.class.st | 4 +- 16 files changed, 160 insertions(+), 145 deletions(-) delete mode 100644 src/GToolkit-Coder/GtCoderNavigationClassAnnoucement.class.st create mode 100644 src/GToolkit-Coder/GtCoderNavigationClassAnnouncement.class.st create mode 100644 src/GToolkit-Coder/GtCoderNavigationMethodModification.class.st delete mode 100644 src/GToolkit-Coder/GtCoderNavigationPackageAnnoucement.class.st create mode 100644 src/GToolkit-Coder/GtCoderNavigationPackageAnnouncement.class.st delete mode 100644 src/GToolkit-Coder/GtCoderNavigationPackageTagAnnoucement.class.st create mode 100644 src/GToolkit-Coder/GtCoderNavigationPackageTagAnnouncement.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st index a2cdffd91..119f44730 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st @@ -191,10 +191,19 @@ GtCoderNavigationElement >> subscribeToContent [ { #category : #subscriptions } GtCoderNavigationElement >> subscribeToNavigationModel [ + | subscriptions | self hasNavigationModel ifFalse: [ ^ self ]. - navigationModel weak when: GtCoderNavigationClassSelected send: #onClassSelected: to: self. - navigationModel weak when: GtCoderNavigationClassRenamed send: #onClassRenamed: to: self. - navigationModel weak when: GtCoderNavigationClassModified send: #onClassModified: to: self. + + subscriptions := {GtCoderNavigationClassSelected -> #onClassSelected:. + GtCoderNavigationClassRenamed -> #onClassRenamed:. + GtCoderNavigationClassModified -> #onClassModified:}. + + subscriptions + do: [ :sub | + navigationModel weak + when: sub key + send: sub value + to: self ] ] { #category : #subscriptions } diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 701ee517a..bbe1d6c94 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -133,6 +133,11 @@ GtCoderNavigationPackagesTagsClassesElement >> initializeLayout [ c vertical matchParent ]. ] +{ #category : #'event handling' } +GtCoderNavigationPackagesTagsClassesElement >> onMethodChanged: anAnnouncement [ + self updateProtocolList +] + { #category : #subscriptions } GtCoderNavigationPackagesTagsClassesElement >> onMethodListSelectionChanged [ | anIndex aSelectedItem theIndices | @@ -429,44 +434,25 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToMethodList [ { #category : #'api - package updates' } GtCoderNavigationPackagesTagsClassesElement >> subscribeToNavigationModel [ + | subscriptions | self hasNavigationModel ifFalse: [ ^ self ]. super subscribeToNavigationModel. - navigationModel weak - when: GtCoderNavigationPackagesSelected - send: #onPackagesSelected: - to: self. - navigationModel weak - when: GtCoderNavigationPackageSelected - send: #onPackageSelected: - to: self. - navigationModel weak - when: GtCoderNavigationPackageTagSelected - send: #onPackageTagSelected: - to: self. - navigationModel weak - when: GtCoderNavigationPackageRegistered - send: #onPackageRegistered: - to: self. - navigationModel weak - when: GtCoderNavigationPackageUnregistered - send: #onPackageUnregistered: - to: self. - navigationModel weak - when: GtCoderNavigationPackageRenamed - send: #onPackageRenamed: - to: self. - navigationModel weak - when: GtCoderNavigationPackageTagAdded - send: #onPackageTagAdded: - to: self. - navigationModel weak - when: GtCoderNavigationPackageTagRemoved - send: #onPackageTagRemoved: - to: self. - navigationModel weak - when: GtCodersFiltersChanged - send: #onMethodsCoderFiltersChanged: - to: self + subscriptions := {GtCoderNavigationPackagesSelected -> #onPackagesSelected:. + GtCoderNavigationPackageSelected -> #onPackageSelected:. + GtCoderNavigationPackageTagSelected -> #onPackageTagSelected:. + GtCoderNavigationPackageRegistered -> #onPackageRegistered:. + GtCoderNavigationPackageUnregistered -> #onPackageUnregistered:. + GtCoderNavigationPackageRenamed -> #onPackageRenamed:. + GtCoderNavigationPackageTagAdded -> #onPackageTagAdded:. + GtCoderNavigationPackageTagRemoved -> #onPackageTagRemoved:. + GtCodersFiltersChanged -> #onMethodsCoderFiltersChanged:. + GtCoderNavigationMethodModification -> #onMethodChanged:}. + subscriptions + do: [ :sub | + navigationModel weak + when: sub key + send: sub value + to: self ] ] { #category : #subscriptions } diff --git a/src/GToolkit-Coder/GtCoderNavigationClassAnnoucement.class.st b/src/GToolkit-Coder/GtCoderNavigationClassAnnoucement.class.st deleted file mode 100644 index 2e59f5fc4..000000000 --- a/src/GToolkit-Coder/GtCoderNavigationClassAnnoucement.class.st +++ /dev/null @@ -1,40 +0,0 @@ -Class { - #name : #GtCoderNavigationClassAnnoucement, - #superclass : #GtCoderNavigationSystemChangesAnnouncement, - #instVars : [ - 'package', - 'tag', - 'theClass' - ], - #category : 'GToolkit-Coder-Navigation - Events' -} - -{ #category : #accessing } -GtCoderNavigationClassAnnoucement >> package [ - ^ package -] - -{ #category : #accessing } -GtCoderNavigationClassAnnoucement >> package: anObject [ - package := anObject -] - -{ #category : #accessing } -GtCoderNavigationClassAnnoucement >> tag [ - ^ tag -] - -{ #category : #accessing } -GtCoderNavigationClassAnnoucement >> tag: anObject [ - tag := anObject -] - -{ #category : #accessing } -GtCoderNavigationClassAnnoucement >> theClass [ - ^ theClass -] - -{ #category : #accessing } -GtCoderNavigationClassAnnoucement >> theClass: anObject [ - theClass := anObject -] diff --git a/src/GToolkit-Coder/GtCoderNavigationClassAnnouncement.class.st b/src/GToolkit-Coder/GtCoderNavigationClassAnnouncement.class.st new file mode 100644 index 000000000..1e9d4243c --- /dev/null +++ b/src/GToolkit-Coder/GtCoderNavigationClassAnnouncement.class.st @@ -0,0 +1,40 @@ +Class { + #name : #GtCoderNavigationClassAnnouncement, + #superclass : #GtCoderNavigationSystemChangesAnnouncement, + #instVars : [ + 'package', + 'tag', + 'theClass' + ], + #category : #'GToolkit-Coder-Navigation - Events' +} + +{ #category : #accessing } +GtCoderNavigationClassAnnouncement >> package [ + ^ package +] + +{ #category : #accessing } +GtCoderNavigationClassAnnouncement >> package: anObject [ + package := anObject +] + +{ #category : #accessing } +GtCoderNavigationClassAnnouncement >> tag [ + ^ tag +] + +{ #category : #accessing } +GtCoderNavigationClassAnnouncement >> tag: anObject [ + tag := anObject +] + +{ #category : #accessing } +GtCoderNavigationClassAnnouncement >> theClass [ + ^ theClass +] + +{ #category : #accessing } +GtCoderNavigationClassAnnouncement >> theClass: anObject [ + theClass := anObject +] diff --git a/src/GToolkit-Coder/GtCoderNavigationClassModified.class.st b/src/GToolkit-Coder/GtCoderNavigationClassModified.class.st index 77b59927f..3d303dd7a 100644 --- a/src/GToolkit-Coder/GtCoderNavigationClassModified.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationClassModified.class.st @@ -1,5 +1,5 @@ Class { #name : #GtCoderNavigationClassModified, - #superclass : #GtCoderNavigationClassAnnoucement, - #category : 'GToolkit-Coder-Navigation - Events' + #superclass : #GtCoderNavigationClassAnnouncement, + #category : #'GToolkit-Coder-Navigation - Events' } diff --git a/src/GToolkit-Coder/GtCoderNavigationClassRenamed.class.st b/src/GToolkit-Coder/GtCoderNavigationClassRenamed.class.st index 3a629723f..efbc85a6e 100644 --- a/src/GToolkit-Coder/GtCoderNavigationClassRenamed.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationClassRenamed.class.st @@ -1,11 +1,11 @@ Class { #name : #GtCoderNavigationClassRenamed, - #superclass : #GtCoderNavigationClassAnnoucement, + #superclass : #GtCoderNavigationClassAnnouncement, #instVars : [ 'oldName', 'newName' ], - #category : 'GToolkit-Coder-Navigation - Events' + #category : #'GToolkit-Coder-Navigation - Events' } { #category : #accessing } diff --git a/src/GToolkit-Coder/GtCoderNavigationMethodModification.class.st b/src/GToolkit-Coder/GtCoderNavigationMethodModification.class.st new file mode 100644 index 000000000..95c9aad03 --- /dev/null +++ b/src/GToolkit-Coder/GtCoderNavigationMethodModification.class.st @@ -0,0 +1,20 @@ +Class { + #name : #GtCoderNavigationMethodModification, + #superclass : #GtCoderNavigationSystemChangesAnnouncement, + #instVars : [ + 'method' + ], + #category : #'GToolkit-Coder-Navigation - Events' +} + +{ #category : #accessing } +GtCoderNavigationMethodModification >> methodModified [ + + ^ method +] + +{ #category : #accessing } +GtCoderNavigationMethodModification >> methodModified: aMethod [ + + method := aMethod +] diff --git a/src/GToolkit-Coder/GtCoderNavigationPackageAnnoucement.class.st b/src/GToolkit-Coder/GtCoderNavigationPackageAnnoucement.class.st deleted file mode 100644 index 3b7e7af2e..000000000 --- a/src/GToolkit-Coder/GtCoderNavigationPackageAnnoucement.class.st +++ /dev/null @@ -1,23 +0,0 @@ -Class { - #name : #GtCoderNavigationPackageAnnoucement, - #superclass : #GtCoderNavigationSystemChangesAnnouncement, - #instVars : [ - 'package' - ], - #category : 'GToolkit-Coder-Navigation - Events' -} - -{ #category : #accessing } -GtCoderNavigationPackageAnnoucement class >> package: aRPackage [ - ^ self new package: aRPackage -] - -{ #category : #accessing } -GtCoderNavigationPackageAnnoucement >> package [ - ^ package -] - -{ #category : #accessing } -GtCoderNavigationPackageAnnoucement >> package: anObject [ - package := anObject -] diff --git a/src/GToolkit-Coder/GtCoderNavigationPackageAnnouncement.class.st b/src/GToolkit-Coder/GtCoderNavigationPackageAnnouncement.class.st new file mode 100644 index 000000000..e189052fc --- /dev/null +++ b/src/GToolkit-Coder/GtCoderNavigationPackageAnnouncement.class.st @@ -0,0 +1,23 @@ +Class { + #name : #GtCoderNavigationPackageAnnouncement, + #superclass : #GtCoderNavigationSystemChangesAnnouncement, + #instVars : [ + 'package' + ], + #category : #'GToolkit-Coder-Navigation - Events' +} + +{ #category : #accessing } +GtCoderNavigationPackageAnnouncement class >> package: aRPackage [ + ^ self new package: aRPackage +] + +{ #category : #accessing } +GtCoderNavigationPackageAnnouncement >> package [ + ^ package +] + +{ #category : #accessing } +GtCoderNavigationPackageAnnouncement >> package: anObject [ + package := anObject +] diff --git a/src/GToolkit-Coder/GtCoderNavigationPackageRegistered.class.st b/src/GToolkit-Coder/GtCoderNavigationPackageRegistered.class.st index 45739fc2e..9d1c8ca00 100644 --- a/src/GToolkit-Coder/GtCoderNavigationPackageRegistered.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationPackageRegistered.class.st @@ -1,5 +1,5 @@ Class { #name : #GtCoderNavigationPackageRegistered, - #superclass : #GtCoderNavigationPackageAnnoucement, - #category : 'GToolkit-Coder-Navigation - Events' + #superclass : #GtCoderNavigationPackageAnnouncement, + #category : #'GToolkit-Coder-Navigation - Events' } diff --git a/src/GToolkit-Coder/GtCoderNavigationPackageRenamed.class.st b/src/GToolkit-Coder/GtCoderNavigationPackageRenamed.class.st index 65c2a77f6..68c6523e0 100644 --- a/src/GToolkit-Coder/GtCoderNavigationPackageRenamed.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationPackageRenamed.class.st @@ -1,11 +1,11 @@ Class { #name : #GtCoderNavigationPackageRenamed, - #superclass : #GtCoderNavigationPackageAnnoucement, + #superclass : #GtCoderNavigationPackageAnnouncement, #instVars : [ 'oldName', 'newName' ], - #category : 'GToolkit-Coder-Navigation - Events' + #category : #'GToolkit-Coder-Navigation - Events' } { #category : #accessing } diff --git a/src/GToolkit-Coder/GtCoderNavigationPackageTagAdded.class.st b/src/GToolkit-Coder/GtCoderNavigationPackageTagAdded.class.st index 4f29da578..329eaf472 100644 --- a/src/GToolkit-Coder/GtCoderNavigationPackageTagAdded.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationPackageTagAdded.class.st @@ -1,5 +1,5 @@ Class { #name : #GtCoderNavigationPackageTagAdded, - #superclass : #GtCoderNavigationPackageTagAnnoucement, - #category : 'GToolkit-Coder-Navigation - Events' + #superclass : #GtCoderNavigationPackageTagAnnouncement, + #category : #'GToolkit-Coder-Navigation - Events' } diff --git a/src/GToolkit-Coder/GtCoderNavigationPackageTagAnnoucement.class.st b/src/GToolkit-Coder/GtCoderNavigationPackageTagAnnoucement.class.st deleted file mode 100644 index ba7f0d612..000000000 --- a/src/GToolkit-Coder/GtCoderNavigationPackageTagAnnoucement.class.st +++ /dev/null @@ -1,29 +0,0 @@ -Class { - #name : #GtCoderNavigationPackageTagAnnoucement, - #superclass : #GtCoderNavigationSystemChangesAnnouncement, - #instVars : [ - 'package', - 'tag' - ], - #category : 'GToolkit-Coder-Navigation - Events' -} - -{ #category : #accessing } -GtCoderNavigationPackageTagAnnoucement >> package [ - ^ package -] - -{ #category : #accessing } -GtCoderNavigationPackageTagAnnoucement >> package: anObject [ - package := anObject -] - -{ #category : #accessing } -GtCoderNavigationPackageTagAnnoucement >> tag [ - ^ tag -] - -{ #category : #accessing } -GtCoderNavigationPackageTagAnnoucement >> tag: anObject [ - tag := anObject -] diff --git a/src/GToolkit-Coder/GtCoderNavigationPackageTagAnnouncement.class.st b/src/GToolkit-Coder/GtCoderNavigationPackageTagAnnouncement.class.st new file mode 100644 index 000000000..7c26eabf8 --- /dev/null +++ b/src/GToolkit-Coder/GtCoderNavigationPackageTagAnnouncement.class.st @@ -0,0 +1,29 @@ +Class { + #name : #GtCoderNavigationPackageTagAnnouncement, + #superclass : #GtCoderNavigationSystemChangesAnnouncement, + #instVars : [ + 'package', + 'tag' + ], + #category : #'GToolkit-Coder-Navigation - Events' +} + +{ #category : #accessing } +GtCoderNavigationPackageTagAnnouncement >> package [ + ^ package +] + +{ #category : #accessing } +GtCoderNavigationPackageTagAnnouncement >> package: anObject [ + package := anObject +] + +{ #category : #accessing } +GtCoderNavigationPackageTagAnnouncement >> tag [ + ^ tag +] + +{ #category : #accessing } +GtCoderNavigationPackageTagAnnouncement >> tag: anObject [ + tag := anObject +] diff --git a/src/GToolkit-Coder/GtCoderNavigationPackageTagRemoved.class.st b/src/GToolkit-Coder/GtCoderNavigationPackageTagRemoved.class.st index b43a771db..0a7a89189 100644 --- a/src/GToolkit-Coder/GtCoderNavigationPackageTagRemoved.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationPackageTagRemoved.class.st @@ -1,5 +1,5 @@ Class { #name : #GtCoderNavigationPackageTagRemoved, - #superclass : #GtCoderNavigationPackageTagAnnoucement, - #category : 'GToolkit-Coder-Navigation - Events' + #superclass : #GtCoderNavigationPackageTagAnnouncement, + #category : #'GToolkit-Coder-Navigation - Events' } diff --git a/src/GToolkit-Coder/GtCoderNavigationPackageUnregistered.class.st b/src/GToolkit-Coder/GtCoderNavigationPackageUnregistered.class.st index 3698d4622..36f765c83 100644 --- a/src/GToolkit-Coder/GtCoderNavigationPackageUnregistered.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationPackageUnregistered.class.st @@ -1,5 +1,5 @@ Class { #name : #GtCoderNavigationPackageUnregistered, - #superclass : #GtCoderNavigationPackageAnnoucement, - #category : 'GToolkit-Coder-Navigation - Events' + #superclass : #GtCoderNavigationPackageAnnouncement, + #category : #'GToolkit-Coder-Navigation - Events' } From 60ab9fabeab5c54a69d9f51f4b3f0b12dc26422d Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Sat, 20 Aug 2022 14:53:09 -0500 Subject: [PATCH 0237/1268] Fix methodList visibility [feenkcom/gtoolkit#2745] --- ...CoderNavigationPackagesTagsClassesElement.class.st | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index bbe1d6c94..908af1586 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -133,6 +133,16 @@ GtCoderNavigationPackagesTagsClassesElement >> initializeLayout [ c vertical matchParent ]. ] +{ #category : #'as yet unclassified' } +GtCoderNavigationPackagesTagsClassesElement >> methodList [ + ^ methodList +] + +{ #category : #'as yet unclassified' } +GtCoderNavigationPackagesTagsClassesElement >> methodProtocolsList [ + ^methodProtocolsList +] + { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onMethodChanged: anAnnouncement [ self updateProtocolList @@ -513,6 +523,7 @@ GtCoderNavigationPackagesTagsClassesElement >> updateProtocolList [ protocolLabel visibility: BlVisibility visible ] ifFalse: [ methodProtocolsList initializeWithProtocols: Array empty. methodList initializeWithMethods: #(). + methodList visibility: BlVisibility hidden. protocolLabel visibility: BlVisibility hidden. methodProtocolsList visibility: BlVisibility hidden. methodsLabel visibility: BlVisibility hidden ] From d65fa81956954303fb80146adb920f7498f6d791 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Sat, 20 Aug 2022 21:07:20 -0400 Subject: [PATCH 0238/1268] use a weak subscription on examples [feenkcom/gtoolkit#2743] --- src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st index 751e01911..b66c36d2b 100644 --- a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st @@ -242,7 +242,7 @@ GtCoderExampleStateElement >> styleLook [ { #category : #'private - subscriptions' } GtCoderExampleStateElement >> subscribeToExample [ - self example announcer + self example announcer weak when: GtExampleExecuted send: #onExampleExecuted: to: self. From 05fd2ad96f3996c6b6f297795b40b746ffeacfb5 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Sun, 21 Aug 2022 07:12:38 -0500 Subject: [PATCH 0239/1268] Fix for failing example [feenkcom/gtoolkit#2745] --- .../GtCoderNavigationPackagesTagsClassesElement.class.st | 1 + 1 file changed, 1 insertion(+) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 908af1586..27860eeee 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -519,6 +519,7 @@ GtCoderNavigationPackagesTagsClassesElement >> updateProtocolList [ methodList initializeWithMethods: navigationModel selectedClass methods , navigationModel selectedClass class methods. + methodList visibility: BlVisibility visible. methodsLabel visibility: BlVisibility visible. protocolLabel visibility: BlVisibility visible ] ifFalse: [ methodProtocolsList initializeWithProtocols: Array empty. From 36d67b9f6dfe190ea1656cdc5c4cfd657339579c Mon Sep 17 00:00:00 2001 From: John Brant Date: Mon, 22 Aug 2022 14:52:15 -0500 Subject: [PATCH 0240/1268] [feenkcom/gtoolkit#2728] positioning cursor in renaming editor --- src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st b/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st index 93995fedb..cd02cc4b8 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st @@ -39,8 +39,9 @@ GtRenameEditorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElem when: BlFocusOutEvent do: [ :event | self updateFocus: event ]. - self flag: #TODO. - "renameEditor editor moveCursorTo: (cursorLocation min: renameEditor editor text size)." + renameEditor editor + moveCursorTo: ((cursorLocation ifNil: [ SmallInteger maxVal ]) + min: renameEditor editor text size). selectAll ifTrue: [ renameEditor editor selecter all select ]. From 97bf8e2c585af475c93e18376bafb48931cdcef9 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Mon, 22 Aug 2022 11:38:47 -0500 Subject: [PATCH 0241/1268] Grouped method list [feenkcom/gtoolkit#2746] Grouped list structure built Group list displaying. Needs Scrolling. Fixed size of method list Fixed protocol list selection update Remove old instance variable Cleanup group list construction --- ...igationPackagesTagsClassesElement.class.st | 128 ++++++++++++------ 1 file changed, 84 insertions(+), 44 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 27860eeee..30b947a06 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -8,9 +8,9 @@ Class { 'classAndMethodProtocolList', 'protocolLabel', 'coderFilterChangesSubscription', - 'methodList', - 'methodLabel', - 'methodsLabel' + 'methodsLabel', + 'methodGroup', + 'methodGroupList' ], #category : #'GToolkit-Coder-UI-Navigation' } @@ -39,6 +39,49 @@ GtCoderNavigationPackagesTagsClassesElement >> addPackage: aPackage tag: aPackag self selectPackageOrTag: aSelectedPackageOrTag ]. ] +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> buildMethodGroupList [ + | menu instanceGroup classGroup | + menu := BrGroupedList new + padding: (BlInsets + top: 2 + left: 10 + bottom: 12 + right: 10); + matchParent; + headerElementStencil: [ BrLabel new + beSmallSize; + aptitude: (BrGlamorousLabelAptitude new foreground: Color gray) ]; + headerDataBinder: [ :label :each | label text: each domainObject asRopedText ]. + + instanceGroup := BrGroup new + domainObject: 'instance side'; + stream: #() asAsyncStream; + itemStencil: [ | label | + label := BrLabel new + hMatchParent; + vFitContent; + beSmallSize; + aptitude: BrGlamorousLabelAptitude + + (BrStyleCommonAptitude new + hovered: [ :aStyle | aStyle background: self theme item selectedColor ]); + when: BlClickEvent + do: [ :event | + event consumed: true. + self onMethodListSelectionChanged: (label userData at: #method) ] ]; + itemDataBinder: [ :label :item | + label text: item selector asRopedText. + label userData at: #method put: item. + label ]; + shouldShowWithoutItems: false. + classGroup := instanceGroup copy domainObject: 'class side'. + methodGroup := {instanceGroup. + classGroup}. + menu stream: methodGroup asAsyncStream. + + ^ menu +] + { #category : #'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> deselectPackages [ packagesList deselectAll @@ -97,7 +140,7 @@ GtCoderNavigationPackagesTagsClassesElement >> initializeContent [ text: 'Categories'); addChild: methodProtocolsList. - methodList := GtCoderNavigationMethodListElement new + methodGroupList := self buildMethodGroupList. ] { #category : #initialization } @@ -121,7 +164,7 @@ GtCoderNavigationPackagesTagsClassesElement >> initializeElement [ text: 'Methods'. packagesList. classAndMethodProtocolList. - methodList} + methodGroupList} ] { #category : #initialization } @@ -133,11 +176,6 @@ GtCoderNavigationPackagesTagsClassesElement >> initializeLayout [ c vertical matchParent ]. ] -{ #category : #'as yet unclassified' } -GtCoderNavigationPackagesTagsClassesElement >> methodList [ - ^ methodList -] - { #category : #'as yet unclassified' } GtCoderNavigationPackagesTagsClassesElement >> methodProtocolsList [ ^methodProtocolsList @@ -148,16 +186,10 @@ GtCoderNavigationPackagesTagsClassesElement >> onMethodChanged: anAnnouncement [ self updateProtocolList ] -{ #category : #subscriptions } -GtCoderNavigationPackagesTagsClassesElement >> onMethodListSelectionChanged [ - | anIndex aSelectedItem theIndices | +{ #category : #'updating lists' } +GtCoderNavigationPackagesTagsClassesElement >> onMethodListSelectionChanged: aMethod [ supressListChanges ifTrue: [ ^ self ]. - theIndices := methodList selectedIndices. - theIndices ifEmpty: [ ^ self ]. - anIndex := theIndices first. - (anIndex between: 1 and: methodList viewModel itemCount) ifFalse: [ ^ self ]. - aSelectedItem := (methodList viewModel itemAt: anIndex) value. - self navigationModel selectMethod: aSelectedItem + self navigationModel selectMethod: aMethod ] { #category : #'event handling' } @@ -258,7 +290,7 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackagesSelected: anAnnouncer [ { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onProtocolListSelectionChanged [ - | anIndex aSelectedItem theIndices methods | + | anIndex aSelectedItem theIndices instMeths classMeths | supressListChanges ifTrue: [ ^ self ]. theIndices := methodProtocolsList selectedIndices. theIndices ifEmpty: [ ^ self ]. @@ -267,15 +299,14 @@ GtCoderNavigationPackagesTagsClassesElement >> onProtocolListSelectionChanged [ ifFalse: [ ^ self ]. aSelectedItem := (methodProtocolsList viewModel itemAt: anIndex) value. self navigationModel selectMethodProtocol: aSelectedItem source: self. - methods := (self selectedClass organization protocolNamed: aSelectedItem) - ifNotNil: [ :s | s methodSelectors collect: [ :sel | self selectedClass >> sel ] as: Array ] + instMeths := (self selectedClass organization protocolNamed: aSelectedItem) + ifNotNil: [ :s | s methodSelectors collect: [ :sel | self selectedClass >> sel ] as: Array ] + ifNil: [ #() ]. + classMeths := (self selectedClass class organization + protocolNamed: aSelectedItem) + ifNotNil: [ :s | s methodSelectors collect: [ :sel | self selectedClass class >> sel ] as: Array ] ifNil: [ #() ]. - methods := methods - , ((self selectedClass class organization protocolNamed: aSelectedItem) - ifNotNil: [ :s | s methodSelectors collect: [ :sel | self selectedClass class >> sel ] as: Array] - ifNil: [ #() ]). - methodList deselectAll. - methodList initializeWithMethods: methods + self updateMethodListWith: instMeths and: classMeths ] { #category : #'api - package updates' } @@ -431,15 +462,7 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToContent [ super subscribeToContent. self subscribeToPackageList. self subscribeToClassList. - self subscribeToProtocolList. - self subscribeToMethodList -] - -{ #category : #subscriptions } -GtCoderNavigationPackagesTagsClassesElement >> subscribeToMethodList [ - methodList - when: BrSelectionChanged - do: [ :anEvent | self onMethodListSelectionChanged ]. + self subscribeToProtocolList ] { #category : #'api - package updates' } @@ -494,6 +517,23 @@ GtCoderNavigationPackagesTagsClassesElement >> updateContent [ self hideOrShowClassList ] +{ #category : #'updating lists' } +GtCoderNavigationPackagesTagsClassesElement >> updateMethodListWith: instanceMethods and: classMethods [ + | instMethStream classMethStream | + instMethStream := (instanceMethods + asSortedCollection: [ :a :b | a selector < b selector ]) asAsyncStream. + + classMethStream := (classMethods + asSortedCollection: [ :a :b | a selector < b selector ]) asAsyncStream. + + methodGroup + with: {instMethStream. + classMethStream} + do: [ :grp :str | grp stream: str ]. + + methodGroupList stream: methodGroup asAsyncStream +] + { #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updatePackageAndClassLists [ self updatePackageLists. @@ -510,21 +550,21 @@ GtCoderNavigationPackagesTagsClassesElement >> updatePackageLists [ GtCoderNavigationPackagesTagsClassesElement >> updateProtocolList [ | methodProtocols | methodProtocolsList deselectAll. - methodList deselectAll. + navigationModel hasSelectedClass ifTrue: [ methodProtocols := navigationModel selectedClass organization protocols , navigationModel selectedClass class organization protocols. methodProtocolsList initializeWithProtocols: methodProtocols. methodProtocolsList visibility: BlVisibility visible. - methodList - initializeWithMethods: navigationModel selectedClass methods - , navigationModel selectedClass class methods. - methodList visibility: BlVisibility visible. + self + updateMethodListWith: navigationModel selectedClass methods + and: navigationModel selectedClass class methods. + methodsLabel visibility: BlVisibility visible. protocolLabel visibility: BlVisibility visible ] ifFalse: [ methodProtocolsList initializeWithProtocols: Array empty. - methodList initializeWithMethods: #(). - methodList visibility: BlVisibility hidden. + self updateMethodListWith: #() and: #(). + protocolLabel visibility: BlVisibility hidden. methodProtocolsList visibility: BlVisibility hidden. methodsLabel visibility: BlVisibility hidden ] From e7c382e093e09d5120131374d6714abccf2fbe2a Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 23 Aug 2022 11:58:31 -0500 Subject: [PATCH 0242/1268] Fix selection for new method group list [feekcom/gtoolkit#2746] --- .../GtCoderNavigationPackagesTagsClassesElement.class.st | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 30b947a06..bffaa1bdb 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -62,7 +62,7 @@ GtCoderNavigationPackagesTagsClassesElement >> buildMethodGroupList [ hMatchParent; vFitContent; beSmallSize; - aptitude: BrGlamorousLabelAptitude + aptitude: BrGlamorousLabelAptitude + BrGlamorousListItemAptitude + (BrStyleCommonAptitude new hovered: [ :aStyle | aStyle background: self theme item selectedColor ]); when: BlClickEvent @@ -306,6 +306,7 @@ GtCoderNavigationPackagesTagsClassesElement >> onProtocolListSelectionChanged [ protocolNamed: aSelectedItem) ifNotNil: [ :s | s methodSelectors collect: [ :sel | self selectedClass class >> sel ] as: Array ] ifNil: [ #() ]. + methodGroupList deselectAll. self updateMethodListWith: instMeths and: classMeths ] @@ -520,6 +521,7 @@ GtCoderNavigationPackagesTagsClassesElement >> updateContent [ { #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updateMethodListWith: instanceMethods and: classMethods [ | instMethStream classMethStream | + methodGroupList deselectAll. instMethStream := (instanceMethods asSortedCollection: [ :a :b | a selector < b selector ]) asAsyncStream. From 4e232ee7533865e3a761c7d9fc8dc00efdb9f794 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 23 Aug 2022 14:31:10 -0500 Subject: [PATCH 0243/1268] Cleanup dead code and restore method change test [feekcom/gtoolkit#2746] --- ...tCoderNavigationMethodListElement.class.st | 57 ------------------- ...igationPackagesTagsClassesElement.class.st | 5 ++ 2 files changed, 5 insertions(+), 57 deletions(-) delete mode 100644 src/GToolkit-Coder-UI/GtCoderNavigationMethodListElement.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationMethodListElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationMethodListElement.class.st deleted file mode 100644 index be15fca95..000000000 --- a/src/GToolkit-Coder-UI/GtCoderNavigationMethodListElement.class.st +++ /dev/null @@ -1,57 +0,0 @@ -Class { - #name : #GtCoderNavigationMethodListElement, - #superclass : #BrSimpleList, - #category : #'GToolkit-Coder-UI-Navigation' -} - -{ #category : #accessing } -GtCoderNavigationMethodListElement >> buildSelectorLabel: aMethod [ - ^ BrLabel new - aptitude: BrGlamorousLabelAptitude; - beSmallSize; - text: aMethod selector -] - -{ #category : #accessing } -GtCoderNavigationMethodListElement >> buildSelectorRow: aMethod index: aRowIndex list: aListElement [ - ^ BrWidgetContainer new - layout: BlLinearLayout horizontal; - aptitude: - BrHorizontalPaneAptitude new - + - (BrStyleCommonAptitude new - default: - [ :aStyle | aStyle background: self theme item deselectedColor ]; - hovered: - [ :aStyle | aStyle background: self theme item hoveredColor ]; - selected: - [ :aStyle | aStyle background: self theme item selectedColor ]; - pressed: - [ :aStyle | aStyle background: self theme item pressedColor ]; - focused: [ :aStyle | - aStyle - border: (BlBorder paint: self theme item focusedBorderColor width: 1) ]); - when: BlMouseDownEvent - do: [ :anEvent | - anEvent consumed: true. - aListElement selectOne: aRowIndex dueTo: anEvent. - aListElement requestFocus ]; - hMatchParent; - vFitContent; - padding: (BlInsets left: 3); - addChild: (self buildSelectorLabel: aMethod) -] - -{ #category : #accessing } -GtCoderNavigationMethodListElement >> initialize [ - super initialize. - self stencil: [ :eachMethod :eachIndex :aListElement | self buildSelectorRow: eachMethod index: eachIndex list: aListElement ] -] - -{ #category : #accessing } -GtCoderNavigationMethodListElement >> initializeWithMethods: aCollection [ - | names | - names := aCollection asSet - sorted: [ :a :b | a methodClass name <= b methodClass name and: [ a selector < b selector ] ]. - self items: names -] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index bffaa1bdb..5bf79e823 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -176,6 +176,11 @@ GtCoderNavigationPackagesTagsClassesElement >> initializeLayout [ c vertical matchParent ]. ] +{ #category : #'api - package selections' } +GtCoderNavigationPackagesTagsClassesElement >> methodList [ + ^methodGroup flatCollect: [:grp | grp itemsProvider currentItems] +] + { #category : #'as yet unclassified' } GtCoderNavigationPackagesTagsClassesElement >> methodProtocolsList [ ^methodProtocolsList From 07f8d29706baa1c4682a008d4c75834492f3c9ba Mon Sep 17 00:00:00 2001 From: John Brant Date: Wed, 24 Aug 2022 09:30:39 -0500 Subject: [PATCH 0244/1268] [feenkcom/gtoolkit#2750] support package names with special characters --- src/GToolkit-Coder-AddOns/GtRenameAction2.class.st | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/GToolkit-Coder-AddOns/GtRenameAction2.class.st b/src/GToolkit-Coder-AddOns/GtRenameAction2.class.st index 0c63f571f..580f6796c 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameAction2.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameAction2.class.st @@ -126,6 +126,12 @@ GtRenameAction2 >> forKeyword [ validationBlock := [ :str | self validateKeyword: str ] ] +{ #category : #'initialize-release' } +GtRenameAction2 >> forText [ + validationBlock := [ :str | true ]. + self filter: BrTextEditorNoInputFilter new +] + { #category : #'initialize-release' } GtRenameAction2 >> forVariableOrUnaryMessage [ validationBlock := [ :str | self validateVariable: str ]. From 5a2d3096874a21a50002079b199b832e9766381d Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 24 Aug 2022 10:31:42 -0500 Subject: [PATCH 0245/1268] Don't show Trait class methods in navigator --- ...tCoderNavigationPackagesTagsClassesElement.class.st | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 5bf79e823..aa7c52221 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -309,7 +309,10 @@ GtCoderNavigationPackagesTagsClassesElement >> onProtocolListSelectionChanged [ ifNil: [ #() ]. classMeths := (self selectedClass class organization protocolNamed: aSelectedItem) - ifNotNil: [ :s | s methodSelectors collect: [ :sel | self selectedClass class >> sel ] as: Array ] + ifNotNil: [ :s | + (s methodSelectors + collect: [ :sel | self selectedClass class >> sel ] + thenReject: [ :meth | meth isFromTrait ]) asArray ] ifNil: [ #() ]. methodGroupList deselectAll. self updateMethodListWith: instMeths and: classMeths @@ -560,12 +563,13 @@ GtCoderNavigationPackagesTagsClassesElement >> updateProtocolList [ navigationModel hasSelectedClass ifTrue: [ methodProtocols := navigationModel selectedClass organization protocols - , navigationModel selectedClass class organization protocols. + , navigationModel selectedClass class organization protocols haltOnce. methodProtocolsList initializeWithProtocols: methodProtocols. methodProtocolsList visibility: BlVisibility visible. self updateMethodListWith: navigationModel selectedClass methods - and: navigationModel selectedClass class methods. + and: (navigationModel selectedClass class methods + reject: [ :meth | meth isFromTrait ]). methodsLabel visibility: BlVisibility visible. protocolLabel visibility: BlVisibility visible ] From 41016e2577d1c0e56125058f1476c94142f3b6b5 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 24 Aug 2022 10:34:10 -0500 Subject: [PATCH 0246/1268] Remove escaped haltOnce --- .../GtCoderNavigationPackagesTagsClassesElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index aa7c52221..e589252cd 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -563,7 +563,7 @@ GtCoderNavigationPackagesTagsClassesElement >> updateProtocolList [ navigationModel hasSelectedClass ifTrue: [ methodProtocols := navigationModel selectedClass organization protocols - , navigationModel selectedClass class organization protocols haltOnce. + , navigationModel selectedClass class organization protocols. methodProtocolsList initializeWithProtocols: methodProtocols. methodProtocolsList visibility: BlVisibility visible. self From 83a59c6e27c57cea83c1e546ce6e6ab425c945a1 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 24 Aug 2022 11:02:50 -0500 Subject: [PATCH 0247/1268] Don't display protocols with only class-side trait methods --- ...tCoderNavigationPackagesTagsClassesElement.class.st | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index e589252cd..b65a594d3 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -562,8 +562,14 @@ GtCoderNavigationPackagesTagsClassesElement >> updateProtocolList [ methodProtocolsList deselectAll. navigationModel hasSelectedClass - ifTrue: [ methodProtocols := navigationModel selectedClass organization protocols - , navigationModel selectedClass class organization protocols. + ifTrue: [ | classProtocols | + classProtocols := navigationModel selectedClass class organization protocols + reject: [ :prot | + (self selectedClass class methods + select: [ :meth | (prot includesSelector: meth selector) and: [ meth isFromTrait not ] ]) + isEmpty ]. + methodProtocols := navigationModel selectedClass organization protocols + , classProtocols. methodProtocolsList initializeWithProtocols: methodProtocols. methodProtocolsList visibility: BlVisibility visible. self From d784d00cdf98bfbe00ce3d70fbe7cb35319d3c81 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 24 Aug 2022 13:49:21 -0500 Subject: [PATCH 0248/1268] Resizable navigation columns [feenkcom/gtoolkit#2757] --- ...igationPackagesTagsClassesElement.class.st | 66 +++++++++++-------- 1 file changed, 38 insertions(+), 28 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index b65a594d3..08eb72c67 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -43,11 +43,7 @@ GtCoderNavigationPackagesTagsClassesElement >> addPackage: aPackage tag: aPackag GtCoderNavigationPackagesTagsClassesElement >> buildMethodGroupList [ | menu instanceGroup classGroup | menu := BrGroupedList new - padding: (BlInsets - top: 2 - left: 10 - bottom: 12 - right: 10); + padding: (BlInsets left: 5 right: 10); matchParent; headerElementStencil: [ BrLabel new beSmallSize; @@ -123,9 +119,10 @@ GtCoderNavigationPackagesTagsClassesElement >> hideOrShowClassList [ ] { #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> initializeContent [ +GtCoderNavigationPackagesTagsClassesElement >> initializeContent [ super initializeContent. - packagesList := GtCoderNavigationPackagesTreeElement new. + packagesList := GtCoderNavigationPackagesTreeElement new + padding: (BlInsets right: 10). methodProtocolsList := GtCoderNavigationMethodProtocolListElement new matchParent. @@ -140,40 +137,53 @@ GtCoderNavigationPackagesTagsClassesElement >> initializeContent [ text: 'Categories'); addChild: methodProtocolsList. - methodGroupList := self buildMethodGroupList. + methodGroupList := self buildMethodGroupList ] { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> initializeElement [ + | pane1 pane2 pane3 | super initializeElement. - self - addChildren: {BrLabel new - aptitude: (BrGlamorousLabelAptitude new - fontSize: 12; - foreground: Color gray); - text: 'Packages'. - classesLabel := BrLabel new - aptitude: (BrGlamorousLabelAptitude new - fontSize: 12; - foreground: Color gray); - text: 'Classes'. - methodsLabel := BrLabel new + pane1 := BrVerticalPane new + addAptitude: BrGlamorousWithHorizontalResizerAptitude; + matchParent; + addChildren: {BrLabel new aptitude: (BrGlamorousLabelAptitude new fontSize: 12; foreground: Color gray); - text: 'Methods'. - packagesList. - classAndMethodProtocolList. - methodGroupList} + text: 'Packages'. + packagesList}. + pane2 := BrVerticalPane new + addAptitude: BrGlamorousWithHorizontalResizerAptitude; + matchParent; + addChildren: {classesLabel := BrLabel new + aptitude: (BrGlamorousLabelAptitude new + fontSize: 12; + foreground: Color gray); + text: 'Classes'. + classAndMethodProtocolList}. + pane3 := BrVerticalPane new + matchParent; + addChildren: {methodsLabel := BrLabel new + aptitude: (BrGlamorousLabelAptitude new + fontSize: 12; + foreground: Color gray); + text: 'Methods'. + methodGroupList}. + self + addChildren: {pane1. + pane2. + pane3} ] { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> initializeLayout [ super initializeLayout. - self layout: (BlGridLayout horizontal columnCount: 3; cellSpacing: 5). - self constraintsDo: [ :c | - c horizontal matchParent. - c vertical matchParent ]. + self layout: BlLinearLayout new beHorizontal. + self + constraintsDo: [ :c | + c horizontal matchParent. + c vertical matchParent ] ] { #category : #'api - package selections' } From 092b9486abacb5e98b53cea42f8e13fe5081ab9f Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Thu, 25 Aug 2022 11:04:37 +0200 Subject: [PATCH 0249/1268] references to package names should also take symbols into account feenkcom/gtoolkit#2758 --- src/GToolkit-Coder-Extensions/RPackage.extension.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-Extensions/RPackage.extension.st b/src/GToolkit-Coder-Extensions/RPackage.extension.st index 5d61de987..83b002c14 100644 --- a/src/GToolkit-Coder-Extensions/RPackage.extension.st +++ b/src/GToolkit-Coder-Extensions/RPackage.extension.st @@ -7,7 +7,7 @@ RPackage >> gtBaselinesFor: aView [ title: 'References'; tooltip: 'References to the package name'; priority: 30; - object: [ self name gtStringLiteralCaseSensitiveMatch ]; + object: [ self name gtStringLiteralCaseSensitiveMatch | self name gtReferences ]; view: #gtItemsFor: ] From ccb71b21dee63e4ae7cc4670ccc6132ecadacec9 Mon Sep 17 00:00:00 2001 From: Andrei Chis Date: Thu, 25 Aug 2022 12:26:39 +0200 Subject: [PATCH 0250/1268] Add #gtAllowedDependenciesFor: --- .../RPackage.extension.st | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/GToolkit-Coder-Extensions/RPackage.extension.st b/src/GToolkit-Coder-Extensions/RPackage.extension.st index 83b002c14..82c610523 100644 --- a/src/GToolkit-Coder-Extensions/RPackage.extension.st +++ b/src/GToolkit-Coder-Extensions/RPackage.extension.st @@ -1,5 +1,26 @@ Extension { #name : #RPackage } +{ #category : #'*GToolkit-Coder-Extensions' } +RPackage >> gtAllowedDependenciesFor: aView [ + + (self packageManifestOrNil + ifNil: [ false ] + ifNotNil: [ :aPackage | + aPackage class canPerform: #mustOnlyDependOn ]) ifFalse: [ ^ aView empty ] . + + ^ aView list + title: 'Allowed Dependencies'; + priority: 50; + items: [ + self packageManifestOrNil + ifNil: [ #() ] + ifNotNil: [ :aPackage | + (aPackage class canPerform: #mustOnlyDependOn) + ifTrue: [ aPackage mustOnlyDependOn collect: #asPackage ] + ifFalse: [ #() ] ] ]; + itemText: [ :aPackage | aPackage name ] +] + { #category : #'*GToolkit-Coder-Extensions' } RPackage >> gtBaselinesFor: aView [ From 291a628b18f65968bfe50feb642bb2b64b7bd492 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 25 Aug 2022 07:42:47 -0500 Subject: [PATCH 0251/1268] Fix class list update when adding classes inline [feenkcom/gtoolkit#1494] --- src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st | 9 ++++++++- src/GToolkit-Coder/GtCoderNavigationClassAdded.class.st | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 src/GToolkit-Coder/GtCoderNavigationClassAdded.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st index 119f44730..aa1b9edfd 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st @@ -79,6 +79,12 @@ GtCoderNavigationElement >> onAddedToSceneGraph [ self subscribeToContent. ] +{ #category : #'event handling' } +GtCoderNavigationElement >> onClassAdded: anAnnouncement [ + self + suppressListChangeEventsDuring: [ self updateClassLists ] +] + { #category : #'event handling' } GtCoderNavigationElement >> onClassListSelectionChanged [ | anIndex aSelectedItem theIndices | @@ -196,7 +202,8 @@ GtCoderNavigationElement >> subscribeToNavigationModel [ subscriptions := {GtCoderNavigationClassSelected -> #onClassSelected:. GtCoderNavigationClassRenamed -> #onClassRenamed:. - GtCoderNavigationClassModified -> #onClassModified:}. + GtCoderNavigationClassModified -> #onClassModified:. + GtCoderNavigationClassAdded-> #onClassAdded: }. subscriptions do: [ :sub | diff --git a/src/GToolkit-Coder/GtCoderNavigationClassAdded.class.st b/src/GToolkit-Coder/GtCoderNavigationClassAdded.class.st new file mode 100644 index 000000000..e7e56c2bf --- /dev/null +++ b/src/GToolkit-Coder/GtCoderNavigationClassAdded.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtCoderNavigationClassAdded, + #superclass : #GtCoderNavigationClassAnnouncement, + #category : #'GToolkit-Coder-Navigation - Events' +} From c8caacc74c2b181a48877b530d81b9594d57f08e Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 25 Aug 2022 09:28:17 -0500 Subject: [PATCH 0252/1268] Show initial package when searched from Spotter --- ...tCoderNavigationPackagesTagsClassesElement.class.st | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 08eb72c67..adc8bd3fe 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -602,10 +602,8 @@ GtCoderNavigationPackagesTagsClassesElement >> updateSelectedPackageAndTag [ self hasNavigationModel ifFalse: [ ^ self ]. navigationModel hasSelectedPackage ifTrue: [ navigationModel hasSelectedTag - ifTrue: [ - self - selectPackage: navigationModel selectedPackage - tag: navigationModel selectedTag ] ] - ifFalse: [ - self selectPackage: navigationModel selectedPackage ]. + ifTrue: [ self + selectPackage: navigationModel selectedPackage + tag: navigationModel selectedTag ] + ifFalse: [ self selectPackage: navigationModel selectedPackage ] ] ] From 23e460a9bb6b83f116d009c3515d8dc4bb1cb4fc Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 25 Aug 2022 10:53:42 -0500 Subject: [PATCH 0253/1268] Add debug keyboard shortcut [feenkcom/gtoolkit#2752] --- .../GtSourceCoderDebugShortcut.class.st | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderDebugShortcut.class.st diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDebugShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDebugShortcut.class.st new file mode 100644 index 000000000..c628e594f --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderDebugShortcut.class.st @@ -0,0 +1,29 @@ +Class { + #name : #GtSourceCoderDebugShortcut, + #superclass : #GtSourceCoderShortcut, + #category : #'GToolkit-Coder-UI-Shortcuts' +} + +{ #category : #accessing } +GtSourceCoderDebugShortcut >> description [ + ^ 'Opens a debugger on the evaluation of the whole source code or just the selection.' +] + +{ #category : #accessing } +GtSourceCoderDebugShortcut >> initialize [ + super initialize. + + combination := BlKeyCombinationBuilder new primary shift d build +] + +{ #category : #accessing } +GtSourceCoderDebugShortcut >> name [ + ^ 'Debug' +] + +{ #category : #accessing } +GtSourceCoderDebugShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ + GtCoderExecutionContextVariable + element: aBrEditorElement + do: [ aSourceCoderViewModel debug ] +] From f37579629b96e0d03d753f187a3fd3a1a829addf Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 26 Aug 2022 09:55:03 -0500 Subject: [PATCH 0254/1268] Don't automatically add main actions to context menu. --- src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 0546637a9..d9c666013 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -30,8 +30,7 @@ GtTextualCoderEditorElement >> createContextMenuContent [ "extra context menu items that depend on ast and view model state such as selection" theContextMenuAstAddons := self textualCoderViewModel computeContextMenuAstAddOns. - theItems := theAddOns contextMenuActions , theAddOns mainActions - , theContextMenuAstAddons contextMenuActions. + theItems := theAddOns contextMenuActions, theContextMenuAstAddons contextMenuActions. theItems := theItems reject: [ :e | e title isNil ]. theContextMenu @@ -61,8 +60,7 @@ GtTextualCoderEditorElement >> initialize [ vFitContent. self editor - beEditableCode"; - disableStyleTextWhenModified". + beEditableCode. self id: GtSourceCoderEditorId. From 188f98dd9bef7f62ad90433e810c0d8e2c4240eb Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 26 Aug 2022 12:49:23 -0400 Subject: [PATCH 0255/1268] `GtStreamingCodersModel>>#codersStream` is now a cached stream [feenkcom/gtoolkit#2743] --- .../GtStreamingCodersModel.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersModel.class.st b/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersModel.class.st index cb9f5b87d..8e95781f3 100644 --- a/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersModel.class.st +++ b/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersModel.class.st @@ -61,10 +61,10 @@ GtStreamingCodersModel >> itemsStream: anAsyncStream dueTo: aReasonObject [ monitor critical: [ itemsStream := anAsyncStream cached. - codersStream := itemsStream + codersStream := (itemsStream map: [ :eachItem | self newCoderFor: eachItem ] key: [ :eachItem | self newCoderCacheKeyFor: eachItem ] - cache: coders ]. + cache: coders) cached ]. self notifyStreamChangedDueTo: aReasonObject ] From 8ecc5f064d2a31d8a5c5c81177c47d654a953bc1 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 26 Aug 2022 13:01:56 -0400 Subject: [PATCH 0256/1268] revert: `GtStreamingCodersModel>>#codersStream` is now a cached stream [feenkcom/gtoolkit#2743] - the `coders` stream my get changed --- .../GtStreamingCodersModel.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersModel.class.st b/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersModel.class.st index 8e95781f3..cb9f5b87d 100644 --- a/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersModel.class.st +++ b/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersModel.class.st @@ -61,10 +61,10 @@ GtStreamingCodersModel >> itemsStream: anAsyncStream dueTo: aReasonObject [ monitor critical: [ itemsStream := anAsyncStream cached. - codersStream := (itemsStream + codersStream := itemsStream map: [ :eachItem | self newCoderFor: eachItem ] key: [ :eachItem | self newCoderCacheKeyFor: eachItem ] - cache: coders) cached ]. + cache: coders ]. self notifyStreamChangedDueTo: aReasonObject ] From 96cdf5b062d7b92eacc8b20c4069bf9d4218a9c6 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 26 Aug 2022 13:39:23 -0500 Subject: [PATCH 0257/1268] Fix crash when clicking on git button in embedded Class coder --- src/GToolkit-Coder/GtCoderNullNavigationModel.class.st | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder/GtCoderNullNavigationModel.class.st b/src/GToolkit-Coder/GtCoderNullNavigationModel.class.st index c0afdd7b7..3564899d0 100644 --- a/src/GToolkit-Coder/GtCoderNullNavigationModel.class.st +++ b/src/GToolkit-Coder/GtCoderNullNavigationModel.class.st @@ -3,7 +3,7 @@ Class { #superclass : #GtCoderNavigationModel, #traits : 'TGtUniqueInstance', #classTraits : 'TGtUniqueInstance classTrait', - #category : 'GToolkit-Coder-Navigation - Model' + #category : #'GToolkit-Coder-Navigation - Model' } { #category : #'api - accessing' } @@ -66,6 +66,11 @@ GtCoderNullNavigationModel >> selectedClassDo: aBlock [ "do nothing" ] +{ #category : #'as yet unclassified' } +GtCoderNullNavigationModel >> selectedPackage [ + "Do Nothing" +] + { #category : #'api - selection' } GtCoderNullNavigationModel >> selectedPackageDo: aBlock [ "do nothing" From 3278f8aaa02733fff399eab81ff90f0271b9358d Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Mon, 29 Aug 2022 09:41:28 -0500 Subject: [PATCH 0258/1268] Rearrange coder menus --- src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st index a35bf7386..d1827661d 100644 --- a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st +++ b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st @@ -15,7 +15,7 @@ GtTextualCoder >> addContextMenuItemFrom: shortcut withId: menuId to: coderAddOn { #category : #'*GToolkit-Coder-AddOns' } GtTextualCoder >> addCopyCutPasteContextMenuAddOnsAst: anAst to: coderAddOns [ - + self addContextMenuItemFrom: BrEditorShortcut cut withId: GtTextualCoderCutContextMenuItemId From 92cdd87522df5ef0208092037424943b88744bc6 Mon Sep 17 00:00:00 2001 From: John Brant Date: Mon, 29 Aug 2022 10:36:09 -0500 Subject: [PATCH 0259/1268] [feenkcom/gtoolkit#2762] fix off by one error when viewing class comments --- src/GToolkit-Coder-UI/GtDiffElement.class.st | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtDiffElement.class.st b/src/GToolkit-Coder-UI/GtDiffElement.class.st index a69309860..6070c1a3b 100644 --- a/src/GToolkit-Coder-UI/GtDiffElement.class.st +++ b/src/GToolkit-Coder-UI/GtDiffElement.class.st @@ -170,9 +170,9 @@ GtDiffElement >> leftEditorLook: aLook [ { #category : #private } GtDiffElement >> leftRange [ | first | - first := (leftElement instVarNamed: 'layoutPositionsRange') - ifNil: [ 1 ] - ifNotNil: [ :interval | interval first ]. + first := ((leftElement instVarNamed: 'layoutPositionsRange') + ifNil: [ 1 ] + ifNotNil: [ :interval | interval first ]) max: 1. ^ first to: first + leftElement children size - 1 ] @@ -318,9 +318,9 @@ GtDiffElement >> rightEditorLook: aLook [ { #category : #private } GtDiffElement >> rightRange [ | first | - first := (rightElement instVarNamed: 'layoutPositionsRange') - ifNil: [ 1 ] - ifNotNil: [ :interval | interval first ]. + first := ((rightElement instVarNamed: 'layoutPositionsRange') + ifNil: [ 1 ] + ifNotNil: [ :interval | interval first ]) max: 1. ^ first to: first + rightElement children size - 1 ] From 79ce08bd5753a77a6ce4a963bc92352435a31337 Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Tue, 30 Aug 2022 19:14:54 +0200 Subject: [PATCH 0260/1268] extract addon pragma names in a separate method feenkcom/gtoolkit#2765 --- src/GToolkit-Coder/GtCoderModel.class.st | 37 ++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/GToolkit-Coder/GtCoderModel.class.st b/src/GToolkit-Coder/GtCoderModel.class.st index d950a99a9..4b83fb561 100644 --- a/src/GToolkit-Coder/GtCoderModel.class.st +++ b/src/GToolkit-Coder/GtCoderModel.class.st @@ -35,6 +35,43 @@ Class { #category : #'GToolkit-Coder-Coders' } +{ #category : #addons } +GtCoderModel class >> astExtensionsPragma [ + ^ #gtAstCoderAddOns: +] + +{ #category : #addons } +GtCoderModel class >> contextMenuAddOnsPragma [ + ^ #gtCoderContextMenuAddOns: +] + +{ #category : #'private - addons' } +GtCoderModel class >> gtAstCoderAddOnsFor: aView context: aPhlowContext [ + + ^ aView forward + title: 'Coder Addons'; + tooltip: 'The methods that extend the Coder with AddOns'; + priority: 40; + object: [ (GtSearchMethodsInClassFilter new + forClass: self; + includeSuperclass: true) & self astExtensionsPragma gtPragmas ]; + view: #gtItemsFor: +] + +{ #category : #'private - addons' } +GtCoderModel class >> gtContextMenuAddOnsFor: aView [ + + + ^ aView forward + title: 'Menu AddOns'; + tooltip: 'The methods that extend the Coder with context menu items'; + priority: 45; + object: [ (GtSearchMethodsInClassFilter new + forClass: self; + includeSuperclass: true) & self contextMenuAddOnsPragma gtPragmas ]; + view: #gtItemsFor: +] + { #category : #'class initialization' } GtCoderModel class >> initialize [ UniqueIdGenerator := BlUniqueIdGenerator new From 7fda401af18269ede2d9e645c1bbf92ef9c13fe4 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 1 Sep 2022 13:52:51 -0500 Subject: [PATCH 0261/1268] Update navigation selector list with collections rather than streams [feenkcom/gtoolkit#2773] --- ...erNavigationPackagesTagsClassesElement.class.st | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index adc8bd3fe..f0461c735 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -73,7 +73,7 @@ GtCoderNavigationPackagesTagsClassesElement >> buildMethodGroupList [ classGroup := instanceGroup copy domainObject: 'class side'. methodGroup := {instanceGroup. classGroup}. - menu stream: methodGroup asAsyncStream. + menu groups: methodGroup. ^ menu ] @@ -540,18 +540,18 @@ GtCoderNavigationPackagesTagsClassesElement >> updateContent [ GtCoderNavigationPackagesTagsClassesElement >> updateMethodListWith: instanceMethods and: classMethods [ | instMethStream classMethStream | methodGroupList deselectAll. - instMethStream := (instanceMethods - asSortedCollection: [ :a :b | a selector < b selector ]) asAsyncStream. + instMethStream := instanceMethods + asSortedCollection: [ :a :b | a selector < b selector ]. - classMethStream := (classMethods - asSortedCollection: [ :a :b | a selector < b selector ]) asAsyncStream. + classMethStream := classMethods + asSortedCollection: [ :a :b | a selector < b selector ]. methodGroup with: {instMethStream. classMethStream} - do: [ :grp :str | grp stream: str ]. + do: [ :grp :str | grp items: str ]. - methodGroupList stream: methodGroup asAsyncStream + methodGroupList groups: methodGroup ] { #category : #'updating lists' } From 7a4367efcd97cc6ede52056c2919cc36d3fb00e5 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 6 Sep 2022 10:36:55 -0500 Subject: [PATCH 0262/1268] Add shortcut key information to debugger menu [feenkcom/gtoolkit#2783] --- src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st index 7fa9d5394..311f208a3 100644 --- a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st +++ b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st @@ -48,8 +48,9 @@ GtCoderContextMenuContent >> initialize [ cull: anEvent. self fireEvent: BrDropdownHideWish new. self fireEvent: BrContextMenuHideWish new ]. - eachGtCoderContextMenuAction shortcutKey isEmpty - ifFalse: [ element + ((eachGtCoderContextMenuAction shortcutKey respondsTo: #isEmpty) + and: [ eachGtCoderContextMenuAction shortcutKey isEmpty not ]) + ifTrue: [ element addChild: (BrHorizontalPane new fitContent; geometry: (BlRoundedRectangleGeometry cornerRadius: 4); From 02a945cac189441c157794d51d9371c66371b193 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Thu, 8 Sep 2022 12:38:12 +0200 Subject: [PATCH 0263/1268] Multiple changes: - Fix default elements to not be required to have a value - add `GtFiltersElement>>#addAllDefaults` to add all default filters --- .../GtFilterDescriptor.class.st | 2 +- .../GtFilterTagElement.class.st | 4 +-- .../GtFiltersElement.class.st | 25 +++++++++++++++++++ 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st b/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st index f99011db6..6adacad6a 100644 --- a/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st +++ b/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st @@ -152,7 +152,7 @@ GtFilterDescriptor >> printOn: aStream [ { #category : #testing } GtFilterDescriptor >> showAsDefaultWhenEmpty [ - ^ isDefault and: [ emptyDefaultValue notNil ] + ^ isDefault and: [ valueIsRequired not or: [ emptyDefaultValue notNil ] ] ] { #category : #testing } diff --git a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st index 360fcb05a..945ab3703 100644 --- a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st @@ -193,8 +193,8 @@ GtFilterTagElement >> initialize [ GtFilterTagElement >> isDefaultAllFilter [ ^ self descriptor showAsDefaultWhenEmpty and: [ valueString isEmpty - and: - [ (self childNamed: #editableLabel) text asString = self emptyDefaultValueLabel ] ] + and: [ self childNamed: #editableLabel + ifFound: [ :aLabel | aLabel text asString = self emptyDefaultValueLabel ] ] ] ] { #category : #testing } diff --git a/src/GToolkit-Coder-UI/GtFiltersElement.class.st b/src/GToolkit-Coder-UI/GtFiltersElement.class.st index 8609b93cc..8259d7aa3 100644 --- a/src/GToolkit-Coder-UI/GtFiltersElement.class.st +++ b/src/GToolkit-Coder-UI/GtFiltersElement.class.st @@ -19,6 +19,31 @@ Class { #category : #'GToolkit-Coder-UI-Filters' } +{ #category : #accessing } +GtFiltersElement >> addAllDefaults [ + | filterElement defaultDescriptors | + self clearFilters. + + defaultDescriptors := self descriptors + select: [ :each | + BlFrameTelemetry + time: [ 'Should show ' , each name , ' as default when empty?' ] + during: [ each showAsDefaultWhenEmpty ] ]. + + defaultDescriptors + do: [ :defaultDescriptor | + filterElement := GtFilterTagElement new. + filterElement filter: self. + + BlFrameTelemetry + time: [ 'Assign default descriptor ' , defaultDescriptor name , ' to the filter tag' ] + during: [ filterElement descriptor: defaultDescriptor ]. + + filterElement makeDefaultFilter. + + self addChild: filterElement at: self childrenCount ] +] + { #category : #accessing } GtFiltersElement >> addEmptyDefault [ | filterElement defaultDescriptor | From afd8e29f00457020a20405ff3e30985822c4ea15 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Thu, 8 Sep 2022 14:20:29 +0200 Subject: [PATCH 0264/1268] Add `asIntersectionFilter` to the filters element --- src/GToolkit-Coder-UI/GtFiltersElement.class.st | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtFiltersElement.class.st b/src/GToolkit-Coder-UI/GtFiltersElement.class.st index 8259d7aa3..d2fd6b3b1 100644 --- a/src/GToolkit-Coder-UI/GtFiltersElement.class.st +++ b/src/GToolkit-Coder-UI/GtFiltersElement.class.st @@ -87,6 +87,17 @@ GtFiltersElement >> applyFilters [ self addEmptyDefault ] +{ #category : #accessing } +GtFiltersElement >> asIntersectionFilter [ + | compositeFilter | + self + filtersDo: [ :descriptor :value | + compositeFilter + ifNil: [ compositeFilter := descriptor newFilterWithValue: value ] + ifNotNil: [ compositeFilter := compositeFilter & (descriptor newFilterWithValue: value) ] ]. + ^ compositeFilter +] + { #category : #accessing } GtFiltersElement >> buildFilters: aBlock [ self clearFilters. From 21e9ac10d9ca9c0921f995c73c6bd839104e5686 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Thu, 8 Sep 2022 19:18:36 +0200 Subject: [PATCH 0265/1268] Fix edge case in filter tag element `#isDefaultAllFilter` --- src/GToolkit-Coder-UI/GtFilterTagElement.class.st | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st index 945ab3703..d1b320d8b 100644 --- a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st @@ -193,8 +193,10 @@ GtFilterTagElement >> initialize [ GtFilterTagElement >> isDefaultAllFilter [ ^ self descriptor showAsDefaultWhenEmpty and: [ valueString isEmpty - and: [ self childNamed: #editableLabel - ifFound: [ :aLabel | aLabel text asString = self emptyDefaultValueLabel ] ] ] + and: [ self + childNamed: #editableLabel + ifFound: [ :aLabel | aLabel text asString = self emptyDefaultValueLabel ] + ifNone: [ true ] ] ] ] { #category : #testing } From 651bb7605191ee882fd9c8addb1b440fca2d37f7 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Fri, 9 Sep 2022 12:34:02 +0200 Subject: [PATCH 0266/1268] Make filter element work with multiple default filters --- .../GtFiltersElement.class.st | 47 +++++-------------- 1 file changed, 12 insertions(+), 35 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFiltersElement.class.st b/src/GToolkit-Coder-UI/GtFiltersElement.class.st index d2fd6b3b1..c143bdab0 100644 --- a/src/GToolkit-Coder-UI/GtFiltersElement.class.st +++ b/src/GToolkit-Coder-UI/GtFiltersElement.class.st @@ -22,7 +22,6 @@ Class { { #category : #accessing } GtFiltersElement >> addAllDefaults [ | filterElement defaultDescriptors | - self clearFilters. defaultDescriptors := self descriptors select: [ :each | @@ -44,32 +43,6 @@ GtFiltersElement >> addAllDefaults [ self addChild: filterElement at: self childrenCount ] ] -{ #category : #accessing } -GtFiltersElement >> addEmptyDefault [ - | filterElement defaultDescriptor | - - self childrenCount = 1 - ifFalse: [ ^ self ]. - - defaultDescriptor := self descriptors - detect: [ :each | - BlFrameTelemetry - time: [ 'Should show ', each name, ' as default when empty?' ] - during: [ each showAsDefaultWhenEmpty ] ] - ifNone: [ ^ self ]. - - filterElement := GtFilterTagElement new. - filterElement filter: self. - - BlFrameTelemetry - time: [ 'Assign default descriptor ', defaultDescriptor name, ' to the filter tag' ] - during: [ filterElement descriptor: defaultDescriptor ]. - - filterElement makeDefaultFilter. - - self addChild: filterElement at: self childrenCount -] - { #category : #accessing } GtFiltersElement >> addFilterForDescriptor: aFilterDescriptor andValue: aString [ | element | @@ -83,8 +56,14 @@ GtFiltersElement >> addFilterForDescriptor: aFilterDescriptor andValue: aString { #category : #'api - actions' } GtFiltersElement >> applyFilters [ - self fireEvent: (GtFiltersChangedEvent new filterElement: self). - self addEmptyDefault + self fireEvent: (GtFiltersChangedEvent new filterElement: self) +] + +{ #category : #'private - actions' } +GtFiltersElement >> areAllDefaults [ + ^ self childrenCount > 1 + and: [ (1 to: self childrenCount - 1) + allSatisfy: [ :index | (self childAt: index) isDefaultAllFilter ] ] ] { #category : #accessing } @@ -101,8 +80,7 @@ GtFiltersElement >> asIntersectionFilter [ { #category : #accessing } GtFiltersElement >> buildFilters: aBlock [ self clearFilters. - aBlock value. - self addEmptyDefault + aBlock value ] { #category : #accessing } @@ -114,9 +92,8 @@ GtFiltersElement >> clearFilters [ GtFiltersElement >> createNewTag [ | tag | self descriptors isEmptyOrNil ifTrue: [ ^ self ]. - (self childrenCount > 1 - and: [ (self childAt: self childrenCount - 1) isDefaultAllFilter ]) - ifTrue: [ self removeChildAt: self childrenCount - 1 ]. + self areAllDefaults + ifTrue: [ self clearFilters ]. tag := GtFilterTagElement new. tag filter: self. tag descriptor: self descriptors first. @@ -135,7 +112,7 @@ GtFiltersElement >> descriptors: aCollection [ BlFrameTelemetry time: [ 'Add default filter tag' ] - during: [ self addEmptyDefault ] + during: [ self addAllDefaults ] ] { #category : #accessing } From a0cc466e83b8245f9d96efcc719c0f5f0e2ee5d0 Mon Sep 17 00:00:00 2001 From: John Brant Date: Mon, 12 Sep 2022 06:31:28 -0500 Subject: [PATCH 0267/1268] [feenkcom/gtoolkit#2794] fix memory leak in fix it attributes --- .../GtFixItAttribute.class.st | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st index b4cb949cb..8ac1eb2f1 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st @@ -6,8 +6,7 @@ Class { 'descriptionBlock', 'hoverMarker', 'hoverAttribute', - 'label', - 'dropDownAptitude' + 'label' ], #category : #'GToolkit-Coder-AddOns-FixIt' } @@ -35,7 +34,7 @@ GtFixItAttribute >> description: aBlockReturningBlText [ { #category : #accessing } GtFixItAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ - | button | + | button dropDownAptitude | button := GtFixItButton new. button beTinySize. button label: (label ifNil: [ 'Fix it' ]). @@ -56,6 +55,8 @@ GtFixItAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ button aptitude: BrGlamorousButtonWithIconAptitude - BrGlamorousButtonExteriorAptitude + dropDownAptitude. + button userData at: #fixItAttribute put: self. + button userData at: #dropDownAptitude put: dropDownAptitude. button icon: BrGlamorousVectorIcons repair. self addHoveringStylingFor: anEditorElement to: button. ^ button @@ -130,13 +131,3 @@ GtFixItAttribute >> label [ GtFixItAttribute >> label: aString [ label := aString ] - -{ #category : #opening } -GtFixItAttribute >> togglePopup [ - | visible | - dropDownAptitude ifNil: [ ^ false ]. - dropDownAptitude widgetDo: [ :aWidget | visible := aWidget isVisible ]. - visible ifNil: [ ^ false ]. - visible ifTrue: [ dropDownAptitude show ] ifFalse: [ dropDownAptitude hide ]. - ^ true -] From 157a6fcbe1409a7edb7b80f57eed6138505a13eb Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 20 Sep 2022 11:22:16 -0500 Subject: [PATCH 0268/1268] [feenkcom/gtoolkit#2809] adding scope to rewrites --- src/GToolkit-Coder/GtSourceCoder.class.st | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/GToolkit-Coder/GtSourceCoder.class.st b/src/GToolkit-Coder/GtSourceCoder.class.st index 90fa6667f..dfbce754c 100644 --- a/src/GToolkit-Coder/GtSourceCoder.class.st +++ b/src/GToolkit-Coder/GtSourceCoder.class.st @@ -239,6 +239,11 @@ GtSourceCoder >> hasImplicitVariableReferenceTo: aString [ ^ false ] +{ #category : #accessing } +GtSourceCoder >> implicitVariableNames [ + ^ #() +] + { #category : #'api - ast' } GtSourceCoder >> implicitVariableReferencesTo: aString do: aBlock [ "Evaluate aBlock for every ast node that is a variable reference to an implicitly defined variable named aString." From 03c16657e0fb453ad7bfc2f50baf51efe74e9dfd Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Tue, 20 Sep 2022 21:40:06 +0200 Subject: [PATCH 0269/1268] Ensure only packages are completed by the package completer [feenkcom/gtoolkit#2806] --- .../GtPackagesCompletionStrategy.class.st | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st b/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st index 5edd0e4d0..bb0b86d6d 100644 --- a/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st @@ -39,15 +39,11 @@ GtPackagesCompletionStrategy class >> findPackagesMatching: aString [ ] { #category : #querying } -GtPackagesCompletionStrategy class >> packageAndTagStreamMatching: searchString [ - ^ (self allPackages asAsyncStream - collect: +GtPackagesCompletionStrategy class >> packageStreamMatching: searchString [ + ^ self allPackages asAsyncStream + select: [ :each | - (searchString match: each name) - ifTrue: [ ({each} , (each classTags asSortedCollection: [ :a :b | a name < b name ])) asAsyncStream ] - ifFalse: - [ ((each classTags select: [ :tag | searchString match: tag categoryName ]) asSortedCollection: [ :a :b | a name < b name ]) - asAsyncStream ] ]) flatten + searchString match: each name] ] { #category : #accessing } @@ -56,7 +52,7 @@ GtPackagesCompletionStrategy >> completionActionStreamFor: aText at: positionInt string := aText asString. string isEmpty ifTrue: [ ^ #() ]. searchString := '*' , string , '*'. - ^ ((self class packageAndTagStreamMatching: searchString) + ^ ((self class packageStreamMatching: searchString) collect: [ :each | (each isKindOf: RPackage) ifTrue: [ each name ] ifFalse: [ each categoryName ] ]) withoutDuplicates collect: [ :each | GtReplaceTextCompletionAction forText: each ] ] From 7829c922e2183dde18bb32b33b5c837c3c1796a4 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Wed, 21 Sep 2022 16:36:29 +0200 Subject: [PATCH 0270/1268] [feenkcom/gtoolkit#2777] migrate spotter searches --- .../GtCoderSpotterStart.class.st | 50 ++++++++----------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st b/src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st index d3e149352..6a88002a9 100644 --- a/src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st +++ b/src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st @@ -8,41 +8,37 @@ Class { } { #category : #searching } -GtCoderSpotterStart >> gtSpotterForClassMethodsInCurrentClassFor: aStep [ +GtCoderSpotterStart >> gtSpotterForClassMethodsInCurrentClassFor: aSearch [ - self navigationModel hasSelectedClass - ifFalse: [ ^ self ]. - aStep listProcessor + self navigationModel hasSelectedClass ifFalse: [ ^ aSearch empty ]. + ^ aSearch list priority: 2; title: 'Class methods'; - allCandidates: [ self navigationModel selectedClass classSide methods ]; - filter: GtFilterSubstring; + items: [ self navigationModel selectedClass classSide methods ]; + filterBySubstring; wantsToDisplayOnEmptyQuery: true ] { #category : #searching } -GtCoderSpotterStart >> gtSpotterForClassesFor: aStep [ +GtCoderSpotterStart >> gtSpotterForClassesFor: aSearch [ - aStep listProcessor + ^ aSearch list priority: 10; - allCandidates: [ Smalltalk allClassesAndTraits ]; + items: [ Smalltalk allClassesAndTraits ]; title: 'Classes'; - filter: GtFilterSubstring; - itemIcon: #systemIcon; - keyBinding: $b meta; + filterBySubstring; wantsToDisplayOnEmptyQuery: self navigationModel hasSelectedClass not ] { #category : #searching } -GtCoderSpotterStart >> gtSpotterForInstanceMethodsInCurrentClassFor: aStep [ +GtCoderSpotterStart >> gtSpotterForInstanceMethodsInCurrentClassFor: aSearch [ - self navigationModel hasSelectedClass - ifFalse: [ ^ self ]. - aStep listProcessor + self navigationModel hasSelectedClass ifFalse: [ ^ aSearch empty ]. + ^ aSearch list priority: 1; title: 'Instance methods'; - allCandidates: [ self navigationModel selectedClass instanceSide methods ]; - filter: GtFilterSubstring; + items: [ self navigationModel selectedClass instanceSide methods ]; + filterBySubstring; wantsToDisplayOnEmptyQuery: true ] @@ -50,13 +46,13 @@ GtCoderSpotterStart >> gtSpotterForInstanceMethodsInCurrentClassFor: aStep [ GtCoderSpotterStart >> gtSpotterForMessagesFor: aStep [ - aStep listProcessor + ^ aStep list priority: 35; title: 'Messages'; filter: GtNullFilter item: [ :filter :context | GtSelector substring: context textTrimmed filter: filter ]; - actLogic: [ :each :step :spotterElement | + itemActLogic: [ :each :step :spotterElement | (each name asSymbol gtImplementors) gtSpotterActDefault: step from: spotterElement ]; @@ -64,30 +60,28 @@ GtCoderSpotterStart >> gtSpotterForMessagesFor: aStep [ ] { #category : #searching } -GtCoderSpotterStart >> gtSpotterForPackagesFor: aStep [ +GtCoderSpotterStart >> gtSpotterForPackagesFor: aSearch [ - aStep listProcessor + ^ aSearch list priority: 20; - allCandidates: [ RPackageOrganizer default packages ]; + items: [ RPackageOrganizer default packages ]; title: 'Packages'; itemName: [ :package | package name ]; - itemIcon: [ Smalltalk ui icons iconNamed: #packageIcon ]; - filter: GtFilterSubstring; + filterBySubstring; wantsToDisplayOnEmptyQuery: self navigationModel hasSelectedPackage not ] { #category : #searching } GtCoderSpotterStart >> gtSpotterImplementorsFor: aStep [ - self flag: #specialFilter. - aStep listProcessor + ^ aStep list priority: 30; title: 'Implementors'; filter: GtFilterImplementor item: [ :filter :context | SystemNavigation default allBehaviorsDo: [ :class | class localMethods do: filter ] ]; - keyBinding: $m meta; + "keyBinding: $m meta;" wantsToDisplayOnEmptyQuery: false ] From ecc3f9a0906a7e9e2c4e750d243e0db2aff0c550 Mon Sep 17 00:00:00 2001 From: John Brant Date: Wed, 21 Sep 2022 14:04:55 -0500 Subject: [PATCH 0271/1268] [feenkcom/gtoolkit#2809] adding filter extensions for rewrite scopes --- .../GtLabeledSearchFilter.class.st | 75 +++++++++++++++++++ .../GtSearchFilter.class.st | 14 ++++ 2 files changed, 89 insertions(+) create mode 100644 src/GToolkit-SearchFilters/GtLabeledSearchFilter.class.st diff --git a/src/GToolkit-SearchFilters/GtLabeledSearchFilter.class.st b/src/GToolkit-SearchFilters/GtLabeledSearchFilter.class.st new file mode 100644 index 000000000..974345183 --- /dev/null +++ b/src/GToolkit-SearchFilters/GtLabeledSearchFilter.class.st @@ -0,0 +1,75 @@ +Class { + #name : #GtLabeledSearchFilter, + #superclass : #GtSearchFilter, + #instVars : [ + 'filter', + 'label', + 'methodDefinition' + ], + #category : #'GToolkit-SearchFilters' +} + +{ #category : #accessing } +GtLabeledSearchFilter >> children [ + ^ {filter} +] + +{ #category : #accessing } +GtLabeledSearchFilter >> defaultFilterScope [ + ^ filter defaultFilterScope +] + +{ #category : #accessing } +GtLabeledSearchFilter >> filter [ + ^ filter +] + +{ #category : #accessing } +GtLabeledSearchFilter >> filter: aSearchFilter [ + filter := aSearchFilter +] + +{ #category : #accessing } +GtLabeledSearchFilter >> filterLabel [ + ^ label +] + +{ #category : #accessing } +GtLabeledSearchFilter >> filterLabel: aString [ + label := aString +] + +{ #category : #accessing } +GtLabeledSearchFilter >> filterValueString [ + ^ filter filterValueString +] + +{ #category : #accessing } +GtLabeledSearchFilter >> highlighter [ + ^ filter highlighter +] + +{ #category : #accessing } +GtLabeledSearchFilter >> matches: anObject [ + ^ filter matches: anObject +] + +{ #category : #accessing } +GtLabeledSearchFilter >> methodDefinition [ + ^ methodDefinition +] + +{ #category : #accessing } +GtLabeledSearchFilter >> methodDefinition: aCompiledMethod [ + methodDefinition := aCompiledMethod +] + +{ #category : #accessing } +GtLabeledSearchFilter >> resultType [ + ^ filter resultType +] + +{ #category : #accessing } +GtLabeledSearchFilter >> size [ + ^ filter size +] diff --git a/src/GToolkit-SearchFilters/GtSearchFilter.class.st b/src/GToolkit-SearchFilters/GtSearchFilter.class.st index f62703a3c..3e8fb55e9 100644 --- a/src/GToolkit-SearchFilters/GtSearchFilter.class.st +++ b/src/GToolkit-SearchFilters/GtSearchFilter.class.st @@ -48,6 +48,11 @@ GtSearchFilter >> do: aBlock [ (self result do: aBlock) wait ] +{ #category : #accessing } +GtSearchFilter >> filterLabel [ + ^ nil +] + { #category : #accessing } GtSearchFilter >> filterValueString [ ^ nil @@ -58,6 +63,15 @@ GtSearchFilter >> isEmpty [ ^ self notEmpty not ] +{ #category : #accessing } +GtSearchFilter >> labeled: aString [ + ^ GtLabeledSearchFilter new + filter: self; + filterLabel: aString; + methodDefinition: thisContext sender method method; + yourself +] + { #category : #testing } GtSearchFilter >> matches: anObject [ self subclassResponsibility From b8f3c0f2f7285c448b63ca776cccd03e87d9134e Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 22 Sep 2022 07:05:11 -0500 Subject: [PATCH 0272/1268] Cleaning out old BlRopedText code --- .../GtRBAddPoolVariableRefactoring.extension.st | 2 +- src/GToolkit-Coder-UI/GtRBAddTraitUsageRefactoring.extension.st | 2 +- .../GtRBChangeSuperclassRefactoring.extension.st | 2 +- .../GtRBRemovePoolVariableRefactoring.extension.st | 2 +- .../GtRBRemoveTraitUsageRefactoring.extension.st | 2 +- .../RBAddClassVariableRefactoring.extension.st | 2 +- .../RBAddInstanceVariableRefactoring.extension.st | 2 +- src/GToolkit-Coder-UI/RBRefactoring.extension.st | 2 +- .../RBRemoveClassVariableRefactoring.extension.st | 2 +- .../RBRemoveInstanceVariableRefactoring.extension.st | 2 +- src/GToolkit-Coder-UI/RBRenameClassRefactoring.extension.st | 2 +- .../RBRenameClassVariableRefactoring.extension.st | 2 +- .../RBRenameInstanceVariableRefactoring.extension.st | 2 +- src/GToolkit-Coder-UI/RBTransformation.extension.st | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtRBAddPoolVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/GtRBAddPoolVariableRefactoring.extension.st index b96c948fc..a28c86be5 100644 --- a/src/GToolkit-Coder-UI/GtRBAddPoolVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/GtRBAddPoolVariableRefactoring.extension.st @@ -2,7 +2,7 @@ Extension { #name : #GtRBAddPoolVariableRefactoring } { #category : #'*GToolkit-Coder-UI' } GtRBAddPoolVariableRefactoring >> gtDescription [ - + ^ ('Add' asRopedText glamorousRoundedBackground) append: ' pool named ' asRopedText; diff --git a/src/GToolkit-Coder-UI/GtRBAddTraitUsageRefactoring.extension.st b/src/GToolkit-Coder-UI/GtRBAddTraitUsageRefactoring.extension.st index e382afddd..980c7e2b1 100644 --- a/src/GToolkit-Coder-UI/GtRBAddTraitUsageRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/GtRBAddTraitUsageRefactoring.extension.st @@ -2,7 +2,7 @@ Extension { #name : #GtRBAddTraitUsageRefactoring } { #category : #'*GToolkit-Coder-UI' } GtRBAddTraitUsageRefactoring >> gtDescription [ - + ^ ('Add' asRopedText glamorousRoundedBackground) append: ' trait usage ' asRopedText; diff --git a/src/GToolkit-Coder-UI/GtRBChangeSuperclassRefactoring.extension.st b/src/GToolkit-Coder-UI/GtRBChangeSuperclassRefactoring.extension.st index 09f61b996..dbb42dd69 100644 --- a/src/GToolkit-Coder-UI/GtRBChangeSuperclassRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/GtRBChangeSuperclassRefactoring.extension.st @@ -2,7 +2,7 @@ Extension { #name : #GtRBChangeSuperclassRefactoring } { #category : #'*GToolkit-Coder-UI' } GtRBChangeSuperclassRefactoring >> gtDescription [ - + ^ ('Change' asRopedText glamorousRoundedBackground) append: ' superclass of ' asRopedText; diff --git a/src/GToolkit-Coder-UI/GtRBRemovePoolVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/GtRBRemovePoolVariableRefactoring.extension.st index c4b8628ad..ce2c470ec 100644 --- a/src/GToolkit-Coder-UI/GtRBRemovePoolVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/GtRBRemovePoolVariableRefactoring.extension.st @@ -2,7 +2,7 @@ Extension { #name : #GtRBRemovePoolVariableRefactoring } { #category : #'*GToolkit-Coder-UI' } GtRBRemovePoolVariableRefactoring >> gtDescription [ - + ^ ('Remove' asRopedText glamorousRoundedBackground) append: ' pool named ' asRopedText; diff --git a/src/GToolkit-Coder-UI/GtRBRemoveTraitUsageRefactoring.extension.st b/src/GToolkit-Coder-UI/GtRBRemoveTraitUsageRefactoring.extension.st index c52704dd8..dc0d9ab05 100644 --- a/src/GToolkit-Coder-UI/GtRBRemoveTraitUsageRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/GtRBRemoveTraitUsageRefactoring.extension.st @@ -2,7 +2,7 @@ Extension { #name : #GtRBRemoveTraitUsageRefactoring } { #category : #'*GToolkit-Coder-UI' } GtRBRemoveTraitUsageRefactoring >> gtDescription [ - + ^ ('Remove' asRopedText glamorousRoundedBackground) append: ' trait usage ' asRopedText; diff --git a/src/GToolkit-Coder-UI/RBAddClassVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBAddClassVariableRefactoring.extension.st index 3afe79dd1..0cfa67e27 100644 --- a/src/GToolkit-Coder-UI/RBAddClassVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBAddClassVariableRefactoring.extension.st @@ -2,7 +2,7 @@ Extension { #name : #RBAddClassVariableRefactoring } { #category : #'*GToolkit-Coder-UI' } RBAddClassVariableRefactoring >> gtDescription [ - + ^ ('Add' asRopedText glamorousRoundedBackground) append: ' class variable ' asRopedText; diff --git a/src/GToolkit-Coder-UI/RBAddInstanceVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBAddInstanceVariableRefactoring.extension.st index c54c63196..622e90dfd 100644 --- a/src/GToolkit-Coder-UI/RBAddInstanceVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBAddInstanceVariableRefactoring.extension.st @@ -2,7 +2,7 @@ Extension { #name : #RBAddInstanceVariableRefactoring } { #category : #'*GToolkit-Coder-UI' } RBAddInstanceVariableRefactoring >> gtDescription [ - + ^ ('Add' asRopedText glamorousRoundedBackground) append: ' instance variable ' asRopedText; diff --git a/src/GToolkit-Coder-UI/RBRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRefactoring.extension.st index 5dfe0ecf1..845d214a9 100644 --- a/src/GToolkit-Coder-UI/RBRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBRefactoring.extension.st @@ -2,7 +2,7 @@ Extension { #name : #RBRefactoring } { #category : #'*GToolkit-Coder-UI' } RBRefactoring >> gtDescription [ - + ^ self class name ] diff --git a/src/GToolkit-Coder-UI/RBRemoveClassVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRemoveClassVariableRefactoring.extension.st index 515063afb..ce703fb44 100644 --- a/src/GToolkit-Coder-UI/RBRemoveClassVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBRemoveClassVariableRefactoring.extension.st @@ -2,7 +2,7 @@ Extension { #name : #RBRemoveClassVariableRefactoring } { #category : #'*GToolkit-Coder-UI' } RBRemoveClassVariableRefactoring >> gtDescription [ - + ^ ('Remove' asRopedText glamorousRoundedBackground) append: ' class variable ' asRopedText; diff --git a/src/GToolkit-Coder-UI/RBRemoveInstanceVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRemoveInstanceVariableRefactoring.extension.st index 54daab99c..fe4600f8c 100644 --- a/src/GToolkit-Coder-UI/RBRemoveInstanceVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBRemoveInstanceVariableRefactoring.extension.st @@ -2,7 +2,7 @@ Extension { #name : #RBRemoveInstanceVariableRefactoring } { #category : #'*GToolkit-Coder-UI' } RBRemoveInstanceVariableRefactoring >> gtDescription [ - + ^ ('Remove' asRopedText glamorousRoundedBackground) append: ' instance variable ' asRopedText; diff --git a/src/GToolkit-Coder-UI/RBRenameClassRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRenameClassRefactoring.extension.st index 9e8c10631..507949114 100644 --- a/src/GToolkit-Coder-UI/RBRenameClassRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBRenameClassRefactoring.extension.st @@ -2,7 +2,7 @@ Extension { #name : #RBRenameClassRefactoring } { #category : #'*GToolkit-Coder-UI' } RBRenameClassRefactoring >> gtDescription [ - + ^ ('Rename' asRopedText glamorousRoundedBackground) append: ' class ' asRopedText; diff --git a/src/GToolkit-Coder-UI/RBRenameClassVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRenameClassVariableRefactoring.extension.st index fd3f38aa4..7be6da90e 100644 --- a/src/GToolkit-Coder-UI/RBRenameClassVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBRenameClassVariableRefactoring.extension.st @@ -2,7 +2,7 @@ Extension { #name : #RBRenameClassVariableRefactoring } { #category : #'*GToolkit-Coder-UI' } RBRenameClassVariableRefactoring >> gtDescription [ - + ^ ('Rename' asRopedText glamorousRoundedBackground) append: ' class variable ' asRopedText; diff --git a/src/GToolkit-Coder-UI/RBRenameInstanceVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRenameInstanceVariableRefactoring.extension.st index 2b29bcf97..ef4b6209d 100644 --- a/src/GToolkit-Coder-UI/RBRenameInstanceVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBRenameInstanceVariableRefactoring.extension.st @@ -2,7 +2,7 @@ Extension { #name : #RBRenameInstanceVariableRefactoring } { #category : #'*GToolkit-Coder-UI' } RBRenameInstanceVariableRefactoring >> gtDescription [ - + ^ ('Rename' asRopedText glamorousRoundedBackground) append: ' instance variable ' asRopedText; diff --git a/src/GToolkit-Coder-UI/RBTransformation.extension.st b/src/GToolkit-Coder-UI/RBTransformation.extension.st index 2da892fec..a14ff6c18 100644 --- a/src/GToolkit-Coder-UI/RBTransformation.extension.st +++ b/src/GToolkit-Coder-UI/RBTransformation.extension.st @@ -2,7 +2,7 @@ Extension { #name : #RBTransformation } { #category : #'*GToolkit-Coder-UI' } RBTransformation >> gtDescription [ - + ^ self class name ] From e254d81b67064d6bde31304f881389a3d91fe73f Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 22 Sep 2022 17:27:39 +0200 Subject: [PATCH 0273/1268] [feenkcom/gtoolkit#2777] remove obsolete spotter extensions --- .../GtCoderSpotterStart.class.st | 31 ------------------- 1 file changed, 31 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st b/src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st index 6a88002a9..03699f05f 100644 --- a/src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st +++ b/src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st @@ -42,23 +42,6 @@ GtCoderSpotterStart >> gtSpotterForInstanceMethodsInCurrentClassFor: aSearch [ wantsToDisplayOnEmptyQuery: true ] -{ #category : #searching } -GtCoderSpotterStart >> gtSpotterForMessagesFor: aStep [ - - - ^ aStep list - priority: 35; - title: 'Messages'; - filter: GtNullFilter - item: - [ :filter :context | GtSelector substring: context textTrimmed filter: filter ]; - itemActLogic: [ :each :step :spotterElement | - (each name asSymbol gtImplementors) - gtSpotterActDefault: step - from: spotterElement ]; - wantsToDisplayOnEmptyQuery: false -] - { #category : #searching } GtCoderSpotterStart >> gtSpotterForPackagesFor: aSearch [ @@ -71,20 +54,6 @@ GtCoderSpotterStart >> gtSpotterForPackagesFor: aSearch [ wantsToDisplayOnEmptyQuery: self navigationModel hasSelectedPackage not ] -{ #category : #searching } -GtCoderSpotterStart >> gtSpotterImplementorsFor: aStep [ - - ^ aStep list - priority: 30; - title: 'Implementors'; - filter: GtFilterImplementor - item: [ :filter :context | - SystemNavigation default - allBehaviorsDo: [ :class | class localMethods do: filter ] ]; - "keyBinding: $m meta;" - wantsToDisplayOnEmptyQuery: false -] - { #category : #accessing } GtCoderSpotterStart >> navigationModel [ ^ navigationModelBlock value From efd84daab72bb2849222e151e1468d9ef90cf030 Mon Sep 17 00:00:00 2001 From: Andrei Chis Date: Thu, 22 Sep 2022 19:44:59 +0200 Subject: [PATCH 0274/1268] Add a dedicated stencil for changes [feenkcom/gtoolkit/issues#2811] --- .../GtCodeDiffBuilder.class.st | 31 ++++ .../GtCodeDiffRBTextStyler.class.st | 14 ++ .../GtDiffElementWithLabelStencil.class.st | 132 ++++++++++++++++++ 3 files changed, 177 insertions(+) create mode 100644 src/GToolkit-Coder-UI/GtCodeDiffBuilder.class.st create mode 100644 src/GToolkit-Coder-UI/GtCodeDiffRBTextStyler.class.st create mode 100644 src/GToolkit-Coder-UI/GtDiffElementWithLabelStencil.class.st diff --git a/src/GToolkit-Coder-UI/GtCodeDiffBuilder.class.st b/src/GToolkit-Coder-UI/GtCodeDiffBuilder.class.st new file mode 100644 index 000000000..a786cd700 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCodeDiffBuilder.class.st @@ -0,0 +1,31 @@ +Class { + #name : #GtCodeDiffBuilder, + #superclass : #TextDiffBuilder, + #instVars : [ + 'isMethod' + ], + #category : #'GToolkit-Coder-UI-Diff' +} + +{ #category : #initialization } +GtCodeDiffBuilder >> initialize [ + super initialize. + isMethod := true +] + +{ #category : #accessing } +GtCodeDiffBuilder >> isMethod [ + ^ isMethod +] + +{ #category : #accessing } +GtCodeDiffBuilder >> isMethod: aBoolean [ + isMethod := aBoolean +] + +{ #category : #'instance creation' } +GtCodeDiffBuilder >> newStyler [ + ^ GtCodeDiffRBTextStyler new + isForWorkspace: isMethod not; + yourself +] diff --git a/src/GToolkit-Coder-UI/GtCodeDiffRBTextStyler.class.st b/src/GToolkit-Coder-UI/GtCodeDiffRBTextStyler.class.st new file mode 100644 index 000000000..fd93ee291 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCodeDiffRBTextStyler.class.st @@ -0,0 +1,14 @@ +Class { + #name : #GtCodeDiffRBTextStyler, + #superclass : #BrRBTextStyler, + #category : #'GToolkit-Coder-UI-Diff' +} + +{ #category : #private } +GtCodeDiffRBTextStyler >> resolveStyleFor: aVariableNode [ + | value | + value := super resolveStyleFor: aVariableNode. + ^ value = #invalid + ifTrue: [ #default ] + ifFalse: [ value ] +] diff --git a/src/GToolkit-Coder-UI/GtDiffElementWithLabelStencil.class.st b/src/GToolkit-Coder-UI/GtDiffElementWithLabelStencil.class.st new file mode 100644 index 000000000..04c92a85d --- /dev/null +++ b/src/GToolkit-Coder-UI/GtDiffElementWithLabelStencil.class.st @@ -0,0 +1,132 @@ +Class { + #name : #GtDiffElementWithLabelStencil, + #superclass : #BrStencil, + #instVars : [ + 'fromLabelText', + 'toLabelText', + 'diffBuilder', + 'shouldHideDiff' + ], + #category : #'GToolkit-Coder-UI-Diff' +} + +{ #category : #'api - instantiation' } +GtDiffElementWithLabelStencil >> create [ + | headerElement diffContainer | + + headerElement := BrHorizontalPane new + padding: (BlInsets all: 0); + hMatchParent; + vFitContent. + + headerElement + addChild: self createFromLabel; + addChild: self createToLabel. + + diffContainer := self createDiffContainer. + + ^ BrVerticalPane new + matchParent; + addChild: headerElement; + addChild: diffContainer asScrollableElement +] + +{ #category : #'api - instantiation' } +GtDiffElementWithLabelStencil >> createDiffContainer [ + | diffContainer | + diffContainer := BrVerticalPane new + hMatchParent; + vFitContent. + + self shouldHideDiff ifFalse: [ + diffContainer addChild: self createPanesDiffElement ]. + + ^ diffContainer +] + +{ #category : #'building - widgets' } +GtDiffElementWithLabelStencil >> createFromLabel [ + ^ BrLabel new + aptitude: BrGlamorousLabelAptitude; + text: (self fromLabelText asRopedText glamorousCodeSmallSize + foreground: BrGlamorousColors defaultButtonTextColor); + hMatchParent +] + +{ #category : #'building - widgets' } +GtDiffElementWithLabelStencil >> createPanesDiffElement [ + | diffWrapper | + + diffWrapper := BrVerticalPane new. + diffWrapper margin: (BlInsets all: 3). + diffWrapper hMatchParent. + diffWrapper vFitContent. + + diffWrapper + addChild: ((GtEpiceaDiffElement on: self diffBuilder) + aptitude: GtDiffFlatAptitude; + vFitContent; + beSmallSize). + + diffWrapper addAptitude: (BrShadowAptitude new width: 1). + + ^ diffWrapper +] + +{ #category : #'building - widgets' } +GtDiffElementWithLabelStencil >> createToLabel [ + ^ BrLabel new + aptitude: BrGlamorousLabelAptitude; + text: (self toLabelText asRopedText glamorousCodeSmallSize + foreground: BrGlamorousColors defaultButtonTextColor); + hMatchParent +] + +{ #category : #accessing } +GtDiffElementWithLabelStencil >> diffBuilder [ + ^ diffBuilder +] + +{ #category : #accessing } +GtDiffElementWithLabelStencil >> diffBuilder: anObject [ + + diffBuilder := anObject +] + +{ #category : #accessing } +GtDiffElementWithLabelStencil >> fromLabelText [ + ^ fromLabelText +] + +{ #category : #accessing } +GtDiffElementWithLabelStencil >> fromLabelText: aString [ + + fromLabelText := aString +] + +{ #category : #accessing } +GtDiffElementWithLabelStencil >> hideDiff [ + shouldHideDiff := true +] + +{ #category : #testing } +GtDiffElementWithLabelStencil >> shouldHideDiff [ + ^ shouldHideDiff ifNil: [ false ] +] + +{ #category : #accessing } +GtDiffElementWithLabelStencil >> shouldHideDiff: anObject [ + + shouldHideDiff := anObject +] + +{ #category : #accessing } +GtDiffElementWithLabelStencil >> toLabelText [ + ^ toLabelText +] + +{ #category : #accessing } +GtDiffElementWithLabelStencil >> toLabelText: aString [ + + toLabelText := aString +] From 9e41b649839c4298b807a0ac23d94e0211f33b4f Mon Sep 17 00:00:00 2001 From: John Brant Date: Fri, 23 Sep 2022 14:02:42 -0500 Subject: [PATCH 0275/1268] adding a couple helper methods for gtSearchFilter pragmas --- .../GtLabeledSearchFilter.class.st | 16 ++++++++++++ .../GtSearchFilter.class.st | 25 +++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/src/GToolkit-SearchFilters/GtLabeledSearchFilter.class.st b/src/GToolkit-SearchFilters/GtLabeledSearchFilter.class.st index 974345183..947820bd6 100644 --- a/src/GToolkit-SearchFilters/GtLabeledSearchFilter.class.st +++ b/src/GToolkit-SearchFilters/GtLabeledSearchFilter.class.st @@ -9,6 +9,12 @@ Class { #category : #'GToolkit-SearchFilters' } +{ #category : #comparing } +GtLabeledSearchFilter >> = anObject [ + ^ self class = anObject class + and: [ self filterLabel = anObject filterLabel and: [ self filter = anObject filter ] ] +] + { #category : #accessing } GtLabeledSearchFilter >> children [ ^ {filter} @@ -44,6 +50,16 @@ GtLabeledSearchFilter >> filterValueString [ ^ filter filterValueString ] +{ #category : #accessing } +GtLabeledSearchFilter >> gtDisplayOn: aStream [ + label gtDisplayOn: aStream +] + +{ #category : #comparing } +GtLabeledSearchFilter >> hash [ + ^ self filterLabel hash hashMultiply bitXor: self filter hash +] + { #category : #accessing } GtLabeledSearchFilter >> highlighter [ ^ filter highlighter diff --git a/src/GToolkit-SearchFilters/GtSearchFilter.class.st b/src/GToolkit-SearchFilters/GtSearchFilter.class.st index 3e8fb55e9..c156ec37f 100644 --- a/src/GToolkit-SearchFilters/GtSearchFilter.class.st +++ b/src/GToolkit-SearchFilters/GtSearchFilter.class.st @@ -4,6 +4,31 @@ Class { #category : #'GToolkit-SearchFilters' } +{ #category : #accessing } +GtSearchFilter class >> allSearchFilterMethods [ + | methods | + methods := ((Pragma allNamed: 'gtSearchFilter') + select: [ :each | each method methodClass isClassSide and: [ each method numArgs = 0 ] ]) + collect: [ :each | each method ]. + ^ methods +] + +{ #category : #accessing } +GtSearchFilter class >> allSearchFilters [ + ^ (self allSearchFilterMethods + collect: [ :each | + ([ each methodClass instanceSide perform: each selector ] + on: Error + do: [ :ex | ex return ]) + ifNotNil: [ :filter | + filter filterLabel + ifNil: [ (filter + labeled: each methodClass instanceSide name asString , ' ' , each selector) + methodDefinition: each; + yourself ] + ifNotNil: [ filter ] ] ]) reject: #isNil +] + { #category : #'logical operations' } GtSearchFilter >> & aFilter [ ^ GtSearchIntersectionFilter forFilter: self filter: aFilter From e10d615425cb038e672fe8a69b0bb22948262a8c Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 27 Sep 2022 11:01:14 -0500 Subject: [PATCH 0276/1268] filters for debugging stack --- .../GtLabeledSearchFilter.class.st | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/GToolkit-SearchFilters/GtLabeledSearchFilter.class.st b/src/GToolkit-SearchFilters/GtLabeledSearchFilter.class.st index 947820bd6..6a751b8cc 100644 --- a/src/GToolkit-SearchFilters/GtLabeledSearchFilter.class.st +++ b/src/GToolkit-SearchFilters/GtLabeledSearchFilter.class.st @@ -9,6 +9,22 @@ Class { #category : #'GToolkit-SearchFilters' } +{ #category : #accessing } +GtLabeledSearchFilter class >> gtSearchFilterPragmaDescriptor [ + ^ GtFilterDescriptor new + creator: [ :value | + (self allSearchFilters + detect: [ :each | each filterLabel = value ] + ifNone: [ self allSearchFilters + detect: [ :each | each filterLabel beginsWith: value caseSensitive: false ] + ifNone: [ nil ] ]) ifNil: [ GtSearchImageMethodsFilter allMethods ] ]; + named: 'Custom Filter'; + order: 10; + emptyDefaultValue: GtSearchImageMethodsFilter allMethods filterLabel; + completion: [ GtStringsCompletionStrategy new + completions: [ GtPrefixTree withAll: (self allSearchFilters collect: #filterLabel) ] ] +] + { #category : #comparing } GtLabeledSearchFilter >> = anObject [ ^ self class = anObject class From 685d2f3768a88664a006f5e5e541ba9d0a7f966d Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 27 Sep 2022 18:57:03 -0300 Subject: [PATCH 0277/1268] rename `BlDevScripter` -> `BlScripter` [feenkcom/gtoolkit#2816] --- src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st b/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st index f2d21f754..c76f0dbd2 100644 --- a/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st +++ b/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st @@ -27,7 +27,7 @@ TCoderByScripterExamples >> openAndClickOnContextMenuItemFor: aScripterOrStep id { #category : #'examples - scripter' } TCoderByScripterExamples >> scripter [ | scripter | - scripter := BlDevScripter new. + scripter := BlScripter new. self assert: scripter events isEmpty. From ac6a05f7ea6e1228765ed41aaebccc540daba36d Mon Sep 17 00:00:00 2001 From: John Brant Date: Wed, 28 Sep 2022 07:06:32 -0500 Subject: [PATCH 0278/1268] renaming allMethods since it conflicts with existing image method --- src/GToolkit-SearchFilters/GtLabeledSearchFilter.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-SearchFilters/GtLabeledSearchFilter.class.st b/src/GToolkit-SearchFilters/GtLabeledSearchFilter.class.st index 6a751b8cc..a863dde14 100644 --- a/src/GToolkit-SearchFilters/GtLabeledSearchFilter.class.st +++ b/src/GToolkit-SearchFilters/GtLabeledSearchFilter.class.st @@ -17,10 +17,10 @@ GtLabeledSearchFilter class >> gtSearchFilterPragmaDescriptor [ detect: [ :each | each filterLabel = value ] ifNone: [ self allSearchFilters detect: [ :each | each filterLabel beginsWith: value caseSensitive: false ] - ifNone: [ nil ] ]) ifNil: [ GtSearchImageMethodsFilter allMethods ] ]; + ifNone: [ nil ] ]) ifNil: [ GtSearchImageMethodsFilter forAllMethods ] ]; named: 'Custom Filter'; order: 10; - emptyDefaultValue: GtSearchImageMethodsFilter allMethods filterLabel; + emptyDefaultValue: GtSearchImageMethodsFilter forAllMethods filterLabel; completion: [ GtStringsCompletionStrategy new completions: [ GtPrefixTree withAll: (self allSearchFilters collect: #filterLabel) ] ] ] From e55dc5e1ecbeeebeff8948f5bada626871839420 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 28 Sep 2022 11:31:15 -0300 Subject: [PATCH 0279/1268] clean scripter examples [feenkcom/gtoolkit#2816] --- .../TCoderByScripterExamples.trait.st | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st b/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st index c76f0dbd2..131b2da00 100644 --- a/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st +++ b/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st @@ -5,23 +5,23 @@ Trait { { #category : #utilities } TCoderByScripterExamples >> openAndClickOnContextMenuItemFor: aScripterOrStep id: aBlElementId [ - + aScripterOrStep secondaryClick label: 'Open context menu'; id: GtSourceCoderEditorId; play. aScripterOrStep mouseMoveOver - label: 'Hover ', aBlElementId asSymbol; + label: 'Hover ' , aBlElementId asSymbol; onSpaceRoot; id: aBlElementId; play. - + aScripterOrStep click - label: 'Click ', aBlElementId asSymbol; + label: 'Click ' , aBlElementId asSymbol; onSpaceRoot; id: aBlElementId; - play. + play ] { #category : #'examples - scripter' } @@ -55,6 +55,7 @@ TCoderByScripterExamples >> scripterForBlock: aBlock [ { #category : #utilities } TCoderByScripterExamples >> selectTextFor: aScripterOrStep from: aStartPosition to: aToPosition andCheck: aSelectedString [ + aScripterOrStep do label: 'Select part of the method'; action: [ :aSourceEditor | From 9a50d43cb04823533b8255e01e9d7fc9b5533f7c Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 28 Sep 2022 17:39:55 -0300 Subject: [PATCH 0280/1268] replace `#check` by `#assert` in other examples [feenkcom/gtoolkit#2816] --- .../TCoderByScripterExamples.trait.st | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st b/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st index 131b2da00..f854a34ed 100644 --- a/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st +++ b/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st @@ -58,16 +58,17 @@ TCoderByScripterExamples >> selectTextFor: aScripterOrStep from: aStartPosition aScripterOrStep do label: 'Select part of the method'; - action: [ :aSourceEditor | + action: [ :aSourceEditor | aSourceEditor selecter from: aStartPosition to: aToPosition; select ]; id: GtSourceCoderEditorId; play. - - aScripterOrStep check - label: 'Check selected text'; - value: [ :aSourceEditor | aSourceEditor editor selectedText asString ] equals: aSelectedString; + + aScripterOrStep assert + label: 'Assert selected text'; + value: [ :aSourceEditor | aSourceEditor editor selectedText asString ] + equals: aSelectedString; id: GtSourceCoderEditorId; play ] From 43bbdbdf2bd4c500f50d0007b963f4d704b06ac3 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 29 Sep 2022 00:21:14 -0300 Subject: [PATCH 0281/1268] more fixed examples [feenkcom/gtoolkit#2816] --- src/GToolkit-Coder-Examples/GtUnionFilterExamples.class.st | 1 - 1 file changed, 1 deletion(-) diff --git a/src/GToolkit-Coder-Examples/GtUnionFilterExamples.class.st b/src/GToolkit-Coder-Examples/GtUnionFilterExamples.class.st index 0e007572c..7c1aad5f2 100644 --- a/src/GToolkit-Coder-Examples/GtUnionFilterExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtUnionFilterExamples.class.st @@ -19,7 +19,6 @@ GtUnionFilterExamples >> unionDifferentMethods [ { #category : #examples } GtUnionFilterExamples >> unionNullFilter [ - | filter union | filter := thisContext method selector gtImplementors. union := GtSearchNullFilter new | filter | filter. From fb0f523e6c243a11a52998d816e8a1293886eaf8 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 29 Sep 2022 12:00:18 -0300 Subject: [PATCH 0282/1268] fix some examples [feenkcom/gtoolkit#2816] --- ...assWithCommentsRefactoringExamples.class.st | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/GToolkit-Coder-Examples/RBRenameClassWithCommentsRefactoringExamples.class.st b/src/GToolkit-Coder-Examples/RBRenameClassWithCommentsRefactoringExamples.class.st index f92ece769..dbcfbdec6 100644 --- a/src/GToolkit-Coder-Examples/RBRenameClassWithCommentsRefactoringExamples.class.st +++ b/src/GToolkit-Coder-Examples/RBRenameClassWithCommentsRefactoringExamples.class.st @@ -17,7 +17,6 @@ Class { RBRenameClassWithCommentsRefactoringExamples >> renameClassComment [ "This comment with RBRenameClassWithCommentsRefactoringExamples should be renamed" - | model refactoring cls newName | model := RBNamespace new. @@ -25,9 +24,9 @@ RBRenameClassWithCommentsRefactoringExamples >> renameClassComment [ self assert: cls comment = self class comment. newName := #RenamedExample. refactoring := GtRBRenameClassWithCommentsRefactoring - model: model - rename: cls - to: newName. + model: model + rename: cls + to: newName. refactoring primitiveExecute. self assert: cls comment ~= self class comment. self class comment lines @@ -35,14 +34,9 @@ RBRenameClassWithCommentsRefactoringExamples >> renameClassComment [ do: [ :orig :new | (orig includesSubstring: ' not ') ifTrue: [ self assert: orig = new ] - ifFalse: [ self - assert: (orig copyReplaceAll: self class name with: newName) = new ] ]. + ifFalse: [ self assert: (orig copyReplaceAll: self class name with: newName) = new ] ]. self - assert: - (cls methodFor: thisContext method selector) source - = - (thisContext method sourceCode - copyReplaceAll: self class name - with: newName). + assert: (cls methodFor: thisContext method selector) source + = (thisContext method sourceCode copyReplaceAll: self class name with: newName). ^ model "This should also be renamed since it contains RBRenameClassWithCommentsRefactoringExamples" ] From 8efee24cabee3ad5f798184a675af750de79f059 Mon Sep 17 00:00:00 2001 From: John Brant Date: Thu, 29 Sep 2022 13:35:43 -0500 Subject: [PATCH 0283/1268] converting snippet rewriter to use filter element --- .../GtFilterDescriptor.class.st | 15 +++++++++++++++ .../GtFiltersElement.class.st | 19 ++++++++++--------- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st b/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st index 6adacad6a..0c31864ab 100644 --- a/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st +++ b/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st @@ -54,6 +54,16 @@ GtFilterDescriptor class >> creator: aBlock named: aString order: anInteger comp yourself ] +{ #category : #comparing } +GtFilterDescriptor >> = anObject [ + self == anObject ifTrue: [ ^ true ]. + ^ self class = anObject class + and: [ self name = anObject name + and: [ self order = anObject order + and: [ self emptyDefaultValue = anObject emptyDefaultValue + and: [ self valueIsRequired = anObject valueIsRequired ] ] ] ] +] + { #category : #'initialize-release' } GtFilterDescriptor >> beNotDefault [ "Do not display this particular descriptor filter as a default filter" @@ -102,6 +112,11 @@ GtFilterDescriptor >> gtCompletionsFor: aView [ view: #gtCompletionsFor: ] +{ #category : #comparing } +GtFilterDescriptor >> hash [ + ^ self class hash hashMultiply bitXor: self name hash +] + { #category : #'initialize-release' } GtFilterDescriptor >> initialize [ super initialize. diff --git a/src/GToolkit-Coder-UI/GtFiltersElement.class.st b/src/GToolkit-Coder-UI/GtFiltersElement.class.st index c143bdab0..e5ef2f21a 100644 --- a/src/GToolkit-Coder-UI/GtFiltersElement.class.st +++ b/src/GToolkit-Coder-UI/GtFiltersElement.class.st @@ -91,19 +91,20 @@ GtFiltersElement >> clearFilters [ { #category : #'private - actions' } GtFiltersElement >> createNewTag [ | tag | - self descriptors isEmptyOrNil ifTrue: [ ^ self ]. - self areAllDefaults - ifTrue: [ self clearFilters ]. - tag := GtFilterTagElement new. - tag filter: self. - tag descriptor: self descriptors first. - self addChild: tag at: self childrenCount. - tag activateEditor + self descriptors + ifNotEmpty: [ :items | + self areAllDefaults ifTrue: [ self clearFilters ]. + tag := GtFilterTagElement new. + tag filter: self. + tag descriptor: items first. + self addChild: tag at: self childrenCount. + tag activateEditor ] ] { #category : #accessing } GtFiltersElement >> descriptors [ - ^ descriptors + ^ (descriptors isBlock ifTrue: [ descriptors value ] ifFalse: [ descriptors ]) + ifNil: [ #() ] ] { #category : #accessing } From 052f443d0a74ac9fe0fc7943dd674c887c28b236 Mon Sep 17 00:00:00 2001 From: John Brant Date: Thu, 29 Sep 2022 14:18:02 -0500 Subject: [PATCH 0284/1268] fixing failing example --- .../RBRenameClassWithCommentsRefactoringExamples.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-Examples/RBRenameClassWithCommentsRefactoringExamples.class.st b/src/GToolkit-Coder-Examples/RBRenameClassWithCommentsRefactoringExamples.class.st index dbcfbdec6..904cebc42 100644 --- a/src/GToolkit-Coder-Examples/RBRenameClassWithCommentsRefactoringExamples.class.st +++ b/src/GToolkit-Coder-Examples/RBRenameClassWithCommentsRefactoringExamples.class.st @@ -25,7 +25,7 @@ RBRenameClassWithCommentsRefactoringExamples >> renameClassComment [ newName := #RenamedExample. refactoring := GtRBRenameClassWithCommentsRefactoring model: model - rename: cls + rename: cls name to: newName. refactoring primitiveExecute. self assert: cls comment ~= self class comment. From f947230d096f0b136bf756eaafc215b18273ae9b Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 6 Oct 2022 09:03:23 -0500 Subject: [PATCH 0285/1268] Class modification in coder just compiles new definition [feenkcom/gtoolkit#2805] [feenkcom/gtoolkit#2807] --- .../GtBehaviorDefinitionCoderViewModel.class.st | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtBehaviorDefinitionCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtBehaviorDefinitionCoderViewModel.class.st index 9262ac4ba..0a461fee3 100644 --- a/src/GToolkit-Coder-UI/GtBehaviorDefinitionCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtBehaviorDefinitionCoderViewModel.class.st @@ -4,6 +4,11 @@ Class { #category : #'GToolkit-Coder-UI-Coder - Behavior-Definition Model' } +{ #category : #accessing } +GtBehaviorDefinitionCoderViewModel >> acceptChanges [ + self coder acceptChanges +] + { #category : #accessing } GtBehaviorDefinitionCoderViewModel >> discardChanges [ self coder discardChanges From 809379d3f7f7719c2966dfd3792545133aab9a91 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 7 Oct 2022 13:17:05 -0500 Subject: [PATCH 0286/1268] Clean up GtCodeDefinitionPluralEditor [feenkcom/gtoolkit#2832] --- .../GtCodeDefinitionPluralEditor.class.st | 161 +++++++++--------- 1 file changed, 76 insertions(+), 85 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st index 921c36639..b5f1bae14 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st @@ -11,13 +11,14 @@ Class { } { #category : #accessing } -GtCodeDefinitionPluralEditor >> addSelector [ - ^ addSelector +GtCodeDefinitionPluralEditor >> addSelector: aSelector [ + addSelector := aSelector ] -{ #category : #accessing } -GtCodeDefinitionPluralEditor >> addSelector: anObject [ - addSelector := anObject +{ #category : #'api - instantiation' } +GtCodeDefinitionPluralEditor >> addTag: aNewTag [ + ^ aNewTag name + ifNotEmpty: [ :name | self definition perform: addSelector withEnoughArguments: {name} ] ] { #category : #accessing } @@ -30,101 +31,40 @@ GtCodeDefinitionPluralEditor >> contextMenuBlock: aBinaryBlock [ { #category : #'api - instantiation' } GtCodeDefinitionPluralEditor >> create [ - | aDefinition anOwner theInitialNames addAction removeAction renameAction aTagger | - aDefinition := self definition. + | anOwner theInitialNames aTagger | anOwner := self owner. - theInitialNames := aDefinition + theInitialNames := self definition perform: getSelector withEnoughArguments: {anOwner}. - addAction := [ :aNewTag | - aNewTag name - ifNotEmpty: [ aDefinition - perform: addSelector - withEnoughArguments: {aNewTag name. - anOwner} ] ]. - - removeAction := [ :aTag | - aDefinition - perform: removeSelector - withEnoughArguments: {aTag name. - anOwner} ]. - - renameAction := [ :aTag :aNewName | - aNewName trimmed - ifEmpty: [ removeAction value: aTag name ] - ifNotEmpty: [ :aTrimmedName | - aDefinition - perform: renameSelector - withEnoughArguments: {aTag name. - aTrimmedName. - anOwner} ] ]. - aTagger := BrTagger new aptitude: (BrGlamorousTaggerEditableAptitude new margin: self margin; - tagLabel: [ :aTaggerTag | - | anEditableLabel eachLabelDefinition | - eachLabelDefinition := aTaggerTag - ifNotNil: [ modelSelector - ifNotNil: [ :aSelector | - aTaggerTag name - ifEmpty: [ nil ] - ifNotEmpty: [ :aTagName | aDefinition perform: aSelector withEnoughArguments: {aTaggerTag name} ] ] ]. - anEditableLabel := BrEditableLabel new - text: aTaggerTag name; - styler: styler; - inputFilter: inputFilter; - aptitude: lookStencil create - + (BrGlamorousWithContextMenuAptitude - content: (contextMenuBlock value: eachLabelDefinition value: self)); - yourself. - interactions - do: [ :eachAssociation | - anEditableLabel - whenKey: eachAssociation key - labelDo: [ :aShortcutEvent :aShortcut | - aShortcutEvent consumed: true. - eachLabelDefinition - ifNotNil: [ eachAssociation value cull: aShortcutEvent cull: eachLabelDefinition ] ] ]. - eventHandlers - do: [ :eachAssociation | - anEditableLabel - when: eachAssociation key - do: [ :anEvent | - anEvent currentTarget isReadOnly - ifTrue: [ eachLabelDefinition - ifNotNil: [ eachAssociation value cull: anEvent cull: eachLabelDefinition ] ] ] ]. - completionStencil - ifNotNil: [ :aStencil | (GtCompletionController on: anEditableLabel strategy: aStencil create) install ]. - anEditableLabel ]; + tagLabel: [ :aTaggerTag | self createElementForTag: aTaggerTag ]; in: [ :aLook | separatorStencil ifNotNil: [ aLook separator: separatorStencil ] ]; yourself); namedTags: theInitialNames; - when: BrTaggerAddTagRequest - do: [ :aRequest | addAction value: aRequest tag ]; + when: BrTaggerAddTagRequest do: [ :aRequest | self addTag: aRequest tag ]; when: BrTaggerRemoveTagRequest - do: [ :aRequest | removeAction value: aRequest tag ]; + do: [ :aRequest | self removeTag: aRequest tag ]; when: BrTaggerRenameTagRequest - do: [ :aRequest | renameAction value: aRequest tag value: aRequest newName ]. + do: [ :aRequest | self renameTag: aRequest tag to: aRequest newName ]. self containerName ifNotNil: [ :aContainerName | aTagger containerName: aContainerName ]. - aDefinition + self definition when: addAnnouncement do: [ :anEvent | (anOwner isNil or: [ anEvent owner = anOwner ]) ifTrue: [ aTagger addTagNamed: anEvent name ] ]. - - aDefinition + self definition when: removeAnnouncement do: [ :anEvent | (anOwner isNil or: [ anEvent owner = anOwner ]) ifTrue: [ aTagger removeTagNamed: anEvent name ] ]. - - aDefinition + self definition when: renameAnnouncement do: [ :anEvent | (anOwner isNil or: [ anEvent owner = anOwner ]) @@ -133,6 +73,51 @@ GtCodeDefinitionPluralEditor >> create [ ^ aTagger ] +{ #category : #'api - instantiation' } +GtCodeDefinitionPluralEditor >> createElementForTag: aTaggerTag [ + | eachLabelDefinition anEditableLabel aContainer aPreviewButton | + aContainer := BrHorizontalPane new + hMatchParent; + alignCenterLeft; + vFitContent. + + eachLabelDefinition := aTaggerTag + ifNotNil: [ modelSelector + ifNotNil: [ :aSelector | + aTaggerTag name + ifEmpty: [ nil ] + ifNotEmpty: [ :aTagName | self definition perform: aSelector withEnoughArguments: {aTaggerTag name} ] ] ]. + anEditableLabel := BrEditableLabel new + text: aTaggerTag name; + styler: styler; + inputFilter: inputFilter; + aptitude: lookStencil create + + (BrGlamorousWithContextMenuAptitude + content: (contextMenuBlock value: eachLabelDefinition value: self)); + yourself. + + interactions + do: [ :eachAssociation | + anEditableLabel + whenKey: eachAssociation key + labelDo: [ :aShortcutEvent :aShortcut | + aShortcutEvent consumed: true. + eachLabelDefinition + ifNotNil: [ eachAssociation value cull: aShortcutEvent cull: eachLabelDefinition ] ] ]. + eventHandlers + do: [ :eachAssociation | + anEditableLabel + when: eachAssociation key + do: [ :anEvent | + anEvent currentTarget isReadOnly + ifTrue: [ eachLabelDefinition + ifNotNil: [ eachAssociation value cull: anEvent cull: eachLabelDefinition ] ] ] ]. + completionStencil + ifNotNil: [ :aStencil | (GtCompletionController on: anEditableLabel strategy: aStencil create) install ]. + + ^ anEditableLabel +] + { #category : #'api - instantiation' } GtCodeDefinitionPluralEditor >> initialize [ super initialize. @@ -140,23 +125,29 @@ GtCodeDefinitionPluralEditor >> initialize [ ] { #category : #accessing } -GtCodeDefinitionPluralEditor >> removeSelector [ - ^ removeSelector +GtCodeDefinitionPluralEditor >> removeSelector: aSelector [ + removeSelector := aSelector ] -{ #category : #accessing } -GtCodeDefinitionPluralEditor >> removeSelector: anObject [ - removeSelector := anObject +{ #category : #'api - instantiation' } +GtCodeDefinitionPluralEditor >> removeTag: aTag [ + ^ self definition perform: removeSelector withEnoughArguments: {aTag name} ] { #category : #accessing } -GtCodeDefinitionPluralEditor >> renameSelector [ - ^ renameSelector +GtCodeDefinitionPluralEditor >> renameSelector: aSelector [ + renameSelector := aSelector ] -{ #category : #accessing } -GtCodeDefinitionPluralEditor >> renameSelector: anObject [ - renameSelector := anObject +{ #category : #'api - instantiation' } +GtCodeDefinitionPluralEditor >> renameTag: aTag to: aNewName [ + ^ aNewName trimmed + ifEmpty: [ self removeTag: aTag name ] + ifNotEmpty: [ :aTrimmedName | + self definition + perform: renameSelector + withEnoughArguments: {aTag name. + aTrimmedName} ] ] { #category : #accessing } From 740830cfd72e10e01abcb32b221c0a11a9dfe89f Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Mon, 10 Oct 2022 08:48:25 -0500 Subject: [PATCH 0287/1268] Rename refactoring in slots editor [feenkcom/gtoolkit#2832] --- .../GtCodeDefinitionPluralEditor.class.st | 63 ++++++++++++++----- 1 file changed, 48 insertions(+), 15 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st index b5f1bae14..92130f320 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st @@ -5,7 +5,11 @@ Class { 'addSelector', 'renameSelector', 'removeSelector', - 'contextMenuBlock' + 'contextMenuBlock', + 'renameRefactoringBlock' + ], + #classInstVars : [ + 'foo' ], #category : #'GToolkit-Coder-UI-Behaviour - Editor / Reader' } @@ -21,6 +25,19 @@ GtCodeDefinitionPluralEditor >> addTag: aNewTag [ ifNotEmpty: [ :name | self definition perform: addSelector withEnoughArguments: {name} ] ] +{ #category : #'api - instantiation' } +GtCodeDefinitionPluralEditor >> buildRenamePreviewFrom: aTag to: aNewName [ + | oldName | + oldName := aTag name. + ^ GtRefactoringsPreviewButton new + margin: (BlInsets + top: 5 + left: -3 + bottom: 0 + right: 5); + refactorings: [ {renameRefactoringBlock value: oldName value: aNewName} ] +] + { #category : #accessing } GtCodeDefinitionPluralEditor >> contextMenuBlock: aBinaryBlock [ "Block accepts a label definition and editor and returns a GtCoderContextMenuContent" @@ -49,7 +66,12 @@ GtCodeDefinitionPluralEditor >> create [ when: BrTaggerRemoveTagRequest do: [ :aRequest | self removeTag: aRequest tag ]; when: BrTaggerRenameTagRequest - do: [ :aRequest | self renameTag: aRequest tag to: aRequest newName ]. + do: [ :aRequest | + self + renameTag: aRequest tag + to: aRequest newName + from: aRequest source. + aRequest currentTarget renameTag: aRequest tag to: aRequest newName ]. self containerName ifNotNil: [ :aContainerName | aTagger containerName: aContainerName ]. @@ -75,12 +97,7 @@ GtCodeDefinitionPluralEditor >> create [ { #category : #'api - instantiation' } GtCodeDefinitionPluralEditor >> createElementForTag: aTaggerTag [ - | eachLabelDefinition anEditableLabel aContainer aPreviewButton | - aContainer := BrHorizontalPane new - hMatchParent; - alignCenterLeft; - vFitContent. - + | eachLabelDefinition anEditableLabel | eachLabelDefinition := aTaggerTag ifNotNil: [ modelSelector ifNotNil: [ :aSelector | @@ -114,7 +131,7 @@ GtCodeDefinitionPluralEditor >> createElementForTag: aTaggerTag [ ifNotNil: [ eachAssociation value cull: anEvent cull: eachLabelDefinition ] ] ] ]. completionStencil ifNotNil: [ :aStencil | (GtCompletionController on: anEditableLabel strategy: aStencil create) install ]. - + ^ anEditableLabel ] @@ -134,20 +151,36 @@ GtCodeDefinitionPluralEditor >> removeTag: aTag [ ^ self definition perform: removeSelector withEnoughArguments: {aTag name} ] +{ #category : #accessing } +GtCodeDefinitionPluralEditor >> renameRefactoringBlock: aBlock [ + "This block should return a refactoring that will rename all references from the old name to the old name. + It is evaluated when renaming existing variables in the class" + + renameRefactoringBlock := aBlock +] + { #category : #accessing } GtCodeDefinitionPluralEditor >> renameSelector: aSelector [ renameSelector := aSelector ] { #category : #'api - instantiation' } -GtCodeDefinitionPluralEditor >> renameTag: aTag to: aNewName [ - ^ aNewName trimmed - ifEmpty: [ self removeTag: aTag name ] - ifNotEmpty: [ :aTrimmedName | - self definition +GtCodeDefinitionPluralEditor >> renameTag: aTag to: aNewName from: aTaggerAptitude [ + | newName aPreviewButton | + newName := aNewName trimmed. + newName = aTag name ifTrue: [ ^ self ]. + newName + ifEmpty: [ self removeTag: aTag name. + ^ self ]. + renameRefactoringBlock notNil + ifTrue: [ aPreviewButton := self buildRenamePreviewFrom: aTag to: newName. + aTaggerAptitude + tagElementFor: aTag + ifFound: [ :elem | elem parent addChild: aPreviewButton after: elem ] ] + ifFalse: [ self definition perform: renameSelector withEnoughArguments: {aTag name. - aTrimmedName} ] + newName} ] ] { #category : #accessing } From 76b7ce21d7539d488428ba3df65aa033e1d77931 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 11 Oct 2022 07:14:45 -0500 Subject: [PATCH 0288/1268] Primary-R triggers editor rename in slots editor [feenkcom/gtoolkit#2832] --- .../GtCodeDefinitionPluralEditor.class.st | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st index 92130f320..6ad923634 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st @@ -8,9 +8,6 @@ Class { 'contextMenuBlock', 'renameRefactoringBlock' ], - #classInstVars : [ - 'foo' - ], #category : #'GToolkit-Coder-UI-Behaviour - Editor / Reader' } @@ -138,7 +135,10 @@ GtCodeDefinitionPluralEditor >> createElementForTag: aTaggerTag [ { #category : #'api - instantiation' } GtCodeDefinitionPluralEditor >> initialize [ super initialize. - contextMenuBlock := [ :def :edit | [ GtCoderContextMenuContent new editorElement: edit ] ] + contextMenuBlock := [ :def :edit | [ GtCoderContextMenuContent new editorElement: edit ] ]. + self + whenKey: BlKeyCombination primaryR + do: [ :anEvent :aDefinition | anEvent target switchToEditor ] ] { #category : #accessing } From 1c255cf4619d4d8e1377594ab1649eefb681585d Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 13 Oct 2022 09:27:04 -0500 Subject: [PATCH 0289/1268] Add cancel button to refactoring preview button [feenkcom/gtoolkit#2837] --- .../GtCodeDefinitionPluralEditor.class.st | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st index 6ad923634..765f824e8 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st @@ -23,7 +23,7 @@ GtCodeDefinitionPluralEditor >> addTag: aNewTag [ ] { #category : #'api - instantiation' } -GtCodeDefinitionPluralEditor >> buildRenamePreviewFrom: aTag to: aNewName [ +GtCodeDefinitionPluralEditor >> buildRenamePreviewFrom: aTag to: aNewName from: anAptitude [ | oldName | oldName := aTag name. ^ GtRefactoringsPreviewButton new @@ -32,7 +32,8 @@ GtCodeDefinitionPluralEditor >> buildRenamePreviewFrom: aTag to: aNewName [ left: -3 bottom: 0 right: 5); - refactorings: [ {renameRefactoringBlock value: oldName value: aNewName} ] + refactorings: [ {renameRefactoringBlock value: oldName value: aNewName} ]; + cancelBlock: [ anAptitude widget viewModel renameTagNamed: aNewName to: oldName ] ] { #category : #accessing } @@ -173,7 +174,7 @@ GtCodeDefinitionPluralEditor >> renameTag: aTag to: aNewName from: aTaggerAptitu ifEmpty: [ self removeTag: aTag name. ^ self ]. renameRefactoringBlock notNil - ifTrue: [ aPreviewButton := self buildRenamePreviewFrom: aTag to: newName. + ifTrue: [ aPreviewButton := self buildRenamePreviewFrom: aTag to: newName from: aTaggerAptitude. aTaggerAptitude tagElementFor: aTag ifFound: [ :elem | elem parent addChild: aPreviewButton after: elem ] ] From 1c480c7e085ac28fff49e7eb33a63946bdb9abcd Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 14 Oct 2022 07:15:08 -0500 Subject: [PATCH 0290/1268] Add cancel to refactoring attribute [feenkcom/gtoolkit#2837] --- .../GtSourceCoderRefactoringController.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st b/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st index 288b9d2fc..0dd6d5d42 100644 --- a/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st +++ b/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st @@ -85,7 +85,7 @@ GtSourceCoderRefactoringController >> setText: aStringOrText [ self sourceCoderViewModel sourceText: aStringOrText asRopedText from: self - synchronously: false + synchronously: true ] { #category : #accessing } From 80aed49890450e63d5c351f999558249c7926e7d Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 18 Oct 2022 10:07:51 -0500 Subject: [PATCH 0291/1268] starting extract to component --- .../GtAbstractRenameAction.class.st | 270 ++++++++++++ .../GtCoderViewModelRenameAction.class.st | 166 ++++++++ .../GtRenameAction.class.st | 233 +--------- .../GtRenameAction2.class.st | 397 ------------------ .../GtRenameEditor.class.st | 8 +- .../GtRenameEditorAttribute.class.st | 168 ++++++-- ...tSourceCoderExtractMethodShortcut.class.st | 4 +- 7 files changed, 574 insertions(+), 672 deletions(-) create mode 100644 src/GToolkit-Coder-AddOns/GtAbstractRenameAction.class.st create mode 100644 src/GToolkit-Coder-AddOns/GtCoderViewModelRenameAction.class.st delete mode 100644 src/GToolkit-Coder-AddOns/GtRenameAction2.class.st diff --git a/src/GToolkit-Coder-AddOns/GtAbstractRenameAction.class.st b/src/GToolkit-Coder-AddOns/GtAbstractRenameAction.class.st new file mode 100644 index 000000000..8e7093e31 --- /dev/null +++ b/src/GToolkit-Coder-AddOns/GtAbstractRenameAction.class.st @@ -0,0 +1,270 @@ +Class { + #name : #GtAbstractRenameAction, + #superclass : #Object, + #traits : 'TGtAnnouncer', + #classTraits : 'TGtAnnouncer classTrait', + #instVars : [ + 'announcer', + 'validationBlock', + 'filter', + 'selectAll', + 'renameAttributes', + 'isInstalled', + 'originalLocations', + 'originalText' + ], + #category : #'GToolkit-Coder-AddOns-Inline rename' +} + +{ #category : #actions } +GtAbstractRenameAction >> accept [ + self updateSource. + self uninstall. + self allowSave. + self announceEvent: #accept +] + +{ #category : #private } +GtAbstractRenameAction >> addRenameAttributes [ + self subclassResponsibility +] + +{ #category : #private } +GtAbstractRenameAction >> allowSave [ +] + +{ #category : #private } +GtAbstractRenameAction >> announceEvent: aSymbol [ + ^ self announce: (GtRenameActionAnnouncement for: self type: aSymbol) +] + +{ #category : #announcer } +GtAbstractRenameAction >> announcer [ + ^ announcer ifNil: [ announcer := Announcer new ] +] + +{ #category : #actions } +GtAbstractRenameAction >> cancel [ + self uninstall. + self undoChanges. + self allowSave. + self announceEvent: #cancel +] + +{ #category : #accessing } +GtAbstractRenameAction >> editor [ + ^ self editorAttribute editor +] + +{ #category : #accessing } +GtAbstractRenameAction >> editorAttribute [ + ^ renameAttributes notNil + ifTrue: [ renameAttributes + detect: [ :attr | attr isKindOf: GtRenameEditorAttribute ] + ifNone: [ ] ] +] + +{ #category : #private } +GtAbstractRenameAction >> filter: aTextEditorInputFilter [ + filter := aTextEditorInputFilter. + self primaryRenameAttribute + ifNotNil: [ :attr | attr filter: aTextEditorInputFilter ] +] + +{ #category : #'initialize-release' } +GtAbstractRenameAction >> forBinaryOrKeyword [ + validationBlock := [ :str | (self validateKeyword: str) or: [ self validateBinary: str ] ] +] + +{ #category : #'initialize-release' } +GtAbstractRenameAction >> forKeyword [ + validationBlock := [ :str | self validateKeyword: str ] +] + +{ #category : #'initialize-release' } +GtAbstractRenameAction >> forText [ + validationBlock := [ :str | true ]. + self filter: BrTextEditorNoInputFilter new +] + +{ #category : #'initialize-release' } +GtAbstractRenameAction >> forVariableOrUnaryMessage [ + validationBlock := [ :str | self validateVariable: str ]. + self filter: BrTextEditorAlphaNumericInputFilter new +] + +{ #category : #initialization } +GtAbstractRenameAction >> initialize [ + super initialize. + originalLocations := #(). + isInstalled := false. + selectAll := false. + filter := BrTextEditorNoInputFilter new +] + +{ #category : #installation } +GtAbstractRenameAction >> install [ + originalLocations isEmpty + ifTrue: [ ^ self ]. + self preventSave. + self saveOriginalState. + self addRenameAttributes. + isInstalled := true. + self announceEvent: #install +] + +{ #category : #testing } +GtAbstractRenameAction >> isInstalled [ + ^ isInstalled +] + +{ #category : #testing } +GtAbstractRenameAction >> isRenameAttribute: anAttribute [ + ^ anAttribute isKindOf: GtRenamePreviewAttribute +] + +{ #category : #'private-validation' } +GtAbstractRenameAction >> isValid [ + validationBlock isNil + ifTrue: [ ^ true ]. + ^ validationBlock value: self newName +] + +{ #category : #accessing } +GtAbstractRenameAction >> locations: aCollectionOfIntervals [ + originalLocations := aCollectionOfIntervals asSortedCollection: [ :a :b | a first < b first ]. + self validateLocations +] + +{ #category : #actions } +GtAbstractRenameAction >> lostFocus [ + self isValid + ifTrue: [ self accept ] + ifFalse: [ self cancel ] +] + +{ #category : #accessing } +GtAbstractRenameAction >> newName [ + ^ renameAttributes first text asString +] + +{ #category : #accessing } +GtAbstractRenameAction >> originalName [ + ^ (originalText + copyFrom: originalLocations first first + to: originalLocations first last) asString +] + +{ #category : #installation } +GtAbstractRenameAction >> preventSave [ +] + +{ #category : #private } +GtAbstractRenameAction >> primaryRenameAttribute [ + renameAttributes isNil + ifTrue: [ ^ nil ]. + ^ renameAttributes + detect: [ :each | each isEditorAttribute ] + ifNone: [ nil ] +] + +{ #category : #private } +GtAbstractRenameAction >> removeAttributes [ + self subclassResponsibility +] + +{ #category : #actions } +GtAbstractRenameAction >> returnAccept [ + self isValid + ifFalse: [ ^ self ]. + self accept +] + +{ #category : #private } +GtAbstractRenameAction >> saveOriginalState [ + self subclassResponsibility +] + +{ #category : #accessing } +GtAbstractRenameAction >> selectAll [ + ^ selectAll +] + +{ #category : #accessing } +GtAbstractRenameAction >> selectAll: aBoolean [ + selectAll := aBoolean +] + +{ #category : #actions } +GtAbstractRenameAction >> tabAccept: forward [ + self isValid + ifFalse: [ ^ self ]. + self accept. + self + announceEvent: + (forward + ifTrue: [ #tab ] + ifFalse: [ #shiftTab ]) +] + +{ #category : #private } +GtAbstractRenameAction >> undoChanges [ + self subclassResponsibility +] + +{ #category : #installation } +GtAbstractRenameAction >> uninstall [ + self removeAttributes. + isInstalled := false. + self allowSave. + self announceEvent: #uninstall +] + +{ #category : #actions } +GtAbstractRenameAction >> updateName: blText [ + renameAttributes do: [ :each | each updateText: blText ]. + self announceEvent: #textUpdated +] + +{ #category : #private } +GtAbstractRenameAction >> updateSource [ + self subclassResponsibility +] + +{ #category : #'private-validation' } +GtAbstractRenameAction >> validateBinary: aString [ + aString isEmpty + ifTrue: [ ^ false ]. + ^ (RBScanner isSelector: aString) and: [ aString asSymbol isBinary ] +] + +{ #category : #'private-validation' } +GtAbstractRenameAction >> validateKeyword: aString [ + aString isEmpty + ifTrue: [ ^ false ]. + aString last = $: + ifFalse: [ ^ false ]. + ^ (RBScanner isSelector: aString) + and: [ aString asSymbol numArgs = 1 ] +] + +{ #category : #private } +GtAbstractRenameAction >> validateLocations [ + | lastLocation size | + originalLocations isEmpty + ifTrue: [ ^ self ]. + lastLocation := 0. + size := originalLocations first size. + originalLocations + do: [ :each | + each first <= lastLocation + ifTrue: [ self error: 'Cannot rename overlapping locations' ]. + lastLocation := each last. + each size ~= size + ifTrue: [ self error: 'Cannot rename items of different sizes' ] ] +] + +{ #category : #'private-validation' } +GtAbstractRenameAction >> validateVariable: aString [ + ^ RBScanner isVariable: aString +] diff --git a/src/GToolkit-Coder-AddOns/GtCoderViewModelRenameAction.class.st b/src/GToolkit-Coder-AddOns/GtCoderViewModelRenameAction.class.st new file mode 100644 index 000000000..1375bbbc3 --- /dev/null +++ b/src/GToolkit-Coder-AddOns/GtCoderViewModelRenameAction.class.st @@ -0,0 +1,166 @@ +Class { + #name : #GtCoderViewModelRenameAction, + #superclass : #GtAbstractRenameAction, + #instVars : [ + 'pharoSourceCoderViewModel', + 'originalCursors', + 'coderAttributes' + ], + #category : #'GToolkit-Coder-AddOns-Inline rename' +} + +{ #category : #'instance creation' } +GtCoderViewModelRenameAction class >> locations: aCollectionOfIntervals textualCoderViewModel: aTextualCoderViewModel [ + ^ self new + locations: aCollectionOfIntervals; + pharoSourceCoderViewModel: aTextualCoderViewModel; + yourself +] + +{ #category : #'private - attributes' } +GtCoderViewModelRenameAction >> addRenameAttributes [ + | text cursorInLocation | + + text := self pharoSourceCoderViewModel styledText ifNil: [ self pharoSourceCoderViewModel sourceText ]. + + cursorInLocation := originalLocations + anySatisfy: [ :each | originalCursors anySatisfy: [ :eachCursor | eachCursor position between: each first - 1 and: each last ] ]. + + coderAttributes := originalLocations + collect: [ :each | + | attribute | + attribute := (cursorInLocation not + or: [ originalCursors anySatisfy: [ :eachCursor | eachCursor position between: each first - 1 and: each last ] ]) + ifTrue: [ + GtRenameEditorAttribute new + action: self; + selectAll: selectAll; + filter: filter; + text: (text from: each first to: each last) ] + ifFalse: [ + GtRenamePreviewAttribute new + action: self; + text: (text from: each first to: each last) ]. + cursorInLocation := true. + + self pharoSourceCoderViewModel + addTextAttribute: attribute + from: each first + to: each last ]. + + renameAttributes := coderAttributes flatCollect: [ :eachCoderAttribute | eachCoderAttribute textAttributes ]. + + self + assert: [ (renameAttributes select: [ :each | each isKindOf: GtRenameEditorAttribute ]) size <= 1 ] + description: [ 'There must not be more than one editor attribute' ] +] + +{ #category : #'private - actions' } +GtCoderViewModelRenameAction >> allowSave [ + pharoSourceCoderViewModel allowSaveDueTo: self +] + +{ #category : #'initialize-release' } +GtCoderViewModelRenameAction >> initialize [ + super initialize. + coderAttributes := #() +] + +{ #category : #accessing } +GtCoderViewModelRenameAction >> pharoSourceCoderViewModel [ + ^ pharoSourceCoderViewModel +] + +{ #category : #accessing } +GtCoderViewModelRenameAction >> pharoSourceCoderViewModel: anObject [ + pharoSourceCoderViewModel := anObject +] + +{ #category : #'private - actions' } +GtCoderViewModelRenameAction >> preventSave [ + pharoSourceCoderViewModel preventSaveDueTo: self +] + +{ #category : #'private - attributes' } +GtCoderViewModelRenameAction >> removeAttributes [ + self pharoSourceCoderViewModel removeAllCoderTextAttributes: coderAttributes +] + +{ #category : #private } +GtCoderViewModelRenameAction >> saveOriginalState [ + originalText := self pharoSourceCoderViewModel sourceText copy. + originalCursors := self pharoSourceCoderViewModel cursors copy +] + +{ #category : #private } +GtCoderViewModelRenameAction >> undoChanges [ + self pharoSourceCoderViewModel cursors: originalCursors +] + +{ #category : #installation } +GtCoderViewModelRenameAction >> uninstall [ + super uninstall. + pharoSourceCoderViewModel focused: true +] + +{ #category : #private } +GtCoderViewModelRenameAction >> updateCursorLocation [ + | sizeDifference offset | + sizeDifference := self newName size - self originalName size. + offset := 0. + originalLocations + with: renameAttributes + do: [ :interval :attr | + attr isEditorAttribute + ifTrue: [ + | aNewCursorPosition | + + aNewCursorPosition := (interval first + offset + attr editorCursorLocation - 1 min: pharoSourceCoderViewModel sourceText size). + pharoSourceCoderViewModel moveCursorTo: aNewCursorPosition. + ^ self ]. + + offset := offset + sizeDifference ] +] + +{ #category : #private } +GtCoderViewModelRenameAction >> updateSource [ + self newName = self originalName + ifTrue: [ ^ self removeAttributes ]. + + self + updateSourceIn: self pharoSourceCoderViewModel + at: originalLocations + attributes: renameAttributes. + + self updateCursorLocation +] + +{ #category : #private } +GtCoderViewModelRenameAction >> updateSourceIn: aTextualSourceCoderViewModel at: intervals attributes: attributeCollection [ + self + updateText: aTextualSourceCoderViewModel sourceText + at: intervals + attributes: attributeCollection +] + +{ #category : #private } +GtCoderViewModelRenameAction >> updateText: text at: intervals attributes: attributeCollection [ + | newText index | + newText := '' asRopedText. + index := 1. + intervals + with: attributeCollection + do: [ :each :attr | + each first = 1 + ifTrue: [ newText := newText , attr text ] + ifFalse: [ newText := newText , (text copyFrom: index to: each first - 1) + , attr text ]. + index := each last + 1 ]. + index > text size + ifFalse: [ newText := newText , (text copyFrom: index to: text size) ]. + + self pharoSourceCoderViewModel + sourceText: newText + from: self + synchronously: false +] diff --git a/src/GToolkit-Coder-AddOns/GtRenameAction.class.st b/src/GToolkit-Coder-AddOns/GtRenameAction.class.st index b2824dd0b..7be47997c 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameAction.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameAction.class.st @@ -1,19 +1,9 @@ Class { #name : #GtRenameAction, - #superclass : #Object, - #traits : 'TGtAnnouncer', - #classTraits : 'TGtAnnouncer classTrait', + #superclass : #GtAbstractRenameAction, #instVars : [ - 'announcer', 'textElement', - 'originalLocations', - 'originalText', - 'originalCursorPosition', - 'isInstalled', - 'renameAttributes', - 'selectAll', - 'validationBlock', - 'filter' + 'originalCursorPosition' ], #category : #'GToolkit-Coder-AddOns-Inline rename' } @@ -26,14 +16,6 @@ GtRenameAction class >> locations: aCollectionOfIntervals element: aTextEditorEl yourself ] -{ #category : #actions } -GtRenameAction >> accept [ - self updateSource. - self uninstall. - self allowSave. - self announceEvent: #accept -] - { #category : #private } GtRenameAction >> addRenameAttributes [ | text cursorInLocation | @@ -66,153 +48,15 @@ GtRenameAction >> allowSave [ ifTrue: [ textElement textualCoderViewModel allowSaveDueTo: self ] ] -{ #category : #private } -GtRenameAction >> announceEvent: aSymbol [ - ^ self announce: (GtRenameActionAnnouncement for: self type: aSymbol) -] - -{ #category : #announcer } -GtRenameAction >> announcer [ - ^ announcer ifNil: [ announcer := Announcer new ] -] - -{ #category : #actions } -GtRenameAction >> cancel [ - self uninstall. - self undoChanges. - self allowSave. - self announceEvent: #cancel -] - -{ #category : #accessing } -GtRenameAction >> editor [ - ^ self editorAttribute editor -] - -{ #category : #accessing } -GtRenameAction >> editorAttribute [ - ^ renameAttributes notNil - ifTrue: [ renameAttributes - detect: [ :attr | attr isKindOf: GtRenameEditorAttribute ] - ifNone: [ ] ] -] - -{ #category : #private } -GtRenameAction >> filter: aTextEditorInputFilter [ - filter := aTextEditorInputFilter. - self primaryRenameAttribute - ifNotNil: [ :attr | attr filter: aTextEditorInputFilter ] -] - -{ #category : #'initialize-release' } -GtRenameAction >> forBinaryOrKeyword [ - validationBlock := [ :str | (self validateKeyword: str) or: [ self validateBinary: str ] ] -] - -{ #category : #'initialize-release' } -GtRenameAction >> forKeyword [ - validationBlock := [ :str | self validateKeyword: str ] -] - -{ #category : #'initialize-release' } -GtRenameAction >> forVariableOrUnaryMessage [ - validationBlock := [ :str | self validateVariable: str ]. - self filter: BrTextEditorAlphaNumericInputFilter new -] - -{ #category : #'initialize-release' } -GtRenameAction >> initialize [ - super initialize. - originalLocations := #(). - isInstalled := false. - selectAll := false. - filter := BrTextEditorNoInputFilter new -] - -{ #category : #installation } -GtRenameAction >> install [ - originalLocations isEmpty - ifTrue: [ ^ self ]. - self preventSave. - self saveOriginalState. - self addRenameAttributes. - isInstalled := true. - self announceEvent: #install -] - -{ #category : #testing } -GtRenameAction >> isInstalled [ - ^ isInstalled -] - -{ #category : #testing } -GtRenameAction >> isRenameAttribute: anAttribute [ - ^ anAttribute isKindOf: GtRenamePreviewAttribute -] - -{ #category : #'private-validation' } -GtRenameAction >> isValid [ - validationBlock isNil - ifTrue: [ ^ true ]. - ^ validationBlock value: self newName -] - -{ #category : #accessing } -GtRenameAction >> locations: aCollectionOfIntervals [ - originalLocations := aCollectionOfIntervals asSortedCollection: [ :a :b | a first < b first ]. - self validateLocations -] - -{ #category : #actions } -GtRenameAction >> lostFocus [ - self isValid - ifTrue: [ self accept ] - ifFalse: [ self cancel ] -] - -{ #category : #accessing } -GtRenameAction >> newName [ - ^ renameAttributes first text asString -] - -{ #category : #accessing } -GtRenameAction >> originalName [ - ^ (originalText - copyFrom: originalLocations first first - to: originalLocations first last) asString -] - { #category : #'private - actions' } GtRenameAction >> preventSave [ (textElement respondsTo: #textualCoderViewModel) ifTrue: [ textElement textualCoderViewModel preventSaveDueTo: self ] ] -{ #category : #private } -GtRenameAction >> primaryRenameAttribute [ - renameAttributes isNil - ifTrue: [ ^ nil ]. - ^ renameAttributes - detect: [ :each | each isEditorAttribute ] - ifNone: [ nil ] -] - -{ #category : #private } -GtRenameAction >> removeAttributeHandlers [ - renameAttributes do: [ :each | each uninstallEventHandlers ] -] - { #category : #private } GtRenameAction >> removeAttributes [ - self text clearAttributes: [ :each | self isRenameAttribute: each ]. - self removeAttributeHandlers -] - -{ #category : #actions } -GtRenameAction >> returnAccept [ - self isValid - ifFalse: [ ^ self ]. - self accept + self text clearAttributes: [ :each | self isRenameAttribute: each ] ] { #category : #private } @@ -223,28 +67,6 @@ GtRenameAction >> saveOriginalState [ originalCursorPosition := self textEditor cursors first position ] -{ #category : #accessing } -GtRenameAction >> selectAll [ - ^ selectAll -] - -{ #category : #accessing } -GtRenameAction >> selectAll: anObject [ - selectAll := anObject -] - -{ #category : #actions } -GtRenameAction >> tabAccept: forward [ - self isValid - ifFalse: [ ^ self ]. - self accept. - self - announceEvent: - (forward - ifTrue: [ #tab ] - ifFalse: [ #shiftTab ]) -] - { #category : #accessing } GtRenameAction >> text [ ^ self textEditor text @@ -276,10 +98,7 @@ GtRenameAction >> undoChanges [ { #category : #installation } GtRenameAction >> uninstall [ - self removeAttributes. - isInstalled := false. - self allowSave. - self announceEvent: #uninstall. + super uninstall. textElement enqueueTask: (BlTaskAction new action: [ textElement requestFocus ]) ] @@ -301,12 +120,6 @@ GtRenameAction >> updateCursorLocation [ offset := offset + sizeDifference ] ] -{ #category : #actions } -GtRenameAction >> updateName: blText [ - renameAttributes do: [ :each | each updateText: blText ]. - self announceEvent: #textUpdated -] - { #category : #private } GtRenameAction >> updateSource [ self newName = self originalName @@ -345,41 +158,3 @@ GtRenameAction >> updateText: text at: intervals attributes: attributeCollection (textElement respondsTo: #onTextModified) ifTrue: [ textElement onTextModified ] ] - -{ #category : #'private-validation' } -GtRenameAction >> validateBinary: aString [ - aString isEmpty - ifTrue: [ ^ false ]. - ^ (RBScanner isSelector: aString) and: [ aString asSymbol isBinary ] -] - -{ #category : #'private-validation' } -GtRenameAction >> validateKeyword: aString [ - aString isEmpty - ifTrue: [ ^ false ]. - aString last = $: - ifFalse: [ ^ false ]. - ^ (RBScanner isSelector: aString) - and: [ aString asSymbol numArgs = 1 ] -] - -{ #category : #private } -GtRenameAction >> validateLocations [ - | lastLocation size | - originalLocations isEmpty - ifTrue: [ ^ self ]. - lastLocation := 0. - size := originalLocations first size. - originalLocations - do: [ :each | - each first <= lastLocation - ifTrue: [ self error: 'Cannot rename overlapping locations' ]. - lastLocation := each last. - each size ~= size - ifTrue: [ self error: 'Cannot rename items of different sizes' ] ] -] - -{ #category : #'private-validation' } -GtRenameAction >> validateVariable: aString [ - ^ RBScanner isVariable: aString -] diff --git a/src/GToolkit-Coder-AddOns/GtRenameAction2.class.st b/src/GToolkit-Coder-AddOns/GtRenameAction2.class.st deleted file mode 100644 index 580f6796c..000000000 --- a/src/GToolkit-Coder-AddOns/GtRenameAction2.class.st +++ /dev/null @@ -1,397 +0,0 @@ -Class { - #name : #GtRenameAction2, - #superclass : #Object, - #traits : 'TGtAnnouncer', - #classTraits : 'TGtAnnouncer classTrait', - #instVars : [ - 'announcer', - 'pharoSourceCoderViewModel', - 'originalLocations', - 'originalText', - 'isInstalled', - 'renameAttributes', - 'selectAll', - 'validationBlock', - 'filter', - 'originalCursors', - 'coderAttributes' - ], - #category : #'GToolkit-Coder-AddOns-Inline rename' -} - -{ #category : #'instance creation' } -GtRenameAction2 class >> locations: aCollectionOfIntervals textualCoderViewModel: aTextualCoderViewModel [ - ^ self new - locations: aCollectionOfIntervals; - pharoSourceCoderViewModel: aTextualCoderViewModel; - yourself -] - -{ #category : #actions } -GtRenameAction2 >> accept [ - self updateSource. - self uninstall. - self allowSave. - self announceEvent: #accept -] - -{ #category : #'private - attributes' } -GtRenameAction2 >> addRenameAttributes [ - | text cursorInLocation | - - text := self pharoSourceCoderViewModel styledText ifNil: [ self pharoSourceCoderViewModel sourceText ]. - - cursorInLocation := originalLocations - anySatisfy: [ :each | originalCursors anySatisfy: [ :eachCursor | eachCursor position between: each first - 1 and: each last ] ]. - - coderAttributes := originalLocations - collect: [ :each | - | attribute | - attribute := (cursorInLocation not - or: [ originalCursors anySatisfy: [ :eachCursor | eachCursor position between: each first - 1 and: each last ] ]) - ifTrue: [ - GtRenameEditorAttribute new - action: self; - selectAll: selectAll; - filter: filter; - text: (text from: each first to: each last) ] - ifFalse: [ - GtRenamePreviewAttribute new - action: self; - text: (text from: each first to: each last) ]. - cursorInLocation := true. - - self pharoSourceCoderViewModel - addTextAttribute: attribute - from: each first - to: each last ]. - - renameAttributes := coderAttributes flatCollect: [ :eachCoderAttribute | eachCoderAttribute textAttributes ]. - - self - assert: [ (renameAttributes select: [ :each | each isKindOf: GtRenameEditorAttribute ]) size <= 1 ] - description: [ 'There must not be more than one editor attribute' ] -] - -{ #category : #'private - actions' } -GtRenameAction2 >> allowSave [ - pharoSourceCoderViewModel allowSaveDueTo: self -] - -{ #category : #private } -GtRenameAction2 >> announceEvent: aSymbol [ - ^ self announce: (GtRenameActionAnnouncement for: self type: aSymbol) -] - -{ #category : #announcer } -GtRenameAction2 >> announcer [ - ^ announcer ifNil: [ announcer := Announcer new ] -] - -{ #category : #actions } -GtRenameAction2 >> cancel [ - self uninstall. - self undoChanges. - self allowSave. - self announceEvent: #cancel -] - -{ #category : #accessing } -GtRenameAction2 >> editor [ - ^ self editorAttribute editor -] - -{ #category : #accessing } -GtRenameAction2 >> editorAttribute [ - ^ renameAttributes notNil - ifTrue: [ renameAttributes - detect: [ :attr | attr isKindOf: GtRenameEditorAttribute ] - ifNone: [ ] ] -] - -{ #category : #private } -GtRenameAction2 >> filter: aTextEditorInputFilter [ - filter := aTextEditorInputFilter. - self primaryRenameAttribute - ifNotNil: [ :attr | attr filter: aTextEditorInputFilter ] -] - -{ #category : #'initialize-release' } -GtRenameAction2 >> forBinaryOrKeyword [ - validationBlock := [ :str | (self validateKeyword: str) or: [ self validateBinary: str ] ] -] - -{ #category : #'initialize-release' } -GtRenameAction2 >> forKeyword [ - validationBlock := [ :str | self validateKeyword: str ] -] - -{ #category : #'initialize-release' } -GtRenameAction2 >> forText [ - validationBlock := [ :str | true ]. - self filter: BrTextEditorNoInputFilter new -] - -{ #category : #'initialize-release' } -GtRenameAction2 >> forVariableOrUnaryMessage [ - validationBlock := [ :str | self validateVariable: str ]. - self filter: BrTextEditorAlphaNumericInputFilter new -] - -{ #category : #'initialize-release' } -GtRenameAction2 >> initialize [ - super initialize. - originalLocations := #(). - isInstalled := false. - selectAll := true. - filter := BrTextEditorNoInputFilter new. - - coderAttributes := #(). -] - -{ #category : #installation } -GtRenameAction2 >> install [ - originalLocations isEmpty - ifTrue: [ ^ self ]. - - self preventSave. - self saveOriginalState. - - self addRenameAttributes. - isInstalled := true. - - self announceEvent: #install -] - -{ #category : #testing } -GtRenameAction2 >> isInstalled [ - ^ isInstalled -] - -{ #category : #testing } -GtRenameAction2 >> isRenameAttribute: anAttribute [ - ^ anAttribute isKindOf: GtRenamePreviewAttribute -] - -{ #category : #'private-validation' } -GtRenameAction2 >> isValid [ - validationBlock isNil - ifTrue: [ ^ true ]. - ^ validationBlock value: self newName -] - -{ #category : #accessing } -GtRenameAction2 >> locations: aCollectionOfIntervals [ - originalLocations := aCollectionOfIntervals asSortedCollection: [ :a :b | a first < b first ]. - self validateLocations -] - -{ #category : #actions } -GtRenameAction2 >> lostFocus [ - self isValid - ifTrue: [ self accept ] - ifFalse: [ self cancel ] -] - -{ #category : #accessing } -GtRenameAction2 >> newName [ - ^ renameAttributes first text asString -] - -{ #category : #accessing } -GtRenameAction2 >> originalName [ - ^ (originalText - copyFrom: originalLocations first first - to: originalLocations first last) asString -] - -{ #category : #accessing } -GtRenameAction2 >> pharoSourceCoderViewModel [ - ^ pharoSourceCoderViewModel -] - -{ #category : #accessing } -GtRenameAction2 >> pharoSourceCoderViewModel: anObject [ - pharoSourceCoderViewModel := anObject -] - -{ #category : #'private - actions' } -GtRenameAction2 >> preventSave [ - pharoSourceCoderViewModel preventSaveDueTo: self -] - -{ #category : #'private - attributes' } -GtRenameAction2 >> primaryRenameAttribute [ - renameAttributes isNil - ifTrue: [ ^ nil ]. - ^ renameAttributes - detect: [ :each | each isEditorAttribute ] - ifNone: [ nil ] -] - -{ #category : #'private - attributes' } -GtRenameAction2 >> removeAttributeHandlers [ - renameAttributes do: [ :each | each uninstallEventHandlers ] -] - -{ #category : #'private - attributes' } -GtRenameAction2 >> removeAttributes [ - self pharoSourceCoderViewModel removeAllCoderTextAttributes: coderAttributes. - self removeAttributeHandlers -] - -{ #category : #actions } -GtRenameAction2 >> returnAccept [ - self isValid - ifFalse: [ ^ self ]. - self accept -] - -{ #category : #private } -GtRenameAction2 >> saveOriginalState [ - originalText := self pharoSourceCoderViewModel sourceText copy. - originalCursors := self pharoSourceCoderViewModel cursors copy -] - -{ #category : #accessing } -GtRenameAction2 >> selectAll [ - ^ selectAll -] - -{ #category : #accessing } -GtRenameAction2 >> selectAll: anObject [ - selectAll := anObject -] - -{ #category : #actions } -GtRenameAction2 >> tabAccept: forward [ - self isValid - ifFalse: [ ^ self ]. - self accept. - self - announceEvent: - (forward - ifTrue: [ #tab ] - ifFalse: [ #shiftTab ]) -] - -{ #category : #private } -GtRenameAction2 >> undoChanges [ - self pharoSourceCoderViewModel cursors: originalCursors -] - -{ #category : #installation } -GtRenameAction2 >> uninstall [ - self removeAttributes. - isInstalled := false. - self allowSave. - self announceEvent: #uninstall. - - pharoSourceCoderViewModel focused: true -] - -{ #category : #private } -GtRenameAction2 >> updateCursorLocation [ - | sizeDifference offset | - sizeDifference := self newName size - self originalName size. - offset := 0. - originalLocations - with: renameAttributes - do: [ :interval :attr | - attr isEditorAttribute - ifTrue: [ - | aNewCursorPosition | - - aNewCursorPosition := (interval first + offset + attr editorCursorLocation - 1 min: pharoSourceCoderViewModel sourceText size). - pharoSourceCoderViewModel moveCursorTo: aNewCursorPosition. - ^ self ]. - - offset := offset + sizeDifference ] -] - -{ #category : #actions } -GtRenameAction2 >> updateName: blText [ - renameAttributes do: [ :each | each updateText: blText ]. - self announceEvent: #textUpdated -] - -{ #category : #private } -GtRenameAction2 >> updateSource [ - self newName = self originalName - ifTrue: [ ^ self removeAttributes ]. - - self - updateSourceIn: self pharoSourceCoderViewModel - at: originalLocations - attributes: renameAttributes. - - self updateCursorLocation -] - -{ #category : #private } -GtRenameAction2 >> updateSourceIn: aTextualSourceCoderViewModel at: intervals attributes: attributeCollection [ - self - updateText: aTextualSourceCoderViewModel sourceText - at: intervals - attributes: attributeCollection -] - -{ #category : #private } -GtRenameAction2 >> updateText: text at: intervals attributes: attributeCollection [ - | newText index | - newText := '' asRopedText. - index := 1. - intervals - with: attributeCollection - do: [ :each :attr | - each first = 1 - ifTrue: [ newText := newText , attr text ] - ifFalse: [ newText := newText , (text copyFrom: index to: each first - 1) - , attr text ]. - index := each last + 1 ]. - index > text size - ifFalse: [ newText := newText , (text copyFrom: index to: text size) ]. - - self pharoSourceCoderViewModel - sourceText: newText - from: self - synchronously: false -] - -{ #category : #'private-validation' } -GtRenameAction2 >> validateBinary: aString [ - aString isEmpty - ifTrue: [ ^ false ]. - ^ (RBScanner isSelector: aString) and: [ aString asSymbol isBinary ] -] - -{ #category : #'private-validation' } -GtRenameAction2 >> validateKeyword: aString [ - aString isEmpty - ifTrue: [ ^ false ]. - aString last = $: - ifFalse: [ ^ false ]. - ^ (RBScanner isSelector: aString) - and: [ aString asSymbol numArgs = 1 ] -] - -{ #category : #private } -GtRenameAction2 >> validateLocations [ - | lastLocation size | - originalLocations isEmpty - ifTrue: [ ^ self ]. - lastLocation := 0. - size := originalLocations first size. - originalLocations - do: [ :each | - each first <= lastLocation - ifTrue: [ self error: 'Cannot rename overlapping locations' ]. - lastLocation := each last. - each size ~= size - ifTrue: [ self error: 'Cannot rename items of different sizes' ] ] -] - -{ #category : #'private-validation' } -GtRenameAction2 >> validateVariable: aString [ - ^ RBScanner isVariable: aString -] diff --git a/src/GToolkit-Coder-AddOns/GtRenameEditor.class.st b/src/GToolkit-Coder-AddOns/GtRenameEditor.class.st index 2c8d69fc9..915819285 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameEditor.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameEditor.class.st @@ -1,5 +1,11 @@ Class { #name : #GtRenameEditor, #superclass : #BrEditableLabel, - #category : 'GToolkit-Coder-AddOns-Inline rename' + #category : #'GToolkit-Coder-AddOns-Inline rename' } + +{ #category : #accessing } +GtRenameEditor >> initialize [ + super initialize. + self when: BlFocusEvent do: [ :anEvent | self switchToEditor ] +] diff --git a/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st b/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st index cd02cc4b8..76ffe7a67 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st @@ -5,7 +5,9 @@ Class { 'cursorLocation', 'selectAll', 'filter', - 'editorShortcuts' + 'editorShortcuts', + 'requestInitialFocus', + 'isForSelector' ], #category : #'GToolkit-Coder-AddOns-Inline rename' } @@ -23,31 +25,55 @@ GtRenameEditorAttribute >> cursorLocation: anInteger [ { #category : #accessing } GtRenameEditorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ renameEditor := GtRenameEditor new - fitContent; - aptitude: (BrGlamorousEditableLabelAptitude new defaultBackground: Color transparent; minWidth: 0); - padding: (BlInsets left: 2 right: 2); - margin: (BlInsets top: 0 left: -2 bottom: 0 right: -2); - inputFilter: filter; - switchToEditor; - text: text; - requestFocus. + fitContent; + aptitude: (BrGlamorousEditableLabelAptitude new + defaultBackground: Color transparent; + defaultBorder: (BlBorder paint: BrGlamorousColors editorBorderColor); + minWidth: 0); + padding: (BlInsets left: 2 right: 2); + margin: (BlInsets + top: 0 + left: -2 + bottom: 0 + right: -2); + inputFilter: filter; + text: text. + requestInitialFocus + ifTrue: [ renameEditor + switchToEditor; + requestFocus ] + ifFalse: [ renameEditor switchToLabel ]. + + isForSelector ifTrue: [ self setupArrowKeysOn: anEditorElement ]. + + renameEditor + whenKey: BlKeyCombination escape + editorDo: [ :aShortcutEvent | self renameAction cancel ]; + whenKey: BlKeyCombination builder shift tab build + editorDo: [ :aShortcutEvent | + (self focusNext: false in: anEditorElement) + ifFalse: [ self renameAction tabAccept: false ] ]; + whenKey: BlKeyCombination tab + editorDo: [ :aShortcutEvent | + (self focusNext: true in: anEditorElement) + ifFalse: [ self renameAction tabAccept: true ] ]; + whenKey: BlKeyCombination enter + editorDo: [ :aShortcutEvent | (self focusNext: true in: anEditorElement) ifFalse: [ self renameAction accept ] ]. + + renameEditor when: BrEditorCancelWish do: [ :event | self renameAction cancel ]. renameEditor editor when: BrTextEditorModifiedEvent do: [ :event | renameAction updateName: renameEditor editor text ]. - renameEditor - when: BlFocusOutEvent - do: [ :event | self updateFocus: event ]. - - renameEditor editor - moveCursorTo: ((cursorLocation ifNil: [ SmallInteger maxVal ]) - min: renameEditor editor text size). + renameEditor when: BlFocusOutEvent do: [ :event | self updateFocus: event ]. - selectAll - ifTrue: [ renameEditor editor selecter all select ]. + requestInitialFocus + ifTrue: [ renameEditor editor + moveCursorTo: ((cursorLocation ifNil: [ SmallInteger maxVal ]) + min: renameEditor editor text size) ]. + + selectAll ifTrue: [ renameEditor editor selecter all select ]. - renameEditor editor addEditorShortcuts: self editorShortcuts. - ^ renameEditor ] @@ -58,24 +84,6 @@ GtRenameEditorAttribute >> editorCursorLocation [ ^ text size ] -{ #category : #private } -GtRenameEditorAttribute >> editorShortcuts [ - ^ editorShortcuts - ifNil: [ editorShortcuts := { - (BlShortcutWithAction new - combination: BlKeyCombination escape; - action: [ :aShortcutEvent | self renameAction cancel ]). - (BlShortcutWithAction new - combination: BlKeyCombination builder shift tab build; - action: [ :aShortcutEvent | self renameAction tabAccept: false ]). - (BlShortcutWithAction new - combination: BlKeyCombination tab; - action: [ :aShortcutEvent | self renameAction tabAccept: true ]). - (BlShortcutWithAction new - combination: BlKeyCombination enter; - action: [ :aShortcutEvent | self renameAction accept ])} ] -] - { #category : #accessing } GtRenameEditorAttribute >> filter: aTextEditorInputFilter [ filter := aTextEditorInputFilter. @@ -83,13 +91,41 @@ GtRenameEditorAttribute >> filter: aTextEditorInputFilter [ ifTrue: [ renameEditor inputFilter: aTextEditorInputFilter ] ] +{ #category : #accessing } +GtRenameEditorAttribute >> focusNext: aBoolean in: anEditorElement [ + | first last previous | + isForSelector ifFalse: [ ^ false ]. + anEditorElement + allChildrenBreadthFirstDo: [ :each | + (each isKindOf: GtRenameEditor) + ifTrue: [ first ifNil: [ first := each ]. + last := each. + (aBoolean not and: [ each == renameEditor and: [ previous notNil ] ]) + ifTrue: [ previous requestFocus. + ^ true ]. + (aBoolean and: [ previous == renameEditor ]) + ifTrue: [ each requestFocus. + ^ true ]. + previous := each ] ]. + aBoolean + ifTrue: [ first + ifNotNil: [ first requestFocus. + ^ true ] ] + ifFalse: [ last + ifNotNil: [ last requestFocus. + ^ true ] ]. + ^ false +] + { #category : #initialization } GtRenameEditorAttribute >> initialize [ super initialize. filter := BrTextEditorNoInputFilter new. selectAll := false. - self cache: self newPooledCache + self cache: self newPooledCache. + requestInitialFocus := true. + isForSelector := false ] { #category : #testing } @@ -102,11 +138,31 @@ GtRenameEditorAttribute >> isFocusable [ ^ true ] +{ #category : #accessing } +GtRenameEditorAttribute >> isForSelector [ + ^ isForSelector +] + +{ #category : #accessing } +GtRenameEditorAttribute >> isForSelector: aBoolean [ + isForSelector := aBoolean +] + { #category : #accessing } GtRenameEditorAttribute >> renameAction [ ^ renameAction ] +{ #category : #accessing } +GtRenameEditorAttribute >> requestInitialFocus [ + ^ requestInitialFocus +] + +{ #category : #accessing } +GtRenameEditorAttribute >> requestInitialFocus: aBoolean [ + requestInitialFocus := aBoolean +] + { #category : #accessing } GtRenameEditorAttribute >> selectAll [ ^ selectAll @@ -117,10 +173,36 @@ GtRenameEditorAttribute >> selectAll: aBoolean [ selectAll := aBoolean ] -{ #category : #accessing } -GtRenameEditorAttribute >> uninstallEventHandlers [ - renameEditor notNil - ifTrue: [ renameEditor editor removeEditorShortcuts: self editorShortcuts ] +{ #category : #private } +GtRenameEditorAttribute >> setupArrowKeysOn: anEditorElement [ + renameEditor + whenKey: BlKeyCombination arrowRight + editorDo: [ :aShortcutEvent | + | cursors editor | + editor := aShortcutEvent source editor. + cursors := editor cursors positions. + (cursors includes: editor text size) + ifTrue: [ aShortcutEvent consumed: (self focusNext: true in: anEditorElement) ] + ifFalse: [ cursors notEmpty + ifTrue: [ editor selectNone. + editor moveCursorTo: cursors first + 1 ] ] ]. + renameEditor + whenKey: BlKeyCombination arrowLeft + editorDo: [ :aShortcutEvent | + | cursors editor | + editor := aShortcutEvent source editor. + cursors := editor cursors positions. + (cursors includes: 0) + ifTrue: [ aShortcutEvent consumed: (self focusNext: false in: anEditorElement) ] + ifFalse: [ cursors notEmpty + ifTrue: [ editor selectNone. + editor moveCursorTo: cursors first - 1 ] ] ]. + renameEditor + whenKey: BlKeyCombination arrowDown + editorDo: [ :aShortcutEvent | aShortcutEvent consumed: (self focusNext: true in: anEditorElement) ]. + renameEditor + whenKey: BlKeyCombination arrowUp + editorDo: [ :aShortcutEvent | aShortcutEvent consumed: (self focusNext: false in: anEditorElement) ] ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExtractMethodShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExtractMethodShortcut.class.st index 87823ed24..479a70704 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExtractMethodShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExtractMethodShortcut.class.st @@ -1,7 +1,7 @@ Class { #name : #GtSourceCoderExtractMethodShortcut, #superclass : #GtSourceCoderShortcut, - #category : 'GToolkit-Coder-UI-Shortcuts' + #category : #'GToolkit-Coder-UI-Shortcuts' } { #category : #accessing } @@ -23,5 +23,5 @@ GtSourceCoderExtractMethodShortcut >> name [ { #category : #evaluation } GtSourceCoderExtractMethodShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ - (GtExtractMethodController new sourceCoderViewModel: aSourceCoderViewModel) execute + (GtExtractMethodToComponentController new sourceCoderViewModel: aSourceCoderViewModel) execute ] From a51ea2ec53829cae75d8353a63bf85d354b4cdc5 Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 18 Oct 2022 15:30:56 -0500 Subject: [PATCH 0292/1268] fixing failing examples --- src/GToolkit-Coder-AddOns/GtRenameEditor.class.st | 6 +++++- src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-AddOns/GtRenameEditor.class.st b/src/GToolkit-Coder-AddOns/GtRenameEditor.class.st index 915819285..b8903ddf9 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameEditor.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameEditor.class.st @@ -7,5 +7,9 @@ Class { { #category : #accessing } GtRenameEditor >> initialize [ super initialize. - self when: BlFocusEvent do: [ :anEvent | self switchToEditor ] + self + when: BlFocusEvent + do: [ :anEvent | + self viewModel mode class = BrTextEditorReadonlyWithoutSelectionMode + ifTrue: [ self switchToEditor ] ] ] diff --git a/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st b/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st index 76ffe7a67..09194a93b 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st @@ -69,6 +69,7 @@ GtRenameEditorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElem requestInitialFocus ifTrue: [ renameEditor editor + selectNone; moveCursorTo: ((cursorLocation ifNil: [ SmallInteger maxVal ]) min: renameEditor editor text size) ]. From 9dbe03427c87b8095ec80ad65427ecee6db9aa57 Mon Sep 17 00:00:00 2001 From: John Brant Date: Wed, 19 Oct 2022 10:26:46 -0500 Subject: [PATCH 0293/1268] adding support for stylers in rename editor attributes --- .../GtRenameEditorAttribute.class.st | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st b/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st index 09194a93b..b2f725a04 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st @@ -7,7 +7,8 @@ Class { 'filter', 'editorShortcuts', 'requestInitialFocus', - 'isForSelector' + 'isForSelector', + 'styler' ], #category : #'GToolkit-Coder-AddOns-Inline rename' } @@ -38,6 +39,7 @@ GtRenameEditorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElem right: -2); inputFilter: filter; text: text. + styler ifNotNil: [ renameEditor styler: styler ]. requestInitialFocus ifTrue: [ renameEditor switchToEditor; @@ -206,6 +208,16 @@ GtRenameEditorAttribute >> setupArrowKeysOn: anEditorElement [ editorDo: [ :aShortcutEvent | aShortcutEvent consumed: (self focusNext: false in: anEditorElement) ] ] +{ #category : #accessing } +GtRenameEditorAttribute >> styler [ + ^ styler +] + +{ #category : #accessing } +GtRenameEditorAttribute >> styler: aBlTextStyler [ + styler := aBlTextStyler +] + { #category : #accessing } GtRenameEditorAttribute >> updateFocus: event [ renameAction isInstalled From 077d89513b9f26714a7d5b5e54e8eba1f2aeab6f Mon Sep 17 00:00:00 2001 From: John Brant Date: Thu, 20 Oct 2022 08:04:22 -0500 Subject: [PATCH 0294/1268] refactoring the refactoring controllers --- .../GtSourceCoderRefactoringController.class.st | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st b/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st index 0dd6d5d42..2c2638738 100644 --- a/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st +++ b/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st @@ -20,6 +20,18 @@ GtSourceCoderRefactoringController >> allowSave [ self sourceCoderViewModel allowSaveDueTo: self ] +{ #category : #accessing } +GtSourceCoderRefactoringController >> cancelRefactoring [ + self cleanUp. + self restoreText +] + +{ #category : #accessing } +GtSourceCoderRefactoringController >> cleanUp [ + self removeRefactoringAttribute. + self allowSave +] + { #category : #executing } GtSourceCoderRefactoringController >> execute [ [ @@ -62,7 +74,9 @@ GtSourceCoderRefactoringController >> refactoringName [ { #category : #'private - attributes' } GtSourceCoderRefactoringController >> removeRefactoringAttribute [ refactoringPreviewAttributes ifNil: [ ^ self ]. - self sourceCoderViewModel removeCoderTextAttributes: refactoringPreviewAttributes + self sourceCoderViewModel + removeCoderTextAttributes: refactoringPreviewAttributes. + refactoringPreviewAttributes := nil ] { #category : #private } From dbc7ed51f849e73a5b85a8267c917a3fe3df8384 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Mon, 24 Oct 2022 10:00:17 -0500 Subject: [PATCH 0295/1268] Fix for browsing classes without package tags [feenkcom/gtoolkit#2827] --- .../GtCoderNavigationPackagesTagsClassesElement.class.st | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index f0461c735..56e0276bc 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -393,7 +393,8 @@ GtCoderNavigationPackagesTagsClassesElement >> selectClass: aClass inPackage: aP (self selectedPackage ~= aPackage or: [ self selectedPackageTag ~= aPackageTag ]) ifTrue: [ self selectPackage: aPackage tag: aPackageTag ]. - self selectClass: aClass + self selectClass: aClass. + self updateProtocolList ] { #category : #'api - package selections' } @@ -569,8 +570,7 @@ GtCoderNavigationPackagesTagsClassesElement >> updatePackageLists [ { #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updateProtocolList [ | methodProtocols | - methodProtocolsList deselectAll. - + navigationModel hasSelectedClass ifTrue: [ | classProtocols | classProtocols := navigationModel selectedClass class organization protocols From a26a2339a0a901d86c0bc7aafb69ac4b0ca9e482 Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 25 Oct 2022 07:06:38 -0500 Subject: [PATCH 0296/1268] cancel extract when method is edited --- .../GtRenameEditorAttribute.class.st | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st b/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st index b2f725a04..b3dc74c2b 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st @@ -25,6 +25,7 @@ GtRenameEditorAttribute >> cursorLocation: anInteger [ { #category : #accessing } GtRenameEditorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ + | handlers | renameEditor := GtRenameEditor new fitContent; aptitude: (BrGlamorousEditableLabelAptitude new @@ -48,6 +49,15 @@ GtRenameEditorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElem isForSelector ifTrue: [ self setupArrowKeysOn: anEditorElement ]. + handlers := {BrTextEditorDeletedEvent. + BrTextEditorInsertedEvent} + collect: [ :each | BlEventHandler on: each do: [ :event | self renameAction cancel ] ]. + renameEditor + when: BlElementAddedToSceneGraphEvent + do: [ :anEvent | handlers do: [ :each | anEditorElement editor addEventHandler: each ] ]; + when: BlElementRemovedFromSceneGraphEvent + do: [ :anEvent | handlers do: [ :each | anEditorElement editor removeEventHandler: each ] ]. + renameEditor whenKey: BlKeyCombination escape editorDo: [ :aShortcutEvent | self renameAction cancel ]; From 79c2101c8855b82401f400cbf8034cf01db3ee0f Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 25 Oct 2022 09:22:38 -0500 Subject: [PATCH 0297/1268] return on last selector part opens extract preview --- src/GToolkit-Coder-AddOns/GtAbstractRenameAction.class.st | 5 +++++ src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-AddOns/GtAbstractRenameAction.class.st b/src/GToolkit-Coder-AddOns/GtAbstractRenameAction.class.st index 8e7093e31..3bcdc4f26 100644 --- a/src/GToolkit-Coder-AddOns/GtAbstractRenameAction.class.st +++ b/src/GToolkit-Coder-AddOns/GtAbstractRenameAction.class.st @@ -168,6 +168,11 @@ GtAbstractRenameAction >> primaryRenameAttribute [ ifNone: [ nil ] ] +{ #category : #actions } +GtAbstractRenameAction >> processReturnFor: renameEditor in: anEditorElement [ + self accept +] + { #category : #private } GtAbstractRenameAction >> removeAttributes [ self subclassResponsibility diff --git a/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st b/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st index b3dc74c2b..4b383fc1a 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st @@ -70,7 +70,7 @@ GtRenameEditorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElem (self focusNext: true in: anEditorElement) ifFalse: [ self renameAction tabAccept: true ] ]; whenKey: BlKeyCombination enter - editorDo: [ :aShortcutEvent | (self focusNext: true in: anEditorElement) ifFalse: [ self renameAction accept ] ]. + editorDo: [ :aShortcutEvent | self renameAction processReturnFor: renameEditor in: anEditorElement ]. renameEditor when: BrEditorCancelWish do: [ :event | self renameAction cancel ]. From 6c0c310951158a26abaccaf1a1f834d396673786 Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 25 Oct 2022 15:33:46 -0500 Subject: [PATCH 0298/1268] changing rename method to use the selector rename attributes --- .../GtTextualCoderEditorElement.class.st | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index d9c666013..4c9727223 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -149,15 +149,11 @@ GtTextualCoderEditorElement >> onCursorsChanged: aCursorsChangedAnnouncement [ { #category : #'private - event handling' } GtTextualCoderEditorElement >> onFocusChangedAnnouncement: anAnnouncement [ - self assertUIProcess. + anAnnouncement source == self ifTrue: [ ^ self ]. - anAnnouncement source == self - ifTrue: [ ^ self ]. - - anAnnouncement source == self textualCoderViewModel - ifFalse: [ ^ self ]. + anAnnouncement source == self textualCoderViewModel ifFalse: [ ^ self ]. - self onCoderViewModelFocused: anAnnouncement focused + self inUIProcessDo: [ self onCoderViewModelFocused: anAnnouncement focused ] ] { #category : #'private - event handling' } From 594974cec6f441550fced8c143786bafa728d19e Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Sun, 30 Oct 2022 22:16:28 -0500 Subject: [PATCH 0299/1268] Fix for initial display of class-side protocols [feenkcom/gtoolkit#2858] --- .../GtCoderNavigationPackagesTagsClassesElement.class.st | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 56e0276bc..feffe8649 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -570,12 +570,11 @@ GtCoderNavigationPackagesTagsClassesElement >> updatePackageLists [ { #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updateProtocolList [ | methodProtocols | - navigationModel hasSelectedClass ifTrue: [ | classProtocols | classProtocols := navigationModel selectedClass class organization protocols reject: [ :prot | - (self selectedClass class methods + (navigationModel selectedClass class methods select: [ :meth | (prot includesSelector: meth selector) and: [ meth isFromTrait not ] ]) isEmpty ]. methodProtocols := navigationModel selectedClass organization protocols From c68ae646327bd0ccab31876e5ca79c5f56a7a6b5 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Mon, 31 Oct 2022 15:32:07 -0500 Subject: [PATCH 0300/1268] Separate protocols into inst side/class side groups [feenkcom/gtoolkit#2858] --- ...igationPackagesTagsClassesElement.class.st | 99 +++++++++++++++---- 1 file changed, 81 insertions(+), 18 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index feffe8649..727dca57f 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -10,7 +10,8 @@ Class { 'coderFilterChangesSubscription', 'methodsLabel', 'methodGroup', - 'methodGroupList' + 'methodGroupList', + 'protocolGroup' ], #category : #'GToolkit-Coder-UI-Navigation' } @@ -41,8 +42,8 @@ GtCoderNavigationPackagesTagsClassesElement >> addPackage: aPackage tag: aPackag { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> buildMethodGroupList [ - | menu instanceGroup classGroup | - menu := BrGroupedList new + | list instanceGroup classGroup | + list := BrGroupedList new padding: (BlInsets left: 5 right: 10); matchParent; headerElementStencil: [ BrLabel new @@ -73,9 +74,48 @@ GtCoderNavigationPackagesTagsClassesElement >> buildMethodGroupList [ classGroup := instanceGroup copy domainObject: 'class side'. methodGroup := {instanceGroup. classGroup}. - menu groups: methodGroup. + list groups: methodGroup. - ^ menu + ^ list +] + +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> buildProtocolGroupList [ + | list instanceGroup classGroup | + list := BrGroupedList new + padding: (BlInsets left: 5 right: 10); + matchParent; + headerElementStencil: [ BrLabel new + beSmallSize; + aptitude: (BrGlamorousLabelAptitude new foreground: Color gray) ]; + headerDataBinder: [ :label :each | label text: each domainObject asRopedText ]. + + instanceGroup := BrGroup new + domainObject: 'instance side'; + stream: #() asAsyncStream; + itemStencil: [ | label | + label := BrLabel new + hMatchParent; + vFitContent; + beSmallSize; + aptitude: BrGlamorousLabelAptitude + BrGlamorousListItemAptitude + + (BrStyleCommonAptitude new + hovered: [ :aStyle | aStyle background: self theme item selectedColor ]); + when: BlClickEvent + do: [ :event | + event consumed: true. + self onProtocolListSelectionChanged": (label userData at: #protocol)" ] ]; + itemDataBinder: [ :label :item | + label text: item second name asRopedText. + label userData at: #protocol put: item. + label ]; + shouldShowWithoutItems: false. + classGroup := instanceGroup copy domainObject: 'class side'. + protocolGroup := {instanceGroup. + classGroup}. + list groups: protocolGroup. + + ^ list ] { #category : #'api - package selections' } @@ -124,8 +164,7 @@ GtCoderNavigationPackagesTagsClassesElement >> initializeContent [ packagesList := GtCoderNavigationPackagesTreeElement new padding: (BlInsets right: 10). - methodProtocolsList := GtCoderNavigationMethodProtocolListElement new - matchParent. + methodProtocolsList := self buildProtocolGroupList. classAndMethodProtocolList := BrVerticalPane new matchParent; @@ -213,7 +252,7 @@ GtCoderNavigationPackagesTagsClassesElement >> onMethodsCoderFiltersChanged: aGt methodProtocolsList selectedItemDo: [ :aSelectedItem | | aCategoryFilter | - aCategoryFilter := GtSearchMethodCategoryFilter forCategory: aSelectedItem. + aCategoryFilter := GtSearchMethodCategoryFilter forCategory: aSelectedItem name. aGtCodersFiltersChanged filters do: [ :eachFilter | eachFilter = aCategoryFilter ifTrue: [ @@ -310,15 +349,15 @@ GtCoderNavigationPackagesTagsClassesElement >> onProtocolListSelectionChanged [ theIndices := methodProtocolsList selectedIndices. theIndices ifEmpty: [ ^ self ]. anIndex := theIndices first. - (anIndex between: 1 and: methodProtocolsList viewModel itemCount) + (anIndex between: 1 and: methodProtocolsList viewModel entityCount) ifFalse: [ ^ self ]. - aSelectedItem := (methodProtocolsList viewModel itemAt: anIndex) value. - self navigationModel selectMethodProtocol: aSelectedItem source: self. - instMeths := (self selectedClass organization protocolNamed: aSelectedItem) + aSelectedItem := (methodProtocolsList viewModel entityAt: anIndex) value. + self navigationModel selectMethodProtocol: aSelectedItem object second source: self. + instMeths := (self selectedClass organization protocolNamed: aSelectedItem object second name) ifNotNil: [ :s | s methodSelectors collect: [ :sel | self selectedClass >> sel ] as: Array ] ifNil: [ #() ]. classMeths := (self selectedClass class organization - protocolNamed: aSelectedItem) + protocolNamed: aSelectedItem object second name) ifNotNil: [ :s | (s methodSelectors collect: [ :sel | self selectedClass class >> sel ] @@ -519,7 +558,7 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToPackageList [ GtCoderNavigationPackagesTagsClassesElement >> subscribeToProtocolList [ methodProtocolsList when: BrSelectionChanged - do: [ :anEvent | self onProtocolListSelectionChanged ]. + do: [ :anEvent | self onProtocolListSelectionChanged ] ] { #category : #'updating lists' } @@ -571,15 +610,21 @@ GtCoderNavigationPackagesTagsClassesElement >> updatePackageLists [ GtCoderNavigationPackagesTagsClassesElement >> updateProtocolList [ | methodProtocols | navigationModel hasSelectedClass - ifTrue: [ | classProtocols | + ifTrue: [ | classProtocols | classProtocols := navigationModel selectedClass class organization protocols reject: [ :prot | (navigationModel selectedClass class methods select: [ :meth | (prot includesSelector: meth selector) and: [ meth isFromTrait not ] ]) isEmpty ]. + classProtocols := classProtocols + collect: [ :each | + {#class. + each} ]. methodProtocols := navigationModel selectedClass organization protocols - , classProtocols. - methodProtocolsList initializeWithProtocols: methodProtocols. + collect: [ :each | + {#inst. + each} ]. + self updateProtocolListWith: methodProtocols and: classProtocols. methodProtocolsList visibility: BlVisibility visible. self updateMethodListWith: navigationModel selectedClass methods @@ -588,7 +633,7 @@ GtCoderNavigationPackagesTagsClassesElement >> updateProtocolList [ methodsLabel visibility: BlVisibility visible. protocolLabel visibility: BlVisibility visible ] - ifFalse: [ methodProtocolsList initializeWithProtocols: Array empty. + ifFalse: [ self updateProtocolListWith: #() and: #(). self updateMethodListWith: #() and: #(). protocolLabel visibility: BlVisibility hidden. @@ -596,6 +641,24 @@ GtCoderNavigationPackagesTagsClassesElement >> updateProtocolList [ methodsLabel visibility: BlVisibility hidden ] ] +{ #category : #'updating lists' } +GtCoderNavigationPackagesTagsClassesElement >> updateProtocolListWith: instanceProtocols and: classProtocols [ + | instStream classStream | + methodProtocolsList deselectAll. + instStream := instanceProtocols + asSortedCollection: [ :a :b | a second name < b second name ]. + + classStream := classProtocols + asSortedCollection: [ :a :b | a second name < b second name ]. + + protocolGroup + with: {instStream. + classStream} + do: [ :grp :str | grp items: str ]. + + methodProtocolsList groups: protocolGroup +] + { #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updateSelectedPackageAndTag [ self hasNavigationModel ifFalse: [ ^ self ]. From 773d2d4834081a7057d7015c5369b13a4957e5ba Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 1 Nov 2022 07:38:30 -0500 Subject: [PATCH 0301/1268] Refactor to clean up implementation [feenkcom/gtoolkit#2858] --- ...vigationMethodProtocolListElement.class.st | 56 --------- ...igationPackagesTagsClassesElement.class.st | 115 ++++++++---------- 2 files changed, 48 insertions(+), 123 deletions(-) delete mode 100644 src/GToolkit-Coder-UI/GtCoderNavigationMethodProtocolListElement.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationMethodProtocolListElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationMethodProtocolListElement.class.st deleted file mode 100644 index 726e45084..000000000 --- a/src/GToolkit-Coder-UI/GtCoderNavigationMethodProtocolListElement.class.st +++ /dev/null @@ -1,56 +0,0 @@ -Class { - #name : #GtCoderNavigationMethodProtocolListElement, - #superclass : #BrSimpleList, - #category : #'GToolkit-Coder-UI-Navigation' -} - -{ #category : #'private - ui' } -GtCoderNavigationMethodProtocolListElement >> buildProtocolLabel: aProtocol [ - ^ BrLabel new - aptitude: BrGlamorousLabelAptitude; - beSmallSize; - text: aProtocol -] - -{ #category : #'private - ui' } -GtCoderNavigationMethodProtocolListElement >> buildProtocolRow: aProtocol index: aRowIndex list: aListElement [ - ^ BrWidgetContainer new - layout: BlLinearLayout horizontal; - aptitude: - BrHorizontalPaneAptitude new - + - (BrStyleCommonAptitude new - default: - [ :aStyle | aStyle background: self theme item deselectedColor ]; - hovered: - [ :aStyle | aStyle background: self theme item hoveredColor ]; - selected: - [ :aStyle | aStyle background: self theme item selectedColor ]; - pressed: - [ :aStyle | aStyle background: self theme item pressedColor ]; - focused: [ :aStyle | - aStyle - border: (BlBorder paint: self theme item focusedBorderColor width: 1) ]); - when: BlMouseDownEvent - do: [ :anEvent | - anEvent consumed: true. - aListElement selectOne: aRowIndex dueTo: anEvent. - aListElement requestFocus ]; - hMatchParent; - vFitContent; - padding: (BlInsets left: 3); - addChild: (self buildProtocolLabel: aProtocol) -] - -{ #category : #initialization } -GtCoderNavigationMethodProtocolListElement >> initialize [ - super initialize. - self stencil: [ :eachProtocol :eachIndex :aListElement | self buildProtocolRow: eachProtocol index: eachIndex list: aListElement ] -] - -{ #category : #initialization } -GtCoderNavigationMethodProtocolListElement >> initializeWithProtocols: aCollection [ - | names | - names := (aCollection collect: #name) asSet sorted. - self items: names -] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 727dca57f..64f0b8929 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -41,16 +41,19 @@ GtCoderNavigationPackagesTagsClassesElement >> addPackage: aPackage tag: aPackag ] { #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> buildMethodGroupList [ - | list instanceGroup classGroup | - list := BrGroupedList new - padding: (BlInsets left: 5 right: 10); - matchParent; - headerElementStencil: [ BrLabel new - beSmallSize; - aptitude: (BrGlamorousLabelAptitude new foreground: Color gray) ]; - headerDataBinder: [ :label :each | label text: each domainObject asRopedText ]. +GtCoderNavigationPackagesTagsClassesElement >> buildGroupList [ + ^ BrGroupedList new + padding: (BlInsets left: 5 right: 10); + matchParent; + headerElementStencil: [ BrLabel new + beSmallSize; + aptitude: (BrGlamorousLabelAptitude new foreground: Color gray) ]; + headerDataBinder: [ :label :each | label text: each domainObject asRopedText ] +] +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> buildGroupWithBinder: binderBlock onClick: clickBlock [ + | classGroup instanceGroup | instanceGroup := BrGroup new domainObject: 'instance side'; stream: #() asAsyncStream; @@ -62,59 +65,44 @@ GtCoderNavigationPackagesTagsClassesElement >> buildMethodGroupList [ aptitude: BrGlamorousLabelAptitude + BrGlamorousListItemAptitude + (BrStyleCommonAptitude new hovered: [ :aStyle | aStyle background: self theme item selectedColor ]); - when: BlClickEvent - do: [ :event | - event consumed: true. - self onMethodListSelectionChanged: (label userData at: #method) ] ]; - itemDataBinder: [ :label :item | - label text: item selector asRopedText. - label userData at: #method put: item. - label ]; + when: BlClickEvent do: clickBlock ]; + itemDataBinder: binderBlock; shouldShowWithoutItems: false. classGroup := instanceGroup copy domainObject: 'class side'. - methodGroup := {instanceGroup. - classGroup}. - list groups: methodGroup. + ^ {instanceGroup. + classGroup} +] +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> buildMethodGroupList [ + | list | + list := self buildGroupList. + methodGroup := self + buildGroupWithBinder: [ :label :item | + label text: item selector asRopedText. + label userData at: #method put: item. + label ] + onClick: [ :event | + event consumed: true. + self + onMethodListSelectionChanged: (event currentTarget userData at: #method) ]. + list groups: methodGroup. ^ list ] { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> buildProtocolGroupList [ - | list instanceGroup classGroup | - list := BrGroupedList new - padding: (BlInsets left: 5 right: 10); - matchParent; - headerElementStencil: [ BrLabel new - beSmallSize; - aptitude: (BrGlamorousLabelAptitude new foreground: Color gray) ]; - headerDataBinder: [ :label :each | label text: each domainObject asRopedText ]. - - instanceGroup := BrGroup new - domainObject: 'instance side'; - stream: #() asAsyncStream; - itemStencil: [ | label | - label := BrLabel new - hMatchParent; - vFitContent; - beSmallSize; - aptitude: BrGlamorousLabelAptitude + BrGlamorousListItemAptitude - + (BrStyleCommonAptitude new - hovered: [ :aStyle | aStyle background: self theme item selectedColor ]); - when: BlClickEvent - do: [ :event | - event consumed: true. - self onProtocolListSelectionChanged": (label userData at: #protocol)" ] ]; - itemDataBinder: [ :label :item | - label text: item second name asRopedText. + | list | + list := self buildGroupList. + protocolGroup := self + buildGroupWithBinder: [ :label :item | + label text: item name asRopedText. label userData at: #protocol put: item. - label ]; - shouldShowWithoutItems: false. - classGroup := instanceGroup copy domainObject: 'class side'. - protocolGroup := {instanceGroup. - classGroup}. + label ] + onClick: [ :event | + event consumed: true. + self onProtocolListSelectionChanged ]. list groups: protocolGroup. - ^ list ] @@ -351,13 +339,13 @@ GtCoderNavigationPackagesTagsClassesElement >> onProtocolListSelectionChanged [ anIndex := theIndices first. (anIndex between: 1 and: methodProtocolsList viewModel entityCount) ifFalse: [ ^ self ]. - aSelectedItem := (methodProtocolsList viewModel entityAt: anIndex) value. - self navigationModel selectMethodProtocol: aSelectedItem object second source: self. - instMeths := (self selectedClass organization protocolNamed: aSelectedItem object second name) + aSelectedItem := (methodProtocolsList viewModel entityAt: anIndex) value object. + self navigationModel selectMethodProtocol: aSelectedItem source: self. + instMeths := (self selectedClass organization protocolNamed: aSelectedItem name) ifNotNil: [ :s | s methodSelectors collect: [ :sel | self selectedClass >> sel ] as: Array ] ifNil: [ #() ]. classMeths := (self selectedClass class organization - protocolNamed: aSelectedItem object second name) + protocolNamed: aSelectedItem name) ifNotNil: [ :s | (s methodSelectors collect: [ :sel | self selectedClass class >> sel ] @@ -610,20 +598,13 @@ GtCoderNavigationPackagesTagsClassesElement >> updatePackageLists [ GtCoderNavigationPackagesTagsClassesElement >> updateProtocolList [ | methodProtocols | navigationModel hasSelectedClass - ifTrue: [ | classProtocols | + ifTrue: [ | classProtocols | classProtocols := navigationModel selectedClass class organization protocols reject: [ :prot | (navigationModel selectedClass class methods select: [ :meth | (prot includesSelector: meth selector) and: [ meth isFromTrait not ] ]) isEmpty ]. - classProtocols := classProtocols - collect: [ :each | - {#class. - each} ]. - methodProtocols := navigationModel selectedClass organization protocols - collect: [ :each | - {#inst. - each} ]. + methodProtocols := navigationModel selectedClass organization protocols. self updateProtocolListWith: methodProtocols and: classProtocols. methodProtocolsList visibility: BlVisibility visible. self @@ -646,10 +627,10 @@ GtCoderNavigationPackagesTagsClassesElement >> updateProtocolListWith: instanceP | instStream classStream | methodProtocolsList deselectAll. instStream := instanceProtocols - asSortedCollection: [ :a :b | a second name < b second name ]. + asSortedCollection: [ :a :b | a name < b name ]. classStream := classProtocols - asSortedCollection: [ :a :b | a second name < b second name ]. + asSortedCollection: [ :a :b | a name < b name ]. protocolGroup with: {instStream. From fc182ae4cb8bbfbacf5939966efc7aa262152984 Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 1 Nov 2022 13:35:07 -0500 Subject: [PATCH 0302/1268] adding method object refactoring --- .../GtRenameEditorAttribute.class.st | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st b/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st index 4b383fc1a..157aa5ee9 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st @@ -7,8 +7,8 @@ Class { 'filter', 'editorShortcuts', 'requestInitialFocus', - 'isForSelector', - 'styler' + 'styler', + 'coordinateFocus' ], #category : #'GToolkit-Coder-AddOns-Inline rename' } @@ -18,6 +18,16 @@ GtRenameEditorAttribute >> additionalAttributes [ ^ {BlFontFamilyAttribute named: 'Source Code Pro'} ] +{ #category : #accessing } +GtRenameEditorAttribute >> coordinateFocus [ + ^ coordinateFocus +] + +{ #category : #accessing } +GtRenameEditorAttribute >> coordinateFocus: aBoolean [ + coordinateFocus := aBoolean +] + { #category : #accessing } GtRenameEditorAttribute >> cursorLocation: anInteger [ cursorLocation := anInteger @@ -47,7 +57,7 @@ GtRenameEditorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElem requestFocus ] ifFalse: [ renameEditor switchToLabel ]. - isForSelector ifTrue: [ self setupArrowKeysOn: anEditorElement ]. + coordinateFocus ifTrue: [ self setupArrowKeysOn: anEditorElement ]. handlers := {BrTextEditorDeletedEvent. BrTextEditorInsertedEvent} @@ -107,7 +117,7 @@ GtRenameEditorAttribute >> filter: aTextEditorInputFilter [ { #category : #accessing } GtRenameEditorAttribute >> focusNext: aBoolean in: anEditorElement [ | first last previous | - isForSelector ifFalse: [ ^ false ]. + coordinateFocus ifFalse: [ ^ false ]. anEditorElement allChildrenBreadthFirstDo: [ :each | (each isKindOf: GtRenameEditor) @@ -138,7 +148,7 @@ GtRenameEditorAttribute >> initialize [ selectAll := false. self cache: self newPooledCache. requestInitialFocus := true. - isForSelector := false + coordinateFocus := false ] { #category : #testing } @@ -151,16 +161,6 @@ GtRenameEditorAttribute >> isFocusable [ ^ true ] -{ #category : #accessing } -GtRenameEditorAttribute >> isForSelector [ - ^ isForSelector -] - -{ #category : #accessing } -GtRenameEditorAttribute >> isForSelector: aBoolean [ - isForSelector := aBoolean -] - { #category : #accessing } GtRenameEditorAttribute >> renameAction [ ^ renameAction From 86b628100657064117b9f596536be23357663a79 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 2 Nov 2022 07:33:33 -0500 Subject: [PATCH 0303/1268] Fix rogue selection after extract method --- .../GtTextualCoderEditorElement.class.st | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 4c9727223..d8dd254ce 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -296,21 +296,20 @@ GtTextualCoderEditorElement >> onViewModelReadyToStyle [ GtTextualCoderEditorElement >> onViewModelSelectionChanged: aSelectionChangedAnnouncement [ "Is sent when the selection changes in the View Model. May be sent from a non-UI thread" - + "if the source of the announcement is myself, do nothing to break the change cycle" - aSelectionChangedAnnouncement source = self - ifTrue: [ ^ self ]. - + + aSelectionChangedAnnouncement source = self ifTrue: [ ^ self ]. + aSelectionChangedAnnouncement source == self textualCoderViewModel ifFalse: [ ^ self ]. - "since it may be sent from a non-UI process make sure to wrap in the action" - self enqueueTask: (BlTaskAction new action: [ - self deselecter all deselect. - self selecter - withoutCursorUpdate; - all: aSelectionChangedAnnouncement selection; - select ]) + self + inUIProcessDo: [ self deselecter all deselect. + self selecter + withoutCursorUpdate; + all: aSelectionChangedAnnouncement selection; + select ] ] { #category : #'private - event handling' } From 576073398be0c71a9ec5c8cf8a9c28edec9af177 Mon Sep 17 00:00:00 2001 From: John Brant Date: Fri, 4 Nov 2022 07:08:57 -0500 Subject: [PATCH 0304/1268] updating rename instance variable to work more like rename method --- .../GtCoderViewModelRenameAction.class.st | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtCoderViewModelRenameAction.class.st b/src/GToolkit-Coder-AddOns/GtCoderViewModelRenameAction.class.st index 1375bbbc3..75a0de02b 100644 --- a/src/GToolkit-Coder-AddOns/GtCoderViewModelRenameAction.class.st +++ b/src/GToolkit-Coder-AddOns/GtCoderViewModelRenameAction.class.st @@ -4,7 +4,8 @@ Class { #instVars : [ 'pharoSourceCoderViewModel', 'originalCursors', - 'coderAttributes' + 'coderAttributes', + 'hasRefactoringPreview' ], #category : #'GToolkit-Coder-AddOns-Inline rename' } @@ -36,6 +37,7 @@ GtCoderViewModelRenameAction >> addRenameAttributes [ action: self; selectAll: selectAll; filter: filter; + coordinateFocus: hasRefactoringPreview; text: (text from: each first to: each last) ] ifFalse: [ GtRenamePreviewAttribute new @@ -60,10 +62,27 @@ GtCoderViewModelRenameAction >> allowSave [ pharoSourceCoderViewModel allowSaveDueTo: self ] +{ #category : #accessing } +GtCoderViewModelRenameAction >> hasRefactoringPreview [ + ^ hasRefactoringPreview +] + +{ #category : #accessing } +GtCoderViewModelRenameAction >> hasRefactoringPreview: aBoolean [ + hasRefactoringPreview := aBoolean +] + { #category : #'initialize-release' } GtCoderViewModelRenameAction >> initialize [ super initialize. - coderAttributes := #() + coderAttributes := #(). + hasRefactoringPreview := false +] + +{ #category : #accessing } +GtCoderViewModelRenameAction >> lostFocus [ + hasRefactoringPreview ifTrue: [ ^ self ]. + ^ super lostFocus ] { #category : #accessing } From 2caf9f073422766f349a2d52cca77c4d56146235 Mon Sep 17 00:00:00 2001 From: Andrei Chis Date: Tue, 15 Nov 2022 17:57:20 +0100 Subject: [PATCH 0305/1268] Add views for filter descriptors --- .../GtFilterDescriptor.class.st | 17 +++++++++++++++++ src/GToolkit-Coder-UI/GtFiltersElement.class.st | 15 +++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st b/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st index 0c31864ab..1faa6e0a8 100644 --- a/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st +++ b/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st @@ -112,6 +112,18 @@ GtFilterDescriptor >> gtCompletionsFor: aView [ view: #gtCompletionsFor: ] +{ #category : #'gt - extensions' } +GtFilterDescriptor >> gtViewFilterBlockFor: aView [ + + + creationBlock ifNil: [ ^ aView empty ]. + + ^ aView forward + title: 'Filter Creation Block'; + object: [ creationBlock ]; + view: #gtSourceCodeFor: +] + { #category : #comparing } GtFilterDescriptor >> hash [ ^ self class hash hashMultiply bitXor: self name hash @@ -124,6 +136,11 @@ GtFilterDescriptor >> initialize [ isDefault := true. ] +{ #category : #testing } +GtFilterDescriptor >> isDefault [ + ^ isDefault +] + { #category : #accessing } GtFilterDescriptor >> name [ ^ name diff --git a/src/GToolkit-Coder-UI/GtFiltersElement.class.st b/src/GToolkit-Coder-UI/GtFiltersElement.class.st index e5ef2f21a..9bf42f094 100644 --- a/src/GToolkit-Coder-UI/GtFiltersElement.class.st +++ b/src/GToolkit-Coder-UI/GtFiltersElement.class.st @@ -127,6 +127,21 @@ GtFiltersElement >> filtersDo: aBlock [ value: filterTagElement valueString ] ] ] +{ #category : #accessing } +GtFiltersElement >> gtViewDefaultDescriptorsFor: aView [ + + + ^ aView columnedList + title: 'Descriptors'; + items: [ self descriptors ]; + column: 'Name' text: [ :aDescriptor | aDescriptor name ]; + column: 'Order' text: [ :aDescriptor | aDescriptor order ]; + column: 'Is Default' text: [ :aDescriptor | aDescriptor isDefault ]; + column: 'Is Required' text: [ :aDescriptor | aDescriptor valueIsRequired ]; + column: 'Empty Value' text: [ :aDescriptor | aDescriptor emptyDefaultValue ]; + column: 'Show Empty Default' text: [ :aDescriptor | aDescriptor showAsDefaultWhenEmpty ] +] + { #category : #initialization } GtFiltersElement >> initialize [ super initialize. From bb089dfcc0e359ed8231abc5d16f8dc0e7b71087 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 15 Nov 2022 14:36:46 -0300 Subject: [PATCH 0306/1268] add `GtSharedVariablesBindings>>#removeBindingOf:` [feenkcom/gtoolkit#2875] --- .../GtSharedVariablesBindings.class.st | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-VariableBindings/GtSharedVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtSharedVariablesBindings.class.st index 1abc054a9..1c7d33990 100644 --- a/src/GToolkit-VariableBindings/GtSharedVariablesBindings.class.st +++ b/src/GToolkit-VariableBindings/GtSharedVariablesBindings.class.st @@ -6,7 +6,7 @@ Class { #instVars : [ 'bindings' ], - #category : 'GToolkit-VariableBindings-Bindings' + #category : #'GToolkit-VariableBindings-Bindings' } { #category : #comparing } @@ -63,3 +63,10 @@ GtSharedVariablesBindings >> initialize [ bindings := Dictionary new ] + +{ #category : #binding } +GtSharedVariablesBindings >> removeBindingOf: aSymbol [ + + + ^ bindings removeKey: aSymbol ifAbsent: [ "ignore" ] +] From 09db9047fea8750dfbe5dfad9611772fe25676e9 Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 15 Nov 2022 14:50:03 -0600 Subject: [PATCH 0307/1268] changing error attribute to a dropdown --- .../GtSourceCoderErrorAttribute.class.st | 72 ++++++++++++++----- 1 file changed, 53 insertions(+), 19 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st index 057c48f81..d6addafce 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st @@ -2,7 +2,8 @@ Class { #name : #GtSourceCoderErrorAttribute, #superclass : #BrTextAdornmentAttribute, #instVars : [ - 'string' + 'string', + 'openOnFirstShow' ], #category : #'GToolkit-Coder-UI-Coder - Source Attributes' } @@ -18,27 +19,60 @@ GtSourceCoderErrorAttribute class >> for: aString [ { #category : #accessing } GtSourceCoderErrorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ - | text element | - text := string asRopedText - foreground: BrGlamorousColors defaultButtonTextColor; - medium; - glamorousCodeFontAndSmallSize. - element := BlTextElement new - text: text; - background: (BrGlamorousColors errorBackgroundColor alpha: 0.4); - padding: (BlInsets - top: 3 - left: 0 - bottom: 3 - right: 0); - margin: (BlInsets left: 2 right: 2); - yourself. - element userData at: #sourceError put: true. - - ^ element + | text button aptitude | + button := self errorButton. + button + addAptitude: (aptitude := BrGlamorousWithDropdownAptitude + handle: [ self errorButton ] + content: [ text := string asRopedText + medium; + glamorousCodeFontAndSmallSize. + BlTextElement new + text: text; + background: BrGlamorousColors errorBackgroundColor; + padding: (BlInsets all: 10); + yourself ] + aptitudeDo: [ :look | + look + allActorsDepthFirstDo: [ :each | + (each isKindOf: BrGlamorousAnchoredAptitude) + ifTrue: [ each + addChangeProperty: #(widget border) + with: [ BlBorder paint: BrGlamorousColors errorBackgroundColor asBlPaint width: 1 ] ] ]. + look background: BrGlamorousColors errorBackgroundColor ]). + openOnFirstShow ifTrue: [ button enqueueTask: [ aptitude show ] asBlTask ]. + + ^ button +] + +{ #category : #accessing } +GtSourceCoderErrorAttribute >> errorButton [ + ^ BrButton new + aptitude: (BrInteractiveCommonAptitude new + default: [ :aWidget | aWidget background: BrGlamorousColors errorBackgroundColor ]); + size: 8 @ 8; + geometry: BlEllipseGeometry new; + padding: (BlInsets left: 2 right: 2); + yourself ] { #category : #'initialize-release' } GtSourceCoderErrorAttribute >> for: aString [ string := aString ] + +{ #category : #accessing } +GtSourceCoderErrorAttribute >> initialize [ + super initialize. + openOnFirstShow := true +] + +{ #category : #accessing } +GtSourceCoderErrorAttribute >> openOnFirstShow [ + ^ openOnFirstShow +] + +{ #category : #accessing } +GtSourceCoderErrorAttribute >> openOnFirstShow: aBoolean [ + openOnFirstShow := aBoolean +] From 5818dd4c48e9eb512bbc818fdc5387e3699aa95e Mon Sep 17 00:00:00 2001 From: John Brant Date: Wed, 16 Nov 2022 07:01:01 -0600 Subject: [PATCH 0308/1268] closing/clicking interaction with error drop down --- .../GtSourceCoderErrorAttribute.class.st | 49 +++++++++++++++---- .../GtTextualCoderEditorElement.class.st | 17 ++++--- 2 files changed, 49 insertions(+), 17 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st index d6addafce..0e1bc98dc 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st @@ -3,7 +3,8 @@ Class { #superclass : #BrTextAdornmentAttribute, #instVars : [ 'string', - 'openOnFirstShow' + 'openOnFirstShow', + 'clickAction' ], #category : #'GToolkit-Coder-UI-Coder - Source Attributes' } @@ -17,6 +18,16 @@ GtSourceCoderErrorAttribute class >> for: aString [ yourself ] +{ #category : #accessing } +GtSourceCoderErrorAttribute >> clickAction [ + ^ clickAction +] + +{ #category : #accessing } +GtSourceCoderErrorAttribute >> clickAction: aBlock [ + clickAction := aBlock +] + { #category : #accessing } GtSourceCoderErrorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ | text button aptitude | @@ -24,14 +35,30 @@ GtSourceCoderErrorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditor button addAptitude: (aptitude := BrGlamorousWithDropdownAptitude handle: [ self errorButton ] - content: [ text := string asRopedText + content: [ | textElement | + text := string asRopedText medium; glamorousCodeFontAndSmallSize. - BlTextElement new - text: text; - background: BrGlamorousColors errorBackgroundColor; - padding: (BlInsets all: 10); - yourself ] + textElement := BlTextElement new. + textElement text: text. + textElement background: BrGlamorousColors errorBackgroundColor. + textElement padding: (BlInsets all: 10). + textElement + when: BlClickEvent + do: [ :event | clickAction cull: anEditorElement cull: aptitude hide ]. + {BlKeyCombination escape. + BlKeyCombination enter. + BlKeyCombination backspace} + do: [ :each | + textElement + addShortcut: (BlShortcutWithAction new + combination: each; + repeatable: false; + action: [ :element | + aptitude hide. + anEditorElement requestFocus ]) ]. + textElement enqueueTask: [ textElement requestFocus ] asBlTask. + textElement ] aptitudeDo: [ :look | look allActorsDepthFirstDo: [ :each | @@ -40,7 +67,10 @@ GtSourceCoderErrorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditor addChangeProperty: #(widget border) with: [ BlBorder paint: BrGlamorousColors errorBackgroundColor asBlPaint width: 1 ] ] ]. look background: BrGlamorousColors errorBackgroundColor ]). - openOnFirstShow ifTrue: [ button enqueueTask: [ aptitude show ] asBlTask ]. + openOnFirstShow + ifTrue: [ button + enqueueTask: [ openOnFirstShow := false. + aptitude show ] asBlTask ]. ^ button ] @@ -64,7 +94,8 @@ GtSourceCoderErrorAttribute >> for: aString [ { #category : #accessing } GtSourceCoderErrorAttribute >> initialize [ super initialize. - openOnFirstShow := true + openOnFirstShow := true. + clickAction := [ :textElement :dropDownAptitude | ] ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index d8dd254ce..8ed7a2b5c 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -427,17 +427,18 @@ GtTextualCoderEditorElement >> registerCoderViewModelAnnouncementsFor: aGtSource { #category : #private } GtTextualCoderEditorElement >> reportParseError: aString at: anInteger [ - | text position | - + | text position error | text := self editor text. - + position := anInteger - 1 max: 1. - text size < position - ifTrue: [ ^ self ]. - + text size < position ifTrue: [ ^ self ]. + text clearAttributesOfClass: GtSourceCoderErrorAttribute. - text - attribute: (GtSourceCoderErrorAttribute for: aString) + error := (aString endsWith: '->') + ifTrue: [ aString allButLast: 2 ] + ifFalse: [ aString ]. + text + attribute: (GtSourceCoderErrorAttribute for: error) from: position to: position ] From d7ce12d52ec4984a9e480f691c2b69365bc3b089 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Thu, 17 Nov 2022 22:03:30 +0100 Subject: [PATCH 0309/1268] Add GtFilterDescriptor>>#creationBlock accessor --- src/GToolkit-Coder-UI/GtFilterDescriptor.class.st | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st b/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st index 1faa6e0a8..07d50a85a 100644 --- a/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st +++ b/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st @@ -80,6 +80,11 @@ GtFilterDescriptor >> completion: completionStrategyBlock [ completionBlock := completionStrategyBlock ] +{ #category : #accessing } +GtFilterDescriptor >> creationBlock [ + ^ creationBlock +] + { #category : #accessing } GtFilterDescriptor >> creationBlock: aBlock [ creationBlock := aBlock From 844b49ba8916f2e7593dddfea6451640044a0469 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 28 Nov 2022 13:21:55 +0100 Subject: [PATCH 0310/1268] [feenkcom/gtoolkit#2919] improve filter tag widget --- .../GtFilterDescriptorExamples.class.st | 50 +++ .../GtFilterTagElementExamples.class.st | 329 ++++++++++++++ .../GtFilterDescriptor.class.st | 133 ++++-- .../GtFilterTagEditorId.class.st | 10 + .../GtFilterTagElement.class.st | 406 +++++++++++------- .../GtFilterTagLabelId.class.st | 10 + .../GtFilterTagPickerId.class.st | 10 + .../GtFilterTagPickerItemId.class.st | 10 + .../GtFilterTagRemoveWish.class.st | 5 + .../GtFilterTagReplaceWish.class.st | 20 + .../GtFilterTagUpdateWish.class.st | 20 + .../GtFilterTagWish.class.st | 20 + .../GtFiltersElement.class.st | 47 +- 13 files changed, 862 insertions(+), 208 deletions(-) create mode 100644 src/GToolkit-Coder-Examples/GtFilterDescriptorExamples.class.st create mode 100644 src/GToolkit-Coder-Examples/GtFilterTagElementExamples.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterTagEditorId.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterTagLabelId.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterTagPickerId.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterTagPickerItemId.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterTagRemoveWish.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterTagReplaceWish.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterTagUpdateWish.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterTagWish.class.st diff --git a/src/GToolkit-Coder-Examples/GtFilterDescriptorExamples.class.st b/src/GToolkit-Coder-Examples/GtFilterDescriptorExamples.class.st new file mode 100644 index 000000000..79b90b328 --- /dev/null +++ b/src/GToolkit-Coder-Examples/GtFilterDescriptorExamples.class.st @@ -0,0 +1,50 @@ +Class { + #name : #GtFilterDescriptorExamples, + #superclass : #Object, + #category : #'GToolkit-Coder-Examples-Filters' +} + +{ #category : #examples } +GtFilterDescriptorExamples >> filterDescriptorValueNotRequired [ + + | aFilterDescriptor | + + aFilterDescriptor := self newFilterDescriptor + valueNotRequired. + + self assert: aFilterDescriptor name equals: 'No name'. + self assert: aFilterDescriptor order equals: 1. + self assert: aFilterDescriptor completion equals: nil. + self assert: aFilterDescriptor valueIsRequired not. + self assert: aFilterDescriptor isDefault. + self assert: aFilterDescriptor emptyDefaultValue equals: nil. + self assert: aFilterDescriptor showAsDefaultWhenEmpty. + + self + assert: (aFilterDescriptor newFilterWithValue: '') + equals: GtSearchNullFilter new. + + ^ aFilterDescriptor +] + +{ #category : #examples } +GtFilterDescriptorExamples >> newFilterDescriptor [ + + | aFilterDescriptor | + + aFilterDescriptor := GtFilterDescriptor new. + + self assert: aFilterDescriptor name equals: 'No name'. + self assert: aFilterDescriptor order equals: 1. + self assert: aFilterDescriptor completion equals: nil. + self assert: aFilterDescriptor valueIsRequired. + self assert: aFilterDescriptor isDefault. + self assert: aFilterDescriptor emptyDefaultValue equals: nil. + self assert: aFilterDescriptor showAsDefaultWhenEmpty not. + + self + assert: (aFilterDescriptor newFilterWithValue: '') + equals: GtSearchNullFilter new. + + ^ aFilterDescriptor +] diff --git a/src/GToolkit-Coder-Examples/GtFilterTagElementExamples.class.st b/src/GToolkit-Coder-Examples/GtFilterTagElementExamples.class.st new file mode 100644 index 000000000..551014c72 --- /dev/null +++ b/src/GToolkit-Coder-Examples/GtFilterTagElementExamples.class.st @@ -0,0 +1,329 @@ +Class { + #name : #GtFilterTagElementExamples, + #superclass : #Object, + #category : #'GToolkit-Coder-Examples-Filters' +} + +{ #category : #examples } +GtFilterTagElementExamples >> availableFilterDescriptors [ + ^ { + GtFilterDescriptor + creator: GtSearchNullFilter new + named: 'Filter with value' + order: 1. + + GtFilterDescriptor new + creator: GtSearchNullFilter new; + named: 'Filter without value'; + order: 2; + valueNotRequired. + + GtFilterDescriptor + creator: GtSearchNullFilter new + named: 'Filter C' + order: 3. + + GtFilterDescriptor + creator: GtSearchNullFilter new + named: 'Filter D' + order: 4. + } +] + +{ #category : #examples } +GtFilterTagElementExamples >> filterTagValueNotRequired [ + + | tagElement filterDescriptor | + + filterDescriptor := self filterValueNotRequired. + + tagElement := GtFilterTagElement new + descriptor: filterDescriptor; + availableFilterDescriptors: self availableFilterDescriptors. + + self + assert: (tagElement query // GtFilterTagLabelId) anyOne text asString + equals: 'Default without value'. + + "there is no editor" + self assert: (tagElement query // GtFilterTagEditorId) isEmpty. + + ^ tagElement +] + +{ #category : #examples } +GtFilterTagElementExamples >> filterTagValueNotRequiredByScripter [ + + | scripter | + + scripter := BlScripter new + extent: 500@400; + element: self filterTagValueNotRequired. + + scripter assert + label: 'Does not have focus by default'; + satisfies: [ :anElement | anElement hasFocus not ]; + play. + + scripter click + label: 'Click on label to request focus'; + id: GtFilterTagLabelId; + play. + + scripter assert + label: 'Has focus after clicking on label'; + satisfies: [ :anElement | anElement hasFocus ]; + play. + + scripter click + label: 'Click again on the label to open a dropdown'; + id: GtFilterTagLabelId; + play. + + scripter click + label: 'Select filter without value'; + onSpaceRoot; + id: (GtFilterTagPickerItemId indexed: 2); + play. + + scripter assert + label: 'Check that replace wish was fired'; + event: GtFilterTagReplaceWish; + value: [ :anEvent | anEvent filterDescriptor name ] + equals: [ 'Default without value' ]; + value: [ :anEvent | anEvent newFilterDescriptor name ] + equals: [ 'Filter without value' ]; + play. + + scripter assert + label: 'Tag still has focus'; + satisfies: [ :anElement | anElement hasFocus ]; + play. + + scripter shortcut + label: 'Press backspace to remove the tag'; + combination: BlKeyCombination backspace; + play. + + scripter assert + label: 'Check that remove wish was fired'; + event: GtFilterTagRemoveWish; + value: [ :anEvent | anEvent filterDescriptor name ] + equals: [ 'Filter without value' ]; + play. + + ^ scripter +] + +{ #category : #examples } +GtFilterTagElementExamples >> filterTagValueRequiredWithDefault [ + + | aTagElement | + + aTagElement := GtFilterTagElement new + descriptor: self filterValueRequiredWithDefault; + availableFilterDescriptors: self availableFilterDescriptors. + + ^ aTagElement +] + +{ #category : #examples } +GtFilterTagElementExamples >> filterTagValueRequiredWithDefaultByScripter [ + + | scripter | + + scripter := BlScripter new + extent: 500@400; + element: self filterTagValueRequiredWithDefault. + + scripter assert + satisfies: [ :anElement | anElement hasFocus not ]. + + scripter assert + label: 'Check that the default value is set in the editor'; + id: GtFilterTagEditorId; + value: [ :anEditor | anEditor text asString ] + equals: 'Default'; + play. + + scripter assert + label: 'Check that name of the filter is correct in the label'; + id: GtFilterTagLabelId; + value: [ :aLabel | aLabel text asString ] + equals: 'Default with value'; + play. + + ^ scripter +] + +{ #category : #examples } +GtFilterTagElementExamples >> filterTagValueRequiredWithDefaultByScripterTypeAndAcceptWithClickingAway [ + + | scripter | + + scripter := self filterTagValueRequiredWithDefaultByScripter. + + scripter click + id: GtFilterTagEditorId; + play. + + scripter assert + id: GtFilterTagEditorId; + satisfies: [ :anEditor | anEditor hasFocus ]. + + scripter shortcut + id: GtFilterTagEditorId; + combination: BlKeyCombination primaryA; + play. + + scripter type + id: GtFilterTagEditorId; + text: ' New value '; + play. + + scripter assert + label: 'Check that the new value is typed in the editor'; + id: GtFilterTagEditorId; + value: [ :anEditor | anEditor text asString ] + "intentionally added spaces to test trimming" + equals: ' New value '; + play. + + scripter assert + id: GtFilterTagEditorId; + satisfies: [ :anEditor | anEditor hasFocus ]. + + scripter click + id: GtFilterTagLabelId; + play. + + scripter assert + id: GtFilterTagEditorId; + satisfies: [ :anEditor | anEditor hasFocus not ]. + + scripter assert + label: 'Check that update wish was fired'; + event: GtFilterTagUpdateWish; + value: [ :anEvent | anEvent filterDescriptor name ] + equals: [ 'Default with value' ]; + value: [ :anEvent | anEvent newValue ] + equals: [ 'New value' ]; + play. + + ^ scripter +] + +{ #category : #examples } +GtFilterTagElementExamples >> filterTagValueRequiredWithDefaultByScripterTypeAndAcceptWithShortcut [ + + | scripter | + + scripter := self filterTagValueRequiredWithDefaultByScripter. + + scripter click + id: GtFilterTagEditorId; + play. + + scripter assert + id: GtFilterTagEditorId; + satisfies: [ :anEditor | anEditor hasFocus ]. + + scripter shortcut + id: GtFilterTagEditorId; + combination: BlKeyCombination primaryA; + play. + + scripter type + id: GtFilterTagEditorId; + text: ' New value '; + play. + + scripter assert + label: 'Check that the new value is typed in the editor'; + id: GtFilterTagEditorId; + value: [ :anEditor | anEditor text asString ] + "intentionally added spaces to test trimming" + equals: ' New value '; + play. + + scripter shortcut + label: 'Accept changes with enter shortcut'; + id: GtFilterTagEditorId; + combination: BlKeyCombination enter; + play. + + scripter assert + label: 'Check that update wish was fired'; + event: GtFilterTagUpdateWish; + value: [ :anEvent | anEvent filterDescriptor name ] + equals: [ 'Default with value' ]; + value: [ :anEvent | anEvent newValue ] + equals: [ 'New value' ]; + play. + + ^ scripter +] + +{ #category : #examples } +GtFilterTagElementExamples >> filterTagValueRequiredWithoutDefault [ + + | aTagElement | + + aTagElement := GtFilterTagElement new + descriptor: self filterValueRequiredWithoutDefault; + availableFilterDescriptors: self availableFilterDescriptors. + + ^ aTagElement +] + +{ #category : #examples } +GtFilterTagElementExamples >> filterTagValueRequiredWithoutDefaultByScripter [ + + | scripter | + + scripter := BlScripter new + extent: 500@400; + element: self filterTagValueRequiredWithoutDefault. + + scripter assert + label: 'Does not have focus by default'; + satisfies: [ :anElement | anElement hasFocus not ]. + + scripter assert + id: GtFilterTagEditorId; + satisfies: [ :anEditor | anEditor text isEmpty ]; + play. + + scripter assert + id: GtFilterTagLabelId; + value: [ :aLabel | aLabel text asString ] equals: 'Default with value'; + play. + + ^ scripter +] + +{ #category : #examples } +GtFilterTagElementExamples >> filterValueNotRequired [ + + ^ GtFilterDescriptorExamples new filterDescriptorValueNotRequired + named: 'Default without value' +] + +{ #category : #examples } +GtFilterTagElementExamples >> filterValueRequiredWithDefault [ + + + ^ (GtFilterDescriptorExamples new + newFilterDescriptor) + named: 'Default with value'; + emptyDefaultValue: 'Default' +] + +{ #category : #examples } +GtFilterTagElementExamples >> filterValueRequiredWithoutDefault [ + + + ^ (GtFilterDescriptorExamples new + newFilterDescriptor) + named: 'Default with value' +] diff --git a/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st b/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st index 07d50a85a..1c9ddb596 100644 --- a/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st +++ b/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st @@ -14,21 +14,21 @@ Class { #instVars : [ 'name', 'order', - 'emptyDefaultValue', 'creationBlock', - 'valueIsRequired', 'isDefault', 'completionBlock', - 'completion' + 'completion', + 'emptyDefaultValue', + 'valueIsRequired' ], #category : #'GToolkit-Coder-UI-Filters' } -{ #category : #'instace creation' } +{ #category : #'instance creation' } GtFilterDescriptor class >> creator: aBlock named: aString order: anInteger [ ^ self new - creationBlock: aBlock; - name: aString; + creator: aBlock; + named: aString; order: anInteger; yourself ] @@ -36,8 +36,8 @@ GtFilterDescriptor class >> creator: aBlock named: aString order: anInteger [ { #category : #'instance creation' } GtFilterDescriptor class >> creator: aBlock named: aString order: anInteger completion: completionStrategy [ ^ self new - creationBlock: aBlock; - name: aString; + creator: aBlock; + named: aString; order: anInteger; completion: completionStrategy; yourself @@ -46,8 +46,8 @@ GtFilterDescriptor class >> creator: aBlock named: aString order: anInteger comp { #category : #'instance creation' } GtFilterDescriptor class >> creator: aBlock named: aString order: anInteger completion: completionStrategy emptyDefaultValue: defaultValueString [ ^ self new - creationBlock: aBlock; - name: aString; + creator: aBlock; + named: aString; order: anInteger; completion: completionStrategy; emptyDefaultValue: defaultValueString; @@ -64,48 +64,77 @@ GtFilterDescriptor >> = anObject [ and: [ self valueIsRequired = anObject valueIsRequired ] ] ] ] ] -{ #category : #'initialize-release' } +{ #category : #'api - configuration' } GtFilterDescriptor >> beNotDefault [ "Do not display this particular descriptor filter as a default filter" + isDefault := false ] { #category : #accessing } GtFilterDescriptor >> completion [ - ^ completion ifNil: [ completion := completionBlock value ] + ^ completion ifNil: [ completion := (completionBlock ifNil: [ self defaultCompletion ]) value ] ] -{ #category : #accessing } +{ #category : #'api - configuration' } GtFilterDescriptor >> completion: completionStrategyBlock [ completionBlock := completionStrategyBlock ] { #category : #accessing } GtFilterDescriptor >> creationBlock [ - ^ creationBlock + ^ creationBlock ifNil: [ self defaultCreator ] ] -{ #category : #accessing } +{ #category : #'api - configuration' } GtFilterDescriptor >> creationBlock: aBlock [ - creationBlock := aBlock + + "We deprecated #creationBlock: in favor of #creator: to keep the instance side api be as close as possible to fluent class side api" + self + deprecated: 'Please use creator: instead.' + transformWith: + '`@receiver creationBlock: `@statements1' + -> '`@receiver creator: `@statements1'. + + self creator: aBlock ] -{ #category : #accessing } +{ #category : #'api - configuration' } GtFilterDescriptor >> creator: aBlock [ creationBlock := aBlock ] +{ #category : #initialization } +GtFilterDescriptor >> defaultCompletion [ + ^ [ nil ] +] + +{ #category : #initialization } +GtFilterDescriptor >> defaultCreator [ + ^ [ :aString | GtSearchNullFilter new ] +] + +{ #category : #initialization } +GtFilterDescriptor >> defaultName [ + ^ 'No name' +] + +{ #category : #initialization } +GtFilterDescriptor >> defaultOrder [ + ^ 1 +] + { #category : #accessing } GtFilterDescriptor >> emptyDefaultValue [ ^ emptyDefaultValue ] -{ #category : #accessing } +{ #category : #'api - configuration' } GtFilterDescriptor >> emptyDefaultValue: aString [ emptyDefaultValue := aString ] -{ #category : #'gt-extensions' } +{ #category : #'gt - extensions' } GtFilterDescriptor >> gtCompletionsFor: aView [ self completion ifNil: [ ^ aView empty ]. @@ -117,6 +146,31 @@ GtFilterDescriptor >> gtCompletionsFor: aView [ view: #gtCompletionsFor: ] +{ #category : #'gt - extensions' } +GtFilterDescriptor >> gtInfoFor: aView [ + + + ^ aView columnedList + title: 'Info'; + priority: 1; + items: [ { + 'Name' -> (name ifNil: [ 'Unspecified (default: {1})' format: { self defaultName printString } ]). + 'Order' -> (order ifNil: [ 'Unspecified (default: {1})' format: { self defaultOrder printString } ]). + 'Filter creator' -> (creationBlock ifNil: [ 'Unspecified (default: {1})' format: { self defaultCreator } ]). + 'Completion' -> (creationBlock ifNil: [ 'Unspecified (default: {1})' format: { self defaultCompletion } ]). + 'Value required' -> valueIsRequired. + 'Is default' -> isDefault. + 'Default value when empty' -> (emptyDefaultValue + ifNotNil: [ :aValue | aValue printString ] + ifNil: [ 'Unspecified (default: {1})' format: { nil } ]). + 'Show default value when empty' -> self showAsDefaultWhenEmpty + } ]; + column: 'Property' text: #key; + column: 'Value' text: #value; + send: #value; + actionUpdateButton +] + { #category : #'gt - extensions' } GtFilterDescriptor >> gtViewFilterBlockFor: aView [ @@ -134,44 +188,60 @@ GtFilterDescriptor >> hash [ ^ self class hash hashMultiply bitXor: self name hash ] -{ #category : #'initialize-release' } +{ #category : #initialization } GtFilterDescriptor >> initialize [ super initialize. + valueIsRequired := true. - isDefault := true. + isDefault := true ] { #category : #testing } GtFilterDescriptor >> isDefault [ + "Return true if the filter should be applied as a default" + ^ isDefault ] { #category : #accessing } GtFilterDescriptor >> name [ - ^ name + "Return the name of the filter (or a default one if not specified) to be displayed in the list of the filters." + + + ^ name ifNil: [ self defaultName ] ] -{ #category : #accessing } +{ #category : #'api - configuration' } GtFilterDescriptor >> name: aString [ - name := aString + "We deprecated #name: in favor of #named: to keep the instance side api be as close as possible to fluent class side api" + self + deprecated: 'Please use named: instead.' + transformWith: + '`@receiver name: `@statements1' + -> '`@receiver named: `@statements1'. + + self named: aString ] -{ #category : #accessing } +{ #category : #'api - configuration' } GtFilterDescriptor >> named: aString [ name := aString ] { #category : #filters } GtFilterDescriptor >> newFilterWithValue: aString [ - ^ creationBlock value: aString + ^ self creationBlock cull: aString ] { #category : #accessing } GtFilterDescriptor >> order [ - ^ order + "The order of the filter in the list of all filters." + + + ^ order ifNil: [ self defaultOrder ] ] -{ #category : #accessing } +{ #category : #'api - configuration' } GtFilterDescriptor >> order: anInteger [ order := anInteger ] @@ -194,10 +264,15 @@ GtFilterDescriptor >> showAsDefaultWhenEmpty [ { #category : #testing } GtFilterDescriptor >> valueIsRequired [ + "Return true if the filter requires an input value, false otherwise. + Filters that require a value should be rendered with a text input field + allowing users to enter the value." + + ^ valueIsRequired ] -{ #category : #'initialize-release' } +{ #category : #'api - configuration' } GtFilterDescriptor >> valueNotRequired [ valueIsRequired := false ] diff --git a/src/GToolkit-Coder-UI/GtFilterTagEditorId.class.st b/src/GToolkit-Coder-UI/GtFilterTagEditorId.class.st new file mode 100644 index 000000000..2daecb758 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterTagEditorId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtFilterTagEditorId, + #superclass : #BlElementUniqueId, + #category : #'GToolkit-Coder-UI-Filters' +} + +{ #category : #converting } +GtFilterTagEditorId >> asSymbol [ + ^ #'filter-tag--editor' +] diff --git a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st index d1b320d8b..cc1e15106 100644 --- a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st @@ -15,219 +15,321 @@ Class { #name : #GtFilterTagElement, #superclass : #BrHorizontalPane, #instVars : [ - 'descriptor', + 'filterDescriptor', + 'availableFilterDescriptors', 'valueString', - 'filterElement' + 'filterElement', + 'filterPickerHandle', + 'filterLabel' ], #category : #'GToolkit-Coder-UI-Filters' } -{ #category : #actions } +{ #category : #'private - accessing' } GtFilterTagElement >> activateEditor [ self childNamed: #editableLabel - ifFound: [ :label | - label - requestFocus; - switchToEditor ] - ifNone: [ (self childNamed: #dropDown) requestFocus ] + ifFound: [ :label | label requestFocus ] + ifNone: [ filterLabel requestFocus ] ] -{ #category : #private } +{ #category : #'private - accessing' } GtFilterTagElement >> applyDescriptor: aDescriptor [ self descriptor: aDescriptor. self activateEditor. aDescriptor valueIsRequired - ifFalse: [ filterElement applyFilters ] + ifFalse: [ self applyFilters ] ] -{ #category : #elements } -GtFilterTagElement >> buildTagElements [ - self removeChildren. - - BlFrameTelemetry - time: [ 'Create and add dropdown' ] - during: [ self addChild: self createDropDown as: #dropDown ]. +{ #category : #'private - instance creation' } +GtFilterTagElement >> applyFilters [ + filterElement + ifNil: [ ^ self ]. - descriptor valueIsRequired - ifTrue: [ - BlFrameTelemetry - time: [ 'Create and add editable label' ] - during: [ self addChild: self createEditableLabel as: #editableLabel ] ] -] - -{ #category : #elements } -GtFilterTagElement >> createDropDown [ - | button dropDownLook | - button := self createDropDownButton. - dropDownLook := BrGlamorousWithDropdownAptitude - handle: [ self createDropDownButton ] - content: [ - BrSimpleList new - fitContent; - stencil: [ :each | - BrHorizontalPane new - hMatchParent; - vFitContent; - padding: (BlInsets all: 5); - aptitude: (BrStyleCommonAptitude new - default: [ :s | s background: Color transparent ]; - hovered: [ :s | s background: self theme button defaultBorderColor ]; - yourself); - when: BlClickEvent - do: [ :anEvent | - anEvent consumed: true. - button label: each name. - anEvent currentTarget fireEvent: BrDropdownHideWish new. - self applyDescriptor: each ]; - addChild: (BrLabel new - aptitude: BrGlamorousLabelAptitude new glamorousRegularFont glamorousCodeSmallSize; - text: each name; - yourself); - yourself ]; - items: filterElement descriptors; - yourself ]. - button addAptitude: dropDownLook. - button addAptitude: (BrStyleCommonAptitude new - default: [ :s | s background: Color transparent ]; - hovered: [ :s | s background: self theme status neutralBackgroundColor darker ]). - - button - when: BlKeyUpEvent - do: [ :anEvent | - anEvent key = BlKeyboardKey backspace ifTrue: [ - self removeFromParent. - filterElement applyFilters ] ]. - - ^ button -] - -{ #category : #elements } -GtFilterTagElement >> createDropDownButton [ - | button | - button := BrButton new. - button aptitude: BrTextLabelAptitude new glamorousRegularFont glamorousCodeSmallSize + BrGlamorousButtonIconAptitude + BrGlamorousButtonLayoutAptitude. - button vExact: 20. - button padding: (BlInsets left: 4 right: 2). - button label: self descriptor name. - button icon: BrGlamorousVectorIcons downwards. - button beSmallSize. - ^ button -] - -{ #category : #elements } + filterElement applyFilters +] + +{ #category : #'api - accessing' } +GtFilterTagElement >> availableFilterDescriptors [ + "Tag element allows users to change the filter to another one. + Therefore each filter tag element should be able to get a list of all possible descriptors" + + + ^ availableFilterDescriptors +] + +{ #category : #'api - accessing' } +GtFilterTagElement >> availableFilterDescriptors: aCollectionOfFilterDescriptors [ + availableFilterDescriptors := aCollectionOfFilterDescriptors +] + +{ #category : #'private - instance creation' } +GtFilterTagElement >> createDropdownContent [ + ^ BrSimpleList new + fitContent; + stencil: [ :eachFilterDescriptor :eachIndex | + BrHorizontalPane new + id: (GtFilterTagPickerItemId indexed: eachIndex); + hMatchParent; + vFitContent; + padding: (BlInsets all: 5); + aptitude: (BrStyleCommonAptitude new + default: [ :s | s background: Color transparent ]; + hovered: [ :s | s background: self theme button defaultBorderColor ]; + yourself); + when: BlClickEvent + do: [ :anEvent | + anEvent consumed: true. + anEvent currentTarget fireEvent: BrDropdownHideWish new. + self + requestReplaceFilter: filterDescriptor + with: eachFilterDescriptor ]; + addChild: (BrLabel new + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont glamorousCodeSmallSize; + text: eachFilterDescriptor name; + yourself); + yourself ]; + items: self availableFilterDescriptors; + yourself +] + +{ #category : #'private - instance creation' } GtFilterTagElement >> createEditableLabel [ - | label | - - label := BrEditableLabel new. - label aptitude: BrGlamorousEditableLabelAptitude new glamorousRegularFont glamorousRegularSmallSize. - label text: (valueString ifNil: [ '' ]). - label padding: (BlInsets top: 2 left: 4 bottom: 2 right: 4). - label - when: BrEditorAcceptWish - do: [ :aWish | - valueString := aWish text asString trim. - (label parent == self and: [ valueString isEmpty ]) - ifTrue: [ self removeFromParent ]. - filterElement applyFilters ]. - label - when: BrEditorCancelWish - do: [ :aWish | - (label parent == self and: [ self isValid not ]) - ifTrue: [ self removeFromParent ]. - filterElement applyFilters ]. - label - whenKey: BlKeyCombination backspace - labelDo: [ :aShortcutEvent :aShortcut | - self removeFromParent. - filterElement applyFilters ]. - - descriptor completion - ifNotNil: - [ :strategy | (GtCompletionController on: label strategy: strategy) install ]. - - ^ label -] - -{ #category : #accessing } + | anEditor | + + anEditor := BrEditor new + beMode: BrTextEditorEditableSingleLineMode new; + fitContent; + id: GtFilterTagEditorId; + aptitude: BrGlamorousRegularEditorAptitude new glamorousRegularFont glamorousCodeSmallSize; + background: Color white; + geometry: (BlRoundedRectangleGeometry cornerRadius: 2); + margin: (BlInsets top: 2 left: 0 bottom: 2 right: 3); + padding: (BlInsets top: 1 left: 2 bottom: 1 right: 2); + constraintsDo: [ :c | c minWidth: 16 ]; + text: ''. + + anEditor addShortcut: (BlShortcutWithAction new + combination: BlKeyCombination enter; + action: [ :anEvent | + self + requestUpdateFilter: filterDescriptor + value: anEvent currentTarget text asString trimmed ]). + + anEditor when: BlFocusOutEvent do: [ :anEvent | + self + requestUpdateFilter: filterDescriptor + value: anEvent currentTarget text asString trimmed ]. + + filterDescriptor completion + ifNotNil: [ :strategy | (GtCompletionController on: anEditor strategy: strategy) install ]. + + ^ anEditor +] + +{ #category : #'private - instance creation' } +GtFilterTagElement >> createFilterLabel [ + ^ BrLabel new + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont glamorousCodeSmallSize; + vFitContent; + beSmallSize +] + +{ #category : #'private - instance creation' } +GtFilterTagElement >> createFilterLabelHandle [ + ^ self createFilterLabel + id: GtFilterTagLabelId; + addAptitude: (BrGlamorousWithDropdownAptitude + handle: [ + BrHorizontalPane new + fitContent; + addChildren: { + self createFilterLabel text: filterDescriptor name. + self createFilterPickerHandle + } ] + content: [ self createDropdownContent ]) doNotShowOnClick +] + +{ #category : #'private - instance creation' } +GtFilterTagElement >> createFilterPickerHandle [ + ^ BrButton new + id: GtFilterTagPickerId; + aptitude: (BrGlamorousButtonCircularAptitude paddingScale: 0 heightScale: 0.75) + + BrGlamorousButtonFlatExteriorAptitude + + BrGlamorousButtonIconAptitude; + icon: BrGlamorousVectorIcons downwards; + beNormalSize +] + +{ #category : #'api - accessing' } GtFilterTagElement >> descriptor [ - ^ descriptor + ^ filterDescriptor ] -{ #category : #accessing } +{ #category : #'api - accessing' } GtFilterTagElement >> descriptor: aFilterDescriptor [ - descriptor := aFilterDescriptor. - valueString := ''. - self buildTagElements + filterDescriptor := aFilterDescriptor. + + filterLabel text: filterDescriptor name. + + filterDescriptor valueIsRequired + ifTrue: [ + | aDefaultValue | + + aDefaultValue := aFilterDescriptor emptyDefaultValue + ifNil: [ '' ]. + + self + childWithId: GtFilterTagEditorId + ifFound: [ :anEditor | anEditor text: aDefaultValue ] + ifNone: [ self addChild: (self createEditableLabel text: aDefaultValue) ] ] + ifFalse: [ + self + childWithId: GtFilterTagEditorId + ifFound: [ :anEditor | anEditor removeFromParent ] ] ] -{ #category : #'initialize-release' } +{ #category : #initialization } GtFilterTagElement >> emptyDefaultValueLabel [ - ^ descriptor emptyDefaultValue + ^ filterDescriptor emptyDefaultValue ] -{ #category : #accessing } +{ #category : #'api - accessing' } GtFilterTagElement >> filter: aGtMethodsFilter [ - filterElement := aGtMethodsFilter + filterElement := aGtMethodsFilter. + self availableFilterDescriptors: filterElement descriptors ] -{ #category : #'initialize-release' } +{ #category : #initialization } GtFilterTagElement >> initialize [ super initialize. - self fitContent. - self margin: (BlInsets all: 3). + availableFilterDescriptors := #(). + + self + fitContent; + alignCenterLeft; + beInSingleCompositionLayer. + self addAptitude: (BrStyleCommonAptitude new default: [ :aStyle | aStyle geometry: (BlRoundedRectangleGeometry cornerRadius: 4). - aStyle background: self theme status neutralBackgroundColor. - aStyle border: BlBorder empty ]; + aStyle background: self theme status neutralBackgroundColor ]; hovered: [ :aStyle | - aStyle background: - self theme status neutralBackgroundColor darker ]) + aStyle background: self theme status neutralBackgroundColor darker ]; + focused: [ :aStyle | + aStyle background: self theme editor focusedBorderColor lighter lighter ]). + + filterLabel := self createFilterLabelHandle. + filterLabel margin: (BlInsets top: 2 right: 0 bottom: 2 left: 4). + filterPickerHandle := self createFilterPickerHandle. + filterPickerHandle margin: (BlInsets top: 1 right: 4). + + self addChildren: { + filterLabel. + filterPickerHandle + }. + + self addAptitude: (BrStyleCommonAptitude new + // #label; + default: [ :aStyle | aStyle foreground: Color black ]; + focused: [ :aStyle | aStyle foreground: Color white ]). + + self addAptitude: (BrStyleCommonAptitude new + // #icon; + default: [ :aStyle | aStyle background: Color black ]; + focused: [ :aStyle | aStyle background: Color white ]). + + self when: BlClickEvent do: [ :anEvent | + anEvent consumed: true. + self hasFocus + ifTrue: [ + filterLabel dispatchEvent: (BrDropdownShowWish new) ]. + self requestFocus ]. + + filterPickerHandle + when: BlClickEvent + do: [ :anEvent | filterLabel dispatchEvent: BrDropdownShowWish new ]. + + self addShortcut: (BlShortcutWithAction new + combination: (BlKeyCombination backspace); + action: [ self requestRemoveFilter: filterDescriptor ]) ] { #category : #testing } GtFilterTagElement >> isDefaultAllFilter [ ^ self descriptor showAsDefaultWhenEmpty - and: [ valueString isEmpty - and: [ self - childNamed: #editableLabel - ifFound: [ :aLabel | aLabel text asString = self emptyDefaultValueLabel ] - ifNone: [ true ] ] ] + and: [ + self + childWithId: GtFilterTagEditorId + ifFound: [ :aLabel | aLabel text asString = self emptyDefaultValueLabel ] + ifNone: [ true ] ] ] { #category : #testing } GtFilterTagElement >> isValid [ - ^ descriptor valueIsRequired not or: [ self valueString notEmpty ] + ^ filterDescriptor valueIsRequired not or: [ self valueString notEmpty ] ] -{ #category : #'initialize-release' } +{ #category : #initialization } GtFilterTagElement >> makeDefaultFilter [ - valueString := ''. self setLabelText: self emptyDefaultValueLabel ] -{ #category : #private } +{ #category : #'private - actions' } +GtFilterTagElement >> requestRemoveFilter: aFilterDescriptor [ + "Is sent by filter tag when it requests to remove a filter" + + self dispatchEvent: (GtFilterTagRemoveWish new + filterDescriptor: aFilterDescriptor). + + self removeFromParent. + self applyFilters +] + +{ #category : #'private - actions' } +GtFilterTagElement >> requestReplaceFilter: aFilterDescriptor with: aNewFilterDescriptor [ + "Is sent by filter tag when it requests to replace itself with a new filter" + + self dispatchEvent: (GtFilterTagReplaceWish new + filterDescriptor: aFilterDescriptor; + newFilterDescriptor: aNewFilterDescriptor). + + self requestFocus. + + self descriptor: aNewFilterDescriptor. + self applyFilters +] + +{ #category : #'private - actions' } +GtFilterTagElement >> requestUpdateFilter: aFilterDescriptor value: aString [ + "Is sent by filter tag when it requests to update the filter with a new value" + + self dispatchEvent: (GtFilterTagUpdateWish new + filterDescriptor: aFilterDescriptor; + newValue: aString). + + self applyFilters +] + +{ #category : #'private - accessing' } GtFilterTagElement >> setLabelText: aString [ self - childNamed: #editableLabel - ifFound: [ :label | - label text deleteAll. - aString notEmpty - ifTrue: [ label text - append: aString asRopedText glamorousRegularFont glamorousRegularSmallSize ] ] + childWithId: GtFilterTagEditorId + ifFound: [ :label | label text: aString ] ] -{ #category : #accessing } +{ #category : #'api - accessing' } GtFilterTagElement >> valueString [ - ^ valueString + ^ self + childWithId: GtFilterTagEditorId + ifFound: [ :anEditor | anEditor text asString ] + ifNone: [ '' ] ] -{ #category : #accessing } +{ #category : #'api - accessing' } GtFilterTagElement >> valueString: aString [ - valueString := aString. self setLabelText: aString ] diff --git a/src/GToolkit-Coder-UI/GtFilterTagLabelId.class.st b/src/GToolkit-Coder-UI/GtFilterTagLabelId.class.st new file mode 100644 index 000000000..134d53398 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterTagLabelId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtFilterTagLabelId, + #superclass : #BlElementUniqueId, + #category : #'GToolkit-Coder-UI-Filters' +} + +{ #category : #converting } +GtFilterTagLabelId >> asSymbol [ + ^ #'filter-tag--label' +] diff --git a/src/GToolkit-Coder-UI/GtFilterTagPickerId.class.st b/src/GToolkit-Coder-UI/GtFilterTagPickerId.class.st new file mode 100644 index 000000000..583deedf3 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterTagPickerId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtFilterTagPickerId, + #superclass : #BlElementUniqueId, + #category : #'GToolkit-Coder-UI-Filters' +} + +{ #category : #converting } +GtFilterTagPickerId >> asSymbol [ + ^ #'filter-tag--picker' +] diff --git a/src/GToolkit-Coder-UI/GtFilterTagPickerItemId.class.st b/src/GToolkit-Coder-UI/GtFilterTagPickerItemId.class.st new file mode 100644 index 000000000..a5538b2a3 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterTagPickerItemId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtFilterTagPickerItemId, + #superclass : #BlElementUniqueId, + #category : #'GToolkit-Coder-UI-Filters' +} + +{ #category : #converting } +GtFilterTagPickerItemId >> asSymbol [ + ^ #'filter-tag--picker-item' +] diff --git a/src/GToolkit-Coder-UI/GtFilterTagRemoveWish.class.st b/src/GToolkit-Coder-UI/GtFilterTagRemoveWish.class.st new file mode 100644 index 000000000..3a354f5e7 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterTagRemoveWish.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtFilterTagRemoveWish, + #superclass : #GtFilterTagWish, + #category : #'GToolkit-Coder-UI-Filters' +} diff --git a/src/GToolkit-Coder-UI/GtFilterTagReplaceWish.class.st b/src/GToolkit-Coder-UI/GtFilterTagReplaceWish.class.st new file mode 100644 index 000000000..784564aa5 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterTagReplaceWish.class.st @@ -0,0 +1,20 @@ +Class { + #name : #GtFilterTagReplaceWish, + #superclass : #GtFilterTagWish, + #instVars : [ + 'newFilterDescriptor' + ], + #category : #'GToolkit-Coder-UI-Filters' +} + +{ #category : #accessing } +GtFilterTagReplaceWish >> newFilterDescriptor [ + + ^ newFilterDescriptor +] + +{ #category : #accessing } +GtFilterTagReplaceWish >> newFilterDescriptor: anObject [ + + newFilterDescriptor := anObject +] diff --git a/src/GToolkit-Coder-UI/GtFilterTagUpdateWish.class.st b/src/GToolkit-Coder-UI/GtFilterTagUpdateWish.class.st new file mode 100644 index 000000000..61ecd35d2 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterTagUpdateWish.class.st @@ -0,0 +1,20 @@ +Class { + #name : #GtFilterTagUpdateWish, + #superclass : #GtFilterTagWish, + #instVars : [ + 'newValue' + ], + #category : #'GToolkit-Coder-UI-Filters' +} + +{ #category : #accessing } +GtFilterTagUpdateWish >> newValue [ + + ^ newValue +] + +{ #category : #accessing } +GtFilterTagUpdateWish >> newValue: anObject [ + + newValue := anObject +] diff --git a/src/GToolkit-Coder-UI/GtFilterTagWish.class.st b/src/GToolkit-Coder-UI/GtFilterTagWish.class.st new file mode 100644 index 000000000..86369cf60 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterTagWish.class.st @@ -0,0 +1,20 @@ +Class { + #name : #GtFilterTagWish, + #superclass : #BlEvent, + #instVars : [ + 'filterDescriptor' + ], + #category : #'GToolkit-Coder-UI-Filters' +} + +{ #category : #accessing } +GtFilterTagWish >> filterDescriptor [ + + ^ filterDescriptor +] + +{ #category : #accessing } +GtFilterTagWish >> filterDescriptor: anObject [ + + filterDescriptor := anObject +] diff --git a/src/GToolkit-Coder-UI/GtFiltersElement.class.st b/src/GToolkit-Coder-UI/GtFiltersElement.class.st index 9bf42f094..4e5a15e6f 100644 --- a/src/GToolkit-Coder-UI/GtFiltersElement.class.st +++ b/src/GToolkit-Coder-UI/GtFiltersElement.class.st @@ -31,13 +31,7 @@ GtFiltersElement >> addAllDefaults [ defaultDescriptors do: [ :defaultDescriptor | - filterElement := GtFilterTagElement new. - filterElement filter: self. - - BlFrameTelemetry - time: [ 'Assign default descriptor ' , defaultDescriptor name , ' to the filter tag' ] - during: [ filterElement descriptor: defaultDescriptor ]. - + filterElement := self createFilterTagFor: defaultDescriptor. filterElement makeDefaultFilter. self addChild: filterElement at: self childrenCount ] @@ -46,9 +40,7 @@ GtFiltersElement >> addAllDefaults [ { #category : #accessing } GtFiltersElement >> addFilterForDescriptor: aFilterDescriptor andValue: aString [ | element | - element := GtFilterTagElement new. - element filter: self. - element descriptor: aFilterDescriptor. + element := self createFilterTagFor: aFilterDescriptor. aFilterDescriptor valueIsRequired ifTrue: [ element valueString: aString ]. self addChild: element at: self childrenCount @@ -88,15 +80,21 @@ GtFiltersElement >> clearFilters [ [ self childrenCount > 1 ] whileTrue: [ self removeChildAt: 1 ] ] +{ #category : #'private - instance creation' } +GtFiltersElement >> createFilterTagFor: aFilterDescription [ + ^ GtFilterTagElement new + descriptor: aFilterDescription; + margin: (BlInsets all: 2); + filter: self +] + { #category : #'private - actions' } GtFiltersElement >> createNewTag [ | tag | self descriptors ifNotEmpty: [ :items | self areAllDefaults ifTrue: [ self clearFilters ]. - tag := GtFilterTagElement new. - tag filter: self. - tag descriptor: items first. + tag := self createFilterTagFor: items first. self addChild: tag at: self childrenCount. tag activateEditor ] ] @@ -157,22 +155,17 @@ GtFiltersElement >> newAddTagButton [ BrGlamorousButtonRectangularAptitude new + BrGlamorousButtonIconAptitude new + BrGlamorousButtonWithLabelTooltipAptitude new - + - (BrInteractiveCommonAptitude new - default: [ :aWidget | - aWidget + + (BrStyleCommonAptitude new + default: [ :aStyle | + aStyle border: BlBorder empty; background: self theme status neutralBackgroundColor ]; - hovered: [ :aWidget | - aWidget background: - self theme status neutralBackgroundColor darker ]; - pressed: [ :aWidget | - aWidget - background: - self theme status neutralBackgroundColor darker darker ]; - focused: [ :aWidget | - aWidget - border: (BlBorder paint: self theme editor focusedBorderColor width: 1) ]); + hovered: [ :aStyle | + aStyle background: self theme status neutralBackgroundColor darker ]; + pressed: [ :aStyle | + aStyle background: self theme status neutralBackgroundColor darker darker ]; + focused: [ :aStyle | + aStyle border: (BlBorder paint: self theme editor focusedBorderColor width: 1) ]); icon: BrGlamorousVectorIcons add; label: 'Add Filter'; margin: (BlInsets all: 2); From 1f43c490f6aef69fbc032d06d93bbe9e72aa00ad Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Tue, 29 Nov 2022 11:41:58 +0100 Subject: [PATCH 0311/1268] [feenkcom/gtoolkit#2919] try to fix completion in the filters widget --- .../GtFilterTagElement.class.st | 14 ++++++---- .../GtFiltersElement.class.st | 26 ++++++++++++++----- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st index cc1e15106..1438f63cb 100644 --- a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st @@ -28,7 +28,7 @@ Class { { #category : #'private - accessing' } GtFilterTagElement >> activateEditor [ self - childNamed: #editableLabel + childNamed: GtFilterTagEditorId ifFound: [ :label | label requestFocus ] ifNone: [ filterLabel requestFocus ] ] @@ -122,9 +122,6 @@ GtFilterTagElement >> createEditableLabel [ requestUpdateFilter: filterDescriptor value: anEvent currentTarget text asString trimmed ]. - filterDescriptor completion - ifNotNil: [ :strategy | (GtCompletionController on: anEditor strategy: strategy) install ]. - ^ anEditor ] @@ -183,7 +180,14 @@ GtFilterTagElement >> descriptor: aFilterDescriptor [ self childWithId: GtFilterTagEditorId ifFound: [ :anEditor | anEditor text: aDefaultValue ] - ifNone: [ self addChild: (self createEditableLabel text: aDefaultValue) ] ] + ifNone: [ self addChild: (self createEditableLabel text: aDefaultValue) ]. + + self + childWithId: GtFilterTagEditorId + ifFound: [ :anEditor | + filterDescriptor completion + ifNotNil: [ :strategy | (GtCompletionController on: anEditor strategy: strategy) install ] + ifNil: [ (GtCompletionController on: anEditor strategy: GtCompletionStrategy new) install ] ] ] ifFalse: [ self childWithId: GtFilterTagEditorId diff --git a/src/GToolkit-Coder-UI/GtFiltersElement.class.st b/src/GToolkit-Coder-UI/GtFiltersElement.class.st index 4e5a15e6f..4eb3bcdbc 100644 --- a/src/GToolkit-Coder-UI/GtFiltersElement.class.st +++ b/src/GToolkit-Coder-UI/GtFiltersElement.class.st @@ -46,21 +46,24 @@ GtFiltersElement >> addFilterForDescriptor: aFilterDescriptor andValue: aString self addChild: element at: self childrenCount ] -{ #category : #'api - actions' } +{ #category : #private } GtFiltersElement >> applyFilters [ self fireEvent: (GtFiltersChangedEvent new filterElement: self) ] -{ #category : #'private - actions' } +{ #category : #private } GtFiltersElement >> areAllDefaults [ ^ self childrenCount > 1 and: [ (1 to: self childrenCount - 1) allSatisfy: [ :index | (self childAt: index) isDefaultAllFilter ] ] ] -{ #category : #accessing } +{ #category : #'api - filters' } GtFiltersElement >> asIntersectionFilter [ | compositeFilter | + + compositeFilter := nil. + self filtersDo: [ :descriptor :value | compositeFilter @@ -75,8 +78,10 @@ GtFiltersElement >> buildFilters: aBlock [ aBlock value ] -{ #category : #accessing } +{ #category : #'api - filters' } GtFiltersElement >> clearFilters [ + "Remove all filters" + [ self childrenCount > 1 ] whileTrue: [ self removeChildAt: 1 ] ] @@ -88,7 +93,7 @@ GtFiltersElement >> createFilterTagFor: aFilterDescription [ filter: self ] -{ #category : #'private - actions' } +{ #category : #private } GtFiltersElement >> createNewTag [ | tag | self descriptors @@ -99,6 +104,11 @@ GtFiltersElement >> createNewTag [ tag activateEditor ] ] +{ #category : #'api - filters' } +GtFiltersElement >> currentFilters [ + ^ Array streamContents: [ :aStream | self filtersDo: [ :eachFilter :eachValue | aStream nextPut: (eachFilter -> eachValue) ] ] +] + { #category : #accessing } GtFiltersElement >> descriptors [ ^ (descriptors isBlock ifTrue: [ descriptors value ] ifFalse: [ descriptors ]) @@ -114,8 +124,10 @@ GtFiltersElement >> descriptors: aCollection [ during: [ self addAllDefaults ] ] -{ #category : #accessing } +{ #category : #'api - filters' } GtFiltersElement >> filtersDo: aBlock [ + "Iterate over all valid filters" + 1 to: self childrenCount - 1 do: [ :i | | filterTagElement | filterTagElement := self childAt: i. @@ -125,7 +137,7 @@ GtFiltersElement >> filtersDo: aBlock [ value: filterTagElement valueString ] ] ] -{ #category : #accessing } +{ #category : #'gt - extensions' } GtFiltersElement >> gtViewDefaultDescriptorsFor: aView [ From c0d6daf9f2b87369dedb596b5668d70295b19490 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Tue, 29 Nov 2022 20:31:52 +0100 Subject: [PATCH 0312/1268] [feenkcom/gtoolkit#2919] add more filter element examples --- .../GtFilterTagElementExamples.class.st | 77 +++++++++- .../GtFiltersElementExamples.class.st | 138 ++++++++++++++++++ .../GtFilterDescriptor.class.st | 13 +- .../GtFilterTagElement.class.st | 51 ++++--- .../GtFiltersAddButtonId.class.st | 10 ++ .../GtFiltersChangedEvent.class.st | 17 ++- .../GtFiltersElement.class.st | 23 +-- 7 files changed, 287 insertions(+), 42 deletions(-) create mode 100644 src/GToolkit-Coder-Examples/GtFiltersElementExamples.class.st create mode 100644 src/GToolkit-Coder-UI/GtFiltersAddButtonId.class.st diff --git a/src/GToolkit-Coder-Examples/GtFilterTagElementExamples.class.st b/src/GToolkit-Coder-Examples/GtFilterTagElementExamples.class.st index 551014c72..17a9ad34a 100644 --- a/src/GToolkit-Coder-Examples/GtFilterTagElementExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtFilterTagElementExamples.class.st @@ -47,6 +47,8 @@ GtFilterTagElementExamples >> filterTagValueNotRequired [ "there is no editor" self assert: (tagElement query // GtFilterTagEditorId) isEmpty. + + self assert: tagElement isValid. ^ tagElement ] @@ -137,7 +139,12 @@ GtFilterTagElementExamples >> filterTagValueRequiredWithDefaultByScripter [ element: self filterTagValueRequiredWithDefault. scripter assert - satisfies: [ :anElement | anElement hasFocus not ]. + satisfies: [ :anElement | anElement isValid ]; + play. + + scripter assert + satisfies: [ :anElement | anElement hasFocus not ]; + play. scripter assert label: 'Check that the default value is set in the editor'; @@ -156,6 +163,51 @@ GtFilterTagElementExamples >> filterTagValueRequiredWithDefaultByScripter [ ^ scripter ] +{ #category : #examples } +GtFilterTagElementExamples >> filterTagValueRequiredWithDefaultByScripterRemoveText [ + + | scripter | + + scripter := self filterTagValueRequiredWithDefaultByScripter. + + scripter click + id: GtFilterTagEditorId; + play. + + scripter shortcut + id: GtFilterTagEditorId; + combination: BlKeyCombination primaryA; + play. + + scripter type + id: GtFilterTagEditorId; + text: ''; + play. + + scripter assert + label: 'Check that the new value is typed in the editor'; + id: GtFilterTagEditorId; + value: [ :anEditor | anEditor text asString ] + equals: ''; + play. + + scripter assert + satisfies: [ :anEditor | anEditor isValid not ]; + play. + + scripter shortcut + label: 'Accept changes with enter shortcut'; + id: GtFilterTagEditorId; + combination: BlKeyCombination enter; + play. + + scripter assert + eventNotFired: GtFilterTagUpdateWish; + play. + + ^ scripter +] + { #category : #examples } GtFilterTagElementExamples >> filterTagValueRequiredWithDefaultByScripterTypeAndAcceptWithClickingAway [ @@ -169,7 +221,8 @@ GtFilterTagElementExamples >> filterTagValueRequiredWithDefaultByScripterTypeAnd scripter assert id: GtFilterTagEditorId; - satisfies: [ :anEditor | anEditor hasFocus ]. + satisfies: [ :anEditor | anEditor hasFocus ]; + play. scripter shortcut id: GtFilterTagEditorId; @@ -191,15 +244,17 @@ GtFilterTagElementExamples >> filterTagValueRequiredWithDefaultByScripterTypeAnd scripter assert id: GtFilterTagEditorId; - satisfies: [ :anEditor | anEditor hasFocus ]. - + satisfies: [ :anEditor | anEditor hasFocus ]; + play. + scripter click id: GtFilterTagLabelId; play. - + scripter assert id: GtFilterTagEditorId; - satisfies: [ :anEditor | anEditor hasFocus not ]. + satisfies: [ :anEditor | anEditor hasFocus not ]; + play. scripter assert label: 'Check that update wish was fired'; @@ -226,7 +281,8 @@ GtFilterTagElementExamples >> filterTagValueRequiredWithDefaultByScripterTypeAnd scripter assert id: GtFilterTagEditorId; - satisfies: [ :anEditor | anEditor hasFocus ]. + satisfies: [ :anEditor | anEditor hasFocus ]; + play. scripter shortcut id: GtFilterTagEditorId; @@ -285,9 +341,14 @@ GtFilterTagElementExamples >> filterTagValueRequiredWithoutDefaultByScripter [ extent: 500@400; element: self filterTagValueRequiredWithoutDefault. + scripter assert + satisfies: [ :anElement | anElement isValid ]; + play. + scripter assert label: 'Does not have focus by default'; - satisfies: [ :anElement | anElement hasFocus not ]. + satisfies: [ :anElement | anElement hasFocus not ]; + play. scripter assert id: GtFilterTagEditorId; diff --git a/src/GToolkit-Coder-Examples/GtFiltersElementExamples.class.st b/src/GToolkit-Coder-Examples/GtFiltersElementExamples.class.st new file mode 100644 index 000000000..314d00c5f --- /dev/null +++ b/src/GToolkit-Coder-Examples/GtFiltersElementExamples.class.st @@ -0,0 +1,138 @@ +Class { + #name : #GtFiltersElementExamples, + #superclass : #Object, + #category : #'GToolkit-Coder-Examples-Filters' +} + +{ #category : #examples } +GtFiltersElementExamples >> emptyFiltersElement [ + + | aFiltersElement | + + aFiltersElement := GtFiltersElement new. + + self assert: (aFiltersElement query // GtFiltersAddButtonId) isNotEmpty. + + ^ aFiltersElement +] + +{ #category : #examples } +GtFiltersElementExamples >> filterDescriptors [ + ^ { + GtFilterDescriptor new + creator: GtSearchNullFilter new; + named: 'Filter with value'; + order: 1; + emptyDefaultValue: 'value'. + + GtFilterDescriptor new + creator: GtSearchNullFilter new; + named: 'Filter without value'; + order: 2; + valueNotRequired. + + GtFilterDescriptor new + creator: GtSearchNullFilter new; + named: 'Filter with empty default value'; + order: 3. + + GtFilterDescriptor + creator: GtSearchNullFilter new + named: 'Filter D' + order: 4. + } +] + +{ #category : #examples } +GtFiltersElementExamples >> filtersElementWithDescriptors [ + + | filtersElement scripter | + + filtersElement := self emptyFiltersElement. + filtersElement descriptors: self filterDescriptors. + + scripter := BlScripter new + element: filtersElement. + + scripter assert + label: 'Check how many default filters there are'; + value: [ :anElement | (anElement query // GtFilterTagElement) all size ] equals: 2; + play. + + ^ scripter +] + +{ #category : #examples } +GtFiltersElementExamples >> filtersElementWithDescriptorsBuildFilters [ + + | scripter | + + scripter := self filtersElementWithDescriptors. + scripter element + when: GtFiltersChangedEvent + do: [ :anEvent | + | aFiltersElement theFilters | + + aFiltersElement := anEvent currentTarget. + + theFilters := aFiltersElement currentFilters. + aFiltersElement buildFilters: [ + theFilters do: [ :eachFilterAndValue | + aFiltersElement + addFilterForDescriptor: eachFilterAndValue key + andValue: eachFilterAndValue value ] ] ]. + + scripter click + id: GtFiltersAddButtonId; + play. + + scripter assert + // GtFilterTagElement; + @ 3; + satisfies: [ :aTagElement | aTagElement hasFocus ]; + play. + + scripter assert + eventNotFired: GtFiltersChangedEvent; + play. + + scripter shortcut + // GtFilterTagElement; + @ 3; + // GtFilterTagEditorId; + combination: BlKeyCombination enter; + play. + + scripter assert + label: 'Make sure that the filters changed event is fired only once'; + eventFired: GtFiltersChangedEvent times: 1; + play. + + ^ scripter +] + +{ #category : #examples } +GtFiltersElementExamples >> filtersElementWithDescriptorsReplaceFilterWithTheSameFilter [ + + | scripter | + + scripter := self filtersElementWithDescriptors. + + scripter click + // GtFilterTagElement; + @ 1; + // GtFilterTagPickerId; + play. + + scripter click + onSpaceRoot; + id: (GtFilterTagPickerItemId indexed: 1); + play. + + scripter assert + label: 'Replacing filter with the same filter should not emit anything'; + eventFired: GtFiltersChangedEvent times: 0; + play. + + ^ scripter +] diff --git a/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st b/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st index 1c9ddb596..9c0c04741 100644 --- a/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st +++ b/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st @@ -157,7 +157,7 @@ GtFilterDescriptor >> gtInfoFor: aView [ 'Name' -> (name ifNil: [ 'Unspecified (default: {1})' format: { self defaultName printString } ]). 'Order' -> (order ifNil: [ 'Unspecified (default: {1})' format: { self defaultOrder printString } ]). 'Filter creator' -> (creationBlock ifNil: [ 'Unspecified (default: {1})' format: { self defaultCreator } ]). - 'Completion' -> (creationBlock ifNil: [ 'Unspecified (default: {1})' format: { self defaultCompletion } ]). + 'Completion' -> (completionBlock ifNil: [ 'Unspecified (default: {1})' format: { self defaultCompletion } ]). 'Value required' -> valueIsRequired. 'Is default' -> isDefault. 'Default value when empty' -> (emptyDefaultValue @@ -203,6 +203,17 @@ GtFilterDescriptor >> isDefault [ ^ isDefault ] +{ #category : #testing } +GtFilterDescriptor >> isValueValid: aValueString [ + "Return true if a given value is valid for this filter descriptor, false otherwise. + Empty values are valid only when the empty default value is empty too or is unspecified" + + + ^ self valueIsRequired not or: [ + aValueString isNotEmpty or: [ + aValueString = (self emptyDefaultValue ifNil: [ '' ]) ] ] +] + { #category : #accessing } GtFilterDescriptor >> name [ "Return the name of the filter (or a default one if not specified) to be displayed in the list of the filters." diff --git a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st index 1438f63cb..45d0032d8 100644 --- a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st @@ -28,8 +28,8 @@ Class { { #category : #'private - accessing' } GtFilterTagElement >> activateEditor [ self - childNamed: GtFilterTagEditorId - ifFound: [ :label | label requestFocus ] + childWithId: GtFilterTagEditorId + ifFound: [ :anEditor | anEditor requestFocus ] ifNone: [ filterLabel requestFocus ] ] @@ -39,15 +39,15 @@ GtFilterTagElement >> applyDescriptor: aDescriptor [ self activateEditor. aDescriptor valueIsRequired - ifFalse: [ self applyFilters ] + ifFalse: [ self applyFiltersDueTo: #applyDescriptor ] ] { #category : #'private - instance creation' } -GtFilterTagElement >> applyFilters [ +GtFilterTagElement >> applyFiltersDueTo: aReason [ filterElement ifNil: [ ^ self ]. - filterElement applyFilters + filterElement applyFiltersDueTo: aReason ] { #category : #'api - accessing' } @@ -118,9 +118,11 @@ GtFilterTagElement >> createEditableLabel [ value: anEvent currentTarget text asString trimmed ]). anEditor when: BlFocusOutEvent do: [ :anEvent | - self - requestUpdateFilter: filterDescriptor - value: anEvent currentTarget text asString trimmed ]. + anEvent isDueToRemoval + ifFalse: [ + self + requestUpdateFilter: filterDescriptor + value: anEvent currentTarget text asString trimmed ] ]. ^ anEditor ] @@ -273,8 +275,8 @@ GtFilterTagElement >> isDefaultAllFilter [ ] { #category : #testing } -GtFilterTagElement >> isValid [ - ^ filterDescriptor valueIsRequired not or: [ self valueString notEmpty ] +GtFilterTagElement >> isValid [ + ^ filterDescriptor isValueValid: self valueString ] { #category : #initialization } @@ -285,37 +287,46 @@ GtFilterTagElement >> makeDefaultFilter [ { #category : #'private - actions' } GtFilterTagElement >> requestRemoveFilter: aFilterDescriptor [ "Is sent by filter tag when it requests to remove a filter" + | aWish | - self dispatchEvent: (GtFilterTagRemoveWish new + self dispatchEvent: (aWish := GtFilterTagRemoveWish new filterDescriptor: aFilterDescriptor). self removeFromParent. - self applyFilters + self applyFiltersDueTo: aWish ] { #category : #'private - actions' } GtFilterTagElement >> requestReplaceFilter: aFilterDescriptor with: aNewFilterDescriptor [ - "Is sent by filter tag when it requests to replace itself with a new filter" + "Is sent by filter tag when it requests to replace itself with a new filter" + | aWish | + + aFilterDescriptor = aNewFilterDescriptor + ifTrue: [ ^ self ]. + + self descriptor: aNewFilterDescriptor. + self activateEditor. - self dispatchEvent: (GtFilterTagReplaceWish new + self dispatchEvent: (aWish := GtFilterTagReplaceWish new filterDescriptor: aFilterDescriptor; newFilterDescriptor: aNewFilterDescriptor). - - self requestFocus. - self descriptor: aNewFilterDescriptor. - self applyFilters + self applyFiltersDueTo: aWish ] { #category : #'private - actions' } GtFilterTagElement >> requestUpdateFilter: aFilterDescriptor value: aString [ "Is sent by filter tag when it requests to update the filter with a new value" + | aWish | + + (aFilterDescriptor isValueValid: aString) + ifFalse: [ ^ self ]. - self dispatchEvent: (GtFilterTagUpdateWish new + self dispatchEvent: (aWish := GtFilterTagUpdateWish new filterDescriptor: aFilterDescriptor; newValue: aString). - self applyFilters + self applyFiltersDueTo: aWish ] { #category : #'private - accessing' } diff --git a/src/GToolkit-Coder-UI/GtFiltersAddButtonId.class.st b/src/GToolkit-Coder-UI/GtFiltersAddButtonId.class.st new file mode 100644 index 000000000..caa59cc59 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFiltersAddButtonId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtFiltersAddButtonId, + #superclass : #BlElementUniqueId, + #category : #'GToolkit-Coder-UI-Filters' +} + +{ #category : #converting } +GtFiltersAddButtonId >> asSymbol [ + ^ #'filter--add-button' +] diff --git a/src/GToolkit-Coder-UI/GtFiltersChangedEvent.class.st b/src/GToolkit-Coder-UI/GtFiltersChangedEvent.class.st index ddbae2ac5..a3bafafa9 100644 --- a/src/GToolkit-Coder-UI/GtFiltersChangedEvent.class.st +++ b/src/GToolkit-Coder-UI/GtFiltersChangedEvent.class.st @@ -2,9 +2,10 @@ Class { #name : #GtFiltersChangedEvent, #superclass : #BlEvent, #instVars : [ - 'filterElement' + 'filterElement', + 'reason' ], - #category : 'GToolkit-Coder-UI-Filters' + #category : #'GToolkit-Coder-UI-Filters' } { #category : #accessing } @@ -16,3 +17,15 @@ GtFiltersChangedEvent >> filterElement [ GtFiltersChangedEvent >> filterElement: anElement [ filterElement := anElement ] + +{ #category : #accessing } +GtFiltersChangedEvent >> reason [ + + ^ reason +] + +{ #category : #accessing } +GtFiltersChangedEvent >> reason: anObject [ + + reason := anObject +] diff --git a/src/GToolkit-Coder-UI/GtFiltersElement.class.st b/src/GToolkit-Coder-UI/GtFiltersElement.class.st index 4eb3bcdbc..dc35965b7 100644 --- a/src/GToolkit-Coder-UI/GtFiltersElement.class.st +++ b/src/GToolkit-Coder-UI/GtFiltersElement.class.st @@ -19,16 +19,11 @@ Class { #category : #'GToolkit-Coder-UI-Filters' } -{ #category : #accessing } +{ #category : #private } GtFiltersElement >> addAllDefaults [ | filterElement defaultDescriptors | - defaultDescriptors := self descriptors - select: [ :each | - BlFrameTelemetry - time: [ 'Should show ' , each name , ' as default when empty?' ] - during: [ each showAsDefaultWhenEmpty ] ]. - + defaultDescriptors := self descriptors select: [ :each | each showAsDefaultWhenEmpty ]. defaultDescriptors do: [ :defaultDescriptor | filterElement := self createFilterTagFor: defaultDescriptor. @@ -48,7 +43,12 @@ GtFiltersElement >> addFilterForDescriptor: aFilterDescriptor andValue: aString { #category : #private } GtFiltersElement >> applyFilters [ - self fireEvent: (GtFiltersChangedEvent new filterElement: self) + self applyFiltersDueTo: #unknown +] + +{ #category : #private } +GtFiltersElement >> applyFiltersDueTo: aReason [ + self fireEvent: (GtFiltersChangedEvent new filterElement: self; reason: aReason) ] { #category : #private } @@ -72,7 +72,7 @@ GtFiltersElement >> asIntersectionFilter [ ^ compositeFilter ] -{ #category : #accessing } +{ #category : #'api - filters' } GtFiltersElement >> buildFilters: aBlock [ self clearFilters. aBlock value @@ -98,7 +98,7 @@ GtFiltersElement >> createNewTag [ | tag | self descriptors ifNotEmpty: [ :items | - self areAllDefaults ifTrue: [ self clearFilters ]. + "self areAllDefaults ifTrue: [ self clearFilters ]." tag := self createFilterTagFor: items first. self addChild: tag at: self childrenCount. tag activateEditor ] @@ -157,12 +157,13 @@ GtFiltersElement >> initialize [ super initialize. self hMatchParent. self vFitContent. - self addChild: self newAddTagButton as: #newButton + self addChild: self newAddTagButton ] { #category : #'private - instance creation' } GtFiltersElement >> newAddTagButton [ ^ BrButton new + id: GtFiltersAddButtonId; aptitude: BrGlamorousButtonRectangularAptitude new + BrGlamorousButtonIconAptitude new From de357d2972c3d5b5d4597f2a5d90c57b6ae1a3b5 Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Tue, 29 Nov 2022 22:52:08 +0100 Subject: [PATCH 0313/1268] remove links to inexistent classes from comment feenkcom/gtoolkit#2919 --- src/GToolkit-Coder-UI/GtFilterTagElement.class.st | 7 ------- src/GToolkit-Coder-UI/GtFiltersElement.class.st | 8 -------- 2 files changed, 15 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st index 45d0032d8..450f9a7ae 100644 --- a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st @@ -2,13 +2,6 @@ I am a {{gtClass:BlElement}}. I display one filter in a chain of filters. I am used by {{gtClass:GtFiltersElement}}. -1. # Element Example - -This is how I look like: {{gtExample:GtFiltersElementExamples>>#filterTagElement|codeExpanded=false|previewExpanded=true|previewShow=#gtLiveFor:|previewHeight=70}} -1. # Coder Example - -The following example shows a coder with default filters element that you can change: {{gtExample:GtFiltersElementExamples>>#coderWithFiltersElement|codeExpanded=false|previewExpanded=true}} - " Class { diff --git a/src/GToolkit-Coder-UI/GtFiltersElement.class.st b/src/GToolkit-Coder-UI/GtFiltersElement.class.st index dc35965b7..caaebcdd1 100644 --- a/src/GToolkit-Coder-UI/GtFiltersElement.class.st +++ b/src/GToolkit-Coder-UI/GtFiltersElement.class.st @@ -1,14 +1,6 @@ " I am a {{gtClass:BlElement}}. I build a filter in {{gtClass:GtCoderElement}}, see {{gtMethod:GtPharoMethodsCoderElement>>#buildFilter|label=#selector}}. -1. # Element Example - -The following example shows how I look like: {{gtExample:GtFiltersElementExamples>>#filtersElement|codeExpanded=false|previewExpanded=true|previewShow=#gtLiveFor:|previewHeight=70}} -1. # Coder Example - -The following example shows a coder with default filters element that you can change: {{gtExample:GtFiltersElementExamples>>#coderWithFiltersElement|codeExpanded=false|previewExpanded=true}} - - " Class { #name : #GtFiltersElement, From 6c1ef82a166fa17c16e7273322d8c9926394fbf0 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Wed, 30 Nov 2022 15:23:40 +0100 Subject: [PATCH 0314/1268] [feenkcom/gtoolkit#2919] do not apply filters if new filter requires value --- src/GToolkit-Coder-UI/GtFilterTagElement.class.st | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st index 45d0032d8..c902bc420 100644 --- a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st @@ -306,12 +306,13 @@ GtFilterTagElement >> requestReplaceFilter: aFilterDescriptor with: aNewFilterDe self descriptor: aNewFilterDescriptor. self activateEditor. - + self dispatchEvent: (aWish := GtFilterTagReplaceWish new filterDescriptor: aFilterDescriptor; newFilterDescriptor: aNewFilterDescriptor). - self applyFiltersDueTo: aWish + aNewFilterDescriptor valueIsRequired + ifFalse: [ self applyFiltersDueTo: aWish ] ] { #category : #'private - actions' } From b96db3368eaef452bd23d1ef91f5a414d5ad0a22 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Wed, 30 Nov 2022 17:17:23 +0100 Subject: [PATCH 0315/1268] Add `hasSelectedPackageOrClass` to navigation model --- src/GToolkit-Coder/GtCoderNavigationModel.class.st | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder/GtCoderNavigationModel.class.st b/src/GToolkit-Coder/GtCoderNavigationModel.class.st index 44e62a2b3..0c850e43f 100644 --- a/src/GToolkit-Coder/GtCoderNavigationModel.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationModel.class.st @@ -1,7 +1,7 @@ Class { #name : #GtCoderNavigationModel, #superclass : #Object, - #category : 'GToolkit-Coder-Navigation - Model' + #category : #'GToolkit-Coder-Navigation - Model' } { #category : #factory } @@ -32,6 +32,12 @@ GtCoderNavigationModel >> hasSelectedPackage [ ^ self subclassResponsibility ] +{ #category : #'api - testing' } +GtCoderNavigationModel >> hasSelectedPackageOrClass [ + + ^ self hasSelectedPackage or: [ self hasSelectedClass ] +] + { #category : #'api - testing' } GtCoderNavigationModel >> hasSelectedTag [ From 64f79a9383dcff7ce555428cf1211e1f22e68935 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Thu, 1 Dec 2022 14:26:47 +0100 Subject: [PATCH 0316/1268] Move coder toolbar buttons from toolbar to class actions directly on classes [feenkcom/gtoolkit#2694] --- .../Behavior.extension.st | 5 +- .../CompiledMethod.extension.st | 2 +- .../ProtoObject.extension.st | 5 +- .../RPackage.extension.st | 2 +- src/GToolkit-Coder-UI/GtCoder.class.st | 10 + src/GToolkit-Coder-UI/GtCoderTool.class.st | 5 +- .../GtCoderToolbarElement.class.st | 182 ++---------------- src/GToolkit-Coder/Behavior.extension.st | 156 +++++++++++++++ src/GToolkit-Coder/BrStencil.extension.st | 12 ++ 9 files changed, 205 insertions(+), 174 deletions(-) create mode 100644 src/GToolkit-Coder/Behavior.extension.st create mode 100644 src/GToolkit-Coder/BrStencil.extension.st diff --git a/src/GToolkit-Coder-Extensions/Behavior.extension.st b/src/GToolkit-Coder-Extensions/Behavior.extension.st index 66232e4eb..7d96b61b9 100644 --- a/src/GToolkit-Coder-Extensions/Behavior.extension.st +++ b/src/GToolkit-Coder-Extensions/Behavior.extension.st @@ -7,9 +7,8 @@ Behavior >> gtBrowse [ { #category : #'*GToolkit-Coder-Extensions' } Behavior >> gtBrowseFrom: anElement [ - ^ ((GtCoder forClass: self) - openInPagerFrom: anElement) - maximized + ^ ((GtPhlowCoderView new coder: (GtCoder forClass: self)) asElement + openInPagerFrom: anElement) maximized ] { #category : #'*GToolkit-Coder-Extensions' } diff --git a/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st b/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st index 6dcd26072..834d7cc17 100644 --- a/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st +++ b/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st @@ -9,7 +9,7 @@ CompiledMethod >> gtBrowse [ { #category : #'*GToolkit-Coder-Extensions' } CompiledMethod >> gtBrowseFrom: anElement [ - ^ ((GtCoder forMethod: self) + ^ ((GtPhlowCoderView new coder: (GtCoder forMethod: self)) asElement openInPagerFrom: anElement) maximized ] diff --git a/src/GToolkit-Coder-Extensions/ProtoObject.extension.st b/src/GToolkit-Coder-Extensions/ProtoObject.extension.st index 71438cf91..798c8a591 100644 --- a/src/GToolkit-Coder-Extensions/ProtoObject.extension.st +++ b/src/GToolkit-Coder-Extensions/ProtoObject.extension.st @@ -7,7 +7,6 @@ ProtoObject >> gtBrowse [ { #category : #'*GToolkit-Coder-Extensions' } ProtoObject >> gtBrowseFrom: anElement [ - ^ ((GtCoder forObject: self) - openInPagerFrom: anElement) - maximized + ^ ((GtPhlowCoderView new coder: (GtCoder forObject: self)) asElement + openInPagerFrom: anElement) maximized ] diff --git a/src/GToolkit-Coder-Extensions/RPackage.extension.st b/src/GToolkit-Coder-Extensions/RPackage.extension.st index 82c610523..b7708da4c 100644 --- a/src/GToolkit-Coder-Extensions/RPackage.extension.st +++ b/src/GToolkit-Coder-Extensions/RPackage.extension.st @@ -40,7 +40,7 @@ RPackage >> gtBrowse [ { #category : #'*GToolkit-Coder-Extensions' } RPackage >> gtBrowseFrom: anElement [ - ^ ((GtCoder forPackage: self) + ^ ((GtPhlowCoderView new coder: (GtCoder forPackage: self)) asElement openInPagerFrom: anElement) maximized ] diff --git a/src/GToolkit-Coder-UI/GtCoder.class.st b/src/GToolkit-Coder-UI/GtCoder.class.st index b9b051adb..83b36578f 100644 --- a/src/GToolkit-Coder-UI/GtCoder.class.st +++ b/src/GToolkit-Coder-UI/GtCoder.class.st @@ -99,6 +99,16 @@ GtCoder >> pagerWindowTitle [ ^ self shortTitle ] +{ #category : #accessing } +GtCoder >> repository [ + + self navigationModel hasSelectedClass ifTrue: [ + ^ self navigationModel selectedClass repository ]. + self navigationModel hasSelectedPackage ifTrue: [ + ^ self navigationModel selectedPackage repository ]. + ^ nil +] + { #category : #'private - accessing' } GtCoder >> shortTitle [ ^ (GtPhlowTitleLabelBuilder diff --git a/src/GToolkit-Coder-UI/GtCoderTool.class.st b/src/GToolkit-Coder-UI/GtCoderTool.class.st index 337a9f711..8beab7fb6 100644 --- a/src/GToolkit-Coder-UI/GtCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtCoderTool.class.st @@ -1,14 +1,15 @@ Class { #name : #GtCoderTool, #superclass : #GtPhlowTool, - #category : 'GToolkit-Coder-UI-Tools' + #category : #'GToolkit-Coder-UI-Tools' } { #category : #converting } GtCoderTool >> asElementDo: aOneArgBlock [ "Create a tool element and execute the block." - ^ aOneArgBlock cull: self newCoder asPagerPageElement + ^ aOneArgBlock + cull: (GtPhlowCoderView new coder: self newCoder) asElement asPagerPageElement ] { #category : #'api - converting' } diff --git a/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st b/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st index 5fbfe01e1..488d23892 100644 --- a/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st @@ -15,50 +15,18 @@ Class { #category : #'GToolkit-Coder-UI-Basic' } -{ #category : #accessing } -GtCoderToolbarElement >> addButtonFor: anAction [ - - ^ anAction dropdown - icon: BrGlamorousVectorIcons add; - tooltip: 'Add class or package'; - priority: 5; - content: [ :aDropdown | - | element | - element := BlElement new. - element - constraintsDo: [ :c | - c horizontal exact: 400. - c vertical exact: 300 ]. - element addChild: (self newAddInterface: aDropdown). - element ] -] - -{ #category : #'gt-extensions' } -GtCoderToolbarElement >> addClassTab: look [ - - ^ BrTab new - aptitude: BrGlamorousTabAptitude new; - label: 'Class'; - stencil: [ | element | - element := GtPharoCreateBehaviorElement new. - element - behaviorBlock: [ :cls | - look fireEvent: BrDropdownHideWish new. - navigationModel selectClass: cls ]. - element forClassDefinition. - navigationModel - selectedPackageDo: [ :package | element forPackage: package ]. - navigationModel - selectedTagDo: [ :tag | element forPackageTag: tag ]. - element ] -] - { #category : #initialization } GtCoderToolbarElement >> addCustomButtons [ - (GtPhlowActionsCollector new - pragmaName: #gtAction; - fromObject: self; - to: self class; + | classToUse | + classToUse := self navigationModel hasSelectedClass + ifTrue: [ self navigationModel selectedClass ] + ifFalse: [ self navigationModel hasSelectedPackage + ifTrue: [ self navigationModel selectedPackage ] + ifFalse: [ self class ] ]. + (GtPhlowClassActionsCollector new + pragmaName: #gtClassAction; + from: classToUse class; + to: Behavior; collect) do: [ :each | each @@ -66,79 +34,6 @@ GtCoderToolbarElement >> addCustomButtons [ withHostElement: self ] ] -{ #category : #'gt-extensions' } -GtCoderToolbarElement >> addPackageTab: look [ - - ^ BrTab new - aptitude: BrGlamorousTabAptitude new; - label: 'Package'; - stencil: [ | element | - element := GtPharoCreatePackageElement new. - element - packageBlock: [ :pkg :tag | - look fireEvent: BrDropdownHideWish new. - tag isNil - ifTrue: [ self navigationModel selectPackage: pkg ] - ifFalse: [ self navigationModel selectPackageTag: tag ] ]. - self navigationModel - selectedPackageDo: [ :package | element forPackage: package ]. - element ] -] - -{ #category : #'gt-extensions' } -GtCoderToolbarElement >> addTraitTab: look [ - - ^ BrTab new - aptitude: BrGlamorousTabAptitude new; - label: 'Trait'; - stencil: [ | element | - element := GtPharoCreateBehaviorElement new. - element - behaviorBlock: [ :cls | - look fireEvent: BrDropdownHideWish new. - self navigationModel selectClass: cls ]. - element forTraitDefinition. - self navigationModel - selectedPackageDo: [ :package | element forPackage: package ]. - self navigationModel - selectedTagDo: [ :tag | element forPackageTag: tag ]. - element ] -] - -{ #category : #accessing } -GtCoderToolbarElement >> browseButtonFor: anAction [ - - ^ anAction button - tooltip: 'Browse in another world tab'; - priority: 1; - icon: BrGlamorousVectorIcons emphasizedBrowse; - action: [ :aButton | self browseFrom: aButton ] -] - -{ #category : #'private - actions' } -GtCoderToolbarElement >> browseFrom: anElement [ - "Do we want to share the same coder model?" - self navigationModel coderDo: [ :aCoder | - ((GtCoder forCoder: aCoder asNewCoderModelWithSameSubject) - openInPagerFrom: anElement) - maximized ] -] - -{ #category : #accessing } -GtCoderToolbarElement >> hierarchyButtonFor: anAction [ - - ^ anAction dropdown - tooltip: 'Show Package and Class Hierarchies'; - icon: BrGlamorousIcons tree; - priority: 3; - content: [ - BlElement new - size: 400@400; - addChild: ((GtCoderNavigationTabsStencil new - navigationModel: navigationModel; - asElement) background: Color white) ] -] - { #category : #initialization } GtCoderToolbarElement >> initialize [ super initialize. @@ -158,58 +53,11 @@ GtCoderToolbarElement >> initializeToolbarElement [ toolbarElement := BrToolbar new aptitude: BrGlamorousToolbarAptitude new; padding: (BlInsets right: 5). - self addCustomButtons -] - -{ #category : #'private - instance creation' } -GtCoderToolbarElement >> newAddInterface: look [ - | contentTabs tabMethods | - contentTabs := BrTabGroup new. - contentTabs aptitude: BrGlamorousTabGroupAptitude new. - contentTabs - constraintsDo: [ :c | - c horizontal matchParent. - c vertical matchParent ]. - tabMethods := (Pragma allNamed: #gtCreateComponentTab: in: self class) - asSortedCollection: [ :a :b | a arguments first < b arguments first ]. - tabMethods - do: - [ :each | contentTabs addTab: (self perform: each method selector with: look) ]. - ^ contentTabs ] { #category : #initialization } -GtCoderToolbarElement >> repository [ - - self navigationModel hasSelectedClass ifTrue: [ - ^ self navigationModel selectedClass repository ]. - self navigationModel hasSelectedPackage ifTrue: [ - ^ self navigationModel selectedPackage repository ]. - ^ nil -] - -{ #category : #accessing } -GtCoderToolbarElement >> spotterButtonFor: anAction [ - - ^ anAction explicit - priority: 2; - stencil: [ GtSpotterDropdownButtonStencil new - valuable: (GtCoderSpotterStart new navigationModelBlock: [ self navigationModel ]); - tooltip: 'Search Code'; - actOn: [ :anActOnEvent :anItem :theButton | - | acted | - acted := false. - (anItem isKindOf: RPackage) - ifTrue: [ self navigationModel selectPackage: anItem. - acted := true ]. - (anItem isKindOf: ClassDescription) - ifTrue: [ self navigationModel selectClass: anItem. - acted := true ]. - (anItem isKindOf: CompiledMethod) - ifTrue: [ self navigationModel selectMethod: anItem. - acted := true ]. - acted ifTrue: [ anActOnEvent beActed ] ]; - asElement ] +GtCoderToolbarElement >> onNavigationModelChanged [ + self updateCustomButtons ] { #category : #accessing } @@ -217,3 +65,9 @@ GtCoderToolbarElement >> toolbarElement [ ^ toolbarElement ] + +{ #category : #initialization } +GtCoderToolbarElement >> updateCustomButtons [ + toolbarElement removeChildren. + self addCustomButtons +] diff --git a/src/GToolkit-Coder/Behavior.extension.st b/src/GToolkit-Coder/Behavior.extension.st new file mode 100644 index 000000000..deb44724f --- /dev/null +++ b/src/GToolkit-Coder/Behavior.extension.st @@ -0,0 +1,156 @@ +Extension { #name : #Behavior } + +{ #category : #'*GToolkit-Coder' } +Behavior >> gtAddButtonFor: anAction [ + + ^ anAction dropdown + icon: BrGlamorousVectorIcons add; + tooltip: 'Add class or package'; + priority: 5; + content: [ :aDropdown | + | element | + element := BlElement new. + element + constraintsDo: [ :c | + c horizontal exact: 400. + c vertical exact: 300 ]. + element addChild: (self gtAddInterface: aDropdown). + element ] +] + +{ #category : #'*GToolkit-Coder' } +Behavior >> gtAddClassTab: look [ + + ^ BrTab new + aptitude: BrGlamorousTabAptitude new; + label: 'Class'; + stencil: [ | element navigationModel | + element := GtPharoCreateBehaviorElement new. + navigationModel := look phlow firstParentWithView navigationModel. + element + behaviorBlock: [ :cls | + look fireEvent: BrDropdownHideWish new. + navigationModel selectClass: cls ]. + element forClassDefinition. + navigationModel selectedPackageDo: [ :package | element forPackage: package ]. + navigationModel selectedTagDo: [ :tag | element forPackageTag: tag ]. + element ] +] + +{ #category : #'*GToolkit-Coder' } +Behavior >> gtAddInterface: look [ + | contentTabs tabMethods | + contentTabs := BrTabGroup new. + contentTabs aptitude: BrGlamorousTabGroupAptitude new. + contentTabs + constraintsDo: [ :c | + c horizontal matchParent. + c vertical matchParent ]. + tabMethods := (Pragma allNamed: #gtCreateComponentTab: from: self class to: Behavior) + asSortedCollection: [ :a :b | a arguments first < b arguments first ]. + tabMethods + do: + [ :each | contentTabs addTab: (self perform: each method selector with: look) ]. + ^ contentTabs +] + +{ #category : #'*GToolkit-Coder' } +Behavior >> gtAddPackageTab: look [ + + ^ BrTab new + aptitude: BrGlamorousTabAptitude new; + label: 'Package'; + stencil: [ | element navigationModel | + element := GtPharoCreatePackageElement new. + navigationModel := look phlow firstParentWithView navigationModel. + element + packageBlock: [ :pkg :tag | + look fireEvent: BrDropdownHideWish new. + tag isNil + ifTrue: [ navigationModel selectPackage: pkg ] + ifFalse: [ navigationModel selectPackageTag: tag ] ]. + navigationModel selectedPackageDo: [ :package | element forPackage: package ]. + element ] +] + +{ #category : #'*GToolkit-Coder' } +Behavior >> gtAddTraitTab: look [ + + ^ BrTab new + aptitude: BrGlamorousTabAptitude new; + label: 'Trait'; + stencil: [ | element navigationModel | + element := GtPharoCreateBehaviorElement new. + navigationModel := look phlow firstParentWithView navigationModel. + element + behaviorBlock: [ :cls | + look fireEvent: BrDropdownHideWish new. + navigationModel selectClass: cls ]. + element forTraitDefinition. + navigationModel selectedPackageDo: [ :package | element forPackage: package ]. + navigationModel selectedTagDo: [ :tag | element forPackageTag: tag ]. + element ] +] + +{ #category : #'*GToolkit-Coder' } +Behavior >> gtBrowseButtonFor: anAction [ + + ^ anAction button + tooltip: 'Browse in another world tab'; + priority: 1; + icon: BrGlamorousVectorIcons emphasizedBrowse; + action: [ :aButton | self gtBrowseFromButton: aButton ] +] + +{ #category : #'*GToolkit-Coder' } +Behavior >> gtBrowseFromButton: anElement [ + "Do we want to share the same coder model?" + anElement phlow firstParentWithView navigationModel coderDo: [ :aCoder | + ((GtCoder forCoder: aCoder asNewCoderModelWithSameSubject) + openInPagerFrom: anElement) + maximized ] +] + +{ #category : #'*GToolkit-Coder' } +Behavior >> gtHierarchyButtonFor: anAction [ + + ^ anAction dropdown + tooltip: 'Show Package and Class Hierarchies'; + icon: BrGlamorousIcons tree; + priority: 3; + content: [ :aButton | + | coder | + coder := aButton phlow firstParentWithView. + BlElement new + size: 400 @ 400; + addChild: ((GtCoderNavigationTabsStencil new + navigationModel: coder navigationModel; + asElement) background: Color white) ] +] + +{ #category : #'*GToolkit-Coder' } +Behavior >> gtSpotterButtonFor: anAction [ + + ^ anAction explicit + priority: 2; + stencil: [ :aButton | + | aNavigationModel | + GtSpotterDropdownButtonStencil new + valuable: (GtCoderSpotterStart new + navigationModelBlock: [ aNavigationModel := aButton phlow firstParentWithView navigationModel ]); + tooltip: 'Search Code'; + actOn: [ :anActOnEvent :anItem :theButton | + | acted | + acted := false. + (anItem isKindOf: RPackage) + ifTrue: [ aNavigationModel selectPackage: anItem. + acted := true ]. + (anItem isKindOf: ClassDescription) + ifTrue: [ aNavigationModel selectClass: anItem. + acted := true ]. + (anItem isKindOf: CompiledMethod) + ifTrue: [ aNavigationModel selectMethod: anItem. + acted := true ]. + acted ifTrue: [ anActOnEvent beActed ] ]; + asElement ] +] diff --git a/src/GToolkit-Coder/BrStencil.extension.st b/src/GToolkit-Coder/BrStencil.extension.st new file mode 100644 index 000000000..443f1d418 --- /dev/null +++ b/src/GToolkit-Coder/BrStencil.extension.st @@ -0,0 +1,12 @@ +Extension { #name : #BrStencil } + +{ #category : #'*GToolkit-Coder' } +BrStencil class >> gtInspectActionFor: anAction [ + + self isAbstract ifTrue: [ ^ anAction noAction ]. + ^ anAction button + icon: BrGlamorousVectorIcons playinspect; + tooltip: 'Inspect Stencil'; + priority: 10; + action: [ :aButton | aButton phlow spawnObject: self new ] +] From cb1e1db6b7e6b05b350d0d04908b2facb807e594 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 1 Dec 2022 11:25:36 -0600 Subject: [PATCH 0317/1268] First cut at adding slot navigation --- ...igationPackagesTagsClassesElement.class.st | 140 ++++++++++++++---- ...ssCoderSlotNavigationAnnouncement.class.st | 29 ++++ 2 files changed, 141 insertions(+), 28 deletions(-) create mode 100644 src/GToolkit-Coder/GtClassCoderSlotNavigationAnnouncement.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 64f0b8929..364b78e37 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -11,7 +11,9 @@ Class { 'methodsLabel', 'methodGroup', 'methodGroupList', - 'protocolGroup' + 'protocolGroup', + 'slotsGroup', + 'slotsGroupList' ], #category : #'GToolkit-Coder-UI-Navigation' } @@ -40,6 +42,27 @@ GtCoderNavigationPackagesTagsClassesElement >> addPackage: aPackage tag: aPackag self selectPackageOrTag: aSelectedPackageOrTag ]. ] +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> buildCategorySlotTabs [ + | aTabGroup | + aTabGroup := BrTabGroup new. + aTabGroup aptitude: BrGlamorousTabGroupAptitude new. + + aTabGroup + addTab: (BrTab new + aptitude: BrGlamorousTabAptitude new; + label: 'Categories'; + stencil: [ methodProtocolsList ]). + + aTabGroup + addTab: (BrTab new + aptitude: BrGlamorousTabAptitude new; + label: 'Slots'; + stencil: [ slotsGroupList ]). + + ^ aTabGroup +] + { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> buildGroupList [ ^ BrGroupedList new @@ -106,6 +129,42 @@ GtCoderNavigationPackagesTagsClassesElement >> buildProtocolGroupList [ ^ list ] +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> buildSlotGroupWithBinder: binderBlock onClick: clickBlock [ + | classGroup instanceGroup | + instanceGroup := BrGroup new + domainObject: 'instance slots'; + stream: #() asAsyncStream; + itemStencil: [ | label | + label := BrLabel new + hMatchParent; + vFitContent; + beSmallSize; + aptitude: BrGlamorousLabelAptitude + BrGlamorousListItemAptitude + + (BrStyleCommonAptitude new + hovered: [ :aStyle | aStyle background: self theme item selectedColor ]); + when: BlClickEvent do: clickBlock ]; + itemDataBinder: binderBlock; + shouldShowWithoutItems: false. + ^ {instanceGroup} +] + +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> buildSlotsGroupList [ + | list | + list := self buildGroupList. + slotsGroup := self + buildSlotGroupWithBinder: [ :label :item | + label text: item name asRopedText. + label userData at: #slot put: item. + label ] + onClick: [ :event | + event consumed: true. + self onSlotsListSelectionChanged ]. + list groups: slotsGroup. + ^ list +] + { #category : #'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> deselectPackages [ packagesList deselectAll @@ -151,25 +210,14 @@ GtCoderNavigationPackagesTagsClassesElement >> initializeContent [ super initializeContent. packagesList := GtCoderNavigationPackagesTreeElement new padding: (BlInsets right: 10). - methodProtocolsList := self buildProtocolGroupList. - - classAndMethodProtocolList := BrVerticalPane new - matchParent; - addChild: classesList; - addChild: (protocolLabel := BrLabel new - aptitude: (BrGlamorousLabelAptitude new - fontSize: 12; - foreground: Color gray); - text: 'Categories'); - addChild: methodProtocolsList. - + slotsGroupList := self buildSlotsGroupList. methodGroupList := self buildMethodGroupList ] { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> initializeElement [ - | pane1 pane2 pane3 | + | pane1 pane2 pane3 pane4 | super initializeElement. pane1 := BrVerticalPane new addAptitude: BrGlamorousWithHorizontalResizerAptitude; @@ -188,8 +236,12 @@ GtCoderNavigationPackagesTagsClassesElement >> initializeElement [ fontSize: 12; foreground: Color gray); text: 'Classes'. - classAndMethodProtocolList}. + classesList}. pane3 := BrVerticalPane new + matchParent; + addChildren: { self buildCategorySlotTabs }. + + pane4 := BrVerticalPane new matchParent; addChildren: {methodsLabel := BrLabel new aptitude: (BrGlamorousLabelAptitude new @@ -200,7 +252,8 @@ GtCoderNavigationPackagesTagsClassesElement >> initializeElement [ self addChildren: {pane1. pane2. - pane3} + pane3. + pane4} ] { #category : #initialization } @@ -334,8 +387,8 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackagesSelected: anAnnouncer [ GtCoderNavigationPackagesTagsClassesElement >> onProtocolListSelectionChanged [ | anIndex aSelectedItem theIndices instMeths classMeths | supressListChanges ifTrue: [ ^ self ]. - theIndices := methodProtocolsList selectedIndices. - theIndices ifEmpty: [ ^ self ]. + slotsGroupList deselectAll. + theIndices := methodProtocolsList selectedIndices ifEmpty: [ ^ self ]. anIndex := theIndices first. (anIndex between: 1 and: methodProtocolsList viewModel entityCount) ifFalse: [ ^ self ]. @@ -355,6 +408,19 @@ GtCoderNavigationPackagesTagsClassesElement >> onProtocolListSelectionChanged [ self updateMethodListWith: instMeths and: classMeths ] +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> onSlotsListSelectionChanged [ + | theIndices anIndex aSelectedItem | + supressListChanges ifTrue: [ ^ self ]. + methodProtocolsList deselectAll. + theIndices := slotsGroupList selectedIndices ifEmpty: [ ^ self ]. + anIndex := theIndices first. + (anIndex between: 1 and: slotsGroupList viewModel entityCount) + ifFalse: [ ^ self ]. + aSelectedItem := (slotsGroupList viewModel entityAt: anIndex) value object. + self navigationModel selectSlot: aSelectedItem source: self. +] + { #category : #'api - package updates' } GtCoderNavigationPackagesTagsClassesElement >> removePackage: aPackage [ | aSelectedPackageOrTag anIndex | @@ -421,7 +487,8 @@ GtCoderNavigationPackagesTagsClassesElement >> selectClass: aClass inPackage: aP or: [ self selectedPackageTag ~= aPackageTag ]) ifTrue: [ self selectPackage: aPackage tag: aPackageTag ]. self selectClass: aClass. - self updateProtocolList + self updateProtocolList. + self updateSlotList ] { #category : #'api - package selections' } @@ -500,8 +567,8 @@ GtCoderNavigationPackagesTagsClassesElement >> selectedPackageTagNodeDo: aBlock { #category : #'showing / hiding' } GtCoderNavigationPackagesTagsClassesElement >> showClassList [ - classAndMethodProtocolList visibility: BlVisibility visible. - classesLabel visibility: BlVisibility visible. + classesList visibility: BlVisibility visible. + classesLabel visibility: BlVisibility visible ] { #category : #subscriptions } @@ -509,7 +576,8 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToContent [ super subscribeToContent. self subscribeToPackageList. self subscribeToClassList. - self subscribeToProtocolList + self subscribeToProtocolList. + self subscribeToSlotList. ] { #category : #'api - package updates' } @@ -549,11 +617,19 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToProtocolList [ do: [ :anEvent | self onProtocolListSelectionChanged ] ] +{ #category : #subscriptions } +GtCoderNavigationPackagesTagsClassesElement >> subscribeToSlotList [ + slotsGroupList + when: BrSelectionChanged + do: [ :anEvent | self onSlotsListSelectionChanged ] +] + { #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updateClassLists [ self hasNavigationModel ifFalse: [ ^ self ]. classesList initializeWithClasses: navigationModel classesToShow. - self updateProtocolList + self updateProtocolList. + self updateSlotList ] { #category : #'updating lists' } @@ -611,13 +687,9 @@ GtCoderNavigationPackagesTagsClassesElement >> updateProtocolList [ updateMethodListWith: navigationModel selectedClass methods and: (navigationModel selectedClass class methods reject: [ :meth | meth isFromTrait ]). - - methodsLabel visibility: BlVisibility visible. - protocolLabel visibility: BlVisibility visible ] + methodsLabel visibility: BlVisibility visible ] ifFalse: [ self updateProtocolListWith: #() and: #(). self updateMethodListWith: #() and: #(). - - protocolLabel visibility: BlVisibility hidden. methodProtocolsList visibility: BlVisibility hidden. methodsLabel visibility: BlVisibility hidden ] ] @@ -650,3 +722,15 @@ GtCoderNavigationPackagesTagsClassesElement >> updateSelectedPackageAndTag [ tag: navigationModel selectedTag ] ifFalse: [ self selectPackage: navigationModel selectedPackage ] ] ] + +{ #category : #'api - class selections' } +GtCoderNavigationPackagesTagsClassesElement >> updateSlotList [ + | slotStream slots | + slotsGroupList deselectAll. + navigationModel hasSelectedClass + ifTrue: [ slots := navigationModel selectedClass instanceVariables. + slotStream := slots asSortedCollection: [ :a :b | a name < b name ]. + slotsGroup with: {slotStream} do: [ :grp :str | grp items: str ] ] + ifFalse: [ slotsGroup with: {#()} do: [ :grp :str | grp items: str ] ]. + slotsGroupList groups: slotsGroup +] diff --git a/src/GToolkit-Coder/GtClassCoderSlotNavigationAnnouncement.class.st b/src/GToolkit-Coder/GtClassCoderSlotNavigationAnnouncement.class.st new file mode 100644 index 000000000..bece2402f --- /dev/null +++ b/src/GToolkit-Coder/GtClassCoderSlotNavigationAnnouncement.class.st @@ -0,0 +1,29 @@ +Class { + #name : #GtClassCoderSlotNavigationAnnouncement, + #superclass : #Announcement, + #instVars : [ + 'slot', + 'source' + ], + #category : #'GToolkit-Coder-Coders' +} + +{ #category : #'as yet unclassified' } +GtClassCoderSlotNavigationAnnouncement >> slot [ + ^ slot +] + +{ #category : #accessing } +GtClassCoderSlotNavigationAnnouncement >> slot: aSlot [ + slot := aSlot +] + +{ #category : #'as yet unclassified' } +GtClassCoderSlotNavigationAnnouncement >> source [ + ^ source +] + +{ #category : #accessing } +GtClassCoderSlotNavigationAnnouncement >> source: aSource [ + source := aSource +] From 4e0fb0ba9692a28df36af52c32706f2b127b0669 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 1 Dec 2022 12:17:50 -0600 Subject: [PATCH 0318/1268] Improved layout --- ...igationPackagesTagsClassesElement.class.st | 24 +++++------ .../GtProtocolSlotTabAptitude.class.st | 43 +++++++++++++++++++ 2 files changed, 53 insertions(+), 14 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtProtocolSlotTabAptitude.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 364b78e37..bcb98a84b 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -45,20 +45,16 @@ GtCoderNavigationPackagesTagsClassesElement >> addPackage: aPackage tag: aPackag { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> buildCategorySlotTabs [ | aTabGroup | - aTabGroup := BrTabGroup new. - aTabGroup aptitude: BrGlamorousTabGroupAptitude new. - - aTabGroup - addTab: (BrTab new - aptitude: BrGlamorousTabAptitude new; - label: 'Categories'; - stencil: [ methodProtocolsList ]). - - aTabGroup - addTab: (BrTab new - aptitude: BrGlamorousTabAptitude new; - label: 'Slots'; - stencil: [ slotsGroupList ]). + aTabGroup := BrTabGroup new + aptitude: BrGlamorousTabGroupAptitude new; + addTab: (BrTab new + aptitude: GtProtocolSlotTabAptitude new; + label: 'Categories' asRopedText glamorousCodeSmallSize; + stencil: [ methodProtocolsList ]); + addTab: (BrTab new + aptitude: GtProtocolSlotTabAptitude new; + label: 'Slots' asRopedText glamorousCodeSmallSize; + stencil: [ slotsGroupList ]). ^ aTabGroup ] diff --git a/src/GToolkit-Coder-UI/GtProtocolSlotTabAptitude.class.st b/src/GToolkit-Coder-UI/GtProtocolSlotTabAptitude.class.st new file mode 100644 index 000000000..7070c900e --- /dev/null +++ b/src/GToolkit-Coder-UI/GtProtocolSlotTabAptitude.class.st @@ -0,0 +1,43 @@ +Class { + #name : #GtProtocolSlotTabAptitude, + #superclass : #BrTabAptitude, + #instVars : [ + 'bar' + ], + #category : #'GToolkit-Coder-UI-Navigation' +} + +{ #category : #accessing } +GtProtocolSlotTabAptitude >> initialize [ + super initialize. + self add: (BrGlamorousTextLabelAptitude new foreground: Color gray). + self add: BrGlamorousTabActionbarAptitude new. + self add: BrLayoutResizerAptitude inherit. + self add: BrLayoutAlignmentAptitude forHorizontalLinearLayout. + bar := BlElement new + visibility: BlVisibility hidden; + background: self theme default primaryBorderColor; + constraintsDo: [ :c | + c ignoreByLayout. + c ignored vertical alignBottom. + c vertical exact: 2. + c horizontal matchParent ]. + self + add: + (BrStyleCommonAptitude new + default: [ :aStyle | + aStyle + padding: + (BlInsets + top: 0 + left: 12 + bottom: 0 + right: 12) ]). + self + add: + (BrStyleCommonAptitude new + @ bar; + deselected: [ :aStyle | aStyle hidden ]; + selected: [ :aStyle | aStyle visible ]). + self addChangeAddChildAs: #(content bar) with: [ bar ] +] From 14e466617bee0973d56a290e4d66cb677be12079 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Fri, 2 Dec 2022 10:02:06 +0100 Subject: [PATCH 0319/1268] Move spotter button in coder over to navigation --- .../GtCoderNavigationTabsStencil.class.st | 26 +++++++++++++++--- src/GToolkit-Coder/Behavior.extension.st | 27 ------------------- 2 files changed, 23 insertions(+), 30 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index c708e315c..c0c81114e 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -5,7 +5,7 @@ Class { 'navigations', 'navigationModel' ], - #category : 'GToolkit-Coder-UI-Navigation' + #category : #'GToolkit-Coder-UI-Navigation' } { #category : #adding } @@ -65,8 +65,28 @@ GtCoderNavigationTabsStencil >> gtPackagesTagsClassesFor: aView [ ^ aView explicit title: 'Package Hierarchy'; priority: 1; - stencil: [ GtCoderNavigationPackagesTagsClassesElement new - navigationModel: self navigationModel ] + stencil: [ GtCoderNavigationPackagesTagsClassesElement new + navigationModel: self navigationModel ]; + actionStencil: [ :aButton | + GtSpotterDropdownButtonStencil new + valuable: (GtCoderSpotterStart new + navigationModelBlock: [ self navigationModel ]); + tooltip: 'Search Code'; + actOn: [ :anActOnEvent :anItem :theButton | + | acted | + acted := false. + (anItem isKindOf: RPackage) + ifTrue: [ self navigationModel selectPackage: anItem. + acted := true ]. + (anItem isKindOf: ClassDescription) + ifTrue: [ self navigationModel selectClass: anItem. + acted := true ]. + (anItem isKindOf: CompiledMethod) + ifTrue: [ self navigationModel selectMethod: anItem. + acted := true ]. + acted ifTrue: [ anActOnEvent beActed ] ]; + asElement ] + tooltip: 'Search Code' ] { #category : #accessing } diff --git a/src/GToolkit-Coder/Behavior.extension.st b/src/GToolkit-Coder/Behavior.extension.st index deb44724f..387bcd5fc 100644 --- a/src/GToolkit-Coder/Behavior.extension.st +++ b/src/GToolkit-Coder/Behavior.extension.st @@ -127,30 +127,3 @@ Behavior >> gtHierarchyButtonFor: anAction [ navigationModel: coder navigationModel; asElement) background: Color white) ] ] - -{ #category : #'*GToolkit-Coder' } -Behavior >> gtSpotterButtonFor: anAction [ - - ^ anAction explicit - priority: 2; - stencil: [ :aButton | - | aNavigationModel | - GtSpotterDropdownButtonStencil new - valuable: (GtCoderSpotterStart new - navigationModelBlock: [ aNavigationModel := aButton phlow firstParentWithView navigationModel ]); - tooltip: 'Search Code'; - actOn: [ :anActOnEvent :anItem :theButton | - | acted | - acted := false. - (anItem isKindOf: RPackage) - ifTrue: [ aNavigationModel selectPackage: anItem. - acted := true ]. - (anItem isKindOf: ClassDescription) - ifTrue: [ aNavigationModel selectClass: anItem. - acted := true ]. - (anItem isKindOf: CompiledMethod) - ifTrue: [ aNavigationModel selectMethod: anItem. - acted := true ]. - acted ifTrue: [ anActOnEvent beActed ] ]; - asElement ] -] From 321d30ac3ae1ea2f17899ffacbe58da1fbef8008 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 2 Dec 2022 07:11:05 -0600 Subject: [PATCH 0320/1268] Shows class instvars and class vars --- ...igationPackagesTagsClassesElement.class.st | 32 +++++++++++++------ .../GtProtocolSlotTabAptitude.class.st | 2 +- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index bcb98a84b..a64a847aa 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -46,7 +46,7 @@ GtCoderNavigationPackagesTagsClassesElement >> addPackage: aPackage tag: aPackag GtCoderNavigationPackagesTagsClassesElement >> buildCategorySlotTabs [ | aTabGroup | aTabGroup := BrTabGroup new - aptitude: BrGlamorousTabGroupAptitude new; + aptitude: BrGlamorousTabGroupAptitude - BrTabGroupSplitterAptitude; addTab: (BrTab new aptitude: GtProtocolSlotTabAptitude new; label: 'Categories' asRopedText glamorousCodeSmallSize; @@ -127,7 +127,7 @@ GtCoderNavigationPackagesTagsClassesElement >> buildProtocolGroupList [ { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> buildSlotGroupWithBinder: binderBlock onClick: clickBlock [ - | classGroup instanceGroup | + | classSlotGroup instanceGroup classVarGroup | instanceGroup := BrGroup new domainObject: 'instance slots'; stream: #() asAsyncStream; @@ -142,7 +142,11 @@ GtCoderNavigationPackagesTagsClassesElement >> buildSlotGroupWithBinder: binderB when: BlClickEvent do: clickBlock ]; itemDataBinder: binderBlock; shouldShowWithoutItems: false. - ^ {instanceGroup} + classSlotGroup := instanceGroup copy domainObject: 'class slots'. + classVarGroup := instanceGroup copy domainObject: 'class variables'. + ^ {instanceGroup. + classSlotGroup. + classVarGroup} ] { #category : #initialization } @@ -234,8 +238,9 @@ GtCoderNavigationPackagesTagsClassesElement >> initializeElement [ text: 'Classes'. classesList}. pane3 := BrVerticalPane new - matchParent; - addChildren: { self buildCategorySlotTabs }. + addAptitude: BrGlamorousWithHorizontalResizerAptitude; + matchParent; + addChildren: {self buildCategorySlotTabs}. pane4 := BrVerticalPane new matchParent; @@ -721,12 +726,19 @@ GtCoderNavigationPackagesTagsClassesElement >> updateSelectedPackageAndTag [ { #category : #'api - class selections' } GtCoderNavigationPackagesTagsClassesElement >> updateSlotList [ - | slotStream slots | + | slotStream classSlotStream classVarStream streams | slotsGroupList deselectAll. navigationModel hasSelectedClass - ifTrue: [ slots := navigationModel selectedClass instanceVariables. - slotStream := slots asSortedCollection: [ :a :b | a name < b name ]. - slotsGroup with: {slotStream} do: [ :grp :str | grp items: str ] ] - ifFalse: [ slotsGroup with: {#()} do: [ :grp :str | grp items: str ] ]. + ifTrue: [ slotStream := navigationModel selectedClass instanceVariables. + classSlotStream := navigationModel selectedClass class instanceVariables. + classVarStream := navigationModel selectedClass classVariables. + streams := {slotStream. + classSlotStream. + classVarStream} + collect: [ :each | each asSortedCollection: [ :a :b | a name < b name ] ] ] + ifFalse: [ streams := {#(). + #(). + #()} ]. + slotsGroup with: streams do: [ :grp :str | grp items: str ]. slotsGroupList groups: slotsGroup ] diff --git a/src/GToolkit-Coder-UI/GtProtocolSlotTabAptitude.class.st b/src/GToolkit-Coder-UI/GtProtocolSlotTabAptitude.class.st index 7070c900e..f20d7984f 100644 --- a/src/GToolkit-Coder-UI/GtProtocolSlotTabAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtProtocolSlotTabAptitude.class.st @@ -20,7 +20,7 @@ GtProtocolSlotTabAptitude >> initialize [ constraintsDo: [ :c | c ignoreByLayout. c ignored vertical alignBottom. - c vertical exact: 2. + c vertical exact: 1. c horizontal matchParent ]. self add: From f4493a43d160fef843c1e5307cea291270954a97 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 2 Dec 2022 10:48:31 -0600 Subject: [PATCH 0321/1268] Cleanup and example fixing. --- ...igationPackagesTagsClassesElement.class.st | 44 +++++++++---------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index a64a847aa..6999d1733 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -5,9 +5,6 @@ Class { 'packagesList', 'classesLabel', 'methodProtocolsList', - 'classAndMethodProtocolList', - 'protocolLabel', - 'coderFilterChangesSubscription', 'methodsLabel', 'methodGroup', 'methodGroupList', @@ -194,7 +191,6 @@ GtCoderNavigationPackagesTagsClassesElement >> hasPackageTagsIn: aRPackage [ { #category : #'showing / hiding' } GtCoderNavigationPackagesTagsClassesElement >> hideClassList [ - classAndMethodProtocolList visibility: BlVisibility hidden. classesLabel visibility: BlVisibility hidden. ] @@ -291,26 +287,26 @@ GtCoderNavigationPackagesTagsClassesElement >> onMethodListSelectionChanged: aMe { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onMethodsCoderFiltersChanged: aGtCodersFiltersChanged [ aGtCodersFiltersChanged source = self ifTrue: [ ^ self ]. - - methodProtocolsList selectedItemDo: [ :aSelectedItem | - | aCategoryFilter | - aCategoryFilter := GtSearchMethodCategoryFilter forCategory: aSelectedItem name. - - aGtCodersFiltersChanged filters do: [ :eachFilter | - eachFilter = aCategoryFilter ifTrue: [ - ^ self ] ] ]. - - aGtCodersFiltersChanged filters do: [ :eachFilter | - eachFilter class = GtSearchMethodCategoryFilter ifTrue: [ - methodProtocolsList items - doWithIndex: [ :aProtocol :anIndex | - (aProtocol name = eachFilter category) ifTrue: [ - self suppressListChangeEventsDuring: [ - methodProtocolsList selectOne: anIndex ]. - ^ self ] ] ] ]. - - self suppressListChangeEventsDuring: [ - methodProtocolsList deselectAll ]. + methodProtocolsList + selectedItemDo: [ :aSelectedItem | + | aCategoryFilter | + aCategoryFilter := GtSearchMethodCategoryFilter + forCategory: aSelectedItem name. + + aGtCodersFiltersChanged filters + do: [ :eachFilter | eachFilter = aCategoryFilter ifTrue: [ ^ self ] ] ]. + + aGtCodersFiltersChanged filters + do: [ :eachFilter | + eachFilter class = GtSearchMethodCategoryFilter + ifTrue: [ methodProtocolsList items + doWithIndex: [ :aProtocol :anIndex | + aProtocol name = eachFilter category + ifTrue: [ self + suppressListChangeEventsDuring: [ methodProtocolsList selectOne: anIndex ]. + ^ self ] ] ] ]. + + self suppressListChangeEventsDuring: [ methodProtocolsList deselectAll ] ] { #category : #'event handling' } From e32f4aefd2490ad26e0c8a8f3b11e4b19b1012a5 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 2 Dec 2022 11:05:15 -0600 Subject: [PATCH 0322/1268] Update method list index for slots. --- .../GtCoderNavigationPackagesTagsClassesElement.class.st | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 6999d1733..d2c31d81f 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -407,7 +407,7 @@ GtCoderNavigationPackagesTagsClassesElement >> onProtocolListSelectionChanged [ { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> onSlotsListSelectionChanged [ - | theIndices anIndex aSelectedItem | + | theIndices anIndex aSelectedItem instMeths classMeths | supressListChanges ifTrue: [ ^ self ]. methodProtocolsList deselectAll. theIndices := slotsGroupList selectedIndices ifEmpty: [ ^ self ]. @@ -416,6 +416,10 @@ GtCoderNavigationPackagesTagsClassesElement >> onSlotsListSelectionChanged [ ifFalse: [ ^ self ]. aSelectedItem := (slotsGroupList viewModel entityAt: anIndex) value object. self navigationModel selectSlot: aSelectedItem source: self. + instMeths := self selectedClass methodsAccessingSlot: aSelectedItem. + classMeths := self selectedClass class methodsAccessingSlot: aSelectedItem. + methodGroupList deselectAll. + self updateMethodListWith: instMeths and: classMeths ] { #category : #'api - package updates' } From 24d3484fdb9633196e39e009362db059e6a94e77 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Sun, 4 Dec 2022 21:52:46 -0600 Subject: [PATCH 0323/1268] Fix hover color on protocol and method lists --- .../GtCoderNavigationPackagesTagsClassesElement.class.st | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index d2c31d81f..bbc5e78f4 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -78,9 +78,7 @@ GtCoderNavigationPackagesTagsClassesElement >> buildGroupWithBinder: binderBlock hMatchParent; vFitContent; beSmallSize; - aptitude: BrGlamorousLabelAptitude + BrGlamorousListItemAptitude - + (BrStyleCommonAptitude new - hovered: [ :aStyle | aStyle background: self theme item selectedColor ]); + aptitude: BrGlamorousLabelAptitude + BrGlamorousListItemAptitude; when: BlClickEvent do: clickBlock ]; itemDataBinder: binderBlock; shouldShowWithoutItems: false. @@ -133,9 +131,7 @@ GtCoderNavigationPackagesTagsClassesElement >> buildSlotGroupWithBinder: binderB hMatchParent; vFitContent; beSmallSize; - aptitude: BrGlamorousLabelAptitude + BrGlamorousListItemAptitude - + (BrStyleCommonAptitude new - hovered: [ :aStyle | aStyle background: self theme item selectedColor ]); + aptitude: BrGlamorousLabelAptitude + BrGlamorousListItemAptitude; when: BlClickEvent do: clickBlock ]; itemDataBinder: binderBlock; shouldShowWithoutItems: false. From a15cf4cc4609021471ee5d452e1509af2f719fdd Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Mon, 5 Dec 2022 15:53:31 +0100 Subject: [PATCH 0324/1268] Move Add button into coder navigation [feenkcom/gtoolki#2930] --- .../GtCoderNavigationTabsStencil.class.st | 71 ++++++++++++++ src/GToolkit-Coder/Behavior.extension.st | 92 ------------------- 2 files changed, 71 insertions(+), 92 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index c0c81114e..7c1d22700 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -48,6 +48,77 @@ GtCoderNavigationTabsStencil >> defaultNavigations [ collect ] +{ #category : #accessing } +GtCoderNavigationTabsStencil >> gtAddClassTab: look [ + + ^ BrTab new + aptitude: BrGlamorousTabAptitude new; + label: 'Class'; + stencil: [ | element | + element := GtPharoCreateBehaviorElement new. + element + behaviorBlock: [ :cls | + look fireEvent: BrDropdownHideWish new. + navigationModel selectClass: cls ]. + element forClassDefinition. + navigationModel selectedPackageDo: [ :package | element forPackage: package ]. + navigationModel selectedTagDo: [ :tag | element forPackageTag: tag ]. + element ] +] + +{ #category : #accessing } +GtCoderNavigationTabsStencil >> gtAddInterface: look [ + | contentTabs tabMethods | + contentTabs := BrTabGroup new. + contentTabs aptitude: BrGlamorousTabGroupAptitude new. + contentTabs + constraintsDo: [ :c | + c horizontal matchParent. + c vertical matchParent ]. + tabMethods := (Pragma allNamed: #gtCreateComponentTab: from: self class to: Behavior) + asSortedCollection: [ :a :b | a arguments first < b arguments first ]. + tabMethods + do: + [ :each | contentTabs addTab: (self perform: each method selector with: look) ]. + ^ contentTabs +] + +{ #category : #accessing } +GtCoderNavigationTabsStencil >> gtAddPackageTab: look [ + + ^ BrTab new + aptitude: BrGlamorousTabAptitude new; + label: 'Package'; + stencil: [ | element | + element := GtPharoCreatePackageElement new. + element + packageBlock: [ :pkg :tag | + look fireEvent: BrDropdownHideWish new. + tag isNil + ifTrue: [ navigationModel selectPackage: pkg ] + ifFalse: [ navigationModel selectPackageTag: tag ] ]. + navigationModel selectedPackageDo: [ :package | element forPackage: package ]. + element ] +] + +{ #category : #accessing } +GtCoderNavigationTabsStencil >> gtAddTraitTab: look [ + + ^ BrTab new + aptitude: BrGlamorousTabAptitude new; + label: 'Trait'; + stencil: [ | element | + element := GtPharoCreateBehaviorElement new. + element + behaviorBlock: [ :cls | + look fireEvent: BrDropdownHideWish new. + navigationModel selectClass: cls ]. + element forTraitDefinition. + navigationModel selectedPackageDo: [ :package | element forPackage: package ]. + navigationModel selectedTagDo: [ :tag | element forPackageTag: tag ]. + element ] +] + { #category : #'gt-extensions' } GtCoderNavigationTabsStencil >> gtClassHierarchyFor: aView [ diff --git a/src/GToolkit-Coder/Behavior.extension.st b/src/GToolkit-Coder/Behavior.extension.st index 387bcd5fc..bbf14f87d 100644 --- a/src/GToolkit-Coder/Behavior.extension.st +++ b/src/GToolkit-Coder/Behavior.extension.st @@ -1,97 +1,5 @@ Extension { #name : #Behavior } -{ #category : #'*GToolkit-Coder' } -Behavior >> gtAddButtonFor: anAction [ - - ^ anAction dropdown - icon: BrGlamorousVectorIcons add; - tooltip: 'Add class or package'; - priority: 5; - content: [ :aDropdown | - | element | - element := BlElement new. - element - constraintsDo: [ :c | - c horizontal exact: 400. - c vertical exact: 300 ]. - element addChild: (self gtAddInterface: aDropdown). - element ] -] - -{ #category : #'*GToolkit-Coder' } -Behavior >> gtAddClassTab: look [ - - ^ BrTab new - aptitude: BrGlamorousTabAptitude new; - label: 'Class'; - stencil: [ | element navigationModel | - element := GtPharoCreateBehaviorElement new. - navigationModel := look phlow firstParentWithView navigationModel. - element - behaviorBlock: [ :cls | - look fireEvent: BrDropdownHideWish new. - navigationModel selectClass: cls ]. - element forClassDefinition. - navigationModel selectedPackageDo: [ :package | element forPackage: package ]. - navigationModel selectedTagDo: [ :tag | element forPackageTag: tag ]. - element ] -] - -{ #category : #'*GToolkit-Coder' } -Behavior >> gtAddInterface: look [ - | contentTabs tabMethods | - contentTabs := BrTabGroup new. - contentTabs aptitude: BrGlamorousTabGroupAptitude new. - contentTabs - constraintsDo: [ :c | - c horizontal matchParent. - c vertical matchParent ]. - tabMethods := (Pragma allNamed: #gtCreateComponentTab: from: self class to: Behavior) - asSortedCollection: [ :a :b | a arguments first < b arguments first ]. - tabMethods - do: - [ :each | contentTabs addTab: (self perform: each method selector with: look) ]. - ^ contentTabs -] - -{ #category : #'*GToolkit-Coder' } -Behavior >> gtAddPackageTab: look [ - - ^ BrTab new - aptitude: BrGlamorousTabAptitude new; - label: 'Package'; - stencil: [ | element navigationModel | - element := GtPharoCreatePackageElement new. - navigationModel := look phlow firstParentWithView navigationModel. - element - packageBlock: [ :pkg :tag | - look fireEvent: BrDropdownHideWish new. - tag isNil - ifTrue: [ navigationModel selectPackage: pkg ] - ifFalse: [ navigationModel selectPackageTag: tag ] ]. - navigationModel selectedPackageDo: [ :package | element forPackage: package ]. - element ] -] - -{ #category : #'*GToolkit-Coder' } -Behavior >> gtAddTraitTab: look [ - - ^ BrTab new - aptitude: BrGlamorousTabAptitude new; - label: 'Trait'; - stencil: [ | element navigationModel | - element := GtPharoCreateBehaviorElement new. - navigationModel := look phlow firstParentWithView navigationModel. - element - behaviorBlock: [ :cls | - look fireEvent: BrDropdownHideWish new. - navigationModel selectClass: cls ]. - element forTraitDefinition. - navigationModel selectedPackageDo: [ :package | element forPackage: package ]. - navigationModel selectedTagDo: [ :tag | element forPackageTag: tag ]. - element ] -] - { #category : #'*GToolkit-Coder' } Behavior >> gtBrowseButtonFor: anAction [ From f2ec83d7f4bb53ba17649d63be26a17cf2f47fe9 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Tue, 6 Dec 2022 12:26:30 +0100 Subject: [PATCH 0325/1268] Add code for add button in nav [feenkcom/gtoolki#2930] --- .../GtCoderNavigationTabsStencil.class.st | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index 7c1d22700..f2cffa76d 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -157,7 +157,18 @@ GtCoderNavigationTabsStencil >> gtPackagesTagsClassesFor: aView [ acted := true ]. acted ifTrue: [ anActOnEvent beActed ] ]; asElement ] - tooltip: 'Search Code' + tooltip: 'Search Code'; + actionDropdownButtonIcon: BrGlamorousVectorIcons add + tooltip: 'Add class or package' + content: [ :aDropdown | + | element | + element := BlElement new. + element + constraintsDo: [ :c | + c horizontal exact: 400. + c vertical exact: 300 ]. + element addChild: (self gtAddInterface: aDropdown). + element ] ] { #category : #accessing } From e4426c1b576acb024d4e929c469e715cfe546de8 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Mon, 5 Dec 2022 14:20:39 -0600 Subject: [PATCH 0326/1268] Move statements up/down in Pharo Method Coders [feenkcom/gtoolkit#2935] --- ...rceCoderMoveStatementDownShortcut.class.st | 33 +++++++++++++++++++ ...ourceCoderMoveStatementUpShortcut.class.st | 33 +++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderMoveStatementDownShortcut.class.st create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderMoveStatementUpShortcut.class.st diff --git a/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementDownShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementDownShortcut.class.st new file mode 100644 index 000000000..87e4388dc --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementDownShortcut.class.st @@ -0,0 +1,33 @@ +Class { + #name : #GtSourceCoderMoveStatementDownShortcut, + #superclass : #GtSourceCoderShortcut, + #category : #'GToolkit-Coder-UI' +} + +{ #category : #accessing } +GtSourceCoderMoveStatementDownShortcut >> description [ + ^ 'Moves a statement down in the statement list.' +] + +{ #category : #accessing } +GtSourceCoderMoveStatementDownShortcut >> initialize [ + super initialize. + + combination := BlKeyCombination builder primary arrowDown build +] + +{ #category : #accessing } +GtSourceCoderMoveStatementDownShortcut >> name [ + ^ 'Move statement down' +] + +{ #category : #accessing } +GtSourceCoderMoveStatementDownShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ + | pos | + self + forEditor: aBrTextEditor + selectionIntervalDo: [ :aSelectionInterval | pos := aSelectionInterval last ] + orCursorStringPositionDo: [ :aCursorTextPosition | pos := aCursorTextPosition ]. + pos + ifNotNil: [ aSourceCoderViewModel coder moveStatementDownAt: pos in: aSourceCoderViewModel ] +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementUpShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementUpShortcut.class.st new file mode 100644 index 000000000..8427489d2 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementUpShortcut.class.st @@ -0,0 +1,33 @@ +Class { + #name : #GtSourceCoderMoveStatementUpShortcut, + #superclass : #GtSourceCoderShortcut, + #category : #'GToolkit-Coder-UI' +} + +{ #category : #accessing } +GtSourceCoderMoveStatementUpShortcut >> description [ + ^ 'Moves a statement up in the statement list.' +] + +{ #category : #accessing } +GtSourceCoderMoveStatementUpShortcut >> initialize [ + super initialize. + + combination := BlKeyCombination builder primary arrowUp build +] + +{ #category : #accessing } +GtSourceCoderMoveStatementUpShortcut >> name [ + ^ 'Move statement up' +] + +{ #category : #accessing } +GtSourceCoderMoveStatementUpShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ + | pos | + self + forEditor: aBrTextEditor + selectionIntervalDo: [ :aSelectionInterval | pos := aSelectionInterval last ] + orCursorStringPositionDo: [ :aCursorTextPosition | pos := aCursorTextPosition ]. + pos + ifNotNil: [ aSourceCoderViewModel coder moveStatementUpAt: pos in: aSourceCoderViewModel ] +] From 36444114f577f0aab7b6222e74bcabdbe875f1f2 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Tue, 6 Dec 2022 14:05:11 +0100 Subject: [PATCH 0327/1268] Remove method search from coder index spotter --- .../GtCoderSpotterStart.class.st | 24 ------------------- 1 file changed, 24 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st b/src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st index 03699f05f..9ff2cf7fd 100644 --- a/src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st +++ b/src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st @@ -7,18 +7,6 @@ Class { #category : #'GToolkit-Coder-UI-Basic' } -{ #category : #searching } -GtCoderSpotterStart >> gtSpotterForClassMethodsInCurrentClassFor: aSearch [ - - self navigationModel hasSelectedClass ifFalse: [ ^ aSearch empty ]. - ^ aSearch list - priority: 2; - title: 'Class methods'; - items: [ self navigationModel selectedClass classSide methods ]; - filterBySubstring; - wantsToDisplayOnEmptyQuery: true -] - { #category : #searching } GtCoderSpotterStart >> gtSpotterForClassesFor: aSearch [ @@ -30,18 +18,6 @@ GtCoderSpotterStart >> gtSpotterForClassesFor: aSearch [ wantsToDisplayOnEmptyQuery: self navigationModel hasSelectedClass not ] -{ #category : #searching } -GtCoderSpotterStart >> gtSpotterForInstanceMethodsInCurrentClassFor: aSearch [ - - self navigationModel hasSelectedClass ifFalse: [ ^ aSearch empty ]. - ^ aSearch list - priority: 1; - title: 'Instance methods'; - items: [ self navigationModel selectedClass instanceSide methods ]; - filterBySubstring; - wantsToDisplayOnEmptyQuery: true -] - { #category : #searching } GtCoderSpotterStart >> gtSpotterForPackagesFor: aSearch [ From 1dba287577a1ae3992c5f595a2308b8a1c3ee1cf Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 6 Dec 2022 14:50:46 -0600 Subject: [PATCH 0328/1268] Expand selection by statements in pharo coder [feenkcom/gtoolkit#2937] --- ...eCoderSelectStatementDownShortcut.class.st | 36 +++++++++++++++++++ ...rceCoderSelectStatementUpShortcut.class.st | 36 +++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderSelectStatementDownShortcut.class.st create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderSelectStatementUpShortcut.class.st diff --git a/src/GToolkit-Coder-UI/GtSourceCoderSelectStatementDownShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderSelectStatementDownShortcut.class.st new file mode 100644 index 000000000..112112b41 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderSelectStatementDownShortcut.class.st @@ -0,0 +1,36 @@ +Class { + #name : #GtSourceCoderSelectStatementDownShortcut, + #superclass : #GtSourceCoderShortcut, + #category : #'GToolkit-Coder-UI' +} + +{ #category : #accessing } +GtSourceCoderSelectStatementDownShortcut >> description [ + ^ 'Selects current statement or expands selection to next statement.' +] + +{ #category : #accessing } +GtSourceCoderSelectStatementDownShortcut >> initialize [ + super initialize. + + combination := BlKeyCombination builder shift primary arrowDown build +] + +{ #category : #accessing } +GtSourceCoderSelectStatementDownShortcut >> name [ + ^ 'Selection statement down' +] + +{ #category : #accessing } +GtSourceCoderSelectStatementDownShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ + self + forEditor: aBrTextEditor + selectionIntervalDo: [ :aSelectionInterval | + aSourceCoderViewModel coder + expandStatementSelection: aSelectionInterval + downIn: aSourceCoderViewModel ] + orCursorStringPositionDo: [ :aCursorTextPosition | + aSourceCoderViewModel coder + selectStatementAt: aCursorTextPosition + in: aSourceCoderViewModel ] +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderSelectStatementUpShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderSelectStatementUpShortcut.class.st new file mode 100644 index 000000000..cc520565a --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderSelectStatementUpShortcut.class.st @@ -0,0 +1,36 @@ +Class { + #name : #GtSourceCoderSelectStatementUpShortcut, + #superclass : #GtSourceCoderShortcut, + #category : #'GToolkit-Coder-UI' +} + +{ #category : #accessing } +GtSourceCoderSelectStatementUpShortcut >> description [ + ^ 'Selects current statement or expands selection to previous statement.' +] + +{ #category : #accessing } +GtSourceCoderSelectStatementUpShortcut >> initialize [ + super initialize. + + combination := BlKeyCombination builder shift primary arrowUp build +] + +{ #category : #accessing } +GtSourceCoderSelectStatementUpShortcut >> name [ + ^ 'Selection statement up' +] + +{ #category : #accessing } +GtSourceCoderSelectStatementUpShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ + self + forEditor: aBrTextEditor + selectionIntervalDo: [ :aSelectionInterval | + aSourceCoderViewModel coder + expandStatementSelection: aSelectionInterval + upIn: aSourceCoderViewModel ] + orCursorStringPositionDo: [ :aCursorTextPosition | + aSourceCoderViewModel coder + selectStatementAt: aCursorTextPosition + in: aSourceCoderViewModel ] +] From d66f6bc8fa4650de4366f2f4d281566c3d9514b9 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 7 Dec 2022 17:28:18 -0600 Subject: [PATCH 0329/1268] Move multiple statements at one time. [feenkcom/gtoolkit#2935] --- .../GtSourceCoderMoveStatementDownShortcut.class.st | 13 ++++++++----- .../GtSourceCoderMoveStatementUpShortcut.class.st | 13 ++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementDownShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementDownShortcut.class.st index 87e4388dc..a78f5405a 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementDownShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementDownShortcut.class.st @@ -23,11 +23,14 @@ GtSourceCoderMoveStatementDownShortcut >> name [ { #category : #accessing } GtSourceCoderMoveStatementDownShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ - | pos | self forEditor: aBrTextEditor - selectionIntervalDo: [ :aSelectionInterval | pos := aSelectionInterval last ] - orCursorStringPositionDo: [ :aCursorTextPosition | pos := aCursorTextPosition ]. - pos - ifNotNil: [ aSourceCoderViewModel coder moveStatementDownAt: pos in: aSourceCoderViewModel ] + selectionIntervalDo: [ :aSelectionInterval | + aSourceCoderViewModel coder + moveStatementsDownWithin: aSelectionInterval + in: aSourceCoderViewModel ] + orCursorStringPositionDo: [ :aCursorTextPosition | + aSourceCoderViewModel coder + moveStatementDownAt: aCursorTextPosition + in: aSourceCoderViewModel ] ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementUpShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementUpShortcut.class.st index 8427489d2..ab7e0f718 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementUpShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementUpShortcut.class.st @@ -23,11 +23,14 @@ GtSourceCoderMoveStatementUpShortcut >> name [ { #category : #accessing } GtSourceCoderMoveStatementUpShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ - | pos | self forEditor: aBrTextEditor - selectionIntervalDo: [ :aSelectionInterval | pos := aSelectionInterval last ] - orCursorStringPositionDo: [ :aCursorTextPosition | pos := aCursorTextPosition ]. - pos - ifNotNil: [ aSourceCoderViewModel coder moveStatementUpAt: pos in: aSourceCoderViewModel ] + selectionIntervalDo: [ :aSelectionInterval | + aSourceCoderViewModel coder + moveStatementsUpWithin: aSelectionInterval + in: aSourceCoderViewModel ] + orCursorStringPositionDo: [ :aCursorTextPosition | + aSourceCoderViewModel coder + moveStatementUpAt: aCursorTextPosition + in: aSourceCoderViewModel ] ] From de5c705161f3fe6df8a58d2b7779f0b599dcf7c5 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Thu, 8 Dec 2022 14:21:47 +0100 Subject: [PATCH 0330/1268] Add a model for local versons --- .../CompiledMethod.extension.st | 27 +--- .../GtLocalVersion.class.st | 135 ++++++++++++++++++ 2 files changed, 142 insertions(+), 20 deletions(-) create mode 100644 src/GToolkit-Coder-Extensions/GtLocalVersion.class.st diff --git a/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st b/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st index 834d7cc17..7a04a3064 100644 --- a/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st +++ b/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st @@ -22,29 +22,16 @@ CompiledMethod >> gtDisplayOn: aStream [ { #category : #'*GToolkit-Coder-Extensions' } CompiledMethod >> gtLocalVersionsFor: aView [ - ^ aView columnedList + ^ aView list title: 'Local versions'; priority: 20; - items: [ - SourceFiles + items: [ SourceFiles changeRecordsFrom: self sourcePointer className: self methodClass name isMeta: self methodClass isMeta ]; - column: 'Timestamp' text: #timeStamp width: 200; - column: 'Change' translated - icon: [ :eachItem | - BrExpander new - vFitContent; - hMatchParent; - collapse; - margin: (BlInsets all: 10); - aptitude: GtCoderExpanderAptitude new; - header: [ BrLabel new aptitude: BrGlamorousLabelAptitude; text: eachItem gtDisplayString ]; - content: [ | container | - container := BrFrame new - vExact: 400; - hMatchParent; - aptitude: BrGlamorousWithVerticalResizerAptitude; - addChild: ((eachItem gtSourceFor: GtPhlowEmptyView new) asElement) matchParent ] ] - weight: 1 + itemStencil: [ GtLocalVersion new ]; + itemDataBinder: [ :aLocalVersionElement :aLocalVersion | + aLocalVersionElement + compiledMethod: self; + localVersion: aLocalVersion ] ] diff --git a/src/GToolkit-Coder-Extensions/GtLocalVersion.class.st b/src/GToolkit-Coder-Extensions/GtLocalVersion.class.st new file mode 100644 index 000000000..3e445d1dd --- /dev/null +++ b/src/GToolkit-Coder-Extensions/GtLocalVersion.class.st @@ -0,0 +1,135 @@ +Class { + #name : #GtLocalVersion, + #superclass : #BrVerticalFlow, + #instVars : [ + 'localVersion', + 'compiledMethod', + 'expander', + 'header', + 'content' + ], + #category : #'GToolkit-Coder-Extensions' +} + +{ #category : #accessing } +GtLocalVersion >> compiledMethod [ + + ^ compiledMethod +] + +{ #category : #accessing } +GtLocalVersion >> compiledMethod: anObject [ + + compiledMethod := anObject +] + +{ #category : #accessing } +GtLocalVersion >> content [ + + ^ content +] + +{ #category : #accessing } +GtLocalVersion >> content: anObject [ + + content := anObject +] + +{ #category : #accessing } +GtLocalVersion >> expander [ + + ^ expander +] + +{ #category : #accessing } +GtLocalVersion >> expander: anObject [ + + expander := anObject +] + +{ #category : #accessing } +GtLocalVersion >> header [ + + ^ header +] + +{ #category : #accessing } +GtLocalVersion >> header: anObject [ + + header := anObject +] + +{ #category : #accessing } +GtLocalVersion >> initialize [ + super initialize. + + self hMatchParent vFitContent padding: (BlInsets all: 2). + + self initializeHeader. + self initializeContent. + self initializeExpander. + + self addChild: self expander +] + +{ #category : #accessing } +GtLocalVersion >> initializeContent [ + content := BrVerticalFlow new matchParent +] + +{ #category : #accessing } +GtLocalVersion >> initializeExpander [ + expander := BrExpander new hMatchParent vFitContent + aptitude: GtCoderExpanderAptitude new; + header: [ self header ]; + content: [ self content ] +] + +{ #category : #accessing } +GtLocalVersion >> initializeHeader [ + header := BrHorizontalFlow new matchParent +] + +{ #category : #accessing } +GtLocalVersion >> localVersion: aLocalVersion [ + localVersion := aLocalVersion. + self updateView +] + +{ #category : #accessing } +GtLocalVersion >> updateContent [ + | previousContent newContent | + previousContent := compiledMethod sourceCode. + newContent := localVersion sourceCode. + + + content + addChild: (BrLabel new + aptitude: BrGlamorousLabelAptitude; + text: 'Version at ' , localVersion timeStamp printToSeconds); + addChild: (GtDiffElementWithLabelStencil new + fromLabelText: 'Current'; + toLabelText: 'Version'; + diffBuilder: ((GtCodeDiffBuilder from: previousContent to: newContent) isMethod: true)) + create; + addChild: (BrFrame new + addChild: (BrButton new + icon: BrGlamorousVectorIcons accept; + label: 'Use this version'; + aptitude: BrGlamorousButtonWithIconAptitude; + action: [ :aButton | localVersion asMCMethodDefinition load ])) +] + +{ #category : #accessing } +GtLocalVersion >> updateHeader [ + header + addChild: (BrLabel new + aptitude: BrGlamorousLabelAptitude; + text: 'Version at ' , localVersion timeStamp printToSeconds) +] + +{ #category : #accessing } +GtLocalVersion >> updateView [ + self updateHeader. + self updateContent. +] From 1cca93e21554fe82699591e3078a4eda0c086a58 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Thu, 8 Dec 2022 18:20:10 +0100 Subject: [PATCH 0331/1268] Add Copy class action [feenkcom/gtoolkit#2725] --- src/GToolkit-Coder/Behavior.extension.st | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/GToolkit-Coder/Behavior.extension.st b/src/GToolkit-Coder/Behavior.extension.st index bbf14f87d..66428b5fb 100644 --- a/src/GToolkit-Coder/Behavior.extension.st +++ b/src/GToolkit-Coder/Behavior.extension.st @@ -19,6 +19,21 @@ Behavior >> gtBrowseFromButton: anElement [ maximized ] ] +{ #category : #'*GToolkit-Coder' } +Behavior >> gtCopyButtonFor: anAction [ + + ^ anAction dropdown + tooltip: 'Copy Class'; + icon: BrGlamorousVectorIcons changes; + priority: 4; + content: [ :aButton | + ((GtCopyClassForm for: self) + onAccept: [ :aClass | + aButton phlow spawnTool: (GtClassCoderTool forClass: aClass). + aButton fireEvent: BrDropdownHideWish new ]) asElement + padding: (BlInsets all: 5) ] +] + { #category : #'*GToolkit-Coder' } Behavior >> gtHierarchyButtonFor: anAction [ From 17b573d161e8e7f6b9a55d1702779c3e6030dae7 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Thu, 8 Dec 2022 19:07:14 +0100 Subject: [PATCH 0332/1268] Remove children on update on GtLocalVersion --- src/GToolkit-Coder-Extensions/GtLocalVersion.class.st | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/GToolkit-Coder-Extensions/GtLocalVersion.class.st b/src/GToolkit-Coder-Extensions/GtLocalVersion.class.st index 3e445d1dd..16bae68a9 100644 --- a/src/GToolkit-Coder-Extensions/GtLocalVersion.class.st +++ b/src/GToolkit-Coder-Extensions/GtLocalVersion.class.st @@ -102,6 +102,7 @@ GtLocalVersion >> updateContent [ previousContent := compiledMethod sourceCode. newContent := localVersion sourceCode. + content removeChildren. content addChild: (BrLabel new @@ -122,6 +123,7 @@ GtLocalVersion >> updateContent [ { #category : #accessing } GtLocalVersion >> updateHeader [ + header removeChildren. header addChild: (BrLabel new aptitude: BrGlamorousLabelAptitude; From 07aba6b750d74f84207ec9f66b557c34c486e998 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Fri, 9 Dec 2022 16:18:42 +0100 Subject: [PATCH 0333/1268] [feenkcom/gtoolkit#2943] fix dependencies --- .../GtLabeledSearchFilter.class.st | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/GToolkit-SearchFilters/GtLabeledSearchFilter.class.st b/src/GToolkit-SearchFilters/GtLabeledSearchFilter.class.st index a863dde14..947820bd6 100644 --- a/src/GToolkit-SearchFilters/GtLabeledSearchFilter.class.st +++ b/src/GToolkit-SearchFilters/GtLabeledSearchFilter.class.st @@ -9,22 +9,6 @@ Class { #category : #'GToolkit-SearchFilters' } -{ #category : #accessing } -GtLabeledSearchFilter class >> gtSearchFilterPragmaDescriptor [ - ^ GtFilterDescriptor new - creator: [ :value | - (self allSearchFilters - detect: [ :each | each filterLabel = value ] - ifNone: [ self allSearchFilters - detect: [ :each | each filterLabel beginsWith: value caseSensitive: false ] - ifNone: [ nil ] ]) ifNil: [ GtSearchImageMethodsFilter forAllMethods ] ]; - named: 'Custom Filter'; - order: 10; - emptyDefaultValue: GtSearchImageMethodsFilter forAllMethods filterLabel; - completion: [ GtStringsCompletionStrategy new - completions: [ GtPrefixTree withAll: (self allSearchFilters collect: #filterLabel) ] ] -] - { #category : #comparing } GtLabeledSearchFilter >> = anObject [ ^ self class = anObject class From 826d05a4def7a9b3bc452e712a82e562d937a3a0 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Fri, 9 Dec 2022 22:15:15 +0100 Subject: [PATCH 0334/1268] Make coder tools be views --- src/GToolkit-Coder-UI/GtCoderTool.class.st | 6 ++++-- src/GToolkit-Coder-UI/GtReadyCoderTool.class.st | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderTool.class.st b/src/GToolkit-Coder-UI/GtCoderTool.class.st index 8beab7fb6..e405da03d 100644 --- a/src/GToolkit-Coder-UI/GtCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtCoderTool.class.st @@ -8,8 +8,10 @@ Class { GtCoderTool >> asElementDo: aOneArgBlock [ "Create a tool element and execute the block." - ^ aOneArgBlock - cull: (GtPhlowCoderView new coder: self newCoder) asElement asPagerPageElement + | anElement | + anElement := (GtPhlowCoderView new coder: self newCoder) asElement. + anElement phlow beView. + ^ aOneArgBlock cull: anElement asPagerPageElement ] { #category : #'api - converting' } diff --git a/src/GToolkit-Coder-UI/GtReadyCoderTool.class.st b/src/GToolkit-Coder-UI/GtReadyCoderTool.class.st index ac71d2f72..ffda28d7a 100644 --- a/src/GToolkit-Coder-UI/GtReadyCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtReadyCoderTool.class.st @@ -4,7 +4,7 @@ Class { #instVars : [ 'coder' ], - #category : 'GToolkit-Coder-UI-Tools' + #category : #'GToolkit-Coder-UI-Tools' } { #category : #accessing } @@ -16,7 +16,10 @@ GtReadyCoderTool class >> coder: aCoder [ GtReadyCoderTool >> asElementDo: aOneArgBlock [ "Create a tool element and execute the block." - ^ aOneArgBlock cull: (GtCoder forCoder: self coder) asPagerPageElement + | anElement | + anElement := (GtCoder forCoder: self coder) asElement. + anElement phlow beView. + ^ aOneArgBlock cull: anElement asPagerPageElement ] { #category : #accessing } From 290382cb436b953ebd8e413ff982c4b552f77b03 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 9 Dec 2022 15:58:59 -0600 Subject: [PATCH 0335/1268] Fix hiding variable annotations [feenkcom/gtoolkit#2281] --- src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st | 5 +++++ src/GToolkit-Coder/GtTextualCoderAddOns.class.st | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 2b9d01ab0..3893dfbd7 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -617,6 +617,11 @@ GtTextualCoderViewModel >> removeCoderTextAttributes: aGtTextualCoderTextAttribu self announce: (GtTextualCoderViewModelTextAttributesRemoved new coderTextAttributes: aGtTextualCoderTextAttributes) ] +{ #category : #'api - shortcuts' } +GtTextualCoderViewModel >> removeStylersOfClass: aGtCoderStylerClass [ + extraAddOns removeStylersOfClass: aGtCoderStylerClass +] + { #category : #'api - add-ons' } GtTextualCoderViewModel >> requestUpdateAddOns [ diff --git a/src/GToolkit-Coder/GtTextualCoderAddOns.class.st b/src/GToolkit-Coder/GtTextualCoderAddOns.class.st index 45d127335..13262f2b8 100644 --- a/src/GToolkit-Coder/GtTextualCoderAddOns.class.st +++ b/src/GToolkit-Coder/GtTextualCoderAddOns.class.st @@ -60,6 +60,11 @@ GtTextualCoderAddOns >> postCopy [ stylers := stylers copy ] +{ #category : #'api - stylers' } +GtTextualCoderAddOns >> removeStylersOfClass: aStylerClass [ + stylers removeAllSuchThat: [ :each | each class = aStylerClass ] +] + { #category : #'api - stylers' } GtTextualCoderAddOns >> stylers [ ^ stylers From 460bf236748e4472b83ea58433557409fc012889 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Sat, 10 Dec 2022 10:16:44 -0300 Subject: [PATCH 0336/1268] use `GtPhlowAction >> #id:` [feenkcom/gtoolkit#2945] --- src/GToolkit-Coder-UI/Behavior.extension.st | 30 +++++++++++++++++++ .../GtCoderBrowseCoderButtonId.class.st | 10 +++++++ .../GtCoderClassHierarchyButtonId.class.st | 10 +++++++ src/GToolkit-Coder/Behavior.extension.st | 27 ----------------- 4 files changed, 50 insertions(+), 27 deletions(-) create mode 100644 src/GToolkit-Coder-UI/Behavior.extension.st create mode 100644 src/GToolkit-Coder-UI/GtCoderBrowseCoderButtonId.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderClassHierarchyButtonId.class.st diff --git a/src/GToolkit-Coder-UI/Behavior.extension.st b/src/GToolkit-Coder-UI/Behavior.extension.st new file mode 100644 index 000000000..ad32660ff --- /dev/null +++ b/src/GToolkit-Coder-UI/Behavior.extension.st @@ -0,0 +1,30 @@ +Extension { #name : #Behavior } + +{ #category : #'*GToolkit-Coder-UI' } +Behavior >> gtBrowseButtonFor: anAction [ + + ^ anAction button + tooltip: 'Browse in another world tab'; + priority: 1; + id: GtCoderBrowseCoderButtonId; + icon: BrGlamorousVectorIcons emphasizedBrowse; + action: [ :aButton | self gtBrowseFromButton: aButton ] +] + +{ #category : #'*GToolkit-Coder-UI' } +Behavior >> gtHierarchyButtonFor: anAction [ + + ^ anAction dropdown + tooltip: 'Show Package and Class Hierarchies'; + icon: BrGlamorousIcons tree; + id: GtCoderClassHierarchyButtonId; + priority: 3; + content: [ :aButton | + | coder | + coder := aButton phlow firstParentWithView. + BlElement new + size: 400 @ 400; + addChild: ((GtCoderNavigationTabsStencil new + navigationModel: coder navigationModel; + asElement) background: Color white) ] +] diff --git a/src/GToolkit-Coder-UI/GtCoderBrowseCoderButtonId.class.st b/src/GToolkit-Coder-UI/GtCoderBrowseCoderButtonId.class.st new file mode 100644 index 000000000..c6e2f3460 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderBrowseCoderButtonId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtCoderBrowseCoderButtonId, + #superclass : #GtCoderElementId, + #category : #'GToolkit-Coder-UI-Coder - Ids' +} + +{ #category : #accessing } +GtCoderBrowseCoderButtonId >> asSymbol [ + ^ #'context-action--browse-coder' +] diff --git a/src/GToolkit-Coder-UI/GtCoderClassHierarchyButtonId.class.st b/src/GToolkit-Coder-UI/GtCoderClassHierarchyButtonId.class.st new file mode 100644 index 000000000..bf3d4c37e --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderClassHierarchyButtonId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtCoderClassHierarchyButtonId, + #superclass : #GtCoderElementId, + #category : #'GToolkit-Coder-UI-Coder - Ids' +} + +{ #category : #accessing } +GtCoderClassHierarchyButtonId >> asSymbol [ + ^ #'context-action--class-hierarchy' +] diff --git a/src/GToolkit-Coder/Behavior.extension.st b/src/GToolkit-Coder/Behavior.extension.st index 66428b5fb..80c0b5edc 100644 --- a/src/GToolkit-Coder/Behavior.extension.st +++ b/src/GToolkit-Coder/Behavior.extension.st @@ -1,15 +1,5 @@ Extension { #name : #Behavior } -{ #category : #'*GToolkit-Coder' } -Behavior >> gtBrowseButtonFor: anAction [ - - ^ anAction button - tooltip: 'Browse in another world tab'; - priority: 1; - icon: BrGlamorousVectorIcons emphasizedBrowse; - action: [ :aButton | self gtBrowseFromButton: aButton ] -] - { #category : #'*GToolkit-Coder' } Behavior >> gtBrowseFromButton: anElement [ "Do we want to share the same coder model?" @@ -33,20 +23,3 @@ Behavior >> gtCopyButtonFor: anAction [ aButton fireEvent: BrDropdownHideWish new ]) asElement padding: (BlInsets all: 5) ] ] - -{ #category : #'*GToolkit-Coder' } -Behavior >> gtHierarchyButtonFor: anAction [ - - ^ anAction dropdown - tooltip: 'Show Package and Class Hierarchies'; - icon: BrGlamorousIcons tree; - priority: 3; - content: [ :aButton | - | coder | - coder := aButton phlow firstParentWithView. - BlElement new - size: 400 @ 400; - addChild: ((GtCoderNavigationTabsStencil new - navigationModel: coder navigationModel; - asElement) background: Color white) ] -] From bc64b2275cbe16b0ecd83d37e1180e4995750604 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Mon, 12 Dec 2022 20:08:58 +0100 Subject: [PATCH 0337/1268] Add baseline and package forms in magritte --- .../GtBaselineDescription.class.st | 43 ++++++++++ .../GtMagritteCreateForm.class.st | 56 +++++++++++++ .../GtPackageDescription.class.st | 81 +++++++++++++++++++ 3 files changed, 180 insertions(+) create mode 100644 src/GToolkit-Coder-UI/GtBaselineDescription.class.st create mode 100644 src/GToolkit-Coder-UI/GtMagritteCreateForm.class.st create mode 100644 src/GToolkit-Coder-UI/GtPackageDescription.class.st diff --git a/src/GToolkit-Coder-UI/GtBaselineDescription.class.st b/src/GToolkit-Coder-UI/GtBaselineDescription.class.st new file mode 100644 index 000000000..3ba793295 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtBaselineDescription.class.st @@ -0,0 +1,43 @@ +Class { + #name : #GtBaselineDescription, + #superclass : #Object, + #instVars : [ + 'baseline' + ], + #category : #'GToolkit-Coder-UI-Forms - Models' +} + +{ #category : #'instance creation' } +GtBaselineDescription class >> forBaseline: aBaseline [ + ^ self new forBaseline: aBaseline +] + +{ #category : #accessing } +GtBaselineDescription >> baseline [ + + ^ baseline +] + +{ #category : #accessing } +GtBaselineDescription >> baseline: anObject [ + + baseline := anObject +] + +{ #category : #accessing } +GtBaselineDescription >> baselineDescription [ + + ^ MAStringDescription new + label: 'Baseline'; + priority: 1; + accessor: #baseline; + blocCompletion: [ GtStringsCompletionStrategy new + completions: (GtPrefixTree withAll: RPackageOrganizer default packageNames) ]; + addCondition: [ :aValue | (RPackageOrganizer default packageNamed: aValue ifAbsent: [ nil ]) isNil ] + labelled: 'Baseline or package exists' +] + +{ #category : #accessing } +GtBaselineDescription >> forBaseline: aBaseline [ + self baseline: aBaseline name +] diff --git a/src/GToolkit-Coder-UI/GtMagritteCreateForm.class.st b/src/GToolkit-Coder-UI/GtMagritteCreateForm.class.st new file mode 100644 index 000000000..cf27bdda6 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtMagritteCreateForm.class.st @@ -0,0 +1,56 @@ +Class { + #name : #GtMagritteCreateForm, + #superclass : #BrFrame, + #traits : 'TBrLayoutResizable', + #classTraits : 'TBrLayoutResizable classTrait', + #instVars : [ + 'description' + ], + #category : #'GToolkit-Coder-UI-Forms' +} + +{ #category : #'instance creation' } +GtMagritteCreateForm class >> forBaseline: aBaseline [ + ^ self forDescription: (GtBaselineDescription forBaseline: aBaseline) +] + +{ #category : #'instance creation' } +GtMagritteCreateForm class >> forDescription: aDescription [ + ^ self new description: aDescription +] + +{ #category : #'instance creation' } +GtMagritteCreateForm class >> forPackage: aPackage [ + ^ self forDescription: (GtPackageDescription forPackage: aPackage) +] + +{ #category : #converting } +GtMagritteCreateForm >> createForm [ + ^ self description asGtMagritteViewModel asElement +] + +{ #category : #accessing } +GtMagritteCreateForm >> description [ + + ^ description +] + +{ #category : #accessing } +GtMagritteCreateForm >> description: anObject [ + description := anObject. + + self removeChildren. + self addChild: self createForm +] + +{ #category : #initialization } +GtMagritteCreateForm >> initialize [ + super initialize. + + self layout: BlFlowLayout vertical. + self margin: (BlInsets all: 5). + self + constraintsDo: [ :c | + c horizontal exact: 400. + c vertical fitContent ] +] diff --git a/src/GToolkit-Coder-UI/GtPackageDescription.class.st b/src/GToolkit-Coder-UI/GtPackageDescription.class.st new file mode 100644 index 000000000..c899a26ed --- /dev/null +++ b/src/GToolkit-Coder-UI/GtPackageDescription.class.st @@ -0,0 +1,81 @@ +Class { + #name : #GtPackageDescription, + #superclass : #Object, + #instVars : [ + 'package', + 'packageName', + 'tag' + ], + #category : #'GToolkit-Coder-UI-Forms - Models' +} + +{ #category : #'instance creation' } +GtPackageDescription class >> forPackage: aPackage [ + ^ self new package: aPackage +] + +{ #category : #initialization } +GtPackageDescription >> initialize [ + tag := '' +] + +{ #category : #accessing } +GtPackageDescription >> package [ + + ^ package +] + +{ #category : #accessing } +GtPackageDescription >> package: aPackage [ + package := aPackage. + packageName := aPackage name. +] + +{ #category : #magritte } +GtPackageDescription >> packageDescription [ + + ^ MAStringDescription new + label: 'Package'; + priority: 1; + accessor: #packageName; + blocCompletion: [ GtStringsCompletionStrategy new + completions: (GtPrefixTree withAll: RPackageOrganizer default packageNames) ]; + addCondition: [ :aValue | (RPackageOrganizer default packageNamed: aValue ifAbsent: [ nil ]) isNil ] + labelled: 'Package exists' +] + +{ #category : #accessing } +GtPackageDescription >> packageName [ + + ^ packageName +] + +{ #category : #accessing } +GtPackageDescription >> packageName: anObject [ + + packageName := anObject +] + +{ #category : #accessing } +GtPackageDescription >> tag [ + + ^ tag +] + +{ #category : #accessing } +GtPackageDescription >> tag: aTagName [ + tag := aTagName +] + +{ #category : #magritte } +GtPackageDescription >> tagDescription [ + + ^ MAStringDescription new + label: 'Tag'; + priority: 2; + accessor: #tag; + blocCompletion: [ GtStringsCompletionStrategy new + completions: (GtPrefixTree withAll: (packageName asPackage classTags collect: #name)) ]; + addCondition: [ :aValue | (package classTagNamed: aValue ifAbsent: [ nil ]) isNil ] + labelled: 'Tag exists' +] From 2d08cb4db24d6cedf9bd383a375764e598f453d1 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Tue, 13 Dec 2022 14:07:39 +0100 Subject: [PATCH 0338/1268] Add more descriptions (class, parser, trait) --- .../GtBaselineDescription.class.st | 14 +- .../GtClassDescription.class.st | 178 +++++++++++++++++ .../GtMagritteCreateForm.class.st | 15 ++ .../GtParserDescription.class.st | 83 ++++++++ .../GtTraitDescription.class.st | 181 ++++++++++++++++++ 5 files changed, 466 insertions(+), 5 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtClassDescription.class.st create mode 100644 src/GToolkit-Coder-UI/GtParserDescription.class.st create mode 100644 src/GToolkit-Coder-UI/GtTraitDescription.class.st diff --git a/src/GToolkit-Coder-UI/GtBaselineDescription.class.st b/src/GToolkit-Coder-UI/GtBaselineDescription.class.st index 3ba793295..c9fa69d9b 100644 --- a/src/GToolkit-Coder-UI/GtBaselineDescription.class.st +++ b/src/GToolkit-Coder-UI/GtBaselineDescription.class.st @@ -24,7 +24,7 @@ GtBaselineDescription >> baseline: anObject [ baseline := anObject ] -{ #category : #accessing } +{ #category : #magritte } GtBaselineDescription >> baselineDescription [ ^ MAStringDescription new @@ -32,12 +32,16 @@ GtBaselineDescription >> baselineDescription [ priority: 1; accessor: #baseline; blocCompletion: [ GtStringsCompletionStrategy new - completions: (GtPrefixTree withAll: RPackageOrganizer default packageNames) ]; - addCondition: [ :aValue | (RPackageOrganizer default packageNamed: aValue ifAbsent: [ nil ]) isNil ] - labelled: 'Baseline or package exists' + completions: (GtPrefixTree withAll: (Smalltalk allClasses collect: #name)) ]; + addCondition: [ :aValue | (Smalltalk classNamed: aValue trim) isNil ] + labelled: 'Baseline name is already taken'; + addCondition: [ :aValue | aValue first isUppercase ] + labelled: 'First character must be uppercase'; + addCondition: [ :aValue | aValue isAllAlphaNumerics ] + labelled: 'Class name must be alphanumeric' ] -{ #category : #accessing } +{ #category : #'instance creation' } GtBaselineDescription >> forBaseline: aBaseline [ self baseline: aBaseline name ] diff --git a/src/GToolkit-Coder-UI/GtClassDescription.class.st b/src/GToolkit-Coder-UI/GtClassDescription.class.st new file mode 100644 index 000000000..874814bb4 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtClassDescription.class.st @@ -0,0 +1,178 @@ +Class { + #name : #GtClassDescription, + #superclass : #GtTraitDescription, + #instVars : [ + 'superclassName', + 'classVars', + 'pools' + ], + #category : #'GToolkit-Coder-UI-Forms - Models' +} + +{ #category : #accessing } +GtClassDescription >> classVars [ + + ^ classVars +] + +{ #category : #accessing } +GtClassDescription >> classVars: anObject [ + + classVars := anObject +] + +{ #category : #accessing } +GtClassDescription >> classVarsDescription [ + + ^ MAToManyRelationDescription new + label: 'Class vars'; + priority: 7; + accessor: #classVars; + blocListStencil: [ :aMemento :aDescription :aForm | + | aTagger | + aTagger := BrTagger new. + aTagger + margin: ((BlInsets left: 7) withBottom: 4); + hMatchParent; + vFitContent. + aForm hMatchParent. + aTagger + aptitude: (BrGlamorousTaggerEditableAptitude new + margin: (BlInsets right: 5); + tagLabel: [ :aTag | + BrEditableLabel new + text: (aDescription displayStringFor: aTag name); + aptitude: (BrGlamorousEditableLabelAptitude new + glamorousCodeFont; + defaultForeground: Color black; + fontSize: 10); + whenKey: BlKeyCombination primaryB + labelDo: [ :aShortcutEvent :aShortcut | aTagger phlow spawnObject: aTag name ] ]). + aTagger + when: BrTaggerAddTagRequest + do: [ :aRequest | + aMemento + write: ((aTagger tags collect: #name) + add: aRequest tag name; + yourself) + using: aDescription ]. + aTagger + when: BrTaggerRemoveTagRequest + do: [ :aRequest | + aMemento + write: ((aTagger tags collect: #name) + remove: aRequest tag name; + yourself) + using: aDescription ]. + aTagger + withAsyncSinkDo: [ :anElementSink | + anElementSink + sink: AsyncPeakSink new; + whenUpdate: [ :theTagger :aSink | + | theValues | + theValues := aSink value currentValue. + theTagger namedTags: theValues ]. + (aMemento readObservableValueUsing: aDescription) observe: anElementSink ] ] +] + +{ #category : #accessing } +GtClassDescription >> initialize [ + super initialize. + + self className: 'NameOfSubclass'. + self superclassName: 'Object'. + + classVars := OrderedCollection new. + pools := OrderedCollection new +] + +{ #category : #accessing } +GtClassDescription >> pools [ + + ^ pools +] + +{ #category : #accessing } +GtClassDescription >> pools: anObject [ + + pools := anObject +] + +{ #category : #accessing } +GtClassDescription >> poolsDescription [ + + ^ MAToManyRelationDescription new + label: 'Pools'; + priority: 7; + accessor: #pools; + blocListStencil: [ :aMemento :aDescription :aForm | + | aTagger | + aTagger := BrTagger new. + aTagger + margin: ((BlInsets left: 7) withBottom: 4); + hMatchParent; + vFitContent. + aForm hMatchParent. + aTagger + aptitude: (BrGlamorousTaggerEditableAptitude new + margin: (BlInsets right: 5); + tagLabel: [ :aTag | + BrEditableLabel new + text: (aDescription displayStringFor: aTag name); + aptitude: (BrGlamorousEditableLabelAptitude new + glamorousCodeFont; + defaultForeground: Color black; + fontSize: 10); + whenKey: BlKeyCombination primaryB + labelDo: [ :aShortcutEvent :aShortcut | aTagger phlow spawnObject: aTag name ] ]). + aTagger + when: BrTaggerAddTagRequest + do: [ :aRequest | + aMemento + write: ((aTagger tags collect: #name) + add: aRequest tag name; + yourself) + using: aDescription ]. + aTagger + when: BrTaggerRemoveTagRequest + do: [ :aRequest | + aMemento + write: ((aTagger tags collect: #name) + remove: aRequest tag name; + yourself) + using: aDescription ]. + aTagger + withAsyncSinkDo: [ :anElementSink | + anElementSink + sink: AsyncPeakSink new; + whenUpdate: [ :theTagger :aSink | + | theValues | + theValues := aSink value currentValue. + theTagger namedTags: theValues ]. + (aMemento readObservableValueUsing: aDescription) observe: anElementSink ] ] +] + +{ #category : #accessing } +GtClassDescription >> superclassDescription [ + + ^ MAStringDescription new + label: 'Superclass'; + priority: 2; + accessor: #superclassName; + blocCompletion: [ GtStringsCompletionStrategy new + completions: (GtPrefixTree withAll: (Smalltalk allClasses collect: #name)) ]; + addCondition: [ :aValue | (Smalltalk classNamed: aValue trim) isNotNil ] + labelled: 'Unknown class' +] + +{ #category : #accessing } +GtClassDescription >> superclassName [ + + ^ superclassName +] + +{ #category : #accessing } +GtClassDescription >> superclassName: anObject [ + + superclassName := anObject +] diff --git a/src/GToolkit-Coder-UI/GtMagritteCreateForm.class.st b/src/GToolkit-Coder-UI/GtMagritteCreateForm.class.st index cf27bdda6..053cf3d1e 100644 --- a/src/GToolkit-Coder-UI/GtMagritteCreateForm.class.st +++ b/src/GToolkit-Coder-UI/GtMagritteCreateForm.class.st @@ -14,6 +14,11 @@ GtMagritteCreateForm class >> forBaseline: aBaseline [ ^ self forDescription: (GtBaselineDescription forBaseline: aBaseline) ] +{ #category : #'instance creation' } +GtMagritteCreateForm class >> forClass [ + ^ self forDescription: GtClassDescription new +] + { #category : #'instance creation' } GtMagritteCreateForm class >> forDescription: aDescription [ ^ self new description: aDescription @@ -24,6 +29,16 @@ GtMagritteCreateForm class >> forPackage: aPackage [ ^ self forDescription: (GtPackageDescription forPackage: aPackage) ] +{ #category : #'instance creation' } +GtMagritteCreateForm class >> forParser [ + ^ self forDescription: GtParserDescription new +] + +{ #category : #'instance creation' } +GtMagritteCreateForm class >> forTrait [ + ^ self forDescription: GtTraitDescription new +] + { #category : #converting } GtMagritteCreateForm >> createForm [ ^ self description asGtMagritteViewModel asElement diff --git a/src/GToolkit-Coder-UI/GtParserDescription.class.st b/src/GToolkit-Coder-UI/GtParserDescription.class.st new file mode 100644 index 000000000..47cb28546 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtParserDescription.class.st @@ -0,0 +1,83 @@ +Class { + #name : #GtParserDescription, + #superclass : #Object, + #instVars : [ + 'parser', + 'scanner' + ], + #category : #'GToolkit-Coder-UI-Forms - Models' +} + +{ #category : #accessing } +GtParserDescription >> defaultParser [ + ^ 'SomeParser' +] + +{ #category : #accessing } +GtParserDescription >> defaultScanner [ + ^ 'SomeScanner' +] + +{ #category : #initialization } +GtParserDescription >> initialize [ + parser := self defaultParser. + scanner := self defaultScanner +] + +{ #category : #accessing } +GtParserDescription >> parser [ + + ^ parser +] + +{ #category : #accessing } +GtParserDescription >> parser: anObject [ + + parser := anObject +] + +{ #category : #magritte } +GtParserDescription >> parserDescription [ + + ^ MAStringDescription new + label: 'Parser'; + priority: 1; + accessor: #parser; + blocCompletion: [ GtStringsCompletionStrategy new + completions: (GtPrefixTree withAll: (Smalltalk allClasses collect: #name)) ]; + addCondition: [ :aValue | (Smalltalk classNamed: aValue trim) isNil ] + labelled: 'Class name is already taken'; + addCondition: [ :aValue | aValue first isUppercase ] + labelled: 'First character must be uppercase'; + addCondition: [ :aValue | aValue isAllAlphaNumerics ] + labelled: 'Class name must be alphanumeric' +] + +{ #category : #accessing } +GtParserDescription >> scanner [ + + ^ scanner +] + +{ #category : #accessing } +GtParserDescription >> scanner: anObject [ + + scanner := anObject +] + +{ #category : #magritte } +GtParserDescription >> scannerDescription [ + + ^ MAStringDescription new + label: 'Scanner'; + priority: 2; + accessor: #scanner; + blocCompletion: [ GtStringsCompletionStrategy new + completions: (GtPrefixTree withAll: (Smalltalk allClasses collect: #name)) ]; + addCondition: [ :aValue | (Smalltalk classNamed: aValue trim) isNil ] + labelled: 'Class name is already taken'; + addCondition: [ :aValue | aValue first isUppercase ] + labelled: 'First character must be uppercase'; + addCondition: [ :aValue | aValue isAllAlphaNumerics ] + labelled: 'Class name must be alphanumeric' +] diff --git a/src/GToolkit-Coder-UI/GtTraitDescription.class.st b/src/GToolkit-Coder-UI/GtTraitDescription.class.st new file mode 100644 index 000000000..aea5a96de --- /dev/null +++ b/src/GToolkit-Coder-UI/GtTraitDescription.class.st @@ -0,0 +1,181 @@ +Class { + #name : #GtTraitDescription, + #superclass : #Object, + #instVars : [ + 'className', + 'traits', + 'slots' + ], + #category : #'GToolkit-Coder-UI-Forms - Models' +} + +{ #category : #accessing } +GtTraitDescription >> className [ + ^ className +] + +{ #category : #accessing } +GtTraitDescription >> className: anObject [ + className := anObject +] + +{ #category : #accessing } +GtTraitDescription >> defaultName [ + ^ 'TNameOfTrait' +] + +{ #category : #initialization } +GtTraitDescription >> initialize [ + className := self defaultName. + traits := OrderedCollection new. + slots := OrderedCollection new +] + +{ #category : #magritte } +GtTraitDescription >> nameDescription [ + + ^ MAStringDescription new + label: 'Name'; + priority: 1; + accessor: #className; + blocCompletion: [ GtStringsCompletionStrategy new + completions: (GtPrefixTree withAll: (Smalltalk allClasses collect: #name)) ]; + addCondition: [ :aValue | (Smalltalk classNamed: aValue trim) isNil ] + labelled: 'Name is already taken'; + addCondition: [ :aValue | aValue first isUppercase ] + labelled: 'First character must be uppercase'; + addCondition: [ :aValue | aValue isAllAlphaNumerics ] + labelled: 'Class name must be alphanumeric' +] + +{ #category : #accessing } +GtTraitDescription >> slots [ + + ^ slots +] + +{ #category : #accessing } +GtTraitDescription >> slots: anObject [ + + slots := anObject +] + +{ #category : #accessing } +GtTraitDescription >> slotsDescription [ + + ^ MAToManyRelationDescription new + label: 'Slots'; + priority: 5; + accessor: #slots; + blocListStencil: [ :aMemento :aDescription :aForm | + | aTagger | + aTagger := BrTagger new. + aTagger + margin: ((BlInsets left: 7) withBottom: 4); + hMatchParent; + vFitContent. + aForm hMatchParent. + aTagger + aptitude: (BrGlamorousTaggerEditableAptitude new + margin: (BlInsets right: 5); + tagLabel: [ :aTag | + BrEditableLabel new + text: (aDescription displayStringFor: aTag name); + aptitude: (BrGlamorousEditableLabelAptitude new + glamorousCodeFont; + defaultForeground: Color black; + fontSize: 10); + whenKey: BlKeyCombination primaryB + labelDo: [ :aShortcutEvent :aShortcut | aTagger phlow spawnObject: aTag name ] ]). + aTagger + when: BrTaggerAddTagRequest + do: [ :aRequest | + aMemento + write: ((aTagger tags collect: #name) + add: aRequest tag name; + yourself) + using: aDescription ]. + aTagger + when: BrTaggerRemoveTagRequest + do: [ :aRequest | + aMemento + write: ((aTagger tags collect: #name) + remove: aRequest tag name; + yourself) + using: aDescription ]. + aTagger + withAsyncSinkDo: [ :anElementSink | + anElementSink + sink: AsyncPeakSink new; + whenUpdate: [ :theTagger :aSink | + | theValues | + theValues := aSink value currentValue. + theTagger namedTags: theValues ]. + (aMemento readObservableValueUsing: aDescription) observe: anElementSink ] ] +] + +{ #category : #accessing } +GtTraitDescription >> traits [ + + ^ traits +] + +{ #category : #accessing } +GtTraitDescription >> traits: anObject [ + + traits := anObject +] + +{ #category : #accessing } +GtTraitDescription >> traitsDescription [ + + ^ MAToManyRelationDescription new + label: 'Traits'; + priority: 5; + accessor: #traits; + blocListStencil: [ :aMemento :aDescription :aForm | + | aTagger | + aTagger := BrTagger new. + aTagger + margin: ((BlInsets left: 7) withBottom: 4); + hMatchParent; + vFitContent. + aForm hMatchParent. + aTagger + aptitude: (BrGlamorousTaggerEditableAptitude new + margin: (BlInsets right: 5); + tagLabel: [ :aTag | + BrEditableLabel new + text: (aDescription displayStringFor: aTag name); + aptitude: (BrGlamorousEditableLabelAptitude new + glamorousCodeFont; + defaultForeground: Color black; + fontSize: 10); + whenKey: BlKeyCombination primaryB + labelDo: [ :aShortcutEvent :aShortcut | aTagger phlow spawnObject: aTag name ] ]). + aTagger + when: BrTaggerAddTagRequest + do: [ :aRequest | + aMemento + write: ((aTagger tags collect: #name) + add: aRequest tag name; + yourself) + using: aDescription ]. + aTagger + when: BrTaggerRemoveTagRequest + do: [ :aRequest | + aMemento + write: ((aTagger tags collect: #name) + remove: aRequest tag name; + yourself) + using: aDescription ]. + aTagger + withAsyncSinkDo: [ :anElementSink | + anElementSink + sink: AsyncPeakSink new; + whenUpdate: [ :theTagger :aSink | + | theValues | + theValues := aSink value currentValue. + theTagger namedTags: theValues ]. + (aMemento readObservableValueUsing: aDescription) observe: anElementSink ] ] +] From baf49d4a54cf915770bb4dfeedaf4d067c6bec1c Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 13 Dec 2022 10:25:40 -0600 Subject: [PATCH 0339/1268] adding inform for refactoring errors --- ...tSourceCoderRefactoringController.class.st | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st b/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st index 2c2638738..001d37db3 100644 --- a/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st +++ b/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st @@ -34,22 +34,26 @@ GtSourceCoderRefactoringController >> cleanUp [ { #category : #executing } GtSourceCoderRefactoringController >> execute [ - [ - self saveSource. - self safelyExecute ] - on: Error - do: [ :ex | - self refactoringFailed. - NonInteractiveTranscript stderr - nextPutAll: ('[{1}] {2}' format: { self class name . ex asString }); - cr. - - (ex signalerContext stack first: 20) do: [ :eachStackEntry | - NonInteractiveTranscript stderr - nextPutAll: eachStackEntry printString; - cr ]. - - ex return ] + [ self saveSource. + self safelyExecute ] + on: Error + do: [ :ex | + self refactoringFailed. + (ex isKindOf: RBRefactoringError) + ifTrue: [ self inform: self refactoringName , ': ' , ex messageText ] + ifFalse: [ NonInteractiveTranscript stderr + nextPutAll: ('[{1}] {2}' + format: {self class name. + ex asString}); + cr. + + (ex signalerContext stack first: 20) + do: [ :eachStackEntry | + NonInteractiveTranscript stderr + nextPutAll: eachStackEntry printString; + cr ] ]. + + ex return ] ] { #category : #private } From a2c24e3ae15aadd67f862bc08df6d1d95eb8fc6a Mon Sep 17 00:00:00 2001 From: Andrei Chis Date: Tue, 13 Dec 2022 22:18:39 +0100 Subject: [PATCH 0340/1268] Remove usage of #asCollection --- src/GToolkit-Coder/GtCoderAnnouncer.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder/GtCoderAnnouncer.class.st b/src/GToolkit-Coder/GtCoderAnnouncer.class.st index 4646dc462..2bc7a51ef 100644 --- a/src/GToolkit-Coder/GtCoderAnnouncer.class.st +++ b/src/GToolkit-Coder/GtCoderAnnouncer.class.st @@ -5,7 +5,7 @@ Class { 'suppressedAnnouncements', 'monitor' ], - #category : 'GToolkit-Coder-Coders' + #category : #'GToolkit-Coder-Coders' } { #category : #announce } @@ -29,6 +29,6 @@ GtCoderAnnouncer >> suppress: aCollectionOfAnnouncementClasses during: aBlock [ monitor critical: [ | aPreviousSuppressedAnnouncements | aPreviousSuppressedAnnouncements := suppressedAnnouncements copy. - suppressedAnnouncements := (suppressedAnnouncements, aCollectionOfAnnouncementClasses asCollection) asSet. + suppressedAnnouncements := (suppressedAnnouncements, aCollectionOfAnnouncementClasses asOrderedCollection) asSet. aBlock ensure: [ suppressedAnnouncements := aPreviousSuppressedAnnouncements ] ] ] From 17db973cc4a2b40422546a85872dbb6b3feb8d39 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Wed, 14 Dec 2022 14:24:24 +0100 Subject: [PATCH 0341/1268] fix dependencies --- ...tNotificationDebugSessionExamples.class.st | 93 +++++++ .../RPackage.extension.st | 2 +- .../GtCoderExecutionContextVariable.class.st | 50 ---- .../GtNotificationDebugSession.class.st | 52 ++++ ...GtNotificationDebugSessionElement.class.st | 229 ++++++++++++++++++ 5 files changed, 375 insertions(+), 51 deletions(-) create mode 100644 src/GToolkit-Coder-Examples/GtNotificationDebugSessionExamples.class.st delete mode 100644 src/GToolkit-Coder-UI/GtCoderExecutionContextVariable.class.st create mode 100644 src/GToolkit-Coder-UI/GtNotificationDebugSession.class.st create mode 100644 src/GToolkit-Coder-UI/GtNotificationDebugSessionElement.class.st diff --git a/src/GToolkit-Coder-Examples/GtNotificationDebugSessionExamples.class.st b/src/GToolkit-Coder-Examples/GtNotificationDebugSessionExamples.class.st new file mode 100644 index 000000000..c0554ca49 --- /dev/null +++ b/src/GToolkit-Coder-Examples/GtNotificationDebugSessionExamples.class.st @@ -0,0 +1,93 @@ +Class { + #name : #GtNotificationDebugSessionExamples, + #superclass : #GtNotificationCommonExamples, + #instVars : [ + 'sessions' + ], + #category : #'GToolkit-Coder-Examples-Examples' +} + +{ #category : #'private - support' } +GtNotificationDebugSessionExamples >> addSession: aSession [ + self sessions add: aSession. +] + +{ #category : #'examples - debug session' } +GtNotificationDebugSessionExamples >> basicDebugSessionElement [ + + | anElement | + anElement := GtNotificationDebugSessionElement new. + self assert: anElement notification isNil. + ^ anElement +] + +{ #category : #'examples - debug session' } +GtNotificationDebugSessionExamples >> basicDebugSessionEvent [ + + | anEvent | + anEvent := GtNotificationDebugSession new. + self assert: anEvent debugSession isNil. + self assert: (anEvent asElement isKindOf: BlElement). + ^ anEvent +] + +{ #category : #'examples - debug session' } +GtNotificationDebugSessionExamples >> debugSession [ + + + | aContext aProcess aSession | + aContext := [ 1 + 1 ] asContext. + aProcess := Process + forContext: aContext + priority: Processor userInterruptPriority. + aSession := aProcess + newDebugSessionNamed: 'Example session' + startedAt: aContext. + self addSession: aSession. + ^ aSession +] + +{ #category : #'examples - debug session' } +GtNotificationDebugSessionExamples >> debugSessionElement [ + + | anElement anEvent | + anElement := self basicDebugSessionElement. + anEvent := self debugSessionNotification. + anElement notification: anEvent. + self assert: anElement notification equals: anEvent. + ^ anElement +] + +{ #category : #'examples - debug session' } +GtNotificationDebugSessionExamples >> debugSessionNotification [ + + | anEvent aSession | + anEvent := self basicDebugSessionEvent. + aSession := self sharedDebugSession. + anEvent debugSession: aSession. + self assert: anEvent debugSession equals: aSession. + self assert: (anEvent asElement isKindOf: BlElement). + ^ anEvent +] + +{ #category : #'private - support' } +GtNotificationDebugSessionExamples >> sessions [ + ^ sessions ifNil: [ sessions := OrderedCollection new ] +] + +{ #category : #'examples - debug session' } +GtNotificationDebugSessionExamples >> sharedDebugSession [ + + | aSharedSession aPharoSession | + aSharedSession := GtSharedDebugSession new. + aPharoSession := self debugSession. + aSharedSession session: aPharoSession. + self assert: aSharedSession session equals: aPharoSession. + ^ aSharedSession +] + +{ #category : #'private - support' } +GtNotificationDebugSessionExamples >> terminateSessions [ + self sessions do: [ :eachSession | + eachSession terminate ] +] diff --git a/src/GToolkit-Coder-Extensions/RPackage.extension.st b/src/GToolkit-Coder-Extensions/RPackage.extension.st index b7708da4c..fc7fb3af3 100644 --- a/src/GToolkit-Coder-Extensions/RPackage.extension.st +++ b/src/GToolkit-Coder-Extensions/RPackage.extension.st @@ -50,7 +50,7 @@ RPackage >> gtDefinedClassesFor: aView context: aPhlowContext [ (aPhlowContext isKindOf: GtPhlowExecutionContext) ifFalse: [ ^ aView empty ]. aPhlowContext hasPackageCoder ifFalse: [ ^ aView empty ]. ^ aView explicit - priority: 10; + priority: 1; title: 'Classes'; disableAsync; stencil: [ aPhlowContext packageCoder classesCoder asElement ] diff --git a/src/GToolkit-Coder-UI/GtCoderExecutionContextVariable.class.st b/src/GToolkit-Coder-UI/GtCoderExecutionContextVariable.class.st deleted file mode 100644 index 29211d4b4..000000000 --- a/src/GToolkit-Coder-UI/GtCoderExecutionContextVariable.class.st +++ /dev/null @@ -1,50 +0,0 @@ -" -I am a {{gtClass:DynamicVariable}}. -I hold a {{gtMethod:BlSpace>>id}} as a {{gtClass:Process}} specific value. -I am used to pass an execution context information that can be requested, for example to display a user information. -1. # Usage -## Initializing Execution Context - -To initialize execution context value using a {{gtClass:BlElement}}, use {{gtMethod:GtCoderExecutionContextVariable class>>#element:do:|label=#selector|expanded=true}} class-side method: -1. ## Obtaining Execution Context - -To obtain the execution context, use {{gtMethod:GtCoderExecutionContextVariable class>>#spaceDo:ifClosed:|label=#selector|expanded=true}} class-side method: - - -" -Class { - #name : #GtCoderExecutionContextVariable, - #superclass : #DynamicVariable, - #category : 'GToolkit-Coder-UI-Basic' -} - -{ #category : #'api - execution' } -GtCoderExecutionContextVariable class >> element: anElement do: aBlock [ - "Initialize a Space ID using the element and evaluate the block" - | aSpaceId | - aSpaceId := self newSpaceIdFromElement: anElement. - ^ self - value: aSpaceId - during: aBlock -] - -{ #category : #testing } -GtCoderExecutionContextVariable class >> isInheritable [ - ^true -] - -{ #category : #'private - instance creation' } -GtCoderExecutionContextVariable class >> newSpaceIdFromElement: anElement [ - anElement spaceDo: [ :aSpace | - ^ aSpace id ]. - ^ nil -] - -{ #category : #'api - execution' } -GtCoderExecutionContextVariable class >> spaceDo: aSpaceBlock ifClosed: aClosedBlock [ - self value ifNotNil: [ :aSpaceId | - BlSpace - spaceWithId: aSpaceId - do: [ :aSpace | ^ aSpaceBlock cull: aSpace ] ]. - ^ aClosedBlock value -] diff --git a/src/GToolkit-Coder-UI/GtNotificationDebugSession.class.st b/src/GToolkit-Coder-UI/GtNotificationDebugSession.class.st new file mode 100644 index 000000000..be0953282 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtNotificationDebugSession.class.st @@ -0,0 +1,52 @@ +Class { + #name : #GtNotificationDebugSession, + #superclass : #GtNotificationEvent, + #instVars : [ + 'debugSession' + ], + #category : #'GToolkit-Coder-UI-DebugSession' +} + +{ #category : #'api - notification' } +GtNotificationDebugSession >> addedTo: aGtNotifications [ + | aSubscription | + aSubscription := self debugSession + when: GtSharedDebugSessionAnnouncement + do: [ :anAnnouncement | + self removeFrom: aGtNotifications. + self debugSession removeSubscription: aSubscription ] +] + +{ #category : #'private - asserting' } +GtNotificationDebugSession >> assertDebugSession: aDebugSession [ + self + assert: [ aDebugSession isNotNil ] + description: [ 'Debug session must be non-nil' ]. + self + assert: [ aDebugSession isKindOf: GtSharedDebugSession ] + description: [ 'Debug session must be a ', + GtSharedDebugSession name, ' instance, instead of a ', + aDebugSession class name, ' instance' ] +] + +{ #category : #accessing } +GtNotificationDebugSession >> debugSession [ + + ^ debugSession +] + +{ #category : #accessing } +GtNotificationDebugSession >> debugSession: aDebugSession [ + self assertDebugSession: aDebugSession. + debugSession := aDebugSession +] + +{ #category : #'api - accessing' } +GtNotificationDebugSession >> elementClass [ + ^ GtNotificationDebugSessionElement +] + +{ #category : #'private - adding / removing' } +GtNotificationDebugSession >> removeFrom: aGtNotifications [ + aGtNotifications removeNotification: self +] diff --git a/src/GToolkit-Coder-UI/GtNotificationDebugSessionElement.class.st b/src/GToolkit-Coder-UI/GtNotificationDebugSessionElement.class.st new file mode 100644 index 000000000..82b4be66e --- /dev/null +++ b/src/GToolkit-Coder-UI/GtNotificationDebugSessionElement.class.st @@ -0,0 +1,229 @@ +Class { + #name : #GtNotificationDebugSessionElement, + #superclass : #GtNotificationEventElement, + #instVars : [ + 'textEditor', + 'toolbarElement', + 'borderElement', + 'stackListElement' + ], + #category : #'GToolkit-Coder-UI-DebugSession' +} + +{ #category : #'private - accessing' } +GtNotificationDebugSessionElement >> borderElement [ + + ^ borderElement +] + +{ #category : #'private - actions' } +GtNotificationDebugSessionElement >> debug [ + self debugSessionDo: [ :aSession | + aSession debug. + self dismiss ] +] + +{ #category : #'private - accessing' } +GtNotificationDebugSessionElement >> debugSessionDo: aBlock [ + self + notificationDo: [ :anEvent | anEvent debugSession ifNotNil: aBlock ] +] + +{ #category : #initialization } +GtNotificationDebugSessionElement >> defaultLayout [ + ^ BlLinearLayout vertical alignCenterRight +] + +{ #category : #initialization } +GtNotificationDebugSessionElement >> initialize [ + super initialize. + self initializeBorderElement. + self initializeTextEditor. + self initializeStackList. + self initializeToolbarElement. + + self addChild: self borderElement as: #border. + + self borderElement containerDo: [ :aContainer | + aContainer alignCenterRight. + aContainer addChild: self textEditor as: #label. + aContainer addChild: self stackListElement as: #stack. + aContainer addChild: self toolbarElement as: #toolbar ]. + + self addAptitude: (BrLayoutResizerAptitude new + hInherit; + vAnyToFitContent; + hInherit: self borderElement; + vAnyToFitContent: self borderElement). + + self borderElement addAptitude: (BrLayoutResizerAptitude new + hInherit: self textEditor; + vAnyToFitContent: self textEditor; + hInherit: self stackListElement; + anyToFitContent: self toolbarElement). +] + +{ #category : #initialization } +GtNotificationDebugSessionElement >> initializeBorderElement [ + borderElement := GtNotificationBorderElement new + borderDo: [ :anElement | + anElement + border: (BlBorder paint: self theme status errorBackgroundColor width: 1); + padding: (BlInsets all: 0) ]; + withCloseButtonAction: [ self terminate ] +] + +{ #category : #initialization } +GtNotificationDebugSessionElement >> initializeStackList [ + stackListElement := BrSimpleList new + hMatchParent; + vExact: 50; + padding: (BlInsets top: 5 right: 9 bottom: 10 left: 9); + itemType: [ :anItemTypeFactory :anItemObject :anItemIndex | DebugSession ]; + itemStencil: [ :anEventElementClass :aListWidget | + BrLabel new + aptitude: (BrGlamorousLabelAptitude new + glamorousRegularFont; + glamorousRegularSmallSize); + hMatchParent; + vFitContent ]; + itemDataBinder: [ :aLabel :aContext :anItemIndex | + aLabel text: (self textForContext: aContext) ] +] + +{ #category : #initialization } +GtNotificationDebugSessionElement >> initializeTextEditor [ + textEditor := BrEditor new + aptitude: + (BrGlamorousRegularEditorAptitude new + glamorousRegularFont; + glamorousRegularSmallSize); + padding: + (BlInsets + top: 5 + right: 10 + bottom: 5 + left: 10); + background: self theme status errorBackgroundColor; + hMatchParent; + vFitContent; + beReadOnlyWithSelection +] + +{ #category : #initialization } +GtNotificationDebugSessionElement >> initializeToolbarElement [ + | aDebugButton | + toolbarElement := BrToolbar new + aptitude: BrGlamorousToolbarAptitude; + padding: (BlInsets top: 5 right: 10 bottom: 10 left: 10); + fitContent. + + aDebugButton := BrButton new + aptitude: BrGlamorousButtonWithIconAptitude; + beSmallSize; + icon: BrGlamorousVectorIcons debug; + label: 'Debug'; + action: [ self debug ]. + + self toolbarElement + addItem: aDebugButton +] + +{ #category : #'private - instance creation' } +GtNotificationDebugSessionElement >> newTextDescribingSession: aSession [ + ^ String streamContents: [ :aStream | + aStream nextPutAll: aSession name asString ] +] + +{ #category : #'private - announcement handling' } +GtNotificationDebugSessionElement >> onDebugSessionDebugged: anAnnouncement [ + self enqueueTask: (BlTaskAction new action: [ + self dismiss ]) +] + +{ #category : #'private - announcement handling' } +GtNotificationDebugSessionElement >> onDebugSessionTerminated: anAnnouncement [ + self enqueueTask: (BlTaskAction new action: [ + self dismiss ]) +] + +{ #category : #'private - hooks' } +GtNotificationDebugSessionElement >> onNotificationChanged [ + super onNotificationChanged. + self updateElement. +] + +{ #category : #'private - accessing' } +GtNotificationDebugSessionElement >> stackListElement [ + + ^ stackListElement +] + +{ #category : #'private - subscriptions' } +GtNotificationDebugSessionElement >> subscribeToNotification [ + super subscribeToNotification. + self debugSessionDo: [ :aSession | + aSession + when: GtSharedDebugSessionDebuggedAnnouncement + send: #onDebugSessionDebugged: + to: self; + when: GtSharedDebugSessionTerminatedAnnouncement + send: #onDebugSessionTerminated: + to: self ] +] + +{ #category : #'private - actions' } +GtNotificationDebugSessionElement >> terminate [ + self debugSessionDo: [ :aSession | + aSession terminate. + self dismiss. + ]. +] + +{ #category : #accessing } +GtNotificationDebugSessionElement >> textEditor [ + + ^ textEditor +] + +{ #category : #'private - instance creation' } +GtNotificationDebugSessionElement >> textForContext: aContext [ + ^ aContext printString +] + +{ #category : #'private - accessing' } +GtNotificationDebugSessionElement >> toolbarElement [ + + ^ toolbarElement +] + +{ #category : #'private - subscriptions' } +GtNotificationDebugSessionElement >> unsubscribeFromNotification [ + super unsubscribeFromNotification. + self debugSessionDo: [ :aSession | + aSession unsubscribe: self ] +] + +{ #category : #'private - updating' } +GtNotificationDebugSessionElement >> updateElement [ + self debugSessionDo: [ :aSession | + self updateTextEditor. + self updateStackList. ] +] + +{ #category : #'private - updating' } +GtNotificationDebugSessionElement >> updateStackList [ + self debugSessionDo: [ :aSession | + aSession interruptedContext + ifNotNil: [ :anInterruptedContext | + anInterruptedContext stack ifNotNil: [ :aStack | + self stackListElement items: aStack ] ] ] +] + +{ #category : #'private - updating' } +GtNotificationDebugSessionElement >> updateTextEditor [ + self debugSessionDo: [ :aSession | + | aText | + aText := self newTextDescribingSession: aSession. + self textEditor text: aText ] +] From b9f41266444f91e903512569a8ee00c83c8e39ba Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 14 Dec 2022 12:05:27 -0300 Subject: [PATCH 0342/1268] add `GtPhlowElementContext >> #coderNavigationModel` [feenkcom/gtoolkit#2945] Move `aCoder phlow beView` to the `GtCoder >> #initialize`. Remove `GtPhlowCoderView` usage --- .../Behavior.extension.st | 3 +- .../CompiledMethod.extension.st | 4 +-- .../ProtoObject.extension.st | 3 +- .../RPackage.extension.st | 3 +- src/GToolkit-Coder-UI/Behavior.extension.st | 6 ++-- src/GToolkit-Coder-UI/GtCoder.class.st | 2 ++ src/GToolkit-Coder-UI/GtCoderTool.class.st | 5 +--- .../GtPhlowElementContext.extension.st | 30 +++++++++++++++++++ .../GtReadyCoderTool.class.st | 1 - src/GToolkit-Coder/Behavior.extension.st | 22 +++----------- 10 files changed, 44 insertions(+), 35 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtPhlowElementContext.extension.st diff --git a/src/GToolkit-Coder-Extensions/Behavior.extension.st b/src/GToolkit-Coder-Extensions/Behavior.extension.st index 7d96b61b9..5076e0c21 100644 --- a/src/GToolkit-Coder-Extensions/Behavior.extension.st +++ b/src/GToolkit-Coder-Extensions/Behavior.extension.st @@ -7,8 +7,7 @@ Behavior >> gtBrowse [ { #category : #'*GToolkit-Coder-Extensions' } Behavior >> gtBrowseFrom: anElement [ - ^ ((GtPhlowCoderView new coder: (GtCoder forClass: self)) asElement - openInPagerFrom: anElement) maximized + ^ ((GtCoder forClass: self) asElement openInPagerFrom: anElement) maximized ] { #category : #'*GToolkit-Coder-Extensions' } diff --git a/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st b/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st index 7a04a3064..bfcc987d2 100644 --- a/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st +++ b/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st @@ -9,9 +9,7 @@ CompiledMethod >> gtBrowse [ { #category : #'*GToolkit-Coder-Extensions' } CompiledMethod >> gtBrowseFrom: anElement [ - ^ ((GtPhlowCoderView new coder: (GtCoder forMethod: self)) asElement - openInPagerFrom: anElement) - maximized + ^ ((GtCoder forMethod: self) asElement openInPagerFrom: anElement) maximized ] { #category : #'*GToolkit-Coder-Extensions' } diff --git a/src/GToolkit-Coder-Extensions/ProtoObject.extension.st b/src/GToolkit-Coder-Extensions/ProtoObject.extension.st index 798c8a591..2173f55bd 100644 --- a/src/GToolkit-Coder-Extensions/ProtoObject.extension.st +++ b/src/GToolkit-Coder-Extensions/ProtoObject.extension.st @@ -7,6 +7,5 @@ ProtoObject >> gtBrowse [ { #category : #'*GToolkit-Coder-Extensions' } ProtoObject >> gtBrowseFrom: anElement [ - ^ ((GtPhlowCoderView new coder: (GtCoder forObject: self)) asElement - openInPagerFrom: anElement) maximized + ^ ((GtCoder forObject: self) asElement openInPagerFrom: anElement) maximized ] diff --git a/src/GToolkit-Coder-Extensions/RPackage.extension.st b/src/GToolkit-Coder-Extensions/RPackage.extension.st index b7708da4c..eda7f4233 100644 --- a/src/GToolkit-Coder-Extensions/RPackage.extension.st +++ b/src/GToolkit-Coder-Extensions/RPackage.extension.st @@ -40,8 +40,7 @@ RPackage >> gtBrowse [ { #category : #'*GToolkit-Coder-Extensions' } RPackage >> gtBrowseFrom: anElement [ - ^ ((GtPhlowCoderView new coder: (GtCoder forPackage: self)) asElement - openInPagerFrom: anElement) maximized + ^ ((GtCoder forPackage: self) asElement openInPagerFrom: anElement) maximized ] { #category : #'*GToolkit-Coder-Extensions' } diff --git a/src/GToolkit-Coder-UI/Behavior.extension.st b/src/GToolkit-Coder-UI/Behavior.extension.st index ad32660ff..f92043f9d 100644 --- a/src/GToolkit-Coder-UI/Behavior.extension.st +++ b/src/GToolkit-Coder-UI/Behavior.extension.st @@ -20,11 +20,11 @@ Behavior >> gtHierarchyButtonFor: anAction [ id: GtCoderClassHierarchyButtonId; priority: 3; content: [ :aButton | - | coder | - coder := aButton phlow firstParentWithView. + | aNavigationModel | + aNavigationModel := aButton phlow coderNavigationModel. BlElement new size: 400 @ 400; addChild: ((GtCoderNavigationTabsStencil new - navigationModel: coder navigationModel; + navigationModel: aNavigationModel; asElement) background: Color white) ] ] diff --git a/src/GToolkit-Coder-UI/GtCoder.class.st b/src/GToolkit-Coder-UI/GtCoder.class.st index 83b36578f..c6fa28119 100644 --- a/src/GToolkit-Coder-UI/GtCoder.class.st +++ b/src/GToolkit-Coder-UI/GtCoder.class.st @@ -56,6 +56,8 @@ GtCoder >> initialize [ self addChild: self contentElement as: #content. self addAptitude: (BrLayoutResizerAptitude inherit). + + self phlow beView. ] { #category : #initialization } diff --git a/src/GToolkit-Coder-UI/GtCoderTool.class.st b/src/GToolkit-Coder-UI/GtCoderTool.class.st index e405da03d..44dad7343 100644 --- a/src/GToolkit-Coder-UI/GtCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtCoderTool.class.st @@ -8,10 +8,7 @@ Class { GtCoderTool >> asElementDo: aOneArgBlock [ "Create a tool element and execute the block." - | anElement | - anElement := (GtPhlowCoderView new coder: self newCoder) asElement. - anElement phlow beView. - ^ aOneArgBlock cull: anElement asPagerPageElement + ^ aOneArgBlock cull: self newCoder asPagerPageElement ] { #category : #'api - converting' } diff --git a/src/GToolkit-Coder-UI/GtPhlowElementContext.extension.st b/src/GToolkit-Coder-UI/GtPhlowElementContext.extension.st new file mode 100644 index 000000000..309e8e591 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtPhlowElementContext.extension.st @@ -0,0 +1,30 @@ +Extension { #name : #GtPhlowElementContext } + +{ #category : #'*GToolkit-Coder-UI' } +GtPhlowElementContext >> coder [ + + | anElement | + anElement := self firstParentWithView. + self + assert: [ anElement isNotNil ] + description: [ 'Coder (element) must be non-nil' ]. + self + assert: [ anElement isKindOf: GtCoder ] + description: [ 'Coder (element) must be a kind of ' , GtCoder name ]. + + ^ anElement +] + +{ #category : #'*GToolkit-Coder-UI' } +GtPhlowElementContext >> coderNavigationModel [ + + | aCoder aNavigationModel | + aCoder := self coder. + aNavigationModel := aCoder navigationModel. + + self + assert: [ aNavigationModel isNotNil ] + description: [ 'Coder navigation model must be non-nil' ]. + + ^ aNavigationModel +] diff --git a/src/GToolkit-Coder-UI/GtReadyCoderTool.class.st b/src/GToolkit-Coder-UI/GtReadyCoderTool.class.st index ffda28d7a..03194fa5d 100644 --- a/src/GToolkit-Coder-UI/GtReadyCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtReadyCoderTool.class.st @@ -18,7 +18,6 @@ GtReadyCoderTool >> asElementDo: aOneArgBlock [ | anElement | anElement := (GtCoder forCoder: self coder) asElement. - anElement phlow beView. ^ aOneArgBlock cull: anElement asPagerPageElement ] diff --git a/src/GToolkit-Coder/Behavior.extension.st b/src/GToolkit-Coder/Behavior.extension.st index 80c0b5edc..736fb4920 100644 --- a/src/GToolkit-Coder/Behavior.extension.st +++ b/src/GToolkit-Coder/Behavior.extension.st @@ -3,23 +3,9 @@ Extension { #name : #Behavior } { #category : #'*GToolkit-Coder' } Behavior >> gtBrowseFromButton: anElement [ "Do we want to share the same coder model?" - anElement phlow firstParentWithView navigationModel coderDo: [ :aCoder | - ((GtCoder forCoder: aCoder asNewCoderModelWithSameSubject) - openInPagerFrom: anElement) - maximized ] -] -{ #category : #'*GToolkit-Coder' } -Behavior >> gtCopyButtonFor: anAction [ - - ^ anAction dropdown - tooltip: 'Copy Class'; - icon: BrGlamorousVectorIcons changes; - priority: 4; - content: [ :aButton | - ((GtCopyClassForm for: self) - onAccept: [ :aClass | - aButton phlow spawnTool: (GtClassCoderTool forClass: aClass). - aButton fireEvent: BrDropdownHideWish new ]) asElement - padding: (BlInsets all: 5) ] + anElement phlow coderNavigationModel + coderDo: [ :aCoder | + ((GtCoder forCoder: aCoder asNewCoderModelWithSameSubject) + openInPagerFrom: anElement) maximized ] ] From dc7e71fe85cd18197fc93299ca92a47deec92bf9 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 14 Dec 2022 12:45:44 -0300 Subject: [PATCH 0343/1268] add `GtPhlowElementContext >> #firstParentCoder` [feenkcom/gtoolkit#2945] --- src/GToolkit-Coder-UI/Behavior.extension.st | 2 +- .../GtPhlowElementContext.extension.st | 20 +++++++++++++++++-- src/GToolkit-Coder/Behavior.extension.st | 2 +- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/Behavior.extension.st b/src/GToolkit-Coder-UI/Behavior.extension.st index f92043f9d..7e3b554ab 100644 --- a/src/GToolkit-Coder-UI/Behavior.extension.st +++ b/src/GToolkit-Coder-UI/Behavior.extension.st @@ -21,7 +21,7 @@ Behavior >> gtHierarchyButtonFor: anAction [ priority: 3; content: [ :aButton | | aNavigationModel | - aNavigationModel := aButton phlow coderNavigationModel. + aNavigationModel := aButton phlow firstParentCoderNavigationModel. BlElement new size: 400 @ 400; addChild: ((GtCoderNavigationTabsStencil new diff --git a/src/GToolkit-Coder-UI/GtPhlowElementContext.extension.st b/src/GToolkit-Coder-UI/GtPhlowElementContext.extension.st index 309e8e591..f61574cb1 100644 --- a/src/GToolkit-Coder-UI/GtPhlowElementContext.extension.st +++ b/src/GToolkit-Coder-UI/GtPhlowElementContext.extension.st @@ -2,6 +2,22 @@ Extension { #name : #GtPhlowElementContext } { #category : #'*GToolkit-Coder-UI' } GtPhlowElementContext >> coder [ + "Use #firstParentCoder instead" + + + ^ self firstParentCoder +] + +{ #category : #'*GToolkit-Coder-UI' } +GtPhlowElementContext >> coderNavigationModel [ + "Use #firstParentCoderNavigationModel instead" + + + ^ self firstParentCoderNavigationModel +] + +{ #category : #'*GToolkit-Coder-UI' } +GtPhlowElementContext >> firstParentCoder [ | anElement | anElement := self firstParentWithView. @@ -16,10 +32,10 @@ GtPhlowElementContext >> coder [ ] { #category : #'*GToolkit-Coder-UI' } -GtPhlowElementContext >> coderNavigationModel [ +GtPhlowElementContext >> firstParentCoderNavigationModel [ | aCoder aNavigationModel | - aCoder := self coder. + aCoder := self firstParentCoder. aNavigationModel := aCoder navigationModel. self diff --git a/src/GToolkit-Coder/Behavior.extension.st b/src/GToolkit-Coder/Behavior.extension.st index 736fb4920..52d102655 100644 --- a/src/GToolkit-Coder/Behavior.extension.st +++ b/src/GToolkit-Coder/Behavior.extension.st @@ -4,7 +4,7 @@ Extension { #name : #Behavior } Behavior >> gtBrowseFromButton: anElement [ "Do we want to share the same coder model?" - anElement phlow coderNavigationModel + anElement phlow firstParentCoderNavigationModel coderDo: [ :aCoder | ((GtCoder forCoder: aCoder asNewCoderModelWithSameSubject) openInPagerFrom: anElement) maximized ] From 41c03729fd5b01a4cc47ac1bb51e3f3803eeb841 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Wed, 14 Dec 2022 18:31:41 +0100 Subject: [PATCH 0344/1268] fix dependencies --- ...tNotificationDebugSessionExamples.class.st | 93 ------------------- 1 file changed, 93 deletions(-) delete mode 100644 src/GToolkit-Coder-Examples/GtNotificationDebugSessionExamples.class.st diff --git a/src/GToolkit-Coder-Examples/GtNotificationDebugSessionExamples.class.st b/src/GToolkit-Coder-Examples/GtNotificationDebugSessionExamples.class.st deleted file mode 100644 index c0554ca49..000000000 --- a/src/GToolkit-Coder-Examples/GtNotificationDebugSessionExamples.class.st +++ /dev/null @@ -1,93 +0,0 @@ -Class { - #name : #GtNotificationDebugSessionExamples, - #superclass : #GtNotificationCommonExamples, - #instVars : [ - 'sessions' - ], - #category : #'GToolkit-Coder-Examples-Examples' -} - -{ #category : #'private - support' } -GtNotificationDebugSessionExamples >> addSession: aSession [ - self sessions add: aSession. -] - -{ #category : #'examples - debug session' } -GtNotificationDebugSessionExamples >> basicDebugSessionElement [ - - | anElement | - anElement := GtNotificationDebugSessionElement new. - self assert: anElement notification isNil. - ^ anElement -] - -{ #category : #'examples - debug session' } -GtNotificationDebugSessionExamples >> basicDebugSessionEvent [ - - | anEvent | - anEvent := GtNotificationDebugSession new. - self assert: anEvent debugSession isNil. - self assert: (anEvent asElement isKindOf: BlElement). - ^ anEvent -] - -{ #category : #'examples - debug session' } -GtNotificationDebugSessionExamples >> debugSession [ - - - | aContext aProcess aSession | - aContext := [ 1 + 1 ] asContext. - aProcess := Process - forContext: aContext - priority: Processor userInterruptPriority. - aSession := aProcess - newDebugSessionNamed: 'Example session' - startedAt: aContext. - self addSession: aSession. - ^ aSession -] - -{ #category : #'examples - debug session' } -GtNotificationDebugSessionExamples >> debugSessionElement [ - - | anElement anEvent | - anElement := self basicDebugSessionElement. - anEvent := self debugSessionNotification. - anElement notification: anEvent. - self assert: anElement notification equals: anEvent. - ^ anElement -] - -{ #category : #'examples - debug session' } -GtNotificationDebugSessionExamples >> debugSessionNotification [ - - | anEvent aSession | - anEvent := self basicDebugSessionEvent. - aSession := self sharedDebugSession. - anEvent debugSession: aSession. - self assert: anEvent debugSession equals: aSession. - self assert: (anEvent asElement isKindOf: BlElement). - ^ anEvent -] - -{ #category : #'private - support' } -GtNotificationDebugSessionExamples >> sessions [ - ^ sessions ifNil: [ sessions := OrderedCollection new ] -] - -{ #category : #'examples - debug session' } -GtNotificationDebugSessionExamples >> sharedDebugSession [ - - | aSharedSession aPharoSession | - aSharedSession := GtSharedDebugSession new. - aPharoSession := self debugSession. - aSharedSession session: aPharoSession. - self assert: aSharedSession session equals: aPharoSession. - ^ aSharedSession -] - -{ #category : #'private - support' } -GtNotificationDebugSessionExamples >> terminateSessions [ - self sessions do: [ :eachSession | - eachSession terminate ] -] From 8b6f66601b0777e1a83c1a61b411271c3c65e2b7 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Wed, 14 Dec 2022 18:45:06 +0100 Subject: [PATCH 0345/1268] fix dependencies --- src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st b/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st index 13af24533..e9b07e4c0 100644 --- a/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st +++ b/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st @@ -43,6 +43,9 @@ BaselineOfGToolkitCoder >> baseline: spec [ baseline: 'GToolkitAnnouncerUtility' with: [ spec repository: 'github://feenkcom/gtoolkit-utility:main/src' ]; + baseline: 'GToolkitNotifications' + with: [ + spec repository: 'github://feenkcom/gtoolkit-notifications:main/src' ]; baseline: 'GToolkitPager' with: [ spec repository: 'github://feenkcom/gtoolkit-pager:main/src' ]; @@ -67,7 +70,7 @@ BaselineOfGToolkitCoder >> baseline: spec [ 'GToolkitPager' 'GToolkitCompleter' 'GToolkit-SearchFilters' ) ]; package: 'GToolkit-Coder-UI' with: [ spec requires: #( 'GToolkit-Coder' 'GToolkit-VariableBindings' - 'GToolkitBasicUtility' 'GToolkitPager' ) ]; + 'GToolkitBasicUtility' 'GToolkitPager' 'GToolkitNotifications') ]; package: 'GToolkit-Coder-AddOns' with: [ spec requires: #( 'GToolkit-Coder' 'GToolkit-Coder-UI' ) ]; package: 'GToolkit-Coder-Extensions' with: [ From 155a0a6911a580018c5b33bae86ece7b0c998447 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Thu, 15 Dec 2022 13:12:23 +0100 Subject: [PATCH 0346/1268] Remove outdated descriptions from coder --- .../GtBaselineDescription.class.st | 47 ----- .../GtClassDescription.class.st | 178 ----------------- .../GtMagritteCreateForm.class.st | 71 ------- .../GtPackageDescription.class.st | 81 -------- .../GtParserDescription.class.st | 83 -------- .../GtTraitDescription.class.st | 181 ------------------ 6 files changed, 641 deletions(-) delete mode 100644 src/GToolkit-Coder-UI/GtBaselineDescription.class.st delete mode 100644 src/GToolkit-Coder-UI/GtClassDescription.class.st delete mode 100644 src/GToolkit-Coder-UI/GtMagritteCreateForm.class.st delete mode 100644 src/GToolkit-Coder-UI/GtPackageDescription.class.st delete mode 100644 src/GToolkit-Coder-UI/GtParserDescription.class.st delete mode 100644 src/GToolkit-Coder-UI/GtTraitDescription.class.st diff --git a/src/GToolkit-Coder-UI/GtBaselineDescription.class.st b/src/GToolkit-Coder-UI/GtBaselineDescription.class.st deleted file mode 100644 index c9fa69d9b..000000000 --- a/src/GToolkit-Coder-UI/GtBaselineDescription.class.st +++ /dev/null @@ -1,47 +0,0 @@ -Class { - #name : #GtBaselineDescription, - #superclass : #Object, - #instVars : [ - 'baseline' - ], - #category : #'GToolkit-Coder-UI-Forms - Models' -} - -{ #category : #'instance creation' } -GtBaselineDescription class >> forBaseline: aBaseline [ - ^ self new forBaseline: aBaseline -] - -{ #category : #accessing } -GtBaselineDescription >> baseline [ - - ^ baseline -] - -{ #category : #accessing } -GtBaselineDescription >> baseline: anObject [ - - baseline := anObject -] - -{ #category : #magritte } -GtBaselineDescription >> baselineDescription [ - - ^ MAStringDescription new - label: 'Baseline'; - priority: 1; - accessor: #baseline; - blocCompletion: [ GtStringsCompletionStrategy new - completions: (GtPrefixTree withAll: (Smalltalk allClasses collect: #name)) ]; - addCondition: [ :aValue | (Smalltalk classNamed: aValue trim) isNil ] - labelled: 'Baseline name is already taken'; - addCondition: [ :aValue | aValue first isUppercase ] - labelled: 'First character must be uppercase'; - addCondition: [ :aValue | aValue isAllAlphaNumerics ] - labelled: 'Class name must be alphanumeric' -] - -{ #category : #'instance creation' } -GtBaselineDescription >> forBaseline: aBaseline [ - self baseline: aBaseline name -] diff --git a/src/GToolkit-Coder-UI/GtClassDescription.class.st b/src/GToolkit-Coder-UI/GtClassDescription.class.st deleted file mode 100644 index 874814bb4..000000000 --- a/src/GToolkit-Coder-UI/GtClassDescription.class.st +++ /dev/null @@ -1,178 +0,0 @@ -Class { - #name : #GtClassDescription, - #superclass : #GtTraitDescription, - #instVars : [ - 'superclassName', - 'classVars', - 'pools' - ], - #category : #'GToolkit-Coder-UI-Forms - Models' -} - -{ #category : #accessing } -GtClassDescription >> classVars [ - - ^ classVars -] - -{ #category : #accessing } -GtClassDescription >> classVars: anObject [ - - classVars := anObject -] - -{ #category : #accessing } -GtClassDescription >> classVarsDescription [ - - ^ MAToManyRelationDescription new - label: 'Class vars'; - priority: 7; - accessor: #classVars; - blocListStencil: [ :aMemento :aDescription :aForm | - | aTagger | - aTagger := BrTagger new. - aTagger - margin: ((BlInsets left: 7) withBottom: 4); - hMatchParent; - vFitContent. - aForm hMatchParent. - aTagger - aptitude: (BrGlamorousTaggerEditableAptitude new - margin: (BlInsets right: 5); - tagLabel: [ :aTag | - BrEditableLabel new - text: (aDescription displayStringFor: aTag name); - aptitude: (BrGlamorousEditableLabelAptitude new - glamorousCodeFont; - defaultForeground: Color black; - fontSize: 10); - whenKey: BlKeyCombination primaryB - labelDo: [ :aShortcutEvent :aShortcut | aTagger phlow spawnObject: aTag name ] ]). - aTagger - when: BrTaggerAddTagRequest - do: [ :aRequest | - aMemento - write: ((aTagger tags collect: #name) - add: aRequest tag name; - yourself) - using: aDescription ]. - aTagger - when: BrTaggerRemoveTagRequest - do: [ :aRequest | - aMemento - write: ((aTagger tags collect: #name) - remove: aRequest tag name; - yourself) - using: aDescription ]. - aTagger - withAsyncSinkDo: [ :anElementSink | - anElementSink - sink: AsyncPeakSink new; - whenUpdate: [ :theTagger :aSink | - | theValues | - theValues := aSink value currentValue. - theTagger namedTags: theValues ]. - (aMemento readObservableValueUsing: aDescription) observe: anElementSink ] ] -] - -{ #category : #accessing } -GtClassDescription >> initialize [ - super initialize. - - self className: 'NameOfSubclass'. - self superclassName: 'Object'. - - classVars := OrderedCollection new. - pools := OrderedCollection new -] - -{ #category : #accessing } -GtClassDescription >> pools [ - - ^ pools -] - -{ #category : #accessing } -GtClassDescription >> pools: anObject [ - - pools := anObject -] - -{ #category : #accessing } -GtClassDescription >> poolsDescription [ - - ^ MAToManyRelationDescription new - label: 'Pools'; - priority: 7; - accessor: #pools; - blocListStencil: [ :aMemento :aDescription :aForm | - | aTagger | - aTagger := BrTagger new. - aTagger - margin: ((BlInsets left: 7) withBottom: 4); - hMatchParent; - vFitContent. - aForm hMatchParent. - aTagger - aptitude: (BrGlamorousTaggerEditableAptitude new - margin: (BlInsets right: 5); - tagLabel: [ :aTag | - BrEditableLabel new - text: (aDescription displayStringFor: aTag name); - aptitude: (BrGlamorousEditableLabelAptitude new - glamorousCodeFont; - defaultForeground: Color black; - fontSize: 10); - whenKey: BlKeyCombination primaryB - labelDo: [ :aShortcutEvent :aShortcut | aTagger phlow spawnObject: aTag name ] ]). - aTagger - when: BrTaggerAddTagRequest - do: [ :aRequest | - aMemento - write: ((aTagger tags collect: #name) - add: aRequest tag name; - yourself) - using: aDescription ]. - aTagger - when: BrTaggerRemoveTagRequest - do: [ :aRequest | - aMemento - write: ((aTagger tags collect: #name) - remove: aRequest tag name; - yourself) - using: aDescription ]. - aTagger - withAsyncSinkDo: [ :anElementSink | - anElementSink - sink: AsyncPeakSink new; - whenUpdate: [ :theTagger :aSink | - | theValues | - theValues := aSink value currentValue. - theTagger namedTags: theValues ]. - (aMemento readObservableValueUsing: aDescription) observe: anElementSink ] ] -] - -{ #category : #accessing } -GtClassDescription >> superclassDescription [ - - ^ MAStringDescription new - label: 'Superclass'; - priority: 2; - accessor: #superclassName; - blocCompletion: [ GtStringsCompletionStrategy new - completions: (GtPrefixTree withAll: (Smalltalk allClasses collect: #name)) ]; - addCondition: [ :aValue | (Smalltalk classNamed: aValue trim) isNotNil ] - labelled: 'Unknown class' -] - -{ #category : #accessing } -GtClassDescription >> superclassName [ - - ^ superclassName -] - -{ #category : #accessing } -GtClassDescription >> superclassName: anObject [ - - superclassName := anObject -] diff --git a/src/GToolkit-Coder-UI/GtMagritteCreateForm.class.st b/src/GToolkit-Coder-UI/GtMagritteCreateForm.class.st deleted file mode 100644 index 053cf3d1e..000000000 --- a/src/GToolkit-Coder-UI/GtMagritteCreateForm.class.st +++ /dev/null @@ -1,71 +0,0 @@ -Class { - #name : #GtMagritteCreateForm, - #superclass : #BrFrame, - #traits : 'TBrLayoutResizable', - #classTraits : 'TBrLayoutResizable classTrait', - #instVars : [ - 'description' - ], - #category : #'GToolkit-Coder-UI-Forms' -} - -{ #category : #'instance creation' } -GtMagritteCreateForm class >> forBaseline: aBaseline [ - ^ self forDescription: (GtBaselineDescription forBaseline: aBaseline) -] - -{ #category : #'instance creation' } -GtMagritteCreateForm class >> forClass [ - ^ self forDescription: GtClassDescription new -] - -{ #category : #'instance creation' } -GtMagritteCreateForm class >> forDescription: aDescription [ - ^ self new description: aDescription -] - -{ #category : #'instance creation' } -GtMagritteCreateForm class >> forPackage: aPackage [ - ^ self forDescription: (GtPackageDescription forPackage: aPackage) -] - -{ #category : #'instance creation' } -GtMagritteCreateForm class >> forParser [ - ^ self forDescription: GtParserDescription new -] - -{ #category : #'instance creation' } -GtMagritteCreateForm class >> forTrait [ - ^ self forDescription: GtTraitDescription new -] - -{ #category : #converting } -GtMagritteCreateForm >> createForm [ - ^ self description asGtMagritteViewModel asElement -] - -{ #category : #accessing } -GtMagritteCreateForm >> description [ - - ^ description -] - -{ #category : #accessing } -GtMagritteCreateForm >> description: anObject [ - description := anObject. - - self removeChildren. - self addChild: self createForm -] - -{ #category : #initialization } -GtMagritteCreateForm >> initialize [ - super initialize. - - self layout: BlFlowLayout vertical. - self margin: (BlInsets all: 5). - self - constraintsDo: [ :c | - c horizontal exact: 400. - c vertical fitContent ] -] diff --git a/src/GToolkit-Coder-UI/GtPackageDescription.class.st b/src/GToolkit-Coder-UI/GtPackageDescription.class.st deleted file mode 100644 index c899a26ed..000000000 --- a/src/GToolkit-Coder-UI/GtPackageDescription.class.st +++ /dev/null @@ -1,81 +0,0 @@ -Class { - #name : #GtPackageDescription, - #superclass : #Object, - #instVars : [ - 'package', - 'packageName', - 'tag' - ], - #category : #'GToolkit-Coder-UI-Forms - Models' -} - -{ #category : #'instance creation' } -GtPackageDescription class >> forPackage: aPackage [ - ^ self new package: aPackage -] - -{ #category : #initialization } -GtPackageDescription >> initialize [ - tag := '' -] - -{ #category : #accessing } -GtPackageDescription >> package [ - - ^ package -] - -{ #category : #accessing } -GtPackageDescription >> package: aPackage [ - package := aPackage. - packageName := aPackage name. -] - -{ #category : #magritte } -GtPackageDescription >> packageDescription [ - - ^ MAStringDescription new - label: 'Package'; - priority: 1; - accessor: #packageName; - blocCompletion: [ GtStringsCompletionStrategy new - completions: (GtPrefixTree withAll: RPackageOrganizer default packageNames) ]; - addCondition: [ :aValue | (RPackageOrganizer default packageNamed: aValue ifAbsent: [ nil ]) isNil ] - labelled: 'Package exists' -] - -{ #category : #accessing } -GtPackageDescription >> packageName [ - - ^ packageName -] - -{ #category : #accessing } -GtPackageDescription >> packageName: anObject [ - - packageName := anObject -] - -{ #category : #accessing } -GtPackageDescription >> tag [ - - ^ tag -] - -{ #category : #accessing } -GtPackageDescription >> tag: aTagName [ - tag := aTagName -] - -{ #category : #magritte } -GtPackageDescription >> tagDescription [ - - ^ MAStringDescription new - label: 'Tag'; - priority: 2; - accessor: #tag; - blocCompletion: [ GtStringsCompletionStrategy new - completions: (GtPrefixTree withAll: (packageName asPackage classTags collect: #name)) ]; - addCondition: [ :aValue | (package classTagNamed: aValue ifAbsent: [ nil ]) isNil ] - labelled: 'Tag exists' -] diff --git a/src/GToolkit-Coder-UI/GtParserDescription.class.st b/src/GToolkit-Coder-UI/GtParserDescription.class.st deleted file mode 100644 index 47cb28546..000000000 --- a/src/GToolkit-Coder-UI/GtParserDescription.class.st +++ /dev/null @@ -1,83 +0,0 @@ -Class { - #name : #GtParserDescription, - #superclass : #Object, - #instVars : [ - 'parser', - 'scanner' - ], - #category : #'GToolkit-Coder-UI-Forms - Models' -} - -{ #category : #accessing } -GtParserDescription >> defaultParser [ - ^ 'SomeParser' -] - -{ #category : #accessing } -GtParserDescription >> defaultScanner [ - ^ 'SomeScanner' -] - -{ #category : #initialization } -GtParserDescription >> initialize [ - parser := self defaultParser. - scanner := self defaultScanner -] - -{ #category : #accessing } -GtParserDescription >> parser [ - - ^ parser -] - -{ #category : #accessing } -GtParserDescription >> parser: anObject [ - - parser := anObject -] - -{ #category : #magritte } -GtParserDescription >> parserDescription [ - - ^ MAStringDescription new - label: 'Parser'; - priority: 1; - accessor: #parser; - blocCompletion: [ GtStringsCompletionStrategy new - completions: (GtPrefixTree withAll: (Smalltalk allClasses collect: #name)) ]; - addCondition: [ :aValue | (Smalltalk classNamed: aValue trim) isNil ] - labelled: 'Class name is already taken'; - addCondition: [ :aValue | aValue first isUppercase ] - labelled: 'First character must be uppercase'; - addCondition: [ :aValue | aValue isAllAlphaNumerics ] - labelled: 'Class name must be alphanumeric' -] - -{ #category : #accessing } -GtParserDescription >> scanner [ - - ^ scanner -] - -{ #category : #accessing } -GtParserDescription >> scanner: anObject [ - - scanner := anObject -] - -{ #category : #magritte } -GtParserDescription >> scannerDescription [ - - ^ MAStringDescription new - label: 'Scanner'; - priority: 2; - accessor: #scanner; - blocCompletion: [ GtStringsCompletionStrategy new - completions: (GtPrefixTree withAll: (Smalltalk allClasses collect: #name)) ]; - addCondition: [ :aValue | (Smalltalk classNamed: aValue trim) isNil ] - labelled: 'Class name is already taken'; - addCondition: [ :aValue | aValue first isUppercase ] - labelled: 'First character must be uppercase'; - addCondition: [ :aValue | aValue isAllAlphaNumerics ] - labelled: 'Class name must be alphanumeric' -] diff --git a/src/GToolkit-Coder-UI/GtTraitDescription.class.st b/src/GToolkit-Coder-UI/GtTraitDescription.class.st deleted file mode 100644 index aea5a96de..000000000 --- a/src/GToolkit-Coder-UI/GtTraitDescription.class.st +++ /dev/null @@ -1,181 +0,0 @@ -Class { - #name : #GtTraitDescription, - #superclass : #Object, - #instVars : [ - 'className', - 'traits', - 'slots' - ], - #category : #'GToolkit-Coder-UI-Forms - Models' -} - -{ #category : #accessing } -GtTraitDescription >> className [ - ^ className -] - -{ #category : #accessing } -GtTraitDescription >> className: anObject [ - className := anObject -] - -{ #category : #accessing } -GtTraitDescription >> defaultName [ - ^ 'TNameOfTrait' -] - -{ #category : #initialization } -GtTraitDescription >> initialize [ - className := self defaultName. - traits := OrderedCollection new. - slots := OrderedCollection new -] - -{ #category : #magritte } -GtTraitDescription >> nameDescription [ - - ^ MAStringDescription new - label: 'Name'; - priority: 1; - accessor: #className; - blocCompletion: [ GtStringsCompletionStrategy new - completions: (GtPrefixTree withAll: (Smalltalk allClasses collect: #name)) ]; - addCondition: [ :aValue | (Smalltalk classNamed: aValue trim) isNil ] - labelled: 'Name is already taken'; - addCondition: [ :aValue | aValue first isUppercase ] - labelled: 'First character must be uppercase'; - addCondition: [ :aValue | aValue isAllAlphaNumerics ] - labelled: 'Class name must be alphanumeric' -] - -{ #category : #accessing } -GtTraitDescription >> slots [ - - ^ slots -] - -{ #category : #accessing } -GtTraitDescription >> slots: anObject [ - - slots := anObject -] - -{ #category : #accessing } -GtTraitDescription >> slotsDescription [ - - ^ MAToManyRelationDescription new - label: 'Slots'; - priority: 5; - accessor: #slots; - blocListStencil: [ :aMemento :aDescription :aForm | - | aTagger | - aTagger := BrTagger new. - aTagger - margin: ((BlInsets left: 7) withBottom: 4); - hMatchParent; - vFitContent. - aForm hMatchParent. - aTagger - aptitude: (BrGlamorousTaggerEditableAptitude new - margin: (BlInsets right: 5); - tagLabel: [ :aTag | - BrEditableLabel new - text: (aDescription displayStringFor: aTag name); - aptitude: (BrGlamorousEditableLabelAptitude new - glamorousCodeFont; - defaultForeground: Color black; - fontSize: 10); - whenKey: BlKeyCombination primaryB - labelDo: [ :aShortcutEvent :aShortcut | aTagger phlow spawnObject: aTag name ] ]). - aTagger - when: BrTaggerAddTagRequest - do: [ :aRequest | - aMemento - write: ((aTagger tags collect: #name) - add: aRequest tag name; - yourself) - using: aDescription ]. - aTagger - when: BrTaggerRemoveTagRequest - do: [ :aRequest | - aMemento - write: ((aTagger tags collect: #name) - remove: aRequest tag name; - yourself) - using: aDescription ]. - aTagger - withAsyncSinkDo: [ :anElementSink | - anElementSink - sink: AsyncPeakSink new; - whenUpdate: [ :theTagger :aSink | - | theValues | - theValues := aSink value currentValue. - theTagger namedTags: theValues ]. - (aMemento readObservableValueUsing: aDescription) observe: anElementSink ] ] -] - -{ #category : #accessing } -GtTraitDescription >> traits [ - - ^ traits -] - -{ #category : #accessing } -GtTraitDescription >> traits: anObject [ - - traits := anObject -] - -{ #category : #accessing } -GtTraitDescription >> traitsDescription [ - - ^ MAToManyRelationDescription new - label: 'Traits'; - priority: 5; - accessor: #traits; - blocListStencil: [ :aMemento :aDescription :aForm | - | aTagger | - aTagger := BrTagger new. - aTagger - margin: ((BlInsets left: 7) withBottom: 4); - hMatchParent; - vFitContent. - aForm hMatchParent. - aTagger - aptitude: (BrGlamorousTaggerEditableAptitude new - margin: (BlInsets right: 5); - tagLabel: [ :aTag | - BrEditableLabel new - text: (aDescription displayStringFor: aTag name); - aptitude: (BrGlamorousEditableLabelAptitude new - glamorousCodeFont; - defaultForeground: Color black; - fontSize: 10); - whenKey: BlKeyCombination primaryB - labelDo: [ :aShortcutEvent :aShortcut | aTagger phlow spawnObject: aTag name ] ]). - aTagger - when: BrTaggerAddTagRequest - do: [ :aRequest | - aMemento - write: ((aTagger tags collect: #name) - add: aRequest tag name; - yourself) - using: aDescription ]. - aTagger - when: BrTaggerRemoveTagRequest - do: [ :aRequest | - aMemento - write: ((aTagger tags collect: #name) - remove: aRequest tag name; - yourself) - using: aDescription ]. - aTagger - withAsyncSinkDo: [ :anElementSink | - anElementSink - sink: AsyncPeakSink new; - whenUpdate: [ :theTagger :aSink | - | theValues | - theValues := aSink value currentValue. - theTagger namedTags: theValues ]. - (aMemento readObservableValueUsing: aDescription) observe: anElementSink ] ] -] From 60a2e0abdfb0880c4ede7d24ce413196cb790346 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Thu, 15 Dec 2022 14:21:22 +0100 Subject: [PATCH 0347/1268] Move coder creation component tabs over to gt4pharo --- .../GtCoderNavigationTabsStencil.class.st | 54 ------------------- 1 file changed, 54 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index f2cffa76d..ea2e75b17 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -48,24 +48,6 @@ GtCoderNavigationTabsStencil >> defaultNavigations [ collect ] -{ #category : #accessing } -GtCoderNavigationTabsStencil >> gtAddClassTab: look [ - - ^ BrTab new - aptitude: BrGlamorousTabAptitude new; - label: 'Class'; - stencil: [ | element | - element := GtPharoCreateBehaviorElement new. - element - behaviorBlock: [ :cls | - look fireEvent: BrDropdownHideWish new. - navigationModel selectClass: cls ]. - element forClassDefinition. - navigationModel selectedPackageDo: [ :package | element forPackage: package ]. - navigationModel selectedTagDo: [ :tag | element forPackageTag: tag ]. - element ] -] - { #category : #accessing } GtCoderNavigationTabsStencil >> gtAddInterface: look [ | contentTabs tabMethods | @@ -83,42 +65,6 @@ GtCoderNavigationTabsStencil >> gtAddInterface: look [ ^ contentTabs ] -{ #category : #accessing } -GtCoderNavigationTabsStencil >> gtAddPackageTab: look [ - - ^ BrTab new - aptitude: BrGlamorousTabAptitude new; - label: 'Package'; - stencil: [ | element | - element := GtPharoCreatePackageElement new. - element - packageBlock: [ :pkg :tag | - look fireEvent: BrDropdownHideWish new. - tag isNil - ifTrue: [ navigationModel selectPackage: pkg ] - ifFalse: [ navigationModel selectPackageTag: tag ] ]. - navigationModel selectedPackageDo: [ :package | element forPackage: package ]. - element ] -] - -{ #category : #accessing } -GtCoderNavigationTabsStencil >> gtAddTraitTab: look [ - - ^ BrTab new - aptitude: BrGlamorousTabAptitude new; - label: 'Trait'; - stencil: [ | element | - element := GtPharoCreateBehaviorElement new. - element - behaviorBlock: [ :cls | - look fireEvent: BrDropdownHideWish new. - navigationModel selectClass: cls ]. - element forTraitDefinition. - navigationModel selectedPackageDo: [ :package | element forPackage: package ]. - navigationModel selectedTagDo: [ :tag | element forPackageTag: tag ]. - element ] -] - { #category : #'gt-extensions' } GtCoderNavigationTabsStencil >> gtClassHierarchyFor: aView [ From f3727f03ffd3b18a1e27a6b47681823813c9a231 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 16 Dec 2022 06:29:39 -0600 Subject: [PATCH 0348/1268] Add variable preview to Pharo snippets [feenkcom/gtoolkit#2281] --- .../GtCoderActionsElement.class.st | 12 ++++++ .../GtCoderToggleAction.extension.st | 14 +++++++ .../GtCoderToggleAction.class.st | 37 +++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 src/GToolkit-Coder-UI/GtCoderToggleAction.extension.st create mode 100644 src/GToolkit-Coder/GtCoderToggleAction.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st index 96d945064..d27627230 100644 --- a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st @@ -178,6 +178,18 @@ GtCoderActionsElement >> newDropButtonForAction: aGtCoderAction [ yourself ] +{ #category : #'instance creation' } +GtCoderActionsElement >> newToggleForAction: aGtCoderAction toggleModel: toggleModel [ + + ^ BrToggle new + "toggleModel: toggleModel;" + aptitude: BrGlamorousButtonWithIconAptitude + BrGlamorousToggleBackgroundAptitude; + icon: aGtCoderAction icon asElement; + beTinySize; + label: aGtCoderAction title; + in: [ :aButtonElement | aButtonElement id: aGtCoderAction id ] +] + { #category : #'instance creation' } GtCoderActionsElement >> newToolbar [ diff --git a/src/GToolkit-Coder-UI/GtCoderToggleAction.extension.st b/src/GToolkit-Coder-UI/GtCoderToggleAction.extension.st new file mode 100644 index 000000000..eba14191b --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderToggleAction.extension.st @@ -0,0 +1,14 @@ +Extension { #name : #GtCoderToggleAction } + +{ #category : #'*GToolkit-Coder-UI' } +GtCoderToggleAction >> buildElementIn: aCoderActionsElement [ + | button | + button := aCoderActionsElement + newToggleForAction: self + toggleModel: toggleModel. + + button + when: BrToggleActivatedEvent do: activateBlock; + when: BrToggleDeactivatedEvent do: deactivateBlock. + ^ button +] diff --git a/src/GToolkit-Coder/GtCoderToggleAction.class.st b/src/GToolkit-Coder/GtCoderToggleAction.class.st new file mode 100644 index 000000000..a94298102 --- /dev/null +++ b/src/GToolkit-Coder/GtCoderToggleAction.class.st @@ -0,0 +1,37 @@ +Class { + #name : #GtCoderToggleAction, + #superclass : #GtCoderAction, + #instVars : [ + 'activateBlock', + 'deactivateBlock', + 'toggleModel' + ], + #category : #'GToolkit-Coder-Coders - Addons' +} + +{ #category : #accessing } +GtCoderToggleAction >> activateBlock: aBlock [ + activateBlock := aBlock +] + +{ #category : #accessing } +GtCoderToggleAction >> deactivateBlock: aBlock [ + deactivateBlock := aBlock +] + +{ #category : #accessing } +GtCoderToggleAction >> initialize [ + super initialize. + activateBlock := deactivateBlock := [ :evt | ] +] + +{ #category : #accessing } +GtCoderToggleAction >> toggleModel [ + + ^ toggleModel +] + +{ #category : #accessing } +GtCoderToggleAction >> toggleModel: aToggleModel [ + toggleModel := aToggleModel +] From 754fd0670f06f7c55f51160d3a8cea5bfdea864d Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 16 Dec 2022 08:41:58 -0600 Subject: [PATCH 0349/1268] Fix failing example [feenkcom/gtoolkit#2281] --- src/GToolkit-Coder-UI/GtCoderActionsElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st index d27627230..87c56c423 100644 --- a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st @@ -180,7 +180,7 @@ GtCoderActionsElement >> newDropButtonForAction: aGtCoderAction [ { #category : #'instance creation' } GtCoderActionsElement >> newToggleForAction: aGtCoderAction toggleModel: toggleModel [ - + ^ BrToggle new "toggleModel: toggleModel;" aptitude: BrGlamorousButtonWithIconAptitude + BrGlamorousToggleBackgroundAptitude; From 4100341f6056ec3863f352ea0c55189a006e7ce4 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 16 Dec 2022 09:56:47 -0600 Subject: [PATCH 0350/1268] Toggle preview on all snippets on a page [feenkcom/gtoolkit#2281] --- .../GtCoderActionsElement.class.st | 3 +-- .../GtCoderToggleAction.extension.st | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st index 87c56c423..2f47e7f24 100644 --- a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st @@ -179,10 +179,9 @@ GtCoderActionsElement >> newDropButtonForAction: aGtCoderAction [ ] { #category : #'instance creation' } -GtCoderActionsElement >> newToggleForAction: aGtCoderAction toggleModel: toggleModel [ +GtCoderActionsElement >> newToggleForAction: aGtCoderAction [ ^ BrToggle new - "toggleModel: toggleModel;" aptitude: BrGlamorousButtonWithIconAptitude + BrGlamorousToggleBackgroundAptitude; icon: aGtCoderAction icon asElement; beTinySize; diff --git a/src/GToolkit-Coder-UI/GtCoderToggleAction.extension.st b/src/GToolkit-Coder-UI/GtCoderToggleAction.extension.st index eba14191b..39624b6b4 100644 --- a/src/GToolkit-Coder-UI/GtCoderToggleAction.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderToggleAction.extension.st @@ -3,12 +3,20 @@ Extension { #name : #GtCoderToggleAction } { #category : #'*GToolkit-Coder-UI' } GtCoderToggleAction >> buildElementIn: aCoderActionsElement [ | button | - button := aCoderActionsElement - newToggleForAction: self - toggleModel: toggleModel. + button := aCoderActionsElement newToggleForAction: self. + toggleModel + when: BrToggleActivatedEvent do: [ :evt | button activate ]; + when: BrToggleDeactivatedEvent do: [ :evt | button deactivate ]. button - when: BrToggleActivatedEvent do: activateBlock; - when: BrToggleDeactivatedEvent do: deactivateBlock. + activated: toggleModel isActivated; + when: BrToggleActivatedEvent + do: [ :evt | + toggleModel activate. + activateBlock value: evt ]; + when: BrToggleDeactivatedEvent + do: [ :evt | + toggleModel deactivate. + deactivateBlock value: evt ]. ^ button ] From 8b8e8bb7d90cb1cb5aa75e1ddfcc98fe3760eeae Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Tue, 20 Dec 2022 16:14:46 +0100 Subject: [PATCH 0351/1268] [feenkcom/gtoolkit#2963] classes and packages views should request focus for the list / tree --- src/GToolkit-Coder-UI/GtClassesElement.class.st | 4 ++-- src/GToolkit-Coder-UI/GtPackagesCoderElement.class.st | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtClassesElement.class.st b/src/GToolkit-Coder-UI/GtClassesElement.class.st index ddf1ba370..7f73294d6 100644 --- a/src/GToolkit-Coder-UI/GtClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtClassesElement.class.st @@ -4,7 +4,7 @@ Class { #instVars : [ 'coder' ], - #category : 'GToolkit-Coder-UI-Basic' + #category : #'GToolkit-Coder-UI-Basic' } { #category : #'building ui' } @@ -16,7 +16,7 @@ GtClassesElement >> buildContainer [ itemStencil: [ GtClassCardElement new ]; itemDataBinder: [ :eachClassCard :eachClassCoder | eachClassCard coder: eachClassCoder ]; items: (coder coders asSortedCollection: [ :a :b | a theClass name < b theClass name ]); - addEventFilterOn: BlClickEvent do: [ :anEvent | self requestFocus ]. + addEventFilterOn: BlClickEvent do: [ :anEvent | anEvent currentTarget requestFocus ]. self addChild: aClassList ] diff --git a/src/GToolkit-Coder-UI/GtPackagesCoderElement.class.st b/src/GToolkit-Coder-UI/GtPackagesCoderElement.class.st index e47a0933b..db14af3cb 100644 --- a/src/GToolkit-Coder-UI/GtPackagesCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtPackagesCoderElement.class.st @@ -40,7 +40,7 @@ GtPackagesCoderElement >> buildPackageList [ items: (packagesCoder coders asSortedCollection: [ :a :b | a packageName < b packageName ]); - addEventFilterOn: BlClickEvent do: [ :anEvent | self requestFocus ] + addEventFilterOn: BlClickEvent do: [ :anEvent | anEvent currentTarget requestFocus ] ] { #category : #'private - ui' } From cfbabe9be7041691d6a1bb59e24cdb5ecf720075 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Wed, 21 Dec 2022 13:55:49 +0100 Subject: [PATCH 0352/1268] Wrap the ghost text in a frame --- src/GToolkit-Coder-UI/BrGhostTextAttribute.class.st | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/BrGhostTextAttribute.class.st b/src/GToolkit-Coder-UI/BrGhostTextAttribute.class.st index c1447b506..ea53a9a07 100644 --- a/src/GToolkit-Coder-UI/BrGhostTextAttribute.class.st +++ b/src/GToolkit-Coder-UI/BrGhostTextAttribute.class.st @@ -20,9 +20,10 @@ BrGhostTextAttribute class >> for: aText [ { #category : #accessing } BrGhostTextAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ | element | - element := BlTextElement new - text: text; - yourself. + element := BrFrame new fitContent preventMeAndChildrenMouseEvents + addChild: (BlTextElement new + text: text; + yourself). self updateVisibilityOf: element in: anEditorElement. element From 2c0e17d1af84f50154e9a7ba28c1965e07884bdd Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Wed, 21 Dec 2022 14:09:03 +0100 Subject: [PATCH 0353/1268] Move Ghost text attribute --- .../BrGhostTextAttribute.class.st | 45 ------------------- 1 file changed, 45 deletions(-) delete mode 100644 src/GToolkit-Coder-UI/BrGhostTextAttribute.class.st diff --git a/src/GToolkit-Coder-UI/BrGhostTextAttribute.class.st b/src/GToolkit-Coder-UI/BrGhostTextAttribute.class.st deleted file mode 100644 index ea53a9a07..000000000 --- a/src/GToolkit-Coder-UI/BrGhostTextAttribute.class.st +++ /dev/null @@ -1,45 +0,0 @@ -Class { - #name : #BrGhostTextAttribute, - #superclass : #BrTextAdornmentAttribute, - #instVars : [ - 'text' - ], - #category : #'GToolkit-Coder-UI-Coder - Source Attributes' -} - -{ #category : #accessing } -BrGhostTextAttribute class >> for: aText [ - ^ self new - for: aText; - beAppend; - beNotOverwritableByStyler; - withoutCache; - yourself -] - -{ #category : #accessing } -BrGhostTextAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ - | element | - element := BrFrame new fitContent preventMeAndChildrenMouseEvents - addChild: (BlTextElement new - text: text; - yourself). - - self updateVisibilityOf: element in: anEditorElement. - element - when: BrTextEditorTextChangedRequest - do: [ :anEvent | self updateVisibilityOf: element in: anEditorElement ]. - ^ element -] - -{ #category : #accessing } -BrGhostTextAttribute >> for: aText [ - text := aText -] - -{ #category : #accessing } -BrGhostTextAttribute >> updateVisibilityOf: element in: anEditorElement [ - ^ anEditorElement text isEmpty - ifTrue: [ element visibility: BlVisibility visible ] - ifFalse: [ element visibility: BlVisibility gone ] -] From e1ba4e67da9c1e4c787dd127ace0fe4028d000b8 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Wed, 21 Dec 2022 16:37:39 +0100 Subject: [PATCH 0354/1268] [feenkcom/gtoolkit#2963] filter tag element should be focusable --- src/GToolkit-Coder-UI/GtFilterTagElement.class.st | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st index aca17f82d..02b28df9e 100644 --- a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st @@ -209,7 +209,8 @@ GtFilterTagElement >> initialize [ self fitContent; alignCenterLeft; - beInSingleCompositionLayer. + beInSingleCompositionLayer; + beFocusable. self addAptitude: (BrStyleCommonAptitude new From 0b9fab655c152a7f1623912d155e28731cf9a2bf Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 4 Jan 2023 07:45:25 -0600 Subject: [PATCH 0355/1268] Select cascades with shift+primary+up/down --- .../GtSourceCoderSelectStatementDownShortcut.class.st | 2 +- .../GtSourceCoderSelectStatementUpShortcut.class.st | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderSelectStatementDownShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderSelectStatementDownShortcut.class.st index 112112b41..c8b84d11c 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderSelectStatementDownShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderSelectStatementDownShortcut.class.st @@ -31,6 +31,6 @@ GtSourceCoderSelectStatementDownShortcut >> performOnEditor: aBrTextEditor eleme downIn: aSourceCoderViewModel ] orCursorStringPositionDo: [ :aCursorTextPosition | aSourceCoderViewModel coder - selectStatementAt: aCursorTextPosition + selectStatementOrCascadeAt: aCursorTextPosition in: aSourceCoderViewModel ] ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderSelectStatementUpShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderSelectStatementUpShortcut.class.st index cc520565a..07a9bbe27 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderSelectStatementUpShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderSelectStatementUpShortcut.class.st @@ -31,6 +31,6 @@ GtSourceCoderSelectStatementUpShortcut >> performOnEditor: aBrTextEditor element upIn: aSourceCoderViewModel ] orCursorStringPositionDo: [ :aCursorTextPosition | aSourceCoderViewModel coder - selectStatementAt: aCursorTextPosition + selectStatementOrCascadeAt: aCursorTextPosition in: aSourceCoderViewModel ] ] From f2bed926da84c29cf9accb751c8fbe8871130eb7 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 6 Jan 2023 12:35:36 -0600 Subject: [PATCH 0356/1268] Add ability to move cascaded message up and down [feenkcom/gtoolkit#2979] --- .../GtSourceCoderMoveStatementDownShortcut.class.st | 4 ++-- .../GtSourceCoderMoveStatementUpShortcut.class.st | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementDownShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementDownShortcut.class.st index a78f5405a..9ef73ab35 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementDownShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementDownShortcut.class.st @@ -27,10 +27,10 @@ GtSourceCoderMoveStatementDownShortcut >> performOnEditor: aBrTextEditor element forEditor: aBrTextEditor selectionIntervalDo: [ :aSelectionInterval | aSourceCoderViewModel coder - moveStatementsDownWithin: aSelectionInterval + moveStatementsOrCascadesDownWithin: aSelectionInterval in: aSourceCoderViewModel ] orCursorStringPositionDo: [ :aCursorTextPosition | aSourceCoderViewModel coder - moveStatementDownAt: aCursorTextPosition + moveStatementOrCascadeDownAt: aCursorTextPosition in: aSourceCoderViewModel ] ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementUpShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementUpShortcut.class.st index ab7e0f718..fadca38c7 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementUpShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementUpShortcut.class.st @@ -27,10 +27,10 @@ GtSourceCoderMoveStatementUpShortcut >> performOnEditor: aBrTextEditor element: forEditor: aBrTextEditor selectionIntervalDo: [ :aSelectionInterval | aSourceCoderViewModel coder - moveStatementsUpWithin: aSelectionInterval + moveStatementsOrCascadesUpWithin: aSelectionInterval in: aSourceCoderViewModel ] orCursorStringPositionDo: [ :aCursorTextPosition | aSourceCoderViewModel coder - moveStatementUpAt: aCursorTextPosition + moveStatementOrCascadeUpAt: aCursorTextPosition in: aSourceCoderViewModel ] ] From 41891a4d5b3552172bcdd323e41159d28d1215db Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Sun, 8 Jan 2023 15:37:38 +0100 Subject: [PATCH 0357/1268] refine printing of key combinations feenkcom/gtoolkit#2607 --- src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st index d1827661d..a0efb61db 100644 --- a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st +++ b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st @@ -10,7 +10,7 @@ GtTextualCoder >> addContextMenuItemFrom: shortcut withId: menuId to: coderAddOn element: anEditorElement dueTo: nil ] id: menuId - shortcutKey: shortcut combinationForPlatform userPrintString + shortcutKey: shortcut combinationForPlatform gtDisplayString ] { #category : #'*GToolkit-Coder-AddOns' } From b014e9e442999d0b1c9605ee11fe2c4974db30d5 Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Sun, 8 Jan 2023 19:58:41 +0100 Subject: [PATCH 0358/1268] order the menu items ascending (the numbers represent the order priority like for views) feenkcom/gtoolkit#2983 --- src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st | 2 +- src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st index a0efb61db..907608ddf 100644 --- a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st +++ b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st @@ -15,7 +15,7 @@ GtTextualCoder >> addContextMenuItemFrom: shortcut withId: menuId to: coderAddOn { #category : #'*GToolkit-Coder-AddOns' } GtTextualCoder >> addCopyCutPasteContextMenuAddOnsAst: anAst to: coderAddOns [ - + self addContextMenuItemFrom: BrEditorShortcut cut withId: GtTextualCoderCutContextMenuItemId diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 3893dfbd7..1efb31552 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -250,7 +250,7 @@ GtTextualCoderViewModel >> computeContextMenuAstAddOns [ newAddOns := aCoderModel newAddOns. theAst ifNotNil: [ - pragmas reverseDo: [ :eachPragma | + pragmas do: [ :eachPragma | [ aCoderModel perform: eachPragma methodSelector withEnoughArguments: { theAst . newAddOns . self } ] From a0e3f2896e8911506c23b40f59950a6d41fda433 Mon Sep 17 00:00:00 2001 From: John Brant Date: Thu, 12 Jan 2023 09:18:30 -0600 Subject: [PATCH 0359/1268] [feenkcom/gtoolkit#2651] class creation shouldn't use Uncategorized package tag --- src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st b/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st index fd1d11d72..6a31f00b4 100644 --- a/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st +++ b/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st @@ -28,6 +28,11 @@ GtCoderPackageUncategorizedTag >> gtTagName [ ^ packageTag name ] +{ #category : #testing } +GtCoderPackageUncategorizedTag >> isRoot [ + ^ true +] + { #category : #accessing } GtCoderPackageUncategorizedTag >> name [ ^ 'Uncategorized' From 4259632408cdddfbbab71b979a7eeff954a0c2e2 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Mon, 16 Jan 2023 15:20:44 -0600 Subject: [PATCH 0360/1268] Cleanup refactorings --- .../GtCoderNavigationElement.class.st | 6 +-- ...igationPackagesTagsClassesElement.class.st | 38 +++++++++++-------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st index aa1b9edfd..0fc2a4b53 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st @@ -120,11 +120,7 @@ GtCoderNavigationElement >> onClassRenamed: anAnnouncement [ { #category : #'event handling' } GtCoderNavigationElement >> onClassSelected: anAnnouncement [ - self - suppressListChangeEventsDuring: [ self - selectClass: anAnnouncement theClass - inPackage: anAnnouncement package - tag: anAnnouncement tag ] + self subclassResponsibility ] { #category : #'event handling' } diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index bbc5e78f4..dc91b29f9 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -185,6 +185,17 @@ GtCoderNavigationPackagesTagsClassesElement >> hasPackageTagsIn: aRPackage [ ^ noTags not or: [ noExtensions not ] ] +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> headerLabel [ + | label | + label := BrLabel new. + label + aptitude: (BrGlamorousLabelAptitude new + fontSize: 12; + foreground: Color gray). + ^ label +] + { #category : #'showing / hiding' } GtCoderNavigationPackagesTagsClassesElement >> hideClassList [ classesLabel visibility: BlVisibility hidden. @@ -214,20 +225,12 @@ GtCoderNavigationPackagesTagsClassesElement >> initializeElement [ pane1 := BrVerticalPane new addAptitude: BrGlamorousWithHorizontalResizerAptitude; matchParent; - addChildren: {BrLabel new - aptitude: (BrGlamorousLabelAptitude new - fontSize: 12; - foreground: Color gray); - text: 'Packages'. + addChildren: {self headerLabel text: 'Packages'. packagesList}. pane2 := BrVerticalPane new addAptitude: BrGlamorousWithHorizontalResizerAptitude; matchParent; - addChildren: {classesLabel := BrLabel new - aptitude: (BrGlamorousLabelAptitude new - fontSize: 12; - foreground: Color gray); - text: 'Classes'. + addChildren: {classesLabel := self headerLabel text: 'Classes'. classesList}. pane3 := BrVerticalPane new addAptitude: BrGlamorousWithHorizontalResizerAptitude; @@ -236,11 +239,7 @@ GtCoderNavigationPackagesTagsClassesElement >> initializeElement [ pane4 := BrVerticalPane new matchParent; - addChildren: {methodsLabel := BrLabel new - aptitude: (BrGlamorousLabelAptitude new - fontSize: 12; - foreground: Color gray); - text: 'Methods'. + addChildren: {methodsLabel := self headerLabel text: 'Methods'. methodGroupList}. self addChildren: {pane1. @@ -269,6 +268,15 @@ GtCoderNavigationPackagesTagsClassesElement >> methodProtocolsList [ ^methodProtocolsList ] +{ #category : #accessing } +GtCoderNavigationPackagesTagsClassesElement >> onClassSelected: anAnnouncement [ + self + suppressListChangeEventsDuring: [ self + selectClass: anAnnouncement theClass + inPackage: anAnnouncement package + tag: anAnnouncement tag ] +] + { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onMethodChanged: anAnnouncement [ self updateProtocolList From f5b1da4a073755629d642cabbd279ff9114b3b11 Mon Sep 17 00:00:00 2001 From: Oscar Nierstrasz Date: Thu, 19 Jan 2023 17:46:01 +0100 Subject: [PATCH 0361/1268] Juraj's solution to open a GtCoder with a predfined filter on a selected protocol --- src/GToolkit-Coder-UI/GtCoder.class.st | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtCoder.class.st b/src/GToolkit-Coder-UI/GtCoder.class.st index c6fa28119..0f2510e27 100644 --- a/src/GToolkit-Coder-UI/GtCoder.class.st +++ b/src/GToolkit-Coder-UI/GtCoder.class.st @@ -111,6 +111,17 @@ GtCoder >> repository [ ^ nil ] +{ #category : #filtering } +GtCoder >> selectMethodProtocolNamed: aMethodProtocolName [ + "(GtCoder forClass: GtPhlowProtoView) selectMethodProtocolNamed: #decorating" + | classProtocols | + classProtocols := navigationModel selectedClass organization protocols. + classProtocols + detect: [ :aProtocol | aProtocol name = aMethodProtocolName ] + ifFound: [ :aProtocol | self navigationModel selectMethodProtocol: aProtocol source: self ] + ifNone: [ "ignore" ] +] + { #category : #'private - accessing' } GtCoder >> shortTitle [ ^ (GtPhlowTitleLabelBuilder From 4cdb9e2c6efd83393dad1112aac88195bfd851f4 Mon Sep 17 00:00:00 2001 From: Andrei Chis Date: Thu, 19 Jan 2023 18:06:19 +0100 Subject: [PATCH 0362/1268] Extend GtCoderSourceCodeChanged with the previous text [feenkcom/gtoolkit#2503] --- .../GtCoderSourceCodeChanged.class.st | 17 +++++++++++--- src/GToolkit-Coder/GtTextualCoder.class.st | 22 +++++++++++++++---- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/GToolkit-Coder/GtCoderSourceCodeChanged.class.st b/src/GToolkit-Coder/GtCoderSourceCodeChanged.class.st index 66bd4f5d6..37e8d5b25 100644 --- a/src/GToolkit-Coder/GtCoderSourceCodeChanged.class.st +++ b/src/GToolkit-Coder/GtCoderSourceCodeChanged.class.st @@ -8,7 +8,8 @@ Class { #superclass : #GtSourceCoderAnnouncement, #instVars : [ 'updateStragegy', - 'newText' + 'newText', + 'previousText' ], #category : #'GToolkit-Coder-Event' } @@ -26,9 +27,19 @@ GtCoderSourceCodeChanged >> newText [ ] { #category : #accessing } -GtCoderSourceCodeChanged >> newText: anObject [ +GtCoderSourceCodeChanged >> newText: aText [ - newText := anObject + newText := aText +] + +{ #category : #accessing } +GtCoderSourceCodeChanged >> previousText [ + ^ previousText +] + +{ #category : #accessing } +GtCoderSourceCodeChanged >> previousText: aText [ + previousText := aText ] { #category : #accessing } diff --git a/src/GToolkit-Coder/GtTextualCoder.class.st b/src/GToolkit-Coder/GtTextualCoder.class.st index de862d760..2cd3dfd7e 100644 --- a/src/GToolkit-Coder/GtTextualCoder.class.st +++ b/src/GToolkit-Coder/GtTextualCoder.class.st @@ -147,8 +147,13 @@ GtTextualCoder >> currentSourceText: aText with: aGtCoderUpdateStragegy [ "Set a new source text" self critical: [ + | previousSourceText| + previousSourceText := self sourceCode currentSourceText. self sourceCode currentSourceText: aText. - self sourceChangedTo: aText with: aGtCoderUpdateStragegy ] + self + sourceChangedTo: aText + from: previousSourceText + with: aGtCoderUpdateStragegy ] ] { #category : #'api - text' } @@ -208,12 +213,13 @@ GtTextualCoder >> notifyCorrectionFrom: aFromIndex to: aToIndex with: aString [ ] { #category : #'private - notifying' } -GtTextualCoder >> notifySourceChangedTo: aNewText with: anUpdateStragegy [ +GtTextualCoder >> notifySourceChangedTo: aNewText from: aPreviousText with: anUpdateStragegy [ "Notify the text editor that it should update the text (for example due to refactoring changes)" self announce: (GtCoderSourceCodeChanged new updateStrategy: anUpdateStragegy; newText: aNewText; + previousText: aPreviousText; coder: self) ] @@ -262,9 +268,17 @@ GtTextualCoder >> sourceChangedTo: aNewText [ ] { #category : #'event handling' } -GtTextualCoder >> sourceChangedTo: aNewText with: anUpdateStrategy [ +GtTextualCoder >> sourceChangedTo: aNewText from: aPreviousText with: anUpdateStrategy [ astPromise := nil. - self notifySourceChangedTo: aNewText with: anUpdateStrategy + self + notifySourceChangedTo: aNewText + from: aPreviousText + with: anUpdateStrategy +] + +{ #category : #'event handling' } +GtTextualCoder >> sourceChangedTo: aNewText with: anUpdateStrategy [ + self sourceChangedTo: aNewText from: nil with: anUpdateStrategy ] { #category : #'api - accessing' } From 8fe307e22d2dd0c2550b4b730d0f52d92af27e7e Mon Sep 17 00:00:00 2001 From: Andrei Chis Date: Thu, 19 Jan 2023 21:58:18 +0100 Subject: [PATCH 0363/1268] Fix issue when sending the previous text to GtCoderSourceCodeChanged [feenkcom/gtoolkit#2503] --- src/GToolkit-Coder/GtTextualCoder.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder/GtTextualCoder.class.st b/src/GToolkit-Coder/GtTextualCoder.class.st index 2cd3dfd7e..3c8bb0b01 100644 --- a/src/GToolkit-Coder/GtTextualCoder.class.st +++ b/src/GToolkit-Coder/GtTextualCoder.class.st @@ -148,7 +148,7 @@ GtTextualCoder >> currentSourceText: aText with: aGtCoderUpdateStragegy [ self critical: [ | previousSourceText| - previousSourceText := self sourceCode currentSourceText. + previousSourceText := self currentSourceText copy. self sourceCode currentSourceText: aText. self sourceChangedTo: aText From c8c8cddb4e39cb931982c7c990c7a0f118a15bfe Mon Sep 17 00:00:00 2001 From: Andrei Chis Date: Thu, 19 Jan 2023 21:58:38 +0100 Subject: [PATCH 0364/1268] Extend GtCoderUpdateStrategy with custom properties [feenkcom/gtoolkit#2503] --- .../GtCoderUpdateStrategy.class.st | 44 ++++++++++++++++++- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder/GtCoderUpdateStrategy.class.st b/src/GToolkit-Coder/GtCoderUpdateStrategy.class.st index 9041987fd..1b25fe17f 100644 --- a/src/GToolkit-Coder/GtCoderUpdateStrategy.class.st +++ b/src/GToolkit-Coder/GtCoderUpdateStrategy.class.st @@ -10,11 +10,30 @@ Class { #superclass : #Object, #instVars : [ 'announcementSource', - 'isSynchronous' + 'isSynchronous', + 'properties' ], - #category : 'GToolkit-Coder-Coders' + #category : #'GToolkit-Coder-Coders' } +{ #category : #'gt - extensions' } +GtCoderUpdateStrategy >> gtViewPropertiesFor: aView [ + + + (properties isNil or: [ properties isEmpty ]) ifTrue: [ ^ aView empty ]. + + ^ aView forward + title: 'Properties'; + priority: 100; + object: [ properties ]; + view: #gtItemsFor: +] + +{ #category : #'accessing - properties' } +GtCoderUpdateStrategy >> hasPropertyNamed: aPropertyName [ + ^ self properties includesKey: aPropertyName +] + { #category : #accessing } GtCoderUpdateStrategy >> isSynchronous [ ^ isSynchronous ifNil: [ false ] @@ -35,6 +54,27 @@ GtCoderUpdateStrategy >> makeSynchronous [ isSynchronous := true ] +{ #category : #'accessing - properties' } +GtCoderUpdateStrategy >> properties [ + ^ properties ifNil: [ + properties := OrderedDictionary new] +] + +{ #category : #'accessing - properties' } +GtCoderUpdateStrategy >> propertyNamed: aPropertyName [ + ^ self properties at: aPropertyName +] + +{ #category : #'accessing - properties' } +GtCoderUpdateStrategy >> propertyNamed: aPropertyName ifAbsent: anAbsentBlock [ + ^ self properties at: aPropertyName ifAbsent: anAbsentBlock +] + +{ #category : #'accessing - properties' } +GtCoderUpdateStrategy >> propertyNamed: aPropertyName put: aValue [ + ^ self properties at: aPropertyName put: aValue +] + { #category : #accessing } GtCoderUpdateStrategy >> source [ ^ announcementSource From 44879167e819e2591c023c77d2365b31d9410fab Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Wed, 25 Jan 2023 20:08:08 +0100 Subject: [PATCH 0365/1268] Add creation interface into coder [feenkcom/gtoolkit#2992] --- .../GtCoderNavigationTabsStencil.class.st | 46 +++++++++++-------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index ea2e75b17..2cf592e1c 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -48,23 +48,6 @@ GtCoderNavigationTabsStencil >> defaultNavigations [ collect ] -{ #category : #accessing } -GtCoderNavigationTabsStencil >> gtAddInterface: look [ - | contentTabs tabMethods | - contentTabs := BrTabGroup new. - contentTabs aptitude: BrGlamorousTabGroupAptitude new. - contentTabs - constraintsDo: [ :c | - c horizontal matchParent. - c vertical matchParent ]. - tabMethods := (Pragma allNamed: #gtCreateComponentTab: from: self class to: Behavior) - asSortedCollection: [ :a :b | a arguments first < b arguments first ]. - tabMethods - do: - [ :each | contentTabs addTab: (self perform: each method selector with: look) ]. - ^ contentTabs -] - { #category : #'gt-extensions' } GtCoderNavigationTabsStencil >> gtClassHierarchyFor: aView [ @@ -75,6 +58,33 @@ GtCoderNavigationTabsStencil >> gtClassHierarchyFor: aView [ stencil: [ GtCoderNavigationClassHierachyElement new navigationModel: self navigationModel ] ] +{ #category : #'gt-extensions' } +GtCoderNavigationTabsStencil >> gtCreationInterface: look [ + | contentTabs tabClasses | + contentTabs := BrTabGroup new. + contentTabs aptitude: BrGlamorousTabGroupAptitude new. + contentTabs + constraintsDo: [ :c | + c horizontal matchParent. + c vertical matchParent ]. + tabClasses := GtCreationForm allSubclasses + asSortedCollection: [ :a :b | a priority < b priority ]. + tabClasses + do: [ :each | + contentTabs + addTab: (BrTab new + aptitude: BrGlamorousTabAptitude new; + label: each componentName; + stencil: [ | form | + form := each new. + (GtCreationFormWidget forForm: form) + onAccept: [ :anInstance | + look + inUIProcessDo: [ form selectInNavigationModel: navigationModel anInstance: anInstance. + look fireEvent: BrDropdownHideWish new ] ] ]) ]. + ^ contentTabs +] + { #category : #'gt-extensions' } GtCoderNavigationTabsStencil >> gtPackagesTagsClassesFor: aView [ @@ -113,7 +123,7 @@ GtCoderNavigationTabsStencil >> gtPackagesTagsClassesFor: aView [ constraintsDo: [ :c | c horizontal exact: 400. c vertical exact: 300 ]. - element addChild: (self gtAddInterface: aDropdown). + element addChild: (self gtCreationInterface: aDropdown). element ] ] From b559c20dada77c6e66be594f3736f05d42a825f4 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Wed, 25 Jan 2023 20:10:00 +0100 Subject: [PATCH 0366/1268] Move GtCreationForm [feenkcom/gtoolkit#2966] --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 168 ++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 src/GToolkit-Coder-UI/GtCreationForm.class.st diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st new file mode 100644 index 000000000..de5f7d583 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -0,0 +1,168 @@ +Class { + #name : #GtCreationForm, + #superclass : #Object, + #instVars : [ + 'onAccept', + 'packageAndTagName' + ], + #category : #'GToolkit-Coder-UI-Forms - Models' +} + +{ #category : #accessing } +GtCreationForm class >> componentName [ + ^ self subclassResponsibility +] + +{ #category : #accessing } +GtCreationForm class >> priority [ + ^ self subclassResponsibility +] + +{ #category : #magritte } +GtCreationForm >> acceptAction [ + + ^ MAActionDescription new + label: 'Accept'; + action: [ :aModel :aButton | + [ | aValue | + aValue := self commit. + onAccept ifNotNil: [ onAccept value: aValue ] ] on: Error do: #inspect ]; + beCommitAction +] + +{ #category : #converting } +GtCreationForm >> asElement [ + ^ self asGtMagritteViewModel asElement +] + +{ #category : #callbacks } +GtCreationForm >> commit [ + ^ self subclassResponsibility +] + +{ #category : #callbacks } +GtCreationForm >> commitPackage [ + | aPackage | + (RPackageOrganizer default includesPackageNamed: packageAndTagName packageName) + ifTrue: [ aPackage := RPackageOrganizer default + packageNamed: packageAndTagName packageName. + ^ packageAndTagName tagName + ifEmpty: [ aPackage ] + ifNotEmpty: [ :aTagName | aPackage classTagNamed: aTagName ifAbsent: [ aPackage addClassTag: aTagName ] ] ] + ifFalse: [ aPackage := (RPackage named: packageAndTagName packageName) + register. + ^ packageAndTagName tagName + ifEmpty: [ aPackage ] + ifNotEmpty: [ :aTagName | aPackage addClassTag: aTagName ] ] +] + +{ #category : #accessing } +GtCreationForm >> ghostTextFor: aString [ + ^ BrGhostTextAttribute + for: (aString asRopedText glamorousCodeFont foreground: Color lightGray) +] + +{ #category : #initialization } +GtCreationForm >> initialize [ + packageAndTagName := GtPackageAndTagName new +] + +{ #category : #accessing } +GtCreationForm >> onAccept [ + + ^ onAccept +] + +{ #category : #accessing } +GtCreationForm >> onAccept: anObject [ + + onAccept := anObject +] + +{ #category : #accessing } +GtCreationForm >> packageAndTagDescription [ + + ^ GtPackageAndTagDescription new + label: 'Package'; + priority: 3; + accessor: #packageAndTagName; + textStyler: #glamorousCodeFont; + beRequired +] + +{ #category : #accessing } +GtCreationForm >> packageAndTagName [ + + ^ packageAndTagName +] + +{ #category : #accessing } +GtCreationForm >> packageAndTagName: anObject [ + + packageAndTagName := anObject +] + +{ #category : #accessing } +GtCreationForm >> selectInNavigationModel: aNavigationModel anInstance: anInstance [ + ^ aNavigationModel selectClass: anInstance +] + +{ #category : #accessing } +GtCreationForm >> taggerStencilWithCompletion: aCompletionStrategy [ + ^ [ :aMemento :aDescription :aForm | + | aTagger aTaggerAptitude | + aTagger := BrTagger new. + aTagger fitContent. + aForm hMatchParent. + aTagger + aptitude: (aTaggerAptitude := GtCreationEditableTaggerAptitude new + margin: (BlInsets right: 5); + tagLabel: [ :aTag | + | aLabel | + aLabel := BrEditableLabel new + text: (aDescription displayStringFor: aTag name); + aptitude: (BrGlamorousEditableLabelAptitude new glamorousCodeFont + defaultForeground: Color black); + whenKey: BlKeyCombination arrowRight + editorDo: [ :anEvent | + anEvent target acceptEdition. + aTaggerAptitude addTagCreatorElement ]. + aCompletionStrategy + ifNotNil: [ (GtCompletionController on: aLabel strategy: aCompletionStrategy) install ]. + aLabel ]). + aTagger + when: BrTaggerAddTagRequest + do: [ :aRequest | + aMemento + write: ((aTagger tags collect: #name) + add: aRequest tag name; + yourself) + using: aDescription ]. + aTagger + when: BrTaggerRemoveTagRequest + do: [ :aRequest | + aMemento + write: ((aTagger tags collect: #name) + remove: aRequest tag name; + yourself) + using: aDescription. + aTaggerAptitude addTagCreatorElement ]. + aTagger + withAsyncSinkDo: [ :anElementSink | + anElementSink + sink: AsyncPeekSink new; + whenUpdate: [ :theTagger :aSink | + | theValues | + theValues := aSink value currentValue. + theTagger namedTags: theValues ]. + (aMemento readObservableValueUsing: aDescription) observe: anElementSink ]. + GtMagritteBuilderUtility + newValidationContainerWith: aTagger + memento: aMemento + using: aDescription ] +] + +{ #category : #accessing } +GtCreationForm >> toolFor: anInstance [ + ^ GtClassCoderTool forClass: anInstance +] From f54a86b925afbb647d522d03079d9a9c7130f996 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Thu, 26 Jan 2023 14:26:27 +0100 Subject: [PATCH 0367/1268] Make creation form acceptable by default [feenkcom/gtoolkit#2966] --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index de5f7d583..72bee1602 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -32,7 +32,21 @@ GtCreationForm >> acceptAction [ { #category : #converting } GtCreationForm >> asElement [ - ^ self asGtMagritteViewModel asElement + | viewModel | + viewModel := self asGtMagritteViewModel. + "save action should be available even if unchanged" + viewModel actions first + installOn: [ :aModel :aButton :aMemento | + aButton + withAsyncSinkDo: [ :anElementSink | + anElementSink + sink: AsyncPeekSink new; + whenUpdate: [ :theButton :aSink | + | aStatus | + aStatus := aSink value. + theButton enabled: aStatus isValid ]. + aMemento overallStatus observe: anElementSink ] ]. + ^ viewModel asElement ] { #category : #callbacks } From 804750dddbb38c380a04cb69a349168b437c3e64 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Thu, 26 Jan 2023 15:02:13 +0100 Subject: [PATCH 0368/1268] Add hasPackageAndTag testing method to creation forms, add package and tag name in form if applicable, and close on Esc [feenkcom/gtoolkit#2966] --- .../GtCoderNavigationTabsStencil.class.st | 13 +++++++++++-- src/GToolkit-Coder-UI/GtCreationForm.class.st | 5 +++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index 2cf592e1c..4ade2b34f 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -77,11 +77,20 @@ GtCoderNavigationTabsStencil >> gtCreationInterface: look [ label: each componentName; stencil: [ | form | form := each new. - (GtCreationFormWidget forForm: form) + form hasPackageAndTag + ifTrue: [ navigationModel + selectedPackageDo: [ :aPackage | form packageAndTagName packageName: aPackage name ]. + navigationModel + selectedTagDo: [ :aTag | form packageAndTagName tagName: aTag name ] ]. + ((GtCreationFormWidget forForm: form) onAccept: [ :anInstance | look inUIProcessDo: [ form selectInNavigationModel: navigationModel anInstance: anInstance. - look fireEvent: BrDropdownHideWish new ] ] ]) ]. + look fireEvent: BrDropdownHideWish new ] ]) asElement + addShortcut: (BlShortcutWithAction new + combination: BlKeyCombination escape; + overrideChildren: true; + action: [ :anEvent | look inUIProcessDo: [ look fireEvent: BrDropdownHideWish new ] ]) ]) ]. ^ contentTabs ] diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index 72bee1602..20b8ae2ca 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -76,6 +76,11 @@ GtCreationForm >> ghostTextFor: aString [ for: (aString asRopedText glamorousCodeFont foreground: Color lightGray) ] +{ #category : #accessing } +GtCreationForm >> hasPackageAndTag [ + ^ true +] + { #category : #initialization } GtCreationForm >> initialize [ packageAndTagName := GtPackageAndTagName new From 78e54ad1490e66d830fb3b4c3053acd9479ed992 Mon Sep 17 00:00:00 2001 From: John Brant Date: Thu, 26 Jan 2023 06:23:19 -0600 Subject: [PATCH 0369/1268] starting diff builder --- .../GtDiffBuilderExamples.class.st | 198 ++++++++++++++ .../GtDiffSplitterExamples.class.st | 71 +++++ .../GtCompositeDiffChange.class.st | 52 ++++ .../GtDeletionDiffChange.class.st | 31 +++ src/GToolkit-Coder/GtDiffBuilder.class.st | 249 ++++++++++++++++++ src/GToolkit-Coder/GtDiffChange.class.st | 45 ++++ src/GToolkit-Coder/GtDiffSplit.class.st | 49 ++++ src/GToolkit-Coder/GtDiffSplitter.class.st | 13 + .../GtInsertionDiffChange.class.st | 31 +++ .../GtLineDiffSplitter.class.st | 38 +++ .../GtNullDiffSplitter.class.st | 11 + src/GToolkit-Coder/GtRangeDiffSplit.class.st | 33 +++ .../GtReplacementDiffChange.class.st | 57 ++++ .../GtSingleObjectDiffSplit.class.st | 23 ++ .../GtSourceDiffChange.class.st | 79 ++++++ 15 files changed, 980 insertions(+) create mode 100644 src/GToolkit-Coder-Examples/GtDiffBuilderExamples.class.st create mode 100644 src/GToolkit-Coder-Examples/GtDiffSplitterExamples.class.st create mode 100644 src/GToolkit-Coder/GtCompositeDiffChange.class.st create mode 100644 src/GToolkit-Coder/GtDeletionDiffChange.class.st create mode 100644 src/GToolkit-Coder/GtDiffBuilder.class.st create mode 100644 src/GToolkit-Coder/GtDiffChange.class.st create mode 100644 src/GToolkit-Coder/GtDiffSplit.class.st create mode 100644 src/GToolkit-Coder/GtDiffSplitter.class.st create mode 100644 src/GToolkit-Coder/GtInsertionDiffChange.class.st create mode 100644 src/GToolkit-Coder/GtLineDiffSplitter.class.st create mode 100644 src/GToolkit-Coder/GtNullDiffSplitter.class.st create mode 100644 src/GToolkit-Coder/GtRangeDiffSplit.class.st create mode 100644 src/GToolkit-Coder/GtReplacementDiffChange.class.st create mode 100644 src/GToolkit-Coder/GtSingleObjectDiffSplit.class.st create mode 100644 src/GToolkit-Coder/GtSourceDiffChange.class.st diff --git a/src/GToolkit-Coder-Examples/GtDiffBuilderExamples.class.st b/src/GToolkit-Coder-Examples/GtDiffBuilderExamples.class.st new file mode 100644 index 000000000..d47ae98ae --- /dev/null +++ b/src/GToolkit-Coder-Examples/GtDiffBuilderExamples.class.st @@ -0,0 +1,198 @@ +Class { + #name : #GtDiffBuilderExamples, + #superclass : #Object, + #category : #'GToolkit-Coder-Examples-Diff' +} + +{ #category : #accessing } +GtDiffBuilderExamples >> deletionsAtBeginningExample [ + + | differences from to change | + from := '1' , String cr , '2' , String lf , '3'. + to := from allButFirst: 2. + change := GtDiffBuilder + computeDifferencesFrom: from + to: to + using: GtLineDiffSplitter new. + differences := change changes. + self assert: differences size equals: 1. + self assert: differences first isDeletion. + self assert: differences first startIndex equals: 1. + self assert: differences first stopIndex equals: 2. + ^ change +] + +{ #category : #accessing } +GtDiffBuilderExamples >> deletionsAtEndExample [ + + | differences from to change | + from := '1' , String cr , '2' , String lf , '3'. + to := from allButLast. + change := GtDiffBuilder + computeDifferencesFrom: from + to: to + using: GtLineDiffSplitter new. + differences := change changes. + self assert: differences size equals: 1. + self assert: differences first isDeletion. + self assert: differences first startIndex equals: from size. + self assert: differences first stopIndex equals: from size. + ^ change +] + +{ #category : #accessing } +GtDiffBuilderExamples >> deletionsInMiddle [ + + | differences from to change | + from := String cr join: ((1 to: 9) collect: #printString). + to := String cr join: ((1 to: 4) , (7 to: 9) collect: #printString). + change := GtDiffBuilder + computeDifferencesFrom: from + to: to + using: GtLineDiffSplitter new. + differences := change changes. + self assert: differences size equals: 1. + self assert: differences first isDeletion. + self assert: differences first startIndex equals: 9. + self assert: differences first stopIndex equals: 12. + ^ change +] + +{ #category : #accessing } +GtDiffBuilderExamples >> insertionsAtBeginningExample [ + + | differences from to change | + to := '1' , String cr , '2' , String lf , '3'. + from := to allButFirst: 2. + change := GtDiffBuilder + computeDifferencesFrom: from + to: to + using: GtLineDiffSplitter new. + differences := change changes. + self assert: differences size equals: 1. + self assert: differences first isInsertion. + self assert: differences first startIndex equals: 1. + self assert: differences first stopIndex equals: 2. + ^ change +] + +{ #category : #accessing } +GtDiffBuilderExamples >> insertionsAtEndExample [ + + | differences from to change | + to := '1' , String cr , '2' , String lf , '3'. + from := to allButLast. + change := GtDiffBuilder + computeDifferencesFrom: from + to: to + using: GtLineDiffSplitter new. + differences := change changes. + self assert: differences size equals: 1. + self assert: differences first isInsertion. + self assert: differences first startIndex equals: to size. + self assert: differences first stopIndex equals: to size. + ^ change +] + +{ #category : #accessing } +GtDiffBuilderExamples >> insertionsInMiddle [ + + | differences from to change | + to := String cr join: ((1 to: 9) collect: #printString). + from := String cr join: ((1 to: 4) , (7 to: 9) collect: #printString). + change := GtDiffBuilder + computeDifferencesFrom: from + to: to + using: GtLineDiffSplitter new. + differences := change changes. + self assert: differences size equals: 1. + self assert: differences first isInsertion. + self assert: differences first startIndex equals: 9. + self assert: differences first stopIndex equals: 12. + ^ change +] + +{ #category : #accessing } +GtDiffBuilderExamples >> multipleChanges [ + + | differences from to change | + from := String cr join: ((0 to: 9 by: 3) collect: #printString). + to := String cr join: ((0 to: 9 by: 2) collect: #printString). + change := GtDiffBuilder + computeDifferencesFrom: from + to: to + using: GtLineDiffSplitter new. + differences := change changes. + self assert: differences size equals: 2. + self assert: differences first isReplacement. + ^ change +] + +{ #category : #accessing } +GtDiffBuilderExamples >> multipleObjectChanges [ + + | differences from to deletedObjects insertedObjects index change | + from := 0 to: 1000 by: 2. + to := 0 to: 1000 by: 7. + change := GtDiffBuilder + computeDifferencesFrom: from + to: to + using: GtNullDiffSplitter new. + differences := change changes. + deletedObjects := OrderedCollection new. + insertedObjects := OrderedCollection new. + differences + do: [ :each | + each deletedObjects ifNotNil: [ :objs | deletedObjects addAll: objs ]. + each insertedObjects ifNotNil: [ :objs | insertedObjects addAll: objs ] ]. + index := 1. + from + do: [ :each | + (to includes: each) + ifTrue: [ self assert: (deletedObjects includes: each) not ] + ifFalse: [ self assert: (deletedObjects at: index) equals: each. + index := index + 1 ] ]. + index := 1. + to + do: [ :each | + (from includes: each) + ifTrue: [ self assert: (insertedObjects includes: each) not ] + ifFalse: [ self assert: (insertedObjects at: index) equals: each. + index := index + 1 ] ]. + ^ change +] + +{ #category : #accessing } +GtDiffBuilderExamples >> noDifferencesExample [ + + | differences from to change | + from := '1' , String cr , '2' , String lf , '3'. + to := from copy. + change := GtDiffBuilder + computeDifferencesFrom: from + to: to + using: GtLineDiffSplitter new. + differences := change changes. + self assert: differences size equals: 0. + ^ change +] + +{ #category : #accessing } +GtDiffBuilderExamples >> replacementInMiddle [ + + | differences from to change | + from := String cr join: ((1 to: 4) , (6 to: 9) collect: #printString). + to := String cr join: ((1 to: 5) , (7 to: 9) collect: #printString). + change := GtDiffBuilder + computeDifferencesFrom: from + to: to + using: GtLineDiffSplitter new. + differences := change changes. + self assert: differences size equals: 1. + self assert: differences first isReplacement. + self assert: differences first deletionChange startIndex equals: 9. + self assert: differences first deletionChange stopIndex equals: 10. + self assert: differences first insertionChange startIndex equals: 9. + self assert: differences first insertionChange stopIndex equals: 10. + ^ change +] diff --git a/src/GToolkit-Coder-Examples/GtDiffSplitterExamples.class.st b/src/GToolkit-Coder-Examples/GtDiffSplitterExamples.class.st new file mode 100644 index 000000000..1e731497c --- /dev/null +++ b/src/GToolkit-Coder-Examples/GtDiffSplitterExamples.class.st @@ -0,0 +1,71 @@ +Class { + #name : #GtDiffSplitterExamples, + #superclass : #Object, + #category : #'GToolkit-Coder-Examples-Diff' +} + +{ #category : #'null splitter' } +GtDiffSplitterExamples >> characterSplitterExample [ + + ^ self compareNullSplits: '1234' +] + +{ #category : #'null splitter' } +GtDiffSplitterExamples >> compareNullSplits: aCollection [ + | splits values | + values := aCollection , aCollection reversed. + splits := GtNullDiffSplitter new split: values. + self assert: values size = splits size. + 1 + to: splits size + do: [ :i | + self assert: (splits at: i) equals: (splits at: splits size - i + 1). + self + assert: (splits at: i) hash + equals: (splits at: splits size - i + 1) hash. + self assert: (splits at: i) object = (values at: i) ]. + ^ splits +] + +{ #category : #lines } +GtDiffSplitterExamples >> lineWithEOLSplitterExample [ + + | splitter splits string | + string := '1' , String crlf , '2' , String cr , '3' , String lf , '4'. + splitter := GtLineDiffSplitter new + includeEOLChars: true; + yourself. + splits := splitter split: string. + self assert: splits size = 4. + self assert: splits first object equals: '1' , String crlf. + self assert: splits second object equals: '2' , String cr. + self assert: splits third object equals: '3' , String lf. + self assert: splits fourth object equals: '4'. + ^ splits +] + +{ #category : #lines } +GtDiffSplitterExamples >> lineWithoutEOLSplitterExample [ + + | splitter splits string | + string := '1' , String crlf , '1' , String cr , '1' , String lf , '1'. + splitter := GtLineDiffSplitter new + includeEOLChars: false; + yourself. + splits := splitter split: string. + self assert: splits size = 4. + self assert: splits asSet size equals: 1. + self assert: splits first object equals: '1'. + ^ splits +] + +{ #category : #'null splitter' } +GtDiffSplitterExamples >> objectSplitterExample [ + + ^ self + compareNullSplits: {1. + 'foo'. + Object new. + #(1 2 3). + 1.2} +] diff --git a/src/GToolkit-Coder/GtCompositeDiffChange.class.st b/src/GToolkit-Coder/GtCompositeDiffChange.class.st new file mode 100644 index 000000000..8fba63fab --- /dev/null +++ b/src/GToolkit-Coder/GtCompositeDiffChange.class.st @@ -0,0 +1,52 @@ +Class { + #name : #GtCompositeDiffChange, + #superclass : #GtDiffChange, + #instVars : [ + 'changes' + ], + #category : #'GToolkit-Coder-Diff-Algorithm' +} + +{ #category : #'instance creation' } +GtCompositeDiffChange class >> forChanges: aCollection [ + ^ self new + changes: aCollection; + yourself +] + +{ #category : #accessing } +GtCompositeDiffChange >> changes [ + ^ changes +] + +{ #category : #accessing } +GtCompositeDiffChange >> changes: aCollection [ + changes := aCollection +] + +{ #category : #accessing } +GtCompositeDiffChange >> gtChangeViewFor: aView [ + + ^ aView columnedTree + priority: 10; + title: 'Changes'; + items: [ self changes ]; + children: [ :each | + each isReplacement + ifTrue: [ {each deletionChange. + each insertionChange} ] + ifFalse: [ #() ] ]; + column: 'Kind' + text: [ :each | (each class name removePrefix: 'Gt') removeSuffix: 'DiffChange' ] + width: 150; + column: 'Range' + text: [ :each | each range ] + width: 100; + column: 'Objects' text: [ :each | each gtObjectsText ] +] + +{ #category : #initialization } +GtCompositeDiffChange >> initialize [ + super initialize. + changes := #() +] diff --git a/src/GToolkit-Coder/GtDeletionDiffChange.class.st b/src/GToolkit-Coder/GtDeletionDiffChange.class.st new file mode 100644 index 000000000..db393bf34 --- /dev/null +++ b/src/GToolkit-Coder/GtDeletionDiffChange.class.st @@ -0,0 +1,31 @@ +Class { + #name : #GtDeletionDiffChange, + #superclass : #GtSourceDiffChange, + #category : #'GToolkit-Coder-Diff-Algorithm' +} + +{ #category : #accessing } +GtDeletionDiffChange >> deletedObjects [ + ^ self objects +] + +{ #category : #accessing } +GtDeletionDiffChange >> deletionChange [ + ^ self +] + +{ #category : #accessing } +GtDeletionDiffChange >> gtObjectsText [ + ^ self objects asString asRopedText glamorousRegularFont + highlight: BrGlamorousColors errorBackgroundColor +] + +{ #category : #accessing } +GtDeletionDiffChange >> highlightColor [ + ^ BrGlamorousColors errorBackgroundColor +] + +{ #category : #testing } +GtDeletionDiffChange >> isDeletion [ + ^ true +] diff --git a/src/GToolkit-Coder/GtDiffBuilder.class.st b/src/GToolkit-Coder/GtDiffBuilder.class.st new file mode 100644 index 000000000..95ce421c2 --- /dev/null +++ b/src/GToolkit-Coder/GtDiffBuilder.class.st @@ -0,0 +1,249 @@ +Class { + #name : #GtDiffBuilder, + #superclass : #Object, + #instVars : [ + 'splitter', + 'from', + 'to', + 'fromSplits', + 'toSplits', + 'fromStart', + 'fromEnd', + 'toStart', + 'toEnd', + 'differences' + ], + #category : #'GToolkit-Coder-Diff-Algorithm' +} + +{ #category : #computing } +GtDiffBuilder class >> computeDifferencesFrom: fromCollection to: toCollection using: aGtDiffSplitter [ + | builder | + builder := self new. + builder from: fromCollection. + builder to: toCollection. + builder splitter: aGtDiffSplitter. + ^ builder computeDifferences +] + +{ #category : #private } +GtDiffBuilder >> addDeletions [ + | startIndex stopIndex | + startIndex := fromStart > 1 + ifTrue: [ (fromSplits at: fromStart) startIndex ] + ifFalse: [ 1 ]. + stopIndex := fromEnd < from size + ifTrue: [ (fromSplits at: fromEnd) stopIndex ] + ifFalse: [ from size ]. + differences + add: (GtDeletionDiffChange + on: from + from: startIndex + to: stopIndex) +] + +{ #category : #private } +GtDiffBuilder >> addInsertions [ + | startIndex stopIndex | + startIndex := toStart > 1 + ifTrue: [ (toSplits at: toStart) startIndex ] + ifFalse: [ 1 ]. + stopIndex := toEnd < to size + ifTrue: [ (toSplits at: toEnd) stopIndex ] + ifFalse: [ to size ]. + differences + add: (GtInsertionDiffChange + on: to + from: startIndex + to: stopIndex) +] + +{ #category : #private } +GtDiffBuilder >> addInsertionsAndDeletionsIgnoring: commonElements [ + [ fromStart <= fromEnd or: [ toStart <= toEnd ] ] + whileTrue: [ | deletion insertion start end split | + [ fromStart <= fromEnd + and: [ (commonElements includes: (split := fromSplits at: fromStart)) not ] ] + whileTrue: [ start ifNil: [ start := split startIndex ]. + end := split stopIndex. + fromStart := fromStart + 1 ]. + start + ifNotNil: [ deletion := GtDeletionDiffChange + on: from + from: start + to: end ]. + start := nil. + [ toStart <= toEnd + and: [ (commonElements includes: (split := toSplits at: toStart)) not ] ] + whileTrue: [ start ifNil: [ start := split startIndex ]. + end := split stopIndex. + toStart := toStart + 1 ]. + start + ifNotNil: [ insertion := GtInsertionDiffChange + on: to + from: start + to: end ]. + deletion + ifNil: [ differences add: insertion ] + ifNotNil: [ insertion + ifNil: [ differences add: deletion ] + ifNotNil: [ differences + add: (GtReplacementDiffChange delete: deletion andInsert: insertion) ] ]. + [ fromStart <= fromEnd + and: [ commonElements includes: (fromSplits at: fromStart) ] ] + whileTrue: [ fromStart := fromStart + 1 ]. + [ toStart <= toEnd and: [ commonElements includes: (toSplits at: toStart) ] ] + whileTrue: [ toStart := toStart + 1 ] ] +] + +{ #category : #private } +GtDiffBuilder >> buildDifferencesList [ + differences := OrderedCollection new. + fromStart > fromEnd + ifTrue: [ toStart > toEnd ifTrue: [ ^ self ]. + ^ self addInsertions ]. + toStart > toEnd ifTrue: [ ^ self addDeletions ]. + self computeLCSElements +] + +{ #category : #computing } +GtDiffBuilder >> computeDifferences [ + self initializeSplits. + self skipEqualElementsAtStart. + self skipEqualElementsAtEnd. + self buildDifferencesList. + ^ GtCompositeDiffChange forChanges: differences +] + +{ #category : #private } +GtDiffBuilder >> computeLCSElements [ + | filter filteredFrom filteredTo commonElements | + filter := Set new. + fromStart to: fromEnd do: [ :i | filter add: (fromSplits at: i) ]. + filteredTo := OrderedCollection new. + toStart + to: toEnd + do: [ :i | + | value | + (filter includes: (value := toSplits at: i)) + ifTrue: [ filteredTo add: value ] ]. + filter := Set new. + toStart to: toEnd do: [ :i | filter add: (toSplits at: i) ]. + filteredFrom := OrderedCollection new. + fromStart + to: fromEnd + do: [ :i | + | value | + (filter includes: (value := fromSplits at: i)) + ifTrue: [ filteredFrom add: value ] ]. + commonElements := self computeLCSElementsBetween: filteredFrom and: filteredTo. + self addInsertionsAndDeletionsIgnoring: commonElements +] + +{ #category : #private } +GtDiffBuilder >> computeLCSElementsBetween: filteredFrom and: filteredTo [ + | map fromNumbers toNumbers common lcs | + common := IdentitySet new. + (filteredFrom isEmpty or: [ filteredTo isEmpty ]) ifTrue: [ ^ common ]. + map := Dictionary new. + fromNumbers := filteredFrom + collect: [ :each | map at: each ifAbsentPut: [ map size ] ]. + toNumbers := filteredTo + collect: [ :each | map at: each ifAbsentPut: [ map size ] ]. + lcs := self lcsFor: fromNumbers and: toNumbers. + [ lcs notNil ] + whileTrue: [ common + add: (filteredFrom at: lcs first); + add: (filteredTo at: lcs second). + lcs := lcs last ]. + ^ common +] + +{ #category : #accessing } +GtDiffBuilder >> from [ + ^ from +] + +{ #category : #accessing } +GtDiffBuilder >> from: aCollection [ + from := aCollection +] + +{ #category : #private } +GtDiffBuilder >> initializeSplits [ + fromSplits := splitter split: from. + toSplits := splitter split: to +] + +{ #category : #private } +GtDiffBuilder >> lcsFor: fromNumbers and: toNumbers [ + | fromSize toSize endPoints lcss maxSize | + fromSize := fromNumbers size. + toSize := toNumbers size. + maxSize := toSize + fromSize. + endPoints := Array new: 2 * maxSize + 1. + endPoints at: maxSize + 2 put: 0. + lcss := Array new: 2 * maxSize + 1. + 0 + to: maxSize + do: [ :d | + d negated + to: d + by: 2 + do: [ :k | + | index lcs x y | + index := maxSize + k. + (k + d = 0 or: [ k ~= d and: [ (endPoints at: index) < (endPoints at: index + 2) ] ]) + ifTrue: [ x := endPoints at: (index := index + 2) ] + ifFalse: [ x := (endPoints at: index) + 1 ]. + y := x - k. + lcs := lcss at: index. + [ x < fromSize + and: [ y < toSize and: [ (fromNumbers at: x + 1) = (toNumbers at: y + 1) ] ] ] + whileTrue: [ lcs := {x := x + 1. + y := y + 1. + lcs} ]. + (x >= fromSize and: [ y >= toSize ]) ifTrue: [ ^ lcs ]. + endPoints at: maxSize + k + 1 put: x. + lcss at: maxSize + k + 1 put: lcs ] ]. +] + +{ #category : #private } +GtDiffBuilder >> skipEqualElementsAtEnd [ + fromEnd := fromSplits size. + toEnd := toSplits size. + [ fromEnd >= fromStart + and: [ toEnd >= toStart and: [ (fromSplits at: fromEnd) = (toSplits at: toEnd) ] ] ] + whileTrue: [ fromEnd := fromEnd - 1. + toEnd := toEnd - 1 ] +] + +{ #category : #private } +GtDiffBuilder >> skipEqualElementsAtStart [ + fromStart := 1. + [ fromStart <= fromSplits size + and: [ fromStart <= toSplits size + and: [ (fromSplits at: fromStart) = (toSplits at: fromStart) ] ] ] + whileTrue: [ fromStart := fromStart + 1 ]. + toStart := fromStart +] + +{ #category : #accessing } +GtDiffBuilder >> splitter [ + ^ splitter +] + +{ #category : #accessing } +GtDiffBuilder >> splitter: aGtDiffSplitter [ + splitter := aGtDiffSplitter +] + +{ #category : #accessing } +GtDiffBuilder >> to [ + ^ to +] + +{ #category : #accessing } +GtDiffBuilder >> to: aCollection [ + to := aCollection +] diff --git a/src/GToolkit-Coder/GtDiffChange.class.st b/src/GToolkit-Coder/GtDiffChange.class.st new file mode 100644 index 000000000..344bfab7f --- /dev/null +++ b/src/GToolkit-Coder/GtDiffChange.class.st @@ -0,0 +1,45 @@ +Class { + #name : #GtDiffChange, + #superclass : #Object, + #category : #'GToolkit-Coder-Diff-Algorithm' +} + +{ #category : #accessing } +GtDiffChange >> deletedObjects [ + ^ nil +] + +{ #category : #accessing } +GtDiffChange >> deletionChange [ + ^ nil +] + +{ #category : #accessing } +GtDiffChange >> gtObjectsText [ + ^ '' asRopedText +] + +{ #category : #accessing } +GtDiffChange >> insertedObjects [ + ^ nil +] + +{ #category : #accessing } +GtDiffChange >> insertionChange [ + ^ nil +] + +{ #category : #testing } +GtDiffChange >> isDeletion [ + ^ false +] + +{ #category : #testing } +GtDiffChange >> isInsertion [ + ^ false +] + +{ #category : #testing } +GtDiffChange >> isReplacement [ + ^ false +] diff --git a/src/GToolkit-Coder/GtDiffSplit.class.st b/src/GToolkit-Coder/GtDiffSplit.class.st new file mode 100644 index 000000000..11c70eea2 --- /dev/null +++ b/src/GToolkit-Coder/GtDiffSplit.class.st @@ -0,0 +1,49 @@ +Class { + #name : #GtDiffSplit, + #superclass : #Object, + #instVars : [ + 'source', + 'startIndex' + ], + #category : #'GToolkit-Coder-Diff-Algorithm' +} + +{ #category : #comparing } +GtDiffSplit >> = anObject [ + ^ self class = anObject class ifTrue: [ self object = anObject object ] +] + +{ #category : #comparing } +GtDiffSplit >> hash [ + ^ self object hash +] + +{ #category : #accessing } +GtDiffSplit >> object [ + ^ self subclassResponsibility +] + +{ #category : #accessing } +GtDiffSplit >> source [ + ^ source +] + +{ #category : #accessing } +GtDiffSplit >> source: aCollection [ + source := aCollection +] + +{ #category : #accessing } +GtDiffSplit >> startIndex [ + ^ startIndex +] + +{ #category : #accessing } +GtDiffSplit >> startIndex: anInteger [ + startIndex := anInteger +] + +{ #category : #accessing } +GtDiffSplit >> stopIndex [ + ^ self subclassResponsibility +] diff --git a/src/GToolkit-Coder/GtDiffSplitter.class.st b/src/GToolkit-Coder/GtDiffSplitter.class.st new file mode 100644 index 000000000..22b670f79 --- /dev/null +++ b/src/GToolkit-Coder/GtDiffSplitter.class.st @@ -0,0 +1,13 @@ +Class { + #name : #GtDiffSplitter, + #superclass : #Object, + #instVars : [ + 'source' + ], + #category : #'GToolkit-Coder-Diff-Algorithm' +} + +{ #category : #actions } +GtDiffSplitter >> split: aCollection [ + self subclassResponsibility +] diff --git a/src/GToolkit-Coder/GtInsertionDiffChange.class.st b/src/GToolkit-Coder/GtInsertionDiffChange.class.st new file mode 100644 index 000000000..2fb878fa5 --- /dev/null +++ b/src/GToolkit-Coder/GtInsertionDiffChange.class.st @@ -0,0 +1,31 @@ +Class { + #name : #GtInsertionDiffChange, + #superclass : #GtSourceDiffChange, + #category : #'GToolkit-Coder-Diff-Algorithm' +} + +{ #category : #accessing } +GtInsertionDiffChange >> gtObjectsText [ + ^ self objects asString asRopedText glamorousRegularFont + highlight: BrGlamorousColors successBackgroundColor +] + +{ #category : #accessing } +GtInsertionDiffChange >> highlightColor [ + ^ BrGlamorousColors successBackgroundColor +] + +{ #category : #accessing } +GtInsertionDiffChange >> insertedObjects [ + ^ self objects +] + +{ #category : #accessing } +GtInsertionDiffChange >> insertionChange [ + ^ self +] + +{ #category : #testing } +GtInsertionDiffChange >> isInsertion [ + ^ true +] diff --git a/src/GToolkit-Coder/GtLineDiffSplitter.class.st b/src/GToolkit-Coder/GtLineDiffSplitter.class.st new file mode 100644 index 000000000..a0444220b --- /dev/null +++ b/src/GToolkit-Coder/GtLineDiffSplitter.class.st @@ -0,0 +1,38 @@ +Class { + #name : #GtLineDiffSplitter, + #superclass : #GtDiffSplitter, + #instVars : [ + 'includeEOLChars' + ], + #category : #'GToolkit-Coder-Diff-Algorithm' +} + +{ #category : #accessing } +GtLineDiffSplitter >> includeEOLChars [ + ^ includeEOLChars +] + +{ #category : #accessing } +GtLineDiffSplitter >> includeEOLChars: aBoolean [ + includeEOLChars := aBoolean +] + +{ #category : #initialization } +GtLineDiffSplitter >> initialize [ + super initialize. + includeEOLChars := true +] + +{ #category : #actions } +GtLineDiffSplitter >> split: aString [ + | splits | + splits := OrderedCollection new. + aString + lineIndicesDo: [ :start :end :endWithEOL | + splits + add: (GtRangeDiffSplit + on: aString + from: start + to: (includeEOLChars ifTrue: [ endWithEOL ] ifFalse: [ end ])) ]. + ^ splits +] diff --git a/src/GToolkit-Coder/GtNullDiffSplitter.class.st b/src/GToolkit-Coder/GtNullDiffSplitter.class.st new file mode 100644 index 000000000..ee7fc86bd --- /dev/null +++ b/src/GToolkit-Coder/GtNullDiffSplitter.class.st @@ -0,0 +1,11 @@ +Class { + #name : #GtNullDiffSplitter, + #superclass : #GtDiffSplitter, + #category : #'GToolkit-Coder-Diff-Algorithm' +} + +{ #category : #actions } +GtNullDiffSplitter >> split: aCollection [ + ^ (1 to: aCollection size) + collect: [ :i | GtSingleObjectDiffSplit on: aCollection at: i ] +] diff --git a/src/GToolkit-Coder/GtRangeDiffSplit.class.st b/src/GToolkit-Coder/GtRangeDiffSplit.class.st new file mode 100644 index 000000000..5c27752e7 --- /dev/null +++ b/src/GToolkit-Coder/GtRangeDiffSplit.class.st @@ -0,0 +1,33 @@ +Class { + #name : #GtRangeDiffSplit, + #superclass : #GtDiffSplit, + #instVars : [ + 'stopIndex', + 'object' + ], + #category : #'GToolkit-Coder-Diff-Algorithm' +} + +{ #category : #accessing } +GtRangeDiffSplit class >> on: aCollection from: startIndex to: stopIndex [ + ^ self new + source: aCollection; + startIndex: startIndex; + stopIndex: stopIndex; + yourself +] + +{ #category : #accessing } +GtRangeDiffSplit >> object [ + ^ object ifNil: [ object := source copyFrom: startIndex to: stopIndex ] +] + +{ #category : #accessing } +GtRangeDiffSplit >> stopIndex [ + ^ stopIndex +] + +{ #category : #accessing } +GtRangeDiffSplit >> stopIndex: anInteger [ + stopIndex := anInteger +] diff --git a/src/GToolkit-Coder/GtReplacementDiffChange.class.st b/src/GToolkit-Coder/GtReplacementDiffChange.class.st new file mode 100644 index 000000000..0a2947dfb --- /dev/null +++ b/src/GToolkit-Coder/GtReplacementDiffChange.class.st @@ -0,0 +1,57 @@ +Class { + #name : #GtReplacementDiffChange, + #superclass : #GtDiffChange, + #instVars : [ + 'insertionChange', + 'deletionChange' + ], + #category : #'GToolkit-Coder-Diff-Algorithm' +} + +{ #category : #'instance creation' } +GtReplacementDiffChange class >> delete: aDeletionChange andInsert: anInsertionChange [ + ^ self new + deletionChange: aDeletionChange; + insertionChange: anInsertionChange; + yourself +] + +{ #category : #accessing } +GtReplacementDiffChange >> deletedObjects [ + ^ deletionChange objects +] + +{ #category : #accessing } +GtReplacementDiffChange >> deletionChange [ + ^ deletionChange +] + +{ #category : #accessing } +GtReplacementDiffChange >> deletionChange: aDeletionChange [ + deletionChange := aDeletionChange +] + +{ #category : #accessing } +GtReplacementDiffChange >> insertedObjects [ + ^ insertionChange objects +] + +{ #category : #accessing } +GtReplacementDiffChange >> insertionChange [ + ^ insertionChange +] + +{ #category : #accessing } +GtReplacementDiffChange >> insertionChange: anInsertionChange [ + insertionChange := anInsertionChange +] + +{ #category : #testing } +GtReplacementDiffChange >> isReplacement [ + ^ true +] + +{ #category : #accessing } +GtReplacementDiffChange >> range [ + ^ self deletionChange range , ', ' , self insertionChange range +] diff --git a/src/GToolkit-Coder/GtSingleObjectDiffSplit.class.st b/src/GToolkit-Coder/GtSingleObjectDiffSplit.class.st new file mode 100644 index 000000000..0b2b1c001 --- /dev/null +++ b/src/GToolkit-Coder/GtSingleObjectDiffSplit.class.st @@ -0,0 +1,23 @@ +Class { + #name : #GtSingleObjectDiffSplit, + #superclass : #GtDiffSplit, + #category : #'GToolkit-Coder-Diff-Algorithm' +} + +{ #category : #'instance creation' } +GtSingleObjectDiffSplit class >> on: aCollection at: anIndex [ + ^ self new + source: aCollection; + startIndex: anIndex; + yourself +] + +{ #category : #accessing } +GtSingleObjectDiffSplit >> object [ + ^ source at: startIndex +] + +{ #category : #accessing } +GtSingleObjectDiffSplit >> stopIndex [ + ^ startIndex +] diff --git a/src/GToolkit-Coder/GtSourceDiffChange.class.st b/src/GToolkit-Coder/GtSourceDiffChange.class.st new file mode 100644 index 000000000..2e56506ad --- /dev/null +++ b/src/GToolkit-Coder/GtSourceDiffChange.class.st @@ -0,0 +1,79 @@ +Class { + #name : #GtSourceDiffChange, + #superclass : #GtDiffChange, + #instVars : [ + 'startIndex', + 'stopIndex', + 'source' + ], + #category : #'GToolkit-Coder-Diff-Algorithm' +} + +{ #category : #'instance creation' } +GtSourceDiffChange class >> on: aCollection from: startIndex to: stopIndex [ + ^ self new + source: aCollection; + startIndex: startIndex; + stopIndex: stopIndex; + yourself +] + +{ #category : #accessing } +GtSourceDiffChange >> gtLiveFor: aView [ + + ^ aView textEditor + title: 'Source'; + text: [ | stream | + stream := BlTextStream new. + stream next putAll: (source copyFrom: 1 to: startIndex - 1) asString. + stream next + highlight: self highlightColor; + putAll: self objects asString. + stream next putAll: (source copyFrom: stopIndex + 1 to: source size) asString. + stream contents ] +] + +{ #category : #accessing } +GtSourceDiffChange >> highlightColor [ + ^ self subclassResponsibility +] + +{ #category : #accessing } +GtSourceDiffChange >> objects [ + ^ source copyFrom: self startIndex to: self stopIndex +] + +{ #category : #accessing } +GtSourceDiffChange >> range [ + ^ self startIndex printString , '-' , self stopIndex printString +] + +{ #category : #accessing } +GtSourceDiffChange >> source [ + ^ source +] + +{ #category : #accessing } +GtSourceDiffChange >> source: aCollection [ + source := aCollection +] + +{ #category : #accessing } +GtSourceDiffChange >> startIndex [ + ^ startIndex +] + +{ #category : #accessing } +GtSourceDiffChange >> startIndex: anInteger [ + startIndex := anInteger +] + +{ #category : #accessing } +GtSourceDiffChange >> stopIndex [ + ^ stopIndex +] + +{ #category : #accessing } +GtSourceDiffChange >> stopIndex: anInteger [ + stopIndex := anInteger +] From b83d76bdfbd5bd53b84cb214938bbe8c1971957b Mon Sep 17 00:00:00 2001 From: John Brant Date: Thu, 26 Jan 2023 15:30:10 -0600 Subject: [PATCH 0370/1268] adding word & token splitters for diff builder --- .../GtDiffBuilderExamples.class.st | 49 +++++++++--- .../GtDiffSplitterExamples.class.st | 55 ++++++++++++-- .../GtCharacterGroupDiffSplitter.class.st | 72 ++++++++++++++++++ .../GtCompositeDiffChange.class.st | 76 ++++++++++++++++++- .../GtDeletionDiffChange.class.st | 11 ++- src/GToolkit-Coder/GtDiffBuilder.class.st | 5 +- src/GToolkit-Coder/GtDiffChange.class.st | 8 ++ src/GToolkit-Coder/GtDiffSplit.class.st | 5 ++ .../GtDiffSplitCollection.class.st | 51 +++++++++++++ src/GToolkit-Coder/GtDiffSplitter.class.st | 8 ++ .../GtInsertionDiffChange.class.st | 5 +- .../GtLineDiffSplitter.class.st | 11 +-- .../GtNullDiffSplitter.class.st | 7 +- .../GtReplacementDiffChange.class.st | 10 +++ .../GtSmaCCDiffSplitter.class.st | 39 ++++++++++ .../GtSourceDiffChange.class.st | 6 ++ 16 files changed, 381 insertions(+), 37 deletions(-) create mode 100644 src/GToolkit-Coder/GtCharacterGroupDiffSplitter.class.st create mode 100644 src/GToolkit-Coder/GtDiffSplitCollection.class.st create mode 100644 src/GToolkit-Coder/GtSmaCCDiffSplitter.class.st diff --git a/src/GToolkit-Coder-Examples/GtDiffBuilderExamples.class.st b/src/GToolkit-Coder-Examples/GtDiffBuilderExamples.class.st index d47ae98ae..0a1803047 100644 --- a/src/GToolkit-Coder-Examples/GtDiffBuilderExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtDiffBuilderExamples.class.st @@ -4,7 +4,7 @@ Class { #category : #'GToolkit-Coder-Examples-Diff' } -{ #category : #accessing } +{ #category : #examples } GtDiffBuilderExamples >> deletionsAtBeginningExample [ | differences from to change | @@ -22,7 +22,7 @@ GtDiffBuilderExamples >> deletionsAtBeginningExample [ ^ change ] -{ #category : #accessing } +{ #category : #examples } GtDiffBuilderExamples >> deletionsAtEndExample [ | differences from to change | @@ -40,7 +40,7 @@ GtDiffBuilderExamples >> deletionsAtEndExample [ ^ change ] -{ #category : #accessing } +{ #category : #examples } GtDiffBuilderExamples >> deletionsInMiddle [ | differences from to change | @@ -58,7 +58,7 @@ GtDiffBuilderExamples >> deletionsInMiddle [ ^ change ] -{ #category : #accessing } +{ #category : #examples } GtDiffBuilderExamples >> insertionsAtBeginningExample [ | differences from to change | @@ -76,7 +76,7 @@ GtDiffBuilderExamples >> insertionsAtBeginningExample [ ^ change ] -{ #category : #accessing } +{ #category : #examples } GtDiffBuilderExamples >> insertionsAtEndExample [ | differences from to change | @@ -94,7 +94,7 @@ GtDiffBuilderExamples >> insertionsAtEndExample [ ^ change ] -{ #category : #accessing } +{ #category : #examples } GtDiffBuilderExamples >> insertionsInMiddle [ | differences from to change | @@ -112,7 +112,7 @@ GtDiffBuilderExamples >> insertionsInMiddle [ ^ change ] -{ #category : #accessing } +{ #category : #examples } GtDiffBuilderExamples >> multipleChanges [ | differences from to change | @@ -128,7 +128,7 @@ GtDiffBuilderExamples >> multipleChanges [ ^ change ] -{ #category : #accessing } +{ #category : #examples } GtDiffBuilderExamples >> multipleObjectChanges [ | differences from to deletedObjects insertedObjects index change | @@ -162,7 +162,7 @@ GtDiffBuilderExamples >> multipleObjectChanges [ ^ change ] -{ #category : #accessing } +{ #category : #examples } GtDiffBuilderExamples >> noDifferencesExample [ | differences from to change | @@ -177,7 +177,7 @@ GtDiffBuilderExamples >> noDifferencesExample [ ^ change ] -{ #category : #accessing } +{ #category : #examples } GtDiffBuilderExamples >> replacementInMiddle [ | differences from to change | @@ -196,3 +196,32 @@ GtDiffBuilderExamples >> replacementInMiddle [ self assert: differences first insertionChange stopIndex equals: 10. ^ change ] + +{ #category : #examples } +GtDiffBuilderExamples >> tokenChanges [ + + | differences from to change scannerClass | + scannerClass := self class environment at: #GtPharoScanner ifAbsent: [ ^ nil ]. + from := 'method: arg ^self inject: arg into: [:sum :each | sum + each]'. + to := 'method: arg1 + ^ self + inject: arg1 + into: [:sum :each | (sum + each)]'. + change := GtDiffBuilder + computeDifferencesFrom: from + to: to + using: (GtSmaCCDiffSplitter new scannerClass: scannerClass). + differences := change changes. + self assert: differences size equals: 4. + self assert: differences first isReplacement. + self assert: differences first deletionChange objects equals: 'arg'. + self assert: differences first insertionChange objects equals: 'arg1'. + self assert: differences second isReplacement. + self assert: differences second deletionChange objects equals: 'arg'. + self assert: differences second insertionChange objects equals: 'arg1'. + self assert: differences third isInsertion. + self assert: differences third objects equals: '('. + self assert: differences fourth isInsertion. + self assert: differences fourth objects equals: ')'. + ^ change +] diff --git a/src/GToolkit-Coder-Examples/GtDiffSplitterExamples.class.st b/src/GToolkit-Coder-Examples/GtDiffSplitterExamples.class.st index 1e731497c..e4472db9e 100644 --- a/src/GToolkit-Coder-Examples/GtDiffSplitterExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtDiffSplitterExamples.class.st @@ -27,6 +27,18 @@ GtDiffSplitterExamples >> compareNullSplits: aCollection [ ^ splits ] +{ #category : #'token splitter' } +GtDiffSplitterExamples >> javascriptDiffSplitter [ + + | splits scannerClass splitter | + scannerClass := self class environment at: #JSScanner ifAbsent: [ ^ nil ]. + splitter := GtSmaCCDiffSplitter new scannerClass: scannerClass. + splits := splitter split: '/*1*/for(i=0; i<10; i++/*2*/) console.log(i);//3'. + #('/*1*/' 'for' '(' 'i' '=' '0' ';' 'i' '<' '10' ';' 'i' '++' '/*2*/' ')' 'console' '.' 'log' '(' 'i' ')' ';' '//3') + doWithIndex: [ :each :i | self assert: (splits at: i) object equals: each ]. + ^ splits +] + { #category : #lines } GtDiffSplitterExamples >> lineWithEOLSplitterExample [ @@ -37,10 +49,10 @@ GtDiffSplitterExamples >> lineWithEOLSplitterExample [ yourself. splits := splitter split: string. self assert: splits size = 4. - self assert: splits first object equals: '1' , String crlf. - self assert: splits second object equals: '2' , String cr. - self assert: splits third object equals: '3' , String lf. - self assert: splits fourth object equals: '4'. + self assert: (splits at: 1) object equals: '1' , String crlf. + self assert: (splits at: 2) object equals: '2' , String cr. + self assert: (splits at: 3) object equals: '3' , String lf. + self assert: (splits at: 4) object equals: '4'. ^ splits ] @@ -54,8 +66,8 @@ GtDiffSplitterExamples >> lineWithoutEOLSplitterExample [ yourself. splits := splitter split: string. self assert: splits size = 4. - self assert: splits asSet size equals: 1. - self assert: splits first object equals: '1'. + self assert: splits splits asSet size equals: 1. + self assert: (splits at: 1) object equals: '1'. ^ splits ] @@ -69,3 +81,34 @@ GtDiffSplitterExamples >> objectSplitterExample [ #(1 2 3). 1.2} ] + +{ #category : #'character groups' } +GtDiffSplitterExamples >> wordIgnoreWhitespaceSplitter [ + + | splits words | + words := #('This ' 'is ' 'a ' 'test' '. + ' '123' ',' '45'). + splits := GtCharacterGroupDiffSplitter words ignoreWhitespace + split: ('' join: words). + self assert: splits size equals: words size. + 1 + to: words size + do: [ :i | self assert: (splits at: i) object equals: (words at: i) trim ]. + ^ splits +] + +{ #category : #'character groups' } +GtDiffSplitterExamples >> wordSplitter [ + + | splits words | + words := #('This' 'is' 'a' 'test'). + splits := GtCharacterGroupDiffSplitter words split: (' ' join: words). + self assert: splits size equals: words size * 2 - 1. + 1 + to: words size + do: [ :i | self assert: (splits at: i * 2 - 1) object equals: (words at: i) trim ]. + 1 + to: words size - 1 + do: [ :i | self assert: (splits at: i * 2) object equals: ' ' ]. + ^ splits +] diff --git a/src/GToolkit-Coder/GtCharacterGroupDiffSplitter.class.st b/src/GToolkit-Coder/GtCharacterGroupDiffSplitter.class.st new file mode 100644 index 000000000..1b7c707a9 --- /dev/null +++ b/src/GToolkit-Coder/GtCharacterGroupDiffSplitter.class.st @@ -0,0 +1,72 @@ +Class { + #name : #GtCharacterGroupDiffSplitter, + #superclass : #GtDiffSplitter, + #instVars : [ + 'groups', + 'shouldIgnoreWhitespace' + ], + #category : #'GToolkit-Coder-Diff-Algorithm' +} + +{ #category : #'instance creation' } +GtCharacterGroupDiffSplitter class >> words [ + ^ self new + addGroup: #tokenish; + addGroup: #isSeparator; + yourself +] + +{ #category : #adding } +GtCharacterGroupDiffSplitter >> addGroup: aSymbolOrBlock [ + groups add: aSymbolOrBlock +] + +{ #category : #accessing } +GtCharacterGroupDiffSplitter >> classify: aCharacter [ + (shouldIgnoreWhitespace and: [ aCharacter isSeparator ]) ifTrue: [ ^ 0 ]. + ^ (1 to: groups size) + detect: [ :i | (groups at: i) value: aCharacter ] + ifNone: [ groups size + 1 ] +] + +{ #category : #initialization } +GtCharacterGroupDiffSplitter >> ignoreWhitespace [ + shouldIgnoreWhitespace := true +] + +{ #category : #initialization } +GtCharacterGroupDiffSplitter >> includeWhitespace [ + shouldIgnoreWhitespace := false +] + +{ #category : #initialization } +GtCharacterGroupDiffSplitter >> initialize [ + super initialize. + shouldIgnoreWhitespace := false. + groups := OrderedCollection new +] + +{ #category : #accessing } +GtCharacterGroupDiffSplitter >> split: aString into: aGtDiffSplits [ + | stream start groupId nextGroupId | + stream := aString readStream. + groupId := 0. + start := 1. + [ stream atEnd ] + whileFalse: [ nextGroupId := self classify: stream next. + nextGroupId ~= groupId + ifTrue: [ groupId = 0 + ifFalse: [ aGtDiffSplits + addSplit: (GtRangeDiffSplit + on: aString + from: start + to: stream position - 1) ]. + start := stream position. + groupId := nextGroupId ] ]. + groupId > 0 + ifTrue: [ aGtDiffSplits + addSplit: (GtRangeDiffSplit + on: aString + from: start + to: stream position) ] +] diff --git a/src/GToolkit-Coder/GtCompositeDiffChange.class.st b/src/GToolkit-Coder/GtCompositeDiffChange.class.st index 8fba63fab..7de4042ca 100644 --- a/src/GToolkit-Coder/GtCompositeDiffChange.class.st +++ b/src/GToolkit-Coder/GtCompositeDiffChange.class.st @@ -2,7 +2,9 @@ Class { #name : #GtCompositeDiffChange, #superclass : #GtDiffChange, #instVars : [ - 'changes' + 'changes', + 'from', + 'to' ], #category : #'GToolkit-Coder-Diff-Algorithm' } @@ -14,6 +16,25 @@ GtCompositeDiffChange class >> forChanges: aCollection [ yourself ] +{ #category : #'instance creation' } +GtCompositeDiffChange class >> from: from to: to changes: aCollection [ + ^ self new + from: from; + to: to; + changes: aCollection; + yourself +] + +{ #category : #formatting } +GtCompositeDiffChange >> applyAttributesToInput: aText [ + changes do: [ :each | each applyAttributesToInput: aText ] +] + +{ #category : #formatting } +GtCompositeDiffChange >> applyAttributesToOutput: aText [ + changes do: [ :each | each applyAttributesToOutput: aText ] +] + { #category : #accessing } GtCompositeDiffChange >> changes [ ^ changes @@ -25,6 +46,16 @@ GtCompositeDiffChange >> changes: aCollection [ ] { #category : #accessing } +GtCompositeDiffChange >> from [ + ^ from +] + +{ #category : #accessing } +GtCompositeDiffChange >> from: anObject [ + from := anObject +] + +{ #category : #inspecting } GtCompositeDiffChange >> gtChangeViewFor: aView [ ^ aView columnedTree @@ -45,8 +76,51 @@ GtCompositeDiffChange >> gtChangeViewFor: aView [ column: 'Objects' text: [ :each | each gtObjectsText ] ] +{ #category : #inspecting } +GtCompositeDiffChange >> gtTextView: aView [ + + from isString ifFalse: [ ^ aView empty ]. + ^ aView explicit + priority: 10; + title: 'Text'; + stencil: [ | pane fromText toText fromEditor toEditor | + pane := BrHorizontalPane new. + pane matchParent. + pane padding: (BlInsets all: 10). + fromText := from asRopedText glamorousRegularFont. + toText := to asRopedText glamorousRegularFont. + self applyAttributesToInput: fromText. + self applyAttributesToOutput: toText. + fromEditor := BrEditor new + focusability: BlFocusability none; + beReadOnlyWithSelection; + matchParent; + aptitude: BrGlamorousCodeEditorAptitude. + fromEditor editor text: fromText. + toEditor := BrEditor new + focusability: BlFocusability none; + beReadOnlyWithSelection; + matchParent; + aptitude: BrGlamorousCodeEditorAptitude. + toEditor editor text: toText. + pane + addChild: fromEditor; + addChild: toEditor. + pane ] +] + { #category : #initialization } GtCompositeDiffChange >> initialize [ super initialize. changes := #() ] + +{ #category : #accessing } +GtCompositeDiffChange >> to [ + ^ to +] + +{ #category : #accessing } +GtCompositeDiffChange >> to: aCollection [ + to := aCollection +] diff --git a/src/GToolkit-Coder/GtDeletionDiffChange.class.st b/src/GToolkit-Coder/GtDeletionDiffChange.class.st index db393bf34..4d665de1b 100644 --- a/src/GToolkit-Coder/GtDeletionDiffChange.class.st +++ b/src/GToolkit-Coder/GtDeletionDiffChange.class.st @@ -4,6 +4,11 @@ Class { #category : #'GToolkit-Coder-Diff-Algorithm' } +{ #category : #accessing } +GtDeletionDiffChange >> applyAttributesToInput: aText [ + (aText from: self startIndex to: self stopIndex) highlight: self highlightColor +] + { #category : #accessing } GtDeletionDiffChange >> deletedObjects [ ^ self objects @@ -14,12 +19,6 @@ GtDeletionDiffChange >> deletionChange [ ^ self ] -{ #category : #accessing } -GtDeletionDiffChange >> gtObjectsText [ - ^ self objects asString asRopedText glamorousRegularFont - highlight: BrGlamorousColors errorBackgroundColor -] - { #category : #accessing } GtDeletionDiffChange >> highlightColor [ ^ BrGlamorousColors errorBackgroundColor diff --git a/src/GToolkit-Coder/GtDiffBuilder.class.st b/src/GToolkit-Coder/GtDiffBuilder.class.st index 95ce421c2..f156a9539 100644 --- a/src/GToolkit-Coder/GtDiffBuilder.class.st +++ b/src/GToolkit-Coder/GtDiffBuilder.class.st @@ -112,7 +112,10 @@ GtDiffBuilder >> computeDifferences [ self skipEqualElementsAtStart. self skipEqualElementsAtEnd. self buildDifferencesList. - ^ GtCompositeDiffChange forChanges: differences + ^ GtCompositeDiffChange + from: from + to: to + changes: differences ] { #category : #private } diff --git a/src/GToolkit-Coder/GtDiffChange.class.st b/src/GToolkit-Coder/GtDiffChange.class.st index 344bfab7f..e5b2f3640 100644 --- a/src/GToolkit-Coder/GtDiffChange.class.st +++ b/src/GToolkit-Coder/GtDiffChange.class.st @@ -4,6 +4,14 @@ Class { #category : #'GToolkit-Coder-Diff-Algorithm' } +{ #category : #formatting } +GtDiffChange >> applyAttributesToInput: aText [ +] + +{ #category : #formatting } +GtDiffChange >> applyAttributesToOutput: aText [ +] + { #category : #accessing } GtDiffChange >> deletedObjects [ ^ nil diff --git a/src/GToolkit-Coder/GtDiffSplit.class.st b/src/GToolkit-Coder/GtDiffSplit.class.st index 11c70eea2..c5ec3a310 100644 --- a/src/GToolkit-Coder/GtDiffSplit.class.st +++ b/src/GToolkit-Coder/GtDiffSplit.class.st @@ -23,6 +23,11 @@ GtDiffSplit >> object [ ^ self subclassResponsibility ] +{ #category : #accessing } +GtDiffSplit >> range [ + ^ self startIndex printString , '-' , self stopIndex printString +] + { #category : #accessing } GtDiffSplit >> source [ ^ source diff --git a/src/GToolkit-Coder/GtDiffSplitCollection.class.st b/src/GToolkit-Coder/GtDiffSplitCollection.class.st new file mode 100644 index 000000000..f92fc01fd --- /dev/null +++ b/src/GToolkit-Coder/GtDiffSplitCollection.class.st @@ -0,0 +1,51 @@ +Class { + #name : #GtDiffSplitCollection, + #superclass : #Object, + #instVars : [ + 'splits' + ], + #category : #'GToolkit-Coder-Diff-Algorithm' +} + +{ #category : #adding } +GtDiffSplitCollection >> addSplit: aGtDiffSplit [ + splits add: aGtDiffSplit +] + +{ #category : #accessing } +GtDiffSplitCollection >> at: anInteger [ + ^ splits at: anInteger +] + +{ #category : #accessing } +GtDiffSplitCollection >> gtLiveFor: aView [ + + ^ aView columnedList + title: 'Splits'; + items: [ self splits ]; + column: 'Range' + text: [ :each | each range ] + width: 100; + column: 'Value' text: [ :each | each object ] +] + +{ #category : #initialization } +GtDiffSplitCollection >> initialize [ + super initialize. + splits := OrderedCollection new +] + +{ #category : #accessing } +GtDiffSplitCollection >> size [ + ^ splits size +] + +{ #category : #accessing } +GtDiffSplitCollection >> splits [ + ^ splits +] + +{ #category : #accessing } +GtDiffSplitCollection >> splits: aCollection [ + splits := aCollection +] diff --git a/src/GToolkit-Coder/GtDiffSplitter.class.st b/src/GToolkit-Coder/GtDiffSplitter.class.st index 22b670f79..8871d4c07 100644 --- a/src/GToolkit-Coder/GtDiffSplitter.class.st +++ b/src/GToolkit-Coder/GtDiffSplitter.class.st @@ -9,5 +9,13 @@ Class { { #category : #actions } GtDiffSplitter >> split: aCollection [ + | splits | + splits := GtDiffSplitCollection new. + self split: aCollection into: splits. + ^ splits +] + +{ #category : #actions } +GtDiffSplitter >> split: aCollection into: aGtDiffSplits [ self subclassResponsibility ] diff --git a/src/GToolkit-Coder/GtInsertionDiffChange.class.st b/src/GToolkit-Coder/GtInsertionDiffChange.class.st index 2fb878fa5..ae445523c 100644 --- a/src/GToolkit-Coder/GtInsertionDiffChange.class.st +++ b/src/GToolkit-Coder/GtInsertionDiffChange.class.st @@ -5,9 +5,8 @@ Class { } { #category : #accessing } -GtInsertionDiffChange >> gtObjectsText [ - ^ self objects asString asRopedText glamorousRegularFont - highlight: BrGlamorousColors successBackgroundColor +GtInsertionDiffChange >> applyAttributesToOutput: aText [ + (aText from: self startIndex to: self stopIndex) highlight: self highlightColor ] { #category : #accessing } diff --git a/src/GToolkit-Coder/GtLineDiffSplitter.class.st b/src/GToolkit-Coder/GtLineDiffSplitter.class.st index a0444220b..f202bf741 100644 --- a/src/GToolkit-Coder/GtLineDiffSplitter.class.st +++ b/src/GToolkit-Coder/GtLineDiffSplitter.class.st @@ -24,15 +24,12 @@ GtLineDiffSplitter >> initialize [ ] { #category : #actions } -GtLineDiffSplitter >> split: aString [ - | splits | - splits := OrderedCollection new. +GtLineDiffSplitter >> split: aString into: aGtDiffSplits [ aString lineIndicesDo: [ :start :end :endWithEOL | - splits - add: (GtRangeDiffSplit + aGtDiffSplits + addSplit: (GtRangeDiffSplit on: aString from: start - to: (includeEOLChars ifTrue: [ endWithEOL ] ifFalse: [ end ])) ]. - ^ splits + to: (includeEOLChars ifTrue: [ endWithEOL ] ifFalse: [ end ])) ] ] diff --git a/src/GToolkit-Coder/GtNullDiffSplitter.class.st b/src/GToolkit-Coder/GtNullDiffSplitter.class.st index ee7fc86bd..69d3cd852 100644 --- a/src/GToolkit-Coder/GtNullDiffSplitter.class.st +++ b/src/GToolkit-Coder/GtNullDiffSplitter.class.st @@ -5,7 +5,8 @@ Class { } { #category : #actions } -GtNullDiffSplitter >> split: aCollection [ - ^ (1 to: aCollection size) - collect: [ :i | GtSingleObjectDiffSplit on: aCollection at: i ] +GtNullDiffSplitter >> split: aCollection into: aGtDiffSplits [ + 1 + to: aCollection size + do: [ :i | aGtDiffSplits addSplit: (GtSingleObjectDiffSplit on: aCollection at: i) ] ] diff --git a/src/GToolkit-Coder/GtReplacementDiffChange.class.st b/src/GToolkit-Coder/GtReplacementDiffChange.class.st index 0a2947dfb..42b9e766e 100644 --- a/src/GToolkit-Coder/GtReplacementDiffChange.class.st +++ b/src/GToolkit-Coder/GtReplacementDiffChange.class.st @@ -16,6 +16,16 @@ GtReplacementDiffChange class >> delete: aDeletionChange andInsert: anInsertionC yourself ] +{ #category : #formatting } +GtReplacementDiffChange >> applyAttributesToInput: aText [ + deletionChange applyAttributesToInput: aText +] + +{ #category : #formatting } +GtReplacementDiffChange >> applyAttributesToOutput: aText [ + insertionChange applyAttributesToOutput: aText +] + { #category : #accessing } GtReplacementDiffChange >> deletedObjects [ ^ deletionChange objects diff --git a/src/GToolkit-Coder/GtSmaCCDiffSplitter.class.st b/src/GToolkit-Coder/GtSmaCCDiffSplitter.class.st new file mode 100644 index 000000000..2a288b1d8 --- /dev/null +++ b/src/GToolkit-Coder/GtSmaCCDiffSplitter.class.st @@ -0,0 +1,39 @@ +Class { + #name : #GtSmaCCDiffSplitter, + #superclass : #GtDiffSplitter, + #instVars : [ + 'scannerClass' + ], + #category : #'GToolkit-Coder-Diff-Algorithm' +} + +{ #category : #accessing } +GtSmaCCDiffSplitter >> scannerClass [ + ^ scannerClass +] + +{ #category : #accessing } +GtSmaCCDiffSplitter >> scannerClass: aSmaCCScannerClass [ + scannerClass := aSmaCCScannerClass +] + +{ #category : #accessing } +GtSmaCCDiffSplitter >> split: aString into: aGtDiffSplits [ + | scanner commentIndex token | + scanner := scannerClass on: aString readStream. + commentIndex := 0. + [ token := scanner next. + [ commentIndex < scanner comments size ] + whileTrue: [ commentIndex := commentIndex + 1. + aGtDiffSplits + addSplit: (GtRangeDiffSplit + on: aString + from: (scanner comments at: commentIndex) first + to: (scanner comments at: commentIndex) last) ]. + token ids first ~= scanner emptySymbolTokenId ] + whileTrue: [ aGtDiffSplits + addSplit: (GtRangeDiffSplit + on: aString + from: token startPosition + to: token stopPosition) ] +] diff --git a/src/GToolkit-Coder/GtSourceDiffChange.class.st b/src/GToolkit-Coder/GtSourceDiffChange.class.st index 2e56506ad..8255744c7 100644 --- a/src/GToolkit-Coder/GtSourceDiffChange.class.st +++ b/src/GToolkit-Coder/GtSourceDiffChange.class.st @@ -33,6 +33,12 @@ GtSourceDiffChange >> gtLiveFor: aView [ stream contents ] ] +{ #category : #accessing } +GtSourceDiffChange >> gtObjectsText [ + ^ self objects asString asRopedText glamorousRegularFont + highlight: self highlightColor +] + { #category : #accessing } GtSourceDiffChange >> highlightColor [ ^ self subclassResponsibility From b6753e7c4dde565508031a0487837062d98288ae Mon Sep 17 00:00:00 2001 From: John Brant Date: Fri, 27 Jan 2023 07:32:05 -0600 Subject: [PATCH 0371/1268] adding list diff view for changes --- .../GtCompositeDiffChange.class.st | 73 +++++++++++++++++++ .../GtDeletionDiffChange.class.st | 10 +-- src/GToolkit-Coder/GtDiffBuilder.class.st | 38 +++++----- src/GToolkit-Coder/GtDiffChange.class.st | 10 +++ src/GToolkit-Coder/GtDiffSplit.class.st | 19 ++++- .../GtInsertionDiffChange.class.st | 8 +- .../GtSourceDiffChange.class.st | 7 +- 7 files changed, 135 insertions(+), 30 deletions(-) diff --git a/src/GToolkit-Coder/GtCompositeDiffChange.class.st b/src/GToolkit-Coder/GtCompositeDiffChange.class.st index 7de4042ca..7fbfb1f1f 100644 --- a/src/GToolkit-Coder/GtCompositeDiffChange.class.st +++ b/src/GToolkit-Coder/GtCompositeDiffChange.class.st @@ -45,6 +45,11 @@ GtCompositeDiffChange >> changes: aCollection [ changes := aCollection ] +{ #category : #iterating } +GtCompositeDiffChange >> deletionChangesDo: aBlock [ + changes do: [ :each | each deletionChangesDo: aBlock ] +] + { #category : #accessing } GtCompositeDiffChange >> from [ ^ from @@ -76,6 +81,69 @@ GtCompositeDiffChange >> gtChangeViewFor: aView [ column: 'Objects' text: [ :each | each gtObjectsText ] ] +{ #category : #inspecting } +GtCompositeDiffChange >> gtListView: aView [ + + from isString ifTrue: [ ^ aView empty ]. + ^ aView explicit + priority: 10; + title: 'List'; + stencil: [ | pane fromList toList deletedIndices insertedIndices | + deletedIndices := Set new. + self + deletionChangesDo: [ :each | deletedIndices addAll: (each startIndex to: each stopIndex) ]. + insertedIndices := Set new. + self + insertionChangesDo: [ :each | insertedIndices addAll: (each startIndex to: each stopIndex) ]. + pane := BrHorizontalPane new. + pane matchParent. + pane padding: (BlInsets all: 10). + fromList := BrColumnedList new. + fromList matchParent. + fromList column + width: 45; + title: 'Index'; + stencil: [ :each :i | + BrLabel new + aptitude: BrGlamorousLabelAptitude new; + text: (i asRopedText foreground: Color gray) ]. + fromList column + title: 'Value'; + stencil: [ :each :i | + | text | + text := each gtDisplayText. + (deletedIndices includes: i) + ifTrue: [ text highlight: GtDeletionDiffChange highlightColor ]. + BrLabel new + aptitude: BrGlamorousLabelAptitude new; + text: text ]. + fromList items: from. + toList := BrColumnedList new. + toList matchParent. + toList column + width: 45; + title: 'Index'; + stencil: [ :each :i | + BrLabel new + aptitude: BrGlamorousLabelAptitude new; + text: (i asRopedText foreground: Color gray) ]. + toList column + title: 'Value'; + stencil: [ :each :i | + | text | + text := each gtDisplayText. + (insertedIndices includes: i) + ifTrue: [ text highlight: GtInsertionDiffChange highlightColor ]. + BrLabel new + aptitude: BrGlamorousLabelAptitude new; + text: text ]. + toList items: to. + pane + addChild: fromList; + addChild: toList. + pane ] +] + { #category : #inspecting } GtCompositeDiffChange >> gtTextView: aView [ @@ -115,6 +183,11 @@ GtCompositeDiffChange >> initialize [ changes := #() ] +{ #category : #iterating } +GtCompositeDiffChange >> insertionChangesDo: aBlock [ + changes do: [ :each | each insertionChangesDo: aBlock ] +] + { #category : #accessing } GtCompositeDiffChange >> to [ ^ to diff --git a/src/GToolkit-Coder/GtDeletionDiffChange.class.st b/src/GToolkit-Coder/GtDeletionDiffChange.class.st index 4d665de1b..0a01ecdf9 100644 --- a/src/GToolkit-Coder/GtDeletionDiffChange.class.st +++ b/src/GToolkit-Coder/GtDeletionDiffChange.class.st @@ -4,6 +4,11 @@ Class { #category : #'GToolkit-Coder-Diff-Algorithm' } +{ #category : #accessing } +GtDeletionDiffChange class >> highlightColor [ + ^ BrGlamorousColors errorBackgroundColor +] + { #category : #accessing } GtDeletionDiffChange >> applyAttributesToInput: aText [ (aText from: self startIndex to: self stopIndex) highlight: self highlightColor @@ -19,11 +24,6 @@ GtDeletionDiffChange >> deletionChange [ ^ self ] -{ #category : #accessing } -GtDeletionDiffChange >> highlightColor [ - ^ BrGlamorousColors errorBackgroundColor -] - { #category : #testing } GtDeletionDiffChange >> isDeletion [ ^ true diff --git a/src/GToolkit-Coder/GtDiffBuilder.class.st b/src/GToolkit-Coder/GtDiffBuilder.class.st index f156a9539..e9c3ef567 100644 --- a/src/GToolkit-Coder/GtDiffBuilder.class.st +++ b/src/GToolkit-Coder/GtDiffBuilder.class.st @@ -59,11 +59,11 @@ GtDiffBuilder >> addInsertions [ ] { #category : #private } -GtDiffBuilder >> addInsertionsAndDeletionsIgnoring: commonElements [ +GtDiffBuilder >> addInsertionsAndDeletionsIgnoring [ [ fromStart <= fromEnd or: [ toStart <= toEnd ] ] whileTrue: [ | deletion insertion start end split | [ fromStart <= fromEnd - and: [ (commonElements includes: (split := fromSplits at: fromStart)) not ] ] + and: [ (split := fromSplits at: fromStart) hasMatch not ] ] whileTrue: [ start ifNil: [ start := split startIndex ]. end := split stopIndex. fromStart := fromStart + 1 ]. @@ -73,8 +73,7 @@ GtDiffBuilder >> addInsertionsAndDeletionsIgnoring: commonElements [ from: start to: end ]. start := nil. - [ toStart <= toEnd - and: [ (commonElements includes: (split := toSplits at: toStart)) not ] ] + [ toStart <= toEnd and: [ (split := toSplits at: toStart) hasMatch not ] ] whileTrue: [ start ifNil: [ start := split startIndex ]. end := split stopIndex. toStart := toStart + 1 ]. @@ -89,10 +88,9 @@ GtDiffBuilder >> addInsertionsAndDeletionsIgnoring: commonElements [ ifNil: [ differences add: deletion ] ifNotNil: [ differences add: (GtReplacementDiffChange delete: deletion andInsert: insertion) ] ]. - [ fromStart <= fromEnd - and: [ commonElements includes: (fromSplits at: fromStart) ] ] + [ fromStart <= fromEnd and: [ (fromSplits at: fromStart) hasMatch ] ] whileTrue: [ fromStart := fromStart + 1 ]. - [ toStart <= toEnd and: [ commonElements includes: (toSplits at: toStart) ] ] + [ toStart <= toEnd and: [ (toSplits at: toStart) hasMatch ] ] whileTrue: [ toStart := toStart + 1 ] ] ] @@ -139,15 +137,14 @@ GtDiffBuilder >> computeLCSElements [ | value | (filter includes: (value := fromSplits at: i)) ifTrue: [ filteredFrom add: value ] ]. - commonElements := self computeLCSElementsBetween: filteredFrom and: filteredTo. - self addInsertionsAndDeletionsIgnoring: commonElements + self computeLCSElementsBetween: filteredFrom and: filteredTo. + self addInsertionsAndDeletionsIgnoring ] { #category : #private } GtDiffBuilder >> computeLCSElementsBetween: filteredFrom and: filteredTo [ - | map fromNumbers toNumbers common lcs | - common := IdentitySet new. - (filteredFrom isEmpty or: [ filteredTo isEmpty ]) ifTrue: [ ^ common ]. + | map fromNumbers toNumbers lcs | + (filteredFrom isEmpty or: [ filteredTo isEmpty ]) ifTrue: [ ^ self ]. map := Dictionary new. fromNumbers := filteredFrom collect: [ :each | map at: each ifAbsentPut: [ map size ] ]. @@ -155,11 +152,9 @@ GtDiffBuilder >> computeLCSElementsBetween: filteredFrom and: filteredTo [ collect: [ :each | map at: each ifAbsentPut: [ map size ] ]. lcs := self lcsFor: fromNumbers and: toNumbers. [ lcs notNil ] - whileTrue: [ common - add: (filteredFrom at: lcs first); - add: (filteredTo at: lcs second). - lcs := lcs last ]. - ^ common + whileTrue: [ (filteredFrom at: lcs first) match. + (filteredTo at: lcs second) match. + lcs := lcs last ] ] { #category : #accessing } @@ -223,11 +218,16 @@ GtDiffBuilder >> skipEqualElementsAtEnd [ { #category : #private } GtDiffBuilder >> skipEqualElementsAtStart [ + | fromObject toObject | fromStart := 1. [ fromStart <= fromSplits size and: [ fromStart <= toSplits size - and: [ (fromSplits at: fromStart) = (toSplits at: fromStart) ] ] ] - whileTrue: [ fromStart := fromStart + 1 ]. + and: [ fromObject := fromSplits at: fromStart. + toObject := toSplits at: fromStart. + fromObject = toObject ] ] ] + whileTrue: [ fromObject match. + toObject match. + fromStart := fromStart + 1 ]. toStart := fromStart ] diff --git a/src/GToolkit-Coder/GtDiffChange.class.st b/src/GToolkit-Coder/GtDiffChange.class.st index e5b2f3640..d702cf6a2 100644 --- a/src/GToolkit-Coder/GtDiffChange.class.st +++ b/src/GToolkit-Coder/GtDiffChange.class.st @@ -22,6 +22,11 @@ GtDiffChange >> deletionChange [ ^ nil ] +{ #category : #iterating } +GtDiffChange >> deletionChangesDo: aBlock [ + self deletionChange ifNotNil: aBlock +] + { #category : #accessing } GtDiffChange >> gtObjectsText [ ^ '' asRopedText @@ -37,6 +42,11 @@ GtDiffChange >> insertionChange [ ^ nil ] +{ #category : #iterating } +GtDiffChange >> insertionChangesDo: aBlock [ + self insertionChange ifNotNil: aBlock +] + { #category : #testing } GtDiffChange >> isDeletion [ ^ false diff --git a/src/GToolkit-Coder/GtDiffSplit.class.st b/src/GToolkit-Coder/GtDiffSplit.class.st index c5ec3a310..8f7a4b176 100644 --- a/src/GToolkit-Coder/GtDiffSplit.class.st +++ b/src/GToolkit-Coder/GtDiffSplit.class.st @@ -3,7 +3,8 @@ Class { #superclass : #Object, #instVars : [ 'source', - 'startIndex' + 'startIndex', + 'matched' ], #category : #'GToolkit-Coder-Diff-Algorithm' } @@ -13,11 +14,27 @@ GtDiffSplit >> = anObject [ ^ self class = anObject class ifTrue: [ self object = anObject object ] ] +{ #category : #testing } +GtDiffSplit >> hasMatch [ + ^ matched +] + { #category : #comparing } GtDiffSplit >> hash [ ^ self object hash ] +{ #category : #initialization } +GtDiffSplit >> initialize [ + super initialize. + matched := false +] + +{ #category : #accessing } +GtDiffSplit >> match [ + matched := true +] + { #category : #accessing } GtDiffSplit >> object [ ^ self subclassResponsibility diff --git a/src/GToolkit-Coder/GtInsertionDiffChange.class.st b/src/GToolkit-Coder/GtInsertionDiffChange.class.st index ae445523c..f4266da27 100644 --- a/src/GToolkit-Coder/GtInsertionDiffChange.class.st +++ b/src/GToolkit-Coder/GtInsertionDiffChange.class.st @@ -5,13 +5,13 @@ Class { } { #category : #accessing } -GtInsertionDiffChange >> applyAttributesToOutput: aText [ - (aText from: self startIndex to: self stopIndex) highlight: self highlightColor +GtInsertionDiffChange class >> highlightColor [ + ^ BrGlamorousColors successBackgroundColor ] { #category : #accessing } -GtInsertionDiffChange >> highlightColor [ - ^ BrGlamorousColors successBackgroundColor +GtInsertionDiffChange >> applyAttributesToOutput: aText [ + (aText from: self startIndex to: self stopIndex) highlight: self highlightColor ] { #category : #accessing } diff --git a/src/GToolkit-Coder/GtSourceDiffChange.class.st b/src/GToolkit-Coder/GtSourceDiffChange.class.st index 8255744c7..70ddca612 100644 --- a/src/GToolkit-Coder/GtSourceDiffChange.class.st +++ b/src/GToolkit-Coder/GtSourceDiffChange.class.st @@ -9,6 +9,11 @@ Class { #category : #'GToolkit-Coder-Diff-Algorithm' } +{ #category : #accessing } +GtSourceDiffChange class >> highlightColor [ + ^ self subclassResponsibility +] + { #category : #'instance creation' } GtSourceDiffChange class >> on: aCollection from: startIndex to: stopIndex [ ^ self new @@ -41,7 +46,7 @@ GtSourceDiffChange >> gtObjectsText [ { #category : #accessing } GtSourceDiffChange >> highlightColor [ - ^ self subclassResponsibility + ^ self class highlightColor ] { #category : #accessing } From 9118eecfacf063f11b3063cb227780ab3af42454 Mon Sep 17 00:00:00 2001 From: Andrei Chis Date: Fri, 27 Jan 2023 15:04:33 +0100 Subject: [PATCH 0372/1268] Add a reson to GtCoderSourceCodeChanged [feenkcom/gtoolkit#2503] --- .../GtTextualCoderEditorElement.class.st | 13 ++++++++- .../GtTextualCoderViewModel.class.st | 12 ++++++++- .../GtCoderSourceCodeChanged.class.st | 13 ++++++++- src/GToolkit-Coder/GtTextualCoder.class.st | 27 +++++++++++++++---- 4 files changed, 57 insertions(+), 8 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 8ed7a2b5c..d14a619df 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -91,7 +91,7 @@ GtTextualCoderEditorElement >> initializeListeners [ self editor when: BrTextEditorModifiedEvent - do: [ :anEvent | self onTextModified ]. + do: [ :anEvent | self onTextModifiedDueToEvent: anEvent ]. self editor when: BrTextEditorCursorChangedEvent @@ -230,6 +230,17 @@ GtTextualCoderEditorElement >> onTextModified [ synchronously: true ] +{ #category : #'private - event handling' } +GtTextualCoderEditorElement >> onTextModifiedDueToEvent: aTextModifiedEvent [ + "Is sent when the text changes in the editor. Here we should synchronise the UI and the model. We also receive the event, which can contain the type of change." + + self textualCoderViewModel + sourceText: self text + from: self + synchronously: true + dueToEvent: aTextModifiedEvent +] + { #category : #'api - textual coder view model' } GtTextualCoderEditorElement >> onTextualCoderViewModelChanged [ "Is sent when a new textualCoder view model is assigned to the element. diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 1efb31552..63f7d5148 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -705,12 +705,22 @@ GtTextualCoderViewModel >> sourceText [ ] { #category : #'api - text' } -GtTextualCoderViewModel >> sourceText: aNewSourceText from: aSourceObject synchronously: isSynchronous [ +GtTextualCoderViewModel >> sourceText: aNewSourceText from: aSourceObject synchronously: isSynchronous [ + self + sourceText: aNewSourceText + from: aSourceObject + synchronously: isSynchronous + dueToEvent: nil +] + +{ #category : #'api - text' } +GtTextualCoderViewModel >> sourceText: aNewSourceText from: aSourceObject synchronously: isSynchronous dueToEvent: aTextModifiedEvent [ self coderModel currentSourceText: aNewSourceText with: (GtCoderUpdateStrategy new source: aSourceObject; isSynchronous: isSynchronous) + dueTo: aTextModifiedEvent ] { #category : #'api - styled text' } diff --git a/src/GToolkit-Coder/GtCoderSourceCodeChanged.class.st b/src/GToolkit-Coder/GtCoderSourceCodeChanged.class.st index 37e8d5b25..f281639a2 100644 --- a/src/GToolkit-Coder/GtCoderSourceCodeChanged.class.st +++ b/src/GToolkit-Coder/GtCoderSourceCodeChanged.class.st @@ -9,7 +9,8 @@ Class { #instVars : [ 'updateStragegy', 'newText', - 'previousText' + 'previousText', + 'reason' ], #category : #'GToolkit-Coder-Event' } @@ -42,6 +43,16 @@ GtCoderSourceCodeChanged >> previousText: aText [ previousText := aText ] +{ #category : #accessing } +GtCoderSourceCodeChanged >> reason [ + ^ reason +] + +{ #category : #accessing } +GtCoderSourceCodeChanged >> reason: anObject [ + reason := anObject +] + { #category : #accessing } GtCoderSourceCodeChanged >> source [ ^ self updateStrategy source diff --git a/src/GToolkit-Coder/GtTextualCoder.class.st b/src/GToolkit-Coder/GtTextualCoder.class.st index 3c8bb0b01..df612df2c 100644 --- a/src/GToolkit-Coder/GtTextualCoder.class.st +++ b/src/GToolkit-Coder/GtTextualCoder.class.st @@ -146,6 +146,16 @@ GtTextualCoder >> currentSourceText: aText [ GtTextualCoder >> currentSourceText: aText with: aGtCoderUpdateStragegy [ "Set a new source text" + self + currentSourceText: aText + with: aGtCoderUpdateStragegy + dueTo: nil +] + +{ #category : #'api - text' } +GtTextualCoder >> currentSourceText: aText with: aGtCoderUpdateStragegy dueTo: aReason [ + "Set a new source text, giving also a reason for the change" + self critical: [ | previousSourceText| previousSourceText := self currentSourceText copy. @@ -153,7 +163,8 @@ GtTextualCoder >> currentSourceText: aText with: aGtCoderUpdateStragegy [ self sourceChangedTo: aText from: previousSourceText - with: aGtCoderUpdateStragegy ] + with: aGtCoderUpdateStragegy + dueTo: aReason ] ] { #category : #'api - text' } @@ -213,14 +224,15 @@ GtTextualCoder >> notifyCorrectionFrom: aFromIndex to: aToIndex with: aString [ ] { #category : #'private - notifying' } -GtTextualCoder >> notifySourceChangedTo: aNewText from: aPreviousText with: anUpdateStragegy [ +GtTextualCoder >> notifySourceChangedTo: aNewText from: aPreviousText with: anUpdateStragegy dueTo: aReason [ "Notify the text editor that it should update the text (for example due to refactoring changes)" self announce: (GtCoderSourceCodeChanged new updateStrategy: anUpdateStragegy; newText: aNewText; previousText: aPreviousText; - coder: self) + coder: self; + reason: aReason) ] { #category : #'private - notifying' } @@ -268,17 +280,22 @@ GtTextualCoder >> sourceChangedTo: aNewText [ ] { #category : #'event handling' } -GtTextualCoder >> sourceChangedTo: aNewText from: aPreviousText with: anUpdateStrategy [ +GtTextualCoder >> sourceChangedTo: aNewText from: aPreviousText with: anUpdateStrategy dueTo: aReason [ astPromise := nil. self notifySourceChangedTo: aNewText from: aPreviousText with: anUpdateStrategy + dueTo: aReason ] { #category : #'event handling' } GtTextualCoder >> sourceChangedTo: aNewText with: anUpdateStrategy [ - self sourceChangedTo: aNewText from: nil with: anUpdateStrategy + self + sourceChangedTo: aNewText + from: nil + with: anUpdateStrategy + dueTo: nil ] { #category : #'api - accessing' } From dba0b5a6afd0f18867e4f4c7b633755f0ffa365f Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Fri, 27 Jan 2023 22:59:45 +0100 Subject: [PATCH 0373/1268] UseElementCreated to select first field [feenkcom/gtoolkit#2966] --- src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index 4ade2b34f..96c65c45b 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -86,7 +86,9 @@ GtCoderNavigationTabsStencil >> gtCreationInterface: look [ onAccept: [ :anInstance | look inUIProcessDo: [ form selectInNavigationModel: navigationModel anInstance: anInstance. - look fireEvent: BrDropdownHideWish new ] ]) asElement + look fireEvent: BrDropdownHideWish new ] ]; + onElementCreated: [ :aFrame | (aFrame childNamed: #field) requestFocus ]) + asElement addShortcut: (BlShortcutWithAction new combination: BlKeyCombination escape; overrideChildren: true; From 6140742f1dcea1e358661f6aa9cdaa10559fa6b9 Mon Sep 17 00:00:00 2001 From: John Brant Date: Fri, 27 Jan 2023 13:41:05 -0600 Subject: [PATCH 0374/1268] starting diff viewer --- .../GtDiffBuilderExamples.class.st | 31 ++ src/GToolkit-Coder-UI/GtDiffElement1.class.st | 388 ++++++++++++++++++ .../GtDiffFlatAptitude.class.st | 17 + .../GtSyncScrollRange.class.st | 57 ++- .../GtSyncScrollRanges1.class.st | 271 ++++++++++++ .../GtDeletionDiffChange.class.st | 19 +- src/GToolkit-Coder/GtDiffBuilder.class.st | 36 +- .../GtInsertionDiffChange.class.st | 19 +- 8 files changed, 825 insertions(+), 13 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtDiffElement1.class.st create mode 100644 src/GToolkit-Coder-UI/GtSyncScrollRanges1.class.st diff --git a/src/GToolkit-Coder-Examples/GtDiffBuilderExamples.class.st b/src/GToolkit-Coder-Examples/GtDiffBuilderExamples.class.st index 0a1803047..821d9280a 100644 --- a/src/GToolkit-Coder-Examples/GtDiffBuilderExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtDiffBuilderExamples.class.st @@ -55,6 +55,7 @@ GtDiffBuilderExamples >> deletionsInMiddle [ self assert: differences first isDeletion. self assert: differences first startIndex equals: 9. self assert: differences first stopIndex equals: 12. + self assert: differences first newIndex equals: 9. ^ change ] @@ -109,6 +110,7 @@ GtDiffBuilderExamples >> insertionsInMiddle [ self assert: differences first isInsertion. self assert: differences first startIndex equals: 9. self assert: differences first stopIndex equals: 12. + self assert: differences first originalIndex equals: 9. ^ change ] @@ -197,6 +199,35 @@ GtDiffBuilderExamples >> replacementInMiddle [ ^ change ] +{ #category : #examples } +GtDiffBuilderExamples >> reversedTokenChanges [ + + | differences from to change scannerClass | + scannerClass := self class environment at: #GtPharoScanner ifAbsent: [ ^ nil ]. + to := 'method: arg ^self inject: arg into: [:sum :each | sum + each]'. + from := 'method: arg1 + ^ self + inject: arg1 + into: [:sum :each | (sum + each)]'. + change := GtDiffBuilder + computeDifferencesFrom: from + to: to + using: (GtSmaCCDiffSplitter new scannerClass: scannerClass). + differences := change changes. + self assert: differences size equals: 4. + self assert: differences first isReplacement. + self assert: differences first deletionChange objects equals: 'arg1'. + self assert: differences first insertionChange objects equals: 'arg'. + self assert: differences second isReplacement. + self assert: differences second deletionChange objects equals: 'arg1'. + self assert: differences second insertionChange objects equals: 'arg'. + self assert: differences third isDeletion. + self assert: differences third objects equals: '('. + self assert: differences fourth isDeletion. + self assert: differences fourth objects equals: ')'. + ^ change +] + { #category : #examples } GtDiffBuilderExamples >> tokenChanges [ diff --git a/src/GToolkit-Coder-UI/GtDiffElement1.class.st b/src/GToolkit-Coder-UI/GtDiffElement1.class.st new file mode 100644 index 000000000..2f7541a73 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtDiffElement1.class.st @@ -0,0 +1,388 @@ +Class { + #name : #GtDiffElement1, + #superclass : #BlElement, + #traits : 'TBrLayoutResizable + TBrSizeAdjustable', + #classTraits : 'TBrLayoutResizable classTrait + TBrSizeAdjustable classTrait', + #instVars : [ + 'leftElement', + 'rightElement', + 'syncScrollRanges', + 'outlines', + 'separatorElement', + 'compositeChange', + 'styler' + ], + #category : #'GToolkit-Coder-UI-Diff' +} + +{ #category : #examples } +GtDiffElement1 class >> example [ + + + ^ self on: self exampleDiff +] + +{ #category : #examples } +GtDiffElement1 class >> exampleDiff [ + + ^ GtDiffBuilder + computeDifferencesFrom: self originalString + to: self newString + using: GtCharacterGroupDiffSplitter words ignoreWhitespace +] + +{ #category : #examples } +GtDiffElement1 class >> exampleFlat [ + + + ^ (self on: self exampleDiff) aptitude: GtDiffFlatAptitude +] + +{ #category : #examples } +GtDiffElement1 class >> exampleShadow [ + + + ^ (self on: self exampleDiff) aptitude: GtDiffShadowAptitude +] + +{ #category : #examples } +GtDiffElement1 class >> newString [ + + ^ String + streamContents: [ :str | + 1 to: 1000 by: 6 do: [ :i | + str + print: i; + cr; + print: i + 1; + cr; + print: i + 2; + cr ] ] +] + +{ #category : #'instance creation' } +GtDiffElement1 class >> on: aCompositeDiffChange [ + ^ self new + change: aCompositeDiffChange; + yourself +] + +{ #category : #examples } +GtDiffElement1 class >> originalString [ + + ^ String + streamContents: [ :str | + 1 to: 1000 by: 5 do: [ :i | + str + print: i; + cr; + print: i + 1; + cr; + print: i + 2; + cr ] ] +] + +{ #category : #private } +GtDiffElement1 >> buildInterface [ + syncScrollRanges := GtSyncScrollRanges1 createFromChanges: compositeChange. + + self updateOutlines +] + +{ #category : #initialize } +GtDiffElement1 >> change: aCompositeDiffChange [ + compositeChange := aCompositeDiffChange. + leftElement text: self previousRopedText. + rightElement text: self newRopedText. + self buildInterface +] + +{ #category : #'event handling' } +GtDiffElement1 >> drawMeAndChildrenOnSpartaCanvas: aCanvas [ + | stroke fill | + super drawMeAndChildrenOnSpartaCanvas: aCanvas. + stroke := aCanvas stroke + alpha: 0.2; + paint: Color black; + width: 1. + fill := aCanvas fill + alpha: 0.2; + paint: Color yellow. + outlines + do: [ :each | + fill + path: (each pathOnSpartaCanvas: aCanvas of: self); + draw. + stroke + path: (each pathOnSpartaCanvas: aCanvas of: self); + draw ] +] + +{ #category : #initialize } +GtDiffElement1 >> editorLook [ + ^ BrGlamorousCodeEditorAptitude +] + +{ #category : #initialize } +GtDiffElement1 >> initialize [ + super initialize. + + self layout: BlLinearLayout horizontal. + self matchParent. + + self beNormalSize. + + outlines := #(). + + leftElement := self newTextElement + id: GtDiffOldTextId; + when: BlElementScrolledEvent do: [ :e | self leftScrolled ]. + + rightElement := self newTextElement + id: GtDiffNewTextId; + when: BlElementScrolledEvent do: [ :e | self rightScrolled ]. + + separatorElement := self newSeparatorElement + id: GtDiffSeparatorId. + + self addChildren: { + leftElement. + separatorElement. + rightElement + }. +] + +{ #category : #'event handling' } +GtDiffElement1 >> leftBottomFor: anInteger [ + | range element | + range := self leftRange. + anInteger < range first ifTrue: [ ^ 0 ]. + anInteger > range last ifTrue: [ ^ self height ]. + element := leftElement children at: anInteger - range first + 1. + ^ element bounds bottom + leftElement bounds top max: 0 +] + +{ #category : #accessing } +GtDiffElement1 >> leftEditorLook: aLook [ + leftElement aptitude: aLook +] + +{ #category : #private } +GtDiffElement1 >> leftRange [ + | first | + first := ((leftElement instVarNamed: 'layoutPositionsRange') + ifNil: [ 1 ] + ifNotNil: [ :interval | interval first ]) max: 1. + ^ first to: first + leftElement children size - 1 +] + +{ #category : #'event handling' } +GtDiffElement1 >> leftScrolled [ + | newPosition | + newPosition := syncScrollRanges rightLineFor: self leftRange first. + + (self rightRange includes: newPosition) + ifTrue: [ | offset | + offset := rightElement children first bounds position y. + 1 to: newPosition - self rightRange first do: [ :i | offset := offset + (rightElement children at: i) height ]. + "rightElement scrollBy: 0@offset" ] + ifFalse: [ "rightElement scrollToPosition: newPosition" ]. + + self updateOutlines +] + +{ #category : #accessing } +GtDiffElement1 >> leftStyler: aStyler [ + leftElement editor styler: aStyler +] + +{ #category : #'event handling' } +GtDiffElement1 >> leftTopFor: anInteger [ + | range element | + range := self leftRange. + anInteger < range first ifTrue: [ ^ 0 ]. + anInteger > range last ifTrue: [ ^ self height ]. + element := leftElement children at: anInteger - range first + 1. + ^ element bounds top + leftElement bounds top max: 0 +] + +{ #category : #private } +GtDiffElement1 >> newRopedText [ + | text | + text := compositeChange to asRopedText glamorousCodeFont. + compositeChange applyAttributesToOutput: text. + ^ text +] + +{ #category : #initialize } +GtDiffElement1 >> newSeparatorElement [ + ^ BlElement new + constraintsDo: [ :c | + c vertical matchParent. + c horizontal exact: 0 ] + yourself +] + +{ #category : #initialize } +GtDiffElement1 >> newTextElement [ + ^ BrEditor new + focusability: BlFocusability none; + beReadOnlyWithSelection; + matchParent; + aptitude: self editorLook +] + +{ #category : #'geometry hooks' } +GtDiffElement1 >> onExtentChanged [ + super onExtentChanged. + + outlines := #(). + self updateOutlines +] + +{ #category : #'geometry hooks' } +GtDiffElement1 >> onLayout: aBounds context: aBlElementBoundsUpdateContext [ + super onLayout: aBounds context: aBlElementBoundsUpdateContext. + + outlines := #(). + self updateOutlines +] + +{ #category : #'event handling' } +GtDiffElement1 >> outlineFor: aSyncScrollRange [ + | leftTop leftBottom rightTop rightBottom vertices leftBounds rightBounds | + leftTop := self leftTopFor: aSyncScrollRange leftFirst + 1. + leftBottom := self leftBottomFor: aSyncScrollRange leftLast. + rightTop := self rightTopFor: aSyncScrollRange rightFirst + 1. + rightBottom := self rightBottomFor: aSyncScrollRange rightLast. + leftBounds := leftElement bounds. + rightBounds := rightElement bounds. + vertices := OrderedCollection new: 9. + vertices + add: leftBounds left @ leftTop; + add: leftBounds right @ leftTop; + add: rightBounds left @ rightTop; + add: rightBounds right @ rightTop; + add: rightBounds right @ rightBottom; + add: rightBounds left @ rightBottom; + add: leftBounds right @ leftBottom; + add: leftBounds left @ leftBottom; + add: leftBounds left @ leftTop. + ^ BlPolyline vertices: vertices +] + +{ #category : #'event handling' } +GtDiffElement1 >> paintMeAndChildrenOn: aCompositorPainter offset: anOffset [ + | aCanvas stroke fill | + super paintMeAndChildrenOn: aCompositorPainter offset: anOffset. + + aCanvas := aCompositorPainter canvas. + + aCanvas transform + by: [ :t | t translateBy: anOffset ] + during: [ + stroke := aCanvas stroke + alpha: 0.2; + paint: Color black; + width: 1. + fill := aCanvas fill + alpha: 0.2; + paint: Color yellow. + outlines + do: [ :each | + fill + path: (each pathOnSpartaCanvas: aCanvas of: self); + draw. + stroke + path: (each pathOnSpartaCanvas: aCanvas of: self); + draw ] ] +] + +{ #category : #private } +GtDiffElement1 >> previousRopedText [ + | text | + text := compositeChange from asRopedText glamorousCodeFont. + compositeChange applyAttributesToInput: text. + ^ text +] + +{ #category : #'event handling' } +GtDiffElement1 >> rightBottomFor: anInteger [ + | range element | + range := self rightRange. + anInteger < range first ifTrue: [ ^ 0 ]. + anInteger > range last ifTrue: [ ^ self height ]. + element := rightElement children at: anInteger - range first + 1. + ^ element bounds bottom + rightElement bounds top max: 0 +] + +{ #category : #accessing } +GtDiffElement1 >> rightEditorLook: aLook [ + rightElement aptitude: aLook +] + +{ #category : #private } +GtDiffElement1 >> rightRange [ + | first | + first := ((rightElement instVarNamed: 'layoutPositionsRange') + ifNil: [ 1 ] + ifNotNil: [ :interval | interval first ]) max: 1. + ^ first to: first + rightElement children size - 1 +] + +{ #category : #'event handling' } +GtDiffElement1 >> rightScrolled [ + | newPosition | + newPosition := syncScrollRanges leftLineFor: self rightRange first. + + (self leftRange includes: newPosition) + ifTrue: [ | offset | + offset := leftElement children first bounds position y. + 1 to: newPosition - self leftRange first do: [ :i | offset := offset + (leftElement children at: i) height ]. + "leftElement scrollBy: 0@ offset" ] + ifFalse: [ "leftElement scrollToPosition: newPosition" ]. + + self updateOutlines +] + +{ #category : #accessing } +GtDiffElement1 >> rightStyler: aStyler [ + rightElement editor styler: aStyler +] + +{ #category : #'event handling' } +GtDiffElement1 >> rightTopFor: anInteger [ + | range element | + range := self rightRange. + anInteger < range first ifTrue: [ ^ 0 ]. + anInteger > range last ifTrue: [ ^ self height ]. + element := rightElement children at: anInteger - range first + 1. + ^ element bounds top + rightElement bounds top max: 0 +] + +{ #category : #accessing } +GtDiffElement1 >> styler [ + ^ styler +] + +{ #category : #accessing } +GtDiffElement1 >> styler: anObject [ + styler := anObject. + styler + ifNotNil: [ leftElement styler: styler. + rightElement styler: styler ] +] + +{ #category : #'event handling' } +GtDiffElement1 >> updateOutlines [ + | ranges | + outlines := OrderedCollection new. + ranges := syncScrollRanges + rangesForLeft: self leftRange + andRight: self rightRange. + ranges + do: [ :each | + each isDifference + ifTrue: [ outlines add: (self outlineFor: each) ] ]. + self invalidate +] diff --git a/src/GToolkit-Coder-UI/GtDiffFlatAptitude.class.st b/src/GToolkit-Coder-UI/GtDiffFlatAptitude.class.st index e5ba4cd04..1a356ebb2 100644 --- a/src/GToolkit-Coder-UI/GtDiffFlatAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtDiffFlatAptitude.class.st @@ -13,10 +13,27 @@ GtDiffFlatAptitude >> initialize [ inherit: GtDiffOldTextId; inherit: GtDiffNewTextId). + self add: (BrSizeAdjustmentAptitude new + normal: [ :aStyle | aStyle padding: (BlInsets all: 10) ]; + small: [ :aStyle | aStyle padding: (BlInsets all: 8) ]; + tiny: [ :aStyle | aStyle padding: (BlInsets all: 6) ]; + mini: [ :aStyle | aStyle padding: (BlInsets all: 6) ]). + + self add: (self newSeparatorLook // GtDiffSeparatorId). + self add: (self newTextLook // GtDiffOldTextId). self add: (self newTextLook // GtDiffNewTextId) ] +{ #category : #accessing } +GtDiffFlatAptitude >> newSeparatorLook [ + ^ BrSizeAdjustmentAptitude new + normal: [ :aStyle | aStyle hExact: 40 ]; + small: [ :aStyle | aStyle hExact: 25 ]; + tiny: [ :aStyle | aStyle hExact: 20 ]; + mini: [ :aStyle | aStyle hExact: 10 ] +] + { #category : #'instance creation' } GtDiffFlatAptitude >> newTextLook [ ^ BrSizeAdjustmentAptitude new diff --git a/src/GToolkit-Coder-UI/GtSyncScrollRange.class.st b/src/GToolkit-Coder-UI/GtSyncScrollRange.class.st index 673f672b5..f82555511 100644 --- a/src/GToolkit-Coder-UI/GtSyncScrollRange.class.st +++ b/src/GToolkit-Coder-UI/GtSyncScrollRange.class.st @@ -8,7 +8,7 @@ Class { 'rightLast', 'isDifference' ], - #category : 'GToolkit-Coder-UI-Diff' + #category : #'GToolkit-Coder-UI-Diff' } { #category : #'instance creation' } @@ -18,6 +18,16 @@ GtSyncScrollRange class >> left: leftInteger right: rightInteger [ yourself ] +{ #category : #'instance creation' } +GtSyncScrollRange class >> leftFirst: leftFirst leftLast: leftLast rightFirst: rightFirst rightLast: rightLast [ + ^ self new + leftFirst: leftFirst; + leftLast: leftLast; + rightFirst: rightFirst; + rightLast: rightLast; + yourself +] + { #category : #syncing } GtSyncScrollRange >> advanceBoth [ self leftSize = self rightSize @@ -51,6 +61,11 @@ GtSyncScrollRange >> advanceRight [ yourself ] +{ #category : #accessing } +GtSyncScrollRange >> beDifferent [ + isDifference := true +] + { #category : #'initialize-release' } GtSyncScrollRange >> initialize [ super initialize. @@ -79,16 +94,41 @@ GtSyncScrollRange >> leftFirst [ ^ leftFirst ] +{ #category : #accessing } +GtSyncScrollRange >> leftFirst: anInteger [ + leftFirst := anInteger +] + { #category : #accessing } GtSyncScrollRange >> leftLast [ ^ leftLast ] +{ #category : #accessing } +GtSyncScrollRange >> leftLast: anInteger [ + leftLast := anInteger +] + +{ #category : #accessing } +GtSyncScrollRange >> leftRangeDisplayString [ + ^ leftFirst printString , '-' , leftLast printString +] + { #category : #accessing } GtSyncScrollRange >> leftSize [ ^ leftLast - leftFirst ] +{ #category : #'initialize-release' } +GtSyncScrollRange >> markDifferent [ + isDifference := true +] + +{ #category : #'initialize-release' } +GtSyncScrollRange >> markSame [ + isDifference := false +] + { #category : #syncing } GtSyncScrollRange >> mergeWith: aRange [ leftFirst := leftFirst min: aRange leftFirst. @@ -128,11 +168,26 @@ GtSyncScrollRange >> rightFirst [ ^ rightFirst ] +{ #category : #accessing } +GtSyncScrollRange >> rightFirst: anInteger [ + rightFirst := anInteger +] + { #category : #accessing } GtSyncScrollRange >> rightLast [ ^ rightLast ] +{ #category : #accessing } +GtSyncScrollRange >> rightLast: anInteger [ + rightLast := anInteger +] + +{ #category : #accessing } +GtSyncScrollRange >> rightRangeDisplayString [ + ^ rightFirst printString , '-' , rightLast printString +] + { #category : #accessing } GtSyncScrollRange >> rightSize [ ^ rightLast - rightFirst diff --git a/src/GToolkit-Coder-UI/GtSyncScrollRanges1.class.st b/src/GToolkit-Coder-UI/GtSyncScrollRanges1.class.st new file mode 100644 index 000000000..5800887b6 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSyncScrollRanges1.class.st @@ -0,0 +1,271 @@ +Class { + #name : #GtSyncScrollRanges1, + #superclass : #Object, + #instVars : [ + 'ranges' + ], + #category : #'GToolkit-Coder-UI-Diff' +} + +{ #category : #'instance creation' } +GtSyncScrollRanges1 class >> createFromChanges: aCompositeChange [ + | syncScroll | + syncScroll := self new. + syncScroll buildFromChanges: aCompositeChange. + ^ syncScroll +] + +{ #category : #examples } +GtSyncScrollRanges1 class >> example [ + + ^ self createFromChanges: self exampleDiff +] + +{ #category : #examples } +GtSyncScrollRanges1 class >> exampleDiff [ + + ^ GtDiffBuilder + computeDifferencesFrom: self originalString + to: self newString + using: GtCharacterGroupDiffSplitter words +] + +{ #category : #examples } +GtSyncScrollRanges1 class >> multilineCode [ + + | change ranges | + change := GtDiffBuilderExamples new tokenChanges. + ranges := self createFromChanges: change. + self assert: ranges ranges size equals: 1. + ^ ranges +] + +{ #category : #examples } +GtSyncScrollRanges1 class >> newString [ + + ^ '1 +4 +5 +6 +7 +8 +9' +] + +{ #category : #examples } +GtSyncScrollRanges1 class >> originalString [ + + ^ '1 +2 +3 +5 +6 +7 +9 +10' +] + +{ #category : #examples } +GtSyncScrollRanges1 class >> reversedMultilineCode [ + + | change ranges | + change := GtDiffBuilderExamples new reversedTokenChanges. + ranges := self createFromChanges: change. + self assert: ranges ranges size equals: 1. + ^ ranges +] + +{ #category : #initialization } +GtSyncScrollRanges1 >> addDestinationLineChangesFrom: aCompositeChange to: changedLines [ + | lineNumber index | + lineNumber := 0. + index := 1. + aCompositeChange to + lineIndicesDo: [ :start :end :endWithCR | + [ | currentChange previousIndex | + previousIndex := index. + currentChange := aCompositeChange changes at: index. + currentChange insertionChange + ifNil: [ currentChange deletionChange + ifNotNil: [ :change | + change newIndex <= endWithCR + ifTrue: [ (changedLines at: currentChange) + add: lineNumber; + add: lineNumber. + index := index + 1 ] ] ] + ifNotNil: [ :change | + (change startIndex between: start and: endWithCR) + ifTrue: [ (changedLines at: currentChange) add: lineNumber ]. + change stopIndex <= endWithCR + ifTrue: [ (changedLines at: currentChange) add: lineNumber + 1. + index := index + 1 ] ]. + index > aCompositeChange changes size ifTrue: [ ^ self ]. + previousIndex ~= index ] whileTrue. + lineNumber := lineNumber + 1 ]. + (changedLines at: aCompositeChange changes last) add: lineNumber +] + +{ #category : #initialization } +GtSyncScrollRanges1 >> addOriginalLineChangesFrom: aCompositeChange to: changedLines [ + | lineNumber index | + lineNumber := 0. + index := 1. + aCompositeChange from + lineIndicesDo: [ :start :end :endWithCR | + [ | currentChange previousIndex | + previousIndex := index. + currentChange := aCompositeChange changes at: index. + currentChange deletionChange + ifNil: [ currentChange insertionChange + ifNotNil: [ :change | + change originalIndex <= endWithCR + ifTrue: [ changedLines + at: currentChange + ifAbsentPut: [ OrderedCollection with: lineNumber with: lineNumber ]. + index := index + 1 ] ] ] + ifNotNil: [ :change | + change startIndex < endWithCR + ifTrue: [ changedLines + at: currentChange + ifAbsentPut: [ OrderedCollection with: lineNumber ] ]. + change stopIndex <= endWithCR + ifTrue: [ (changedLines at: currentChange) add: lineNumber + 1. + index := index + 1 ] ]. + index > aCompositeChange changes size ifTrue: [ ^ self ]. + previousIndex ~= index ] whileTrue. + lineNumber := lineNumber + 1 ]. + (changedLines + at: aCompositeChange changes last + ifAbsentPut: [ OrderedCollection with: lineNumber ]) add: lineNumber +] + +{ #category : #initialization } +GtSyncScrollRanges1 >> addRanges: changedRanges fromChanges: aCompositeChange [ + | fromStart toStart fromEnd toEnd | + fromEnd := aCompositeChange from lineCount. + toEnd := aCompositeChange to lineCount. + fromStart := 0. + toStart := 0. + changedRanges + do: [ :each | + (ranges isEmpty and: [ each first = 0 and: [ each third = 0 ] ]) + ifFalse: [ ranges + add: (GtSyncScrollRange + leftFirst: fromStart + leftLast: each first - 1 + rightFirst: toStart + rightLast: each third - 1) ]. + ranges + add: (GtSyncScrollRange + leftFirst: each first + leftLast: each second + rightFirst: each third + rightLast: each fourth) beDifferent. + fromStart := each second + 1. + toStart := each fourth + 1 ]. + (fromStart > fromEnd and: [ toStart > toEnd ]) + ifFalse: [ ranges + add: (GtSyncScrollRange + leftFirst: fromStart + leftLast: fromEnd + rightFirst: toStart + rightLast: toEnd) ] +] + +{ #category : #initialization } +GtSyncScrollRanges1 >> buildFromChanges: aCompositeChange [ + | changedLines changedRanges | + changedLines := IdentityDictionary new. + self addOriginalLineChangesFrom: aCompositeChange to: changedLines. + self addDestinationLineChangesFrom: aCompositeChange to: changedLines. + changedRanges := changedLines values + asSortedCollection: [ :a :b | a first < b first or: [ a first = b first and: [ a third < b third ] ] ]. + changedRanges := self mergeRanges: changedRanges. + self addRanges: changedRanges fromChanges: aCompositeChange +] + +{ #category : #accessing } +GtSyncScrollRanges1 >> gtRangesViewFor: aView [ + + ^ aView columnedList + title: 'Ranges'; + items: [ ranges ]; + column: 'Left' + text: [ :each | each leftRangeDisplayString asRopedText glamorousRegularFont ]; + column: 'Right' + text: [ :each | each rightRangeDisplayString asRopedText glamorousRegularFont ]; + column: 'Equal' + text: [ :each | each isDifference not asString asRopedText glamorousRegularFont ] +] + +{ #category : #'initialize-release' } +GtSyncScrollRanges1 >> initialize [ + super initialize. + ranges := OrderedCollection new +] + +{ #category : #accessing } +GtSyncScrollRanges1 >> leftLineFor: rightIndex [ + | range | + range := ranges + detect: [ :each | rightIndex between: each rightFirst and: each rightLast ] + ifNone: [ ^ 0 ]. + range rightSize = 0 + ifTrue: [ ^ 0 ]. + ^ ((rightIndex asFloat - range rightFirst) / range rightSize + * range leftSize + range leftFirst) rounded +] + +{ #category : #'private-creation' } +GtSyncScrollRanges1 >> mergeDifferences [ + | index current previous | + index := ranges size. + current := ranges last. + [ index > 1 ] + whileTrue: [ previous := ranges at: index - 1. + (current isDifference and: [ previous isDifference ]) + ifTrue: [ previous mergeWith: current. + ranges removeAtIndex: index ]. + index := index - 1. + current := previous ] +] + +{ #category : #initialization } +GtSyncScrollRanges1 >> mergeRanges: changedRanges [ + | newRanges | + newRanges := OrderedCollection new. + changedRanges + do: [ :each | + (newRanges notEmpty + and: [ (newRanges last at: 2) >= (each at: 1) + or: [ (newRanges last at: 4) >= (each at: 3) ] ]) + ifTrue: [ | lastRange | + lastRange := newRanges last. + lastRange at: 2 put: ((each at: 2) max: (lastRange at: 2)). + lastRange at: 4 put: ((each at: 4) max: (lastRange at: 4)) ] + ifFalse: [ newRanges add: each ] ]. + ^ newRanges +] + +{ #category : #accessing } +GtSyncScrollRanges1 >> ranges [ + ^ ranges +] + +{ #category : #accessing } +GtSyncScrollRanges1 >> rangesForLeft: leftInterval andRight: rightInterval [ + ^ ranges + select: [ :each | each overlapsLeft: leftInterval orRight: rightInterval ] +] + +{ #category : #accessing } +GtSyncScrollRanges1 >> rightLineFor: leftIndex [ + | range | + range := ranges + detect: [ :each | leftIndex between: each leftFirst and: each leftLast ] + ifNone: [ ^ 0 ]. + range leftSize = 0 + ifTrue: [ ^ 0 ]. + ^ ((leftIndex asFloat - range leftFirst) / range leftSize + * range rightSize + range rightFirst) rounded +] diff --git a/src/GToolkit-Coder/GtDeletionDiffChange.class.st b/src/GToolkit-Coder/GtDeletionDiffChange.class.st index 0a01ecdf9..acbe6ea7b 100644 --- a/src/GToolkit-Coder/GtDeletionDiffChange.class.st +++ b/src/GToolkit-Coder/GtDeletionDiffChange.class.st @@ -1,6 +1,9 @@ Class { #name : #GtDeletionDiffChange, #superclass : #GtSourceDiffChange, + #instVars : [ + 'newIndex' + ], #category : #'GToolkit-Coder-Diff-Algorithm' } @@ -11,7 +14,11 @@ GtDeletionDiffChange class >> highlightColor [ { #category : #accessing } GtDeletionDiffChange >> applyAttributesToInput: aText [ - (aText from: self startIndex to: self stopIndex) highlight: self highlightColor + aText + attribute: (BlTextHighlightAttribute paint: self highlightColor) + beNotOverwritableByStyler + from: self startIndex + to: self stopIndex ] { #category : #accessing } @@ -28,3 +35,13 @@ GtDeletionDiffChange >> deletionChange [ GtDeletionDiffChange >> isDeletion [ ^ true ] + +{ #category : #accessing } +GtDeletionDiffChange >> newIndex [ + ^ newIndex +] + +{ #category : #accessing } +GtDeletionDiffChange >> newIndex: anInteger [ + newIndex := anInteger +] diff --git a/src/GToolkit-Coder/GtDiffBuilder.class.st b/src/GToolkit-Coder/GtDiffBuilder.class.st index e9c3ef567..7811905a9 100644 --- a/src/GToolkit-Coder/GtDiffBuilder.class.st +++ b/src/GToolkit-Coder/GtDiffBuilder.class.st @@ -36,10 +36,13 @@ GtDiffBuilder >> addDeletions [ ifTrue: [ (fromSplits at: fromEnd) stopIndex ] ifFalse: [ from size ]. differences - add: (GtDeletionDiffChange + add: ((GtDeletionDiffChange on: from from: startIndex to: stopIndex) + newIndex: (toStart > toSplits size + ifTrue: [ to size + 1 ] + ifFalse: [ (toSplits at: toStart) startIndex ])) ] { #category : #private } @@ -52,16 +55,20 @@ GtDiffBuilder >> addInsertions [ ifTrue: [ (toSplits at: toEnd) stopIndex ] ifFalse: [ to size ]. differences - add: (GtInsertionDiffChange + add: ((GtInsertionDiffChange on: to from: startIndex to: stopIndex) + originalIndex: (fromStart > fromSplits size + ifTrue: [ from size + 1 ] + ifFalse: [ (fromSplits at: fromStart) startIndex ])) ] { #category : #private } GtDiffBuilder >> addInsertionsAndDeletionsIgnoring [ [ fromStart <= fromEnd or: [ toStart <= toEnd ] ] - whileTrue: [ | deletion insertion start end split | + whileTrue: [ | deletion insertion start end split fromTop | + fromTop := fromStart. [ fromStart <= fromEnd and: [ (split := fromSplits at: fromStart) hasMatch not ] ] whileTrue: [ start ifNil: [ start := split startIndex ]. @@ -71,7 +78,11 @@ GtDiffBuilder >> addInsertionsAndDeletionsIgnoring [ ifNotNil: [ deletion := GtDeletionDiffChange on: from from: start - to: end ]. + to: end. + deletion + newIndex: (toStart > toSplits size + ifTrue: [ to size + 1 ] + ifFalse: [ (toSplits at: toStart) startIndex ]) ]. start := nil. [ toStart <= toEnd and: [ (split := toSplits at: toStart) hasMatch not ] ] whileTrue: [ start ifNil: [ start := split startIndex ]. @@ -81,17 +92,22 @@ GtDiffBuilder >> addInsertionsAndDeletionsIgnoring [ ifNotNil: [ insertion := GtInsertionDiffChange on: to from: start - to: end ]. + to: end. + insertion + originalIndex: (fromTop > fromSplits size + ifTrue: [ from size + 1 ] + ifFalse: [ (fromSplits at: fromTop) startIndex ]) ]. deletion ifNil: [ differences add: insertion ] ifNotNil: [ insertion ifNil: [ differences add: deletion ] ifNotNil: [ differences add: (GtReplacementDiffChange delete: deletion andInsert: insertion) ] ]. - [ fromStart <= fromEnd and: [ (fromSplits at: fromStart) hasMatch ] ] - whileTrue: [ fromStart := fromStart + 1 ]. - [ toStart <= toEnd and: [ (toSplits at: toStart) hasMatch ] ] - whileTrue: [ toStart := toStart + 1 ] ] + [ fromStart <= fromEnd + and: [ toStart <= toEnd + and: [ (fromSplits at: fromStart) hasMatch and: [ (toSplits at: toStart) hasMatch ] ] ] ] + whileTrue: [ fromStart := fromStart + 1. + toStart := toStart + 1 ] ] ] { #category : #private } @@ -118,7 +134,7 @@ GtDiffBuilder >> computeDifferences [ { #category : #private } GtDiffBuilder >> computeLCSElements [ - | filter filteredFrom filteredTo commonElements | + | filter filteredFrom filteredTo | filter := Set new. fromStart to: fromEnd do: [ :i | filter add: (fromSplits at: i) ]. filteredTo := OrderedCollection new. diff --git a/src/GToolkit-Coder/GtInsertionDiffChange.class.st b/src/GToolkit-Coder/GtInsertionDiffChange.class.st index f4266da27..c780b7fef 100644 --- a/src/GToolkit-Coder/GtInsertionDiffChange.class.st +++ b/src/GToolkit-Coder/GtInsertionDiffChange.class.st @@ -1,6 +1,9 @@ Class { #name : #GtInsertionDiffChange, #superclass : #GtSourceDiffChange, + #instVars : [ + 'originalIndex' + ], #category : #'GToolkit-Coder-Diff-Algorithm' } @@ -11,7 +14,11 @@ GtInsertionDiffChange class >> highlightColor [ { #category : #accessing } GtInsertionDiffChange >> applyAttributesToOutput: aText [ - (aText from: self startIndex to: self stopIndex) highlight: self highlightColor + aText + attribute: (BlTextHighlightAttribute paint: self highlightColor) + beNotOverwritableByStyler + from: self startIndex + to: self stopIndex. ] { #category : #accessing } @@ -28,3 +35,13 @@ GtInsertionDiffChange >> insertionChange [ GtInsertionDiffChange >> isInsertion [ ^ true ] + +{ #category : #'as yet unclassified' } +GtInsertionDiffChange >> originalIndex [ + ^ originalIndex +] + +{ #category : #accessing } +GtInsertionDiffChange >> originalIndex: anInteger [ + originalIndex := anInteger +] From 0c2a55b5fa67ebe51d640ded29033dd5b2c0cf77 Mon Sep 17 00:00:00 2001 From: John Brant Date: Fri, 27 Jan 2023 20:18:53 -0600 Subject: [PATCH 0375/1268] couple fixes for diff view --- .../GtSyncScrollRanges1.class.st | 12 +++++---- .../GtCompositeDiffChange.class.st | 25 +------------------ 2 files changed, 8 insertions(+), 29 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSyncScrollRanges1.class.st b/src/GToolkit-Coder-UI/GtSyncScrollRanges1.class.st index 5800887b6..e4702f135 100644 --- a/src/GToolkit-Coder-UI/GtSyncScrollRanges1.class.st +++ b/src/GToolkit-Coder-UI/GtSyncScrollRanges1.class.st @@ -77,7 +77,7 @@ GtSyncScrollRanges1 class >> reversedMultilineCode [ { #category : #initialization } GtSyncScrollRanges1 >> addDestinationLineChangesFrom: aCompositeChange to: changedLines [ - | lineNumber index | + | lineNumber index lineNumbers | lineNumber := 0. index := 1. aCompositeChange to @@ -102,7 +102,8 @@ GtSyncScrollRanges1 >> addDestinationLineChangesFrom: aCompositeChange to: chang index > aCompositeChange changes size ifTrue: [ ^ self ]. previousIndex ~= index ] whileTrue. lineNumber := lineNumber + 1 ]. - (changedLines at: aCompositeChange changes last) add: lineNumber + lineNumbers := changedLines at: aCompositeChange changes last. + [ lineNumbers size < 4 ] whileTrue: [ lineNumbers add: lineNumber ] ] { #category : #initialization } @@ -124,7 +125,7 @@ GtSyncScrollRanges1 >> addOriginalLineChangesFrom: aCompositeChange to: changedL ifAbsentPut: [ OrderedCollection with: lineNumber with: lineNumber ]. index := index + 1 ] ] ] ifNotNil: [ :change | - change startIndex < endWithCR + change startIndex <= endWithCR ifTrue: [ changedLines at: currentChange ifAbsentPut: [ OrderedCollection with: lineNumber ] ]. @@ -176,8 +177,9 @@ GtSyncScrollRanges1 >> addRanges: changedRanges fromChanges: aCompositeChange [ GtSyncScrollRanges1 >> buildFromChanges: aCompositeChange [ | changedLines changedRanges | changedLines := IdentityDictionary new. - self addOriginalLineChangesFrom: aCompositeChange to: changedLines. - self addDestinationLineChangesFrom: aCompositeChange to: changedLines. + aCompositeChange changes notEmpty + ifTrue: [ self addOriginalLineChangesFrom: aCompositeChange to: changedLines. + self addDestinationLineChangesFrom: aCompositeChange to: changedLines ]. changedRanges := changedLines values asSortedCollection: [ :a :b | a first < b first or: [ a first = b first and: [ a third < b third ] ] ]. changedRanges := self mergeRanges: changedRanges. diff --git a/src/GToolkit-Coder/GtCompositeDiffChange.class.st b/src/GToolkit-Coder/GtCompositeDiffChange.class.st index 7fbfb1f1f..43f43e963 100644 --- a/src/GToolkit-Coder/GtCompositeDiffChange.class.st +++ b/src/GToolkit-Coder/GtCompositeDiffChange.class.st @@ -151,30 +151,7 @@ GtCompositeDiffChange >> gtTextView: aView [ ^ aView explicit priority: 10; title: 'Text'; - stencil: [ | pane fromText toText fromEditor toEditor | - pane := BrHorizontalPane new. - pane matchParent. - pane padding: (BlInsets all: 10). - fromText := from asRopedText glamorousRegularFont. - toText := to asRopedText glamorousRegularFont. - self applyAttributesToInput: fromText. - self applyAttributesToOutput: toText. - fromEditor := BrEditor new - focusability: BlFocusability none; - beReadOnlyWithSelection; - matchParent; - aptitude: BrGlamorousCodeEditorAptitude. - fromEditor editor text: fromText. - toEditor := BrEditor new - focusability: BlFocusability none; - beReadOnlyWithSelection; - matchParent; - aptitude: BrGlamorousCodeEditorAptitude. - toEditor editor text: toText. - pane - addChild: fromEditor; - addChild: toEditor. - pane ] + stencil: [ (GtDiffElement1 on: self) addAptitude: GtDiffFlatAptitude ] ] { #category : #initialization } From f36fa1668aa130fc4b8c2fbe254a3070c99fe383 Mon Sep 17 00:00:00 2001 From: John Brant Date: Mon, 30 Jan 2023 07:28:18 -0600 Subject: [PATCH 0376/1268] refactoring diff view --- .../GtDiffElementExamples.class.st | 88 ++++ .../GtSyncScrollRangesExamples.class.st | 72 ++++ src/GToolkit-Coder-UI/GtDiffElement.class.st | 120 ++---- src/GToolkit-Coder-UI/GtDiffElement1.class.st | 388 ------------------ .../GtDiffElementWithLabelStencil.class.st | 15 +- .../GtSyncScrollRanges.class.st | 213 +++++++--- .../GtSyncScrollRanges1.class.st | 273 ------------ .../GtCompositeDiffChange.class.st | 2 +- 8 files changed, 376 insertions(+), 795 deletions(-) create mode 100644 src/GToolkit-Coder-Examples/GtDiffElementExamples.class.st create mode 100644 src/GToolkit-Coder-Examples/GtSyncScrollRangesExamples.class.st delete mode 100644 src/GToolkit-Coder-UI/GtDiffElement1.class.st delete mode 100644 src/GToolkit-Coder-UI/GtSyncScrollRanges1.class.st diff --git a/src/GToolkit-Coder-Examples/GtDiffElementExamples.class.st b/src/GToolkit-Coder-Examples/GtDiffElementExamples.class.st new file mode 100644 index 000000000..42107d714 --- /dev/null +++ b/src/GToolkit-Coder-Examples/GtDiffElementExamples.class.st @@ -0,0 +1,88 @@ +Class { + #name : #GtDiffElementExamples, + #superclass : #Object, + #category : #'GToolkit-Coder-Examples-Diff' +} + +{ #category : #examples } +GtDiffElementExamples >> changeElementExample [ + + + ^ GtDiffElement onChange: self exampleChange +] + +{ #category : #examples } +GtDiffElementExamples >> changeExampleFlat [ + + ^ self changeElementExample aptitude: GtDiffFlatAptitude +] + +{ #category : #examples } +GtDiffElementExamples >> changeExampleShadow [ + + ^ self changeElementExample aptitude: GtDiffShadowAptitude +] + +{ #category : #examples } +GtDiffElementExamples >> exampleChange [ + + ^ GtDiffBuilder + computeDifferencesFrom: self originalString + to: self newString + using: GtCharacterGroupDiffSplitter words ignoreWhitespace +] + +{ #category : #examples } +GtDiffElementExamples >> exampleTextDiff [ + + ^ TextDiffBuilder from: self originalString to: self newString +] + +{ #category : #examples } +GtDiffElementExamples >> newString [ + + ^ String + streamContents: [ :str | + 1 to: 1000 by: 6 do: [ :i | + str + print: i; + cr; + print: i + 1; + cr; + print: i + 2; + cr ] ] +] + +{ #category : #examples } +GtDiffElementExamples >> originalString [ + + ^ String + streamContents: [ :str | + 1 to: 1000 by: 5 do: [ :i | + str + print: i; + cr; + print: i + 1; + cr; + print: i + 2; + cr ] ] +] + +{ #category : #examples } +GtDiffElementExamples >> textDiffElementExample [ + + + ^ GtDiffElement onDiff: self exampleTextDiff +] + +{ #category : #examples } +GtDiffElementExamples >> textDiffExampleFlat [ + + ^ self textDiffElementExample aptitude: GtDiffFlatAptitude +] + +{ #category : #examples } +GtDiffElementExamples >> textDiffExampleShadow [ + + ^ self textDiffElementExample aptitude: GtDiffShadowAptitude +] diff --git a/src/GToolkit-Coder-Examples/GtSyncScrollRangesExamples.class.st b/src/GToolkit-Coder-Examples/GtSyncScrollRangesExamples.class.st new file mode 100644 index 000000000..54e5b309a --- /dev/null +++ b/src/GToolkit-Coder-Examples/GtSyncScrollRangesExamples.class.st @@ -0,0 +1,72 @@ +Class { + #name : #GtSyncScrollRangesExamples, + #superclass : #Object, + #category : #'GToolkit-Coder-Examples-Diff' +} + +{ #category : #examples } +GtSyncScrollRangesExamples >> example [ + + ^ GtSyncScrollRanges createFromChange: self exampleDiff +] + +{ #category : #examples } +GtSyncScrollRangesExamples >> exampleDiff [ + + ^ GtDiffBuilder + computeDifferencesFrom: self originalString + to: self newString + using: GtCharacterGroupDiffSplitter words +] + +{ #category : #examples } +GtSyncScrollRangesExamples >> multilineCode [ + + | change ranges | + change := GtDiffBuilderExamples new tokenChanges. + ranges := GtSyncScrollRanges createFromChange: change. + self assert: ranges ranges size equals: 1. + ^ ranges +] + +{ #category : #private } +GtSyncScrollRangesExamples >> newString [ + + ^ '1 +4 +5 +6 +7 +8 +9' +] + +{ #category : #private } +GtSyncScrollRangesExamples >> originalString [ + + ^ '1 +2 +3 +5 +6 +7 +9 +10' +] + +{ #category : #examples } +GtSyncScrollRangesExamples >> reversedMultilineCode [ + + | change ranges | + change := GtDiffBuilderExamples new reversedTokenChanges. + ranges := GtSyncScrollRanges createFromChange: change. + self assert: ranges ranges size equals: 1. + ^ ranges +] + +{ #category : #examples } +GtSyncScrollRangesExamples >> textDiffExample [ + + ^ GtSyncScrollRanges + createFromDiff: (TextDiffBuilder from: self originalString to: self newString) +] diff --git a/src/GToolkit-Coder-UI/GtDiffElement.class.st b/src/GToolkit-Coder-UI/GtDiffElement.class.st index 6070c1a3b..ed58f5cd2 100644 --- a/src/GToolkit-Coder-UI/GtDiffElement.class.st +++ b/src/GToolkit-Coder-UI/GtDiffElement.class.st @@ -7,94 +7,55 @@ Class { 'leftElement', 'rightElement', 'syncScrollRanges', - 'diff', 'outlines', - 'separatorElement' + 'separatorElement', + 'styler' ], #category : #'GToolkit-Coder-UI-Diff' } -{ #category : #examples } -GtDiffElement class >> example [ - - - ^ self on: self exampleDiff -] - -{ #category : #examples } -GtDiffElement class >> exampleDiff [ - - ^ TextDiffBuilder from: self originalString to: self newString -] - -{ #category : #examples } -GtDiffElement class >> exampleFlat [ - - - ^ (self on: self exampleDiff) aptitude: GtDiffFlatAptitude -] - -{ #category : #examples } -GtDiffElement class >> exampleShadow [ - - - ^ (self on: self exampleDiff) aptitude: GtDiffShadowAptitude +{ #category : #'instance creation' } +GtDiffElement class >> on: anObject [ + self + deprecated: 'Please use onDiff: instead.' + transformWith: '`@receiver on: `@arg' -> '`@receiver onDiff: `@arg'. + ^ self onDiff: anObject ] -{ #category : #examples } -GtDiffElement class >> newString [ - - ^ String - streamContents: [ :str | - 1 to: 1000 by: 6 do: [ :i | - str - print: i; - cr; - print: i + 1; - cr; - print: i + 2; - cr ] ] +{ #category : #'instance creation' } +GtDiffElement class >> onChange: aCompositeDiffChange [ + ^ self new + change: aCompositeDiffChange; + yourself ] { #category : #'instance creation' } -GtDiffElement class >> on: aDiffBuilder [ +GtDiffElement class >> onDiff: aDiffBuilder [ ^ self new diff: aDiffBuilder; yourself ] -{ #category : #examples } -GtDiffElement class >> originalString [ - - ^ String - streamContents: [ :str | - 1 to: 1000 by: 5 do: [ :i | - str - print: i; - cr; - print: i + 1; - cr; - print: i + 2; - cr ] ] -] - -{ #category : #private } -GtDiffElement >> buildInterface [ - syncScrollRanges := GtSyncScrollRanges createFromDiff: diff. - - leftElement text: self previousRopedText. - diff newStyler ifNotNil: [ :aStyler | leftElement styler: aStyler ]. - - rightElement text: self newRopedText. - diff newStyler ifNotNil: [ :aStyler | rightElement styler: aStyler ]. - +{ #category : #initialize } +GtDiffElement >> change: aCompositeDiffChange [ + | text | + text := aCompositeDiffChange from asRopedText glamorousCodeFont. + aCompositeDiffChange applyAttributesToInput: text. + leftElement text: text. + text := aCompositeDiffChange to asRopedText glamorousCodeFont. + aCompositeDiffChange applyAttributesToOutput: text. + rightElement text: text. + syncScrollRanges := GtSyncScrollRanges createFromChange: aCompositeDiffChange. self updateOutlines ] { #category : #initialize } GtDiffElement >> diff: aDiffBuilder [ - diff := aDiffBuilder. - self buildInterface + syncScrollRanges := GtSyncScrollRanges createFromDiff: aDiffBuilder. + leftElement text: aDiffBuilder previousRopedText. + rightElement text: aDiffBuilder newRopedText. + aDiffBuilder newStyler ifNotNil: [ :aStyler | self styler: aStyler ]. + self updateOutlines ] { #category : #'event handling' } @@ -206,11 +167,6 @@ GtDiffElement >> leftTopFor: anInteger [ ^ element bounds top + leftElement bounds top max: 0 ] -{ #category : #private } -GtDiffElement >> newRopedText [ - ^ diff newRopedText -] - { #category : #initialize } GtDiffElement >> newSeparatorElement [ ^ BlElement new @@ -295,11 +251,6 @@ GtDiffElement >> paintMeAndChildrenOn: aCompositorPainter offset: anOffset [ draw ] ] ] -{ #category : #private } -GtDiffElement >> previousRopedText [ - ^ diff previousRopedText -] - { #category : #'event handling' } GtDiffElement >> rightBottomFor: anInteger [ | range element | @@ -354,6 +305,19 @@ GtDiffElement >> rightTopFor: anInteger [ ^ element bounds top + rightElement bounds top max: 0 ] +{ #category : #accessing } +GtDiffElement >> styler [ + ^ styler +] + +{ #category : #accessing } +GtDiffElement >> styler: anObject [ + styler := anObject. + styler + ifNotNil: [ leftElement styler: styler. + rightElement styler: styler ] +] + { #category : #'event handling' } GtDiffElement >> updateOutlines [ | ranges | diff --git a/src/GToolkit-Coder-UI/GtDiffElement1.class.st b/src/GToolkit-Coder-UI/GtDiffElement1.class.st deleted file mode 100644 index 2f7541a73..000000000 --- a/src/GToolkit-Coder-UI/GtDiffElement1.class.st +++ /dev/null @@ -1,388 +0,0 @@ -Class { - #name : #GtDiffElement1, - #superclass : #BlElement, - #traits : 'TBrLayoutResizable + TBrSizeAdjustable', - #classTraits : 'TBrLayoutResizable classTrait + TBrSizeAdjustable classTrait', - #instVars : [ - 'leftElement', - 'rightElement', - 'syncScrollRanges', - 'outlines', - 'separatorElement', - 'compositeChange', - 'styler' - ], - #category : #'GToolkit-Coder-UI-Diff' -} - -{ #category : #examples } -GtDiffElement1 class >> example [ - - - ^ self on: self exampleDiff -] - -{ #category : #examples } -GtDiffElement1 class >> exampleDiff [ - - ^ GtDiffBuilder - computeDifferencesFrom: self originalString - to: self newString - using: GtCharacterGroupDiffSplitter words ignoreWhitespace -] - -{ #category : #examples } -GtDiffElement1 class >> exampleFlat [ - - - ^ (self on: self exampleDiff) aptitude: GtDiffFlatAptitude -] - -{ #category : #examples } -GtDiffElement1 class >> exampleShadow [ - - - ^ (self on: self exampleDiff) aptitude: GtDiffShadowAptitude -] - -{ #category : #examples } -GtDiffElement1 class >> newString [ - - ^ String - streamContents: [ :str | - 1 to: 1000 by: 6 do: [ :i | - str - print: i; - cr; - print: i + 1; - cr; - print: i + 2; - cr ] ] -] - -{ #category : #'instance creation' } -GtDiffElement1 class >> on: aCompositeDiffChange [ - ^ self new - change: aCompositeDiffChange; - yourself -] - -{ #category : #examples } -GtDiffElement1 class >> originalString [ - - ^ String - streamContents: [ :str | - 1 to: 1000 by: 5 do: [ :i | - str - print: i; - cr; - print: i + 1; - cr; - print: i + 2; - cr ] ] -] - -{ #category : #private } -GtDiffElement1 >> buildInterface [ - syncScrollRanges := GtSyncScrollRanges1 createFromChanges: compositeChange. - - self updateOutlines -] - -{ #category : #initialize } -GtDiffElement1 >> change: aCompositeDiffChange [ - compositeChange := aCompositeDiffChange. - leftElement text: self previousRopedText. - rightElement text: self newRopedText. - self buildInterface -] - -{ #category : #'event handling' } -GtDiffElement1 >> drawMeAndChildrenOnSpartaCanvas: aCanvas [ - | stroke fill | - super drawMeAndChildrenOnSpartaCanvas: aCanvas. - stroke := aCanvas stroke - alpha: 0.2; - paint: Color black; - width: 1. - fill := aCanvas fill - alpha: 0.2; - paint: Color yellow. - outlines - do: [ :each | - fill - path: (each pathOnSpartaCanvas: aCanvas of: self); - draw. - stroke - path: (each pathOnSpartaCanvas: aCanvas of: self); - draw ] -] - -{ #category : #initialize } -GtDiffElement1 >> editorLook [ - ^ BrGlamorousCodeEditorAptitude -] - -{ #category : #initialize } -GtDiffElement1 >> initialize [ - super initialize. - - self layout: BlLinearLayout horizontal. - self matchParent. - - self beNormalSize. - - outlines := #(). - - leftElement := self newTextElement - id: GtDiffOldTextId; - when: BlElementScrolledEvent do: [ :e | self leftScrolled ]. - - rightElement := self newTextElement - id: GtDiffNewTextId; - when: BlElementScrolledEvent do: [ :e | self rightScrolled ]. - - separatorElement := self newSeparatorElement - id: GtDiffSeparatorId. - - self addChildren: { - leftElement. - separatorElement. - rightElement - }. -] - -{ #category : #'event handling' } -GtDiffElement1 >> leftBottomFor: anInteger [ - | range element | - range := self leftRange. - anInteger < range first ifTrue: [ ^ 0 ]. - anInteger > range last ifTrue: [ ^ self height ]. - element := leftElement children at: anInteger - range first + 1. - ^ element bounds bottom + leftElement bounds top max: 0 -] - -{ #category : #accessing } -GtDiffElement1 >> leftEditorLook: aLook [ - leftElement aptitude: aLook -] - -{ #category : #private } -GtDiffElement1 >> leftRange [ - | first | - first := ((leftElement instVarNamed: 'layoutPositionsRange') - ifNil: [ 1 ] - ifNotNil: [ :interval | interval first ]) max: 1. - ^ first to: first + leftElement children size - 1 -] - -{ #category : #'event handling' } -GtDiffElement1 >> leftScrolled [ - | newPosition | - newPosition := syncScrollRanges rightLineFor: self leftRange first. - - (self rightRange includes: newPosition) - ifTrue: [ | offset | - offset := rightElement children first bounds position y. - 1 to: newPosition - self rightRange first do: [ :i | offset := offset + (rightElement children at: i) height ]. - "rightElement scrollBy: 0@offset" ] - ifFalse: [ "rightElement scrollToPosition: newPosition" ]. - - self updateOutlines -] - -{ #category : #accessing } -GtDiffElement1 >> leftStyler: aStyler [ - leftElement editor styler: aStyler -] - -{ #category : #'event handling' } -GtDiffElement1 >> leftTopFor: anInteger [ - | range element | - range := self leftRange. - anInteger < range first ifTrue: [ ^ 0 ]. - anInteger > range last ifTrue: [ ^ self height ]. - element := leftElement children at: anInteger - range first + 1. - ^ element bounds top + leftElement bounds top max: 0 -] - -{ #category : #private } -GtDiffElement1 >> newRopedText [ - | text | - text := compositeChange to asRopedText glamorousCodeFont. - compositeChange applyAttributesToOutput: text. - ^ text -] - -{ #category : #initialize } -GtDiffElement1 >> newSeparatorElement [ - ^ BlElement new - constraintsDo: [ :c | - c vertical matchParent. - c horizontal exact: 0 ] - yourself -] - -{ #category : #initialize } -GtDiffElement1 >> newTextElement [ - ^ BrEditor new - focusability: BlFocusability none; - beReadOnlyWithSelection; - matchParent; - aptitude: self editorLook -] - -{ #category : #'geometry hooks' } -GtDiffElement1 >> onExtentChanged [ - super onExtentChanged. - - outlines := #(). - self updateOutlines -] - -{ #category : #'geometry hooks' } -GtDiffElement1 >> onLayout: aBounds context: aBlElementBoundsUpdateContext [ - super onLayout: aBounds context: aBlElementBoundsUpdateContext. - - outlines := #(). - self updateOutlines -] - -{ #category : #'event handling' } -GtDiffElement1 >> outlineFor: aSyncScrollRange [ - | leftTop leftBottom rightTop rightBottom vertices leftBounds rightBounds | - leftTop := self leftTopFor: aSyncScrollRange leftFirst + 1. - leftBottom := self leftBottomFor: aSyncScrollRange leftLast. - rightTop := self rightTopFor: aSyncScrollRange rightFirst + 1. - rightBottom := self rightBottomFor: aSyncScrollRange rightLast. - leftBounds := leftElement bounds. - rightBounds := rightElement bounds. - vertices := OrderedCollection new: 9. - vertices - add: leftBounds left @ leftTop; - add: leftBounds right @ leftTop; - add: rightBounds left @ rightTop; - add: rightBounds right @ rightTop; - add: rightBounds right @ rightBottom; - add: rightBounds left @ rightBottom; - add: leftBounds right @ leftBottom; - add: leftBounds left @ leftBottom; - add: leftBounds left @ leftTop. - ^ BlPolyline vertices: vertices -] - -{ #category : #'event handling' } -GtDiffElement1 >> paintMeAndChildrenOn: aCompositorPainter offset: anOffset [ - | aCanvas stroke fill | - super paintMeAndChildrenOn: aCompositorPainter offset: anOffset. - - aCanvas := aCompositorPainter canvas. - - aCanvas transform - by: [ :t | t translateBy: anOffset ] - during: [ - stroke := aCanvas stroke - alpha: 0.2; - paint: Color black; - width: 1. - fill := aCanvas fill - alpha: 0.2; - paint: Color yellow. - outlines - do: [ :each | - fill - path: (each pathOnSpartaCanvas: aCanvas of: self); - draw. - stroke - path: (each pathOnSpartaCanvas: aCanvas of: self); - draw ] ] -] - -{ #category : #private } -GtDiffElement1 >> previousRopedText [ - | text | - text := compositeChange from asRopedText glamorousCodeFont. - compositeChange applyAttributesToInput: text. - ^ text -] - -{ #category : #'event handling' } -GtDiffElement1 >> rightBottomFor: anInteger [ - | range element | - range := self rightRange. - anInteger < range first ifTrue: [ ^ 0 ]. - anInteger > range last ifTrue: [ ^ self height ]. - element := rightElement children at: anInteger - range first + 1. - ^ element bounds bottom + rightElement bounds top max: 0 -] - -{ #category : #accessing } -GtDiffElement1 >> rightEditorLook: aLook [ - rightElement aptitude: aLook -] - -{ #category : #private } -GtDiffElement1 >> rightRange [ - | first | - first := ((rightElement instVarNamed: 'layoutPositionsRange') - ifNil: [ 1 ] - ifNotNil: [ :interval | interval first ]) max: 1. - ^ first to: first + rightElement children size - 1 -] - -{ #category : #'event handling' } -GtDiffElement1 >> rightScrolled [ - | newPosition | - newPosition := syncScrollRanges leftLineFor: self rightRange first. - - (self leftRange includes: newPosition) - ifTrue: [ | offset | - offset := leftElement children first bounds position y. - 1 to: newPosition - self leftRange first do: [ :i | offset := offset + (leftElement children at: i) height ]. - "leftElement scrollBy: 0@ offset" ] - ifFalse: [ "leftElement scrollToPosition: newPosition" ]. - - self updateOutlines -] - -{ #category : #accessing } -GtDiffElement1 >> rightStyler: aStyler [ - rightElement editor styler: aStyler -] - -{ #category : #'event handling' } -GtDiffElement1 >> rightTopFor: anInteger [ - | range element | - range := self rightRange. - anInteger < range first ifTrue: [ ^ 0 ]. - anInteger > range last ifTrue: [ ^ self height ]. - element := rightElement children at: anInteger - range first + 1. - ^ element bounds top + rightElement bounds top max: 0 -] - -{ #category : #accessing } -GtDiffElement1 >> styler [ - ^ styler -] - -{ #category : #accessing } -GtDiffElement1 >> styler: anObject [ - styler := anObject. - styler - ifNotNil: [ leftElement styler: styler. - rightElement styler: styler ] -] - -{ #category : #'event handling' } -GtDiffElement1 >> updateOutlines [ - | ranges | - outlines := OrderedCollection new. - ranges := syncScrollRanges - rangesForLeft: self leftRange - andRight: self rightRange. - ranges - do: [ :each | - each isDifference - ifTrue: [ outlines add: (self outlineFor: each) ] ]. - self invalidate -] diff --git a/src/GToolkit-Coder-UI/GtDiffElementWithLabelStencil.class.st b/src/GToolkit-Coder-UI/GtDiffElementWithLabelStencil.class.st index 04c92a85d..e5b413815 100644 --- a/src/GToolkit-Coder-UI/GtDiffElementWithLabelStencil.class.st +++ b/src/GToolkit-Coder-UI/GtDiffElementWithLabelStencil.class.st @@ -56,20 +56,19 @@ GtDiffElementWithLabelStencil >> createFromLabel [ { #category : #'building - widgets' } GtDiffElementWithLabelStencil >> createPanesDiffElement [ | diffWrapper | - diffWrapper := BrVerticalPane new. diffWrapper margin: (BlInsets all: 3). diffWrapper hMatchParent. diffWrapper vFitContent. - - diffWrapper - addChild: ((GtEpiceaDiffElement on: self diffBuilder) - aptitude: GtDiffFlatAptitude; - vFitContent; - beSmallSize). + + diffWrapper + addChild: ((GtEpiceaDiffElement onDiff: self diffBuilder) + aptitude: GtDiffFlatAptitude; + vFitContent; + beSmallSize). diffWrapper addAptitude: (BrShadowAptitude new width: 1). - + ^ diffWrapper ] diff --git a/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st b/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st index d730e7043..e6e62de9d 100644 --- a/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st +++ b/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st @@ -4,83 +4,180 @@ Class { #instVars : [ 'ranges' ], - #category : 'GToolkit-Coder-UI-Diff' + #category : #'GToolkit-Coder-UI-Diff' } { #category : #'instance creation' } -GtSyncScrollRanges class >> createFromDiff: aDiffBuilder [ +GtSyncScrollRanges class >> createFromChange: aCompositeChange [ | syncScroll | syncScroll := self new. - aDiffBuilder - patchSequenceDoIfMatch: [ :line | syncScroll advanceBoth ] - ifInsert: [ :line | syncScroll advanceRight ] - ifRemove: [ :line | syncScroll advanceLeft ]. - syncScroll mergeDifferences. + syncScroll buildFromChange: aCompositeChange. ^ syncScroll ] -{ #category : #examples } -GtSyncScrollRanges class >> example [ - - ^ self createFromDiff: self exampleDiff +{ #category : #'instance creation' } +GtSyncScrollRanges class >> createFromDiff: aDiffBuilder [ + | syncScroll | + syncScroll := self new. + syncScroll buildFromDiff: aDiffBuilder. + ^ syncScroll ] -{ #category : #examples } -GtSyncScrollRanges class >> exampleDiff [ - - ^ TextDiffBuilder from: self originalString to: self newString +{ #category : #'private-creation changes' } +GtSyncScrollRanges >> addDestinationLineChangesFrom: aCompositeChange to: changedLines [ + | lineNumber index lineNumbers | + lineNumber := 0. + index := 1. + aCompositeChange to + lineIndicesDo: [ :start :end :endWithCR | + [ | currentChange previousIndex | + previousIndex := index. + currentChange := aCompositeChange changes at: index. + currentChange insertionChange + ifNil: [ currentChange deletionChange + ifNotNil: [ :change | + change newIndex <= endWithCR + ifTrue: [ (changedLines at: currentChange) + add: lineNumber; + add: lineNumber. + index := index + 1 ] ] ] + ifNotNil: [ :change | + (change startIndex between: start and: endWithCR) + ifTrue: [ (changedLines at: currentChange) add: lineNumber ]. + change stopIndex <= endWithCR + ifTrue: [ (changedLines at: currentChange) add: lineNumber + 1. + index := index + 1 ] ]. + index > aCompositeChange changes size ifTrue: [ ^ self ]. + previousIndex ~= index ] whileTrue. + lineNumber := lineNumber + 1 ]. + lineNumbers := changedLines at: aCompositeChange changes last. + [ lineNumbers size < 4 ] whileTrue: [ lineNumbers add: lineNumber ] ] -{ #category : #examples } -GtSyncScrollRanges class >> newString [ - - ^ '1 -4 -5 -6 -7 -8 -9' +{ #category : #'private-creation changes' } +GtSyncScrollRanges >> addOriginalLineChangesFrom: aCompositeChange to: changedLines [ + | lineNumber index | + lineNumber := 0. + index := 1. + aCompositeChange from + lineIndicesDo: [ :start :end :endWithCR | + [ | currentChange previousIndex | + previousIndex := index. + currentChange := aCompositeChange changes at: index. + currentChange deletionChange + ifNil: [ currentChange insertionChange + ifNotNil: [ :change | + change originalIndex <= endWithCR + ifTrue: [ changedLines + at: currentChange + ifAbsentPut: [ OrderedCollection with: lineNumber with: lineNumber ]. + index := index + 1 ] ] ] + ifNotNil: [ :change | + change startIndex <= endWithCR + ifTrue: [ changedLines + at: currentChange + ifAbsentPut: [ OrderedCollection with: lineNumber ] ]. + change stopIndex <= endWithCR + ifTrue: [ (changedLines at: currentChange) add: lineNumber + 1. + index := index + 1 ] ]. + index > aCompositeChange changes size ifTrue: [ ^ self ]. + previousIndex ~= index ] whileTrue. + lineNumber := lineNumber + 1 ]. + (changedLines + at: aCompositeChange changes last + ifAbsentPut: [ OrderedCollection with: lineNumber ]) add: lineNumber ] -{ #category : #examples } -GtSyncScrollRanges class >> originalString [ - - ^ '1 -2 -3 -5 -6 -7 -9 -10' +{ #category : #'private-creation changes' } +GtSyncScrollRanges >> addRanges: changedRanges fromChanges: aCompositeChange [ + | fromStart toStart fromEnd toEnd | + fromEnd := aCompositeChange from lineCount. + toEnd := aCompositeChange to lineCount. + fromStart := 0. + toStart := 0. + changedRanges + do: [ :each | + (ranges isEmpty and: [ each first = 0 and: [ each third = 0 ] ]) + ifFalse: [ ranges + add: (GtSyncScrollRange + leftFirst: fromStart + leftLast: each first - 1 + rightFirst: toStart + rightLast: each third - 1) ]. + ranges + add: (GtSyncScrollRange + leftFirst: each first + leftLast: each second + rightFirst: each third + rightLast: each fourth) beDifferent. + fromStart := each second + 1. + toStart := each fourth + 1 ]. + (fromStart > fromEnd and: [ toStart > toEnd ]) + ifFalse: [ ranges + add: (GtSyncScrollRange + leftFirst: fromStart + leftLast: fromEnd + rightFirst: toStart + rightLast: toEnd) ] ] -{ #category : #'private-creation' } +{ #category : #'private-creation diff' } GtSyncScrollRanges >> advanceBoth [ ranges last advanceBoth ifNotNil: [ :range | ranges add: range ] ] -{ #category : #'private-creation' } +{ #category : #'private-creation diff' } GtSyncScrollRanges >> advanceLeft [ ranges last advanceLeft ifNotNil: [ :range | ranges add: range ] ] -{ #category : #'private-creation' } +{ #category : #'private-creation diff' } GtSyncScrollRanges >> advanceRight [ ranges last advanceRight ifNotNil: [ :range | ranges add: range ] ] -{ #category : #'initialize-release' } -GtSyncScrollRanges >> initialize [ - super initialize. - ranges := OrderedCollection with: GtSyncScrollRange new +{ #category : #'private-creation changes' } +GtSyncScrollRanges >> buildFromChange: aCompositeChange [ + | changedLines changedRanges | + ranges := OrderedCollection new. + changedLines := IdentityDictionary new. + aCompositeChange changes notEmpty + ifTrue: [ self addOriginalLineChangesFrom: aCompositeChange to: changedLines. + self addDestinationLineChangesFrom: aCompositeChange to: changedLines ]. + changedRanges := changedLines values + asSortedCollection: [ :a :b | a first < b first or: [ a first = b first and: [ a third < b third ] ] ]. + changedRanges := self mergeRanges: changedRanges. + self addRanges: changedRanges fromChanges: aCompositeChange +] + +{ #category : #'private-creation diff' } +GtSyncScrollRanges >> buildFromDiff: aDiffBuilder [ + ranges := OrderedCollection with: GtSyncScrollRange new. + aDiffBuilder + patchSequenceDoIfMatch: [ :line | self advanceBoth ] + ifInsert: [ :line | self advanceRight ] + ifRemove: [ :line | self advanceLeft ]. + self mergeDifferences +] + +{ #category : #inspecting } +GtSyncScrollRanges >> gtRangesViewFor: aView [ + + ^ aView columnedList + title: 'Ranges'; + items: [ self ranges ]; + column: 'Left' + text: [ :each | each leftRangeDisplayString asRopedText glamorousRegularFont ]; + column: 'Right' + text: [ :each | each rightRangeDisplayString asRopedText glamorousRegularFont ]; + column: 'Equal' + text: [ :each | each isDifference not asString asRopedText glamorousRegularFont ] ] { #category : #accessing } GtSyncScrollRanges >> leftLineFor: rightIndex [ | range | - range := ranges + range := self ranges detect: [ :each | rightIndex between: each rightFirst and: each rightLast ] ifNone: [ ^ 0 ]. range rightSize = 0 @@ -89,7 +186,7 @@ GtSyncScrollRanges >> leftLineFor: rightIndex [ * range leftSize + range leftFirst) rounded ] -{ #category : #'private-creation' } +{ #category : #'private-creation diff' } GtSyncScrollRanges >> mergeDifferences [ | index current previous | index := ranges size. @@ -103,16 +200,38 @@ GtSyncScrollRanges >> mergeDifferences [ current := previous ] ] +{ #category : #'private-creation changes' } +GtSyncScrollRanges >> mergeRanges: changedRanges [ + | newRanges | + newRanges := OrderedCollection new. + changedRanges + do: [ :each | + (newRanges notEmpty + and: [ (newRanges last at: 2) >= (each at: 1) + or: [ (newRanges last at: 4) >= (each at: 3) ] ]) + ifTrue: [ | lastRange | + lastRange := newRanges last. + lastRange at: 2 put: ((each at: 2) max: (lastRange at: 2)). + lastRange at: 4 put: ((each at: 4) max: (lastRange at: 4)) ] + ifFalse: [ newRanges add: each ] ]. + ^ newRanges +] + +{ #category : #accessing } +GtSyncScrollRanges >> ranges [ + ^ ranges ifNil: [ #() ] +] + { #category : #accessing } GtSyncScrollRanges >> rangesForLeft: leftInterval andRight: rightInterval [ - ^ ranges + ^ self ranges select: [ :each | each overlapsLeft: leftInterval orRight: rightInterval ] ] { #category : #accessing } GtSyncScrollRanges >> rightLineFor: leftIndex [ | range | - range := ranges + range := self ranges detect: [ :each | leftIndex between: each leftFirst and: each leftLast ] ifNone: [ ^ 0 ]. range leftSize = 0 diff --git a/src/GToolkit-Coder-UI/GtSyncScrollRanges1.class.st b/src/GToolkit-Coder-UI/GtSyncScrollRanges1.class.st deleted file mode 100644 index e4702f135..000000000 --- a/src/GToolkit-Coder-UI/GtSyncScrollRanges1.class.st +++ /dev/null @@ -1,273 +0,0 @@ -Class { - #name : #GtSyncScrollRanges1, - #superclass : #Object, - #instVars : [ - 'ranges' - ], - #category : #'GToolkit-Coder-UI-Diff' -} - -{ #category : #'instance creation' } -GtSyncScrollRanges1 class >> createFromChanges: aCompositeChange [ - | syncScroll | - syncScroll := self new. - syncScroll buildFromChanges: aCompositeChange. - ^ syncScroll -] - -{ #category : #examples } -GtSyncScrollRanges1 class >> example [ - - ^ self createFromChanges: self exampleDiff -] - -{ #category : #examples } -GtSyncScrollRanges1 class >> exampleDiff [ - - ^ GtDiffBuilder - computeDifferencesFrom: self originalString - to: self newString - using: GtCharacterGroupDiffSplitter words -] - -{ #category : #examples } -GtSyncScrollRanges1 class >> multilineCode [ - - | change ranges | - change := GtDiffBuilderExamples new tokenChanges. - ranges := self createFromChanges: change. - self assert: ranges ranges size equals: 1. - ^ ranges -] - -{ #category : #examples } -GtSyncScrollRanges1 class >> newString [ - - ^ '1 -4 -5 -6 -7 -8 -9' -] - -{ #category : #examples } -GtSyncScrollRanges1 class >> originalString [ - - ^ '1 -2 -3 -5 -6 -7 -9 -10' -] - -{ #category : #examples } -GtSyncScrollRanges1 class >> reversedMultilineCode [ - - | change ranges | - change := GtDiffBuilderExamples new reversedTokenChanges. - ranges := self createFromChanges: change. - self assert: ranges ranges size equals: 1. - ^ ranges -] - -{ #category : #initialization } -GtSyncScrollRanges1 >> addDestinationLineChangesFrom: aCompositeChange to: changedLines [ - | lineNumber index lineNumbers | - lineNumber := 0. - index := 1. - aCompositeChange to - lineIndicesDo: [ :start :end :endWithCR | - [ | currentChange previousIndex | - previousIndex := index. - currentChange := aCompositeChange changes at: index. - currentChange insertionChange - ifNil: [ currentChange deletionChange - ifNotNil: [ :change | - change newIndex <= endWithCR - ifTrue: [ (changedLines at: currentChange) - add: lineNumber; - add: lineNumber. - index := index + 1 ] ] ] - ifNotNil: [ :change | - (change startIndex between: start and: endWithCR) - ifTrue: [ (changedLines at: currentChange) add: lineNumber ]. - change stopIndex <= endWithCR - ifTrue: [ (changedLines at: currentChange) add: lineNumber + 1. - index := index + 1 ] ]. - index > aCompositeChange changes size ifTrue: [ ^ self ]. - previousIndex ~= index ] whileTrue. - lineNumber := lineNumber + 1 ]. - lineNumbers := changedLines at: aCompositeChange changes last. - [ lineNumbers size < 4 ] whileTrue: [ lineNumbers add: lineNumber ] -] - -{ #category : #initialization } -GtSyncScrollRanges1 >> addOriginalLineChangesFrom: aCompositeChange to: changedLines [ - | lineNumber index | - lineNumber := 0. - index := 1. - aCompositeChange from - lineIndicesDo: [ :start :end :endWithCR | - [ | currentChange previousIndex | - previousIndex := index. - currentChange := aCompositeChange changes at: index. - currentChange deletionChange - ifNil: [ currentChange insertionChange - ifNotNil: [ :change | - change originalIndex <= endWithCR - ifTrue: [ changedLines - at: currentChange - ifAbsentPut: [ OrderedCollection with: lineNumber with: lineNumber ]. - index := index + 1 ] ] ] - ifNotNil: [ :change | - change startIndex <= endWithCR - ifTrue: [ changedLines - at: currentChange - ifAbsentPut: [ OrderedCollection with: lineNumber ] ]. - change stopIndex <= endWithCR - ifTrue: [ (changedLines at: currentChange) add: lineNumber + 1. - index := index + 1 ] ]. - index > aCompositeChange changes size ifTrue: [ ^ self ]. - previousIndex ~= index ] whileTrue. - lineNumber := lineNumber + 1 ]. - (changedLines - at: aCompositeChange changes last - ifAbsentPut: [ OrderedCollection with: lineNumber ]) add: lineNumber -] - -{ #category : #initialization } -GtSyncScrollRanges1 >> addRanges: changedRanges fromChanges: aCompositeChange [ - | fromStart toStart fromEnd toEnd | - fromEnd := aCompositeChange from lineCount. - toEnd := aCompositeChange to lineCount. - fromStart := 0. - toStart := 0. - changedRanges - do: [ :each | - (ranges isEmpty and: [ each first = 0 and: [ each third = 0 ] ]) - ifFalse: [ ranges - add: (GtSyncScrollRange - leftFirst: fromStart - leftLast: each first - 1 - rightFirst: toStart - rightLast: each third - 1) ]. - ranges - add: (GtSyncScrollRange - leftFirst: each first - leftLast: each second - rightFirst: each third - rightLast: each fourth) beDifferent. - fromStart := each second + 1. - toStart := each fourth + 1 ]. - (fromStart > fromEnd and: [ toStart > toEnd ]) - ifFalse: [ ranges - add: (GtSyncScrollRange - leftFirst: fromStart - leftLast: fromEnd - rightFirst: toStart - rightLast: toEnd) ] -] - -{ #category : #initialization } -GtSyncScrollRanges1 >> buildFromChanges: aCompositeChange [ - | changedLines changedRanges | - changedLines := IdentityDictionary new. - aCompositeChange changes notEmpty - ifTrue: [ self addOriginalLineChangesFrom: aCompositeChange to: changedLines. - self addDestinationLineChangesFrom: aCompositeChange to: changedLines ]. - changedRanges := changedLines values - asSortedCollection: [ :a :b | a first < b first or: [ a first = b first and: [ a third < b third ] ] ]. - changedRanges := self mergeRanges: changedRanges. - self addRanges: changedRanges fromChanges: aCompositeChange -] - -{ #category : #accessing } -GtSyncScrollRanges1 >> gtRangesViewFor: aView [ - - ^ aView columnedList - title: 'Ranges'; - items: [ ranges ]; - column: 'Left' - text: [ :each | each leftRangeDisplayString asRopedText glamorousRegularFont ]; - column: 'Right' - text: [ :each | each rightRangeDisplayString asRopedText glamorousRegularFont ]; - column: 'Equal' - text: [ :each | each isDifference not asString asRopedText glamorousRegularFont ] -] - -{ #category : #'initialize-release' } -GtSyncScrollRanges1 >> initialize [ - super initialize. - ranges := OrderedCollection new -] - -{ #category : #accessing } -GtSyncScrollRanges1 >> leftLineFor: rightIndex [ - | range | - range := ranges - detect: [ :each | rightIndex between: each rightFirst and: each rightLast ] - ifNone: [ ^ 0 ]. - range rightSize = 0 - ifTrue: [ ^ 0 ]. - ^ ((rightIndex asFloat - range rightFirst) / range rightSize - * range leftSize + range leftFirst) rounded -] - -{ #category : #'private-creation' } -GtSyncScrollRanges1 >> mergeDifferences [ - | index current previous | - index := ranges size. - current := ranges last. - [ index > 1 ] - whileTrue: [ previous := ranges at: index - 1. - (current isDifference and: [ previous isDifference ]) - ifTrue: [ previous mergeWith: current. - ranges removeAtIndex: index ]. - index := index - 1. - current := previous ] -] - -{ #category : #initialization } -GtSyncScrollRanges1 >> mergeRanges: changedRanges [ - | newRanges | - newRanges := OrderedCollection new. - changedRanges - do: [ :each | - (newRanges notEmpty - and: [ (newRanges last at: 2) >= (each at: 1) - or: [ (newRanges last at: 4) >= (each at: 3) ] ]) - ifTrue: [ | lastRange | - lastRange := newRanges last. - lastRange at: 2 put: ((each at: 2) max: (lastRange at: 2)). - lastRange at: 4 put: ((each at: 4) max: (lastRange at: 4)) ] - ifFalse: [ newRanges add: each ] ]. - ^ newRanges -] - -{ #category : #accessing } -GtSyncScrollRanges1 >> ranges [ - ^ ranges -] - -{ #category : #accessing } -GtSyncScrollRanges1 >> rangesForLeft: leftInterval andRight: rightInterval [ - ^ ranges - select: [ :each | each overlapsLeft: leftInterval orRight: rightInterval ] -] - -{ #category : #accessing } -GtSyncScrollRanges1 >> rightLineFor: leftIndex [ - | range | - range := ranges - detect: [ :each | leftIndex between: each leftFirst and: each leftLast ] - ifNone: [ ^ 0 ]. - range leftSize = 0 - ifTrue: [ ^ 0 ]. - ^ ((leftIndex asFloat - range leftFirst) / range leftSize - * range rightSize + range rightFirst) rounded -] diff --git a/src/GToolkit-Coder/GtCompositeDiffChange.class.st b/src/GToolkit-Coder/GtCompositeDiffChange.class.st index 43f43e963..b58a5c0a0 100644 --- a/src/GToolkit-Coder/GtCompositeDiffChange.class.st +++ b/src/GToolkit-Coder/GtCompositeDiffChange.class.st @@ -151,7 +151,7 @@ GtCompositeDiffChange >> gtTextView: aView [ ^ aView explicit priority: 10; title: 'Text'; - stencil: [ (GtDiffElement1 on: self) addAptitude: GtDiffFlatAptitude ] + stencil: [ (GtDiffElement onChange: self) addAptitude: GtDiffFlatAptitude ] ] { #category : #initialization } From a8d57900101132bd9ee1cb873b1da2844895a83c Mon Sep 17 00:00:00 2001 From: John Brant Date: Mon, 30 Jan 2023 14:55:00 -0600 Subject: [PATCH 0377/1268] scroll diff view on click --- src/GToolkit-Coder-UI/GtDiffElement.class.st | 99 ++++++++++++------- .../GtSyncScrollRanges.class.st | 24 ++--- 2 files changed, 73 insertions(+), 50 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtDiffElement.class.st b/src/GToolkit-Coder-UI/GtDiffElement.class.st index ed58f5cd2..9c57bf737 100644 --- a/src/GToolkit-Coder-UI/GtDiffElement.class.st +++ b/src/GToolkit-Coder-UI/GtDiffElement.class.st @@ -87,30 +87,42 @@ GtDiffElement >> editorLook [ { #category : #initialize } GtDiffElement >> initialize [ super initialize. - + self layout: BlLinearLayout horizontal. self matchParent. - - self beNormalSize. + + self beNormalSize. outlines := #(). - + leftElement := self newTextElement - id: GtDiffOldTextId; - when: BlElementScrolledEvent do: [ :e | self leftScrolled ]. + id: GtDiffOldTextId; + when: BlElementScrolledEvent do: [ :e | self leftScrolled ]. + leftElement editor + addEventHandler: (BlEventHandler + on: BrTextEditorCursorMovedEvent + do: [ :e | self leftCursorChanged ]); + addEventHandler: (BlEventHandler + on: BrTextEditorCursorAddedEvent + do: [ :e | self leftCursorChanged ]). rightElement := self newTextElement - id: GtDiffNewTextId; - when: BlElementScrolledEvent do: [ :e | self rightScrolled ]. - - separatorElement := self newSeparatorElement - id: GtDiffSeparatorId. - - self addChildren: { - leftElement. - separatorElement. - rightElement - }. + id: GtDiffNewTextId; + when: BlElementScrolledEvent do: [ :e | self rightScrolled ]. + rightElement editor + addEventHandler: (BlEventHandler + on: BrTextEditorCursorMovedEvent + do: [ :e | self rightCursorChanged ]); + addEventHandler: (BlEventHandler + on: BrTextEditorCursorAddedEvent + do: [ :e | self rightCursorChanged ]). + + separatorElement := self newSeparatorElement id: GtDiffSeparatorId. + + self + addChildren: {leftElement. + separatorElement. + rightElement} ] { #category : #'event handling' } @@ -123,11 +135,27 @@ GtDiffElement >> leftBottomFor: anInteger [ ^ element bounds bottom + leftElement bounds top max: 0 ] +{ #category : #'event handling' } +GtDiffElement >> leftCursorChanged [ + | newPosition | + newPosition := syncScrollRanges + rightLineFor: (self leftLineForCursor ifNil: [ self leftRange first ]). + (self rightRange includes: newPosition) + ifFalse: [ rightElement scrollToPosition: newPosition ] +] + { #category : #accessing } GtDiffElement >> leftEditorLook: aLook [ leftElement aptitude: aLook ] +{ #category : #'event handling' } +GtDiffElement >> leftLineForCursor [ + leftElement editor cursors + do: [ :each | ^ leftElement text asString lineNumberCorrespondingToIndex: each position ]. + ^ nil +] + { #category : #private } GtDiffElement >> leftRange [ | first | @@ -139,16 +167,6 @@ GtDiffElement >> leftRange [ { #category : #'event handling' } GtDiffElement >> leftScrolled [ - | newPosition | - newPosition := syncScrollRanges rightLineFor: self leftRange first. - - (self rightRange includes: newPosition) - ifTrue: [ | offset | - offset := rightElement children first bounds position y. - 1 to: newPosition - self rightRange first do: [ :i | offset := offset + (rightElement children at: i) height ]. - "rightElement scrollBy: 0@offset" ] - ifFalse: [ "rightElement scrollToPosition: newPosition" ]. - self updateOutlines ] @@ -179,7 +197,6 @@ GtDiffElement >> newSeparatorElement [ { #category : #initialize } GtDiffElement >> newTextElement [ ^ BrEditor new - focusability: BlFocusability none; beReadOnlyWithSelection; matchParent; aptitude: self editorLook @@ -261,11 +278,27 @@ GtDiffElement >> rightBottomFor: anInteger [ ^ element bounds bottom + rightElement bounds top max: 0 ] +{ #category : #'event handling' } +GtDiffElement >> rightCursorChanged [ + | newPosition | + newPosition := syncScrollRanges + leftLineFor: (self rightLineForCursor ifNil: [ self rightRange first ]). + (self leftRange includes: newPosition) + ifFalse: [ leftElement scrollToPosition: newPosition ] +] + { #category : #accessing } GtDiffElement >> rightEditorLook: aLook [ rightElement aptitude: aLook ] +{ #category : #'event handling' } +GtDiffElement >> rightLineForCursor [ + rightElement editor cursors + do: [ :each | ^ rightElement text asString lineNumberCorrespondingToIndex: each position ]. + ^ nil +] + { #category : #private } GtDiffElement >> rightRange [ | first | @@ -277,16 +310,6 @@ GtDiffElement >> rightRange [ { #category : #'event handling' } GtDiffElement >> rightScrolled [ - | newPosition | - newPosition := syncScrollRanges leftLineFor: self rightRange first. - - (self leftRange includes: newPosition) - ifTrue: [ | offset | - offset := leftElement children first bounds position y. - 1 to: newPosition - self leftRange first do: [ :i | offset := offset + (leftElement children at: i) height ]. - "leftElement scrollBy: 0@ offset" ] - ifFalse: [ "leftElement scrollToPosition: newPosition" ]. - self updateOutlines ] diff --git a/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st b/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st index e6e62de9d..9e06cc269 100644 --- a/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st +++ b/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st @@ -178,12 +178,12 @@ GtSyncScrollRanges >> gtRangesViewFor: aView [ GtSyncScrollRanges >> leftLineFor: rightIndex [ | range | range := self ranges - detect: [ :each | rightIndex between: each rightFirst and: each rightLast ] - ifNone: [ ^ 0 ]. - range rightSize = 0 - ifTrue: [ ^ 0 ]. - ^ ((rightIndex asFloat - range rightFirst) / range rightSize - * range leftSize + range leftFirst) rounded + detect: [ :each | rightIndex between: each rightFirst and: each rightLast ] + ifNone: [ ^ 0 ]. + ^ ((range rightSize = 0 + ifTrue: [ 0 ] + ifFalse: [ (rightIndex asFloat - range rightFirst) / range rightSize ]) + * range leftSize + range leftFirst) rounded ] { #category : #'private-creation diff' } @@ -232,10 +232,10 @@ GtSyncScrollRanges >> rangesForLeft: leftInterval andRight: rightInterval [ GtSyncScrollRanges >> rightLineFor: leftIndex [ | range | range := self ranges - detect: [ :each | leftIndex between: each leftFirst and: each leftLast ] - ifNone: [ ^ 0 ]. - range leftSize = 0 - ifTrue: [ ^ 0 ]. - ^ ((leftIndex asFloat - range leftFirst) / range leftSize - * range rightSize + range rightFirst) rounded + detect: [ :each | leftIndex between: each leftFirst and: each leftLast ] + ifNone: [ ^ 0 ]. + ^ ((range leftSize = 0 + ifTrue: [ 0 ] + ifFalse: [ (leftIndex asFloat - range leftFirst) / range leftSize ]) + * range rightSize + range rightFirst) rounded ] From 409593b550b303bb11d76fbb255ed7c92f735a60 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Tue, 31 Jan 2023 11:27:07 +0100 Subject: [PATCH 0378/1268] Cache creation forms in coder [feenkcom/gtoolkit#2966] --- .../GtCoderNavigationTabsStencil.class.st | 52 ++++++++++++------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index 96c65c45b..d5a24a296 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -3,7 +3,8 @@ Class { #superclass : #BrStencil, #instVars : [ 'navigations', - 'navigationModel' + 'navigationModel', + 'formCache' ], #category : #'GToolkit-Coder-UI-Navigation' } @@ -48,6 +49,16 @@ GtCoderNavigationTabsStencil >> defaultNavigations [ collect ] +{ #category : #accessing } +GtCoderNavigationTabsStencil >> formCache [ + ^ formCache +] + +{ #category : #accessing } +GtCoderNavigationTabsStencil >> formCache: anObject [ + formCache := anObject +] + { #category : #'gt-extensions' } GtCoderNavigationTabsStencil >> gtClassHierarchyFor: aView [ @@ -75,24 +86,22 @@ GtCoderNavigationTabsStencil >> gtCreationInterface: look [ addTab: (BrTab new aptitude: BrGlamorousTabAptitude new; label: each componentName; - stencil: [ | form | - form := each new. - form hasPackageAndTag - ifTrue: [ navigationModel - selectedPackageDo: [ :aPackage | form packageAndTagName packageName: aPackage name ]. - navigationModel - selectedTagDo: [ :aTag | form packageAndTagName tagName: aTag name ] ]. - ((GtCreationFormWidget forForm: form) - onAccept: [ :anInstance | - look - inUIProcessDo: [ form selectInNavigationModel: navigationModel anInstance: anInstance. - look fireEvent: BrDropdownHideWish new ] ]; - onElementCreated: [ :aFrame | (aFrame childNamed: #field) requestFocus ]) - asElement - addShortcut: (BlShortcutWithAction new - combination: BlKeyCombination escape; - overrideChildren: true; - action: [ :anEvent | look inUIProcessDo: [ look fireEvent: BrDropdownHideWish new ] ]) ]) ]. + stencil: [ (self formCache + at: each + ifAbsentPut: [ | form | + form := each new. + form hasPackageAndTag + ifTrue: [ navigationModel + selectedPackageDo: [ :aPackage | form packageAndTagName packageName: aPackage name ]. + navigationModel + selectedTagDo: [ :aTag | form packageAndTagName tagName: aTag name ] ]. + ((GtCreationFormWidget forForm: form) + onAccept: [ :anInstance | + look + inUIProcessDo: [ form selectInNavigationModel: navigationModel anInstance: anInstance. + look fireEvent: BrDropdownHideWish new ] ]; + onElementCreated: [ :aFrame | (aFrame childNamed: #field) requestFocus ]) + asElement ]) removeFromParent ]) ]. ^ contentTabs ] @@ -138,6 +147,11 @@ GtCoderNavigationTabsStencil >> gtPackagesTagsClassesFor: aView [ element ] ] +{ #category : #accessing } +GtCoderNavigationTabsStencil >> initialize [ + formCache := Dictionary new. +] + { #category : #accessing } GtCoderNavigationTabsStencil >> navigationModel [ From 633c2fa8659b1775ea5d4f538cede7e0e759932f Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Tue, 31 Jan 2023 14:26:03 +0100 Subject: [PATCH 0379/1268] Spawn a debugger on issue in creation from [feenkcom/gtoolkit#2966] --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index 20b8ae2ca..1ad45890c 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -26,7 +26,7 @@ GtCreationForm >> acceptAction [ action: [ :aModel :aButton | [ | aValue | aValue := self commit. - onAccept ifNotNil: [ onAccept value: aValue ] ] on: Error do: #inspect ]; + onAccept ifNotNil: [ onAccept value: aValue ] ] on: Error do: #debug ]; beCommitAction ] From 5ef24d7b89773cc8f00b1ad47d705b397b9ce70f Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 31 Jan 2023 10:51:47 -0600 Subject: [PATCH 0380/1268] switching diff builder --- .../GtLocalVersion.class.st | 12 ++++-- .../GtDiffElementWithLabelStencil.class.st | 39 ++++++++++++------- 2 files changed, 34 insertions(+), 17 deletions(-) diff --git a/src/GToolkit-Coder-Extensions/GtLocalVersion.class.st b/src/GToolkit-Coder-Extensions/GtLocalVersion.class.st index 16bae68a9..8674d73ce 100644 --- a/src/GToolkit-Coder-Extensions/GtLocalVersion.class.st +++ b/src/GToolkit-Coder-Extensions/GtLocalVersion.class.st @@ -98,12 +98,18 @@ GtLocalVersion >> localVersion: aLocalVersion [ { #category : #accessing } GtLocalVersion >> updateContent [ - | previousContent newContent | + | previousContent newContent change styler | previousContent := compiledMethod sourceCode. newContent := localVersion sourceCode. content removeChildren. + change := GtDiffBuilder + computeDifferencesFrom: previousContent + to: newContent + using: GtSmaCCDiffSplitter forPharo. + styler := GtCodeDiffRBTextStyler new. + content addChild: (BrLabel new aptitude: BrGlamorousLabelAptitude; @@ -111,8 +117,8 @@ GtLocalVersion >> updateContent [ addChild: (GtDiffElementWithLabelStencil new fromLabelText: 'Current'; toLabelText: 'Version'; - diffBuilder: ((GtCodeDiffBuilder from: previousContent to: newContent) isMethod: true)) - create; + change: change; + styler: styler) create; addChild: (BrFrame new addChild: (BrButton new icon: BrGlamorousVectorIcons accept; diff --git a/src/GToolkit-Coder-UI/GtDiffElementWithLabelStencil.class.st b/src/GToolkit-Coder-UI/GtDiffElementWithLabelStencil.class.st index e5b413815..dd57f615c 100644 --- a/src/GToolkit-Coder-UI/GtDiffElementWithLabelStencil.class.st +++ b/src/GToolkit-Coder-UI/GtDiffElementWithLabelStencil.class.st @@ -4,12 +4,23 @@ Class { #instVars : [ 'fromLabelText', 'toLabelText', - 'diffBuilder', - 'shouldHideDiff' + 'shouldHideDiff', + 'change', + 'styler' ], #category : #'GToolkit-Coder-UI-Diff' } +{ #category : #accessing } +GtDiffElementWithLabelStencil >> change [ + ^ change +] + +{ #category : #accessing } +GtDiffElementWithLabelStencil >> change: aGtCompositeDiffChange [ + change := aGtCompositeDiffChange +] + { #category : #'api - instantiation' } GtDiffElementWithLabelStencil >> create [ | headerElement diffContainer | @@ -62,8 +73,9 @@ GtDiffElementWithLabelStencil >> createPanesDiffElement [ diffWrapper vFitContent. diffWrapper - addChild: ((GtEpiceaDiffElement onDiff: self diffBuilder) + addChild: ((GtEpiceaDiffElement onChange: self change) aptitude: GtDiffFlatAptitude; + styler: styler; vFitContent; beSmallSize). @@ -81,17 +93,6 @@ GtDiffElementWithLabelStencil >> createToLabel [ hMatchParent ] -{ #category : #accessing } -GtDiffElementWithLabelStencil >> diffBuilder [ - ^ diffBuilder -] - -{ #category : #accessing } -GtDiffElementWithLabelStencil >> diffBuilder: anObject [ - - diffBuilder := anObject -] - { #category : #accessing } GtDiffElementWithLabelStencil >> fromLabelText [ ^ fromLabelText @@ -119,6 +120,16 @@ GtDiffElementWithLabelStencil >> shouldHideDiff: anObject [ shouldHideDiff := anObject ] +{ #category : #accessing } +GtDiffElementWithLabelStencil >> styler [ + ^ styler +] + +{ #category : #accessing } +GtDiffElementWithLabelStencil >> styler: anObject [ + styler := anObject +] + { #category : #accessing } GtDiffElementWithLabelStencil >> toLabelText [ ^ toLabelText From 6d058afb0a49eb10a240fa330171053a2c5e04b0 Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 31 Jan 2023 13:55:05 -0600 Subject: [PATCH 0381/1268] switching diff builder --- src/GToolkit-Coder/GtCompositeDiffChange.class.st | 7 ++++++- src/GToolkit-Coder/RBCommentChange.extension.st | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder/GtCompositeDiffChange.class.st b/src/GToolkit-Coder/GtCompositeDiffChange.class.st index b58a5c0a0..855ecf406 100644 --- a/src/GToolkit-Coder/GtCompositeDiffChange.class.st +++ b/src/GToolkit-Coder/GtCompositeDiffChange.class.st @@ -35,6 +35,11 @@ GtCompositeDiffChange >> applyAttributesToOutput: aText [ changes do: [ :each | each applyAttributesToOutput: aText ] ] +{ #category : #accessing } +GtCompositeDiffChange >> asElement [ + ^ (GtDiffElement onChange: self) addAptitude: GtDiffFlatAptitude +] + { #category : #accessing } GtCompositeDiffChange >> changes [ ^ changes @@ -151,7 +156,7 @@ GtCompositeDiffChange >> gtTextView: aView [ ^ aView explicit priority: 10; title: 'Text'; - stencil: [ (GtDiffElement onChange: self) addAptitude: GtDiffFlatAptitude ] + stencil: [ self asElement ] ] { #category : #initialization } diff --git a/src/GToolkit-Coder/RBCommentChange.extension.st b/src/GToolkit-Coder/RBCommentChange.extension.st index 7d0dc9f5f..6c8534273 100644 --- a/src/GToolkit-Coder/RBCommentChange.extension.st +++ b/src/GToolkit-Coder/RBCommentChange.extension.st @@ -6,5 +6,5 @@ RBCommentChange >> gtChangesFor: aView [ ^ aView explicit title: 'Diff'; priority: 10; - stencil: [ self gtDiff asElement ] + stencil: [ self gtDiffChange asElement ] ] From 94602c09ca935103a78437485de3b3d80a23a913 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Wed, 1 Feb 2023 10:35:56 +0100 Subject: [PATCH 0382/1268] Add onElementCreated hook to creation form --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index 1ad45890c..66ba61f69 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -3,7 +3,8 @@ Class { #superclass : #Object, #instVars : [ 'onAccept', - 'packageAndTagName' + 'packageAndTagName', + 'onElementCreated' ], #category : #'GToolkit-Coder-UI-Forms - Models' } @@ -33,7 +34,7 @@ GtCreationForm >> acceptAction [ { #category : #converting } GtCreationForm >> asElement [ | viewModel | - viewModel := self asGtMagritteViewModel. + viewModel := self asGtMagritteViewModel onElementCreated: self onElementCreated. "save action should be available even if unchanged" viewModel actions first installOn: [ :aModel :aButton :aMemento | @@ -98,6 +99,16 @@ GtCreationForm >> onAccept: anObject [ onAccept := anObject ] +{ #category : #accessing } +GtCreationForm >> onElementCreated [ + ^ onElementCreated +] + +{ #category : #accessing } +GtCreationForm >> onElementCreated: anObject [ + onElementCreated := anObject +] + { #category : #accessing } GtCreationForm >> packageAndTagDescription [ From 3746d9485477f21f10725aa96e583ca251efcb39 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 31 Jan 2023 06:35:09 -0600 Subject: [PATCH 0383/1268] Add slots context menu [feenkcom/gtoolkit#3041] --- ...igationPackagesTagsClassesElement.class.st | 86 +++++++++++++++++-- 1 file changed, 77 insertions(+), 9 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index dc91b29f9..62878751d 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -39,6 +39,26 @@ GtCoderNavigationPackagesTagsClassesElement >> addPackage: aPackage tag: aPackag self selectPackageOrTag: aSelectedPackageOrTag ]. ] +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> addPreviewButtonFor: refactoring to: elem [ + | button | + button := GtRefactoringsPreviewButton new. + button vMatchParent. + button refactorings: [ {refactoring} ]. + button cancelBlock: [ ]. + button + padding: (BlInsets + top: 1 + right: 4 + bottom: 0 + left: 4). + button beMiniSize. + button + when: GtRefactoringsAppliedEvent + do: [ :anEvent | elem removeChild: anEvent currentTarget ]. + ^ elem addChild: button as: #preview +] + { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> buildCategorySlotTabs [ | aTabGroup | @@ -126,13 +146,10 @@ GtCoderNavigationPackagesTagsClassesElement >> buildSlotGroupWithBinder: binderB instanceGroup := BrGroup new domainObject: 'instance slots'; stream: #() asAsyncStream; - itemStencil: [ | label | - label := BrLabel new - hMatchParent; - vFitContent; - beSmallSize; - aptitude: BrGlamorousLabelAptitude + BrGlamorousListItemAptitude; - when: BlClickEvent do: clickBlock ]; + itemStencil: [ BrHorizontalPane new + hMatchParent; + vFitContent; + when: BlClickEvent do: clickBlock ]; itemDataBinder: binderBlock; shouldShowWithoutItems: false. classSlotGroup := instanceGroup copy domainObject: 'class slots'. @@ -147,10 +164,22 @@ GtCoderNavigationPackagesTagsClassesElement >> buildSlotsGroupList [ | list | list := self buildGroupList. slotsGroup := self - buildSlotGroupWithBinder: [ :label :item | + buildSlotGroupWithBinder: [ :element :item | + | label | + element removeChildren. + label := BrLabel new + hMatchParent; + vFitContent; + beSmallSize; + aptitude: BrGlamorousLabelAptitude + BrGlamorousListItemAptitude. label text: item name asRopedText. label userData at: #slot put: item. - label ] + + label + addAptitude: (BrGlamorousWithContextMenuAptitude + content: [ BrGlamorousSimpleContextMenuContent new + items: (self slotListContextMenuItemsFor: item) ]). + element addChild: label ] onClick: [ :event | event consumed: true. self onSlotsListSelectionChanged ]. @@ -576,6 +605,45 @@ GtCoderNavigationPackagesTagsClassesElement >> showClassList [ classesLabel visibility: BlVisibility visible ] +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> slotListContextMenuItemsFor: item [ + ^ {('Push up ' , item name) + -> [ :elem | + | refactoring | + refactoring := RBPullUpInstanceVariableRefactoring + variable: item name + class: self selectedClass superclass. + self addPreviewButtonFor: refactoring to: elem ]. + ('Push down ' , item name) + -> [ :elem | + | refactoring | + refactoring := RBPushDownInstanceVariableRefactoring + variable: item name + class: self selectedClass. + self addPreviewButtonFor: refactoring to: elem ]. + ('Create accessors for ' , item name) + -> [ :elem | + | refactoring | + refactoring := RBCreateAccessorsForVariableRefactoring + instanceVariable: item name + class: self selectedClass. + self addPreviewButtonFor: refactoring to: elem ]. + ('Abstract ' , item name) + -> [ :elem | + | refactoring | + refactoring := RBAbstractInstanceVariableRefactoring + variable: item name + class: self selectedClass. + self addPreviewButtonFor: refactoring to: elem ]. + ('Protect ' , item name) + -> [ :elem | + | refactoring | + refactoring := RBProtectInstanceVariableRefactoring + variable: item name + class: self selectedClass. + self addPreviewButtonFor: refactoring to: elem ]} +] + { #category : #subscriptions } GtCoderNavigationPackagesTagsClassesElement >> subscribeToContent [ super subscribeToContent. From 8b7daa97c4d0869cf671f738e39690f3c7524990 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 2 Feb 2023 06:55:47 -0600 Subject: [PATCH 0384/1268] Make context menus in navigator look the same as coder context menus [feenkcom/gtoolkit#3041] --- ...CoderNavigationContextMenuContent.class.st | 41 ++++++++++++ ...igationPackagesTagsClassesElement.class.st | 65 +++++++++++++++---- 2 files changed, 95 insertions(+), 11 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderNavigationContextMenuContent.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationContextMenuContent.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationContextMenuContent.class.st new file mode 100644 index 000000000..8aa5d8223 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderNavigationContextMenuContent.class.st @@ -0,0 +1,41 @@ +Class { + #name : #GtCoderNavigationContextMenuContent, + #superclass : #BrSimpleList, + #category : #'GToolkit-Coder-UI-Navigation' +} + +{ #category : #accessing } +GtCoderNavigationContextMenuContent >> initialize [ + super initialize. + self + stencil: [ :e | + BlElement new + viewModel: (BrInteractiveModel new + withHover; + yourself); + aptitude: (BrStyleCommonAptitude new + hovered: [ :aStyle | aStyle background: self theme item selectedColor ]); + layout: BlLinearLayout horizontal; + constraintsDo: [ :c | + c horizontal matchParent. + c vertical fitContent ]; + padding: (BlInsets top: 2 bottom: 2); + when: BlClickEvent + do: [ e value cull: self anchor. + self anchor + dispatchEvent: (BrContextMenuHideWish new + anchor: self anchor; + yourself) ]; + addChild: (BrLabel new + aptitude: BrGlamorousLabelAptitude; + text: e key; + yourself); + yourself ]; + padding: (BlInsets + top: 8 + right: 10 + bottom: 8 + left: 10); + hFitContent; + vFitContent +] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 62878751d..b451ec548 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -112,10 +112,21 @@ GtCoderNavigationPackagesTagsClassesElement >> buildMethodGroupList [ | list | list := self buildGroupList. methodGroup := self - buildGroupWithBinder: [ :label :item | + buildMethodGroupWithBinder: [ :element :item | + | label | + element removeChildren. + element userData at: #method put: item. + label := BrLabel new + hMatchParent; + vFitContent; + beSmallSize; + aptitude: BrGlamorousLabelAptitude + BrGlamorousListItemAptitude. label text: item selector asRopedText. - label userData at: #method put: item. - label ] + + label + addAptitude: (BrGlamorousWithContextMenuAptitude + content: [ BrGlamorousSimpleContextMenuContent new items: {} ]). + element addChild: label ] onClick: [ :event | event consumed: true. self @@ -124,6 +135,24 @@ GtCoderNavigationPackagesTagsClassesElement >> buildMethodGroupList [ ^ list ] +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> buildMethodGroupWithBinder: binderBlock onClick: clickBlock [ + | classGroup instanceGroup | + instanceGroup := BrGroup new + domainObject: 'instance side'; + stream: #() asAsyncStream; + itemStencil: [ | label | + label := BrHorizontalPane new + hMatchParent; + vFitContent; + when: BlClickEvent do: clickBlock ]; + itemDataBinder: binderBlock; + shouldShowWithoutItems: false. + classGroup := instanceGroup copy domainObject: 'class side'. + ^ {instanceGroup. + classGroup} +] + { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> buildProtocolGroupList [ | list | @@ -173,11 +202,9 @@ GtCoderNavigationPackagesTagsClassesElement >> buildSlotsGroupList [ beSmallSize; aptitude: BrGlamorousLabelAptitude + BrGlamorousListItemAptitude. label text: item name asRopedText. - label userData at: #slot put: item. - label addAptitude: (BrGlamorousWithContextMenuAptitude - content: [ BrGlamorousSimpleContextMenuContent new + content: [ GtCoderNavigationContextMenuContent new items: (self slotListContextMenuItemsFor: item) ]). element addChild: label ] onClick: [ :event | @@ -187,6 +214,15 @@ GtCoderNavigationPackagesTagsClassesElement >> buildSlotsGroupList [ ^ list ] +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> createLabel: aString description: description [ + ^ aString asRopedText glamorousRegularFont + , ((' ' , description) asRopedText + glamorousCodeFont; + foreground: Color gray; + glamorousCodeTinySize) +] + { #category : #'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> deselectPackages [ packagesList deselectAll @@ -607,40 +643,47 @@ GtCoderNavigationPackagesTagsClassesElement >> showClassList [ { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> slotListContextMenuItemsFor: item [ - ^ {('Push up ' , item name) + ^ {(self createLabel: 'Push up ' description: item name) -> [ :elem | | refactoring | refactoring := RBPullUpInstanceVariableRefactoring variable: item name class: self selectedClass superclass. self addPreviewButtonFor: refactoring to: elem ]. - ('Push down ' , item name) + (self createLabel: 'Push down ' description: item name) -> [ :elem | | refactoring | refactoring := RBPushDownInstanceVariableRefactoring variable: item name class: self selectedClass. self addPreviewButtonFor: refactoring to: elem ]. - ('Create accessors for ' , item name) + (self createLabel: 'Create accessors for ' description: item name) -> [ :elem | | refactoring | refactoring := RBCreateAccessorsForVariableRefactoring instanceVariable: item name class: self selectedClass. self addPreviewButtonFor: refactoring to: elem ]. - ('Abstract ' , item name) + (self createLabel: 'Abstract ' description: item name) -> [ :elem | | refactoring | refactoring := RBAbstractInstanceVariableRefactoring variable: item name class: self selectedClass. self addPreviewButtonFor: refactoring to: elem ]. - ('Protect ' , item name) + (self createLabel: 'Protect ' description: item name) -> [ :elem | | refactoring | refactoring := RBProtectInstanceVariableRefactoring variable: item name class: self selectedClass. + self addPreviewButtonFor: refactoring to: elem ]. + (self createLabel: 'Remove ' description: item name) + -> [ :elem | + | refactoring | + refactoring := RBRemoveInstanceVariableRefactoring + variable: item name + class: self selectedClass. self addPreviewButtonFor: refactoring to: elem ]} ] From e34a0bc094713a3a5c7ece22e8bc5c415d08486c Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Thu, 2 Feb 2023 14:53:31 +0100 Subject: [PATCH 0385/1268] Only set onElementCreated when it is set on creation form [feenkcom/gtoolkit#2966] --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index 66ba61f69..5cda992e8 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -34,7 +34,9 @@ GtCreationForm >> acceptAction [ { #category : #converting } GtCreationForm >> asElement [ | viewModel | - viewModel := self asGtMagritteViewModel onElementCreated: self onElementCreated. + viewModel := self asGtMagritteViewModel. + self onElementCreated + ifNotNil: [ :aCallback | viewModel onElementCreated: aCallback ]. "save action should be available even if unchanged" viewModel actions first installOn: [ :aModel :aButton :aMemento | From 651bb993361cbaa639c54f25346d2abb1ca28e65 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 2 Feb 2023 10:16:50 -0600 Subject: [PATCH 0386/1268] Refactoring context menus [feenkcom/gtoolkit#3041] --- ...GtAbstractCoderContextMenuContent.class.st | 44 +++++++ .../GtCoderContextMenuContent.class.st | 116 ++++++++---------- ...CoderNavigationContextMenuContent.class.st | 51 +++----- 3 files changed, 112 insertions(+), 99 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtAbstractCoderContextMenuContent.class.st diff --git a/src/GToolkit-Coder-UI/GtAbstractCoderContextMenuContent.class.st b/src/GToolkit-Coder-UI/GtAbstractCoderContextMenuContent.class.st new file mode 100644 index 000000000..8c5379370 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtAbstractCoderContextMenuContent.class.st @@ -0,0 +1,44 @@ +Class { + #name : #GtAbstractCoderContextMenuContent, + #superclass : #BrSimpleList, + #category : #'GToolkit-Coder-UI-Basic' +} + +{ #category : #accessing } +GtAbstractCoderContextMenuContent >> initialize [ + super initialize. + self + stencil: self menuItemStencil; + padding: (BlInsets + top: 8 + right: 10 + bottom: 8 + left: 10); + hFitContent; + vFitContent +] + +{ #category : #accessing } +GtAbstractCoderContextMenuContent >> itemLabelFor: labelText [ + ^ BrLabel new + aptitude: BrGlamorousLabelAptitude; + text: labelText; + hMatchParent; + yourself +] + +{ #category : #accessing } +GtAbstractCoderContextMenuContent >> itemPadding [ + ^ BlInsets top: 2 bottom: 2 +] + +{ #category : #accessing } +GtAbstractCoderContextMenuContent >> menuItemStencil [ + self subclassResponsibility +] + +{ #category : #accessing } +GtAbstractCoderContextMenuContent >> selectionAptitude [ + ^ BrStyleCommonAptitude new + hovered: [ :aStyle | aStyle background: self theme item selectedColor ] +] diff --git a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st index 311f208a3..ce6f27b08 100644 --- a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st +++ b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st @@ -1,6 +1,6 @@ Class { #name : #GtCoderContextMenuContent, - #superclass : #BrSimpleList, + #superclass : #GtAbstractCoderContextMenuContent, #instVars : [ 'editorElement' ], @@ -22,68 +22,54 @@ GtCoderContextMenuContent >> editorElement: anEditorElement [ ] { #category : #initialization } -GtCoderContextMenuContent >> initialize [ - super initialize. - self - stencil: [ :eachGtCoderContextMenuAction | - | element | - element := BrHorizontalPane new - hMatchParent; - vFitContent; - alignCenter; - addAptitude: (BrStyleCommonAptitude new - hovered: [ :aStyle | aStyle background: self theme item selectedColor ]); - padding: (BlInsets top: 2 bottom: 2); - addChild: (BrLabel new - aptitude: BrGlamorousLabelAptitude; - text: eachGtCoderContextMenuAction title asRopedText; - hMatchParent; - yourself); - when: BlClickEvent - do: [ :anEvent | - anEvent consumed: true. - eachGtCoderContextMenuAction action - cull: self editorElement textualCoderViewModel - cull: self editorElement - cull: anEvent. - self fireEvent: BrDropdownHideWish new. - self fireEvent: BrContextMenuHideWish new ]. - ((eachGtCoderContextMenuAction shortcutKey respondsTo: #isEmpty) - and: [ eachGtCoderContextMenuAction shortcutKey isEmpty not ]) - ifTrue: [ element - addChild: (BrHorizontalPane new - fitContent; - geometry: (BlRoundedRectangleGeometry cornerRadius: 4); - border: (BlBorder paint: Color gray width: 1); - padding: (BlInsets all: 1); - margin: (BlInsets left: 10); - addChild: (BrLabel new - aptitude: BrGlamorousLabelAptitude; - text: (eachGtCoderContextMenuAction shortcutKey asRopedText - fontName: 'Source Code Pro'; - foreground: Color gray; - fontSize: 10); - hFitContent; - yourself); - yourself) ]. - eachGtCoderContextMenuAction hoverAction - ifNotNil: [ :hover | - element - when: BlMouseEnterEvent - do: [ :anEvent | hover cull: self editorElement textualCoderViewModel cull: anEvent ] ]. - eachGtCoderContextMenuAction leaveAction - ifNotNil: [ :leave | - element - when: BlMouseLeaveEvent - do: [ :anEvent | leave cull: self editorElement textualCoderViewModel cull: anEvent ] ]. - eachGtCoderContextMenuAction name - ifNotNil: [ :anActionName | element containerName: anActionName ]. - element ]; - padding: (BlInsets - top: 8 - right: 10 - bottom: 8 - left: 10); - hFitContent; - vFitContent +GtCoderContextMenuContent >> menuItemStencil [ + ^ [ :eachGtCoderContextMenuAction | + | element | + element := BrHorizontalPane new + hMatchParent; + vFitContent; + alignCenter; + addAptitude: self selectionAptitude; + padding: self itemPadding; + addChild: (self itemLabelFor: eachGtCoderContextMenuAction title asRopedText); + when: BlClickEvent + do: [ :anEvent | + anEvent consumed: true. + eachGtCoderContextMenuAction action + cull: self editorElement textualCoderViewModel + cull: self editorElement + cull: anEvent. + self fireEvent: BrDropdownHideWish new. + self fireEvent: BrContextMenuHideWish new ]. + ((eachGtCoderContextMenuAction shortcutKey respondsTo: #isEmpty) + and: [ eachGtCoderContextMenuAction shortcutKey isEmpty not ]) + ifTrue: [ element + addChild: (BrHorizontalPane new + fitContent; + geometry: (BlRoundedRectangleGeometry cornerRadius: 4); + border: (BlBorder paint: Color gray width: 1); + padding: (BlInsets all: 1); + margin: (BlInsets left: 10); + addChild: (BrLabel new + aptitude: BrGlamorousLabelAptitude; + text: (eachGtCoderContextMenuAction shortcutKey asRopedText + fontName: 'Source Code Pro'; + foreground: Color gray; + fontSize: 10); + hFitContent; + yourself); + yourself) ]. + eachGtCoderContextMenuAction hoverAction + ifNotNil: [ :hover | + element + when: BlMouseEnterEvent + do: [ :anEvent | hover cull: self editorElement textualCoderViewModel cull: anEvent ] ]. + eachGtCoderContextMenuAction leaveAction + ifNotNil: [ :leave | + element + when: BlMouseLeaveEvent + do: [ :anEvent | leave cull: self editorElement textualCoderViewModel cull: anEvent ] ]. + eachGtCoderContextMenuAction name + ifNotNil: [ :anActionName | element containerName: anActionName ]. + element ] ] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationContextMenuContent.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationContextMenuContent.class.st index 8aa5d8223..2b1bc4d95 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationContextMenuContent.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationContextMenuContent.class.st @@ -1,41 +1,24 @@ Class { #name : #GtCoderNavigationContextMenuContent, - #superclass : #BrSimpleList, + #superclass : #GtAbstractCoderContextMenuContent, #category : #'GToolkit-Coder-UI-Navigation' } { #category : #accessing } -GtCoderNavigationContextMenuContent >> initialize [ - super initialize. - self - stencil: [ :e | - BlElement new - viewModel: (BrInteractiveModel new - withHover; - yourself); - aptitude: (BrStyleCommonAptitude new - hovered: [ :aStyle | aStyle background: self theme item selectedColor ]); - layout: BlLinearLayout horizontal; - constraintsDo: [ :c | - c horizontal matchParent. - c vertical fitContent ]; - padding: (BlInsets top: 2 bottom: 2); - when: BlClickEvent - do: [ e value cull: self anchor. - self anchor - dispatchEvent: (BrContextMenuHideWish new - anchor: self anchor; - yourself) ]; - addChild: (BrLabel new - aptitude: BrGlamorousLabelAptitude; - text: e key; - yourself); - yourself ]; - padding: (BlInsets - top: 8 - right: 10 - bottom: 8 - left: 10); - hFitContent; - vFitContent +GtCoderNavigationContextMenuContent >> menuItemStencil [ + ^ [ :e | + BrHorizontalPane new + hMatchParent; + vFitContent; + alignCenter; + aptitude: self selectionAptitude; + padding: self itemPadding; + when: BlClickEvent + do: [ e value cull: self anchor. + self anchor + dispatchEvent: (BrContextMenuHideWish new + anchor: self anchor; + yourself) ]; + addChild: (self itemLabelFor: e key); + yourself ] ] From 83f82b1984dc22c10a208e12efb7c4bf722561d6 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 2 Feb 2023 12:52:38 -0600 Subject: [PATCH 0387/1268] Context menus for selector [feenkcom/gtoolkit#3041] --- ...igationPackagesTagsClassesElement.class.st | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index b451ec548..47fe78d35 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -125,7 +125,8 @@ GtCoderNavigationPackagesTagsClassesElement >> buildMethodGroupList [ label addAptitude: (BrGlamorousWithContextMenuAptitude - content: [ BrGlamorousSimpleContextMenuContent new items: {} ]). + content: [ GtCoderNavigationContextMenuContent new + items: (self methodListContextMenuItemsFor: item) ]). element addChild: label ] onClick: [ :event | event consumed: true. @@ -328,6 +329,31 @@ GtCoderNavigationPackagesTagsClassesElement >> methodList [ ^methodGroup flatCollect: [:grp | grp itemsProvider currentItems] ] +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> methodListContextMenuItemsFor: item [ + ^ {(self createLabel: 'Push up method' description: item name) + -> [ :elem | + | refactoring | + refactoring := RBPullUpMethodRefactoring + pullUp: {item selector} + from: self selectedClass. + self addPreviewButtonFor: refactoring to: elem ]. + (self createLabel: 'Push down method' description: item name) + -> [ :elem | + | refactoring | + refactoring := RBPushDownMethodRefactoring + pushDown: {item selector} + from: self selectedClass. + self addPreviewButtonFor: refactoring to: elem ]. + (self createLabel: 'Remove method' description: item name) + -> [ :elem | + | refactoring | + refactoring := RBRemoveMethodRefactoring + removeMethods: {item selector} + from: self selectedClass. + self addPreviewButtonFor: refactoring to: elem ]} +] + { #category : #'as yet unclassified' } GtCoderNavigationPackagesTagsClassesElement >> methodProtocolsList [ ^methodProtocolsList From ce51f32211a484ccd5479e004eaac4f1d7849cc1 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 3 Feb 2023 11:02:18 -0600 Subject: [PATCH 0388/1268] Remove unreferenced GtCoder2 class --- src/GToolkit-Coder-UI/GtCoder2.class.st | 148 ------------------ ...igationPackagesTagsClassesElement.class.st | 4 +- 2 files changed, 3 insertions(+), 149 deletions(-) delete mode 100644 src/GToolkit-Coder-UI/GtCoder2.class.st diff --git a/src/GToolkit-Coder-UI/GtCoder2.class.st b/src/GToolkit-Coder-UI/GtCoder2.class.st deleted file mode 100644 index 9a75f6bb2..000000000 --- a/src/GToolkit-Coder-UI/GtCoder2.class.st +++ /dev/null @@ -1,148 +0,0 @@ -Class { - #name : #GtCoder2, - #superclass : #BlElement, - #traits : 'TGtPagerPageInstantiator + TGtPhlowToolDetailAdjustable + TGtWithCoderToolViewModel + TBrLayoutResizable', - #classTraits : 'TGtPagerPageInstantiator classTrait + TGtPhlowToolDetailAdjustable classTrait + TGtWithCoderToolViewModel classTrait + TBrLayoutResizable classTrait', - #instVars : [ - 'coderContainer', - 'goBackButton', - 'navigationBreacrumb', - 'navigationSidebar' - ], - #category : #'GToolkit-Coder-UI-! Core' -} - -{ #category : #initialization } -GtCoder2 >> createCoderContainer [ - "A container that contains an actual current coder element. The content of the container - is replaced every time a coder is pushed or popped" - - ^ BrVerticalPane new - matchParent -] - -{ #category : #initialization } -GtCoder2 >> createGoBackButton [ - ^ BrButton new - aptitude: BrGlamorousButtonWithLabelAptitude; - label: 'Go back'; - action: [ self coderToolViewModel popCoderViewModel ] -] - -{ #category : #initialization } -GtCoder2 >> createNavigationBreadcrumb [ - ^ BrHorizontalPane new - hMatchParent; - vFitContent -] - -{ #category : #initialization } -GtCoder2 >> createNavigationSidebar [ - ^ GtPhlowHorizontalSidebarElement new beLeft -] - -{ #category : #initialization } -GtCoder2 >> initialize [ - super initialize. - - self layout: BlLinearLayout horizontal. - self matchParent. - - navigationSidebar := self createNavigationSidebar. - - goBackButton := self createGoBackButton. - navigationBreacrumb := self createNavigationBreadcrumb. - navigationBreacrumb addChild: goBackButton. - - coderContainer := self createCoderContainer. - - self addChildren: { - navigationSidebar. - - BrVerticalPane new - matchParent; - addChildren: { - navigationBreacrumb. - coderContainer } - }. - - self addInteractiveModelState: GtPhlowToolDetailModel new. - self addAptitude: (GtPhlowToolDetailAptitude new - normal: [ :theInstance | navigationSidebar hide ]; - detailed: [ :theInstance | navigationSidebar show ]). - - self - when: GtCoderToReplace - do: [ :anEvent | - anEvent consumed: true. - self coderToolViewModel pushCoderViewModel: anEvent coder asCoderViewModel ]. - - -] - -{ #category : #initialization } -GtCoder2 >> navigationStencil: aStencil [ - navigationSidebar contentStencil: aStencil -] - -{ #category : #'api - coder tool view model' } -GtCoder2 >> onCoderToolViewModelChanged [ - "Is sent when a new coderTool view model is assigned to the element. - Note: #onCoderToolViewModelChanged is sent before #subscribeToCoderToolViewModel - which means that if you perform any operation that triggers an announcement it will be ignored because the receiver - didn't get a chance to subscribe to any announcement. Override #onPostCoderToolViewModelChanged if you - wish to perform an operation that requires an announcement, but keep in mind that this is not the most efficient way" - - self updateGoBackButton. - self rebuildTopCoderElement -] - -{ #category : #'private - event handling' } -GtCoder2 >> onViewModelCoderPopped: anAnnouncement [ - self updateGoBackButton. - self rebuildTopCoderElement. -] - -{ #category : #'private - event handling' } -GtCoder2 >> onViewModelCoderPushed: anAnnouncement [ - self updateGoBackButton. - self rebuildTopCoderElement -] - -{ #category : #opening } -GtCoder2 >> pagerWindowTitle [ - - ^ self shortTitle -] - -{ #category : #'private - updating' } -GtCoder2 >> rebuildTopCoderElement [ - coderContainer removeChildren. - - self coderToolViewModel hasCoderViewModel - ifTrue: [ coderContainer addChild: self coderToolViewModel currentCoderViewModel asElement ] -] - -{ #category : #'api - coder tool view model' } -GtCoder2 >> subscribeToCoderToolViewModel [ - "Is sent after a new coderTool view model is assigned to the element. - It is required to unsubscribe from the view model or domain model by implementing - #unsubscribeFromCoderToolViewModel if elements subscribe to them" - - self coderToolViewModel weak - when: GtCoderToolViewModelCoderPushed send: #onViewModelCoderPushed: to: self; - when: GtCoderToolViewModelCoderPopped send: #onViewModelCoderPopped: to: self -] - -{ #category : #'api - coder tool view model' } -GtCoder2 >> unsubscribeFromCoderToolViewModel [ - "Is sent before a new coderTool view model is assigned to the element. - Elements that subscribe to coderTool view model in domain model are required to implement this methods." - - self coderToolViewModel unsubscribe: self -] - -{ #category : #'private - updating' } -GtCoder2 >> updateGoBackButton [ - goBackButton enabled: self coderToolViewModel canGoBack -] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 47fe78d35..9450e8eee 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -331,7 +331,9 @@ GtCoderNavigationPackagesTagsClassesElement >> methodList [ { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> methodListContextMenuItemsFor: item [ - ^ {(self createLabel: 'Push up method' description: item name) + ^ {(self createLabel: 'Browse Implementors' description: item name) + -> [ :elem | self halt ]. + (self createLabel: 'Push up method' description: item name) -> [ :elem | | refactoring | refactoring := RBPullUpMethodRefactoring From c6053969e2757f744f802e6e925d34b237a1a5ba Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Sun, 5 Feb 2023 02:16:50 +0100 Subject: [PATCH 0389/1268] remove shadow from the diff element with stencil --- .../GtDiffElementWithLabelStencil.class.st | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtDiffElementWithLabelStencil.class.st b/src/GToolkit-Coder-UI/GtDiffElementWithLabelStencil.class.st index dd57f615c..ad0cfec7a 100644 --- a/src/GToolkit-Coder-UI/GtDiffElementWithLabelStencil.class.st +++ b/src/GToolkit-Coder-UI/GtDiffElementWithLabelStencil.class.st @@ -67,8 +67,8 @@ GtDiffElementWithLabelStencil >> createFromLabel [ { #category : #'building - widgets' } GtDiffElementWithLabelStencil >> createPanesDiffElement [ | diffWrapper | - diffWrapper := BrVerticalPane new. - diffWrapper margin: (BlInsets all: 3). + diffWrapper := BrVerticalPane new." + diffWrapper margin: (BlInsets all: 3)." diffWrapper hMatchParent. diffWrapper vFitContent. @@ -79,8 +79,6 @@ GtDiffElementWithLabelStencil >> createPanesDiffElement [ vFitContent; beSmallSize). - diffWrapper addAptitude: (BrShadowAptitude new width: 1). - ^ diffWrapper ] From 64af288f51ef0cd01d91fec46e953510411659e9 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Mon, 6 Feb 2023 10:30:51 +0100 Subject: [PATCH 0390/1268] Reset add form after it was accepted [feenkcom/gtoolkit2966] --- src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index d5a24a296..e092b0323 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -99,7 +99,8 @@ GtCoderNavigationTabsStencil >> gtCreationInterface: look [ onAccept: [ :anInstance | look inUIProcessDo: [ form selectInNavigationModel: navigationModel anInstance: anInstance. - look fireEvent: BrDropdownHideWish new ] ]; + look fireEvent: BrDropdownHideWish new ]. + self formCache removeKey: each ]; onElementCreated: [ :aFrame | (aFrame childNamed: #field) requestFocus ]) asElement ]) removeFromParent ]) ]. ^ contentTabs From 014f1d2f768b526a581f4becd11f584783aa49d6 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Mon, 6 Feb 2023 11:00:52 -0600 Subject: [PATCH 0391/1268] More selector menu items [feenkcom/gtoolkit#3041] --- ...igationPackagesTagsClassesElement.class.st | 34 +++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 9450e8eee..fd4855e22 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -59,6 +59,30 @@ GtCoderNavigationPackagesTagsClassesElement >> addPreviewButtonFor: refactoring ^ elem addChild: button as: #preview ] +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> browseHierarchyImplementorsOf: aSymbol [ + self phlow + spawnObject: (GtSearchMethodsInClassFilter forClass: self selectedClass) withSuperclasses + withSubclasses & aSymbol gtImplementors +] + +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> browseHierarchyReferencesOf: aSymbol [ + self phlow + spawnObject: (GtSearchMethodsInClassFilter forClass: self selectedClass) withSuperclasses + withSubclasses & aSymbol gtSenders +] + +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> browseImplementorsOf: aSymbol [ + self phlow spawnObject: (GtSearchImplementorsFilter selector: aSymbol) +] + +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> browseReferencesOf: aSymbol [ + self phlow spawnObject: (GtSearchReferencesFilter literal: aSymbol) +] + { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> buildCategorySlotTabs [ | aTabGroup | @@ -331,8 +355,14 @@ GtCoderNavigationPackagesTagsClassesElement >> methodList [ { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> methodListContextMenuItemsFor: item [ - ^ {(self createLabel: 'Browse Implementors' description: item name) - -> [ :elem | self halt ]. + ^ {(self createLabel: 'Browse implementors' description: item name) + -> [ :elem | self browseImplementorsOf: item selector ]. + (self createLabel: 'Browse hierarachy implementors' description: item name) + -> [ :elem | self browseHierarchyImplementorsOf: item selector ]. + (self createLabel: 'Browse references' description: item name) + -> [ :elem | self browseReferencesOf: item selector ]. + (self createLabel: 'Browse hierarchy references' description: item name) + -> [ :elem | self browseHierarchyReferencesOf: item selector ]. (self createLabel: 'Push up method' description: item name) -> [ :elem | | refactoring | From 2bb462c988e1be134d701da965812aa0de905e57 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Mon, 6 Feb 2023 13:17:47 -0600 Subject: [PATCH 0392/1268] Only show selector in the description of the method list [feenkcom/gtoolkit#3041] --- ...NavigationPackagesTagsClassesElement.class.st | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index fd4855e22..9a542e6c0 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -355,29 +355,29 @@ GtCoderNavigationPackagesTagsClassesElement >> methodList [ { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> methodListContextMenuItemsFor: item [ - ^ {(self createLabel: 'Browse implementors' description: item name) + ^ {(self createLabel: 'Browse implementors' description: item selector) -> [ :elem | self browseImplementorsOf: item selector ]. - (self createLabel: 'Browse hierarachy implementors' description: item name) + (self createLabel: 'Browse hierarachy implementors' description: item selector) -> [ :elem | self browseHierarchyImplementorsOf: item selector ]. - (self createLabel: 'Browse references' description: item name) + (self createLabel: 'Browse references' description: item selector) -> [ :elem | self browseReferencesOf: item selector ]. - (self createLabel: 'Browse hierarchy references' description: item name) + (self createLabel: 'Browse hierarchy references' description: item selector) -> [ :elem | self browseHierarchyReferencesOf: item selector ]. - (self createLabel: 'Push up method' description: item name) + (self createLabel: 'Push up method' description: item selector) -> [ :elem | | refactoring | refactoring := RBPullUpMethodRefactoring pullUp: {item selector} from: self selectedClass. self addPreviewButtonFor: refactoring to: elem ]. - (self createLabel: 'Push down method' description: item name) + (self createLabel: 'Push down method' description: item selector) -> [ :elem | | refactoring | refactoring := RBPushDownMethodRefactoring pushDown: {item selector} from: self selectedClass. self addPreviewButtonFor: refactoring to: elem ]. - (self createLabel: 'Remove method' description: item name) + (self createLabel: 'Remove method' description: item selector) -> [ :elem | | refactoring | refactoring := RBRemoveMethodRefactoring @@ -386,7 +386,7 @@ GtCoderNavigationPackagesTagsClassesElement >> methodListContextMenuItemsFor: it self addPreviewButtonFor: refactoring to: elem ]} ] -{ #category : #'as yet unclassified' } +{ #category : #acccessing } GtCoderNavigationPackagesTagsClassesElement >> methodProtocolsList [ ^methodProtocolsList ] From 1104a0163aca287911a3d76cfdbe8eba3c7d4a4b Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Tue, 7 Feb 2023 09:49:35 +0100 Subject: [PATCH 0393/1268] Focus first in creation interface with focus finder [feenkcom/gtoolkit#2966] --- .../GtCoderNavigationTabsStencil.class.st | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index e092b0323..1d40955d6 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -101,8 +101,13 @@ GtCoderNavigationTabsStencil >> gtCreationInterface: look [ inUIProcessDo: [ form selectInNavigationModel: navigationModel anInstance: anInstance. look fireEvent: BrDropdownHideWish new ]. self formCache removeKey: each ]; - onElementCreated: [ :aFrame | (aFrame childNamed: #field) requestFocus ]) - asElement ]) removeFromParent ]) ]. + onElementCreated: [ :aFrame | + BlFocusFinder new + direction: BlFocusSearchDirectionForward new; + root: aFrame; + referenceElement: nil; + nextFocusDo: #requestFocus ifNone: [ ] ]) asElement ]) + removeFromParent ]) ]. ^ contentTabs ] From 13dec02d022721851b5e41fb2539af13f7f881e6 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 7 Feb 2023 09:58:26 -0600 Subject: [PATCH 0394/1268] Fix method group selection in indexes. --- .../GtCoderNavigationPackagesTagsClassesElement.class.st | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 9a542e6c0..7334d2946 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -144,7 +144,7 @@ GtCoderNavigationPackagesTagsClassesElement >> buildMethodGroupList [ hMatchParent; vFitContent; beSmallSize; - aptitude: BrGlamorousLabelAptitude + BrGlamorousListItemAptitude. + aptitude: BrGlamorousLabelAptitude. label text: item selector asRopedText. label @@ -168,6 +168,7 @@ GtCoderNavigationPackagesTagsClassesElement >> buildMethodGroupWithBinder: binde stream: #() asAsyncStream; itemStencil: [ | label | label := BrHorizontalPane new + aptitude: BrGlamorousListItemAptitude; hMatchParent; vFitContent; when: BlClickEvent do: clickBlock ]; From 4d1ee47214790886f2c9c126291b6ca46d843280 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 8 Feb 2023 09:58:07 -0600 Subject: [PATCH 0395/1268] Refactor context menu code --- ...igationPackagesTagsClassesElement.class.st | 64 ++++++++++++------- 1 file changed, 41 insertions(+), 23 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 7334d2946..20577c436 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -349,11 +349,6 @@ GtCoderNavigationPackagesTagsClassesElement >> initializeLayout [ c vertical matchParent ] ] -{ #category : #'api - package selections' } -GtCoderNavigationPackagesTagsClassesElement >> methodList [ - ^methodGroup flatCollect: [:grp | grp itemsProvider currentItems] -] - { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> methodListContextMenuItemsFor: item [ ^ {(self createLabel: 'Browse implementors' description: item selector) @@ -365,26 +360,13 @@ GtCoderNavigationPackagesTagsClassesElement >> methodListContextMenuItemsFor: it (self createLabel: 'Browse hierarchy references' description: item selector) -> [ :elem | self browseHierarchyReferencesOf: item selector ]. (self createLabel: 'Push up method' description: item selector) - -> [ :elem | - | refactoring | - refactoring := RBPullUpMethodRefactoring - pullUp: {item selector} - from: self selectedClass. - self addPreviewButtonFor: refactoring to: elem ]. + -> [ :elem | self renameMethod: item selector inElement: elem ]. (self createLabel: 'Push down method' description: item selector) - -> [ :elem | - | refactoring | - refactoring := RBPushDownMethodRefactoring - pushDown: {item selector} - from: self selectedClass. - self addPreviewButtonFor: refactoring to: elem ]. + -> [ :elem | self pushDownMethod: item selector inElement: elem ]. + (self createLabel: 'Rename message' description: item selector) + -> [ :elem | self renameMethod: item selector inElement: elem ]. (self createLabel: 'Remove method' description: item selector) - -> [ :elem | - | refactoring | - refactoring := RBRemoveMethodRefactoring - removeMethods: {item selector} - from: self selectedClass. - self addPreviewButtonFor: refactoring to: elem ]} + -> [ :elem | self removeMethod: item selector inElement: elem ]} ] { #category : #acccessing } @@ -550,6 +532,33 @@ GtCoderNavigationPackagesTagsClassesElement >> onSlotsListSelectionChanged [ self updateMethodListWith: instMeths and: classMeths ] +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> pushDownMethod: aSelector inElement: elem [ + | refactoring | + refactoring := RBPushDownMethodRefactoring + pushDown: {aSelector} + from: self selectedClass. + ^ self addPreviewButtonFor: refactoring to: elem +] + +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> removeMethod: aSelector inElement: elem [ + | refactoring button | + refactoring := RBRemoveMethodChange remove: aSelector from: self selectedClass. + button := GtPreviewChangeButton new + icon: BrGlamorousVectorIcons remove; + label: 'Remove'; + changeAction: [ refactoring execute ]; + changeStencil: [ GtPharoRemoveMethodPreviewStencil new + selectorToRemove: aSelector; + isEmptyMethod: false; + create ]. + button + when: GtRefactoringsAppliedEvent + do: [ :anEvent | elem removeChild: anEvent currentTarget ]. + ^ elem addChild: button as: #preview +] + { #category : #'api - package updates' } GtCoderNavigationPackagesTagsClassesElement >> removePackage: aPackage [ | aSelectedPackageOrTag anIndex | @@ -575,6 +584,15 @@ GtCoderNavigationPackagesTagsClassesElement >> removePackage: aPackage tag: aPac self reselectPackageOrTag: aSelectedPackageOrTag afterRemovalOfTagNamed: aPackageTagName. ] +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> renameMethod: aSelector inElement: elem [ + | refactoring | + refactoring := RBPullUpMethodRefactoring + pullUp: {aSelector} + from: self selectedClass. + ^ self addPreviewButtonFor: refactoring to: elem +] + { #category : #'api - package updates' } GtCoderNavigationPackagesTagsClassesElement >> renamePackage: aPackage oldName: anOldName newName: aNewName [ | aSelectedPackageOrTag | From 16a037c137c2c35f9f1eeec9110605f5992221be Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 8 Feb 2023 12:41:17 -0600 Subject: [PATCH 0396/1268] Fix broken example by restoring accidently removed method --- .../GtCoderNavigationPackagesTagsClassesElement.class.st | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 20577c436..7d3f7c571 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -349,6 +349,11 @@ GtCoderNavigationPackagesTagsClassesElement >> initializeLayout [ c vertical matchParent ] ] +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> methodList [ + ^ methodGroup flatCollect: [ :grp | grp itemsProvider currentItems ] +] + { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> methodListContextMenuItemsFor: item [ ^ {(self createLabel: 'Browse implementors' description: item selector) From a288af906672ef87a781a9cb62d59b43e297be05 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 8 Feb 2023 14:09:08 -0600 Subject: [PATCH 0397/1268] Add rename method to index context menu [feenkcom/gtoolkit#3041] --- ...igationPackagesTagsClassesElement.class.st | 37 ++++++++++++++++--- 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 7d3f7c571..5eebf0121 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -42,6 +42,7 @@ GtCoderNavigationPackagesTagsClassesElement >> addPackage: aPackage tag: aPackag { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> addPreviewButtonFor: refactoring to: elem [ | button | + elem removeChildNamed: #preview. button := GtRefactoringsPreviewButton new. button vMatchParent. button refactorings: [ {refactoring} ]. @@ -365,7 +366,7 @@ GtCoderNavigationPackagesTagsClassesElement >> methodListContextMenuItemsFor: it (self createLabel: 'Browse hierarchy references' description: item selector) -> [ :elem | self browseHierarchyReferencesOf: item selector ]. (self createLabel: 'Push up method' description: item selector) - -> [ :elem | self renameMethod: item selector inElement: elem ]. + -> [ :elem | self pushUpMethod: item selector inElement: elem ]. (self createLabel: 'Push down method' description: item selector) -> [ :elem | self pushDownMethod: item selector inElement: elem ]. (self createLabel: 'Rename message' description: item selector) @@ -546,6 +547,15 @@ GtCoderNavigationPackagesTagsClassesElement >> pushDownMethod: aSelector inEleme ^ self addPreviewButtonFor: refactoring to: elem ] +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> pushUpMethod: aSelector inElement: elem [ + | refactoring | + refactoring := RBPullUpMethodRefactoring + pullUp: {aSelector} + from: self selectedClass. + ^ self addPreviewButtonFor: refactoring to: elem +] + { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> removeMethod: aSelector inElement: elem [ | refactoring button | @@ -591,11 +601,26 @@ GtCoderNavigationPackagesTagsClassesElement >> removePackage: aPackage tag: aPac { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> renameMethod: aSelector inElement: elem [ - | refactoring | - refactoring := RBPullUpMethodRefactoring - pullUp: {aSelector} - from: self selectedClass. - ^ self addPreviewButtonFor: refactoring to: elem + | refactoring edit | + edit := BrEditableLabel new. + edit + aptitude: (BrGlamorousEditableLabelAptitude new + glamorousCodeSmallSize; + background: Color transparent); + text: aSelector; + when: BrEditorAcceptWish + do: [ :aWish | + refactoring := RBRenameMethodRefactoring + renameMethod: aSelector + in: self selectedClass + to: aWish text asString + permutation: (1 to: aSelector numArgs). + edit switchToLabel. + self addPreviewButtonFor: refactoring to: elem ]; + switchToEditor. + edit requestFocus. + elem removeChildren. + elem addChild: edit ] { #category : #'api - package updates' } From 8136043f0e1639893cac60d8258ae71fba1f6c10 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Thu, 9 Feb 2023 10:21:36 +0100 Subject: [PATCH 0398/1268] Add baseline-based completion strategy --- .../GtBaselinesCompletionStrategy.class.st | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/GToolkit-Coder/GtBaselinesCompletionStrategy.class.st diff --git a/src/GToolkit-Coder/GtBaselinesCompletionStrategy.class.st b/src/GToolkit-Coder/GtBaselinesCompletionStrategy.class.st new file mode 100644 index 000000000..fb3ac97c7 --- /dev/null +++ b/src/GToolkit-Coder/GtBaselinesCompletionStrategy.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtBaselinesCompletionStrategy, + #superclass : #GtClassesCompletionStrategy, + #category : #'GToolkit-Coder-Completion' +} + +{ #category : #accessing } +GtBaselinesCompletionStrategy >> candidateClasses [ + ^ super candidateClasses select: [:aClassName | aClassName beginsWith: 'BaselineOf' ] +] From 85c288fabdc75384c3b89d5ac5b1e8530da58cdd Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Thu, 9 Feb 2023 11:24:06 +0100 Subject: [PATCH 0399/1268] Remove outdated shortcut from creation form taggers --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index 5cda992e8..8783d9e28 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -154,11 +154,7 @@ GtCreationForm >> taggerStencilWithCompletion: aCompletionStrategy [ aLabel := BrEditableLabel new text: (aDescription displayStringFor: aTag name); aptitude: (BrGlamorousEditableLabelAptitude new glamorousCodeFont - defaultForeground: Color black); - whenKey: BlKeyCombination arrowRight - editorDo: [ :anEvent | - anEvent target acceptEdition. - aTaggerAptitude addTagCreatorElement ]. + defaultForeground: Color black). aCompletionStrategy ifNotNil: [ (GtCompletionController on: aLabel strategy: aCompletionStrategy) install ]. aLabel ]). From 8e57afcbd9c723e4617a9612ed737b13070e7a32 Mon Sep 17 00:00:00 2001 From: Andrei Chis Date: Thu, 9 Feb 2023 12:26:03 +0100 Subject: [PATCH 0400/1268] Add GtCoderSourceCoderChange>>textEditCommand [/feenkcom/gtoolkit#2503] --- src/GToolkit-Coder/GtCoderSourceCodeChanged.class.st | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/GToolkit-Coder/GtCoderSourceCodeChanged.class.st b/src/GToolkit-Coder/GtCoderSourceCodeChanged.class.st index f281639a2..7a34a6439 100644 --- a/src/GToolkit-Coder/GtCoderSourceCodeChanged.class.st +++ b/src/GToolkit-Coder/GtCoderSourceCodeChanged.class.st @@ -58,6 +58,14 @@ GtCoderSourceCodeChanged >> source [ ^ self updateStrategy source ] +{ #category : #accessing } +GtCoderSourceCodeChanged >> textEditCommand [ + ^ self reason ifNotNil: [ :aReason| + (aReason isKindOf: BrTextEditorModifiedEvent) + ifTrue: [ aReason editCommand ] + ifFalse: [ nil ] ] +] + { #category : #accessing } GtCoderSourceCodeChanged >> updateStrategy [ ^ updateStragegy From b14e89384a475a5692e4e254670dc57ff1b09174 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 9 Feb 2023 11:57:37 -0600 Subject: [PATCH 0401/1268] Add remove class to index context menu [feenkcom/gtoolkit#3041] --- ...gationClassesHierarchyTreeElement.class.st | 84 ++++++++++++++++--- .../GtCoderNavigationElement.class.st | 8 +- ...igationPackagesTagsClassesElement.class.st | 24 ++++-- .../GtCoderNavigationClassRemoved.class.st | 5 ++ 4 files changed, 104 insertions(+), 17 deletions(-) create mode 100644 src/GToolkit-Coder/GtCoderNavigationClassRemoved.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st index 192f6d552..9c961d25b 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st @@ -9,7 +9,7 @@ Class { #instVars : [ 'classesTree' ], - #category : 'GToolkit-Coder-UI-Navigation' + #category : #'GToolkit-Coder-UI-Navigation' } { #category : #'instance creation' } @@ -17,6 +17,38 @@ GtCoderNavigationClassesHierarchyTreeElement class >> fromClasses: aCollectionOf ^ self new initializeWithClasses: aCollectionOfClasses ] +{ #category : #initialization } +GtCoderNavigationClassesHierarchyTreeElement >> buildRemoveClassLabelFor: aClass [ + | labelText | + labelText := (aClass isReferenced + ifTrue: [ '<1s> is referenced. Remove anyway?' ] + ifFalse: [ aClass subclasses isEmpty + ifTrue: [ 'Remove class <1s>' ] + ifFalse: [ '<1s> has subclasses. Remove anyway?' ] ]) + expandMacrosWith: aClass name. + ^ BrLabel new + margin: (BlInsets all: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont; + text: labelText asRopedText +] + +{ #category : #initialization } +GtCoderNavigationClassesHierarchyTreeElement >> classListContextMenuItemsFor: aClass [ + ^{(self createLabel: 'Rename class' description: aClass name) + -> [ :elem | self renameClass: aClass inElement: elem ]. + (self createLabel: 'Remove class' description: aClass name) + -> [ :elem | self removeClass: aClass inElement: elem ]} +] + +{ #category : #initialization } +GtCoderNavigationClassesHierarchyTreeElement >> createLabel: aString description: description [ + ^ aString asRopedText glamorousRegularFont + , ((' ' , description) asRopedText + glamorousCodeFont; + foreground: Color gray; + glamorousCodeTinySize) +] + { #category : #'private - ui' } GtCoderNavigationClassesHierarchyTreeElement >> expandClass: aClass [ | aClassDepth | @@ -29,18 +61,23 @@ GtCoderNavigationClassesHierarchyTreeElement >> expandClass: aClass [ { #category : #initialization } GtCoderNavigationClassesHierarchyTreeElement >> initialize [ super initialize. - + self rowStencil: BrGlamorousSimpleTreeSelectableRowElementStencilBuilder new. - + self - nodeStencil: [ BrLabel new - beSmallSize; - aptitude: BrGlamorousLabelAptitude ]; + nodeStencil: [ BrHorizontalPane new + aptitude: BrGlamorousListItemAptitude; + hMatchParent; + vFitContent ]; nodeDataBinder: [ :aClassElement :aClassHierarchyTree | - aClassElement - text: - (aClassHierarchyTree - ifNil: [ '' asRopedText ] + | label | + aClassElement removeChildren. + label := BrLabel new + beSmallSize; + aptitude: BrGlamorousLabelAptitude. + aClassElement addChild: label. + aClassHierarchyTree + ifNil: [ label text: '' asRopedText] ifNotNil: [ | aClass aText | aClass := aClassHierarchyTree rootClass. aText := aClass gtDisplayText asRopedText. @@ -48,7 +85,12 @@ GtCoderNavigationClassesHierarchyTreeElement >> initialize [ ifTrue: [ aText italic ]. aClass isDeprecated ifTrue: [ aText append: ' (deprecated)' asRopedText italic ]. - aText ]) ] + label text: aText. + label + addAptitude: (BrGlamorousWithContextMenuAptitude + content: [ GtCoderNavigationContextMenuContent new + items: (self classListContextMenuItemsFor: aClass) ]).]. + ] ] { #category : #'api - initialization' } @@ -71,6 +113,26 @@ GtCoderNavigationClassesHierarchyTreeElement >> initializeWithHierachyForClass: self expandAll ] +{ #category : #initialization } +GtCoderNavigationClassesHierarchyTreeElement >> removeClass: aClass inElement: elem [ + | change button | + change := RBRemoveClassChange remove: aClass. + button := GtPreviewChangeButton new + icon: BrGlamorousVectorIcons remove; + label: 'Remove'; + changeAction: [ change execute ]; + changeStencil: [ self buildRemoveClassLabelFor: aClass ]. + button + when: GtRefactoringsAppliedEvent + do: [ :anEvent | elem removeChild: anEvent currentTarget ]. + ^ elem addChild: button as: #preview +] + +{ #category : #initialization } +GtCoderNavigationClassesHierarchyTreeElement >> renameClass: aClass inElement: elem [ + self halt +] + { #category : #'api - selection' } GtCoderNavigationClassesHierarchyTreeElement >> selectedClass [ diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st index 0fc2a4b53..36967e5f4 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st @@ -107,6 +107,11 @@ GtCoderNavigationElement >> onClassModified: anAnnouncement [ tag: anAnnouncement tag ] ] +{ #category : #'event handling' } +GtCoderNavigationElement >> onClassRemoved: anAnnouncement [ + self subclassResponsibility +] + { #category : #'event handling' } GtCoderNavigationElement >> onClassRenamed: anAnnouncement [ self @@ -199,7 +204,8 @@ GtCoderNavigationElement >> subscribeToNavigationModel [ subscriptions := {GtCoderNavigationClassSelected -> #onClassSelected:. GtCoderNavigationClassRenamed -> #onClassRenamed:. GtCoderNavigationClassModified -> #onClassModified:. - GtCoderNavigationClassAdded-> #onClassAdded: }. + GtCoderNavigationClassAdded-> #onClassAdded:. + GtCoderNavigationClassRemoved -> #onClassRemoved: }. subscriptions do: [ :sub | diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 5eebf0121..b7ec542c7 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -380,6 +380,14 @@ GtCoderNavigationPackagesTagsClassesElement >> methodProtocolsList [ ^methodProtocolsList ] +{ #category : #accessing } +GtCoderNavigationPackagesTagsClassesElement >> onClassRemoved: anAnnouncement [ + | aPackageOrTag | + aPackageOrTag := self selectedPackageOrTag. + packagesList deselectAll. + self selectPackage: aPackageOrTag +] + { #category : #accessing } GtCoderNavigationPackagesTagsClassesElement >> onClassSelected: anAnnouncement [ self @@ -577,15 +585,14 @@ GtCoderNavigationPackagesTagsClassesElement >> removeMethod: aSelector inElement { #category : #'api - package updates' } GtCoderNavigationPackagesTagsClassesElement >> removePackage: aPackage [ | aSelectedPackageOrTag anIndex | - anIndex := packagesList viewModel indexOf: aPackage. anIndex > 0 ifFalse: [ ^ self ]. - - packagesList selectedNodeDo: [ :aNode | - aSelectedPackageOrTag := aNode value ]. + aSelectedPackageOrTag := self selectedPackageOrTag. self updatePackageLists. - self reselectPackageOrTag: aSelectedPackageOrTag afterRemovalOfPackageNamed: aPackage name. + self + reselectPackageOrTag: aSelectedPackageOrTag + afterRemovalOfPackageNamed: aPackage name ] { #category : #'api - package updates' } @@ -731,6 +738,13 @@ GtCoderNavigationPackagesTagsClassesElement >> selectedPackageNodeDo: aBlock [ ^ packagesList selectedPackageNodeDo: aBlock ] +{ #category : #'api - package updates' } +GtCoderNavigationPackagesTagsClassesElement >> selectedPackageOrTag [ + | aSelectedPackageOrTag | + packagesList selectedNodeDo: [ :aNode | aSelectedPackageOrTag := aNode value ]. + ^ aSelectedPackageOrTag +] + { #category : #'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> selectedPackageTag [ diff --git a/src/GToolkit-Coder/GtCoderNavigationClassRemoved.class.st b/src/GToolkit-Coder/GtCoderNavigationClassRemoved.class.st new file mode 100644 index 000000000..d8f21e6d3 --- /dev/null +++ b/src/GToolkit-Coder/GtCoderNavigationClassRemoved.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtCoderNavigationClassRemoved, + #superclass : #GtCoderNavigationClassAnnouncement, + #category : #'GToolkit-Coder-Navigation - Events' +} From 104074734b63e4e8db8ce953b415e29b223e8f0a Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 10 Feb 2023 10:37:58 -0600 Subject: [PATCH 0402/1268] Add rename class to index context menu [feenkcom/gtoolkit#3041] --- ...gationClassesHierarchyTreeElement.class.st | 40 ++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st index 9c961d25b..873408de0 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st @@ -17,6 +17,27 @@ GtCoderNavigationClassesHierarchyTreeElement class >> fromClasses: aCollectionOf ^ self new initializeWithClasses: aCollectionOfClasses ] +{ #category : #accessing } +GtCoderNavigationClassesHierarchyTreeElement >> addPreviewButtonFor: refactoring to: elem [ + | button | + elem removeChildNamed: #preview. + button := GtRefactoringsPreviewButton new. + button vMatchParent. + button refactorings: [ {refactoring} ]. + button cancelBlock: [ ]. + button + padding: (BlInsets + top: 1 + right: 4 + bottom: 0 + left: 4). + button beMiniSize. + button + when: GtRefactoringsAppliedEvent + do: [ :anEvent | elem removeChild: anEvent currentTarget ]. + ^ elem addChild: button as: #preview +] + { #category : #initialization } GtCoderNavigationClassesHierarchyTreeElement >> buildRemoveClassLabelFor: aClass [ | labelText | @@ -130,7 +151,24 @@ GtCoderNavigationClassesHierarchyTreeElement >> removeClass: aClass inElement: e { #category : #initialization } GtCoderNavigationClassesHierarchyTreeElement >> renameClass: aClass inElement: elem [ - self halt + | refactoring edit | + edit := BrEditableLabel new. + edit + aptitude: (BrGlamorousEditableLabelAptitude new + glamorousCodeSmallSize; + background: Color transparent); + text: aClass name; + when: BrEditorAcceptWish + do: [ :aWish | + refactoring := RBRenameClassRefactoring + rename: aClass name + to: aWish text asString. + edit switchToLabel. + self addPreviewButtonFor: refactoring to: elem ]; + switchToEditor. + edit requestFocus. + elem removeChildren. + elem addChild: edit ] { #category : #'api - selection' } From a6c8dcb0617318bf6c15db3ee9fb82f0092be048 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 14 Feb 2023 15:10:53 -0600 Subject: [PATCH 0403/1268] Add package context menu and refactorings [feenkcom/gtoolkit#3041] --- ...igationClassesListElementExamples.class.st | 13 -- ...gationClassesHierarchyTreeElement.class.st | 23 ++-- ...CoderNavigationClassesListElement.class.st | 79 ----------- ...igationPackagesTagsClassesElement.class.st | 11 +- ...oderNavigationPackagesTreeElement.class.st | 126 ++++++++++++++++-- .../TGtCoderNavigationClassesHelper.trait.st | 34 ----- .../TNavigationWithContextMenu.trait.st | 34 +++++ 7 files changed, 163 insertions(+), 157 deletions(-) delete mode 100644 src/GToolkit-Coder-Examples/GtCoderNavigationClassesListElementExamples.class.st delete mode 100644 src/GToolkit-Coder-UI/GtCoderNavigationClassesListElement.class.st delete mode 100644 src/GToolkit-Coder-UI/TGtCoderNavigationClassesHelper.trait.st create mode 100644 src/GToolkit-Coder-UI/TNavigationWithContextMenu.trait.st diff --git a/src/GToolkit-Coder-Examples/GtCoderNavigationClassesListElementExamples.class.st b/src/GToolkit-Coder-Examples/GtCoderNavigationClassesListElementExamples.class.st deleted file mode 100644 index 14e424e88..000000000 --- a/src/GToolkit-Coder-Examples/GtCoderNavigationClassesListElementExamples.class.st +++ /dev/null @@ -1,13 +0,0 @@ -Class { - #name : #GtCoderNavigationClassesListElementExamples, - #superclass : #Object, - #category : #'GToolkit-Coder-Examples-Navigation' -} - -{ #category : #'instance creation' } -GtCoderNavigationClassesListElementExamples >> fromCollectionClasses [ - - - ^ GtCoderNavigationClassesListElement - fromClasses: #'Collections-Abstract' asPackage definedClasses -] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st index 873408de0..fb7c3010a 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st @@ -6,6 +6,8 @@ I show a list of classes grouping them based on the inheritance hierarchy and so Class { #name : #GtCoderNavigationClassesHierarchyTreeElement, #superclass : #BrSimpleTree, + #traits : 'TNavigationWithContextMenu', + #classTraits : 'TNavigationWithContextMenu classTrait', #instVars : [ 'classesTree' ], @@ -54,22 +56,15 @@ GtCoderNavigationClassesHierarchyTreeElement >> buildRemoveClassLabelFor: aClass ] { #category : #initialization } -GtCoderNavigationClassesHierarchyTreeElement >> classListContextMenuItemsFor: aClass [ - ^{(self createLabel: 'Rename class' description: aClass name) +GtCoderNavigationClassesHierarchyTreeElement >> contextMenuItemsFor: aClass [ + ^ {"(self createLabel: 'New Subclass' description: aClass name) + -> [ :elem | self newSubclassOf: aClass ]." + (self createLabel: 'Rename class' description: aClass name) -> [ :elem | self renameClass: aClass inElement: elem ]. (self createLabel: 'Remove class' description: aClass name) -> [ :elem | self removeClass: aClass inElement: elem ]} ] -{ #category : #initialization } -GtCoderNavigationClassesHierarchyTreeElement >> createLabel: aString description: description [ - ^ aString asRopedText glamorousRegularFont - , ((' ' , description) asRopedText - glamorousCodeFont; - foreground: Color gray; - glamorousCodeTinySize) -] - { #category : #'private - ui' } GtCoderNavigationClassesHierarchyTreeElement >> expandClass: aClass [ | aClassDepth | @@ -110,7 +105,7 @@ GtCoderNavigationClassesHierarchyTreeElement >> initialize [ label addAptitude: (BrGlamorousWithContextMenuAptitude content: [ GtCoderNavigationContextMenuContent new - items: (self classListContextMenuItemsFor: aClass) ]).]. + items: (self contextMenuItemsFor: aClass) ]).]. ] ] @@ -134,6 +129,10 @@ GtCoderNavigationClassesHierarchyTreeElement >> initializeWithHierachyForClass: self expandAll ] +{ #category : #initialization } +GtCoderNavigationClassesHierarchyTreeElement >> newSubclassOf: aClass [ +] + { #category : #initialization } GtCoderNavigationClassesHierarchyTreeElement >> removeClass: aClass inElement: elem [ | change button | diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassesListElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassesListElement.class.st deleted file mode 100644 index eaee18d05..000000000 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassesListElement.class.st +++ /dev/null @@ -1,79 +0,0 @@ -" -I show a simple list of classes sorting alphabetically - - -" -Class { - #name : #GtCoderNavigationClassesListElement, - #superclass : #BrSimpleList, - #traits : 'TGtCoderNavigationClassesHelper', - #classTraits : 'TGtCoderNavigationClassesHelper classTrait', - #category : 'GToolkit-Coder-UI-Navigation' -} - -{ #category : #'instance creation' } -GtCoderNavigationClassesListElement class >> fromClasses: aCollectionOfClasses [ - ^ self new initializeWithClasses: aCollectionOfClasses -] - -{ #category : #'private - ui' } -GtCoderNavigationClassesListElement >> buildClassLabel: aClass [ - | aLook aText | - aLook := (BrGlamorousLabelAptitude new fontSize: 12). - aText := aClass name. - - (self isAbstractClass: aClass) - ifTrue: [ aLook italic ]. - - (self isDeprecatedClass: aClass) - ifTrue: [ - aText := aText, ' (deprecated)'. - Transcript show: aText; cr. - aLook bold ]. - - ^ BrLabel new - aptitude: aLook; - text: aText. -] - -{ #category : #'private - ui' } -GtCoderNavigationClassesListElement >> buildClassRow: aClass index: aRowIndex list: aListElement [ - ^ BrWidgetContainer new - layout: BlLinearLayout horizontal; - aptitude: - BrHorizontalPaneAptitude new - + - (BrStyleCommonAptitude new - default: - [ :aStyle | aStyle background: self theme item deselectedColor ]; - hovered: - [ :aStyle | aStyle background: self theme item hoveredColor ]; - selected: - [ :aStyle | aStyle background: self theme item selectedColor ]; - pressed: - [ :aStyle | aStyle background: self theme item pressedColor ]; - focused: [ :aStyle | - aStyle - border: (BlBorder paint: self theme item focusedBorderColor width: 1) ]); - when: BlMouseDownEvent - do: [ :anEvent | - anEvent consumed: true. - aListElement selectOne: aRowIndex dueTo: anEvent. - aListElement requestFocus ]; - hMatchParent; - vFitContent; - padding: (BlInsets left: 3); - addChild: (self buildClassLabel: aClass) -] - -{ #category : #initialization } -GtCoderNavigationClassesListElement >> initialize [ - super initialize. - - self stencil: [ :eachClass :eachIndex :aListElement | self buildClassRow: eachClass index: eachIndex list: aListElement ] -] - -{ #category : #initialization } -GtCoderNavigationClassesListElement >> initializeWithClasses: aCollectionOfClasses [ - self items: (aCollectionOfClasses sorted: [ :classA :classB | classA name < classB name ]) -] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index b7ec542c7..cdd2e0009 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -1,6 +1,8 @@ Class { #name : #GtCoderNavigationPackagesTagsClassesElement, #superclass : #GtCoderNavigationElement, + #traits : 'TNavigationWithContextMenu', + #classTraits : 'TNavigationWithContextMenu classTrait', #instVars : [ 'packagesList', 'classesLabel', @@ -241,15 +243,6 @@ GtCoderNavigationPackagesTagsClassesElement >> buildSlotsGroupList [ ^ list ] -{ #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> createLabel: aString description: description [ - ^ aString asRopedText glamorousRegularFont - , ((' ' , description) asRopedText - glamorousCodeFont; - foreground: Color gray; - glamorousCodeTinySize) -] - { #category : #'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> deselectPackages [ packagesList deselectAll diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st index 241d454c1..56d1a574b 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st @@ -6,7 +6,9 @@ I show a simple list of packages sorting alphabetically Class { #name : #GtCoderNavigationPackagesTreeElement, #superclass : #BrSimpleTree, - #category : 'GToolkit-Coder-UI-Navigation' + #traits : 'TNavigationWithContextMenu', + #classTraits : 'TNavigationWithContextMenu classTrait', + #category : #'GToolkit-Coder-UI-Navigation' } { #category : #'instance creation' } @@ -14,6 +16,16 @@ GtCoderNavigationPackagesTreeElement class >> fromPackages: aCollectionOfPackage ^ self new initializeWithPackages: aCollectionOfPackages ] +{ #category : #initialization } +GtCoderNavigationPackagesTreeElement >> buildRemovePackageLabelFor: aPackage [ + | labelText | + labelText := 'Remove package <1s>' expandMacrosWith: aPackage name. + ^ BrLabel new + margin: (BlInsets all: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont; + text: labelText asRopedText +] + { #category : #'private - enumeration' } GtCoderNavigationPackagesTreeElement >> childrenForPackageOrTag: aPackageOrTag [ | theTags anExtension | @@ -33,21 +45,63 @@ GtCoderNavigationPackagesTreeElement >> childrenForPackageOrTag: aPackageOrTag [ ^ theTags ] +{ #category : #initialization } +GtCoderNavigationPackagesTreeElement >> contextMenuItemsFor: aPackageOrTag [ + | items | + items := {"(self createLabel: 'New package' description: '') + -> [ :elem | self newPackage ]. + (self createLabel: 'New tag' description: aPackageOrTag name) + -> [ :elem | self newTagFor: aPackageOrTag inElement: elem ]"} + asOrderedCollection. + aPackageOrTag class == RPackage + ifTrue: [ items + addAll: {(self createLabel: 'Rename package' description: aPackageOrTag name) + -> [ :elem | self renamePackage: aPackageOrTag inElement: elem ]. + (self createLabel: 'Remove package' description: aPackageOrTag name) + -> [ :elem | self removePackage: aPackageOrTag inElement: elem ]. + "(self createLabel: 'Demote package' description: aPackageOrTag name) + -> [ :elem | self demotePackage: aPackageOrTag inElement: elem ]"} ] + ifFalse: [ items + addAll: {(self createLabel: 'Rename tag' description: aPackageOrTag name) + -> [ :elem | self renamePackage: aPackageOrTag inElement: elem ]. + (self createLabel: 'Remove tag' description: aPackageOrTag name) + -> [ :elem | self removePackage: aPackageOrTag inElement: elem ]. + "(self createLabel: 'Promote tag' description: aPackageOrTag name) + -> [ :elem | self promoteTag: aPackageOrTag inElement: elem ]"} ]. + + ^ items +] + +{ #category : #initialization } +GtCoderNavigationPackagesTreeElement >> demotePackage: aPackageOrTag inElement: elem [ + self notYetImplemented +] + { #category : #initialization } GtCoderNavigationPackagesTreeElement >> initialize [ super initialize. self rowStencil: BrGlamorousSimpleTreeSelectableRowElementStencilBuilder new. - self nodeStencil: [ - BrLabel new - beSmallSize; - aptitude: BrGlamorousListLabelAptitude ]; - nodeDataBinder: [ :aPackageElement :aPackage | - aPackageElement - text: (aPackage - ifNil: [ '' ] - ifNotNil: [ aPackage name ]) ] + self + nodeStencil: [ BrHorizontalPane new + aptitude: BrGlamorousListItemAptitude; + hMatchParent; + vFitContent ]; + nodeDataBinder: [ :aPackageElement :aPackage | + | label | + aPackageElement removeChildren. + label := BrLabel new + beSmallSize; + aptitude: BrGlamorousLabelAptitude. + aPackageElement addChild: label. + aPackage + ifNil: [ label text: '' asRopedText ] + ifNotNil: [ label text: aPackage name. + label + addAptitude: (BrGlamorousWithContextMenuAptitude + content: [ GtCoderNavigationContextMenuContent new + items: (self contextMenuItemsFor: aPackage) ]) ] ] ] { #category : #'api - initialization' } @@ -70,6 +124,58 @@ GtCoderNavigationPackagesTreeElement >> isTag: tagA lessThan: tagB [ ] +{ #category : #initialization } +GtCoderNavigationPackagesTreeElement >> newPackage [ + self notYetImplemented +] + +{ #category : #initialization } +GtCoderNavigationPackagesTreeElement >> newTagFor: aPackage inElement: elem [ + self notYetImplemented +] + +{ #category : #initialization } +GtCoderNavigationPackagesTreeElement >> promoteTag: aPackageOrTag inElement: elem [ + self notYetImplemented +] + +{ #category : #initialization } +GtCoderNavigationPackagesTreeElement >> removePackage: aPackage inElement: elem [ + | change button | + change := RBRemovePackageChange removePackageNamed: aPackage name. + button := GtPreviewChangeButton new + icon: BrGlamorousVectorIcons remove; + label: 'Remove'; + changeAction: [ change execute ]; + changeStencil: [ self buildRemovePackageLabelFor: aPackage ]. + button + when: GtRefactoringsAppliedEvent + do: [ :anEvent | elem removeChild: anEvent currentTarget ]. + ^ elem addChild: button as: #preview +] + +{ #category : #initialization } +GtCoderNavigationPackagesTreeElement >> renamePackage: aPackage inElement: elem [ + | refactoring edit | + edit := BrEditableLabel new. + edit + aptitude: (BrGlamorousEditableLabelAptitude new + glamorousCodeSmallSize; + background: Color transparent); + text: aPackage name; + when: BrEditorAcceptWish + do: [ :aWish | + refactoring := GtRBRenamePackageRefactoring + from: aPackage name + to: aWish text asString. + edit switchToLabel. + self addPreviewButtonFor: refactoring to: elem ]; + switchToEditor. + edit requestFocus. + elem removeChildren. + elem addChild: edit +] + { #category : #'api - selection' } GtCoderNavigationPackagesTreeElement >> selectedIndice [ "Return selected indice or zero" diff --git a/src/GToolkit-Coder-UI/TGtCoderNavigationClassesHelper.trait.st b/src/GToolkit-Coder-UI/TGtCoderNavigationClassesHelper.trait.st deleted file mode 100644 index f71942481..000000000 --- a/src/GToolkit-Coder-UI/TGtCoderNavigationClassesHelper.trait.st +++ /dev/null @@ -1,34 +0,0 @@ -Trait { - #name : #TGtCoderNavigationClassesHelper, - #category : 'GToolkit-Coder-UI-Navigation' -} - -{ #category : #'private - ui' } -TGtCoderNavigationClassesHelper >> buildClassLabel: aClass [ - | aLook aText | - aLook := (BrGlamorousLabelAptitude new fontSize: 12). - aText := aClass name. - - (self isAbstractClass: aClass) - ifTrue: [ aLook italic ]. - - (self isDeprecatedClass: aClass) - ifTrue: [ - aText := aText, ' (deprecated)'. - Transcript show: aText; cr. - aLook bold ]. - - ^ BrLabel new - aptitude: aLook; - text: aText. -] - -{ #category : #'private - testing' } -TGtCoderNavigationClassesHelper >> isAbstractClass: aClass [ - ^ aClass isAbstract or: [ aClass hasAbstractMethods ] -] - -{ #category : #'private - testing' } -TGtCoderNavigationClassesHelper >> isDeprecatedClass: aClass [ - ^ aClass isDeprecated -] diff --git a/src/GToolkit-Coder-UI/TNavigationWithContextMenu.trait.st b/src/GToolkit-Coder-UI/TNavigationWithContextMenu.trait.st new file mode 100644 index 000000000..b2684389e --- /dev/null +++ b/src/GToolkit-Coder-UI/TNavigationWithContextMenu.trait.st @@ -0,0 +1,34 @@ +Trait { + #name : #TNavigationWithContextMenu, + #category : #'GToolkit-Coder-UI-Navigation' +} + +{ #category : #accessing } +TNavigationWithContextMenu >> addPreviewButtonFor: refactoring to: elem [ + | button | + elem removeChildNamed: #preview. + button := GtRefactoringsPreviewButton new. + button vMatchParent. + button refactorings: [ {refactoring} ]. + button cancelBlock: [ ]. + button + padding: (BlInsets + top: 1 + right: 4 + bottom: 0 + left: 4). + button beMiniSize. + button + when: GtRefactoringsAppliedEvent + do: [ :anEvent | elem removeChild: anEvent currentTarget ]. + ^ elem addChild: button as: #preview +] + +{ #category : #accessing } +TNavigationWithContextMenu >> createLabel: aString description: description [ + ^ aString asRopedText glamorousRegularFont + , ((' ' , description) asRopedText + glamorousCodeFont; + foreground: Color gray; + glamorousCodeTinySize) +] From 462d4d30982b8089a85bebee7799f1d72d831e34 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Fri, 17 Feb 2023 13:32:16 +0100 Subject: [PATCH 0404/1268] Mark addition forms explicitly [feenkcom/gtoolkit#3085] --- src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st | 2 +- src/GToolkit-Coder-UI/GtCreationForm.class.st | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index 1d40955d6..5300dcd87 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -78,7 +78,7 @@ GtCoderNavigationTabsStencil >> gtCreationInterface: look [ constraintsDo: [ :c | c horizontal matchParent. c vertical matchParent ]. - tabClasses := GtCreationForm allSubclasses + tabClasses := (GtCreationForm allSubclasses select: #isAdditionForm) asSortedCollection: [ :a :b | a priority < b priority ]. tabClasses do: [ :each | diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index 8783d9e28..515d143af 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -14,6 +14,11 @@ GtCreationForm class >> componentName [ ^ self subclassResponsibility ] +{ #category : #accessing } +GtCreationForm class >> isAdditionForm [ + ^ true +] + { #category : #accessing } GtCreationForm class >> priority [ ^ self subclassResponsibility From 5a69138c62036074a2812a19d00ea5f0b3e6b57f Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 16 Feb 2023 11:28:33 -0500 Subject: [PATCH 0405/1268] Add protocol and tag menus and new subclass context menu item [feenkcom/gtoolkit#3041] --- ...gationClassesHierarchyTreeElement.class.st | 13 +++++-- ...igationPackagesTagsClassesElement.class.st | 39 +++++++++++++++++-- ...oderNavigationPackagesTreeElement.class.st | 33 +++++++++++++++- .../GtCoderNavigationTabsStencil.class.st | 4 ++ .../GtNavigationNewDropdownId.class.st | 10 +++++ 5 files changed, 91 insertions(+), 8 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtNavigationNewDropdownId.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st index fb7c3010a..b5ae43dfa 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st @@ -57,8 +57,8 @@ GtCoderNavigationClassesHierarchyTreeElement >> buildRemoveClassLabelFor: aClass { #category : #initialization } GtCoderNavigationClassesHierarchyTreeElement >> contextMenuItemsFor: aClass [ - ^ {"(self createLabel: 'New Subclass' description: aClass name) - -> [ :elem | self newSubclassOf: aClass ]." + ^ {(self createLabel: 'New Subclass' description: aClass name) + -> [ :elem | self newSubclassOf: aClass ]. (self createLabel: 'Rename class' description: aClass name) -> [ :elem | self renameClass: aClass inElement: elem ]. (self createLabel: 'Remove class' description: aClass name) @@ -130,7 +130,14 @@ GtCoderNavigationClassesHierarchyTreeElement >> initializeWithHierachyForClass: ] { #category : #initialization } -GtCoderNavigationClassesHierarchyTreeElement >> newSubclassOf: aClass [ +GtCoderNavigationClassesHierarchyTreeElement >> newSubclassOf: aClass [ + | dropdown tabGroup | + tabGroup := self + withAllParentsDetect: [ :each | each class == BrTabGroup ] + ifFound: #yourself + ifNone: [ ^self ]. + dropdown := tabGroup childWithId: GtNavigationNewDropdownId. + dropdown dispatchEvent: BrDropdownShowWish new. ] { #category : #initialization } diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index cdd2e0009..1f114ad54 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -187,10 +187,21 @@ GtCoderNavigationPackagesTagsClassesElement >> buildProtocolGroupList [ | list | list := self buildGroupList. protocolGroup := self - buildGroupWithBinder: [ :label :item | + buildGroupWithBinder: [ :element :item | + | label | + element removeChildren. + element userData at: #protocol put: item. + label := BrLabel new + hMatchParent; + vFitContent; + beSmallSize; + aptitude: BrGlamorousLabelAptitude + BrGlamorousListItemAptitude. label text: item name asRopedText. - label userData at: #protocol put: item. - label ] + label + addAptitude: (BrGlamorousWithContextMenuAptitude + content: [ GtCoderNavigationContextMenuContent new + items: (self protocolListContextMenuItemsFor: item) ]). + element addChild: label ] onClick: [ :event | event consumed: true. self onProtocolListSelectionChanged ]. @@ -539,6 +550,14 @@ GtCoderNavigationPackagesTagsClassesElement >> onSlotsListSelectionChanged [ self updateMethodListWith: instMeths and: classMeths ] +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> protocolListContextMenuItemsFor: item [ + ^ {(self createLabel: 'Remove ' description: item name) + -> [ :elem | self removeProtocol: item name in: elem ]. + "(self createLabel: 'Rename ' description: item name) + -> [ :elem | self renameProtocol: item name in: elem ]"} +] + { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> pushDownMethod: aSelector inElement: elem [ | refactoring | @@ -599,6 +618,15 @@ GtCoderNavigationPackagesTagsClassesElement >> removePackage: aPackage tag: aPac self reselectPackageOrTag: aSelectedPackageOrTag afterRemovalOfTagNamed: aPackageTagName. ] +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> removeProtocol: protocolName in: elem [ + | refactoring | + refactoring := RBRemoveProtocolChange + removeProtocolNamed: protocolName + in: self selectedClass. + ^ self addPreviewButtonFor: refactoring to: elem +] + { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> renameMethod: aSelector inElement: elem [ | refactoring edit | @@ -635,6 +663,11 @@ GtCoderNavigationPackagesTagsClassesElement >> renamePackage: aPackage oldName: self selectPackageOrTag: aSelectedPackageOrTag ]. ] +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> renameProtocol: protocolName in: elem [ + self notYetImplemented +] + { #category : #'api - package reselections' } GtCoderNavigationPackagesTagsClassesElement >> reselectPackageOrTag: aSelectedPackageOrTag afterRemovalOfPackageNamed: aRemovedPackageOrTagName [ aSelectedPackageOrTag ifNotNil: [ diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st index 56d1a574b..6c7b269d8 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st @@ -26,6 +26,16 @@ GtCoderNavigationPackagesTreeElement >> buildRemovePackageLabelFor: aPackage [ text: labelText asRopedText ] +{ #category : #initialization } +GtCoderNavigationPackagesTreeElement >> buildRemoveTagLabelFor: aTag [ + | labelText | + labelText := 'Remove package <1s>' expandMacrosWith: aTag name. + ^ BrLabel new + margin: (BlInsets all: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont; + text: labelText asRopedText +] + { #category : #'private - enumeration' } GtCoderNavigationPackagesTreeElement >> childrenForPackageOrTag: aPackageOrTag [ | theTags anExtension | @@ -63,9 +73,9 @@ GtCoderNavigationPackagesTreeElement >> contextMenuItemsFor: aPackageOrTag [ -> [ :elem | self demotePackage: aPackageOrTag inElement: elem ]"} ] ifFalse: [ items addAll: {(self createLabel: 'Rename tag' description: aPackageOrTag name) - -> [ :elem | self renamePackage: aPackageOrTag inElement: elem ]. + -> [ :elem | self renameTag: aPackageOrTag inElement: elem ]. (self createLabel: 'Remove tag' description: aPackageOrTag name) - -> [ :elem | self removePackage: aPackageOrTag inElement: elem ]. + -> [ :elem | self removeTag: aPackageOrTag inElement: elem ]. "(self createLabel: 'Promote tag' description: aPackageOrTag name) -> [ :elem | self promoteTag: aPackageOrTag inElement: elem ]"} ]. @@ -154,6 +164,21 @@ GtCoderNavigationPackagesTreeElement >> removePackage: aPackage inElement: elem ^ elem addChild: button as: #preview ] +{ #category : #initialization } +GtCoderNavigationPackagesTreeElement >> removeTag: aTag inElement: elem [ + | change button | + change := GtRBRemovePackageTagChange packageName: aTag package name tagName: aTag name. + button := GtPreviewChangeButton new + icon: BrGlamorousVectorIcons remove; + label: 'Remove'; + changeAction: [ change execute ]; + changeStencil: [ self buildRemoveTagLabelFor: aTag ]. + button + when: GtRefactoringsAppliedEvent + do: [ :anEvent | elem removeChild: anEvent currentTarget ]. + ^ elem addChild: button as: #preview +] + { #category : #initialization } GtCoderNavigationPackagesTreeElement >> renamePackage: aPackage inElement: elem [ | refactoring edit | @@ -176,6 +201,10 @@ GtCoderNavigationPackagesTreeElement >> renamePackage: aPackage inElement: elem elem addChild: edit ] +{ #category : #initialization } +GtCoderNavigationPackagesTreeElement >> renameTag: aPackageOrTag inElement: elem [ +] + { #category : #'api - selection' } GtCoderNavigationPackagesTreeElement >> selectedIndice [ "Return selected indice or zero" diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index 1d40955d6..ee63e1fb8 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -90,6 +90,9 @@ GtCoderNavigationTabsStencil >> gtCreationInterface: look [ at: each ifAbsentPut: [ | form | form := each new. + form class == GtClassCreationForm + ifTrue: [ navigationModel + selectedClassDo: [ :aClass | form superclassName: aClass name ] ]. form hasPackageAndTag ifTrue: [ navigationModel selectedPackageDo: [ :aPackage | form packageAndTagName packageName: aPackage name ]. @@ -151,6 +154,7 @@ GtCoderNavigationTabsStencil >> gtPackagesTagsClassesFor: aView [ c vertical exact: 300 ]. element addChild: (self gtCreationInterface: aDropdown). element ] + id: GtNavigationNewDropdownId ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtNavigationNewDropdownId.class.st b/src/GToolkit-Coder-UI/GtNavigationNewDropdownId.class.st new file mode 100644 index 000000000..596246335 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtNavigationNewDropdownId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtNavigationNewDropdownId, + #superclass : #GtCoderElementId, + #category : #'GToolkit-Coder-UI-Navigation' +} + +{ #category : #accessing } +GtNavigationNewDropdownId >> asSymbol [ + ^#'navigation-newDropdown' +] From 78beb822793748b058e741ffd42150875d426206 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 17 Feb 2023 09:58:05 -0500 Subject: [PATCH 0406/1268] Make context menus appear when right-clicking whitespace in list [feenkcom/gtoolkit#3041] --- ...gationClassesHierarchyTreeElement.class.st | 29 ++++++++-------- ...oderNavigationPackagesTreeElement.class.st | 34 +++++++++++-------- 2 files changed, 33 insertions(+), 30 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st index b5ae43dfa..7f912e9ff 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st @@ -87,26 +87,25 @@ GtCoderNavigationClassesHierarchyTreeElement >> initialize [ vFitContent ]; nodeDataBinder: [ :aClassElement :aClassHierarchyTree | | label | - aClassElement removeChildren. + aClassElement + removeChildren; + addAptitude: (BrGlamorousWithContextMenuAptitude + content: [ GtCoderNavigationContextMenuContent new + items: (self contextMenuItemsFor: aClassHierarchyTree rootClass) ]). label := BrLabel new beSmallSize; aptitude: BrGlamorousLabelAptitude. aClassElement addChild: label. aClassHierarchyTree - ifNil: [ label text: '' asRopedText] - ifNotNil: [ | aClass aText | - aClass := aClassHierarchyTree rootClass. - aText := aClass gtDisplayText asRopedText. - (aClass isAbstract or: [ aClass hasAbstractMethods ]) - ifTrue: [ aText italic ]. - aClass isDeprecated - ifTrue: [ aText append: ' (deprecated)' asRopedText italic ]. - label text: aText. - label - addAptitude: (BrGlamorousWithContextMenuAptitude - content: [ GtCoderNavigationContextMenuContent new - items: (self contextMenuItemsFor: aClass) ]).]. - ] + ifNil: [ label text: '' asRopedText ] + ifNotNil: [ | aClass aText | + aClass := aClassHierarchyTree rootClass. + aText := aClass gtDisplayText asRopedText. + (aClass isAbstract or: [ aClass hasAbstractMethods ]) + ifTrue: [ aText italic ]. + aClass isDeprecated + ifTrue: [ aText append: ' (deprecated)' asRopedText italic ]. + label text: aText ] ] ] { #category : #'api - initialization' } diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st index 6c7b269d8..a825293a1 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st @@ -58,26 +58,24 @@ GtCoderNavigationPackagesTreeElement >> childrenForPackageOrTag: aPackageOrTag [ { #category : #initialization } GtCoderNavigationPackagesTreeElement >> contextMenuItemsFor: aPackageOrTag [ | items | - items := {"(self createLabel: 'New package' description: '') + items := {(self createLabel: 'New package' description: '') -> [ :elem | self newPackage ]. (self createLabel: 'New tag' description: aPackageOrTag name) - -> [ :elem | self newTagFor: aPackageOrTag inElement: elem ]"} + -> [ :elem | self newTagFor: aPackageOrTag inElement: elem ]} asOrderedCollection. aPackageOrTag class == RPackage ifTrue: [ items addAll: {(self createLabel: 'Rename package' description: aPackageOrTag name) -> [ :elem | self renamePackage: aPackageOrTag inElement: elem ]. (self createLabel: 'Remove package' description: aPackageOrTag name) - -> [ :elem | self removePackage: aPackageOrTag inElement: elem ]. - "(self createLabel: 'Demote package' description: aPackageOrTag name) - -> [ :elem | self demotePackage: aPackageOrTag inElement: elem ]"} ] + -> [ :elem | self removePackage: aPackageOrTag inElement: elem ]} "(self createLabel: 'Demote package' description: aPackageOrTag name) + -> [ :elem | self demotePackage: aPackageOrTag inElement: elem ]" ] ifFalse: [ items addAll: {(self createLabel: 'Rename tag' description: aPackageOrTag name) -> [ :elem | self renameTag: aPackageOrTag inElement: elem ]. (self createLabel: 'Remove tag' description: aPackageOrTag name) - -> [ :elem | self removeTag: aPackageOrTag inElement: elem ]. - "(self createLabel: 'Promote tag' description: aPackageOrTag name) - -> [ :elem | self promoteTag: aPackageOrTag inElement: elem ]"} ]. + -> [ :elem | self removeTag: aPackageOrTag inElement: elem ]} "(self createLabel: 'Promote tag' description: aPackageOrTag name) + -> [ :elem | self promoteTag: aPackageOrTag inElement: elem ]" ]. ^ items ] @@ -100,18 +98,18 @@ GtCoderNavigationPackagesTreeElement >> initialize [ vFitContent ]; nodeDataBinder: [ :aPackageElement :aPackage | | label | - aPackageElement removeChildren. + aPackageElement + removeChildren; + addAptitude: (BrGlamorousWithContextMenuAptitude + content: [ GtCoderNavigationContextMenuContent new + items: (self contextMenuItemsFor: aPackage) ]). label := BrLabel new beSmallSize; aptitude: BrGlamorousLabelAptitude. aPackageElement addChild: label. aPackage ifNil: [ label text: '' asRopedText ] - ifNotNil: [ label text: aPackage name. - label - addAptitude: (BrGlamorousWithContextMenuAptitude - content: [ GtCoderNavigationContextMenuContent new - items: (self contextMenuItemsFor: aPackage) ]) ] ] + ifNotNil: [ label text: aPackage name ] ] ] { #category : #'api - initialization' } @@ -136,7 +134,13 @@ GtCoderNavigationPackagesTreeElement >> isTag: tagA lessThan: tagB [ { #category : #initialization } GtCoderNavigationPackagesTreeElement >> newPackage [ - self notYetImplemented + | dropdown tabGroup | + tabGroup := self + withAllParentsDetect: [ :each | each class == BrTabGroup ] + ifFound: #yourself + ifNone: [ ^self ]. + dropdown := tabGroup childWithId: GtNavigationNewDropdownId. + dropdown dispatchEvent: BrDropdownShowWish new. ] { #category : #initialization } From 9d486d9da82466885229fb52e087bdf58cc80cb4 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 17 Feb 2023 17:03:20 -0500 Subject: [PATCH 0407/1268] Add references button to remove class previews and refactor [feenkcom/gtoolkit#3041] --- .../GtAbstractRemovePreviewStencil.class.st | 119 ++++++++++++++++++ ...gationClassesHierarchyTreeElement.class.st | 6 +- ...igationPackagesTagsClassesElement.class.st | 4 +- ...oderNavigationPackagesTreeElement.class.st | 1 + .../GtPharoRemoveClassPreviewStencil.class.st | 25 ++++ 5 files changed, 152 insertions(+), 3 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtAbstractRemovePreviewStencil.class.st create mode 100644 src/GToolkit-Coder-UI/GtPharoRemoveClassPreviewStencil.class.st diff --git a/src/GToolkit-Coder-UI/GtAbstractRemovePreviewStencil.class.st b/src/GToolkit-Coder-UI/GtAbstractRemovePreviewStencil.class.st new file mode 100644 index 000000000..5882aa812 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtAbstractRemovePreviewStencil.class.st @@ -0,0 +1,119 @@ +Class { + #name : #GtAbstractRemovePreviewStencil, + #superclass : #BrStencil, + #instVars : [ + 'anElement' + ], + #category : #'GToolkit-Coder-UI-Utilities' +} + +{ #category : #accessing } +GtAbstractRemovePreviewStencil >> anElement [ + ^ anElement +] + +{ #category : #accessing } +GtAbstractRemovePreviewStencil >> anElement: element [ + ^ anElement := element +] + +{ #category : #accessing } +GtAbstractRemovePreviewStencil >> createPreviewContainerForItemNamed: itemName withReferences: references [ + | referencesButton container stillReferencedLabel noReferencesLabel waitingLabel | + noReferencesLabel := self noReferencesLabel. + noReferencesLabel + text: itemName asRopedText bold , ' is not referenced' asRopedText. + waitingLabel := self waitingLabel. + stillReferencedLabel := self stillReferencedLabelFor: itemName. + referencesButton := self referencesButtonFor: references. + + container := BrHorizontalPane new + fitContent; + withAsyncSinkDo: [ :anElementSink | + anElementSink + sink: AsyncCounterSink new; + whenPending: [ :aContainer :aSink | + aSink count > 0 + ifTrue: [ waitingLabel visibility: BlVisibility gone. + stillReferencedLabel visibility: BlVisibility visible. + referencesButton visibility: BlVisibility visible ]. + + referencesButton + label: (String + streamContents: [ :aStream | + aStream + print: aSink count; + space; + nextPutAll: ('method' asPluralBasedOn: aSink count); + nextPutAll: '...' ]) ]; + whenSuccess: [ :aContainer :aSink | + waitingLabel visibility: BlVisibility gone. + + aSink count > 0 + ifTrue: [ stillReferencedLabel visibility: BlVisibility visible. + referencesButton visibility: BlVisibility visible ] + ifFalse: [ stillReferencedLabel visibility: BlVisibility gone. + referencesButton visibility: BlVisibility gone. + noReferencesLabel visibility: BlVisibility visible ]. + + referencesButton + label: (String + streamContents: [ :aStream | + aStream + print: aSink count; + space; + nextPutAll: ('method' asPluralBasedOn: aSink count) ]) ] ]. + + container asyncSink forwardStream: references asAsyncStream. + + container + addChildren: {waitingLabel. + stillReferencedLabel visibility: BlVisibility gone. + referencesButton visibility: BlVisibility gone. + noReferencesLabel visibility: BlVisibility gone}. + ^ container +] + +{ #category : #accessing } +GtAbstractRemovePreviewStencil >> noReferencesLabel [ + | noReferencesLabel | + noReferencesLabel := BrLabel new + margin: (BlInsets all: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont; + text: 'Remove?' asRopedText. + ^ noReferencesLabel +] + +{ #category : #accessing } +GtAbstractRemovePreviewStencil >> referencesButtonFor: references [ + ^ BrButton new + aptitude: BrGlamorousLinkSquaredButtonWithLabelAptitude new glamorousCodeSmallSize; + beSmallSize; + margin: (BlInsets + top: 10 + left: 2 + bottom: 10 + right: 10); + label: '0 methods'; + action: [ self anElement phlow spawnObject: references ] +] + +{ #category : #accessing } +GtAbstractRemovePreviewStencil >> stillReferencedLabelFor: name [ + ^ BrLabel new + margin: (BlInsets + top: 10 + left: 10 + bottom: 10 + right: 0); + aptitude: BrGlamorousLabelAptitude new; + text: name asRopedText bold , ' is still referenced in ' asRopedText +] + +{ #category : #accessing } +GtAbstractRemovePreviewStencil >> waitingLabel [ + ^ BrLabel new + aptitude: BrGlamorousLabelAptitude new italic; + margin: (BlInsets all: 10); + text: 'Searching references...' +] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st index 7f912e9ff..184ca7655 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st @@ -93,6 +93,7 @@ GtCoderNavigationClassesHierarchyTreeElement >> initialize [ content: [ GtCoderNavigationContextMenuContent new items: (self contextMenuItemsFor: aClassHierarchyTree rootClass) ]). label := BrLabel new + matchParent; beSmallSize; aptitude: BrGlamorousLabelAptitude. aClassElement addChild: label. @@ -147,7 +148,10 @@ GtCoderNavigationClassesHierarchyTreeElement >> removeClass: aClass inElement: e icon: BrGlamorousVectorIcons remove; label: 'Remove'; changeAction: [ change execute ]; - changeStencil: [ self buildRemoveClassLabelFor: aClass ]. + changeStencil: [ GtPharoRemoveClassPreviewStencil new + classToRemove: aClass; + anElement: self; + create ]. button when: GtRefactoringsAppliedEvent do: [ :anEvent | elem removeChild: anEvent currentTarget ]. diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 1f114ad54..0f30045d6 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -144,8 +144,7 @@ GtCoderNavigationPackagesTagsClassesElement >> buildMethodGroupList [ element removeChildren. element userData at: #method put: item. label := BrLabel new - hMatchParent; - vFitContent; + matchParent; beSmallSize; aptitude: BrGlamorousLabelAptitude. label text: item selector asRopedText. @@ -587,6 +586,7 @@ GtCoderNavigationPackagesTagsClassesElement >> removeMethod: aSelector inElement changeStencil: [ GtPharoRemoveMethodPreviewStencil new selectorToRemove: aSelector; isEmptyMethod: false; + anElement: self; create ]. button when: GtRefactoringsAppliedEvent diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st index a825293a1..ca4f7adc3 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st @@ -104,6 +104,7 @@ GtCoderNavigationPackagesTreeElement >> initialize [ content: [ GtCoderNavigationContextMenuContent new items: (self contextMenuItemsFor: aPackage) ]). label := BrLabel new + matchParent; beSmallSize; aptitude: BrGlamorousLabelAptitude. aPackageElement addChild: label. diff --git a/src/GToolkit-Coder-UI/GtPharoRemoveClassPreviewStencil.class.st b/src/GToolkit-Coder-UI/GtPharoRemoveClassPreviewStencil.class.st new file mode 100644 index 000000000..84c70bdc6 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtPharoRemoveClassPreviewStencil.class.st @@ -0,0 +1,25 @@ +Class { + #name : #GtPharoRemoveClassPreviewStencil, + #superclass : #GtAbstractRemovePreviewStencil, + #instVars : [ + 'classToRemove' + ], + #category : #'GToolkit-Coder-UI-Navigation' +} + +{ #category : #initialization } +GtPharoRemoveClassPreviewStencil >> anElement: element [ + anElement := element +] + +{ #category : #initialization } +GtPharoRemoveClassPreviewStencil >> classToRemove: aClass [ + classToRemove := aClass +] + +{ #category : #accessing } +GtPharoRemoveClassPreviewStencil >> create [ + ^ self + createPreviewContainerForItemNamed: classToRemove name + withReferences: classToRemove gtReferences +] From d8482d79069a79b962db20f4b42609790239011e Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Mon, 20 Feb 2023 15:54:17 +0100 Subject: [PATCH 0408/1268] Smaller fonts for creation interface [feenkcom/gtoolkit#3085] --- .../GtCoderNavigationTabsStencil.class.st | 8 +-- src/GToolkit-Coder-UI/GtCreationForm.class.st | 49 ++++++++++++++++--- 2 files changed, 45 insertions(+), 12 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index f26fdd5ca..9e09f17f2 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -89,10 +89,10 @@ GtCoderNavigationTabsStencil >> gtCreationInterface: look [ stencil: [ (self formCache at: each ifAbsentPut: [ | form | - form := each new. - form class == GtClassCreationForm - ifTrue: [ navigationModel - selectedClassDo: [ :aClass | form superclassName: aClass name ] ]. + form := each new + onReset: [ look + inUIProcessDo: [ look fireEvent: BrDropdownHideWish new. + self formCache removeKey: each ] ]. form hasPackageAndTag ifTrue: [ navigationModel selectedPackageDo: [ :aPackage | form packageAndTagName packageName: aPackage name ]. diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index 515d143af..71e8fb303 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -4,7 +4,8 @@ Class { #instVars : [ 'onAccept', 'packageAndTagName', - 'onElementCreated' + 'onElementCreated', + 'onReset' ], #category : #'GToolkit-Coder-UI-Forms - Models' } @@ -42,7 +43,7 @@ GtCreationForm >> asElement [ viewModel := self asGtMagritteViewModel. self onElementCreated ifNotNil: [ :aCallback | viewModel onElementCreated: aCallback ]. - "save action should be available even if unchanged" + "save and cancel actions should be available even if unchanged" viewModel actions first installOn: [ :aModel :aButton :aMemento | aButton @@ -54,9 +55,27 @@ GtCreationForm >> asElement [ aStatus := aSink value. theButton enabled: aStatus isValid ]. aMemento overallStatus observe: anElementSink ] ]. + viewModel actions second + installOn: [ :aModel :aButton :aMemento | + aButton + withAsyncSinkDo: [ :anElementSink | + anElementSink + sink: AsyncPeekSink new; + whenUpdate: [ :theButton :aSink | + theButton enabled: true ]. + aMemento overallStatus observe: anElementSink ] ]. ^ viewModel asElement ] +{ #category : #magritte } +GtCreationForm >> cancelAction [ + + ^ MAActionDescription new + label: 'Reset'; + action: [ :aModel :aButton | [ onReset ifNotNil: [ onReset value ] ] on: Error do: #debug ]; + beResetAction +] + { #category : #callbacks } GtCreationForm >> commit [ ^ self subclassResponsibility @@ -81,7 +100,7 @@ GtCreationForm >> commitPackage [ { #category : #accessing } GtCreationForm >> ghostTextFor: aString [ ^ BrGhostTextAttribute - for: (aString asRopedText glamorousCodeFont foreground: Color lightGray) + for: (aString asRopedText glamorousFormEditorCodeFontAndSize foreground: Color lightGray) ] { #category : #accessing } @@ -116,6 +135,16 @@ GtCreationForm >> onElementCreated: anObject [ onElementCreated := anObject ] +{ #category : #accessing } +GtCreationForm >> onReset [ + ^ onReset +] + +{ #category : #accessing } +GtCreationForm >> onReset: anObject [ + onReset := anObject +] + { #category : #accessing } GtCreationForm >> packageAndTagDescription [ @@ -123,7 +152,8 @@ GtCreationForm >> packageAndTagDescription [ label: 'Package'; priority: 3; accessor: #packageAndTagName; - textStyler: #glamorousCodeFont; + labelStyler: #glamorousFormLabelStyle; + textStyler: #glamorousFormEditorCodeFontAndSize; beRequired ] @@ -148,17 +178,20 @@ GtCreationForm >> selectInNavigationModel: aNavigationModel anInstance: anInstan GtCreationForm >> taggerStencilWithCompletion: aCompletionStrategy [ ^ [ :aMemento :aDescription :aForm | | aTagger aTaggerAptitude | - aTagger := BrTagger new. - aTagger fitContent. + aTagger := BrTagger new hFitContentLimited. aForm hMatchParent. aTagger aptitude: (aTaggerAptitude := GtCreationEditableTaggerAptitude new - margin: (BlInsets right: 5); + margin: (BlInsets + top: 3 + bottom: 3 + left: 0 + right: 5); tagLabel: [ :aTag | | aLabel | aLabel := BrEditableLabel new text: (aDescription displayStringFor: aTag name); - aptitude: (BrGlamorousEditableLabelAptitude new glamorousCodeFont + aptitude: (BrGlamorousEditableLabelAptitude new glamorousFormEditorCodeFontAndSize defaultForeground: Color black). aCompletionStrategy ifNotNil: [ (GtCompletionController on: aLabel strategy: aCompletionStrategy) install ]. From e24bff10f8cae5d447dcd1ef8d261334b52f06ee Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Mon, 20 Feb 2023 14:47:20 -0600 Subject: [PATCH 0409/1268] Add new Package context menu item [feenkcom/gtoolkit#3041] --- ...oderNavigationPackagesTreeElement.class.st | 13 ++++---- .../GtCoderNavigationTabsStencil.class.st | 30 ++++++++++--------- .../GtNavigationDropDownCreateWish.class.st | 23 ++++++++++++++ 3 files changed, 47 insertions(+), 19 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtNavigationDropDownCreateWish.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st index ca4f7adc3..d70c68059 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st @@ -60,7 +60,7 @@ GtCoderNavigationPackagesTreeElement >> contextMenuItemsFor: aPackageOrTag [ | items | items := {(self createLabel: 'New package' description: '') -> [ :elem | self newPackage ]. - (self createLabel: 'New tag' description: aPackageOrTag name) + (self createLabel: 'New tag' description: '') -> [ :elem | self newTagFor: aPackageOrTag inElement: elem ]} asOrderedCollection. aPackageOrTag class == RPackage @@ -68,14 +68,16 @@ GtCoderNavigationPackagesTreeElement >> contextMenuItemsFor: aPackageOrTag [ addAll: {(self createLabel: 'Rename package' description: aPackageOrTag name) -> [ :elem | self renamePackage: aPackageOrTag inElement: elem ]. (self createLabel: 'Remove package' description: aPackageOrTag name) - -> [ :elem | self removePackage: aPackageOrTag inElement: elem ]} "(self createLabel: 'Demote package' description: aPackageOrTag name) - -> [ :elem | self demotePackage: aPackageOrTag inElement: elem ]" ] + -> [ :elem | self removePackage: aPackageOrTag inElement: elem ] + "(self createLabel: 'Demote package' description: aPackageOrTag name) + -> [ :elem | self demotePackage: aPackageOrTag inElement: elem ]" }] ifFalse: [ items addAll: {(self createLabel: 'Rename tag' description: aPackageOrTag name) -> [ :elem | self renameTag: aPackageOrTag inElement: elem ]. (self createLabel: 'Remove tag' description: aPackageOrTag name) - -> [ :elem | self removeTag: aPackageOrTag inElement: elem ]} "(self createLabel: 'Promote tag' description: aPackageOrTag name) - -> [ :elem | self promoteTag: aPackageOrTag inElement: elem ]" ]. + -> [ :elem | self removeTag: aPackageOrTag inElement: elem ] + "(self createLabel: 'Promote tag' description: aPackageOrTag name) + -> [ :elem | self promoteTag: aPackageOrTag inElement: elem ]" } ]. ^ items ] @@ -142,6 +144,7 @@ GtCoderNavigationPackagesTreeElement >> newPackage [ ifNone: [ ^self ]. dropdown := tabGroup childWithId: GtNavigationNewDropdownId. dropdown dispatchEvent: BrDropdownShowWish new. + dropdown dispatchEvent: (GtNavigationDropDownCreateWish showTab: GtPackageCreationForm). ] { #category : #initialization } diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index f26fdd5ca..6b90429d1 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -125,8 +125,7 @@ GtCoderNavigationTabsStencil >> gtPackagesTagsClassesFor: aView [ navigationModel: self navigationModel ]; actionStencil: [ :aButton | GtSpotterDropdownButtonStencil new - valuable: (GtCoderSpotterStart new - navigationModelBlock: [ self navigationModel ]); + valuable: (GtCoderSpotterStart new navigationModelBlock: [ self navigationModel ]); tooltip: 'Search Code'; actOn: [ :anActOnEvent :anItem :theButton | | acted | @@ -143,18 +142,21 @@ GtCoderNavigationTabsStencil >> gtPackagesTagsClassesFor: aView [ acted ifTrue: [ anActOnEvent beActed ] ]; asElement ] tooltip: 'Search Code'; - actionDropdownButtonIcon: BrGlamorousVectorIcons add - tooltip: 'Add class or package' - content: [ :aDropdown | - | element | - element := BlElement new. - element - constraintsDo: [ :c | - c horizontal exact: 400. - c vertical exact: 300 ]. - element addChild: (self gtCreationInterface: aDropdown). - element ] - id: GtNavigationNewDropdownId + actionDropdownButtonIcon: BrGlamorousVectorIcons add + tooltip: 'Add class or package' + content: [ :aDropdown | + | element | + element := BlElement new. + element + constraintsDo: [ :c | + c horizontal exact: 400. + c vertical exact: 300 ]. + element addChild: (self gtCreationInterface: aDropdown). + aDropdown + when: GtNavigationDropDownCreateWish + do: [ :aWish | element children first selectTabWithLabel: aWish tabName ]. + element ] + id: GtNavigationNewDropdownId ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtNavigationDropDownCreateWish.class.st b/src/GToolkit-Coder-UI/GtNavigationDropDownCreateWish.class.st new file mode 100644 index 000000000..1c83c34a4 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtNavigationDropDownCreateWish.class.st @@ -0,0 +1,23 @@ +Class { + #name : #GtNavigationDropDownCreateWish, + #superclass : #BrWish, + #instVars : [ + 'tabName' + ], + #category : #'GToolkit-Coder-UI-Navigation' +} + +{ #category : #accessing } +GtNavigationDropDownCreateWish class >> showTab: aCreationForm [ + ^self new tabName: aCreationForm componentName +] + +{ #category : #accessing } +GtNavigationDropDownCreateWish >> tabName [ + ^ tabName +] + +{ #category : #accessing } +GtNavigationDropDownCreateWish >> tabName: aString [ + tabName := aString +] From b20702c88c36c80200fc99c3891afe95752ecc05 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Mon, 20 Feb 2023 15:59:53 -0600 Subject: [PATCH 0410/1268] Cleanup refactorings [feenkcom/gtoolkit#3041] --- src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index e64e2a084..6f6fadf44 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -154,7 +154,7 @@ GtCoderNavigationTabsStencil >> gtPackagesTagsClassesFor: aView [ element addChild: (self gtCreationInterface: aDropdown). aDropdown when: GtNavigationDropDownCreateWish - do: [ :aWish | element children first selectTabWithLabel: aWish tabName ]. + do: [ :aWish | element children first selectTabWithLabelString: aWish tabName ]. element ] id: GtNavigationNewDropdownId ] From d1d0337b505a54a17eff261259b7dfa42e17a3d7 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Tue, 21 Feb 2023 13:22:30 +0100 Subject: [PATCH 0411/1268] Remove bottom padding on dropdown creation form [feenkcom/gtoolkit#3085] --- src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st | 2 +- src/GToolkit-Coder-UI/GtCreationForm.class.st | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index 9e09f17f2..a1c29b52e 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -151,7 +151,7 @@ GtCoderNavigationTabsStencil >> gtPackagesTagsClassesFor: aView [ element constraintsDo: [ :c | c horizontal exact: 400. - c vertical exact: 300 ]. + c vertical exact: 260 ]. element addChild: (self gtCreationInterface: aDropdown). element ] id: GtNavigationNewDropdownId diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index 71e8fb303..73a8f80c9 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -175,7 +175,7 @@ GtCreationForm >> selectInNavigationModel: aNavigationModel anInstance: anInstan ] { #category : #accessing } -GtCreationForm >> taggerStencilWithCompletion: aCompletionStrategy [ +GtCreationForm >> taggerStencilWithCompletion: aCompletionStrategy andContextMenuBlock: aContextMenuBlock [ ^ [ :aMemento :aDescription :aForm | | aTagger aTaggerAptitude | aTagger := BrTagger new hFitContentLimited. @@ -195,6 +195,10 @@ GtCreationForm >> taggerStencilWithCompletion: aCompletionStrategy [ defaultForeground: Color black). aCompletionStrategy ifNotNil: [ (GtCompletionController on: aLabel strategy: aCompletionStrategy) install ]. + aContextMenuBlock + ifNotNil: [ aLabel + addAptitude: (BrGlamorousWithContextMenuAptitude + content: (aContextMenuBlock value: aTag name value: aLabel)) ]. aLabel ]). aTagger when: BrTaggerAddTagRequest From 971e944b02a0fcd0d809026f977cc4b934c70c99 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 21 Feb 2023 07:00:42 -0600 Subject: [PATCH 0412/1268] Fix lost change [feenkcom/gtoolkit#3041] --- .../GtCoderNavigationTabsStencil.class.st | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index a1c29b52e..bc98bc29d 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -125,8 +125,7 @@ GtCoderNavigationTabsStencil >> gtPackagesTagsClassesFor: aView [ navigationModel: self navigationModel ]; actionStencil: [ :aButton | GtSpotterDropdownButtonStencil new - valuable: (GtCoderSpotterStart new - navigationModelBlock: [ self navigationModel ]); + valuable: (GtCoderSpotterStart new navigationModelBlock: [ self navigationModel ]); tooltip: 'Search Code'; actOn: [ :anActOnEvent :anItem :theButton | | acted | @@ -143,18 +142,21 @@ GtCoderNavigationTabsStencil >> gtPackagesTagsClassesFor: aView [ acted ifTrue: [ anActOnEvent beActed ] ]; asElement ] tooltip: 'Search Code'; - actionDropdownButtonIcon: BrGlamorousVectorIcons add - tooltip: 'Add class or package' - content: [ :aDropdown | - | element | - element := BlElement new. - element - constraintsDo: [ :c | - c horizontal exact: 400. - c vertical exact: 260 ]. - element addChild: (self gtCreationInterface: aDropdown). - element ] - id: GtNavigationNewDropdownId + actionDropdownButtonIcon: BrGlamorousVectorIcons add + tooltip: 'Add class or package' + content: [ :aDropdown | + | element | + element := BlElement new. + element + constraintsDo: [ :c | + c horizontal exact: 400. + c vertical exact: 260 ]. + element addChild: (self gtCreationInterface: aDropdown). + aDropdown + when: GtNavigationDropDownCreateWish + do: [ :aWish | element children first selectTabWithLabelString: aWish tabName ]. + element ] + id: GtNavigationNewDropdownId ] { #category : #accessing } From f410afd3cde509b29a9e92f5ca9fffbffef2f1ab Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 21 Feb 2023 09:04:18 -0600 Subject: [PATCH 0413/1268] Fix slot selection in index --- .../GtCoderNavigationPackagesTagsClassesElement.class.st | 3 ++- .../GtCoderNavigationPackagesTreeElement.class.st | 6 ++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 0f30045d6..181f68752 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -215,6 +215,7 @@ GtCoderNavigationPackagesTagsClassesElement >> buildSlotGroupWithBinder: binderB domainObject: 'instance slots'; stream: #() asAsyncStream; itemStencil: [ BrHorizontalPane new + aptitude: BrGlamorousListItemAptitude; hMatchParent; vFitContent; when: BlClickEvent do: clickBlock ]; @@ -239,7 +240,7 @@ GtCoderNavigationPackagesTagsClassesElement >> buildSlotsGroupList [ hMatchParent; vFitContent; beSmallSize; - aptitude: BrGlamorousLabelAptitude + BrGlamorousListItemAptitude. + aptitude: BrGlamorousLabelAptitude. label text: item name asRopedText. label addAptitude: (BrGlamorousWithContextMenuAptitude diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st index d70c68059..1dbcd9f66 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st @@ -58,10 +58,8 @@ GtCoderNavigationPackagesTreeElement >> childrenForPackageOrTag: aPackageOrTag [ { #category : #initialization } GtCoderNavigationPackagesTreeElement >> contextMenuItemsFor: aPackageOrTag [ | items | - items := {(self createLabel: 'New package' description: '') - -> [ :elem | self newPackage ]. - (self createLabel: 'New tag' description: '') - -> [ :elem | self newTagFor: aPackageOrTag inElement: elem ]} + items := {(self createLabel: 'New package / tag' description: '') + -> [ :elem | self newPackage ]} asOrderedCollection. aPackageOrTag class == RPackage ifTrue: [ items From 61ac4ba8088f50476b032a2715ae2e844968746e Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 21 Feb 2023 09:40:13 -0600 Subject: [PATCH 0414/1268] Restore erased change [feenkcom/gtoolkit#3041] --- src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index bc98bc29d..2fbbf9fb4 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -93,6 +93,9 @@ GtCoderNavigationTabsStencil >> gtCreationInterface: look [ onReset: [ look inUIProcessDo: [ look fireEvent: BrDropdownHideWish new. self formCache removeKey: each ] ]. + form class == GtClassCreationForm + ifTrue: [ navigationModel + selectedClassDo: [ :aClass | form superclassName: aClass name ] ]. form hasPackageAndTag ifTrue: [ navigationModel selectedPackageDo: [ :aPackage | form packageAndTagName packageName: aPackage name ]. From a5f6ff293912e6cd179e8ab13d8f12ccaa3deea8 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Fri, 24 Feb 2023 11:15:52 +0100 Subject: [PATCH 0415/1268] Use aptitude instead of styler in magritte [feenkcom/gtoolkit#3085] --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index 73a8f80c9..b16fbbcce 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -152,8 +152,8 @@ GtCreationForm >> packageAndTagDescription [ label: 'Package'; priority: 3; accessor: #packageAndTagName; - labelStyler: #glamorousFormLabelStyle; - textStyler: #glamorousFormEditorCodeFontAndSize; + editorAptitude: [ BrGlamorousRegularEditorAptitude new glamorousFormEditorCodeFontAndSize ]; + labelAptitude: [ BrGlamorousLabelAptitude new glamorousFormLabelStyle ]; beRequired ] From 86d7f3575793fdd8766c33ab50bb920ed3bb1416 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Fri, 24 Feb 2023 13:32:38 +0100 Subject: [PATCH 0416/1268] =?UTF-8?q?Multiple=20changes=20[feenkcom/gtoolk?= =?UTF-8?q?it#3085]:=20-=20Ensure=20we=C3=A2=C2=80=C2=99re=20in=20a=20UI?= =?UTF-8?q?=20process=20when=20committing=20from=20the=20creation/update?= =?UTF-8?q?=20form=20-=20Update=20size=20of=20creation=20form=20dropdown?= =?UTF-8?q?=20-=20Guard=20from=20non-existant=20entry=20in=20creation=20fo?= =?UTF-8?q?rm=20cache?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GtCoderNavigationTabsStencil.class.st | 4 ++-- src/GToolkit-Coder-UI/GtCreationForm.class.st | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index 2fbbf9fb4..f17bcc5fb 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -106,7 +106,7 @@ GtCoderNavigationTabsStencil >> gtCreationInterface: look [ look inUIProcessDo: [ form selectInNavigationModel: navigationModel anInstance: anInstance. look fireEvent: BrDropdownHideWish new ]. - self formCache removeKey: each ]; + self formCache removeKey: each ifAbsent: [ ] ]; onElementCreated: [ :aFrame | BlFocusFinder new direction: BlFocusSearchDirectionForward new; @@ -153,7 +153,7 @@ GtCoderNavigationTabsStencil >> gtPackagesTagsClassesFor: aView [ element constraintsDo: [ :c | c horizontal exact: 400. - c vertical exact: 260 ]. + c vertical exact: 280 ]. element addChild: (self gtCreationInterface: aDropdown). aDropdown when: GtNavigationDropDownCreateWish diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index b16fbbcce..f471d536e 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -31,9 +31,10 @@ GtCreationForm >> acceptAction [ ^ MAActionDescription new label: 'Accept'; action: [ :aModel :aButton | - [ | aValue | - aValue := self commit. - onAccept ifNotNil: [ onAccept value: aValue ] ] on: Error do: #debug ]; + aButton + inUIProcessDo: [ [ | aValue | + aValue := self commit. + onAccept ifNotNil: [ onAccept value: aValue ] ] on: Error do: #debug ] ]; beCommitAction ] From ace656905968ee7fec7e46f8bcfbf6d05f524a6c Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 24 Feb 2023 06:56:24 -0600 Subject: [PATCH 0417/1268] Add creation button to Class Hiearchy tab in index --- .../GtCoderNavigationTabsStencil.class.st | 99 +++++++++++-------- 1 file changed, 56 insertions(+), 43 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index 2fbbf9fb4..33f65ac77 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -9,6 +9,46 @@ Class { #category : #'GToolkit-Coder-UI-Navigation' } +{ #category : #'gt-extensions' } +GtCoderNavigationTabsStencil >> addButtonsTo: explicitView [ + explicitView + actionStencil: [ :aButton | + GtSpotterDropdownButtonStencil new + valuable: (GtCoderSpotterStart new navigationModelBlock: [ self navigationModel ]); + tooltip: 'Search Code'; + actOn: [ :anActOnEvent :anItem :theButton | + | acted | + acted := false. + (anItem isKindOf: RPackage) + ifTrue: [ self navigationModel selectPackage: anItem. + acted := true ]. + (anItem isKindOf: ClassDescription) + ifTrue: [ self navigationModel selectClass: anItem. + acted := true ]. + (anItem isKindOf: CompiledMethod) + ifTrue: [ self navigationModel selectMethod: anItem. + acted := true ]. + acted ifTrue: [ anActOnEvent beActed ] ]; + asElement ] + tooltip: 'Search Code'. + explicitView + actionDropdownButtonIcon: BrGlamorousVectorIcons add + tooltip: 'Add class or package' + content: [ :aDropdown | + | element | + element := BlElement new. + element + constraintsDo: [ :c | + c horizontal exact: 400. + c vertical exact: 260 ]. + element addChild: (self gtCreationInterface: aDropdown). + aDropdown + when: GtNavigationDropDownCreateWish + do: [ :aWish | element children first selectTabWithLabelString: aWish tabName ]. + element ] + id: GtNavigationNewDropdownId +] + { #category : #adding } GtCoderNavigationTabsStencil >> addNavigation: aNavigationElement [ self assertNavigationView: aNavigationElement. @@ -62,11 +102,15 @@ GtCoderNavigationTabsStencil >> formCache: anObject [ { #category : #'gt-extensions' } GtCoderNavigationTabsStencil >> gtClassHierarchyFor: aView [ + | explicitView | self navigationModel ifNil: [ ^ aView empty ]. - ^ aView explicit - title: 'Class Hierarchy'; - priority: 2; - stencil: [ GtCoderNavigationClassHierachyElement new navigationModel: self navigationModel ] + explicitView := aView explicit + title: 'Class Hierarchy'; + priority: 2; + stencil: [ GtCoderNavigationClassHierachyElement new + navigationModel: self navigationModel ]. + self addButtonsTo: explicitView. + ^ explicitView ] { #category : #'gt-extensions' } @@ -120,46 +164,15 @@ GtCoderNavigationTabsStencil >> gtCreationInterface: look [ { #category : #'gt-extensions' } GtCoderNavigationTabsStencil >> gtPackagesTagsClassesFor: aView [ + | explicitView | self navigationModel ifNil: [ ^ aView empty ]. - ^ aView explicit - title: 'Package Hierarchy'; - priority: 1; - stencil: [ GtCoderNavigationPackagesTagsClassesElement new - navigationModel: self navigationModel ]; - actionStencil: [ :aButton | - GtSpotterDropdownButtonStencil new - valuable: (GtCoderSpotterStart new navigationModelBlock: [ self navigationModel ]); - tooltip: 'Search Code'; - actOn: [ :anActOnEvent :anItem :theButton | - | acted | - acted := false. - (anItem isKindOf: RPackage) - ifTrue: [ self navigationModel selectPackage: anItem. - acted := true ]. - (anItem isKindOf: ClassDescription) - ifTrue: [ self navigationModel selectClass: anItem. - acted := true ]. - (anItem isKindOf: CompiledMethod) - ifTrue: [ self navigationModel selectMethod: anItem. - acted := true ]. - acted ifTrue: [ anActOnEvent beActed ] ]; - asElement ] - tooltip: 'Search Code'; - actionDropdownButtonIcon: BrGlamorousVectorIcons add - tooltip: 'Add class or package' - content: [ :aDropdown | - | element | - element := BlElement new. - element - constraintsDo: [ :c | - c horizontal exact: 400. - c vertical exact: 260 ]. - element addChild: (self gtCreationInterface: aDropdown). - aDropdown - when: GtNavigationDropDownCreateWish - do: [ :aWish | element children first selectTabWithLabelString: aWish tabName ]. - element ] - id: GtNavigationNewDropdownId + explicitView := aView explicit + title: 'Package Hierarchy'; + priority: 1; + stencil: [ GtCoderNavigationPackagesTagsClassesElement new + navigationModel: self navigationModel ]. + self addButtonsTo: explicitView. + ^ explicitView ] { #category : #accessing } From ebb3024bd3b24aa4168aeed2622fc4283ca67062 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Fri, 24 Feb 2023 16:06:20 +0100 Subject: [PATCH 0418/1268] Only show non-abstract classes in creation interface [feenkcom/gtoolkit#3085] --- src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index 484c6aa23..1dab0ee71 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -122,7 +122,10 @@ GtCoderNavigationTabsStencil >> gtCreationInterface: look [ constraintsDo: [ :c | c horizontal matchParent. c vertical matchParent ]. - tabClasses := (GtCreationForm allSubclasses select: #isAdditionForm) + tabClasses := (GtCreationForm allSubclasses + select: [ :aClass | + (aClass isAbstract or: [ aClass hasAbstractMethods ]) not + and: [ aClass isAdditionForm ] ]) asSortedCollection: [ :a :b | a priority < b priority ]. tabClasses do: [ :each | From 47cb1b4b1c3953473dd0877c60ac1b6b02e65adc Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Mon, 27 Feb 2023 07:40:13 -0600 Subject: [PATCH 0419/1268] Start rename protocol (not quite finished) [feenkcom/gtoolkit#3041] --- ...igationPackagesTagsClassesElement.class.st | 61 +++++++++++++++---- ...oderNavigationPackagesTreeElement.class.st | 11 +--- 2 files changed, 51 insertions(+), 21 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 181f68752..622202905 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -254,6 +254,16 @@ GtCoderNavigationPackagesTagsClassesElement >> buildSlotsGroupList [ ^ list ] +{ #category : #'event handling' } +GtCoderNavigationPackagesTagsClassesElement >> classMethodsForAProtocol: aSelectedItem [ + ^ (self selectedClass class organization protocolNamed: aSelectedItem name) + ifNotNil: [ :s | + (s methodSelectors + collect: [ :sel | self selectedClass class >> sel ] + thenReject: [ :meth | meth isFromTrait ]) asArray ] + ifNil: [ #() ] +] + { #category : #'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> deselectPackages [ packagesList deselectAll @@ -354,6 +364,13 @@ GtCoderNavigationPackagesTagsClassesElement >> initializeLayout [ c vertical matchParent ] ] +{ #category : #'event handling' } +GtCoderNavigationPackagesTagsClassesElement >> instanceMethodsForAProtocol: aSelectedItem [ + ^ (self selectedClass organization protocolNamed: aSelectedItem name) + ifNotNil: [ :s | s methodSelectors collect: [ :sel | self selectedClass >> sel ] as: Array ] + ifNil: [ #() ] +] + { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> methodList [ ^ methodGroup flatCollect: [ :grp | grp itemsProvider currentItems ] @@ -519,16 +536,8 @@ GtCoderNavigationPackagesTagsClassesElement >> onProtocolListSelectionChanged [ ifFalse: [ ^ self ]. aSelectedItem := (methodProtocolsList viewModel entityAt: anIndex) value object. self navigationModel selectMethodProtocol: aSelectedItem source: self. - instMeths := (self selectedClass organization protocolNamed: aSelectedItem name) - ifNotNil: [ :s | s methodSelectors collect: [ :sel | self selectedClass >> sel ] as: Array ] - ifNil: [ #() ]. - classMeths := (self selectedClass class organization - protocolNamed: aSelectedItem name) - ifNotNil: [ :s | - (s methodSelectors - collect: [ :sel | self selectedClass class >> sel ] - thenReject: [ :meth | meth isFromTrait ]) asArray ] - ifNil: [ #() ]. + instMeths := self instanceMethodsForAProtocol: aSelectedItem. + classMeths := self classMethodsForAProtocol: aSelectedItem. methodGroupList deselectAll. self updateMethodListWith: instMeths and: classMeths ] @@ -554,8 +563,8 @@ GtCoderNavigationPackagesTagsClassesElement >> onSlotsListSelectionChanged [ GtCoderNavigationPackagesTagsClassesElement >> protocolListContextMenuItemsFor: item [ ^ {(self createLabel: 'Remove ' description: item name) -> [ :elem | self removeProtocol: item name in: elem ]. - "(self createLabel: 'Rename ' description: item name) - -> [ :elem | self renameProtocol: item name in: elem ]"} + (self createLabel: 'Rename ' description: item name) + -> [ :elem | self renameProtocol: item name in: elem ]} ] { #category : #initialization } @@ -666,7 +675,33 @@ GtCoderNavigationPackagesTagsClassesElement >> renamePackage: aPackage oldName: { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> renameProtocol: protocolName in: elem [ - self notYetImplemented + | refactoring edit | + edit := BrEditableLabel new. + edit + aptitude: (BrGlamorousEditableLabelAptitude new + glamorousCodeSmallSize; + background: Color transparent); + text: protocolName; + when: BrEditorAcceptWish + do: [ :aWish | + refactoring := self renameProtocolFrom: protocolName to: aWish text asString. + refactoring halt. + edit switchToLabel. + self addPreviewButtonFor: refactoring to: elem ]; + switchToEditor. + edit requestFocus. + elem removeChildren. + elem addChild: edit +] + +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> renameProtocolFrom: oldName to: newName [ + | model modelClass | + model := RBNamespace new. + modelClass := model classFor: self selectedClass. + (self selectedClass organization protocolNamed: oldName) + methodSelectors do: [:each | model selector: each in: modelClass classified: newName]. + ^model changes ] { #category : #'api - package reselections' } diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st index 1dbcd9f66..d22314d6c 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st @@ -59,23 +59,18 @@ GtCoderNavigationPackagesTreeElement >> childrenForPackageOrTag: aPackageOrTag [ GtCoderNavigationPackagesTreeElement >> contextMenuItemsFor: aPackageOrTag [ | items | items := {(self createLabel: 'New package / tag' description: '') - -> [ :elem | self newPackage ]} - asOrderedCollection. + -> [ :elem | self newPackage ]} asOrderedCollection. aPackageOrTag class == RPackage ifTrue: [ items addAll: {(self createLabel: 'Rename package' description: aPackageOrTag name) -> [ :elem | self renamePackage: aPackageOrTag inElement: elem ]. (self createLabel: 'Remove package' description: aPackageOrTag name) - -> [ :elem | self removePackage: aPackageOrTag inElement: elem ] - "(self createLabel: 'Demote package' description: aPackageOrTag name) - -> [ :elem | self demotePackage: aPackageOrTag inElement: elem ]" }] + -> [ :elem | self removePackage: aPackageOrTag inElement: elem ]} ] ifFalse: [ items addAll: {(self createLabel: 'Rename tag' description: aPackageOrTag name) -> [ :elem | self renameTag: aPackageOrTag inElement: elem ]. (self createLabel: 'Remove tag' description: aPackageOrTag name) - -> [ :elem | self removeTag: aPackageOrTag inElement: elem ] - "(self createLabel: 'Promote tag' description: aPackageOrTag name) - -> [ :elem | self promoteTag: aPackageOrTag inElement: elem ]" } ]. + -> [ :elem | self removeTag: aPackageOrTag inElement: elem ]} ]. ^ items ] From f711dd526106a4dc53923ab3331e91d99d3ce918 Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Mon, 27 Feb 2023 14:50:07 +0100 Subject: [PATCH 0420/1268] enlarge the add form feenkcom/gtoolkit#3101 --- src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index 1dab0ee71..47295badf 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -40,7 +40,7 @@ GtCoderNavigationTabsStencil >> addButtonsTo: explicitView [ element constraintsDo: [ :c | c horizontal exact: 400. - c vertical exact: 260 ]. + c vertical exact: 300 ]. element addChild: (self gtCreationInterface: aDropdown). aDropdown when: GtNavigationDropDownCreateWish From 41d778395f7207a766df9c2756d3115f07f909f3 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Mon, 27 Feb 2023 15:50:03 +0100 Subject: [PATCH 0421/1268] Use a stencil/block in the context menu definition of the class/trait update forms [feenkcom/gtoolkit#3085] --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index f471d536e..9d12c1d7d 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -199,7 +199,7 @@ GtCreationForm >> taggerStencilWithCompletion: aCompletionStrategy andContextMen aContextMenuBlock ifNotNil: [ aLabel addAptitude: (BrGlamorousWithContextMenuAptitude - content: (aContextMenuBlock value: aTag name value: aLabel)) ]. + content: [ aContextMenuBlock value: aTag name value: aLabel ]) ]. aLabel ]). aTagger when: BrTaggerAddTagRequest From e5ace0b246b58e29de99889ca893d309d943b469 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Mon, 27 Feb 2023 09:47:45 -0600 Subject: [PATCH 0422/1268] Created rename protocol refactoring [feenkcom/gtoolkit#3041] --- ...NavigationPackagesTagsClassesElement.class.st | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 622202905..d4ab3d50c 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -684,8 +684,10 @@ GtCoderNavigationPackagesTagsClassesElement >> renameProtocol: protocolName in: text: protocolName; when: BrEditorAcceptWish do: [ :aWish | - refactoring := self renameProtocolFrom: protocolName to: aWish text asString. - refactoring halt. + refactoring := GtRBRenameProtocolRefactoring + renameProtocol: protocolName + in: self selectedClass + to: aWish text asString. edit switchToLabel. self addPreviewButtonFor: refactoring to: elem ]; switchToEditor. @@ -694,16 +696,6 @@ GtCoderNavigationPackagesTagsClassesElement >> renameProtocol: protocolName in: elem addChild: edit ] -{ #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> renameProtocolFrom: oldName to: newName [ - | model modelClass | - model := RBNamespace new. - modelClass := model classFor: self selectedClass. - (self selectedClass organization protocolNamed: oldName) - methodSelectors do: [:each | model selector: each in: modelClass classified: newName]. - ^model changes -] - { #category : #'api - package reselections' } GtCoderNavigationPackagesTagsClassesElement >> reselectPackageOrTag: aSelectedPackageOrTag afterRemovalOfPackageNamed: aRemovedPackageOrTagName [ aSelectedPackageOrTag ifNotNil: [ From 2927afbeb117fca151294aabc082d6c2d8493a2d Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Mon, 27 Feb 2023 21:12:40 +0100 Subject: [PATCH 0423/1268] set the context menu instead of adding it in the data binder feenkcom/gtoolkit#3106 --- .../GtCoderNavigationPackagesTreeElement.class.st | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st index d22314d6c..8fc26fb87 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st @@ -88,16 +88,16 @@ GtCoderNavigationPackagesTreeElement >> initialize [ self nodeStencil: [ BrHorizontalPane new - aptitude: BrGlamorousListItemAptitude; hMatchParent; vFitContent ]; nodeDataBinder: [ :aPackageElement :aPackage | | label | aPackageElement removeChildren; - addAptitude: (BrGlamorousWithContextMenuAptitude - content: [ GtCoderNavigationContextMenuContent new - items: (self contextMenuItemsFor: aPackage) ]). + aptitude: BrGlamorousListItemAptitude new + + (BrGlamorousWithContextMenuAptitude + content: [ GtCoderNavigationContextMenuContent new + items: (self contextMenuItemsFor: aPackage) ]). label := BrLabel new matchParent; beSmallSize; From 67e38e58e3ea2876151470d82411f38d15c6bc0f Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Mon, 27 Feb 2023 21:17:16 +0100 Subject: [PATCH 0424/1268] set the context menu instead of adding it in the data binder feenkcom/gtoolkit#3106 --- .../GtCoderNavigationClassesHierarchyTreeElement.class.st | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st index 184ca7655..48a04c8a0 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st @@ -82,16 +82,16 @@ GtCoderNavigationClassesHierarchyTreeElement >> initialize [ self nodeStencil: [ BrHorizontalPane new - aptitude: BrGlamorousListItemAptitude; hMatchParent; vFitContent ]; nodeDataBinder: [ :aClassElement :aClassHierarchyTree | | label | aClassElement removeChildren; - addAptitude: (BrGlamorousWithContextMenuAptitude - content: [ GtCoderNavigationContextMenuContent new - items: (self contextMenuItemsFor: aClassHierarchyTree rootClass) ]). + aptitude: BrGlamorousListItemAptitude new + + (BrGlamorousWithContextMenuAptitude + content: [ GtCoderNavigationContextMenuContent new + items: (self contextMenuItemsFor: aClassHierarchyTree rootClass) ]). label := BrLabel new matchParent; beSmallSize; From dcb8f7ef36c388a281a19db720025f3d9c518ea6 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 28 Feb 2023 10:01:49 -0600 Subject: [PATCH 0425/1268] Fix some of the refactoring cancel actions [feenkcom/gtoolkit#3041] --- ...gationClassesHierarchyTreeElement.class.st | 23 +----- ...igationPackagesTagsClassesElement.class.st | 82 +++++++++++-------- .../TNavigationWithContextMenu.trait.st | 21 +++++ 3 files changed, 69 insertions(+), 57 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st index 48a04c8a0..cbd801d20 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st @@ -19,27 +19,6 @@ GtCoderNavigationClassesHierarchyTreeElement class >> fromClasses: aCollectionOf ^ self new initializeWithClasses: aCollectionOfClasses ] -{ #category : #accessing } -GtCoderNavigationClassesHierarchyTreeElement >> addPreviewButtonFor: refactoring to: elem [ - | button | - elem removeChildNamed: #preview. - button := GtRefactoringsPreviewButton new. - button vMatchParent. - button refactorings: [ {refactoring} ]. - button cancelBlock: [ ]. - button - padding: (BlInsets - top: 1 - right: 4 - bottom: 0 - left: 4). - button beMiniSize. - button - when: GtRefactoringsAppliedEvent - do: [ :anEvent | elem removeChild: anEvent currentTarget ]. - ^ elem addChild: button as: #preview -] - { #category : #initialization } GtCoderNavigationClassesHierarchyTreeElement >> buildRemoveClassLabelFor: aClass [ | labelText | @@ -159,7 +138,7 @@ GtCoderNavigationClassesHierarchyTreeElement >> removeClass: aClass inElement: e ] { #category : #initialization } -GtCoderNavigationClassesHierarchyTreeElement >> renameClass: aClass inElement: elem [ +GtCoderNavigationClassesHierarchyTreeElement >> renameClass: aClass inElement: elem [ | refactoring edit | edit := BrEditableLabel new. edit diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index d4ab3d50c..016ee035f 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -41,27 +41,6 @@ GtCoderNavigationPackagesTagsClassesElement >> addPackage: aPackage tag: aPackag self selectPackageOrTag: aSelectedPackageOrTag ]. ] -{ #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> addPreviewButtonFor: refactoring to: elem [ - | button | - elem removeChildNamed: #preview. - button := GtRefactoringsPreviewButton new. - button vMatchParent. - button refactorings: [ {refactoring} ]. - button cancelBlock: [ ]. - button - padding: (BlInsets - top: 1 - right: 4 - bottom: 0 - left: 4). - button beMiniSize. - button - when: GtRefactoringsAppliedEvent - do: [ :anEvent | elem removeChild: anEvent currentTarget ]. - ^ elem addChild: button as: #preview -] - { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> browseHierarchyImplementorsOf: aSymbol [ self phlow @@ -573,7 +552,10 @@ GtCoderNavigationPackagesTagsClassesElement >> pushDownMethod: aSelector inEleme refactoring := RBPushDownMethodRefactoring pushDown: {aSelector} from: self selectedClass. - ^ self addPreviewButtonFor: refactoring to: elem + ^ self + addPreviewButtonFor: refactoring + to: elem + cancelSelector: #updateProtocolList ] { #category : #initialization } @@ -582,7 +564,10 @@ GtCoderNavigationPackagesTagsClassesElement >> pushUpMethod: aSelector inElement refactoring := RBPullUpMethodRefactoring pullUp: {aSelector} from: self selectedClass. - ^ self addPreviewButtonFor: refactoring to: elem + ^ self + addPreviewButtonFor: refactoring + to: elem + cancelSelector: #updateProtocolList ] { #category : #initialization } @@ -634,7 +619,10 @@ GtCoderNavigationPackagesTagsClassesElement >> removeProtocol: protocolName in: refactoring := RBRemoveProtocolChange removeProtocolNamed: protocolName in: self selectedClass. - ^ self addPreviewButtonFor: refactoring to: elem + ^ self + addPreviewButtonFor: refactoring + to: elem + cancelSelector: #updateProtocolList ] { #category : #initialization } @@ -654,7 +642,10 @@ GtCoderNavigationPackagesTagsClassesElement >> renameMethod: aSelector inElement to: aWish text asString permutation: (1 to: aSelector numArgs). edit switchToLabel. - self addPreviewButtonFor: refactoring to: elem ]; + self + addPreviewButtonFor: refactoring + to: elem + cancelSelector: #updateProtocolList ]; switchToEditor. edit requestFocus. elem removeChildren. @@ -685,11 +676,14 @@ GtCoderNavigationPackagesTagsClassesElement >> renameProtocol: protocolName in: when: BrEditorAcceptWish do: [ :aWish | refactoring := GtRBRenameProtocolRefactoring - renameProtocol: protocolName - in: self selectedClass - to: aWish text asString. + renameProtocol: protocolName + in: self selectedClass + to: aWish text asString. edit switchToLabel. - self addPreviewButtonFor: refactoring to: elem ]; + self + addPreviewButtonFor: refactoring + to: elem + cancelSelector: #updateProtocolList ]; switchToEditor. edit requestFocus. elem removeChildren. @@ -824,42 +818,60 @@ GtCoderNavigationPackagesTagsClassesElement >> slotListContextMenuItemsFor: item refactoring := RBPullUpInstanceVariableRefactoring variable: item name class: self selectedClass superclass. - self addPreviewButtonFor: refactoring to: elem ]. + self + addPreviewButtonFor: refactoring + to: elem + cancelSelector: #updateProtocolList ]. (self createLabel: 'Push down ' description: item name) -> [ :elem | | refactoring | refactoring := RBPushDownInstanceVariableRefactoring variable: item name class: self selectedClass. - self addPreviewButtonFor: refactoring to: elem ]. + self + addPreviewButtonFor: refactoring + to: elem + cancelSelector: #updateProtocolList ]. (self createLabel: 'Create accessors for ' description: item name) -> [ :elem | | refactoring | refactoring := RBCreateAccessorsForVariableRefactoring instanceVariable: item name class: self selectedClass. - self addPreviewButtonFor: refactoring to: elem ]. + self + addPreviewButtonFor: refactoring + to: elem + cancelSelector: #updateProtocolList ]. (self createLabel: 'Abstract ' description: item name) -> [ :elem | | refactoring | refactoring := RBAbstractInstanceVariableRefactoring variable: item name class: self selectedClass. - self addPreviewButtonFor: refactoring to: elem ]. + self + addPreviewButtonFor: refactoring + to: elem + cancelSelector: #updateProtocolList ]. (self createLabel: 'Protect ' description: item name) -> [ :elem | | refactoring | refactoring := RBProtectInstanceVariableRefactoring variable: item name class: self selectedClass. - self addPreviewButtonFor: refactoring to: elem ]. + self + addPreviewButtonFor: refactoring + to: elem + cancelSelector: #updateProtocolList ]. (self createLabel: 'Remove ' description: item name) -> [ :elem | | refactoring | refactoring := RBRemoveInstanceVariableRefactoring variable: item name class: self selectedClass. - self addPreviewButtonFor: refactoring to: elem ]} + self + addPreviewButtonFor: refactoring + to: elem + cancelSelector: #updateProtocolList ]} ] { #category : #subscriptions } diff --git a/src/GToolkit-Coder-UI/TNavigationWithContextMenu.trait.st b/src/GToolkit-Coder-UI/TNavigationWithContextMenu.trait.st index b2684389e..1d6d20ebb 100644 --- a/src/GToolkit-Coder-UI/TNavigationWithContextMenu.trait.st +++ b/src/GToolkit-Coder-UI/TNavigationWithContextMenu.trait.st @@ -24,6 +24,27 @@ TNavigationWithContextMenu >> addPreviewButtonFor: refactoring to: elem [ ^ elem addChild: button as: #preview ] +{ #category : #accessing } +TNavigationWithContextMenu >> addPreviewButtonFor: refactoring to: elem cancelSelector: cancelSelector [ + | button | + elem removeChildNamed: #preview. + button := GtRefactoringsPreviewButton new. + button vMatchParent. + button refactorings: [ {refactoring} ]. + button cancelBlock: [ self perform: cancelSelector ]. + button + padding: (BlInsets + top: 1 + right: 4 + bottom: 0 + left: 4). + button beMiniSize. + button + when: GtRefactoringsAppliedEvent + do: [ :anEvent | elem removeChild: anEvent currentTarget ]. + ^ elem addChild: button as: #preview +] + { #category : #accessing } TNavigationWithContextMenu >> createLabel: aString description: description [ ^ aString asRopedText glamorousRegularFont From 8738d3dff2d51ca4acc9f903a96eb72df729dd00 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 28 Feb 2023 10:26:04 -0600 Subject: [PATCH 0426/1268] Fix rename cancel actions [feenkcom/gtoolkit#3041] --- ...GtCoderNavigationClassesHierarchyTreeElement.class.st | 9 +++++++-- .../GtCoderNavigationPackagesTreeElement.class.st | 9 +++++++-- .../TNavigationWithContextMenu.trait.st | 4 ++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st index cbd801d20..b8e1df93d 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st @@ -139,8 +139,9 @@ GtCoderNavigationClassesHierarchyTreeElement >> removeClass: aClass inElement: e { #category : #initialization } GtCoderNavigationClassesHierarchyTreeElement >> renameClass: aClass inElement: elem [ - | refactoring edit | + | refactoring edit childs | edit := BrEditableLabel new. + childs := elem children. edit aptitude: (BrGlamorousEditableLabelAptitude new glamorousCodeSmallSize; @@ -152,7 +153,11 @@ GtCoderNavigationClassesHierarchyTreeElement >> renameClass: aClass inElement: e rename: aClass name to: aWish text asString. edit switchToLabel. - self addPreviewButtonFor: refactoring to: elem ]; + self + addPreviewButtonFor: refactoring + to: elem + cancelBlock: [ elem removeChildren. + elem addChildren: childs ] ]; switchToEditor. edit requestFocus. elem removeChildren. diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st index 8fc26fb87..b5fa2e890 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st @@ -182,7 +182,8 @@ GtCoderNavigationPackagesTreeElement >> removeTag: aTag inElement: elem [ { #category : #initialization } GtCoderNavigationPackagesTreeElement >> renamePackage: aPackage inElement: elem [ - | refactoring edit | + | refactoring edit childs | + childs := elem children. edit := BrEditableLabel new. edit aptitude: (BrGlamorousEditableLabelAptitude new @@ -195,7 +196,11 @@ GtCoderNavigationPackagesTreeElement >> renamePackage: aPackage inElement: elem from: aPackage name to: aWish text asString. edit switchToLabel. - self addPreviewButtonFor: refactoring to: elem ]; + self + addPreviewButtonFor: refactoring + to: elem + cancelBlock: [ elem removeChildren. + elem addChildren: childs ] ]; switchToEditor. edit requestFocus. elem removeChildren. diff --git a/src/GToolkit-Coder-UI/TNavigationWithContextMenu.trait.st b/src/GToolkit-Coder-UI/TNavigationWithContextMenu.trait.st index 1d6d20ebb..70eb316ea 100644 --- a/src/GToolkit-Coder-UI/TNavigationWithContextMenu.trait.st +++ b/src/GToolkit-Coder-UI/TNavigationWithContextMenu.trait.st @@ -4,13 +4,13 @@ Trait { } { #category : #accessing } -TNavigationWithContextMenu >> addPreviewButtonFor: refactoring to: elem [ +TNavigationWithContextMenu >> addPreviewButtonFor: refactoring to: elem cancelBlock: aBlock [ | button | elem removeChildNamed: #preview. button := GtRefactoringsPreviewButton new. button vMatchParent. button refactorings: [ {refactoring} ]. - button cancelBlock: [ ]. + button cancelBlock: aBlock. button padding: (BlInsets top: 1 From 4ee5d47a004e30400bdc1579560e386020fef44f Mon Sep 17 00:00:00 2001 From: John Brant Date: Wed, 1 Mar 2023 07:26:59 -0600 Subject: [PATCH 0427/1268] [feenkcom/gtoolkit#3110] fixing diff display when at the beginning --- src/GToolkit-Coder-UI/GtDiffElement.class.st | 48 ++++++++++++-------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtDiffElement.class.st b/src/GToolkit-Coder-UI/GtDiffElement.class.st index 9c57bf737..b29af5894 100644 --- a/src/GToolkit-Coder-UI/GtDiffElement.class.st +++ b/src/GToolkit-Coder-UI/GtDiffElement.class.st @@ -127,12 +127,14 @@ GtDiffElement >> initialize [ { #category : #'event handling' } GtDiffElement >> leftBottomFor: anInteger [ - | range element | + | range element index | range := self leftRange. - anInteger < range first ifTrue: [ ^ 0 ]. - anInteger > range last ifTrue: [ ^ self height ]. - element := leftElement children at: anInteger - range first + 1. - ^ element bounds bottom + leftElement bounds top max: 0 + range isEmpty ifTrue: [ ^ leftElement bounds top + leftElement padding top ]. + index := (anInteger max: range first) min: range last. + element := leftElement children at: index - range first + 1. + ^ (anInteger < range first + ifTrue: [ element bounds top ] + ifFalse: [ element bounds bottom ]) + leftElement bounds top max: 0 ] { #category : #'event handling' } @@ -177,12 +179,14 @@ GtDiffElement >> leftStyler: aStyler [ { #category : #'event handling' } GtDiffElement >> leftTopFor: anInteger [ - | range element | + | range element index | range := self leftRange. - anInteger < range first ifTrue: [ ^ 0 ]. - anInteger > range last ifTrue: [ ^ self height ]. - element := leftElement children at: anInteger - range first + 1. - ^ element bounds top + leftElement bounds top max: 0 + range isEmpty ifTrue: [ ^ leftElement bounds top + leftElement padding top ]. + index := (anInteger max: range first) min: range last. + element := leftElement children at: index - range first + 1. + ^ (anInteger > range last + ifTrue: [ element bounds bottom ] + ifFalse: [ element bounds top ]) + leftElement bounds top max: 0 ] { #category : #initialize } @@ -270,12 +274,14 @@ GtDiffElement >> paintMeAndChildrenOn: aCompositorPainter offset: anOffset [ { #category : #'event handling' } GtDiffElement >> rightBottomFor: anInteger [ - | range element | + | range element index | range := self rightRange. - anInteger < range first ifTrue: [ ^ 0 ]. - anInteger > range last ifTrue: [ ^ self height ]. - element := rightElement children at: anInteger - range first + 1. - ^ element bounds bottom + rightElement bounds top max: 0 + range isEmpty ifTrue: [ ^ rightElement bounds top + rightElement padding top ]. + index := (anInteger max: range first) min: range last. + element := rightElement children at: index - range first + 1. + ^ (anInteger < range first + ifTrue: [ element bounds top ] + ifFalse: [ element bounds bottom ]) + rightElement bounds top max: 0 ] { #category : #'event handling' } @@ -320,12 +326,14 @@ GtDiffElement >> rightStyler: aStyler [ { #category : #'event handling' } GtDiffElement >> rightTopFor: anInteger [ - | range element | + | range element index | range := self rightRange. - anInteger < range first ifTrue: [ ^ 0 ]. - anInteger > range last ifTrue: [ ^ self height ]. - element := rightElement children at: anInteger - range first + 1. - ^ element bounds top + rightElement bounds top max: 0 + range isEmpty ifTrue: [ ^ rightElement bounds top + rightElement padding top ]. + index := (anInteger max: range first) min: range last. + element := rightElement children at: index - range first + 1. + ^ (anInteger > range last + ifTrue: [ element bounds bottom ] + ifFalse: [ element bounds top ]) + rightElement bounds top max: 0 ] { #category : #accessing } From 443b1ad2cf575106d0bd42c20babf3d6ce38aed6 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Wed, 1 Mar 2023 20:24:50 +0100 Subject: [PATCH 0428/1268] Make tagger label become editor on click [feenkcom/gtoolkit#3085] --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index 9d12c1d7d..ce26b6f14 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -194,6 +194,14 @@ GtCreationForm >> taggerStencilWithCompletion: aCompletionStrategy andContextMen text: (aDescription displayStringFor: aTag name); aptitude: (BrGlamorousEditableLabelAptitude new glamorousFormEditorCodeFontAndSize defaultForeground: Color black). + + aDescription blocShortcuts + ifNotNil: [ :aBlockReturningCollection | + aBlockReturningCollection value + do: [ :aShortcut | aLabel addShortcut: aShortcut ] ]. + + aLabel when: BlClickEvent do: [ :anEvent | aLabel switchToEditor ]. + aCompletionStrategy ifNotNil: [ (GtCompletionController on: aLabel strategy: aCompletionStrategy) install ]. aContextMenuBlock From 3a6b4f4807e4756203ad57445454b30018412f6d Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Wed, 1 Mar 2023 20:39:07 +0100 Subject: [PATCH 0429/1268] Fix tagger margins [feenkcom/gtoolkit#3085] --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index ce26b6f14..d2c06e2c3 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -182,10 +182,11 @@ GtCreationForm >> taggerStencilWithCompletion: aCompletionStrategy andContextMen aTagger := BrTagger new hFitContentLimited. aForm hMatchParent. aTagger + padding: (BlInsets bottom: 6); aptitude: (aTaggerAptitude := GtCreationEditableTaggerAptitude new margin: (BlInsets - top: 3 - bottom: 3 + top: 0 + bottom: 0 left: 0 right: 5); tagLabel: [ :aTag | From b1f00fadacf3e4b8b32c8b63f3b28b9fee29da28 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 1 Mar 2023 14:21:08 -0600 Subject: [PATCH 0430/1268] Start of proper handling of extension methods in the index [feenkcom/gtoolkit#2998] --- .../GtCoderNavigationPackagesTagsClassesElement.class.st | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 016ee035f..05320ec5d 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -715,9 +715,6 @@ GtCoderNavigationPackagesTagsClassesElement >> reselectPackageOrTag: aSelectedPa { #category : #'api - class selections' } GtCoderNavigationPackagesTagsClassesElement >> selectClass: aClass inPackage: aPackage tag: aPackageTag [ - (self selectedPackage ~= aPackage - or: [ self selectedPackageTag ~= aPackageTag ]) - ifTrue: [ self selectPackage: aPackage tag: aPackageTag ]. self selectClass: aClass. self updateProtocolList. self updateSlotList From 80f5fe2cc92b631d8c9e8819c63dbea9c5bb85c2 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Thu, 2 Mar 2023 09:58:02 +0100 Subject: [PATCH 0431/1268] Better tagger alignment in creation forms [feenkcom/gtoolkit#3105] --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index d2c06e2c3..22bae3099 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -182,11 +182,12 @@ GtCreationForm >> taggerStencilWithCompletion: aCompletionStrategy andContextMen aTagger := BrTagger new hFitContentLimited. aForm hMatchParent. aTagger - padding: (BlInsets bottom: 6); + padding: (BlInsets top: -2 bottom: 5); + clipChildren: false; aptitude: (aTaggerAptitude := GtCreationEditableTaggerAptitude new margin: (BlInsets top: 0 - bottom: 0 + bottom: 3 left: 0 right: 5); tagLabel: [ :aTag | From dd8a4099d3c07e2b150afc2e1015063acf88fc1a Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 2 Mar 2023 06:53:22 -0600 Subject: [PATCH 0432/1268] Fix failing example [feenkcom/gtoolkit#2998] --- .../GtCoderNavigationPackagesTagsClassesElement.class.st | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 05320ec5d..016ee035f 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -715,6 +715,9 @@ GtCoderNavigationPackagesTagsClassesElement >> reselectPackageOrTag: aSelectedPa { #category : #'api - class selections' } GtCoderNavigationPackagesTagsClassesElement >> selectClass: aClass inPackage: aPackage tag: aPackageTag [ + (self selectedPackage ~= aPackage + or: [ self selectedPackageTag ~= aPackageTag ]) + ifTrue: [ self selectPackage: aPackage tag: aPackageTag ]. self selectClass: aClass. self updateProtocolList. self updateSlotList From d79d6d340397719010229560debb29de70892336 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 3 Mar 2023 10:33:49 -0300 Subject: [PATCH 0433/1268] ensure that `GtAbstractCoderContextMenuContent` width is fully visible [feenkcom/gtoolkit#3017] There were cases during which a part of a context menu was outside of Bloc screen bounds. --- .../GtAbstractCoderContextMenuContent.class.st | 2 +- .../GtCoderContextMenuContent.class.st | 3 ++- .../GtCoderContextMenuItemId.class.st | 10 ++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderContextMenuItemId.class.st diff --git a/src/GToolkit-Coder-UI/GtAbstractCoderContextMenuContent.class.st b/src/GToolkit-Coder-UI/GtAbstractCoderContextMenuContent.class.st index 8c5379370..1c9d56ff1 100644 --- a/src/GToolkit-Coder-UI/GtAbstractCoderContextMenuContent.class.st +++ b/src/GToolkit-Coder-UI/GtAbstractCoderContextMenuContent.class.st @@ -14,7 +14,7 @@ GtAbstractCoderContextMenuContent >> initialize [ right: 10 bottom: 8 left: 10); - hFitContent; + hFitContentLimited; vFitContent ] diff --git a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st index ce6f27b08..065ba67be 100644 --- a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st +++ b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st @@ -23,9 +23,10 @@ GtCoderContextMenuContent >> editorElement: anEditorElement [ { #category : #initialization } GtCoderContextMenuContent >> menuItemStencil [ - ^ [ :eachGtCoderContextMenuAction | + ^ [ :eachGtCoderContextMenuAction :aRowIndex | | element | element := BrHorizontalPane new + id: (GtCoderContextMenuItemId indexed: aRowIndex); hMatchParent; vFitContent; alignCenter; diff --git a/src/GToolkit-Coder-UI/GtCoderContextMenuItemId.class.st b/src/GToolkit-Coder-UI/GtCoderContextMenuItemId.class.st new file mode 100644 index 000000000..43c6e5bcc --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderContextMenuItemId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtCoderContextMenuItemId, + #superclass : #BlElementUniqueId, + #category : #'GToolkit-Coder-UI-Basic' +} + +{ #category : #converting } +GtCoderContextMenuItemId >> asSymbol [ + ^ #'coder-context-menu--item' +] From 25861701f57fa7104753157f83550340e13a82d2 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 3 Mar 2023 11:44:02 -0300 Subject: [PATCH 0434/1268] fix context menu height [feenkcom/gtoolkit#3017] Users can scroll if some context menu items are not visible. --- .../GtAbstractCoderContextMenuContent.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtAbstractCoderContextMenuContent.class.st b/src/GToolkit-Coder-UI/GtAbstractCoderContextMenuContent.class.st index 1c9d56ff1..cf81be0b8 100644 --- a/src/GToolkit-Coder-UI/GtAbstractCoderContextMenuContent.class.st +++ b/src/GToolkit-Coder-UI/GtAbstractCoderContextMenuContent.class.st @@ -15,7 +15,7 @@ GtAbstractCoderContextMenuContent >> initialize [ bottom: 8 left: 10); hFitContentLimited; - vFitContent + vFitContentLimited ] { #category : #accessing } From caecc4cabb77a664c58796a3cbf152aa5a1d8a58 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 3 Mar 2023 12:23:49 -0300 Subject: [PATCH 0435/1268] add a class comment [feenkcom/gtoolkit#3017] --- src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st index 065ba67be..0fb4de4ea 100644 --- a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st +++ b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st @@ -1,3 +1,9 @@ +" +I represent a Coder context menu. +#Examples +The following example shows a case during which a context menu height does not fit and a scrollbar is displayed: {{gtExample:GtPharoCoderByScripterExamples>>#displayPharoMethodContextMenuExtentIn800x300Space | previewExpanded=true | codeExpanded=false | previewHeight=500}} + +" Class { #name : #GtCoderContextMenuContent, #superclass : #GtAbstractCoderContextMenuContent, From 209e0201057c3fb135ad083d42690588c4c04a4b Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 3 Mar 2023 11:23:43 -0600 Subject: [PATCH 0436/1268] Don't switch packages when selecting extension tag [feenkcom/gtoolkit#2998] --- src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st | 2 +- .../GtCoderNavigationPackagesTagsClassesElement.class.st | 9 ++++----- src/GToolkit-Coder/GtCoderPackageExtentionTag.class.st | 5 +++++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st index 36967e5f4..439fc97ae 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st @@ -171,7 +171,7 @@ GtCoderNavigationElement >> scrollIndexFromPrevious: aPreviousIndex current: aNe { #category : #'api - class selections' } GtCoderNavigationElement >> selectClass: aClass [ - | aPreviousIndex | + | aPreviousIndex | aPreviousIndex := classesList selectedIndice. classesList viewModel indexOfSuchThat: [ :each | each rootClass = aClass ] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 016ee035f..5ea136fb2 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -444,7 +444,7 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackageListSelectionChanged [ aSelectedItem := (packagesList viewModel itemAt: anIndex) value. (aSelectedItem isKindOf: RPackage) ifTrue: [ self navigationModel selectPackage: aSelectedItem ] - ifFalse: [ self navigationModel selectTag: aSelectedItem ]. + ifFalse: [ self navigationModel selectPackageTag: aSelectedItem ]. self showClassList. self deselectClasses ] @@ -467,7 +467,7 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackageRenamed: anAnnouncement { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageSelected: anAnnouncer [ self - suppressListChangeEventsDuring: [ self selectPackage: anAnnouncer package. + suppressListChangeEventsDuring: [ self selectPackage: anAnnouncer package. self haltOnce. self showClassList. self deselectClasses ] ] @@ -743,12 +743,11 @@ GtCoderNavigationPackagesTagsClassesElement >> selectPackage: aPackage [ { #category : #'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> selectPackage: aPackage tag: aPackageTag [ - | aPreviousIndex | + | aPreviousIndex | (self hasPackageTagsIn: aPackage) ifFalse: [ ^ self selectPackage: aPackage ]. self expandPackage: aPackage. aPreviousIndex := packagesList selectedIndice. - packagesList viewModel indexOf: aPackageTag do: [ :aNewIndex | @@ -929,7 +928,7 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToSlotList [ { #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updateClassLists [ - self hasNavigationModel ifFalse: [ ^ self ]. + self hasNavigationModel ifFalse: [ ^ self ]. self haltOnce. classesList initializeWithClasses: navigationModel classesToShow. self updateProtocolList. self updateSlotList diff --git a/src/GToolkit-Coder/GtCoderPackageExtentionTag.class.st b/src/GToolkit-Coder/GtCoderPackageExtentionTag.class.st index ced72ed10..e3821243c 100644 --- a/src/GToolkit-Coder/GtCoderPackageExtentionTag.class.st +++ b/src/GToolkit-Coder/GtCoderPackageExtentionTag.class.st @@ -35,6 +35,11 @@ GtCoderPackageExtentionTag >> hasExtendedClasses [ ^ self classes isNotEmpty ] +{ #category : #testing } +GtCoderPackageExtentionTag >> isRoot [ + ^true +] + { #category : #accessing } GtCoderPackageExtentionTag >> name [ ^ 'Extensions' From 1340c35a1fa5bbe89cc40eba4effd6a2a022fb13 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 3 Mar 2023 12:07:45 -0600 Subject: [PATCH 0437/1268] Remove an escaped haltOnce [feenkcom/gtoolkit#2998] --- .../GtCoderNavigationPackagesTagsClassesElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 5ea136fb2..8f1b8dd72 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -928,7 +928,7 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToSlotList [ { #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updateClassLists [ - self hasNavigationModel ifFalse: [ ^ self ]. self haltOnce. + self hasNavigationModel ifFalse: [ ^ self ]. classesList initializeWithClasses: navigationModel classesToShow. self updateProtocolList. self updateSlotList From 8bc9ffa7eaca572cd155c37c71151d0d5b19aecf Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 3 Mar 2023 12:09:18 -0600 Subject: [PATCH 0438/1268] Remove an escaped haltOnce [feenkcom/gtoolkit#2998] --- .../GtCoderNavigationPackagesTagsClassesElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 8f1b8dd72..4116d9a06 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -467,7 +467,7 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackageRenamed: anAnnouncement { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageSelected: anAnnouncer [ self - suppressListChangeEventsDuring: [ self selectPackage: anAnnouncer package. self haltOnce. + suppressListChangeEventsDuring: [ self selectPackage: anAnnouncer package. self showClassList. self deselectClasses ] ] From 3922dff77ba2c26ff6ed9517ec2a1e45050cf930 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 3 Mar 2023 17:29:11 -0300 Subject: [PATCH 0439/1268] add `GtCoderNavigationClassesHierarchyTreeElementId` [feenkcom/gtoolkit#3018] --- ...CoderNavigationClassesHierarchyTreeElement.class.st | 3 ++- ...derNavigationClassesHierarchyTreeElementId.class.st | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElementId.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st index b8e1df93d..7a6785c0f 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st @@ -63,9 +63,10 @@ GtCoderNavigationClassesHierarchyTreeElement >> initialize [ nodeStencil: [ BrHorizontalPane new hMatchParent; vFitContent ]; - nodeDataBinder: [ :aClassElement :aClassHierarchyTree | + nodeDataBinder: [ :aClassElement :aClassHierarchyTree :aTreeNode | | label | aClassElement + id: (GtCoderNavigationClassesHierarchyTreeElementId indexed: aTreeNode indexInTree); removeChildren; aptitude: BrGlamorousListItemAptitude new + (BrGlamorousWithContextMenuAptitude diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElementId.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElementId.class.st new file mode 100644 index 000000000..bd306530e --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElementId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtCoderNavigationClassesHierarchyTreeElementId, + #superclass : #BlElementUniqueId, + #category : #'GToolkit-Coder-UI-Navigation' +} + +{ #category : #accessing } +GtCoderNavigationClassesHierarchyTreeElementId >> asSymbol [ + ^ #'coder-sidebar--classes-hierarchy-tree-item' +] From f1bbf3c0558c4f97c0e10118770f3db2fa1bdbe2 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Mon, 6 Mar 2023 11:37:30 +0100 Subject: [PATCH 0440/1268] Ensure "Uncategorized" package tag is never prefilled in package creation form [feenkcom/gtoolkit#3115] --- src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st | 2 +- src/GToolkit-Coder/GtCoderPackageExtentionTag.class.st | 5 +++++ src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index 47295badf..c999258f5 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -147,7 +147,7 @@ GtCoderNavigationTabsStencil >> gtCreationInterface: look [ ifTrue: [ navigationModel selectedPackageDo: [ :aPackage | form packageAndTagName packageName: aPackage name ]. navigationModel - selectedTagDo: [ :aTag | form packageAndTagName tagName: aTag name ] ]. + selectedTagDo: [ :aTag | aTag isUncategorized ifFalse: [ form packageAndTagName tagName: aTag name ] ] ]. ((GtCreationFormWidget forForm: form) onAccept: [ :anInstance | look diff --git a/src/GToolkit-Coder/GtCoderPackageExtentionTag.class.st b/src/GToolkit-Coder/GtCoderPackageExtentionTag.class.st index e3821243c..667d0bb65 100644 --- a/src/GToolkit-Coder/GtCoderPackageExtentionTag.class.st +++ b/src/GToolkit-Coder/GtCoderPackageExtentionTag.class.st @@ -40,6 +40,11 @@ GtCoderPackageExtentionTag >> isRoot [ ^true ] +{ #category : #accessing } +GtCoderPackageExtentionTag >> isUncategorized [ + ^ false +] + { #category : #accessing } GtCoderPackageExtentionTag >> name [ ^ 'Extensions' diff --git a/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st b/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st index 6a31f00b4..ccae87815 100644 --- a/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st +++ b/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st @@ -33,6 +33,11 @@ GtCoderPackageUncategorizedTag >> isRoot [ ^ true ] +{ #category : #accessing } +GtCoderPackageUncategorizedTag >> isUncategorized [ + ^ true +] + { #category : #accessing } GtCoderPackageUncategorizedTag >> name [ ^ 'Uncategorized' From 93def0c78d96c7370c6d9ca50f3d211d4bec8c86 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Mon, 6 Mar 2023 10:45:36 -0600 Subject: [PATCH 0441/1268] Adding examples for extension navigation [feenkcom/gtoolkit#2998] --- .../GtCoderNavigationElement.class.st | 5 ++ ...igationPackagesTagsClassesElement.class.st | 4 +- ...oderNavigationPackagesTreeElement.class.st | 2 +- .../GtCoderPackageExtensionTag.class.st | 79 +++++++++++++++++++ .../GtCoderPackageExtentionTag.class.st | 68 ---------------- 5 files changed, 87 insertions(+), 71 deletions(-) create mode 100644 src/GToolkit-Coder/GtCoderPackageExtensionTag.class.st delete mode 100644 src/GToolkit-Coder/GtCoderPackageExtentionTag.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st index 439fc97ae..6b391ea52 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st @@ -16,6 +16,11 @@ GtCoderNavigationElement >> assertNavigationModel: aGtCoderNavigationPackagesTag description: [ 'Navigation model must be non-nil' ]. ] +{ #category : #'private-accessing' } +GtCoderNavigationElement >> classesList [ + ^classesList +] + { #category : #'api - class selections' } GtCoderNavigationElement >> deselectClasses [ classesList deselectAll diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 4116d9a06..a5b9bcebe 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -375,9 +375,9 @@ GtCoderNavigationPackagesTagsClassesElement >> methodListContextMenuItemsFor: it -> [ :elem | self removeMethod: item selector inElement: elem ]} ] -{ #category : #acccessing } +{ #category : #'private-accessing' } GtCoderNavigationPackagesTagsClassesElement >> methodProtocolsList [ - ^methodProtocolsList + ^ methodProtocolsList ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st index b5fa2e890..0bdc09d49 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st @@ -45,7 +45,7 @@ GtCoderNavigationPackagesTreeElement >> childrenForPackageOrTag: aPackageOrTag [ theTags at: eachIndex put: (GtCoderPackageUncategorizedTag forPackageTag: eachTag) ] ]. theTags sort: [ :tagA :tagB | self isTag: tagA lessThan: tagB ]. - anExtension := GtCoderPackageExtentionTag forPackage: aPackageOrTag. + anExtension := GtCoderPackageExtensionTag forPackage: aPackageOrTag. anExtension hasExtendedClasses ifTrue: [ theTags addLast: anExtension ]. "Do not return an only tag of the same name as the package" diff --git a/src/GToolkit-Coder/GtCoderPackageExtensionTag.class.st b/src/GToolkit-Coder/GtCoderPackageExtensionTag.class.st new file mode 100644 index 000000000..fe6ff04c2 --- /dev/null +++ b/src/GToolkit-Coder/GtCoderPackageExtensionTag.class.st @@ -0,0 +1,79 @@ +Class { + #name : #GtCoderPackageExtensionTag, + #superclass : #Object, + #instVars : [ + 'package', + 'classes' + ], + #category : #'GToolkit-Coder-Navigation - Model' +} + +{ #category : #'instance creation' } +GtCoderPackageExtensionTag class >> forPackage: aRPackage [ + ^ self new package: aRPackage. +] + +{ #category : #testing } +GtCoderPackageExtensionTag >> = anObject [ + ^ self class == anObject class + and: [ package = anObject package and: [ classes = anObject classes ] ] +] + +{ #category : #accessing } +GtCoderPackageExtensionTag >> classes [ + + ^ classes +] + +{ #category : #accessing } +GtCoderPackageExtensionTag >> classes: anObject [ + classes := anObject +] + +{ #category : #accessing } +GtCoderPackageExtensionTag >> gtTagName [ + ^ self name +] + +{ #category : #testing } +GtCoderPackageExtensionTag >> hasExtendedClasses [ + + ^ self classes isNotEmpty +] + +{ #category : #testing } +GtCoderPackageExtensionTag >> hash [ + ^ package hash bitXor: classes hash +] + +{ #category : #testing } +GtCoderPackageExtensionTag >> isRoot [ + ^true +] + +{ #category : #accessing } +GtCoderPackageExtensionTag >> name [ + ^ 'Extensions' +] + +{ #category : #hooks } +GtCoderPackageExtensionTag >> onPackageChange [ + self classes: self package extendedClasses asArray +] + +{ #category : #accessing } +GtCoderPackageExtensionTag >> package [ + + ^ package +] + +{ #category : #accessing } +GtCoderPackageExtensionTag >> package: aRPackage [ + package := aRPackage. + self onPackageChange. +] + +{ #category : #accessing } +GtCoderPackageExtensionTag >> packageName [ + ^ self package name. +] diff --git a/src/GToolkit-Coder/GtCoderPackageExtentionTag.class.st b/src/GToolkit-Coder/GtCoderPackageExtentionTag.class.st deleted file mode 100644 index e3821243c..000000000 --- a/src/GToolkit-Coder/GtCoderPackageExtentionTag.class.st +++ /dev/null @@ -1,68 +0,0 @@ -Class { - #name : #GtCoderPackageExtentionTag, - #superclass : #Object, - #instVars : [ - 'package', - 'classes' - ], - #category : #'GToolkit-Coder-Navigation - Model' -} - -{ #category : #'instance creation' } -GtCoderPackageExtentionTag class >> forPackage: aRPackage [ - ^ self new package: aRPackage. -] - -{ #category : #accessing } -GtCoderPackageExtentionTag >> classes [ - - ^ classes -] - -{ #category : #accessing } -GtCoderPackageExtentionTag >> classes: anObject [ - classes := anObject -] - -{ #category : #accessing } -GtCoderPackageExtentionTag >> gtTagName [ - ^ self name -] - -{ #category : #testing } -GtCoderPackageExtentionTag >> hasExtendedClasses [ - - ^ self classes isNotEmpty -] - -{ #category : #testing } -GtCoderPackageExtentionTag >> isRoot [ - ^true -] - -{ #category : #accessing } -GtCoderPackageExtentionTag >> name [ - ^ 'Extensions' -] - -{ #category : #hooks } -GtCoderPackageExtentionTag >> onPackageChange [ - self classes: self package extendedClasses asArray -] - -{ #category : #accessing } -GtCoderPackageExtentionTag >> package [ - - ^ package -] - -{ #category : #accessing } -GtCoderPackageExtentionTag >> package: aRPackage [ - package := aRPackage. - self onPackageChange. -] - -{ #category : #accessing } -GtCoderPackageExtentionTag >> packageName [ - ^ self package name. -] From 25e96148c22c16f023f40666454eb3cb72581058 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Mon, 6 Mar 2023 10:51:54 -0600 Subject: [PATCH 0442/1268] Complete merge [feenkcom/gtoolkit#2998] --- src/GToolkit-Coder/GtCoderPackageExtensionTag.class.st | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/GToolkit-Coder/GtCoderPackageExtensionTag.class.st b/src/GToolkit-Coder/GtCoderPackageExtensionTag.class.st index fe6ff04c2..8556341bf 100644 --- a/src/GToolkit-Coder/GtCoderPackageExtensionTag.class.st +++ b/src/GToolkit-Coder/GtCoderPackageExtensionTag.class.st @@ -51,6 +51,11 @@ GtCoderPackageExtensionTag >> isRoot [ ^true ] +{ #category : #testing } +GtCoderPackageExtensionTag >> isUncategorized [ + ^false +] + { #category : #accessing } GtCoderPackageExtensionTag >> name [ ^ 'Extensions' From dc5b022258e6060dfb1d27bb4a79984c782b42d2 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Tue, 7 Mar 2023 12:31:53 +0100 Subject: [PATCH 0443/1268] Make `GtMagritteMemento>>#write:using:` return a future [feenkcom/gtoolkit#3118] --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index 22bae3099..b4d450b08 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -214,19 +214,23 @@ GtCreationForm >> taggerStencilWithCompletion: aCompletionStrategy andContextMen aTagger when: BrTaggerAddTagRequest do: [ :aRequest | - aMemento - write: ((aTagger tags collect: #name) - add: aRequest tag name; - yourself) - using: aDescription ]. + aTagger + enqueueTask: (BlPromiseTask new + promise: (aMemento + write: ((aTagger tags collect: #name) + add: aRequest tag name; + yourself) + using: aDescription) asAsyncPromise) ]. aTagger when: BrTaggerRemoveTagRequest do: [ :aRequest | - aMemento - write: ((aTagger tags collect: #name) - remove: aRequest tag name; - yourself) - using: aDescription. + aTagger + enqueueTask: (BlPromiseTask new + promise: (aMemento + write: ((aTagger tags collect: #name) + remove: aRequest tag name; + yourself) + using: aDescription) asAsyncPromise). aTaggerAptitude addTagCreatorElement ]. aTagger withAsyncSinkDo: [ :anElementSink | From db71eff1f49098ccbc274393817f9343ca029123 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Tue, 7 Mar 2023 12:35:04 +0100 Subject: [PATCH 0444/1268] Ensure we handle selected package tag in creation interface --- src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index c999258f5..5d207c484 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -147,7 +147,9 @@ GtCoderNavigationTabsStencil >> gtCreationInterface: look [ ifTrue: [ navigationModel selectedPackageDo: [ :aPackage | form packageAndTagName packageName: aPackage name ]. navigationModel - selectedTagDo: [ :aTag | aTag isUncategorized ifFalse: [ form packageAndTagName tagName: aTag name ] ] ]. + selectedTagDo: [ :aTag | + ((aTag isKindOf: RPackageTag) or: [ aTag isUncategorized ]) + ifFalse: [ form packageAndTagName tagName: aTag name ] ] ]. ((GtCreationFormWidget forForm: form) onAccept: [ :anInstance | look From 7469adf885bf5bd794f350e7350a117ff08e0d5c Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 7 Mar 2023 08:38:15 -0600 Subject: [PATCH 0445/1268] Select protocol on extensions [feenkcom/gtoolkit#2998] --- ...igationPackagesTagsClassesElement.class.st | 66 ++++++++++++------- 1 file changed, 43 insertions(+), 23 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index a5b9bcebe..0c7cb1011 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -506,14 +506,10 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackagesSelected: anAnnouncer [ { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onProtocolListSelectionChanged [ - | anIndex aSelectedItem theIndices instMeths classMeths | - supressListChanges ifTrue: [ ^ self ]. + | aSelectedItem instMeths classMeths | slotsGroupList deselectAll. - theIndices := methodProtocolsList selectedIndices ifEmpty: [ ^ self ]. - anIndex := theIndices first. - (anIndex between: 1 and: methodProtocolsList viewModel entityCount) - ifFalse: [ ^ self ]. - aSelectedItem := (methodProtocolsList viewModel entityAt: anIndex) value object. + aSelectedItem := self selectedProtocol. + aSelectedItem ifNil: [^self]. self navigationModel selectMethodProtocol: aSelectedItem source: self. instMeths := self instanceMethodsForAProtocol: aSelectedItem. classMeths := self classMethodsForAProtocol: aSelectedItem. @@ -803,6 +799,16 @@ GtCoderNavigationPackagesTagsClassesElement >> selectedPackageTagNodeDo: aBlock ^ packagesList selectedPackageTagNodeDo: aBlock ] +{ #category : #'event handling' } +GtCoderNavigationPackagesTagsClassesElement >> selectedProtocol [ + | theIndices anIndex | + theIndices := methodProtocolsList selectedIndices ifEmpty: [ ^nil]. + anIndex := theIndices first. + (anIndex between: 1 and: methodProtocolsList viewModel entityCount) + ifFalse: [ ^nil ]. + ^ (methodProtocolsList viewModel entityAt: anIndex) value object +] + { #category : #'showing / hiding' } GtCoderNavigationPackagesTagsClassesElement >> showClassList [ classesList visibility: BlVisibility visible. @@ -974,26 +980,40 @@ GtCoderNavigationPackagesTagsClassesElement >> updatePackageLists [ { #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updateProtocolList [ - | methodProtocols | + | methodProtocols classProtocols extension | navigationModel hasSelectedClass - ifTrue: [ | classProtocols | - classProtocols := navigationModel selectedClass class organization protocols - reject: [ :prot | - (navigationModel selectedClass class methods - select: [ :meth | (prot includesSelector: meth selector) and: [ meth isFromTrait not ] ]) - isEmpty ]. - methodProtocols := navigationModel selectedClass organization protocols. - self updateProtocolListWith: methodProtocols and: classProtocols. - methodProtocolsList visibility: BlVisibility visible. - self - updateMethodListWith: navigationModel selectedClass methods - and: (navigationModel selectedClass class methods - reject: [ :meth | meth isFromTrait ]). - methodsLabel visibility: BlVisibility visible ] ifFalse: [ self updateProtocolListWith: #() and: #(). self updateMethodListWith: #() and: #(). methodProtocolsList visibility: BlVisibility hidden. - methodsLabel visibility: BlVisibility hidden ] + methodsLabel visibility: BlVisibility hidden. + ^ self ]. + classProtocols := navigationModel selectedClass class organization protocols + reject: [ :prot | + (navigationModel selectedClass class methods + select: [ :meth | (prot includesSelector: meth selector) and: [ meth isFromTrait not ] ]) + isEmpty ]. + methodProtocols := navigationModel selectedClass organization protocols. + extension := false. + navigationModel + selectedPackageDo: [ :pkg | + pkg ~= navigationModel selectedClass package + ifTrue: [ | protocolName | + extension := true. + protocolName := '*' , pkg name. + methodProtocols := methodProtocols + select: [ :each | each name beginsWith: protocolName ]. + classProtocols := classProtocols + select: [ :each | each name beginsWith: protocolName ] ] ]. + self updateProtocolListWith: methodProtocols and: classProtocols. + extension + ifTrue: [ methodProtocolsList selectOne: 2. + self onProtocolListSelectionChanged ] + ifFalse: [ self + updateMethodListWith: navigationModel selectedClass methods + and: (navigationModel selectedClass class methods + reject: [ :meth | meth isFromTrait ]) ]. + methodProtocolsList visibility: BlVisibility visible. + methodsLabel visibility: BlVisibility visible ] { #category : #'updating lists' } From 88dff5b4d6876dcb1a1fc029e8aa01508661a094 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 7 Mar 2023 10:39:56 -0600 Subject: [PATCH 0446/1268] Don't change focus on class selection of hierarchy and correct misspelled class name. --- ...rNavigationClassHierarchyElement.class.st} | 31 +++++++++---------- .../GtCoderNavigationTabsStencil.class.st | 2 +- 2 files changed, 16 insertions(+), 17 deletions(-) rename src/GToolkit-Coder-UI/{GtCoderNavigationClassHierachyElement.class.st => GtCoderNavigationClassHierarchyElement.class.st} (67%) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassHierachyElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st similarity index 67% rename from src/GToolkit-Coder-UI/GtCoderNavigationClassHierachyElement.class.st rename to src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st index fe26d4796..4cf9d304c 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassHierachyElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st @@ -1,17 +1,17 @@ Class { - #name : #GtCoderNavigationClassHierachyElement, + #name : #GtCoderNavigationClassHierarchyElement, #superclass : #GtCoderNavigationElement, #category : #'GToolkit-Coder-UI-Navigation' } { #category : #initialization } -GtCoderNavigationClassHierachyElement >> initializeElement [ +GtCoderNavigationClassHierarchyElement >> initializeElement [ super initializeElement. self addChild: classesList ] { #category : #initialization } -GtCoderNavigationClassHierachyElement >> initializeLayout [ +GtCoderNavigationClassHierarchyElement >> initializeLayout [ super initializeLayout. self layout: BlLinearLayout vertical. self constraintsDo: [ :c | @@ -20,7 +20,7 @@ GtCoderNavigationClassHierachyElement >> initializeLayout [ ] { #category : #subscriptions } -GtCoderNavigationClassHierachyElement >> onClassModified: anAnnouncement [ +GtCoderNavigationClassHierarchyElement >> onClassModified: anAnnouncement [ self suppressListChangeEventsDuring: [ self updateClass: anAnnouncement theClass @@ -29,7 +29,7 @@ GtCoderNavigationClassHierachyElement >> onClassModified: anAnnouncement [ ] { #category : #subscriptions } -GtCoderNavigationClassHierachyElement >> onClassRenamed: anAnnouncement [ +GtCoderNavigationClassHierarchyElement >> onClassRenamed: anAnnouncement [ self suppressListChangeEventsDuring: [ self renameClass: anAnnouncement theClass @@ -40,41 +40,40 @@ GtCoderNavigationClassHierachyElement >> onClassRenamed: anAnnouncement [ ] { #category : #'event handling' } -GtCoderNavigationClassHierachyElement >> onClassSelected: anAnnouncement [ +GtCoderNavigationClassHierarchyElement >> onClassSelected: anAnnouncement [ self - suppressListChangeEventsDuring: [ self updateClassListsWith: anAnnouncement theClass. - self selectClass: anAnnouncement theClass ] + suppressListChangeEventsDuring: [ self selectClass: anAnnouncement theClass ] ] { #category : #'event handling' } -GtCoderNavigationClassHierachyElement >> onPackageSelected: anAnnouncer [ +GtCoderNavigationClassHierarchyElement >> onPackageSelected: anAnnouncer [ self suppressListChangeEventsDuring: [ self emptyClassList. self deselectClasses ] ] { #category : #'event handling' } -GtCoderNavigationClassHierachyElement >> onPackageTagSelected: anAnnouncer [ +GtCoderNavigationClassHierarchyElement >> onPackageTagSelected: anAnnouncer [ self suppressListChangeEventsDuring: [ self emptyClassList. self deselectClasses ] ] { #category : #'event handling' } -GtCoderNavigationClassHierachyElement >> onPackagesSelected: anAnnouncer [ +GtCoderNavigationClassHierarchyElement >> onPackagesSelected: anAnnouncer [ self suppressListChangeEventsDuring: [ self emptyClassList. self deselectClasses ] ] { #category : #subscriptions } -GtCoderNavigationClassHierachyElement >> subscribeToContent [ +GtCoderNavigationClassHierarchyElement >> subscribeToContent [ super subscribeToContent. self subscribeToClassList. ] { #category : #subscriptions } -GtCoderNavigationClassHierachyElement >> subscribeToNavigationModel [ +GtCoderNavigationClassHierarchyElement >> subscribeToNavigationModel [ self hasNavigationModel ifFalse: [ ^ self ]. super subscribeToNavigationModel. navigationModel weak when: GtCoderNavigationPackagesSelected send: #onPackagesSelected: to: self. @@ -83,7 +82,7 @@ GtCoderNavigationClassHierachyElement >> subscribeToNavigationModel [ ] { #category : #'updating lists' } -GtCoderNavigationClassHierachyElement >> updateClassLists [ +GtCoderNavigationClassHierarchyElement >> updateClassLists [ self hasNavigationModel ifFalse: [ ^ self ]. navigationModel hasSelectedClass ifTrue: [ self updateClassListsWith: navigationModel selectedClass ] @@ -91,12 +90,12 @@ GtCoderNavigationClassHierachyElement >> updateClassLists [ ] { #category : #'updating lists' } -GtCoderNavigationClassHierachyElement >> updateClassListsWith: aClass [ +GtCoderNavigationClassHierarchyElement >> updateClassListsWith: aClass [ classesList initializeWithHierachyForClass: aClass. ] { #category : #'updating lists' } -GtCoderNavigationClassHierachyElement >> updateContent [ +GtCoderNavigationClassHierarchyElement >> updateContent [ self updateClassLists. self updateSelectedClass ] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index 5d207c484..e5c035d0e 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -107,7 +107,7 @@ GtCoderNavigationTabsStencil >> gtClassHierarchyFor: aView [ explicitView := aView explicit title: 'Class Hierarchy'; priority: 2; - stencil: [ GtCoderNavigationClassHierachyElement new + stencil: [ GtCoderNavigationClassHierarchyElement new navigationModel: self navigationModel ]. self addButtonsTo: explicitView. ^ explicitView From 6810fcd17b4b37aff64c1a0fd119df8922285354 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 7 Mar 2023 10:59:57 -0600 Subject: [PATCH 0447/1268] Fix failing example. --- .../GtCoderNavigationPackagesTagsClassesElement.class.st | 1 + 1 file changed, 1 insertion(+) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 0c7cb1011..2c46d6a26 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -345,6 +345,7 @@ GtCoderNavigationPackagesTagsClassesElement >> initializeLayout [ { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> instanceMethodsForAProtocol: aSelectedItem [ + self selectedClass ifNil: [ ^ #() ]. ^ (self selectedClass organization protocolNamed: aSelectedItem name) ifNotNil: [ :s | s methodSelectors collect: [ :sel | self selectedClass >> sel ] as: Array ] ifNil: [ #() ] From 4a90607a84cefa0671d4e57c9a627be00e58e19e Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Tue, 7 Mar 2023 18:33:20 +0100 Subject: [PATCH 0448/1268] Make package tag autofill in creation interface again --- src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index 5d207c484..14de942c3 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -148,8 +148,8 @@ GtCoderNavigationTabsStencil >> gtCreationInterface: look [ selectedPackageDo: [ :aPackage | form packageAndTagName packageName: aPackage name ]. navigationModel selectedTagDo: [ :aTag | - ((aTag isKindOf: RPackageTag) or: [ aTag isUncategorized ]) - ifFalse: [ form packageAndTagName tagName: aTag name ] ] ]. + ((aTag isKindOf: RPackageTag) or: [ aTag isUncategorized not ]) + ifTrue: [ form packageAndTagName tagName: aTag name ] ] ]. ((GtCreationFormWidget forForm: form) onAccept: [ :anInstance | look From 5852722f2efd12461672303c0a9c0f793a115954 Mon Sep 17 00:00:00 2001 From: John Brant Date: Wed, 8 Mar 2023 11:24:56 -0600 Subject: [PATCH 0449/1268] [feenkcom/gtoolkit#3100] next/previous diff --- .../GtDiffElementExamples.class.st | 7 +- .../GtSyncScrollRangesExamples.class.st | 97 +++++++ .../GtDiffButtonsId.class.st | 10 + src/GToolkit-Coder-UI/GtDiffElement.class.st | 241 +++++++++++++----- .../GtSyncScrollRange.class.st | 39 ++- .../GtSyncScrollRanges.class.st | 93 ++++++- .../GtCompositeDiffChange.class.st | 4 +- 7 files changed, 418 insertions(+), 73 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtDiffButtonsId.class.st diff --git a/src/GToolkit-Coder-Examples/GtDiffElementExamples.class.st b/src/GToolkit-Coder-Examples/GtDiffElementExamples.class.st index 42107d714..4a2886343 100644 --- a/src/GToolkit-Coder-Examples/GtDiffElementExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtDiffElementExamples.class.st @@ -7,8 +7,7 @@ Class { { #category : #examples } GtDiffElementExamples >> changeElementExample [ - - ^ GtDiffElement onChange: self exampleChange + ^ (GtDiffElement onChange: self exampleChange) showButtons ] { #category : #examples } @@ -78,7 +77,9 @@ GtDiffElementExamples >> textDiffElementExample [ { #category : #examples } GtDiffElementExamples >> textDiffExampleFlat [ - ^ self textDiffElementExample aptitude: GtDiffFlatAptitude + ^ self textDiffElementExample + aptitude: GtDiffFlatAptitude; + showButtons ] { #category : #examples } diff --git a/src/GToolkit-Coder-Examples/GtSyncScrollRangesExamples.class.st b/src/GToolkit-Coder-Examples/GtSyncScrollRangesExamples.class.st index 54e5b309a..fe217a566 100644 --- a/src/GToolkit-Coder-Examples/GtSyncScrollRangesExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtSyncScrollRangesExamples.class.st @@ -29,6 +29,23 @@ GtSyncScrollRangesExamples >> multilineCode [ ^ ranges ] +{ #category : #accessing } +GtSyncScrollRangesExamples >> multipleChanges [ + + | diff ranges | + diff := GtDiffBuilderExamples new multipleChanges. + ranges := GtSyncScrollRanges createFromChange: diff. + ranges ranges + inject: {0. + 0} + into: [ :last :each | + self assert: last first equals: each leftFirst. + self assert: last last equals: each rightFirst. + {each leftLast. + each rightLast} ]. + ^ ranges +] + { #category : #private } GtSyncScrollRangesExamples >> newString [ @@ -41,6 +58,38 @@ GtSyncScrollRangesExamples >> newString [ 9' ] +{ #category : #accessing } +GtSyncScrollRangesExamples >> nextPreviousLeftChange [ + + | diff ranges | + diff := GtDiffBuilderExamples new deletionsInMiddle. + ranges := GtSyncScrollRanges createFromChange: diff. + self validateNextLeftChangeIn: ranges equals: #(1 5 5). + self validatePreviousLeftChangeIn: ranges equals: #(6 5 5). + ^ ranges +] + +{ #category : #accessing } +GtSyncScrollRangesExamples >> nextPreviousMultipleChanges [ + + | ranges | + ranges := self multipleChanges. + self validateNextLeftChangeIn: ranges equals: #(1 2 4). + self validateNextRightChangeIn: ranges equals: #(1 2 5). + ^ ranges +] + +{ #category : #accessing } +GtSyncScrollRangesExamples >> nextPreviousRightChange [ + + | diff ranges | + diff := GtDiffBuilderExamples new insertionsInMiddle. + ranges := GtSyncScrollRanges createFromChange: diff. + self validateNextRightChangeIn: ranges equals: #(1 5 5). + self validatePreviousRightChangeIn: ranges equals: #(6 5 5). + ^ ranges +] + { #category : #private } GtSyncScrollRangesExamples >> originalString [ @@ -70,3 +119,51 @@ GtSyncScrollRangesExamples >> textDiffExample [ ^ GtSyncScrollRanges createFromDiff: (TextDiffBuilder from: self originalString to: self newString) ] + +{ #category : #examples } +GtSyncScrollRangesExamples >> textDiffNextChange [ + + | ranges | + ranges := self textDiffExample. + self validateNextLeftChangeIn: ranges equals: #(1 2 7 8 2). + self validatePreviousLeftChangeIn: ranges equals: #(8 7 2 8). + self validateNextRightChangeIn: ranges equals: #(1 2 6 8 2). + self validatePreviousRightChangeIn: ranges equals: #(8 8 6 2 8). + ^ ranges +] + +{ #category : #accessing } +GtSyncScrollRangesExamples >> validateNextLeftChangeIn: ranges equals: stops [ + | stream | + stream := ReadStream on: stops. + ranges selectRange: (ranges rangeForLeft: stream next). + [ stream atEnd ] + whileFalse: [ self assert: ranges selectNext leftFirst + 1 equals: stream next ] +] + +{ #category : #accessing } +GtSyncScrollRangesExamples >> validateNextRightChangeIn: ranges equals: stops [ + | stream | + stream := ReadStream on: stops. + ranges selectRange: (ranges rangeForRight: stream next). + [ stream atEnd ] + whileFalse: [ self assert: ranges selectNext rightFirst + 1 equals: stream next ] +] + +{ #category : #accessing } +GtSyncScrollRangesExamples >> validatePreviousLeftChangeIn: ranges equals: stops [ + | stream | + stream := ReadStream on: stops. + ranges selectRange: (ranges rangeForLeft: stream next). + [ stream atEnd ] + whileFalse: [ self assert: ranges selectPrevious leftFirst + 1 equals: stream next ] +] + +{ #category : #accessing } +GtSyncScrollRangesExamples >> validatePreviousRightChangeIn: ranges equals: stops [ + | stream | + stream := ReadStream on: stops. + ranges selectRange: (ranges rangeForRight: stream next). + [ stream atEnd ] + whileFalse: [ self assert: ranges selectPrevious rightFirst + 1 equals: stream next ] +] diff --git a/src/GToolkit-Coder-UI/GtDiffButtonsId.class.st b/src/GToolkit-Coder-UI/GtDiffButtonsId.class.st new file mode 100644 index 000000000..e26475a93 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtDiffButtonsId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtDiffButtonsId, + #superclass : #GtDiffElementId, + #category : #'GToolkit-Coder-UI-Diff' +} + +{ #category : #converting } +GtDiffButtonsId >> asSymbol [ + ^ #'diff--button-bar' +] diff --git a/src/GToolkit-Coder-UI/GtDiffElement.class.st b/src/GToolkit-Coder-UI/GtDiffElement.class.st index b29af5894..8b57d1343 100644 --- a/src/GToolkit-Coder-UI/GtDiffElement.class.st +++ b/src/GToolkit-Coder-UI/GtDiffElement.class.st @@ -9,7 +9,9 @@ Class { 'syncScrollRanges', 'outlines', 'separatorElement', - 'styler' + 'styler', + 'buttonsElement', + 'progressLabel' ], #category : #'GToolkit-Coder-UI-Diff' } @@ -46,7 +48,8 @@ GtDiffElement >> change: aCompositeDiffChange [ aCompositeDiffChange applyAttributesToOutput: text. rightElement text: text. syncScrollRanges := GtSyncScrollRanges createFromChange: aCompositeDiffChange. - self updateOutlines + self updateOutlines. + self updateProgressLabel ] { #category : #initialize } @@ -55,28 +58,14 @@ GtDiffElement >> diff: aDiffBuilder [ leftElement text: aDiffBuilder previousRopedText. rightElement text: aDiffBuilder newRopedText. aDiffBuilder newStyler ifNotNil: [ :aStyler | self styler: aStyler ]. - self updateOutlines + self updateOutlines. + self updateProgressLabel ] { #category : #'event handling' } GtDiffElement >> drawMeAndChildrenOnSpartaCanvas: aCanvas [ - | stroke fill | super drawMeAndChildrenOnSpartaCanvas: aCanvas. - stroke := aCanvas stroke - alpha: 0.2; - paint: Color black; - width: 1. - fill := aCanvas fill - alpha: 0.2; - paint: Color yellow. - outlines - do: [ :each | - fill - path: (each pathOnSpartaCanvas: aCanvas of: self); - draw. - stroke - path: (each pathOnSpartaCanvas: aCanvas of: self); - draw ] + self paintOnCanvas: aCanvas ] { #category : #initialize } @@ -84,16 +73,40 @@ GtDiffElement >> editorLook [ ^ BrGlamorousCodeEditorAptitude ] +{ #category : #accessing } +GtDiffElement >> hideButtons [ + buttonsElement visibility: BlVisibility visible +] + { #category : #initialize } GtDiffElement >> initialize [ + | gridLayout | super initialize. - self layout: BlLinearLayout horizontal. + gridLayout := BlGridLayout new columnCount: 3. + self layout: gridLayout. self matchParent. self beNormalSize. - outlines := #(). + self + addShortcut: (BlShortcutWithAction new + combination: BlKeyCombination builder primary arrowDown build; + action: [ self scrollNext ]). + self + addShortcut: (BlShortcutWithAction new + combination: BlKeyCombination builder primary arrowUp build; + action: [ self scrollPrevious ]). + + outlines := Dictionary new. + + buttonsElement := self newButtonsElement. + buttonsElement id: GtDiffButtonsId. + buttonsElement visibility: BlVisibility gone. + buttonsElement + addChildren: {self newPreviousChangeButton. + self newProgressLabel. + self newNextChangeButton}. leftElement := self newTextElement id: GtDiffOldTextId; @@ -120,7 +133,8 @@ GtDiffElement >> initialize [ separatorElement := self newSeparatorElement id: GtDiffSeparatorId. self - addChildren: {leftElement. + addChildren: {buttonsElement. + leftElement. separatorElement. rightElement} ] @@ -134,16 +148,20 @@ GtDiffElement >> leftBottomFor: anInteger [ element := leftElement children at: index - range first + 1. ^ (anInteger < range first ifTrue: [ element bounds top ] - ifFalse: [ element bounds bottom ]) + leftElement bounds top max: 0 + ifFalse: [ element bounds bottom ]) + leftElement bounds top max: leftElement bounds top ] { #category : #'event handling' } GtDiffElement >> leftCursorChanged [ - | newPosition | - newPosition := syncScrollRanges - rightLineFor: (self leftLineForCursor ifNil: [ self leftRange first ]). + | newPosition leftLine range | + leftLine := self leftLineForCursor ifNil: [ self leftRange first ]. + range := syncScrollRanges rangeForLeft: leftLine. + syncScrollRanges selectRange: range. + newPosition := syncScrollRanges rightLineFor: leftLine. (self rightRange includes: newPosition) - ifFalse: [ rightElement scrollToPosition: newPosition ] + ifFalse: [ rightElement scrollToPosition: newPosition ]. + self updateProgressLabel. + self invalidate ] { #category : #accessing } @@ -154,7 +172,7 @@ GtDiffElement >> leftEditorLook: aLook [ { #category : #'event handling' } GtDiffElement >> leftLineForCursor [ leftElement editor cursors - do: [ :each | ^ leftElement text asString lineNumberCorrespondingToIndex: each position ]. + do: [ :each | ^ leftElement text asString lineNumberCorrespondingToIndex: each position + 1 ]. ^ nil ] @@ -186,7 +204,63 @@ GtDiffElement >> leftTopFor: anInteger [ element := leftElement children at: index - range first + 1. ^ (anInteger > range last ifTrue: [ element bounds bottom ] - ifFalse: [ element bounds top ]) + leftElement bounds top max: 0 + ifFalse: [ element bounds top ]) + leftElement bounds top max: leftElement bounds top +] + +{ #category : #'event handling' } +GtDiffElement >> moveCursorIn: textEditor toLine: anInteger [ + | string index | + string := textEditor text asString. + index := (string intervalOfLine: anInteger) first - 1. + index < 0 + ifTrue: [ index := anInteger <= 0 ifTrue: [ 0 ] ifFalse: [ string size ] ]. + textEditor editor moveCursorTo: index +] + +{ #category : #initialize } +GtDiffElement >> newButtonsElement [ + ^ BrHorizontalPane new + vFitContent; + hMatchParent; + alignCenter; + constraintsDo: [ :c | c grid horizontal span: 3 ] +] + +{ #category : #initialize } +GtDiffElement >> newNextChangeButton [ + ^ BrButton new + aptitude: BrGlamorousButtonWithIconAptitude; + fitContent; + beTinySize; + margin: (BlInsets top: 0 bottom: 5 left: 5 right: 0); + icon: BrGlamorousVectorIcons down; + label: 'Next change'; + action: [ :aButton | self scrollNext ] +] + +{ #category : #initialize } +GtDiffElement >> newPreviousChangeButton [ + ^ BrButton new + aptitude: BrGlamorousButtonWithIconAptitude; + fitContent; + beTinySize; + margin: (BlInsets bottom: 5); + icon: BrGlamorousVectorIcons up; + label: 'Previous change'; + action: [ :aButton | self scrollPrevious ] +] + +{ #category : #initialize } +GtDiffElement >> newProgressLabel [ + ^ progressLabel := BrLabel new + fitContent; + alignCenter; + margin: (BlInsets + top: 0 + bottom: 5 + left: 5 + right: 0); + aptitude: BrGlamorousLabelAptitude ] { #category : #initialize } @@ -210,7 +284,7 @@ GtDiffElement >> newTextElement [ GtDiffElement >> onExtentChanged [ super onExtentChanged. - outlines := #(). + outlines := Dictionary new. self updateOutlines ] @@ -218,7 +292,7 @@ GtDiffElement >> onExtentChanged [ GtDiffElement >> onLayout: aBounds context: aBlElementBoundsUpdateContext [ super onLayout: aBounds context: aBlElementBoundsUpdateContext. - outlines := #(). + outlines := Dictionary new. self updateOutlines ] @@ -247,29 +321,38 @@ GtDiffElement >> outlineFor: aSyncScrollRange [ { #category : #'event handling' } GtDiffElement >> paintMeAndChildrenOn: aCompositorPainter offset: anOffset [ - | aCanvas stroke fill | + | aCanvas | super paintMeAndChildrenOn: aCompositorPainter offset: anOffset. - + aCanvas := aCompositorPainter canvas. - + aCanvas transform by: [ :t | t translateBy: anOffset ] - during: [ - stroke := aCanvas stroke - alpha: 0.2; - paint: Color black; - width: 1. - fill := aCanvas fill - alpha: 0.2; - paint: Color yellow. - outlines - do: [ :each | - fill - path: (each pathOnSpartaCanvas: aCanvas of: self); - draw. - stroke - path: (each pathOnSpartaCanvas: aCanvas of: self); - draw ] ] + during: [ self paintOnCanvas: aCanvas ] +] + +{ #category : #'event handling' } +GtDiffElement >> paintOnCanvas: aCanvas [ + | stroke selectedStroke fill | + stroke := aCanvas stroke + alpha: 0.2; + paint: Color black; + width: 1. + selectedStroke := aCanvas stroke + alpha: 0.6; + paint: BrGlamorousColors primaryBorderColor; + width: 2. + fill := aCanvas fill + alpha: 0.2; + paint: Color yellow. + ^ outlines + keysAndValuesDo: [ :range :each | + fill + path: (each pathOnSpartaCanvas: aCanvas of: self); + draw. + (range isSelected ifTrue: [ selectedStroke ] ifFalse: [ stroke ]) + path: (each pathOnSpartaCanvas: aCanvas of: self); + draw ] ] { #category : #'event handling' } @@ -281,16 +364,21 @@ GtDiffElement >> rightBottomFor: anInteger [ element := rightElement children at: index - range first + 1. ^ (anInteger < range first ifTrue: [ element bounds top ] - ifFalse: [ element bounds bottom ]) + rightElement bounds top max: 0 + ifFalse: [ element bounds bottom ]) + rightElement bounds top + max: rightElement bounds top ] { #category : #'event handling' } GtDiffElement >> rightCursorChanged [ - | newPosition | - newPosition := syncScrollRanges - leftLineFor: (self rightLineForCursor ifNil: [ self rightRange first ]). + | newPosition rightLine range | + rightLine := self rightLineForCursor ifNil: [ self rightRange first ]. + range := syncScrollRanges rangeForRight: rightLine. + syncScrollRanges selectRange: range. + newPosition := syncScrollRanges leftLineFor: rightLine. (self leftRange includes: newPosition) - ifFalse: [ leftElement scrollToPosition: newPosition ] + ifFalse: [ leftElement scrollToPosition: newPosition ]. + self updateProgressLabel. + self invalidate ] { #category : #accessing } @@ -301,7 +389,7 @@ GtDiffElement >> rightEditorLook: aLook [ { #category : #'event handling' } GtDiffElement >> rightLineForCursor [ rightElement editor cursors - do: [ :each | ^ rightElement text asString lineNumberCorrespondingToIndex: each position ]. + do: [ :each | ^ rightElement text asString lineNumberCorrespondingToIndex: each position + 1 ]. ^ nil ] @@ -333,7 +421,33 @@ GtDiffElement >> rightTopFor: anInteger [ element := rightElement children at: index - range first + 1. ^ (anInteger > range last ifTrue: [ element bounds bottom ] - ifFalse: [ element bounds top ]) + rightElement bounds top max: 0 + ifFalse: [ element bounds top ]) + rightElement bounds top + max: rightElement bounds top +] + +{ #category : #'event handling' } +GtDiffElement >> scrollNext [ + | range | + range := syncScrollRanges selectNext. + range ifNil: [ ^ self ]. + leftElement scrollToPosition: range leftFirst + 1. + rightElement scrollToPosition: range rightFirst + 1. + self updateProgressLabel +] + +{ #category : #'event handling' } +GtDiffElement >> scrollPrevious [ + | range | + range := syncScrollRanges selectPrevious. + range ifNil: [ ^ self ]. + leftElement scrollToPosition: range leftFirst + 1. + rightElement scrollToPosition: range rightFirst + 1. + self updateProgressLabel +] + +{ #category : #accessing } +GtDiffElement >> showButtons [ + buttonsElement visibility: BlVisibility visible ] { #category : #accessing } @@ -352,13 +466,22 @@ GtDiffElement >> styler: anObject [ { #category : #'event handling' } GtDiffElement >> updateOutlines [ | ranges | - outlines := OrderedCollection new. + outlines := Dictionary new. ranges := syncScrollRanges rangesForLeft: self leftRange andRight: self rightRange. ranges do: [ :each | each isDifference - ifTrue: [ outlines add: (self outlineFor: each) ] ]. + ifTrue: [ outlines at: each put: (self outlineFor: each) ] ]. self invalidate ] + +{ #category : #initialize } +GtDiffElement >> updateProgressLabel [ + | progress | + progress := syncScrollRanges selectedProgress. + progressLabel + text: (progress first printString , '/' , progress last printString) asRopedText + glamorousRegularFont +] diff --git a/src/GToolkit-Coder-UI/GtSyncScrollRange.class.st b/src/GToolkit-Coder-UI/GtSyncScrollRange.class.st index f82555511..a3e561aec 100644 --- a/src/GToolkit-Coder-UI/GtSyncScrollRange.class.st +++ b/src/GToolkit-Coder-UI/GtSyncScrollRange.class.st @@ -6,7 +6,8 @@ Class { 'leftLast', 'rightFirst', 'rightLast', - 'isDifference' + 'isDifference', + 'isSelected' ], #category : #'GToolkit-Coder-UI-Diff' } @@ -66,10 +67,21 @@ GtSyncScrollRange >> beDifferent [ isDifference := true ] +{ #category : #testing } +GtSyncScrollRange >> includesLeftLine: anInteger [ + ^ self leftFirst < anInteger and: [ anInteger <= self leftLast ] +] + +{ #category : #testing } +GtSyncScrollRange >> includesRightLine: anInteger [ + ^ self rightFirst < anInteger and: [ anInteger <= self rightLast ] +] + { #category : #'initialize-release' } GtSyncScrollRange >> initialize [ super initialize. isDifference := false. + isSelected := false. leftFirst := 0. leftLast := 0. rightFirst := 0. @@ -89,6 +101,21 @@ GtSyncScrollRange >> isDifference [ ^ isDifference ] +{ #category : #testing } +GtSyncScrollRange >> isLeftEmpty [ + ^ self leftSize = 0 +] + +{ #category : #testing } +GtSyncScrollRange >> isRightEmpty [ + ^ self rightSize = 0 +] + +{ #category : #testing } +GtSyncScrollRange >> isSelected [ + ^ isSelected +] + { #category : #accessing } GtSyncScrollRange >> leftFirst [ ^ leftFirst @@ -192,3 +219,13 @@ GtSyncScrollRange >> rightRangeDisplayString [ GtSyncScrollRange >> rightSize [ ^ rightLast - rightFirst ] + +{ #category : #accessing } +GtSyncScrollRange >> select [ + isSelected := true +] + +{ #category : #accessing } +GtSyncScrollRange >> unselect [ + isSelected := false +] diff --git a/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st b/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st index 9e06cc269..6223e48c4 100644 --- a/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st +++ b/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st @@ -101,18 +101,18 @@ GtSyncScrollRanges >> addRanges: changedRanges fromChanges: aCompositeChange [ ifFalse: [ ranges add: (GtSyncScrollRange leftFirst: fromStart - leftLast: each first - 1 + leftLast: each first rightFirst: toStart - rightLast: each third - 1) ]. + rightLast: each third) ]. ranges add: (GtSyncScrollRange leftFirst: each first leftLast: each second rightFirst: each third rightLast: each fourth) beDifferent. - fromStart := each second + 1. - toStart := each fourth + 1 ]. - (fromStart > fromEnd and: [ toStart > toEnd ]) + fromStart := each second. + toStart := each fourth ]. + (fromStart + 1 > fromEnd and: [ toStart + 1 > toEnd ]) ifFalse: [ ranges add: (GtSyncScrollRange leftFirst: fromStart @@ -175,8 +175,11 @@ GtSyncScrollRanges >> gtRangesViewFor: aView [ ] { #category : #accessing } -GtSyncScrollRanges >> leftLineFor: rightIndex [ - | range | +GtSyncScrollRanges >> leftLineFor: anInteger [ + | range rightIndex | + rightIndex := self ranges notEmpty + ifTrue: [ (self ranges last rightLast min: anInteger) max: self ranges first rightFirst ] + ifFalse: [ anInteger ]. range := self ranges detect: [ :each | rightIndex between: each rightFirst and: each rightLast ] ifNone: [ ^ 0 ]. @@ -217,6 +220,20 @@ GtSyncScrollRanges >> mergeRanges: changedRanges [ ^ newRanges ] +{ #category : #accessing } +GtSyncScrollRanges >> rangeForLeft: anInteger [ + ^ self ranges + detect: [ :each | each includesLeftLine: anInteger ] + ifNone: [ ] +] + +{ #category : #accessing } +GtSyncScrollRanges >> rangeForRight: anInteger [ + ^ self ranges + detect: [ :each | each includesRightLine: anInteger ] + ifNone: [ ] +] + { #category : #accessing } GtSyncScrollRanges >> ranges [ ^ ranges ifNil: [ #() ] @@ -229,8 +246,11 @@ GtSyncScrollRanges >> rangesForLeft: leftInterval andRight: rightInterval [ ] { #category : #accessing } -GtSyncScrollRanges >> rightLineFor: leftIndex [ - | range | +GtSyncScrollRanges >> rightLineFor: anInteger [ + | range leftIndex | + leftIndex := self ranges notEmpty + ifTrue: [ (self ranges last leftLast min: anInteger) max: self ranges first leftFirst ] + ifFalse: [ anInteger ]. range := self ranges detect: [ :each | leftIndex between: each leftFirst and: each leftLast ] ifNone: [ ^ 0 ]. @@ -239,3 +259,58 @@ GtSyncScrollRanges >> rightLineFor: leftIndex [ ifFalse: [ (leftIndex asFloat - range leftFirst) / range leftSize ]) * range rightSize + range rightFirst) rounded ] + +{ #category : #accessing } +GtSyncScrollRanges >> selectNext [ + | found | + found := false. + self ranges isEmpty ifTrue: [ ^ self ]. + self ranges + do: [ :each | + found + ifTrue: [ each isDifference ifTrue: [ ^ each select ] ] + ifFalse: [ found := each isSelected ]. + each unselect ]. + ^ (self ranges + detect: [ :each | each isDifference ] + ifNone: [ self ranges first ]) select +] + +{ #category : #accessing } +GtSyncScrollRanges >> selectPrevious [ + | found | + found := false. + self ranges isEmpty ifTrue: [ ^ self ]. + self ranges + reverseDo: [ :each | + found + ifTrue: [ each isDifference ifTrue: [ ^ each select ] ] + ifFalse: [ found := each isSelected ]. + each unselect ]. + self ranges size + to: 1 + by: -1 + do: [ :i | + | range | + range := self ranges at: i. + range isDifference ifTrue: [ ^ range select ] ]. + ^ self ranges last select +] + +{ #category : #accessing } +GtSyncScrollRanges >> selectRange: aRange [ + self ranges do: [ :each | each unselect ]. + aRange ifNotNil: [ aRange select ] +] + +{ #category : #accessing } +GtSyncScrollRanges >> selectedProgress [ + | index | + index := {0. 0}. + self ranges + do: [ :each | + each isDifference + ifTrue: [ index at: 2 put: index last + 1. + each isSelected ifTrue: [ index at: 1 put: index last ] ] ]. + ^ index +] diff --git a/src/GToolkit-Coder/GtCompositeDiffChange.class.st b/src/GToolkit-Coder/GtCompositeDiffChange.class.st index 855ecf406..b83c52f67 100644 --- a/src/GToolkit-Coder/GtCompositeDiffChange.class.st +++ b/src/GToolkit-Coder/GtCompositeDiffChange.class.st @@ -37,7 +37,9 @@ GtCompositeDiffChange >> applyAttributesToOutput: aText [ { #category : #accessing } GtCompositeDiffChange >> asElement [ - ^ (GtDiffElement onChange: self) addAptitude: GtDiffFlatAptitude + ^ (GtDiffElement onChange: self) + addAptitude: GtDiffFlatAptitude; + showButtons ] { #category : #accessing } From 1f21883eb913498b1056f92ddce331dad11beb68 Mon Sep 17 00:00:00 2001 From: John Brant Date: Thu, 9 Mar 2023 06:39:00 -0600 Subject: [PATCH 0450/1268] [feenkcom/gtoolkit#3121] use vFitContentLimited to limit the height of the diff text views --- .../GtDiffElementWithLabelStencil.class.st | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtDiffElementWithLabelStencil.class.st b/src/GToolkit-Coder-UI/GtDiffElementWithLabelStencil.class.st index ad0cfec7a..e1cba4d44 100644 --- a/src/GToolkit-Coder-UI/GtDiffElementWithLabelStencil.class.st +++ b/src/GToolkit-Coder-UI/GtDiffElementWithLabelStencil.class.st @@ -47,7 +47,7 @@ GtDiffElementWithLabelStencil >> createDiffContainer [ | diffContainer | diffContainer := BrVerticalPane new hMatchParent; - vFitContent. + vFitContentLimited. self shouldHideDiff ifFalse: [ diffContainer addChild: self createPanesDiffElement ]. @@ -70,13 +70,13 @@ GtDiffElementWithLabelStencil >> createPanesDiffElement [ diffWrapper := BrVerticalPane new." diffWrapper margin: (BlInsets all: 3)." diffWrapper hMatchParent. - diffWrapper vFitContent. + diffWrapper vFitContentLimited. diffWrapper addChild: ((GtEpiceaDiffElement onChange: self change) aptitude: GtDiffFlatAptitude; styler: styler; - vFitContent; + vFitContentLimited; beSmallSize). ^ diffWrapper From 5b6f00171e46dfd0eb2a8d562ceabdbce4e3830c Mon Sep 17 00:00:00 2001 From: John Brant Date: Thu, 9 Mar 2023 08:43:30 -0600 Subject: [PATCH 0451/1268] [feenkcom/gtoolkit#3100] show next/previous buttons in git diff --- .../GtDiffElementExamples.class.st | 7 ++----- src/GToolkit-Coder-UI/GtDiffElement.class.st | 20 +++++++++++-------- .../GtDiffElementWithLabelStencil.class.st | 5 +++-- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/GToolkit-Coder-Examples/GtDiffElementExamples.class.st b/src/GToolkit-Coder-Examples/GtDiffElementExamples.class.st index 4a2886343..5ff074da7 100644 --- a/src/GToolkit-Coder-Examples/GtDiffElementExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtDiffElementExamples.class.st @@ -70,16 +70,13 @@ GtDiffElementExamples >> originalString [ { #category : #examples } GtDiffElementExamples >> textDiffElementExample [ - - ^ GtDiffElement onDiff: self exampleTextDiff + ^ (GtDiffElement onDiff: self exampleTextDiff) showButtons ] { #category : #examples } GtDiffElementExamples >> textDiffExampleFlat [ - ^ self textDiffElementExample - aptitude: GtDiffFlatAptitude; - showButtons + ^ self textDiffElementExample aptitude: GtDiffFlatAptitude ] { #category : #examples } diff --git a/src/GToolkit-Coder-UI/GtDiffElement.class.st b/src/GToolkit-Coder-UI/GtDiffElement.class.st index 8b57d1343..fe6cf95ee 100644 --- a/src/GToolkit-Coder-UI/GtDiffElement.class.st +++ b/src/GToolkit-Coder-UI/GtDiffElement.class.st @@ -207,6 +207,14 @@ GtDiffElement >> leftTopFor: anInteger [ ifFalse: [ element bounds top ]) + leftElement bounds top max: leftElement bounds top ] +{ #category : #accessing } +GtDiffElement >> moveButtonsToBottom [ + buttonsElement removeFromParent. + buttonsElement margin: (BlInsets top: 5). + self addChild: buttonsElement. + self showButtons +] + { #category : #'event handling' } GtDiffElement >> moveCursorIn: textEditor toLine: anInteger [ | string index | @@ -222,6 +230,7 @@ GtDiffElement >> newButtonsElement [ ^ BrHorizontalPane new vFitContent; hMatchParent; + margin: (BlInsets bottom: 5); alignCenter; constraintsDo: [ :c | c grid horizontal span: 3 ] ] @@ -232,7 +241,7 @@ GtDiffElement >> newNextChangeButton [ aptitude: BrGlamorousButtonWithIconAptitude; fitContent; beTinySize; - margin: (BlInsets top: 0 bottom: 5 left: 5 right: 0); + margin: (BlInsets left: 5); icon: BrGlamorousVectorIcons down; label: 'Next change'; action: [ :aButton | self scrollNext ] @@ -244,7 +253,6 @@ GtDiffElement >> newPreviousChangeButton [ aptitude: BrGlamorousButtonWithIconAptitude; fitContent; beTinySize; - margin: (BlInsets bottom: 5); icon: BrGlamorousVectorIcons up; label: 'Previous change'; action: [ :aButton | self scrollPrevious ] @@ -255,11 +263,7 @@ GtDiffElement >> newProgressLabel [ ^ progressLabel := BrLabel new fitContent; alignCenter; - margin: (BlInsets - top: 0 - bottom: 5 - left: 5 - right: 0); + margin: (BlInsets left: 5); aptitude: BrGlamorousLabelAptitude ] @@ -267,7 +271,7 @@ GtDiffElement >> newProgressLabel [ GtDiffElement >> newSeparatorElement [ ^ BlElement new constraintsDo: [ :c | - c vertical matchParent. + c vertical exact: 1. c horizontal exact: 0 ] yourself ] diff --git a/src/GToolkit-Coder-UI/GtDiffElementWithLabelStencil.class.st b/src/GToolkit-Coder-UI/GtDiffElementWithLabelStencil.class.st index e1cba4d44..d9f47d885 100644 --- a/src/GToolkit-Coder-UI/GtDiffElementWithLabelStencil.class.st +++ b/src/GToolkit-Coder-UI/GtDiffElementWithLabelStencil.class.st @@ -67,7 +67,7 @@ GtDiffElementWithLabelStencil >> createFromLabel [ { #category : #'building - widgets' } GtDiffElementWithLabelStencil >> createPanesDiffElement [ | diffWrapper | - diffWrapper := BrVerticalPane new." + diffWrapper := BrVerticalPane new. " diffWrapper margin: (BlInsets all: 3)." diffWrapper hMatchParent. diffWrapper vFitContentLimited. @@ -77,7 +77,8 @@ GtDiffElementWithLabelStencil >> createPanesDiffElement [ aptitude: GtDiffFlatAptitude; styler: styler; vFitContentLimited; - beSmallSize). + beSmallSize; + moveButtonsToBottom). ^ diffWrapper ] From cc277a39db12706373e356fec97a3a3e1451efea Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Fri, 10 Mar 2023 17:09:48 +0100 Subject: [PATCH 0452/1268] =?UTF-8?q?Ensure=20we=20don=C3=A2=C2=80=C2=99t?= =?UTF-8?q?=20add=20tag=20creators=20for=20no=20reason=20[feenkcom/gtoolki?= =?UTF-8?q?t#3125]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index b4d450b08..564f508db 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -202,7 +202,26 @@ GtCreationForm >> taggerStencilWithCompletion: aCompletionStrategy andContextMen aBlockReturningCollection value do: [ :aShortcut | aLabel addShortcut: aShortcut ] ]. - aLabel when: BlClickEvent do: [ :anEvent | aLabel switchToEditor ]. + aLabel + when: BlClickEvent + do: [ :aClickEvent | + aLabel switchToEditor + addShortcut: (BlShortcutWithAction new + combination: BlKeyCombination shiftTab; + action: [ :anEvent | + BlFocusFinder new + direction: BlFocusSearchDirectionBackward new; + root: aForm; + referenceElement: anEvent currentTarget; + nextFocusDo: #requestFocus ifNone: [ ] ]); + addShortcut: (BlShortcutWithAction new + combination: BlKeyCombination tab; + action: [ :anEvent | + BlFocusFinder new + direction: BlFocusSearchDirectionForward new; + root: aForm; + referenceElement: anEvent currentTarget; + nextFocusDo: #requestFocus ifNone: [ ] ]) ]. aCompletionStrategy ifNotNil: [ (GtCompletionController on: aLabel strategy: aCompletionStrategy) install ]. @@ -230,8 +249,7 @@ GtCreationForm >> taggerStencilWithCompletion: aCompletionStrategy andContextMen write: ((aTagger tags collect: #name) remove: aRequest tag name; yourself) - using: aDescription) asAsyncPromise). - aTaggerAptitude addTagCreatorElement ]. + using: aDescription) asAsyncPromise) ]. aTagger withAsyncSinkDo: [ :anElementSink | anElementSink From e6bbad5be200b7847b8f62fb9854bfc925b9e193 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Mon, 13 Mar 2023 10:27:38 +0100 Subject: [PATCH 0453/1268] Remove outdated UI elements --- ...deDefinitionCompositeEntityViewer.class.st | 5 - .../GtCodeDefinitionPluralEditor.class.st | 191 ------------------ .../GtCreateElement.class.st | 45 ----- 3 files changed, 241 deletions(-) delete mode 100644 src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st delete mode 100644 src/GToolkit-Coder-UI/GtCreateElement.class.st diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionCompositeEntityViewer.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionCompositeEntityViewer.class.st index 02ee7d31b..4536b894b 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionCompositeEntityViewer.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionCompositeEntityViewer.class.st @@ -45,11 +45,6 @@ GtCodeDefinitionCompositeEntityViewer >> create [ aStream nextPut: (self buildSectionLabel: (editors at: aCurrentIndex) title) ] ] ]) ] -{ #category : #accessing } -GtCodeDefinitionCompositeEntityViewer >> definitionsDo: aBlock [ - self editors do: [ :each | each definitionsDo: aBlock ] -] - { #category : #accessing } GtCodeDefinitionCompositeEntityViewer >> editors [ ^ editors diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st deleted file mode 100644 index 765f824e8..000000000 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionPluralEditor.class.st +++ /dev/null @@ -1,191 +0,0 @@ -Class { - #name : #GtCodeDefinitionPluralEditor, - #superclass : #GtCodeDefinitionPluralViewer, - #instVars : [ - 'addSelector', - 'renameSelector', - 'removeSelector', - 'contextMenuBlock', - 'renameRefactoringBlock' - ], - #category : #'GToolkit-Coder-UI-Behaviour - Editor / Reader' -} - -{ #category : #accessing } -GtCodeDefinitionPluralEditor >> addSelector: aSelector [ - addSelector := aSelector -] - -{ #category : #'api - instantiation' } -GtCodeDefinitionPluralEditor >> addTag: aNewTag [ - ^ aNewTag name - ifNotEmpty: [ :name | self definition perform: addSelector withEnoughArguments: {name} ] -] - -{ #category : #'api - instantiation' } -GtCodeDefinitionPluralEditor >> buildRenamePreviewFrom: aTag to: aNewName from: anAptitude [ - | oldName | - oldName := aTag name. - ^ GtRefactoringsPreviewButton new - margin: (BlInsets - top: 5 - left: -3 - bottom: 0 - right: 5); - refactorings: [ {renameRefactoringBlock value: oldName value: aNewName} ]; - cancelBlock: [ anAptitude widget viewModel renameTagNamed: aNewName to: oldName ] -] - -{ #category : #accessing } -GtCodeDefinitionPluralEditor >> contextMenuBlock: aBinaryBlock [ - "Block accepts a label definition and editor and returns a GtCoderContextMenuContent" - - contextMenuBlock := aBinaryBlock -] - -{ #category : #'api - instantiation' } -GtCodeDefinitionPluralEditor >> create [ - - | anOwner theInitialNames aTagger | - anOwner := self owner. - - theInitialNames := self definition - perform: getSelector - withEnoughArguments: {anOwner}. - - aTagger := BrTagger new - aptitude: (BrGlamorousTaggerEditableAptitude new - margin: self margin; - tagLabel: [ :aTaggerTag | self createElementForTag: aTaggerTag ]; - in: [ :aLook | separatorStencil ifNotNil: [ aLook separator: separatorStencil ] ]; - yourself); - namedTags: theInitialNames; - when: BrTaggerAddTagRequest do: [ :aRequest | self addTag: aRequest tag ]; - when: BrTaggerRemoveTagRequest - do: [ :aRequest | self removeTag: aRequest tag ]; - when: BrTaggerRenameTagRequest - do: [ :aRequest | - self - renameTag: aRequest tag - to: aRequest newName - from: aRequest source. - aRequest currentTarget renameTag: aRequest tag to: aRequest newName ]. - - self containerName - ifNotNil: [ :aContainerName | aTagger containerName: aContainerName ]. - - self definition - when: addAnnouncement - do: [ :anEvent | - (anOwner isNil or: [ anEvent owner = anOwner ]) - ifTrue: [ aTagger addTagNamed: anEvent name ] ]. - self definition - when: removeAnnouncement - do: [ :anEvent | - (anOwner isNil or: [ anEvent owner = anOwner ]) - ifTrue: [ aTagger removeTagNamed: anEvent name ] ]. - self definition - when: renameAnnouncement - do: [ :anEvent | - (anOwner isNil or: [ anEvent owner = anOwner ]) - ifTrue: [ aTagger renameTagNamed: anEvent oldName to: anEvent newName ] ]. - - ^ aTagger -] - -{ #category : #'api - instantiation' } -GtCodeDefinitionPluralEditor >> createElementForTag: aTaggerTag [ - | eachLabelDefinition anEditableLabel | - eachLabelDefinition := aTaggerTag - ifNotNil: [ modelSelector - ifNotNil: [ :aSelector | - aTaggerTag name - ifEmpty: [ nil ] - ifNotEmpty: [ :aTagName | self definition perform: aSelector withEnoughArguments: {aTaggerTag name} ] ] ]. - anEditableLabel := BrEditableLabel new - text: aTaggerTag name; - styler: styler; - inputFilter: inputFilter; - aptitude: lookStencil create - + (BrGlamorousWithContextMenuAptitude - content: (contextMenuBlock value: eachLabelDefinition value: self)); - yourself. - - interactions - do: [ :eachAssociation | - anEditableLabel - whenKey: eachAssociation key - labelDo: [ :aShortcutEvent :aShortcut | - aShortcutEvent consumed: true. - eachLabelDefinition - ifNotNil: [ eachAssociation value cull: aShortcutEvent cull: eachLabelDefinition ] ] ]. - eventHandlers - do: [ :eachAssociation | - anEditableLabel - when: eachAssociation key - do: [ :anEvent | - anEvent currentTarget isReadOnly - ifTrue: [ eachLabelDefinition - ifNotNil: [ eachAssociation value cull: anEvent cull: eachLabelDefinition ] ] ] ]. - completionStencil - ifNotNil: [ :aStencil | (GtCompletionController on: anEditableLabel strategy: aStencil create) install ]. - - ^ anEditableLabel -] - -{ #category : #'api - instantiation' } -GtCodeDefinitionPluralEditor >> initialize [ - super initialize. - contextMenuBlock := [ :def :edit | [ GtCoderContextMenuContent new editorElement: edit ] ]. - self - whenKey: BlKeyCombination primaryR - do: [ :anEvent :aDefinition | anEvent target switchToEditor ] -] - -{ #category : #accessing } -GtCodeDefinitionPluralEditor >> removeSelector: aSelector [ - removeSelector := aSelector -] - -{ #category : #'api - instantiation' } -GtCodeDefinitionPluralEditor >> removeTag: aTag [ - ^ self definition perform: removeSelector withEnoughArguments: {aTag name} -] - -{ #category : #accessing } -GtCodeDefinitionPluralEditor >> renameRefactoringBlock: aBlock [ - "This block should return a refactoring that will rename all references from the old name to the old name. - It is evaluated when renaming existing variables in the class" - - renameRefactoringBlock := aBlock -] - -{ #category : #accessing } -GtCodeDefinitionPluralEditor >> renameSelector: aSelector [ - renameSelector := aSelector -] - -{ #category : #'api - instantiation' } -GtCodeDefinitionPluralEditor >> renameTag: aTag to: aNewName from: aTaggerAptitude [ - | newName aPreviewButton | - newName := aNewName trimmed. - newName = aTag name ifTrue: [ ^ self ]. - newName - ifEmpty: [ self removeTag: aTag name. - ^ self ]. - renameRefactoringBlock notNil - ifTrue: [ aPreviewButton := self buildRenamePreviewFrom: aTag to: newName from: aTaggerAptitude. - aTaggerAptitude - tagElementFor: aTag - ifFound: [ :elem | elem parent addChild: aPreviewButton after: elem ] ] - ifFalse: [ self definition - perform: renameSelector - withEnoughArguments: {aTag name. - newName} ] -] - -{ #category : #accessing } -GtCodeDefinitionPluralEditor >> textualCoderViewModel [ - "Hack to use context menus" - ^self -] diff --git a/src/GToolkit-Coder-UI/GtCreateElement.class.st b/src/GToolkit-Coder-UI/GtCreateElement.class.st deleted file mode 100644 index e436f2014..000000000 --- a/src/GToolkit-Coder-UI/GtCreateElement.class.st +++ /dev/null @@ -1,45 +0,0 @@ -Class { - #name : #GtCreateElement, - #superclass : #BlElement, - #traits : 'TBrLayoutResizable', - #classTraits : 'TBrLayoutResizable classTrait', - #instVars : [ - 'definition' - ], - #category : 'GToolkit-Coder-UI-Behaviour' -} - -{ #category : #'private - instance creation' } -GtCreateElement >> buildSectionLabel: aSectionName [ - - ^ BrLabel new - aptitude: (BrGlamorousLabelAptitude new glamorousRegularFontAndSize foreground: Color gray; fontSize: 12); - text: aSectionName, ':'; - focusability: BlFocusability none; - margin: (BlInsets top: 5 right: 2); - constraintsDo: [ :c | c grid horizontal alignLeft ] -] - -{ #category : #'private - ui' } -GtCreateElement >> buttonMargin [ - ^ BlInsets top: 3 left: 0 bottom: 3 right: 5 -] - -{ #category : #'private - ui' } -GtCreateElement >> editableLabelLook [ - ^ BrGlamorousEditableLabelAptitude new - glamorousCodeFont; - defaultForeground: Color black; - fontSize: 10 -] - -{ #category : #initialization } -GtCreateElement >> initialize [ - super initialize. - self layout: BlFlowLayout vertical. - self margin: (BlInsets all: 5). - self - constraintsDo: [ :c | - c horizontal exact: 400. - c vertical fitContent ] -] From 1058123e87c9ae1e7a4eadd4a47728f1067ae916 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Mon, 13 Mar 2023 07:33:31 -0500 Subject: [PATCH 0454/1268] Fix removing a class from the class hierarchy tab --- .../GtCoderNavigationClassHierarchyElement.class.st | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st index 4cf9d304c..13b1b0128 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st @@ -28,6 +28,14 @@ GtCoderNavigationClassHierarchyElement >> onClassModified: anAnnouncement [ tag: anAnnouncement tag ] ] +{ #category : #subscriptions } +GtCoderNavigationClassHierarchyElement >> onClassRemoved: anAnnouncement [ + | newSelection | + newSelection := anAnnouncement theClass superclass. + self updateClassListsWith: newSelection. + self selectClass: newSelection +] + { #category : #subscriptions } GtCoderNavigationClassHierarchyElement >> onClassRenamed: anAnnouncement [ self From 6f96c76fd238bbab3210a23cbef607133468337f Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Mon, 13 Mar 2023 20:27:53 +0100 Subject: [PATCH 0455/1268] Make creation form tagger respond to rename requests --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index 564f508db..36d809a5e 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -240,6 +240,17 @@ GtCreationForm >> taggerStencilWithCompletion: aCompletionStrategy andContextMen add: aRequest tag name; yourself) using: aDescription) asAsyncPromise) ]. + aTagger + when: BrTaggerRenameTagRequest + do: [ :aRequest | + (aRequest tag name = aRequest newName) not + ifTrue: [ aTagger + enqueueTask: (BlPromiseTask new + promise: (aMemento + write: ((aTagger tags collect: #name) + replaceAll: aRequest tag name with: aRequest newName; + yourself) + using: aDescription) asAsyncPromise) ] ]. aTagger when: BrTaggerRemoveTagRequest do: [ :aRequest | From f63be1cc5401a4b01c428fd99c6e8fb575153240 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Mon, 13 Mar 2023 16:11:30 -0500 Subject: [PATCH 0456/1268] Selected created class when created from dropdown form. --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index 564f508db..86e4e35ef 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -172,7 +172,9 @@ GtCreationForm >> packageAndTagName: anObject [ { #category : #accessing } GtCreationForm >> selectInNavigationModel: aNavigationModel anInstance: anInstance [ - ^ aNavigationModel selectClass: anInstance + aNavigationModel selectPackage: anInstance package. + aNavigationModel selectPackageTag: (anInstance package classTagNamed: anInstance tags first). + aNavigationModel selectClass: anInstance ] { #category : #accessing } From b1af0f3851f374ce5ab73bfc0dcae3752fe5e3b6 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 14 Mar 2023 06:56:28 -0500 Subject: [PATCH 0457/1268] Add protocol and inst/class tags to new method dropdown [feenkcom/gtoolkit#3063] --- ...SourceCoderExpandedContentElement.class.st | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st index 9b59d892d..19a9defc2 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st @@ -3,7 +3,8 @@ Class { #superclass : #GtSourceCoderContentElement, #instVars : [ 'editorElement', - 'actions' + 'actions', + 'tags' ], #category : #'GToolkit-Coder-UI-Coder - Source' } @@ -14,9 +15,10 @@ GtSourceCoderExpandedContentElement >> initialize [ editorElement := self newEditorElement. actions := self newActionsElement. - + tags := self newTagsElement. + + "self addChildren: { editorElement . actions . tags }." self addChildren: { editorElement . actions }. - self addAptitude: (BrLayoutResizerAptitude new inherit: editorElement) ] @@ -33,10 +35,27 @@ GtSourceCoderExpandedContentElement >> newEditorElement [ ^ GtSourceCoderEditorElement new ] +{ #category : #initialization } +GtSourceCoderExpandedContentElement >> newTagsElement [ + ^GtPharoMethodCoderTagsElement new + constraintsDo: [ :c | + c ignoreByLayout. + c ignored horizontal alignRight. + c ignored vertical alignBottom. + c + margin: (BlInsets + top: 5 + left: 5 + bottom: 5 + right: 5) ]; + zIndex: 10 +] + { #category : #'api - textual coder view model' } GtSourceCoderExpandedContentElement >> onTextualCoderViewModelChanged [ super onTextualCoderViewModelChanged. - + actions coderViewModel: textualCoderViewModel. - editorElement textualCoderViewModel: textualCoderViewModel + editorElement textualCoderViewModel: textualCoderViewModel. + "tags pharoMethodCoderViewModel: textualCoderViewModel" ] From d3d3c97cd3f4a713c17fda8874a1f28a2261ba47 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 14 Mar 2023 10:16:12 -0500 Subject: [PATCH 0458/1268] Clean up some unused traits [feenkcom/gtoolkit#3063] --- .../GtSingleCoderViewModel.class.st | 42 +++++++++- ...SourceCoderExpandedContentElement.class.st | 12 ++- src/GToolkit-Coder/TGtWithCoderModel.trait.st | 62 -------------- .../TGtWithCodersModel.trait.st | 84 ------------------- 4 files changed, 44 insertions(+), 156 deletions(-) delete mode 100644 src/GToolkit-Coder/TGtWithCoderModel.trait.st delete mode 100644 src/GToolkit-Coder/TGtWithCodersModel.trait.st diff --git a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st index 32033a19f..76f8d7c32 100644 --- a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st @@ -7,11 +7,12 @@ Wraps {{gtClass:GtCoderModel}} and optionally adds UI related api and state. Cod Class { #name : #GtSingleCoderViewModel, #superclass : #Object, - #traits : 'TGtAnnouncer + TGtWithCoderModel', - #classTraits : 'TGtAnnouncer classTrait + TGtWithCoderModel classTrait', + #traits : 'TGtAnnouncer', + #classTraits : 'TGtAnnouncer classTrait', #instVars : [ 'announcer', - 'codersUIModel' + 'codersUIModel', + 'coderModel' ], #category : #'GToolkit-Coder-UI-Coder - Basic' } @@ -53,6 +54,33 @@ GtSingleCoderViewModel >> coderLook [ ^ self coder coderLook ] +{ #category : #'api - coder model' } +GtSingleCoderViewModel >> coderModel [ + "Return a not-null coder model assigned to the receiver view model" + self + assert: [ coderModel notNil ] + description: [ 'coder model should be initialized' ]. + + ^ coderModel +] + +{ #category : #'api - coder model' } +GtSingleCoderViewModel >> coderModel: aCoderModel [ + "Set a not-null coder domain model assigned to the receiver view model" + self + assert: [ aCoderModel notNil ] + description: [ 'coder model must not be nil' ]. + + coderModel == aCoderModel + ifTrue: [ ^ self ]. + + coderModel ifNotNil: [ self unsubscribeFromCoderModel ]. + coderModel := aCoderModel. + + self onCoderModelChanged. + self subscribeToCoderModel +] + { #category : #accessing } GtSingleCoderViewModel >> coders [ ^ self coder coders @@ -84,6 +112,14 @@ GtSingleCoderViewModel >> gtLiveFor: aView [ view: #gtLiveFor: ] +{ #category : #'api - coder model' } +GtSingleCoderViewModel >> hasCoder [ + "Return a true if coder model is assigned to the receiver, false otherwise" + + + ^ coderModel notNil +] + { #category : #accessing } GtSingleCoderViewModel >> hasFocus [ diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st index 19a9defc2..fef676b74 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st @@ -17,8 +17,7 @@ GtSourceCoderExpandedContentElement >> initialize [ actions := self newActionsElement. tags := self newTagsElement. - "self addChildren: { editorElement . actions . tags }." - self addChildren: { editorElement . actions }. + self addChildren: { editorElement . actions . tags }. self addAptitude: (BrLayoutResizerAptitude new inherit: editorElement) ] @@ -37,7 +36,7 @@ GtSourceCoderExpandedContentElement >> newEditorElement [ { #category : #initialization } GtSourceCoderExpandedContentElement >> newTagsElement [ - ^GtPharoMethodCoderTagsElement new + ^ GtPharoMethodCoderTagsElement new constraintsDo: [ :c | c ignoreByLayout. c ignored horizontal alignRight. @@ -46,9 +45,8 @@ GtSourceCoderExpandedContentElement >> newTagsElement [ margin: (BlInsets top: 5 left: 5 - bottom: 5 - right: 5) ]; - zIndex: 10 + bottom: 2 + right: 5) ] ] { #category : #'api - textual coder view model' } @@ -57,5 +55,5 @@ GtSourceCoderExpandedContentElement >> onTextualCoderViewModelChanged [ actions coderViewModel: textualCoderViewModel. editorElement textualCoderViewModel: textualCoderViewModel. - "tags pharoMethodCoderViewModel: textualCoderViewModel" + tags pharoMethodCoderViewModel: textualCoderViewModel ] diff --git a/src/GToolkit-Coder/TGtWithCoderModel.trait.st b/src/GToolkit-Coder/TGtWithCoderModel.trait.st deleted file mode 100644 index c54bb8907..000000000 --- a/src/GToolkit-Coder/TGtWithCoderModel.trait.st +++ /dev/null @@ -1,62 +0,0 @@ -Trait { - #name : #TGtWithCoderModel, - #instVars : [ - 'coderModel' - ], - #category : #'GToolkit-Coder-Coders' -} - -{ #category : #'api - coder model' } -TGtWithCoderModel >> coderModel [ - "Return a not-null coder model assigned to the receiver view model" - self - assert: [ coderModel notNil ] - description: [ 'coder model should be initialized' ]. - - ^ coderModel -] - -{ #category : #'api - coder model' } -TGtWithCoderModel >> coderModel: aCoderModel [ - "Set a not-null coder domain model assigned to the receiver view model" - self - assert: [ aCoderModel notNil ] - description: [ 'coder model must not be nil' ]. - - coderModel == aCoderModel - ifTrue: [ ^ self ]. - - coderModel ifNotNil: [ self unsubscribeFromCoderModel ]. - coderModel := aCoderModel. - - self onCoderModelChanged. - self subscribeToCoderModel -] - -{ #category : #'api - coder model' } -TGtWithCoderModel >> hasCoder [ - "Return a true if coder model is assigned to the receiver, false otherwise" - - - ^ coderModel notNil -] - -{ #category : #'api - coder model' } -TGtWithCoderModel >> onCoderModelChanged [ - "Is sent when a new coder model is assigned to the view model" - - self explicitRequirement -] - -{ #category : #'api - coder model' } -TGtWithCoderModel >> subscribeToCoderModel [ - "Is sent after a new coder model is assigned to the view model. - It is required to unsubscribe from the domain model by implementing - #unsubscribeFromCoderModel if view model subscribes to them" -] - -{ #category : #'api - coder model' } -TGtWithCoderModel >> unsubscribeFromCoderModel [ - "Is sent before a new coder model is assigned to the view model. - View models that subscribe to coder model are required to implement this methods" -] diff --git a/src/GToolkit-Coder/TGtWithCodersModel.trait.st b/src/GToolkit-Coder/TGtWithCodersModel.trait.st deleted file mode 100644 index 7eb1f06f2..000000000 --- a/src/GToolkit-Coder/TGtWithCodersModel.trait.st +++ /dev/null @@ -1,84 +0,0 @@ -Trait { - #name : #TGtWithCodersModel, - #instVars : [ - 'codersModel' - ], - #category : #'GToolkit-Coder-Coders' -} - -{ #category : #'api - coders model' } -TGtWithCodersModel >> codersModel [ - "Return a not-null codersModel assigned to the receiver" - - >#objectGetterTemplate'> - self - assert: [ codersModel notNil ] - description: [ 'codersModel should be initialized' ]. - - ^ codersModel -] - -{ #category : #'api - coders model' } -TGtWithCodersModel >> codersModel: aCodersModel [ - "Set a not-null codersModel assigned to the receiver" - - >#objectSetterTemplate'> - self - assert: [ aCodersModel notNil ] - description: [ 'codersModel must not be nil' ]. - - codersModel == aCodersModel - ifTrue: [ ^ self ]. - - codersModel ifNotNil: [ self unsubscribeFromCodersModel ]. - codersModel := aCodersModel. - - self onCodersModelChanged. - self subscribeToCodersModel. - self onPostCodersModelChanged -] - -{ #category : #'api - coders model' } -TGtWithCodersModel >> hasCodersModel [ - "Return a true if nil is assigned to the receiver, false otherwise" - - - >#hasObjectTemplate'> - - ^ codersModel notNil -] - -{ #category : #'api - coders model' } -TGtWithCodersModel >> onCodersModelChanged [ - "Is sent when a new codersModel is assigned to the receiver. - Note: #onCodersModelChanged is sent before #subscribeToCodersModel - which means that if you perform any operation that triggers an announcement it will be ignored because the receiver - didn't get a chance to subscribe to any announcement. Override #onPostCodersModelChanged if you - wish to perform an operation that requires an announcement, but keep in mind that this is not the most efficient way" - >#onObjectChangedTemplate'> -] - -{ #category : #'api - coders model' } -TGtWithCodersModel >> onPostCodersModelChanged [ - "I am an optional hook method that is sent after #subscribeToCodersModel. - I do nothing by default but allow users to perform update operations when a receiver object is already - subscribed to announcements." - >#onPostObjectChangedTemplate'> -] - -{ #category : #'api - coders model' } -TGtWithCodersModel >> subscribeToCodersModel [ - "Is sent after a new codersModel is assigned to the receiver. - It is required to unsubscribe from the previously subscribed objects by implementing - #unsubscribeFromCodersModel if the receiver subscribes to them" - - >#subscribeToObjectTemplate'> -] - -{ #category : #'api - coders model' } -TGtWithCodersModel >> unsubscribeFromCodersModel [ - "Is sent before a new codersModel is assigned to the receiver. - Objects that subscribe to codersModel are required to implement this method." - - >#unsubscribeFromObjectTemplate'> -] From 5986c4d0093b495f9d158c7063151efda6c76f58 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 15 Mar 2023 06:42:03 -0500 Subject: [PATCH 0459/1268] Revert code that shouldn't have been released [feenkcom/gtoolkit#3063] --- .../GtSourceCoderExpandedContentElement.class.st | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st index fef676b74..5531f184c 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st @@ -17,7 +17,8 @@ GtSourceCoderExpandedContentElement >> initialize [ actions := self newActionsElement. tags := self newTagsElement. - self addChildren: { editorElement . actions . tags }. + "self addChildren: { editorElement . actions . tags }." + self addChildren: { editorElement . actions }. self addAptitude: (BrLayoutResizerAptitude new inherit: editorElement) ] From b4dc55111431c25d2e0265c4452e39a6db1e776e Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 15 Mar 2023 07:07:43 -0500 Subject: [PATCH 0460/1268] Revert code that shouldn't have been released [feenkcom/gtoolkit#3063] --- .../GtSourceCoderExpandedContentElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st index 5531f184c..4d9602af3 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st @@ -56,5 +56,5 @@ GtSourceCoderExpandedContentElement >> onTextualCoderViewModelChanged [ actions coderViewModel: textualCoderViewModel. editorElement textualCoderViewModel: textualCoderViewModel. - tags pharoMethodCoderViewModel: textualCoderViewModel + "tags pharoMethodCoderViewModel: textualCoderViewModel" ] From d48ed237223cfb35be4d0e57247d4ae6c2faa79f Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 15 Mar 2023 19:27:52 -0500 Subject: [PATCH 0461/1268] Fix for creating classes in tagless packages. --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index 72b0409c7..2a450ccc7 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -172,8 +172,12 @@ GtCreationForm >> packageAndTagName: anObject [ { #category : #accessing } GtCreationForm >> selectInNavigationModel: aNavigationModel anInstance: anInstance [ + | aTag | aNavigationModel selectPackage: anInstance package. - aNavigationModel selectPackageTag: (anInstance package classTagNamed: anInstance tags first). + aTag := anInstance tags + ifEmpty: [ nil ] + ifNotEmpty: [ anInstance package classTagNamed: anInstance tags first ]. + aNavigationModel selectPackageTag: aTag. aNavigationModel selectClass: anInstance ] From 89d7c2638dd7e85746e5836959f3450c8de074c1 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 16 Mar 2023 08:49:57 -0500 Subject: [PATCH 0462/1268] Revert changes to GtSourceCoderExpandedContentElement [feenkcom/gtoolkit#3063] --- ...SourceCoderExpandedContentElement.class.st | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st index 4d9602af3..08924ef17 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st @@ -15,9 +15,7 @@ GtSourceCoderExpandedContentElement >> initialize [ editorElement := self newEditorElement. actions := self newActionsElement. - tags := self newTagsElement. - "self addChildren: { editorElement . actions . tags }." self addChildren: { editorElement . actions }. self addAptitude: (BrLayoutResizerAptitude new inherit: editorElement) ] @@ -35,26 +33,10 @@ GtSourceCoderExpandedContentElement >> newEditorElement [ ^ GtSourceCoderEditorElement new ] -{ #category : #initialization } -GtSourceCoderExpandedContentElement >> newTagsElement [ - ^ GtPharoMethodCoderTagsElement new - constraintsDo: [ :c | - c ignoreByLayout. - c ignored horizontal alignRight. - c ignored vertical alignBottom. - c - margin: (BlInsets - top: 5 - left: 5 - bottom: 2 - right: 5) ] -] - { #category : #'api - textual coder view model' } GtSourceCoderExpandedContentElement >> onTextualCoderViewModelChanged [ super onTextualCoderViewModelChanged. actions coderViewModel: textualCoderViewModel. - editorElement textualCoderViewModel: textualCoderViewModel. - "tags pharoMethodCoderViewModel: textualCoderViewModel" + editorElement textualCoderViewModel: textualCoderViewModel ] From 8fec951450fe424f93ca0693ef3d91d25f2af7be Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 21 Mar 2023 10:07:20 -0500 Subject: [PATCH 0463/1268] Improvements to extension navigation + examples [feenkcom/gtoolkit#2998] --- .../GtCoderNavigationPackagesTagsClassesElement.class.st | 3 ++- src/GToolkit-Coder/GtCoderPackageExtensionTag.class.st | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 2c46d6a26..94671c214 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -714,7 +714,8 @@ GtCoderNavigationPackagesTagsClassesElement >> reselectPackageOrTag: aSelectedPa GtCoderNavigationPackagesTagsClassesElement >> selectClass: aClass inPackage: aPackage tag: aPackageTag [ (self selectedPackage ~= aPackage or: [ self selectedPackageTag ~= aPackageTag ]) - ifTrue: [ self selectPackage: aPackage tag: aPackageTag ]. + ifTrue: [ self selectPackage: aPackage. + self selectPackage: aPackage tag: aPackageTag ]. self selectClass: aClass. self updateProtocolList. self updateSlotList diff --git a/src/GToolkit-Coder/GtCoderPackageExtensionTag.class.st b/src/GToolkit-Coder/GtCoderPackageExtensionTag.class.st index 8556341bf..94da7190e 100644 --- a/src/GToolkit-Coder/GtCoderPackageExtensionTag.class.st +++ b/src/GToolkit-Coder/GtCoderPackageExtensionTag.class.st @@ -48,7 +48,7 @@ GtCoderPackageExtensionTag >> hash [ { #category : #testing } GtCoderPackageExtensionTag >> isRoot [ - ^true + ^false ] { #category : #testing } From e57f8c5d966a4fc5dd9d5df6d0533a890fbdf47b Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 21 Mar 2023 11:03:40 -0500 Subject: [PATCH 0464/1268] Correctly switch packages when navigating class hierarchy [feenkcom/gtoolkit#2998] --- .../GtCoderNavigationElement.class.st | 3 +-- ...NavigationPackagesTagsClassesElement.class.st | 16 ++++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st index 6b391ea52..23b8f3619 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st @@ -261,6 +261,5 @@ GtCoderNavigationElement >> updateContent [ { #category : #'updating lists' } GtCoderNavigationElement >> updateSelectedClass [ self hasNavigationModel ifFalse: [ ^ self ]. - navigationModel selectedClassDo: [ :aClass | - self selectClass: aClass ]. + navigationModel selectedClassDo: [ :aClass | self selectClass: aClass ] ] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 94671c214..90ce5f92b 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -945,8 +945,7 @@ GtCoderNavigationPackagesTagsClassesElement >> updateClassLists [ { #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updateContent [ self updatePackageAndClassLists. - self updateSelectedPackageAndTag. - self updateSelectedClass. + self updateSelections. self hideOrShowClassList ] @@ -1037,13 +1036,18 @@ GtCoderNavigationPackagesTagsClassesElement >> updateProtocolListWith: instanceP ] { #category : #'updating lists' } -GtCoderNavigationPackagesTagsClassesElement >> updateSelectedPackageAndTag [ +GtCoderNavigationPackagesTagsClassesElement >> updateSelections [ self hasNavigationModel ifFalse: [ ^ self ]. navigationModel hasSelectedPackage ifTrue: [ navigationModel hasSelectedTag - ifTrue: [ self - selectPackage: navigationModel selectedPackage - tag: navigationModel selectedTag ] + ifTrue: [ navigationModel hasSelectedClass + ifTrue: [ self + selectClass: navigationModel selectedClass + inPackage: navigationModel selectedPackage + tag: navigationModel selectedTag ] + ifFalse: [ self + selectPackage: navigationModel selectedPackage + tag: navigationModel selectedTag ] ] ifFalse: [ self selectPackage: navigationModel selectedPackage ] ] ] From fa04055ed09814cbca76a1b006b09201068cdbf0 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 21 Mar 2023 13:57:09 -0500 Subject: [PATCH 0465/1268] Fix failing examples [feenkcom/gtoolkit#2998] --- .../GtCoderNavigationPackagesTagsClassesElement.class.st | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 90ce5f92b..e5982bfe1 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -714,8 +714,7 @@ GtCoderNavigationPackagesTagsClassesElement >> reselectPackageOrTag: aSelectedPa GtCoderNavigationPackagesTagsClassesElement >> selectClass: aClass inPackage: aPackage tag: aPackageTag [ (self selectedPackage ~= aPackage or: [ self selectedPackageTag ~= aPackageTag ]) - ifTrue: [ self selectPackage: aPackage. - self selectPackage: aPackage tag: aPackageTag ]. + ifTrue: [ self selectPackage: aPackage tag: aPackageTag ]. self selectClass: aClass. self updateProtocolList. self updateSlotList @@ -741,8 +740,9 @@ GtCoderNavigationPackagesTagsClassesElement >> selectPackage: aPackage [ { #category : #'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> selectPackage: aPackage tag: aPackageTag [ - | aPreviousIndex | + | aPreviousIndex | (self hasPackageTagsIn: aPackage) ifFalse: [ ^ self selectPackage: aPackage ]. + aPackageTag isNil ifTrue: [ ^ self selectPackage: aPackage ]. self expandPackage: aPackage. aPreviousIndex := packagesList selectedIndice. From 033609659aae2f68c163a4d09f614c6047c274ea Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Tue, 21 Mar 2023 23:16:43 +0100 Subject: [PATCH 0466/1268] make the buttons appear at the bottom in the diff widget feenkcom/gtoolkit#3100 --- src/GToolkit-Coder-UI/GtDiffElement.class.st | 45 +++++++++++--------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtDiffElement.class.st b/src/GToolkit-Coder-UI/GtDiffElement.class.st index fe6cf95ee..37f76e05c 100644 --- a/src/GToolkit-Coder-UI/GtDiffElement.class.st +++ b/src/GToolkit-Coder-UI/GtDiffElement.class.st @@ -80,10 +80,10 @@ GtDiffElement >> hideButtons [ { #category : #initialize } GtDiffElement >> initialize [ - | gridLayout | + | gridLayout comparisonElement | super initialize. - gridLayout := BlGridLayout new columnCount: 3. + gridLayout := BlLinearLayout vertical. self layout: gridLayout. self matchParent. @@ -130,25 +130,27 @@ GtDiffElement >> initialize [ on: BrTextEditorCursorAddedEvent do: [ :e | self rightCursorChanged ]). - separatorElement := self newSeparatorElement id: GtDiffSeparatorId. + comparisonElement := BrHorizontalPane new + hMatchParent; + vFitContentLimited; + addChildren: {leftElement. self newSeparatorElement id: GtDiffSeparatorId. rightElement}. self - addChildren: {buttonsElement. - leftElement. - separatorElement. - rightElement} + addChildren: {buttonsElement . comparisonElement} ] { #category : #'event handling' } GtDiffElement >> leftBottomFor: anInteger [ | range element index | range := self leftRange. - range isEmpty ifTrue: [ ^ leftElement bounds top + leftElement padding top ]. + range isEmpty + ifTrue: [ ^ leftElement bounds inParent inParent top + leftElement padding top ]. index := (anInteger max: range first) min: range last. element := leftElement children at: index - range first + 1. ^ (anInteger < range first ifTrue: [ element bounds top ] - ifFalse: [ element bounds bottom ]) + leftElement bounds top max: leftElement bounds top + ifFalse: [ element bounds bottom ]) + leftElement bounds inParent inParent top + max: leftElement bounds inParent inParent top ] { #category : #'event handling' } @@ -199,12 +201,14 @@ GtDiffElement >> leftStyler: aStyler [ GtDiffElement >> leftTopFor: anInteger [ | range element index | range := self leftRange. - range isEmpty ifTrue: [ ^ leftElement bounds top + leftElement padding top ]. + range isEmpty + ifTrue: [ ^ leftElement bounds inParent inParent top + leftElement padding top ]. index := (anInteger max: range first) min: range last. element := leftElement children at: index - range first + 1. ^ (anInteger > range last ifTrue: [ element bounds bottom ] - ifFalse: [ element bounds top ]) + leftElement bounds top max: leftElement bounds top + ifFalse: [ element bounds top ]) + leftElement bounds inParent inParent top + max: leftElement bounds inParent inParent top ] { #category : #accessing } @@ -280,7 +284,8 @@ GtDiffElement >> newSeparatorElement [ GtDiffElement >> newTextElement [ ^ BrEditor new beReadOnlyWithSelection; - matchParent; + hMatchParent; + vFitContentLimited; aptitude: self editorLook ] @@ -307,8 +312,8 @@ GtDiffElement >> outlineFor: aSyncScrollRange [ leftBottom := self leftBottomFor: aSyncScrollRange leftLast. rightTop := self rightTopFor: aSyncScrollRange rightFirst + 1. rightBottom := self rightBottomFor: aSyncScrollRange rightLast. - leftBounds := leftElement bounds. - rightBounds := rightElement bounds. + leftBounds := leftElement bounds inParent inParent. + rightBounds := rightElement bounds inParent inParent. vertices := OrderedCollection new: 9. vertices add: leftBounds left @ leftTop; @@ -363,13 +368,13 @@ GtDiffElement >> paintOnCanvas: aCanvas [ GtDiffElement >> rightBottomFor: anInteger [ | range element index | range := self rightRange. - range isEmpty ifTrue: [ ^ rightElement bounds top + rightElement padding top ]. + range isEmpty ifTrue: [ ^ rightElement bounds inParent inParent top + rightElement padding top ]. index := (anInteger max: range first) min: range last. element := rightElement children at: index - range first + 1. ^ (anInteger < range first ifTrue: [ element bounds top ] - ifFalse: [ element bounds bottom ]) + rightElement bounds top - max: rightElement bounds top + ifFalse: [ element bounds bottom ]) + rightElement bounds inParent inParent top + max: rightElement bounds inParent inParent top ] { #category : #'event handling' } @@ -420,13 +425,13 @@ GtDiffElement >> rightStyler: aStyler [ GtDiffElement >> rightTopFor: anInteger [ | range element index | range := self rightRange. - range isEmpty ifTrue: [ ^ rightElement bounds top + rightElement padding top ]. + range isEmpty ifTrue: [ ^ rightElement bounds inParent inParent top + rightElement padding top ]. index := (anInteger max: range first) min: range last. element := rightElement children at: index - range first + 1. ^ (anInteger > range last ifTrue: [ element bounds bottom ] - ifFalse: [ element bounds top ]) + rightElement bounds top - max: rightElement bounds top + ifFalse: [ element bounds top ]) + rightElement bounds inParent inParent top + max: rightElement bounds inParent inParent top ] { #category : #'event handling' } From 09db3903beb822b7ad97061fe25a329590216c88 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 22 Mar 2023 14:29:37 -0500 Subject: [PATCH 0467/1268] Disable context menus on dirty class forms [feenkcom/gtoolkit#3133] --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index 2a450ccc7..977fd951e 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -121,9 +121,9 @@ GtCreationForm >> onAccept [ ] { #category : #accessing } -GtCreationForm >> onAccept: anObject [ +GtCreationForm >> onAccept: aBlock [ - onAccept := anObject + onAccept := aBlock ] { #category : #accessing } @@ -132,8 +132,8 @@ GtCreationForm >> onElementCreated [ ] { #category : #accessing } -GtCreationForm >> onElementCreated: anObject [ - onElementCreated := anObject +GtCreationForm >> onElementCreated: aBlock [ + onElementCreated := aBlock ] { #category : #accessing } @@ -142,8 +142,8 @@ GtCreationForm >> onReset [ ] { #category : #accessing } -GtCreationForm >> onReset: anObject [ - onReset := anObject +GtCreationForm >> onReset: aBlock [ + onReset := aBlock ] { #category : #accessing } @@ -234,7 +234,7 @@ GtCreationForm >> taggerStencilWithCompletion: aCompletionStrategy andContextMen aContextMenuBlock ifNotNil: [ aLabel addAptitude: (BrGlamorousWithContextMenuAptitude - content: [ aContextMenuBlock value: aTag name value: aLabel ]) ]. + content: [ aContextMenuBlock value: aTag name value: aLabel value: aMemento]) ]. aLabel ]). aTagger when: BrTaggerAddTagRequest From 69d0f5001bbfa2302701ff83a5ab29a0c7521595 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 23 Mar 2023 13:48:29 -0500 Subject: [PATCH 0468/1268] Rename slot refactoring added to index context menu [feenkcom/gtoolkit#3133] --- ...igationPackagesTagsClassesElement.class.st | 35 +++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index e5982bfe1..89b847afa 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -5,14 +5,14 @@ Class { #classTraits : 'TNavigationWithContextMenu classTrait', #instVars : [ 'packagesList', - 'classesLabel', 'methodProtocolsList', 'methodsLabel', 'methodGroup', 'methodGroupList', 'protocolGroup', 'slotsGroup', - 'slotsGroupList' + 'slotsGroupList', + 'classesLabel' ], #category : #'GToolkit-Coder-UI-Navigation' } @@ -687,6 +687,33 @@ GtCoderNavigationPackagesTagsClassesElement >> renameProtocol: protocolName in: elem addChild: edit ] +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> renameSlot: slotName inElement: elem [ + | edit | + edit := BrEditableLabel new. + edit + aptitude: (BrGlamorousEditableLabelAptitude new + glamorousCodeSmallSize; + background: Color transparent); + text: slotName; + when: BrEditorAcceptWish + do: [ :aWish | + | refactoring | + refactoring := RBRenameInstanceVariableRefactoring + rename: slotName + to: aWish text asString + in: self selectedClass. + edit switchToLabel. + self + addPreviewButtonFor: refactoring + to: elem + cancelSelector: #updateSlotList ]; + switchToEditor. + edit requestFocus. + elem removeChildren. + elem addChild: edit +] + { #category : #'api - package reselections' } GtCoderNavigationPackagesTagsClassesElement >> reselectPackageOrTag: aSelectedPackageOrTag afterRemovalOfPackageNamed: aRemovedPackageOrTagName [ aSelectedPackageOrTag ifNotNil: [ @@ -878,7 +905,9 @@ GtCoderNavigationPackagesTagsClassesElement >> slotListContextMenuItemsFor: item self addPreviewButtonFor: refactoring to: elem - cancelSelector: #updateProtocolList ]} + cancelSelector: #updateProtocolList ]. + (self createLabel: 'Rename slot' description: item name) + -> [ :elem | self renameSlot: item name inElement: elem ]} ] { #category : #subscriptions } From 84be0d152277dc4122fa6adfb65e8f5d02beef7c Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 23 Mar 2023 20:22:44 +0100 Subject: [PATCH 0469/1268] [feenkcom/gtoolkit#2995] improve cursor and text updating in the textual coder editor --- .../GtTextualCoderEditorElement.class.st | 85 ++++++++++++------- ...GtTextualCoderEditorElementSignal.class.st | 5 ++ ...rEditorElementUpdateCursorsSignal.class.st | 5 ++ ...derEditorElementUpdateStateSignal.class.st | 5 ++ ...oderEditorElementUpdateTextSignal.class.st | 5 ++ .../GtTextualCoderViewModel.class.st | 1 + ...TextualCoderViewModelAnnouncement.class.st | 15 +++- .../GtCoderUpdateStrategy.class.st | 5 ++ src/GToolkit-Coder/GtTextualCoder.class.st | 8 +- 9 files changed, 99 insertions(+), 35 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtTextualCoderEditorElementSignal.class.st create mode 100644 src/GToolkit-Coder-UI/GtTextualCoderEditorElementUpdateCursorsSignal.class.st create mode 100644 src/GToolkit-Coder-UI/GtTextualCoderEditorElementUpdateStateSignal.class.st create mode 100644 src/GToolkit-Coder-UI/GtTextualCoderEditorElementUpdateTextSignal.class.st diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index d14a619df..487695ecd 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -7,7 +7,9 @@ Class { 'completion', 'evaluationHighlighter', 'evaluationPrinter', - 'shortcuts' + 'shortcuts', + 'cursorsUpdater', + 'textUpdater' ], #category : #'GToolkit-Coder-UI-Coder - Textual' } @@ -69,12 +71,20 @@ GtTextualCoderEditorElement >> initialize [ evaluationHighlighter := GtSourceCoderEvaluationHighlighter new editorElement: self. evaluationPrinter := GtSourceCoderEvaluationPrinter new editorElement: self. + + cursorsUpdater := BrElementUpdater new + element: self; + action: (MessageSend receiver: self selector: #privateUpdateCursors:announcement:). + + textUpdater := BrElementUpdater new + element: self; + action: (MessageSend receiver: self selector: #privateUpdateText:announcement:). self initializeListeners. self withAsyncPromiseDo: [ :anElementPromise | anElementPromise - whenSuccess: [ :anEditorElement :anEditorState | anEditorElement editor restoreState: anEditorState ]; + whenSuccess: [ :anEditorElement :anEditorState | anEditorElement privateUpdateEditorState: anEditorState ]; whenError: [ :anEditorElement :anEditorState | ]; whenPending: [ :anEditorElement | ] ] ] @@ -129,24 +139,6 @@ GtTextualCoderEditorElement >> onCoderViewModelFocused: aBoolean [ ifFalse: [ self loseFocus ] ] -{ #category : #'private - event handling' } -GtTextualCoderEditorElement >> onCursorsChanged: aCursorsChangedAnnouncement [ - "Is sent when the cursors change in the View Model. - May be sent from a non-UI thread" - - "if the source of the announcement is myself, do nothing to break the change cycle" - aCursorsChangedAnnouncement source = self - ifTrue: [ ^ self ]. - - "since it may be sent from a non-UI process make sure to wrap in the action" - self enqueueTask: (BlTaskAction new action: [ - self navigator - withoutResettingDesiredCoordinate; - removeAll; - addAll: aCursorsChangedAnnouncement cursors; - apply ]) -] - { #category : #'private - event handling' } GtTextualCoderEditorElement >> onFocusChangedAnnouncement: anAnnouncement [ anAnnouncement source == self ifTrue: [ ^ self ]. @@ -286,16 +278,12 @@ GtTextualCoderEditorElement >> onViewModelCursorsChanged: aCursorsChangedAnnounc aCursorsChangedAnnouncement source = self ifTrue: [ ^ self ]. + "do nothing if it comes from a different view model" aCursorsChangedAnnouncement source == self textualCoderViewModel ifFalse: [ ^ self ]. "since it may be sent from a non-UI process make sure to wrap in the action" - self enqueueTask: (BlTaskAction new action: [ - self navigator - withoutResettingDesiredCoordinate; - removeAll; - addAll: aCursorsChangedAnnouncement cursors; - apply ]) + cursorsUpdater requestUpdate: aCursorsChangedAnnouncement ] { #category : #'private - event handling' } @@ -372,12 +360,45 @@ GtTextualCoderEditorElement >> onViewModelTextChanged: aGtTextualCoderViewModelT ifTrue: [ ^ self hideHighlighters ]. aGtTextualCoderViewModelTextChanged isSynchronous - ifTrue: [ - self text: aGtTextualCoderViewModelTextChanged text copy. - self hideHighlighters ] - ifFalse: [ self enqueueTask: (BlTaskAction new action: [ - self text: aGtTextualCoderViewModelTextChanged text copy. - self hideHighlighters ]) ] + ifTrue: [ self privateUpdateText: self announcement: aGtTextualCoderViewModelTextChanged ] + ifFalse: [ textUpdater requestUpdate: aGtTextualCoderViewModelTextChanged ] +] + +{ #category : #'private - updating' } +GtTextualCoderEditorElement >> privateUpdateCursors: anEditorElement announcement: aCursorsChangedAnnouncement [ + + "do nothing if it comes from a different view model" + aCursorsChangedAnnouncement source == self textualCoderViewModel + ifFalse: [ ^ self ]. + + GtTextualCoderEditorElementUpdateCursorsSignal emit. + + self navigator + withoutResettingDesiredCoordinate; + removeAll; + addAll: aCursorsChangedAnnouncement cursors; + apply +] + +{ #category : #'private - updating' } +GtTextualCoderEditorElement >> privateUpdateEditorState: anEditorState [ + GtTextualCoderEditorElementUpdateStateSignal emit. + + self editor restoreState: anEditorState +] + +{ #category : #'private - updating' } +GtTextualCoderEditorElement >> privateUpdateText: anEditorElement announcement: aGtTextualCoderViewModelTextChanged [ + "Executed in a UI thread as a result of text being changed in the view model" + + "do nothing if it comes from a different view model" + aGtTextualCoderViewModelTextChanged textualCoderViewModel == self textualCoderViewModel + ifFalse: [ ^ self ]. + + GtTextualCoderEditorElementUpdateTextSignal emit. + + self text: aGtTextualCoderViewModelTextChanged text copy. + self hideHighlighters ] { #category : #registration } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElementSignal.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElementSignal.class.st new file mode 100644 index 000000000..30d183b0f --- /dev/null +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElementSignal.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtTextualCoderEditorElementSignal, + #superclass : #ContextStackSignal, + #category : #'GToolkit-Coder-UI-Coder - Textual' +} diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElementUpdateCursorsSignal.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElementUpdateCursorsSignal.class.st new file mode 100644 index 000000000..265ecc031 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElementUpdateCursorsSignal.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtTextualCoderEditorElementUpdateCursorsSignal, + #superclass : #GtTextualCoderEditorElementSignal, + #category : #'GToolkit-Coder-UI-Coder - Textual' +} diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElementUpdateStateSignal.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElementUpdateStateSignal.class.st new file mode 100644 index 000000000..6a55632a5 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElementUpdateStateSignal.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtTextualCoderEditorElementUpdateStateSignal, + #superclass : #GtTextualCoderEditorElementSignal, + #category : #'GToolkit-Coder-UI-Coder - Textual' +} diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElementUpdateTextSignal.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElementUpdateTextSignal.class.st new file mode 100644 index 000000000..3a8075fcc --- /dev/null +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElementUpdateTextSignal.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtTextualCoderEditorElementUpdateTextSignal, + #superclass : #GtTextualCoderEditorElementSignal, + #category : #'GToolkit-Coder-UI-Coder - Textual' +} diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 63f7d5148..c7bd73743 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -579,6 +579,7 @@ GtTextualCoderViewModel >> onSourceCodeChanged: anSourceCodeChangedAnnouncement self ensureAddOns. self announce: (GtTextualCoderViewModelTextChanged new + textualCoderViewModel: self; text: self coderModel currentSourceText; updateStrategy: anSourceCodeChangedAnnouncement updateStrategy) ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelAnnouncement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelAnnouncement.class.st index baebada4f..0e4072cf0 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelAnnouncement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelAnnouncement.class.st @@ -1,5 +1,18 @@ Class { #name : #GtTextualCoderViewModelAnnouncement, #superclass : #Announcement, - #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' + #instVars : [ + 'textualCoderViewModel' + ], + #category : #'GToolkit-Coder-UI-Coder - Textual Model - Events' } + +{ #category : #accessing } +GtTextualCoderViewModelAnnouncement >> textualCoderViewModel [ + ^ textualCoderViewModel +] + +{ #category : #accessing } +GtTextualCoderViewModelAnnouncement >> textualCoderViewModel: anObject [ + textualCoderViewModel := anObject +] diff --git a/src/GToolkit-Coder/GtCoderUpdateStrategy.class.st b/src/GToolkit-Coder/GtCoderUpdateStrategy.class.st index 1b25fe17f..22642cd61 100644 --- a/src/GToolkit-Coder/GtCoderUpdateStrategy.class.st +++ b/src/GToolkit-Coder/GtCoderUpdateStrategy.class.st @@ -54,6 +54,11 @@ GtCoderUpdateStrategy >> makeSynchronous [ isSynchronous := true ] +{ #category : #copying } +GtCoderUpdateStrategy >> postCopy [ + properties := properties copy +] + { #category : #'accessing - properties' } GtCoderUpdateStrategy >> properties [ ^ properties ifNil: [ diff --git a/src/GToolkit-Coder/GtTextualCoder.class.st b/src/GToolkit-Coder/GtTextualCoder.class.st index df612df2c..20a41b647 100644 --- a/src/GToolkit-Coder/GtTextualCoder.class.st +++ b/src/GToolkit-Coder/GtTextualCoder.class.st @@ -226,7 +226,11 @@ GtTextualCoder >> notifyCorrectionFrom: aFromIndex to: aToIndex with: aString [ { #category : #'private - notifying' } GtTextualCoder >> notifySourceChangedTo: aNewText from: aPreviousText with: anUpdateStragegy dueTo: aReason [ "Notify the text editor that it should update the text (for example due to refactoring changes)" - + + "If user didn't specify the source, we assume that the coder model plays a role of the source" + anUpdateStragegy source ifNil: [ + anUpdateStragegy source: self ]. + self announce: (GtCoderSourceCodeChanged new updateStrategy: anUpdateStragegy; newText: aNewText; @@ -293,7 +297,7 @@ GtTextualCoder >> sourceChangedTo: aNewText from: aPreviousText with: anUpdateSt GtTextualCoder >> sourceChangedTo: aNewText with: anUpdateStrategy [ self sourceChangedTo: aNewText - from: nil + from: self with: anUpdateStrategy dueTo: nil ] From 6d0a17338964cac3d99a832ec7b24a8fdaab4506 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 24 Mar 2023 16:21:22 -0500 Subject: [PATCH 0470/1268] Make the inline rename editor font match the list font in the index --- .../GtCoderNavigationClassesHierarchyTreeElement.class.st | 2 +- .../GtCoderNavigationPackagesTagsClassesElement.class.st | 6 +++--- .../GtCoderNavigationPackagesTreeElement.class.st | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st index 7a6785c0f..c9e8a5d78 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st @@ -145,7 +145,7 @@ GtCoderNavigationClassesHierarchyTreeElement >> renameClass: aClass inElement: e childs := elem children. edit aptitude: (BrGlamorousEditableLabelAptitude new - glamorousCodeSmallSize; + fontSize: 11.9; "Force the font to match the label font" background: Color transparent); text: aClass name; when: BrEditorAcceptWish diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 89b847afa..f233326db 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -628,7 +628,7 @@ GtCoderNavigationPackagesTagsClassesElement >> renameMethod: aSelector inElement edit := BrEditableLabel new. edit aptitude: (BrGlamorousEditableLabelAptitude new - glamorousCodeSmallSize; + fontSize: 11.9; "Force the font to match the label font" background: Color transparent); text: aSelector; when: BrEditorAcceptWish @@ -667,7 +667,7 @@ GtCoderNavigationPackagesTagsClassesElement >> renameProtocol: protocolName in: edit := BrEditableLabel new. edit aptitude: (BrGlamorousEditableLabelAptitude new - glamorousCodeSmallSize; + fontSize: 11.9; "Force the font to match the label font" background: Color transparent); text: protocolName; when: BrEditorAcceptWish @@ -693,7 +693,7 @@ GtCoderNavigationPackagesTagsClassesElement >> renameSlot: slotName inElement: e edit := BrEditableLabel new. edit aptitude: (BrGlamorousEditableLabelAptitude new - glamorousCodeSmallSize; + fontSize: 11.9; "Force the font to match the label font" background: Color transparent); text: slotName; when: BrEditorAcceptWish diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st index 0bdc09d49..c55cb97e0 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st @@ -187,7 +187,7 @@ GtCoderNavigationPackagesTreeElement >> renamePackage: aPackage inElement: elem edit := BrEditableLabel new. edit aptitude: (BrGlamorousEditableLabelAptitude new - glamorousCodeSmallSize; + fontSize: 11.9; "Force the font to match the label font" background: Color transparent); text: aPackage name; when: BrEditorAcceptWish From c130df8774a70a85e57195e0a3695e2afdc75798 Mon Sep 17 00:00:00 2001 From: Andrei Chis Date: Fri, 24 Mar 2023 22:45:13 +0100 Subject: [PATCH 0471/1268] Pass the text edit command to the editor and use it to update the text [feenkcom/gtoolkit#2503] --- .../GtTextualCoderEditorElement.class.st | 54 +++++++++++++++++-- .../GtTextualCoderViewModel.class.st | 8 +++ ...tTextualCoderViewModelTextChanged.class.st | 16 +++++- ...extEditCommandRequestAnnouncement.class.st | 18 +++++++ src/GToolkit-Coder/GtCoderTextSource.class.st | 4 +- .../GtCoderUpdateStrategy.class.st | 18 ++++++- src/GToolkit-Coder/GtTextualCoder.class.st | 27 ++++++++-- 7 files changed, 135 insertions(+), 10 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtTextualCoderViewModelTextEditCommandRequestAnnouncement.class.st diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 487695ecd..ff2a141d9 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -19,6 +19,24 @@ GtTextualCoderEditorElement >> coderViewModel: aTextualCoderViewModel [ self textualCoderViewModel: aTextualCoderViewModel ] +{ #category : #'private - updating' } +GtTextualCoderEditorElement >> computeTextForUpdateForTextChangedEvent: aGtTextualCoderViewModelTextChanged [ + "In case the editor has a text edit command we determine + the updated text by editing the text currently in the + editor. If no edit command is present in the event, + we take the text from the event. We use the edit command + to avoid setting the text from the event which is not + styled, and can cause flickerings." + + ^ aGtTextualCoderViewModelTextChanged hasTextEditCommand + ifTrue: [ + | editCommand| + editCommand := aGtTextualCoderViewModelTextChanged textEditCommand. + self editedTextBasedOnEditCommand: editCommand. ] + ifFalse: [ + aGtTextualCoderViewModelTextChanged text copy ] +] + { #category : #'instance creation' } GtTextualCoderEditorElement >> createContextMenuContent [ "wait for the addons to be computed" @@ -43,6 +61,16 @@ GtTextualCoderEditorElement >> createContextMenuContent [ ^ theContextMenu ] +{ #category : #'private - updating' } +GtTextualCoderEditorElement >> editedTextBasedOnEditCommand: aTextEditCommand [ + | modifiedText| + "self haltOnce." + + modifiedText := self text copy. + aTextEditCommand applyTextChangeOn: modifiedText. + ^ modifiedText +] + { #category : #private } GtTextualCoderEditorElement >> hideHighlighters [ self text clearAttributes: [ :eachAttribute | @@ -354,16 +382,29 @@ GtTextualCoderEditorElement >> onViewModelTextAttributesRemoved: anAnnouncement GtTextualCoderEditorElement >> onViewModelTextChanged: aGtTextualCoderViewModelTextChanged [ "When text is modified, the view model starts to recompute addOns" - self enqueueTask: (BlPromiseTask new promise: self textualCoderViewModel addOns). + self enqueueTask: (BlPromiseTask new + promise: self textualCoderViewModel addOns). aGtTextualCoderViewModelTextChanged source == self ifTrue: [ ^ self hideHighlighters ]. aGtTextualCoderViewModelTextChanged isSynchronous - ifTrue: [ self privateUpdateText: self announcement: aGtTextualCoderViewModelTextChanged ] + ifTrue: [ + self + privateUpdateText: self + announcement: aGtTextualCoderViewModelTextChanged ] ifFalse: [ textUpdater requestUpdate: aGtTextualCoderViewModelTextChanged ] ] +{ #category : #'private - event handling' } +GtTextualCoderEditorElement >> onViewModelTextEditCommandRequest: aGtTextualCoderViewModelTextEditCommandRequest [ + "This is sent by the view model on requests to change the text + in the editor by executing a command." + + aGtTextualCoderViewModelTextEditCommandRequest textEditCommand + applyOn: self editor +] + { #category : #'private - updating' } GtTextualCoderEditorElement >> privateUpdateCursors: anEditorElement announcement: aCursorsChangedAnnouncement [ @@ -389,6 +430,7 @@ GtTextualCoderEditorElement >> privateUpdateEditorState: anEditorState [ { #category : #'private - updating' } GtTextualCoderEditorElement >> privateUpdateText: anEditorElement announcement: aGtTextualCoderViewModelTextChanged [ + | textForUpdate | "Executed in a UI thread as a result of text being changed in the view model" "do nothing if it comes from a different view model" @@ -397,7 +439,10 @@ GtTextualCoderEditorElement >> privateUpdateText: anEditorElement announcement: GtTextualCoderEditorElementUpdateTextSignal emit. - self text: aGtTextualCoderViewModelTextChanged text copy. + "Determine the text that we should use to update the editor." + textForUpdate := self computeTextForUpdateForTextChangedEvent: aGtTextualCoderViewModelTextChanged. + + self text: textForUpdate. self hideHighlighters ] @@ -431,6 +476,9 @@ GtTextualCoderEditorElement >> registerCoderViewModelAnnouncementsFor: aGtSource when: GtTextualCoderViewModelTextChanged send: #onViewModelTextChanged: to: self; + when: GtTextualCoderViewModelTextEditCommandRequestAnnouncement + send: #onViewModelTextEditCommandRequest: + to: self; when: GtTextualCoderViewModelCursorsChanged send: #onViewModelCursorsChanged: to: self; diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index c7bd73743..767e4ecb8 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -111,6 +111,14 @@ GtTextualCoderViewModel >> addTextAttributes: aCollectionOfTextAttributes onText ^ newCoderTextAttributes ] +{ #category : #'api - text' } +GtTextualCoderViewModel >> applyTextEditCommand: aTextEditCommand [ + self announce: (GtTextualCoderViewModelTextEditCommandRequestAnnouncement new + textualCoderViewModel: self; + textEditCommand: aTextEditCommand"; + updateStrategy: GtCoderUpdateStrategy new makeAsynchronous") +] + { #category : #converting } GtTextualCoderViewModel >> asEditorState [ diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextChanged.class.st index 0e6d1aa30..b12f2ac87 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextChanged.class.st @@ -5,10 +5,16 @@ Class { 'text', 'updateStrategy' ], - #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' + #category : #'GToolkit-Coder-UI-Coder - Textual Model - Events' } -{ #category : #accessing } +{ #category : #testing } +GtTextualCoderViewModelTextChanged >> hasTextEditCommand [ + ^ self updateStrategy notNil and: [ + self updateStrategy hasTextEditCommand ] +] + +{ #category : #testing } GtTextualCoderViewModelTextChanged >> isSynchronous [ ^ self updateStrategy isSynchronous ] @@ -28,6 +34,12 @@ GtTextualCoderViewModelTextChanged >> text: anObject [ text := anObject ] +{ #category : #accessing } +GtTextualCoderViewModelTextChanged >> textEditCommand [ + ^ self updateStrategy ifNotNil: [ :anUpdateStrategy | + anUpdateStrategy textEditCommand ] +] + { #category : #accessing } GtTextualCoderViewModelTextChanged >> updateStrategy [ ^ updateStrategy diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextEditCommandRequestAnnouncement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextEditCommandRequestAnnouncement.class.st new file mode 100644 index 000000000..ba0d20afb --- /dev/null +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextEditCommandRequestAnnouncement.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtTextualCoderViewModelTextEditCommandRequestAnnouncement, + #superclass : #GtTextualCoderViewModelAnnouncement, + #instVars : [ + 'textEditCommand' + ], + #category : #'GToolkit-Coder-UI-Coder - Textual Model - Events' +} + +{ #category : #accessing } +GtTextualCoderViewModelTextEditCommandRequestAnnouncement >> textEditCommand [ + ^ textEditCommand +] + +{ #category : #accessing } +GtTextualCoderViewModelTextEditCommandRequestAnnouncement >> textEditCommand: anObject [ + textEditCommand := anObject +] diff --git a/src/GToolkit-Coder/GtCoderTextSource.class.st b/src/GToolkit-Coder/GtCoderTextSource.class.st index f5620e931..8b34a7d85 100644 --- a/src/GToolkit-Coder/GtCoderTextSource.class.st +++ b/src/GToolkit-Coder/GtCoderTextSource.class.st @@ -51,7 +51,9 @@ GtCoderTextSource >> currentSourceText [ GtCoderTextSource >> currentSourceText: aText [ "Set a new source text" - self critical: [ currentSourceText := GtCoderSourceText new text: aText copyWithoutExternalReferences ] + self critical: [ + currentSourceText := GtCoderSourceText new + text: aText copyWithoutExternalReferences ] ] { #category : #initialization } diff --git a/src/GToolkit-Coder/GtCoderUpdateStrategy.class.st b/src/GToolkit-Coder/GtCoderUpdateStrategy.class.st index 22642cd61..d4a0d8068 100644 --- a/src/GToolkit-Coder/GtCoderUpdateStrategy.class.st +++ b/src/GToolkit-Coder/GtCoderUpdateStrategy.class.st @@ -11,7 +11,8 @@ Class { #instVars : [ 'announcementSource', 'isSynchronous', - 'properties' + 'properties', + 'textEditCommand' ], #category : #'GToolkit-Coder-Coders' } @@ -34,6 +35,11 @@ GtCoderUpdateStrategy >> hasPropertyNamed: aPropertyName [ ^ self properties includesKey: aPropertyName ] +{ #category : #testing } +GtCoderUpdateStrategy >> hasTextEditCommand [ + ^ self textEditCommand notNil +] + { #category : #accessing } GtCoderUpdateStrategy >> isSynchronous [ ^ isSynchronous ifNil: [ false ] @@ -89,3 +95,13 @@ GtCoderUpdateStrategy >> source [ GtCoderUpdateStrategy >> source: anObject [ announcementSource := anObject ] + +{ #category : #accessing } +GtCoderUpdateStrategy >> textEditCommand [ + ^ textEditCommand +] + +{ #category : #accessing } +GtCoderUpdateStrategy >> textEditCommand: anObject [ + textEditCommand := anObject +] diff --git a/src/GToolkit-Coder/GtTextualCoder.class.st b/src/GToolkit-Coder/GtTextualCoder.class.st index 20a41b647..addfd5ef0 100644 --- a/src/GToolkit-Coder/GtTextualCoder.class.st +++ b/src/GToolkit-Coder/GtTextualCoder.class.st @@ -167,6 +167,15 @@ GtTextualCoder >> currentSourceText: aText with: aGtCoderUpdateStragegy dueTo: a dueTo: aReason ] ] +{ #category : #'api - text' } +GtTextualCoder >> currentSourceText: aText withEditCommand: anEditCommand [ + "Set a new source text, together with a command used to edit the text." + + self critical: [ + self sourceCode currentSourceText: aText. + self sourceChangedTo: aText withEditCommand: anEditCommand ] +] + { #category : #'api - text' } GtTextualCoder >> currentSourceTextPromise [ @@ -180,7 +189,10 @@ GtTextualCoder >> currentSourceTextSynchronously: aText [ self critical: [ self sourceCode currentSourceText: aText. - self sourceChangedTo: aText with: GtCoderUpdateStrategy new makeSynchronous ] + self + sourceChangedTo: aText + with: GtCoderUpdateStrategy new + makeSynchronous ] ] { #category : #'api - text' } @@ -278,9 +290,9 @@ GtTextualCoder >> resetAstCache [ { #category : #'event handling' } GtTextualCoder >> sourceChangedTo: aNewText [ - self + self sourceChangedTo: aNewText - with: GtCoderUpdateStrategy new makeAsynchronous + withEditCommand: nil ] { #category : #'event handling' } @@ -302,6 +314,15 @@ GtTextualCoder >> sourceChangedTo: aNewText with: anUpdateStrategy [ dueTo: nil ] +{ #category : #'event handling' } +GtTextualCoder >> sourceChangedTo: aNewText withEditCommand: anEditCommand [ + self + sourceChangedTo: aNewText + with: (GtCoderUpdateStrategy new + makeAsynchronous; + textEditCommand: anEditCommand) +] + { #category : #'api - accessing' } GtTextualCoder >> sourceCode [ From ae7ae2672071ad758602dd0973cd9ffab0d32fd1 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 24 Mar 2023 19:54:48 -0600 Subject: [PATCH 0472/1268] use new implementation of Magritte accept and cancel action customizations [feenkcom/gtoolkit#3172] --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 70 +++++++------------ 1 file changed, 27 insertions(+), 43 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index 977fd951e..6aa36a912 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -25,58 +25,15 @@ GtCreationForm class >> priority [ ^ self subclassResponsibility ] -{ #category : #magritte } -GtCreationForm >> acceptAction [ - - ^ MAActionDescription new - label: 'Accept'; - action: [ :aModel :aButton | - aButton - inUIProcessDo: [ [ | aValue | - aValue := self commit. - onAccept ifNotNil: [ onAccept value: aValue ] ] on: Error do: #debug ] ]; - beCommitAction -] - { #category : #converting } GtCreationForm >> asElement [ | viewModel | viewModel := self asGtMagritteViewModel. self onElementCreated ifNotNil: [ :aCallback | viewModel onElementCreated: aCallback ]. - "save and cancel actions should be available even if unchanged" - viewModel actions first - installOn: [ :aModel :aButton :aMemento | - aButton - withAsyncSinkDo: [ :anElementSink | - anElementSink - sink: AsyncPeekSink new; - whenUpdate: [ :theButton :aSink | - | aStatus | - aStatus := aSink value. - theButton enabled: aStatus isValid ]. - aMemento overallStatus observe: anElementSink ] ]. - viewModel actions second - installOn: [ :aModel :aButton :aMemento | - aButton - withAsyncSinkDo: [ :anElementSink | - anElementSink - sink: AsyncPeekSink new; - whenUpdate: [ :theButton :aSink | - theButton enabled: true ]. - aMemento overallStatus observe: anElementSink ] ]. ^ viewModel asElement ] -{ #category : #magritte } -GtCreationForm >> cancelAction [ - - ^ MAActionDescription new - label: 'Reset'; - action: [ :aModel :aButton | [ onReset ifNotNil: [ onReset value ] ] on: Error do: #debug ]; - beResetAction -] - { #category : #callbacks } GtCreationForm >> commit [ ^ self subclassResponsibility @@ -114,6 +71,33 @@ GtCreationForm >> initialize [ packageAndTagName := GtPackageAndTagName new ] +{ #category : #magritte } +GtCreationForm >> magritteAcceptAction [ + + ^ super magritteAcceptAction + label: 'Create'; + onSuccessCallback: (GtMagritteActionExecutor new + beInUIProcess; + action: [ :aModel :aButton :aMemento :aDescription | + [ | aClass | + aClass := self commit. + onAccept ifNotNil: [ onAccept value: aClass ] ] + on: Error do: #debug ]); + beEnabledOnValidOverallStatus +] + +{ #category : #magritte } +GtCreationForm >> magritteCancelAction [ + + ^ super magritteCancelAction + onSuccessCallback: (GtMagritteActionExecutor new + beInUIProcess; + action: [ :aModel :aButton :aMemento :aDescription | + [ onReset ifNotNil: [ onReset value ] ] + on: Error do: #debug ]); + beAlwaysEnabled +] + { #category : #accessing } GtCreationForm >> onAccept [ From c6c15bdc50e00ab306bffaafb72b8d98c3569657 Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Sat, 25 Mar 2023 09:00:35 +0100 Subject: [PATCH 0473/1268] make coder snippet show vFitContentLimited feenkcom/gtoolkit#3174 --- src/GToolkit-Coder-Extensions/GtCoderModel.extension.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-Extensions/GtCoderModel.extension.st b/src/GToolkit-Coder-Extensions/GtCoderModel.extension.st index 6e235777a..3855beb0e 100644 --- a/src/GToolkit-Coder-Extensions/GtCoderModel.extension.st +++ b/src/GToolkit-Coder-Extensions/GtCoderModel.extension.st @@ -22,7 +22,7 @@ GtCoderModel >> gtLiveFor: aView [ ^ aView explicit title: 'Live'; priority: 5; - stencil: [ self asElement matchParent ] + stencil: [ self asElement vFitContentLimited ] ] { #category : #'*GToolkit-Coder-Extensions' } From 05ed3e8062f522f7b66d5a669bf0b5fc47375a87 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Sat, 25 Mar 2023 18:56:52 -0600 Subject: [PATCH 0474/1268] code cleaning [feenkcom/gtoolkit#3172] Refactor code that writes new values to memento into one place. Configure future to easily identify them in Monitor Future Workers. --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 52 +++++++++++-------- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index 6aa36a912..470e5456c 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -223,34 +223,44 @@ GtCreationForm >> taggerStencilWithCompletion: aCompletionStrategy andContextMen aTagger when: BrTaggerAddTagRequest do: [ :aRequest | - aTagger - enqueueTask: (BlPromiseTask new - promise: (aMemento - write: ((aTagger tags collect: #name) - add: aRequest tag name; - yourself) - using: aDescription) asAsyncPromise) ]. + | aValue | + aValue := (aTagger tags collect: #name) + add: aRequest tag name; + yourself. + + GtMagritteBuilderUtility + write: aValue + using: aDescription + memento: aMemento + element: aTagger ]. aTagger when: BrTaggerRenameTagRequest do: [ :aRequest | (aRequest tag name = aRequest newName) not - ifTrue: [ aTagger - enqueueTask: (BlPromiseTask new - promise: (aMemento - write: ((aTagger tags collect: #name) - replaceAll: aRequest tag name with: aRequest newName; - yourself) - using: aDescription) asAsyncPromise) ] ]. + ifTrue: [ + | aValue | + aValue := (aTagger tags collect: #name) + replaceAll: aRequest tag name with: aRequest newName; + yourself. + + GtMagritteBuilderUtility + write: aValue + using: aDescription + memento: aMemento + element: aTagger ] ]. aTagger when: BrTaggerRemoveTagRequest do: [ :aRequest | - aTagger - enqueueTask: (BlPromiseTask new - promise: (aMemento - write: ((aTagger tags collect: #name) - remove: aRequest tag name; - yourself) - using: aDescription) asAsyncPromise) ]. + | aValue | + aValue := (aTagger tags collect: #name) + remove: aRequest tag name; + yourself. + + GtMagritteBuilderUtility + write: aValue + using: aDescription + memento: aMemento + element: aTagger ]. aTagger withAsyncSinkDo: [ :anElementSink | anElementSink From 9fdb1efc94968322dafcdd8783e820428598811e Mon Sep 17 00:00:00 2001 From: Andrei Chis Date: Mon, 27 Mar 2023 14:41:29 +0200 Subject: [PATCH 0475/1268] Do not set the previous text as `self` [feenkcom/gtoolkit#2503] --- src/GToolkit-Coder/GtTextualCoder.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder/GtTextualCoder.class.st b/src/GToolkit-Coder/GtTextualCoder.class.st index addfd5ef0..bb1873487 100644 --- a/src/GToolkit-Coder/GtTextualCoder.class.st +++ b/src/GToolkit-Coder/GtTextualCoder.class.st @@ -309,7 +309,7 @@ GtTextualCoder >> sourceChangedTo: aNewText from: aPreviousText with: anUpdateSt GtTextualCoder >> sourceChangedTo: aNewText with: anUpdateStrategy [ self sourceChangedTo: aNewText - from: self + from: nil with: anUpdateStrategy dueTo: nil ] From a21387bc8ac42f00d1a518da3d8ab6d06681dc99 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Mon, 27 Mar 2023 15:01:20 +0200 Subject: [PATCH 0476/1268] Ensure we are always in the UI process when handling announcements related to classes and packages from the elements --- ...erNavigationClassHierarchyElement.class.st | 33 +++++++++++-------- .../GtCoderNavigationElement.class.st | 13 ++++---- ...igationPackagesTagsClassesElement.class.st | 24 ++++++++------ .../GtCoderPlaygroundElement.class.st | 6 ++-- 4 files changed, 43 insertions(+), 33 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st index 13b1b0128..2f5efbdba 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st @@ -32,19 +32,21 @@ GtCoderNavigationClassHierarchyElement >> onClassModified: anAnnouncement [ GtCoderNavigationClassHierarchyElement >> onClassRemoved: anAnnouncement [ | newSelection | newSelection := anAnnouncement theClass superclass. - self updateClassListsWith: newSelection. - self selectClass: newSelection + self + inUIProcessDo: [ self updateClassListsWith: newSelection. + self selectClass: newSelection ] ] { #category : #subscriptions } GtCoderNavigationClassHierarchyElement >> onClassRenamed: anAnnouncement [ self - suppressListChangeEventsDuring: [ self - renameClass: anAnnouncement theClass - oldName: anAnnouncement oldName - newName: anAnnouncement newName - inPackage: anAnnouncement package - tag: anAnnouncement tag ] + inUIProcessDo: [ self + suppressListChangeEventsDuring: [ self + renameClass: anAnnouncement theClass + oldName: anAnnouncement oldName + newName: anAnnouncement newName + inPackage: anAnnouncement package + tag: anAnnouncement tag ] ] ] { #category : #'event handling' } @@ -56,22 +58,25 @@ GtCoderNavigationClassHierarchyElement >> onClassSelected: anAnnouncement [ { #category : #'event handling' } GtCoderNavigationClassHierarchyElement >> onPackageSelected: anAnnouncer [ self - suppressListChangeEventsDuring: [ self emptyClassList. - self deselectClasses ] + inUIProcessDo: [ self + suppressListChangeEventsDuring: [ self emptyClassList. + self deselectClasses ] ] ] { #category : #'event handling' } GtCoderNavigationClassHierarchyElement >> onPackageTagSelected: anAnnouncer [ self - suppressListChangeEventsDuring: [ self emptyClassList. - self deselectClasses ] + inUIProcessDo: [ self + suppressListChangeEventsDuring: [ self emptyClassList. + self deselectClasses ] ] ] { #category : #'event handling' } GtCoderNavigationClassHierarchyElement >> onPackagesSelected: anAnnouncer [ self - suppressListChangeEventsDuring: [ self emptyClassList. - self deselectClasses ] + inUIProcessDo: [ self + suppressListChangeEventsDuring: [ self emptyClassList. + self deselectClasses ] ] ] { #category : #subscriptions } diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st index 23b8f3619..3536c757f 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st @@ -120,12 +120,13 @@ GtCoderNavigationElement >> onClassRemoved: anAnnouncement [ { #category : #'event handling' } GtCoderNavigationElement >> onClassRenamed: anAnnouncement [ self - suppressListChangeEventsDuring: [ self - renameClass: anAnnouncement theClass - oldName: anAnnouncement oldName - newName: anAnnouncement newName - inPackage: anAnnouncement package - tag: anAnnouncement tag ] + inUIProcessDo: [ self + suppressListChangeEventsDuring: [ self + renameClass: anAnnouncement theClass + oldName: anAnnouncement oldName + newName: anAnnouncement newName + inPackage: anAnnouncement package + tag: anAnnouncement tag ] ] ] { #category : #'event handling' } diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index f233326db..f9b0a39ea 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -384,9 +384,10 @@ GtCoderNavigationPackagesTagsClassesElement >> methodProtocolsList [ { #category : #accessing } GtCoderNavigationPackagesTagsClassesElement >> onClassRemoved: anAnnouncement [ | aPackageOrTag | - aPackageOrTag := self selectedPackageOrTag. - packagesList deselectAll. - self selectPackage: aPackageOrTag + self + inUIProcessDo: [ aPackageOrTag := self selectedPackageOrTag. + packagesList deselectAll. + self selectPackage: aPackageOrTag ] ] { #category : #accessing } @@ -468,9 +469,10 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackageRenamed: anAnnouncement { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageSelected: anAnnouncer [ self - suppressListChangeEventsDuring: [ self selectPackage: anAnnouncer package. - self showClassList. - self deselectClasses ] + inUIProcessDo: [ self + suppressListChangeEventsDuring: [ self selectPackage: anAnnouncer package. + self showClassList. + self deselectClasses ] ] ] { #category : #'event handling' } @@ -488,8 +490,9 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackageTagRemoved: anAnnounceme { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageTagSelected: anAnnouncer [ self - suppressListChangeEventsDuring: [ self selectPackage: anAnnouncer package tag: anAnnouncer tag. - self deselectClasses ] + inUIProcessDo: [ self + suppressListChangeEventsDuring: [ self selectPackage: anAnnouncer package tag: anAnnouncer tag. + self deselectClasses ] ] ] { #category : #'event handling' } @@ -501,8 +504,9 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackageUnregistered: anAnnounce { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackagesSelected: anAnnouncer [ self - suppressListChangeEventsDuring: [ self deselectPackages. - self deselectClasses ] + inUIProcessDo: [ self + suppressListChangeEventsDuring: [ self deselectPackages. + self deselectClasses ] ] ] { #category : #'event handling' } diff --git a/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st b/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st index 98063554d..68d3183ce 100644 --- a/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st @@ -73,17 +73,17 @@ GtCoderPlaygroundElement >> onNavigationModelChanged [ { #category : #'private - hooks' } GtCoderPlaygroundElement >> onPackageSelected: anEvent [ - self updatePlayground + self inUIProcessDo: [ self updatePlayground ] ] { #category : #'private - hooks' } GtCoderPlaygroundElement >> onPackageTagSelected: anEvent [ - self updatePlayground + self inUIProcessDo: [ self updatePlayground ] ] { #category : #'private - hooks' } GtCoderPlaygroundElement >> onPackagesSelected: anEvent [ - self updatePlayground + self inUIProcessDo: [ self updatePlayground ] ] { #category : #'private - accessing' } From 60b785c34f8dd572cf53ad91ac49777fc11d49ee Mon Sep 17 00:00:00 2001 From: Andrei Chis Date: Mon, 27 Mar 2023 15:25:21 +0200 Subject: [PATCH 0477/1268] Dummy change --- src/GToolkit-Coder/GtTextualCoder.class.st | 1 + 1 file changed, 1 insertion(+) diff --git a/src/GToolkit-Coder/GtTextualCoder.class.st b/src/GToolkit-Coder/GtTextualCoder.class.st index bb1873487..fb29e3181 100644 --- a/src/GToolkit-Coder/GtTextualCoder.class.st +++ b/src/GToolkit-Coder/GtTextualCoder.class.st @@ -307,6 +307,7 @@ GtTextualCoder >> sourceChangedTo: aNewText from: aPreviousText with: anUpdateSt { #category : #'event handling' } GtTextualCoder >> sourceChangedTo: aNewText with: anUpdateStrategy [ + self sourceChangedTo: aNewText from: nil From 3ed1628c472ce6b9d04d1f712d542ade807e98e1 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 27 Mar 2023 09:54:38 -0600 Subject: [PATCH 0478/1268] use `GtMagritteCallback` [feenkcom/gtoolkit#3176] --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index 470e5456c..9e3bb65a3 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -76,8 +76,7 @@ GtCreationForm >> magritteAcceptAction [ ^ super magritteAcceptAction label: 'Create'; - onSuccessCallback: (GtMagritteActionExecutor new - beInUIProcess; + onSuccessCallback: (GtMagritteCallback new action: [ :aModel :aButton :aMemento :aDescription | [ | aClass | aClass := self commit. @@ -90,8 +89,7 @@ GtCreationForm >> magritteAcceptAction [ GtCreationForm >> magritteCancelAction [ ^ super magritteCancelAction - onSuccessCallback: (GtMagritteActionExecutor new - beInUIProcess; + onSuccessCallback: (GtMagritteCallback new action: [ :aModel :aButton :aMemento :aDescription | [ onReset ifNotNil: [ onReset value ] ] on: Error do: #debug ]); From 582037d2bfac0c155dc5b3410d2596c50b32c9d3 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Mon, 27 Mar 2023 11:12:39 -0500 Subject: [PATCH 0479/1268] Ghost text for new method popup [feenkcom/gtoolkit#3063] --- .../GtSourceCoderExpandedContentElement.class.st | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st index 08924ef17..34ce44d43 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st @@ -9,6 +9,11 @@ Class { #category : #'GToolkit-Coder-UI-Coder - Source' } +{ #category : #accessing } +GtSourceCoderExpandedContentElement >> actions [ + ^ actions +] + { #category : #initialization } GtSourceCoderExpandedContentElement >> initialize [ super initialize. From 84c440ba08227956fcae2eae2c5ae8b3b2fa68b0 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 28 Mar 2023 09:09:32 -0500 Subject: [PATCH 0480/1268] Refactor new method dropdown and move to appropriate package [feenkcom/gtoolkit#3063] --- src/GToolkit-Coder-UI/Behavior.extension.st | 131 ++++++++++++++++++++ 1 file changed, 131 insertions(+) diff --git a/src/GToolkit-Coder-UI/Behavior.extension.st b/src/GToolkit-Coder-UI/Behavior.extension.st index 7e3b554ab..cc2abd9bd 100644 --- a/src/GToolkit-Coder-UI/Behavior.extension.st +++ b/src/GToolkit-Coder-UI/Behavior.extension.st @@ -11,6 +11,83 @@ Behavior >> gtBrowseButtonFor: anAction [ action: [ :aButton | self gtBrowseFromButton: aButton ] ] +{ #category : #'*GToolkit-Coder-UI' } +Behavior >> gtCoderStreamingMethodsFor: aView context: aPhlowContext [ + + | aMethodsCoder aMethodsCoderViewModel aTestSuiteViewModel anExampleViewModel view | + aMethodsCoder := GtPharoStreamingMethodsCoder forBehavior: self. + aMethodsCoderViewModel := GtPharoStreamingMethodsCoderViewModel new + streamingCodersModel: aMethodsCoder; + shouldExpandByDefault: false; + shouldHaveHeaderByDefault: false; + selfObject: (aPhlowContext + optionAt: #behaviorCoder + ifPresent: [ :aBehaviorCoderUIModel | aBehaviorCoderUIModel coderModel object ] + ifAbsent: [ nil ]). + + aTestSuiteViewModel := self + testSuiteViewModelWith: aMethodsCoder + fromContext: aPhlowContext. + + anExampleViewModel := GtPharoCoderUIUtility + exampleViewModelCachedAs: #exampleViewModelHandler_gtCoderStreamingMethodsForContext + inPhlowContext: aPhlowContext + forMethodsCoder: aMethodsCoder. + + + view := aView explicit + priority: 9; + title: 'Methods'; + disableAsync; + actionDropdownButtonIcon: BrGlamorousVectorIcons filter + tooltip: 'Filter' + content: [ :element | aMethodsCoder filterDropDown: element ]; + actionDropdownButtonDo: [ :aDrodownAction | + aDrodownAction dropdown + name: GtPharoBehaviorCoder addNewMethodButtonName; + icon: BrGlamorousVectorIcons add; + tooltip: 'Add new method'; + content: [ :aButton | self gtNewMethodDropdownOn: aButton withViewModel: aMethodsCoderViewModel ] ]. + + (aMethodsCoder codeGeneratorsAvailableFor: aMethodsCoderViewModel) + ifTrue: [ view + actionDropdownButtonIcon: BrGlamorousVectorIcons robot + tooltip: 'Generate' + content: [ :anElement | aMethodsCoder codeGeneratorsDropDown: anElement for: aMethodsCoderViewModel ] ]. + ^ view + actionButtonDo: [ :aButtonAction | + aButtonAction + icon: BrGlamorousVectorIcons inspect; + tooltip: 'Inspect view model'; + action: [ :aButton | aButton phlow spawnObject: aMethodsCoderViewModel ] ]; + actionStencil: [ :aBrTab | GtPharoCoderUIUtility newExamplesDropdownButtonForViewModel: anExampleViewModel ]; + actionStencil: [ :aBrTab | GtPharoCoderUIUtility newTestsDropdownButtonForViewModel: aTestSuiteViewModel ]; + stencil: [ GtPharoStreamingMethodsCoderElement new + streamingCodersViewModel: aMethodsCoderViewModel ]; + actionStencil: [ :aButton | + GtSpotterDropdownButtonStencil new + object: self; + tooltip: 'Search Code'; + id: GtPharoSearchCodeButtonId; + actOn: [ :anActOnEvent :anItem :theButton | + | acted navigationModel | + acted := false. + navigationModel := theButton phlow firstParentWithView phlow + firstParentWithView navigationModel. + (anItem isKindOf: RPackage) + ifTrue: [ navigationModel selectPackage: anItem. + acted := true ]. + (anItem isKindOf: ClassDescription) + ifTrue: [ navigationModel selectClass: anItem. + acted := true ]. + (anItem isKindOf: CompiledMethod) + ifTrue: [ navigationModel selectMethod: anItem. + acted := true ]. + acted ifTrue: [ anActOnEvent beActed ] ]; + asElement ] + tooltip: 'Search Code' +] + { #category : #'*GToolkit-Coder-UI' } Behavior >> gtHierarchyButtonFor: anAction [ @@ -28,3 +105,57 @@ Behavior >> gtHierarchyButtonFor: anAction [ navigationModel: aNavigationModel; asElement) background: Color white) ] ] + +{ #category : #'*GToolkit-Coder-UI' } +Behavior >> gtNewMethodDropdownOn: aButton withViewModel: aMethodsCoderViewModel [ + | aNewMethodCoderHolder element aNewMethodCoderViewModel newMethodText aNewMethodCoder aHandler tagElement | + newMethodText := '' asRopedText + glamorousCodeFontAndSize; + attribute: (BrGhostTextAttribute + for: ('newMethod' asRopedText glamorousCodeFontAndSize foreground: Color lightGray)) + beNotOverwritableByStyler. + aNewMethodCoder := (GtPharoMethodCoder forNewMethod: self) + currentSourceText: newMethodText; + protocol: #accessing; + yourself. + aNewMethodCoderViewModel := aNewMethodCoder asCoderViewModel + withoutHeader; + expanded: true; + focused: true; + moveCursorAtEnd. + aNewMethodCoderHolder := ValueHolder new contents: aNewMethodCoderViewModel. + aHandler := GtPharoNewMethodCodeSavedHandler new + methodsCoderViewModel: aMethodsCoderViewModel; + element: aButton; + methodCoderHolder: aNewMethodCoderHolder. + aNewMethodCoderViewModel weak + when: GtMethodCoderSaved + send: #onAnnouncement: + to: aHandler. + element := (GtSourceCoderExpandedContentElement new + coderViewModel: aNewMethodCoderViewModel) + hExact: 400; + vFitContentLimited; + background: Color white; + addAptitude: BrGlamorousFocusableShadowAptitude new; + when: GtPhlowObjectToSpawn + do: [ :aSpawnEvent | + aSpawnEvent consumed: true. + aButton + fireEvent: (GtPhlowObjectToSpawn new + previousSpawnEvent: aSpawnEvent; + tool: aSpawnEvent tool; + sourceElement: aSpawnEvent currentTarget; + spawnDestination: aSpawnEvent spawnDestination; + in: [ :anNewEvent | anNewEvent propertyAt: #spawnContainer put: aSpawnEvent currentTarget ]; + yourself) ]. + tagElement := GtPharoMethodCoderTagsElement new + pharoMethodCoderViewModel: aNewMethodCoderViewModel; + constraintsDo: [ :c | + c ignoreByLayout. + c ignored horizontal alignRight. + c ignored vertical alignBottom. + c margin: (BlInsets bottom: -2) ]. + element actions addChild: tagElement. + ^ element +] From cdfa24311f417f66ad78d743cbb99e54eeff382a Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Tue, 28 Mar 2023 20:04:14 +0200 Subject: [PATCH 0481/1268] [feenkcom/gtoolkit#2920] rely on textualCoderViewModel when deciding if cursor change should be handled by textual coder --- src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st | 6 +++++- src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 487695ecd..d22c75ec8 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -279,7 +279,7 @@ GtTextualCoderEditorElement >> onViewModelCursorsChanged: aCursorsChangedAnnounc ifTrue: [ ^ self ]. "do nothing if it comes from a different view model" - aCursorsChangedAnnouncement source == self textualCoderViewModel + aCursorsChangedAnnouncement textualCoderViewModel == self textualCoderViewModel ifFalse: [ ^ self ]. "since it may be sent from a non-UI process make sure to wrap in the action" @@ -358,6 +358,10 @@ GtTextualCoderEditorElement >> onViewModelTextChanged: aGtTextualCoderViewModelT aGtTextualCoderViewModelTextChanged source == self ifTrue: [ ^ self hideHighlighters ]. + + "do nothing if it comes from a different view model" + aGtTextualCoderViewModelTextChanged textualCoderViewModel == self textualCoderViewModel + ifFalse: [ ^ self ]. aGtTextualCoderViewModelTextChanged isSynchronous ifTrue: [ self privateUpdateText: self announcement: aGtTextualCoderViewModelTextChanged ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index c7bd73743..fa570a68e 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -510,7 +510,10 @@ GtTextualCoderViewModel >> newCompletionStrategy [ { #category : #'private - notifying' } GtTextualCoderViewModel >> notifyCursorsChanged: aBrTextEditorCursor from: aSourceObject [ - self announce: (GtTextualCoderViewModelCursorsChanged new cursors: aBrTextEditorCursor; source: aSourceObject) + self announce: (GtTextualCoderViewModelCursorsChanged new + textualCoderViewModel: self; + cursors: aBrTextEditorCursor; + source: aSourceObject) ] { #category : #'private - notifying' } From 72181c268ae8147e5fe61823bcbf77a728b4a9bf Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Wed, 29 Mar 2023 16:09:03 +0200 Subject: [PATCH 0482/1268] Use editor in GtCreationForm tagger [feenkcom/gtoolkit#3185] --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 75 ++++++++----------- 1 file changed, 30 insertions(+), 45 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index 9e3bb65a3..4f2a14175 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -180,7 +180,7 @@ GtCreationForm >> taggerStencilWithCompletion: aCompletionStrategy andContextMen right: 5); tagLabel: [ :aTag | | aLabel | - aLabel := BrEditableLabel new + aLabel := BrEditor new text: (aDescription displayStringFor: aTag name); aptitude: (BrGlamorousEditableLabelAptitude new glamorousFormEditorCodeFontAndSize defaultForeground: Color black). @@ -190,74 +190,58 @@ GtCreationForm >> taggerStencilWithCompletion: aCompletionStrategy andContextMen aBlockReturningCollection value do: [ :aShortcut | aLabel addShortcut: aShortcut ] ]. - aLabel - when: BlClickEvent - do: [ :aClickEvent | - aLabel switchToEditor - addShortcut: (BlShortcutWithAction new - combination: BlKeyCombination shiftTab; - action: [ :anEvent | - BlFocusFinder new - direction: BlFocusSearchDirectionBackward new; - root: aForm; - referenceElement: anEvent currentTarget; - nextFocusDo: #requestFocus ifNone: [ ] ]); - addShortcut: (BlShortcutWithAction new - combination: BlKeyCombination tab; - action: [ :anEvent | - BlFocusFinder new - direction: BlFocusSearchDirectionForward new; - root: aForm; - referenceElement: anEvent currentTarget; - nextFocusDo: #requestFocus ifNone: [ ] ]) ]. - aCompletionStrategy ifNotNil: [ (GtCompletionController on: aLabel strategy: aCompletionStrategy) install ]. aContextMenuBlock ifNotNil: [ aLabel addAptitude: (BrGlamorousWithContextMenuAptitude - content: [ aContextMenuBlock value: aTag name value: aLabel value: aMemento]) ]. + content: [ aContextMenuBlock + value: aTag name + value: aLabel + value: aMemento ]) ]. aLabel ]). aTagger when: BrTaggerAddTagRequest do: [ :aRequest | | aValue | + aRequest currentTarget addTag: aRequest tag. aValue := (aTagger tags collect: #name) - add: aRequest tag name; - yourself. - + add: aRequest tag name; + yourself. + GtMagritteBuilderUtility - write: aValue - using: aDescription - memento: aMemento + write: aValue + using: aDescription + memento: aMemento element: aTagger ]. aTagger when: BrTaggerRenameTagRequest do: [ :aRequest | (aRequest tag name = aRequest newName) not - ifTrue: [ - | aValue | + ifTrue: [ | aValue | + aRequest currentTarget renameTag: aRequest tag to: aRequest newName. aValue := (aTagger tags collect: #name) - replaceAll: aRequest tag name with: aRequest newName; - yourself. - + replaceAll: aRequest tag name with: aRequest newName; + yourself. + GtMagritteBuilderUtility - write: aValue - using: aDescription - memento: aMemento + write: aValue + using: aDescription + memento: aMemento element: aTagger ] ]. aTagger when: BrTaggerRemoveTagRequest do: [ :aRequest | | aValue | aValue := (aTagger tags collect: #name) - remove: aRequest tag name; - yourself. - + remove: aRequest tag name; + yourself. + aRequest currentTarget removeTag: aRequest tag. + GtMagritteBuilderUtility - write: aValue - using: aDescription - memento: aMemento + write: aValue + using: aDescription + memento: aMemento element: aTagger ]. aTagger withAsyncSinkDo: [ :anElementSink | @@ -265,8 +249,9 @@ GtCreationForm >> taggerStencilWithCompletion: aCompletionStrategy andContextMen sink: AsyncPeekSink new; whenUpdate: [ :theTagger :aSink | | theValues | - theValues := aSink value currentValue. - theTagger namedTags: theValues ]. + (theTagger tags isEmpty or: [ aSink value isChanged not ]) + ifTrue: [ theValues := aSink value currentValue. + theTagger namedTags: theValues ] ]. (aMemento readObservableValueUsing: aDescription) observe: anElementSink ]. GtMagritteBuilderUtility newValidationContainerWith: aTagger From d5310e03690054da5249e2eef6fbb7740a136d50 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Wed, 29 Mar 2023 17:56:30 +0200 Subject: [PATCH 0483/1268] Re-add navigation with tab [feenkcom/gtoolkit#3185] --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index 4f2a14175..d21cc2fb3 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -183,7 +183,27 @@ GtCreationForm >> taggerStencilWithCompletion: aCompletionStrategy andContextMen aLabel := BrEditor new text: (aDescription displayStringFor: aTag name); aptitude: (BrGlamorousEditableLabelAptitude new glamorousFormEditorCodeFontAndSize - defaultForeground: Color black). + defaultForeground: Color black); + addShortcut: (BlShortcutWithAction new + name: 'Move to previous form item'; + description: 'Moves to the previous form item. If none is found, we cycle back to the last.'; + combination: BlKeyCombination shiftTab; + action: [ :anEvent | + BlFocusFinder new + direction: BlFocusSearchDirectionBackward new; + root: aForm; + referenceElement: anEvent currentTarget; + nextFocusDo: #requestFocus ifNone: [ ] ]); + addShortcut: (BlShortcutWithAction new + name: 'Move to next form item'; + description: 'Moves to the next form item. If none is found, we cycle back to the first.'; + combination: BlKeyCombination tab; + action: [ :anEvent | + BlFocusFinder new + direction: BlFocusSearchDirectionForward new; + root: aForm; + referenceElement: anEvent currentTarget; + nextFocusDo: #requestFocus ifNone: [ ] ]). aDescription blocShortcuts ifNotNil: [ :aBlockReturningCollection | From 261d24f85568b58057097740fd96580d8416fb0f Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Wed, 29 Mar 2023 22:02:17 +0200 Subject: [PATCH 0484/1268] Ensure the tagger editor is fitContent [feenckom/gtoolkit#3195] --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index d21cc2fb3..00ebd8fbe 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -180,7 +180,7 @@ GtCreationForm >> taggerStencilWithCompletion: aCompletionStrategy andContextMen right: 5); tagLabel: [ :aTag | | aLabel | - aLabel := BrEditor new + aLabel := BrEditor new fitContent text: (aDescription displayStringFor: aTag name); aptitude: (BrGlamorousEditableLabelAptitude new glamorousFormEditorCodeFontAndSize defaultForeground: Color black); From 2cdfc78944301d83589e80ae93f6d99310f78f64 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 30 Mar 2023 06:44:37 -0500 Subject: [PATCH 0485/1268] Add references to class context menu on index [feenkcom/gtoolkit#3197] --- ...GtCoderNavigationClassesHierarchyTreeElement.class.st | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st index c9e8a5d78..dd2982c00 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st @@ -19,6 +19,11 @@ GtCoderNavigationClassesHierarchyTreeElement class >> fromClasses: aCollectionOf ^ self new initializeWithClasses: aCollectionOfClasses ] +{ #category : #initialization } +GtCoderNavigationClassesHierarchyTreeElement >> browseReferencesTo: aClass [ + self phlow spawnObject: (aClass gtReferences) +] + { #category : #initialization } GtCoderNavigationClassesHierarchyTreeElement >> buildRemoveClassLabelFor: aClass [ | labelText | @@ -36,7 +41,9 @@ GtCoderNavigationClassesHierarchyTreeElement >> buildRemoveClassLabelFor: aClass { #category : #initialization } GtCoderNavigationClassesHierarchyTreeElement >> contextMenuItemsFor: aClass [ - ^ {(self createLabel: 'New Subclass' description: aClass name) + ^ {(self createLabel: 'Browse references' description: aClass name) + -> [ :elem | self browseReferencesTo: aClass ]. + (self createLabel: 'New Subclass' description: aClass name) -> [ :elem | self newSubclassOf: aClass ]. (self createLabel: 'Rename class' description: aClass name) -> [ :elem | self renameClass: aClass inElement: elem ]. From 39f363a9b53968fba372e8296fe07225fdc21a9c Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Thu, 30 Mar 2023 19:40:32 +0200 Subject: [PATCH 0486/1268] Simplify tagger state handling in creation forms [gtoolkit/feenkcom#3185] --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index 00ebd8fbe..a9c9303e6 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -225,12 +225,10 @@ GtCreationForm >> taggerStencilWithCompletion: aCompletionStrategy andContextMen do: [ :aRequest | | aValue | aRequest currentTarget addTag: aRequest tag. - aValue := (aTagger tags collect: #name) - add: aRequest tag name; - yourself. + aValue := aTagger tags collect: #name. GtMagritteBuilderUtility - write: aValue + write: aValue asArray using: aDescription memento: aMemento element: aTagger ]. @@ -240,12 +238,10 @@ GtCreationForm >> taggerStencilWithCompletion: aCompletionStrategy andContextMen (aRequest tag name = aRequest newName) not ifTrue: [ | aValue | aRequest currentTarget renameTag: aRequest tag to: aRequest newName. - aValue := (aTagger tags collect: #name) - replaceAll: aRequest tag name with: aRequest newName; - yourself. + aValue := aTagger tags collect: #name. GtMagritteBuilderUtility - write: aValue + write: aValue asArray using: aDescription memento: aMemento element: aTagger ] ]. @@ -253,13 +249,11 @@ GtCreationForm >> taggerStencilWithCompletion: aCompletionStrategy andContextMen when: BrTaggerRemoveTagRequest do: [ :aRequest | | aValue | - aValue := (aTagger tags collect: #name) - remove: aRequest tag name; - yourself. aRequest currentTarget removeTag: aRequest tag. + aValue := aTagger tags collect: #name. GtMagritteBuilderUtility - write: aValue + write: aValue asArray using: aDescription memento: aMemento element: aTagger ]. From cda1452c316240c7510b3bf26e333ae562e883dd Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 31 Mar 2023 18:15:17 -0500 Subject: [PATCH 0487/1268] Add menu item for slot references [feenkcom/gtoolkit#3196] --- ...igationPackagesTagsClassesElement.class.st | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index f9b0a39ea..a3b9ead99 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -65,6 +65,14 @@ GtCoderNavigationPackagesTagsClassesElement >> browseReferencesOf: aSymbol [ self phlow spawnObject: (GtSearchReferencesFilter literal: aSymbol) ] +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> browseSlotReferencesFor: aString [ + self phlow + spawnObject: (GtSearchInstanceSlotReferenceFilter + forClassAndSubclasses: self selectedClass + andVariable: aString) +] + { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> buildCategorySlotTabs [ | aTabGroup | @@ -850,7 +858,9 @@ GtCoderNavigationPackagesTagsClassesElement >> showClassList [ { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> slotListContextMenuItemsFor: item [ - ^ {(self createLabel: 'Push up ' description: item name) + ^ {(self createLabel: 'Browse references' description: item name) + -> [ :elem | self browseSlotReferencesFor: item name ]. + (self createLabel: 'Push up' description: item name) -> [ :elem | | refactoring | refactoring := RBPullUpInstanceVariableRefactoring @@ -860,7 +870,7 @@ GtCoderNavigationPackagesTagsClassesElement >> slotListContextMenuItemsFor: item addPreviewButtonFor: refactoring to: elem cancelSelector: #updateProtocolList ]. - (self createLabel: 'Push down ' description: item name) + (self createLabel: 'Push down' description: item name) -> [ :elem | | refactoring | refactoring := RBPushDownInstanceVariableRefactoring @@ -870,7 +880,7 @@ GtCoderNavigationPackagesTagsClassesElement >> slotListContextMenuItemsFor: item addPreviewButtonFor: refactoring to: elem cancelSelector: #updateProtocolList ]. - (self createLabel: 'Create accessors for ' description: item name) + (self createLabel: 'Create accessors' description: item name) -> [ :elem | | refactoring | refactoring := RBCreateAccessorsForVariableRefactoring @@ -880,7 +890,7 @@ GtCoderNavigationPackagesTagsClassesElement >> slotListContextMenuItemsFor: item addPreviewButtonFor: refactoring to: elem cancelSelector: #updateProtocolList ]. - (self createLabel: 'Abstract ' description: item name) + (self createLabel: 'Abstract' description: item name) -> [ :elem | | refactoring | refactoring := RBAbstractInstanceVariableRefactoring @@ -890,7 +900,7 @@ GtCoderNavigationPackagesTagsClassesElement >> slotListContextMenuItemsFor: item addPreviewButtonFor: refactoring to: elem cancelSelector: #updateProtocolList ]. - (self createLabel: 'Protect ' description: item name) + (self createLabel: 'Protect' description: item name) -> [ :elem | | refactoring | refactoring := RBProtectInstanceVariableRefactoring @@ -900,7 +910,7 @@ GtCoderNavigationPackagesTagsClassesElement >> slotListContextMenuItemsFor: item addPreviewButtonFor: refactoring to: elem cancelSelector: #updateProtocolList ]. - (self createLabel: 'Remove ' description: item name) + (self createLabel: 'Remove' description: item name) -> [ :elem | | refactoring | refactoring := RBRemoveInstanceVariableRefactoring From aaef54f189d75c9d9d366293623858cacd5c77d6 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Mon, 3 Apr 2023 20:03:19 +0200 Subject: [PATCH 0488/1268] Ensure Enter leads to accept in tagger [feenkcom/gtoolkit#3208] --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index a9c9303e6..299869405 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -197,7 +197,7 @@ GtCreationForm >> taggerStencilWithCompletion: aCompletionStrategy andContextMen addShortcut: (BlShortcutWithAction new name: 'Move to next form item'; description: 'Moves to the next form item. If none is found, we cycle back to the first.'; - combination: BlKeyCombination tab; + combination: (BlKeyCombination tab or: BlKeyCombination enter); action: [ :anEvent | BlFocusFinder new direction: BlFocusSearchDirectionForward new; From 7aa8f9f343cae69f197a0796990e7bd646334aa8 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 4 Apr 2023 08:34:34 -0500 Subject: [PATCH 0489/1268] Make class tree retain expansion on selection [feenkcom/gtoolkit#3187] --- ...avigationClassesHierarchyTreeElement.class.st | 16 +++++----------- ...NavigationPackagesTagsClassesElement.class.st | 2 ++ .../GtCoderClassesHierarchyTree.class.st | 16 ++++++++++++++-- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st index dd2982c00..569c3832c 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st @@ -51,15 +51,6 @@ GtCoderNavigationClassesHierarchyTreeElement >> contextMenuItemsFor: aClass [ -> [ :elem | self removeClass: aClass inElement: elem ]} ] -{ #category : #'private - ui' } -GtCoderNavigationClassesHierarchyTreeElement >> expandClass: aClass [ - | aClassDepth | - aClassDepth := 0. - aClass - allSuperclassesDo: [ :eachClass | aClassDepth := aClassDepth + 1 ]. - self expandUpTo: aClassDepth + 1 -] - { #category : #initialization } GtCoderNavigationClassesHierarchyTreeElement >> initialize [ super initialize. @@ -98,8 +89,11 @@ GtCoderNavigationClassesHierarchyTreeElement >> initialize [ { #category : #'api - initialization' } GtCoderNavigationClassesHierarchyTreeElement >> initializeWithClasses: aCollectionOfClasses [ - classesTree := (GtCoderClassesHierarchyTree - fromClasses: aCollectionOfClasses) sortByClassName. + | newTree | + newTree := (GtCoderClassesHierarchyTree fromClasses: aCollectionOfClasses) + sortByClassName. + newTree = classesTree ifTrue: [ ^ self ]. + classesTree := newTree. self items: classesTree subclassTrees lazy: [ :eachTree | eachTree subclassTrees ]. diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index a3b9ead99..95f35d876 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -754,6 +754,7 @@ GtCoderNavigationPackagesTagsClassesElement >> selectClass: aClass inPackage: aP (self selectedPackage ~= aPackage or: [ self selectedPackageTag ~= aPackageTag ]) ifTrue: [ self selectPackage: aPackage tag: aPackageTag ]. + self selectClass: aClass. self updateProtocolList. self updateSlotList @@ -980,6 +981,7 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToSlotList [ { #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updateClassLists [ self hasNavigationModel ifFalse: [ ^ self ]. + self haltOnce. classesList initializeWithClasses: navigationModel classesToShow. self updateProtocolList. self updateSlotList diff --git a/src/GToolkit-Coder/GtCoderClassesHierarchyTree.class.st b/src/GToolkit-Coder/GtCoderClassesHierarchyTree.class.st index 62b77894c..39e7c5be1 100644 --- a/src/GToolkit-Coder/GtCoderClassesHierarchyTree.class.st +++ b/src/GToolkit-Coder/GtCoderClassesHierarchyTree.class.st @@ -19,13 +19,13 @@ Class { GtCoderClassesHierarchyTree class >> fromClasses: aCollectionOfClasses [ | aRootItem theSetOfClasses classToTree | - aRootItem := GtCoderClassesHierarchyTree new. + aRootItem := self new. theSetOfClasses := aCollectionOfClasses asSet. classToTree := Dictionary new. theSetOfClasses do: [ :each | classToTree at: each - put: (GtCoderClassesHierarchyTree new rootClass: each) ]. + put: (self new rootClass: each) ]. theSetOfClasses do: [ :each | classToTree at: each superclass @@ -50,6 +50,13 @@ GtCoderClassesHierarchyTree class >> hierarchyForClass: aClass [ ^ aRootNode. ] +{ #category : #comparing } +GtCoderClassesHierarchyTree >> = anObject [ + ^ anObject class = self class + and: [ self rootClass = anObject rootClass + and: [ self subclassTrees = anObject subclassTrees ] ] +] + { #category : #accessing } GtCoderClassesHierarchyTree >> at: anIndex [ @@ -90,6 +97,11 @@ GtCoderClassesHierarchyTree >> hasRootClass [ ^ rootClass isNotNil ] +{ #category : #comparing } +GtCoderClassesHierarchyTree >> hash [ + ^ self rootClass hash bitXor: self subclassTrees hash +] + { #category : #initialization } GtCoderClassesHierarchyTree >> initialize [ super initialize. From ac88cbfa048300e37aa09c85ac519676c96e9774 Mon Sep 17 00:00:00 2001 From: Alistair Grant Date: Tue, 4 Apr 2023 17:36:57 +0200 Subject: [PATCH 0490/1268] Remove haltOnce. --- .../GtCoderNavigationPackagesTagsClassesElement.class.st | 1 - 1 file changed, 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 95f35d876..6ba7bb7c7 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -981,7 +981,6 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToSlotList [ { #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updateClassLists [ self hasNavigationModel ifFalse: [ ^ self ]. - self haltOnce. classesList initializeWithClasses: navigationModel classesToShow. self updateProtocolList. self updateSlotList From 4dc95b0e4e1790196eebee8fcfb9c90d8fcbcb6f Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 6 Apr 2023 09:21:27 +0200 Subject: [PATCH 0491/1268] [feenkcom/gtoolkit#3212] add debugging signals to the textual coder element --- .../GtTextualCoderEditorElement.class.st | 28 +++++++++++++++++++ ...torElementAddedToSceneGraphSignal.class.st | 5 ++++ ...rEditorElementAttachedSpaceSignal.class.st | 5 ++++ ...rEditorElementDetachedSpaceSignal.class.st | 5 ++++ ...lementRemovedFromSceneGraphSignal.class.st | 5 ++++ 5 files changed, 48 insertions(+) create mode 100644 src/GToolkit-Coder-UI/GtTextualCoderEditorElementAddedToSceneGraphSignal.class.st create mode 100644 src/GToolkit-Coder-UI/GtTextualCoderEditorElementAttachedSpaceSignal.class.st create mode 100644 src/GToolkit-Coder-UI/GtTextualCoderEditorElementDetachedSpaceSignal.class.st create mode 100644 src/GToolkit-Coder-UI/GtTextualCoderEditorElementRemovedFromSceneGraphSignal.class.st diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index a9aa0bdd3..54003838b 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -14,6 +14,13 @@ Class { #category : #'GToolkit-Coder-UI-Coder - Textual' } +{ #category : #'hooks - children' } +GtTextualCoderEditorElement >> attachSpace [ + super attachSpace. + + GtTextualCoderEditorElementAttachedSpaceSignal emit +] + { #category : #'api - textual coder view model' } GtTextualCoderEditorElement >> coderViewModel: aTextualCoderViewModel [ self textualCoderViewModel: aTextualCoderViewModel @@ -61,6 +68,13 @@ GtTextualCoderEditorElement >> createContextMenuContent [ ^ theContextMenu ] +{ #category : #'hooks - children' } +GtTextualCoderEditorElement >> detachSpace [ + super detachSpace. + + GtTextualCoderEditorElementDetachedSpaceSignal emit +] + { #category : #'private - updating' } GtTextualCoderEditorElement >> editedTextBasedOnEditCommand: aTextEditCommand [ | modifiedText| @@ -144,6 +158,13 @@ GtTextualCoderEditorElement >> initializeListeners [ do: [ :anEvent | self textualCoderViewModel styledText: anEvent styledText ] ] +{ #category : #'hooks - children' } +GtTextualCoderEditorElement >> onAddedToSceneGraph [ + super onAddedToSceneGraph. + + GtTextualCoderEditorElementAddedToSceneGraphSignal emit +] + { #category : #'private - event handling' } GtTextualCoderEditorElement >> onCodeEvaluated: anEvaluationAnnouncement [ evaluationHighlighter displayResult: anEvaluationAnnouncement evaluationResult. @@ -206,6 +227,13 @@ GtTextualCoderEditorElement >> onPrintRequest: anEvaluationAnnouncement [ evaluationPrinter displayResult: anEvaluationAnnouncement evaluationResult. ] +{ #category : #'hooks - children' } +GtTextualCoderEditorElement >> onRemovedFromSceneGraph [ + super onRemovedFromSceneGraph. + + GtTextualCoderEditorElementRemovedFromSceneGraphSignal emit +] + { #category : #'private - event handling' } GtTextualCoderEditorElement >> onShowDebuggerRequest: aShowDebuggerAnnouncement [ | sharedDebugSession anEvaluatedSource anEvaluatedInterval theSourceStartInText theSourceEndInText | diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElementAddedToSceneGraphSignal.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElementAddedToSceneGraphSignal.class.st new file mode 100644 index 000000000..6892b3a5b --- /dev/null +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElementAddedToSceneGraphSignal.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtTextualCoderEditorElementAddedToSceneGraphSignal, + #superclass : #GtTextualCoderEditorElementSignal, + #category : #'GToolkit-Coder-UI-Coder - Textual' +} diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElementAttachedSpaceSignal.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElementAttachedSpaceSignal.class.st new file mode 100644 index 000000000..3b1feb1c3 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElementAttachedSpaceSignal.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtTextualCoderEditorElementAttachedSpaceSignal, + #superclass : #GtTextualCoderEditorElementSignal, + #category : #'GToolkit-Coder-UI-Coder - Textual' +} diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElementDetachedSpaceSignal.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElementDetachedSpaceSignal.class.st new file mode 100644 index 000000000..153fbb99e --- /dev/null +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElementDetachedSpaceSignal.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtTextualCoderEditorElementDetachedSpaceSignal, + #superclass : #GtTextualCoderEditorElementSignal, + #category : #'GToolkit-Coder-UI-Coder - Textual' +} diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElementRemovedFromSceneGraphSignal.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElementRemovedFromSceneGraphSignal.class.st new file mode 100644 index 000000000..c5a83fe1e --- /dev/null +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElementRemovedFromSceneGraphSignal.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtTextualCoderEditorElementRemovedFromSceneGraphSignal, + #superclass : #GtTextualCoderEditorElementSignal, + #category : #'GToolkit-Coder-UI-Coder - Textual' +} From 265320a3c5f1200196b0d5f9459ff928e56e7fcb Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Thu, 6 Apr 2023 11:16:39 +0200 Subject: [PATCH 0492/1268] Only write non-empty tags [feenkcom/gtoolkit#3215] --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index 299869405..9126dd9c4 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -225,7 +225,7 @@ GtCreationForm >> taggerStencilWithCompletion: aCompletionStrategy andContextMen do: [ :aRequest | | aValue | aRequest currentTarget addTag: aRequest tag. - aValue := aTagger tags collect: #name. + aValue := aTagger tags collect: #name thenSelect: #isNotEmpty. GtMagritteBuilderUtility write: aValue asArray From 0c6da05ed1867fcc6e19c7f125e5d6024ad7a19b Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 12 Apr 2023 13:17:28 -0600 Subject: [PATCH 0493/1268] add `GtStreamingCodersViewModelScrollTarget>>#printTargetNameOn:` [feenkcom/gtoolkit#3168] --- .../GtStreamingCodersViewModelScrollTarget.class.st | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModelScrollTarget.class.st b/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModelScrollTarget.class.st index 13e6d8e22..4d60564d6 100644 --- a/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModelScrollTarget.class.st +++ b/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModelScrollTarget.class.st @@ -8,3 +8,8 @@ Class { GtStreamingCodersViewModelScrollTarget >> applicableTo: aCoderViewModel [ ^ false ] + +{ #category : #printing } +GtStreamingCodersViewModelScrollTarget >> printTargetNameOn: aStream [ + aStream nextPutAll: '' +] From 4681048b4a0a7579ee49158c2f45d9cbe6fdb081 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Tue, 18 Apr 2023 13:18:17 +0200 Subject: [PATCH 0494/1268] Make browse button in coder work on both click and primary+click [feenkcom/gtoolkit#3219] --- src/GToolkit-Coder-UI/Behavior.extension.st | 36 ++++++++++++++++++--- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/src/GToolkit-Coder-UI/Behavior.extension.st b/src/GToolkit-Coder-UI/Behavior.extension.st index cc2abd9bd..258581c75 100644 --- a/src/GToolkit-Coder-UI/Behavior.extension.st +++ b/src/GToolkit-Coder-UI/Behavior.extension.st @@ -3,12 +3,38 @@ Extension { #name : #Behavior } { #category : #'*GToolkit-Coder-UI' } Behavior >> gtBrowseButtonFor: anAction [ - ^ anAction button - tooltip: 'Browse in another world tab'; + ^ anAction explicit priority: 1; - id: GtCoderBrowseCoderButtonId; - icon: BrGlamorousVectorIcons emphasizedBrowse; - action: [ :aButton | self gtBrowseFromButton: aButton ] + stencil: [ | button | + button := BrButton new + id: GtCoderBrowseCoderButtonId; + aptitude: BrGlamorousButtonWithIconAptitude; + label: 'Browse class'; + icon: BrGlamorousVectorIcons emphasizedBrowse; + action: [ :aButton :aModel :anEvent | + anEvent modifiers isPrimaryModifier + ifTrue: [ self gtBrowseFromButton: aButton ] + ifFalse: [ aButton phlow + spawnTool: (GtPhlowValuableTool new + name: self gtDisplayString; + valuable: [ | aCoder | + aButton phlow firstParentCoderNavigationModel + coderDo: [ :oldCoder | aCoder := GtCoder forCoder: oldCoder asNewCoderModelWithSameSubject ]. + aCoder ]) ] ]. + button viewModel + when: BlClickEvent + do: [ :anEvent | + anEvent modifiers isPrimaryModifier + ifTrue: [ button viewModel clickEvent: anEvent ] ]. + button viewModel + when: BlMouseEnterEvent + do: [ :anEvent | + anEvent consumed: true. + anEvent modifiers isPrimaryModifier + ifTrue: [ anEvent target mouseCursor: BlCopyCursor new ] + ifFalse: [ anEvent target mouseCursor: nil ]. + anEvent target requestFocus ]. + button ] ] { #category : #'*GToolkit-Coder-UI' } From 4250d740c465a7ed183f96d43b73167830b77dba Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 18 Apr 2023 17:25:02 -0600 Subject: [PATCH 0495/1268] modify `GtTextualCoderEditorElement>>#onTextualCoderViewModelChanged` [feenkcom/gtoolkit#3168] If the element is not added to the scene, set the editor text immediately. --- src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 54003838b..9860f616a 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -298,6 +298,11 @@ GtTextualCoderEditorElement >> onTextualCoderViewModelChanged [ wish to perform an operation that requires an announcement, but keep in mind that this is not the most efficient way" self onCoderViewModelFocused: self textualCoderViewModel focused. + + "In order to properly layout the element in an infinite list, + we set the text. See https://github.com/feenkcom/gtoolkit/issues/3168" + self isAddedToSceneGraph ifFalse: [ + self text: self textualCoderViewModel sourceText copy ]. "Setting text may change cursor and selection because text editor makes sure that they have valid values. That is why we create a snaphot of the editor's state From 4ccebb2622c1d4128b63f7f866d1bc89037165af Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 19 Apr 2023 09:13:22 -0600 Subject: [PATCH 0496/1268] revert a change [feenkcom/gtoolkit#3168] --- src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 9860f616a..54003838b 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -298,11 +298,6 @@ GtTextualCoderEditorElement >> onTextualCoderViewModelChanged [ wish to perform an operation that requires an announcement, but keep in mind that this is not the most efficient way" self onCoderViewModelFocused: self textualCoderViewModel focused. - - "In order to properly layout the element in an infinite list, - we set the text. See https://github.com/feenkcom/gtoolkit/issues/3168" - self isAddedToSceneGraph ifFalse: [ - self text: self textualCoderViewModel sourceText copy ]. "Setting text may change cursor and selection because text editor makes sure that they have valid values. That is why we create a snaphot of the editor's state From 4bc1660f957ec3d96ec35b0d4aefce935ba9b823 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 20 Apr 2023 18:38:03 -0600 Subject: [PATCH 0497/1268] move `Behavior` extensions to `gt4pharo` [feenkcom/gtoolkit#3230] --- src/GToolkit-Coder-UI/Behavior.extension.st | 131 -------------------- 1 file changed, 131 deletions(-) diff --git a/src/GToolkit-Coder-UI/Behavior.extension.st b/src/GToolkit-Coder-UI/Behavior.extension.st index 258581c75..5e3856b8c 100644 --- a/src/GToolkit-Coder-UI/Behavior.extension.st +++ b/src/GToolkit-Coder-UI/Behavior.extension.st @@ -37,83 +37,6 @@ Behavior >> gtBrowseButtonFor: anAction [ button ] ] -{ #category : #'*GToolkit-Coder-UI' } -Behavior >> gtCoderStreamingMethodsFor: aView context: aPhlowContext [ - - | aMethodsCoder aMethodsCoderViewModel aTestSuiteViewModel anExampleViewModel view | - aMethodsCoder := GtPharoStreamingMethodsCoder forBehavior: self. - aMethodsCoderViewModel := GtPharoStreamingMethodsCoderViewModel new - streamingCodersModel: aMethodsCoder; - shouldExpandByDefault: false; - shouldHaveHeaderByDefault: false; - selfObject: (aPhlowContext - optionAt: #behaviorCoder - ifPresent: [ :aBehaviorCoderUIModel | aBehaviorCoderUIModel coderModel object ] - ifAbsent: [ nil ]). - - aTestSuiteViewModel := self - testSuiteViewModelWith: aMethodsCoder - fromContext: aPhlowContext. - - anExampleViewModel := GtPharoCoderUIUtility - exampleViewModelCachedAs: #exampleViewModelHandler_gtCoderStreamingMethodsForContext - inPhlowContext: aPhlowContext - forMethodsCoder: aMethodsCoder. - - - view := aView explicit - priority: 9; - title: 'Methods'; - disableAsync; - actionDropdownButtonIcon: BrGlamorousVectorIcons filter - tooltip: 'Filter' - content: [ :element | aMethodsCoder filterDropDown: element ]; - actionDropdownButtonDo: [ :aDrodownAction | - aDrodownAction dropdown - name: GtPharoBehaviorCoder addNewMethodButtonName; - icon: BrGlamorousVectorIcons add; - tooltip: 'Add new method'; - content: [ :aButton | self gtNewMethodDropdownOn: aButton withViewModel: aMethodsCoderViewModel ] ]. - - (aMethodsCoder codeGeneratorsAvailableFor: aMethodsCoderViewModel) - ifTrue: [ view - actionDropdownButtonIcon: BrGlamorousVectorIcons robot - tooltip: 'Generate' - content: [ :anElement | aMethodsCoder codeGeneratorsDropDown: anElement for: aMethodsCoderViewModel ] ]. - ^ view - actionButtonDo: [ :aButtonAction | - aButtonAction - icon: BrGlamorousVectorIcons inspect; - tooltip: 'Inspect view model'; - action: [ :aButton | aButton phlow spawnObject: aMethodsCoderViewModel ] ]; - actionStencil: [ :aBrTab | GtPharoCoderUIUtility newExamplesDropdownButtonForViewModel: anExampleViewModel ]; - actionStencil: [ :aBrTab | GtPharoCoderUIUtility newTestsDropdownButtonForViewModel: aTestSuiteViewModel ]; - stencil: [ GtPharoStreamingMethodsCoderElement new - streamingCodersViewModel: aMethodsCoderViewModel ]; - actionStencil: [ :aButton | - GtSpotterDropdownButtonStencil new - object: self; - tooltip: 'Search Code'; - id: GtPharoSearchCodeButtonId; - actOn: [ :anActOnEvent :anItem :theButton | - | acted navigationModel | - acted := false. - navigationModel := theButton phlow firstParentWithView phlow - firstParentWithView navigationModel. - (anItem isKindOf: RPackage) - ifTrue: [ navigationModel selectPackage: anItem. - acted := true ]. - (anItem isKindOf: ClassDescription) - ifTrue: [ navigationModel selectClass: anItem. - acted := true ]. - (anItem isKindOf: CompiledMethod) - ifTrue: [ navigationModel selectMethod: anItem. - acted := true ]. - acted ifTrue: [ anActOnEvent beActed ] ]; - asElement ] - tooltip: 'Search Code' -] - { #category : #'*GToolkit-Coder-UI' } Behavior >> gtHierarchyButtonFor: anAction [ @@ -131,57 +54,3 @@ Behavior >> gtHierarchyButtonFor: anAction [ navigationModel: aNavigationModel; asElement) background: Color white) ] ] - -{ #category : #'*GToolkit-Coder-UI' } -Behavior >> gtNewMethodDropdownOn: aButton withViewModel: aMethodsCoderViewModel [ - | aNewMethodCoderHolder element aNewMethodCoderViewModel newMethodText aNewMethodCoder aHandler tagElement | - newMethodText := '' asRopedText - glamorousCodeFontAndSize; - attribute: (BrGhostTextAttribute - for: ('newMethod' asRopedText glamorousCodeFontAndSize foreground: Color lightGray)) - beNotOverwritableByStyler. - aNewMethodCoder := (GtPharoMethodCoder forNewMethod: self) - currentSourceText: newMethodText; - protocol: #accessing; - yourself. - aNewMethodCoderViewModel := aNewMethodCoder asCoderViewModel - withoutHeader; - expanded: true; - focused: true; - moveCursorAtEnd. - aNewMethodCoderHolder := ValueHolder new contents: aNewMethodCoderViewModel. - aHandler := GtPharoNewMethodCodeSavedHandler new - methodsCoderViewModel: aMethodsCoderViewModel; - element: aButton; - methodCoderHolder: aNewMethodCoderHolder. - aNewMethodCoderViewModel weak - when: GtMethodCoderSaved - send: #onAnnouncement: - to: aHandler. - element := (GtSourceCoderExpandedContentElement new - coderViewModel: aNewMethodCoderViewModel) - hExact: 400; - vFitContentLimited; - background: Color white; - addAptitude: BrGlamorousFocusableShadowAptitude new; - when: GtPhlowObjectToSpawn - do: [ :aSpawnEvent | - aSpawnEvent consumed: true. - aButton - fireEvent: (GtPhlowObjectToSpawn new - previousSpawnEvent: aSpawnEvent; - tool: aSpawnEvent tool; - sourceElement: aSpawnEvent currentTarget; - spawnDestination: aSpawnEvent spawnDestination; - in: [ :anNewEvent | anNewEvent propertyAt: #spawnContainer put: aSpawnEvent currentTarget ]; - yourself) ]. - tagElement := GtPharoMethodCoderTagsElement new - pharoMethodCoderViewModel: aNewMethodCoderViewModel; - constraintsDo: [ :c | - c ignoreByLayout. - c ignored horizontal alignRight. - c ignored vertical alignBottom. - c margin: (BlInsets bottom: -2) ]. - element actions addChild: tagElement. - ^ element -] From 869bc9e40a77c78b4c721d1ce49b1a4e33fc7519 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Fri, 21 Apr 2023 10:47:29 +0200 Subject: [PATCH 0498/1268] [feenkcom/gtoolkit#3207] improve performance of the textual coder creation --- .../GtTextualCoderEditorElement.class.st | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 9860f616a..099938a18 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -68,6 +68,11 @@ GtTextualCoderEditorElement >> createContextMenuContent [ ^ theContextMenu ] +{ #category : #initialization } +GtTextualCoderEditorElement >> defaultTextEditorMode [ + ^ BrTextEditorEditableCodeMode new +] + { #category : #'hooks - children' } GtTextualCoderEditorElement >> detachSpace [ super detachSpace. @@ -103,9 +108,6 @@ GtTextualCoderEditorElement >> initialize [ hMatchParent; vFitContent. - self editor - beEditableCode. - self id: GtSourceCoderEditorId. shortcuts := #(). From 0b61e704366bf162a7b4fa42b42b8f7090333ec5 Mon Sep 17 00:00:00 2001 From: John Brant Date: Mon, 24 Apr 2023 09:48:17 -0500 Subject: [PATCH 0499/1268] [feenkcom/gtoolkit#3235] highlight when scrolling to next/previous change --- src/GToolkit-Coder-UI/GtDiffElement.class.st | 26 +++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtDiffElement.class.st b/src/GToolkit-Coder-UI/GtDiffElement.class.st index 37f76e05c..1d6ebebb7 100644 --- a/src/GToolkit-Coder-UI/GtDiffElement.class.st +++ b/src/GToolkit-Coder-UI/GtDiffElement.class.st @@ -141,16 +141,16 @@ GtDiffElement >> initialize [ { #category : #'event handling' } GtDiffElement >> leftBottomFor: anInteger [ - | range element index | + | range element index parentBounds | range := self leftRange. - range isEmpty - ifTrue: [ ^ leftElement bounds inParent inParent top + leftElement padding top ]. + parentBounds := leftElement bounds inParent inParent. + range isEmpty ifTrue: [ ^ parentBounds top + leftElement padding top ]. index := (anInteger max: range first) min: range last. element := leftElement children at: index - range first + 1. - ^ (anInteger < range first + ^ ((anInteger < range first ifTrue: [ element bounds top ] ifFalse: [ element bounds bottom ]) + leftElement bounds inParent inParent top - max: leftElement bounds inParent inParent top + max: parentBounds top) min: parentBounds bottom ] { #category : #'event handling' } @@ -181,7 +181,7 @@ GtDiffElement >> leftLineForCursor [ { #category : #private } GtDiffElement >> leftRange [ | first | - first := ((leftElement instVarNamed: 'layoutPositionsRange') + first := (leftElement findMinMaxChildLayoutPositions ifNil: [ 1 ] ifNotNil: [ :interval | interval first ]) max: 1. ^ first to: first + leftElement children size - 1 @@ -366,15 +366,17 @@ GtDiffElement >> paintOnCanvas: aCanvas [ { #category : #'event handling' } GtDiffElement >> rightBottomFor: anInteger [ - | range element index | + | range element index parentBounds | range := self rightRange. - range isEmpty ifTrue: [ ^ rightElement bounds inParent inParent top + rightElement padding top ]. + parentBounds := rightElement bounds inParent inParent. + range isEmpty ifTrue: [ ^ parentBounds top + rightElement padding top ]. index := (anInteger max: range first) min: range last. element := rightElement children at: index - range first + 1. - ^ (anInteger < range first + ^ ((anInteger < range first ifTrue: [ element bounds top ] - ifFalse: [ element bounds bottom ]) + rightElement bounds inParent inParent top - max: rightElement bounds inParent inParent top + ifFalse: [ element bounds bottom ]) + + rightElement bounds inParent inParent top max: parentBounds top) + min: parentBounds bottom ] { #category : #'event handling' } @@ -405,7 +407,7 @@ GtDiffElement >> rightLineForCursor [ { #category : #private } GtDiffElement >> rightRange [ | first | - first := ((rightElement instVarNamed: 'layoutPositionsRange') + first := (rightElement findMinMaxChildLayoutPositions ifNil: [ 1 ] ifNotNil: [ :interval | interval first ]) max: 1. ^ first to: first + rightElement children size - 1 From 0d68c20d7e8cf57f20377cd2e5ad16e561d99041 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Wed, 3 May 2023 11:25:47 +0200 Subject: [PATCH 0500/1268] protocol tab aptitude should setup a layout --- src/GToolkit-Coder-UI/GtProtocolSlotTabAptitude.class.st | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtProtocolSlotTabAptitude.class.st b/src/GToolkit-Coder-UI/GtProtocolSlotTabAptitude.class.st index f20d7984f..687897fa6 100644 --- a/src/GToolkit-Coder-UI/GtProtocolSlotTabAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtProtocolSlotTabAptitude.class.st @@ -13,7 +13,10 @@ GtProtocolSlotTabAptitude >> initialize [ self add: (BrGlamorousTextLabelAptitude new foreground: Color gray). self add: BrGlamorousTabActionbarAptitude new. self add: BrLayoutResizerAptitude inherit. - self add: BrLayoutAlignmentAptitude forHorizontalLinearLayout. + self add: BrLayoutAlignmentAptitude new. + self + addChangeProperty: #(widget layout) + with: [ BlLinearLayout horizontal ]. bar := BlElement new visibility: BlVisibility hidden; background: self theme default primaryBorderColor; From 68f100e24ecf2bc8d3e284ae8cf702161628a2e4 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 3 May 2023 09:46:56 -0500 Subject: [PATCH 0501/1268] Handle uncategorized classes when navigating. [feenkcom/gtoolkit#3247] --- ...vigationPackagesTagsClassesElement.class.st | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 6ba7bb7c7..7ae410367 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -1083,16 +1083,14 @@ GtCoderNavigationPackagesTagsClassesElement >> updateProtocolListWith: instanceP GtCoderNavigationPackagesTagsClassesElement >> updateSelections [ self hasNavigationModel ifFalse: [ ^ self ]. navigationModel hasSelectedPackage - ifTrue: [ navigationModel hasSelectedTag - ifTrue: [ navigationModel hasSelectedClass - ifTrue: [ self - selectClass: navigationModel selectedClass - inPackage: navigationModel selectedPackage - tag: navigationModel selectedTag ] - ifFalse: [ self - selectPackage: navigationModel selectedPackage - tag: navigationModel selectedTag ] ] - ifFalse: [ self selectPackage: navigationModel selectedPackage ] ] + ifTrue: [ navigationModel hasSelectedClass + ifTrue: [ self + selectClass: navigationModel selectedClass + inPackage: navigationModel selectedPackage + tag: navigationModel selectedTag ] + ifFalse: [ self + selectPackage: navigationModel selectedPackage + tag: navigationModel selectedTag ] ] ] { #category : #'api - class selections' } From bcead41945b2ccee6a2dc98f01942086851748b7 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 5 May 2023 10:57:43 -0400 Subject: [PATCH 0502/1268] setup `GtClassCreationForm >>#superclassName` only if a selected class is a class (not a Trait) --- src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index 8ea0c0467..32797d828 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -142,7 +142,8 @@ GtCoderNavigationTabsStencil >> gtCreationInterface: look [ self formCache removeKey: each ] ]. form class == GtClassCreationForm ifTrue: [ navigationModel - selectedClassDo: [ :aClass | form superclassName: aClass name ] ]. + selectedClassDo: [ :aClass | + aClass isClass ifTrue: [ form superclassName: aClass name ] ] ]. form hasPackageAndTag ifTrue: [ navigationModel selectedPackageDo: [ :aPackage | form packageAndTagName packageName: aPackage name ]. From 8996e4679c1a5bd9462fffe9ed2f375a4abf1719 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Wed, 10 May 2023 22:25:54 +0200 Subject: [PATCH 0503/1268] Move filters tool to coder [feenkcom/gtoolkit#3256] --- .../BaselineOfGToolkitCoder.class.st | 2 + .../GtPhlowSearchFilterTool.class.st | 61 ++++++++++ .../GtPhlowSearchFilterToolElement.class.st | 114 ++++++++++++++++++ .../GtSearchFilter.extension.st | 8 ++ .../package.st | 1 + 5 files changed, 186 insertions(+) create mode 100644 src/GToolkit-SearchFilters-PhlowTool/GtPhlowSearchFilterTool.class.st create mode 100644 src/GToolkit-SearchFilters-PhlowTool/GtPhlowSearchFilterToolElement.class.st create mode 100644 src/GToolkit-SearchFilters-PhlowTool/GtSearchFilter.extension.st create mode 100644 src/GToolkit-SearchFilters-PhlowTool/package.st diff --git a/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st b/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st index e9b07e4c0..a26596e99 100644 --- a/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st +++ b/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st @@ -58,6 +58,8 @@ BaselineOfGToolkitCoder >> baseline: spec [ package: 'GToolkit-SearchFilters' with: [ spec requires: #('Futures') ]; + package: 'GToolkit-SearchFilters-PhlowTool' with: [ + spec requires: #('GToolkit-SearchFilters' 'GToolkitPager') ]; package: 'GToolkit-Coder-StreamingCoders' with: [ spec requires: #('Futures' 'GToolkit-SearchFilters') ]; diff --git a/src/GToolkit-SearchFilters-PhlowTool/GtPhlowSearchFilterTool.class.st b/src/GToolkit-SearchFilters-PhlowTool/GtPhlowSearchFilterTool.class.st new file mode 100644 index 000000000..96b72cdb4 --- /dev/null +++ b/src/GToolkit-SearchFilters-PhlowTool/GtPhlowSearchFilterTool.class.st @@ -0,0 +1,61 @@ +Class { + #name : #GtPhlowSearchFilterTool, + #superclass : #GtPhlowTool, + #instVars : [ + 'searchFilter' + ], + #category : #'GToolkit-SearchFilters-PhlowTool' +} + +{ #category : #'instance creation' } +GtPhlowSearchFilterTool class >> forSearchFilter: aSearchFilter [ + ^ self new + searchFilter: aSearchFilter +] + +{ #category : #'api - converting' } +GtPhlowSearchFilterTool >> asElementDo: aOneArgBlock [ + | toolElement | + toolElement := GtPhlowSearchFilterToolElement new + searchFilter: self searchFilter. + ^ aOneArgBlock cull: toolElement +] + +{ #category : #'api - accessing' } +GtPhlowSearchFilterTool >> icon [ + "Return a tool icon" + + ^ BrGlamorousVectorIcons search +] + +{ #category : #'api - accessing' } +GtPhlowSearchFilterTool >> name [ + "Return a tool name" + + ^ 'Search Filter' +] + +{ #category : #'api - accessing' } +GtPhlowSearchFilterTool >> object [ + ^ self searchFilter +] + +{ #category : #'api - accessing' } +GtPhlowSearchFilterTool >> object: aSearchFilter [ + self searchFilter: aSearchFilter +] + +{ #category : #accessing } +GtPhlowSearchFilterTool >> searchFilter [ + ^ searchFilter +] + +{ #category : #accessing } +GtPhlowSearchFilterTool >> searchFilter: aSearchFilter [ + searchFilter := aSearchFilter +] + +{ #category : #'api - accessing' } +GtPhlowSearchFilterTool >> tabLook [ + ^ BrGlamorousTabSwitcherWithIconAptitude +] diff --git a/src/GToolkit-SearchFilters-PhlowTool/GtPhlowSearchFilterToolElement.class.st b/src/GToolkit-SearchFilters-PhlowTool/GtPhlowSearchFilterToolElement.class.st new file mode 100644 index 000000000..c7d956e1d --- /dev/null +++ b/src/GToolkit-SearchFilters-PhlowTool/GtPhlowSearchFilterToolElement.class.st @@ -0,0 +1,114 @@ +Class { + #name : #GtPhlowSearchFilterToolElement, + #superclass : #BrVerticalPane, + #category : #'GToolkit-SearchFilters-PhlowTool' +} + +{ #category : #'building - widgets' } +GtPhlowSearchFilterToolElement >> buildContentElement [ + ^ BrFrame new + matchParent +] + +{ #category : #'building - widgets' } +GtPhlowSearchFilterToolElement >> buildHeaderElement [ + | headerElement titleLabel | + + headerElement := BrHorizontalPane new + vFitContent; + hMatchParent. + + titleLabel := self buildTitleLabel. + + headerElement addChild: titleLabel as: #titleLabel. + ^ headerElement +] + +{ #category : #'building - widgets' } +GtPhlowSearchFilterToolElement >> buildPlaygroundPageElement [ + | playgroundElement | + playgroundElement := (GtInspector environment + at: GtInspector embeddedPlaygroundName) new. + + playgroundElement collapse. + ^ playgroundElement +] + +{ #category : #'building - widgets' } +GtPhlowSearchFilterToolElement >> buildTitleLabel [ + ^ BrLabel new + aptitude: (BrGlamorousLabelAptitude new + bold; + fontSize: 18); + text: '' +] + +{ #category : #'building - widgets' } +GtPhlowSearchFilterToolElement >> buildToolLabel [ + ^ BrLabel new + aptitude: (BrGlamorousLabelAptitude new glamorousRegularFontAndSize + foreground: Color gray; + fontSize: 12); + text: 'Search Filter'. +] + +{ #category : #'accessing - elements' } +GtPhlowSearchFilterToolElement >> contentElement [ + ^ self childNamed: #content +] + +{ #category : #'accessing - elements' } +GtPhlowSearchFilterToolElement >> headerElement [ + ^ self childNamed: #header +] + +{ #category : #initialization } +GtPhlowSearchFilterToolElement >> initialize [ + super initialize. + + self matchParent. + self padding: (BlInsets top: 5 left: 6 bottom: 0 right: 6). + + self addChild: (self buildToolLabel + padding: (BlInsets left: 5)) as: #toolLabel. + self addChild: (self buildHeaderElement + padding: (BlInsets left: 5)) as: #header. + self addChild: (self buildContentElement + padding: (BlInsets top: 5)) as: #content. + self addChild: (self buildPlaygroundPageElement + padding: (BlInsets top: 5)) as: #playgroundPage. +] + +{ #category : #'accessing - elements' } +GtPhlowSearchFilterToolElement >> playgroundElement [ + ^ self childNamed: #playgroundPage +] + +{ #category : #accessing } +GtPhlowSearchFilterToolElement >> searchFilter: aSearchFilter [ + self updateForSearchFilter: aSearchFilter +] + +{ #category : #'accessing - elements' } +GtPhlowSearchFilterToolElement >> titleLabel [ + ^ self headerElement childNamed: #titleLabel +] + +{ #category : #updating } +GtPhlowSearchFilterToolElement >> updateContentForSearchFilter: aSearchFilter [ + | viewElement | + viewElement := (aSearchFilter gtItemsFor: GtPhlowEmptyView new) + asElementDo: [ :e | e ]. + self contentElement + removeChildren; + addChild: viewElement +] + +{ #category : #updating } +GtPhlowSearchFilterToolElement >> updateForSearchFilter: aSearchFilter [ + self titleLabel + text: aSearchFilter gtDisplayString. + self updateContentForSearchFilter: aSearchFilter. + self playgroundElement objectHolder: (GtInspectorObject new + object: aSearchFilter) +] diff --git a/src/GToolkit-SearchFilters-PhlowTool/GtSearchFilter.extension.st b/src/GToolkit-SearchFilters-PhlowTool/GtSearchFilter.extension.st new file mode 100644 index 000000000..58860851c --- /dev/null +++ b/src/GToolkit-SearchFilters-PhlowTool/GtSearchFilter.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #GtSearchFilter } + +{ #category : #'*GToolkit-SearchFilters-PhlowTool' } +GtSearchFilter >> gtDefaultInspectorTool [ + ^ GtPhlowCompositeTool new + addTool: (GtPhlowSearchFilterTool forSearchFilter: self); + addTool: (super gtDefaultInspectorTool) +] diff --git a/src/GToolkit-SearchFilters-PhlowTool/package.st b/src/GToolkit-SearchFilters-PhlowTool/package.st new file mode 100644 index 000000000..11a87872b --- /dev/null +++ b/src/GToolkit-SearchFilters-PhlowTool/package.st @@ -0,0 +1 @@ +Package { #name : #'GToolkit-SearchFilters-PhlowTool' } From 2542a8f3163c4164658827cab846b5d18abd18f4 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 15 May 2023 09:56:26 +0200 Subject: [PATCH 0504/1268] [feenkcom/gtoolkit#3207] resizer aptitude does not need to inherit --- src/GToolkit-Coder-UI/GtCoder.class.st | 2 -- src/GToolkit-Coder-UI/GtCoderContentElement.class.st | 4 +--- src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st | 1 - src/GToolkit-Coder-UI/GtDiffFlatAptitude.class.st | 1 - src/GToolkit-Coder-UI/GtDiffShadowAptitude.class.st | 1 - src/GToolkit-Coder-UI/GtProtocolSlotTabAptitude.class.st | 1 - 6 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoder.class.st b/src/GToolkit-Coder-UI/GtCoder.class.st index 0f2510e27..4419eaaa3 100644 --- a/src/GToolkit-Coder-UI/GtCoder.class.st +++ b/src/GToolkit-Coder-UI/GtCoder.class.st @@ -55,8 +55,6 @@ GtCoder >> initialize [ self addChild: self sidebarElement as: #sidebar. self addChild: self contentElement as: #content. - self addAptitude: (BrLayoutResizerAptitude inherit). - self phlow beView. ] diff --git a/src/GToolkit-Coder-UI/GtCoderContentElement.class.st b/src/GToolkit-Coder-UI/GtCoderContentElement.class.st index a62173b23..a5dbc1271 100644 --- a/src/GToolkit-Coder-UI/GtCoderContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderContentElement.class.st @@ -21,9 +21,7 @@ GtCoderContentElement class >> default [ { #category : #initialization } GtCoderContentElement >> initialize [ super initialize. - self layout: BlFrameLayout new. - - self addAptitude: (BrLayoutResizerAptitude inherit). + self layout: BlFrameLayout new ] { #category : #'hooks - children' } diff --git a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st index b66c36d2b..a5378d996 100644 --- a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st @@ -93,7 +93,6 @@ GtCoderExampleStateElement >> initialize [ self initializeInteractiveLook. self initializeTooltipLook. - self addAptitude: BrLayoutResizerAptitude inherit. ] { #category : #initialization } diff --git a/src/GToolkit-Coder-UI/GtDiffFlatAptitude.class.st b/src/GToolkit-Coder-UI/GtDiffFlatAptitude.class.st index 1a356ebb2..c999829a5 100644 --- a/src/GToolkit-Coder-UI/GtDiffFlatAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtDiffFlatAptitude.class.st @@ -9,7 +9,6 @@ GtDiffFlatAptitude >> initialize [ super initialize. self add: (BrLayoutResizerAptitude new - inherit; inherit: GtDiffOldTextId; inherit: GtDiffNewTextId). diff --git a/src/GToolkit-Coder-UI/GtDiffShadowAptitude.class.st b/src/GToolkit-Coder-UI/GtDiffShadowAptitude.class.st index bcfbd135e..613ad39cf 100644 --- a/src/GToolkit-Coder-UI/GtDiffShadowAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtDiffShadowAptitude.class.st @@ -9,7 +9,6 @@ GtDiffShadowAptitude >> initialize [ super initialize. self add: (BrLayoutResizerAptitude new - inherit; inherit: GtDiffOldTextId; inherit: GtDiffNewTextId). diff --git a/src/GToolkit-Coder-UI/GtProtocolSlotTabAptitude.class.st b/src/GToolkit-Coder-UI/GtProtocolSlotTabAptitude.class.st index 687897fa6..152771fa7 100644 --- a/src/GToolkit-Coder-UI/GtProtocolSlotTabAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtProtocolSlotTabAptitude.class.st @@ -12,7 +12,6 @@ GtProtocolSlotTabAptitude >> initialize [ super initialize. self add: (BrGlamorousTextLabelAptitude new foreground: Color gray). self add: BrGlamorousTabActionbarAptitude new. - self add: BrLayoutResizerAptitude inherit. self add: BrLayoutAlignmentAptitude new. self addChangeProperty: #(widget layout) From 560f0c17176eafe9dc70bb56a5b9a35224966501 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 15 May 2023 11:50:37 +0200 Subject: [PATCH 0505/1268] [feenkcom/gtoolkit#3260] update evaluated code button aptitude --- .../GtPlaygroundEvaluatedCodeButtonAttribute.class.st | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st b/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st index bdc69db3c..5c4e85eff 100644 --- a/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st @@ -6,7 +6,7 @@ Class { 'action', 'coder' ], - #category : 'GToolkit-Coder-UI-Coder - Source Attributes' + #category : #'GToolkit-Coder-UI-Coder - Source Attributes' } { #category : #accessing } @@ -28,12 +28,12 @@ GtPlaygroundEvaluatedCodeButtonAttribute >> affect: aTBrTextEditorTextualPiece i ^ aButton aptitude: ( - (BrInteractiveCommonAptitude new - default: [ :aWidget | aWidget background: BrGlamorousColors defaultButtonBorderColor ]; - hovered: [ :aWidget | aWidget background: BrGlamorousColors hoveredButtonBorderColor ]) + (BrLazyStyleCommonAptitude new + default: [ :aStyle | aStyle background: BrGlamorousColors defaultButtonBorderColor ]; + hovered: [ :aStyle | aStyle background: BrGlamorousColors hoveredButtonBorderColor ]) + - ((BrGlamorousWithTooltipAptitude2 content: [ + ((BrGlamorousWithTooltipAptitude content: [ | aContainer | aContainer := BlElement new layout: BlFrameLayout new; From 04aeee15cdade40e9e1df6b5acfc66dedc6acbf7 Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Wed, 17 May 2023 01:52:09 +0200 Subject: [PATCH 0506/1268] fix capitalization of view titles feenkcom/gtoolkit#3254 --- src/GToolkit-Coder-UI/GtFilterDescriptor.class.st | 2 +- .../GtCoderGrowingClassesHierarchyTree.class.st | 4 ++-- src/GToolkit-Coder/GtCoderModel.class.st | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st b/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st index 9c0c04741..48e2be4f2 100644 --- a/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st +++ b/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st @@ -178,7 +178,7 @@ GtFilterDescriptor >> gtViewFilterBlockFor: aView [ creationBlock ifNil: [ ^ aView empty ]. ^ aView forward - title: 'Filter Creation Block'; + title: 'Filter creation block'; object: [ creationBlock ]; view: #gtSourceCodeFor: ] diff --git a/src/GToolkit-Coder/GtCoderGrowingClassesHierarchyTree.class.st b/src/GToolkit-Coder/GtCoderGrowingClassesHierarchyTree.class.st index 09dfd5880..ef980586b 100644 --- a/src/GToolkit-Coder/GtCoderGrowingClassesHierarchyTree.class.st +++ b/src/GToolkit-Coder/GtCoderGrowingClassesHierarchyTree.class.st @@ -31,7 +31,7 @@ GtCoderGrowingClassesHierarchyTree >> gtFixedTreeFor: aView [ ^ aView tree - title: 'Fixed Classes'; + title: 'Fixed classes'; priority: 1; items: [ { self } ]; children: [ :anItem | anItem currentSubclassTrees ]; @@ -42,7 +42,7 @@ GtCoderGrowingClassesHierarchyTree >> gtFixedTreeFor: aView [ GtCoderGrowingClassesHierarchyTree >> gtTreeFor: aView [ ^ (super gtTreeFor: aView) - title: 'Growing Classes'; + title: 'Growing classes'; priority: 2 ] diff --git a/src/GToolkit-Coder/GtCoderModel.class.st b/src/GToolkit-Coder/GtCoderModel.class.st index 4b83fb561..390818677 100644 --- a/src/GToolkit-Coder/GtCoderModel.class.st +++ b/src/GToolkit-Coder/GtCoderModel.class.st @@ -63,7 +63,7 @@ GtCoderModel class >> gtContextMenuAddOnsFor: aView [ ^ aView forward - title: 'Menu AddOns'; + title: 'Menu addons'; tooltip: 'The methods that extend the Coder with context menu items'; priority: 45; object: [ (GtSearchMethodsInClassFilter new From ab3a68603e8486183145172d5d4e167866108243 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Wed, 31 May 2023 16:15:44 +0200 Subject: [PATCH 0507/1268] Added evaluated code attribute for specific views --- ...roundEvaluatedCodeButtonAttribute.class.st | 51 ++++++++++--------- ...dEvaluatedCodeViewButtonAttribute.class.st | 38 ++++++++++++++ 2 files changed, 66 insertions(+), 23 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeViewButtonAttribute.class.st diff --git a/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st b/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st index 5c4e85eff..e07bcdd09 100644 --- a/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st @@ -23,32 +23,29 @@ GtPlaygroundEvaluatedCodeButtonAttribute >> action: aBlock [ GtPlaygroundEvaluatedCodeButtonAttribute >> affect: aTBrTextEditorTextualPiece in: anEditorElement [ | aButton | - aButton := BrButton new. ^ aButton - aptitude: ( - (BrLazyStyleCommonAptitude new + aptitude: (BrLazyStyleCommonAptitude new default: [ :aStyle | aStyle background: BrGlamorousColors defaultButtonBorderColor ]; hovered: [ :aStyle | aStyle background: BrGlamorousColors hoveredButtonBorderColor ]) - + - - ((BrGlamorousWithTooltipAptitude content: [ - | aContainer | - aContainer := BlElement new - layout: BlFrameLayout new; - constraintsDo: [ :c | - c horizontal fitContent. - c vertical fitContent ]; - when: GtPhlowObjectToSpawn do: [ :anEvent | aButton fireEvent: (GtPhlowObjectToSpawn new - previousSpawnEvent: anEvent; - tool: anEvent tool; - sourceElement: aButton; - spawnDestination: self spawnDestination) ]. - (self result gtViewsFor: GtPhlowEmptyView new) asElementDo: [ :anInspectorElement | - aContainer addChild: ((anInspectorElement exact: 400@400) asScalableElement size: 200@200) - ] ]) showDelay: 200 milliSeconds)); - size: 8@8; + + ((BrGlamorousWithTooltipAptitude + content: [ | aContainer | + aContainer := BlElement new + layout: BlFrameLayout new; + constraintsDo: [ :c | + c horizontal fitContent. + c vertical fitContent ]; + when: GtPhlowObjectToSpawn + do: [ :anEvent | + aButton + fireEvent: (GtPhlowObjectToSpawn new + previousSpawnEvent: anEvent; + tool: anEvent tool; + sourceElement: aButton; + spawnDestination: self spawnDestination) ]. + self playgroundElementIn: aContainer ]) showDelay: 200 milliSeconds); + size: 8 @ 8; geometry: BlEllipseGeometry new; margin: (BlInsets left: 2 right: 2); action: [ :aButtonElement :aButtonModel :anEvent | self clickEvent: anEvent from: aButtonElement ]; @@ -85,14 +82,22 @@ GtPlaygroundEvaluatedCodeButtonAttribute >> mayHaveExternalReferences [ ^ true ] +{ #category : #initialization } +GtPlaygroundEvaluatedCodeButtonAttribute >> playgroundElementIn: aContainer [ + ^ (self result value gtViewsFor: GtPhlowEmptyView new) + asElementDo: [ :anInspectorElement | + aContainer + addChild: ((anInspectorElement exact: 400 @ 400) asScalableElement size: 200 @ 200) ] +] + { #category : #accessing } GtPlaygroundEvaluatedCodeButtonAttribute >> result [ ^ result ] { #category : #accessing } -GtPlaygroundEvaluatedCodeButtonAttribute >> result: anObject [ - result := anObject +GtPlaygroundEvaluatedCodeButtonAttribute >> result: anObjectOrBlock [ + result := anObjectOrBlock ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeViewButtonAttribute.class.st b/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeViewButtonAttribute.class.st new file mode 100644 index 000000000..c3c5e5054 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeViewButtonAttribute.class.st @@ -0,0 +1,38 @@ +Class { + #name : #GtPlaygroundEvaluatedCodeViewButtonAttribute, + #superclass : #GtPlaygroundEvaluatedCodeButtonAttribute, + #instVars : [ + 'view' + ], + #category : #'GToolkit-Coder-UI-Coder - Source Attributes' +} + +{ #category : #accessing } +GtPlaygroundEvaluatedCodeViewButtonAttribute >> defaultView [ + ^ #gtViewsFor: +] + +{ #category : #accessing } +GtPlaygroundEvaluatedCodeViewButtonAttribute >> initialize [ + super initialize. + + self view: self defaultView +] + +{ #category : #accessing } +GtPlaygroundEvaluatedCodeViewButtonAttribute >> playgroundElementIn: aContainer [ + ^ (self result value perform: self view withArguments: {GtPhlowEmptyView new}) + asElementDo: [ :anInspectorElement | + aContainer + addChild: ((anInspectorElement exact: 400 @ 400) asScalableElement size: 200 @ 200) ] +] + +{ #category : #accessing } +GtPlaygroundEvaluatedCodeViewButtonAttribute >> view [ + ^ view +] + +{ #category : #accessing } +GtPlaygroundEvaluatedCodeViewButtonAttribute >> view: anObject [ + view := anObject +] From 5d6e774581672281b393dfa08024b3bde42172a4 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Wed, 31 May 2023 16:19:10 +0200 Subject: [PATCH 0508/1268] Make the size of the view in evaluated snippet customizable --- .../GtPlaygroundEvaluatedCodeViewButtonAttribute.class.st | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeViewButtonAttribute.class.st b/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeViewButtonAttribute.class.st index c3c5e5054..fc706100c 100644 --- a/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeViewButtonAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeViewButtonAttribute.class.st @@ -22,9 +22,7 @@ GtPlaygroundEvaluatedCodeViewButtonAttribute >> initialize [ { #category : #accessing } GtPlaygroundEvaluatedCodeViewButtonAttribute >> playgroundElementIn: aContainer [ ^ (self result value perform: self view withArguments: {GtPhlowEmptyView new}) - asElementDo: [ :anInspectorElement | - aContainer - addChild: ((anInspectorElement exact: 400 @ 400) asScalableElement size: 200 @ 200) ] + asElementDo: [ :anInspectorElement | aContainer addChild: (anInspectorElement asScalableElement size: 200 @ 200) ] ] { #category : #accessing } From c9b23ee82a49ba7a671c871105a8d2b944f2b78c Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 20 Jun 2023 08:01:07 -0500 Subject: [PATCH 0509/1268] Double-clicking package class list switches tab to class hierarchy view [feenkcom/gtoolkit#3326] --- .../GtCoderNavigationElement.class.st | 1 - .../GtCoderNavigationModelElement.class.st | 4 +--- ...rNavigationPackagesTagsClassesElement.class.st | 15 +++++++++++++++ .../GtCoderNavigationTabsStencil.class.st | 8 -------- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st index 3536c757f..b1d359acf 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st @@ -70,7 +70,6 @@ GtCoderNavigationElement >> navigationModel [ { #category : #accessing } GtCoderNavigationElement >> navigationModel: aGtCoderNavigationPackagesTagsClassesModel [ - self assertNavigationModel: aGtCoderNavigationPackagesTagsClassesModel. self unsubscribeFromNavigationModel. navigationModel := aGtCoderNavigationPackagesTagsClassesModel. self onNavigationModelChanged. diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationModelElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationModelElement.class.st index 1b61e7643..585842bc6 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationModelElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationModelElement.class.st @@ -11,7 +11,7 @@ Class { #instVars : [ 'navigationModel' ], - #category : 'GToolkit-Coder-UI-Basic' + #category : #'GToolkit-Coder-UI-Basic' } { #category : #'private - asserting' } @@ -62,7 +62,6 @@ GtCoderNavigationModelElement >> navigationModel [ { #category : #'api - accessing' } GtCoderNavigationModelElement >> navigationModel: aGtCoderNavigationModel [ navigationModel = aGtCoderNavigationModel ifTrue: [ ^ self ]. - self assertNavigationModel: aGtCoderNavigationModel. self unsubscribeFromNavigationModel. navigationModel := aGtCoderNavigationModel. self subscribeToNavigationModel. @@ -76,7 +75,6 @@ GtCoderNavigationModelElement >> onNavigationModelChanged [ { #category : #'api - updating' } GtCoderNavigationModelElement >> pushCoder: aCoderOrCoders [ - self assertNavigationModel: self navigationModel. self navigationModel selectCoder: aCoderOrCoders ] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 7ae410367..51ce06a65 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -389,6 +389,13 @@ GtCoderNavigationPackagesTagsClassesElement >> methodProtocolsList [ ^ methodProtocolsList ] +{ #category : #subscriptions } +GtCoderNavigationPackagesTagsClassesElement >> onClassListSelectionDoubleClicked [ + | tabGroup | + tabGroup := self withAllParentsDetect: [:each | each class == BrTabGroup] ifFound: [:each | each] ifNone: [^self]. + tabGroup selectTabWithLabelString: 'Class Hierarchy' +] + { #category : #accessing } GtCoderNavigationPackagesTagsClassesElement >> onClassRemoved: anAnnouncement [ | aPackageOrTag | @@ -925,6 +932,14 @@ GtCoderNavigationPackagesTagsClassesElement >> slotListContextMenuItemsFor: item -> [ :elem | self renameSlot: item name inElement: elem ]} ] +{ #category : #subscriptions } +GtCoderNavigationPackagesTagsClassesElement >> subscribeToClassList [ + super subscribeToClassList. + classesList + when: BrSelectionDoubleClicked + do: [ :anEvent | self onClassListSelectionDoubleClicked ]. +] + { #category : #subscriptions } GtCoderNavigationPackagesTagsClassesElement >> subscribeToContent [ super subscribeToContent. diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index 32797d828..10b90139f 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -55,13 +55,6 @@ GtCoderNavigationTabsStencil >> addNavigation: aNavigationElement [ self navigations: (self navigations copyWith: aNavigationElement) ] -{ #category : #asserting } -GtCoderNavigationTabsStencil >> assertNavigationModel: aGtCoderNavigationPackagesTagsClassesModel [ - self - assert: [ aGtCoderNavigationPackagesTagsClassesModel isNotNil ] - description: [ 'Navigation model must be non-nil' ]. -] - { #category : #asserting } GtCoderNavigationTabsStencil >> assertNavigationView: aNavigationView [ self @@ -195,7 +188,6 @@ GtCoderNavigationTabsStencil >> navigationModel [ { #category : #accessing } GtCoderNavigationTabsStencil >> navigationModel: aGtCoderNavigationPackagesTagsClassesModel [ - self assertNavigationModel: aGtCoderNavigationPackagesTagsClassesModel. navigationModel := aGtCoderNavigationPackagesTagsClassesModel. ] From a83118f4614c0f4d259d2d41b50285484f035de7 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 20 Jun 2023 10:41:22 -0500 Subject: [PATCH 0510/1268] Revert double-click behavior [feenkcom/gtoolkit#3326] --- ...rNavigationPackagesTagsClassesElement.class.st | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 51ce06a65..7ae410367 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -389,13 +389,6 @@ GtCoderNavigationPackagesTagsClassesElement >> methodProtocolsList [ ^ methodProtocolsList ] -{ #category : #subscriptions } -GtCoderNavigationPackagesTagsClassesElement >> onClassListSelectionDoubleClicked [ - | tabGroup | - tabGroup := self withAllParentsDetect: [:each | each class == BrTabGroup] ifFound: [:each | each] ifNone: [^self]. - tabGroup selectTabWithLabelString: 'Class Hierarchy' -] - { #category : #accessing } GtCoderNavigationPackagesTagsClassesElement >> onClassRemoved: anAnnouncement [ | aPackageOrTag | @@ -932,14 +925,6 @@ GtCoderNavigationPackagesTagsClassesElement >> slotListContextMenuItemsFor: item -> [ :elem | self renameSlot: item name inElement: elem ]} ] -{ #category : #subscriptions } -GtCoderNavigationPackagesTagsClassesElement >> subscribeToClassList [ - super subscribeToClassList. - classesList - when: BrSelectionDoubleClicked - do: [ :anEvent | self onClassListSelectionDoubleClicked ]. -] - { #category : #subscriptions } GtCoderNavigationPackagesTagsClassesElement >> subscribeToContent [ super subscribeToContent. From 26bdb5e72da5c1ffd3b3a1c08a3786d96a04947b Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 20 Jun 2023 10:49:16 -0500 Subject: [PATCH 0511/1268] Double-clicking class in hierarchy list refocuses hierarchy [feenkcom/gtoolkit#3326] --- .../GtCoderNavigationClassesHierarchyTreeElement.class.st | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st index 569c3832c..0373d4606 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st @@ -84,7 +84,10 @@ GtCoderNavigationClassesHierarchyTreeElement >> initialize [ ifTrue: [ aText italic ]. aClass isDeprecated ifTrue: [ aText append: ' (deprecated)' asRopedText italic ]. - label text: aText ] ] + label text: aText ] ]. + self + when: BrSelectionDoubleClicked + do: [ :evt | self initializeWithHierachyForClass: self selectedClass ] ] { #category : #'api - initialization' } From 4484940de771ad57805da772441cdff5d181d27b Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 21 Jun 2023 11:47:26 -0500 Subject: [PATCH 0512/1268] Don't switch tags if package is already selected [feenkcom/gtoolkit#1267] --- .../GtCoderNavigationPackagesTagsClassesElement.class.st | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 7ae410367..09152258d 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -751,8 +751,7 @@ GtCoderNavigationPackagesTagsClassesElement >> reselectPackageOrTag: aSelectedPa { #category : #'api - class selections' } GtCoderNavigationPackagesTagsClassesElement >> selectClass: aClass inPackage: aPackage tag: aPackageTag [ - (self selectedPackage ~= aPackage - or: [ self selectedPackageTag ~= aPackageTag ]) + self selectedPackage ~= aPackage ifTrue: [ self selectPackage: aPackage tag: aPackageTag ]. self selectClass: aClass. From a02882b1812427fe1823483dd4b93dd4b6af3319 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 29 Jun 2023 23:43:30 +0200 Subject: [PATCH 0513/1268] remove the use of alpha: from the primaryBorderColor --- .../GtCoderExpanderWithoutShadowAptitude.class.st | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderExpanderWithoutShadowAptitude.class.st b/src/GToolkit-Coder-UI/GtCoderExpanderWithoutShadowAptitude.class.st index bc05195e1..aab266449 100644 --- a/src/GToolkit-Coder-UI/GtCoderExpanderWithoutShadowAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExpanderWithoutShadowAptitude.class.st @@ -63,8 +63,7 @@ GtCoderExpanderWithoutShadowAptitude >> defaultBorderPaint [ { #category : #initialization } GtCoderExpanderWithoutShadowAptitude >> defaultFocusedBorderPaint [ - ^ (self theme default primaryBorderColor alpha: 0.4) - gtOpaqueColorOnWhite + ^ self theme default primaryBorderColor ] { #category : #accessing } From 3de629c32607a4aec945833de348d83beebb01eb Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Wed, 5 Jul 2023 10:00:48 +0200 Subject: [PATCH 0514/1268] [feenkcom/gtoolkit#1125] BrEditor is no longer a subclass of the infinite element, update diff element --- src/GToolkit-Coder-UI/GtDiffElement.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtDiffElement.class.st b/src/GToolkit-Coder-UI/GtDiffElement.class.st index 1d6ebebb7..82fbbf729 100644 --- a/src/GToolkit-Coder-UI/GtDiffElement.class.st +++ b/src/GToolkit-Coder-UI/GtDiffElement.class.st @@ -181,7 +181,7 @@ GtDiffElement >> leftLineForCursor [ { #category : #private } GtDiffElement >> leftRange [ | first | - first := (leftElement findMinMaxChildLayoutPositions + first := (leftElement editorElement findMinMaxChildLayoutPositions ifNil: [ 1 ] ifNotNil: [ :interval | interval first ]) max: 1. ^ first to: first + leftElement children size - 1 @@ -407,7 +407,7 @@ GtDiffElement >> rightLineForCursor [ { #category : #private } GtDiffElement >> rightRange [ | first | - first := (rightElement findMinMaxChildLayoutPositions + first := (rightElement editorElement findMinMaxChildLayoutPositions ifNil: [ 1 ] ifNotNil: [ :interval | interval first ]) max: 1. ^ first to: first + rightElement children size - 1 From 7df1dd8e0e9fde8fbfe5a852eb75ae982287a640 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Tue, 11 Jul 2023 10:17:08 +0200 Subject: [PATCH 0515/1268] Revert "[feenkcom/gtoolkit#1125] BrEditor is no longer a subclass of the infinite element, update diff element" This reverts commit 3de629c32607a4aec945833de348d83beebb01eb. --- src/GToolkit-Coder-UI/GtDiffElement.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtDiffElement.class.st b/src/GToolkit-Coder-UI/GtDiffElement.class.st index 82fbbf729..1d6ebebb7 100644 --- a/src/GToolkit-Coder-UI/GtDiffElement.class.st +++ b/src/GToolkit-Coder-UI/GtDiffElement.class.st @@ -181,7 +181,7 @@ GtDiffElement >> leftLineForCursor [ { #category : #private } GtDiffElement >> leftRange [ | first | - first := (leftElement editorElement findMinMaxChildLayoutPositions + first := (leftElement findMinMaxChildLayoutPositions ifNil: [ 1 ] ifNotNil: [ :interval | interval first ]) max: 1. ^ first to: first + leftElement children size - 1 @@ -407,7 +407,7 @@ GtDiffElement >> rightLineForCursor [ { #category : #private } GtDiffElement >> rightRange [ | first | - first := (rightElement editorElement findMinMaxChildLayoutPositions + first := (rightElement findMinMaxChildLayoutPositions ifNil: [ 1 ] ifNotNil: [ :interval | interval first ]) max: 1. ^ first to: first + rightElement children size - 1 From bcce04dc7ea49209ff0c80af516528274764464d Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Tue, 11 Jul 2023 15:12:24 +0200 Subject: [PATCH 0516/1268] Ensure spotters only handle items when applicable [feenkcom/gtoolkit#3352] --- src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index 10b90139f..b070b143f 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -16,7 +16,7 @@ GtCoderNavigationTabsStencil >> addButtonsTo: explicitView [ GtSpotterDropdownButtonStencil new valuable: (GtCoderSpotterStart new navigationModelBlock: [ self navigationModel ]); tooltip: 'Search Code'; - actOn: [ :anActOnEvent :anItem :theButton | + objectActOn: [ :anActOnEvent :anItem :theButton | | acted | acted := false. (anItem isKindOf: RPackage) From 4823c2073543689d2acfeeca23ad5fa973be9dab Mon Sep 17 00:00:00 2001 From: John Brant Date: Fri, 14 Jul 2023 13:04:20 -0500 Subject: [PATCH 0517/1268] set background color for error attribute --- src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st index 0e1bc98dc..06f51ca02 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st @@ -78,8 +78,7 @@ GtSourceCoderErrorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditor { #category : #accessing } GtSourceCoderErrorAttribute >> errorButton [ ^ BrButton new - aptitude: (BrInteractiveCommonAptitude new - default: [ :aWidget | aWidget background: BrGlamorousColors errorBackgroundColor ]); + background: BrGlamorousColors errorBackgroundColor; size: 8 @ 8; geometry: BlEllipseGeometry new; padding: (BlInsets left: 2 right: 2); From 6b928faeba88a36ca9291c06a26c06233204d4f3 Mon Sep 17 00:00:00 2001 From: John Brant Date: Mon, 24 Jul 2023 11:47:58 -0500 Subject: [PATCH 0518/1268] change error attribute to display multiple lines --- .../GtSourceCoderErrorAttribute.class.st | 51 ++++++++++--------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st index 06f51ca02..8e1731bed 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st @@ -35,30 +35,35 @@ GtSourceCoderErrorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditor button addAptitude: (aptitude := BrGlamorousWithDropdownAptitude handle: [ self errorButton ] - content: [ | textElement | - text := string asRopedText - medium; - glamorousCodeFontAndSmallSize. - textElement := BlTextElement new. - textElement text: text. - textElement background: BrGlamorousColors errorBackgroundColor. - textElement padding: (BlInsets all: 10). - textElement - when: BlClickEvent - do: [ :event | clickAction cull: anEditorElement cull: aptitude hide ]. - {BlKeyCombination escape. - BlKeyCombination enter. - BlKeyCombination backspace} - do: [ :each | + content: [ | textElement pane | + pane := BrVerticalPane new. + pane matchParent. + pane background: BrGlamorousColors errorBackgroundColor. + string lines + do: [ :line | + text := line asRopedText + medium; + glamorousCodeFontAndSmallSize. + textElement := BlTextElement new. + textElement text: text. + textElement padding: (BlInsets all: 10). textElement - addShortcut: (BlShortcutWithAction new - combination: each; - repeatable: false; - action: [ :element | - aptitude hide. - anEditorElement requestFocus ]) ]. - textElement enqueueTask: [ textElement requestFocus ] asBlTask. - textElement ] + when: BlClickEvent + do: [ :event | clickAction cull: anEditorElement cull: aptitude hide ]. + {BlKeyCombination escape. + BlKeyCombination enter. + BlKeyCombination backspace} + do: [ :each | + textElement + addShortcut: (BlShortcutWithAction new + combination: each; + repeatable: false; + action: [ :element | + aptitude hide. + anEditorElement requestFocus ]) ]. + textElement enqueueTask: [ textElement requestFocus ] asBlTask. + pane addChild: textElement ]. + pane ] aptitudeDo: [ :look | look allActorsDepthFirstDo: [ :each | From ebb197ba55fbcc6f59754dd48c1e9c2e7f337935 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 27 Jul 2023 08:02:37 -0500 Subject: [PATCH 0519/1268] Clean up GtCoder element hierarchy a bit --- ...ass.st => GtAbstractCoderElement.class.st} | 41 ++++++++++--------- src/GToolkit-Coder-UI/GtCoder.class.st | 2 +- .../GtCoderContentElement.class.st | 2 +- src/GToolkit-Coder-UI/GtCoderElement.class.st | 22 ---------- .../GtCoderPlaygroundElement.class.st | 2 +- .../GtCoderToolbarElement.class.st | 2 +- 6 files changed, 26 insertions(+), 45 deletions(-) rename src/GToolkit-Coder-UI/{GtCoderNavigationModelElement.class.st => GtAbstractCoderElement.class.st} (60%) delete mode 100644 src/GToolkit-Coder-UI/GtCoderElement.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationModelElement.class.st b/src/GToolkit-Coder-UI/GtAbstractCoderElement.class.st similarity index 60% rename from src/GToolkit-Coder-UI/GtCoderNavigationModelElement.class.st rename to src/GToolkit-Coder-UI/GtAbstractCoderElement.class.st index 585842bc6..bb113726d 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationModelElement.class.st +++ b/src/GToolkit-Coder-UI/GtAbstractCoderElement.class.st @@ -1,13 +1,16 @@ " I am an abstract class. -I provide basic {{gtMethod:GtCoderNavigationModelElement>>#navigationModel:|label=navigation}} accessors, model {{gtMethod:GtCoderNavigationModelElement>>#subscribeToNavigationModel|label=subscriptons}}, and model {{gtMethod:GtCoderNavigationModelElement>>#onNavigationModelChanged|label=instance changes}}. -See my {{gtClass:GtCoderNavigationModelElement|expanded|show=#gtSubclassesFor:}} for concrete implementations: +I am an {{gtClass:BlElement}}. +I provide basic {{gtClass:TBrLayoutResizable}} methods. +See my {{gtClass:GtCoderElement|expanded|show=#gtSubclassesFor:}} for concrete implementations: " Class { - #name : #GtCoderNavigationModelElement, - #superclass : #GtCoderElement, + #name : #GtAbstractCoderElement, + #superclass : #BlElement, + #traits : 'TBrLayoutResizable', + #classTraits : 'TBrLayoutResizable classTrait', #instVars : [ 'navigationModel' ], @@ -15,7 +18,7 @@ Class { } { #category : #'private - asserting' } -GtCoderNavigationModelElement >> assertNavigationModel: aGtCoderNavigationModel [ +GtAbstractCoderElement >> assertNavigationModel: aGtCoderNavigationModel [ self assert: [ aGtCoderNavigationModel isNotNil ] description: [ 'Navigation model must be non-nil' ]. @@ -26,20 +29,20 @@ GtCoderNavigationModelElement >> assertNavigationModel: aGtCoderNavigationModel ] { #category : #defaults } -GtCoderNavigationModelElement >> defaultNavigationModel [ +GtAbstractCoderElement >> defaultNavigationModel [ ^ GtCoderNavigationModel null ] { #category : #initialization } -GtCoderNavigationModelElement >> initialize [ +GtAbstractCoderElement >> initialize [ super initialize. + self matchParent. navigationModel := self defaultNavigationModel. - self initializeListeners. - + self initializeListeners ] { #category : #initialization } -GtCoderNavigationModelElement >> initializeListeners [ +GtAbstractCoderElement >> initializeListeners [ self when: GtCoderToReplace do: [ :anEvent | self replaceFrom: anEvent ]. @@ -54,13 +57,13 @@ GtCoderNavigationModelElement >> initializeListeners [ ] { #category : #'api - accessing' } -GtCoderNavigationModelElement >> navigationModel [ +GtAbstractCoderElement >> navigationModel [ ^ navigationModel ] { #category : #'api - accessing' } -GtCoderNavigationModelElement >> navigationModel: aGtCoderNavigationModel [ +GtAbstractCoderElement >> navigationModel: aGtCoderNavigationModel [ navigationModel = aGtCoderNavigationModel ifTrue: [ ^ self ]. self unsubscribeFromNavigationModel. navigationModel := aGtCoderNavigationModel. @@ -69,41 +72,41 @@ GtCoderNavigationModelElement >> navigationModel: aGtCoderNavigationModel [ ] { #category : #'private - hooks' } -GtCoderNavigationModelElement >> onNavigationModelChanged [ +GtAbstractCoderElement >> onNavigationModelChanged [ "Subclasses can react to navigation model changes." ] { #category : #'api - updating' } -GtCoderNavigationModelElement >> pushCoder: aCoderOrCoders [ +GtAbstractCoderElement >> pushCoder: aCoderOrCoders [ self navigationModel selectCoder: aCoderOrCoders ] { #category : #'private - event handling' } -GtCoderNavigationModelElement >> replaceFrom: aGtCoderToReplaceEvent [ +GtAbstractCoderElement >> replaceFrom: aGtCoderToReplaceEvent [ aGtCoderToReplaceEvent consumed: true. self pushCoder: aGtCoderToReplaceEvent coder ] { #category : #'private - event handling' } -GtCoderNavigationModelElement >> spawnFrom: aGtCoderToSpawnEvent [ +GtAbstractCoderElement >> spawnFrom: aGtCoderToSpawnEvent [ aGtCoderToSpawnEvent consumed: true. self phlow spawnTool: (GtReadyCoderTool coder: (aGtCoderToSpawnEvent coder)) ] { #category : #'private - event handling' } -GtCoderNavigationModelElement >> spawnInSpaceFrom: aGtCoderToSpawnInSpaceEvent [ +GtAbstractCoderElement >> spawnInSpaceFrom: aGtCoderToSpawnInSpaceEvent [ aGtCoderToSpawnInSpaceEvent consumed: true. ] { #category : #'private - subscriptions' } -GtCoderNavigationModelElement >> subscribeToNavigationModel [ +GtAbstractCoderElement >> subscribeToNavigationModel [ "Subclasses can subscribe to the navigation model" ] { #category : #'private - subscriptions' } -GtCoderNavigationModelElement >> unsubscribeFromNavigationModel [ +GtAbstractCoderElement >> unsubscribeFromNavigationModel [ self navigationModel = GtCoderNavigationModel null ifTrue: [ ^ self ]. self navigationModel unsubscribe: self. ] diff --git a/src/GToolkit-Coder-UI/GtCoder.class.st b/src/GToolkit-Coder-UI/GtCoder.class.st index 4419eaaa3..7dc8b53ec 100644 --- a/src/GToolkit-Coder-UI/GtCoder.class.st +++ b/src/GToolkit-Coder-UI/GtCoder.class.st @@ -13,7 +13,7 @@ I am the entrance point into the coder as a tool. To instantiate me, use one of " Class { #name : #GtCoder, - #superclass : #GtCoderNavigationModelElement, + #superclass : #AnObsoleteGtCoderNavigationModelElement, #traits : 'TGtPagerPageInstantiator + TGtPhlowToolDetailAdjustable', #classTraits : 'TGtPagerPageInstantiator classTrait + TGtPhlowToolDetailAdjustable classTrait', #instVars : [ diff --git a/src/GToolkit-Coder-UI/GtCoderContentElement.class.st b/src/GToolkit-Coder-UI/GtCoderContentElement.class.st index a5dbc1271..4d1a0ada0 100644 --- a/src/GToolkit-Coder-UI/GtCoderContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderContentElement.class.st @@ -8,7 +8,7 @@ I display a {{gtClass:GtPharoBehaviorCoder}}, {{gtClass:GtPharoPackageTagCoder}} " Class { #name : #GtCoderContentElement, - #superclass : #GtCoderNavigationModelElement, + #superclass : #GtAbstractCoderElement, #category : #'GToolkit-Coder-UI-Basic' } diff --git a/src/GToolkit-Coder-UI/GtCoderElement.class.st b/src/GToolkit-Coder-UI/GtCoderElement.class.st deleted file mode 100644 index 7f138c307..000000000 --- a/src/GToolkit-Coder-UI/GtCoderElement.class.st +++ /dev/null @@ -1,22 +0,0 @@ -" -I am an abstract class. -I am an {{gtClass:BlElement}}. -I provide basic {{gtClass:TBrLayoutResizable}} methods. -See my {{gtClass:GtCoderElement|expanded|show=#gtSubclassesFor:}} for concrete implementations: - - -" -Class { - #name : #GtCoderElement, - #superclass : #BlElement, - #traits : 'TBrLayoutResizable', - #classTraits : 'TBrLayoutResizable classTrait', - #category : 'GToolkit-Coder-UI-Basic' -} - -{ #category : #initialization } -GtCoderElement >> initialize [ - super initialize. - - self matchParent -] diff --git a/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st b/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st index 68d3183ce..77def48db 100644 --- a/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st @@ -8,7 +8,7 @@ I display {{gtClass:GtCoderContentElement}} and an embedded playground. " Class { #name : #GtCoderPlaygroundElement, - #superclass : #GtCoderNavigationModelElement, + #superclass : #GtAbstractCoderElement, #instVars : [ 'contentElement', 'playgroundElement' diff --git a/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st b/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st index 488d23892..af34b8594 100644 --- a/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderToolbarElement.class.st @@ -8,7 +8,7 @@ I display a {{gtClass:BrToolbar}}. " Class { #name : #GtCoderToolbarElement, - #superclass : #GtCoderNavigationModelElement, + #superclass : #GtAbstractCoderElement, #instVars : [ 'toolbarElement' ], From 2028b85ddba98ef8acf436ec434d176bf6b5f781 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 27 Jul 2023 08:28:13 -0500 Subject: [PATCH 0520/1268] Patch up strange save error --- src/GToolkit-Coder-UI/GtCoder.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoder.class.st b/src/GToolkit-Coder-UI/GtCoder.class.st index 7dc8b53ec..d7ffba0e0 100644 --- a/src/GToolkit-Coder-UI/GtCoder.class.st +++ b/src/GToolkit-Coder-UI/GtCoder.class.st @@ -13,7 +13,7 @@ I am the entrance point into the coder as a tool. To instantiate me, use one of " Class { #name : #GtCoder, - #superclass : #AnObsoleteGtCoderNavigationModelElement, + #superclass : #GtAbstractCoderElement, #traits : 'TGtPagerPageInstantiator + TGtPhlowToolDetailAdjustable', #classTraits : 'TGtPagerPageInstantiator classTrait + TGtPhlowToolDetailAdjustable classTrait', #instVars : [ From dc8dcc9b846d218f3fc600586ef597c7a51c6fc4 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 27 Jul 2023 08:52:32 -0500 Subject: [PATCH 0521/1268] Rename GtCoder to GtCoderElement --- .../Behavior.extension.st | 4 +- .../CompiledMethod.extension.st | 4 +- .../ProtoObject.extension.st | 4 +- .../RPackage.extension.st | 4 +- src/GToolkit-Coder-UI/Behavior.extension.st | 2 +- .../GtClassCoderTool.class.st | 4 +- src/GToolkit-Coder-UI/GtCoder.class.st | 173 +---------------- src/GToolkit-Coder-UI/GtCoderElement.class.st | 175 ++++++++++++++++++ .../GtMethodCoderTool.class.st | 4 +- .../GtPackageCoderTool.class.st | 4 +- .../GtPackageTagCoderTool.class.st | 2 +- .../GtPhlowElementContext.extension.st | 8 +- .../GtReadyCoderTool.class.st | 2 +- src/GToolkit-Coder/Behavior.extension.st | 2 +- 14 files changed, 200 insertions(+), 192 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderElement.class.st diff --git a/src/GToolkit-Coder-Extensions/Behavior.extension.st b/src/GToolkit-Coder-Extensions/Behavior.extension.st index 5076e0c21..473d3dc55 100644 --- a/src/GToolkit-Coder-Extensions/Behavior.extension.st +++ b/src/GToolkit-Coder-Extensions/Behavior.extension.st @@ -2,12 +2,12 @@ Extension { #name : #Behavior } { #category : #'*GToolkit-Coder-Extensions' } Behavior >> gtBrowse [ - ^ (GtCoder forClass: self) openInPager maximized + ^ (GtCoderElement forClass: self) openInPager maximized ] { #category : #'*GToolkit-Coder-Extensions' } Behavior >> gtBrowseFrom: anElement [ - ^ ((GtCoder forClass: self) asElement openInPagerFrom: anElement) maximized + ^ ((GtCoderElement forClass: self) asElement openInPagerFrom: anElement) maximized ] { #category : #'*GToolkit-Coder-Extensions' } diff --git a/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st b/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st index bfcc987d2..15ed38423 100644 --- a/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st +++ b/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st @@ -2,14 +2,14 @@ Extension { #name : #CompiledMethod } { #category : #'*GToolkit-Coder-Extensions' } CompiledMethod >> gtBrowse [ - ^ (GtCoder forMethod: self) + ^ (GtCoderElement forMethod: self) openInPager maximized ] { #category : #'*GToolkit-Coder-Extensions' } CompiledMethod >> gtBrowseFrom: anElement [ - ^ ((GtCoder forMethod: self) asElement openInPagerFrom: anElement) maximized + ^ ((GtCoderElement forMethod: self) asElement openInPagerFrom: anElement) maximized ] { #category : #'*GToolkit-Coder-Extensions' } diff --git a/src/GToolkit-Coder-Extensions/ProtoObject.extension.st b/src/GToolkit-Coder-Extensions/ProtoObject.extension.st index 2173f55bd..e60f3aa89 100644 --- a/src/GToolkit-Coder-Extensions/ProtoObject.extension.st +++ b/src/GToolkit-Coder-Extensions/ProtoObject.extension.st @@ -2,10 +2,10 @@ Extension { #name : #ProtoObject } { #category : #'*GToolkit-Coder-Extensions' } ProtoObject >> gtBrowse [ - ^ (GtCoder forObject: self) openInPager maximized + ^ (GtCoderElement forObject: self) openInPager maximized ] { #category : #'*GToolkit-Coder-Extensions' } ProtoObject >> gtBrowseFrom: anElement [ - ^ ((GtCoder forObject: self) asElement openInPagerFrom: anElement) maximized + ^ ((GtCoderElement forObject: self) asElement openInPagerFrom: anElement) maximized ] diff --git a/src/GToolkit-Coder-Extensions/RPackage.extension.st b/src/GToolkit-Coder-Extensions/RPackage.extension.st index 895a14485..7e196cd2c 100644 --- a/src/GToolkit-Coder-Extensions/RPackage.extension.st +++ b/src/GToolkit-Coder-Extensions/RPackage.extension.st @@ -34,13 +34,13 @@ RPackage >> gtBaselinesFor: aView [ { #category : #'*GToolkit-Coder-Extensions' } RPackage >> gtBrowse [ - ^ ((GtCoder forPackage: self) + ^ ((GtCoderElement forPackage: self) openInPager) maximized ] { #category : #'*GToolkit-Coder-Extensions' } RPackage >> gtBrowseFrom: anElement [ - ^ ((GtCoder forPackage: self) asElement openInPagerFrom: anElement) maximized + ^ ((GtCoderElement forPackage: self) asElement openInPagerFrom: anElement) maximized ] { #category : #'*GToolkit-Coder-Extensions' } diff --git a/src/GToolkit-Coder-UI/Behavior.extension.st b/src/GToolkit-Coder-UI/Behavior.extension.st index 5e3856b8c..81a28ff45 100644 --- a/src/GToolkit-Coder-UI/Behavior.extension.st +++ b/src/GToolkit-Coder-UI/Behavior.extension.st @@ -19,7 +19,7 @@ Behavior >> gtBrowseButtonFor: anAction [ name: self gtDisplayString; valuable: [ | aCoder | aButton phlow firstParentCoderNavigationModel - coderDo: [ :oldCoder | aCoder := GtCoder forCoder: oldCoder asNewCoderModelWithSameSubject ]. + coderDo: [ :oldCoder | aCoder := GtCoderElement forCoder: oldCoder asNewCoderModelWithSameSubject ]. aCoder ]) ] ]. button viewModel when: BlClickEvent diff --git a/src/GToolkit-Coder-UI/GtClassCoderTool.class.st b/src/GToolkit-Coder-UI/GtClassCoderTool.class.st index 42eea5265..a69d11b29 100644 --- a/src/GToolkit-Coder-UI/GtClassCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtClassCoderTool.class.st @@ -4,7 +4,7 @@ Class { #instVars : [ 'observedClass' ], - #category : 'GToolkit-Coder-UI-Tools' + #category : #'GToolkit-Coder-UI-Tools' } { #category : #'instance creation' } @@ -19,7 +19,7 @@ GtClassCoderTool class >> observedClass: aClass [ { #category : #converting } GtClassCoderTool >> newCoder [ - ^ GtCoder forClass: self observedClass instanceSide + ^ GtCoderElement forClass: self observedClass instanceSide ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtCoder.class.st b/src/GToolkit-Coder-UI/GtCoder.class.st index d7ffba0e0..452cab948 100644 --- a/src/GToolkit-Coder-UI/GtCoder.class.st +++ b/src/GToolkit-Coder-UI/GtCoder.class.st @@ -1,175 +1,8 @@ " -I am the entrance point into the coder as a tool. To instantiate me, use one of the following class-side methods: -- {{gtMethod:GtCoder class>>#forObject:|label=#selector}}, -- {{gtMethod:GtCoder class>>#forClass:|label=#selector}}, -- {{gtMethod:GtCoder class>>#forMethod:|label=#selector}}, -- {{gtMethod:GtCoder class>>#forPackage:|label=#selector}}, -- {{gtMethod:GtCoder class>>#new|label=#selector}}. -1. # Example - -{{gtExample:GtCoderElementExamples>>#coderElementWithObject|previewExpanded|codeExpanded=false|previewHeight=700}} - - +This class is deprecated. You should use GtCoderElement instead " Class { #name : #GtCoder, - #superclass : #GtAbstractCoderElement, - #traits : 'TGtPagerPageInstantiator + TGtPhlowToolDetailAdjustable', - #classTraits : 'TGtPagerPageInstantiator classTrait + TGtPhlowToolDetailAdjustable classTrait', - #instVars : [ - 'sidebarElement', - 'contentElement', - 'titleNotifier' - ], - #category : #'GToolkit-Coder-UI-! Core' + #superclass : #GtCoderElement, + #category : #'GToolkit-Coder-UI-Deprecated' } - -{ #category : #'private - accessing' } -GtCoder >> contentElement [ - - ^ contentElement -] - -{ #category : #'private - accessing' } -GtCoder >> contentElement: anElement [ - - contentElement := anElement -] - -{ #category : #initialization } -GtCoder >> disablePlayPage [ - contentElement disablePlayPage -] - -{ #category : #initialization } -GtCoder >> initialize [ - super initialize. - self initializeTitleNotifier. - self addInteractiveModelState: GtPhlowToolDetailModel new. - self initializeContentElement. - self initializeSidebarElement. - self initializeListeners. - - self layout: BlLinearLayout horizontal. - - self addChild: self sidebarElement as: #sidebar. - self addChild: self contentElement as: #content. - - self phlow beView. -] - -{ #category : #initialization } -GtCoder >> initializeContentElement [ - contentElement := GtCoderPlaygroundElement new. -] - -{ #category : #initialization } -GtCoder >> initializeSidebarElement [ - sidebarElement := GtPhlowHorizontalSidebarElement new beLeft. - self addAptitude: (GtPhlowToolDetailAptitude new - normal: [ :theInstance | sidebarElement hide ]; - detailed: [ :theInstance | sidebarElement show ]). -] - -{ #category : #initialization } -GtCoder >> initializeTitleNotifier [ - titleNotifier := GtPhlowTitleIconAndLabelNotifier new - shortLabel: [ self shortTitle ifEmpty: [ 'Coder' asRopedText ] ]; - icon: BrGlamorousVectorIcons emphasizedBrowse. - self addEventHandler: titleNotifier. -] - -{ #category : #'private - hooks' } -GtCoder >> onNavigationModelChanged [ - super onNavigationModelChanged. - self contentElement navigationModel: self navigationModel. - self updateSidebarContent. - self updateTabLabel -] - -{ #category : #'private - announcement handling' } -GtCoder >> onNavigationModelSubjectChange [ - self enqueueTask: (BlTaskAction new action: [ - self updateTabLabel ]) -] - -{ #category : #opening } -GtCoder >> pagerWindowTitle [ - - ^ self shortTitle -] - -{ #category : #accessing } -GtCoder >> repository [ - - self navigationModel hasSelectedClass ifTrue: [ - ^ self navigationModel selectedClass repository ]. - self navigationModel hasSelectedPackage ifTrue: [ - ^ self navigationModel selectedPackage repository ]. - ^ nil -] - -{ #category : #filtering } -GtCoder >> selectMethodProtocolNamed: aMethodProtocolName [ - "(GtCoder forClass: GtPhlowProtoView) selectMethodProtocolNamed: #decorating" - | classProtocols | - classProtocols := navigationModel selectedClass organization protocols. - classProtocols - detect: [ :aProtocol | aProtocol name = aMethodProtocolName ] - ifFound: [ :aProtocol | self navigationModel selectMethodProtocol: aProtocol source: self ] - ifNone: [ "ignore" ] -] - -{ #category : #'private - accessing' } -GtCoder >> shortTitle [ - ^ (GtPhlowTitleLabelBuilder - longLabel: self subjectTitle) - build -] - -{ #category : #'private - accessing' } -GtCoder >> sidebarElement [ - - ^ sidebarElement -] - -{ #category : #'private - accessing' } -GtCoder >> subjectTitle [ - - self navigationModel selectedClassDo: [ :aClass | ^ aClass name ]. - self navigationModel selectedTagDo: [ :aPackageTag | ^ aPackageTag packageName, '-', aPackageTag name ]. - self navigationModel selectedPackageDo: [ :aPackage | ^ aPackage name ]. - ^ nil -] - -{ #category : #'private - subscriptions' } -GtCoder >> subscribeToNavigationModel [ - super subscribeToNavigationModel. - self navigationModel weak - when: GtCoderNavigationPackagesSelected, - GtCoderNavigationPackageSelected, - GtCoderNavigationPackageRenamed, - GtCoderNavigationPackageTagSelected, - GtCoderNavigationClassSelected, - GtCoderNavigationClassRenamed, - GtCoderNavigationClassModified - send: #onNavigationModelSubjectChange to: self -] - -{ #category : #'private - accessing' } -GtCoder >> titleNotifier [ - - ^ titleNotifier -] - -{ #category : #'private - updating' } -GtCoder >> updateSidebarContent [ - self sidebarElement - contentStencil: (GtCoderNavigationTabsStencil new - navigationModel: self navigationModel) -] - -{ #category : #'private - updating' } -GtCoder >> updateTabLabel [ - self titleNotifier notifyIfFocused -] diff --git a/src/GToolkit-Coder-UI/GtCoderElement.class.st b/src/GToolkit-Coder-UI/GtCoderElement.class.st new file mode 100644 index 000000000..c87940d77 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderElement.class.st @@ -0,0 +1,175 @@ +" +I am the entrance point into the coder as a tool. To instantiate me, use one of the following class-side methods: +- {{gtMethod:GtCoder class>>#forObject:|label=#selector}}, +- {{gtMethod:GtCoder class>>#forClass:|label=#selector}}, +- {{gtMethod:GtCoder class>>#forMethod:|label=#selector}}, +- {{gtMethod:GtCoder class>>#forPackage:|label=#selector}}, +- {{gtMethod:GtCoder class>>#new|label=#selector}}. +1. # Example + +{{gtExample:GtCoderElementExamples>>#coderElementWithObject|previewExpanded|codeExpanded=false|previewHeight=700}} + + +" +Class { + #name : #GtCoderElement, + #superclass : #GtAbstractCoderElement, + #traits : 'TGtPagerPageInstantiator + TGtPhlowToolDetailAdjustable', + #classTraits : 'TGtPagerPageInstantiator classTrait + TGtPhlowToolDetailAdjustable classTrait', + #instVars : [ + 'sidebarElement', + 'contentElement', + 'titleNotifier' + ], + #category : #'GToolkit-Coder-UI-! Core' +} + +{ #category : #'private - accessing' } +GtCoderElement >> contentElement [ + + ^ contentElement +] + +{ #category : #'private - accessing' } +GtCoderElement >> contentElement: anElement [ + + contentElement := anElement +] + +{ #category : #initialization } +GtCoderElement >> disablePlayPage [ + contentElement disablePlayPage +] + +{ #category : #initialization } +GtCoderElement >> initialize [ + super initialize. + self initializeTitleNotifier. + self addInteractiveModelState: GtPhlowToolDetailModel new. + self initializeContentElement. + self initializeSidebarElement. + self initializeListeners. + + self layout: BlLinearLayout horizontal. + + self addChild: self sidebarElement as: #sidebar. + self addChild: self contentElement as: #content. + + self phlow beView. +] + +{ #category : #initialization } +GtCoderElement >> initializeContentElement [ + contentElement := GtCoderPlaygroundElement new. +] + +{ #category : #initialization } +GtCoderElement >> initializeSidebarElement [ + sidebarElement := GtPhlowHorizontalSidebarElement new beLeft. + self addAptitude: (GtPhlowToolDetailAptitude new + normal: [ :theInstance | sidebarElement hide ]; + detailed: [ :theInstance | sidebarElement show ]). +] + +{ #category : #initialization } +GtCoderElement >> initializeTitleNotifier [ + titleNotifier := GtPhlowTitleIconAndLabelNotifier new + shortLabel: [ self shortTitle ifEmpty: [ 'Coder' asRopedText ] ]; + icon: BrGlamorousVectorIcons emphasizedBrowse. + self addEventHandler: titleNotifier. +] + +{ #category : #'private - hooks' } +GtCoderElement >> onNavigationModelChanged [ + super onNavigationModelChanged. + self contentElement navigationModel: self navigationModel. + self updateSidebarContent. + self updateTabLabel +] + +{ #category : #'private - announcement handling' } +GtCoderElement >> onNavigationModelSubjectChange [ + self enqueueTask: (BlTaskAction new action: [ + self updateTabLabel ]) +] + +{ #category : #opening } +GtCoderElement >> pagerWindowTitle [ + + ^ self shortTitle +] + +{ #category : #accessing } +GtCoderElement >> repository [ + + self navigationModel hasSelectedClass ifTrue: [ + ^ self navigationModel selectedClass repository ]. + self navigationModel hasSelectedPackage ifTrue: [ + ^ self navigationModel selectedPackage repository ]. + ^ nil +] + +{ #category : #filtering } +GtCoderElement >> selectMethodProtocolNamed: aMethodProtocolName [ + "(GtCoder forClass: GtPhlowProtoView) selectMethodProtocolNamed: #decorating" + | classProtocols | + classProtocols := navigationModel selectedClass organization protocols. + classProtocols + detect: [ :aProtocol | aProtocol name = aMethodProtocolName ] + ifFound: [ :aProtocol | self navigationModel selectMethodProtocol: aProtocol source: self ] + ifNone: [ "ignore" ] +] + +{ #category : #'private - accessing' } +GtCoderElement >> shortTitle [ + ^ (GtPhlowTitleLabelBuilder + longLabel: self subjectTitle) + build +] + +{ #category : #'private - accessing' } +GtCoderElement >> sidebarElement [ + + ^ sidebarElement +] + +{ #category : #'private - accessing' } +GtCoderElement >> subjectTitle [ + + self navigationModel selectedClassDo: [ :aClass | ^ aClass name ]. + self navigationModel selectedTagDo: [ :aPackageTag | ^ aPackageTag packageName, '-', aPackageTag name ]. + self navigationModel selectedPackageDo: [ :aPackage | ^ aPackage name ]. + ^ nil +] + +{ #category : #'private - subscriptions' } +GtCoderElement >> subscribeToNavigationModel [ + super subscribeToNavigationModel. + self navigationModel weak + when: GtCoderNavigationPackagesSelected, + GtCoderNavigationPackageSelected, + GtCoderNavigationPackageRenamed, + GtCoderNavigationPackageTagSelected, + GtCoderNavigationClassSelected, + GtCoderNavigationClassRenamed, + GtCoderNavigationClassModified + send: #onNavigationModelSubjectChange to: self +] + +{ #category : #'private - accessing' } +GtCoderElement >> titleNotifier [ + + ^ titleNotifier +] + +{ #category : #'private - updating' } +GtCoderElement >> updateSidebarContent [ + self sidebarElement + contentStencil: (GtCoderNavigationTabsStencil new + navigationModel: self navigationModel) +] + +{ #category : #'private - updating' } +GtCoderElement >> updateTabLabel [ + self titleNotifier notifyIfFocused +] diff --git a/src/GToolkit-Coder-UI/GtMethodCoderTool.class.st b/src/GToolkit-Coder-UI/GtMethodCoderTool.class.st index 31b17c2d0..c7c9fe158 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderTool.class.st @@ -4,7 +4,7 @@ Class { #instVars : [ 'compiledMethod' ], - #category : 'GToolkit-Coder-UI-Tools' + #category : #'GToolkit-Coder-UI-Tools' } { #category : #'instance creation' } @@ -24,7 +24,7 @@ GtMethodCoderTool >> compiledMethod: anObject [ { #category : #converting } GtMethodCoderTool >> newCoder [ - ^ GtCoder forMethod: self compiledMethod + ^ GtCoderElement forMethod: self compiledMethod ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtPackageCoderTool.class.st b/src/GToolkit-Coder-UI/GtPackageCoderTool.class.st index cfaa37b26..97ed0fc5b 100644 --- a/src/GToolkit-Coder-UI/GtPackageCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtPackageCoderTool.class.st @@ -4,7 +4,7 @@ Class { #instVars : [ 'package' ], - #category : 'GToolkit-Coder-UI-Tools' + #category : #'GToolkit-Coder-UI-Tools' } { #category : #'instance creation' } @@ -14,7 +14,7 @@ GtPackageCoderTool class >> package: aPackage [ { #category : #converting } GtPackageCoderTool >> newCoder [ - ^ GtCoder forPackage: self package + ^ GtCoderElement forPackage: self package ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtPackageTagCoderTool.class.st b/src/GToolkit-Coder-UI/GtPackageTagCoderTool.class.st index 7c32dfe5e..c17ab2157 100644 --- a/src/GToolkit-Coder-UI/GtPackageTagCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtPackageTagCoderTool.class.st @@ -14,7 +14,7 @@ GtPackageTagCoderTool class >> packageTag: aPackageTag [ { #category : #accessing } GtPackageTagCoderTool >> newCoder [ - ^ GtCoder forPackageTag: self packageTag + ^ GtCoderElement forPackageTag: self packageTag ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtPhlowElementContext.extension.st b/src/GToolkit-Coder-UI/GtPhlowElementContext.extension.st index f61574cb1..2d08913d2 100644 --- a/src/GToolkit-Coder-UI/GtPhlowElementContext.extension.st +++ b/src/GToolkit-Coder-UI/GtPhlowElementContext.extension.st @@ -4,7 +4,7 @@ Extension { #name : #GtPhlowElementContext } GtPhlowElementContext >> coder [ "Use #firstParentCoder instead" - + ^ self firstParentCoder ] @@ -18,15 +18,15 @@ GtPhlowElementContext >> coderNavigationModel [ { #category : #'*GToolkit-Coder-UI' } GtPhlowElementContext >> firstParentCoder [ - + | anElement | anElement := self firstParentWithView. self assert: [ anElement isNotNil ] description: [ 'Coder (element) must be non-nil' ]. self - assert: [ anElement isKindOf: GtCoder ] - description: [ 'Coder (element) must be a kind of ' , GtCoder name ]. + assert: [ anElement isKindOf: GtCoderElement ] + description: [ 'Coder (element) must be a kind of ' , GtCoderElement name ]. ^ anElement ] diff --git a/src/GToolkit-Coder-UI/GtReadyCoderTool.class.st b/src/GToolkit-Coder-UI/GtReadyCoderTool.class.st index 03194fa5d..94dbb2d85 100644 --- a/src/GToolkit-Coder-UI/GtReadyCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtReadyCoderTool.class.st @@ -17,7 +17,7 @@ GtReadyCoderTool >> asElementDo: aOneArgBlock [ "Create a tool element and execute the block." | anElement | - anElement := (GtCoder forCoder: self coder) asElement. + anElement := (GtCoderElement forCoder: self coder) asElement. ^ aOneArgBlock cull: anElement asPagerPageElement ] diff --git a/src/GToolkit-Coder/Behavior.extension.st b/src/GToolkit-Coder/Behavior.extension.st index 52d102655..e17898314 100644 --- a/src/GToolkit-Coder/Behavior.extension.st +++ b/src/GToolkit-Coder/Behavior.extension.st @@ -6,6 +6,6 @@ Behavior >> gtBrowseFromButton: anElement [ anElement phlow firstParentCoderNavigationModel coderDo: [ :aCoder | - ((GtCoder forCoder: aCoder asNewCoderModelWithSameSubject) + ((GtCoderElement forCoder: aCoder asNewCoderModelWithSameSubject) openInPagerFrom: anElement) maximized ] ] From f1de86a4d828b886e54c683561fbf5ce81897a28 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 27 Jul 2023 09:07:13 -0500 Subject: [PATCH 0522/1268] Fix class reference in GtCoderElement class comment --- src/GToolkit-Coder-UI/GtCoderElement.class.st | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderElement.class.st b/src/GToolkit-Coder-UI/GtCoderElement.class.st index c87940d77..99c084e2c 100644 --- a/src/GToolkit-Coder-UI/GtCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderElement.class.st @@ -1,10 +1,10 @@ " I am the entrance point into the coder as a tool. To instantiate me, use one of the following class-side methods: -- {{gtMethod:GtCoder class>>#forObject:|label=#selector}}, -- {{gtMethod:GtCoder class>>#forClass:|label=#selector}}, -- {{gtMethod:GtCoder class>>#forMethod:|label=#selector}}, -- {{gtMethod:GtCoder class>>#forPackage:|label=#selector}}, -- {{gtMethod:GtCoder class>>#new|label=#selector}}. +- {{gtMethod:GtCoderElement class>>#forObject:|label=#selector}}, +- {{gtMethod:GtCoderElement class>>#forClass:|label=#selector}}, +- {{gtMethod:GtCoderElement class>>#forMethod:|label=#selector}}, +- {{gtMethod:GtCoderElement class>>#forPackage:|label=#selector}}, +- {{gtMethod:GtCoderElement class>>#new|label=#selector}}. 1. # Example {{gtExample:GtCoderElementExamples>>#coderElementWithObject|previewExpanded|codeExpanded=false|previewHeight=700}} From d268a9cc23c7926cfa14cba1fd3dbd44108dc698 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 1 Aug 2023 09:27:14 -0500 Subject: [PATCH 0523/1268] Add missing hash method [feenkcom/gtoolkit#3374] --- src/GToolkit-SearchFilters/GtSearchNullFilter.class.st | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/GToolkit-SearchFilters/GtSearchNullFilter.class.st b/src/GToolkit-SearchFilters/GtSearchNullFilter.class.st index 72113ccce..2f582f538 100644 --- a/src/GToolkit-SearchFilters/GtSearchNullFilter.class.st +++ b/src/GToolkit-SearchFilters/GtSearchNullFilter.class.st @@ -16,6 +16,11 @@ GtSearchNullFilter >> defaultFilterScope [ ^ AsyncEmptyStream new ] +{ #category : #comparing } +GtSearchNullFilter >> hash [ + ^self class hash +] + { #category : #enumerating } GtSearchNullFilter >> itemsDo: aBloc [ ] From 44c8eee4a35a626181194d4030954424e0467d1c Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 1 Aug 2023 13:57:46 -0500 Subject: [PATCH 0524/1268] Add subclass references to class remove preview [feenkcom/gtoolkit#3368] --- src/GToolkit-Coder-UI/GtAbstractRemovePreviewStencil.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtAbstractRemovePreviewStencil.class.st b/src/GToolkit-Coder-UI/GtAbstractRemovePreviewStencil.class.st index 5882aa812..4744e4d90 100644 --- a/src/GToolkit-Coder-UI/GtAbstractRemovePreviewStencil.class.st +++ b/src/GToolkit-Coder-UI/GtAbstractRemovePreviewStencil.class.st @@ -62,7 +62,7 @@ GtAbstractRemovePreviewStencil >> createPreviewContainerForItemNamed: itemName w aStream print: aSink count; space; - nextPutAll: ('method' asPluralBasedOn: aSink count) ]) ] ]. + nextPutAll: ('place' asPluralBasedOn: aSink count) ]) ] ]. container asyncSink forwardStream: references asAsyncStream. From 68222850522a8b9d9916bc3455e7e1896637d770 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 2 Aug 2023 07:49:05 -0500 Subject: [PATCH 0525/1268] Fix failing examples [feenkcom/gtoolkit#3374] --- src/GToolkit-SearchFilters/GtAsyncSearchGroupStream.class.st | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/GToolkit-SearchFilters/GtAsyncSearchGroupStream.class.st b/src/GToolkit-SearchFilters/GtAsyncSearchGroupStream.class.st index d94b94cc7..18a41c341 100644 --- a/src/GToolkit-SearchFilters/GtAsyncSearchGroupStream.class.st +++ b/src/GToolkit-SearchFilters/GtAsyncSearchGroupStream.class.st @@ -33,6 +33,11 @@ GtAsyncSearchGroupStream class >> mergeTypeWithTypedGroup: aGroupType [ ^ self ] +{ #category : #'as yet unclassified' } +GtAsyncSearchGroupStream >> asCoder [ + ^ GtFilteredMethodsCoder forFilter: self filter +] + { #category : #accessing } GtAsyncSearchGroupStream >> filter [ ^ filter From 9cfe2d7e192b2f049988b4b270cc92371be2eef9 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 2 Aug 2023 10:14:39 -0500 Subject: [PATCH 0526/1268] Fix broken dependency [feenkcom/gtoolkit#3374] --- src/GToolkit-SearchFilters/GtAsyncSearchGroupStream.class.st | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/GToolkit-SearchFilters/GtAsyncSearchGroupStream.class.st b/src/GToolkit-SearchFilters/GtAsyncSearchGroupStream.class.st index 18a41c341..d94b94cc7 100644 --- a/src/GToolkit-SearchFilters/GtAsyncSearchGroupStream.class.st +++ b/src/GToolkit-SearchFilters/GtAsyncSearchGroupStream.class.st @@ -33,11 +33,6 @@ GtAsyncSearchGroupStream class >> mergeTypeWithTypedGroup: aGroupType [ ^ self ] -{ #category : #'as yet unclassified' } -GtAsyncSearchGroupStream >> asCoder [ - ^ GtFilteredMethodsCoder forFilter: self filter -] - { #category : #accessing } GtAsyncSearchGroupStream >> filter [ ^ filter From 1b5859b40e2e43e41616820b349a6a128403ceaf Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 2 Aug 2023 11:45:43 -0500 Subject: [PATCH 0527/1268] Restore original references tab [feenkcom/gtoolkit#3368] --- src/GToolkit-Coder-UI/GtAbstractRemovePreviewStencil.class.st | 2 +- src/GToolkit-Coder-UI/GtPharoRemoveClassPreviewStencil.class.st | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtAbstractRemovePreviewStencil.class.st b/src/GToolkit-Coder-UI/GtAbstractRemovePreviewStencil.class.st index 4744e4d90..44c27ba7b 100644 --- a/src/GToolkit-Coder-UI/GtAbstractRemovePreviewStencil.class.st +++ b/src/GToolkit-Coder-UI/GtAbstractRemovePreviewStencil.class.st @@ -44,7 +44,7 @@ GtAbstractRemovePreviewStencil >> createPreviewContainerForItemNamed: itemName w aStream print: aSink count; space; - nextPutAll: ('method' asPluralBasedOn: aSink count); + nextPutAll: ('place' asPluralBasedOn: aSink count); nextPutAll: '...' ]) ]; whenSuccess: [ :aContainer :aSink | waitingLabel visibility: BlVisibility gone. diff --git a/src/GToolkit-Coder-UI/GtPharoRemoveClassPreviewStencil.class.st b/src/GToolkit-Coder-UI/GtPharoRemoveClassPreviewStencil.class.st index 84c70bdc6..73e438140 100644 --- a/src/GToolkit-Coder-UI/GtPharoRemoveClassPreviewStencil.class.st +++ b/src/GToolkit-Coder-UI/GtPharoRemoveClassPreviewStencil.class.st @@ -21,5 +21,5 @@ GtPharoRemoveClassPreviewStencil >> classToRemove: aClass [ GtPharoRemoveClassPreviewStencil >> create [ ^ self createPreviewContainerForItemNamed: classToRemove name - withReferences: classToRemove gtReferences + withReferences: classToRemove gtReferences | (GtSearchSubclassesFilter forClass: classToRemove) ] From f0b37294566b5977e6281088580b978e0dfe09ea Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Fri, 4 Aug 2023 12:39:26 +0200 Subject: [PATCH 0528/1268] =?UTF-8?q?Ensure=20tag=20is=20only=20set=20in?= =?UTF-8?q?=20creation=20form=20if=20it=C3=A2=C2=80=C2=99s=20not=20the=20r?= =?UTF-8?q?oot=20tag=20[feenkcom/gtoolkit#3381]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GtCoderNavigationTabsStencil.class.st | 8 ++++---- src/GToolkit-Coder-UI/GtCreationForm.class.st | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index b070b143f..2c5bcbb10 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -135,15 +135,15 @@ GtCoderNavigationTabsStencil >> gtCreationInterface: look [ self formCache removeKey: each ] ]. form class == GtClassCreationForm ifTrue: [ navigationModel - selectedClassDo: [ :aClass | - aClass isClass ifTrue: [ form superclassName: aClass name ] ] ]. + selectedClassDo: [ :aClass | aClass isClass ifTrue: [ form superclassName: aClass name ] ] ]. form hasPackageAndTag ifTrue: [ navigationModel selectedPackageDo: [ :aPackage | form packageAndTagName packageName: aPackage name ]. navigationModel selectedTagDo: [ :aTag | - ((aTag isKindOf: RPackageTag) or: [ aTag isUncategorized not ]) - ifTrue: [ form packageAndTagName tagName: aTag name ] ] ]. + (aTag isKindOf: RPackageTag) + ifTrue: [ aTag isRoot ifFalse: [ form packageAndTagName tagName: aTag name ] ] + ifFalse: [ aTag isUncategorized ifFalse: [ form packageAndTagName tagName: aTag name ] ] ] ]. ((GtCreationFormWidget forForm: form) onAccept: [ :anInstance | look diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index 9126dd9c4..c7ed6dced 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -154,12 +154,12 @@ GtCreationForm >> packageAndTagName: anObject [ { #category : #accessing } GtCreationForm >> selectInNavigationModel: aNavigationModel anInstance: anInstance [ - | aTag | aNavigationModel selectPackage: anInstance package. - aTag := anInstance tags - ifEmpty: [ nil ] - ifNotEmpty: [ anInstance package classTagNamed: anInstance tags first ]. - aNavigationModel selectPackageTag: aTag. + + anInstance tags + ifNotEmpty: [ aNavigationModel + selectPackageTag: (anInstance package classTagNamed: anInstance tags first) ]. + aNavigationModel selectClass: anInstance ] From 7440519ba739241c869cba2c10661444b9e98dbf Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 17 Aug 2023 08:56:08 -0400 Subject: [PATCH 0529/1268] move Coder examples to `gtoolkit-coder` [feenkcom/gtoolkit#3400] --- .../BaselineOfGToolkitCoder.class.st | 10 ++- .../GtMagritteModelExamples.extension.st | 18 ++++ .../GtMagritteViewModelExamples.extension.st | 82 +++++++++++++++++++ 3 files changed, 107 insertions(+), 3 deletions(-) create mode 100644 src/GToolkit-Coder-Examples/GtMagritteModelExamples.extension.st create mode 100644 src/GToolkit-Coder-Examples/GtMagritteViewModelExamples.extension.st diff --git a/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st b/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st index a26596e99..550548971 100644 --- a/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st +++ b/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st @@ -51,7 +51,10 @@ BaselineOfGToolkitCoder >> baseline: spec [ spec repository: 'github://feenkcom/gtoolkit-pager:main/src' ]; baseline: 'GToolkitCompleter' with: [ - spec repository: 'github://feenkcom/gtoolkit-completer:main/src' ]. + spec repository: 'github://feenkcom/gtoolkit-completer:main/src' ]; + baseline: 'GToolkit4Magritte' + with: [ + spec repository: 'github://feenkcom/gt4magritte:main/src' ]. spec package: 'GToolkit-VariableBindings'; @@ -72,7 +75,8 @@ BaselineOfGToolkitCoder >> baseline: spec [ 'GToolkitPager' 'GToolkitCompleter' 'GToolkit-SearchFilters' ) ]; package: 'GToolkit-Coder-UI' with: [ spec requires: #( 'GToolkit-Coder' 'GToolkit-VariableBindings' - 'GToolkitBasicUtility' 'GToolkitPager' 'GToolkitNotifications') ]; + 'GToolkitBasicUtility' 'GToolkitPager' 'GToolkitNotifications' + 'GToolkit4Magritte' ) ]; package: 'GToolkit-Coder-AddOns' with: [ spec requires: #( 'GToolkit-Coder' 'GToolkit-Coder-UI' ) ]; package: 'GToolkit-Coder-Extensions' with: [ @@ -82,5 +86,5 @@ BaselineOfGToolkitCoder >> baseline: spec [ package: 'GToolkit-Coder-Examples' with: [ spec requires: #( 'GToolkit-Coder' 'GToolkit-Coder-UI' 'GToolkit-Coder-AddOns' - 'GToolkit-Coder-Examples-SystemS1' ) ] ] + 'GToolkit-Coder-Examples-SystemS1' 'GToolkit4Magritte' ) ] ] ] diff --git a/src/GToolkit-Coder-Examples/GtMagritteModelExamples.extension.st b/src/GToolkit-Coder-Examples/GtMagritteModelExamples.extension.st new file mode 100644 index 000000000..ad9852b29 --- /dev/null +++ b/src/GToolkit-Coder-Examples/GtMagritteModelExamples.extension.st @@ -0,0 +1,18 @@ +Extension { #name : #GtMagritteModelExamples } + +{ #category : #'*GToolkit-Coder-Examples' } +GtMagritteModelExamples >> simpleBaselineDescription [ + + + ^ MAPriorityContainer withAll: { (MAStringDescription new + accessor: (MADictionaryAccessor key: #baseline); + beAlwaysEditable; + blocCompletion: [ GtClassesCompletionStrategy new ]; + beRequired; + addCondition: [ :aValue | aValue beginsWith: 'BaselineOf' ] + labelled: 'Baseline name must begin with BaselineOf'; + addCondition: [ :aValue | + (Smalltalk globals includesKey: aValue asSymbol) not ] + labelled: 'Baseline name must be a non-existent class'; + comment: 'Baseline name') } +] diff --git a/src/GToolkit-Coder-Examples/GtMagritteViewModelExamples.extension.st b/src/GToolkit-Coder-Examples/GtMagritteViewModelExamples.extension.st new file mode 100644 index 000000000..be13c22da --- /dev/null +++ b/src/GToolkit-Coder-Examples/GtMagritteViewModelExamples.extension.st @@ -0,0 +1,82 @@ +Extension { #name : #GtMagritteViewModelExamples } + +{ #category : #'*GToolkit-Coder-Examples' } +GtMagritteViewModelExamples >> asyncViewModelWithSimpleBaseline [ + + + | aViewModel anObject aDescription | + anObject := self simpleBaselineObject. + aDescription := self simpleBaselineDescription. + aViewModel := GtMagritteViewModel + forObject: anObject + description: aDescription. + + self assert: aViewModel mementoFuture isAsyncFuture. + + ^ aViewModel +] + +{ #category : #'*GToolkit-Coder-Examples' } +GtMagritteViewModelExamples >> asyncViewModelWithSimpleBaselines [ + + + | aViewModel anObject aDescription | + anObject := GtMagritteModelExamples new simpleBaselinesObject. + aDescription := GtMagritteModelExamples new + simpleBaselinesDescription. + aViewModel := GtMagritteViewModel + forObject: anObject + description: aDescription. + + self assert: aViewModel mementoFuture isAsyncFuture. + + ^ aViewModel +] + +{ #category : #'*GToolkit-Coder-Examples' } +GtMagritteViewModelExamples >> elementWithSimpleBaseline [ + + + | aViewModel anElement | + aViewModel := self asyncViewModelWithSimpleBaseline. + anElement := aViewModel asElement. + + self assert: anElement isNotNil. + + ^ anElement +] + +{ #category : #'*GToolkit-Coder-Examples' } +GtMagritteViewModelExamples >> simpleBaselineDescription [ + + + ^ GtMagritteModelExamples new simpleBaselineDescription +] + +{ #category : #'*GToolkit-Coder-Examples' } +GtMagritteViewModelExamples >> viewModelWithBaselines [ + + + | aViewModel anObject aDescription | + anObject := GtMagritteModelExamples new simpleBaselinesObject. + aDescription := GtMagritteModelExamples new + simpleBaselinesDescription. + aViewModel := GtMagritteViewModel + forObject: anObject + description: aDescription. + + self assert: aViewModel mementoFuture isAsyncFuture. + + ^ aViewModel +] + +{ #category : #'*GToolkit-Coder-Examples' } +GtMagritteViewModelExamples >> viewModelWithBaselinesWithoutSaveOrCancelButton [ + + | aViewModel | + aViewModel := self viewModelWithBaselines. + + aViewModel actions: #(). + + ^ aViewModel +] From 0fce24b2144d51844c8b1d95dd0975f42a180ea8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Thu, 17 Aug 2023 16:26:56 +0200 Subject: [PATCH 0530/1268] Move RBReplaceMethodRefactoring>>gtPreconditions [feenkcom/gtoolkit#3334] --- .../RBReplaceMethodRefactoring.extension.st | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 src/GToolkit-Coder/RBReplaceMethodRefactoring.extension.st diff --git a/src/GToolkit-Coder/RBReplaceMethodRefactoring.extension.st b/src/GToolkit-Coder/RBReplaceMethodRefactoring.extension.st deleted file mode 100644 index 5f7e3047b..000000000 --- a/src/GToolkit-Coder/RBReplaceMethodRefactoring.extension.st +++ /dev/null @@ -1,10 +0,0 @@ -Extension { #name : #RBReplaceMethodRefactoring } - -{ #category : #'*GToolkit-Coder' } -RBReplaceMethodRefactoring >> gtPreconditions [ - |conditions| - conditions := (RBCondition withBlock: [ self haveSameNumberOfArgs. true]) - &(RBCondition definesSelector: oldSelector in: class ) - & (RBCondition definesSelector: newSelector in: class ). - ^ conditions -] From 1baefb51dd31a89148f6864c71fd3081fa41c6cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Thu, 17 Aug 2023 22:03:56 +0200 Subject: [PATCH 0531/1268] Move some extensions methods directly to refactoring classes [feenkcom/gtoolkit#3334] --- .../GtRBAddPoolVariableRefactoring.extension.st | 12 ------------ .../GtRBAddTraitUsageRefactoring.extension.st | 12 ------------ .../GtRBChangeSuperclassRefactoring.extension.st | 12 ------------ .../GtRBRemovePoolVariableRefactoring.extension.st | 12 ------------ .../GtRBRemoveTraitUsageRefactoring.extension.st | 12 ------------ 5 files changed, 60 deletions(-) delete mode 100644 src/GToolkit-Coder-UI/GtRBAddPoolVariableRefactoring.extension.st delete mode 100644 src/GToolkit-Coder-UI/GtRBAddTraitUsageRefactoring.extension.st delete mode 100644 src/GToolkit-Coder-UI/GtRBChangeSuperclassRefactoring.extension.st delete mode 100644 src/GToolkit-Coder-UI/GtRBRemovePoolVariableRefactoring.extension.st delete mode 100644 src/GToolkit-Coder-UI/GtRBRemoveTraitUsageRefactoring.extension.st diff --git a/src/GToolkit-Coder-UI/GtRBAddPoolVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/GtRBAddPoolVariableRefactoring.extension.st deleted file mode 100644 index a28c86be5..000000000 --- a/src/GToolkit-Coder-UI/GtRBAddPoolVariableRefactoring.extension.st +++ /dev/null @@ -1,12 +0,0 @@ -Extension { #name : #GtRBAddPoolVariableRefactoring } - -{ #category : #'*GToolkit-Coder-UI' } -GtRBAddPoolVariableRefactoring >> gtDescription [ - - - ^ ('Add' asRopedText glamorousRoundedBackground) - append: ' pool named ' asRopedText; - append: variableName asRopedText glamorousRoundedBackground; - append: ' to ' asRopedText; - append: class name asRopedText -] diff --git a/src/GToolkit-Coder-UI/GtRBAddTraitUsageRefactoring.extension.st b/src/GToolkit-Coder-UI/GtRBAddTraitUsageRefactoring.extension.st deleted file mode 100644 index 980c7e2b1..000000000 --- a/src/GToolkit-Coder-UI/GtRBAddTraitUsageRefactoring.extension.st +++ /dev/null @@ -1,12 +0,0 @@ -Extension { #name : #GtRBAddTraitUsageRefactoring } - -{ #category : #'*GToolkit-Coder-UI' } -GtRBAddTraitUsageRefactoring >> gtDescription [ - - - ^ ('Add' asRopedText glamorousRoundedBackground) - append: ' trait usage ' asRopedText; - append: traitName asRopedText glamorousRoundedBackground; - append: ' to ' asRopedText; - append: class name asRopedText -] diff --git a/src/GToolkit-Coder-UI/GtRBChangeSuperclassRefactoring.extension.st b/src/GToolkit-Coder-UI/GtRBChangeSuperclassRefactoring.extension.st deleted file mode 100644 index dbb42dd69..000000000 --- a/src/GToolkit-Coder-UI/GtRBChangeSuperclassRefactoring.extension.st +++ /dev/null @@ -1,12 +0,0 @@ -Extension { #name : #GtRBChangeSuperclassRefactoring } - -{ #category : #'*GToolkit-Coder-UI' } -GtRBChangeSuperclassRefactoring >> gtDescription [ - - - ^ ('Change' asRopedText glamorousRoundedBackground) - append: ' superclass of ' asRopedText; - append: className asRopedText; - append: ' to ' asRopedText; - append: newSuperclass name asRopedText glamorousRoundedBackground -] diff --git a/src/GToolkit-Coder-UI/GtRBRemovePoolVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/GtRBRemovePoolVariableRefactoring.extension.st deleted file mode 100644 index ce2c470ec..000000000 --- a/src/GToolkit-Coder-UI/GtRBRemovePoolVariableRefactoring.extension.st +++ /dev/null @@ -1,12 +0,0 @@ -Extension { #name : #GtRBRemovePoolVariableRefactoring } - -{ #category : #'*GToolkit-Coder-UI' } -GtRBRemovePoolVariableRefactoring >> gtDescription [ - - - ^ ('Remove' asRopedText glamorousRoundedBackground) - append: ' pool named ' asRopedText; - append: variableName asRopedText glamorousRoundedBackground; - append: ' from ' asRopedText; - append: class name asRopedText -] diff --git a/src/GToolkit-Coder-UI/GtRBRemoveTraitUsageRefactoring.extension.st b/src/GToolkit-Coder-UI/GtRBRemoveTraitUsageRefactoring.extension.st deleted file mode 100644 index dc0d9ab05..000000000 --- a/src/GToolkit-Coder-UI/GtRBRemoveTraitUsageRefactoring.extension.st +++ /dev/null @@ -1,12 +0,0 @@ -Extension { #name : #GtRBRemoveTraitUsageRefactoring } - -{ #category : #'*GToolkit-Coder-UI' } -GtRBRemoveTraitUsageRefactoring >> gtDescription [ - - - ^ ('Remove' asRopedText glamorousRoundedBackground) - append: ' trait usage ' asRopedText; - append: traitName asRopedText glamorousRoundedBackground; - append: ' from ' asRopedText; - append: class name asRopedText -] From 11520906b0650387e6d385639d7912f6b0fae868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Fri, 18 Aug 2023 17:47:56 +0200 Subject: [PATCH 0532/1268] Do not set topContext: as it does not seem to be used --- src/GToolkit-Coder/DebugSession.extension.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder/DebugSession.extension.st b/src/GToolkit-Coder/DebugSession.extension.st index 8dc418983..8a109446d 100644 --- a/src/GToolkit-Coder/DebugSession.extension.st +++ b/src/GToolkit-Coder/DebugSession.extension.st @@ -3,7 +3,7 @@ Extension { #name : #DebugSession } { #category : #'*GToolkit-Coder' } DebugSession >> gtCreateModelForContext: aContext [ - ^ (GtDebugContext forContext: aContext) topContext: interruptedContext + ^ (GtDebugContext forContext: aContext) "topContext: interruptedContext" ] { #category : #'*GToolkit-Coder' } From 5d9e429481846caa86c7191b88f64aed23ee8acb Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 21 Aug 2023 14:42:16 +0200 Subject: [PATCH 0533/1268] [feenkcom/gtoolkit#3404] always pass #requested: to a completion strategy --- .../GtFilterDescriptorExamples.class.st | 26 +++++ .../GtFilterTagElementExamples.class.st | 30 ++++++ .../GtFilterDescriptor.class.st | 19 +++- .../GtFilterTagElement.class.st | 97 ++++++++++++++++--- .../GtClassesCompletionStrategy.class.st | 2 +- ...lassWithPackageCompletionStrategy.class.st | 2 +- ...tPackageClassesCompletionStrategy.class.st | 2 +- .../GtPackagesCompletionStrategy.class.st | 2 +- .../GtPoolsCompletionStrategy.class.st | 2 +- .../GtTraitsCompletionStrategy.class.st | 2 +- 10 files changed, 159 insertions(+), 25 deletions(-) diff --git a/src/GToolkit-Coder-Examples/GtFilterDescriptorExamples.class.st b/src/GToolkit-Coder-Examples/GtFilterDescriptorExamples.class.st index 79b90b328..2e0b23c66 100644 --- a/src/GToolkit-Coder-Examples/GtFilterDescriptorExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtFilterDescriptorExamples.class.st @@ -4,6 +4,32 @@ Class { #category : #'GToolkit-Coder-Examples-Filters' } +{ #category : #examples } +GtFilterDescriptorExamples >> filterDescriptorOffersCompletionValues [ + + | aFilterDescriptor | + + aFilterDescriptor := self newFilterDescriptor + offerCompletionValues: true; + emptyDefaultValue: 'Lorem'; + completion: [ GtStreamedBlockCompletionStrategy new streamingBlock: [ :aText | (String loremIpsum piecesCutWhere: [:each :next | next = Character space]) asAsyncStream ] ]. + + self assert: aFilterDescriptor name equals: 'No name'. + self assert: aFilterDescriptor order equals: 1. + self assert: (aFilterDescriptor completion isKindOf: GtStreamedBlockCompletionStrategy). + self assert: aFilterDescriptor valueIsRequired. + self assert: aFilterDescriptor isDefault. + self assert: aFilterDescriptor emptyDefaultValue equals: 'Lorem'. + self assert: aFilterDescriptor showAsDefaultWhenEmpty. + self assert: aFilterDescriptor shouldOfferCompletionValues. + + self + assert: (aFilterDescriptor newFilterWithValue: '') + equals: GtSearchNullFilter new. + + ^ aFilterDescriptor +] + { #category : #examples } GtFilterDescriptorExamples >> filterDescriptorValueNotRequired [ diff --git a/src/GToolkit-Coder-Examples/GtFilterTagElementExamples.class.st b/src/GToolkit-Coder-Examples/GtFilterTagElementExamples.class.st index 17a9ad34a..6fe9959e0 100644 --- a/src/GToolkit-Coder-Examples/GtFilterTagElementExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtFilterTagElementExamples.class.st @@ -30,6 +30,36 @@ GtFilterTagElementExamples >> availableFilterDescriptors [ } ] +{ #category : #examples } +GtFilterTagElementExamples >> filterOffersCompletionValues [ + + ^ GtFilterDescriptorExamples new filterDescriptorOffersCompletionValues + named: 'Words' +] + +{ #category : #examples } +GtFilterTagElementExamples >> filterTagCompletionOffersValues [ + + | tagElement filterDescriptor | + + filterDescriptor := self filterOffersCompletionValues. + + tagElement := GtFilterTagElement new + descriptor: filterDescriptor; + availableFilterDescriptors: self availableFilterDescriptors. + + self + assert: (tagElement query // GtFilterTagLabelId) anyOne text asString + equals: 'Words'. + + "there is no editor" + "self assert: (tagElement query // GtFilterTagEditorId) isEmpty. + + self assert: tagElement isValid." + + ^ tagElement +] + { #category : #examples } GtFilterTagElementExamples >> filterTagValueNotRequired [ diff --git a/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st b/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st index 48e2be4f2..b473ed9ce 100644 --- a/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st +++ b/src/GToolkit-Coder-UI/GtFilterDescriptor.class.st @@ -19,7 +19,8 @@ Class { 'completionBlock', 'completion', 'emptyDefaultValue', - 'valueIsRequired' + 'valueIsRequired', + 'offerCompletionValues' ], #category : #'GToolkit-Coder-UI-Filters' } @@ -163,7 +164,8 @@ GtFilterDescriptor >> gtInfoFor: aView [ 'Default value when empty' -> (emptyDefaultValue ifNotNil: [ :aValue | aValue printString ] ifNil: [ 'Unspecified (default: {1})' format: { nil } ]). - 'Show default value when empty' -> self showAsDefaultWhenEmpty + 'Show default value when empty' -> self showAsDefaultWhenEmpty. + 'Offers user completion items' -> self shouldOfferCompletionValues } ]; column: 'Property' text: #key; column: 'Value' text: #value; @@ -193,7 +195,8 @@ GtFilterDescriptor >> initialize [ super initialize. valueIsRequired := true. - isDefault := true + isDefault := true. + offerCompletionValues := false ] { #category : #testing } @@ -244,6 +247,11 @@ GtFilterDescriptor >> newFilterWithValue: aString [ ^ self creationBlock cull: aString ] +{ #category : #'api - configuration' } +GtFilterDescriptor >> offerCompletionValues: aBoolean [ + offerCompletionValues := aBoolean +] + { #category : #accessing } GtFilterDescriptor >> order [ "The order of the filter in the list of all filters." @@ -268,6 +276,11 @@ GtFilterDescriptor >> printOn: aStream [ nextPutAll: ')' ] +{ #category : #testing } +GtFilterDescriptor >> shouldOfferCompletionValues [ + ^ offerCompletionValues +] + { #category : #testing } GtFilterDescriptor >> showAsDefaultWhenEmpty [ ^ isDefault and: [ valueIsRequired not or: [ emptyDefaultValue notNil ] ] diff --git a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st index 02b28df9e..712e39c38 100644 --- a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st @@ -57,6 +57,84 @@ GtFilterTagElement >> availableFilterDescriptors: aCollectionOfFilterDescriptors availableFilterDescriptors := aCollectionOfFilterDescriptors ] +{ #category : #'api - accessing' } +GtFilterTagElement >> createAndAddCompletionValuesDropdown [ + | aDefaultValue | + + aDefaultValue := filterDescriptor emptyDefaultValue ifNil: [ '' ]. + + self addChild: (self createFilterLabel + id: GtFilterTagLabelId; + text: aDefaultValue; + addAptitude: (BrGlamorousWithDropdownAptitude + handle: [ + BrHorizontalPane new + fitContent; + addChildren: { + self createFilterLabel text: aDefaultValue. + self createFilterPickerHandle. + } ] + content: [ self createCompletionValuesDropdownContent ])). + self addChild: self createFilterPickerHandle. + +] + +{ #category : #'api - accessing' } +GtFilterTagElement >> createAndAddFilterValueEditor [ + | aDefaultValue | + aDefaultValue := filterDescriptor emptyDefaultValue ifNil: [ '' ]. + + self + childWithId: GtFilterTagEditorId + ifFound: [ :anEditor | anEditor text: aDefaultValue ] + ifNone: [ self addChild: (self createEditableLabel text: aDefaultValue) ]. + + self + childWithId: GtFilterTagEditorId + ifFound: [ :anEditor | + filterDescriptor completion + ifNotNil: [ :strategy | + (GtCompletionController on: anEditor strategy: strategy) install ] + ifNil: [ + (GtCompletionController on: anEditor strategy: GtCompletionStrategy new) install ] ] +] + +{ #category : #'private - instance creation' } +GtFilterTagElement >> createCompletionValuesDropdownContent [ + ^ BrSimpleList new + fitContent; + stencil: [ :eachCompletionAction :eachIndex | + BrHorizontalPane new + id: (GtFilterTagPickerItemId indexed: eachIndex); + hMatchParent; + vFitContent; + padding: (BlInsets all: 5); + aptitude: (BrStyleCommonAptitude new + default: [ :s | s background: Color transparent ]; + hovered: [ :s | s background: self theme button defaultBorderColor ]; + yourself); + when: BlClickEvent + do: [ :anEvent | + anEvent consumed: true. + anEvent currentTarget fireEvent: BrDropdownHideWish new. + self + requestUpdateFilter: filterDescriptor + value: eachCompletionAction displayText asString trimmed ]; + addChild: (BrLabel new + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont glamorousCodeSmallSize; + text: eachCompletionAction displayText; + yourself); + yourself ]; + stream: (filterDescriptor completion + ifNil: [ AsyncEmptyStream new ] + ifNotNil: [ :aCompletion | + (aCompletion + completionResultFor: '' + at: 0 + requested: true) asAsyncStream ]); + yourself +] + { #category : #'private - instance creation' } GtFilterTagElement >> createDropdownContent [ ^ BrSimpleList new @@ -167,22 +245,9 @@ GtFilterTagElement >> descriptor: aFilterDescriptor [ filterDescriptor valueIsRequired ifTrue: [ - | aDefaultValue | - - aDefaultValue := aFilterDescriptor emptyDefaultValue - ifNil: [ '' ]. - - self - childWithId: GtFilterTagEditorId - ifFound: [ :anEditor | anEditor text: aDefaultValue ] - ifNone: [ self addChild: (self createEditableLabel text: aDefaultValue) ]. - - self - childWithId: GtFilterTagEditorId - ifFound: [ :anEditor | - filterDescriptor completion - ifNotNil: [ :strategy | (GtCompletionController on: anEditor strategy: strategy) install ] - ifNil: [ (GtCompletionController on: anEditor strategy: GtCompletionStrategy new) install ] ] ] + filterDescriptor shouldOfferCompletionValues + ifTrue: [ self createAndAddCompletionValuesDropdown ] + ifFalse: [ self createAndAddFilterValueEditor ] ] ifFalse: [ self childWithId: GtFilterTagEditorId diff --git a/src/GToolkit-Coder/GtClassesCompletionStrategy.class.st b/src/GToolkit-Coder/GtClassesCompletionStrategy.class.st index b218fb9c1..4c3f06877 100644 --- a/src/GToolkit-Coder/GtClassesCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtClassesCompletionStrategy.class.st @@ -17,7 +17,7 @@ GtClassesCompletionStrategy >> candidateClasses [ ] { #category : #accessing } -GtClassesCompletionStrategy >> completionActionStreamFor: aText at: positionInteger [ +GtClassesCompletionStrategy >> completionActionStreamFor: aText at: positionInteger requested: aBoolean [ | currentInput | currentInput := aText asString. currentInput isEmpty ifTrue: [ ^ #() asAsyncStream ]. diff --git a/src/GToolkit-Coder/GtCoderClassWithPackageCompletionStrategy.class.st b/src/GToolkit-Coder/GtCoderClassWithPackageCompletionStrategy.class.st index 9c213d878..c3ea38699 100644 --- a/src/GToolkit-Coder/GtCoderClassWithPackageCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtCoderClassWithPackageCompletionStrategy.class.st @@ -26,7 +26,7 @@ GtCoderClassWithPackageCompletionStrategy >> classesIn: aPackage [ ] { #category : #accessing } -GtCoderClassWithPackageCompletionStrategy >> completionActionStreamFor: aText at: positionInteger [ +GtCoderClassWithPackageCompletionStrategy >> completionActionStreamFor: aText at: positionInteger requested: aBoolean [ | currentInput delimitedIndex | currentInput := aText asString. delimitedIndex := currentInput indexOf: $>. diff --git a/src/GToolkit-Coder/GtPackageClassesCompletionStrategy.class.st b/src/GToolkit-Coder/GtPackageClassesCompletionStrategy.class.st index 9923bf6d8..dd63a5708 100644 --- a/src/GToolkit-Coder/GtPackageClassesCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtPackageClassesCompletionStrategy.class.st @@ -18,7 +18,7 @@ GtPackageClassesCompletionStrategy >> classStreamMatching: aString [ ] { #category : #accessing } -GtPackageClassesCompletionStrategy >> completionActionStreamFor: aText at: positionInteger [ +GtPackageClassesCompletionStrategy >> completionActionStreamFor: aText at: positionInteger requested: aBoolean [ | string | string := aText asString. ^ (self classStreamMatching: string) collect: [ :each | GtReplaceTextCompletionAction forText: each name ] diff --git a/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st b/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st index bb0b86d6d..c26ea5db2 100644 --- a/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st @@ -47,7 +47,7 @@ GtPackagesCompletionStrategy class >> packageStreamMatching: searchString [ ] { #category : #accessing } -GtPackagesCompletionStrategy >> completionActionStreamFor: aText at: positionInteger [ +GtPackagesCompletionStrategy >> completionActionStreamFor: aText at: positionInteger requested: aBoolean [ | string searchString | string := aText asString. string isEmpty ifTrue: [ ^ #() ]. diff --git a/src/GToolkit-Coder/GtPoolsCompletionStrategy.class.st b/src/GToolkit-Coder/GtPoolsCompletionStrategy.class.st index 1e6ad48cb..ce4126d85 100644 --- a/src/GToolkit-Coder/GtPoolsCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtPoolsCompletionStrategy.class.st @@ -18,7 +18,7 @@ GtPoolsCompletionStrategy >> candidatePools [ ] { #category : #accessing } -GtPoolsCompletionStrategy >> completionActionStreamFor: aText at: positionInteger [ +GtPoolsCompletionStrategy >> completionActionStreamFor: aText at: positionInteger requested: aBoolean [ | currentInput | currentInput := aText asString. ^ (self candidatePools asyncStreamStartingWith: currentInput) diff --git a/src/GToolkit-Coder/GtTraitsCompletionStrategy.class.st b/src/GToolkit-Coder/GtTraitsCompletionStrategy.class.st index 3f2a68c87..d41f9dce5 100644 --- a/src/GToolkit-Coder/GtTraitsCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtTraitsCompletionStrategy.class.st @@ -16,7 +16,7 @@ GtTraitsCompletionStrategy >> candidateTraits [ ] { #category : #accessing } -GtTraitsCompletionStrategy >> completionActionStreamFor: aText at: positionInteger [ +GtTraitsCompletionStrategy >> completionActionStreamFor: aText at: positionInteger requested: aBoolean [ | currentInput | currentInput := aText asString. ^ (self candidateTraits asyncStreamStartingWith: currentInput) From a78401acc7e05fad4bef77de760ed8868a71f456 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 21 Aug 2023 11:24:39 -0400 Subject: [PATCH 0534/1268] move Coder examples to `gtoolkit-coder` [feenkcom/gtoolkit#3400] --- .../GtMagritteModelExamples.extension.st | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/src/GToolkit-Coder-Examples/GtMagritteModelExamples.extension.st b/src/GToolkit-Coder-Examples/GtMagritteModelExamples.extension.st index ad9852b29..db14ade55 100644 --- a/src/GToolkit-Coder-Examples/GtMagritteModelExamples.extension.st +++ b/src/GToolkit-Coder-Examples/GtMagritteModelExamples.extension.st @@ -16,3 +16,71 @@ GtMagritteModelExamples >> simpleBaselineDescription [ labelled: 'Baseline name must be a non-existent class'; comment: 'Baseline name') } ] + +{ #category : #'*GToolkit-Coder-Examples' } +GtMagritteModelExamples >> simpleBaselinesDescription [ + + ^ MAPriorityContainer + withAll: {MAToManyRelationDescription new + label: 'Baselines'; + classes: {String}; + accessor: (MADictionaryAccessor key: #baselines); + blocListStencil: [ :aMemento :aDescription :aForm | + | aTagger | + aTagger := BrTagger new. + aTagger + hMatchParent; + vFitContent. + aForm hMatchParent. + aTagger + aptitude: (BrGlamorousTaggerEditableAptitude new + tagLabel: [ :aTag | + | aLabel | + aLabel := BrEditableLabel new + text: aTag name; + aptitude: (BrGlamorousEditableLabelAptitude new + glamorousCodeFont; + defaultForeground: Color black; + fontSize: 10). + + (GtCompletionController + on: aLabel + strategy: GtClassesCompletionStrategy new) install. + + aLabel ]). + aTagger + when: BrTaggerAddTagRequest + do: [ :aRequest | + | aValue | + aValue := (aTagger tags collect: #name) + add: aRequest tag name; + yourself. + GtMagritteBuilderUtility + write: aValue + using: aDescription + memento: aMemento + element: aTagger ]. + aTagger + when: BrTaggerRemoveTagRequest + do: [ :aRequest | + | aValue | + aValue := (aTagger tags collect: #name) + remove: aRequest tag name; + yourself. + GtMagritteBuilderUtility + write: aValue + using: aDescription + memento: aMemento + element: aTagger ]. + aTagger + withAsyncSinkDo: [ :anElementSink | + anElementSink + sink: AsyncPeekSink new; + whenUpdate: [ :theTagger :aSink | + | theValues theTexts | + theValues := aSink value currentValue. + theTexts := theValues + collect: [ :each | aDescription displayStringFor: each ]. + theTagger namedTags: theTexts ]. + (aMemento readObservableValueUsing: aDescription) observe: anElementSink ] ]} +] From a5c87b56d359c7b42b628a01cb9385790fc29cb9 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 23 Aug 2023 17:50:20 -0400 Subject: [PATCH 0535/1268] set the Coder hierarchy dropdown preferred extent --- src/GToolkit-Coder-UI/Behavior.extension.st | 1 + 1 file changed, 1 insertion(+) diff --git a/src/GToolkit-Coder-UI/Behavior.extension.st b/src/GToolkit-Coder-UI/Behavior.extension.st index 81a28ff45..226a3d4e8 100644 --- a/src/GToolkit-Coder-UI/Behavior.extension.st +++ b/src/GToolkit-Coder-UI/Behavior.extension.st @@ -45,6 +45,7 @@ Behavior >> gtHierarchyButtonFor: anAction [ icon: BrGlamorousIcons tree; id: GtCoderClassHierarchyButtonId; priority: 3; + preferredExtent: 400 @ 400; content: [ :aButton | | aNavigationModel | aNavigationModel := aButton phlow firstParentCoderNavigationModel. From ed7f389a6c17babb76969eb8bf292f4a4448bc0c Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 25 Aug 2023 13:06:15 -0500 Subject: [PATCH 0536/1268] Correctly handle renaming classes within coder [feenkcom/gtoolkit#3408] --- src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st index b1d359acf..3aaf756f6 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st @@ -261,5 +261,7 @@ GtCoderNavigationElement >> updateContent [ { #category : #'updating lists' } GtCoderNavigationElement >> updateSelectedClass [ self hasNavigationModel ifFalse: [ ^ self ]. - navigationModel selectedClassDo: [ :aClass | self selectClass: aClass ] + navigationModel selectedClassDo: [ :aClass | + navigationModel selectClass: aClass. + self selectClass: aClass ] ] From 04a5431a8a05f78532e98f29b6004700a4367c0c Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 25 Aug 2023 15:09:51 -0500 Subject: [PATCH 0537/1268] Revert "Correctly handle renaming classes within coder [feenkcom/gtoolkit#3408]" This reverts commit ed7f389a6c17babb76969eb8bf292f4a4448bc0c. --- src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st index 3aaf756f6..b1d359acf 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st @@ -261,7 +261,5 @@ GtCoderNavigationElement >> updateContent [ { #category : #'updating lists' } GtCoderNavigationElement >> updateSelectedClass [ self hasNavigationModel ifFalse: [ ^ self ]. - navigationModel selectedClassDo: [ :aClass | - navigationModel selectClass: aClass. - self selectClass: aClass ] + navigationModel selectedClassDo: [ :aClass | self selectClass: aClass ] ] From ed04a1964ef015259694ef62682951fe7c06e4b0 Mon Sep 17 00:00:00 2001 From: John Brant Date: Wed, 30 Aug 2023 09:22:24 -0500 Subject: [PATCH 0538/1268] changing editor interaction for extract to component refactoring --- src/GToolkit-Coder-AddOns/GtRenameEditor.class.st | 1 + src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-AddOns/GtRenameEditor.class.st b/src/GToolkit-Coder-AddOns/GtRenameEditor.class.st index b8903ddf9..4b75a8bbd 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameEditor.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameEditor.class.st @@ -7,6 +7,7 @@ Class { { #category : #accessing } GtRenameEditor >> initialize [ super initialize. + self userData at: #isRefactoringEditor put: true. self when: BlFocusEvent do: [ :anEvent | diff --git a/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st b/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st index 157aa5ee9..7ab15c31f 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st @@ -120,7 +120,7 @@ GtRenameEditorAttribute >> focusNext: aBoolean in: anEditorElement [ coordinateFocus ifFalse: [ ^ false ]. anEditorElement allChildrenBreadthFirstDo: [ :each | - (each isKindOf: GtRenameEditor) + (each userData at: #isRefactoringEditor ifAbsent: [ false ]) ifTrue: [ first ifNil: [ first := each ]. last := each. (aBoolean not and: [ each == renameEditor and: [ previous notNil ] ]) From 4b37522fbb2571e4886ad93c7965dae7d0451e89 Mon Sep 17 00:00:00 2001 From: John Brant Date: Wed, 30 Aug 2023 12:44:12 -0500 Subject: [PATCH 0539/1268] [feenkcom/gtoolkit#3434] use instance side class name --- src/GToolkit-Coder-Extensions/CompiledMethod.extension.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st b/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st index 15ed38423..1898ee174 100644 --- a/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st +++ b/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st @@ -25,7 +25,7 @@ CompiledMethod >> gtLocalVersionsFor: aView [ priority: 20; items: [ SourceFiles changeRecordsFrom: self sourcePointer - className: self methodClass name + className: self methodClass instanceSide name isMeta: self methodClass isMeta ]; itemStencil: [ GtLocalVersion new ]; itemDataBinder: [ :aLocalVersionElement :aLocalVersion | From 68af3371b13b9172ecba96cd27503bef10984f61 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 6 Sep 2023 08:55:56 -0500 Subject: [PATCH 0540/1268] Make methods upTo filter work [feenkcom/gtoolkit#3379] --- .../GtFilteredCodersModel.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st b/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st index 3c196cb9c..b28b1e5dc 100644 --- a/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st +++ b/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st @@ -47,7 +47,7 @@ GtFilteredCodersModel >> createCombinedFilterFor: aMainSearchFilter andAdditiona aCompositeFilter := aCollectionOfFilters inject: nil - into: [ :sum :each | sum ifNil: [ each ] ifNotNil: [ sum | each ] ]. + into: [ :sum :each | sum ifNil: [ each ] ifNotNil: [ sum & each ] ]. aCompositeFilter := aCompositeFilter ifNil: [ aMainSearchFilter ] From a10d13d021b686e81a7d10b3791d808caa3dd298 Mon Sep 17 00:00:00 2001 From: Alistair Grant Date: Mon, 18 Sep 2023 08:31:58 +0200 Subject: [PATCH 0541/1268] [feenkcom/gtoolkit#3454] Add support for serialising an evaluated result. --- .../GtCoderCodeExecutor.class.st | 13 +++++++++ ...eCoderDoItAndGoSerializedActionId.class.st | 10 +++++++ ...rDoItAndInspectSerializedShortcut.class.st | 29 +++++++++++++++++++ .../GtSourceCoderViewModel.class.st | 25 ++++++++++++++++ 4 files changed, 77 insertions(+) create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderDoItAndGoSerializedActionId.class.st create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectSerializedShortcut.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st b/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st index d457e3127..8e7d7bf14 100644 --- a/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st +++ b/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st @@ -28,6 +28,12 @@ GtCoderCodeExecutor class >> doItAndGo [ ^ self new doItAndGo ] +{ #category : #'api - instance creation' } +GtCoderCodeExecutor class >> doItAndGoSerialized [ + "Execute a code and display the execution result" + ^ self new doItAndGoSerialized +] + { #category : #'api - instance creation' } GtCoderCodeExecutor class >> playAll [ "Execute a method code (and do not display the execution result)" @@ -69,6 +75,13 @@ GtCoderCodeExecutor >> doItAndGo [ action := #doItAndGo ] +{ #category : #initialization } +GtCoderCodeExecutor >> doItAndGoSerialized [ + "Execute a code and display the execution result" + + action := #doItAndGoSerialized +] + { #category : #'api - accessing' } GtCoderCodeExecutor >> element [ ^ element diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDoItAndGoSerializedActionId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDoItAndGoSerializedActionId.class.st new file mode 100644 index 000000000..ebbe0ae95 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderDoItAndGoSerializedActionId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtSourceCoderDoItAndGoSerializedActionId, + #superclass : #GtCoderElementId, + #category : #'GToolkit-Coder-UI-Coder - Ids' +} + +{ #category : #converting } +GtSourceCoderDoItAndGoSerializedActionId >> asSymbol [ + ^ #'source-coder--doit-and-go-serialized-action' +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectSerializedShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectSerializedShortcut.class.st new file mode 100644 index 000000000..8f14348af --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectSerializedShortcut.class.st @@ -0,0 +1,29 @@ +Class { + #name : #GtSourceCoderDoItAndInspectSerializedShortcut, + #superclass : #GtSourceCoderShortcut, + #category : #'GToolkit-Coder-UI-Shortcuts' +} + +{ #category : #accessing } +GtSourceCoderDoItAndInspectSerializedShortcut >> description [ + ^ 'Evaluates the whole source code or just the selection and inspects the serialized result.' +] + +{ #category : #initialization } +GtSourceCoderDoItAndInspectSerializedShortcut >> initialize [ + super initialize. + + combination := BlKeyCombination primaryShiftG +] + +{ #category : #accessing } +GtSourceCoderDoItAndInspectSerializedShortcut >> name [ + ^ 'Do it and inspect serialized' +] + +{ #category : #evaluation } +GtSourceCoderDoItAndInspectSerializedShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ + GtCoderExecutionContextVariable + element: aBrEditorElement + do: [ aSourceCoderViewModel doItAndGoSerialized ] +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st index 58ada41d8..cee859aad 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st @@ -96,6 +96,31 @@ GtSourceCoderViewModel >> doItAndGoAll [ ^ self coder doItAndGoInContext: self evaluationContext all ] +{ #category : #'api - actions' } +GtSourceCoderViewModel >> doItAndGoAllSerialized [ + "Evaluate the whole source code and inspect the result" + + ^ self coder doItAndGoInContext: (self evaluationContext all + serializationStrategy: #GtRsrStonSerializationStrategy) +] + +{ #category : #'api - actions' } +GtSourceCoderViewModel >> doItAndGoSerialized [ + "Evaluate selected source code or everything if there is nothing selected and inspect the result" + + ^ self selection isEmpty + ifTrue: [ self doItAndGoAllSerialized ] + ifFalse: [ self doItAndGoSerialized: self selectedTextInterval ] +] + +{ #category : #'api - actions' } +GtSourceCoderViewModel >> doItAndGoSerialized: aTextInterval [ + "Evaluate a piece of source code within an interval and inspect a result." + + ^ self coder doItAndGoInContext: ((self evaluationContext from: aTextInterval first to: aTextInterval last) + serializationStrategy: #GtRsrStonSerializationStrategy) +] + { #category : #'api - actions' } GtSourceCoderViewModel >> doItRequestedBy: aRequesterObject [ "Evaluate selected source code or everything if there is nothing selected and return the result" From 1a3f58898ac364934ed21d285a2e992acf92bd87 Mon Sep 17 00:00:00 2001 From: John Brant Date: Mon, 18 Sep 2023 08:46:18 -0500 Subject: [PATCH 0542/1268] [feenkcom/gtoolkit#3451] add renamer for added parameter --- .../GtAbstractRenameAction.class.st | 14 +++++++++++++- .../GtCoderViewModelRenameAction.class.st | 17 +++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtAbstractRenameAction.class.st b/src/GToolkit-Coder-AddOns/GtAbstractRenameAction.class.st index 3bcdc4f26..6a706faed 100644 --- a/src/GToolkit-Coder-AddOns/GtAbstractRenameAction.class.st +++ b/src/GToolkit-Coder-AddOns/GtAbstractRenameAction.class.st @@ -11,13 +11,15 @@ Class { 'renameAttributes', 'isInstalled', 'originalLocations', - 'originalText' + 'originalText', + 'allowAccept' ], #category : #'GToolkit-Coder-AddOns-Inline rename' } { #category : #actions } GtAbstractRenameAction >> accept [ + self allowAccept ifFalse: [ ^ self ]. self updateSource. self uninstall. self allowSave. @@ -29,6 +31,16 @@ GtAbstractRenameAction >> addRenameAttributes [ self subclassResponsibility ] +{ #category : #accessing } +GtAbstractRenameAction >> allowAccept [ + ^ allowAccept ifNil: [ true ] +] + +{ #category : #accessing } +GtAbstractRenameAction >> allowAccept: anObject [ + allowAccept := anObject +] + { #category : #private } GtAbstractRenameAction >> allowSave [ ] diff --git a/src/GToolkit-Coder-AddOns/GtCoderViewModelRenameAction.class.st b/src/GToolkit-Coder-AddOns/GtCoderViewModelRenameAction.class.st index 75a0de02b..fe806b984 100644 --- a/src/GToolkit-Coder-AddOns/GtCoderViewModelRenameAction.class.st +++ b/src/GToolkit-Coder-AddOns/GtCoderViewModelRenameAction.class.st @@ -5,7 +5,8 @@ Class { 'pharoSourceCoderViewModel', 'originalCursors', 'coderAttributes', - 'hasRefactoringPreview' + 'hasRefactoringPreview', + 'requestInitialFocus' ], #category : #'GToolkit-Coder-AddOns-Inline rename' } @@ -38,6 +39,7 @@ GtCoderViewModelRenameAction >> addRenameAttributes [ selectAll: selectAll; filter: filter; coordinateFocus: hasRefactoringPreview; + requestInitialFocus: requestInitialFocus; text: (text from: each first to: each last) ] ifFalse: [ GtRenamePreviewAttribute new @@ -76,7 +78,8 @@ GtCoderViewModelRenameAction >> hasRefactoringPreview: aBoolean [ GtCoderViewModelRenameAction >> initialize [ super initialize. coderAttributes := #(). - hasRefactoringPreview := false + hasRefactoringPreview := false. + requestInitialFocus := true ] { #category : #accessing } @@ -105,6 +108,16 @@ GtCoderViewModelRenameAction >> removeAttributes [ self pharoSourceCoderViewModel removeAllCoderTextAttributes: coderAttributes ] +{ #category : #accessing } +GtCoderViewModelRenameAction >> requestInitialFocus [ + ^ requestInitialFocus +] + +{ #category : #accessing } +GtCoderViewModelRenameAction >> requestInitialFocus: aBoolean [ + requestInitialFocus := aBoolean +] + { #category : #private } GtCoderViewModelRenameAction >> saveOriginalState [ originalText := self pharoSourceCoderViewModel sourceText copy. From b1977e79c8e3c074e70157802218677045a177f5 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 3 Oct 2023 12:04:38 -0500 Subject: [PATCH 0543/1268] Position notification in proper location at the start of snippets [feenkcom/gtoolkit#3470] --- src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index e4406ce6d..c677ef32b 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -540,7 +540,7 @@ GtTextualCoderEditorElement >> reportParseError: aString at: anInteger [ | text position error | text := self editor text. - position := anInteger - 1 max: 1. + position := anInteger - 1 max: 0. text size < position ifTrue: [ ^ self ]. text clearAttributesOfClass: GtSourceCoderErrorAttribute. From 6627064f52befbe49be57beef701eec6d155a396 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 3 Oct 2023 13:43:53 -0500 Subject: [PATCH 0544/1268] Make erro popup clear the source line better [feenkcom/gtoolkit#3470] --- src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st index 8e1731bed..16c010108 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st @@ -84,9 +84,9 @@ GtSourceCoderErrorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditor GtSourceCoderErrorAttribute >> errorButton [ ^ BrButton new background: BrGlamorousColors errorBackgroundColor; - size: 8 @ 8; + size: 12 @ 12; + border: (BlBorder paint: Color transparent width: 2); geometry: BlEllipseGeometry new; - padding: (BlInsets left: 2 right: 2); yourself ] From fb68a807eeade3c1605324ab9fb09e50777512ce Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 6 Oct 2023 13:11:50 -0500 Subject: [PATCH 0545/1268] Refactor Scripter API a bit [feenkcom/gtoolkit#3470] --- .../TCoderByScripterExamples.trait.st | 39 ++++++++----------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st b/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st index f854a34ed..bc3f145c1 100644 --- a/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st +++ b/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st @@ -6,22 +6,19 @@ Trait { { #category : #utilities } TCoderByScripterExamples >> openAndClickOnContextMenuItemFor: aScripterOrStep id: aBlElementId [ - aScripterOrStep secondaryClick - label: 'Open context menu'; - id: GtSourceCoderEditorId; - play. + aScripterOrStep secondaryClickStep: [:s | + s label: 'Open context menu'; + // GtSourceCoderEditorId]. - aScripterOrStep mouseMoveOver - label: 'Hover ' , aBlElementId asSymbol; + aScripterOrStep mouseMoveOverStep: [:s | + s label: 'Hover ' , aBlElementId asSymbol; onSpaceRoot; - id: aBlElementId; - play. + // aBlElementId]. - aScripterOrStep click - label: 'Click ' , aBlElementId asSymbol; + aScripterOrStep clickStep: [:s | + s label: 'Click ' , aBlElementId asSymbol; onSpaceRoot; - id: aBlElementId; - play + // aBlElementId] ] { #category : #'examples - scripter' } @@ -56,19 +53,17 @@ TCoderByScripterExamples >> scripterForBlock: aBlock [ { #category : #utilities } TCoderByScripterExamples >> selectTextFor: aScripterOrStep from: aStartPosition to: aToPosition andCheck: aSelectedString [ - aScripterOrStep do - label: 'Select part of the method'; + aScripterOrStep doStep: [:s | + s label: 'Select part of the method'; + // GtSourceCoderEditorId; action: [ :aSourceEditor | aSourceEditor selecter from: aStartPosition to: aToPosition; - select ]; - id: GtSourceCoderEditorId; - play. + select ]]. - aScripterOrStep assert - label: 'Assert selected text'; + aScripterOrStep assertStep: [:s | + s label: 'Assert selected text'; + // GtSourceCoderEditorId; value: [ :aSourceEditor | aSourceEditor editor selectedText asString ] - equals: aSelectedString; - id: GtSourceCoderEditorId; - play + equals: aSelectedString] ] From 94d2a7a8b640d6c05f8fe8f8444759b874e55828 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Mon, 9 Oct 2023 13:06:40 -0500 Subject: [PATCH 0546/1268] Update scripter examples [feenkcom/gtoolkit#3481] --- .../GtFilterTagElementExamples.class.st | 421 +++++++++--------- .../GtFiltersElementExamples.class.st | 105 ++--- 2 files changed, 276 insertions(+), 250 deletions(-) diff --git a/src/GToolkit-Coder-Examples/GtFilterTagElementExamples.class.st b/src/GToolkit-Coder-Examples/GtFilterTagElementExamples.class.st index 6fe9959e0..56bc86569 100644 --- a/src/GToolkit-Coder-Examples/GtFilterTagElementExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtFilterTagElementExamples.class.st @@ -87,62 +87,69 @@ GtFilterTagElementExamples >> filterTagValueNotRequired [ GtFilterTagElementExamples >> filterTagValueNotRequiredByScripter [ | scripter | - scripter := BlScripter new - extent: 500@400; - element: self filterTagValueNotRequired. - - scripter assert - label: 'Does not have focus by default'; - satisfies: [ :anElement | anElement hasFocus not ]; - play. - - scripter click - label: 'Click on label to request focus'; - id: GtFilterTagLabelId; - play. - - scripter assert - label: 'Has focus after clicking on label'; - satisfies: [ :anElement | anElement hasFocus ]; - play. - - scripter click - label: 'Click again on the label to open a dropdown'; - id: GtFilterTagLabelId; - play. - - scripter click - label: 'Select filter without value'; - onSpaceRoot; - id: (GtFilterTagPickerItemId indexed: 2); - play. - - scripter assert - label: 'Check that replace wish was fired'; - event: GtFilterTagReplaceWish; - value: [ :anEvent | anEvent filterDescriptor name ] - equals: [ 'Default without value' ]; - value: [ :anEvent | anEvent newFilterDescriptor name ] - equals: [ 'Filter without value' ]; - play. - - scripter assert - label: 'Tag still has focus'; - satisfies: [ :anElement | anElement hasFocus ]; - play. + extent: 500 @ 400; + element: self filterTagValueNotRequired. + + scripter + assertStep: [ :s | + s + label: 'Does not have focus by default'; + satisfies: [ :anElement | anElement hasFocus not ] ]. + + scripter + clickStep: [ :s | + s + label: 'Click on label to request focus'; + id: GtFilterTagLabelId ]. + + scripter + assertStep: [ :s | + s + label: 'Has focus after clicking on label'; + satisfies: [ :anElement | anElement hasFocus ] ]. + + scripter + clickStep: [ :s | + s + label: 'Click again on the label to open a dropdown'; + id: GtFilterTagLabelId ]. + + scripter + clickStep: [ :s | + s + label: 'Select filter without value'; + onSpaceRoot; + id: (GtFilterTagPickerItemId indexed: 2) ]. + + scripter + assertStep: [ :s | + s + label: 'Check that replace wish was fired'; + event: GtFilterTagReplaceWish; + value: [ :anEvent | anEvent filterDescriptor name ] + equals: [ 'Default without value' ]; + value: [ :anEvent | anEvent newFilterDescriptor name ] + equals: [ 'Filter without value' ] ]. + + scripter + assertStep: [ :s | + s + label: 'Tag still has focus'; + satisfies: [ :anElement | anElement hasFocus ] ]. scripter shortcut label: 'Press backspace to remove the tag'; combination: BlKeyCombination backspace; play. - scripter assert - label: 'Check that remove wish was fired'; - event: GtFilterTagRemoveWish; - value: [ :anEvent | anEvent filterDescriptor name ] - equals: [ 'Filter without value' ]; - play. + scripter + assertStep: [ :s | + s + label: 'Check that remove wish was fired'; + event: GtFilterTagRemoveWish; + value: [ :anEvent | anEvent filterDescriptor name ] + equals: [ 'Filter without value' ] ]. ^ scripter ] @@ -163,32 +170,33 @@ GtFilterTagElementExamples >> filterTagValueRequiredWithDefault [ GtFilterTagElementExamples >> filterTagValueRequiredWithDefaultByScripter [ | scripter | - scripter := BlScripter new - extent: 500@400; - element: self filterTagValueRequiredWithDefault. - - scripter assert - satisfies: [ :anElement | anElement isValid ]; - play. - - scripter assert - satisfies: [ :anElement | anElement hasFocus not ]; - play. - - scripter assert - label: 'Check that the default value is set in the editor'; - id: GtFilterTagEditorId; - value: [ :anEditor | anEditor text asString ] - equals: 'Default'; - play. - - scripter assert - label: 'Check that name of the filter is correct in the label'; - id: GtFilterTagLabelId; - value: [ :aLabel | aLabel text asString ] - equals: 'Default with value'; - play. + extent: 500 @ 400; + element: self filterTagValueRequiredWithDefault. + + scripter + assertStep: [ :s | + s + satisfies: [ :anElement | anElement isValid ] ]. + + scripter + assertStep: [ :s | + s + satisfies: [ :anElement | anElement hasFocus not ] ]. + + scripter + assertStep: [ :s | + s + label: 'Check that the default value is set in the editor'; + id: GtFilterTagEditorId; + value: [ :anEditor | anEditor text asString ] equals: 'Default' ]. + + scripter + assertStep: [ :s | + s + label: 'Check that name of the filter is correct in the label'; + id: GtFilterTagLabelId; + value: [ :aLabel | aLabel text asString ] equals: 'Default with value' ]. ^ scripter ] @@ -197,43 +205,46 @@ GtFilterTagElementExamples >> filterTagValueRequiredWithDefaultByScripter [ GtFilterTagElementExamples >> filterTagValueRequiredWithDefaultByScripterRemoveText [ | scripter | - scripter := self filterTagValueRequiredWithDefaultByScripter. - - scripter click - id: GtFilterTagEditorId; - play. - + + scripter + clickStep: [ :s | + s + id: GtFilterTagEditorId ]. + scripter shortcut id: GtFilterTagEditorId; combination: BlKeyCombination primaryA; play. - - scripter type - id: GtFilterTagEditorId; - text: ''; - play. - - scripter assert - label: 'Check that the new value is typed in the editor'; - id: GtFilterTagEditorId; - value: [ :anEditor | anEditor text asString ] - equals: ''; - play. - scripter assert - satisfies: [ :anEditor | anEditor isValid not ]; - play. - + scripter + typeStep: [ :s | + s + id: GtFilterTagEditorId; + text: '' ]. + + scripter + assertStep: [ :s | + s + label: 'Check that the new value is typed in the editor'; + id: GtFilterTagEditorId; + value: [ :anEditor | anEditor text asString ] equals: '' ]. + + scripter + assertStep: [ :s | + s + satisfies: [ :anEditor | anEditor isValid not ] ]. + scripter shortcut label: 'Accept changes with enter shortcut'; id: GtFilterTagEditorId; combination: BlKeyCombination enter; play. - - scripter assert - eventNotFired: GtFilterTagUpdateWish; - play. + + scripter + assertStep: [ :s | + s + eventNotFired: GtFilterTagUpdateWish ]. ^ scripter ] @@ -242,58 +253,63 @@ GtFilterTagElementExamples >> filterTagValueRequiredWithDefaultByScripterRemoveT GtFilterTagElementExamples >> filterTagValueRequiredWithDefaultByScripterTypeAndAcceptWithClickingAway [ | scripter | - scripter := self filterTagValueRequiredWithDefaultByScripter. - - scripter click - id: GtFilterTagEditorId; - play. - - scripter assert - id: GtFilterTagEditorId; - satisfies: [ :anEditor | anEditor hasFocus ]; - play. - - scripter shortcut - id: GtFilterTagEditorId; - combination: BlKeyCombination primaryA; - play. - - scripter type - id: GtFilterTagEditorId; - text: ' New value '; - play. - - scripter assert - label: 'Check that the new value is typed in the editor'; - id: GtFilterTagEditorId; - value: [ :anEditor | anEditor text asString ] - "intentionally added spaces to test trimming" - equals: ' New value '; - play. - scripter assert - id: GtFilterTagEditorId; - satisfies: [ :anEditor | anEditor hasFocus ]; - play. + scripter + clickStep: [ :s | + s + id: GtFilterTagEditorId ]. - scripter click - id: GtFilterTagLabelId; - play. + scripter + assertStep: [ :s | + s + id: GtFilterTagEditorId; + satisfies: [ :anEditor | anEditor hasFocus ] ]. - scripter assert + scripter shortcut id: GtFilterTagEditorId; - satisfies: [ :anEditor | anEditor hasFocus not ]; + combination: BlKeyCombination primaryA; play. - scripter assert - label: 'Check that update wish was fired'; - event: GtFilterTagUpdateWish; - value: [ :anEvent | anEvent filterDescriptor name ] - equals: [ 'Default with value' ]; - value: [ :anEvent | anEvent newValue ] - equals: [ 'New value' ]; - play. + scripter + typeStep: [ :s | + s + id: GtFilterTagEditorId; + text: ' New value ' ]. + + scripter + assertStep: [ :s | + s + label: 'Check that the new value is typed in the editor'; + id: GtFilterTagEditorId; + value: [ "intentionally added spaces to test trimming":anEditor | anEditor text asString ] + equals: ' New value ' ]. + + scripter + assertStep: [ :s | + s + id: GtFilterTagEditorId; + satisfies: [ :anEditor | anEditor hasFocus ] ]. + + scripter + clickStep: [ :s | + s + id: GtFilterTagLabelId ]. + + scripter + assertStep: [ :s | + s + id: GtFilterTagEditorId; + satisfies: [ :anEditor | anEditor hasFocus not ] ]. + + scripter + assertStep: [ :s | + s + label: 'Check that update wish was fired'; + event: GtFilterTagUpdateWish; + value: [ :anEvent | anEvent filterDescriptor name ] + equals: [ 'Default with value' ]; + value: [ :anEvent | anEvent newValue ] equals: [ 'New value' ] ]. ^ scripter ] @@ -302,50 +318,52 @@ GtFilterTagElementExamples >> filterTagValueRequiredWithDefaultByScripterTypeAnd GtFilterTagElementExamples >> filterTagValueRequiredWithDefaultByScripterTypeAndAcceptWithShortcut [ | scripter | - scripter := self filterTagValueRequiredWithDefaultByScripter. - - scripter click - id: GtFilterTagEditorId; - play. - - scripter assert - id: GtFilterTagEditorId; - satisfies: [ :anEditor | anEditor hasFocus ]; - play. - + + scripter + clickStep: [ :s | + s + id: GtFilterTagEditorId ]. + + scripter + assertStep: [ :s | + s + id: GtFilterTagEditorId; + satisfies: [ :anEditor | anEditor hasFocus ] ]. + scripter shortcut id: GtFilterTagEditorId; combination: BlKeyCombination primaryA; play. - - scripter type - id: GtFilterTagEditorId; - text: ' New value '; - play. - - scripter assert - label: 'Check that the new value is typed in the editor'; - id: GtFilterTagEditorId; - value: [ :anEditor | anEditor text asString ] - "intentionally added spaces to test trimming" - equals: ' New value '; - play. + + scripter + typeStep: [ :s | + s + id: GtFilterTagEditorId; + text: ' New value ' ]. + + scripter + assertStep: [ :s | + s + label: 'Check that the new value is typed in the editor'; + id: GtFilterTagEditorId; + value: [ "intentionally added spaces to test trimming":anEditor | anEditor text asString ] + equals: ' New value ' ]. scripter shortcut label: 'Accept changes with enter shortcut'; id: GtFilterTagEditorId; combination: BlKeyCombination enter; play. - - scripter assert - label: 'Check that update wish was fired'; - event: GtFilterTagUpdateWish; - value: [ :anEvent | anEvent filterDescriptor name ] - equals: [ 'Default with value' ]; - value: [ :anEvent | anEvent newValue ] - equals: [ 'New value' ]; - play. + + scripter + assertStep: [ :s | + s + label: 'Check that update wish was fired'; + event: GtFilterTagUpdateWish; + value: [ :anEvent | anEvent filterDescriptor name ] + equals: [ 'Default with value' ]; + value: [ :anEvent | anEvent newValue ] equals: [ 'New value' ] ]. ^ scripter ] @@ -366,29 +384,32 @@ GtFilterTagElementExamples >> filterTagValueRequiredWithoutDefault [ GtFilterTagElementExamples >> filterTagValueRequiredWithoutDefaultByScripter [ | scripter | - scripter := BlScripter new - extent: 500@400; - element: self filterTagValueRequiredWithoutDefault. - - scripter assert - satisfies: [ :anElement | anElement isValid ]; - play. - - scripter assert - label: 'Does not have focus by default'; - satisfies: [ :anElement | anElement hasFocus not ]; - play. - - scripter assert - id: GtFilterTagEditorId; - satisfies: [ :anEditor | anEditor text isEmpty ]; - play. - - scripter assert - id: GtFilterTagLabelId; - value: [ :aLabel | aLabel text asString ] equals: 'Default with value'; - play. + extent: 500 @ 400; + element: self filterTagValueRequiredWithoutDefault. + + scripter + assertStep: [ :s | + s + satisfies: [ :anElement | anElement isValid ] ]. + + scripter + assertStep: [ :s | + s + label: 'Does not have focus by default'; + satisfies: [ :anElement | anElement hasFocus not ] ]. + + scripter + assertStep: [ :s | + s + id: GtFilterTagEditorId; + satisfies: [ :anEditor | anEditor text isEmpty ] ]. + + scripter + assertStep: [ :s | + s + id: GtFilterTagLabelId; + value: [ :aLabel | aLabel text asString ] equals: 'Default with value' ]. ^ scripter ] diff --git a/src/GToolkit-Coder-Examples/GtFiltersElementExamples.class.st b/src/GToolkit-Coder-Examples/GtFiltersElementExamples.class.st index 314d00c5f..9f580bb75 100644 --- a/src/GToolkit-Coder-Examples/GtFiltersElementExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtFiltersElementExamples.class.st @@ -47,17 +47,17 @@ GtFiltersElementExamples >> filterDescriptors [ GtFiltersElementExamples >> filtersElementWithDescriptors [ | filtersElement scripter | - filtersElement := self emptyFiltersElement. filtersElement descriptors: self filterDescriptors. - scripter := BlScripter new - element: filtersElement. + scripter := BlScripter new element: filtersElement. - scripter assert - label: 'Check how many default filters there are'; - value: [ :anElement | (anElement query // GtFilterTagElement) all size ] equals: 2; - play. + scripter + assertStep: [ :s | + s + label: 'Check how many default filters there are'; + value: [ :anElement | (anElement query // GtFilterTagElement) all size ] + equals: 2 ]. ^ scripter ] @@ -66,35 +66,37 @@ GtFiltersElementExamples >> filtersElementWithDescriptors [ GtFiltersElementExamples >> filtersElementWithDescriptorsBuildFilters [ | scripter | - scripter := self filtersElementWithDescriptors. scripter element when: GtFiltersChangedEvent - do: [ :anEvent | + do: [ :anEvent | | aFiltersElement theFilters | - aFiltersElement := anEvent currentTarget. - - theFilters := aFiltersElement currentFilters. - aFiltersElement buildFilters: [ - theFilters do: [ :eachFilterAndValue | - aFiltersElement - addFilterForDescriptor: eachFilterAndValue key - andValue: eachFilterAndValue value ] ] ]. - - scripter click - id: GtFiltersAddButtonId; - play. - - scripter assert - // GtFilterTagElement; - @ 3; - satisfies: [ :aTagElement | aTagElement hasFocus ]; - play. - scripter assert - eventNotFired: GtFiltersChangedEvent; - play. + theFilters := aFiltersElement currentFilters. + aFiltersElement + buildFilters: [ theFilters + do: [ :eachFilterAndValue | + aFiltersElement + addFilterForDescriptor: eachFilterAndValue key + andValue: eachFilterAndValue value ] ] ]. + + scripter + clickStep: [ :s | + s + id: GtFiltersAddButtonId ]. + + scripter + assertStep: [ :s | + s + // GtFilterTagElement; + @ 3; + satisfies: [ :aTagElement | aTagElement hasFocus ] ]. + + scripter + assertStep: [ :s | + s + eventNotFired: GtFiltersChangedEvent ]. scripter shortcut // GtFilterTagElement; @@ -103,10 +105,11 @@ GtFiltersElementExamples >> filtersElementWithDescriptorsBuildFilters [ combination: BlKeyCombination enter; play. - scripter assert - label: 'Make sure that the filters changed event is fired only once'; - eventFired: GtFiltersChangedEvent times: 1; - play. + scripter + assertStep: [ :s | + s + label: 'Make sure that the filters changed event is fired only once'; + eventFired: GtFiltersChangedEvent times: 1 ]. ^ scripter ] @@ -115,24 +118,26 @@ GtFiltersElementExamples >> filtersElementWithDescriptorsBuildFilters [ GtFiltersElementExamples >> filtersElementWithDescriptorsReplaceFilterWithTheSameFilter [ | scripter | - scripter := self filtersElementWithDescriptors. - scripter click - // GtFilterTagElement; - @ 1; - // GtFilterTagPickerId; - play. - - scripter click - onSpaceRoot; - id: (GtFilterTagPickerItemId indexed: 1); - play. - - scripter assert - label: 'Replacing filter with the same filter should not emit anything'; - eventFired: GtFiltersChangedEvent times: 0; - play. + scripter + clickStep: [ :s | + s + // GtFilterTagElement; + @ 1; + // GtFilterTagPickerId ]. + + scripter + clickStep: [ :s | + s + onSpaceRoot; + id: (GtFilterTagPickerItemId indexed: 1) ]. + + scripter + assertStep: [ :s | + s + label: 'Replacing filter with the same filter should not emit anything'; + eventFired: GtFiltersChangedEvent times: 0 ]. ^ scripter ] From acf47258574b7e4f2b79d5084b6f30b2058d543d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Wed, 1 Nov 2023 18:12:26 +0100 Subject: [PATCH 0547/1268] Make addons specific to the single coder view model, not just to source coders [feenkcom/gtoolkit#3501] --- .../GtBehaviorCoderActionsElement.class.st | 143 +++++++++++++++++ .../GtCoderActionsElement.class.st | 136 +--------------- .../GtSingleCoderViewModel.class.st | 47 +++++- .../GtSourceCoderActionsElement.class.st | 145 ++++++++++++++++++ ...SourceCoderExpandedContentElement.class.st | 2 +- .../GtTextualCoderViewModel.class.st | 33 +--- src/GToolkit-Coder/GtCoderModel.class.st | 9 ++ src/GToolkit-Coder/GtTextualCoder.class.st | 9 -- 8 files changed, 348 insertions(+), 176 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtBehaviorCoderActionsElement.class.st create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st diff --git a/src/GToolkit-Coder-UI/GtBehaviorCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtBehaviorCoderActionsElement.class.st new file mode 100644 index 000000000..a1f53665d --- /dev/null +++ b/src/GToolkit-Coder-UI/GtBehaviorCoderActionsElement.class.st @@ -0,0 +1,143 @@ +Class { + #name : #GtBehaviorCoderActionsElement, + #superclass : #GtCoderActionsElement, + #instVars : [ + 'behaviorCoderViewModel', + 'toolbarElement', + 'previewsElement' + ], + #category : #'GToolkit-Coder-UI-Coder - Basic' +} + +{ #category : #accessing } +GtBehaviorCoderActionsElement >> addPreviews [ + previewsElement addChildren: + (self coderViewModel previews + collect: [ :aGtCoderPreview | + | addOnPreviewElement | + addOnPreviewElement := aGtCoderPreview stencil asElement . + aGtCoderPreview dataBinder + element: addOnPreviewElement; + coderViewModel: self behaviorCoderViewModel; + build. + + addOnPreviewElement]) +] + +{ #category : #accessing } +GtBehaviorCoderActionsElement >> addToolbarActions [ + toolbarElement addItems: + (self coderViewModel mainActions + collect: [ :aGtCoderAction | + self flag: 'Temporary hack. Coder should to Phlow actions'. + aGtCoderAction buildElementIn: self ]) +] + +{ #category : #accessing } +GtBehaviorCoderActionsElement >> behaviorCoderViewModel [ + ^ behaviorCoderViewModel +] + +{ #category : #accessing } +GtBehaviorCoderActionsElement >> behaviorCoderViewModel: aCoderViewModel [ + + behaviorCoderViewModel ifNotNil: [ self unsubscribeFromBehaviourCoderViewModel ]. + + behaviorCoderViewModel := aCoderViewModel. + + self subscribeToBehaviorCoderViewModel. + self onBehaviourCoderViewModelChanged +] + +{ #category : #accessing } +GtBehaviorCoderActionsElement >> coderViewModel [ + ^ self behaviorCoderViewModel +] + +{ #category : #accessing } +GtBehaviorCoderActionsElement >> coderViewModel: aCoderViewModel [ + self behaviorCoderViewModel: aCoderViewModel +] + +{ #category : #initialization } +GtBehaviorCoderActionsElement >> initialize [ + super initialize. + + self layout: BlLinearLayout horizontal. + self padding: (BlInsets empty). + self constraintsDo: [ :c | + c horizontal matchParent. + c vertical fitContent ]. + + previewsElement := BrHorizontalPane new + fitContent; + alignCenterLeft; + cellSpacing: 2. + + toolbarElement := self newToolbarElement + labeled: 'Main toolbar'. + + self addChildren: { previewsElement. toolbarElement } +] + +{ #category : #'building - widgets' } +GtBehaviorCoderActionsElement >> newToolbarElement [ + + + ^ BrToolbar new + aptitude: (BrGlamorousToolbarAptitude new + spacing: 0); + padding: (BlInsets empty); + margin: (BlInsets empty) +] + +{ #category : #callbacks } +GtBehaviorCoderActionsElement >> onBehaviourCoderViewModelChanged [ + self updatePreviews. + self updateToolbarActions +] + +{ #category : #updating } +GtBehaviorCoderActionsElement >> removePreviews [ + previewsElement removeChildren +] + +{ #category : #updating } +GtBehaviorCoderActionsElement >> removeToolbarActions [ + toolbarElement numberOfItems + timesRepeat: [ toolbarElement removeItemAt: 1 ] +] + +{ #category : #subscriptions } +GtBehaviorCoderActionsElement >> subscribeToBehaviorCoderViewModel [ + + self behaviorCoderViewModel weak + when: GtPharoBehaviorCoderViewModelAddonsChangedAnnouncement + send: #updateContent + to: self +] + +{ #category : #subscriptions } +GtBehaviorCoderActionsElement >> unsubscribeFromBehaviourCoderViewModel [ + self behaviorCoderViewModel unsubscribe: self +] + +{ #category : #updating } +GtBehaviorCoderActionsElement >> updateContent [ + self enqueueTask: (BlTaskAction new + action: [ + self updatePreviews. + self updateToolbarActions ]) +] + +{ #category : #updating } +GtBehaviorCoderActionsElement >> updatePreviews [ + self removePreviews. + self addPreviews +] + +{ #category : #updating } +GtBehaviorCoderActionsElement >> updateToolbarActions [ + self removeToolbarActions. + self addToolbarActions +] diff --git a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st index 2f47e7f24..515d1f048 100644 --- a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st @@ -1,45 +1,17 @@ Class { #name : #GtCoderActionsElement, #superclass : #BlElement, - #traits : 'TGtWithTextualCoderViewModel', - #classTraits : 'TGtWithTextualCoderViewModel classTrait', - #instVars : [ - 'mainToolbar', - 'contextToolbar', - 'separator', - 'editor' - ], #category : #'GToolkit-Coder-UI-Coder - Basic' } -{ #category : #private } -GtCoderActionsElement >> addContextToolbarActions [ - contextToolbar addItems: (self textualCoderViewModel contextActions collect: [ :aGtCoderAction | self newButtonForAction: aGtCoderAction ]). - separator - visibility: - (contextToolbar hasItems - ifTrue: [ BlVisibility visible ] - ifFalse: [ BlVisibility gone ]) -] - -{ #category : #private } -GtCoderActionsElement >> addMainToolbarActions [ - mainToolbar - addItems: - (self textualCoderViewModel mainActions - collect: [ :aGtCoderAction | - self flag: 'Temporary hack. Coder should to Phlow actions'. - aGtCoderAction buildElementIn: self ]) -] - { #category : #accessing } GtCoderActionsElement >> coderViewModel [ - ^ self textualCoderViewModel + self subclassResponsibility ] { #category : #accessing } GtCoderActionsElement >> coderViewModel: aCoderViewModel [ - self textualCoderViewModel: aCoderViewModel + self subclassResponsibility ] { #category : #'private - event handling' } @@ -73,35 +45,11 @@ GtCoderActionsElement >> handleButton: aButtonElement action: aGtCoderAction onE (BlTaskAction new action: [ [ aGtCoderAction action gtValueWithArgs: - {self textualCoderViewModel. + {self coderViewModel. aButtonElement} ] ensure: [ self enqueueEnableButton: aButtonElement action: aGtCoderAction ] ]) ] ] -{ #category : #initialization } -GtCoderActionsElement >> initialize [ - super initialize. - - self layout: BlLinearLayout horizontal. - self padding: (BlInsets empty). - self constraintsDo: [ :c | - c horizontal matchParent. - c vertical fitContent ]. - - mainToolbar := self newToolbar labeled: 'Main toolbar'. - - separator := BlElement new - background: (Color gray alpha: 0.2); - margin: (BlInsets all: 5); - constraintsDo: [ :c | - c horizontal exact: 1. - c vertical matchParent ]. - - contextToolbar := self newToolbar labeled: 'Context toolbar'. - - self addChildren: { mainToolbar . separator . contextToolbar } -] - { #category : #'instance creation' } GtCoderActionsElement >> newButtonForAction: aGtCoderAction [ @@ -188,81 +136,3 @@ GtCoderActionsElement >> newToggleForAction: aGtCoderAction [ label: aGtCoderAction title; in: [ :aButtonElement | aButtonElement id: aGtCoderAction id ] ] - -{ #category : #'instance creation' } -GtCoderActionsElement >> newToolbar [ - - - ^ BrToolbar new - aptitude: (BrGlamorousToolbarAptitude new spacing: 4); - padding: (BlInsets left: -4) -] - -{ #category : #'api - textual coder view model' } -GtCoderActionsElement >> onPostTextualCoderViewModelChanged [ - "I am an optional hook method that is sent after #subscribeToTextualCoderViewModel. - I do nothing by default but allow users to perform update operations when a receiver object is already - subscribed to announcements." - - self textualCoderViewModel ensureAddOns -] - -{ #category : #'api - textual coder view model' } -GtCoderActionsElement >> onTextualCoderViewModelChanged [ - "Is sent when a new textualCoder view model is assigned to the element. - Note: #onTextualCoderViewModelChanged is sent before #subscribeToTextualCoderViewModel - which means that if you perform any operation that triggers an announcement it will be ignored because the receiver - didn't get a chance to subscribe to any announcement. Override #onPostTextualCoderViewModelChanged if you - wish to perform an operation that requires an announcement, but keep in mind that this is not the most efficient way" - - self removeMainToolbarActions. - self removeContextToolbarActions. - self addMainToolbarActions. - self addContextToolbarActions -] - -{ #category : #private } -GtCoderActionsElement >> removeContextToolbarActions [ - contextToolbar numberOfItems timesRepeat: [ contextToolbar removeItemAt: 1 ] -] - -{ #category : #private } -GtCoderActionsElement >> removeMainToolbarActions [ - mainToolbar numberOfItems timesRepeat: [ mainToolbar removeItemAt: 1 ] -] - -{ #category : #'api - textual coder view model' } -GtCoderActionsElement >> subscribeToTextualCoderViewModel [ - "Is sent after a new textualCoder view model is assigned to the element. - It is required to unsubscribe from the view model or domain model by implementing - #unsubscribeFromTextualCoderViewModel if elements subscribe to them" - - self textualCoderViewModel weak - when: GtTextualCoderViewModelMainActionsChanged send: #updateMainToolbar to: self; - when: GtTextualCoderViewModelContextActionsChanged send: #updateContextToolbar to: self -] - -{ #category : #'api - textual coder view model' } -GtCoderActionsElement >> unsubscribeFromTextualCoderViewModel [ - "Is sent before a new textualCoder view model is assigned to the element. - Elements that subscribe to textualCoder view model in domain model are required to implement this methods." - - self textualCoderViewModel unsubscribe: self -] - -{ #category : #'private - event handling' } -GtCoderActionsElement >> updateContextToolbar [ - self enqueueTask: - (BlTaskAction new - action: [ - self removeContextToolbarActions. - self addContextToolbarActions ]) -] - -{ #category : #'private - event handling' } -GtCoderActionsElement >> updateMainToolbar [ - self enqueueTask: (BlTaskAction new - action: [ - self removeMainToolbarActions. - self addMainToolbarActions ]) -] diff --git a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st index 76f8d7c32..de1fae482 100644 --- a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st @@ -12,11 +12,27 @@ Class { #instVars : [ 'announcer', 'codersUIModel', - 'coderModel' + 'coderModel', + 'extraAddOns', + 'addOnPromise' ], #category : #'GToolkit-Coder-UI-Coder - Basic' } +{ #category : #'api - shortcuts' } +GtSingleCoderViewModel >> addMainAction: aGtCoderAction [ + "Add an extra main action add-on independent from the dynamically computed add-ons" + + extraAddOns addMainAction: aGtCoderAction +] + +{ #category : #'api - add-ons' } +GtSingleCoderViewModel >> addOns [ + + + ^ self ensureAddOns +] + { #category : #accessing } GtSingleCoderViewModel >> announcer [ ^ announcer ifNil: [ announcer := Announcer new ] @@ -96,11 +112,27 @@ GtSingleCoderViewModel >> codersUIModel: anObject [ codersUIModel := anObject ] +{ #category : #'private - addons' } +GtSingleCoderViewModel >> computeAddOns [ + self subclassResponsibility +] + { #category : #accessing } GtSingleCoderViewModel >> elementClass [ ^ self subclassResponsibility ] +{ #category : #'private - addons' } +GtSingleCoderViewModel >> ensureAddOns [ + + + ^ addOnPromise ifNil: [ + addOnPromise := self computeAddOns + then: [ :theAddOns | + self onAddOnsChanged: theAddOns ]; + yourself ] +] + { #category : #'gt-extension' } GtSingleCoderViewModel >> gtLiveFor: aView [ @@ -146,11 +178,24 @@ GtSingleCoderViewModel >> isModified [ ^ self coder isModified ] +{ #category : #'private - event handling' } +GtSingleCoderViewModel >> onAddOnsChanged: theAddOns [ + +] + { #category : #'api - coder model' } GtSingleCoderViewModel >> onCoderModelChanged [ "Is sent when a new coder model is assigned to the view model" ] +{ #category : #'api - add-ons' } +GtSingleCoderViewModel >> requestUpdateAddOns [ + + + addOnPromise := nil. + ^ self ensureAddOns +] + { #category : #'api - coder model' } GtSingleCoderViewModel >> subscribeToCoderModel [ "Is sent after a new coder model is assigned to the view model. diff --git a/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st new file mode 100644 index 000000000..aec1281ff --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st @@ -0,0 +1,145 @@ +Class { + #name : #GtSourceCoderActionsElement, + #superclass : #GtCoderActionsElement, + #traits : 'TGtWithTextualCoderViewModel', + #classTraits : 'TGtWithTextualCoderViewModel classTrait', + #instVars : [ + 'mainToolbar', + 'contextToolbar', + 'separator', + 'editor' + ], + #category : #'GToolkit-Coder-UI-Coder - Basic' +} + +{ #category : #private } +GtSourceCoderActionsElement >> addContextToolbarActions [ + contextToolbar addItems: (self textualCoderViewModel contextActions collect: [ :aGtCoderAction | self newButtonForAction: aGtCoderAction ]). + separator + visibility: + (contextToolbar hasItems + ifTrue: [ BlVisibility visible ] + ifFalse: [ BlVisibility gone ]) +] + +{ #category : #private } +GtSourceCoderActionsElement >> addMainToolbarActions [ + mainToolbar + addItems: + (self coderViewModel mainActions + collect: [ :aGtCoderAction | + self flag: 'Temporary hack. Coder should to Phlow actions'. + aGtCoderAction buildElementIn: self ]) +] + +{ #category : #accessing } +GtSourceCoderActionsElement >> coderViewModel [ + ^ self textualCoderViewModel +] + +{ #category : #accessing } +GtSourceCoderActionsElement >> coderViewModel: aCoderViewModel [ + self textualCoderViewModel: aCoderViewModel +] + +{ #category : #initialization } +GtSourceCoderActionsElement >> initialize [ + super initialize. + + self layout: BlLinearLayout horizontal. + self padding: (BlInsets empty). + self constraintsDo: [ :c | + c horizontal matchParent. + c vertical fitContent ]. + + mainToolbar := self newToolbar labeled: 'Main toolbar'. + + separator := BlElement new + background: (Color gray alpha: 0.2); + margin: (BlInsets all: 5); + constraintsDo: [ :c | + c horizontal exact: 1. + c vertical matchParent ]. + + contextToolbar := self newToolbar labeled: 'Context toolbar'. + + self addChildren: { mainToolbar . separator . contextToolbar } +] + +{ #category : #'instance creation' } +GtSourceCoderActionsElement >> newToolbar [ + + + ^ BrToolbar new + aptitude: (BrGlamorousToolbarAptitude new spacing: 4); + padding: (BlInsets left: -4) +] + +{ #category : #'api - textual coder view model' } +GtSourceCoderActionsElement >> onPostTextualCoderViewModelChanged [ + "I am an optional hook method that is sent after #subscribeToTextualCoderViewModel. + I do nothing by default but allow users to perform update operations when a receiver object is already + subscribed to announcements." + + self textualCoderViewModel ensureAddOns +] + +{ #category : #'api - textual coder view model' } +GtSourceCoderActionsElement >> onTextualCoderViewModelChanged [ + "Is sent when a new textualCoder view model is assigned to the element. + Note: #onTextualCoderViewModelChanged is sent before #subscribeToTextualCoderViewModel + which means that if you perform any operation that triggers an announcement it will be ignored because the receiver + didn't get a chance to subscribe to any announcement. Override #onPostTextualCoderViewModelChanged if you + wish to perform an operation that requires an announcement, but keep in mind that this is not the most efficient way" + + self removeMainToolbarActions. + self removeContextToolbarActions. + self addMainToolbarActions. + self addContextToolbarActions +] + +{ #category : #private } +GtSourceCoderActionsElement >> removeContextToolbarActions [ + contextToolbar numberOfItems timesRepeat: [ contextToolbar removeItemAt: 1 ] +] + +{ #category : #private } +GtSourceCoderActionsElement >> removeMainToolbarActions [ + mainToolbar numberOfItems timesRepeat: [ mainToolbar removeItemAt: 1 ] +] + +{ #category : #'api - textual coder view model' } +GtSourceCoderActionsElement >> subscribeToTextualCoderViewModel [ + "Is sent after a new textualCoder view model is assigned to the element. + It is required to unsubscribe from the view model or domain model by implementing + #unsubscribeFromTextualCoderViewModel if elements subscribe to them" + + self textualCoderViewModel weak + when: GtTextualCoderViewModelMainActionsChanged send: #updateMainToolbar to: self; + when: GtTextualCoderViewModelContextActionsChanged send: #updateContextToolbar to: self +] + +{ #category : #'api - textual coder view model' } +GtSourceCoderActionsElement >> unsubscribeFromTextualCoderViewModel [ + "Is sent before a new textualCoder view model is assigned to the element. + Elements that subscribe to textualCoder view model in domain model are required to implement this methods." + + self textualCoderViewModel unsubscribe: self +] + +{ #category : #'private - event handling' } +GtSourceCoderActionsElement >> updateContextToolbar [ + self enqueueTask: + (BlTaskAction new + action: [ + self removeContextToolbarActions. + self addContextToolbarActions ]) +] + +{ #category : #'private - event handling' } +GtSourceCoderActionsElement >> updateMainToolbar [ + self enqueueTask: (BlTaskAction new + action: [ + self removeMainToolbarActions. + self addMainToolbarActions ]) +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st index 34ce44d43..48ee4bafa 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st @@ -27,7 +27,7 @@ GtSourceCoderExpandedContentElement >> initialize [ { #category : #'instance creation' } GtSourceCoderExpandedContentElement >> newActionsElement [ - ^ GtCoderActionsElement new + ^ GtSourceCoderActionsElement new margin: (BlInsets top: 5); id: #actions; yourself diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 43ba020e3..a04d3b879 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -2,8 +2,6 @@ Class { #name : #GtTextualCoderViewModel, #superclass : #GtSingleCoderViewModel, #instVars : [ - 'addOnPromise', - 'extraAddOns', 'stylers', 'mainActions', 'contextActions', @@ -22,20 +20,6 @@ Class { #category : #'GToolkit-Coder-UI-Coder - Textual Model' } -{ #category : #'api - shortcuts' } -GtTextualCoderViewModel >> addMainAction: aGtCoderAction [ - "Add an extra main action add-on independent from the dynamically computed add-ons" - - extraAddOns addMainAction: aGtCoderAction -] - -{ #category : #'api - add-ons' } -GtTextualCoderViewModel >> addOns [ - - - ^ self ensureAddOns -] - { #category : #'api - shortcuts' } GtTextualCoderViewModel >> addShortcut: aShortcut [ "Add an extra shortcut add-on independent from the dynamically computed add-ons" @@ -200,7 +184,7 @@ GtTextualCoderViewModel >> compositeStyler [ yourself ] -{ #category : #'private - addons' } +{ #category : #'api - add-ons' } GtTextualCoderViewModel >> computeAddOns [ | aCoderModel | @@ -332,13 +316,6 @@ GtTextualCoderViewModel >> elementClass [ ^ GtTextualCoderEditorElement ] -{ #category : #'private - addons' } -GtTextualCoderViewModel >> ensureAddOns [ - - - ^ addOnPromise ifNil: [ addOnPromise := self computeAddOns then: [ :theAddOns | self onAddOnsChanged: theAddOns ]; yourself ] -] - { #category : #'api - expansion' } GtTextualCoderViewModel >> expand [ self expanded: true @@ -634,14 +611,6 @@ GtTextualCoderViewModel >> removeStylersOfClass: aGtCoderStylerClass [ extraAddOns removeStylersOfClass: aGtCoderStylerClass ] -{ #category : #'api - add-ons' } -GtTextualCoderViewModel >> requestUpdateAddOns [ - - - addOnPromise := nil. - ^ self ensureAddOns -] - { #category : #'api - selection' } GtTextualCoderViewModel >> select: aFromCursorIndex to: aToCursorIndex [ self selection: (self selection copy select: aFromCursorIndex to: aToCursorIndex) diff --git a/src/GToolkit-Coder/GtCoderModel.class.st b/src/GToolkit-Coder/GtCoderModel.class.st index 390818677..8874fbcbd 100644 --- a/src/GToolkit-Coder/GtCoderModel.class.st +++ b/src/GToolkit-Coder/GtCoderModel.class.st @@ -220,6 +220,15 @@ GtCoderModel >> newAddOns [ ^ self addOnsClass new ] +{ #category : #private } +GtCoderModel >> pragmasNamed: aSymbol inHierarchy: aClass [ + | actions | + actions := OrderedCollection new. + aClass withAllSuperclassesDo: [ :each | actions addAll: (Pragma allNamed: aSymbol in: each) ]. + actions sort: [ :a :b | a arguments first < b arguments first ]. + ^ actions +] + { #category : #elements } GtCoderModel >> previewElement [ "Return a preview element for the Spotter" diff --git a/src/GToolkit-Coder/GtTextualCoder.class.st b/src/GToolkit-Coder/GtTextualCoder.class.st index fb29e3181..401015912 100644 --- a/src/GToolkit-Coder/GtTextualCoder.class.st +++ b/src/GToolkit-Coder/GtTextualCoder.class.st @@ -258,15 +258,6 @@ GtTextualCoder >> notifySourceCodeReplaced: aSourceCode [ coder: self) ] -{ #category : #private } -GtTextualCoder >> pragmasNamed: aSymbol inHierarchy: aClass [ - | actions | - actions := OrderedCollection new. - aClass withAllSuperclassesDo: [ :each | actions addAll: (Pragma allNamed: aSymbol in: each) ]. - actions sort: [ :a :b | a arguments first < b arguments first ]. - ^ actions -] - { #category : #'api - text' } GtTextualCoder >> requestStyleSourceText [ "Request the text editor to restyle the text (for example due to environmental changes)" From 8fea78daf938d07d15efeb038c58afd2e36f6542 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Thu, 2 Nov 2023 16:22:04 +0100 Subject: [PATCH 0548/1268] GtBehaviorCoderActionsElement should fit content --- src/GToolkit-Coder-UI/GtBehaviorCoderActionsElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtBehaviorCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtBehaviorCoderActionsElement.class.st index a1f53665d..00cb92887 100644 --- a/src/GToolkit-Coder-UI/GtBehaviorCoderActionsElement.class.st +++ b/src/GToolkit-Coder-UI/GtBehaviorCoderActionsElement.class.st @@ -66,7 +66,7 @@ GtBehaviorCoderActionsElement >> initialize [ self layout: BlLinearLayout horizontal. self padding: (BlInsets empty). self constraintsDo: [ :c | - c horizontal matchParent. + c horizontal fitContent. c vertical fitContent ]. previewsElement := BrHorizontalPane new From 11ebab2bebbe9a8d56265ac239b735c8278d9f12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Wed, 15 Nov 2023 16:56:59 +0100 Subject: [PATCH 0549/1268] Move some generic methods to GtSourceCoder --- src/GToolkit-Coder/GtSourceCoder.class.st | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/GToolkit-Coder/GtSourceCoder.class.st b/src/GToolkit-Coder/GtSourceCoder.class.st index dfbce754c..a3d43e313 100644 --- a/src/GToolkit-Coder/GtSourceCoder.class.st +++ b/src/GToolkit-Coder/GtSourceCoder.class.st @@ -288,6 +288,14 @@ GtSourceCoder >> notifyObjectSpawnFromEvaluationResult: anEvaluationResult [ notifyObjectSpawn: anEvaluationResult value ] +{ #category : #'private - notifying' } +GtSourceCoder >> notifyParseError: aString at: anInteger [ + self announce: (GtCoderParseError new + coder: self; + errorMessage: aString; + location: anInteger) +] + { #category : #'private - notifying' } GtSourceCoder >> notifyPrintResult: anEvaluationResult [ self announce: (GtCoderPrintAnnouncement new @@ -355,3 +363,15 @@ GtSourceCoder >> spawnDestination [ GtSourceCoder >> spawnDestination: aSpawnDestination [ self attributeNamed: #spawnDestination put: aSpawnDestination ] + +{ #category : #accessing } +GtSourceCoder >> validateSyntax [ + + + [ self computeAst ] + on: SmaCCParserError + do: [ :ex | + self notifyParseError: ex messageText at: ex tag position. + ^ false ]. + ^ true +] From b207713d8aed5472a8ada107f6f5262ee664b683 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Wed, 15 Nov 2023 16:58:07 +0100 Subject: [PATCH 0550/1268] Log errors in the overall computation of add-ons --- src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st index de1fae482..7300f991f 100644 --- a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st @@ -129,7 +129,15 @@ GtSingleCoderViewModel >> ensureAddOns [ ^ addOnPromise ifNil: [ addOnPromise := self computeAddOns then: [ :theAddOns | - self onAddOnsChanged: theAddOns ]; + self onAddOnsChanged: theAddOns ] + otherwise: [ :anError | + anError emit. + + NonInteractiveTranscript stderr + nextPutAll: 'Error computing addons: '; + space; + print: anError; + cr ]; yourself ] ] From 03e89692bc39cda46d3b47ba88661c8f2c5ad3a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Mon, 20 Nov 2023 21:43:50 +0100 Subject: [PATCH 0551/1268] Allow the coder header element to be overriden using a pragma --- .../GtSourceCoderContentElement.class.st | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st index 7ae2fbfb7..7919714a4 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st @@ -71,7 +71,19 @@ GtSourceCoderContentElement >> initialize [ { #category : #initialization } GtSourceCoderContentElement >> newHeaderElement [ - ^ self textualCoderViewModel headerElementClass new + | pragmas headerClass | + pragmas := Pragma + allNamed: #coderBreadcrumb: + from: self textualCoderViewModel class + to: Object. + + pragmas sorted: [ :aPragma | aPragma arguments first ]. + headerClass := pragmas + ifEmpty: [ self textualCoderViewModel headerElementClass ] + ifNotEmpty: [ + self textualCoderViewModel perform: pragmas first methodSelector ]. + + ^ headerClass new constraintsDo: [ :c | c margin: (BlInsets top: 2). c frame horizontal alignLeft. From ee42d16f62cdb7d929dc516bd2e9f8b0fb82f416 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Wed, 22 Nov 2023 23:18:16 +0100 Subject: [PATCH 0552/1268] Handle the change of the tab label in the search filter tool. --- .../GtPhlowSearchFilterToolElement.class.st | 53 +++++++++++++++---- 1 file changed, 43 insertions(+), 10 deletions(-) diff --git a/src/GToolkit-SearchFilters-PhlowTool/GtPhlowSearchFilterToolElement.class.st b/src/GToolkit-SearchFilters-PhlowTool/GtPhlowSearchFilterToolElement.class.st index c7d956e1d..17c7e8680 100644 --- a/src/GToolkit-SearchFilters-PhlowTool/GtPhlowSearchFilterToolElement.class.st +++ b/src/GToolkit-SearchFilters-PhlowTool/GtPhlowSearchFilterToolElement.class.st @@ -1,6 +1,10 @@ Class { #name : #GtPhlowSearchFilterToolElement, #superclass : #BrVerticalPane, + #instVars : [ + 'titleNotifier', + 'searchFilter' + ], #category : #'GToolkit-SearchFilters-PhlowTool' } @@ -47,8 +51,8 @@ GtPhlowSearchFilterToolElement >> buildTitleLabel [ GtPhlowSearchFilterToolElement >> buildToolLabel [ ^ BrLabel new aptitude: (BrGlamorousLabelAptitude new glamorousRegularFontAndSize - foreground: Color gray; - fontSize: 12); + foreground: Color gray; + fontSize: 12); text: 'Search Filter'. ] @@ -77,6 +81,16 @@ GtPhlowSearchFilterToolElement >> initialize [ padding: (BlInsets top: 5)) as: #content. self addChild: (self buildPlaygroundPageElement padding: (BlInsets top: 5)) as: #playgroundPage. + + self initializeTitleNotifier. +] + +{ #category : #accessing } +GtPhlowSearchFilterToolElement >> initializeTitleNotifier [ + titleNotifier := GtPhlowTitleIconAndLabelNotifier new + longLabel: [ self searchFilterDescription ]; + icon: BrGlamorousVectorIcons emphasizedBrowse. + self addEventHandler: titleNotifier. ] { #category : #'accessing - elements' } @@ -86,7 +100,17 @@ GtPhlowSearchFilterToolElement >> playgroundElement [ { #category : #accessing } GtPhlowSearchFilterToolElement >> searchFilter: aSearchFilter [ - self updateForSearchFilter: aSearchFilter + searchFilter := aSearchFilter. + + self updateContent. +] + +{ #category : #accessing } +GtPhlowSearchFilterToolElement >> searchFilterDescription [ + ^ searchFilter + ifNil: [ 'Search Filter' ] + ifNotNil: [ :aSearchFilter | + 'Filter: ', aSearchFilter gtDisplayString ] ] { #category : #'accessing - elements' } @@ -94,10 +118,15 @@ GtPhlowSearchFilterToolElement >> titleLabel [ ^ self headerElement childNamed: #titleLabel ] +{ #category : #accessing } +GtPhlowSearchFilterToolElement >> titleNotifier [ + ^ titleNotifier +] + { #category : #updating } -GtPhlowSearchFilterToolElement >> updateContentForSearchFilter: aSearchFilter [ +GtPhlowSearchFilterToolElement >> updateContainedView [ | viewElement | - viewElement := (aSearchFilter gtItemsFor: GtPhlowEmptyView new) + viewElement := (searchFilter gtItemsFor: GtPhlowEmptyView new) asElementDo: [ :e | e ]. self contentElement removeChildren; @@ -105,10 +134,14 @@ GtPhlowSearchFilterToolElement >> updateContentForSearchFilter: aSearchFilter [ ] { #category : #updating } -GtPhlowSearchFilterToolElement >> updateForSearchFilter: aSearchFilter [ - self titleLabel - text: aSearchFilter gtDisplayString. - self updateContentForSearchFilter: aSearchFilter. +GtPhlowSearchFilterToolElement >> updateContent [ + self titleLabel text: self searchFilterDescription. + self updateContainedView. self playgroundElement objectHolder: (GtInspectorObject new - object: aSearchFilter) + object: searchFilter) +] + +{ #category : #updating } +GtPhlowSearchFilterToolElement >> updateTabLabel [ + self titleNotifier notify ] From 1ed489fc9e4824c2d631231f77aa2320091d92f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Thu, 23 Nov 2023 19:25:36 +0100 Subject: [PATCH 0553/1268] Remove the margin from newAddOnsContainer [feenkcom/gtoolkit#3526] --- .../GtSourceCoderCollapsedContentElement.class.st | 1 - 1 file changed, 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st index 97347bc09..971b3d2e8 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st @@ -34,7 +34,6 @@ GtSourceCoderCollapsedContentElement >> newAddOnsContainer [ ^ BrHorizontalPane new matchParent; alignCenterLeft; - margin: (BlInsets left: 5); withAsyncPromiseDo: [ :anElementPromise | anElementPromise whenSuccess: [ :aContainer :theAddOns | From 1a15e538457e5404bd7d7584243e297c4c5dd482 Mon Sep 17 00:00:00 2001 From: John Brant Date: Fri, 24 Nov 2023 13:49:04 -0600 Subject: [PATCH 0554/1268] allowing primary click add on buttons --- .../GtCoderActionsElement.class.st | 47 ++++++++++++------- ...hodCoderExtractPlaygroundActionId.class.st | 10 ++++ src/GToolkit-Coder/GtCoderAction.class.st | 13 ++++- src/GToolkit-Coder/GtCoderAddOns.class.st | 13 +++++ 4 files changed, 66 insertions(+), 17 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtMethodCoderExtractPlaygroundActionId.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st index 515d1f048..2eb8f7cc0 100644 --- a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st @@ -41,29 +41,44 @@ GtCoderActionsElement >> handleButton: aButtonElement action: aGtCoderAction onE GtCoderExecutionContextVariable element: aButtonElement do: [ aButtonElement - enqueueTask: - (BlTaskAction new + enqueueTask: (BlTaskAction new action: [ [ aGtCoderAction action - gtValueWithArgs: - {self coderViewModel. - aButtonElement} ] + gtValueWithArgs: {self coderViewModel. + aButtonElement. + anEvent} ] ensure: [ self enqueueEnableButton: aButtonElement action: aGtCoderAction ] ]) ] ] { #category : #'instance creation' } GtCoderActionsElement >> newButtonForAction: aGtCoderAction [ - ^ BrButton new - icon: aGtCoderAction icon asElement; - beTinySize; - label: aGtCoderAction title; - aptitude: BrGlamorousButtonWithIconAptitude; - in: [ :aButtonElement | aButtonElement id: aGtCoderAction id ]; - action: [ :aButtonElement :aButtonModel :anEvent | - self - handleButton: aButtonElement - action: aGtCoderAction - onEvent: anEvent ] + | button | + button := BrButton new + icon: aGtCoderAction icon asElement; + beTinySize; + label: aGtCoderAction title; + aptitude: BrGlamorousButtonWithIconAptitude; + in: [ :aButtonElement | aButtonElement id: aGtCoderAction id ]; + action: [ :aButtonElement :aButtonModel :anEvent | + self + handleButton: aButtonElement + action: aGtCoderAction + onEvent: anEvent ]. + aGtCoderAction allowPrimaryClick + ifTrue: [ button viewModel + when: BlClickEvent + do: [ :anEvent | + anEvent modifiers isPrimaryModifier + ifTrue: [ button viewModel clickEvent: anEvent ] ]. + button viewModel + when: BlMouseEnterEvent + do: [ :anEvent | + anEvent consumed: true. + anEvent modifiers isPrimaryModifier + ifTrue: [ anEvent target mouseCursor: BlCopyCursor new ] + ifFalse: [ anEvent target mouseCursor: nil ]. + anEvent target requestFocus ] ]. + ^ button ] { #category : #'instance creation' } diff --git a/src/GToolkit-Coder-UI/GtMethodCoderExtractPlaygroundActionId.class.st b/src/GToolkit-Coder-UI/GtMethodCoderExtractPlaygroundActionId.class.st new file mode 100644 index 000000000..ce6b281e5 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtMethodCoderExtractPlaygroundActionId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtMethodCoderExtractPlaygroundActionId, + #superclass : #GtCoderElementId, + #category : #'GToolkit-Coder-UI-Coder - Ids' +} + +{ #category : #converting } +GtMethodCoderExtractPlaygroundActionId >> asSymbol [ + ^ #'context-action--extract-playground' +] diff --git a/src/GToolkit-Coder/GtCoderAction.class.st b/src/GToolkit-Coder/GtCoderAction.class.st index d31d3eaa3..1d60a6cd2 100644 --- a/src/GToolkit-Coder/GtCoderAction.class.st +++ b/src/GToolkit-Coder/GtCoderAction.class.st @@ -6,7 +6,8 @@ Class { 'icon', 'action', 'id', - 'shortcutKey' + 'shortcutKey', + 'allowPrimaryClick' ], #category : #'GToolkit-Coder-Coders - Addons' } @@ -32,6 +33,16 @@ GtCoderAction >> action: anObject [ action := anObject ] +{ #category : #accessing } +GtCoderAction >> allowPrimaryClick [ + ^ allowPrimaryClick ifNil: [ false ] +] + +{ #category : #accessing } +GtCoderAction >> allowPrimaryClick: anObject [ + allowPrimaryClick := anObject +] + { #category : #evaluating } GtCoderAction >> gtValueWithArgs: anArray [ ^ self action valueWithPossibleArgs: anArray diff --git a/src/GToolkit-Coder/GtCoderAddOns.class.st b/src/GToolkit-Coder/GtCoderAddOns.class.st index 393d5b45d..7b78668ae 100644 --- a/src/GToolkit-Coder/GtCoderAddOns.class.st +++ b/src/GToolkit-Coder/GtCoderAddOns.class.st @@ -50,6 +50,19 @@ GtCoderAddOns >> addContextAction: aTitleString icon: anIcon action: aBlock id: onlyNew: true ] +{ #category : #'api - context actions' } +GtCoderAddOns >> addContextAction: aTitleString icon: anIcon action: aBlock id: aBlElementId allowPrimaryClick: aBoolean [ + self + updateActionList: #contextActions + withAction: (GtCoderAction new + title: aTitleString; + icon: anIcon; + action: aBlock; + id: aBlElementId; + allowPrimaryClick: aBoolean) + onlyNew: true +] + { #category : #'api - context actions' } GtCoderAddOns >> addContextActions: aCollectionOfContextActions [ aCollectionOfContextActions do: [ :eachContextAction | self addContextAction: eachContextAction ] From e46644fa0fd1de68ae8446f24a5d2232532d2643 Mon Sep 17 00:00:00 2001 From: Alistair Grant Date: Tue, 12 Dec 2023 18:14:21 +0100 Subject: [PATCH 0555/1268] Add .gitattributes --- .gitattributes | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..472bad7c3 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,9 @@ +# Bash needs lf even on windows/cygwin +*.st eol=lf +*.sh eol=lf + +# st files are always text, even if they contain invalid encoded chars +*.st text diff + +# GitHub is unable to properly detect Smalltalk code, so help it a bit +*.st linguist-language=Smalltalk From db766b3b0b56e022096f4cdcf4cc23c5124c2b97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Thu, 14 Dec 2023 17:58:40 +0100 Subject: [PATCH 0556/1268] Add a stub for GtSearchFilterContext --- .../GtSourceCoderBrowseImplementorsShortcut.class.st | 8 +++++--- .../GtPhlowSearchFilterToolElement.class.st | 2 +- .../GtSearchFilterCoderMethodContext.class.st | 5 +++++ src/GToolkit-SearchFilters/GtSearchFilterContext.class.st | 5 +++++ .../GtSearchFilterNullContext.class.st | 5 +++++ 5 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 src/GToolkit-SearchFilters/GtSearchFilterCoderMethodContext.class.st create mode 100644 src/GToolkit-SearchFilters/GtSearchFilterContext.class.st create mode 100644 src/GToolkit-SearchFilters/GtSearchFilterNullContext.class.st diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBrowseImplementorsShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBrowseImplementorsShortcut.class.st index 07055ec6e..e8e36e2b5 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderBrowseImplementorsShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderBrowseImplementorsShortcut.class.st @@ -1,7 +1,7 @@ Class { #name : #GtSourceCoderBrowseImplementorsShortcut, #superclass : #GtSourceCoderShortcut, - #category : 'GToolkit-Coder-UI-Shortcuts' + #category : #'GToolkit-Coder-UI-Shortcuts' } { #category : #accessing } @@ -25,6 +25,8 @@ GtSourceCoderBrowseImplementorsShortcut >> name [ GtSourceCoderBrowseImplementorsShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent [ self forEditor: aBrTextEditor - selectedStringDo: [ :aSelectedString | aGtSourceCoder browseImplementorsIn: aSelectedString ] - orCursorStringPositionDo: [ :aStringPosition | aGtSourceCoder browseImplementorsAt: aStringPosition ] + selectedStringDo: [ :aSelectedString | + aGtSourceCoder browseImplementorsIn: aSelectedString ] + orCursorStringPositionDo: [ :aStringPosition | + aGtSourceCoder browseImplementorsAt: aStringPosition ] ] diff --git a/src/GToolkit-SearchFilters-PhlowTool/GtPhlowSearchFilterToolElement.class.st b/src/GToolkit-SearchFilters-PhlowTool/GtPhlowSearchFilterToolElement.class.st index 17c7e8680..bccad6b86 100644 --- a/src/GToolkit-SearchFilters-PhlowTool/GtPhlowSearchFilterToolElement.class.st +++ b/src/GToolkit-SearchFilters-PhlowTool/GtPhlowSearchFilterToolElement.class.st @@ -138,7 +138,7 @@ GtPhlowSearchFilterToolElement >> updateContent [ self titleLabel text: self searchFilterDescription. self updateContainedView. self playgroundElement objectHolder: (GtInspectorObject new - object: searchFilter) + object: searchFilter) ] { #category : #updating } diff --git a/src/GToolkit-SearchFilters/GtSearchFilterCoderMethodContext.class.st b/src/GToolkit-SearchFilters/GtSearchFilterCoderMethodContext.class.st new file mode 100644 index 000000000..c15262695 --- /dev/null +++ b/src/GToolkit-SearchFilters/GtSearchFilterCoderMethodContext.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtSearchFilterCoderMethodContext, + #superclass : #GtSearchFilterContext, + #category : #'GToolkit-SearchFilters' +} diff --git a/src/GToolkit-SearchFilters/GtSearchFilterContext.class.st b/src/GToolkit-SearchFilters/GtSearchFilterContext.class.st new file mode 100644 index 000000000..5812353c0 --- /dev/null +++ b/src/GToolkit-SearchFilters/GtSearchFilterContext.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtSearchFilterContext, + #superclass : #Object, + #category : #'GToolkit-SearchFilters' +} diff --git a/src/GToolkit-SearchFilters/GtSearchFilterNullContext.class.st b/src/GToolkit-SearchFilters/GtSearchFilterNullContext.class.st new file mode 100644 index 000000000..2303ea52a --- /dev/null +++ b/src/GToolkit-SearchFilters/GtSearchFilterNullContext.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtSearchFilterNullContext, + #superclass : #GtSearchFilterContext, + #category : #'GToolkit-SearchFilters' +} From 1d86e61d1df3c188873a06d7b37e72ccae1f932a Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Wed, 17 Jan 2024 22:00:33 +0100 Subject: [PATCH 0557/1268] [feenkcom/gtoolkit#3563] move tool detail levels to element states --- src/GToolkit-Coder-UI/GtCoderElement.class.st | 90 +++++++++++-------- .../GtCoderNavigationElement.class.st | 19 +--- 2 files changed, 53 insertions(+), 56 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderElement.class.st b/src/GToolkit-Coder-UI/GtCoderElement.class.st index 99c084e2c..834423962 100644 --- a/src/GToolkit-Coder-UI/GtCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderElement.class.st @@ -36,47 +36,55 @@ GtCoderElement >> contentElement: anElement [ contentElement := anElement ] -{ #category : #initialization } +{ #category : #'instance creation' } +GtCoderElement >> createPlaygroundElement [ + ^ GtCoderPlaygroundElement new +] + +{ #category : #'instance creation' } +GtCoderElement >> createSidebarElement [ + ^ GtPhlowHorizontalSidebarElement new + beLeft; + contentStencil: (GtCoderNavigationTabsStencil new navigationModel: self navigationModel) +] + +{ #category : #'instance creation' } +GtCoderElement >> createTitleNotifier [ + ^ GtPhlowTitleIconAndLabelNotifier new + shortLabel: [ self shortTitle ifEmpty: [ 'Coder' asRopedText ] ]; + icon: BrGlamorousVectorIcons emphasizedBrowse +] + +{ #category : #accessing } GtCoderElement >> disablePlayPage [ contentElement disablePlayPage ] +{ #category : #'private - updating' } +GtCoderElement >> hideSidebar [ + sidebarElement ifNil: [ ^ self ]. + sidebarElement + hide; + removeFromParent +] + { #category : #initialization } GtCoderElement >> initialize [ super initialize. - self initializeTitleNotifier. - self addInteractiveModelState: GtPhlowToolDetailModel new. - self initializeContentElement. - self initializeSidebarElement. - self initializeListeners. - - self layout: BlLinearLayout horizontal. - - self addChild: self sidebarElement as: #sidebar. - self addChild: self contentElement as: #content. - - self phlow beView. -] -{ #category : #initialization } -GtCoderElement >> initializeContentElement [ - contentElement := GtCoderPlaygroundElement new. -] + contentElement := self createPlaygroundElement. + titleNotifier := self createTitleNotifier. -{ #category : #initialization } -GtCoderElement >> initializeSidebarElement [ - sidebarElement := GtPhlowHorizontalSidebarElement new beLeft. - self addAptitude: (GtPhlowToolDetailAptitude new - normal: [ :theInstance | sidebarElement hide ]; - detailed: [ :theInstance | sidebarElement show ]). -] + self + layout: BlLinearLayout horizontal; + addEventHandler: titleNotifier; + addAptitude: (GtPhlowToolDetailAptitude new + normal: [ :aStyle | aStyle do: [ self hideSidebar ] ]; + detailed: [ :aStyle | aStyle do: [ self showSidebar ] ]). -{ #category : #initialization } -GtCoderElement >> initializeTitleNotifier [ - titleNotifier := GtPhlowTitleIconAndLabelNotifier new - shortLabel: [ self shortTitle ifEmpty: [ 'Coder' asRopedText ] ]; - icon: BrGlamorousVectorIcons emphasizedBrowse. - self addEventHandler: titleNotifier. + self addChild: contentElement as: #content. + + self phlow beView ] { #category : #'private - hooks' } @@ -101,11 +109,11 @@ GtCoderElement >> pagerWindowTitle [ { #category : #accessing } GtCoderElement >> repository [ - self navigationModel hasSelectedClass ifTrue: [ ^ self navigationModel selectedClass repository ]. self navigationModel hasSelectedPackage ifTrue: [ ^ self navigationModel selectedPackage repository ]. + ^ nil ] @@ -127,10 +135,15 @@ GtCoderElement >> shortTitle [ build ] -{ #category : #'private - accessing' } -GtCoderElement >> sidebarElement [ - - ^ sidebarElement +{ #category : #'private - updating' } +GtCoderElement >> showSidebar [ + sidebarElement ifNil: [ sidebarElement := self createSidebarElement ]. + sidebarElement show. + + (sidebarElement hasParent: self) + ifTrue: [ ^ self ]. + + self addChildFirst: sidebarElement ] { #category : #'private - accessing' } @@ -164,9 +177,8 @@ GtCoderElement >> titleNotifier [ { #category : #'private - updating' } GtCoderElement >> updateSidebarContent [ - self sidebarElement - contentStencil: (GtCoderNavigationTabsStencil new - navigationModel: self navigationModel) + sidebarElement ifNil: [ ^ self ]. + sidebarElement contentStencil: (GtCoderNavigationTabsStencil new navigationModel: self navigationModel) ] { #category : #'private - updating' } diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st index b1d359acf..8b82f73e2 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st @@ -75,14 +75,6 @@ GtCoderNavigationElement >> navigationModel: aGtCoderNavigationPackagesTagsClass self onNavigationModelChanged. ] -{ #category : #'hooks - children' } -GtCoderNavigationElement >> onAddedToSceneGraph [ - super onAddedToSceneGraph. - self updateContent. - self subscribeToNavigationModel. - self subscribeToContent. -] - { #category : #'event handling' } GtCoderNavigationElement >> onClassAdded: anAnnouncement [ self @@ -136,16 +128,9 @@ GtCoderNavigationElement >> onClassSelected: anAnnouncement [ { #category : #'event handling' } GtCoderNavigationElement >> onNavigationModelChanged [ "subclasses may perform actions on navigation model changes" - self isAttachedToSceneGraph ifFalse: [ ^ self ]. - self subscribeToNavigationModel. self updateContent. -] - -{ #category : #'hooks - children' } -GtCoderNavigationElement >> onRemovedFromSceneGraph [ - super onRemovedFromSceneGraph. - self unsuscribeFromContent. - self unsubscribeFromNavigationModel. + self subscribeToNavigationModel. + self subscribeToContent. ] { #category : #'api - class updates' } From c51b28247041407d22b2ac24229e557c52924e17 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 18 Jan 2024 20:00:09 +0100 Subject: [PATCH 0558/1268] reuse elements when scrolling through a packages tree --- ...oderNavigationPackagesTreeElement.class.st | 26 ++++-------- ...NavigationPackagesTreeItemElement.class.st | 41 +++++++++++++++++++ 2 files changed, 50 insertions(+), 17 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeItemElement.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st index c55cb97e0..9c5076ac4 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st @@ -87,25 +87,17 @@ GtCoderNavigationPackagesTreeElement >> initialize [ self rowStencil: BrGlamorousSimpleTreeSelectableRowElementStencilBuilder new. self - nodeStencil: [ BrHorizontalPane new + nodeStencil: [ + | anItemElement | + anItemElement := GtCoderNavigationPackagesTreeItemElement new. + anItemElement hMatchParent; - vFitContent ]; - nodeDataBinder: [ :aPackageElement :aPackage | - | label | - aPackageElement - removeChildren; - aptitude: BrGlamorousListItemAptitude new - + (BrGlamorousWithContextMenuAptitude + vFitContent; + addAptitude: (BrGlamorousWithContextMenuAptitude content: [ GtCoderNavigationContextMenuContent new - items: (self contextMenuItemsFor: aPackage) ]). - label := BrLabel new - matchParent; - beSmallSize; - aptitude: BrGlamorousLabelAptitude. - aPackageElement addChild: label. - aPackage - ifNil: [ label text: '' asRopedText ] - ifNotNil: [ label text: aPackage name ] ] + items: (self contextMenuItemsFor: anItemElement packageOrTag) ]) ]; + nodeDataBinder: [ :aPackageElement :aPackage | + aPackageElement packageOrTag: aPackage ] ] { #category : #'api - initialization' } diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeItemElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeItemElement.class.st new file mode 100644 index 000000000..53e4d01cc --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeItemElement.class.st @@ -0,0 +1,41 @@ +Class { + #name : #GtCoderNavigationPackagesTreeItemElement, + #superclass : #BrHorizontalPane, + #instVars : [ + 'packageOrTag', + 'label' + ], + #category : #'GToolkit-Coder-UI-Navigation' +} + +{ #category : #initialization } +GtCoderNavigationPackagesTreeItemElement >> initialize [ + super initialize. + + self addAptitude: BrGlamorousListItemAptitude new. + + label := BrLabel new + matchParent; + text: ''; + beSmallSize; + aptitude: BrGlamorousLabelAptitude. + + self addChild: label +] + +{ #category : #accessing } +GtCoderNavigationPackagesTreeItemElement >> packageOrTag [ + ^ packageOrTag +] + +{ #category : #accessing } +GtCoderNavigationPackagesTreeItemElement >> packageOrTag: aPackageOrTag [ + packageOrTag = aPackageOrTag + ifTrue: [ ^ self ]. + + packageOrTag := aPackageOrTag. + + packageOrTag + ifNil: [ label text: '' ] + ifNotNil: [ label text: packageOrTag name ] +] From 0669a64897039f6a28c2f2ee334eef44b2953827 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Fri, 19 Jan 2024 15:28:24 +0100 Subject: [PATCH 0559/1268] [feenkcom/gtoolkit#3567] show shadow around an expander on hover --- .../GtCoderExpanderShadowAptitude.class.st | 8 ++++---- .../GtCoderExpanderWithoutShadowAptitude.class.st | 10 ++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderExpanderShadowAptitude.class.st b/src/GToolkit-Coder-UI/GtCoderExpanderShadowAptitude.class.st index b963c9028..e3149a02c 100644 --- a/src/GToolkit-Coder-UI/GtCoderExpanderShadowAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExpanderShadowAptitude.class.st @@ -1,7 +1,7 @@ Class { #name : #GtCoderExpanderShadowAptitude, - #superclass : #BrStyleCommonAptitude, - #category : 'GToolkit-Coder-UI-Looks' + #superclass : #BrLazyStyleCommonAptitude, + #category : #'GToolkit-Coder-UI-Looks' } { #category : #initialization } @@ -9,8 +9,8 @@ GtCoderExpanderShadowAptitude >> initialize [ super initialize. self - when: (self state expanded & self state focused) + when: (self state focused) style: [ :aStyle | aStyle effect: BrGlamorousFocusedShadowEffect new ]; - when: (self state expanded & self state unfocused) + when: (self state hovered or: (self state expanded & self state unfocused)) style: [ :aStyle | aStyle effect: BrGlamorousShadowEffect new ] ] diff --git a/src/GToolkit-Coder-UI/GtCoderExpanderWithoutShadowAptitude.class.st b/src/GToolkit-Coder-UI/GtCoderExpanderWithoutShadowAptitude.class.st index aab266449..8a0881d81 100644 --- a/src/GToolkit-Coder-UI/GtCoderExpanderWithoutShadowAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExpanderWithoutShadowAptitude.class.st @@ -99,15 +99,17 @@ GtCoderExpanderWithoutShadowAptitude >> initialize [ padding: self padding; layout: BlLinearLayout vertical. - self add: (BrStyleCommonAptitude new + self add: (BrLazyStyleCommonAptitude new + default: [ :aStyle | + aStyle background: Color white]; collapsed: [ :aStyle | aStyle border: (BlBorder paint: self borderPaint width: self borderWidth) ]; expanded: [ :aStyle | - aStyle background: Color white. aStyle border: (BlBorder paint: self borderPaint width: self expandedBorderWidth) ]; - focused: [ :aStyle | (BlBorder paint: self borderFocusedPaint width: self expandedBorderWidth) ]). + focused: [ :aStyle | + aStyle border: (BlBorder paint: self borderFocusedPaint width: self expandedBorderWidth) ]). - self add: (BrStyleCommonAptitude new + self add: (BrLazyStyleCommonAptitude new @ sidebar; default: [ :aStyle | aStyle background: self borderPaint ]; focused: [ :aStyle | aStyle background: self borderFocusedPaint ]). From a12b8724fa08e24a344811878975e3da66f2e7ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Tue, 23 Jan 2024 14:37:19 +0100 Subject: [PATCH 0560/1268] Update priority for #gtLocalVersionsFor: --- src/GToolkit-Coder-Extensions/CompiledMethod.extension.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st b/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st index 1898ee174..9e19b17c5 100644 --- a/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st +++ b/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st @@ -22,7 +22,7 @@ CompiledMethod >> gtLocalVersionsFor: aView [ ^ aView list title: 'Local versions'; - priority: 20; + priority: 10; items: [ SourceFiles changeRecordsFrom: self sourcePointer className: self methodClass instanceSide name From 14ee48cbacb62699c65de3442f6184c36195618b Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Tue, 23 Jan 2024 15:25:42 +0100 Subject: [PATCH 0561/1268] optimize protocol nad method list in the navigation --- ...igationPackagesTagsClassesElement.class.st | 66 ++++++++----------- 1 file changed, 27 insertions(+), 39 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 09152258d..e2af4dd1e 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -107,13 +107,19 @@ GtCoderNavigationPackagesTagsClassesElement >> buildGroupWithBinder: binderBlock instanceGroup := BrGroup new domainObject: 'instance side'; stream: #() asAsyncStream; - itemStencil: [ | label | - label := BrLabel new - hMatchParent; - vFitContent; - beSmallSize; - aptitude: BrGlamorousLabelAptitude + BrGlamorousListItemAptitude; - when: BlClickEvent do: clickBlock ]; + itemStencil: [ + | aLabel | + aLabel := BrLabel new. + aLabel + hMatchParent; + vFitContent; + beSmallSize; + aptitude: BrGlamorousLabelAptitude + BrGlamorousListItemAptitude + + (BrGlamorousWithContextMenuAptitude + content: [ GtCoderNavigationContextMenuContent new + items: (self protocolListContextMenuItemsFor: (aLabel userData at: #protocol)) ]); + when: BlClickEvent do: clickBlock. + aLabel ]; itemDataBinder: binderBlock; shouldShowWithoutItems: false. classGroup := instanceGroup copy domainObject: 'class side'. @@ -127,20 +133,8 @@ GtCoderNavigationPackagesTagsClassesElement >> buildMethodGroupList [ list := self buildGroupList. methodGroup := self buildMethodGroupWithBinder: [ :element :item | - | label | - element removeChildren. element userData at: #method put: item. - label := BrLabel new - matchParent; - beSmallSize; - aptitude: BrGlamorousLabelAptitude. - label text: item selector asRopedText. - - label - addAptitude: (BrGlamorousWithContextMenuAptitude - content: [ GtCoderNavigationContextMenuContent new - items: (self methodListContextMenuItemsFor: item) ]). - element addChild: label ] + element text: item selector asRopedText. ] onClick: [ :event | event consumed: true. self @@ -155,12 +149,18 @@ GtCoderNavigationPackagesTagsClassesElement >> buildMethodGroupWithBinder: binde instanceGroup := BrGroup new domainObject: 'instance side'; stream: #() asAsyncStream; - itemStencil: [ | label | - label := BrHorizontalPane new - aptitude: BrGlamorousListItemAptitude; - hMatchParent; - vFitContent; - when: BlClickEvent do: clickBlock ]; + itemStencil: [ | aLabel | + aLabel := BrLabel new. + aLabel + hMatchParent; + vFitContent; + beSmallSize; + aptitude: BrGlamorousLabelAptitude + BrGlamorousListItemAptitude + + (BrGlamorousWithContextMenuAptitude + content: [ GtCoderNavigationContextMenuContent new + items: (self methodListContextMenuItemsFor: (aLabel userData at: #method)) ]); + when: BlClickEvent do: clickBlock. + aLabel ]; itemDataBinder: binderBlock; shouldShowWithoutItems: false. classGroup := instanceGroup copy domainObject: 'class side'. @@ -174,20 +174,8 @@ GtCoderNavigationPackagesTagsClassesElement >> buildProtocolGroupList [ list := self buildGroupList. protocolGroup := self buildGroupWithBinder: [ :element :item | - | label | - element removeChildren. element userData at: #protocol put: item. - label := BrLabel new - hMatchParent; - vFitContent; - beSmallSize; - aptitude: BrGlamorousLabelAptitude + BrGlamorousListItemAptitude. - label text: item name asRopedText. - label - addAptitude: (BrGlamorousWithContextMenuAptitude - content: [ GtCoderNavigationContextMenuContent new - items: (self protocolListContextMenuItemsFor: item) ]). - element addChild: label ] + element text: item name asRopedText ] onClick: [ :event | event consumed: true. self onProtocolListSelectionChanged ]. From 1411e6a9f4fe15b484e797ed793b222891f6f4c0 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 25 Jan 2024 16:25:12 +0100 Subject: [PATCH 0562/1268] remove obsolete telemetry --- .../TGtWithTextualCoderViewModel.trait.st | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/GToolkit-Coder-UI/TGtWithTextualCoderViewModel.trait.st b/src/GToolkit-Coder-UI/TGtWithTextualCoderViewModel.trait.st index 2f15aff4e..49082fbe9 100644 --- a/src/GToolkit-Coder-UI/TGtWithTextualCoderViewModel.trait.st +++ b/src/GToolkit-Coder-UI/TGtWithTextualCoderViewModel.trait.st @@ -59,22 +59,12 @@ TGtWithTextualCoderViewModel >> textualCoderViewModel: aTextualCoderViewModel [ textualCoderViewModel == aTextualCoderViewModel ifTrue: [ ^ self ]. - BlFrameTelemetry - time: [ self class name, ' #unsubscribeFromTextualCoderViewModel' ] - during: [ textualCoderViewModel ifNotNil: [ self unsubscribeFromTextualCoderViewModel ] ]. + textualCoderViewModel ifNotNil: [ self unsubscribeFromTextualCoderViewModel ]. textualCoderViewModel := aTextualCoderViewModel. - BlFrameTelemetry - time: [ self class name, ' ', #onTextualCoderViewModelChanged ] - during: [ self onTextualCoderViewModelChanged ]. - - BlFrameTelemetry - time: [ self class name, ' ', #subscribeToTextualCoderViewModel ] - during: [ self subscribeToTextualCoderViewModel ]. - - BlFrameTelemetry - time: [ self class name, ' ', #onPostTextualCoderViewModelChanged ] - during: [ self onPostTextualCoderViewModelChanged ]. + self onTextualCoderViewModelChanged. + self subscribeToTextualCoderViewModel. + self onPostTextualCoderViewModelChanged. ] { #category : #'api - textual coder view model' } From e2adf762d900a34b086222c7b374b89d8752f829 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 26 Jan 2024 13:57:35 -0300 Subject: [PATCH 0563/1268] remove unused instance variable --- src/GToolkit-Coder/GtCoderModel.class.st | 1 - 1 file changed, 1 deletion(-) diff --git a/src/GToolkit-Coder/GtCoderModel.class.st b/src/GToolkit-Coder/GtCoderModel.class.st index 8874fbcbd..11d82729b 100644 --- a/src/GToolkit-Coder/GtCoderModel.class.st +++ b/src/GToolkit-Coder/GtCoderModel.class.st @@ -25,7 +25,6 @@ Class { 'monitor', 'announcer', 'id', - 'suppressedAnnouncements', 'attributes', 'extraAddOns' ], From af6bcfcd075afc8113f6ddd32fe83fa0bf8491b3 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 26 Jan 2024 22:49:36 -0300 Subject: [PATCH 0564/1268] add `GtCoderObjectSpawnRequest>>#requesterObject` [feenkcom/gtoolkit#3582] The requester object is a coder view model from which an action is triggered. Other coder view models can ignore the spawn request. --- ...SourceCoderBrowseBehaviorShortcut.class.st | 4 +-- ...ceCoderBrowseImplementorsShortcut.class.st | 8 +++--- ...urceCoderBrowseReferencesShortcut.class.st | 8 +++--- .../GtSourceCoderFormatShortcut.class.st | 4 +-- ...SourceCoderPlayAndInspectShortcut.class.st | 4 +-- .../GtSourceCoderPlayShortcut.class.st | 4 +-- .../GtSourceCoderShortcut.class.st | 5 ++-- .../GtTextualCoderEditorElement.class.st | 8 ++++++ .../GtCoderObjectSpawnRequest.class.st | 15 +++++++++-- .../GtCoderPrintAnnouncement.class.st | 7 +++++- src/GToolkit-Coder/GtSourceCoder.class.st | 25 ++++++++++--------- 11 files changed, 58 insertions(+), 34 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBrowseBehaviorShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBrowseBehaviorShortcut.class.st index 0865b9658..a356dd221 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderBrowseBehaviorShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderBrowseBehaviorShortcut.class.st @@ -1,7 +1,7 @@ Class { #name : #GtSourceCoderBrowseBehaviorShortcut, #superclass : #GtSourceCoderShortcut, - #category : 'GToolkit-Coder-UI-Shortcuts' + #category : #'GToolkit-Coder-UI-Shortcuts' } { #category : #accessing } @@ -22,7 +22,7 @@ GtSourceCoderBrowseBehaviorShortcut >> name [ ] { #category : #evaluation } -GtSourceCoderBrowseBehaviorShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent [ +GtSourceCoderBrowseBehaviorShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent requesterObject: aReceiver [ self forEditor: aBrTextEditor diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBrowseImplementorsShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBrowseImplementorsShortcut.class.st index e8e36e2b5..3e186eebb 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderBrowseImplementorsShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderBrowseImplementorsShortcut.class.st @@ -22,11 +22,9 @@ GtSourceCoderBrowseImplementorsShortcut >> name [ ] { #category : #evaluation } -GtSourceCoderBrowseImplementorsShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent [ +GtSourceCoderBrowseImplementorsShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent requesterObject: aRequester [ self forEditor: aBrTextEditor - selectedStringDo: [ :aSelectedString | - aGtSourceCoder browseImplementorsIn: aSelectedString ] - orCursorStringPositionDo: [ :aStringPosition | - aGtSourceCoder browseImplementorsAt: aStringPosition ] + selectedStringDo: [ :aSelectedString | aGtSourceCoder browseImplementorsIn: aSelectedString requesterObject: aRequester ] + orCursorStringPositionDo: [ :aStringPosition | aGtSourceCoder browseImplementorsAt: aStringPosition requesterObject: aRequester ] ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBrowseReferencesShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBrowseReferencesShortcut.class.st index 7ebf707d4..aa23d0cdf 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderBrowseReferencesShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderBrowseReferencesShortcut.class.st @@ -1,7 +1,7 @@ Class { #name : #GtSourceCoderBrowseReferencesShortcut, #superclass : #GtSourceCoderShortcut, - #category : 'GToolkit-Coder-UI-Shortcuts' + #category : #'GToolkit-Coder-UI-Shortcuts' } { #category : #accessing } @@ -22,9 +22,9 @@ GtSourceCoderBrowseReferencesShortcut >> name [ ] { #category : #evaluation } -GtSourceCoderBrowseReferencesShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent [ +GtSourceCoderBrowseReferencesShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent requesterObject: aReceiver [ self forEditor: aBrTextEditor - selectedStringDo: [ :aSelectedString | aGtSourceCoder browseReferencesIn: aSelectedString ] - orCursorStringPositionDo: [ :aStringPosition | aGtSourceCoder browseReferencesAt: aStringPosition ] + selectedStringDo: [ :aSelectedString | aGtSourceCoder browseReferencesIn: aSelectedString requesterObject: aReceiver ] + orCursorStringPositionDo: [ :aStringPosition | aGtSourceCoder browseReferencesAt: aStringPosition requesterObject: aReceiver ] ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderFormatShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderFormatShortcut.class.st index 1ea942834..7ff52775e 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderFormatShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderFormatShortcut.class.st @@ -1,7 +1,7 @@ Class { #name : #GtSourceCoderFormatShortcut, #superclass : #GtSourceCoderShortcut, - #category : 'GToolkit-Coder-UI-Shortcuts' + #category : #'GToolkit-Coder-UI-Shortcuts' } { #category : #accessing } @@ -22,6 +22,6 @@ GtSourceCoderFormatShortcut >> name [ ] { #category : #evaluation } -GtSourceCoderFormatShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent [ +GtSourceCoderFormatShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent requesterObject: aReceiver [ aGtSourceCoder format ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderPlayAndInspectShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderPlayAndInspectShortcut.class.st index 7040118d6..7454be239 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderPlayAndInspectShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderPlayAndInspectShortcut.class.st @@ -1,7 +1,7 @@ Class { #name : #GtSourceCoderPlayAndInspectShortcut, #superclass : #GtSourceCoderShortcut, - #category : 'GToolkit-Coder-UI-Shortcuts' + #category : #'GToolkit-Coder-UI-Shortcuts' } { #category : #accessing } @@ -22,7 +22,7 @@ GtSourceCoderPlayAndInspectShortcut >> name [ ] { #category : #evaluation } -GtSourceCoderPlayAndInspectShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent [ +GtSourceCoderPlayAndInspectShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent requesterObject: aReceiver [ GtCoderExecutionContextVariable element: aBrEditorElement do: [ diff --git a/src/GToolkit-Coder-UI/GtSourceCoderPlayShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderPlayShortcut.class.st index de6cec80d..3e32cce80 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderPlayShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderPlayShortcut.class.st @@ -1,7 +1,7 @@ Class { #name : #GtSourceCoderPlayShortcut, #superclass : #GtSourceCoderShortcut, - #category : 'GToolkit-Coder-UI-Shortcuts' + #category : #'GToolkit-Coder-UI-Shortcuts' } { #category : #accessing } @@ -22,7 +22,7 @@ GtSourceCoderPlayShortcut >> name [ ] { #category : #evaluation } -GtSourceCoderPlayShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent [ +GtSourceCoderPlayShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent requesterObject: aReceiver [ GtCoderExecutionContextVariable element: aBrEditorElement do: [ diff --git a/src/GToolkit-Coder-UI/GtSourceCoderShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderShortcut.class.st index 4133a9ccc..ef244ee2c 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderShortcut.class.st @@ -1,7 +1,7 @@ Class { #name : #GtSourceCoderShortcut, #superclass : #BrEditorShortcut, - #category : 'GToolkit-Coder-UI-Shortcuts' + #category : #'GToolkit-Coder-UI-Shortcuts' } { #category : #private } @@ -37,7 +37,7 @@ GtSourceCoderShortcut >> forEditor: aBrTextEditor selectionIntervalDo: aSelectio ] { #category : #evaluation } -GtSourceCoderShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent [ +GtSourceCoderShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent requesterObject: aReceiver [ self subclassResponsibility ] @@ -48,6 +48,7 @@ GtSourceCoderShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElemen element: aBrEditorElement coder: aSourceCoderViewModel coder dueTo: aShortcutEvent + requesterObject: aSourceCoderViewModel ] { #category : #evaluation } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index c677ef32b..f7bc2501f 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -169,6 +169,9 @@ GtTextualCoderEditorElement >> onAddedToSceneGraph [ { #category : #'private - event handling' } GtTextualCoderEditorElement >> onCodeEvaluated: anEvaluationAnnouncement [ + anEvaluationAnnouncement requesterObject = self textualCoderViewModel + ifFalse: [ ^ self ]. + evaluationHighlighter displayResult: anEvaluationAnnouncement evaluationResult. evaluationPrinter hideResult ] @@ -201,6 +204,8 @@ GtTextualCoderEditorElement >> onFocusChangedAnnouncement: anAnnouncement [ { #category : #'private - event handling' } GtTextualCoderEditorElement >> onObjectSpawnRequest: anAnnouncement [ + anAnnouncement requesterObject = self textualCoderViewModel ifFalse: [ ^ self ]. + self enqueueTask: (BlTaskAction new action: [ self phlow spawnObject: anAnnouncement object @@ -225,6 +230,9 @@ GtTextualCoderEditorElement >> onPostTextualCoderViewModelChanged [ { #category : #'private - event handling' } GtTextualCoderEditorElement >> onPrintRequest: anEvaluationAnnouncement [ + anEvaluationAnnouncement requesterObject = self textualCoderViewModel + ifFalse: [ ^ self ]. + evaluationHighlighter hideResult. evaluationPrinter displayResult: anEvaluationAnnouncement evaluationResult. ] diff --git a/src/GToolkit-Coder/GtCoderObjectSpawnRequest.class.st b/src/GToolkit-Coder/GtCoderObjectSpawnRequest.class.st index d55a7d84d..da5373375 100644 --- a/src/GToolkit-Coder/GtCoderObjectSpawnRequest.class.st +++ b/src/GToolkit-Coder/GtCoderObjectSpawnRequest.class.st @@ -3,9 +3,10 @@ Class { #superclass : #GtSourceCoderAnnouncement, #instVars : [ 'object', - 'spawnDestination' + 'spawnDestination', + 'requesterObject' ], - #category : 'GToolkit-Coder-Event' + #category : #'GToolkit-Coder-Event' } { #category : #accessing } @@ -18,6 +19,16 @@ GtCoderObjectSpawnRequest >> object: anObject [ object := anObject ] +{ #category : #accessing } +GtCoderObjectSpawnRequest >> requesterObject [ + ^ requesterObject +] + +{ #category : #accessing } +GtCoderObjectSpawnRequest >> requesterObject: anObject [ + requesterObject := anObject +] + { #category : #accessing } GtCoderObjectSpawnRequest >> spawnDestination [ ^ spawnDestination diff --git a/src/GToolkit-Coder/GtCoderPrintAnnouncement.class.st b/src/GToolkit-Coder/GtCoderPrintAnnouncement.class.st index d75306ec6..9ab01d18f 100644 --- a/src/GToolkit-Coder/GtCoderPrintAnnouncement.class.st +++ b/src/GToolkit-Coder/GtCoderPrintAnnouncement.class.st @@ -4,7 +4,7 @@ Class { #instVars : [ 'evaluationResult' ], - #category : 'GToolkit-Coder-Event' + #category : #'GToolkit-Coder-Event' } { #category : #accessing } @@ -18,3 +18,8 @@ GtCoderPrintAnnouncement >> evaluationResult [ GtCoderPrintAnnouncement >> evaluationResult: aGtSourceCoderEvaluationResult [ evaluationResult := aGtSourceCoderEvaluationResult ] + +{ #category : #accessing } +GtCoderPrintAnnouncement >> requesterObject [ + ^ self evaluationResult requesterObject +] diff --git a/src/GToolkit-Coder/GtSourceCoder.class.st b/src/GToolkit-Coder/GtSourceCoder.class.st index a3d43e313..ce4d73de3 100644 --- a/src/GToolkit-Coder/GtSourceCoder.class.st +++ b/src/GToolkit-Coder/GtSourceCoder.class.st @@ -82,9 +82,11 @@ GtSourceCoder >> doItAndGoInContext: aGtSourceCoderEvaluationContext [ ^ self evaluate: [ :thisCoder | thisCoder currentSourceString ] inContext: aGtSourceCoderEvaluationContext - thenDo: [ :anEvaluationResult | + thenDo: [ :anEvaluationResult | self notifyEvaluatedWithResult: anEvaluationResult. - self notifyObjectSpawnFromEvaluationResult: anEvaluationResult ] + self + notifyObjectSpawnFromEvaluationResult: anEvaluationResult + requesterObject: aGtSourceCoderEvaluationContext requesterObject ] ] { #category : #'api - actions' } @@ -264,28 +266,27 @@ GtSourceCoder >> notifyEvaluatedWithResult: anEvaluationResult [ ] { #category : #'private - notifying' } -GtSourceCoder >> notifyObjectSpawn: anObject [ +GtSourceCoder >> notifyObjectSpawn: anObject requesterObject: aRequester [ self notifyObjectSpawn: anObject withDestination: self spawnDestination + requesterObject: aRequester ] { #category : #'private - notifying' } -GtSourceCoder >> notifyObjectSpawn: anObject withDestination: aSpawnDestination [ +GtSourceCoder >> notifyObjectSpawn: anObject withDestination: aSpawnDestination requesterObject: aRequester [ self announce: (GtCoderObjectSpawnRequest new object: anObject; spawnDestination: aSpawnDestination; - coder: self) + coder: self; + requesterObject: aRequester) ] { #category : #'private - notifying' } -GtSourceCoder >> notifyObjectSpawnFromEvaluationResult: anEvaluationResult [ - - anEvaluationResult isSuccess - ifFalse: [ ^ self ]. - - self - notifyObjectSpawn: anEvaluationResult value +GtSourceCoder >> notifyObjectSpawnFromEvaluationResult: anEvaluationResult requesterObject: aRequester [ + anEvaluationResult isSuccess ifFalse: [ ^ self ]. + + self notifyObjectSpawn: anEvaluationResult value requesterObject: aRequester ] { #category : #'private - notifying' } From 7519f9f2efc238f7b3b575c56c9e45a21177c018 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 29 Jan 2024 11:56:45 -0300 Subject: [PATCH 0565/1268] introduce `TGtCoderRequesterObject` [feenkcom/gtoolkit#3582] --- .../GtCoderViewModelRequester.class.st | 25 +++++++++++++++++++ .../GtSourceCoderViewModel.class.st | 8 ++++-- .../GtTextualCoderEditorElement.class.st | 5 ++-- .../TGtCoderRequesterObject.extension.st | 6 +++++ .../GtCoderEvaluationAnnouncement.class.st | 5 ++-- .../GtCoderObjectSpawnRequest.class.st | 5 ++-- .../GtCoderPrintAnnouncement.class.st | 1 + .../GtNoCoderRequester.class.st | 7 ++++++ src/GToolkit-Coder/GtSourceCoder.class.st | 2 +- .../GtSourceCoderEvaluationContext.class.st | 7 +++--- .../GtSourceCoderEvaluationResult.class.st | 3 ++- .../GtSourceCoderRequester.class.st | 20 +++++++++++++++ .../TGtCoderRequesterObject.trait.st | 9 +++++++ 13 files changed, 90 insertions(+), 13 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderViewModelRequester.class.st create mode 100644 src/GToolkit-Coder-UI/TGtCoderRequesterObject.extension.st create mode 100644 src/GToolkit-Coder/GtNoCoderRequester.class.st create mode 100644 src/GToolkit-Coder/GtSourceCoderRequester.class.st create mode 100644 src/GToolkit-Coder/TGtCoderRequesterObject.trait.st diff --git a/src/GToolkit-Coder-UI/GtCoderViewModelRequester.class.st b/src/GToolkit-Coder-UI/GtCoderViewModelRequester.class.st new file mode 100644 index 000000000..0d414281f --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderViewModelRequester.class.st @@ -0,0 +1,25 @@ +Class { + #name : #GtCoderViewModelRequester, + #superclass : #Object, + #traits : 'TGtCoderRequesterObject', + #classTraits : 'TGtCoderRequesterObject classTrait', + #instVars : [ + 'coderViewModel' + ], + #category : #'GToolkit-Coder-UI-Coder - Source Model' +} + +{ #category : #accessing } +GtCoderViewModelRequester >> coderViewModel [ + ^ coderViewModel +] + +{ #category : #accessing } +GtCoderViewModelRequester >> coderViewModel: anObject [ + coderViewModel := anObject +] + +{ #category : #testing } +GtCoderViewModelRequester >> isCoderViewModel: aCoderViewModel [ + ^ aCoderViewModel = self coderViewModel +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st index cee859aad..89887ee7c 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st @@ -7,6 +7,11 @@ Class { #category : #'GToolkit-Coder-UI-Coder - Source Model' } +{ #category : #converting } +GtSourceCoderViewModel >> asCoderRequesterObject [ + ^ GtCoderViewModelRequester new coderViewModel: self +] + { #category : #'api - actions' } GtSourceCoderViewModel >> debug [ ^ self selection isEmpty @@ -138,9 +143,8 @@ GtSourceCoderViewModel >> elementClass [ { #category : #'private - evaluation' } GtSourceCoderViewModel >> evaluationContext [ - ^ self coderModel evaluationContext - requesterObject: self + requesterObject: self asCoderRequesterObject ] { #category : #'api - accessing' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index f7bc2501f..f18ce5cb2 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -169,7 +169,7 @@ GtTextualCoderEditorElement >> onAddedToSceneGraph [ { #category : #'private - event handling' } GtTextualCoderEditorElement >> onCodeEvaluated: anEvaluationAnnouncement [ - anEvaluationAnnouncement requesterObject = self textualCoderViewModel + (anEvaluationAnnouncement requesterObject isCoderViewModel: self textualCoderViewModel) ifFalse: [ ^ self ]. evaluationHighlighter displayResult: anEvaluationAnnouncement evaluationResult. @@ -204,7 +204,8 @@ GtTextualCoderEditorElement >> onFocusChangedAnnouncement: anAnnouncement [ { #category : #'private - event handling' } GtTextualCoderEditorElement >> onObjectSpawnRequest: anAnnouncement [ - anAnnouncement requesterObject = self textualCoderViewModel ifFalse: [ ^ self ]. + (anAnnouncement requesterObject isCoderViewModel: self textualCoderViewModel) + ifFalse: [ ^ self ]. self enqueueTask: (BlTaskAction new action: [ self phlow diff --git a/src/GToolkit-Coder-UI/TGtCoderRequesterObject.extension.st b/src/GToolkit-Coder-UI/TGtCoderRequesterObject.extension.st new file mode 100644 index 000000000..3614161be --- /dev/null +++ b/src/GToolkit-Coder-UI/TGtCoderRequesterObject.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #TGtCoderRequesterObject } + +{ #category : #'*GToolkit-Coder-UI' } +TGtCoderRequesterObject >> isCoderViewModel: aCoderViewModel [ + ^ false +] diff --git a/src/GToolkit-Coder/GtCoderEvaluationAnnouncement.class.st b/src/GToolkit-Coder/GtCoderEvaluationAnnouncement.class.st index 483616dbd..d89e7dd51 100644 --- a/src/GToolkit-Coder/GtCoderEvaluationAnnouncement.class.st +++ b/src/GToolkit-Coder/GtCoderEvaluationAnnouncement.class.st @@ -4,7 +4,7 @@ Class { #instVars : [ 'evaluationResult' ], - #category : 'GToolkit-Coder-Event' + #category : #'GToolkit-Coder-Event' } { #category : #accessing } @@ -21,7 +21,7 @@ GtCoderEvaluationAnnouncement >> evaluationResult: aGtSourceCoderEvaluationResul { #category : #testing } GtCoderEvaluationAnnouncement >> isRequestedByElementOrItsChild: anElement [ - "Return true if the evaluation ws requested by a given visual element or any of its children" + "Return true if the evaluation was requested by a given visual element or any of its children" self requesterObject == anElement @@ -35,5 +35,6 @@ GtCoderEvaluationAnnouncement >> isRequestedByElementOrItsChild: anElement [ { #category : #accessing } GtCoderEvaluationAnnouncement >> requesterObject [ + ^ self evaluationResult requesterObject ] diff --git a/src/GToolkit-Coder/GtCoderObjectSpawnRequest.class.st b/src/GToolkit-Coder/GtCoderObjectSpawnRequest.class.st index da5373375..8583c1a39 100644 --- a/src/GToolkit-Coder/GtCoderObjectSpawnRequest.class.st +++ b/src/GToolkit-Coder/GtCoderObjectSpawnRequest.class.st @@ -21,12 +21,13 @@ GtCoderObjectSpawnRequest >> object: anObject [ { #category : #accessing } GtCoderObjectSpawnRequest >> requesterObject [ - ^ requesterObject + + ^ requesterObject ifNil: [ GtNoCoderRequester uniqueInstance ] ] { #category : #accessing } GtCoderObjectSpawnRequest >> requesterObject: anObject [ - requesterObject := anObject + requesterObject := anObject asCoderRequesterObject ] { #category : #accessing } diff --git a/src/GToolkit-Coder/GtCoderPrintAnnouncement.class.st b/src/GToolkit-Coder/GtCoderPrintAnnouncement.class.st index 9ab01d18f..c74b6a6bd 100644 --- a/src/GToolkit-Coder/GtCoderPrintAnnouncement.class.st +++ b/src/GToolkit-Coder/GtCoderPrintAnnouncement.class.st @@ -21,5 +21,6 @@ GtCoderPrintAnnouncement >> evaluationResult: aGtSourceCoderEvaluationResult [ { #category : #accessing } GtCoderPrintAnnouncement >> requesterObject [ + ^ self evaluationResult requesterObject ] diff --git a/src/GToolkit-Coder/GtNoCoderRequester.class.st b/src/GToolkit-Coder/GtNoCoderRequester.class.st new file mode 100644 index 000000000..b50dcc1a0 --- /dev/null +++ b/src/GToolkit-Coder/GtNoCoderRequester.class.st @@ -0,0 +1,7 @@ +Class { + #name : #GtNoCoderRequester, + #superclass : #Object, + #traits : 'TGtCoderRequesterObject + TGtUniqueInstance', + #classTraits : 'TGtCoderRequesterObject classTrait + TGtUniqueInstance classTrait', + #category : #'GToolkit-Coder-Coders - Evaluation' +} diff --git a/src/GToolkit-Coder/GtSourceCoder.class.st b/src/GToolkit-Coder/GtSourceCoder.class.st index ce4d73de3..b8b70fffa 100644 --- a/src/GToolkit-Coder/GtSourceCoder.class.st +++ b/src/GToolkit-Coder/GtSourceCoder.class.st @@ -231,7 +231,7 @@ GtSourceCoder >> evaluationContext [ ^ self newEvaluationContext - requesterObject: self; + requesterObject: (GtSourceCoderRequester new coder: self); coder: self ] diff --git a/src/GToolkit-Coder/GtSourceCoderEvaluationContext.class.st b/src/GToolkit-Coder/GtSourceCoderEvaluationContext.class.st index 7d6ea1ec2..ddd54e62b 100644 --- a/src/GToolkit-Coder/GtSourceCoderEvaluationContext.class.st +++ b/src/GToolkit-Coder/GtSourceCoderEvaluationContext.class.st @@ -9,7 +9,7 @@ Class { 'evaluatedInterval', 'evaluatedSourceString' ], - #category : 'GToolkit-Coder-Coders - Evaluation' + #category : #'GToolkit-Coder-Coders - Evaluation' } { #category : #'api - context' } @@ -66,12 +66,13 @@ GtSourceCoderEvaluationContext >> initialize [ { #category : #accessing } GtSourceCoderEvaluationContext >> requesterObject [ - ^ requesterObject + + ^ requesterObject ifNil: [ GtNoCoderRequester uniqueInstance ] ] { #category : #accessing } GtSourceCoderEvaluationContext >> requesterObject: anObject [ - requesterObject := anObject + requesterObject := anObject asCoderRequesterObject ] { #category : #accessing } diff --git a/src/GToolkit-Coder/GtSourceCoderEvaluationResult.class.st b/src/GToolkit-Coder/GtSourceCoderEvaluationResult.class.st index b843f9fa8..f7b51ada2 100644 --- a/src/GToolkit-Coder/GtSourceCoderEvaluationResult.class.st +++ b/src/GToolkit-Coder/GtSourceCoderEvaluationResult.class.st @@ -4,7 +4,7 @@ Class { #instVars : [ 'evaluationContext' ], - #category : 'GToolkit-Coder-Coders - Evaluation' + #category : #'GToolkit-Coder-Coders - Evaluation' } { #category : #accessing } @@ -39,6 +39,7 @@ GtSourceCoderEvaluationResult >> isSyntaxError [ { #category : #accessing } GtSourceCoderEvaluationResult >> requesterObject [ + ^ self evaluationContext requesterObject ] diff --git a/src/GToolkit-Coder/GtSourceCoderRequester.class.st b/src/GToolkit-Coder/GtSourceCoderRequester.class.st new file mode 100644 index 000000000..071922403 --- /dev/null +++ b/src/GToolkit-Coder/GtSourceCoderRequester.class.st @@ -0,0 +1,20 @@ +Class { + #name : #GtSourceCoderRequester, + #superclass : #Object, + #traits : 'TGtCoderRequesterObject', + #classTraits : 'TGtCoderRequesterObject classTrait', + #instVars : [ + 'coder' + ], + #category : #'GToolkit-Coder-Coders - Evaluation' +} + +{ #category : #accessing } +GtSourceCoderRequester >> coder [ + ^ coder +] + +{ #category : #accessing } +GtSourceCoderRequester >> coder: anObject [ + coder := anObject +] diff --git a/src/GToolkit-Coder/TGtCoderRequesterObject.trait.st b/src/GToolkit-Coder/TGtCoderRequesterObject.trait.st new file mode 100644 index 000000000..f03a7566c --- /dev/null +++ b/src/GToolkit-Coder/TGtCoderRequesterObject.trait.st @@ -0,0 +1,9 @@ +Trait { + #name : #TGtCoderRequesterObject, + #category : #'GToolkit-Coder-Coders - Evaluation' +} + +{ #category : #converting } +TGtCoderRequesterObject >> asCoderRequesterObject [ + ^ self +] From 3adea09dc55d65899a6a4655432c4d4dfef4f96b Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 29 Jan 2024 12:27:09 -0300 Subject: [PATCH 0566/1268] clean code [feenkcom/gtoolkit#3582] --- .../GtCoderEvaluationAnnouncement.class.st | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/GToolkit-Coder/GtCoderEvaluationAnnouncement.class.st b/src/GToolkit-Coder/GtCoderEvaluationAnnouncement.class.st index d89e7dd51..af726c8e0 100644 --- a/src/GToolkit-Coder/GtCoderEvaluationAnnouncement.class.st +++ b/src/GToolkit-Coder/GtCoderEvaluationAnnouncement.class.st @@ -19,20 +19,6 @@ GtCoderEvaluationAnnouncement >> evaluationResult: aGtSourceCoderEvaluationResul evaluationResult := aGtSourceCoderEvaluationResult ] -{ #category : #testing } -GtCoderEvaluationAnnouncement >> isRequestedByElementOrItsChild: anElement [ - "Return true if the evaluation was requested by a given visual element or any of its children" - - - self requesterObject == anElement - ifTrue: [ ^ true ]. - - (self requesterObject isKindOf: BlElement) - ifFalse: [ ^ false ]. - - ^ self requesterObject hasParent: anElement -] - { #category : #accessing } GtCoderEvaluationAnnouncement >> requesterObject [ From c0d04b601a45f798c2a2bc62e2410e5f3e0c2084 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 29 Jan 2024 15:02:13 -0300 Subject: [PATCH 0567/1268] requester object fixes [feenkcom/gtoolkit#3582] --- src/GToolkit-Coder-UI/GtCoderViewModelRequester.class.st | 5 +++++ .../GtSourceCoderBrowseBehaviorShortcut.class.st | 7 +++---- src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st | 2 +- src/GToolkit-Coder/GtCoderToolSpawnRequest.class.st | 5 +++-- src/GToolkit-Coder/TGtCoderRequesterObject.trait.st | 7 +++++++ 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderViewModelRequester.class.st b/src/GToolkit-Coder-UI/GtCoderViewModelRequester.class.st index 0d414281f..86826eb36 100644 --- a/src/GToolkit-Coder-UI/GtCoderViewModelRequester.class.st +++ b/src/GToolkit-Coder-UI/GtCoderViewModelRequester.class.st @@ -23,3 +23,8 @@ GtCoderViewModelRequester >> coderViewModel: anObject [ GtCoderViewModelRequester >> isCoderViewModel: aCoderViewModel [ ^ aCoderViewModel = self coderViewModel ] + +{ #category : #accessing } +GtCoderViewModelRequester >> selfObject [ + ^ self coderViewModel selfObject +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBrowseBehaviorShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBrowseBehaviorShortcut.class.st index a356dd221..b8dc1583e 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderBrowseBehaviorShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderBrowseBehaviorShortcut.class.st @@ -22,10 +22,9 @@ GtSourceCoderBrowseBehaviorShortcut >> name [ ] { #category : #evaluation } -GtSourceCoderBrowseBehaviorShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent requesterObject: aReceiver [ - +GtSourceCoderBrowseBehaviorShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent requesterObject: aRequester [ self forEditor: aBrTextEditor - selectedStringDo: [ :aSelectedString | aGtSourceCoder browseBehaviorIn: aSelectedString ] - orCursorStringPositionDo: [ :aStringPosition | aGtSourceCoder browseBehaviorAt: aStringPosition ] + selectedStringDo: [ :aSelectedString | aGtSourceCoder browseBehaviorIn: aSelectedString requesterObject: aRequester ] + orCursorStringPositionDo: [ :aStringPosition | aGtSourceCoder browseBehaviorAt: aStringPosition requesterObject: aRequester ] ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index f18ce5cb2..96fc5edfe 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -231,7 +231,7 @@ GtTextualCoderEditorElement >> onPostTextualCoderViewModelChanged [ { #category : #'private - event handling' } GtTextualCoderEditorElement >> onPrintRequest: anEvaluationAnnouncement [ - anEvaluationAnnouncement requesterObject = self textualCoderViewModel + (anEvaluationAnnouncement requesterObject isCoderViewModel: self textualCoderViewModel) ifFalse: [ ^ self ]. evaluationHighlighter hideResult. diff --git a/src/GToolkit-Coder/GtCoderToolSpawnRequest.class.st b/src/GToolkit-Coder/GtCoderToolSpawnRequest.class.st index 6e421e2e4..7701c283c 100644 --- a/src/GToolkit-Coder/GtCoderToolSpawnRequest.class.st +++ b/src/GToolkit-Coder/GtCoderToolSpawnRequest.class.st @@ -3,9 +3,10 @@ Class { #superclass : #GtSourceCoderAnnouncement, #instVars : [ 'tool', - 'spawnDestination' + 'spawnDestination', + 'requesterObject' ], - #category : 'GToolkit-Coder-Event' + #category : #'GToolkit-Coder-Event' } { #category : #accessing } diff --git a/src/GToolkit-Coder/TGtCoderRequesterObject.trait.st b/src/GToolkit-Coder/TGtCoderRequesterObject.trait.st index f03a7566c..7cc3a923b 100644 --- a/src/GToolkit-Coder/TGtCoderRequesterObject.trait.st +++ b/src/GToolkit-Coder/TGtCoderRequesterObject.trait.st @@ -7,3 +7,10 @@ Trait { TGtCoderRequesterObject >> asCoderRequesterObject [ ^ self ] + +{ #category : #accessing } +TGtCoderRequesterObject >> selfObject [ + "Return an object that is represented by `self` (or `super`) key" + + ^ nil +] From 0a91129fa8d550e24d7070de7005076da1e8d8e9 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 29 Jan 2024 16:50:36 -0300 Subject: [PATCH 0568/1268] add `GtCoderPrintStringElementId` examples [feenkcom/gtoolkit#3585] --- .../GtCoderPrintStringAttribute.class.st | 1 + .../GtCoderPrintStringElementId.class.st | 10 ++++++++++ src/GToolkit-Coder/GtCoderToolSpawnRequest.class.st | 11 +++++++++++ 3 files changed, 22 insertions(+) create mode 100644 src/GToolkit-Coder-UI/GtCoderPrintStringElementId.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderPrintStringAttribute.class.st b/src/GToolkit-Coder-UI/GtCoderPrintStringAttribute.class.st index 106d87e42..13d6900c4 100644 --- a/src/GToolkit-Coder-UI/GtCoderPrintStringAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPrintStringAttribute.class.st @@ -111,6 +111,7 @@ GtCoderPrintStringAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditor aptitude: (BrGlamorousLabelAptitude new glamorousCodeFont labelDo: [ :aLabel | aLabel addAptitude: (BrGlamorousWithTooltipAptitude new contentStencil: [ self buildTooltip ]) ]); beTinySize; + id: GtCoderPrintStringElementId; text: object printString; background: BrGlamorousColors neutralBackgroundColor; margin: (BlInsets top: 0 left: 4 bottom: 0 right: 4); diff --git a/src/GToolkit-Coder-UI/GtCoderPrintStringElementId.class.st b/src/GToolkit-Coder-UI/GtCoderPrintStringElementId.class.st new file mode 100644 index 000000000..1c3fd9836 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderPrintStringElementId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtCoderPrintStringElementId, + #superclass : #BlElementUniqueId, + #category : #'GToolkit-Coder-UI-Coder - Source Attributes' +} + +{ #category : #converting } +GtCoderPrintStringElementId >> asSymbol [ + ^ #'coder-print-string-result' +] diff --git a/src/GToolkit-Coder/GtCoderToolSpawnRequest.class.st b/src/GToolkit-Coder/GtCoderToolSpawnRequest.class.st index 7701c283c..2fece2058 100644 --- a/src/GToolkit-Coder/GtCoderToolSpawnRequest.class.st +++ b/src/GToolkit-Coder/GtCoderToolSpawnRequest.class.st @@ -9,6 +9,17 @@ Class { #category : #'GToolkit-Coder-Event' } +{ #category : #accessing } +GtCoderToolSpawnRequest >> requesterObject [ + + ^ requesterObject ifNil: [ GtNoCoderRequester uniqueInstance ] +] + +{ #category : #accessing } +GtCoderToolSpawnRequest >> requesterObject: anObject [ + requesterObject := anObject +] + { #category : #accessing } GtCoderToolSpawnRequest >> spawnDestination [ ^ spawnDestination From fba5be8d4c0ddf8ec6ce316fd9ecc4b4f040f373 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 29 Jan 2024 23:04:20 -0300 Subject: [PATCH 0569/1268] use `GtSourceCoder>>#notifyParseError:at:requesterObject:` [feenkcom/gtoolkit#3585] --- .../GtCoderViewModelRequester.class.st | 5 +++++ .../GtNoCoderRequester.extension.st | 6 ++++++ .../GtSourceCoderErrorAttribute.class.st | 2 ++ ...GtSourceCoderErrorButtonElementId.class.st | 10 ++++++++++ ...tSourceCoderErrorContentElementId.class.st | 10 ++++++++++ .../GtTextualCoderEditorElement.class.st | 5 ++++- .../TGtCoderRequesterObject.extension.st | 5 +++++ src/GToolkit-Coder/GtCoderParseError.class.st | 16 ++++++++++++++-- src/GToolkit-Coder/GtSourceCoder.class.st | 19 ++++++++++++++----- .../UndefinedObject.extension.st | 6 ++++++ 10 files changed, 76 insertions(+), 8 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtNoCoderRequester.extension.st create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderErrorButtonElementId.class.st create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderErrorContentElementId.class.st create mode 100644 src/GToolkit-Coder/UndefinedObject.extension.st diff --git a/src/GToolkit-Coder-UI/GtCoderViewModelRequester.class.st b/src/GToolkit-Coder-UI/GtCoderViewModelRequester.class.st index 86826eb36..dd20f0f62 100644 --- a/src/GToolkit-Coder-UI/GtCoderViewModelRequester.class.st +++ b/src/GToolkit-Coder-UI/GtCoderViewModelRequester.class.st @@ -24,6 +24,11 @@ GtCoderViewModelRequester >> isCoderViewModel: aCoderViewModel [ ^ aCoderViewModel = self coderViewModel ] +{ #category : #testing } +GtCoderViewModelRequester >> isUndefinedOrCoderViewModel: aCoderViewModel [ + ^ self isCoderViewModel: aCoderViewModel +] + { #category : #accessing } GtCoderViewModelRequester >> selfObject [ ^ self coderViewModel selfObject diff --git a/src/GToolkit-Coder-UI/GtNoCoderRequester.extension.st b/src/GToolkit-Coder-UI/GtNoCoderRequester.extension.st new file mode 100644 index 000000000..d6cc88e5d --- /dev/null +++ b/src/GToolkit-Coder-UI/GtNoCoderRequester.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #GtNoCoderRequester } + +{ #category : #'*GToolkit-Coder-UI' } +GtNoCoderRequester >> isUndefinedOrCoderViewModel: aCoderViewModel [ + ^ true +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st index 16c010108..083928ca7 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st @@ -32,11 +32,13 @@ GtSourceCoderErrorAttribute >> clickAction: aBlock [ GtSourceCoderErrorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ | text button aptitude | button := self errorButton. + button id: GtSourceCoderErrorButtonElementId. button addAptitude: (aptitude := BrGlamorousWithDropdownAptitude handle: [ self errorButton ] content: [ | textElement pane | pane := BrVerticalPane new. + pane id: GtSourceCoderErrorContentElementId. pane matchParent. pane background: BrGlamorousColors errorBackgroundColor. string lines diff --git a/src/GToolkit-Coder-UI/GtSourceCoderErrorButtonElementId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderErrorButtonElementId.class.st new file mode 100644 index 000000000..df9d86344 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderErrorButtonElementId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtSourceCoderErrorButtonElementId, + #superclass : #BlElementUniqueId, + #category : #'GToolkit-Coder-UI-Coder - Ids' +} + +{ #category : #converting } +GtSourceCoderErrorButtonElementId >> asSymbol [ + ^ #'coder--error-button' +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderErrorContentElementId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderErrorContentElementId.class.st new file mode 100644 index 000000000..164b76255 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderErrorContentElementId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtSourceCoderErrorContentElementId, + #superclass : #BlElementUniqueId, + #category : #'GToolkit-Coder-UI-Coder - Ids' +} + +{ #category : #converting } +GtSourceCoderErrorContentElementId >> asSymbol [ + ^ #'coder--error-content' +] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 96fc5edfe..9602517a7 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -178,8 +178,11 @@ GtTextualCoderEditorElement >> onCodeEvaluated: anEvaluationAnnouncement [ { #category : #'private - event handling' } GtTextualCoderEditorElement >> onCoderParseError: aGtCoderParseError [ - "A parse error can be notifying from a non-UI thread" + (aGtCoderParseError requesterObject + isUndefinedOrCoderViewModel: self textualCoderViewModel) + ifFalse: [ ^ self ]. + "A parse error can be notifying from a non-UI thread" self enqueueTask: (BlTaskAction new action: [ self reportParseError: aGtCoderParseError errorMessage diff --git a/src/GToolkit-Coder-UI/TGtCoderRequesterObject.extension.st b/src/GToolkit-Coder-UI/TGtCoderRequesterObject.extension.st index 3614161be..4bc533473 100644 --- a/src/GToolkit-Coder-UI/TGtCoderRequesterObject.extension.st +++ b/src/GToolkit-Coder-UI/TGtCoderRequesterObject.extension.st @@ -4,3 +4,8 @@ Extension { #name : #TGtCoderRequesterObject } TGtCoderRequesterObject >> isCoderViewModel: aCoderViewModel [ ^ false ] + +{ #category : #'*GToolkit-Coder-UI' } +TGtCoderRequesterObject >> isUndefinedOrCoderViewModel: aCoderViewModel [ + ^ false +] diff --git a/src/GToolkit-Coder/GtCoderParseError.class.st b/src/GToolkit-Coder/GtCoderParseError.class.st index f2bae6aa3..a854d14bd 100644 --- a/src/GToolkit-Coder/GtCoderParseError.class.st +++ b/src/GToolkit-Coder/GtCoderParseError.class.st @@ -3,9 +3,10 @@ Class { #superclass : #GtSourceCoderAnnouncement, #instVars : [ 'errorMessage', - 'location' + 'location', + 'requesterObject' ], - #category : 'GToolkit-Coder-Event' + #category : #'GToolkit-Coder-Event' } { #category : #accessing } @@ -27,3 +28,14 @@ GtCoderParseError >> location [ GtCoderParseError >> location: anObject [ location := anObject ] + +{ #category : #accessing } +GtCoderParseError >> requesterObject [ + + ^ requesterObject +] + +{ #category : #accessing } +GtCoderParseError >> requesterObject: anObject [ + requesterObject := anObject asCoderRequesterObject +] diff --git a/src/GToolkit-Coder/GtSourceCoder.class.st b/src/GToolkit-Coder/GtSourceCoder.class.st index b8b70fffa..357295054 100644 --- a/src/GToolkit-Coder/GtSourceCoder.class.st +++ b/src/GToolkit-Coder/GtSourceCoder.class.st @@ -290,11 +290,12 @@ GtSourceCoder >> notifyObjectSpawnFromEvaluationResult: anEvaluationResult reque ] { #category : #'private - notifying' } -GtSourceCoder >> notifyParseError: aString at: anInteger [ +GtSourceCoder >> notifyParseError: aString at: anInteger requesterObject: aRequester [ self announce: (GtCoderParseError new coder: self; errorMessage: aString; - location: anInteger) + location: anInteger; + requesterObject: aRequester) ] { #category : #'private - notifying' } @@ -365,14 +366,22 @@ GtSourceCoder >> spawnDestination: aSpawnDestination [ self attributeNamed: #spawnDestination put: aSpawnDestination ] -{ #category : #accessing } +{ #category : #'private - actions' } GtSourceCoder >> validateSyntax [ - + ^ self validateSyntaxInContext: self evaluationContext +] + +{ #category : #'private - actions' } +GtSourceCoder >> validateSyntaxInContext: aGtPharoSourceCoderEvaluationContext [ + [ self computeAst ] on: SmaCCParserError do: [ :ex | - self notifyParseError: ex messageText at: ex tag position. + self + notifyParseError: ex messageText + at: ex tag position + requesterObject: aGtPharoSourceCoderEvaluationContext requesterObject. ^ false ]. ^ true ] diff --git a/src/GToolkit-Coder/UndefinedObject.extension.st b/src/GToolkit-Coder/UndefinedObject.extension.st new file mode 100644 index 000000000..db42e5873 --- /dev/null +++ b/src/GToolkit-Coder/UndefinedObject.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #UndefinedObject } + +{ #category : #'*GToolkit-Coder' } +UndefinedObject >> asCoderRequesterObject [ + ^ GtNoCoderRequester uniqueInstance +] From d34af03138ec6dea7c5ed41cb840c4d30d0359c1 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 30 Jan 2024 16:55:34 -0300 Subject: [PATCH 0570/1268] handle syntax error while formating with requester [feenkcom/gtoolkit#3585] --- .../GtSourceCoderBrowseReferencesShortcut.class.st | 6 +++--- src/GToolkit-Coder-UI/GtSourceCoderFormatShortcut.class.st | 4 ++-- .../GtSourceCoderPlayAndInspectShortcut.class.st | 2 +- src/GToolkit-Coder-UI/GtSourceCoderPlayShortcut.class.st | 2 +- src/GToolkit-Coder-UI/GtSourceCoderShortcut.class.st | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBrowseReferencesShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBrowseReferencesShortcut.class.st index aa23d0cdf..a1371b0fd 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderBrowseReferencesShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderBrowseReferencesShortcut.class.st @@ -22,9 +22,9 @@ GtSourceCoderBrowseReferencesShortcut >> name [ ] { #category : #evaluation } -GtSourceCoderBrowseReferencesShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent requesterObject: aReceiver [ +GtSourceCoderBrowseReferencesShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent requesterObject: aRequester [ self forEditor: aBrTextEditor - selectedStringDo: [ :aSelectedString | aGtSourceCoder browseReferencesIn: aSelectedString requesterObject: aReceiver ] - orCursorStringPositionDo: [ :aStringPosition | aGtSourceCoder browseReferencesAt: aStringPosition requesterObject: aReceiver ] + selectedStringDo: [ :aSelectedString | aGtSourceCoder browseReferencesIn: aSelectedString requesterObject: aRequester ] + orCursorStringPositionDo: [ :aStringPosition | aGtSourceCoder browseReferencesAt: aStringPosition requesterObject: aRequester ] ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderFormatShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderFormatShortcut.class.st index 7ff52775e..b2f11e18b 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderFormatShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderFormatShortcut.class.st @@ -22,6 +22,6 @@ GtSourceCoderFormatShortcut >> name [ ] { #category : #evaluation } -GtSourceCoderFormatShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent requesterObject: aReceiver [ - aGtSourceCoder format +GtSourceCoderFormatShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent requesterObject: aRequester [ + aGtSourceCoder formatWithRequesterObject: aRequester ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderPlayAndInspectShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderPlayAndInspectShortcut.class.st index 7454be239..50ad27337 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderPlayAndInspectShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderPlayAndInspectShortcut.class.st @@ -22,7 +22,7 @@ GtSourceCoderPlayAndInspectShortcut >> name [ ] { #category : #evaluation } -GtSourceCoderPlayAndInspectShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent requesterObject: aReceiver [ +GtSourceCoderPlayAndInspectShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent requesterObject: aRequester [ GtCoderExecutionContextVariable element: aBrEditorElement do: [ diff --git a/src/GToolkit-Coder-UI/GtSourceCoderPlayShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderPlayShortcut.class.st index 3e32cce80..b1a91a5e8 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderPlayShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderPlayShortcut.class.st @@ -22,7 +22,7 @@ GtSourceCoderPlayShortcut >> name [ ] { #category : #evaluation } -GtSourceCoderPlayShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent requesterObject: aReceiver [ +GtSourceCoderPlayShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent requesterObject: aRequester [ GtCoderExecutionContextVariable element: aBrEditorElement do: [ diff --git a/src/GToolkit-Coder-UI/GtSourceCoderShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderShortcut.class.st index ef244ee2c..0e042471c 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderShortcut.class.st @@ -37,7 +37,7 @@ GtSourceCoderShortcut >> forEditor: aBrTextEditor selectionIntervalDo: aSelectio ] { #category : #evaluation } -GtSourceCoderShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent requesterObject: aReceiver [ +GtSourceCoderShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent requesterObject: aRequester [ self subclassResponsibility ] From a98f9b4549315c3f676ebb899670c992bc0dd63e Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 6 Feb 2024 21:36:39 -0300 Subject: [PATCH 0571/1268] fix `#bindingValueOf:` [feenkcom/gtoolkit#3600] --- .../GtContextVariablesBindings.class.st | 11 +++++++++- .../GtLocalVariablesBindings.class.st | 22 ++++++++++++++++++- .../GtSlotVariablesBindings.class.st | 1 - .../TGtVariablesBindings.trait.st | 14 +++++------- 4 files changed, 36 insertions(+), 12 deletions(-) diff --git a/src/GToolkit-VariableBindings/GtContextVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtContextVariablesBindings.class.st index 64f4b0ba6..38758fc6d 100644 --- a/src/GToolkit-VariableBindings/GtContextVariablesBindings.class.st +++ b/src/GToolkit-VariableBindings/GtContextVariablesBindings.class.st @@ -6,7 +6,7 @@ Class { #instVars : [ 'context' ], - #category : 'GToolkit-VariableBindings-Bindings' + #category : #'GToolkit-VariableBindings-Bindings' } { #category : #comparing } @@ -41,6 +41,15 @@ GtContextVariablesBindings >> bindingOf: aSymbol [ ^ var ] +{ #category : #binding } +GtContextVariablesBindings >> bindingValueOf: aSymbol [ + "aSymbol is a variable name. + Return a value of the variable." + + ^ (self bindingOf: aSymbol) + ifNotNil: [ :aBinding | aBinding readInContext: context ] +] + { #category : #accessing } GtContextVariablesBindings >> context [ diff --git a/src/GToolkit-VariableBindings/GtLocalVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtLocalVariablesBindings.class.st index f065adc90..d7c81806b 100644 --- a/src/GToolkit-VariableBindings/GtLocalVariablesBindings.class.st +++ b/src/GToolkit-VariableBindings/GtLocalVariablesBindings.class.st @@ -6,7 +6,7 @@ Class { #instVars : [ 'bindings' ], - #category : 'GToolkit-VariableBindings-Bindings' + #category : #'GToolkit-VariableBindings-Bindings' } { #category : #comparing } @@ -24,6 +24,12 @@ GtLocalVariablesBindings >> bindingNames [ ^ bindings keys ] +{ #category : #enumerating } +GtLocalVariablesBindings >> bindingNamesAndValuesDo: aBlock [ + bindings + keysAndValuesDo: [ :aName :aVariable | aBlock cull: aName cull: aVariable ] +] + { #category : #binding } GtLocalVariablesBindings >> bindingOf: aSymbol [ "aSymbol is a variable name. @@ -74,3 +80,17 @@ GtLocalVariablesBindings >> localAt: aSymbol put: anObject [ at: aSymbol put: (WorkspaceVariable key: aSymbol value: anObject) ] + +{ #category : #accessing } +GtLocalVariablesBindings >> localAt: aSymbol putVariable: aVariable [ + self + assert: [ aSymbol isSymbol ] + description: [ 'Variable name should be a symbol' ]. + self + assert: [ aVariable isKindOf: Variable ] + description: [ 'Variable must be kind of Variable: {1}' format: { aVariable } ]. + + bindings + at: aSymbol + put: aVariable +] diff --git a/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st index fa4413734..10eb63e79 100644 --- a/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st +++ b/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st @@ -44,7 +44,6 @@ GtSlotVariablesBindings >> bindingOf: aSymbol [ GtSlotVariablesBindings >> bindingValueOf: aSymbol [ "aSymbol is a variable name. Return a value of the variable." - ^ (self bindingOf: aSymbol) ifNotNil: [ :aSlot | aSlot read: self object ] ] diff --git a/src/GToolkit-VariableBindings/TGtVariablesBindings.trait.st b/src/GToolkit-VariableBindings/TGtVariablesBindings.trait.st index 823217bd6..bf32a2e7c 100644 --- a/src/GToolkit-VariableBindings/TGtVariablesBindings.trait.st +++ b/src/GToolkit-VariableBindings/TGtVariablesBindings.trait.st @@ -33,22 +33,18 @@ TGtVariablesBindings >> bindingOf: aSymbol [ TGtVariablesBindings >> bindingValueOf: aSymbol [ "aSymbol is a variable name. Return a value of the variable." - - ^ (self bindingOf: aSymbol) - ifNotNil: [ :aBinding | aBinding value ] + ^ (self bindingOf: aSymbol) ifNotNil: [ :aBinding | aBinding value ] ] { #category : #binding } TGtVariablesBindings >> bindingValueOf: aSymbol ifPresent: aPresentBlock ifAbsent: anAbsentBlock [ "aSymbol is a variable name. - Does not have side effects" - + Return a value of variable name" - ^ self bindings - at: aSymbol - ifPresent: [ :aBinding | aPresentBlock value: aBinding value ] - ifAbsent: anAbsentBlock + (self hasBindingOf: aSymbol) + ifTrue: [ aPresentBlock cull: (self bindingValueOf: aSymbol) ] + ifFalse: [ anAbsentBlock value ] ] { #category : #testing } From 552269db2a2c32e59d266405e744eea03ff9332a Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 7 Feb 2024 20:14:29 -0300 Subject: [PATCH 0572/1268] fix `TGtVariablesBindings>>#bindingValueOf:ifPresent:ifAbsent:` [feenkcom/gtoolkit#3600] it must return results --- src/GToolkit-VariableBindings/TGtVariablesBindings.trait.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-VariableBindings/TGtVariablesBindings.trait.st b/src/GToolkit-VariableBindings/TGtVariablesBindings.trait.st index bf32a2e7c..5e7cff896 100644 --- a/src/GToolkit-VariableBindings/TGtVariablesBindings.trait.st +++ b/src/GToolkit-VariableBindings/TGtVariablesBindings.trait.st @@ -42,7 +42,7 @@ TGtVariablesBindings >> bindingValueOf: aSymbol ifPresent: aPresentBlock ifAbsen "aSymbol is a variable name. Return a value of variable name" - (self hasBindingOf: aSymbol) + ^ (self hasBindingOf: aSymbol) ifTrue: [ aPresentBlock cull: (self bindingValueOf: aSymbol) ] ifFalse: [ anAbsentBlock value ] ] From 7ac1884cdd84c9184326989f5f8e3d94ae14dc4c Mon Sep 17 00:00:00 2001 From: John Brant Date: Fri, 9 Feb 2024 10:24:05 -0600 Subject: [PATCH 0573/1268] [feenkcom/gtoolkit#3613] add convert to sibling refactoring --- ...gationClassesHierarchyTreeElement.class.st | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st index 0373d4606..9f23884ec 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st @@ -49,6 +49,51 @@ GtCoderNavigationClassesHierarchyTreeElement >> contextMenuItemsFor: aClass [ -> [ :elem | self renameClass: aClass inElement: elem ]. (self createLabel: 'Remove class' description: aClass name) -> [ :elem | self removeClass: aClass inElement: elem ]} + , (aClass subclasses isEmpty + ifTrue: [ #() ] + ifFalse: [ {(self createLabel: 'Convert to sibling' description: aClass name) + -> [ :elem | self convertToSibling: aClass inElement: elem ]} ]) +] + +{ #category : #initialization } +GtCoderNavigationClassesHierarchyTreeElement >> convertToSibling: aClass inElement: elem [ + | refactoring label refactoringButton edit | + refactoringButton := GtRefactoringsWithInputPreviewElement new. + refactoringButton cancelBlock: [ ]. + edit := BrHorizontalPane new. + edit padding: (BlInsets all: 10). + edit fitContent. + edit + addChild: (BrLabel new + fitContent; + aptitude: BrGlamorousLabelAptitude; + text: 'Superclass:'). + label := BrEditableLabel new. + label + aptitude: (BrGlamorousEditableLabelAptitude new + fontSize: 11.9; + background: Color transparent); + text: 'NewClass'; + focused: true; + when: BrEditorAcceptWish + do: [ :aWish | + edit + padding: (BlInsets + top: 10 + bottom: 0 + left: 10 + right: 10). + refactoring := RBChildrenToSiblingsRefactoring + name: aWish text asString + class: aClass + subclasses: aClass subclasses. + refactoringButton refactorings: [ {refactoring} ]. + label switchToLabel ]; + switchToEditor. + edit addChild: label. + refactoringButton editorElement: edit. + refactoringButton enqueueTask: [ refactoringButton openPreview ] asBlTask. + elem addChild: refactoringButton as: #refactoringButton ] { #category : #initialization } From 133ebc3384f7a4bdaa72fbea4ad9be51df08b32f Mon Sep 17 00:00:00 2001 From: John Brant Date: Fri, 9 Feb 2024 14:09:09 -0600 Subject: [PATCH 0574/1268] [feenkcom/gtoolkit#3613] adding an accept button for the superclass name --- ...gationClassesHierarchyTreeElement.class.st | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st index 9f23884ec..4fb003251 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st @@ -57,7 +57,7 @@ GtCoderNavigationClassesHierarchyTreeElement >> contextMenuItemsFor: aClass [ { #category : #initialization } GtCoderNavigationClassesHierarchyTreeElement >> convertToSibling: aClass inElement: elem [ - | refactoring label refactoringButton edit | + | refactoring label refactoringButton edit acceptButton | refactoringButton := GtRefactoringsWithInputPreviewElement new. refactoringButton cancelBlock: [ ]. edit := BrHorizontalPane new. @@ -75,8 +75,13 @@ GtCoderNavigationClassesHierarchyTreeElement >> convertToSibling: aClass inEleme background: Color transparent); text: 'NewClass'; focused: true; + when: BrEditorCancelWish + do: [ :wish | + refactoringButton previewButton fireEvent: BrDropdownHideWish new. + refactoringButton removeFromParent ]; when: BrEditorAcceptWish do: [ :aWish | + acceptButton removeFromParent. edit padding: (BlInsets top: 10 @@ -90,7 +95,31 @@ GtCoderNavigationClassesHierarchyTreeElement >> convertToSibling: aClass inEleme refactoringButton refactorings: [ {refactoring} ]. label switchToLabel ]; switchToEditor. + label viewModel + when: BrEditorModeChanged + do: [ :event | + event mode isEditable + ifTrue: [ edit padding: (BlInsets all: 10). + refactoringButton refactorings: [ #() ]. + edit addChild: acceptButton ] + ifFalse: [ refactoring + ifNotNil: [ refactoringButton refactorings: [ {refactoring} ]. + acceptButton removeFromParent ] ] ]. edit addChild: label. + acceptButton := BrButton new + aptitude: BrGlamorousButtonWithIconAptitude new; + id: GtRefactoringsPreviewAcceptId; + icon: BrGlamorousVectorIcons accept; + beSmallSize; + requestFocus; + label: 'Save'; + margin: (BlInsets + top: 0 + left: 10 + bottom: 10 + right: 0); + action: [ label acceptEdition ]. + edit addChild: acceptButton. refactoringButton editorElement: edit. refactoringButton enqueueTask: [ refactoringButton openPreview ] asBlTask. elem addChild: refactoringButton as: #refactoringButton From c89c5149594db5a94f04fcee16f36032a4edc243 Mon Sep 17 00:00:00 2001 From: John Brant Date: Wed, 14 Feb 2024 14:04:12 -0600 Subject: [PATCH 0575/1268] adding completion to rename attributes --- .../GtRenameEditorAttribute.class.st | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st b/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st index 7ab15c31f..36615c447 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st @@ -8,7 +8,9 @@ Class { 'editorShortcuts', 'requestInitialFocus', 'styler', - 'coordinateFocus' + 'coordinateFocus', + 'completionStrategy', + 'completionController' ], #category : #'GToolkit-Coder-AddOns-Inline rename' } @@ -18,6 +20,16 @@ GtRenameEditorAttribute >> additionalAttributes [ ^ {BlFontFamilyAttribute named: 'Source Code Pro'} ] +{ #category : #accessing } +GtRenameEditorAttribute >> completionStrategy [ + ^ completionStrategy +] + +{ #category : #accessing } +GtRenameEditorAttribute >> completionStrategy: anObject [ + completionStrategy := anObject +] + { #category : #accessing } GtRenameEditorAttribute >> coordinateFocus [ ^ coordinateFocus @@ -51,6 +63,12 @@ GtRenameEditorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElem inputFilter: filter; text: text. styler ifNotNil: [ renameEditor styler: styler ]. + completionStrategy + ifNotNil: [ completionController := GtCompletionController + on: renameEditor + strategy: completionStrategy. + completionController closeOnEmptyCompletion: false. + completionController install ]. requestInitialFocus ifTrue: [ renameEditor switchToEditor; From 0c3bdb5e6cc98d8f13ed8624b5a5a4d7081d9191 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Fri, 16 Feb 2024 17:03:03 +0100 Subject: [PATCH 0576/1268] Simplify copy and creation forms with new API --- .../GtCoderNavigationTabsStencil.class.st | 8 +------- src/GToolkit-Coder-UI/GtCreationForm.class.st | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index 2c5bcbb10..a90e4a2cb 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -149,13 +149,7 @@ GtCoderNavigationTabsStencil >> gtCreationInterface: look [ look inUIProcessDo: [ form selectInNavigationModel: navigationModel anInstance: anInstance. look fireEvent: BrDropdownHideWish new ]. - self formCache removeKey: each ifAbsent: [ ] ]; - onElementCreated: [ :aFrame | - BlFocusFinder new - direction: BlFocusSearchDirectionForward new; - root: aFrame; - referenceElement: nil; - nextFocusDo: #requestFocus ifNone: [ ] ]) asElement ]) + self formCache removeKey: each ifAbsent: [ ] ]) asElement ]) removeFromParent ]) ]. ^ contentTabs ] diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index c7ed6dced..0ea2d23eb 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -28,7 +28,7 @@ GtCreationForm class >> priority [ { #category : #converting } GtCreationForm >> asElement [ | viewModel | - viewModel := self asGtMagritteViewModel. + viewModel := self asGtMagritteViewModel focusFirstInputField. self onElementCreated ifNotNil: [ :aCallback | viewModel onElementCreated: aCallback ]. ^ viewModel asElement From 6259f14b356e5fd335ef6928fdf7637b2fe5c0b8 Mon Sep 17 00:00:00 2001 From: John Brant Date: Mon, 19 Feb 2024 13:07:22 -0600 Subject: [PATCH 0577/1268] [feenkcom/gtoolkit#3645] show notification drop down on refactoring error --- ...GtSourceCoderInlineRenameShortcut.class.st | 14 ++++++-- ...tSourceCoderRefactoringController.class.st | 34 +++++++++++++++++-- ...tSourceCoderExtractMethodShortcut.class.st | 5 +-- 3 files changed, 45 insertions(+), 8 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtSourceCoderInlineRenameShortcut.class.st b/src/GToolkit-Coder-AddOns/GtSourceCoderInlineRenameShortcut.class.st index 03d807cd8..edeb0c0c2 100644 --- a/src/GToolkit-Coder-AddOns/GtSourceCoderInlineRenameShortcut.class.st +++ b/src/GToolkit-Coder-AddOns/GtSourceCoderInlineRenameShortcut.class.st @@ -1,7 +1,7 @@ Class { #name : #GtSourceCoderInlineRenameShortcut, #superclass : #GtSourceCoderShortcut, - #category : 'GToolkit-Coder-AddOns-Inline rename' + #category : #'GToolkit-Coder-AddOns-Inline rename' } { #category : #accessing } @@ -25,6 +25,14 @@ GtSourceCoderInlineRenameShortcut >> name [ GtSourceCoderInlineRenameShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ self forEditor: aBrTextEditor - selectionIntervalDo: [ :aSelectionInterval | aSourceCoderViewModel coder renameAt: aSelectionInterval last in: aSourceCoderViewModel ] - orCursorStringPositionDo: [ :aCursorTextPosition | aSourceCoderViewModel coder renameAt: aCursorTextPosition in: aSourceCoderViewModel ] + selectionIntervalDo: [ :aSelectionInterval | + aSourceCoderViewModel coder + renameAt: aSelectionInterval last + in: aSourceCoderViewModel + for: aBrEditorElement ] + orCursorStringPositionDo: [ :aCursorTextPosition | + aSourceCoderViewModel coder + renameAt: aCursorTextPosition + in: aSourceCoderViewModel + for: aBrEditorElement ] ] diff --git a/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st b/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st index 001d37db3..dcbdb1406 100644 --- a/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st +++ b/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st @@ -10,7 +10,8 @@ Class { #instVars : [ 'originalSource', 'sourceCoderViewModel', - 'refactoringPreviewAttributes' + 'refactoringPreviewAttributes', + 'element' ], #category : #'GToolkit-Coder-AddOns-! Core' } @@ -41,7 +42,8 @@ GtSourceCoderRefactoringController >> execute [ self refactoringFailed. (ex isKindOf: RBRefactoringError) ifTrue: [ self inform: self refactoringName , ': ' , ex messageText ] - ifFalse: [ NonInteractiveTranscript stderr + ifFalse: [ self informException: ex. + NonInteractiveTranscript stderr nextPutAll: ('[{1}] {2}' format: {self class name. ex asString}); @@ -52,10 +54,36 @@ GtSourceCoderRefactoringController >> execute [ NonInteractiveTranscript stderr nextPutAll: eachStackEntry printString; cr ] ]. - + self cancelRefactoring. ex return ] ] +{ #category : #executing } +GtSourceCoderRefactoringController >> executeIn: anElement [ + element := anElement. + ^ self execute +] + +{ #category : #accessing } +GtSourceCoderRefactoringController >> inform: aString [ + element ifNil: [ ^ super inform: aString ]. + element + showNotification: (GtNotificationMessage new + showNotifications; + message: aString) +] + +{ #category : #accessing } +GtSourceCoderRefactoringController >> informException: anException [ + element + showNotification: (GtObjectNotificationMessage new + message: ('[{1}] {2}' + format: {anException class name. + anException messageText}); + object: anException copy freeze; + showNotifications) +] + { #category : #private } GtSourceCoderRefactoringController >> preventSave [ self sourceCoderViewModel preventSaveDueTo: self diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExtractMethodShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExtractMethodShortcut.class.st index 479a70704..a754ccb7a 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExtractMethodShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExtractMethodShortcut.class.st @@ -22,6 +22,7 @@ GtSourceCoderExtractMethodShortcut >> name [ ] { #category : #evaluation } -GtSourceCoderExtractMethodShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ - (GtExtractMethodToComponentController new sourceCoderViewModel: aSourceCoderViewModel) execute +GtSourceCoderExtractMethodShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ + (GtExtractMethodToComponentController new + sourceCoderViewModel: aSourceCoderViewModel) executeIn: aBrEditorElement ] From b68dbf988251d8ae96d08432b0a5de08fefc5273 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Wed, 21 Feb 2024 17:33:17 +0100 Subject: [PATCH 0578/1268] [feenkcom/gtoolkit#3649] inUIProcessDo: deprecation rewrites --- src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 9602517a7..a4f1e7530 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -202,7 +202,9 @@ GtTextualCoderEditorElement >> onFocusChangedAnnouncement: anAnnouncement [ anAnnouncement source == self textualCoderViewModel ifFalse: [ ^ self ]. - self inUIProcessDo: [ self onCoderViewModelFocused: anAnnouncement focused ] + self + enqueueTask: (BlTaskAction new + action: [ self onCoderViewModelFocused: anAnnouncement focused ]) ] { #category : #'private - event handling' } From b34d2c859b83f51d52ee6cde9e24e890979db07d Mon Sep 17 00:00:00 2001 From: John Brant Date: Wed, 21 Feb 2024 14:37:11 -0600 Subject: [PATCH 0579/1268] adding a GtPushDownInstanceVariableRefactoring to only push into classes using the variable --- .../GtCoderNavigationPackagesTagsClassesElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index e2af4dd1e..1b8d86722 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -861,7 +861,7 @@ GtCoderNavigationPackagesTagsClassesElement >> slotListContextMenuItemsFor: item (self createLabel: 'Push down' description: item name) -> [ :elem | | refactoring | - refactoring := RBPushDownInstanceVariableRefactoring + refactoring := GtPushDownInstanceVariableRefactoring variable: item name class: self selectedClass. self From fe0d8b9428612a12086a3f8a6857dae08f93373c Mon Sep 17 00:00:00 2001 From: John Brant Date: Thu, 22 Feb 2024 15:52:36 -0600 Subject: [PATCH 0580/1268] adding descriptions for some refactorings --- .../RBAbstractClassVariableRefactoring.extension.st | 6 ++++++ .../RBAbstractInstanceVariableRefactoring.extension.st | 6 ++++++ .../RBAbstractVariablesRefactoring.extension.st | 6 ++++++ .../RBAddParameterRefactoring.extension.st | 6 ++++++ .../RBChildrenToSiblingsRefactoring.extension.st | 6 ++++++ .../RBCreateAccessorsForVariableRefactoring.extension.st | 6 ++++++ .../RBExtractMethodRefactoring.extension.st | 6 ++++++ .../RBExtractMethodToComponentRefactoring.extension.st | 6 ++++++ .../RBExtractToTemporaryRefactoring.extension.st | 6 ++++++ .../RBInlineAllSendersRefactoring.extension.st | 6 ++++++ .../RBInlineMethodRefactoring.extension.st | 6 ++++++ .../RBInlineParameterRefactoring.extension.st | 6 ++++++ .../RBInlineTemporaryRefactoring.extension.st | 6 ++++++ src/GToolkit-Coder-UI/RBMoveMethodRefactoring.extension.st | 6 ++++++ .../RBMoveVariableDefinitionRefactoring.extension.st | 6 ++++++ .../RBProtectInstanceVariableRefactoring.extension.st | 6 ++++++ .../RBPullUpClassVariableRefactoring.extension.st | 6 ++++++ .../RBPullUpInstanceVariableRefactoring.extension.st | 6 ++++++ .../RBPullUpMethodRefactoring.extension.st | 6 ++++++ .../RBPushDownClassVariableRefactoring.extension.st | 6 ++++++ .../RBPushDownInstanceVariableRefactoring.extension.st | 6 ++++++ .../RBPushDownMethodRefactoring.extension.st | 6 ++++++ src/GToolkit-Coder-UI/RBRemoveClassRefactoring.extension.st | 6 ++++++ .../RBRemoveParameterRefactoring.extension.st | 6 ++++++ .../RBRenameMethodRefactoring.extension.st | 6 ++++++ .../RBTemporaryToInstanceVariableRefactoring.extension.st | 6 ++++++ 26 files changed, 156 insertions(+) create mode 100644 src/GToolkit-Coder-UI/RBAbstractClassVariableRefactoring.extension.st create mode 100644 src/GToolkit-Coder-UI/RBAbstractInstanceVariableRefactoring.extension.st create mode 100644 src/GToolkit-Coder-UI/RBAbstractVariablesRefactoring.extension.st create mode 100644 src/GToolkit-Coder-UI/RBAddParameterRefactoring.extension.st create mode 100644 src/GToolkit-Coder-UI/RBChildrenToSiblingsRefactoring.extension.st create mode 100644 src/GToolkit-Coder-UI/RBCreateAccessorsForVariableRefactoring.extension.st create mode 100644 src/GToolkit-Coder-UI/RBExtractMethodRefactoring.extension.st create mode 100644 src/GToolkit-Coder-UI/RBExtractMethodToComponentRefactoring.extension.st create mode 100644 src/GToolkit-Coder-UI/RBExtractToTemporaryRefactoring.extension.st create mode 100644 src/GToolkit-Coder-UI/RBInlineAllSendersRefactoring.extension.st create mode 100644 src/GToolkit-Coder-UI/RBInlineMethodRefactoring.extension.st create mode 100644 src/GToolkit-Coder-UI/RBInlineParameterRefactoring.extension.st create mode 100644 src/GToolkit-Coder-UI/RBInlineTemporaryRefactoring.extension.st create mode 100644 src/GToolkit-Coder-UI/RBMoveMethodRefactoring.extension.st create mode 100644 src/GToolkit-Coder-UI/RBMoveVariableDefinitionRefactoring.extension.st create mode 100644 src/GToolkit-Coder-UI/RBProtectInstanceVariableRefactoring.extension.st create mode 100644 src/GToolkit-Coder-UI/RBPullUpClassVariableRefactoring.extension.st create mode 100644 src/GToolkit-Coder-UI/RBPullUpInstanceVariableRefactoring.extension.st create mode 100644 src/GToolkit-Coder-UI/RBPullUpMethodRefactoring.extension.st create mode 100644 src/GToolkit-Coder-UI/RBPushDownClassVariableRefactoring.extension.st create mode 100644 src/GToolkit-Coder-UI/RBPushDownInstanceVariableRefactoring.extension.st create mode 100644 src/GToolkit-Coder-UI/RBPushDownMethodRefactoring.extension.st create mode 100644 src/GToolkit-Coder-UI/RBRemoveClassRefactoring.extension.st create mode 100644 src/GToolkit-Coder-UI/RBRemoveParameterRefactoring.extension.st create mode 100644 src/GToolkit-Coder-UI/RBRenameMethodRefactoring.extension.st create mode 100644 src/GToolkit-Coder-UI/RBTemporaryToInstanceVariableRefactoring.extension.st diff --git a/src/GToolkit-Coder-UI/RBAbstractClassVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBAbstractClassVariableRefactoring.extension.st new file mode 100644 index 000000000..e5837846d --- /dev/null +++ b/src/GToolkit-Coder-UI/RBAbstractClassVariableRefactoring.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #RBAbstractClassVariableRefactoring } + +{ #category : #'*GToolkit-Coder-UI' } +RBAbstractClassVariableRefactoring >> gtDescription [ + ^ 'Abstract class variable ' , variableName +] diff --git a/src/GToolkit-Coder-UI/RBAbstractInstanceVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBAbstractInstanceVariableRefactoring.extension.st new file mode 100644 index 000000000..a075c375d --- /dev/null +++ b/src/GToolkit-Coder-UI/RBAbstractInstanceVariableRefactoring.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #RBAbstractInstanceVariableRefactoring } + +{ #category : #'*GToolkit-Coder-UI' } +RBAbstractInstanceVariableRefactoring >> gtDescription [ + ^ 'Abstract instance variable ' , variableName +] diff --git a/src/GToolkit-Coder-UI/RBAbstractVariablesRefactoring.extension.st b/src/GToolkit-Coder-UI/RBAbstractVariablesRefactoring.extension.st new file mode 100644 index 000000000..a131ee0eb --- /dev/null +++ b/src/GToolkit-Coder-UI/RBAbstractVariablesRefactoring.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #RBAbstractVariablesRefactoring } + +{ #category : #'*GToolkit-Coder-UI' } +RBAbstractVariablesRefactoring >> gtDescription [ + ^ 'Abstract variables' +] diff --git a/src/GToolkit-Coder-UI/RBAddParameterRefactoring.extension.st b/src/GToolkit-Coder-UI/RBAddParameterRefactoring.extension.st new file mode 100644 index 000000000..ce947770d --- /dev/null +++ b/src/GToolkit-Coder-UI/RBAddParameterRefactoring.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #RBAddParameterRefactoring } + +{ #category : #'*GToolkit-Coder-UI' } +RBAddParameterRefactoring >> gtDescription [ + ^ 'Add parameter to ' , oldSelector +] diff --git a/src/GToolkit-Coder-UI/RBChildrenToSiblingsRefactoring.extension.st b/src/GToolkit-Coder-UI/RBChildrenToSiblingsRefactoring.extension.st new file mode 100644 index 000000000..e303fb5ac --- /dev/null +++ b/src/GToolkit-Coder-UI/RBChildrenToSiblingsRefactoring.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #RBChildrenToSiblingsRefactoring } + +{ #category : #'*GToolkit-Coder-UI' } +RBChildrenToSiblingsRefactoring >> gtDescription [ + ^ 'Convert children of ' , className , ' to siblings' +] diff --git a/src/GToolkit-Coder-UI/RBCreateAccessorsForVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBCreateAccessorsForVariableRefactoring.extension.st new file mode 100644 index 000000000..bc15b87d2 --- /dev/null +++ b/src/GToolkit-Coder-UI/RBCreateAccessorsForVariableRefactoring.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #RBCreateAccessorsForVariableRefactoring } + +{ #category : #'*GToolkit-Coder-UI' } +RBCreateAccessorsForVariableRefactoring >> gtDescription [ + ^ 'Create accessors for ' , variableName +] diff --git a/src/GToolkit-Coder-UI/RBExtractMethodRefactoring.extension.st b/src/GToolkit-Coder-UI/RBExtractMethodRefactoring.extension.st new file mode 100644 index 000000000..b61bf314d --- /dev/null +++ b/src/GToolkit-Coder-UI/RBExtractMethodRefactoring.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #RBExtractMethodRefactoring } + +{ #category : #'*GToolkit-Coder-UI' } +RBExtractMethodRefactoring >> gtDescription [ + ^ 'Extract method from ' , class name , '>>' , selector +] diff --git a/src/GToolkit-Coder-UI/RBExtractMethodToComponentRefactoring.extension.st b/src/GToolkit-Coder-UI/RBExtractMethodToComponentRefactoring.extension.st new file mode 100644 index 000000000..c9623c0ef --- /dev/null +++ b/src/GToolkit-Coder-UI/RBExtractMethodToComponentRefactoring.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #RBExtractMethodToComponentRefactoring } + +{ #category : #'*GToolkit-Coder-UI' } +RBExtractMethodToComponentRefactoring >> gtDescription [ + ^ 'Extract method to component from ' , class name , '>>' , selector +] diff --git a/src/GToolkit-Coder-UI/RBExtractToTemporaryRefactoring.extension.st b/src/GToolkit-Coder-UI/RBExtractToTemporaryRefactoring.extension.st new file mode 100644 index 000000000..9448cf0d9 --- /dev/null +++ b/src/GToolkit-Coder-UI/RBExtractToTemporaryRefactoring.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #RBExtractToTemporaryRefactoring } + +{ #category : #'*GToolkit-Coder-UI' } +RBExtractToTemporaryRefactoring >> gtDescription [ + ^ 'Extract expression to temporary ' , newVariableName +] diff --git a/src/GToolkit-Coder-UI/RBInlineAllSendersRefactoring.extension.st b/src/GToolkit-Coder-UI/RBInlineAllSendersRefactoring.extension.st new file mode 100644 index 000000000..ece6ab3dd --- /dev/null +++ b/src/GToolkit-Coder-UI/RBInlineAllSendersRefactoring.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #RBInlineAllSendersRefactoring } + +{ #category : #'*GToolkit-Coder-UI' } +RBInlineAllSendersRefactoring >> gtDescription [ + ^ 'Inline all self sends of ' , selector +] diff --git a/src/GToolkit-Coder-UI/RBInlineMethodRefactoring.extension.st b/src/GToolkit-Coder-UI/RBInlineMethodRefactoring.extension.st new file mode 100644 index 000000000..0a9936b83 --- /dev/null +++ b/src/GToolkit-Coder-UI/RBInlineMethodRefactoring.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #RBInlineMethodRefactoring } + +{ #category : #'*GToolkit-Coder-UI' } +RBInlineMethodRefactoring >> gtDescription [ + ^ 'Inline method ' , class name , '>>' , sourceSelector +] diff --git a/src/GToolkit-Coder-UI/RBInlineParameterRefactoring.extension.st b/src/GToolkit-Coder-UI/RBInlineParameterRefactoring.extension.st new file mode 100644 index 000000000..5e8821532 --- /dev/null +++ b/src/GToolkit-Coder-UI/RBInlineParameterRefactoring.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #RBInlineParameterRefactoring } + +{ #category : #'*GToolkit-Coder-UI' } +RBInlineParameterRefactoring >> gtDescription [ + ^ 'Inline parameter ' , argument , ' in ' , oldSelector +] diff --git a/src/GToolkit-Coder-UI/RBInlineTemporaryRefactoring.extension.st b/src/GToolkit-Coder-UI/RBInlineTemporaryRefactoring.extension.st new file mode 100644 index 000000000..b7f5e81d1 --- /dev/null +++ b/src/GToolkit-Coder-UI/RBInlineTemporaryRefactoring.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #RBInlineTemporaryRefactoring } + +{ #category : #'*GToolkit-Coder-UI' } +RBInlineTemporaryRefactoring >> gtDescription [ + ^ 'Inline temporary variable in ' , class name , '>>' , selector +] diff --git a/src/GToolkit-Coder-UI/RBMoveMethodRefactoring.extension.st b/src/GToolkit-Coder-UI/RBMoveMethodRefactoring.extension.st new file mode 100644 index 000000000..24a02b3f8 --- /dev/null +++ b/src/GToolkit-Coder-UI/RBMoveMethodRefactoring.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #RBMoveMethodRefactoring } + +{ #category : #'*GToolkit-Coder-UI' } +RBMoveMethodRefactoring >> gtDescription [ + ^ 'Move method ' , class name , '>>' , selector +] diff --git a/src/GToolkit-Coder-UI/RBMoveVariableDefinitionRefactoring.extension.st b/src/GToolkit-Coder-UI/RBMoveVariableDefinitionRefactoring.extension.st new file mode 100644 index 000000000..405fdaa1f --- /dev/null +++ b/src/GToolkit-Coder-UI/RBMoveVariableDefinitionRefactoring.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #RBMoveVariableDefinitionRefactoring } + +{ #category : #'*GToolkit-Coder-UI' } +RBMoveVariableDefinitionRefactoring >> gtDescription [ + ^ 'Move variable declaration of ' , name , ' to inner scope' +] diff --git a/src/GToolkit-Coder-UI/RBProtectInstanceVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBProtectInstanceVariableRefactoring.extension.st new file mode 100644 index 000000000..38f3378d5 --- /dev/null +++ b/src/GToolkit-Coder-UI/RBProtectInstanceVariableRefactoring.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #RBProtectInstanceVariableRefactoring } + +{ #category : #'*GToolkit-Coder-UI' } +RBProtectInstanceVariableRefactoring >> gtDescription [ + ^ 'Protect instance variable ' , variableName +] diff --git a/src/GToolkit-Coder-UI/RBPullUpClassVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBPullUpClassVariableRefactoring.extension.st new file mode 100644 index 000000000..321074fd7 --- /dev/null +++ b/src/GToolkit-Coder-UI/RBPullUpClassVariableRefactoring.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #RBPullUpClassVariableRefactoring } + +{ #category : #'*GToolkit-Coder-UI' } +RBPullUpClassVariableRefactoring >> gtDescription [ + ^ 'Pull up class variable ' , variableName +] diff --git a/src/GToolkit-Coder-UI/RBPullUpInstanceVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBPullUpInstanceVariableRefactoring.extension.st new file mode 100644 index 000000000..50b93b7b1 --- /dev/null +++ b/src/GToolkit-Coder-UI/RBPullUpInstanceVariableRefactoring.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #RBPullUpInstanceVariableRefactoring } + +{ #category : #'*GToolkit-Coder-UI' } +RBPullUpInstanceVariableRefactoring >> gtDescription [ + ^ 'Pull up instance variable ' , variableName +] diff --git a/src/GToolkit-Coder-UI/RBPullUpMethodRefactoring.extension.st b/src/GToolkit-Coder-UI/RBPullUpMethodRefactoring.extension.st new file mode 100644 index 000000000..67dcae769 --- /dev/null +++ b/src/GToolkit-Coder-UI/RBPullUpMethodRefactoring.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #RBPullUpMethodRefactoring } + +{ #category : #'*GToolkit-Coder-UI' } +RBPullUpMethodRefactoring >> gtDescription [ + ^ 'Pull up method ' , class name , '>>' , selectors anyOne +] diff --git a/src/GToolkit-Coder-UI/RBPushDownClassVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBPushDownClassVariableRefactoring.extension.st new file mode 100644 index 000000000..2a51c9cd5 --- /dev/null +++ b/src/GToolkit-Coder-UI/RBPushDownClassVariableRefactoring.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #RBPushDownClassVariableRefactoring } + +{ #category : #'*GToolkit-Coder-UI' } +RBPushDownClassVariableRefactoring >> gtDescription [ + ^ 'Push down class variable ' , variableName +] diff --git a/src/GToolkit-Coder-UI/RBPushDownInstanceVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBPushDownInstanceVariableRefactoring.extension.st new file mode 100644 index 000000000..1a3fc75e3 --- /dev/null +++ b/src/GToolkit-Coder-UI/RBPushDownInstanceVariableRefactoring.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #RBPushDownInstanceVariableRefactoring } + +{ #category : #'*GToolkit-Coder-UI' } +RBPushDownInstanceVariableRefactoring >> gtDescription [ + ^ ('Push down instance variable ' , variableName) asRopedText +] diff --git a/src/GToolkit-Coder-UI/RBPushDownMethodRefactoring.extension.st b/src/GToolkit-Coder-UI/RBPushDownMethodRefactoring.extension.st new file mode 100644 index 000000000..ad754131e --- /dev/null +++ b/src/GToolkit-Coder-UI/RBPushDownMethodRefactoring.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #RBPushDownMethodRefactoring } + +{ #category : #'*GToolkit-Coder-UI' } +RBPushDownMethodRefactoring >> gtDescription [ + ^ 'Push down method ' , class name , '>>' , selectors anyOne +] diff --git a/src/GToolkit-Coder-UI/RBRemoveClassRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRemoveClassRefactoring.extension.st new file mode 100644 index 000000000..8f09d1dde --- /dev/null +++ b/src/GToolkit-Coder-UI/RBRemoveClassRefactoring.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #RBRemoveClassRefactoring } + +{ #category : #'*GToolkit-Coder-UI' } +RBRemoveClassRefactoring >> gtDescription [ + ^ 'Remove class ' , classNames anyOne +] diff --git a/src/GToolkit-Coder-UI/RBRemoveParameterRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRemoveParameterRefactoring.extension.st new file mode 100644 index 000000000..abdba7ab7 --- /dev/null +++ b/src/GToolkit-Coder-UI/RBRemoveParameterRefactoring.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #RBRemoveParameterRefactoring } + +{ #category : #'*GToolkit-Coder-UI' } +RBRemoveParameterRefactoring >> gtDescription [ + ^ 'Remove parameter ' , argument , ' from ' , class name , '>>' , oldSelector +] diff --git a/src/GToolkit-Coder-UI/RBRenameMethodRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRenameMethodRefactoring.extension.st new file mode 100644 index 000000000..a67e72a03 --- /dev/null +++ b/src/GToolkit-Coder-UI/RBRenameMethodRefactoring.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #RBRenameMethodRefactoring } + +{ #category : #'*GToolkit-Coder-UI' } +RBRenameMethodRefactoring >> gtDescription [ + ^ 'Rename method ' , oldSelector , ' to ' , newSelector +] diff --git a/src/GToolkit-Coder-UI/RBTemporaryToInstanceVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBTemporaryToInstanceVariableRefactoring.extension.st new file mode 100644 index 000000000..f69b166bc --- /dev/null +++ b/src/GToolkit-Coder-UI/RBTemporaryToInstanceVariableRefactoring.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #RBTemporaryToInstanceVariableRefactoring } + +{ #category : #'*GToolkit-Coder-UI' } +RBTemporaryToInstanceVariableRefactoring >> gtDescription [ + ^ 'Convert temporary ' , temporaryVariableName , ' to instance variable' +] From baaf5793cd45469be9e90d6d17275f4fa5db8bf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Sun, 24 Mar 2024 23:15:48 +0100 Subject: [PATCH 0581/1268] Push up to GtSourceCoder some utility methods for locating ast nodes --- .../GtSourceCoder.extension.st | 10 +++++ ...ceCoderBrowseImplementorsShortcut.class.st | 10 ++++- src/GToolkit-Coder/GtSourceCoder.class.st | 41 +++++++++++++++++++ 3 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 src/GToolkit-Coder-AddOns/GtSourceCoder.extension.st diff --git a/src/GToolkit-Coder-AddOns/GtSourceCoder.extension.st b/src/GToolkit-Coder-AddOns/GtSourceCoder.extension.st new file mode 100644 index 000000000..da42c8899 --- /dev/null +++ b/src/GToolkit-Coder-AddOns/GtSourceCoder.extension.st @@ -0,0 +1,10 @@ +Extension { #name : #GtSourceCoder } + +{ #category : #'*GToolkit-Coder-AddOns' } +GtSourceCoder >> createLabel: aString description: description [ + ^ aString asRopedText glamorousRegularFont + , ((' ' , description) asRopedText + glamorousCodeFont; + foreground: Color gray; + glamorousCodeTinySize) +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBrowseImplementorsShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBrowseImplementorsShortcut.class.st index 3e186eebb..419883152 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderBrowseImplementorsShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderBrowseImplementorsShortcut.class.st @@ -25,6 +25,12 @@ GtSourceCoderBrowseImplementorsShortcut >> name [ GtSourceCoderBrowseImplementorsShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent requesterObject: aRequester [ self forEditor: aBrTextEditor - selectedStringDo: [ :aSelectedString | aGtSourceCoder browseImplementorsIn: aSelectedString requesterObject: aRequester ] - orCursorStringPositionDo: [ :aStringPosition | aGtSourceCoder browseImplementorsAt: aStringPosition requesterObject: aRequester ] + selectedStringDo: [ :aSelectedString | + aGtSourceCoder + browseImplementorsIn: aSelectedString + requesterObject: aRequester ] + orCursorStringPositionDo: [ :aStringPosition | + aGtSourceCoder + browseImplementorsAt: aStringPosition + requesterObject: aRequester ] ] diff --git a/src/GToolkit-Coder/GtSourceCoder.class.st b/src/GToolkit-Coder/GtSourceCoder.class.st index 357295054..059178e6e 100644 --- a/src/GToolkit-Coder/GtSourceCoder.class.st +++ b/src/GToolkit-Coder/GtSourceCoder.class.st @@ -258,6 +258,47 @@ GtSourceCoder >> newEvaluationContext [ ^ GtSourceCoderEvaluationContext new ] +{ #category : #'private - ast' } +GtSourceCoder >> nodeAt: anIndex [ + ^ self + nodeAt: anIndex + ifFound: [ :aNode | + aNode isSequence + ifTrue: [ aNode statements + detect: [ :eachNode | eachNode intersectsInterval: (anIndex to: anIndex) ] ] + ifFalse: [ aNode ] ] + ifNone: [ nil ] +] + +{ #category : #'private - ast' } +GtSourceCoder >> nodeAt: aTextPosition ifFound: aFoundBlock ifNone: aNoneBlock [ + + [ + | theAST innerNode | + theAST := self astAwait. + theAST + withAllNodesDo: [ :node | + (aTextPosition between: node startPosition - 1 and: node stopPosition) + ifTrue: [ innerNode := node ] ]. + + ^ innerNode ifNil: aNoneBlock ifNotNil: aFoundBlock ] + on: Error + do: [ :ex | ex return ]. + + ^ aNoneBlock value +] + +{ #category : #accessing } +GtSourceCoder >> nodeFrom: aCoderViewModel [ + | allSelections allCursors | + allSelections := aCoderViewModel selection allSelections. + allCursors := aCoderViewModel cursors allCursors. + + ^ allSelections size = 1 + ifTrue: [ self nodeWithin: allSelections first interval ] + ifFalse: [ allCursors size = 1 ifTrue: [ self nodeAt: allCursors first position ] ] +] + { #category : #'private - notifying' } GtSourceCoder >> notifyEvaluatedWithResult: anEvaluationResult [ self announce: (GtCoderEvaluationAnnouncement new From d4871cf7d8ed4bc3c9bedbf377c277a2878ca36e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Mon, 25 Mar 2024 10:18:01 +0100 Subject: [PATCH 0582/1268] Move the nodeWithin:* methods to the source coder --- ...urceCoderBrowseReferencesShortcut.class.st | 10 +++++-- src/GToolkit-Coder/GtSourceCoder.class.st | 29 +++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBrowseReferencesShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBrowseReferencesShortcut.class.st index a1371b0fd..b02da1a8d 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderBrowseReferencesShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderBrowseReferencesShortcut.class.st @@ -25,6 +25,12 @@ GtSourceCoderBrowseReferencesShortcut >> name [ GtSourceCoderBrowseReferencesShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent requesterObject: aRequester [ self forEditor: aBrTextEditor - selectedStringDo: [ :aSelectedString | aGtSourceCoder browseReferencesIn: aSelectedString requesterObject: aRequester ] - orCursorStringPositionDo: [ :aStringPosition | aGtSourceCoder browseReferencesAt: aStringPosition requesterObject: aRequester ] + selectedStringDo: [ :aSelectedString | + aGtSourceCoder + browseReferencesIn: aSelectedString + requesterObject: aRequester ] + orCursorStringPositionDo: [ :aStringPosition | + aGtSourceCoder + browseReferencesAt: aStringPosition + requesterObject: aRequester ] ] diff --git a/src/GToolkit-Coder/GtSourceCoder.class.st b/src/GToolkit-Coder/GtSourceCoder.class.st index 059178e6e..04da95b92 100644 --- a/src/GToolkit-Coder/GtSourceCoder.class.st +++ b/src/GToolkit-Coder/GtSourceCoder.class.st @@ -299,6 +299,35 @@ GtSourceCoder >> nodeFrom: aCoderViewModel [ ifFalse: [ allCursors size = 1 ifTrue: [ self nodeAt: allCursors first position ] ] ] +{ #category : #accessing } +GtSourceCoder >> nodeWithin: anInterval [ + ^ self + nodeWithin: anInterval + ifFound: [ :aNode | + aNode isSequence + ifTrue: [ aNode statements + detect: [ :eachNode | eachNode intersectsInterval: anInterval ] ] + ifFalse: [ aNode ] ] + ifNone: [ ] +] + +{ #category : #'private - ast' } +GtSourceCoder >> nodeWithin: anInterval ifFound: aFoundBlock ifNone: aNoneBlock [ + + + [ + | theAST | + theAST := self astAwait. + ^ theAST + bestNodeFor: anInterval + ifFound: aFoundBlock + ifNone: aNoneBlock ] + on: Error + do: [ :ex | ex return ]. + + ^ aNoneBlock value +] + { #category : #'private - notifying' } GtSourceCoder >> notifyEvaluatedWithResult: anEvaluationResult [ self announce: (GtCoderEvaluationAnnouncement new From f2699b3cc2656efd68731bbc3ba13073a4af4d60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Mon, 25 Mar 2024 10:56:36 +0100 Subject: [PATCH 0583/1268] Push extractableNodes* methods to GtSourceCoder --- .../GtSourceCoder.extension.st | 43 +++++++++++++++++++ ...SourceCoderBrowseBehaviorShortcut.class.st | 10 ++++- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtSourceCoder.extension.st b/src/GToolkit-Coder-AddOns/GtSourceCoder.extension.st index da42c8899..fb1f52ca3 100644 --- a/src/GToolkit-Coder-AddOns/GtSourceCoder.extension.st +++ b/src/GToolkit-Coder-AddOns/GtSourceCoder.extension.st @@ -8,3 +8,46 @@ GtSourceCoder >> createLabel: aString description: description [ foreground: Color gray; glamorousCodeTinySize) ] + +{ #category : #'*GToolkit-Coder-AddOns' } +GtSourceCoder >> extractableNodesAt: anIndex [ + "Return a collection of extractable nodes that intersect a given interval" + + + ^ self + nodeAt: anIndex + ifFound: [ :aNode | + aNode isSequence + ifTrue: [ aNode statements select: [ :eachNode | eachNode intersectsInterval: (anIndex to: anIndex) ] ] + ifFalse: [ { aNode isMessage ifTrue: [ aNode parent ] ifFalse: [ aNode ] } ] ] + ifNone: [ #() ] +] + +{ #category : #'*GToolkit-Coder-AddOns' } +GtSourceCoder >> extractableNodesFrom: aCoderViewModel [ + | allSelections allCursors | + + allSelections := aCoderViewModel selection allSelections. + allCursors := aCoderViewModel cursors allCursors. + + ^ allSelections size = 1 + ifTrue: [ self extractableNodesWithin: allSelections first interval ] + ifFalse: [ allCursors size = 1 + ifTrue: [ self extractableNodesAt: allCursors first position ] + ifFalse: [ #() ] ] +] + +{ #category : #'*GToolkit-Coder-AddOns' } +GtSourceCoder >> extractableNodesWithin: anInterval [ + "Return a collection of extractable nodes that intersect a given interval" + + + ^ self + nodeWithin: anInterval + ifFound: [ :aNode | + aNode isSequence + ifTrue: [ aNode statements + select: [ :eachNode | eachNode intersectsInterval: anInterval ] ] + ifFalse: [ {aNode} ] ] + ifNone: [ #() ] +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBrowseBehaviorShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBrowseBehaviorShortcut.class.st index b8dc1583e..d1b7ce006 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderBrowseBehaviorShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderBrowseBehaviorShortcut.class.st @@ -25,6 +25,12 @@ GtSourceCoderBrowseBehaviorShortcut >> name [ GtSourceCoderBrowseBehaviorShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent requesterObject: aRequester [ self forEditor: aBrTextEditor - selectedStringDo: [ :aSelectedString | aGtSourceCoder browseBehaviorIn: aSelectedString requesterObject: aRequester ] - orCursorStringPositionDo: [ :aStringPosition | aGtSourceCoder browseBehaviorAt: aStringPosition requesterObject: aRequester ] + selectedStringDo: [ :aSelectedString | + aGtSourceCoder + browseBehaviorIn: aSelectedString + requesterObject: aRequester ] + orCursorStringPositionDo: [ :aStringPosition | + aGtSourceCoder + browseBehaviorAt: aStringPosition + requesterObject: aRequester ] ] From 3dd864e697acf38785e6e40a72d54741f837677c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Mon, 25 Mar 2024 10:59:13 +0100 Subject: [PATCH 0584/1268] Push notifyToolSpawn: * to GtSourceCoder --- src/GToolkit-Coder/GtSourceCoder.class.st | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/GToolkit-Coder/GtSourceCoder.class.st b/src/GToolkit-Coder/GtSourceCoder.class.st index 04da95b92..593c64aed 100644 --- a/src/GToolkit-Coder/GtSourceCoder.class.st +++ b/src/GToolkit-Coder/GtSourceCoder.class.st @@ -391,6 +391,14 @@ GtSourceCoder >> notifyShowDebuggerRequest: aDebugSession dueTo: anException sou sourceInterval: aSourceInterval) ] +{ #category : #'private - notifying' } +GtSourceCoder >> notifyToolSpawn: aTool withDestination: aSpawnDestination requesterObject: aRequester [ + self announce: (GtCoderToolSpawnRequest new + tool: aTool; + spawnDestination: aSpawnDestination; + coder: self) +] + { #category : #'private - actions' } GtSourceCoder >> primitiveDebug: aSourceString inContext: aGtSourceCoderEvaluationContext onFailDo: anEvaluationFailBlock [ ^ self subclassResponsibility From 38d7c8d4656811ffa7da4527f73c9bcc62da63f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Tue, 26 Mar 2024 12:00:27 +0100 Subject: [PATCH 0585/1268] Sort coder extensions by the pragma argument and the method selector name --- src/GToolkit-Coder/GtCoderModel.class.st | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder/GtCoderModel.class.st b/src/GToolkit-Coder/GtCoderModel.class.st index 11d82729b..0457c87fe 100644 --- a/src/GToolkit-Coder/GtCoderModel.class.st +++ b/src/GToolkit-Coder/GtCoderModel.class.st @@ -223,8 +223,12 @@ GtCoderModel >> newAddOns [ GtCoderModel >> pragmasNamed: aSymbol inHierarchy: aClass [ | actions | actions := OrderedCollection new. - aClass withAllSuperclassesDo: [ :each | actions addAll: (Pragma allNamed: aSymbol in: each) ]. - actions sort: [ :a :b | a arguments first < b arguments first ]. + aClass withAllSuperclassesDo: [ :each | + actions addAll: (Pragma allNamed: aSymbol in: each) ]. + actions + sort: ( + [ :aPragma | aPragma arguments first ] ascending, + [ :aPragma | aPragma methodSelector ] ascending). ^ actions ] From b8585010865cd4ef9514eedb5b5ee90a9d6328dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Tue, 26 Mar 2024 12:06:31 +0100 Subject: [PATCH 0586/1268] Add an inspect action to coder addon views --- src/GToolkit-Coder/GtCoderModel.class.st | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder/GtCoderModel.class.st b/src/GToolkit-Coder/GtCoderModel.class.st index 0457c87fe..bd99f8d9d 100644 --- a/src/GToolkit-Coder/GtCoderModel.class.st +++ b/src/GToolkit-Coder/GtCoderModel.class.st @@ -47,6 +47,7 @@ GtCoderModel class >> contextMenuAddOnsPragma [ { #category : #'private - addons' } GtCoderModel class >> gtAstCoderAddOnsFor: aView context: aPhlowContext [ + ^ aView forward title: 'Coder Addons'; tooltip: 'The methods that extend the Coder with AddOns'; @@ -54,7 +55,13 @@ GtCoderModel class >> gtAstCoderAddOnsFor: aView context: aPhlowContext [ object: [ (GtSearchMethodsInClassFilter new forClass: self; includeSuperclass: true) & self astExtensionsPragma gtPragmas ]; - view: #gtItemsFor: + view: #gtItemsFor:; + actionButtonIcon: BrGlamorousVectorIcons inspect + tooltip: 'Inspect Addons' + action: [ :aButton | + aButton phlow spawnObject: (GtSearchMethodsInClassFilter new + forClass: self; + includeSuperclass: true) & self astExtensionsPragma gtPragmas ] ] { #category : #'private - addons' } @@ -68,7 +75,13 @@ GtCoderModel class >> gtContextMenuAddOnsFor: aView [ object: [ (GtSearchMethodsInClassFilter new forClass: self; includeSuperclass: true) & self contextMenuAddOnsPragma gtPragmas ]; - view: #gtItemsFor: + view: #gtItemsFor:; + actionButtonIcon: BrGlamorousVectorIcons inspect + tooltip: 'Inspect Addons' + action: [ :aButton | + aButton phlow spawnObject: (GtSearchMethodsInClassFilter new + forClass: self; + includeSuperclass: true) & self contextMenuAddOnsPragma gtPragmas ] ] { #category : #'class initialization' } From 9da987e443fa5864771386d8dfd37d094f02192e Mon Sep 17 00:00:00 2001 From: John Brant Date: Wed, 27 Mar 2024 09:04:45 -0500 Subject: [PATCH 0587/1268] [feenkcom/gtoolkit#3705] create GtRefactoryChangeManager to undo/redo code changes --- .../GtRefactoryChangeManager.class.st | 183 ++++++++++++++++++ ...toryChangeManagerUndoChangedEvent.class.st | 18 ++ src/GToolkit-Coder/RBRefactoring.extension.st | 8 - 3 files changed, 201 insertions(+), 8 deletions(-) create mode 100644 src/GToolkit-Coder/GtRefactoryChangeManager.class.st create mode 100644 src/GToolkit-Coder/GtRefactoryChangeManagerUndoChangedEvent.class.st diff --git a/src/GToolkit-Coder/GtRefactoryChangeManager.class.st b/src/GToolkit-Coder/GtRefactoryChangeManager.class.st new file mode 100644 index 000000000..185f7aaf7 --- /dev/null +++ b/src/GToolkit-Coder/GtRefactoryChangeManager.class.st @@ -0,0 +1,183 @@ +Class { + #name : #GtRefactoryChangeManager, + #superclass : #Object, + #traits : 'TGtAnnouncer', + #classTraits : 'TGtAnnouncer classTrait', + #instVars : [ + 'undo', + 'redo', + 'isPerformingChanges', + 'announcer' + ], + #classVars : [ + 'Instance', + 'UndoSize' + ], + #category : #'GToolkit-Coder-Refactoring' +} + +{ #category : #'class initialization' } +GtRefactoryChangeManager class >> initialize [ + self nuke. + UndoSize := 200 +] + +{ #category : #accessing } +GtRefactoryChangeManager class >> instance [ + ^ Instance ifNil: [ Instance := self new ] +] + +{ #category : #'class initialization' } +GtRefactoryChangeManager class >> nuke [ + Instance notNil ifTrue: [ Instance release ]. + Instance := nil +] + +{ #category : #accessing } +GtRefactoryChangeManager class >> undoSize [ + ^ UndoSize +] + +{ #category : #accessing } +GtRefactoryChangeManager class >> undoSize: anInteger [ + UndoSize := anInteger max: 0. + Instance + ifNotNil: [ Instance checkUndoStackLimit ifTrue: [ Instance announceUndoChanged ] ] +] + +{ #category : #accessing } +GtRefactoryChangeManager class >> unload [ + self nuke +] + +{ #category : #'undo/redo' } +GtRefactoryChangeManager >> addUndo: aChange [ + undo addLast: aChange. + self checkUndoStackLimit. + redo removeAll. + self announceUndoChanged +] + +{ #category : #executing } +GtRefactoryChangeManager >> announceUndoChanged [ + self + announce: (GtRefactoryChangeManagerUndoChangedEvent new + changeManager: self; + yourself) +] + +{ #category : #announcer } +GtRefactoryChangeManager >> announcer [ + ^ announcer ifNil: [ announcer := Announcer new ] +] + +{ #category : #accessing } +GtRefactoryChangeManager >> changeFactory [ + ^ RBRefactoryChangeFactory new +] + +{ #category : #'undo/redo' } +GtRefactoryChangeManager >> checkUndoStackLimit [ + | previousSize | + previousSize := undo size. + [ undo size > UndoSize ] whileTrue: [ undo removeFirst ]. + ^ previousSize ~= undo size +] + +{ #category : #private } +GtRefactoryChangeManager >> clearUndoRedoList [ + (undo isEmpty and: [ redo isEmpty ]) ifTrue: [ ^ self ]. + undo removeAll. + redo removeAll. + self announceUndoChanged +] + +{ #category : #private } +GtRefactoryChangeManager >> connectToChanges [ + SystemAnnouncer uniqueInstance weak + when: ClassAdded , ClassModifiedClassDefinition , ClassRemoved , ClassRenamed + , MethodAdded , MethodModified , MethodRemoved + send: #update: + to: self +] + +{ #category : #private } +GtRefactoryChangeManager >> disconnectFromChanges [ + SystemAnnouncer uniqueInstance unsubscribe: self +] + +{ #category : #accessing } +GtRefactoryChangeManager >> gtRedoFor: aView [ + + redo isEmpty ifTrue: [ ^ aView empty ]. + ^ aView list + title: 'Redo'; + priority: 15; + items: [ redo reversed ]; + itemText: #gtDescription +] + +{ #category : #accessing } +GtRefactoryChangeManager >> gtUndoFor: aView [ + + ^ aView list + title: 'Undo'; + priority: 10; + items: [ undo reversed ]; + itemText: #gtDescription +] + +{ #category : #testing } +GtRefactoryChangeManager >> hasRedoableOperations [ + ^ redo notEmpty +] + +{ #category : #testing } +GtRefactoryChangeManager >> hasUndoableOperations [ + ^ undo notEmpty +] + +{ #category : #executing } +GtRefactoryChangeManager >> ignoreChangesWhile: aBlock [ + isPerformingChanges ifTrue: [ ^ aBlock value ]. + isPerformingChanges := true. + aBlock ensure: [ isPerformingChanges := false ] +] + +{ #category : #initialization } +GtRefactoryChangeManager >> initialize [ + super initialize. + undo := OrderedCollection new. + redo := OrderedCollection new. + isPerformingChanges := false +] + +{ #category : #executing } +GtRefactoryChangeManager >> performChange: aRefactoringChange [ + self ignoreChangesWhile: [ self addUndo: aRefactoringChange execute ] +] + +{ #category : #executing } +GtRefactoryChangeManager >> redoChange [ + redo isEmpty ifTrue: [ ^ self ]. + self ignoreChangesWhile: [ undo add: redo removeLast execute ]. + self announceUndoChanged +] + +{ #category : #initialization } +GtRefactoryChangeManager >> release [ + self disconnectFromChanges. + super release +] + +{ #category : #executing } +GtRefactoryChangeManager >> undoChange [ + undo isEmpty ifTrue: [ ^ self ]. + self ignoreChangesWhile: [ redo add: undo removeLast execute ]. + self announceUndoChanged +] + +{ #category : #private } +GtRefactoryChangeManager >> update: anEvent [ + isPerformingChanges ifFalse: [ self clearUndoRedoList ] +] diff --git a/src/GToolkit-Coder/GtRefactoryChangeManagerUndoChangedEvent.class.st b/src/GToolkit-Coder/GtRefactoryChangeManagerUndoChangedEvent.class.st new file mode 100644 index 000000000..5aaba71c5 --- /dev/null +++ b/src/GToolkit-Coder/GtRefactoryChangeManagerUndoChangedEvent.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtRefactoryChangeManagerUndoChangedEvent, + #superclass : #Announcement, + #instVars : [ + 'changeManager' + ], + #category : #'GToolkit-Coder-Refactoring' +} + +{ #category : #accessing } +GtRefactoryChangeManagerUndoChangedEvent >> changeManager [ + ^ changeManager +] + +{ #category : #accessing } +GtRefactoryChangeManagerUndoChangedEvent >> changeManager: anObject [ + changeManager := anObject +] diff --git a/src/GToolkit-Coder/RBRefactoring.extension.st b/src/GToolkit-Coder/RBRefactoring.extension.st index cb782cb97..af802e3d0 100644 --- a/src/GToolkit-Coder/RBRefactoring.extension.st +++ b/src/GToolkit-Coder/RBRefactoring.extension.st @@ -11,14 +11,6 @@ RBRefactoring >> gtDangers [ description: (eachCondition errorMacro expandMacrosWith: false) ] ] -{ #category : #'*GToolkit-Coder' } -RBRefactoring >> gtExecute: isForce [ - isForce - ifTrue: [ self transform ] - ifFalse: [ self primitiveExecute ]. - RBRefactoryChangeManager instance performChange: self changes; addUndoPointer: 1 -] - { #category : #'*GToolkit-Coder' } RBRefactoring >> gtPreconditions [ ^ self preconditions From 3277bab042730e2cecf146464b2d619afd690f8e Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Wed, 27 Mar 2024 17:59:35 +0100 Subject: [PATCH 0588/1268] [feenkcom/gtoolkit#3574] add addons execution configuration --- src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st index 7300f991f..b88c67ab6 100644 --- a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st @@ -19,6 +19,13 @@ Class { #category : #'GToolkit-Coder-UI-Coder - Basic' } +{ #category : #accessing } +GtSingleCoderViewModel class >> addOnsExecutionConfiguration [ + ^ AsyncFutureExecutionConfiguration new + customGroup: #CoderAddOn; + lowPriority +] + { #category : #'api - shortcuts' } GtSingleCoderViewModel >> addMainAction: aGtCoderAction [ "Add an extra main action add-on independent from the dynamically computed add-ons" From 9869c9b26b1a50aefa691a6abab9e2214799bd06 Mon Sep 17 00:00:00 2001 From: John Brant Date: Mon, 1 Apr 2024 09:06:55 -0500 Subject: [PATCH 0589/1268] feenkcom/gtoolkit#3705] adding timestamp & actions for undo redo to refactory changes --- src/GToolkit-Coder/GtPerformedChange.class.st | 57 +++++++++++++ .../GtRefactoryChangeManager.class.st | 80 +++++++++++++++---- 2 files changed, 120 insertions(+), 17 deletions(-) create mode 100644 src/GToolkit-Coder/GtPerformedChange.class.st diff --git a/src/GToolkit-Coder/GtPerformedChange.class.st b/src/GToolkit-Coder/GtPerformedChange.class.st new file mode 100644 index 000000000..2ff408920 --- /dev/null +++ b/src/GToolkit-Coder/GtPerformedChange.class.st @@ -0,0 +1,57 @@ +Class { + #name : #GtPerformedChange, + #superclass : #RBRefactoryChange, + #instVars : [ + 'change', + 'timestamp' + ], + #category : #'GToolkit-Coder-Refactoring' +} + +{ #category : #executing } +GtPerformedChange class >> onChange: aChange [ + ^ self new + timestamp: DateAndTime now; + change: aChange; + yourself +] + +{ #category : #accessing } +GtPerformedChange >> change [ + ^ change +] + +{ #category : #accessing } +GtPerformedChange >> change: anObject [ + change := anObject +] + +{ #category : #accessing } +GtPerformedChange >> executeNotifying: aBlock [ + ^ change executeNotifying: aBlock +] + +{ #category : #accessing } +GtPerformedChange >> gtChangesFor: aView [ + + (change respondsTo: #gtChangesFor:) ifFalse: [ ^ aView empty ]. + ^ aView forward + title: 'Changes'; + object: [ change ]; + view: #gtChangesFor: +] + +{ #category : #accessing } +GtPerformedChange >> renameChangesForClass: oldClassName to: newClassName [ + ^ change renameChangesForClass: oldClassName to: newClassName +] + +{ #category : #accessing } +GtPerformedChange >> timestamp [ + ^ timestamp +] + +{ #category : #accessing } +GtPerformedChange >> timestamp: anObject [ + timestamp := anObject +] diff --git a/src/GToolkit-Coder/GtRefactoryChangeManager.class.st b/src/GToolkit-Coder/GtRefactoryChangeManager.class.st index 185f7aaf7..9759e22bc 100644 --- a/src/GToolkit-Coder/GtRefactoryChangeManager.class.st +++ b/src/GToolkit-Coder/GtRefactoryChangeManager.class.st @@ -52,7 +52,7 @@ GtRefactoryChangeManager class >> unload [ { #category : #'undo/redo' } GtRefactoryChangeManager >> addUndo: aChange [ - undo addLast: aChange. + undo addLast: (GtPerformedChange onChange: aChange). self checkUndoStackLimit. redo removeAll. self announceUndoChanged @@ -106,25 +106,69 @@ GtRefactoryChangeManager >> disconnectFromChanges [ SystemAnnouncer uniqueInstance unsubscribe: self ] -{ #category : #accessing } -GtRefactoryChangeManager >> gtRedoFor: aView [ - - redo isEmpty ifTrue: [ ^ aView empty ]. - ^ aView list - title: 'Redo'; - priority: 15; - items: [ redo reversed ]; - itemText: #gtDescription -] - { #category : #accessing } GtRefactoryChangeManager >> gtUndoFor: aView [ - ^ aView list + | update | + update := [ :element | + element + allParentsDetect: [ :each | each phlow isViewContent ] + ifFound: [ :each | each phlow syncUpdate ] + ifNone: [ ] ]. + ^ aView columnedList title: 'Undo'; priority: 10; - items: [ undo reversed ]; - itemText: #gtDescription + items: [ redo , undo reversed ]; + column: 'Timestamp' + text: [ :each | + | text | + text := each timestamp printToSeconds asRopedText. + (redo identityIncludes: each) + ifTrue: [ text foreground: BrGlamorousColors disabledHeaderTextColor ]. + text ] + width: 130; + column: 'Change' + text: [ :each | + | text | + text := each change gtDescription asRopedText. + (redo identityIncludes: each) + ifTrue: [ text foreground: BrGlamorousColors disabledHeaderTextColor ]. + text ]; + contextItemLabel: 'Undo' + action: [ :element :each | + self undoChange. + update value: element ] + if: [ :each | (undo at: undo size ifAbsent: [ ]) == each ]; + contextItemLabel: 'Undo up to here' + action: [ :element :each | + | found | + found := false. + [ self hasUndoableOperations and: [ found not ] ] + whileTrue: [ found := undo last == each. + self undoChange ]. + update value: element ] + if: [ :each | (undo at: undo size ifAbsent: [ ]) ~~ each and: [ undo identityIncludes: each ] ]; + contextItemLabel: 'Redo' + action: [ :element :each | + self redoChange. + update value: element ] + if: [ :each | (redo at: redo size ifAbsent: [ ]) == each ]; + contextItemLabel: 'Redo back to here' + action: [ :element :each | + | found | + found := false. + [ self hasRedoableOperations and: [ found not ] ] + whileTrue: [ found := redo last == each. + self redoChange ]. + update value: element ] + if: [ :each | (redo at: redo size ifAbsent: [ ]) ~~ each and: [ redo identityIncludes: each ] ]; + actionButtonIcon: BrGlamorousVectorIcons refresh + tooltip: 'Update undo/redo stacks' + action: [ :aButton :aTab | + aButton disable. + [ aTab viewContentElement phlow syncUpdate ] asAsyncPromise + then: [ :aResult | aButton enable ] + otherwise: [ :anError | aButton enable ] ] ] { #category : #testing } @@ -160,7 +204,8 @@ GtRefactoryChangeManager >> performChange: aRefactoringChange [ { #category : #executing } GtRefactoryChangeManager >> redoChange [ redo isEmpty ifTrue: [ ^ self ]. - self ignoreChangesWhile: [ undo add: redo removeLast execute ]. + self + ignoreChangesWhile: [ undo add: (GtPerformedChange onChange: redo removeLast change execute) ]. self announceUndoChanged ] @@ -173,7 +218,8 @@ GtRefactoryChangeManager >> release [ { #category : #executing } GtRefactoryChangeManager >> undoChange [ undo isEmpty ifTrue: [ ^ self ]. - self ignoreChangesWhile: [ redo add: undo removeLast execute ]. + self + ignoreChangesWhile: [ redo add: (GtPerformedChange onChange: undo removeLast change execute) ]. self announceUndoChanged ] From d12f90bd1db82847d8ea3cd870c3fc654c4df189 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 1 Apr 2024 14:36:42 -0300 Subject: [PATCH 0590/1268] compute properly explicit target behavior for lepiter snippets [feenkcom/gtoolkit#3706] --- .../GtSourceCoderEvaluationContext.class.st | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/GToolkit-Coder/GtSourceCoderEvaluationContext.class.st b/src/GToolkit-Coder/GtSourceCoderEvaluationContext.class.st index ddd54e62b..b6de7a4b3 100644 --- a/src/GToolkit-Coder/GtSourceCoderEvaluationContext.class.st +++ b/src/GToolkit-Coder/GtSourceCoderEvaluationContext.class.st @@ -98,3 +98,12 @@ GtSourceCoderEvaluationContext >> sourceString: anObject [ sourceString := anObject ] + +{ #category : #accessing } +GtSourceCoderEvaluationContext >> targetBehavior [ + "Return a target behavior in which the method should be compiled. The target behavior can differ from + the method's behavior if for example the method originates from the trait" + + + ^ nil +] From 20b163886fa4f5c784e063248e17b8c78ae3b918 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 1 Apr 2024 18:51:56 -0300 Subject: [PATCH 0591/1268] add navigation spotter button ID --- .../GtCoderNavigationTabsStencil.class.st | 1 + .../GtNavigationSpotterDropdownId.class.st | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 src/GToolkit-Coder-UI/GtNavigationSpotterDropdownId.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index a90e4a2cb..54a117fa5 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -29,6 +29,7 @@ GtCoderNavigationTabsStencil >> addButtonsTo: explicitView [ ifTrue: [ self navigationModel selectMethod: anItem. acted := true ]. acted ifTrue: [ anActOnEvent beActed ] ]; + id: GtNavigationSpotterDropdownId; asElement ] tooltip: 'Search Code'. explicitView diff --git a/src/GToolkit-Coder-UI/GtNavigationSpotterDropdownId.class.st b/src/GToolkit-Coder-UI/GtNavigationSpotterDropdownId.class.st new file mode 100644 index 000000000..a6eadc1c8 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtNavigationSpotterDropdownId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtNavigationSpotterDropdownId, + #superclass : #GtCoderElementId, + #category : #'GToolkit-Coder-UI-Navigation' +} + +{ #category : #accessing } +GtNavigationSpotterDropdownId >> asSymbol [ + ^#'navigation-spotter' +] From cbafe1e5f5342d1c190aebb10a2735370a067e1b Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 2 Apr 2024 13:27:24 -0500 Subject: [PATCH 0592/1268] connect change manager to system changes --- src/GToolkit-Coder/GtPerformedChange.class.st | 10 ++++++++++ src/GToolkit-Coder/GtRefactoryChangeManager.class.st | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder/GtPerformedChange.class.st b/src/GToolkit-Coder/GtPerformedChange.class.st index 2ff408920..f11b4b28b 100644 --- a/src/GToolkit-Coder/GtPerformedChange.class.st +++ b/src/GToolkit-Coder/GtPerformedChange.class.st @@ -41,6 +41,16 @@ GtPerformedChange >> gtChangesFor: aView [ view: #gtChangesFor: ] +{ #category : #accessing } +GtPerformedChange >> gtViewDefinitionFor: aView [ + + (change respondsTo: #gtViewDefinitionFor:) ifFalse: [ ^ aView empty ]. + ^ aView forward + title: 'Definition'; + object: [ change ]; + view: #gtViewDefinitionFor: +] + { #category : #accessing } GtPerformedChange >> renameChangesForClass: oldClassName to: newClassName [ ^ change renameChangesForClass: oldClassName to: newClassName diff --git a/src/GToolkit-Coder/GtRefactoryChangeManager.class.st b/src/GToolkit-Coder/GtRefactoryChangeManager.class.st index 9759e22bc..227458f5b 100644 --- a/src/GToolkit-Coder/GtRefactoryChangeManager.class.st +++ b/src/GToolkit-Coder/GtRefactoryChangeManager.class.st @@ -193,7 +193,8 @@ GtRefactoryChangeManager >> initialize [ super initialize. undo := OrderedCollection new. redo := OrderedCollection new. - isPerformingChanges := false + isPerformingChanges := false. + self connectToChanges ] { #category : #executing } From e9ac211aa6369e394feac8ba8e800782f2271ff1 Mon Sep 17 00:00:00 2001 From: John Brant Date: Wed, 3 Apr 2024 14:04:35 -0500 Subject: [PATCH 0593/1268] [feenkcom/gtoolkit#3705] adding undo/redo to remove class/method from index --- .../GtCoderNavigationClassesHierarchyTreeElement.class.st | 2 +- .../GtCoderNavigationPackagesTagsClassesElement.class.st | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st index 4fb003251..31bcb1e6c 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st @@ -205,7 +205,7 @@ GtCoderNavigationClassesHierarchyTreeElement >> removeClass: aClass inElement: e button := GtPreviewChangeButton new icon: BrGlamorousVectorIcons remove; label: 'Remove'; - changeAction: [ change execute ]; + changeAction: [ change gtExecuteWithUndo ]; changeStencil: [ GtPharoRemoveClassPreviewStencil new classToRemove: aClass; anElement: self; diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 1b8d86722..343c7da79 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -569,12 +569,12 @@ GtCoderNavigationPackagesTagsClassesElement >> pushUpMethod: aSelector inElement { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> removeMethod: aSelector inElement: elem [ - | refactoring button | - refactoring := RBRemoveMethodChange remove: aSelector from: self selectedClass. + | change button | + change := RBRemoveMethodChange remove: aSelector from: self selectedClass. button := GtPreviewChangeButton new icon: BrGlamorousVectorIcons remove; label: 'Remove'; - changeAction: [ refactoring execute ]; + changeAction: [ change gtExecuteWithUndo ]; changeStencil: [ GtPharoRemoveMethodPreviewStencil new selectorToRemove: aSelector; isEmptyMethod: false; From f33b492d38b0505b34ddd2dda3e0febaec362537 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Thu, 11 Apr 2024 23:54:41 +0200 Subject: [PATCH 0594/1268] Add GtFixItAction>>printOn: --- src/GToolkit-Coder-AddOns/GtFixItAction.class.st | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/GToolkit-Coder-AddOns/GtFixItAction.class.st b/src/GToolkit-Coder-AddOns/GtFixItAction.class.st index 9d60c16cb..fbd5cb251 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItAction.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItAction.class.st @@ -63,6 +63,14 @@ GtFixItAction >> node: aRBProgramNode [ node := aRBProgramNode ] +{ #category : #printing } +GtFixItAction >> printOn: aStream [ + super printOn: aStream. + + aStream parenthesize: [ + aStream << self description ] +] + { #category : #initialization } GtFixItAction >> sourceCoder: aCoder [ sourceCoder := aCoder From 16eb5404d89510efb9aff1891df577d0e9ff8829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Sun, 14 Apr 2024 21:11:08 +0200 Subject: [PATCH 0595/1268] Slightly refactor GtFixItAttribute>>#dropDownElementFor: --- .../GtFixItAttribute.class.st | 83 +++++++++++++------ 1 file changed, 57 insertions(+), 26 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st index 8ac1eb2f1..a1c91b0cc 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st @@ -27,6 +27,32 @@ GtFixItAttribute >> addHoveringStylingFor: anEditorElement to: anElement [ do: [ :anEvent | anEditorElement text clearAttributes: [ :each | each == hoverAttribute ] ] ] +{ #category : #accessing } +GtFixItAttribute >> computeDescriptionTextInEditorElement: anEditorElement [ + | text | + + text := (descriptionBlock cull: anEditorElement) asRopedText + foreground: BrGlamorousColors disabledButtonTextColor. + + ^ BrEditor new + vFitContent; + aptitude: BrGlamorousRegularEditorAptitude new + glamorousCodeSmallSize; + text: text. +] + +{ #category : #accessing } +GtFixItAttribute >> computeMenuItemsForFixItActions [ + | actionsGroupedById | + actionsGroupedById := fixItActionsBlock value + groupedBy: [ :eachFixitAction | eachFixitAction id ]. + + ^ actionsGroupedById values + flatCollect: [ :fixitActionsPerId | + fixitActionsPerId collectWithIndex: [ :eachFixItAction :eachIndex | + eachFixItAction menuActionWithIndex: eachIndex ] ] +] + { #category : #accessing } GtFixItAttribute >> description: aBlockReturningBlText [ descriptionBlock := aBlockReturningBlText @@ -38,8 +64,10 @@ GtFixItAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ button := GtFixItButton new. button beTinySize. button label: (label ifNil: [ 'Fix it' ]). + dropDownAptitude := BrGlamorousWithDropdownAptitude - handle: [ | dropdownButton | + handle: [ + | dropdownButton | dropdownButton := BrButton new. dropdownButton beTinySize. dropdownButton @@ -48,45 +76,48 @@ GtFixItAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ dropdownButton icon: BrGlamorousVectorIcons repair. self addHoveringStylingFor: anEditorElement to: dropdownButton. dropdownButton ] - content: [ | element | + content: [ + | element | element := self dropDownElementFor: anEditorElement. self addHoveringStylingFor: anEditorElement to: element. element ]. + button - aptitude: BrGlamorousButtonWithIconAptitude - BrGlamorousButtonExteriorAptitude - + dropDownAptitude. + aptitude: BrGlamorousButtonWithIconAptitude + - BrGlamorousButtonExteriorAptitude + + dropDownAptitude. button userData at: #fixItAttribute put: self. button userData at: #dropDownAptitude put: dropDownAptitude. button icon: BrGlamorousVectorIcons repair. + self addHoveringStylingFor: anEditorElement to: button. ^ button ] { #category : #accessing } GtFixItAttribute >> dropDownElementFor: anEditorElement [ - | pane labelText text menu menuItems | + | pane menuElement menuItems | + pane := BrVerticalPane new. pane fitContent. - menuItems := (fixItActionsBlock value - groupedBy: [ :eachFixitAction | eachFixitAction id ]) values - flatCollect: [ :fixitActionsPerId | - fixitActionsPerId - collectWithIndex: [ :eachFixItAction :eachIndex | eachFixItAction menuActionWithIndex: eachIndex ] ]. - descriptionBlock - ifNotNil: [ text := (descriptionBlock cull: anEditorElement) asRopedText - foreground: BrGlamorousColors disabledButtonTextColor. - labelText := BrEditor new - vFitContent; - aptitude: BrGlamorousRegularEditorAptitude new glamorousCodeSmallSize; - text: text. - menuItems isEmpty - ifTrue: [ labelText width: 200 ] - ifFalse: [ labelText hMatchParent ]. - pane addChild: labelText ]. - menu := GtCoderContextMenuContent new - editorElement: anEditorElement; - items: menuItems. - pane addChild: menu. + + menuItems := self computeMenuItemsForFixItActions. + + descriptionBlock ifNotNil: [ + | labelText | + labelText := self computeDescriptionTextInEditorElement: anEditorElement. + + menuItems isEmpty + ifTrue: [ labelText width: 200 ] + ifFalse: [ labelText hMatchParent ]. + + pane addChild: labelText ]. + + menuElement := GtCoderContextMenuContent new + editorElement: anEditorElement; + items: menuItems. + + pane addChild: menuElement. ^ pane ] @@ -115,7 +146,7 @@ GtFixItAttribute >> hoverMarker: aTextAttribute [ hoverMarker := aTextAttribute ] -{ #category : #accessing } +{ #category : #initialization } GtFixItAttribute >> initialize [ super initialize. From fe36af065a500ddf13fb50fbb963e6b95dbcc273 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Sun, 14 Apr 2024 22:11:20 +0200 Subject: [PATCH 0596/1268] Make it possible to inspect fix it actions --- .../GtFixItAttribute.class.st | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st index a1c91b0cc..e48f8d9c0 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st @@ -28,10 +28,12 @@ GtFixItAttribute >> addHoveringStylingFor: anEditorElement to: anElement [ ] { #category : #accessing } -GtFixItAttribute >> computeDescriptionTextInEditorElement: anEditorElement [ +GtFixItAttribute >> computeDescriptionTextInEditorElement: anEditorElement forFixItActions: aCollectionOfFixItActions [ | text | - text := (descriptionBlock cull: anEditorElement) asRopedText + text := (descriptionBlock + cull: anEditorElement + cull: aCollectionOfFixItActions) asRopedText foreground: BrGlamorousColors disabledButtonTextColor. ^ BrEditor new @@ -42,9 +44,9 @@ GtFixItAttribute >> computeDescriptionTextInEditorElement: anEditorElement [ ] { #category : #accessing } -GtFixItAttribute >> computeMenuItemsForFixItActions [ +GtFixItAttribute >> computeMenuItemsForFixItActions: aCollectionOfFixItActions [ | actionsGroupedById | - actionsGroupedById := fixItActionsBlock value + actionsGroupedById := aCollectionOfFixItActions groupedBy: [ :eachFixitAction | eachFixitAction id ]. ^ actionsGroupedById values @@ -96,16 +98,19 @@ GtFixItAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ { #category : #accessing } GtFixItAttribute >> dropDownElementFor: anEditorElement [ - | pane menuElement menuItems | + | pane menuElement computedFixItActions menuItems | + computedFixItActions := fixItActionsBlock value. + menuItems := self computeMenuItemsForFixItActions: computedFixItActions. + pane := BrVerticalPane new. pane fitContent. - menuItems := self computeMenuItemsForFixItActions. - descriptionBlock ifNotNil: [ | labelText | - labelText := self computeDescriptionTextInEditorElement: anEditorElement. + labelText := self + computeDescriptionTextInEditorElement: anEditorElement + forFixItActions: computedFixItActions. menuItems isEmpty ifTrue: [ labelText width: 200 ] From b7a0f5576691bac5824a341cc31c5e5dd4b4f0e0 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Sun, 21 Apr 2024 22:49:56 -0400 Subject: [PATCH 0597/1268] add `GtSingleCoderViewModel>>#evaluationResult` --- src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st index b88c67ab6..a6922f4ac 100644 --- a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st @@ -148,6 +148,11 @@ GtSingleCoderViewModel >> ensureAddOns [ yourself ] ] +{ #category : #accessing } +GtSingleCoderViewModel >> evaluationResult [ + ^ nil +] + { #category : #'gt-extension' } GtSingleCoderViewModel >> gtLiveFor: aView [ From dadbaeab18888e5a7d5e377ed5508c860b9303c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Wed, 24 Apr 2024 00:17:19 +0200 Subject: [PATCH 0598/1268] Temporary hack for avoiding a race condition when adding editors to a space [feenkcom/gtoolkit#3727] --- .../GtTextualCoderEditorElement.class.st | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index a4f1e7530..b7c49ca72 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -318,9 +318,13 @@ GtTextualCoderEditorElement >> onTextualCoderViewModelChanged [ "Setting text may change cursor and selection because text editor makes sure that they have valid values. That is why we create a snaphot of the editor's state which we will restore once new text is set" - self asyncPromise promise: self textualCoderViewModel asEditorState. - self editor model: self textualCoderViewModel. + "Related to: https://github.com/feenkcom/gtoolkit/issues/3727" + self privateUpdateEditorState: self textualCoderViewModel asEditorState wait. + "self asyncPromise + promise: self textualCoderViewModel asEditorState." + + self editor model: self textualCoderViewModel. shortcuts := self textualCoderViewModel shortcuts copy. self editor addEditorShortcuts: shortcuts. From eebbe0a3f9794a03cd643c2b3cca17a2702fc444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Wed, 24 Apr 2024 02:26:12 +0200 Subject: [PATCH 0599/1268] Revert the previous change related to making the state commputation synchronous [feenkcom/gtoolkit#3727] --- src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index b7c49ca72..0b5b6c415 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -320,9 +320,10 @@ GtTextualCoderEditorElement >> onTextualCoderViewModelChanged [ which we will restore once new text is set" "Related to: https://github.com/feenkcom/gtoolkit/issues/3727" - self privateUpdateEditorState: self textualCoderViewModel asEditorState wait. - "self asyncPromise - promise: self textualCoderViewModel asEditorState." + "self privateUpdateEditorState: self textualCoderViewModel asEditorState wait." + + self asyncPromise + promise: self textualCoderViewModel asEditorState. self editor model: self textualCoderViewModel. From 61065838a0e281091ef1009d27ea54911499a130 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 23 Apr 2024 20:33:41 -0400 Subject: [PATCH 0600/1268] add `GtCoderActionDefinition` - it is possible to `alt+click` on coder toolbar buttons - it does not work for all cases, e.g., the save method button --- .../GtCoderActionsElement.class.st | 20 ++++++++++- src/GToolkit-Coder/GtCoderAction.class.st | 26 ++++++++++++++- .../GtCoderActionClosureDefinition.class.st | 33 +++++++++++++++++++ .../GtCoderActionDefinition.class.st | 15 +++++++++ .../GtCoderActionNoDefinition.class.st | 7 ++++ .../GtCoderCustomAction.class.st | 7 ++++ .../GtCoderDropDownAction.class.st | 7 ++++ .../GtCoderDropDownWithPreviewAction.class.st | 9 +++++ .../GtCoderToggleAction.class.st | 9 +++++ 9 files changed, 131 insertions(+), 2 deletions(-) create mode 100644 src/GToolkit-Coder/GtCoderActionClosureDefinition.class.st create mode 100644 src/GToolkit-Coder/GtCoderActionDefinition.class.st create mode 100644 src/GToolkit-Coder/GtCoderActionNoDefinition.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st index 2eb8f7cc0..a84af1102 100644 --- a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st @@ -49,6 +49,18 @@ GtCoderActionsElement >> handleButton: aButtonElement action: aGtCoderAction onE ensure: [ self enqueueEnableButton: aButtonElement action: aGtCoderAction ] ]) ] ] +{ #category : #'instance creation' } +GtCoderActionsElement >> initializeAltClick: aGtCoderAction element: anElement [ + aGtCoderAction allowAltClick ifFalse: [ ^ self ]. + + anElement viewModel + when: BlClickEvent + do: [ :anEvent | + anEvent modifiers isAlt + ifTrue: [ anEvent consumed: true. + anEvent target phlow spawnObject: aGtCoderAction actionDefinition ] ] +] + { #category : #'instance creation' } GtCoderActionsElement >> newButtonForAction: aGtCoderAction [ @@ -64,6 +76,8 @@ GtCoderActionsElement >> newButtonForAction: aGtCoderAction [ handleButton: aButtonElement action: aGtCoderAction onEvent: anEvent ]. + self initializeAltClick: aGtCoderAction element: button. + aGtCoderAction allowPrimaryClick ifTrue: [ button viewModel when: BlClickEvent @@ -119,6 +133,8 @@ GtCoderActionsElement >> newDropButtonForAction: aGtCoderAction [ containerElement addChild: titleElement. containerElement ]. + self initializeAltClick: aGtCoderAction element: button. + ^ button beTinySize; aptitude: BrGlamorousButtonWithIconAptitude + @@ -149,5 +165,7 @@ GtCoderActionsElement >> newToggleForAction: aGtCoderAction [ icon: aGtCoderAction icon asElement; beTinySize; label: aGtCoderAction title; - in: [ :aButtonElement | aButtonElement id: aGtCoderAction id ] + in: [ :aToggle | self initializeAltClick: aGtCoderAction element: aToggle ]; + id: aGtCoderAction id; + yourself ] diff --git a/src/GToolkit-Coder/GtCoderAction.class.st b/src/GToolkit-Coder/GtCoderAction.class.st index 1d60a6cd2..f48974f52 100644 --- a/src/GToolkit-Coder/GtCoderAction.class.st +++ b/src/GToolkit-Coder/GtCoderAction.class.st @@ -7,7 +7,9 @@ Class { 'action', 'id', 'shortcutKey', - 'allowPrimaryClick' + 'allowPrimaryClick', + 'allowAltClick', + 'actionDefinition' ], #category : #'GToolkit-Coder-Coders - Addons' } @@ -33,6 +35,21 @@ GtCoderAction >> action: anObject [ action := anObject ] +{ #category : #accessing } +GtCoderAction >> actionDefinition [ + "Return a method definition that defines the action" + + + ^ actionDefinition + ifNil: [ actionDefinition := self computeActionDefinition + ifNil: [ GtCoderActionNoDefinition default ] ] +] + +{ #category : #testing } +GtCoderAction >> allowAltClick [ + ^ (allowAltClick ifNil: [ true ]) and: [ self actionDefinition isDefined ] +] + { #category : #accessing } GtCoderAction >> allowPrimaryClick [ ^ allowPrimaryClick ifNil: [ false ] @@ -43,6 +60,13 @@ GtCoderAction >> allowPrimaryClick: anObject [ allowPrimaryClick := anObject ] +{ #category : #initialization } +GtCoderAction >> computeActionDefinition [ + ^ self action isClosure + ifTrue: [ GtCoderActionClosureDefinition new closure: self action ] + ifFalse: [ nil ] +] + { #category : #evaluating } GtCoderAction >> gtValueWithArgs: anArray [ ^ self action valueWithPossibleArgs: anArray diff --git a/src/GToolkit-Coder/GtCoderActionClosureDefinition.class.st b/src/GToolkit-Coder/GtCoderActionClosureDefinition.class.st new file mode 100644 index 000000000..90000c1df --- /dev/null +++ b/src/GToolkit-Coder/GtCoderActionClosureDefinition.class.st @@ -0,0 +1,33 @@ +Class { + #name : #GtCoderActionClosureDefinition, + #superclass : #GtCoderActionDefinition, + #instVars : [ + 'closure' + ], + #category : #'GToolkit-Coder-Coders - Addons' +} + +{ #category : #accessing } +GtCoderActionClosureDefinition >> closure [ + ^ closure +] + +{ #category : #accessing } +GtCoderActionClosureDefinition >> closure: aBlock [ + closure := aBlock +] + +{ #category : #'gt - extensions' } +GtCoderActionClosureDefinition >> gtSourceCodeFor: aView [ + + ^ aView forward + title: 'Source code'; + priority: 1; + object: [ self closure ]; + view: #gtSourceCodeFor: +] + +{ #category : #testing } +GtCoderActionClosureDefinition >> isDefined [ + ^ self closure isNotNil +] diff --git a/src/GToolkit-Coder/GtCoderActionDefinition.class.st b/src/GToolkit-Coder/GtCoderActionDefinition.class.st new file mode 100644 index 000000000..7bd93b14d --- /dev/null +++ b/src/GToolkit-Coder/GtCoderActionDefinition.class.st @@ -0,0 +1,15 @@ +Class { + #name : #GtCoderActionDefinition, + #superclass : #Object, + #category : #'GToolkit-Coder-Coders - Addons' +} + +{ #category : #'gt - extensions' } +GtCoderActionDefinition >> gtSourceCodeFor: aView [ + ^ aView empty +] + +{ #category : #testing } +GtCoderActionDefinition >> isDefined [ + ^ false +] diff --git a/src/GToolkit-Coder/GtCoderActionNoDefinition.class.st b/src/GToolkit-Coder/GtCoderActionNoDefinition.class.st new file mode 100644 index 000000000..d16150341 --- /dev/null +++ b/src/GToolkit-Coder/GtCoderActionNoDefinition.class.st @@ -0,0 +1,7 @@ +Class { + #name : #GtCoderActionNoDefinition, + #superclass : #GtCoderActionDefinition, + #traits : 'TGtUniqueInstance', + #classTraits : 'TGtUniqueInstance classTrait', + #category : #'GToolkit-Coder-Coders - Addons' +} diff --git a/src/GToolkit-Coder/GtCoderCustomAction.class.st b/src/GToolkit-Coder/GtCoderCustomAction.class.st index e5dd014c9..54b537fa5 100644 --- a/src/GToolkit-Coder/GtCoderCustomAction.class.st +++ b/src/GToolkit-Coder/GtCoderCustomAction.class.st @@ -7,6 +7,13 @@ Class { #category : #'GToolkit-Coder-Coders - Addons' } +{ #category : #initialization } +GtCoderCustomAction >> computeActionDefinition [ + self stencil isClosure + ifTrue: [ ^ GtCoderActionClosureDefinition new closure: self stencil ]. + ^ nil +] + { #category : #accessing } GtCoderCustomAction >> stencil [ diff --git a/src/GToolkit-Coder/GtCoderDropDownAction.class.st b/src/GToolkit-Coder/GtCoderDropDownAction.class.st index 83b7f461c..bd65486c1 100644 --- a/src/GToolkit-Coder/GtCoderDropDownAction.class.st +++ b/src/GToolkit-Coder/GtCoderDropDownAction.class.st @@ -7,6 +7,13 @@ Class { #category : #'GToolkit-Coder-Coders - Addons' } +{ #category : #initialization } +GtCoderDropDownAction >> computeActionDefinition [ + self stencil isClosure + ifTrue: [ ^ GtCoderActionClosureDefinition new closure: self stencil ]. + ^ nil +] + { #category : #accessing } GtCoderDropDownAction >> stencil [ ^ stencil diff --git a/src/GToolkit-Coder/GtCoderDropDownWithPreviewAction.class.st b/src/GToolkit-Coder/GtCoderDropDownWithPreviewAction.class.st index f247e1c56..b9322aacd 100644 --- a/src/GToolkit-Coder/GtCoderDropDownWithPreviewAction.class.st +++ b/src/GToolkit-Coder/GtCoderDropDownWithPreviewAction.class.st @@ -27,3 +27,12 @@ GtCoderDropDownWithPreviewAction >> changeStencil [ GtCoderDropDownWithPreviewAction >> changeStencil: aBlock [ changeStencil := aBlock ] + +{ #category : #initialization } +GtCoderDropDownWithPreviewAction >> computeActionDefinition [ + self changeAction isClosure + ifTrue: [ ^ GtCoderActionClosureDefinition new closure: self changeAction ]. + self changeStencil isClosure + ifTrue: [ ^ GtCoderActionClosureDefinition new closure: self changeStencil ]. + ^ nil +] diff --git a/src/GToolkit-Coder/GtCoderToggleAction.class.st b/src/GToolkit-Coder/GtCoderToggleAction.class.st index a94298102..9a6eea96b 100644 --- a/src/GToolkit-Coder/GtCoderToggleAction.class.st +++ b/src/GToolkit-Coder/GtCoderToggleAction.class.st @@ -14,6 +14,15 @@ GtCoderToggleAction >> activateBlock: aBlock [ activateBlock := aBlock ] +{ #category : #initialization } +GtCoderToggleAction >> computeActionDefinition [ + activateBlock isClosure + ifTrue: [ ^ GtCoderActionClosureDefinition new closure: activateBlock ]. + deactivateBlock isClosure + ifTrue: [ ^ GtCoderActionClosureDefinition new closure: deactivateBlock ]. + ^ nil +] + { #category : #accessing } GtCoderToggleAction >> deactivateBlock: aBlock [ deactivateBlock := aBlock From 4c534dfce2fecb29a39af25e6db998af45a574b1 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 23 Apr 2024 23:47:40 -0400 Subject: [PATCH 0601/1268] add `locate debugger` button [feenkcom/gtoolkit#3720] --- .../GtCoderActionsElement.class.st | 73 +++++++++++++++---- .../GtCoderLocateDebuggerAction.class.st | 49 +++++++++++++ .../GtSourceCoderActionsElement.class.st | 36 ++++++++- ...ourceCoderProcessInDebuggerSignal.class.st | 34 +++++++++ .../GtSourceCoderViewModel.class.st | 43 +++++++++-- ...elAboutToOpenDebuggerAnnouncement.class.st | 29 ++++++++ .../GtTextualCoderViewModel.class.st | 44 ++++++++++- 7 files changed, 281 insertions(+), 27 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderLocateDebuggerAction.class.st create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderProcessInDebuggerSignal.class.st create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderViewModelAboutToOpenDebuggerAnnouncement.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st index a84af1102..b2d37ddd4 100644 --- a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st @@ -61,6 +61,24 @@ GtCoderActionsElement >> initializeAltClick: aGtCoderAction element: anElement [ anEvent target phlow spawnObject: aGtCoderAction actionDefinition ] ] ] +{ #category : #'instance creation' } +GtCoderActionsElement >> initializePrimaryClick: aGtCoderAction element: button [ + aGtCoderAction allowPrimaryClick + ifTrue: [ button viewModel + when: BlClickEvent + do: [ :anEvent | + anEvent modifiers isPrimaryModifier + ifTrue: [ button viewModel clickEvent: anEvent ] ]. + button viewModel + when: BlMouseEnterEvent + do: [ :anEvent | + anEvent consumed: true. + anEvent modifiers isPrimaryModifier + ifTrue: [ anEvent target mouseCursor: BlCopyCursor new ] + ifFalse: [ anEvent target mouseCursor: nil ]. + anEvent target requestFocus ] ] +] + { #category : #'instance creation' } GtCoderActionsElement >> newButtonForAction: aGtCoderAction [ @@ -77,21 +95,7 @@ GtCoderActionsElement >> newButtonForAction: aGtCoderAction [ action: aGtCoderAction onEvent: anEvent ]. self initializeAltClick: aGtCoderAction element: button. - - aGtCoderAction allowPrimaryClick - ifTrue: [ button viewModel - when: BlClickEvent - do: [ :anEvent | - anEvent modifiers isPrimaryModifier - ifTrue: [ button viewModel clickEvent: anEvent ] ]. - button viewModel - when: BlMouseEnterEvent - do: [ :anEvent | - anEvent consumed: true. - anEvent modifiers isPrimaryModifier - ifTrue: [ anEvent target mouseCursor: BlCopyCursor new ] - ifFalse: [ anEvent target mouseCursor: nil ]. - anEvent target requestFocus ] ]. + self initializePrimaryClick: aGtCoderAction element: button. ^ button ] @@ -157,6 +161,45 @@ GtCoderActionsElement >> newDropButtonForAction: aGtCoderAction [ yourself ] +{ #category : #'instance creation' } +GtCoderActionsElement >> newLocateDebuggerButtonForAction: aGtCoderAction [ + + | button anAptitude | + button := BrButton new + icon: aGtCoderAction icon asElement; + beTinySize; + label: aGtCoderAction title; + id: aGtCoderAction id; + action: [ :aButtonElement :aButtonModel :anEvent | + self + handleButton: aButtonElement + action: aGtCoderAction + onEvent: anEvent ]. + + anAptitude := BrGlamorousButtonWithIconAndLabelAptitude new. + anAptitude + findActor: BrGlamorousButtonExteriorAptitude + ifFound: [ :anExteriorAptitude | + anExteriorAptitude + "backgroundPaint: BrGlamorousColors errorBackgroundColor;" + "borderPaint: BrGlamorousColors errorBorderColor" ] + ifNone: [ ]. + anAptitude + findActor: BrGlamorousButtonLabelAptitude + ifFound: [ :aLabelAptitude | + "aLabelAptitude + defaultColor: BrGlamorousColors errorBackgroundColor; + hoveredColor: BrGlamorousColors errorBorderColor; + pressedColor: BrGlamorousColors errorBorderColor; + selectedColor: BrGlamorousColors errorBackgroundColor" ] + ifNone: [ "ignore" ]. + button aptitude: anAptitude. + + self initializeAltClick: aGtCoderAction element: button. + self initializePrimaryClick: aGtCoderAction element: button. + ^ button +] + { #category : #'instance creation' } GtCoderActionsElement >> newToggleForAction: aGtCoderAction [ diff --git a/src/GToolkit-Coder-UI/GtCoderLocateDebuggerAction.class.st b/src/GToolkit-Coder-UI/GtCoderLocateDebuggerAction.class.st new file mode 100644 index 000000000..93c0a333e --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderLocateDebuggerAction.class.st @@ -0,0 +1,49 @@ +Class { + #name : #GtCoderLocateDebuggerAction, + #superclass : #GtCoderAction, + #instVars : [ + 'weakSpace' + ], + #category : #'GToolkit-Coder-UI-Coder - Addons' +} + +{ #category : #comparing } +GtCoderLocateDebuggerAction >> = anObject [ + ^ super = anObject and: [ self space = anObject space ] +] + +{ #category : #building } +GtCoderLocateDebuggerAction >> buildElementIn: aCoderActionsElement [ + ^ aCoderActionsElement newLocateDebuggerButtonForAction: self +] + +{ #category : #comparing } +GtCoderLocateDebuggerAction >> hash [ + ^ super hash bitXor: self space hash +] + +{ #category : #initialization } +GtCoderLocateDebuggerAction >> initialize [ + super initialize. + + self + icon: BrGlamorousVectorIcons debug; + title: 'Locate debugger'; + action: [ :aCoderViewModel :aButtonElement :anEvent | + self locateDebuggerInSpace ] +] + +{ #category : #'private - event handling' } +GtCoderLocateDebuggerAction >> locateDebuggerInSpace [ + ^ self space ifNotNil: [ :theSpace | theSpace position: 0 @ 0 ] +] + +{ #category : #accessing } +GtCoderLocateDebuggerAction >> space [ + ^ weakSpace ifNotNil: [ :aWeak | aWeak at: 1 ] +] + +{ #category : #accessing } +GtCoderLocateDebuggerAction >> weakSpace: anObject [ + weakSpace := anObject +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st index aec1281ff..f86a7a9d6 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st @@ -14,7 +14,8 @@ Class { { #category : #private } GtSourceCoderActionsElement >> addContextToolbarActions [ - contextToolbar addItems: (self textualCoderViewModel contextActions collect: [ :aGtCoderAction | self newButtonForAction: aGtCoderAction ]). + contextToolbar addItems: (self textualCoderViewModel contextActions collect: [ :aGtCoderAction | + aGtCoderAction buildElementIn: self ]). separator visibility: (contextToolbar hasItems @@ -75,6 +76,13 @@ GtSourceCoderActionsElement >> newToolbar [ padding: (BlInsets left: -4) ] +{ #category : #'private - announcement handling' } +GtSourceCoderActionsElement >> onAboutToOpenDebugger: anAnnouncement [ + BlTaskAction + enqueueElement: self + action: [ self updateDebuggerIndicatorForProcess: anAnnouncement process ] +] + { #category : #'api - textual coder view model' } GtSourceCoderActionsElement >> onPostTextualCoderViewModelChanged [ "I am an optional hook method that is sent after #subscribeToTextualCoderViewModel. @@ -116,7 +124,8 @@ GtSourceCoderActionsElement >> subscribeToTextualCoderViewModel [ self textualCoderViewModel weak when: GtTextualCoderViewModelMainActionsChanged send: #updateMainToolbar to: self; - when: GtTextualCoderViewModelContextActionsChanged send: #updateContextToolbar to: self + when: GtTextualCoderViewModelContextActionsChanged send: #updateContextToolbar to: self; + when: GtSourceCoderViewModelAboutToOpenDebuggerAnnouncement send: #onAboutToOpenDebugger: to: self. ] { #category : #'api - textual coder view model' } @@ -136,6 +145,29 @@ GtSourceCoderActionsElement >> updateContextToolbar [ self addContextToolbarActions ]) ] +{ #category : #'private - updating' } +GtSourceCoderActionsElement >> updateDebuggerIndicatorForProcess: aProcess [ + | aSpace | + aSpace := nil. + BlParallelUniverse all + do: [ :eachUniverse | + eachUniverse spaces + do: [ :eachSpace | + | aQuery | + aQuery := eachSpace root query // GtMoldableDebugger. + aQuery isEmpty + ifFalse: [ aQuery anyOne debugSession interruptedProcess == aProcess + ifTrue: [ aSpace := eachSpace ] ] ] ]. + + GtSourceCoderProcessInDebuggerSignal new + process: aProcess; + space: aSpace; + emit. + + aSpace ifNil: [ ^ self ]. + self textualCoderViewModel addLocateDebuggerInSpaceAction: aSpace +] + { #category : #'private - event handling' } GtSourceCoderActionsElement >> updateMainToolbar [ self enqueueTask: (BlTaskAction new diff --git a/src/GToolkit-Coder-UI/GtSourceCoderProcessInDebuggerSignal.class.st b/src/GToolkit-Coder-UI/GtSourceCoderProcessInDebuggerSignal.class.st new file mode 100644 index 000000000..74d1e9a33 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderProcessInDebuggerSignal.class.st @@ -0,0 +1,34 @@ +Class { + #name : #GtSourceCoderProcessInDebuggerSignal, + #superclass : #BeaconSignal, + #instVars : [ + 'process', + 'space' + ], + #category : #'GToolkit-Coder-UI-Signals' +} + +{ #category : #printing } +GtSourceCoderProcessInDebuggerSignal >> printOneLineContentsOn: aStream [ + aStream print: space +] + +{ #category : #accessing } +GtSourceCoderProcessInDebuggerSignal >> process [ + ^ process +] + +{ #category : #accessing } +GtSourceCoderProcessInDebuggerSignal >> process: anObject [ + process := anObject +] + +{ #category : #accessing } +GtSourceCoderProcessInDebuggerSignal >> space [ + ^ space +] + +{ #category : #accessing } +GtSourceCoderProcessInDebuggerSignal >> space: anObject [ + space := anObject +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st index 89887ee7c..d456287e2 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st @@ -57,9 +57,11 @@ GtSourceCoderViewModel >> doIt: aTextInterval [ GtSourceCoderViewModel >> doIt: aTextInterval requestedBy: aRequesterObject [ "Evaluate source code within given text interval and return the result" - ^ self coderModel doItInContext: (self evaluationContext - from: aTextInterval first to: aTextInterval last; - requesterObject: aRequesterObject) + ^ self handleCoderEvaluationUnhandledErrorDuring: [ + self coderModel doItInContext: ( + self evaluationContext + from: aTextInterval first to: aTextInterval last; + requesterObject: aRequesterObject) ] ] { #category : #'api - actions' } @@ -73,9 +75,10 @@ GtSourceCoderViewModel >> doItAll [ GtSourceCoderViewModel >> doItAllRequestedBy: aRequesterObject [ "Evaluate the whole source code independent from the selection and return the result" - ^ self coder doItInContext: (self evaluationContext - all; - requesterObject: aRequesterObject) + ^ self handleCoderEvaluationUnhandledErrorDuring: [ + self coder doItInContext: (self evaluationContext + all; + requesterObject: aRequesterObject) ] ] { #category : #'api - actions' } @@ -91,14 +94,19 @@ GtSourceCoderViewModel >> doItAndGo [ GtSourceCoderViewModel >> doItAndGo: aTextInterval [ "Evaluate a piece of source code within an interval and inspect a result." - ^ self coder doItAndGoInContext: (self evaluationContext from: aTextInterval first to: aTextInterval last) + ^ self handleCoderEvaluationUnhandledErrorDuring: [ + self coder doItAndGoInContext: ( + self evaluationContext + from: aTextInterval first + to: aTextInterval last) ] ] { #category : #'api - actions' } GtSourceCoderViewModel >> doItAndGoAll [ "Evaluate the whole source code and inspect the result" - ^ self coder doItAndGoInContext: self evaluationContext all + ^ self handleCoderEvaluationUnhandledErrorDuring: [ + self coder doItAndGoInContext: self evaluationContext all ] ] { #category : #'api - actions' } @@ -157,6 +165,25 @@ GtSourceCoderViewModel >> evaluationResult: anObject [ evaluationResult := anObject ] +{ #category : #'private - event handling' } +GtSourceCoderViewModel >> handleCoderEvaluationUnhandledErrorDuring: aBlock [ + ^ aBlock + on: GtCoderEvaluationUnhandledError , Halt + do: [ :anError | + self + notifyCoderEvaluationUnhandledError: anError + inProcess: Processor activeProcess. + anError pass ] +] + +{ #category : #'private - notifying' } +GtSourceCoderViewModel >> notifyCoderEvaluationUnhandledError: anError inProcess: aProcess [ + self + announce: (GtSourceCoderViewModelAboutToOpenDebuggerAnnouncement new + process: aProcess; + exception: anError) +] + { #category : #'api - actions' } GtSourceCoderViewModel >> printIt [ "Evaluate selected source code or everything if there is nothing selected and print the result" diff --git a/src/GToolkit-Coder-UI/GtSourceCoderViewModelAboutToOpenDebuggerAnnouncement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderViewModelAboutToOpenDebuggerAnnouncement.class.st new file mode 100644 index 000000000..9b1500148 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderViewModelAboutToOpenDebuggerAnnouncement.class.st @@ -0,0 +1,29 @@ +Class { + #name : #GtSourceCoderViewModelAboutToOpenDebuggerAnnouncement, + #superclass : #GtTextualCoderViewModelAnnouncement, + #instVars : [ + 'process', + 'exception' + ], + #category : #'GToolkit-Coder-UI-Coder - Textual Model - Events' +} + +{ #category : #accessing } +GtSourceCoderViewModelAboutToOpenDebuggerAnnouncement >> exception [ + ^ exception +] + +{ #category : #accessing } +GtSourceCoderViewModelAboutToOpenDebuggerAnnouncement >> exception: anObject [ + exception := anObject +] + +{ #category : #accessing } +GtSourceCoderViewModelAboutToOpenDebuggerAnnouncement >> process [ + ^ process +] + +{ #category : #accessing } +GtSourceCoderViewModelAboutToOpenDebuggerAnnouncement >> process: anObject [ + process := anObject +] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index a04d3b879..6e458e9ed 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -15,11 +15,23 @@ Class { 'styledText', 'shouldHaveHeader', 'isTextModifiedPromise', - 'completionStrategy' + 'completionStrategy', + 'debuggerInSpace' ], #category : #'GToolkit-Coder-UI-Coder - Textual Model' } +{ #category : #'api - add-ons' } +GtTextualCoderViewModel >> addLocateDebuggerInSpaceAction: aSpace [ + debuggerInSpace := aSpace asWeakReference. + + aSpace + addEventHandlerOn: BlSpaceClosedEvent + do: [ :anEvent | self onDebuggerSpaceCloseEvent: anEvent ]. + + self requestUpdateAddOns +] + { #category : #'api - shortcuts' } GtTextualCoderViewModel >> addShortcut: aShortcut [ "Add an extra shortcut add-on independent from the dynamically computed add-ons" @@ -455,6 +467,16 @@ GtTextualCoderViewModel >> isTextModified [ ^ isTextModifiedPromise ifNil: [ isTextModifiedPromise := self coderModel isModifiedPromise ] ] +{ #category : #'api - add-ons' } +GtTextualCoderViewModel >> locateDebuggerInSpaceAction [ + | aSpace | + debuggerInSpace ifNil: [ ^ nil ]. + aSpace := debuggerInSpace at: 1. + aSpace ifNil: [ ^ nil ]. + + ^ GtCoderLocateDebuggerAction new weakSpace: debuggerInSpace +] + { #category : #'api - add-ons' } GtTextualCoderViewModel >> mainActions [ ^ mainActions @@ -531,9 +553,15 @@ GtTextualCoderViewModel >> notifyStyledTextChanged [ GtTextualCoderViewModel >> onAddOnsChanged: theAddOns [ "Is sent when new add-ons are computed" + | someContextActions | self shortcuts: theAddOns shortcuts. self mainActions: theAddOns mainActions. - self contextActions: theAddOns contextActions. + + someContextActions := theAddOns contextActions. + self locateDebuggerInSpaceAction ifNotNil: [ :anAction | + someContextActions := someContextActions copyWith: anAction ]. + self contextActions: someContextActions. + self contextMenuActions: theAddOns contextMenuActions. self stylers: theAddOns stylers ] @@ -543,6 +571,18 @@ GtTextualCoderViewModel >> onCoderModelChanged [ super onCoderModelChanged ] +{ #category : #'api - add-ons' } +GtTextualCoderViewModel >> onDebuggerSpaceCloseEvent: anEvent [ + | aCurrentSpace | + debuggerInSpace ifNil: [ ^ self ]. + aCurrentSpace := debuggerInSpace at: 1. + aCurrentSpace ifNil: [ ^ self ]. + + aCurrentSpace = anEvent space ifFalse: [ ^ self ]. + debuggerInSpace := nil. + self requestUpdateAddOns +] + { #category : #'api - styled text' } GtTextualCoderViewModel >> onNewStyledTextSet: aNewStyledText [ "Is sent after a new value of the styledText is assigned" From 48ce9ba91f47589d2ef34bac6e1baaa38416305a Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 23 Apr 2024 23:59:09 -0400 Subject: [PATCH 0602/1268] the `locate debugger` button moves debugger space to indicate which window it is [feenkcom/gtoolkit#3720] --- src/GToolkit-Coder-UI/GtCoderLocateDebuggerAction.class.st | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderLocateDebuggerAction.class.st b/src/GToolkit-Coder-UI/GtCoderLocateDebuggerAction.class.st index 93c0a333e..51e9627ff 100644 --- a/src/GToolkit-Coder-UI/GtCoderLocateDebuggerAction.class.st +++ b/src/GToolkit-Coder-UI/GtCoderLocateDebuggerAction.class.st @@ -35,7 +35,12 @@ GtCoderLocateDebuggerAction >> initialize [ { #category : #'private - event handling' } GtCoderLocateDebuggerAction >> locateDebuggerInSpace [ - ^ self space ifNotNil: [ :theSpace | theSpace position: 0 @ 0 ] + ^ self space ifNotNil: [ :theSpace | + | anArray xRandom yRandom | + anArray := #(-10 -5 5 10). + xRandom := anArray atRandom. + yRandom := anArray atRandom. + theSpace position: (theSpace position + (xRandom @ yRandom)) ] ] { #category : #accessing } From 5c633be17a744b1d96198640a317640c3b929597 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 24 Apr 2024 12:03:58 -0400 Subject: [PATCH 0603/1268] use `BlSpace>>#toFront` [feenkcom/gtoolkit#3720] --- src/GToolkit-Coder-UI/GtCoderLocateDebuggerAction.class.st | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderLocateDebuggerAction.class.st b/src/GToolkit-Coder-UI/GtCoderLocateDebuggerAction.class.st index 51e9627ff..6fb0c03bf 100644 --- a/src/GToolkit-Coder-UI/GtCoderLocateDebuggerAction.class.st +++ b/src/GToolkit-Coder-UI/GtCoderLocateDebuggerAction.class.st @@ -35,12 +35,7 @@ GtCoderLocateDebuggerAction >> initialize [ { #category : #'private - event handling' } GtCoderLocateDebuggerAction >> locateDebuggerInSpace [ - ^ self space ifNotNil: [ :theSpace | - | anArray xRandom yRandom | - anArray := #(-10 -5 5 10). - xRandom := anArray atRandom. - yRandom := anArray atRandom. - theSpace position: (theSpace position + (xRandom @ yRandom)) ] + ^ self space ifNotNil: [ :theSpace | theSpace toFront ] ] { #category : #accessing } From 2152c4cf014245a800fe5e468f742e240230399a Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Thu, 25 Apr 2024 12:04:52 +0200 Subject: [PATCH 0604/1268] Add disjunction for searches --- .../GtSearchDisjunctionFilter.class.st | 33 +++++++++++++++++++ .../GtSearchFilter.class.st | 5 +++ 2 files changed, 38 insertions(+) create mode 100644 src/GToolkit-SearchFilters/GtSearchDisjunctionFilter.class.st diff --git a/src/GToolkit-SearchFilters/GtSearchDisjunctionFilter.class.st b/src/GToolkit-SearchFilters/GtSearchDisjunctionFilter.class.st new file mode 100644 index 000000000..d4b6b6449 --- /dev/null +++ b/src/GToolkit-SearchFilters/GtSearchDisjunctionFilter.class.st @@ -0,0 +1,33 @@ +Class { + #name : #GtSearchDisjunctionFilter, + #superclass : #GtSearchBinaryFilter, + #category : #'GToolkit-SearchFilters-Filters' +} + +{ #category : #accessing } +GtSearchDisjunctionFilter >> defaultFilterScope [ + ^ left defaultFilterScope +] + +{ #category : #printing } +GtSearchDisjunctionFilter >> gtDisplayOn: stream [ + left gtDisplayOn: stream. + stream nextPutAll: ' - '. + right gtDisplayOn: stream. +] + +{ #category : #testing } +GtSearchDisjunctionFilter >> matches: anObject [ + | leftResult rightResult | + leftResult := left matches: anObject. + rightResult := right matches: anObject. + + ^ leftResult ifTrue: [ rightResult not ] ifFalse: [ rightResult ] +] + +{ #category : #printing } +GtSearchDisjunctionFilter >> printOn: stream [ + left printOn: stream. + stream nextPutAll: ' - '. + right printOn: stream. +] diff --git a/src/GToolkit-SearchFilters/GtSearchFilter.class.st b/src/GToolkit-SearchFilters/GtSearchFilter.class.st index c156ec37f..90ab80557 100644 --- a/src/GToolkit-SearchFilters/GtSearchFilter.class.st +++ b/src/GToolkit-SearchFilters/GtSearchFilter.class.st @@ -34,6 +34,11 @@ GtSearchFilter >> & aFilter [ ^ GtSearchIntersectionFilter forFilter: self filter: aFilter ] +{ #category : #'logical operations' } +GtSearchFilter >> - aFilter [ + ^ GtSearchDisjunctionFilter forFilter: self filter: aFilter +] + { #category : #evaluating } GtSearchFilter >> applyInScope: aStream [ ^ self resultType new From 47f4ea8601cda00e05d0785c9b1b99d765dcded5 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 29 Apr 2024 10:20:52 -0400 Subject: [PATCH 0605/1268] add `GtCoderShowDebuggerRequest>>isDelivered` [feenkcom/gtoolkit#3735] --- .../GtNotificationDebugSession.class.st | 10 +++---- ...GtNotificationDebugSessionElement.class.st | 4 +-- .../GtCoderShowDebuggerRequest.class.st | 30 +++++++++++++++++-- src/GToolkit-Coder/GtSourceCoder.class.st | 24 ++++++++------- 4 files changed, 48 insertions(+), 20 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtNotificationDebugSession.class.st b/src/GToolkit-Coder-UI/GtNotificationDebugSession.class.st index be0953282..1cb3cd7ce 100644 --- a/src/GToolkit-Coder-UI/GtNotificationDebugSession.class.st +++ b/src/GToolkit-Coder-UI/GtNotificationDebugSession.class.st @@ -10,11 +10,11 @@ Class { { #category : #'api - notification' } GtNotificationDebugSession >> addedTo: aGtNotifications [ | aSubscription | - aSubscription := self debugSession - when: GtSharedDebugSessionAnnouncement - do: [ :anAnnouncement | - self removeFrom: aGtNotifications. - self debugSession removeSubscription: aSubscription ] + aSubscription := self debugSession weak + when: GtSharedDebugSessionAnnouncement + do: [ :anAnnouncement | + self removeFrom: aGtNotifications. + self debugSession removeSubscription: aSubscription ] ] { #category : #'private - asserting' } diff --git a/src/GToolkit-Coder-UI/GtNotificationDebugSessionElement.class.st b/src/GToolkit-Coder-UI/GtNotificationDebugSessionElement.class.st index 82b4be66e..1c7b17283 100644 --- a/src/GToolkit-Coder-UI/GtNotificationDebugSessionElement.class.st +++ b/src/GToolkit-Coder-UI/GtNotificationDebugSessionElement.class.st @@ -26,7 +26,7 @@ GtNotificationDebugSessionElement >> debug [ { #category : #'private - accessing' } GtNotificationDebugSessionElement >> debugSessionDo: aBlock [ self - notificationDo: [ :anEvent | anEvent debugSession ifNotNil: aBlock ] + notificationDo: [ :aNotification | aNotification debugSession ifNotNil: aBlock ] ] { #category : #initialization } @@ -163,7 +163,7 @@ GtNotificationDebugSessionElement >> stackListElement [ GtNotificationDebugSessionElement >> subscribeToNotification [ super subscribeToNotification. self debugSessionDo: [ :aSession | - aSession + aSession weak when: GtSharedDebugSessionDebuggedAnnouncement send: #onDebugSessionDebugged: to: self; diff --git a/src/GToolkit-Coder/GtCoderShowDebuggerRequest.class.st b/src/GToolkit-Coder/GtCoderShowDebuggerRequest.class.st index 6940fc406..91892bd1e 100644 --- a/src/GToolkit-Coder/GtCoderShowDebuggerRequest.class.st +++ b/src/GToolkit-Coder/GtCoderShowDebuggerRequest.class.st @@ -5,9 +5,10 @@ Class { 'debugSession', 'exception', 'sourceString', - 'sourceInterval' + 'sourceInterval', + 'isDelivered' ], - #category : 'GToolkit-Coder-Event' + #category : #'GToolkit-Coder-Event' } { #category : #accessing } @@ -30,6 +31,31 @@ GtCoderShowDebuggerRequest >> exception: anObject [ exception := anObject ] +{ #category : #initialization } +GtCoderShowDebuggerRequest >> initialize [ + super initialize. + isDelivered := false +] + +{ #category : #accessing } +GtCoderShowDebuggerRequest >> isDelivered [ + "Return true if the request was handled (and debugger displayed)." + + + ^ isDelivered ifNil: [ false ] +] + +{ #category : #accessing } +GtCoderShowDebuggerRequest >> isDelivered: aBoolean [ + isDelivered := aBoolean +] + +{ #category : #initialization } +GtCoderShowDebuggerRequest >> prepareForDelivery [ + super prepareForDelivery. + isDelivered := true +] + { #category : #accessing } GtCoderShowDebuggerRequest >> sourceInterval [ ^ sourceInterval diff --git a/src/GToolkit-Coder/GtSourceCoder.class.st b/src/GToolkit-Coder/GtSourceCoder.class.st index 593c64aed..d43f88b11 100644 --- a/src/GToolkit-Coder/GtSourceCoder.class.st +++ b/src/GToolkit-Coder/GtSourceCoder.class.st @@ -377,18 +377,20 @@ GtSourceCoder >> notifyPrintResult: anEvaluationResult [ { #category : #'private - notifying' } GtSourceCoder >> notifyShowDebuggerRequest: aDebugSession dueTo: anException sourceString: aSourceString sourceInterval: aSourceInterval [ - (self announcer subscriptionsForClass: GtCoderShowDebuggerRequest) size isZero - ifTrue: [ - ^ Smalltalk tools debugger - openOn: aDebugSession - withFullView: true ]. + "Return true if announcement was handled (and debugger displayed in some way). + Return false otherwise." - self announce: (GtCoderShowDebuggerRequest new - coder: self; - debugSession: aDebugSession; - exception: anException; - sourceString: aSourceString; - sourceInterval: aSourceInterval) + + | anAnnouncement | + anAnnouncement := GtCoderShowDebuggerRequest new + coder: self; + debugSession: aDebugSession; + exception: anException; + sourceString: aSourceString; + sourceInterval: aSourceInterval. + self announce: anAnnouncement. + + ^ anAnnouncement isDelivered ] { #category : #'private - notifying' } From 111f8c38c22c699b0f0a66e7d76157dde0b12822 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 29 Apr 2024 10:35:26 -0400 Subject: [PATCH 0606/1268] add `GtCoderUserSnippetDynamicVariable` [feenkcom/gtoolkit#3735] --- .../GtCoderUserNotUserSnippetState.class.st | 12 ++++++++++ ...GtCoderUserSnippetDynamicVariable.class.st | 22 +++++++++++++++++++ ...erSnippetEvaluationExceptionState.class.st | 7 ++++++ ...UserSnippetEvaluationRunningState.class.st | 7 ++++++ ...GtCoderUserSnippetEvaluationState.class.st | 10 +++++++++ .../GtSourceCoderViewModel.class.st | 5 ++++- 6 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderUserNotUserSnippetState.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderUserSnippetDynamicVariable.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderUserSnippetEvaluationExceptionState.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderUserSnippetEvaluationRunningState.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderUserSnippetEvaluationState.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderUserNotUserSnippetState.class.st b/src/GToolkit-Coder-UI/GtCoderUserNotUserSnippetState.class.st new file mode 100644 index 000000000..bd3777d54 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderUserNotUserSnippetState.class.st @@ -0,0 +1,12 @@ +Class { + #name : #GtCoderUserNotUserSnippetState, + #superclass : #GtCoderUserSnippetEvaluationState, + #traits : 'TGtUniqueInstance', + #classTraits : 'TGtUniqueInstance classTrait', + #category : #'GToolkit-Coder-UI-Coder - Source Model' +} + +{ #category : #accessing } +GtCoderUserNotUserSnippetState >> isUserSnippet [ + ^ false +] diff --git a/src/GToolkit-Coder-UI/GtCoderUserSnippetDynamicVariable.class.st b/src/GToolkit-Coder-UI/GtCoderUserSnippetDynamicVariable.class.st new file mode 100644 index 000000000..df74d75b1 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderUserSnippetDynamicVariable.class.st @@ -0,0 +1,22 @@ +Class { + #name : #GtCoderUserSnippetDynamicVariable, + #superclass : #DynamicVariable, + #category : #'GToolkit-Coder-UI-Coder - Source Model' +} + +{ #category : #accessing } +GtCoderUserSnippetDynamicVariable class >> value: aSnippetEvaluationState [ + ^ self soleInstance value: aSnippetEvaluationState +] + +{ #category : #accessing } +GtCoderUserSnippetDynamicVariable >> default [ + ^ GtCoderUserNotUserSnippetState default +] + +{ #category : #accessing } +GtCoderUserSnippetDynamicVariable >> value: aSnippetEvaluationState [ + | activeProcess | + activeProcess := Processor activeProcess. + ^ activeProcess psValueAt: index put: aSnippetEvaluationState +] diff --git a/src/GToolkit-Coder-UI/GtCoderUserSnippetEvaluationExceptionState.class.st b/src/GToolkit-Coder-UI/GtCoderUserSnippetEvaluationExceptionState.class.st new file mode 100644 index 000000000..948cc9261 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderUserSnippetEvaluationExceptionState.class.st @@ -0,0 +1,7 @@ +Class { + #name : #GtCoderUserSnippetEvaluationExceptionState, + #superclass : #GtCoderUserSnippetEvaluationState, + #traits : 'TGtUniqueInstance', + #classTraits : 'TGtUniqueInstance classTrait', + #category : #'GToolkit-Coder-UI-Coder - Source Model' +} diff --git a/src/GToolkit-Coder-UI/GtCoderUserSnippetEvaluationRunningState.class.st b/src/GToolkit-Coder-UI/GtCoderUserSnippetEvaluationRunningState.class.st new file mode 100644 index 000000000..3eb270dbe --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderUserSnippetEvaluationRunningState.class.st @@ -0,0 +1,7 @@ +Class { + #name : #GtCoderUserSnippetEvaluationRunningState, + #superclass : #GtCoderUserSnippetEvaluationState, + #traits : 'TGtUniqueInstance', + #classTraits : 'TGtUniqueInstance classTrait', + #category : #'GToolkit-Coder-UI-Coder - Source Model' +} diff --git a/src/GToolkit-Coder-UI/GtCoderUserSnippetEvaluationState.class.st b/src/GToolkit-Coder-UI/GtCoderUserSnippetEvaluationState.class.st new file mode 100644 index 000000000..f955b25f9 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderUserSnippetEvaluationState.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtCoderUserSnippetEvaluationState, + #superclass : #Object, + #category : #'GToolkit-Coder-UI-Coder - Source Model' +} + +{ #category : #testing } +GtCoderUserSnippetEvaluationState >> isUserSnippet [ + ^ true +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st index d456287e2..c4248aca9 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st @@ -167,9 +167,12 @@ GtSourceCoderViewModel >> evaluationResult: anObject [ { #category : #'private - event handling' } GtSourceCoderViewModel >> handleCoderEvaluationUnhandledErrorDuring: aBlock [ - ^ aBlock + ^ [ GtCoderUserSnippetDynamicVariable + value: GtCoderUserSnippetEvaluationRunningState default + during: aBlock ] on: GtCoderEvaluationUnhandledError , Halt do: [ :anError | + GtCoderUserSnippetDynamicVariable value: GtCoderUserSnippetEvaluationExceptionState default . self notifyCoderEvaluationUnhandledError: anError inProcess: Processor activeProcess. From c7a77e992d6d1683e813dc3af8bc82de92abae0c Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 29 Apr 2024 10:49:00 -0400 Subject: [PATCH 0607/1268] add `GtCoderUserSnippetDynamicVariable >> #valueAtProcess:` [feenkcom/gtoolkit#3735] --- .../GtCoderUserSnippetDynamicVariable.class.st | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtCoderUserSnippetDynamicVariable.class.st b/src/GToolkit-Coder-UI/GtCoderUserSnippetDynamicVariable.class.st index df74d75b1..268c2e969 100644 --- a/src/GToolkit-Coder-UI/GtCoderUserSnippetDynamicVariable.class.st +++ b/src/GToolkit-Coder-UI/GtCoderUserSnippetDynamicVariable.class.st @@ -9,6 +9,11 @@ GtCoderUserSnippetDynamicVariable class >> value: aSnippetEvaluationState [ ^ self soleInstance value: aSnippetEvaluationState ] +{ #category : #accessing } +GtCoderUserSnippetDynamicVariable class >> valueAtProcess: aProcess [ + ^ self soleInstance valueAtProcess: aProcess +] + { #category : #accessing } GtCoderUserSnippetDynamicVariable >> default [ ^ GtCoderUserNotUserSnippetState default @@ -20,3 +25,8 @@ GtCoderUserSnippetDynamicVariable >> value: aSnippetEvaluationState [ activeProcess := Processor activeProcess. ^ activeProcess psValueAt: index put: aSnippetEvaluationState ] + +{ #category : #accessing } +GtCoderUserSnippetDynamicVariable >> valueAtProcess: aProcess [ + ^ (aProcess psValueAt: index) ifNil: [ self default ] +] From fe5f4f533e72bfe12b0c34da552844fcee5c782b Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 29 Apr 2024 11:34:25 -0400 Subject: [PATCH 0608/1268] remove `weak` [feenkcom/gtoolkit#3735] --- src/GToolkit-Coder-UI/GtNotificationDebugSession.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtNotificationDebugSession.class.st b/src/GToolkit-Coder-UI/GtNotificationDebugSession.class.st index 1cb3cd7ce..bfeccefcd 100644 --- a/src/GToolkit-Coder-UI/GtNotificationDebugSession.class.st +++ b/src/GToolkit-Coder-UI/GtNotificationDebugSession.class.st @@ -10,7 +10,7 @@ Class { { #category : #'api - notification' } GtNotificationDebugSession >> addedTo: aGtNotifications [ | aSubscription | - aSubscription := self debugSession weak + aSubscription := self debugSession when: GtSharedDebugSessionAnnouncement do: [ :anAnnouncement | self removeFrom: aGtNotifications. From f4938c300518f636afbd28046b4e1d16e36fba6f Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 29 Apr 2024 15:12:43 -0400 Subject: [PATCH 0609/1268] weak subscriptions [feenkcom/gtoolkit#3735] --- .../GtNotificationDebugSession.class.st | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtNotificationDebugSession.class.st b/src/GToolkit-Coder-UI/GtNotificationDebugSession.class.st index bfeccefcd..d40fbe841 100644 --- a/src/GToolkit-Coder-UI/GtNotificationDebugSession.class.st +++ b/src/GToolkit-Coder-UI/GtNotificationDebugSession.class.st @@ -9,12 +9,10 @@ Class { { #category : #'api - notification' } GtNotificationDebugSession >> addedTo: aGtNotifications [ - | aSubscription | - aSubscription := self debugSession - when: GtSharedDebugSessionAnnouncement - do: [ :anAnnouncement | - self removeFrom: aGtNotifications. - self debugSession removeSubscription: aSubscription ] + self debugSession weak + when: GtSharedDebugSessionAnnouncement + send: #onSharedDebugSessionAnnouncement: + to: self ] { #category : #'private - asserting' } @@ -46,6 +44,12 @@ GtNotificationDebugSession >> elementClass [ ^ GtNotificationDebugSessionElement ] +{ #category : #'private - announcement handling' } +GtNotificationDebugSession >> onSharedDebugSessionAnnouncement: anAnnouncement [ + self requestRemoval. + self debugSession unsubscribe: self +] + { #category : #'private - adding / removing' } GtNotificationDebugSession >> removeFrom: aGtNotifications [ aGtNotifications removeNotification: self From 2c5150f9bc1195ab36704ba45482137f5e92ea15 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 29 Apr 2024 15:43:58 -0400 Subject: [PATCH 0610/1268] show debugger attribute at the end of a snippet [feenkcom/gtoolkit#3735] --- src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 0b5b6c415..066af9c8e 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -273,7 +273,7 @@ GtTextualCoderEditorElement >> onShowDebuggerRequest: aShowDebuggerAnnouncement ((GtEmbeddedDebuggerAttribute new) signaledException: aShowDebuggerAnnouncement exception; debugSession: sharedDebugSession) - from: theSourceStartInText + from: theSourceEndInText to: theSourceEndInText ] From 92c8c91aedc4090f37df8dcad6bc2a85f79977cd Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 29 Apr 2024 16:07:56 -0400 Subject: [PATCH 0611/1268] better user snippet evaluation state names [feenkcom/gtoolkit#3735] --- ...tate.class.st => GtCoderNotUserSnippetState.class.st} | 9 +++++++-- .../GtCoderUserSnippetDynamicVariable.class.st | 2 +- .../GtCoderUserSnippetEvaluationExceptionState.class.st | 5 +++++ .../GtCoderUserSnippetEvaluationRunningState.class.st | 5 +++++ 4 files changed, 18 insertions(+), 3 deletions(-) rename src/GToolkit-Coder-UI/{GtCoderUserNotUserSnippetState.class.st => GtCoderNotUserSnippetState.class.st} (53%) diff --git a/src/GToolkit-Coder-UI/GtCoderUserNotUserSnippetState.class.st b/src/GToolkit-Coder-UI/GtCoderNotUserSnippetState.class.st similarity index 53% rename from src/GToolkit-Coder-UI/GtCoderUserNotUserSnippetState.class.st rename to src/GToolkit-Coder-UI/GtCoderNotUserSnippetState.class.st index bd3777d54..d178a4f4e 100644 --- a/src/GToolkit-Coder-UI/GtCoderUserNotUserSnippetState.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNotUserSnippetState.class.st @@ -1,12 +1,17 @@ Class { - #name : #GtCoderUserNotUserSnippetState, + #name : #GtCoderNotUserSnippetState, #superclass : #GtCoderUserSnippetEvaluationState, #traits : 'TGtUniqueInstance', #classTraits : 'TGtUniqueInstance classTrait', #category : #'GToolkit-Coder-UI-Coder - Source Model' } +{ #category : #printing } +GtCoderNotUserSnippetState >> gtDisplayOn: stream [ + stream nextPutAll: 'No user snippet' +] + { #category : #accessing } -GtCoderUserNotUserSnippetState >> isUserSnippet [ +GtCoderNotUserSnippetState >> isUserSnippet [ ^ false ] diff --git a/src/GToolkit-Coder-UI/GtCoderUserSnippetDynamicVariable.class.st b/src/GToolkit-Coder-UI/GtCoderUserSnippetDynamicVariable.class.st index 268c2e969..4b4299927 100644 --- a/src/GToolkit-Coder-UI/GtCoderUserSnippetDynamicVariable.class.st +++ b/src/GToolkit-Coder-UI/GtCoderUserSnippetDynamicVariable.class.st @@ -16,7 +16,7 @@ GtCoderUserSnippetDynamicVariable class >> valueAtProcess: aProcess [ { #category : #accessing } GtCoderUserSnippetDynamicVariable >> default [ - ^ GtCoderUserNotUserSnippetState default + ^ GtCoderNotUserSnippetState default ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtCoderUserSnippetEvaluationExceptionState.class.st b/src/GToolkit-Coder-UI/GtCoderUserSnippetEvaluationExceptionState.class.st index 948cc9261..d23c9ab78 100644 --- a/src/GToolkit-Coder-UI/GtCoderUserSnippetEvaluationExceptionState.class.st +++ b/src/GToolkit-Coder-UI/GtCoderUserSnippetEvaluationExceptionState.class.st @@ -5,3 +5,8 @@ Class { #classTraits : 'TGtUniqueInstance classTrait', #category : #'GToolkit-Coder-UI-Coder - Source Model' } + +{ #category : #printing } +GtCoderUserSnippetEvaluationExceptionState >> gtDisplayOn: stream [ + stream nextPutAll: 'Snippet with exception' +] diff --git a/src/GToolkit-Coder-UI/GtCoderUserSnippetEvaluationRunningState.class.st b/src/GToolkit-Coder-UI/GtCoderUserSnippetEvaluationRunningState.class.st index 3eb270dbe..cfff18b1f 100644 --- a/src/GToolkit-Coder-UI/GtCoderUserSnippetEvaluationRunningState.class.st +++ b/src/GToolkit-Coder-UI/GtCoderUserSnippetEvaluationRunningState.class.st @@ -5,3 +5,8 @@ Class { #classTraits : 'TGtUniqueInstance classTrait', #category : #'GToolkit-Coder-UI-Coder - Source Model' } + +{ #category : #printing } +GtCoderUserSnippetEvaluationRunningState >> gtDisplayOn: stream [ + stream nextPutAll: 'Running snippet' +] From 883fac3ff8dfe47015ad57c258322fe7f7332137 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 30 Apr 2024 00:37:49 -0400 Subject: [PATCH 0612/1268] use `GtCoderModel astExtensionsPragma` --- src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 6e458e9ed..633e27e35 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -208,7 +208,7 @@ GtTextualCoderViewModel >> computeAddOns [ theAst := aCoderAst ast. pragmas := aCoderModel - pragmasNamed: #gtAstCoderAddOns: + pragmasNamed: GtCoderModel astExtensionsPragma inHierarchy: aCoderModel class. newAddOns := aCoderModel newAddOns. From b6c569573f1a38aa8eb556f2e6c1d791be22934d Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 30 Apr 2024 00:39:32 -0400 Subject: [PATCH 0613/1268] add `GtCoderDebugSessionEvaluationStatus` [feenkcom/gtoolkit#3735] --- ...CoderDebugSessionEvaluationStatus.class.st | 74 ++++++++++++++++++ .../GtCoderEvaluationStatus.class.st | 15 ++++ .../GtCoderNoEvaluationStatus.class.st | 7 ++ .../GtSourceCoderEditorElement.class.st | 18 +++++ .../GtSourceCoderViewModel.class.st | 75 ++++++++++++++++++- ...rViewModelEvaluationStatusChanged.class.st | 18 +++++ .../GtTextualCoderEditorElement.class.st | 34 ++++----- 7 files changed, 223 insertions(+), 18 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderDebugSessionEvaluationStatus.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderEvaluationStatus.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderNoEvaluationStatus.class.st create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderViewModelEvaluationStatusChanged.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderDebugSessionEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderDebugSessionEvaluationStatus.class.st new file mode 100644 index 000000000..658df3360 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderDebugSessionEvaluationStatus.class.st @@ -0,0 +1,74 @@ +Class { + #name : #GtCoderDebugSessionEvaluationStatus, + #superclass : #GtCoderEvaluationStatus, + #instVars : [ + 'debugSession', + 'exception', + 'sourceInterval', + 'sourceString', + 'sharedDebugSession' + ], + #category : #'GToolkit-Coder-UI-Coders - Evaluation' +} + +{ #category : #accessing } +GtCoderDebugSessionEvaluationStatus >> debugSession [ + ^ debugSession +] + +{ #category : #accessing } +GtCoderDebugSessionEvaluationStatus >> debugSession: anObject [ + debugSession := anObject +] + +{ #category : #accessing } +GtCoderDebugSessionEvaluationStatus >> exception [ + ^ exception +] + +{ #category : #accessing } +GtCoderDebugSessionEvaluationStatus >> exception: anObject [ + exception := anObject +] + +{ #category : #testing } +GtCoderDebugSessionEvaluationStatus >> hasSharedDebugSession [ + ^ true +] + +{ #category : #'api - hooks' } +GtCoderDebugSessionEvaluationStatus >> onSourceCoderElement: anElement [ + "This code must be called from a coder element (or moved to an element), listening to GtSourceCoderViewModelEvaluationStatusChanged." + anElement + showNotification: (GtNotificationDebugSession new debugSession: self sharedDebugSession) +] + +{ #category : #accessing } +GtCoderDebugSessionEvaluationStatus >> sharedDebugSession [ + ^ sharedDebugSession +] + +{ #category : #'private - announcement handling' } +GtCoderDebugSessionEvaluationStatus >> sharedDebugSession: aSharedDebugSession [ + sharedDebugSession := aSharedDebugSession +] + +{ #category : #accessing } +GtCoderDebugSessionEvaluationStatus >> sourceInterval [ + ^ sourceInterval +] + +{ #category : #accessing } +GtCoderDebugSessionEvaluationStatus >> sourceInterval: anObject [ + sourceInterval := anObject +] + +{ #category : #accessing } +GtCoderDebugSessionEvaluationStatus >> sourceString [ + ^ sourceString +] + +{ #category : #accessing } +GtCoderDebugSessionEvaluationStatus >> sourceString: anObject [ + sourceString := anObject +] diff --git a/src/GToolkit-Coder-UI/GtCoderEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderEvaluationStatus.class.st new file mode 100644 index 000000000..b2ba9f690 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderEvaluationStatus.class.st @@ -0,0 +1,15 @@ +Class { + #name : #GtCoderEvaluationStatus, + #superclass : #Object, + #category : #'GToolkit-Coder-UI-Coders - Evaluation' +} + +{ #category : #testing } +GtCoderEvaluationStatus >> hasSharedDebugSession [ + ^ false +] + +{ #category : #'api - hooks' } +GtCoderEvaluationStatus >> onSourceCoderElement: anElement [ + +] diff --git a/src/GToolkit-Coder-UI/GtCoderNoEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderNoEvaluationStatus.class.st new file mode 100644 index 000000000..cf47d7cdd --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderNoEvaluationStatus.class.st @@ -0,0 +1,7 @@ +Class { + #name : #GtCoderNoEvaluationStatus, + #superclass : #GtCoderEvaluationStatus, + #traits : 'TGtUniqueInstance', + #classTraits : 'TGtUniqueInstance classTrait', + #category : #'GToolkit-Coder-UI-Coders - Evaluation' +} diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st index cb484d8ee..5ff9fb349 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st @@ -12,3 +12,21 @@ GtSourceCoderEditorElement >> onTextualCoderViewModelChanged [ ifNil: [ evaluationHighlighter hideResult ] ifNotNil: [ :aResult | evaluationHighlighter displayResult: aResult ] ] + +{ #category : #registration } +GtSourceCoderEditorElement >> onViewModelEvaluationStatusChanged: anAnnouncement [ + BlTaskAction + enqueueElement: self + action: [ + anAnnouncement evaluationStatus onSourceCoderElement: self. + self styleText ] +] + +{ #category : #registration } +GtSourceCoderEditorElement >> registerCoderViewModelAnnouncementsFor: aGtSourceCoderUIModel [ + super registerCoderViewModelAnnouncementsFor: aGtSourceCoderUIModel. + aGtSourceCoderUIModel weak + when: GtSourceCoderViewModelEvaluationStatusChanged + send: #onViewModelEvaluationStatusChanged: + to: self +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st index c4248aca9..e73c094a0 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st @@ -2,7 +2,8 @@ Class { #name : #GtSourceCoderViewModel, #superclass : #GtTextualCoderViewModel, #instVars : [ - 'evaluationResult' + 'evaluationResult', + 'evaluationStatus' ], #category : #'GToolkit-Coder-UI-Coder - Source Model' } @@ -165,6 +166,20 @@ GtSourceCoderViewModel >> evaluationResult: anObject [ evaluationResult := anObject ] +{ #category : #accessing } +GtSourceCoderViewModel >> evaluationStatus [ + + ^ evaluationStatus + ifNil: [ evaluationStatus := GtCoderNoEvaluationStatus default ] +] + +{ #category : #'api - accessing' } +GtSourceCoderViewModel >> evaluationStatus: aStatus [ + evaluationStatus = aStatus ifTrue: [ ^ self ]. + evaluationStatus := aStatus. + self onEvaluationStatusChanged +] + { #category : #'private - event handling' } GtSourceCoderViewModel >> handleCoderEvaluationUnhandledErrorDuring: aBlock [ ^ [ GtCoderUserSnippetDynamicVariable @@ -187,6 +202,54 @@ GtSourceCoderViewModel >> notifyCoderEvaluationUnhandledError: anError inProcess exception: anError) ] +{ #category : #'private - notifying' } +GtSourceCoderViewModel >> notifyEvaluationStatusChanged [ + self + announce: (GtSourceCoderViewModelEvaluationStatusChanged new + textualCoderViewModel: self; + evaluationStatus: self evaluationStatus) +] + +{ #category : #'private - announcement handling' } +GtSourceCoderViewModel >> onDebugSessionDebuggedAnnouncement: anAnnouncement [ + anAnnouncement session unsubscribe: self. + self evaluationStatus: GtCoderNoEvaluationStatus default +] + +{ #category : #'private - announcement handling' } +GtSourceCoderViewModel >> onDebugSessionTerminatedAnnouncement: anAnnouncement [ + anAnnouncement session unsubscribe: self. + self evaluationStatus: GtCoderNoEvaluationStatus default +] + +{ #category : #'private - hooks' } +GtSourceCoderViewModel >> onEvaluationStatusChanged [ + self notifyEvaluationStatusChanged. +] + +{ #category : #'private - announcement handling' } +GtSourceCoderViewModel >> onShowDebuggerRequest: anAnnouncement [ + | aSharedDebugSession aStatus | + aSharedDebugSession := GtSharedDebugSession new + session: anAnnouncement debugSession. + aStatus := GtCoderDebugSessionEvaluationStatus new + debugSession: anAnnouncement debugSession; + sharedDebugSession: aSharedDebugSession; + exception: anAnnouncement exception; + sourceInterval: anAnnouncement sourceInterval; + sourceString: anAnnouncement sourceString. + + aSharedDebugSession weak + when: GtSharedDebugSessionDebuggedAnnouncement + send: #onDebugSessionDebuggedAnnouncement: + to: self; + when: GtSharedDebugSessionTerminatedAnnouncement + send: #onDebugSessionTerminatedAnnouncement: + to: self. + + self evaluationStatus: aStatus +] + { #category : #'api - actions' } GtSourceCoderViewModel >> printIt [ "Evaluate selected source code or everything if there is nothing selected and print the result" @@ -243,3 +306,13 @@ GtSourceCoderViewModel >> selectedTextInterval [ anInterval := eachMonotoneSelection from + 1 to: eachMonotoneSelection to ]. ^ anInterval ] + +{ #category : #'api - coder model' } +GtSourceCoderViewModel >> subscribeToCoderModel [ + super subscribeToCoderModel. + + self coderModel weak + when: GtCoderShowDebuggerRequest + send: #onShowDebuggerRequest: + to: self +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderViewModelEvaluationStatusChanged.class.st b/src/GToolkit-Coder-UI/GtSourceCoderViewModelEvaluationStatusChanged.class.st new file mode 100644 index 000000000..269889cd2 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderViewModelEvaluationStatusChanged.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtSourceCoderViewModelEvaluationStatusChanged, + #superclass : #GtTextualCoderViewModelAnnouncement, + #instVars : [ + 'evaluationStatus' + ], + #category : #'GToolkit-Coder-UI-Coder - Source Model' +} + +{ #category : #accessing } +GtSourceCoderViewModelEvaluationStatusChanged >> evaluationStatus [ + ^ evaluationStatus +] + +{ #category : #accessing } +GtSourceCoderViewModelEvaluationStatusChanged >> evaluationStatus: anObject [ + evaluationStatus := anObject +] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 066af9c8e..5d12119fd 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -253,24 +253,27 @@ GtTextualCoderEditorElement >> onRemovedFromSceneGraph [ { #category : #'private - event handling' } GtTextualCoderEditorElement >> onShowDebuggerRequest: aShowDebuggerAnnouncement [ | sharedDebugSession anEvaluatedSource anEvaluatedInterval theSourceStartInText theSourceEndInText | + self flag: #delete. evaluationHighlighter hideResult. evaluationPrinter hideResult. - sharedDebugSession := GtSharedDebugSession new session: aShowDebuggerAnnouncement debugSession. - self showNotification: (GtNotificationDebugSession new debugSession: sharedDebugSession). + true ifTrue: [ ^ self ]. + sharedDebugSession := GtSharedDebugSession new + session: aShowDebuggerAnnouncement debugSession. + self + showNotification: (GtNotificationDebugSession new debugSession: sharedDebugSession). anEvaluatedSource := aShowDebuggerAnnouncement sourceString. anEvaluatedInterval := aShowDebuggerAnnouncement sourceInterval. - theSourceStartInText := (self text finder) - caseSensitiveSubstring: anEvaluatedSource; - startAtPosition: anEvaluatedInterval first; - searchClosest. - - "what did we evaluate?" + theSourceStartInText := self text finder + caseSensitiveSubstring: anEvaluatedSource; + startAtPosition: anEvaluatedInterval first; + searchClosest. "what did we evaluate?" theSourceStartInText isZero ifTrue: [ ^ self ]. - theSourceEndInText := theSourceStartInText + anEvaluatedSource size - 1 min: self text size. - self text clearAttributes: [ :each | {GtEmbeddedDebuggerAttribute} anySatisfy: [ :cls | each isKindOf: cls ] ]. + theSourceEndInText := theSourceStartInText + anEvaluatedSource size - 1 + min: self text size. + self text + clearAttributes: [ :each | {GtEmbeddedDebuggerAttribute} anySatisfy: [ :cls | each isKindOf: cls ] ]. self text - attribute: - ((GtEmbeddedDebuggerAttribute new) + attribute: (GtEmbeddedDebuggerAttribute new signaledException: aShowDebuggerAnnouncement exception; debugSession: sharedDebugSession) from: theSourceEndInText @@ -510,10 +513,7 @@ GtTextualCoderEditorElement >> registerCoderModelAnnouncementsFor: aCoderModel [ when: GtCoderEvaluationAnnouncement send: #onCodeEvaluated: to: self; - when: GtCoderPrintAnnouncement send: #onPrintRequest: to: self; - when: GtCoderShowDebuggerRequest - send: #onShowDebuggerRequest: - to: self + when: GtCoderPrintAnnouncement send: #onPrintRequest: to: self ] { #category : #registration } @@ -551,7 +551,7 @@ GtTextualCoderEditorElement >> registerCoderViewModelAnnouncementsFor: aGtSource to: self; when: GtTextualCoderViewModelStyledTextChanged send: #onViewModelStyledTextChanged: - to: self. + to: self ] { #category : #private } From a02e16f3cda5d655e5be393a0d7842ce5760b9c8 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 30 Apr 2024 10:08:06 -0400 Subject: [PATCH 0614/1268] add `GtCoderDebuggerSpaceFinder` [feenkcom/gtoolkit#3735] --- ...CoderDebugSessionEvaluationStatus.class.st | 5 ++ .../GtCoderDebuggerSpaceFinder.class.st | 49 +++++++++++++++++++ .../GtCoderEvaluationStatus.class.st | 11 +++++ .../GtCoderNoEvaluationStatus.class.st | 5 ++ .../GtSourceCoderActionsElement.class.st | 20 +++----- 5 files changed, 77 insertions(+), 13 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderDebuggerSpaceFinder.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderDebugSessionEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderDebugSessionEvaluationStatus.class.st index 658df3360..59a126862 100644 --- a/src/GToolkit-Coder-UI/GtCoderDebugSessionEvaluationStatus.class.st +++ b/src/GToolkit-Coder-UI/GtCoderDebugSessionEvaluationStatus.class.st @@ -1,3 +1,8 @@ +" +I am a {{gtClass:GtCoderEvaluationStatus}}. +I represent an evaluation status for a source code that was was executed and resulted to an unhandled exception. + +" Class { #name : #GtCoderDebugSessionEvaluationStatus, #superclass : #GtCoderEvaluationStatus, diff --git a/src/GToolkit-Coder-UI/GtCoderDebuggerSpaceFinder.class.st b/src/GToolkit-Coder-UI/GtCoderDebuggerSpaceFinder.class.st new file mode 100644 index 000000000..0e085c969 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderDebuggerSpaceFinder.class.st @@ -0,0 +1,49 @@ +" +I find a {{gtClass:BlSpace}} in which a {{gtClass:GtMoldableDebugger}} for a given {{gtClass:Process}} is opened. +Main methods: +- {{gtMethod:GtCoderDebuggerSpaceFinder >> #process: | label=#selector}} sets the {{gtClass:Process}} for which a corresponding {{gtClass:BlSpace}} should be found, +- {{gtMethod:GtCoderDebuggerSpaceFinder >> #find | label=#selector}} searches the corresponding {{gtClass:BlSpace}}, +- {{gtMethod:GtCoderDebuggerSpaceFinder >> #space | label=#selector}} returns the found {{gtClass:BlSpace}} or `nil`. + +" +Class { + #name : #GtCoderDebuggerSpaceFinder, + #superclass : #Object, + #instVars : [ + 'process', + 'space' + ], + #category : #'GToolkit-Coder-UI-Coders - Evaluation' +} + +{ #category : #finding } +GtCoderDebuggerSpaceFinder >> find [ + + BlParallelUniverse all + do: [ :eachUniverse | + eachUniverse spaces + do: [ :eachSpace | + | aQuery | + aQuery := eachSpace root query // GtMoldableDebugger. + aQuery isEmpty + ifFalse: [ aQuery anyOne debugSession interruptedProcess == process + ifTrue: [ ^ space := eachSpace ] ] ] ]. + + ^ space +] + +{ #category : #accessing } +GtCoderDebuggerSpaceFinder >> process [ + ^ process +] + +{ #category : #accessing } +GtCoderDebuggerSpaceFinder >> process: anObject [ + process := anObject +] + +{ #category : #accessing } +GtCoderDebuggerSpaceFinder >> space [ + + ^ space +] diff --git a/src/GToolkit-Coder-UI/GtCoderEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderEvaluationStatus.class.st index b2ba9f690..724edd6ff 100644 --- a/src/GToolkit-Coder-UI/GtCoderEvaluationStatus.class.st +++ b/src/GToolkit-Coder-UI/GtCoderEvaluationStatus.class.st @@ -1,9 +1,20 @@ +" +I represent an evaluation status of a source code. +I am used by {{gtClass:GtSourceCoderViewModel}}. +I am an abstract class. +See my subclasses for concrete evaluation statuses: {{gtClass:GtCoderEvaluationStatus | expanded=true | show=#gtSubclassesFor:}} +" Class { #name : #GtCoderEvaluationStatus, #superclass : #Object, #category : #'GToolkit-Coder-UI-Coders - Evaluation' } +{ #category : #testing } +GtCoderEvaluationStatus class >> isAbstract [ + ^ self name = #GtCoderEvaluationStatus +] + { #category : #testing } GtCoderEvaluationStatus >> hasSharedDebugSession [ ^ false diff --git a/src/GToolkit-Coder-UI/GtCoderNoEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderNoEvaluationStatus.class.st index cf47d7cdd..226f149ab 100644 --- a/src/GToolkit-Coder-UI/GtCoderNoEvaluationStatus.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNoEvaluationStatus.class.st @@ -1,3 +1,8 @@ +" +I am a {{gtClass:GtCoderEvaluationStatus}}. +I represent an evaluation status for a source code that was not executed. + +" Class { #name : #GtCoderNoEvaluationStatus, #superclass : #GtCoderEvaluationStatus, diff --git a/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st index f86a7a9d6..c126e9bcd 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st @@ -148,22 +148,16 @@ GtSourceCoderActionsElement >> updateContextToolbar [ { #category : #'private - updating' } GtSourceCoderActionsElement >> updateDebuggerIndicatorForProcess: aProcess [ | aSpace | - aSpace := nil. - BlParallelUniverse all - do: [ :eachUniverse | - eachUniverse spaces - do: [ :eachSpace | - | aQuery | - aQuery := eachSpace root query // GtMoldableDebugger. - aQuery isEmpty - ifFalse: [ aQuery anyOne debugSession interruptedProcess == aProcess - ifTrue: [ aSpace := eachSpace ] ] ] ]. - - GtSourceCoderProcessInDebuggerSignal new + aSpace := GtCoderDebuggerSpaceFinder new + process: aProcess; + find; + space. + + GtSourceCoderProcessInDebuggerSignal new process: aProcess; space: aSpace; emit. - + aSpace ifNil: [ ^ self ]. self textualCoderViewModel addLocateDebuggerInSpaceAction: aSpace ] From 8651937f6e967824834c7537d4e174a1cb3267b0 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 30 Apr 2024 16:44:27 -0400 Subject: [PATCH 0615/1268] add `GtCoderDebugSessionInSpaceEvaluationStatus` [feenkcom/gtoolkit#3735] --- ...CoderDebugSessionEvaluationStatus.class.st | 79 ----------------- ...bugSessionInSpaceEvaluationStatus.class.st | 70 +++++++++++++++ .../GtCoderDebugSessionMatcher.class.st | 23 +++++ ...DebuggerInterruptedProcessMatcher.class.st | 23 +++++ .../GtCoderDebuggerMatcher.class.st | 10 +++ .../GtCoderDebuggerSpaceFinder.class.st | 22 +++-- ...eddedDebugSessionEvaluationStatus.class.st | 88 +++++++++++++++++++ .../GtCoderEvaluationStatus.class.st | 10 +++ .../GtSourceCoderViewModel.class.st | 7 +- 9 files changed, 243 insertions(+), 89 deletions(-) delete mode 100644 src/GToolkit-Coder-UI/GtCoderDebugSessionEvaluationStatus.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderDebugSessionInSpaceEvaluationStatus.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderDebugSessionMatcher.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderDebuggerInterruptedProcessMatcher.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderDebuggerMatcher.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderDebugSessionEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderDebugSessionEvaluationStatus.class.st deleted file mode 100644 index 59a126862..000000000 --- a/src/GToolkit-Coder-UI/GtCoderDebugSessionEvaluationStatus.class.st +++ /dev/null @@ -1,79 +0,0 @@ -" -I am a {{gtClass:GtCoderEvaluationStatus}}. -I represent an evaluation status for a source code that was was executed and resulted to an unhandled exception. - -" -Class { - #name : #GtCoderDebugSessionEvaluationStatus, - #superclass : #GtCoderEvaluationStatus, - #instVars : [ - 'debugSession', - 'exception', - 'sourceInterval', - 'sourceString', - 'sharedDebugSession' - ], - #category : #'GToolkit-Coder-UI-Coders - Evaluation' -} - -{ #category : #accessing } -GtCoderDebugSessionEvaluationStatus >> debugSession [ - ^ debugSession -] - -{ #category : #accessing } -GtCoderDebugSessionEvaluationStatus >> debugSession: anObject [ - debugSession := anObject -] - -{ #category : #accessing } -GtCoderDebugSessionEvaluationStatus >> exception [ - ^ exception -] - -{ #category : #accessing } -GtCoderDebugSessionEvaluationStatus >> exception: anObject [ - exception := anObject -] - -{ #category : #testing } -GtCoderDebugSessionEvaluationStatus >> hasSharedDebugSession [ - ^ true -] - -{ #category : #'api - hooks' } -GtCoderDebugSessionEvaluationStatus >> onSourceCoderElement: anElement [ - "This code must be called from a coder element (or moved to an element), listening to GtSourceCoderViewModelEvaluationStatusChanged." - anElement - showNotification: (GtNotificationDebugSession new debugSession: self sharedDebugSession) -] - -{ #category : #accessing } -GtCoderDebugSessionEvaluationStatus >> sharedDebugSession [ - ^ sharedDebugSession -] - -{ #category : #'private - announcement handling' } -GtCoderDebugSessionEvaluationStatus >> sharedDebugSession: aSharedDebugSession [ - sharedDebugSession := aSharedDebugSession -] - -{ #category : #accessing } -GtCoderDebugSessionEvaluationStatus >> sourceInterval [ - ^ sourceInterval -] - -{ #category : #accessing } -GtCoderDebugSessionEvaluationStatus >> sourceInterval: anObject [ - sourceInterval := anObject -] - -{ #category : #accessing } -GtCoderDebugSessionEvaluationStatus >> sourceString [ - ^ sourceString -] - -{ #category : #accessing } -GtCoderDebugSessionEvaluationStatus >> sourceString: anObject [ - sourceString := anObject -] diff --git a/src/GToolkit-Coder-UI/GtCoderDebugSessionInSpaceEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderDebugSessionInSpaceEvaluationStatus.class.st new file mode 100644 index 000000000..1c2067750 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderDebugSessionInSpaceEvaluationStatus.class.st @@ -0,0 +1,70 @@ +" +I am a {{gtClass:GtCoderEvaluationStatus}}. +I represent an evaluation status for a source code that was executed and resulted to an unhandled exception. +The corresponding process is opened in a debugger. +" +Class { + #name : #GtCoderDebugSessionInSpaceEvaluationStatus, + #superclass : #GtCoderEvaluationStatus, + #instVars : [ + 'debugSession', + 'debugger', + 'sourceInterval', + 'sourceString' + ], + #category : #'GToolkit-Coder-UI-Coders - Evaluation' +} + +{ #category : #converting } +GtCoderDebugSessionInSpaceEvaluationStatus >> asDebugSessionInSpaceEvaluationStatusFromAnnouncement: anAnnouncement [ + ^ GtCoderDebugSessionInSpaceEvaluationStatus new + debugSession: anAnnouncement releasedSession; + debugger: anAnnouncement debugger; + sourceInterval: self sourceInterval; + sourceString: self sourceString +] + +{ #category : #accessing } +GtCoderDebugSessionInSpaceEvaluationStatus >> debugSession [ + ^ debugSession +] + +{ #category : #accessing } +GtCoderDebugSessionInSpaceEvaluationStatus >> debugSession: anObject [ + debugSession := anObject +] + +{ #category : #accessing } +GtCoderDebugSessionInSpaceEvaluationStatus >> debugger [ + ^ debugger +] + +{ #category : #accessing } +GtCoderDebugSessionInSpaceEvaluationStatus >> debugger: anObject [ + debugger := anObject +] + +{ #category : #testing } +GtCoderDebugSessionInSpaceEvaluationStatus >> hasDebugSessionInSpace [ + ^ true +] + +{ #category : #accessing } +GtCoderDebugSessionInSpaceEvaluationStatus >> sourceInterval [ + ^ sourceInterval +] + +{ #category : #accessing } +GtCoderDebugSessionInSpaceEvaluationStatus >> sourceInterval: anObject [ + sourceInterval := anObject +] + +{ #category : #accessing } +GtCoderDebugSessionInSpaceEvaluationStatus >> sourceString [ + ^ sourceString +] + +{ #category : #accessing } +GtCoderDebugSessionInSpaceEvaluationStatus >> sourceString: anObject [ + sourceString := anObject +] diff --git a/src/GToolkit-Coder-UI/GtCoderDebugSessionMatcher.class.st b/src/GToolkit-Coder-UI/GtCoderDebugSessionMatcher.class.st new file mode 100644 index 000000000..88a1e8dc4 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderDebugSessionMatcher.class.st @@ -0,0 +1,23 @@ +Class { + #name : #GtCoderDebugSessionMatcher, + #superclass : #GtCoderDebuggerMatcher, + #instVars : [ + 'debugSession' + ], + #category : #'GToolkit-Coder-UI-Coders - Evaluation' +} + +{ #category : #accessing } +GtCoderDebugSessionMatcher >> debugSession [ + ^ debugSession +] + +{ #category : #accessing } +GtCoderDebugSessionMatcher >> debugSession: anObject [ + debugSession := anObject +] + +{ #category : #testing } +GtCoderDebugSessionMatcher >> isMoldableDebugger: anElement [ + ^ anElement debugSession interruptedProcess == debugSession interruptedProcess +] diff --git a/src/GToolkit-Coder-UI/GtCoderDebuggerInterruptedProcessMatcher.class.st b/src/GToolkit-Coder-UI/GtCoderDebuggerInterruptedProcessMatcher.class.st new file mode 100644 index 000000000..5e069787d --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderDebuggerInterruptedProcessMatcher.class.st @@ -0,0 +1,23 @@ +Class { + #name : #GtCoderDebuggerInterruptedProcessMatcher, + #superclass : #GtCoderDebuggerMatcher, + #instVars : [ + 'process' + ], + #category : #'GToolkit-Coder-UI-Coders - Evaluation' +} + +{ #category : #testing } +GtCoderDebuggerInterruptedProcessMatcher >> isMoldableDebugger: anElement [ + ^ anElement debugSession interruptedProcess == process +] + +{ #category : #accessing } +GtCoderDebuggerInterruptedProcessMatcher >> process [ + ^ process +] + +{ #category : #accessing } +GtCoderDebuggerInterruptedProcessMatcher >> process: anObject [ + process := anObject +] diff --git a/src/GToolkit-Coder-UI/GtCoderDebuggerMatcher.class.st b/src/GToolkit-Coder-UI/GtCoderDebuggerMatcher.class.st new file mode 100644 index 000000000..b2291f2ed --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderDebuggerMatcher.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtCoderDebuggerMatcher, + #superclass : #Object, + #category : #'GToolkit-Coder-UI-Coders - Evaluation' +} + +{ #category : #testing } +GtCoderDebuggerMatcher >> isMoldableDebugger: anElement [ + ^ false +] diff --git a/src/GToolkit-Coder-UI/GtCoderDebuggerSpaceFinder.class.st b/src/GToolkit-Coder-UI/GtCoderDebuggerSpaceFinder.class.st index 0e085c969..fa0becf51 100644 --- a/src/GToolkit-Coder-UI/GtCoderDebuggerSpaceFinder.class.st +++ b/src/GToolkit-Coder-UI/GtCoderDebuggerSpaceFinder.class.st @@ -10,12 +10,17 @@ Class { #name : #GtCoderDebuggerSpaceFinder, #superclass : #Object, #instVars : [ - 'process', - 'space' + 'space', + 'debuggerMatcher' ], #category : #'GToolkit-Coder-UI-Coders - Evaluation' } +{ #category : #accessing } +GtCoderDebuggerSpaceFinder >> debugSession: aDebugSession [ + debuggerMatcher := GtCoderDebugSessionMatcher new debugSession: aDebugSession +] + { #category : #finding } GtCoderDebuggerSpaceFinder >> find [ @@ -26,20 +31,21 @@ GtCoderDebuggerSpaceFinder >> find [ | aQuery | aQuery := eachSpace root query // GtMoldableDebugger. aQuery isEmpty - ifFalse: [ aQuery anyOne debugSession interruptedProcess == process + ifFalse: [ (debuggerMatcher isMoldableDebugger: aQuery anyOne) ifTrue: [ ^ space := eachSpace ] ] ] ]. ^ space ] -{ #category : #accessing } -GtCoderDebuggerSpaceFinder >> process [ - ^ process +{ #category : #initialization } +GtCoderDebuggerSpaceFinder >> initialize [ + super initialize. + debuggerMatcher := GtCoderDebuggerMatcher new ] { #category : #accessing } -GtCoderDebuggerSpaceFinder >> process: anObject [ - process := anObject +GtCoderDebuggerSpaceFinder >> process: aProcess [ + debuggerMatcher := GtCoderDebuggerInterruptedProcessMatcher new process: aProcess ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st new file mode 100644 index 000000000..da9a5493d --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st @@ -0,0 +1,88 @@ +" +I am a {{gtClass:GtCoderEvaluationStatus}}. +I represent an evaluation status for a source code that was executed and resulted to an unhandled exception. The corresponding process is suspended and waiting for a user action, e.g., opening in a debugger. + +" +Class { + #name : #GtCoderEmbeddedDebugSessionEvaluationStatus, + #superclass : #GtCoderEvaluationStatus, + #instVars : [ + 'debugSession', + 'exception', + 'sourceInterval', + 'sourceString', + 'sharedDebugSession' + ], + #category : #'GToolkit-Coder-UI-Coders - Evaluation' +} + +{ #category : #converting } +GtCoderEmbeddedDebugSessionEvaluationStatus >> asDebugSessionInSpaceEvaluationStatusFromAnnouncement: anAnnouncement [ + ^ GtCoderDebugSessionInSpaceEvaluationStatus new + debugSession: anAnnouncement releasedSession; + debugger: anAnnouncement debugger; + sourceInterval: self sourceInterval; + sourceString: self sourceString +] + +{ #category : #accessing } +GtCoderEmbeddedDebugSessionEvaluationStatus >> debugSession [ + ^ debugSession +] + +{ #category : #accessing } +GtCoderEmbeddedDebugSessionEvaluationStatus >> debugSession: anObject [ + debugSession := anObject +] + +{ #category : #accessing } +GtCoderEmbeddedDebugSessionEvaluationStatus >> exception [ + ^ exception +] + +{ #category : #accessing } +GtCoderEmbeddedDebugSessionEvaluationStatus >> exception: anObject [ + exception := anObject +] + +{ #category : #testing } +GtCoderEmbeddedDebugSessionEvaluationStatus >> hasSharedDebugSession [ + ^ true +] + +{ #category : #'api - hooks' } +GtCoderEmbeddedDebugSessionEvaluationStatus >> onSourceCoderElement: anElement [ + "This code must be called from a coder element (or moved to an element), listening to GtSourceCoderViewModelEvaluationStatusChanged." + anElement + showNotification: (GtNotificationDebugSession new debugSession: self sharedDebugSession) +] + +{ #category : #accessing } +GtCoderEmbeddedDebugSessionEvaluationStatus >> sharedDebugSession [ + ^ sharedDebugSession +] + +{ #category : #'private - announcement handling' } +GtCoderEmbeddedDebugSessionEvaluationStatus >> sharedDebugSession: aSharedDebugSession [ + sharedDebugSession := aSharedDebugSession +] + +{ #category : #accessing } +GtCoderEmbeddedDebugSessionEvaluationStatus >> sourceInterval [ + ^ sourceInterval +] + +{ #category : #accessing } +GtCoderEmbeddedDebugSessionEvaluationStatus >> sourceInterval: anObject [ + sourceInterval := anObject +] + +{ #category : #accessing } +GtCoderEmbeddedDebugSessionEvaluationStatus >> sourceString [ + ^ sourceString +] + +{ #category : #accessing } +GtCoderEmbeddedDebugSessionEvaluationStatus >> sourceString: anObject [ + sourceString := anObject +] diff --git a/src/GToolkit-Coder-UI/GtCoderEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderEvaluationStatus.class.st index 724edd6ff..bbb4eb99e 100644 --- a/src/GToolkit-Coder-UI/GtCoderEvaluationStatus.class.st +++ b/src/GToolkit-Coder-UI/GtCoderEvaluationStatus.class.st @@ -15,6 +15,16 @@ GtCoderEvaluationStatus class >> isAbstract [ ^ self name = #GtCoderEvaluationStatus ] +{ #category : #converting } +GtCoderEvaluationStatus >> asDebugSessionInSpaceEvaluationStatusFromAnnouncement: anAnnouncement [ + ^ GtCoderNoEvaluationStatus default +] + +{ #category : #testing } +GtCoderEvaluationStatus >> hasDebugSessionInSpace [ + ^ false +] + { #category : #testing } GtCoderEvaluationStatus >> hasSharedDebugSession [ ^ false diff --git a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st index e73c094a0..05163c69f 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st @@ -212,8 +212,11 @@ GtSourceCoderViewModel >> notifyEvaluationStatusChanged [ { #category : #'private - announcement handling' } GtSourceCoderViewModel >> onDebugSessionDebuggedAnnouncement: anAnnouncement [ + | aStatus | anAnnouncement session unsubscribe: self. - self evaluationStatus: GtCoderNoEvaluationStatus default + aStatus := self evaluationStatus + asDebugSessionInSpaceEvaluationStatusFromAnnouncement: anAnnouncement. + self evaluationStatus: aStatus ] { #category : #'private - announcement handling' } @@ -232,7 +235,7 @@ GtSourceCoderViewModel >> onShowDebuggerRequest: anAnnouncement [ | aSharedDebugSession aStatus | aSharedDebugSession := GtSharedDebugSession new session: anAnnouncement debugSession. - aStatus := GtCoderDebugSessionEvaluationStatus new + aStatus := GtCoderEmbeddedDebugSessionEvaluationStatus new debugSession: anAnnouncement debugSession; sharedDebugSession: aSharedDebugSession; exception: anAnnouncement exception; From e5e49872eb37641293398b7b955f4a8bf5ba948f Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 30 Apr 2024 17:09:03 -0400 Subject: [PATCH 0616/1268] embedded debugger: close debugger on snippet code changes [feenkcom/gtoolkit#3735] --- ...bugSessionInSpaceEvaluationStatus.class.st | 5 ++++ ...eddedDebugSessionEvaluationStatus.class.st | 5 ++++ .../GtCoderEvaluationStatus.class.st | 13 +++++++++++ .../GtCoderNoEvaluationStatus.class.st | 10 ++++++++ .../GtSourceCoderViewModel.class.st | 23 ++++++++++++++++++- 5 files changed, 55 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderDebugSessionInSpaceEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderDebugSessionInSpaceEvaluationStatus.class.st index 1c2067750..dda5a1f5b 100644 --- a/src/GToolkit-Coder-UI/GtCoderDebugSessionInSpaceEvaluationStatus.class.st +++ b/src/GToolkit-Coder-UI/GtCoderDebugSessionInSpaceEvaluationStatus.class.st @@ -49,6 +49,11 @@ GtCoderDebugSessionInSpaceEvaluationStatus >> hasDebugSessionInSpace [ ^ true ] +{ #category : #'api - hooks' } +GtCoderDebugSessionInSpaceEvaluationStatus >> onSourceCoderViewModel: aViewModel aboutToChangeToStatus: aNewStatus [ + aNewStatus mayTerminateDebugSession: self debugSession +] + { #category : #accessing } GtCoderDebugSessionInSpaceEvaluationStatus >> sourceInterval [ ^ sourceInterval diff --git a/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st index da9a5493d..e23dd16e0 100644 --- a/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st +++ b/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st @@ -57,6 +57,11 @@ GtCoderEmbeddedDebugSessionEvaluationStatus >> onSourceCoderElement: anElement [ showNotification: (GtNotificationDebugSession new debugSession: self sharedDebugSession) ] +{ #category : #'api - hooks' } +GtCoderEmbeddedDebugSessionEvaluationStatus >> onSourceCoderViewModel: aViewModel aboutToChangeToStatus: aNewStatus [ + aNewStatus mayTerminateSharedDebugSession: self sharedDebugSession +] + { #category : #accessing } GtCoderEmbeddedDebugSessionEvaluationStatus >> sharedDebugSession [ ^ sharedDebugSession diff --git a/src/GToolkit-Coder-UI/GtCoderEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderEvaluationStatus.class.st index bbb4eb99e..d780faee5 100644 --- a/src/GToolkit-Coder-UI/GtCoderEvaluationStatus.class.st +++ b/src/GToolkit-Coder-UI/GtCoderEvaluationStatus.class.st @@ -30,7 +30,20 @@ GtCoderEvaluationStatus >> hasSharedDebugSession [ ^ false ] +{ #category : #'api - hooks' } +GtCoderEvaluationStatus >> mayTerminateDebugSession: aDebugSession [ +] + +{ #category : #'api - hooks' } +GtCoderEvaluationStatus >> mayTerminateSharedDebugSession: aSharedDebugSession [ +] + { #category : #'api - hooks' } GtCoderEvaluationStatus >> onSourceCoderElement: anElement [ ] + +{ #category : #'api - hooks' } +GtCoderEvaluationStatus >> onSourceCoderViewModel: aViewModel aboutToChangeToStatus: aNewStatus [ + +] diff --git a/src/GToolkit-Coder-UI/GtCoderNoEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderNoEvaluationStatus.class.st index 226f149ab..9c805c2aa 100644 --- a/src/GToolkit-Coder-UI/GtCoderNoEvaluationStatus.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNoEvaluationStatus.class.st @@ -10,3 +10,13 @@ Class { #classTraits : 'TGtUniqueInstance classTrait', #category : #'GToolkit-Coder-UI-Coders - Evaluation' } + +{ #category : #'api - hooks' } +GtCoderNoEvaluationStatus >> mayTerminateDebugSession: aDebugSession [ + aDebugSession terminate +] + +{ #category : #'api - hooks' } +GtCoderNoEvaluationStatus >> mayTerminateSharedDebugSession: aSharedDebugSession [ + aSharedDebugSession terminate +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st index 05163c69f..a4b906970 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st @@ -170,12 +170,15 @@ GtSourceCoderViewModel >> evaluationResult: anObject [ GtSourceCoderViewModel >> evaluationStatus [ ^ evaluationStatus - ifNil: [ evaluationStatus := GtCoderNoEvaluationStatus default ] ] { #category : #'api - accessing' } GtSourceCoderViewModel >> evaluationStatus: aStatus [ evaluationStatus = aStatus ifTrue: [ ^ self ]. + evaluationStatus ifNotNil: [ :oldStatus | + oldStatus + onSourceCoderViewModel: self + aboutToChangeToStatus: aStatus ]. evaluationStatus := aStatus. self onEvaluationStatusChanged ] @@ -194,6 +197,12 @@ GtSourceCoderViewModel >> handleCoderEvaluationUnhandledErrorDuring: aBlock [ anError pass ] ] +{ #category : #initialization } +GtSourceCoderViewModel >> initialize [ + super initialize. + evaluationStatus := GtCoderNoEvaluationStatus default +] + { #category : #'private - notifying' } GtSourceCoderViewModel >> notifyCoderEvaluationUnhandledError: anError inProcess: aProcess [ self @@ -253,6 +262,18 @@ GtSourceCoderViewModel >> onShowDebuggerRequest: anAnnouncement [ self evaluationStatus: aStatus ] +{ #category : #'private - event handling' } +GtSourceCoderViewModel >> onSourceCodeChanged: anSourceCodeChangedAnnouncement [ + super onSourceCodeChanged: anSourceCodeChangedAnnouncement. + self evaluationStatus: GtCoderNoEvaluationStatus default +] + +{ #category : #'private - event handling' } +GtSourceCoderViewModel >> onSourceCodeReplaced: aSourceCodeReplacedAnnouncement [ + super onSourceCodeReplaced: aSourceCodeReplacedAnnouncement. + self evaluationStatus: GtCoderNoEvaluationStatus default +] + { #category : #'api - actions' } GtSourceCoderViewModel >> printIt [ "Evaluate selected source code or everything if there is nothing selected and print the result" From 6ae4bb625e5446fbef2627351b08d2fcb64b6c2a Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 1 May 2024 20:07:32 -0400 Subject: [PATCH 0617/1268] code cleaning [feenkcom/gtoolkit#3735] - image still gets frozen on text edit while embedded debugger element --- ...ebugSessionInSpaceEvaluationStatus.class.st | 18 ++++++++++++++++-- ...beddedDebugSessionEvaluationStatus.class.st | 4 ++-- .../GtCoderEvaluationStatus.class.st | 6 +++--- .../GtCoderNoEvaluationStatus.class.st | 8 ++++---- .../GtSourceCoderViewModel.class.st | 7 +++---- 5 files changed, 28 insertions(+), 15 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderDebugSessionInSpaceEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderDebugSessionInSpaceEvaluationStatus.class.st index dda5a1f5b..893ddaed2 100644 --- a/src/GToolkit-Coder-UI/GtCoderDebugSessionInSpaceEvaluationStatus.class.st +++ b/src/GToolkit-Coder-UI/GtCoderDebugSessionInSpaceEvaluationStatus.class.st @@ -44,14 +44,28 @@ GtCoderDebugSessionInSpaceEvaluationStatus >> debugger: anObject [ debugger := anObject ] +{ #category : #accessing } +GtCoderDebugSessionInSpaceEvaluationStatus >> debuggerSpace [ + + ^ GtCoderDebuggerSpaceFinder new + debugSession: self debugSession; + find; + space +] + { #category : #testing } GtCoderDebugSessionInSpaceEvaluationStatus >> hasDebugSessionInSpace [ ^ true ] { #category : #'api - hooks' } -GtCoderDebugSessionInSpaceEvaluationStatus >> onSourceCoderViewModel: aViewModel aboutToChangeToStatus: aNewStatus [ - aNewStatus mayTerminateDebugSession: self debugSession +GtCoderDebugSessionInSpaceEvaluationStatus >> onSourceCoderViewModel: aViewModel changedToStatus: aNewStatus [ + aNewStatus mayCloseDebuggerOfStatus: self +] + +{ #category : #actions } +GtCoderDebugSessionInSpaceEvaluationStatus >> requestDebuggerSpaceClose [ + ^ self debuggerSpace ifNotNil: #requestClose ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st index e23dd16e0..574f3deed 100644 --- a/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st +++ b/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st @@ -58,8 +58,8 @@ GtCoderEmbeddedDebugSessionEvaluationStatus >> onSourceCoderElement: anElement [ ] { #category : #'api - hooks' } -GtCoderEmbeddedDebugSessionEvaluationStatus >> onSourceCoderViewModel: aViewModel aboutToChangeToStatus: aNewStatus [ - aNewStatus mayTerminateSharedDebugSession: self sharedDebugSession +GtCoderEmbeddedDebugSessionEvaluationStatus >> onSourceCoderViewModel: aViewModel changedToStatus: aNewStatus [ + aNewStatus mayTerminateSharedDebugSessionOfStatus: self ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtCoderEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderEvaluationStatus.class.st index d780faee5..ad960c7ae 100644 --- a/src/GToolkit-Coder-UI/GtCoderEvaluationStatus.class.st +++ b/src/GToolkit-Coder-UI/GtCoderEvaluationStatus.class.st @@ -31,11 +31,11 @@ GtCoderEvaluationStatus >> hasSharedDebugSession [ ] { #category : #'api - hooks' } -GtCoderEvaluationStatus >> mayTerminateDebugSession: aDebugSession [ +GtCoderEvaluationStatus >> mayCloseDebuggerOfStatus: anEvaluationStatus [ ] { #category : #'api - hooks' } -GtCoderEvaluationStatus >> mayTerminateSharedDebugSession: aSharedDebugSession [ +GtCoderEvaluationStatus >> mayTerminateSharedDebugSessionOfStatus: anEvaluationStatus [ ] { #category : #'api - hooks' } @@ -44,6 +44,6 @@ GtCoderEvaluationStatus >> onSourceCoderElement: anElement [ ] { #category : #'api - hooks' } -GtCoderEvaluationStatus >> onSourceCoderViewModel: aViewModel aboutToChangeToStatus: aNewStatus [ +GtCoderEvaluationStatus >> onSourceCoderViewModel: aViewModel changedToStatus: aNewStatus [ ] diff --git a/src/GToolkit-Coder-UI/GtCoderNoEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderNoEvaluationStatus.class.st index 9c805c2aa..c503b59d4 100644 --- a/src/GToolkit-Coder-UI/GtCoderNoEvaluationStatus.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNoEvaluationStatus.class.st @@ -12,11 +12,11 @@ Class { } { #category : #'api - hooks' } -GtCoderNoEvaluationStatus >> mayTerminateDebugSession: aDebugSession [ - aDebugSession terminate +GtCoderNoEvaluationStatus >> mayCloseDebuggerOfStatus: anEvaluationStatus [ + ] { #category : #'api - hooks' } -GtCoderNoEvaluationStatus >> mayTerminateSharedDebugSession: aSharedDebugSession [ - aSharedDebugSession terminate +GtCoderNoEvaluationStatus >> mayTerminateSharedDebugSessionOfStatus: anEvaluationStatus [ + anEvaluationStatus sharedDebugSession terminate ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st index a4b906970..f04883b76 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st @@ -174,12 +174,11 @@ GtSourceCoderViewModel >> evaluationStatus [ { #category : #'api - accessing' } GtSourceCoderViewModel >> evaluationStatus: aStatus [ + | anOldStatus | evaluationStatus = aStatus ifTrue: [ ^ self ]. - evaluationStatus ifNotNil: [ :oldStatus | - oldStatus - onSourceCoderViewModel: self - aboutToChangeToStatus: aStatus ]. + anOldStatus := evaluationStatus. evaluationStatus := aStatus. + anOldStatus onSourceCoderViewModel: self changedToStatus: aStatus. self onEvaluationStatusChanged ] From fd0c6295f2d8ddbd85be09125a519f85da86cb86 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 1 May 2024 23:09:42 -0400 Subject: [PATCH 0618/1268] add `TGtCoderRequesterObject>>#notifyShowDebuggerRequest:dueTo:sourceString:sourceInterval:` [feenkcom/gtoolkit#3735] - we want to display debugger in just one snippet element (in which execution happened) --- ...bugSessionInSpaceEvaluationStatus.class.st | 10 ++-- ...eddedDebugSessionEvaluationStatus.class.st | 19 +++++-- .../GtCoderEvaluationStatus.class.st | 6 +-- ...oderEvaluationStatusChangedSignal.class.st | 49 +++++++++++++++++++ .../GtCoderNoEvaluationStatus.class.st | 10 +++- .../GtCoderViewModelRequester.class.st | 12 +++++ .../GtSourceCoderViewModel.class.st | 36 +++++++++++++- .../GtCoderEvaluationUnhandledError.class.st | 17 +++++-- src/GToolkit-Coder/GtSourceCoder.class.st | 5 +- .../GtSourceCoderRequester.class.st | 12 +++++ .../TGtCoderRequesterObject.trait.st | 8 +++ 11 files changed, 163 insertions(+), 21 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderEvaluationStatusChangedSignal.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderDebugSessionInSpaceEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderDebugSessionInSpaceEvaluationStatus.class.st index 893ddaed2..a8475fcdc 100644 --- a/src/GToolkit-Coder-UI/GtCoderDebugSessionInSpaceEvaluationStatus.class.st +++ b/src/GToolkit-Coder-UI/GtCoderDebugSessionInSpaceEvaluationStatus.class.st @@ -58,16 +58,16 @@ GtCoderDebugSessionInSpaceEvaluationStatus >> hasDebugSessionInSpace [ ^ true ] -{ #category : #'api - hooks' } -GtCoderDebugSessionInSpaceEvaluationStatus >> onSourceCoderViewModel: aViewModel changedToStatus: aNewStatus [ - aNewStatus mayCloseDebuggerOfStatus: self -] - { #category : #actions } GtCoderDebugSessionInSpaceEvaluationStatus >> requestDebuggerSpaceClose [ ^ self debuggerSpace ifNotNil: #requestClose ] +{ #category : #'api - hooks' } +GtCoderDebugSessionInSpaceEvaluationStatus >> sourceCoderViewModel: aViewModel evaluationStatusChangedTo: aNewStatus [ + aNewStatus mayCloseSourceCoderViewModel: aViewModel debuggerSpaceOfStatus: self +] + { #category : #accessing } GtCoderDebugSessionInSpaceEvaluationStatus >> sourceInterval [ ^ sourceInterval diff --git a/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st index 574f3deed..9a2f0f856 100644 --- a/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st +++ b/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st @@ -45,6 +45,13 @@ GtCoderEmbeddedDebugSessionEvaluationStatus >> exception: anObject [ exception := anObject ] +{ #category : #printing } +GtCoderEmbeddedDebugSessionEvaluationStatus >> gtDisplayOn: stream [ + stream nextPutAll: 'Embedded debugger('. + stream print: exception. + stream nextPut: $) +] + { #category : #testing } GtCoderEmbeddedDebugSessionEvaluationStatus >> hasSharedDebugSession [ ^ true @@ -57,11 +64,6 @@ GtCoderEmbeddedDebugSessionEvaluationStatus >> onSourceCoderElement: anElement [ showNotification: (GtNotificationDebugSession new debugSession: self sharedDebugSession) ] -{ #category : #'api - hooks' } -GtCoderEmbeddedDebugSessionEvaluationStatus >> onSourceCoderViewModel: aViewModel changedToStatus: aNewStatus [ - aNewStatus mayTerminateSharedDebugSessionOfStatus: self -] - { #category : #accessing } GtCoderEmbeddedDebugSessionEvaluationStatus >> sharedDebugSession [ ^ sharedDebugSession @@ -72,6 +74,13 @@ GtCoderEmbeddedDebugSessionEvaluationStatus >> sharedDebugSession: aSharedDebugS sharedDebugSession := aSharedDebugSession ] +{ #category : #'api - hooks' } +GtCoderEmbeddedDebugSessionEvaluationStatus >> sourceCoderViewModel: aViewModel evaluationStatusChangedTo: aNewStatus [ + aNewStatus + mayTerminateSourceCoderViewModel: aViewModel + sharedDebugSessionOfStatus: self +] + { #category : #accessing } GtCoderEmbeddedDebugSessionEvaluationStatus >> sourceInterval [ ^ sourceInterval diff --git a/src/GToolkit-Coder-UI/GtCoderEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderEvaluationStatus.class.st index ad960c7ae..d23e314b4 100644 --- a/src/GToolkit-Coder-UI/GtCoderEvaluationStatus.class.st +++ b/src/GToolkit-Coder-UI/GtCoderEvaluationStatus.class.st @@ -31,11 +31,11 @@ GtCoderEvaluationStatus >> hasSharedDebugSession [ ] { #category : #'api - hooks' } -GtCoderEvaluationStatus >> mayCloseDebuggerOfStatus: anEvaluationStatus [ +GtCoderEvaluationStatus >> mayCloseSourceCoderViewModel: aViewModel debuggerSpaceOfStatus: anEvaluationStatus [ ] { #category : #'api - hooks' } -GtCoderEvaluationStatus >> mayTerminateSharedDebugSessionOfStatus: anEvaluationStatus [ +GtCoderEvaluationStatus >> mayTerminateSourceCoderViewModel: aViewModel sharedDebugSessionOfStatus: anEvaluationStatus [ ] { #category : #'api - hooks' } @@ -44,6 +44,6 @@ GtCoderEvaluationStatus >> onSourceCoderElement: anElement [ ] { #category : #'api - hooks' } -GtCoderEvaluationStatus >> onSourceCoderViewModel: aViewModel changedToStatus: aNewStatus [ +GtCoderEvaluationStatus >> sourceCoderViewModel: aViewModel evaluationStatusChangedTo: aNewStatus [ ] diff --git a/src/GToolkit-Coder-UI/GtCoderEvaluationStatusChangedSignal.class.st b/src/GToolkit-Coder-UI/GtCoderEvaluationStatusChangedSignal.class.st new file mode 100644 index 000000000..d95549b30 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderEvaluationStatusChangedSignal.class.st @@ -0,0 +1,49 @@ +Class { + #name : #GtCoderEvaluationStatusChangedSignal, + #superclass : #ContextStackSignal, + #instVars : [ + 'viewModel', + 'oldStatus', + 'newStatus' + ], + #category : #'GToolkit-Coder-UI-Signals' +} + +{ #category : #accessing } +GtCoderEvaluationStatusChangedSignal >> newStatus [ + ^ newStatus +] + +{ #category : #accessing } +GtCoderEvaluationStatusChangedSignal >> newStatus: anObject [ + newStatus := anObject +] + +{ #category : #accessing } +GtCoderEvaluationStatusChangedSignal >> oldStatus [ + ^ oldStatus +] + +{ #category : #accessing } +GtCoderEvaluationStatusChangedSignal >> oldStatus: anObject [ + oldStatus := anObject +] + +{ #category : #printing } +GtCoderEvaluationStatusChangedSignal >> printOneLineContentsOn: stream [ + stream print: viewModel identityHash. + stream nextPutAll: ', '. + oldStatus gtDisplayOn: stream. + stream nextPutAll: ' -> '. + newStatus gtDisplayOn: stream +] + +{ #category : #accessing } +GtCoderEvaluationStatusChangedSignal >> viewModel [ + ^ viewModel +] + +{ #category : #accessing } +GtCoderEvaluationStatusChangedSignal >> viewModel: anObject [ + viewModel := anObject +] diff --git a/src/GToolkit-Coder-UI/GtCoderNoEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderNoEvaluationStatus.class.st index c503b59d4..4b0d2ab08 100644 --- a/src/GToolkit-Coder-UI/GtCoderNoEvaluationStatus.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNoEvaluationStatus.class.st @@ -11,12 +11,18 @@ Class { #category : #'GToolkit-Coder-UI-Coders - Evaluation' } +{ #category : #printing } +GtCoderNoEvaluationStatus >> gtDisplayOn: stream [ + stream nextPutAll: 'No evaluation' +] + { #category : #'api - hooks' } -GtCoderNoEvaluationStatus >> mayCloseDebuggerOfStatus: anEvaluationStatus [ +GtCoderNoEvaluationStatus >> mayCloseSourceCoderViewModel: aViewModel debuggerSpaceOfStatus: anEvaluationStatus [ ] { #category : #'api - hooks' } -GtCoderNoEvaluationStatus >> mayTerminateSharedDebugSessionOfStatus: anEvaluationStatus [ +GtCoderNoEvaluationStatus >> mayTerminateSourceCoderViewModel: aViewModel sharedDebugSessionOfStatus: anEvaluationStatus [ + anEvaluationStatus sharedDebugSession unsubscribe: aViewModel. anEvaluationStatus sharedDebugSession terminate ] diff --git a/src/GToolkit-Coder-UI/GtCoderViewModelRequester.class.st b/src/GToolkit-Coder-UI/GtCoderViewModelRequester.class.st index dd20f0f62..217102afa 100644 --- a/src/GToolkit-Coder-UI/GtCoderViewModelRequester.class.st +++ b/src/GToolkit-Coder-UI/GtCoderViewModelRequester.class.st @@ -29,6 +29,18 @@ GtCoderViewModelRequester >> isUndefinedOrCoderViewModel: aCoderViewModel [ ^ self isCoderViewModel: aCoderViewModel ] +{ #category : #'api - notifying' } +GtCoderViewModelRequester >> notifyShowDebuggerRequest: aDebugSession dueTo: anException sourceString: aSourceString sourceInterval: aSourceInterval [ + "Return true if announcement was handled (and debugger displayed in some way). + Return false otherwise." + + ^ self coderViewModel + notifyShowDebuggerRequest: aDebugSession + dueTo: anException + sourceString: aSourceString + sourceInterval: aSourceInterval +] + { #category : #accessing } GtCoderViewModelRequester >> selfObject [ ^ self coderViewModel selfObject diff --git a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st index f04883b76..73d067dfe 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st @@ -178,7 +178,12 @@ GtSourceCoderViewModel >> evaluationStatus: aStatus [ evaluationStatus = aStatus ifTrue: [ ^ self ]. anOldStatus := evaluationStatus. evaluationStatus := aStatus. - anOldStatus onSourceCoderViewModel: self changedToStatus: aStatus. + GtCoderEvaluationStatusChangedSignal new + oldStatus: anOldStatus; + newStatus: aStatus; + viewModel: self; + emit. + anOldStatus sourceCoderViewModel: self evaluationStatusChangedTo: aStatus. self onEvaluationStatusChanged ] @@ -218,6 +223,34 @@ GtSourceCoderViewModel >> notifyEvaluationStatusChanged [ evaluationStatus: self evaluationStatus) ] +{ #category : #'api - notifying' } +GtSourceCoderViewModel >> notifyShowDebuggerRequest: aDebugSession dueTo: anException sourceString: aSourceString sourceInterval: aSourceInterval [ + "Return true if announcement was handled (and debugger displayed in some way). + Return false otherwise." + + + | aSharedDebugSession aStatus | + aSharedDebugSession := GtSharedDebugSession new session: aDebugSession. + aStatus := GtCoderEmbeddedDebugSessionEvaluationStatus new + debugSession: aDebugSession; + sharedDebugSession: aSharedDebugSession; + exception: anException; + sourceInterval: aSourceInterval; + sourceString: aSourceString. + + aSharedDebugSession weak + when: GtSharedDebugSessionDebuggedAnnouncement + send: #onDebugSessionDebuggedAnnouncement: + to: self; + when: GtSharedDebugSessionTerminatedAnnouncement + send: #onDebugSessionTerminatedAnnouncement: + to: self. + + self evaluationStatus: aStatus. + + ^ true +] + { #category : #'private - announcement handling' } GtSourceCoderViewModel >> onDebugSessionDebuggedAnnouncement: anAnnouncement [ | aStatus | @@ -334,6 +367,7 @@ GtSourceCoderViewModel >> selectedTextInterval [ GtSourceCoderViewModel >> subscribeToCoderModel [ super subscribeToCoderModel. + true ifTrue: [ ^ self ]. self coderModel weak when: GtCoderShowDebuggerRequest send: #onShowDebuggerRequest: diff --git a/src/GToolkit-Coder/GtCoderEvaluationUnhandledError.class.st b/src/GToolkit-Coder/GtCoderEvaluationUnhandledError.class.st index 0806ec52d..4a135ea9d 100644 --- a/src/GToolkit-Coder/GtCoderEvaluationUnhandledError.class.st +++ b/src/GToolkit-Coder/GtCoderEvaluationUnhandledError.class.st @@ -4,9 +4,10 @@ Class { #instVars : [ 'sourceCoder', 'sourceString', - 'sourceInterval' + 'sourceInterval', + 'requesterObject' ], - #category : 'GToolkit-Coder-Coders' + #category : #'GToolkit-Coder-Coders' } { #category : #handling } @@ -16,7 +17,7 @@ GtCoderEvaluationUnhandledError >> debug [ UIManager default gtDebugProcess: Processor activeProcess context: self exception signalerContext - withEmbeddedDebuggerIn: sourceCoder + withEmbeddedDebuggerIn: requesterObject withSourceString: self sourceString withSourceInterval: self sourceInterval forException: self exception @@ -28,6 +29,16 @@ GtCoderEvaluationUnhandledError >> defaultAction [ ^ UIManager default unhandledErrorDefaultAction: self ] +{ #category : #accessing } +GtCoderEvaluationUnhandledError >> requesterObject [ + ^ requesterObject +] + +{ #category : #accessing } +GtCoderEvaluationUnhandledError >> requesterObject: anObject [ + requesterObject := anObject +] + { #category : #accessing } GtCoderEvaluationUnhandledError >> sourceCoder [ ^ sourceCoder diff --git a/src/GToolkit-Coder/GtSourceCoder.class.st b/src/GToolkit-Coder/GtSourceCoder.class.st index d43f88b11..cabbf9e6c 100644 --- a/src/GToolkit-Coder/GtSourceCoder.class.st +++ b/src/GToolkit-Coder/GtSourceCoder.class.st @@ -214,7 +214,8 @@ GtSourceCoder >> evaluateBlock: aBlock onErrorDo: anErrorBlock [ exception: anError; sourceCoder: self; sourceString: aResultWithError sourceString; - sourceInterval: aResultWithError sourceInterval). + sourceInterval: aResultWithError sourceInterval; + requesterObject: aResultWithError requesterObject). anError resignalAs: aResultWithError error. ^ nil ]. @@ -375,7 +376,7 @@ GtSourceCoder >> notifyPrintResult: anEvaluationResult [ coder: self) ] -{ #category : #'private - notifying' } +{ #category : #'api - notifying' } GtSourceCoder >> notifyShowDebuggerRequest: aDebugSession dueTo: anException sourceString: aSourceString sourceInterval: aSourceInterval [ "Return true if announcement was handled (and debugger displayed in some way). Return false otherwise." diff --git a/src/GToolkit-Coder/GtSourceCoderRequester.class.st b/src/GToolkit-Coder/GtSourceCoderRequester.class.st index 071922403..df7fb2927 100644 --- a/src/GToolkit-Coder/GtSourceCoderRequester.class.st +++ b/src/GToolkit-Coder/GtSourceCoderRequester.class.st @@ -18,3 +18,15 @@ GtSourceCoderRequester >> coder [ GtSourceCoderRequester >> coder: anObject [ coder := anObject ] + +{ #category : #'api - notifying' } +GtSourceCoderRequester >> notifyShowDebuggerRequest: aDebugSession dueTo: anException sourceString: aSourceString sourceInterval: aSourceInterval [ + "Return true if announcement was handled (and debugger displayed in some way). + Return false otherwise." + + ^ self coder + notifyShowDebuggerRequest: aDebugSession + dueTo: anException + sourceString: aSourceString + sourceInterval: aSourceInterval +] diff --git a/src/GToolkit-Coder/TGtCoderRequesterObject.trait.st b/src/GToolkit-Coder/TGtCoderRequesterObject.trait.st index 7cc3a923b..c353378db 100644 --- a/src/GToolkit-Coder/TGtCoderRequesterObject.trait.st +++ b/src/GToolkit-Coder/TGtCoderRequesterObject.trait.st @@ -8,6 +8,14 @@ TGtCoderRequesterObject >> asCoderRequesterObject [ ^ self ] +{ #category : #'api - notifying' } +TGtCoderRequesterObject >> notifyShowDebuggerRequest: aDebugSession dueTo: anException sourceString: aSourceString sourceInterval: aSourceInterval [ + "Return true if announcement was handled (and debugger displayed in some way). + Return false otherwise." + + ^ false +] + { #category : #accessing } TGtCoderRequesterObject >> selfObject [ "Return an object that is represented by `self` (or `super`) key" From c5c5ed1c7578ce6f5e0a6d8b57d9e08dfffe8ca8 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 2 May 2024 09:34:17 -0400 Subject: [PATCH 0619/1268] embedded debugger code cleaning [feenkcom/gtoolkit#3735] --- .../GtSourceCoderViewModel.class.st | 20 +++++++++++----- .../GtCoderShowDebuggerRequest.class.st | 23 +++++++++++++------ src/GToolkit-Coder/GtSourceCoder.class.st | 5 +++- 3 files changed, 34 insertions(+), 14 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st index 73d067dfe..6819c510c 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st @@ -273,17 +273,18 @@ GtSourceCoderViewModel >> onEvaluationStatusChanged [ { #category : #'private - announcement handling' } GtSourceCoderViewModel >> onShowDebuggerRequest: anAnnouncement [ - | aSharedDebugSession aStatus | - aSharedDebugSession := GtSharedDebugSession new - session: anAnnouncement debugSession. + | aStatus | + anAnnouncement isDelivered ifTrue: [ ^ self ]. + anAnnouncement beDelivered. + aStatus := GtCoderEmbeddedDebugSessionEvaluationStatus new debugSession: anAnnouncement debugSession; - sharedDebugSession: aSharedDebugSession; + sharedDebugSession: anAnnouncement sharedDebugSession; exception: anAnnouncement exception; sourceInterval: anAnnouncement sourceInterval; sourceString: anAnnouncement sourceString. - aSharedDebugSession weak + anAnnouncement sharedDebugSession weak when: GtSharedDebugSessionDebuggedAnnouncement send: #onDebugSessionDebuggedAnnouncement: to: self; @@ -367,7 +368,14 @@ GtSourceCoderViewModel >> selectedTextInterval [ GtSourceCoderViewModel >> subscribeToCoderModel [ super subscribeToCoderModel. - true ifTrue: [ ^ self ]. + true ifTrue: [ + "Currently, we dispatch the show debugger request using TGtCoderRequesterObject. + We likely do not want to handle it listening to GtCoder models as we observed + unresponsive images if a debug session was terminated twice. This may be solved + by sharing same GtSharedDebugSession instances among all subscribers. It was not + tested as dispaching the request throught TGtCoderRequesterObject seems to be + better solution." + ^ self ]. self coderModel weak when: GtCoderShowDebuggerRequest send: #onShowDebuggerRequest: diff --git a/src/GToolkit-Coder/GtCoderShowDebuggerRequest.class.st b/src/GToolkit-Coder/GtCoderShowDebuggerRequest.class.st index 91892bd1e..5d243b55d 100644 --- a/src/GToolkit-Coder/GtCoderShowDebuggerRequest.class.st +++ b/src/GToolkit-Coder/GtCoderShowDebuggerRequest.class.st @@ -6,11 +6,20 @@ Class { 'exception', 'sourceString', 'sourceInterval', - 'isDelivered' + 'isDelivered', + 'sharedDebugSession' ], #category : #'GToolkit-Coder-Event' } +{ #category : #accessing } +GtCoderShowDebuggerRequest >> beDelivered [ + self + assert: [ isDelivered not ] + description: [ 'I can be delivered only once' ]. + isDelivered := true +] + { #category : #accessing } GtCoderShowDebuggerRequest >> debugSession [ ^ debugSession @@ -46,14 +55,14 @@ GtCoderShowDebuggerRequest >> isDelivered [ ] { #category : #accessing } -GtCoderShowDebuggerRequest >> isDelivered: aBoolean [ - isDelivered := aBoolean +GtCoderShowDebuggerRequest >> sharedDebugSession [ + + ^ sharedDebugSession ] -{ #category : #initialization } -GtCoderShowDebuggerRequest >> prepareForDelivery [ - super prepareForDelivery. - isDelivered := true +{ #category : #accessing } +GtCoderShowDebuggerRequest >> sharedDebugSession: aGtSharedDebugSession [ + sharedDebugSession := aGtSharedDebugSession ] { #category : #accessing } diff --git a/src/GToolkit-Coder/GtSourceCoder.class.st b/src/GToolkit-Coder/GtSourceCoder.class.st index cabbf9e6c..d77dc1b1c 100644 --- a/src/GToolkit-Coder/GtSourceCoder.class.st +++ b/src/GToolkit-Coder/GtSourceCoder.class.st @@ -382,10 +382,13 @@ GtSourceCoder >> notifyShowDebuggerRequest: aDebugSession dueTo: anException sou Return false otherwise." - | anAnnouncement | + | anAnnouncement aSharedDebugSession | + aSharedDebugSession := GtSharedDebugSession new + session: aDebugSession. anAnnouncement := GtCoderShowDebuggerRequest new coder: self; debugSession: aDebugSession; + sharedDebugSession: aSharedDebugSession; exception: anException; sourceString: aSourceString; sourceInterval: aSourceInterval. From fd2ae4b59062a43a17b7eac2d7eef2b1b33cc746 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 2 May 2024 11:32:24 -0400 Subject: [PATCH 0620/1268] embedded debugger code cleaning [feenkcom/gtoolkit#3735] --- src/GToolkit-Coder-UI/GtNotificationDebugSession.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtNotificationDebugSession.class.st b/src/GToolkit-Coder-UI/GtNotificationDebugSession.class.st index d40fbe841..3489ca7d9 100644 --- a/src/GToolkit-Coder-UI/GtNotificationDebugSession.class.st +++ b/src/GToolkit-Coder-UI/GtNotificationDebugSession.class.st @@ -46,8 +46,8 @@ GtNotificationDebugSession >> elementClass [ { #category : #'private - announcement handling' } GtNotificationDebugSession >> onSharedDebugSessionAnnouncement: anAnnouncement [ - self requestRemoval. - self debugSession unsubscribe: self + self debugSession unsubscribe: self. + self requestRemoval ] { #category : #'private - adding / removing' } From 0fe965d4e689d1b9230646f776dc95fcbdf29b7a Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 2 May 2024 15:31:37 -0400 Subject: [PATCH 0621/1268] notification subscribes to the debug session in its setter [feenkcom/gtoolkit#3735] --- .../GtNotificationDebugSession.class.st | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtNotificationDebugSession.class.st b/src/GToolkit-Coder-UI/GtNotificationDebugSession.class.st index 3489ca7d9..882b41db3 100644 --- a/src/GToolkit-Coder-UI/GtNotificationDebugSession.class.st +++ b/src/GToolkit-Coder-UI/GtNotificationDebugSession.class.st @@ -7,14 +7,6 @@ Class { #category : #'GToolkit-Coder-UI-DebugSession' } -{ #category : #'api - notification' } -GtNotificationDebugSession >> addedTo: aGtNotifications [ - self debugSession weak - when: GtSharedDebugSessionAnnouncement - send: #onSharedDebugSessionAnnouncement: - to: self -] - { #category : #'private - asserting' } GtNotificationDebugSession >> assertDebugSession: aDebugSession [ self @@ -36,7 +28,12 @@ GtNotificationDebugSession >> debugSession [ { #category : #accessing } GtNotificationDebugSession >> debugSession: aDebugSession [ self assertDebugSession: aDebugSession. - debugSession := aDebugSession + debugSession ifNotNil: [ debugSession unsubscribe: self ]. + debugSession := aDebugSession. + aDebugSession weak + when: GtSharedDebugSessionAnnouncement + send: #onSharedDebugSessionAnnouncement: + to: self ] { #category : #'api - accessing' } From 1e13c6a3bf2d304537feef46c2584c179adfa8ee Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 2 May 2024 15:58:38 -0400 Subject: [PATCH 0622/1268] check element debug session for nil values [feenkcom/gtoolkit#3735] --- src/GToolkit-Coder-UI/GtCoderDebugSessionMatcher.class.st | 5 ++++- .../GtCoderDebuggerInterruptedProcessMatcher.class.st | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderDebugSessionMatcher.class.st b/src/GToolkit-Coder-UI/GtCoderDebugSessionMatcher.class.st index 88a1e8dc4..9b920e01c 100644 --- a/src/GToolkit-Coder-UI/GtCoderDebugSessionMatcher.class.st +++ b/src/GToolkit-Coder-UI/GtCoderDebugSessionMatcher.class.st @@ -19,5 +19,8 @@ GtCoderDebugSessionMatcher >> debugSession: anObject [ { #category : #testing } GtCoderDebugSessionMatcher >> isMoldableDebugger: anElement [ - ^ anElement debugSession interruptedProcess == debugSession interruptedProcess + | anElementDebugSession | + anElementDebugSession := anElement debugSession. + ^ anElementDebugSession isNotNil + and: [ anElementDebugSession interruptedProcess == debugSession interruptedProcess ] ] diff --git a/src/GToolkit-Coder-UI/GtCoderDebuggerInterruptedProcessMatcher.class.st b/src/GToolkit-Coder-UI/GtCoderDebuggerInterruptedProcessMatcher.class.st index 5e069787d..07d438aec 100644 --- a/src/GToolkit-Coder-UI/GtCoderDebuggerInterruptedProcessMatcher.class.st +++ b/src/GToolkit-Coder-UI/GtCoderDebuggerInterruptedProcessMatcher.class.st @@ -9,7 +9,10 @@ Class { { #category : #testing } GtCoderDebuggerInterruptedProcessMatcher >> isMoldableDebugger: anElement [ - ^ anElement debugSession interruptedProcess == process + | anElementDebugSession | + anElementDebugSession := anElement debugSession. + ^ anElementDebugSession isNotNil + and: [ anElementDebugSession interruptedProcess == process ] ] { #category : #accessing } From 87e02e55fe805a954ee1ee223a5e65170cf7957b Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 3 May 2024 10:23:29 -0400 Subject: [PATCH 0623/1268] add a notification removal hook [feenkcom/gtoolkit#3735] - add `GtNotificationEvent>>#removedFrom:` - notification badge requests to remove all notifications when removed from a space (individual notifications can handle their resources, e.g., terminate processes) --- .../GtNotificationDebugSession.class.st | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtNotificationDebugSession.class.st b/src/GToolkit-Coder-UI/GtNotificationDebugSession.class.st index 882b41db3..1dda88c64 100644 --- a/src/GToolkit-Coder-UI/GtNotificationDebugSession.class.st +++ b/src/GToolkit-Coder-UI/GtNotificationDebugSession.class.st @@ -28,12 +28,9 @@ GtNotificationDebugSession >> debugSession [ { #category : #accessing } GtNotificationDebugSession >> debugSession: aDebugSession [ self assertDebugSession: aDebugSession. - debugSession ifNotNil: [ debugSession unsubscribe: self ]. + debugSession ifNotNil: [ self unsubscribeFromDebugSession ]. debugSession := aDebugSession. - aDebugSession weak - when: GtSharedDebugSessionAnnouncement - send: #onSharedDebugSessionAnnouncement: - to: self + self subscribeToDebugSession ] { #category : #'api - accessing' } @@ -47,7 +44,24 @@ GtNotificationDebugSession >> onSharedDebugSessionAnnouncement: anAnnouncement [ self requestRemoval ] -{ #category : #'private - adding / removing' } -GtNotificationDebugSession >> removeFrom: aGtNotifications [ - aGtNotifications removeNotification: self +{ #category : #'api - hooks' } +GtNotificationDebugSession >> removedFrom: aNotifications [ + "Subclasses can react to notification removal" + + super removedFrom: aNotifications. + self unsubscribeFromDebugSession. + debugSession terminate +] + +{ #category : #'private - subscriptions' } +GtNotificationDebugSession >> subscribeToDebugSession [ + debugSession weak + when: GtSharedDebugSessionAnnouncement + send: #onSharedDebugSessionAnnouncement: + to: self +] + +{ #category : #'private - subscriptions' } +GtNotificationDebugSession >> unsubscribeFromDebugSession [ + debugSession unsubscribe: self ] From 1844dcc2fec97e5177903e4c7acbd97b7f01b8f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Mon, 6 May 2024 20:30:31 +0300 Subject: [PATCH 0624/1268] Add GtCoderAddOns>>#addContextDropDownWithPreviewAction:icon:action:stencil: --- src/GToolkit-Coder/GtCoderAddOns.class.st | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/GToolkit-Coder/GtCoderAddOns.class.st b/src/GToolkit-Coder/GtCoderAddOns.class.st index 7b78668ae..18ab1e4ce 100644 --- a/src/GToolkit-Coder/GtCoderAddOns.class.st +++ b/src/GToolkit-Coder/GtCoderAddOns.class.st @@ -68,6 +68,18 @@ GtCoderAddOns >> addContextActions: aCollectionOfContextActions [ aCollectionOfContextActions do: [ :eachContextAction | self addContextAction: eachContextAction ] ] +{ #category : #'api - main actions' } +GtCoderAddOns >> addContextDropDownWithPreviewAction: aString icon: anIcon action: actionBlock stencil: stencilBlock [ + self + updateActionList: #contextActions + withAction: (GtCoderDropDownWithPreviewAction new + title: aString; + icon: anIcon; + changeAction: actionBlock; + changeStencil: stencilBlock) + onlyNew: true +] + { #category : #'api - context menu' } GtCoderAddOns >> addContextMenuAction: aContextMenuAction [ contextMenuActions add: aContextMenuAction From 540902b4797b2a51f7630835d7849dbd43795ac2 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 7 May 2024 09:52:57 -0400 Subject: [PATCH 0625/1268] enable the previous code change [feenkcom/gtoolkit#3727] Temporary hack for avoiding a race condition when adding editors to a space --- src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 5d12119fd..2a6337b3a 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -323,10 +323,10 @@ GtTextualCoderEditorElement >> onTextualCoderViewModelChanged [ which we will restore once new text is set" "Related to: https://github.com/feenkcom/gtoolkit/issues/3727" - "self privateUpdateEditorState: self textualCoderViewModel asEditorState wait." + self privateUpdateEditorState: self textualCoderViewModel asEditorState wait. - self asyncPromise - promise: self textualCoderViewModel asEditorState. + "self asyncPromise + promise: self textualCoderViewModel asEditorState." self editor model: self textualCoderViewModel. From 8186c931c94863144a26a21cf1830e24b908620d Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 7 May 2024 17:34:08 -0400 Subject: [PATCH 0626/1268] limit debugger notification text to 72 characters [feenkcom/gtoolkit#3735] --- .../GtNotificationDebugSessionElement.class.st | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtNotificationDebugSessionElement.class.st b/src/GToolkit-Coder-UI/GtNotificationDebugSessionElement.class.st index 1c7b17283..908c9752d 100644 --- a/src/GToolkit-Coder-UI/GtNotificationDebugSessionElement.class.st +++ b/src/GToolkit-Coder-UI/GtNotificationDebugSessionElement.class.st @@ -131,8 +131,12 @@ GtNotificationDebugSessionElement >> initializeToolbarElement [ { #category : #'private - instance creation' } GtNotificationDebugSessionElement >> newTextDescribingSession: aSession [ - ^ String streamContents: [ :aStream | - aStream nextPutAll: aSession name asString ] + ^ String + streamContents: [ :aStream | + | aString | + aString := aSession name asString. + aString size > 72 ifTrue: [ aString := aString first: 72 ]. + aStream nextPutAll: aString ] ] { #category : #'private - announcement handling' } From fff56cde8071c9e593cfb6e1b4b71a8181579c97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Wed, 8 May 2024 07:52:44 +0200 Subject: [PATCH 0627/1268] Define #gtDescription directly in the class. No extension method is needed as those as now in GT. --- .../RBAbstractClassVariableRefactoring.extension.st | 6 ------ .../RBCreateAccessorsForVariableRefactoring.extension.st | 6 ------ .../RBMoveVariableDefinitionRefactoring.extension.st | 6 ------ 3 files changed, 18 deletions(-) delete mode 100644 src/GToolkit-Coder-UI/RBAbstractClassVariableRefactoring.extension.st delete mode 100644 src/GToolkit-Coder-UI/RBCreateAccessorsForVariableRefactoring.extension.st delete mode 100644 src/GToolkit-Coder-UI/RBMoveVariableDefinitionRefactoring.extension.st diff --git a/src/GToolkit-Coder-UI/RBAbstractClassVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBAbstractClassVariableRefactoring.extension.st deleted file mode 100644 index e5837846d..000000000 --- a/src/GToolkit-Coder-UI/RBAbstractClassVariableRefactoring.extension.st +++ /dev/null @@ -1,6 +0,0 @@ -Extension { #name : #RBAbstractClassVariableRefactoring } - -{ #category : #'*GToolkit-Coder-UI' } -RBAbstractClassVariableRefactoring >> gtDescription [ - ^ 'Abstract class variable ' , variableName -] diff --git a/src/GToolkit-Coder-UI/RBCreateAccessorsForVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBCreateAccessorsForVariableRefactoring.extension.st deleted file mode 100644 index bc15b87d2..000000000 --- a/src/GToolkit-Coder-UI/RBCreateAccessorsForVariableRefactoring.extension.st +++ /dev/null @@ -1,6 +0,0 @@ -Extension { #name : #RBCreateAccessorsForVariableRefactoring } - -{ #category : #'*GToolkit-Coder-UI' } -RBCreateAccessorsForVariableRefactoring >> gtDescription [ - ^ 'Create accessors for ' , variableName -] diff --git a/src/GToolkit-Coder-UI/RBMoveVariableDefinitionRefactoring.extension.st b/src/GToolkit-Coder-UI/RBMoveVariableDefinitionRefactoring.extension.st deleted file mode 100644 index 405fdaa1f..000000000 --- a/src/GToolkit-Coder-UI/RBMoveVariableDefinitionRefactoring.extension.st +++ /dev/null @@ -1,6 +0,0 @@ -Extension { #name : #RBMoveVariableDefinitionRefactoring } - -{ #category : #'*GToolkit-Coder-UI' } -RBMoveVariableDefinitionRefactoring >> gtDescription [ - ^ 'Move variable declaration of ' , name , ' to inner scope' -] From 2cacbed5cb2cd201c09dda30b5d46d1ce87dc14c Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Thu, 9 May 2024 23:53:31 +0200 Subject: [PATCH 0628/1268] align center main coder actions feenkcom/gtoolkit#3761 --- src/GToolkit-Coder-UI/GtCoderActionsElement.class.st | 1 + src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st index b2d37ddd4..e132f140d 100644 --- a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st @@ -87,6 +87,7 @@ GtCoderActionsElement >> newButtonForAction: aGtCoderAction [ icon: aGtCoderAction icon asElement; beTinySize; label: aGtCoderAction title; + constraintsDo: [ :c | c linear vertical alignCenter ]; aptitude: BrGlamorousButtonWithIconAptitude; in: [ :aButtonElement | aButtonElement id: aGtCoderAction id ]; action: [ :aButtonElement :aButtonModel :anEvent | diff --git a/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st index c126e9bcd..0ba51e9c4 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st @@ -70,10 +70,10 @@ GtSourceCoderActionsElement >> initialize [ { #category : #'instance creation' } GtSourceCoderActionsElement >> newToolbar [ - ^ BrToolbar new aptitude: (BrGlamorousToolbarAptitude new spacing: 4); - padding: (BlInsets left: -4) + padding: (BlInsets left: -4); + constraintsDo: [ :c | c linear vertical alignCenter ] ] { #category : #'private - announcement handling' } From a7d69cbbb9d1c098169fb7f20b5fd49ea7b341a4 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 14 May 2024 00:11:10 -0400 Subject: [PATCH 0629/1268] add `TGtSourceCoderEvaluatedCode` [feenkcom/gtoolkit#3735] Using dedicated objects, we can pass compiled methods that can be later found in a context stack. As a consequence, we can display embedded debuggers next to lines that produce errors. --- ...eddedDebugSessionEvaluationStatus.class.st | 62 +++++++++++++++- .../GtCoderViewModelRequester.class.st | 3 +- .../GtSourceCoderViewModel.class.st | 3 +- .../GtCoderEvaluationUnhandledError.class.st | 25 ++++++- ...aluationUnhandledErrorInformation.class.st | 71 +++++++++++++++++++ .../GtCoderShowDebuggerRequest.class.st | 14 +++- src/GToolkit-Coder/GtSourceCoder.class.st | 6 +- .../GtSourceCoderEvaluationContext.class.st | 19 ++++- .../GtSourceCoderEvaluationResult.class.st | 9 +++ .../GtSourceCoderNoEvaluatedCode.class.st | 7 ++ .../GtSourceCoderRequester.class.st | 3 +- .../TGtCoderRequesterObject.trait.st | 2 +- .../TGtSourceCoderEvaluatedCode.trait.st | 12 ++++ 13 files changed, 226 insertions(+), 10 deletions(-) create mode 100644 src/GToolkit-Coder/GtCoderEvaluationUnhandledErrorInformation.class.st create mode 100644 src/GToolkit-Coder/GtSourceCoderNoEvaluatedCode.class.st create mode 100644 src/GToolkit-Coder/TGtSourceCoderEvaluatedCode.trait.st diff --git a/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st index 9a2f0f856..25619fe4c 100644 --- a/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st +++ b/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st @@ -11,7 +11,8 @@ Class { 'exception', 'sourceInterval', 'sourceString', - 'sharedDebugSession' + 'sharedDebugSession', + 'evaluatedCode' ], #category : #'GToolkit-Coder-UI-Coders - Evaluation' } @@ -35,6 +36,39 @@ GtCoderEmbeddedDebugSessionEvaluationStatus >> debugSession: anObject [ debugSession := anObject ] +{ #category : #accessing } +GtCoderEmbeddedDebugSessionEvaluationStatus >> evaluatedCode [ + + ^ evaluatedCode ifNil: [ + evaluatedCode := GtSourceCoderNoEvaluatedCode default ] +] + +{ #category : #accessing } +GtCoderEmbeddedDebugSessionEvaluationStatus >> evaluatedCode: anObject [ + evaluatedCode := anObject +] + +{ #category : #accessing } +GtCoderEmbeddedDebugSessionEvaluationStatus >> evaluatedCodeContext [ + "Return a stack context that corresponds to a given evaluated code." + + + self sharedDebugSession + sessionDo: [ :aSession | ^ self evaluatedCode findRelevantContextInStack: aSession context stack ]. + ^ nil +] + +{ #category : #accessing } +GtCoderEmbeddedDebugSessionEvaluationStatus >> evaluatedCodeInterval [ + "Return an interval that corresponds to a given evaluated code." + + + | aContext | + aContext := self evaluatedCodeContext. + aContext ifNil: [ ^ nil ]. + ^ aContext pcRangeContextIsActive: false +] + { #category : #accessing } GtCoderEmbeddedDebugSessionEvaluationStatus >> exception [ ^ exception @@ -52,6 +86,32 @@ GtCoderEmbeddedDebugSessionEvaluationStatus >> gtDisplayOn: stream [ stream nextPut: $) ] +{ #category : #'gt - extensions' } +GtCoderEmbeddedDebugSessionEvaluationStatus >> gtEvaluatedSource [ + | aText | + aText := self sourceString asRopedText glamorousCodeFontAndSize. + + self evaluatedCodeInterval + ifNotNil: [ :aContextInterval | + | aContextMin aContextMax | + aContextMin := aContextInterval first min: aText size. + aContextMax := aContextInterval last min: aText size. + (aText from: aContextMin to: aContextMax) + highlight: BrGlamorousColors debuggerTextHighlightColor ]. + + ^ aText +] + +{ #category : #'gt - extensions' } +GtCoderEmbeddedDebugSessionEvaluationStatus >> gtEvaluatedSourceFor: aView [ + + sourceString ifNil: [ ^ aView empty ]. + + ^ aView text + title: 'Evaluated source'; + text: [ self gtEvaluatedSource ] +] + { #category : #testing } GtCoderEmbeddedDebugSessionEvaluationStatus >> hasSharedDebugSession [ ^ true diff --git a/src/GToolkit-Coder-UI/GtCoderViewModelRequester.class.st b/src/GToolkit-Coder-UI/GtCoderViewModelRequester.class.st index 217102afa..12ba7372b 100644 --- a/src/GToolkit-Coder-UI/GtCoderViewModelRequester.class.st +++ b/src/GToolkit-Coder-UI/GtCoderViewModelRequester.class.st @@ -30,7 +30,7 @@ GtCoderViewModelRequester >> isUndefinedOrCoderViewModel: aCoderViewModel [ ] { #category : #'api - notifying' } -GtCoderViewModelRequester >> notifyShowDebuggerRequest: aDebugSession dueTo: anException sourceString: aSourceString sourceInterval: aSourceInterval [ +GtCoderViewModelRequester >> notifyShowDebuggerRequest: aDebugSession dueTo: anException sourceString: aSourceString sourceInterval: aSourceInterval evaluationInfo: anEvaluationInfo [ "Return true if announcement was handled (and debugger displayed in some way). Return false otherwise." @@ -39,6 +39,7 @@ GtCoderViewModelRequester >> notifyShowDebuggerRequest: aDebugSession dueTo: anE dueTo: anException sourceString: aSourceString sourceInterval: aSourceInterval + evaluationInfo: anEvaluationInfo ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st index 6819c510c..2ed83adc5 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st @@ -224,7 +224,7 @@ GtSourceCoderViewModel >> notifyEvaluationStatusChanged [ ] { #category : #'api - notifying' } -GtSourceCoderViewModel >> notifyShowDebuggerRequest: aDebugSession dueTo: anException sourceString: aSourceString sourceInterval: aSourceInterval [ +GtSourceCoderViewModel >> notifyShowDebuggerRequest: aDebugSession dueTo: anException sourceString: aSourceString sourceInterval: aSourceInterval evaluationInfo: anEvaluationInfo [ "Return true if announcement was handled (and debugger displayed in some way). Return false otherwise." @@ -235,6 +235,7 @@ GtSourceCoderViewModel >> notifyShowDebuggerRequest: aDebugSession dueTo: anExce debugSession: aDebugSession; sharedDebugSession: aSharedDebugSession; exception: anException; + evaluatedCode: anEvaluationInfo evaluatedCode; sourceInterval: aSourceInterval; sourceString: aSourceString. diff --git a/src/GToolkit-Coder/GtCoderEvaluationUnhandledError.class.st b/src/GToolkit-Coder/GtCoderEvaluationUnhandledError.class.st index 4a135ea9d..5479c1585 100644 --- a/src/GToolkit-Coder/GtCoderEvaluationUnhandledError.class.st +++ b/src/GToolkit-Coder/GtCoderEvaluationUnhandledError.class.st @@ -5,7 +5,8 @@ Class { 'sourceCoder', 'sourceString', 'sourceInterval', - 'requesterObject' + 'requesterObject', + 'evaluatedCode' ], #category : #'GToolkit-Coder-Coders' } @@ -21,6 +22,12 @@ GtCoderEvaluationUnhandledError >> debug [ withSourceString: self sourceString withSourceInterval: self sourceInterval forException: self exception + evaluationInfo: (GtCoderEvaluationUnhandledErrorInformation new + requesterObject: self requesterObject; + evaluatedCode: self evaluatedCode; + sourceString: self sourceString; + sourceInterval: self sourceInterval; + sourceCoder: self sourceCoder) ] { #category : #'priv handling' } @@ -29,8 +36,23 @@ GtCoderEvaluationUnhandledError >> defaultAction [ ^ UIManager default unhandledErrorDefaultAction: self ] +{ #category : #accessing } +GtCoderEvaluationUnhandledError >> evaluatedCode [ + + ^ evaluatedCode ifNil: [ + evaluatedCode := GtSourceCoderNoEvaluatedCode default ] +] + +{ #category : #accessing } +GtCoderEvaluationUnhandledError >> evaluatedCode: aSourceCode [ + evaluatedCode := aSourceCode +] + { #category : #accessing } GtCoderEvaluationUnhandledError >> requesterObject [ + "Return an object that requested evaluation." + + ^ requesterObject ] @@ -41,6 +63,7 @@ GtCoderEvaluationUnhandledError >> requesterObject: anObject [ { #category : #accessing } GtCoderEvaluationUnhandledError >> sourceCoder [ + ^ sourceCoder ] diff --git a/src/GToolkit-Coder/GtCoderEvaluationUnhandledErrorInformation.class.st b/src/GToolkit-Coder/GtCoderEvaluationUnhandledErrorInformation.class.st new file mode 100644 index 000000000..701e25a44 --- /dev/null +++ b/src/GToolkit-Coder/GtCoderEvaluationUnhandledErrorInformation.class.st @@ -0,0 +1,71 @@ +" +I hold extra information that is passed by {{gtClass:GtCoderEvaluationUnhandledError}} to handle (debug) unhandled exceptions. +" +Class { + #name : #GtCoderEvaluationUnhandledErrorInformation, + #superclass : #Object, + #instVars : [ + 'requesterObject', + 'evaluatedCode', + 'sourceString', + 'sourceInterval', + 'sourceCoder' + ], + #category : #'GToolkit-Coder-Coders' +} + +{ #category : #accessing } +GtCoderEvaluationUnhandledErrorInformation >> evaluatedCode [ + + ^ evaluatedCode ifNil: [ + evaluatedCode := GtSourceCoderNoEvaluatedCode default ] +] + +{ #category : #accessing } +GtCoderEvaluationUnhandledErrorInformation >> evaluatedCode: anObject [ + evaluatedCode := anObject +] + +{ #category : #accessing } +GtCoderEvaluationUnhandledErrorInformation >> requesterObject [ + "Return an object that requested evaluation." + + + ^ requesterObject +] + +{ #category : #accessing } +GtCoderEvaluationUnhandledErrorInformation >> requesterObject: anObject [ + requesterObject := anObject +] + +{ #category : #accessing } +GtCoderEvaluationUnhandledErrorInformation >> sourceCoder [ + + ^ sourceCoder +] + +{ #category : #accessing } +GtCoderEvaluationUnhandledErrorInformation >> sourceCoder: anObject [ + sourceCoder := anObject +] + +{ #category : #accessing } +GtCoderEvaluationUnhandledErrorInformation >> sourceInterval [ + ^ sourceInterval +] + +{ #category : #accessing } +GtCoderEvaluationUnhandledErrorInformation >> sourceInterval: anObject [ + sourceInterval := anObject +] + +{ #category : #accessing } +GtCoderEvaluationUnhandledErrorInformation >> sourceString [ + ^ sourceString +] + +{ #category : #accessing } +GtCoderEvaluationUnhandledErrorInformation >> sourceString: anObject [ + sourceString := anObject +] diff --git a/src/GToolkit-Coder/GtCoderShowDebuggerRequest.class.st b/src/GToolkit-Coder/GtCoderShowDebuggerRequest.class.st index 5d243b55d..fff6e9f8f 100644 --- a/src/GToolkit-Coder/GtCoderShowDebuggerRequest.class.st +++ b/src/GToolkit-Coder/GtCoderShowDebuggerRequest.class.st @@ -7,7 +7,8 @@ Class { 'sourceString', 'sourceInterval', 'isDelivered', - 'sharedDebugSession' + 'sharedDebugSession', + 'evaluationInfo' ], #category : #'GToolkit-Coder-Event' } @@ -30,6 +31,17 @@ GtCoderShowDebuggerRequest >> debugSession: anObject [ debugSession := anObject ] +{ #category : #accessing } +GtCoderShowDebuggerRequest >> evaluationInfo [ + + ^ evaluationInfo +] + +{ #category : #accessing } +GtCoderShowDebuggerRequest >> evaluationInfo: anObject [ + evaluationInfo := anObject +] + { #category : #accessing } GtCoderShowDebuggerRequest >> exception [ ^ exception diff --git a/src/GToolkit-Coder/GtSourceCoder.class.st b/src/GToolkit-Coder/GtSourceCoder.class.st index d77dc1b1c..b074aedc8 100644 --- a/src/GToolkit-Coder/GtSourceCoder.class.st +++ b/src/GToolkit-Coder/GtSourceCoder.class.st @@ -213,6 +213,7 @@ GtSourceCoder >> evaluateBlock: aBlock onErrorDo: anErrorBlock [ aResultWithError error: (GtCoderEvaluationUnhandledError new exception: anError; sourceCoder: self; + evaluatedCode: aResultWithError evaluatedCode; sourceString: aResultWithError sourceString; sourceInterval: aResultWithError sourceInterval; requesterObject: aResultWithError requesterObject). @@ -377,7 +378,7 @@ GtSourceCoder >> notifyPrintResult: anEvaluationResult [ ] { #category : #'api - notifying' } -GtSourceCoder >> notifyShowDebuggerRequest: aDebugSession dueTo: anException sourceString: aSourceString sourceInterval: aSourceInterval [ +GtSourceCoder >> notifyShowDebuggerRequest: aDebugSession dueTo: anException sourceString: aSourceString sourceInterval: aSourceInterval evaluationInfo: anEvaluationInfo [ "Return true if announcement was handled (and debugger displayed in some way). Return false otherwise." @@ -391,7 +392,8 @@ GtSourceCoder >> notifyShowDebuggerRequest: aDebugSession dueTo: anException sou sharedDebugSession: aSharedDebugSession; exception: anException; sourceString: aSourceString; - sourceInterval: aSourceInterval. + sourceInterval: aSourceInterval; + evaluationInfo: anEvaluationInfo. self announce: anAnnouncement. ^ anAnnouncement isDelivered diff --git a/src/GToolkit-Coder/GtSourceCoderEvaluationContext.class.st b/src/GToolkit-Coder/GtSourceCoderEvaluationContext.class.st index b6de7a4b3..ddcf4cc31 100644 --- a/src/GToolkit-Coder/GtSourceCoderEvaluationContext.class.st +++ b/src/GToolkit-Coder/GtSourceCoderEvaluationContext.class.st @@ -7,7 +7,8 @@ Class { 'sourceInterval', 'sourceString', 'evaluatedInterval', - 'evaluatedSourceString' + 'evaluatedSourceString', + 'evaluatedCode' ], #category : #'GToolkit-Coder-Coders - Evaluation' } @@ -29,6 +30,22 @@ GtSourceCoderEvaluationContext >> coder: aGtSourceCoder [ coder := aGtSourceCoder ] +{ #category : #'api - context' } +GtSourceCoderEvaluationContext >> evaluatedCode [ + "Return an object, representing the evaluated source string. + For example in case of Pharo, it is a reference to a compiled method." + + + ^ evaluatedCode ifNil: [ evaluatedCode := GtSourceCoderNoEvaluatedCode default ] +] + +{ #category : #'api - context' } +GtSourceCoderEvaluationContext >> evaluatedCode: aContextReference [ + "Set a {{gtClass:TGtSourceCoderEvaluatedCode}}" + + evaluatedCode := aContextReference +] + { #category : #accessing } GtSourceCoderEvaluationContext >> evaluatedInterval [ ^ evaluatedInterval diff --git a/src/GToolkit-Coder/GtSourceCoderEvaluationResult.class.st b/src/GToolkit-Coder/GtSourceCoderEvaluationResult.class.st index f7b51ada2..a1428f501 100644 --- a/src/GToolkit-Coder/GtSourceCoderEvaluationResult.class.st +++ b/src/GToolkit-Coder/GtSourceCoderEvaluationResult.class.st @@ -7,6 +7,15 @@ Class { #category : #'GToolkit-Coder-Coders - Evaluation' } +{ #category : #accessing } +GtSourceCoderEvaluationResult >> evaluatedCode [ + "Return an object, representing the evaluated source string. + For example in case of Pharo, it is a reference to a compiled method." + + + ^ self evaluationContext evaluatedCode +] + { #category : #accessing } GtSourceCoderEvaluationResult >> evaluationContext [ ^ evaluationContext diff --git a/src/GToolkit-Coder/GtSourceCoderNoEvaluatedCode.class.st b/src/GToolkit-Coder/GtSourceCoderNoEvaluatedCode.class.st new file mode 100644 index 000000000..158dad0e5 --- /dev/null +++ b/src/GToolkit-Coder/GtSourceCoderNoEvaluatedCode.class.st @@ -0,0 +1,7 @@ +Class { + #name : #GtSourceCoderNoEvaluatedCode, + #superclass : #Object, + #traits : 'TGtSourceCoderEvaluatedCode + TGtUniqueInstance', + #classTraits : 'TGtSourceCoderEvaluatedCode classTrait + TGtUniqueInstance classTrait', + #category : #'GToolkit-Coder-Coders - Evaluation' +} diff --git a/src/GToolkit-Coder/GtSourceCoderRequester.class.st b/src/GToolkit-Coder/GtSourceCoderRequester.class.st index df7fb2927..7bbd960e5 100644 --- a/src/GToolkit-Coder/GtSourceCoderRequester.class.st +++ b/src/GToolkit-Coder/GtSourceCoderRequester.class.st @@ -20,7 +20,7 @@ GtSourceCoderRequester >> coder: anObject [ ] { #category : #'api - notifying' } -GtSourceCoderRequester >> notifyShowDebuggerRequest: aDebugSession dueTo: anException sourceString: aSourceString sourceInterval: aSourceInterval [ +GtSourceCoderRequester >> notifyShowDebuggerRequest: aDebugSession dueTo: anException sourceString: aSourceString sourceInterval: aSourceInterval evaluationInfo: anEvaluationInfo [ "Return true if announcement was handled (and debugger displayed in some way). Return false otherwise." @@ -29,4 +29,5 @@ GtSourceCoderRequester >> notifyShowDebuggerRequest: aDebugSession dueTo: anExce dueTo: anException sourceString: aSourceString sourceInterval: aSourceInterval + evaluationInfo: anEvaluationInfo ] diff --git a/src/GToolkit-Coder/TGtCoderRequesterObject.trait.st b/src/GToolkit-Coder/TGtCoderRequesterObject.trait.st index c353378db..19791559a 100644 --- a/src/GToolkit-Coder/TGtCoderRequesterObject.trait.st +++ b/src/GToolkit-Coder/TGtCoderRequesterObject.trait.st @@ -9,7 +9,7 @@ TGtCoderRequesterObject >> asCoderRequesterObject [ ] { #category : #'api - notifying' } -TGtCoderRequesterObject >> notifyShowDebuggerRequest: aDebugSession dueTo: anException sourceString: aSourceString sourceInterval: aSourceInterval [ +TGtCoderRequesterObject >> notifyShowDebuggerRequest: aDebugSession dueTo: anException sourceString: aSourceString sourceInterval: aSourceInterval evaluationInfo: anEvaluationInfo [ "Return true if announcement was handled (and debugger displayed in some way). Return false otherwise." diff --git a/src/GToolkit-Coder/TGtSourceCoderEvaluatedCode.trait.st b/src/GToolkit-Coder/TGtSourceCoderEvaluatedCode.trait.st new file mode 100644 index 000000000..13732f132 --- /dev/null +++ b/src/GToolkit-Coder/TGtSourceCoderEvaluatedCode.trait.st @@ -0,0 +1,12 @@ +Trait { + #name : #TGtSourceCoderEvaluatedCode, + #category : #'GToolkit-Coder-Coders - Evaluation' +} + +{ #category : #accessing } +TGtSourceCoderEvaluatedCode >> findRelevantContextInStack: aStack [ + "Return a stack context that corresponds to a given evaluated code." + + + ^ nil +] From 36b01e29ef5045012d04af3df05240d45b457df7 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 14 May 2024 15:55:50 -0400 Subject: [PATCH 0630/1268] use `GtPharoEvaluatedCode>>#findSourceAstForContext:` [feenkcom/gtoolkit#3735] It finds correct error intervals in Pharo 10 --- ...eddedDebugSessionEvaluationStatus.class.st | 13 +++- ...aroMethodNodeSourceIntervalFinder.class.st | 77 +++++++++++++++++++ .../TGtSourceCoderEvaluatedCode.trait.st | 8 ++ 3 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 src/GToolkit-Coder-UI/GtPharoMethodNodeSourceIntervalFinder.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st index 25619fe4c..635aaa9a2 100644 --- a/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st +++ b/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st @@ -66,7 +66,18 @@ GtCoderEmbeddedDebugSessionEvaluationStatus >> evaluatedCodeInterval [ | aContext | aContext := self evaluatedCodeContext. aContext ifNil: [ ^ nil ]. - ^ aContext pcRangeContextIsActive: false + + (self debugSession process isNil or: [ aContext isDead ]) ifTrue: [ ^ nil ]. + + ^ self + forPharo11OrNewer: [ self debugSession pcRangeForContext: aContext ] + forPharo10: [ | aUsedAst anInterval | + aUsedAst := self evaluatedCode findSourceAstForContext: aContext. + anInterval := GtPharoMethodNodeSourceIntervalFinder new + methodNode: aUsedAst; + sourceString: self sourceString; + find. + anInterval last isZero ifTrue: [ nil ] ifFalse: [ anInterval ] ] ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtPharoMethodNodeSourceIntervalFinder.class.st b/src/GToolkit-Coder-UI/GtPharoMethodNodeSourceIntervalFinder.class.st new file mode 100644 index 000000000..d8fa5b00e --- /dev/null +++ b/src/GToolkit-Coder-UI/GtPharoMethodNodeSourceIntervalFinder.class.st @@ -0,0 +1,77 @@ +Class { + #name : #GtPharoMethodNodeSourceIntervalFinder, + #superclass : #Object, + #instVars : [ + 'methodNode', + 'sourceString', + 'sourceAst', + 'sourceNode', + 'sourceInterval' + ], + #category : #'GToolkit-Coder-UI-Context' +} + +{ #category : #finding } +GtPharoMethodNodeSourceIntervalFinder >> equivalentNodeTo: aNode in: otherTree [ + | equivParent nodeIndex equivNode | + aNode isMethod ifTrue: [ ^ otherTree ]. + (aNode parent isReturn and: [ aNode parent parent parent isMethod ]) + ifTrue: [ equivNode := otherTree isSequence + ifTrue: [ otherTree statements last ] + ifFalse: [ otherTree ]. + ^ equivNode isReturn ifTrue: [ equivNode value ] ifFalse: [ equivNode ] ]. + aNode parent isMethod + ifTrue: [ otherTree isSequence ifTrue: [ ^ otherTree ] ifFalse: [ ^ otherTree parent ] ]. + equivParent := self equivalentNodeTo: aNode parent in: otherTree. + equivParent ifNil: [ ^ nil ]. + nodeIndex := aNode parent children identityIndexOf: aNode. + ^ equivParent children at: nodeIndex ifAbsent: [ nil ] +] + +{ #category : #finding } +GtPharoMethodNodeSourceIntervalFinder >> find [ + "Copy of SmaCCMethodNodeSourceIntervalFinder" + + + sourceAst := RBParser + parseExpression: sourceString + onError: [ :msg :pos | ^ sourceInterval := 1 to: 0 ]. + sourceNode := self equivalentNodeTo: methodNode in: sourceAst. + sourceNode ifNil: [ ^ sourceInterval := 1 to: 0 ]. + ^ sourceInterval := sourceNode start to: sourceNode stop +] + +{ #category : #accessing } +GtPharoMethodNodeSourceIntervalFinder >> methodNode [ + ^ methodNode +] + +{ #category : #accessing } +GtPharoMethodNodeSourceIntervalFinder >> methodNode: anObject [ + methodNode := anObject +] + +{ #category : #'accessing - computed' } +GtPharoMethodNodeSourceIntervalFinder >> sourceAst [ + ^ sourceAst +] + +{ #category : #'accessing - computed' } +GtPharoMethodNodeSourceIntervalFinder >> sourceInterval [ + ^ sourceInterval +] + +{ #category : #'accessing - computed' } +GtPharoMethodNodeSourceIntervalFinder >> sourceNode [ + ^ sourceNode +] + +{ #category : #accessing } +GtPharoMethodNodeSourceIntervalFinder >> sourceString [ + ^ sourceString +] + +{ #category : #accessing } +GtPharoMethodNodeSourceIntervalFinder >> sourceString: anObject [ + sourceString := anObject +] diff --git a/src/GToolkit-Coder/TGtSourceCoderEvaluatedCode.trait.st b/src/GToolkit-Coder/TGtSourceCoderEvaluatedCode.trait.st index 13732f132..762c8e84b 100644 --- a/src/GToolkit-Coder/TGtSourceCoderEvaluatedCode.trait.st +++ b/src/GToolkit-Coder/TGtSourceCoderEvaluatedCode.trait.st @@ -10,3 +10,11 @@ TGtSourceCoderEvaluatedCode >> findRelevantContextInStack: aStack [ ^ nil ] + +{ #category : #accessing } +TGtSourceCoderEvaluatedCode >> findSourceAstForContext: aContext [ + "Return an AST node that corresponds to a given executed code." + + + ^ nil +] From b73fb16356c720f432ffdbdd1c9b2b4e3fb4cfc4 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 14 May 2024 16:24:27 -0400 Subject: [PATCH 0631/1268] delegate interval computation to `TGtSourceCoderEvaluatedCode>>#findSourceIntervalForContext:sourceString:` [feenkcom/gtoolkit#3735] --- ...tCoderEmbeddedDebugSessionEvaluationStatus.class.st | 10 +++------- .../TGtSourceCoderEvaluatedCode.trait.st | 6 +++--- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st index 635aaa9a2..4cbba2335 100644 --- a/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st +++ b/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st @@ -71,13 +71,9 @@ GtCoderEmbeddedDebugSessionEvaluationStatus >> evaluatedCodeInterval [ ^ self forPharo11OrNewer: [ self debugSession pcRangeForContext: aContext ] - forPharo10: [ | aUsedAst anInterval | - aUsedAst := self evaluatedCode findSourceAstForContext: aContext. - anInterval := GtPharoMethodNodeSourceIntervalFinder new - methodNode: aUsedAst; - sourceString: self sourceString; - find. - anInterval last isZero ifTrue: [ nil ] ifFalse: [ anInterval ] ] + forPharo10: [ self evaluatedCode + findSourceIntervalForContext: aContext + sourceString: self sourceString ] ] { #category : #accessing } diff --git a/src/GToolkit-Coder/TGtSourceCoderEvaluatedCode.trait.st b/src/GToolkit-Coder/TGtSourceCoderEvaluatedCode.trait.st index 762c8e84b..215da8a76 100644 --- a/src/GToolkit-Coder/TGtSourceCoderEvaluatedCode.trait.st +++ b/src/GToolkit-Coder/TGtSourceCoderEvaluatedCode.trait.st @@ -12,9 +12,9 @@ TGtSourceCoderEvaluatedCode >> findRelevantContextInStack: aStack [ ] { #category : #accessing } -TGtSourceCoderEvaluatedCode >> findSourceAstForContext: aContext [ - "Return an AST node that corresponds to a given executed code." +TGtSourceCoderEvaluatedCode >> findSourceIntervalForContext: aContext sourceString: aSourceString [ + "Return source code interval that corresponds to a given executed code." - + ^ nil ] From 13ed295db04130c633d10c6df079213b9b513a28 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 14 May 2024 18:58:06 -0400 Subject: [PATCH 0632/1268] use `SmaCCMethodNodeSourceIntervalFinder` [feenkcom/gtoolkit#3735] delete `GtPharoMethodNodeSourceIntervalFinder` --- ...aroMethodNodeSourceIntervalFinder.class.st | 77 ------------------- 1 file changed, 77 deletions(-) delete mode 100644 src/GToolkit-Coder-UI/GtPharoMethodNodeSourceIntervalFinder.class.st diff --git a/src/GToolkit-Coder-UI/GtPharoMethodNodeSourceIntervalFinder.class.st b/src/GToolkit-Coder-UI/GtPharoMethodNodeSourceIntervalFinder.class.st deleted file mode 100644 index d8fa5b00e..000000000 --- a/src/GToolkit-Coder-UI/GtPharoMethodNodeSourceIntervalFinder.class.st +++ /dev/null @@ -1,77 +0,0 @@ -Class { - #name : #GtPharoMethodNodeSourceIntervalFinder, - #superclass : #Object, - #instVars : [ - 'methodNode', - 'sourceString', - 'sourceAst', - 'sourceNode', - 'sourceInterval' - ], - #category : #'GToolkit-Coder-UI-Context' -} - -{ #category : #finding } -GtPharoMethodNodeSourceIntervalFinder >> equivalentNodeTo: aNode in: otherTree [ - | equivParent nodeIndex equivNode | - aNode isMethod ifTrue: [ ^ otherTree ]. - (aNode parent isReturn and: [ aNode parent parent parent isMethod ]) - ifTrue: [ equivNode := otherTree isSequence - ifTrue: [ otherTree statements last ] - ifFalse: [ otherTree ]. - ^ equivNode isReturn ifTrue: [ equivNode value ] ifFalse: [ equivNode ] ]. - aNode parent isMethod - ifTrue: [ otherTree isSequence ifTrue: [ ^ otherTree ] ifFalse: [ ^ otherTree parent ] ]. - equivParent := self equivalentNodeTo: aNode parent in: otherTree. - equivParent ifNil: [ ^ nil ]. - nodeIndex := aNode parent children identityIndexOf: aNode. - ^ equivParent children at: nodeIndex ifAbsent: [ nil ] -] - -{ #category : #finding } -GtPharoMethodNodeSourceIntervalFinder >> find [ - "Copy of SmaCCMethodNodeSourceIntervalFinder" - - - sourceAst := RBParser - parseExpression: sourceString - onError: [ :msg :pos | ^ sourceInterval := 1 to: 0 ]. - sourceNode := self equivalentNodeTo: methodNode in: sourceAst. - sourceNode ifNil: [ ^ sourceInterval := 1 to: 0 ]. - ^ sourceInterval := sourceNode start to: sourceNode stop -] - -{ #category : #accessing } -GtPharoMethodNodeSourceIntervalFinder >> methodNode [ - ^ methodNode -] - -{ #category : #accessing } -GtPharoMethodNodeSourceIntervalFinder >> methodNode: anObject [ - methodNode := anObject -] - -{ #category : #'accessing - computed' } -GtPharoMethodNodeSourceIntervalFinder >> sourceAst [ - ^ sourceAst -] - -{ #category : #'accessing - computed' } -GtPharoMethodNodeSourceIntervalFinder >> sourceInterval [ - ^ sourceInterval -] - -{ #category : #'accessing - computed' } -GtPharoMethodNodeSourceIntervalFinder >> sourceNode [ - ^ sourceNode -] - -{ #category : #accessing } -GtPharoMethodNodeSourceIntervalFinder >> sourceString [ - ^ sourceString -] - -{ #category : #accessing } -GtPharoMethodNodeSourceIntervalFinder >> sourceString: anObject [ - sourceString := anObject -] From 45c631ab2fcac7a59911b109301c81663f62edc8 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 15 May 2024 11:16:53 -0400 Subject: [PATCH 0633/1268] the locate debugger button is placed in the same place as the embedded debugger [feenkcom/gtoolkit#3735] --- ...bugSessionInSpaceEvaluationStatus.class.st | 38 +++++++++- ...eddedDebugSessionEvaluationStatus.class.st | 20 ++--- ...tCoderEvaluatedCodeIntervalFinder.class.st | 74 +++++++++++++++++++ 3 files changed, 119 insertions(+), 13 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderEvaluatedCodeIntervalFinder.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderDebugSessionInSpaceEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderDebugSessionInSpaceEvaluationStatus.class.st index a8475fcdc..8f99c3d95 100644 --- a/src/GToolkit-Coder-UI/GtCoderDebugSessionInSpaceEvaluationStatus.class.st +++ b/src/GToolkit-Coder-UI/GtCoderDebugSessionInSpaceEvaluationStatus.class.st @@ -10,7 +10,8 @@ Class { 'debugSession', 'debugger', 'sourceInterval', - 'sourceString' + 'sourceString', + 'evaluatedCode' ], #category : #'GToolkit-Coder-UI-Coders - Evaluation' } @@ -53,6 +54,41 @@ GtCoderDebugSessionInSpaceEvaluationStatus >> debuggerSpace [ space ] +{ #category : #accessing } +GtCoderDebugSessionInSpaceEvaluationStatus >> evaluatedCode [ + + ^ evaluatedCode ifNil: [ + evaluatedCode := GtSourceCoderNoEvaluatedCode default ] +] + +{ #category : #accessing } +GtCoderDebugSessionInSpaceEvaluationStatus >> evaluatedCode: anObject [ + evaluatedCode := anObject +] + +{ #category : #accessing } +GtCoderDebugSessionInSpaceEvaluationStatus >> evaluatedCodeContext [ + "Return a stack context that corresponds to a given evaluated code." + + + self debugSession process ifNil: [ ^ nil ]. + + ^ self evaluatedCode findRelevantContextInStack: self debugSession context stack +] + +{ #category : #accessing } +GtCoderDebugSessionInSpaceEvaluationStatus >> evaluatedCodeInterval [ + "Return an interval that corresponds to a given evaluated code." + + + ^ GtCoderEvaluatedCodeIntervalFinder new + debugSession: self debugSession; + context: self evaluatedCodeContext; + evaluatedCode: self evaluatedCode; + sourceString: self sourceString; + find +] + { #category : #testing } GtCoderDebugSessionInSpaceEvaluationStatus >> hasDebugSessionInSpace [ ^ true diff --git a/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st index 4cbba2335..26dc410a7 100644 --- a/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st +++ b/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st @@ -23,7 +23,8 @@ GtCoderEmbeddedDebugSessionEvaluationStatus >> asDebugSessionInSpaceEvaluationSt debugSession: anAnnouncement releasedSession; debugger: anAnnouncement debugger; sourceInterval: self sourceInterval; - sourceString: self sourceString + sourceString: self sourceString; + evaluatedCode: self evaluatedCode ] { #category : #accessing } @@ -63,17 +64,12 @@ GtCoderEmbeddedDebugSessionEvaluationStatus >> evaluatedCodeInterval [ "Return an interval that corresponds to a given evaluated code." - | aContext | - aContext := self evaluatedCodeContext. - aContext ifNil: [ ^ nil ]. - - (self debugSession process isNil or: [ aContext isDead ]) ifTrue: [ ^ nil ]. - - ^ self - forPharo11OrNewer: [ self debugSession pcRangeForContext: aContext ] - forPharo10: [ self evaluatedCode - findSourceIntervalForContext: aContext - sourceString: self sourceString ] + ^ GtCoderEvaluatedCodeIntervalFinder new + debugSession: self debugSession; + context: self evaluatedCodeContext; + evaluatedCode: self evaluatedCode; + sourceString: self sourceString; + find ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtCoderEvaluatedCodeIntervalFinder.class.st b/src/GToolkit-Coder-UI/GtCoderEvaluatedCodeIntervalFinder.class.st new file mode 100644 index 000000000..31232cdda --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderEvaluatedCodeIntervalFinder.class.st @@ -0,0 +1,74 @@ +Class { + #name : #GtCoderEvaluatedCodeIntervalFinder, + #superclass : #Object, + #instVars : [ + 'debugSession', + 'context', + 'sourceString', + 'evaluatedCode' + ], + #category : #'GToolkit-Coder-UI-Coders - Evaluation' +} + +{ #category : #accessing } +GtCoderEvaluatedCodeIntervalFinder >> context [ + + ^ context +] + +{ #category : #accessing } +GtCoderEvaluatedCodeIntervalFinder >> context: aContext [ + context := aContext +] + +{ #category : #accessing } +GtCoderEvaluatedCodeIntervalFinder >> debugSession [ + + ^ debugSession +] + +{ #category : #accessing } +GtCoderEvaluatedCodeIntervalFinder >> debugSession: anObject [ + debugSession := anObject +] + +{ #category : #accessing } +GtCoderEvaluatedCodeIntervalFinder >> evaluatedCode [ + + ^ evaluatedCode +] + +{ #category : #accessing } +GtCoderEvaluatedCodeIntervalFinder >> evaluatedCode: anObject [ + evaluatedCode := anObject +] + +{ #category : #finding } +GtCoderEvaluatedCodeIntervalFinder >> find [ + "Return an interval that corresponds to a given evaluated code." + + + debugSession ifNil: [ ^ nil ]. + debugSession process ifNil: [ ^ nil ]. + context ifNil: [ ^ nil ]. + context isDead ifTrue: [ ^ nil ]. + + ^ self + forPharo11OrNewer: [ self debugSession pcRangeForContext: context ] + forPharo10: [ evaluatedCode ifNil: [ ^ nil ]. + sourceString ifNil: [ ^ nil ]. + self evaluatedCode + findSourceIntervalForContext: context + sourceString: sourceString ] +] + +{ #category : #accessing } +GtCoderEvaluatedCodeIntervalFinder >> sourceString [ + + ^ sourceString +] + +{ #category : #accessing } +GtCoderEvaluatedCodeIntervalFinder >> sourceString: anObject [ + sourceString := anObject +] From 36793160828e7a0c5a8d5b7f47e16d2c19910ce4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Fri, 17 May 2024 14:33:47 +0200 Subject: [PATCH 0634/1268] Add GtSharedVariablesBindings>>#interactive to support Pharo 11 --- .../GtSharedVariablesBindings.class.st | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/GToolkit-VariableBindings/GtSharedVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtSharedVariablesBindings.class.st index 1c7d33990..fab16e8fd 100644 --- a/src/GToolkit-VariableBindings/GtSharedVariablesBindings.class.st +++ b/src/GToolkit-VariableBindings/GtSharedVariablesBindings.class.st @@ -64,6 +64,11 @@ GtSharedVariablesBindings >> initialize [ bindings := Dictionary new ] +{ #category : #accessing } +GtSharedVariablesBindings >> interactive [ + ^ false +] + { #category : #binding } GtSharedVariablesBindings >> removeBindingOf: aSymbol [ From 4d00aae5d1cac8186fb48e90e74256fd98eb0849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Tue, 21 May 2024 14:59:24 +0200 Subject: [PATCH 0635/1268] Add #gtPharoPatch: --- src/GToolkit-Coder/RBAddPoolVariableChange.extension.st | 2 ++ src/GToolkit-Coder/RBNamespace.extension.st | 6 ++++-- src/GToolkit-Coder/RBRemovePoolVariableChange.extension.st | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder/RBAddPoolVariableChange.extension.st b/src/GToolkit-Coder/RBAddPoolVariableChange.extension.st index 21b503f5a..0472962ec 100644 --- a/src/GToolkit-Coder/RBAddPoolVariableChange.extension.st +++ b/src/GToolkit-Coder/RBAddPoolVariableChange.extension.st @@ -2,5 +2,7 @@ Extension { #name : #RBAddPoolVariableChange } { #category : #'*GToolkit-Coder' } RBAddPoolVariableChange >> changeObject [ + + ^ Smalltalk globals at: self variable asSymbol ] diff --git a/src/GToolkit-Coder/RBNamespace.extension.st b/src/GToolkit-Coder/RBNamespace.extension.st index 10504677a..15008558d 100644 --- a/src/GToolkit-Coder/RBNamespace.extension.st +++ b/src/GToolkit-Coder/RBNamespace.extension.st @@ -2,7 +2,8 @@ Extension { #name : #RBNamespace } { #category : #'*GToolkit-Coder' } RBNamespace >> category: aString for: aClass [ - + + ^ changes addChange: (RBClassCategoryChange category: aString for: aClass) ] @@ -13,7 +14,8 @@ RBNamespace >> changedClasses [ { #category : #'*GToolkit-Coder' } RBNamespace >> classObjectFor: anObject [ - + + (anObject isBehavior or: [anObject isTrait]) ifTrue: [ ^ self classFor: anObject ]. anObject isSymbol diff --git a/src/GToolkit-Coder/RBRemovePoolVariableChange.extension.st b/src/GToolkit-Coder/RBRemovePoolVariableChange.extension.st index bd8df502d..b5412b257 100644 --- a/src/GToolkit-Coder/RBRemovePoolVariableChange.extension.st +++ b/src/GToolkit-Coder/RBRemovePoolVariableChange.extension.st @@ -2,5 +2,7 @@ Extension { #name : #RBRemovePoolVariableChange } { #category : #'*GToolkit-Coder' } RBRemovePoolVariableChange >> changeObject [ + + ^ Smalltalk globals at: self variable asSymbol ] From 12d42e101eb0d76e0df45b5b1a24f71d63dad284 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 27 May 2024 14:45:23 -0400 Subject: [PATCH 0636/1268] use `GtPhlowDropdownAction>>#preferredExtentFrom:` [feenkcom/gtoolkit#3792] --- src/GToolkit-Coder-UI/Behavior.extension.st | 4 +- ...derHierarchyDropdownConfiguration.class.st | 39 +++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtPharoCoderHierarchyDropdownConfiguration.class.st diff --git a/src/GToolkit-Coder-UI/Behavior.extension.st b/src/GToolkit-Coder-UI/Behavior.extension.st index 226a3d4e8..943f06fff 100644 --- a/src/GToolkit-Coder-UI/Behavior.extension.st +++ b/src/GToolkit-Coder-UI/Behavior.extension.st @@ -45,12 +45,12 @@ Behavior >> gtHierarchyButtonFor: anAction [ icon: BrGlamorousIcons tree; id: GtCoderClassHierarchyButtonId; priority: 3; - preferredExtent: 400 @ 400; + preferredExtentFrom: GtPharoCoderHierarchyDropdownConfiguration; content: [ :aButton | | aNavigationModel | aNavigationModel := aButton phlow firstParentCoderNavigationModel. BlElement new - size: 400 @ 400; + size: GtPharoCoderHierarchyDropdownConfiguration preferredExtent; addChild: ((GtCoderNavigationTabsStencil new navigationModel: aNavigationModel; asElement) background: Color white) ] diff --git a/src/GToolkit-Coder-UI/GtPharoCoderHierarchyDropdownConfiguration.class.st b/src/GToolkit-Coder-UI/GtPharoCoderHierarchyDropdownConfiguration.class.st new file mode 100644 index 000000000..9024cec90 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtPharoCoderHierarchyDropdownConfiguration.class.st @@ -0,0 +1,39 @@ +Class { + #name : #GtPharoCoderHierarchyDropdownConfiguration, + #superclass : #Object, + #classInstVars : [ + 'preferredExtent' + ], + #category : #'GToolkit-Coder-UI' +} + +{ #category : #accessing } +GtPharoCoderHierarchyDropdownConfiguration class >> gtConfiguration [ + ^ {GtPhlowOverviewItem new + name: 'Preferred extent'; + value: self preferredExtent} +] + +{ #category : #accessing } +GtPharoCoderHierarchyDropdownConfiguration class >> gtConfigurationFor: aView [ + + + ^ aView columnedList + title: 'Configuration'; + priority: 40; + actionUpdateButton; + items: [ self gtConfiguration ]; + column: 'Name' text: #name; + column: 'Value' text: #description; + send: #value +] + +{ #category : #accessing } +GtPharoCoderHierarchyDropdownConfiguration class >> preferredExtent [ + ^ preferredExtent ifNil: [ preferredExtent := 400 @ 400 ] +] + +{ #category : #accessing } +GtPharoCoderHierarchyDropdownConfiguration class >> preferredExtent: anObject [ + preferredExtent := anObject +] From 707af4251d3fe24812484c35e832a6321ca6b26e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Tue, 28 May 2024 11:33:53 +0200 Subject: [PATCH 0637/1268] Update how the history of a method is shown [feenkcom/gtoolkit#3793] --- .../CompiledMethod.extension.st | 17 +- .../GtLocalVersion.class.st | 207 ++++++++---------- .../GtLocalVersionElement.class.st | 132 +++++++++++ 3 files changed, 233 insertions(+), 123 deletions(-) create mode 100644 src/GToolkit-Coder-Extensions/GtLocalVersionElement.class.st diff --git a/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st b/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st index 9e19b17c5..fcab20807 100644 --- a/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st +++ b/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st @@ -20,16 +20,25 @@ CompiledMethod >> gtDisplayOn: aStream [ { #category : #'*GToolkit-Coder-Extensions' } CompiledMethod >> gtLocalVersionsFor: aView [ + + self sourcePointer ifNil: [ ^ aView empty ]. + ^ aView list title: 'Local versions'; priority: 10; - items: [ SourceFiles + items: [ + | changeRecords | + changeRecords := SourceFiles changeRecordsFrom: self sourcePointer className: self methodClass instanceSide name - isMeta: self methodClass isMeta ]; - itemStencil: [ GtLocalVersion new ]; + isMeta: self methodClass isMeta. + changeRecords withIndexCollect: [ :aChange :anIndex | + GtLocalVersion + change: aChange + previousChange: (changeRecords at: anIndex + 1 ifAbsent: [nil]) + currentMethod: self ] ]; + itemStencil: [ GtLocalVersionElement new ]; itemDataBinder: [ :aLocalVersionElement :aLocalVersion | aLocalVersionElement - compiledMethod: self; localVersion: aLocalVersion ] ] diff --git a/src/GToolkit-Coder-Extensions/GtLocalVersion.class.st b/src/GToolkit-Coder-Extensions/GtLocalVersion.class.st index 8674d73ce..82f293048 100644 --- a/src/GToolkit-Coder-Extensions/GtLocalVersion.class.st +++ b/src/GToolkit-Coder-Extensions/GtLocalVersion.class.st @@ -1,143 +1,112 @@ Class { #name : #GtLocalVersion, - #superclass : #BrVerticalFlow, + #superclass : #Object, #instVars : [ - 'localVersion', - 'compiledMethod', - 'expander', - 'header', - 'content' + 'previousChangeRecord', + 'currentMethod', + 'changeRecord' ], #category : #'GToolkit-Coder-Extensions' } -{ #category : #accessing } -GtLocalVersion >> compiledMethod [ - - ^ compiledMethod -] - -{ #category : #accessing } -GtLocalVersion >> compiledMethod: anObject [ - - compiledMethod := anObject -] - -{ #category : #accessing } -GtLocalVersion >> content [ - - ^ content -] - -{ #category : #accessing } -GtLocalVersion >> content: anObject [ - - content := anObject -] - -{ #category : #accessing } -GtLocalVersion >> expander [ - - ^ expander -] - -{ #category : #accessing } -GtLocalVersion >> expander: anObject [ - - expander := anObject -] - -{ #category : #accessing } -GtLocalVersion >> header [ - - ^ header -] - -{ #category : #accessing } -GtLocalVersion >> header: anObject [ - - header := anObject -] - -{ #category : #accessing } -GtLocalVersion >> initialize [ - super initialize. - - self hMatchParent vFitContent padding: (BlInsets all: 2). - - self initializeHeader. - self initializeContent. - self initializeExpander. - - self addChild: self expander +{ #category : #'instance creation' } +GtLocalVersion class >> change: aChangeRecord previousChange: aPreviousChangeRecord currentMethod: aMethod [ + ^ self new + initializeWithChange: aChangeRecord + previousChange: aPreviousChangeRecord + currentMethod: aMethod +] + +{ #category : #accessing } +GtLocalVersion >> currentSourceCodeInImage [ + ^ currentMethod + ifNil: [ '' ] + ifNotNil: [ :aMethod | + aMethod sourceCode ] +] + +{ #category : #'gt - extensions' } +GtLocalVersion >> gtViewDiffWithInImageCodeFor: aView [ + + + ^ aView explicit + title: 'Diff (current)'; + priority: 10; + stencil: [ + | change styler | + + change := GtDiffBuilder + computeDifferencesFrom: self sourceCode + to: self currentSourceCodeInImage + using: GtSmaCCDiffSplitter forPharo. + + styler := GtCodeDiffRBTextStyler new. + + GtDiffElementWithLabelStencil new + fromLabelText: 'Version'; + toLabelText: 'Image'; + change: change; + styler: styler ] +] + +{ #category : #'gt - extensions' } +GtLocalVersion >> gtViewDiffWithPreviousFor: aView [ + + + ^ aView explicit + title: 'Diff'; + priority: 5; + stencil: [ + | change styler | + + change := GtDiffBuilder + computeDifferencesFrom: self previousSourceCode + to: self sourceCode + using: GtSmaCCDiffSplitter forPharo. + + styler := GtCodeDiffRBTextStyler new. + + GtDiffElementWithLabelStencil new + fromLabelText: 'Previous'; + toLabelText: 'Changed'; + change: change; + styler: styler ] ] -{ #category : #accessing } -GtLocalVersion >> initializeContent [ - content := BrVerticalFlow new matchParent +{ #category : #initialization } +GtLocalVersion >> initializeWithChange: aChangeRecord previousChange: aPreviousChangeRecord currentMethod: aMethod [ + changeRecord := aChangeRecord. + previousChangeRecord := aPreviousChangeRecord. + currentMethod := aMethod. ] -{ #category : #accessing } -GtLocalVersion >> initializeExpander [ - expander := BrExpander new hMatchParent vFitContent - aptitude: GtCoderExpanderAptitude new; - header: [ self header ]; - content: [ self content ] +{ #category : #actions } +GtLocalVersion >> loadChange [ + ^ changeRecord asMCMethodDefinition load ] { #category : #accessing } -GtLocalVersion >> initializeHeader [ - header := BrHorizontalFlow new matchParent +GtLocalVersion >> previousSourceCode [ + ^ previousChangeRecord + ifNil: [ '' ] + ifNotNil: [ :aChangeRecord | + aChangeRecord sourceCode ] ] { #category : #accessing } -GtLocalVersion >> localVersion: aLocalVersion [ - localVersion := aLocalVersion. - self updateView -] - -{ #category : #accessing } -GtLocalVersion >> updateContent [ - | previousContent newContent change styler | - previousContent := compiledMethod sourceCode. - newContent := localVersion sourceCode. - - content removeChildren. - - change := GtDiffBuilder - computeDifferencesFrom: previousContent - to: newContent - using: GtSmaCCDiffSplitter forPharo. - styler := GtCodeDiffRBTextStyler new. - - content - addChild: (BrLabel new - aptitude: BrGlamorousLabelAptitude; - text: 'Version at ' , localVersion timeStamp printToSeconds); - addChild: (GtDiffElementWithLabelStencil new - fromLabelText: 'Current'; - toLabelText: 'Version'; - change: change; - styler: styler) create; - addChild: (BrFrame new - addChild: (BrButton new - icon: BrGlamorousVectorIcons accept; - label: 'Use this version'; - aptitude: BrGlamorousButtonWithIconAptitude; - action: [ :aButton | localVersion asMCMethodDefinition load ])) +GtLocalVersion >> printOn: aStream [ + super printOn: aStream . + + aStream parenthesize: [ + changeRecord printOn: aStream ] ] { #category : #accessing } -GtLocalVersion >> updateHeader [ - header removeChildren. - header - addChild: (BrLabel new - aptitude: BrGlamorousLabelAptitude; - text: 'Version at ' , localVersion timeStamp printToSeconds) +GtLocalVersion >> sourceCode [ + ^ changeRecord sourceCode ] { #category : #accessing } -GtLocalVersion >> updateView [ - self updateHeader. - self updateContent. +GtLocalVersion >> timeStamp [ + ^ changeRecord timeStamp ] diff --git a/src/GToolkit-Coder-Extensions/GtLocalVersionElement.class.st b/src/GToolkit-Coder-Extensions/GtLocalVersionElement.class.st new file mode 100644 index 000000000..74095ef64 --- /dev/null +++ b/src/GToolkit-Coder-Extensions/GtLocalVersionElement.class.st @@ -0,0 +1,132 @@ +Class { + #name : #GtLocalVersionElement, + #superclass : #BrVerticalFlow, + #instVars : [ + 'localVersion', + 'expander', + 'header', + 'content' + ], + #category : #'GToolkit-Coder-Extensions' +} + +{ #category : #accessing } +GtLocalVersionElement >> content [ + + ^ content +] + +{ #category : #accessing } +GtLocalVersionElement >> content: anObject [ + + content := anObject +] + +{ #category : #accessing } +GtLocalVersionElement >> expander [ + + ^ expander +] + +{ #category : #accessing } +GtLocalVersionElement >> expander: anObject [ + + expander := anObject +] + +{ #category : #accessing } +GtLocalVersionElement >> header [ + + ^ header +] + +{ #category : #accessing } +GtLocalVersionElement >> header: anObject [ + + header := anObject +] + +{ #category : #accessing } +GtLocalVersionElement >> initialize [ + super initialize. + + self hMatchParent vFitContent padding: (BlInsets all: 2). + + self initializeHeader. + self initializeContent. + self initializeExpander. + + self addChild: self expander +] + +{ #category : #accessing } +GtLocalVersionElement >> initializeContent [ + content := BrVerticalFlow new matchParent +] + +{ #category : #accessing } +GtLocalVersionElement >> initializeExpander [ + expander := BrExpander new hMatchParent vFitContent + aptitude: GtCoderExpanderAptitude new; + header: [ self header ]; + content: [ self content ] +] + +{ #category : #accessing } +GtLocalVersionElement >> initializeHeader [ + header := BrHorizontalFlow new matchParent +] + +{ #category : #accessing } +GtLocalVersionElement >> localVersion: aLocalVersion [ + localVersion := aLocalVersion. + self updateView +] + +{ #category : #accessing } +GtLocalVersionElement >> updateContent [ + | currentContent previousContent change styler | + previousContent := localVersion previousSourceCode. + currentContent := localVersion sourceCode. + + content removeChildren. + + change := GtDiffBuilder + computeDifferencesFrom: previousContent + to: currentContent + using: GtSmaCCDiffSplitter forPharo. + styler := GtCodeDiffRBTextStyler new. + + content + addChild: (BrLabel new + aptitude: BrGlamorousLabelAptitude; + text: 'Version at ' , localVersion timeStamp printToSeconds); + addChild: (GtDiffElementWithLabelStencil new + fromLabelText: 'Previous'; + toLabelText: 'Changed'; + change: change; + styler: styler) create; + addChild: (BrFrame new + fitContent; + padding: (BlInsets left: 5); + addChild: (BrButton new + icon: BrGlamorousVectorIcons accept; + label: 'Use this version'; + aptitude: BrGlamorousButtonWithIconAptitude; + action: [ :aButton | localVersion loadChange ])) +] + +{ #category : #accessing } +GtLocalVersionElement >> updateHeader [ + header removeChildren. + header + addChild: (BrLabel new + aptitude: BrGlamorousLabelAptitude; + text: 'Version at ' , localVersion timeStamp printToSeconds) +] + +{ #category : #accessing } +GtLocalVersionElement >> updateView [ + self updateHeader. + self updateContent. +] From e9b3b25399dbbe1745f3403adbb048d5777570a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Tue, 28 May 2024 14:48:48 +0200 Subject: [PATCH 0638/1268] Add a load action to GtLocalVersion [feenkcom/gtoolkit#3793] --- src/GToolkit-Coder-Extensions/GtLocalVersion.class.st | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/GToolkit-Coder-Extensions/GtLocalVersion.class.st b/src/GToolkit-Coder-Extensions/GtLocalVersion.class.st index 82f293048..dfbf5017d 100644 --- a/src/GToolkit-Coder-Extensions/GtLocalVersion.class.st +++ b/src/GToolkit-Coder-Extensions/GtLocalVersion.class.st @@ -25,6 +25,13 @@ GtLocalVersion >> currentSourceCodeInImage [ aMethod sourceCode ] ] +{ #category : #'gt - extensions' } +GtLocalVersion >> gtActionLoadVersionFor: anAction [ + + + ^ changeRecord gtActionLoadVersionFor: anAction +] + { #category : #'gt - extensions' } GtLocalVersion >> gtViewDiffWithInImageCodeFor: aView [ From 6bb40c826be1882e4bd2822f72e0a1874faef5db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Tue, 11 Jun 2024 10:01:41 +0200 Subject: [PATCH 0639/1268] Enable scrolling in the list of filters in case they go out of screen --- src/GToolkit-Coder-UI/GtFilterTagElement.class.st | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st index 712e39c38..a3dbb19d3 100644 --- a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st @@ -138,7 +138,8 @@ GtFilterTagElement >> createCompletionValuesDropdownContent [ { #category : #'private - instance creation' } GtFilterTagElement >> createDropdownContent [ ^ BrSimpleList new - fitContent; + vFitContentLimited; + hFitContent; stencil: [ :eachFilterDescriptor :eachIndex | BrHorizontalPane new id: (GtFilterTagPickerItemId indexed: eachIndex); From d62b846c06e6601175b735308c800be01a4feb93 Mon Sep 17 00:00:00 2001 From: John Brant Date: Thu, 13 Jun 2024 07:47:19 -0500 Subject: [PATCH 0640/1268] adding reorder parameters for extract python function --- .../GtRenameAction.class.st | 41 +++++++++++-------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtRenameAction.class.st b/src/GToolkit-Coder-AddOns/GtRenameAction.class.st index 7be47997c..9087f237d 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameAction.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameAction.class.st @@ -21,25 +21,25 @@ GtRenameAction >> addRenameAttributes [ | text cursorInLocation | text := self text. cursorInLocation := originalLocations - anySatisfy: - [ :each | originalCursorPosition between: each first - 1 and: each last ]. + anySatisfy: [ :each | originalCursorPosition between: each first - 1 and: each last ]. renameAttributes := originalLocations - collect: [ :each | - | attribute | - attribute := (cursorInLocation not - or: [ originalCursorPosition between: each first - 1 and: each last ]) - ifTrue: [ GtRenameEditorAttribute new - action: self; - selectAll: selectAll; - filter: filter; - cursorLocation: originalCursorPosition - each first + 1; - text: (text from: each first to: each last) ] - ifFalse: [ GtRenamePreviewAttribute new - action: self; - text: (text from: each first to: each last) ]. - cursorInLocation := true. - (text from: each first to: each last) attributes: {attribute}. - attribute ] + collect: [ :each | + | attribute | + attribute := (cursorInLocation not + or: [ originalCursorPosition between: each first - 1 and: each last ]) + ifTrue: [ GtRenameEditorAttribute new + action: self; + selectAll: selectAll; + filter: filter; + coordinateFocus: self shouldCoordinateFocus; + cursorLocation: originalCursorPosition - each first + 1; + text: (text from: each first to: each last) ] + ifFalse: [ GtRenamePreviewAttribute new + action: self; + text: (text from: each first to: each last) ]. + cursorInLocation := true. + (text from: each first to: each last) attributes: {attribute}. + attribute ] ] { #category : #'private - actions' } @@ -67,6 +67,11 @@ GtRenameAction >> saveOriginalState [ originalCursorPosition := self textEditor cursors first position ] +{ #category : #private } +GtRenameAction >> shouldCoordinateFocus [ + ^ false +] + { #category : #accessing } GtRenameAction >> text [ ^ self textEditor text From cb604b53fa013a7f2b84f8ad3c388e180f5cf99d Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 24 Jun 2024 09:43:35 -0400 Subject: [PATCH 0641/1268] Coder Addons view includes `#initializeAddOns:...` methods --- src/GToolkit-Coder/GtCoderModel.class.st | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/GToolkit-Coder/GtCoderModel.class.st b/src/GToolkit-Coder/GtCoderModel.class.st index bd99f8d9d..89a8bebc1 100644 --- a/src/GToolkit-Coder/GtCoderModel.class.st +++ b/src/GToolkit-Coder/GtCoderModel.class.st @@ -47,21 +47,23 @@ GtCoderModel class >> contextMenuAddOnsPragma [ { #category : #'private - addons' } GtCoderModel class >> gtAstCoderAddOnsFor: aView context: aPhlowContext [ - ^ aView forward title: 'Coder Addons'; tooltip: 'The methods that extend the Coder with AddOns'; priority: 40; object: [ (GtSearchMethodsInClassFilter new forClass: self; - includeSuperclass: true) & self astExtensionsPragma gtPragmas ]; + includeSuperclass: true) + & (self astExtensionsPragma gtPragmas | #initializeAddOns: gtImplementors + | #initializeAddOns:viewModel: gtImplementors) ]; view: #gtItemsFor:; - actionButtonIcon: BrGlamorousVectorIcons inspect + actionButtonIcon: BrGlamorousVectorIcons inspect tooltip: 'Inspect Addons' - action: [ :aButton | - aButton phlow spawnObject: (GtSearchMethodsInClassFilter new - forClass: self; - includeSuperclass: true) & self astExtensionsPragma gtPragmas ] + action: [ :aButton | + aButton phlow + spawnObject: (GtSearchMethodsInClassFilter new + forClass: self; + includeSuperclass: true) & self astExtensionsPragma gtPragmas ] ] { #category : #'private - addons' } From d20a96ef399df97e5718adceef0549a74625e3a9 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 5 Jul 2024 18:26:22 -0400 Subject: [PATCH 0642/1268] FixIt attributes can define element IDs [feenkcom/gtoolkit#3862] --- .../GtFixItAttribute.class.st | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st index e48f8d9c0..8eeb19a0d 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st @@ -6,7 +6,8 @@ Class { 'descriptionBlock', 'hoverMarker', 'hoverAttribute', - 'label' + 'label', + 'elementId' ], #category : #'GToolkit-Coder-AddOns-FixIt' } @@ -64,6 +65,7 @@ GtFixItAttribute >> description: aBlockReturningBlText [ GtFixItAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ | button dropDownAptitude | button := GtFixItButton new. + elementId ifNotNil: [ button id: elementId ]. button beTinySize. button label: (label ifNil: [ 'Fix it' ]). @@ -126,6 +128,16 @@ GtFixItAttribute >> dropDownElementFor: anEditorElement [ ^ pane ] +{ #category : #accessing } +GtFixItAttribute >> elementId [ + ^ elementId +] + +{ #category : #accessing } +GtFixItAttribute >> elementId: anObject [ + elementId := anObject +] + { #category : #initialization } GtFixItAttribute >> fixItActions: aCollection [ fixItActionsBlock := aCollection From 1042384f73288bd41364314572c4b5b0958bdd3c Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Sat, 6 Jul 2024 20:54:36 -0400 Subject: [PATCH 0643/1268] `GtContextVariablesBindings>>#bindingOf:` returns `DoItVariable` instances [feenkcom/gtoolkit#3860] --- .../GtContextVariablesBindings.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-VariableBindings/GtContextVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtContextVariablesBindings.class.st index 38758fc6d..f85c967a0 100644 --- a/src/GToolkit-VariableBindings/GtContextVariablesBindings.class.st +++ b/src/GToolkit-VariableBindings/GtContextVariablesBindings.class.st @@ -38,7 +38,7 @@ GtContextVariablesBindings >> bindingOf: aSymbol [ ifNil: [ ^ nil ]. var isLocalVariable ifFalse: [ ^ nil ]. - ^ var + ^ var asDoItVariableFrom: context. ] { #category : #binding } From 0aa4abf09931de8a028203c63610230de06abca5 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 10 Jul 2024 14:01:43 -0400 Subject: [PATCH 0644/1268] `GtSingleCoderViewModel` uses `TGtOptions` [feenkcom/gtoolkit#3868] --- src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st index a6922f4ac..873284adb 100644 --- a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st @@ -7,8 +7,8 @@ Wraps {{gtClass:GtCoderModel}} and optionally adds UI related api and state. Cod Class { #name : #GtSingleCoderViewModel, #superclass : #Object, - #traits : 'TGtAnnouncer', - #classTraits : 'TGtAnnouncer classTrait', + #traits : 'TGtAnnouncer + TGtOptions', + #classTraits : 'TGtAnnouncer classTrait + TGtOptions classTrait', #instVars : [ 'announcer', 'codersUIModel', From 84f31f10952783cb14d5c1b4956ea6d9c1bff516 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 11 Jul 2024 16:40:57 -0400 Subject: [PATCH 0645/1268] `GtCoderEvaluationStatus` uses `TGtOptions` [feenkcom/gtoolkit#3735] --- .../GtCoderEvaluationStatus.class.st | 2 ++ .../GtSourceCoderViewModel.class.st | 8 ----- .../GtTextualCoderEditorElement.class.st | 30 ------------------- 3 files changed, 2 insertions(+), 38 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderEvaluationStatus.class.st index d23e314b4..1404dddda 100644 --- a/src/GToolkit-Coder-UI/GtCoderEvaluationStatus.class.st +++ b/src/GToolkit-Coder-UI/GtCoderEvaluationStatus.class.st @@ -7,6 +7,8 @@ See my subclasses for concrete evaluation statuses: {{gtClass:GtCoderEvaluationS Class { #name : #GtCoderEvaluationStatus, #superclass : #Object, + #traits : 'TGtOptions', + #classTraits : 'TGtOptions classTrait', #category : #'GToolkit-Coder-UI-Coders - Evaluation' } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st index 2ed83adc5..cb8935bfa 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st @@ -369,14 +369,6 @@ GtSourceCoderViewModel >> selectedTextInterval [ GtSourceCoderViewModel >> subscribeToCoderModel [ super subscribeToCoderModel. - true ifTrue: [ - "Currently, we dispatch the show debugger request using TGtCoderRequesterObject. - We likely do not want to handle it listening to GtCoder models as we observed - unresponsive images if a debug session was terminated twice. This may be solved - by sharing same GtSharedDebugSession instances among all subscribers. It was not - tested as dispaching the request throught TGtCoderRequesterObject seems to be - better solution." - ^ self ]. self coderModel weak when: GtCoderShowDebuggerRequest send: #onShowDebuggerRequest: diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 2a6337b3a..0d0a074a1 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -250,36 +250,6 @@ GtTextualCoderEditorElement >> onRemovedFromSceneGraph [ GtTextualCoderEditorElementRemovedFromSceneGraphSignal emit ] -{ #category : #'private - event handling' } -GtTextualCoderEditorElement >> onShowDebuggerRequest: aShowDebuggerAnnouncement [ - | sharedDebugSession anEvaluatedSource anEvaluatedInterval theSourceStartInText theSourceEndInText | - self flag: #delete. - evaluationHighlighter hideResult. - evaluationPrinter hideResult. - true ifTrue: [ ^ self ]. - sharedDebugSession := GtSharedDebugSession new - session: aShowDebuggerAnnouncement debugSession. - self - showNotification: (GtNotificationDebugSession new debugSession: sharedDebugSession). - anEvaluatedSource := aShowDebuggerAnnouncement sourceString. - anEvaluatedInterval := aShowDebuggerAnnouncement sourceInterval. - theSourceStartInText := self text finder - caseSensitiveSubstring: anEvaluatedSource; - startAtPosition: anEvaluatedInterval first; - searchClosest. "what did we evaluate?" - theSourceStartInText isZero ifTrue: [ ^ self ]. - theSourceEndInText := theSourceStartInText + anEvaluatedSource size - 1 - min: self text size. - self text - clearAttributes: [ :each | {GtEmbeddedDebuggerAttribute} anySatisfy: [ :cls | each isKindOf: cls ] ]. - self text - attribute: (GtEmbeddedDebuggerAttribute new - signaledException: aShowDebuggerAnnouncement exception; - debugSession: sharedDebugSession) - from: theSourceEndInText - to: theSourceEndInText -] - { #category : #'private - event handling' } GtTextualCoderEditorElement >> onStyleTextRequest: anEvent [ "onStyleTextRequest: may be sent from a non-UI thread" From a1041c71560167d954af3569f0a011b6c88f43b0 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 11 Jul 2024 18:41:43 -0400 Subject: [PATCH 0646/1268] ensure that only one debugger notification is displayed [feenkcom/gtoolkit#3735] Terminate a previous embedded debugger session on new debug session evaluation status. --- ...bugSessionInSpaceEvaluationStatus.class.st | 7 +++ ...eddedDebugSessionEvaluationStatus.class.st | 48 +++++++++++++++++-- .../GtCoderEvaluationStatus.class.st | 12 +++-- ...ationStatusShowNotificationSignal.class.st | 40 ++++++++++++++++ .../GtCoderNoEvaluationStatus.class.st | 11 ----- .../GtSourceCoderEditorElement.class.st | 5 +- ...rViewModelEvaluationStatusChanged.class.st | 15 +++++- 7 files changed, 115 insertions(+), 23 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderEvaluationStatusShowNotificationSignal.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderDebugSessionInSpaceEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderDebugSessionInSpaceEvaluationStatus.class.st index 8f99c3d95..629819f3f 100644 --- a/src/GToolkit-Coder-UI/GtCoderDebugSessionInSpaceEvaluationStatus.class.st +++ b/src/GToolkit-Coder-UI/GtCoderDebugSessionInSpaceEvaluationStatus.class.st @@ -94,6 +94,13 @@ GtCoderDebugSessionInSpaceEvaluationStatus >> hasDebugSessionInSpace [ ^ true ] +{ #category : #'api - hooks' } +GtCoderDebugSessionInSpaceEvaluationStatus >> mayTerminateSourceCoderViewModel: aViewModel sharedDebugSessionOfStatus: anEvaluationStatus [ + "We want to keep the debug session, since we are about to open it in a full window." + + +] + { #category : #actions } GtCoderDebugSessionInSpaceEvaluationStatus >> requestDebuggerSpaceClose [ ^ self debuggerSpace ifNotNil: #requestClose diff --git a/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st index 26dc410a7..f1d56983a 100644 --- a/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st +++ b/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st @@ -17,6 +17,20 @@ Class { #category : #'GToolkit-Coder-UI-Coders - Evaluation' } +{ #category : #comparing } +GtCoderEmbeddedDebugSessionEvaluationStatus >> = anObject [ + self == anObject ifTrue: [ ^ true ]. + + self class = anObject class ifFalse: [ ^ false ]. + + ^ self debugSession = anObject debugSession + and: [ self sharedDebugSession = anObject sharedDebugSession + and: [ self exception = anObject exception + and: [ self evaluatedCode = anObject evaluatedCode + and: [ self sourceInterval = anObject sourceInterval + and: [ self sourceString = anObject sourceString ] ] ] ] ] +] + { #category : #converting } GtCoderEmbeddedDebugSessionEvaluationStatus >> asDebugSessionInSpaceEvaluationStatusFromAnnouncement: anAnnouncement [ ^ GtCoderDebugSessionInSpaceEvaluationStatus new @@ -112,19 +126,43 @@ GtCoderEmbeddedDebugSessionEvaluationStatus >> gtEvaluatedSourceFor: aView [ ^ aView text title: 'Evaluated source'; + priority: 20; text: [ self gtEvaluatedSource ] ] +{ #category : #'api - hooks' } +GtCoderEmbeddedDebugSessionEvaluationStatus >> handleStatusChangedAnnouncement: anAnnouncement sourceCoderElement: anElement [ + "I request to display a debug session notification. This method must be called + from an element, listening to GtSourceCoderViewModelEvaluationStatusChanged." + + + anAnnouncement isNotificationHandled ifTrue: [ ^ self ]. + anAnnouncement isNotificationHandled: true. + + GtCoderEvaluationStatusShowNotificationSignal new + evaluationStatus: self; + announcement: anAnnouncement; + sourceCoderElement: anElement; + emit. + + anElement + showNotification: (GtNotificationDebugSession new debugSession: self sharedDebugSession) +] + { #category : #testing } GtCoderEmbeddedDebugSessionEvaluationStatus >> hasSharedDebugSession [ ^ true ] -{ #category : #'api - hooks' } -GtCoderEmbeddedDebugSessionEvaluationStatus >> onSourceCoderElement: anElement [ - "This code must be called from a coder element (or moved to an element), listening to GtSourceCoderViewModelEvaluationStatusChanged." - anElement - showNotification: (GtNotificationDebugSession new debugSession: self sharedDebugSession) +{ #category : #comparing } +GtCoderEmbeddedDebugSessionEvaluationStatus >> hash [ + ^ self class hash + bitXor: (self debugSession hash + bitXor: (self sharedDebugSession hash + bitXor: (self exception hash + bitXor: (self evaluatedCode hash + bitXor: (self sourceInterval hash + bitXor: (self sourceString hash )))))) ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtCoderEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderEvaluationStatus.class.st index 1404dddda..c8870aac5 100644 --- a/src/GToolkit-Coder-UI/GtCoderEvaluationStatus.class.st +++ b/src/GToolkit-Coder-UI/GtCoderEvaluationStatus.class.st @@ -22,6 +22,11 @@ GtCoderEvaluationStatus >> asDebugSessionInSpaceEvaluationStatusFromAnnouncement ^ GtCoderNoEvaluationStatus default ] +{ #category : #'api - hooks' } +GtCoderEvaluationStatus >> handleStatusChangedAnnouncement: anAnnouncement sourceCoderElement: anElement [ + +] + { #category : #testing } GtCoderEvaluationStatus >> hasDebugSessionInSpace [ ^ false @@ -38,11 +43,10 @@ GtCoderEvaluationStatus >> mayCloseSourceCoderViewModel: aViewModel debuggerSpac { #category : #'api - hooks' } GtCoderEvaluationStatus >> mayTerminateSourceCoderViewModel: aViewModel sharedDebugSessionOfStatus: anEvaluationStatus [ -] + "Usually, we want to terminate a debug session of a previous evaluation status." -{ #category : #'api - hooks' } -GtCoderEvaluationStatus >> onSourceCoderElement: anElement [ - + anEvaluationStatus sharedDebugSession unsubscribe: aViewModel. + anEvaluationStatus sharedDebugSession terminate ] { #category : #'api - hooks' } diff --git a/src/GToolkit-Coder-UI/GtCoderEvaluationStatusShowNotificationSignal.class.st b/src/GToolkit-Coder-UI/GtCoderEvaluationStatusShowNotificationSignal.class.st new file mode 100644 index 000000000..d98067a49 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderEvaluationStatusShowNotificationSignal.class.st @@ -0,0 +1,40 @@ +Class { + #name : #GtCoderEvaluationStatusShowNotificationSignal, + #superclass : #ContextStackSignal, + #instVars : [ + 'evaluationStatus', + 'announcement', + 'sourceCoderElement' + ], + #category : #'GToolkit-Coder-UI-Signals' +} + +{ #category : #accessing } +GtCoderEvaluationStatusShowNotificationSignal >> announcement [ + ^ announcement +] + +{ #category : #accessing } +GtCoderEvaluationStatusShowNotificationSignal >> announcement: anObject [ + announcement := anObject +] + +{ #category : #accessing } +GtCoderEvaluationStatusShowNotificationSignal >> evaluationStatus [ + ^ evaluationStatus +] + +{ #category : #accessing } +GtCoderEvaluationStatusShowNotificationSignal >> evaluationStatus: anObject [ + evaluationStatus := anObject +] + +{ #category : #accessing } +GtCoderEvaluationStatusShowNotificationSignal >> sourceCoderElement [ + ^ sourceCoderElement +] + +{ #category : #accessing } +GtCoderEvaluationStatusShowNotificationSignal >> sourceCoderElement: anObject [ + sourceCoderElement := anObject +] diff --git a/src/GToolkit-Coder-UI/GtCoderNoEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderNoEvaluationStatus.class.st index 4b0d2ab08..f4f5ac062 100644 --- a/src/GToolkit-Coder-UI/GtCoderNoEvaluationStatus.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNoEvaluationStatus.class.st @@ -15,14 +15,3 @@ Class { GtCoderNoEvaluationStatus >> gtDisplayOn: stream [ stream nextPutAll: 'No evaluation' ] - -{ #category : #'api - hooks' } -GtCoderNoEvaluationStatus >> mayCloseSourceCoderViewModel: aViewModel debuggerSpaceOfStatus: anEvaluationStatus [ - -] - -{ #category : #'api - hooks' } -GtCoderNoEvaluationStatus >> mayTerminateSourceCoderViewModel: aViewModel sharedDebugSessionOfStatus: anEvaluationStatus [ - anEvaluationStatus sharedDebugSession unsubscribe: aViewModel. - anEvaluationStatus sharedDebugSession terminate -] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st index 5ff9fb349..781a913c5 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st @@ -17,8 +17,9 @@ GtSourceCoderEditorElement >> onTextualCoderViewModelChanged [ GtSourceCoderEditorElement >> onViewModelEvaluationStatusChanged: anAnnouncement [ BlTaskAction enqueueElement: self - action: [ - anAnnouncement evaluationStatus onSourceCoderElement: self. + action: [ anAnnouncement evaluationStatus + handleStatusChangedAnnouncement: anAnnouncement + sourceCoderElement: self. self styleText ] ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderViewModelEvaluationStatusChanged.class.st b/src/GToolkit-Coder-UI/GtSourceCoderViewModelEvaluationStatusChanged.class.st index 269889cd2..9aff8aaf1 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderViewModelEvaluationStatusChanged.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderViewModelEvaluationStatusChanged.class.st @@ -2,7 +2,8 @@ Class { #name : #GtSourceCoderViewModelEvaluationStatusChanged, #superclass : #GtTextualCoderViewModelAnnouncement, #instVars : [ - 'evaluationStatus' + 'evaluationStatus', + 'isNotificationHandled' ], #category : #'GToolkit-Coder-UI-Coder - Source Model' } @@ -16,3 +17,15 @@ GtSourceCoderViewModelEvaluationStatusChanged >> evaluationStatus [ GtSourceCoderViewModelEvaluationStatusChanged >> evaluationStatus: anObject [ evaluationStatus := anObject ] + +{ #category : #accessing } +GtSourceCoderViewModelEvaluationStatusChanged >> isNotificationHandled [ + "Indicates, whether a user notification, e.g., debug session notification, was requested (and therefore displayed)." + + ^ isNotificationHandled ifNil: [ isNotificationHandled := false ] +] + +{ #category : #accessing } +GtSourceCoderViewModelEvaluationStatusChanged >> isNotificationHandled: aBoolean [ + isNotificationHandled := aBoolean +] From 99d628875f5ae5ba8fd122a2a3dd98b6c726bd2c Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 11 Jul 2024 18:49:14 -0400 Subject: [PATCH 0647/1268] add `GtCoderIncomingEvaluationStatusSignal` [feenkcom/gtoolkit#3735] --- ...derIncomingEvaluationStatusSignal.class.st | 49 +++++++++++++++++++ .../GtSourceCoderViewModel.class.st | 15 ++++-- 2 files changed, 59 insertions(+), 5 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderIncomingEvaluationStatusSignal.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderIncomingEvaluationStatusSignal.class.st b/src/GToolkit-Coder-UI/GtCoderIncomingEvaluationStatusSignal.class.st new file mode 100644 index 000000000..da03177ca --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderIncomingEvaluationStatusSignal.class.st @@ -0,0 +1,49 @@ +Class { + #name : #GtCoderIncomingEvaluationStatusSignal, + #superclass : #ContextStackSignal, + #instVars : [ + 'viewModel', + 'existingStatus', + 'newStatus' + ], + #category : #'GToolkit-Coder-UI-Signals' +} + +{ #category : #accessing } +GtCoderIncomingEvaluationStatusSignal >> existingStatus [ + ^ existingStatus +] + +{ #category : #accessing } +GtCoderIncomingEvaluationStatusSignal >> existingStatus: anObject [ + existingStatus := anObject +] + +{ #category : #accessing } +GtCoderIncomingEvaluationStatusSignal >> newStatus [ + ^ newStatus +] + +{ #category : #accessing } +GtCoderIncomingEvaluationStatusSignal >> newStatus: anObject [ + newStatus := anObject +] + +{ #category : #printing } +GtCoderIncomingEvaluationStatusSignal >> printOneLineContentsOn: stream [ + stream print: viewModel identityHash. + stream nextPutAll: ', '. + existingStatus gtDisplayOn: stream. + stream nextPutAll: ' -> '. + newStatus gtDisplayOn: stream +] + +{ #category : #accessing } +GtCoderIncomingEvaluationStatusSignal >> viewModel [ + ^ viewModel +] + +{ #category : #accessing } +GtCoderIncomingEvaluationStatusSignal >> viewModel: anObject [ + viewModel := anObject +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st index cb8935bfa..81dbc8b3e 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st @@ -173,17 +173,22 @@ GtSourceCoderViewModel >> evaluationStatus [ ] { #category : #'api - accessing' } -GtSourceCoderViewModel >> evaluationStatus: aStatus [ +GtSourceCoderViewModel >> evaluationStatus: aNewStatus [ | anOldStatus | - evaluationStatus = aStatus ifTrue: [ ^ self ]. + GtCoderIncomingEvaluationStatusSignal new + existingStatus: evaluationStatus; + newStatus: aNewStatus; + viewModel: self; + emit. + evaluationStatus = aNewStatus ifTrue: [ ^ self ]. anOldStatus := evaluationStatus. - evaluationStatus := aStatus. + evaluationStatus := aNewStatus. GtCoderEvaluationStatusChangedSignal new oldStatus: anOldStatus; - newStatus: aStatus; + newStatus: aNewStatus; viewModel: self; emit. - anOldStatus sourceCoderViewModel: self evaluationStatusChangedTo: aStatus. + anOldStatus sourceCoderViewModel: self evaluationStatusChangedTo: aNewStatus. self onEvaluationStatusChanged ] From ae19dd84052c506485ce9ed372f6c26b1852b2d9 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 12 Jul 2024 21:08:05 -0400 Subject: [PATCH 0648/1268] It is possible to evaluate class variables and class slots [feenkcom/gtoolkit#3861] --- .../GtSlotVariablesBindings.class.st | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st index 10eb63e79..65c76d3df 100644 --- a/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st +++ b/src/GToolkit-VariableBindings/GtSlotVariablesBindings.class.st @@ -35,9 +35,13 @@ GtSlotVariablesBindings >> bindingOf: aSymbol [ gtSlotNamed: aSymbol ifFound: [ :aSlot | aSlot ] ifNone: [ - object class - classVariableNamed: aSymbol - ifAbsent: [ nil ] ] + object class isInstanceSide + ifTrue: [ object class + classVariableNamed: aSymbol + ifAbsent: [ nil ] ] + ifFalse: [ object + classVariableNamed: aSymbol + ifAbsent: [ nil ] ] ] ] { #category : #binding } @@ -45,7 +49,10 @@ GtSlotVariablesBindings >> bindingValueOf: aSymbol [ "aSymbol is a variable name. Return a value of the variable." - ^ (self bindingOf: aSymbol) ifNotNil: [ :aSlot | aSlot read: self object ] + ^ (self bindingOf: aSymbol) ifNotNil: [ :aSlot | + aSlot isClassVariable + ifTrue: [ aSlot value ] + ifFalse: [ aSlot read: self object ] ] ] { #category : #testing } @@ -55,9 +62,9 @@ GtSlotVariablesBindings >> hasBindingOf: aSymbol [ ^ object class gtSlotNamed: aSymbol ifFound: [ :slot | true ] - ifNone: [ object class = object class instanceSide + ifNone: [ object class isInstanceSide ifTrue: [ object class hasClassVarNamed: aSymbol ] - ifFalse: [ false ] ] + ifFalse: [ object hasClassVarNamed: aSymbol ] ] ] { #category : #comparing } @@ -79,3 +86,13 @@ GtSlotVariablesBindings >> object: anObject [ object := anObject ] + +{ #category : #printing } +GtSlotVariablesBindings >> printOn: aStream [ + super printOn: aStream. + + aStream + nextPut: $(; + print: object; + nextPut: $) +] From e92ec8be5d2ac5e066db741208d7a32c4ea1142a Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Sun, 14 Jul 2024 18:20:00 -0400 Subject: [PATCH 0649/1268] do not call `#value` to display result in a tooltip [feenkcom/gtoolkit#3888] --- .../GtPlaygroundEvaluatedCodeButtonAttribute.class.st | 2 +- .../GtPlaygroundEvaluatedCodeViewButtonAttribute.class.st | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st b/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st index e07bcdd09..dfb767754 100644 --- a/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st @@ -84,7 +84,7 @@ GtPlaygroundEvaluatedCodeButtonAttribute >> mayHaveExternalReferences [ { #category : #initialization } GtPlaygroundEvaluatedCodeButtonAttribute >> playgroundElementIn: aContainer [ - ^ (self result value gtViewsFor: GtPhlowEmptyView new) + ^ (self result gtViewsFor: GtPhlowEmptyView new) asElementDo: [ :anInspectorElement | aContainer addChild: ((anInspectorElement exact: 400 @ 400) asScalableElement size: 200 @ 200) ] diff --git a/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeViewButtonAttribute.class.st b/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeViewButtonAttribute.class.st index fc706100c..a853f21d2 100644 --- a/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeViewButtonAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeViewButtonAttribute.class.st @@ -21,7 +21,7 @@ GtPlaygroundEvaluatedCodeViewButtonAttribute >> initialize [ { #category : #accessing } GtPlaygroundEvaluatedCodeViewButtonAttribute >> playgroundElementIn: aContainer [ - ^ (self result value perform: self view withArguments: {GtPhlowEmptyView new}) + ^ (self result perform: self view withArguments: {GtPhlowEmptyView new}) asElementDo: [ :anInspectorElement | aContainer addChild: (anInspectorElement asScalableElement size: 200 @ 200) ] ] From 92e45bc965a344929d652a72954e40a23882af88 Mon Sep 17 00:00:00 2001 From: John Brant Date: Wed, 17 Jul 2024 07:59:21 -0500 Subject: [PATCH 0650/1268] [feenkcom/gtoolkit#3758] renaming package tags in coder --- src/GToolkit-Coder-UI/GtCoderElement.class.st | 1 + ...igationPackagesTagsClassesElement.class.st | 22 ++++++++++++++ ...oderNavigationPackagesTreeElement.class.st | 26 ++++++++++++++++- ...tCoderNavigationPackageTagRenamed.class.st | 29 +++++++++++++++++++ src/GToolkit-Coder/RPackageTag.extension.st | 5 ++++ 5 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 src/GToolkit-Coder/GtCoderNavigationPackageTagRenamed.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderElement.class.st b/src/GToolkit-Coder-UI/GtCoderElement.class.st index 834423962..e19b065ae 100644 --- a/src/GToolkit-Coder-UI/GtCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderElement.class.st @@ -163,6 +163,7 @@ GtCoderElement >> subscribeToNavigationModel [ GtCoderNavigationPackageSelected, GtCoderNavigationPackageRenamed, GtCoderNavigationPackageTagSelected, + GtCoderNavigationPackageTagRenamed, GtCoderNavigationClassSelected, GtCoderNavigationClassRenamed, GtCoderNavigationClassModified diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 343c7da79..ac5ecfe2d 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -483,6 +483,15 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackageTagRemoved: anAnnounceme suppressListChangeEventsDuring: [ self removePackage: anAnnouncement package tag: anAnnouncement tag ] ] +{ #category : #'event handling' } +GtCoderNavigationPackagesTagsClassesElement >> onPackageTagRenamed: anAnnouncement [ + self + suppressListChangeEventsDuring: [ self + renamePackageTag: anAnnouncement package + oldName: anAnnouncement oldName + newName: anAnnouncement newName ] +] + { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageTagSelected: anAnnouncer [ self @@ -661,6 +670,18 @@ GtCoderNavigationPackagesTagsClassesElement >> renamePackage: aPackage oldName: self selectPackageOrTag: aSelectedPackageOrTag ]. ] +{ #category : #'api - package updates' } +GtCoderNavigationPackagesTagsClassesElement >> renamePackageTag: aPackageTag oldName: anOldName newName: aNewName [ + | aSelectedPackageOrTag | + + packagesList selectedNodeDo: [ :aNode | + aSelectedPackageOrTag := aNode value ]. + + self updatePackageLists. + aSelectedPackageOrTag ifNotNil: [ + self selectPackageOrTag: aSelectedPackageOrTag ]. +] + { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> renameProtocol: protocolName in: elem [ | refactoring edit | @@ -934,6 +955,7 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToNavigationModel [ GtCoderNavigationPackageRenamed -> #onPackageRenamed:. GtCoderNavigationPackageTagAdded -> #onPackageTagAdded:. GtCoderNavigationPackageTagRemoved -> #onPackageTagRemoved:. + GtCoderNavigationPackageTagRenamed -> #onPackageTagRenamed:. GtCodersFiltersChanged -> #onMethodsCoderFiltersChanged:. GtCoderNavigationMethodModification -> #onMethodChanged:}. subscriptions diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st index 9c5076ac4..ad1765f15 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st @@ -200,7 +200,31 @@ GtCoderNavigationPackagesTreeElement >> renamePackage: aPackage inElement: elem ] { #category : #initialization } -GtCoderNavigationPackagesTreeElement >> renameTag: aPackageOrTag inElement: elem [ +GtCoderNavigationPackagesTreeElement >> renameTag: aPackageOrTag inElement: elem [ + | refactoring edit childs | + childs := elem children. + edit := BrEditableLabel new. + edit + aptitude: (BrGlamorousEditableLabelAptitude new + fontSize: 11.9; + background: Color transparent); + text: aPackageOrTag name; + when: BrEditorAcceptWish + do: [ :aWish | + refactoring := GtRBRenamePackageTagRefactoring + packageName: aPackageOrTag package name + from: aPackageOrTag name + to: aWish text asString. + edit switchToLabel. + self + addPreviewButtonFor: refactoring + to: elem + cancelBlock: [ elem removeChildren. + elem addChildren: childs ] ]; + switchToEditor. "Force the font to match the label font" + edit requestFocus. + elem removeChildren. + elem addChild: edit ] { #category : #'api - selection' } diff --git a/src/GToolkit-Coder/GtCoderNavigationPackageTagRenamed.class.st b/src/GToolkit-Coder/GtCoderNavigationPackageTagRenamed.class.st new file mode 100644 index 000000000..e285e9fe5 --- /dev/null +++ b/src/GToolkit-Coder/GtCoderNavigationPackageTagRenamed.class.st @@ -0,0 +1,29 @@ +Class { + #name : #GtCoderNavigationPackageTagRenamed, + #superclass : #GtCoderNavigationPackageAnnouncement, + #instVars : [ + 'oldName', + 'newName' + ], + #category : #'GToolkit-Coder-Navigation - Events' +} + +{ #category : #accessing } +GtCoderNavigationPackageTagRenamed >> newName [ + ^ newName +] + +{ #category : #accessing } +GtCoderNavigationPackageTagRenamed >> newName: anObject [ + newName := anObject +] + +{ #category : #accessing } +GtCoderNavigationPackageTagRenamed >> oldName [ + ^ oldName +] + +{ #category : #accessing } +GtCoderNavigationPackageTagRenamed >> oldName: anObject [ + oldName := anObject +] diff --git a/src/GToolkit-Coder/RPackageTag.extension.st b/src/GToolkit-Coder/RPackageTag.extension.st index 5bfacab0a..da654eb28 100644 --- a/src/GToolkit-Coder/RPackageTag.extension.st +++ b/src/GToolkit-Coder/RPackageTag.extension.st @@ -11,3 +11,8 @@ RPackageTag >> gtClassesCoderFor: aView context: aPhlowContext [ disableAsync; stencil: [ aPhlowContext packageTagCoder classesCoder asElement ] ] + +{ #category : #'*GToolkit-Coder' } +RPackageTag >> gtTagName [ + ^ self name +] From 3653dcc987d259a88e393384843018cd4bb007c2 Mon Sep 17 00:00:00 2001 From: John Brant Date: Thu, 18 Jul 2024 08:29:50 -0500 Subject: [PATCH 0651/1268] mark the fix it attribute as potentially having external references so they aren't included in undo/redo history --- src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st index 8eeb19a0d..dbd7bcd26 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st @@ -179,3 +179,8 @@ GtFixItAttribute >> label [ GtFixItAttribute >> label: aString [ label := aString ] + +{ #category : #testing } +GtFixItAttribute >> mayHaveExternalReferences [ + ^ true +] From b868e4fb8afe8f57df95c091de182f08fee18fa6 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 22 Jul 2024 09:05:20 -0400 Subject: [PATCH 0652/1268] add user snippet evaluation configuration [feenkcom/gtoolkit#3735] --- .../GtCoderUserSnippetEvaluationConfiguration.class.st | 10 ++++++++++ src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderUserSnippetEvaluationConfiguration.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderUserSnippetEvaluationConfiguration.class.st b/src/GToolkit-Coder-UI/GtCoderUserSnippetEvaluationConfiguration.class.st new file mode 100644 index 000000000..ed09f30df --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderUserSnippetEvaluationConfiguration.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtCoderUserSnippetEvaluationConfiguration, + #superclass : #Object, + #category : #'GToolkit-Coder-UI-Coder - Source Model' +} + +{ #category : #accessing } +GtCoderUserSnippetEvaluationConfiguration class >> handledErrors [ + ^ GtCoderEvaluationUnhandledError , Halt, Warning +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st index 81dbc8b3e..8efd7632d 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st @@ -197,7 +197,7 @@ GtSourceCoderViewModel >> handleCoderEvaluationUnhandledErrorDuring: aBlock [ ^ [ GtCoderUserSnippetDynamicVariable value: GtCoderUserSnippetEvaluationRunningState default during: aBlock ] - on: GtCoderEvaluationUnhandledError , Halt + on: GtCoderUserSnippetEvaluationConfiguration handledErrors do: [ :anError | GtCoderUserSnippetDynamicVariable value: GtCoderUserSnippetEvaluationExceptionState default . self From 9b336c3a15cf6e6290203cc71192290b77bf19e1 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 26 Jul 2024 18:54:01 -0400 Subject: [PATCH 0653/1268] Add Beacon signal views and print methods [feenkcom/gtoolkit#3908] --- .../GtTextualCoderEditorElement.class.st | 28 ++++++++++++++----- ...GtTextualCoderEditorElementSignal.class.st | 13 +++++++++ 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 0d0a074a1..6294295a3 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -18,7 +18,9 @@ Class { GtTextualCoderEditorElement >> attachSpace [ super attachSpace. - GtTextualCoderEditorElementAttachedSpaceSignal emit + GtTextualCoderEditorElementAttachedSpaceSignal new + element: self; + emit ] { #category : #'api - textual coder view model' } @@ -77,7 +79,9 @@ GtTextualCoderEditorElement >> defaultTextEditorMode [ GtTextualCoderEditorElement >> detachSpace [ super detachSpace. - GtTextualCoderEditorElementDetachedSpaceSignal emit + GtTextualCoderEditorElementDetachedSpaceSignal new + element: self; + emit ] { #category : #'private - updating' } @@ -164,7 +168,9 @@ GtTextualCoderEditorElement >> initializeListeners [ GtTextualCoderEditorElement >> onAddedToSceneGraph [ super onAddedToSceneGraph. - GtTextualCoderEditorElementAddedToSceneGraphSignal emit + GtTextualCoderEditorElementAddedToSceneGraphSignal new + element: self; + emit ] { #category : #'private - event handling' } @@ -247,7 +253,9 @@ GtTextualCoderEditorElement >> onPrintRequest: anEvaluationAnnouncement [ GtTextualCoderEditorElement >> onRemovedFromSceneGraph [ super onRemovedFromSceneGraph. - GtTextualCoderEditorElementRemovedFromSceneGraphSignal emit + GtTextualCoderEditorElementRemovedFromSceneGraphSignal new + element: self; + emit ] { #category : #'private - event handling' } @@ -434,7 +442,9 @@ GtTextualCoderEditorElement >> privateUpdateCursors: anEditorElement announcemen aCursorsChangedAnnouncement source == self textualCoderViewModel ifFalse: [ ^ self ]. - GtTextualCoderEditorElementUpdateCursorsSignal emit. + GtTextualCoderEditorElementUpdateCursorsSignal new + element: self; + emit. self navigator withoutResettingDesiredCoordinate; @@ -445,7 +455,9 @@ GtTextualCoderEditorElement >> privateUpdateCursors: anEditorElement announcemen { #category : #'private - updating' } GtTextualCoderEditorElement >> privateUpdateEditorState: anEditorState [ - GtTextualCoderEditorElementUpdateStateSignal emit. + GtTextualCoderEditorElementUpdateStateSignal new + element: self; + emit. self editor restoreState: anEditorState ] @@ -459,7 +471,9 @@ GtTextualCoderEditorElement >> privateUpdateText: anEditorElement announcement: aGtTextualCoderViewModelTextChanged textualCoderViewModel == self textualCoderViewModel ifFalse: [ ^ self ]. - GtTextualCoderEditorElementUpdateTextSignal emit. + GtTextualCoderEditorElementUpdateTextSignal new + element: self; + emit. "Determine the text that we should use to update the editor." textForUpdate := self computeTextForUpdateForTextChangedEvent: aGtTextualCoderViewModelTextChanged. diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElementSignal.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElementSignal.class.st index 30d183b0f..5b560282a 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElementSignal.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElementSignal.class.st @@ -1,5 +1,18 @@ Class { #name : #GtTextualCoderEditorElementSignal, #superclass : #ContextStackSignal, + #instVars : [ + 'element' + ], #category : #'GToolkit-Coder-UI-Coder - Textual' } + +{ #category : #accessing } +GtTextualCoderEditorElementSignal >> element [ + ^ element +] + +{ #category : #accessing } +GtTextualCoderEditorElementSignal >> element: anObject [ + element := anObject +] From a9570eb876e96bb87020fd5cbded8634f45fdecc Mon Sep 17 00:00:00 2001 From: John Brant Date: Mon, 29 Jul 2024 09:33:51 -0500 Subject: [PATCH 0654/1268] use the gt rename class refactoring instead of the base RB one --- .../GtCoderNavigationClassesHierarchyTreeElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st index 31bcb1e6c..0b652e12a 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st @@ -228,7 +228,7 @@ GtCoderNavigationClassesHierarchyTreeElement >> renameClass: aClass inElement: e text: aClass name; when: BrEditorAcceptWish do: [ :aWish | - refactoring := RBRenameClassRefactoring + refactoring := GtRBRenameClassRefactoring rename: aClass name to: aWish text asString. edit switchToLabel. From 8886267f1668e8ea62e93384b38b6586e6bb79da Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 30 Jul 2024 12:14:54 -0500 Subject: [PATCH 0655/1268] adding extensible rename method refactoring --- .../GtCoderNavigationPackagesTagsClassesElement.class.st | 2 +- src/GToolkit-Coder/GtCoderRenameMethodRefactoring.class.st | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index ac5ecfe2d..fe9730360 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -642,7 +642,7 @@ GtCoderNavigationPackagesTagsClassesElement >> renameMethod: aSelector inElement text: aSelector; when: BrEditorAcceptWish do: [ :aWish | - refactoring := RBRenameMethodRefactoring + refactoring := GtRBRenameMethodRefactoring renameMethod: aSelector in: self selectedClass to: aWish text asString diff --git a/src/GToolkit-Coder/GtCoderRenameMethodRefactoring.class.st b/src/GToolkit-Coder/GtCoderRenameMethodRefactoring.class.st index 5553974bd..0a620836a 100644 --- a/src/GToolkit-Coder/GtCoderRenameMethodRefactoring.class.st +++ b/src/GToolkit-Coder/GtCoderRenameMethodRefactoring.class.st @@ -1,10 +1,10 @@ Class { #name : #GtCoderRenameMethodRefactoring, - #superclass : #RBRenameMethodRefactoring, + #superclass : #GtRBRenameMethodRefactoring, #instVars : [ 'methodCoder' ], - #category : 'GToolkit-Coder-Refactoring' + #category : #'GToolkit-Coder-Refactoring' } { #category : #accessing } From 0680d3df4c496d0f9072c21087d67753b8bb2cc1 Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 30 Jul 2024 13:52:03 -0500 Subject: [PATCH 0656/1268] moving rename method refactoring --- .../GtRBRenameMethodRefactoring.class.st | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/GToolkit-Coder/GtRBRenameMethodRefactoring.class.st diff --git a/src/GToolkit-Coder/GtRBRenameMethodRefactoring.class.st b/src/GToolkit-Coder/GtRBRenameMethodRefactoring.class.st new file mode 100644 index 000000000..1c62793de --- /dev/null +++ b/src/GToolkit-Coder/GtRBRenameMethodRefactoring.class.st @@ -0,0 +1,20 @@ +Class { + #name : #GtRBRenameMethodRefactoring, + #superclass : #RBRenameMethodRefactoring, + #category : #'GToolkit-Coder-Refactorings' +} + +{ #category : #accessing } +GtRBRenameMethodRefactoring >> executeRenameExtensions [ + (Pragma + allNamed: #gtRename + from: self class + to: GtRBRenameMethodRefactoring) + do: [ :each | self perform: each method selector ] +] + +{ #category : #accessing } +GtRBRenameMethodRefactoring >> renameMessageSends [ + super renameMessageSends. + self executeRenameExtensions +] From e52af5b34ebbb90259fea274e2162d0ee1932edc Mon Sep 17 00:00:00 2001 From: Alistair Grant Date: Tue, 6 Aug 2024 11:51:56 +0200 Subject: [PATCH 0657/1268] [feenkcom/gtoolkit#3942] Add GtSourceCoderEvaluationContext --- .../GtCoderCodeExecutor.class.st | 18 +++++++++++-- ...oderDoItAndGoAsynchronousActionId.class.st | 10 +++++++ .../GtSourceCoderViewModel.class.st | 26 ++++++++++++++++++- .../GtSourceCoderEvaluationContext.class.st | 13 +++++++++- 4 files changed, 63 insertions(+), 4 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderDoItAndGoAsynchronousActionId.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st b/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st index 8e7d7bf14..026a97305 100644 --- a/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st +++ b/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st @@ -11,7 +11,8 @@ Class { #instVars : [ 'coderUIModel', 'action', - 'element' + 'element', + 'executionStrategy' ], #category : #'GToolkit-Coder-UI-Execution' } @@ -113,7 +114,20 @@ GtCoderCodeExecutor >> event: anObject [ GtCoderCodeExecutor >> execute [ GtCoderExecutionContextVariable element: self element - do: [ self coderViewModel perform: action ] + do: [ | coderViewModel | + coderViewModel := self coderViewModel. + coderViewModel executionStrategy: executionStrategy. + coderViewModel perform: action ] +] + +{ #category : #accessing } +GtCoderCodeExecutor >> executionStrategy [ + ^ executionStrategy +] + +{ #category : #accessing } +GtCoderCodeExecutor >> executionStrategy: anObject [ + executionStrategy := anObject ] { #category : #initialization } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDoItAndGoAsynchronousActionId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDoItAndGoAsynchronousActionId.class.st new file mode 100644 index 000000000..67c6338f7 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderDoItAndGoAsynchronousActionId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtSourceCoderDoItAndGoAsynchronousActionId, + #superclass : #GtCoderElementId, + #category : #'GToolkit-Coder-UI-Coder - Ids' +} + +{ #category : #converting } +GtSourceCoderDoItAndGoAsynchronousActionId >> asSymbol [ + ^ #'source-coder--doit-and-go-asynchronous-action' +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st index 8efd7632d..6f1106f5b 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st @@ -3,7 +3,8 @@ Class { #superclass : #GtTextualCoderViewModel, #instVars : [ 'evaluationResult', - 'evaluationStatus' + 'evaluationStatus', + 'executionStrategy' ], #category : #'GToolkit-Coder-UI-Coder - Source Model' } @@ -118,6 +119,17 @@ GtSourceCoderViewModel >> doItAndGoAllSerialized [ serializationStrategy: #GtRsrStonSerializationStrategy) ] +{ #category : #'api - actions' } +GtSourceCoderViewModel >> doItAndGoAsynchronous: aTextInterval [ + "Evaluate a piece of source code within an interval and inspect a result." + + ^ self handleCoderEvaluationUnhandledErrorDuring: [ + self coder doItAndGoAsynchronousInContext: ( + self evaluationContext + from: aTextInterval first + to: aTextInterval last) ] +] + { #category : #'api - actions' } GtSourceCoderViewModel >> doItAndGoSerialized [ "Evaluate selected source code or everything if there is nothing selected and inspect the result" @@ -192,6 +204,18 @@ GtSourceCoderViewModel >> evaluationStatus: aNewStatus [ self onEvaluationStatusChanged ] +{ #category : #accessing } +GtSourceCoderViewModel >> executionStrategy [ + + ^ executionStrategy +] + +{ #category : #accessing } +GtSourceCoderViewModel >> executionStrategy: anObject [ + + executionStrategy := anObject +] + { #category : #'private - event handling' } GtSourceCoderViewModel >> handleCoderEvaluationUnhandledErrorDuring: aBlock [ ^ [ GtCoderUserSnippetDynamicVariable diff --git a/src/GToolkit-Coder/GtSourceCoderEvaluationContext.class.st b/src/GToolkit-Coder/GtSourceCoderEvaluationContext.class.st index ddcf4cc31..2577b8979 100644 --- a/src/GToolkit-Coder/GtSourceCoderEvaluationContext.class.st +++ b/src/GToolkit-Coder/GtSourceCoderEvaluationContext.class.st @@ -8,7 +8,8 @@ Class { 'sourceString', 'evaluatedInterval', 'evaluatedSourceString', - 'evaluatedCode' + 'evaluatedCode', + 'executionStrategy' ], #category : #'GToolkit-Coder-Coders - Evaluation' } @@ -66,6 +67,16 @@ GtSourceCoderEvaluationContext >> evaluatedSourceString: anObject [ evaluatedSourceString := anObject ] +{ #category : #accessing } +GtSourceCoderEvaluationContext >> executionStrategy [ + ^ executionStrategy +] + +{ #category : #accessing } +GtSourceCoderEvaluationContext >> executionStrategy: anObject [ + executionStrategy := anObject +] + { #category : #'api - context' } GtSourceCoderEvaluationContext >> from: aStartPosition to: aStopPosition [ sourceInterval := GtSourceCoderEvaluationPartialSource new From 1007e93a298e19ef497511fa91d74a7f26386be5 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 7 Aug 2024 15:14:53 +0200 Subject: [PATCH 0658/1268] `GtCoderToolSpawnRequest`: set and check requester object [feenkcom/gtoolkit#3941] --- src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st | 7 ++++--- src/GToolkit-Coder/GtSourceCoder.class.st | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 6294295a3..a0ea65d92 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -317,9 +317,10 @@ GtTextualCoderEditorElement >> onTextualCoderViewModelChanged [ { #category : #'private - event handling' } GtTextualCoderEditorElement >> onToolSpawnRequest: anAnnouncement [ self enqueueTask: (BlTaskAction new action: [ - self phlow - spawnTool: anAnnouncement tool - withDestination: anAnnouncement spawnDestination ]) + anAnnouncement requesterObject = self textualCoderViewModel ifTrue: [ + self phlow + spawnTool: anAnnouncement tool + withDestination: anAnnouncement spawnDestination ] ]) ] { #category : #'private - event handling' } diff --git a/src/GToolkit-Coder/GtSourceCoder.class.st b/src/GToolkit-Coder/GtSourceCoder.class.st index b074aedc8..b5339675e 100644 --- a/src/GToolkit-Coder/GtSourceCoder.class.st +++ b/src/GToolkit-Coder/GtSourceCoder.class.st @@ -404,6 +404,7 @@ GtSourceCoder >> notifyToolSpawn: aTool withDestination: aSpawnDestination reque self announce: (GtCoderToolSpawnRequest new tool: aTool; spawnDestination: aSpawnDestination; + requesterObject: aRequester; coder: self) ] From 9f51122d17fb0e65e6172f90ccb0a3a672e909ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Wed, 14 Aug 2024 17:02:54 +0200 Subject: [PATCH 0659/1268] Update icon for the search tool --- .../GtPhlowSearchFilterToolElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-SearchFilters-PhlowTool/GtPhlowSearchFilterToolElement.class.st b/src/GToolkit-SearchFilters-PhlowTool/GtPhlowSearchFilterToolElement.class.st index bccad6b86..366a9b4d8 100644 --- a/src/GToolkit-SearchFilters-PhlowTool/GtPhlowSearchFilterToolElement.class.st +++ b/src/GToolkit-SearchFilters-PhlowTool/GtPhlowSearchFilterToolElement.class.st @@ -89,7 +89,7 @@ GtPhlowSearchFilterToolElement >> initialize [ GtPhlowSearchFilterToolElement >> initializeTitleNotifier [ titleNotifier := GtPhlowTitleIconAndLabelNotifier new longLabel: [ self searchFilterDescription ]; - icon: BrGlamorousVectorIcons emphasizedBrowse. + icon: BrGlamorousVectorIcons search. self addEventHandler: titleNotifier. ] From 14ddaed26d67169d17f77d6c9223ef37eee4ce87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Thu, 15 Aug 2024 14:28:37 +0200 Subject: [PATCH 0660/1268] Add multiple views in the search filter tool [feenkcom/gtoolkit#3956] --- .../GtPhlowSearchFilterToolElement.class.st | 79 +++++++++++++------ 1 file changed, 56 insertions(+), 23 deletions(-) diff --git a/src/GToolkit-SearchFilters-PhlowTool/GtPhlowSearchFilterToolElement.class.st b/src/GToolkit-SearchFilters-PhlowTool/GtPhlowSearchFilterToolElement.class.st index 366a9b4d8..f38a55879 100644 --- a/src/GToolkit-SearchFilters-PhlowTool/GtPhlowSearchFilterToolElement.class.st +++ b/src/GToolkit-SearchFilters-PhlowTool/GtPhlowSearchFilterToolElement.class.st @@ -8,12 +8,6 @@ Class { #category : #'GToolkit-SearchFilters-PhlowTool' } -{ #category : #'building - widgets' } -GtPhlowSearchFilterToolElement >> buildContentElement [ - ^ BrFrame new - matchParent -] - { #category : #'building - widgets' } GtPhlowSearchFilterToolElement >> buildHeaderElement [ | headerElement titleLabel | @@ -56,9 +50,18 @@ GtPhlowSearchFilterToolElement >> buildToolLabel [ text: 'Search Filter'. ] -{ #category : #'accessing - elements' } -GtPhlowSearchFilterToolElement >> contentElement [ - ^ self childNamed: #content +{ #category : #'building - widgets' } +GtPhlowSearchFilterToolElement >> buildViewsContainerElement [ + ^ BrFrame new + matchParent +] + +{ #category : #accessing } +GtPhlowSearchFilterToolElement >> collectToolViews [ + ^ GtPhlowViewsCollector new + pragmaName: #gtToolView; + fromObject: searchFilter; + collect ] { #category : #'accessing - elements' } @@ -73,16 +76,21 @@ GtPhlowSearchFilterToolElement >> initialize [ self matchParent. self padding: (BlInsets top: 5 left: 6 bottom: 0 right: 6). + self initializeContent. + self initializeTitleNotifier. +] + +{ #category : #initialization } +GtPhlowSearchFilterToolElement >> initializeContent [ self addChild: (self buildToolLabel padding: (BlInsets left: 5)) as: #toolLabel. self addChild: (self buildHeaderElement padding: (BlInsets left: 5)) as: #header. - self addChild: (self buildContentElement - padding: (BlInsets top: 5)) as: #content. + + self addChild: (self buildViewsContainerElement + padding: (BlInsets top: 5)) as: #viewsContainer. self addChild: (self buildPlaygroundPageElement padding: (BlInsets top: 5)) as: #playgroundPage. - - self initializeTitleNotifier. ] { #category : #accessing } @@ -124,24 +132,49 @@ GtPhlowSearchFilterToolElement >> titleNotifier [ ] { #category : #updating } -GtPhlowSearchFilterToolElement >> updateContainedView [ - | viewElement | - viewElement := (searchFilter gtItemsFor: GtPhlowEmptyView new) - asElementDo: [ :e | e ]. - self contentElement +GtPhlowSearchFilterToolElement >> updateContainedViews [ + | tabGroup compositeView | + + compositeView := GtPhlowCompositeView new + views:self collectToolViews. + + "This particular views do not update" + "compositeView views do: [ :aView | + aView autoUpdates definitions removeAll ]." + + tabGroup := compositeView asElementDo: [ :e | e ]. + + self viewsContainerElement removeChildren; - addChild: viewElement + addChild: tabGroup ] { #category : #updating } GtPhlowSearchFilterToolElement >> updateContent [ - self titleLabel text: self searchFilterDescription. - self updateContainedView. - self playgroundElement objectHolder: (GtInspectorObject new - object: searchFilter) + self updateHeader. + self updateContainedViews. + self updatePlayground. +] + +{ #category : #updating } +GtPhlowSearchFilterToolElement >> updateHeader [ + self titleLabel + text: self searchFilterDescription. +] + +{ #category : #updating } +GtPhlowSearchFilterToolElement >> updatePlayground [ + self playgroundElement + objectHolder: (GtInspectorObject new + object: searchFilter) ] { #category : #updating } GtPhlowSearchFilterToolElement >> updateTabLabel [ self titleNotifier notify ] + +{ #category : #'accessing - elements' } +GtPhlowSearchFilterToolElement >> viewsContainerElement [ + ^ self childNamed: #viewsContainer +] From 641c8f54baba566af611d76e64302dc3b5cc3250 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Thu, 15 Aug 2024 17:33:18 +0200 Subject: [PATCH 0661/1268] Allow also actions in the search filter tool [feenkcom/gtoolkit#3956] --- .../GtPhlowSearchFilterToolElement.class.st | 95 +++++++++++++++---- 1 file changed, 75 insertions(+), 20 deletions(-) diff --git a/src/GToolkit-SearchFilters-PhlowTool/GtPhlowSearchFilterToolElement.class.st b/src/GToolkit-SearchFilters-PhlowTool/GtPhlowSearchFilterToolElement.class.st index f38a55879..4487d7d38 100644 --- a/src/GToolkit-SearchFilters-PhlowTool/GtPhlowSearchFilterToolElement.class.st +++ b/src/GToolkit-SearchFilters-PhlowTool/GtPhlowSearchFilterToolElement.class.st @@ -10,16 +10,10 @@ Class { { #category : #'building - widgets' } GtPhlowSearchFilterToolElement >> buildHeaderElement [ - | headerElement titleLabel | - - headerElement := BrHorizontalPane new + ^ BrVerticalPane new + padding: (BlInsets left: 5); vFitContent; - hMatchParent. - - titleLabel := self buildTitleLabel. - - headerElement addChild: titleLabel as: #titleLabel. - ^ headerElement + hMatchParent ] { #category : #'building - widgets' } @@ -32,6 +26,13 @@ GtPhlowSearchFilterToolElement >> buildPlaygroundPageElement [ ^ playgroundElement ] +{ #category : #'building - widgets' } +GtPhlowSearchFilterToolElement >> buildTitleContainer [ + ^ BrHorizontalPane new + vFitContent; + hMatchParent +] + { #category : #'building - widgets' } GtPhlowSearchFilterToolElement >> buildTitleLabel [ ^ BrLabel new @@ -50,12 +51,31 @@ GtPhlowSearchFilterToolElement >> buildToolLabel [ text: 'Search Filter'. ] +{ #category : #'building - widgets' } +GtPhlowSearchFilterToolElement >> buildToolbar [ + ^ BrToolbar new + aptitude: BrGlamorousToolbarAptitude new; + fitContent; + constraintsDo: [ :c | + c ignoreByLayout. + c ignored horizontal alignRight. + c ignored vertical alignTop ] +] + { #category : #'building - widgets' } GtPhlowSearchFilterToolElement >> buildViewsContainerElement [ ^ BrFrame new matchParent ] +{ #category : #accessing } +GtPhlowSearchFilterToolElement >> collectToolActions [ + ^ GtPhlowActionsCollector new + pragmaName: #gtToolAction; + fromObject: searchFilter; + collect +] + { #category : #accessing } GtPhlowSearchFilterToolElement >> collectToolViews [ ^ GtPhlowViewsCollector new @@ -74,7 +94,7 @@ GtPhlowSearchFilterToolElement >> initialize [ super initialize. self matchParent. - self padding: (BlInsets top: 5 left: 6 bottom: 0 right: 6). + self padding: (BlInsets top: 5 left: 5 bottom: 0 right: 5). self initializeContent. self initializeTitleNotifier. @@ -82,15 +102,26 @@ GtPhlowSearchFilterToolElement >> initialize [ { #category : #initialization } GtPhlowSearchFilterToolElement >> initializeContent [ - self addChild: (self buildToolLabel - padding: (BlInsets left: 5)) as: #toolLabel. - self addChild: (self buildHeaderElement - padding: (BlInsets left: 5)) as: #header. + self initializeHeaderElement. - self addChild: (self buildViewsContainerElement - padding: (BlInsets top: 5)) as: #viewsContainer. - self addChild: (self buildPlaygroundPageElement - padding: (BlInsets top: 5)) as: #playgroundPage. + self addChild: self buildViewsContainerElement as: #viewsContainer. + self addChild: self buildPlaygroundPageElement as: #playgroundPage. +] + +{ #category : #initialization } +GtPhlowSearchFilterToolElement >> initializeHeaderElement [ + | headerElement titleContainer | + + headerElement := self buildHeaderElement. + + titleContainer := self buildTitleContainer. + titleContainer addChild: self buildTitleLabel as: #titleLabel. + titleContainer addChild: self buildToolbar as: #headerToolbar. + + headerElement addChild: self buildToolLabel as: #toolLabel. + headerElement addChild: titleContainer as: #titleContainer. + + self addChild: headerElement as: #header. ] { #category : #accessing } @@ -131,6 +162,11 @@ GtPhlowSearchFilterToolElement >> titleNotifier [ ^ titleNotifier ] +{ #category : #'accessing - elements' } +GtPhlowSearchFilterToolElement >> toolbarElement [ + ^ self headerElement childNamed: #headerToolbar +] + { #category : #updating } GtPhlowSearchFilterToolElement >> updateContainedViews [ | tabGroup compositeView | @@ -158,8 +194,8 @@ GtPhlowSearchFilterToolElement >> updateContent [ { #category : #updating } GtPhlowSearchFilterToolElement >> updateHeader [ - self titleLabel - text: self searchFilterDescription. + self updateTitle. + self updateToolbarActions. ] { #category : #updating } @@ -174,6 +210,25 @@ GtPhlowSearchFilterToolElement >> updateTabLabel [ self titleNotifier notify ] +{ #category : #updating } +GtPhlowSearchFilterToolElement >> updateTitle [ + self titleLabel + text: self searchFilterDescription. +] + +{ #category : #updating } +GtPhlowSearchFilterToolElement >> updateToolbarActions [ + | toolbarElement| + toolbarElement := self toolbarElement. + toolbarElement removeAllItems. + + self collectToolActions do: [ :aPhlowAction | + aPhlowAction asElement: [ :actionElement | + toolbarElement + addItem: actionElement ] + withHostElement: self ] +] + { #category : #'accessing - elements' } GtPhlowSearchFilterToolElement >> viewsContainerElement [ ^ self childNamed: #viewsContainer From 4009594e758c6587ec32aca6a319cdccdf2a569a Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 27 Aug 2024 12:58:55 +0200 Subject: [PATCH 0662/1268] boolean, and short-list filter widgets [feenkcom/gtoolkit#3983] [work-in-progress] --- ...GtFilterElementByScripterExamples.class.st | 40 ++++ .../GtFilterModelExamples.class.st | 45 +++++ .../GtFilterBooleanModel.class.st | 48 +++++ ...GtFilterBooleanModelSwitchChanged.class.st | 29 +++ .../GtFilterBooleanSettingsElement.class.st | 59 ++++++ .../GtFilterBooleanViewModel.class.st | 40 ++++ ...lterBooleanViewModelSwitchChanged.class.st | 29 +++ src/GToolkit-Coder-UI/GtFilterModel.class.st | 34 ++++ .../GtFilterModelAnnouncement.class.st | 18 ++ .../GtFilterNameElement.class.st | 118 +++++++++++ .../GtFilterSettingsElement.class.st | 23 +++ .../GtFilterShortListModel.class.st | 67 +++++++ .../GtFilterShortListModelItem.class.st | 36 ++++ ...tFilterShortListModelItemsChanged.class.st | 18 ++ ...ShortListModelSelectedItemChanged.class.st | 18 ++ .../GtFilterShortListModelStringItem.class.st | 38 ++++ .../GtFilterShortListSettingsElement.class.st | 189 ++++++++++++++++++ .../GtFilterShortListViewModel.class.st | 76 +++++++ ...terShortListViewModelItemsChanged.class.st | 18 ++ ...tListViewModelSelectedItemChanged.class.st | 18 ++ .../GtFilterTextModel.class.st | 43 ++++ .../GtFilterTextModelTextChanged.class.st | 18 ++ .../GtFilterTextSettingsElement.class.st | 55 +++++ .../GtFilterTextViewModel.class.st | 38 ++++ .../GtFilterTextViewModelTextChanged.class.st | 18 ++ .../GtFilterViewModel.class.st | 28 +++ .../GtFilterViewModelAnnouncement.class.st | 18 ++ src/GToolkit-Coder-UI/String.extension.st | 6 + .../TFilterWithWithFilterModel.trait.st | 7 + .../TGtWithFilterModel.trait.st | 42 ++++ .../TGtWithFilterViewModel.trait.st | 48 +++++ 31 files changed, 1282 insertions(+) create mode 100644 src/GToolkit-Coder-Examples/GtFilterElementByScripterExamples.class.st create mode 100644 src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterBooleanModel.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterBooleanModelSwitchChanged.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterBooleanSettingsElement.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterBooleanViewModel.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterBooleanViewModelSwitchChanged.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterModel.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterModelAnnouncement.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterNameElement.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterSettingsElement.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterShortListModel.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterShortListModelItem.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterShortListModelItemsChanged.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterShortListModelSelectedItemChanged.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterShortListModelStringItem.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterShortListViewModel.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterShortListViewModelItemsChanged.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterShortListViewModelSelectedItemChanged.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterTextModel.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterTextModelTextChanged.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterTextViewModel.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterTextViewModelTextChanged.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterViewModel.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterViewModelAnnouncement.class.st create mode 100644 src/GToolkit-Coder-UI/String.extension.st create mode 100644 src/GToolkit-Coder-UI/TFilterWithWithFilterModel.trait.st create mode 100644 src/GToolkit-Coder-UI/TGtWithFilterModel.trait.st create mode 100644 src/GToolkit-Coder-UI/TGtWithFilterViewModel.trait.st diff --git a/src/GToolkit-Coder-Examples/GtFilterElementByScripterExamples.class.st b/src/GToolkit-Coder-Examples/GtFilterElementByScripterExamples.class.st new file mode 100644 index 000000000..7a57e076c --- /dev/null +++ b/src/GToolkit-Coder-Examples/GtFilterElementByScripterExamples.class.st @@ -0,0 +1,40 @@ +Class { + #name : #GtFilterElementByScripterExamples, + #superclass : #Object, + #traits : 'TBlDevScripterExamples', + #classTraits : 'TBlDevScripterExamples classTrait', + #category : #'GToolkit-Coder-Examples-Filters - New' +} + +{ #category : #examples } +GtFilterElementByScripterExamples >> booleanElement [ + + | aScripter | + aScripter := self + scripterWithModel: [ GtFilterModelExamples new booleanModel ] + element: [ :aModel | GtFilterNameElement new filterViewModel: aModel asFilterViewModel ]. + + ^ aScripter +] + +{ #category : #examples } +GtFilterElementByScripterExamples >> shortListElement [ + + | aScripter | + aScripter := self + scripterWithModel: [ GtFilterModelExamples new shortListModel ] + element: [ :aModel | GtFilterNameElement new filterViewModel: aModel asFilterViewModel ]. + + ^ aScripter +] + +{ #category : #examples } +GtFilterElementByScripterExamples >> textElement [ + + | aScripter | + aScripter := self + scripterWithModel: [ GtFilterModelExamples new textModel ] + element: [ :aModel | GtFilterNameElement new filterViewModel: aModel asFilterViewModel ]. + + ^ aScripter +] diff --git a/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st b/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st new file mode 100644 index 000000000..d3c077cd3 --- /dev/null +++ b/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st @@ -0,0 +1,45 @@ +Class { + #name : #GtFilterModelExamples, + #superclass : #Object, + #category : #'GToolkit-Coder-Examples-Filters - New' +} + +{ #category : #examples } +GtFilterModelExamples >> booleanModel [ + + | aModel | + aModel := GtFilterBooleanModel new. + aModel switchedOn: true. + self assert: aModel isSwitchedOn. + + ^ aModel +] + +{ #category : #examples } +GtFilterModelExamples >> shortListModel [ + + | aModel | + aModel := GtFilterShortListModel new. + aModel + items: {'instance'. + 'class'}. + aModel selectedItem: 'class'. + self + assert: aModel items + equals: ({'instance'. + 'class'} collect: #asFilterShortListModelItem). + self assert: aModel selectedItem equals: 'class' asFilterShortListModelItem. + + ^ aModel +] + +{ #category : #examples } +GtFilterModelExamples >> textModel [ + + | aModel | + aModel := GtFilterTextModel new. + aModel text: 'Object'. + self assert: (aModel text equals: 'Object' asRopedText). + + ^ aModel +] diff --git a/src/GToolkit-Coder-UI/GtFilterBooleanModel.class.st b/src/GToolkit-Coder-UI/GtFilterBooleanModel.class.st new file mode 100644 index 000000000..f4992ec97 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterBooleanModel.class.st @@ -0,0 +1,48 @@ +Class { + #name : #GtFilterBooleanModel, + #superclass : #GtFilterModel, + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #accessing } +GtFilterBooleanModel >> filterViewModelClass [ + ^ GtFilterBooleanViewModel +] + +{ #category : #'initialization ' } +GtFilterBooleanModel >> initialize [ + super initialize. + switchedOn := false +] + +{ #category : #testing } +GtFilterBooleanModel >> isSwitchedOff [ + ^ self isSwitchedOn not +] + +{ #category : #testing } +GtFilterBooleanModel >> isSwitchedOn [ + ^ switchedOn +] + +{ #category : #'private - notifying' } +GtFilterBooleanModel >> notifySwitchChanged [ + self + announce: (GtFilterBooleanModelSwitchChanged new + model: self; + switchedOn: self isSwitchedOn) +] + +{ #category : #accessing } +GtFilterBooleanModel >> switchedOn [ + + ^ switchedOn +] + +{ #category : #accessing } +GtFilterBooleanModel >> switchedOn: aBoolean [ + self switchedOn = aBoolean ifTrue: [ ^ self ]. + + switchedOn := aBoolean. + self notifySwitchChanged +] diff --git a/src/GToolkit-Coder-UI/GtFilterBooleanModelSwitchChanged.class.st b/src/GToolkit-Coder-UI/GtFilterBooleanModelSwitchChanged.class.st new file mode 100644 index 000000000..39ea7cf1c --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterBooleanModelSwitchChanged.class.st @@ -0,0 +1,29 @@ +Class { + #name : #GtFilterBooleanModelSwitchChanged, + #superclass : #GtFilterModelAnnouncement, + #instVars : [ + 'switchedOn' + ], + #category : #'GToolkit-Coder-UI-Filters - Events' +} + +{ #category : #testing } +GtFilterBooleanModelSwitchChanged >> isOff [ + ^ self switchedOn not +] + +{ #category : #testing } +GtFilterBooleanModelSwitchChanged >> isOn [ + ^ self switchedOn +] + +{ #category : #accessing } +GtFilterBooleanModelSwitchChanged >> switchedOn [ + + ^ switchedOn +] + +{ #category : #accessing } +GtFilterBooleanModelSwitchChanged >> switchedOn: aBoolean [ + switchedOn := aBoolean +] diff --git a/src/GToolkit-Coder-UI/GtFilterBooleanSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterBooleanSettingsElement.class.st new file mode 100644 index 000000000..4568a1519 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterBooleanSettingsElement.class.st @@ -0,0 +1,59 @@ +Class { + #name : #GtFilterBooleanSettingsElement, + #superclass : #GtFilterSettingsElement, + #instVars : [ + 'switcherElement' + ], + #category : #'GToolkit-Coder-UI-Filters - Widgets' +} + +{ #category : #initialization } +GtFilterBooleanSettingsElement >> initialize [ + super initialize. + self initializeSwitcherElement. + self addChild: switcherElement as: #switcher +] + +{ #category : #initialization } +GtFilterBooleanSettingsElement >> initializeSwitcherElement [ + switcherElement := BrCheckbox new + fitContent; + aptitude: BrGlamorousCheckboxAptitude; + whenCheckedDo: [ :anEvent | self onCheckedEvent: anEvent ]; + whenUncheckedDo: [ :anEvent | self onUncheckedEvent: anEvent ]. +] + +{ #category : #'event handling' } +GtFilterBooleanSettingsElement >> onCheckedEvent: anEvent [ +] + +{ #category : #'as yet unclassified' } +GtFilterBooleanSettingsElement >> onFilterViewModelChanged [ + super onFilterViewModelChanged. + + self updateSwitcherElement +] + +{ #category : #'event handling' } +GtFilterBooleanSettingsElement >> onSwitchChanged: anAnnouncement [ + BlTaskAction enqueueElement: self action: [ self updateSwitcherElement ] +] + +{ #category : #'event handling' } +GtFilterBooleanSettingsElement >> onUncheckedEvent: anEvent [ +] + +{ #category : #'api - filter view model' } +GtFilterBooleanSettingsElement >> subscribeToFilterViewModel [ + super subscribeToFilterViewModel. + + self filterViewModel weak + when: GtFilterBooleanViewModelSwitchChanged + send: #onSwitchChanged: + to: self +] + +{ #category : #'private - updating' } +GtFilterBooleanSettingsElement >> updateSwitcherElement [ + switcherElement checked: self filterViewModel isSwitchedOn +] diff --git a/src/GToolkit-Coder-UI/GtFilterBooleanViewModel.class.st b/src/GToolkit-Coder-UI/GtFilterBooleanViewModel.class.st new file mode 100644 index 000000000..e1aee8b10 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterBooleanViewModel.class.st @@ -0,0 +1,40 @@ +Class { + #name : #GtFilterBooleanViewModel, + #superclass : #GtFilterViewModel, + #category : #'GToolkit-Coder-UI-Filters - View Models' +} + +{ #category : #accessing } +GtFilterBooleanViewModel >> filterElementClass [ + ^ GtFilterBooleanSettingsElement +] + +{ #category : #testing } +GtFilterBooleanViewModel >> isSwitchedOff [ + ^ self filterModel isSwitchedOff +] + +{ #category : #testing } +GtFilterBooleanViewModel >> isSwitchedOn [ + ^ self filterModel isSwitchedOn +] + +{ #category : #'event handling' } +GtFilterBooleanViewModel >> onSwitchChanged: anAnnouncement [ + self announce: (GtFilterBooleanViewModelSwitchChanged new viewModel: self) +] + +{ #category : #'api - filter model' } +GtFilterBooleanViewModel >> subscribeToFilterModel [ + super subscribeToFilterModel. + self filterModel weak + when: GtFilterBooleanModelSwitchChanged + send: #onSwitchChanged: + to: self +] + +{ #category : #'api - filter model' } +GtFilterBooleanViewModel >> unsubscribeFromFilterModel [ + super unsubscribeFromFilterModel. + self filterModel unsubscribe: self +] diff --git a/src/GToolkit-Coder-UI/GtFilterBooleanViewModelSwitchChanged.class.st b/src/GToolkit-Coder-UI/GtFilterBooleanViewModelSwitchChanged.class.st new file mode 100644 index 000000000..15b3eeadc --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterBooleanViewModelSwitchChanged.class.st @@ -0,0 +1,29 @@ +Class { + #name : #GtFilterBooleanViewModelSwitchChanged, + #superclass : #GtFilterViewModelAnnouncement, + #instVars : [ + 'switchedOn' + ], + #category : #'GToolkit-Coder-UI-Filters - Events' +} + +{ #category : #testing } +GtFilterBooleanViewModelSwitchChanged >> isOff [ + ^ self switchedOn not +] + +{ #category : #testing } +GtFilterBooleanViewModelSwitchChanged >> isOn [ + ^ self switchedOn +] + +{ #category : #'as yet unclassified' } +GtFilterBooleanViewModelSwitchChanged >> switchedOn [ + + ^ switchedOn +] + +{ #category : #'as yet unclassified' } +GtFilterBooleanViewModelSwitchChanged >> switchedOn: aBoolean [ + switchedOn := aBoolean +] diff --git a/src/GToolkit-Coder-UI/GtFilterModel.class.st b/src/GToolkit-Coder-UI/GtFilterModel.class.st new file mode 100644 index 000000000..39edba99b --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModel.class.st @@ -0,0 +1,34 @@ +Class { + #name : #GtFilterModel, + #superclass : #Object, + #traits : 'TGtAnnouncer', + #classTraits : 'TGtAnnouncer classTrait', + #instVars : [ + 'announcer' + ], + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #announcer } +GtFilterModel >> announcer [ + + ^ announcer ifNil: [ announcer := Announcer new ] +] + +{ #category : #converting } +GtFilterModel >> asFilterViewModel [ + + ^ self filterViewModelClass new filterModel: self +] + +{ #category : #converting } +GtFilterModel >> asUserSettingsElement [ + + ^ self asFilterViewModel asUserSettingsElement +] + +{ #category : #accessing } +GtFilterModel >> filterViewModelClass [ + + ^ self subclassResponsibility +] diff --git a/src/GToolkit-Coder-UI/GtFilterModelAnnouncement.class.st b/src/GToolkit-Coder-UI/GtFilterModelAnnouncement.class.st new file mode 100644 index 000000000..5a1391ff2 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModelAnnouncement.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtFilterModelAnnouncement, + #superclass : #Announcement, + #instVars : [ + 'model' + ], + #category : #'GToolkit-Coder-UI-Filters - Events' +} + +{ #category : #accessing } +GtFilterModelAnnouncement >> model [ + ^ model +] + +{ #category : #accessing } +GtFilterModelAnnouncement >> model: anObject [ + model := anObject +] diff --git a/src/GToolkit-Coder-UI/GtFilterNameElement.class.st b/src/GToolkit-Coder-UI/GtFilterNameElement.class.st new file mode 100644 index 000000000..023c9c4f1 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterNameElement.class.st @@ -0,0 +1,118 @@ +Class { + #name : #GtFilterNameElement, + #superclass : #BlElement, + #traits : 'TBrLayoutResizable + TGtWithFilterViewModel', + #classTraits : 'TBrLayoutResizable classTrait + TGtWithFilterViewModel classTrait', + #instVars : [ + 'labelElement', + 'settingsContainer' + ], + #category : #'GToolkit-Coder-UI-Filters - Widgets' +} + +{ #category : #'private - updating' } +GtFilterNameElement >> addSettingsElement: anElement [ + settingsContainer addChild: anElement as: #settings +] + +{ #category : #initialization } +GtFilterNameElement >> defaultLayout [ + ^ BlLinearLayout horizontal +] + +{ #category : #initialization } +GtFilterNameElement >> initialize [ + super initialize. + self fitContent. + self beFocusable. + self beInSingleCompositionLayer. + self padding: (BlInsets top: 0 right: 0 bottom: 0 left: 2). + + self initializeLabelElement. + self initializeSettingsContainer. + self addChild: labelElement. + self addChild: settingsContainer as: #container. + + self initializeStyling. + self initializeEventHandlers. + self initializeShortcuts +] + +{ #category : #initialization } +GtFilterNameElement >> initializeEventHandlers [ + self when: BlClickEvent do: [ :anEvent | self onClickEvent: anEvent ] +] + +{ #category : #initialization } +GtFilterNameElement >> initializeLabelElement [ + labelElement := BrLabel new + id: GtFilterTagLabelId; + text: 'Filter'; + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont glamorousCodeSmallSize; + vFitContent; + beSmallSize; + constraintsDo: [ :c | c linear vertical alignCenter ] +] + +{ #category : #initialization } +GtFilterNameElement >> initializeSettingsContainer [ + settingsContainer := BrFrame new + hFitContentLimited; + vFitContent; + margin: (BlInsets all: 2); + constraintsDo: [ :c | c linear vertical alignCenter ] +] + +{ #category : #initialization } +GtFilterNameElement >> initializeShortcuts [ + self + addShortcut: (BlShortcutWithAction new + combination: BlKeyCombination backspace; + action: [ self requestRemoveFilter ]) +] + +{ #category : #initialization } +GtFilterNameElement >> initializeStyling [ + self + addAptitude: (BrStyleCommonAptitude new + default: [ :aStyle | + aStyle geometry: (BlRoundedRectangleGeometry cornerRadius: 4). + aStyle background: self theme status neutralBackgroundColor ]; + hovered: [ :aStyle | aStyle background: self theme status neutralBackgroundColor darker ]; + focused: [ :aStyle | aStyle background: self theme editor focusedBorderColor lighter lighter ]). + + self + addAptitude: (BrStyleCommonAptitude new + // GtFilterTagLabelId / #label; + default: [ :aStyle | aStyle foreground: Color black ]; + focused: [ :aStyle | aStyle foreground: Color white ]) +] + +{ #category : #'event handling' } +GtFilterNameElement >> onClickEvent: anEvent [ + anEvent consumed: true. + self requestFocus +] + +{ #category : #'api - filter view model' } +GtFilterNameElement >> onFilterViewModelChanged [ + self updateSettingsContainer +] + +{ #category : #'private - updating' } +GtFilterNameElement >> removeSettingsElement [ + settingsContainer removeChildren +] + +{ #category : #'event handling' } +GtFilterNameElement >> requestRemoveFilter [ +] + +{ #category : #'private - updating' } +GtFilterNameElement >> updateSettingsContainer [ + | anElement | + self removeSettingsElement. + anElement := self filterViewModel asUserSettingsElement. + anElement ifNil: [ ^ self ]. + self addSettingsElement: anElement +] diff --git a/src/GToolkit-Coder-UI/GtFilterSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterSettingsElement.class.st new file mode 100644 index 000000000..79ca3379c --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterSettingsElement.class.st @@ -0,0 +1,23 @@ +Class { + #name : #GtFilterSettingsElement, + #superclass : #BlElement, + #traits : 'TGtWithFilterViewModel + TBrLayoutResizable', + #classTraits : 'TGtWithFilterViewModel classTrait + TBrLayoutResizable classTrait', + #category : #'GToolkit-Coder-UI-Filters - Widgets' +} + +{ #category : #initialization } +GtFilterSettingsElement >> defaultLayout [ + ^ BlLinearLayout horizontal +] + +{ #category : #initialization } +GtFilterSettingsElement >> initialize [ + super initialize. + self fitContent +] + +{ #category : #'api - filter view model' } +GtFilterSettingsElement >> unsubscribeFromFilterViewModel [ + self filterViewModel unsubscribe: self +] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st new file mode 100644 index 000000000..c5fe56820 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st @@ -0,0 +1,67 @@ +Class { + #name : #GtFilterShortListModel, + #superclass : #GtFilterModel, + #instVars : [ + 'items', + 'selectedItem' + ], + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #accessing } +GtFilterShortListModel >> filterViewModelClass [ + ^ GtFilterShortListViewModel +] + +{ #category : #initialization } +GtFilterShortListModel >> initialize [ + super initialize. + items := #() +] + +{ #category : #accessing } +GtFilterShortListModel >> items [ + + ^ items +] + +{ #category : #accessing } +GtFilterShortListModel >> items: aCollection [ + | aNewCollection | + aNewCollection := aCollection collect: #asFilterShortListModelItem. + self items = aNewCollection ifTrue: [ ^ self ]. + + items := aNewCollection. + self notifyItemsChanged. +] + +{ #category : #accessing } +GtFilterShortListModel >> notifyItemsChanged [ + self + announce: (GtFilterShortListModelItemsChanged new + model: self; + items: self items) +] + +{ #category : #accessing } +GtFilterShortListModel >> notifySelectedItemChanged [ + self + announce: (GtFilterShortListModelSelectedItemChanged new + model: self; + selectedItem: self selectedItem) +] + +{ #category : #accessing } +GtFilterShortListModel >> selectedItem [ + ^ selectedItem +] + +{ #category : #accessing } +GtFilterShortListModel >> selectedItem: anItem [ + | aNewItem | + aNewItem := anItem asFilterShortListModelItem. + self selectedItem = aNewItem ifTrue: [ ^ self ]. + + selectedItem := aNewItem. + self notifySelectedItemChanged +] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModelItem.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModelItem.class.st new file mode 100644 index 000000000..185f1b2b2 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterShortListModelItem.class.st @@ -0,0 +1,36 @@ +Class { + #name : #GtFilterShortListModelItem, + #superclass : #Object, + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #comparing } +GtFilterShortListModelItem >> = anObject [ + self == anObject ifTrue: [ ^ true ]. + + self class = anObject class ifFalse: [ ^ false ]. + + ^ self label = anObject label +] + +{ #category : #converting } +GtFilterShortListModelItem >> asFilterShortListModelItem [ + ^ self +] + +{ #category : #comparing } +GtFilterShortListModelItem >> hash [ + ^ self class hash bitXor: self label hash +] + +{ #category : #accessing } +GtFilterShortListModelItem >> label [ + + ^ self subclassResponsibility +] + +{ #category : #accessing } +GtFilterShortListModelItem >> labelSize [ + + ^ self label size +] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModelItemsChanged.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModelItemsChanged.class.st new file mode 100644 index 000000000..ddea7b8a6 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterShortListModelItemsChanged.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtFilterShortListModelItemsChanged, + #superclass : #GtFilterModelAnnouncement, + #instVars : [ + 'items' + ], + #category : #'GToolkit-Coder-UI-Filters - Events' +} + +{ #category : #accessing } +GtFilterShortListModelItemsChanged >> items [ + ^ items +] + +{ #category : #accessing } +GtFilterShortListModelItemsChanged >> items: anObject [ + items := anObject +] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModelSelectedItemChanged.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModelSelectedItemChanged.class.st new file mode 100644 index 000000000..5cc42e1ea --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterShortListModelSelectedItemChanged.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtFilterShortListModelSelectedItemChanged, + #superclass : #GtFilterModelAnnouncement, + #instVars : [ + 'selectedItem' + ], + #category : #'GToolkit-Coder-UI-Filters - Events' +} + +{ #category : #accessing } +GtFilterShortListModelSelectedItemChanged >> selectedItem [ + ^ selectedItem +] + +{ #category : #accessing } +GtFilterShortListModelSelectedItemChanged >> selectedItem: anObject [ + selectedItem := anObject +] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModelStringItem.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModelStringItem.class.st new file mode 100644 index 000000000..a6e666606 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterShortListModelStringItem.class.st @@ -0,0 +1,38 @@ +Class { + #name : #GtFilterShortListModelStringItem, + #superclass : #GtFilterShortListModelItem, + #instVars : [ + 'string' + ], + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #comparing } +GtFilterShortListModelStringItem >> = anObject [ + self == anObject ifTrue: [ ^ true ]. + + self class = anObject class ifFalse: [ ^ false ]. + + ^ self string = anObject string +] + +{ #category : #comparing } +GtFilterShortListModelStringItem >> hash [ + ^ self class hash bitXor: self string hash +] + +{ #category : #accessing } +GtFilterShortListModelStringItem >> label [ + + ^ self string +] + +{ #category : #accessing } +GtFilterShortListModelStringItem >> string [ + ^ string +] + +{ #category : #accessing } +GtFilterShortListModelStringItem >> string: aString [ + string := aString +] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st new file mode 100644 index 000000000..6868a7118 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st @@ -0,0 +1,189 @@ +Class { + #name : #GtFilterShortListSettingsElement, + #superclass : #GtFilterSettingsElement, + #instVars : [ + 'buttonElement', + 'buttonAptitude', + 'listElement', + 'handleElement' + ], + #category : #'GToolkit-Coder-UI-Filters - Widgets' +} + +{ #category : #initialization } +GtFilterShortListSettingsElement >> defaultItemLabel [ + ^ 'item' +] + +{ #category : #initialization } +GtFilterShortListSettingsElement >> handleElementDo: aBlock [ + (handleElement at: 1) ifNotNil: aBlock +] + +{ #category : #initialization } +GtFilterShortListSettingsElement >> initialize [ + super initialize. + handleElement := nil asWeakReference. + listElement := nil asWeakReference. + self initializeButtonElement. + self initializeDropdownAptitude. + buttonElement addAptitude: buttonAptitude. + self addChild: buttonElement as: #button +] + +{ #category : #initialization } +GtFilterShortListSettingsElement >> initializeButtonElement [ + buttonElement := self newButtonElement + aptitude: BrGlamorousButtonWithLabelAptitude +] + +{ #category : #initialization } +GtFilterShortListSettingsElement >> initializeDropdownAptitude [ + buttonAptitude := BrGlamorousWithDropdownAptitude + handle: [ self newHandleElement ] + content: [ self newContentElement ]. + buttonAptitude beNotResizable. +] + +{ #category : #initialization } +GtFilterShortListSettingsElement >> listElementDo: aBlock [ + (listElement at: 1) ifNotNil: aBlock +] + +{ #category : #initialization } +GtFilterShortListSettingsElement >> newButtonElement [ + ^ BrButton new + beSmallSize; + label: self defaultItemLabel; + fitContent +] + +{ #category : #initialization } +GtFilterShortListSettingsElement >> newContentElement [ + | aListElement | + self + listElementDo: [ :anElement | + anElement removeFromParent. + ^ anElement ]. + + aListElement := BrSimpleList new + fitContent; + itemStencil: [ :anItemType :aListWidget | self newItemElement ]; + itemDataBinder: [ :anItemElement :anItemObject :anItemIndex | + anItemElement + label: anItemObject label; + model: anItemObject ]; + itemDataUnbinder: [ :anItemElement :anItemObject :anItemIndex | + anItemElement + label: self defaultItemLabel; + model: nil ]. + + self updateListElement: aListElement. + listElement at: 1 put: aListElement. + ^ aListElement +] + +{ #category : #initialization } +GtFilterShortListSettingsElement >> newHandleElement [ + | aHandle | + self + handleElementDo: [ :anElement | + anElement removeFromParent. + ^ anElement ]. + aHandle := self newButtonElement + disable; + aptitude: BrGlamorousButtonRectangularAptitude; + addAptitude: BrGlamorousButtonLabelAptitude. + + self updateHandleElement: aHandle. + handleElement at: 1 put: aHandle. + ^ aHandle +] + +{ #category : #initialization } +GtFilterShortListSettingsElement >> newItemElement [ + ^ self newButtonElement + aptitude: BrGlamorousButtonRectangularAptitude; + addAptitude: BrGlamorousButtonLabelAptitude; + label: 'item'; + action: [ :aButton | self onItemClick: aButton ] +] + +{ #category : #'api - filter view model' } +GtFilterShortListSettingsElement >> onFilterViewModelChanged [ + super onFilterViewModelChanged. + self updateElement +] + +{ #category : #'event handling' } +GtFilterShortListSettingsElement >> onItemClick: aButton [ + self hasFilterViewModel ifFalse: [ ^ self ]. + aButton fireEvent: BrDropdownHideWish new. + + self filterViewModel selectedItem: aButton model +] + +{ #category : #'event handling' } +GtFilterShortListSettingsElement >> onItemsChanged: anAnnouncement [ + BlTaskAction enqueueElement: self action: [ self updateElement ] +] + +{ #category : #'event handling' } +GtFilterShortListSettingsElement >> onSelectedItemChanged: anAnnouncement [. + BlTaskAction enqueueElement: self action: [ self updateElement ] +] + +{ #category : #'api - filter view model' } +GtFilterShortListSettingsElement >> subscribeToFilterViewModel [ + super subscribeToFilterViewModel. + self filterViewModel weak + when: GtFilterShortListViewModelItemsChanged + send: #onItemsChanged: + to: self; + when: GtFilterShortListViewModelSelectedItemChanged + send: #onSelectedItemChanged: + to: self +] + +{ #category : #'private - updating' } +GtFilterShortListSettingsElement >> updateButtonElement [ + buttonElement label: self filterViewModel selectedItem label +] + +{ #category : #'private - updating' } +GtFilterShortListSettingsElement >> updateElement [ + self updateButtonElement. + self updateHandleElement. + self updateListElement +] + +{ #category : #'private - updating' } +GtFilterShortListSettingsElement >> updateHandleElement [ + self handleElementDo: [ :anElement | + self updateHandleElement: anElement ]. +] + +{ #category : #'private - updating' } +GtFilterShortListSettingsElement >> updateHandleElement: anElement [ + self hasFilterViewModel ifFalse: [ ^ self ]. + + anElement label: self filterViewModel selectedItem label +] + +{ #category : #'private - updating' } +GtFilterShortListSettingsElement >> updateListElement [ + | aHeight aWidth | + aHeight := self filterViewModel itemsCount * 12. + aWidth := (self filterViewModel items detectMax: #labelSize) labelSize * 12. + buttonAptitude preferredExtent: aHeight @ aWidth. + + self listElementDo: [ :anElement | + self updateListElement: anElement ]. +] + +{ #category : #'private - updating' } +GtFilterShortListSettingsElement >> updateListElement: anElement [ + self hasFilterViewModel ifFalse: [ ^ self ]. + + anElement items: self filterViewModel itemsWithoutSelection +] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListViewModel.class.st b/src/GToolkit-Coder-UI/GtFilterShortListViewModel.class.st new file mode 100644 index 000000000..70b87ac19 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterShortListViewModel.class.st @@ -0,0 +1,76 @@ +Class { + #name : #GtFilterShortListViewModel, + #superclass : #GtFilterViewModel, + #category : #'GToolkit-Coder-UI-Filters - View Models' +} + +{ #category : #accessing } +GtFilterShortListViewModel >> filterElementClass [ + ^ GtFilterShortListSettingsElement +] + +{ #category : #accessing } +GtFilterShortListViewModel >> items [ + ^ self filterModel items +] + +{ #category : #accessing } +GtFilterShortListViewModel >> items: aCollection [ + self filterModel items: aCollection +] + +{ #category : #accessing } +GtFilterShortListViewModel >> itemsCount [ + ^ self filterModel items size +] + +{ #category : #accessing } +GtFilterShortListViewModel >> itemsWithoutSelection [ + | aSelectedItem | + aSelectedItem := self selectedItem. + ^ self filterModel items reject: [ :each | aSelectedItem = each ] +] + +{ #category : #'api - filter model' } +GtFilterShortListViewModel >> onItemsChanged: anAnnouncement [ + self + announce: (GtFilterShortListViewModelItemsChanged new + viewModel: self; + items: anAnnouncement items) +] + +{ #category : #'api - filter model' } +GtFilterShortListViewModel >> onSelectedItemChanged: anAnnouncement [ + self + announce: (GtFilterShortListViewModelSelectedItemChanged new + viewModel: self; + selectedItem: anAnnouncement selectedItem) +] + +{ #category : #accessing } +GtFilterShortListViewModel >> selectedItem [ + ^ self filterModel selectedItem +] + +{ #category : #accessing } +GtFilterShortListViewModel >> selectedItem: anItem [ + self filterModel selectedItem: anItem +] + +{ #category : #'api - filter model' } +GtFilterShortListViewModel >> subscribeToFilterModel [ + super subscribeToFilterModel. + self filterModel weak + when: GtFilterShortListModelItemsChanged + send: #onItemsChanged: + to: self; + when: GtFilterShortListModelSelectedItemChanged + send: #onSelectedItemChanged: + to: self +] + +{ #category : #'api - filter model' } +GtFilterShortListViewModel >> unsubscribeFromFilterModel [ + super unsubscribeFromFilterModel. + self filterModel unsubscribe: self +] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListViewModelItemsChanged.class.st b/src/GToolkit-Coder-UI/GtFilterShortListViewModelItemsChanged.class.st new file mode 100644 index 000000000..912bf362b --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterShortListViewModelItemsChanged.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtFilterShortListViewModelItemsChanged, + #superclass : #GtFilterViewModelAnnouncement, + #instVars : [ + 'items' + ], + #category : #'GToolkit-Coder-UI-Filters - Events' +} + +{ #category : #accessing } +GtFilterShortListViewModelItemsChanged >> items [ + ^ items +] + +{ #category : #accessing } +GtFilterShortListViewModelItemsChanged >> items: anObject [ + items := anObject +] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListViewModelSelectedItemChanged.class.st b/src/GToolkit-Coder-UI/GtFilterShortListViewModelSelectedItemChanged.class.st new file mode 100644 index 000000000..6e725e601 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterShortListViewModelSelectedItemChanged.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtFilterShortListViewModelSelectedItemChanged, + #superclass : #GtFilterViewModelAnnouncement, + #instVars : [ + 'selectedItem' + ], + #category : #'GToolkit-Coder-UI-Filters - Events' +} + +{ #category : #accessing } +GtFilterShortListViewModelSelectedItemChanged >> selectedItem [ + ^ selectedItem +] + +{ #category : #accessing } +GtFilterShortListViewModelSelectedItemChanged >> selectedItem: anObject [ + selectedItem := anObject +] diff --git a/src/GToolkit-Coder-UI/GtFilterTextModel.class.st b/src/GToolkit-Coder-UI/GtFilterTextModel.class.st new file mode 100644 index 000000000..2f3003c40 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterTextModel.class.st @@ -0,0 +1,43 @@ +Class { + #name : #GtFilterTextModel, + #superclass : #GtFilterModel, + #instVars : [ + 'text' + ], + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #accessing } +GtFilterTextModel >> filterViewModelClass [ + ^ GtFilterTextViewModel +] + +{ #category : #initialization } +GtFilterTextModel >> initialize [ + super initialize. + text := BlText empty +] + +{ #category : #accessing } +GtFilterTextModel >> notifyTextChanged [ + self + announce: (GtFilterTextModelTextChanged new + model: self; + text: self text) +] + +{ #category : #accessing } +GtFilterTextModel >> text [ + + ^ text +] + +{ #category : #accessing } +GtFilterTextModel >> text: aText [ + | aNewText | + aNewText := aText asRopedText. + (self text equals: aNewText) ifTrue: [ ^ self ]. + + text := aNewText. + self notifyTextChanged. +] diff --git a/src/GToolkit-Coder-UI/GtFilterTextModelTextChanged.class.st b/src/GToolkit-Coder-UI/GtFilterTextModelTextChanged.class.st new file mode 100644 index 000000000..cbc31186c --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterTextModelTextChanged.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtFilterTextModelTextChanged, + #superclass : #GtFilterModelAnnouncement, + #instVars : [ + 'text' + ], + #category : #'GToolkit-Coder-UI-Filters - Events' +} + +{ #category : #accessing } +GtFilterTextModelTextChanged >> text [ + ^ text +] + +{ #category : #accessing } +GtFilterTextModelTextChanged >> text: anObject [ + text := anObject +] diff --git a/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st new file mode 100644 index 000000000..865c94a03 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st @@ -0,0 +1,55 @@ +Class { + #name : #GtFilterTextSettingsElement, + #superclass : #GtFilterSettingsElement, + #instVars : [ + 'editorElement' + ], + #category : #'GToolkit-Coder-UI-Filters - Widgets' +} + +{ #category : #initialization } +GtFilterTextSettingsElement >> initialize [ + super initialize. + self initializeEditorElement. + self addChild: editorElement as: #editor +] + +{ #category : #initialization } +GtFilterTextSettingsElement >> initializeEditorElement [ + editorElement := BrEditor new + hFitContentLimited; + vFitContent; + background: self theme default contentBackgroundColor; + aptitude: BrGlamorousRegularEditorAptitude new + glamorousRegularSmallSize; + text: '' +] + +{ #category : #'as yet unclassified' } +GtFilterTextSettingsElement >> onFilterViewModelChanged [ + super onFilterViewModelChanged. + + self updateEditorElement +] + +{ #category : #'event handling' } +GtFilterTextSettingsElement >> onTextChanged: anAnnouncement [ + BlTaskAction + enqueueElement: self + action: [ self updateEditorElement ] +] + +{ #category : #'api - filter view model' } +GtFilterTextSettingsElement >> subscribeToFilterViewModel [ + super subscribeToFilterViewModel. + + self filterViewModel weak + when: GtFilterTextModelTextChanged + send: #onTextChanged: + to: self +] + +{ #category : #'private - updating' } +GtFilterTextSettingsElement >> updateEditorElement [ + editorElement text: self filterViewModel text copy +] diff --git a/src/GToolkit-Coder-UI/GtFilterTextViewModel.class.st b/src/GToolkit-Coder-UI/GtFilterTextViewModel.class.st new file mode 100644 index 000000000..2b0f71d81 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterTextViewModel.class.st @@ -0,0 +1,38 @@ +Class { + #name : #GtFilterTextViewModel, + #superclass : #GtFilterViewModel, + #category : #'GToolkit-Coder-UI-Filters - View Models' +} + +{ #category : #accessing } +GtFilterTextViewModel >> filterElementClass [ + ^ GtFilterTextSettingsElement +] + +{ #category : #'event handling' } +GtFilterTextViewModel >> onTextChanged: anAnnouncement [ + self + announce: (GtFilterTextViewModelTextChanged new + viewModel: self; + text: anAnnouncement text) +] + +{ #category : #'api - filter model' } +GtFilterTextViewModel >> subscribeToFilterModel [ + super subscribeToFilterModel. + self filterModel weak + when: GtFilterTextModelTextChanged + send: #onTextChanged: + to: self +] + +{ #category : #testing } +GtFilterTextViewModel >> text [ + ^ self filterModel text +] + +{ #category : #'api - filter model' } +GtFilterTextViewModel >> unsubscribeFromFilterModel [ + super unsubscribeFromFilterModel. + self filterModel unsubscribe: self +] diff --git a/src/GToolkit-Coder-UI/GtFilterTextViewModelTextChanged.class.st b/src/GToolkit-Coder-UI/GtFilterTextViewModelTextChanged.class.st new file mode 100644 index 000000000..f12f490e5 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterTextViewModelTextChanged.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtFilterTextViewModelTextChanged, + #superclass : #GtFilterViewModelAnnouncement, + #instVars : [ + 'text' + ], + #category : #'GToolkit-Coder-UI-Filters - Events' +} + +{ #category : #accessing } +GtFilterTextViewModelTextChanged >> text [ + ^ text +] + +{ #category : #accessing } +GtFilterTextViewModelTextChanged >> text: anObject [ + text := anObject +] diff --git a/src/GToolkit-Coder-UI/GtFilterViewModel.class.st b/src/GToolkit-Coder-UI/GtFilterViewModel.class.st new file mode 100644 index 000000000..84dbf9b98 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterViewModel.class.st @@ -0,0 +1,28 @@ +Class { + #name : #GtFilterViewModel, + #superclass : #Object, + #traits : 'TGtWithFilterModel + TGtAnnouncer', + #classTraits : 'TGtWithFilterModel classTrait + TGtAnnouncer classTrait', + #instVars : [ + 'announcer' + ], + #category : #'GToolkit-Coder-UI-Filters - View Models' +} + +{ #category : #announcer } +GtFilterViewModel >> announcer [ + + ^ announcer ifNil: [ announcer := Announcer new ] +] + +{ #category : #converting } +GtFilterViewModel >> asUserSettingsElement [ + + ^ self filterElementClass new filterViewModel: self +] + +{ #category : #accessing } +GtFilterViewModel >> filterElementClass [ + + ^ self subclassResponsibility +] diff --git a/src/GToolkit-Coder-UI/GtFilterViewModelAnnouncement.class.st b/src/GToolkit-Coder-UI/GtFilterViewModelAnnouncement.class.st new file mode 100644 index 000000000..bd073fe9f --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterViewModelAnnouncement.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtFilterViewModelAnnouncement, + #superclass : #Announcement, + #instVars : [ + 'viewModel' + ], + #category : #'GToolkit-Coder-UI-Filters - Events' +} + +{ #category : #accessing } +GtFilterViewModelAnnouncement >> viewModel [ + ^ viewModel +] + +{ #category : #accessing } +GtFilterViewModelAnnouncement >> viewModel: anObject [ + viewModel := anObject +] diff --git a/src/GToolkit-Coder-UI/String.extension.st b/src/GToolkit-Coder-UI/String.extension.st new file mode 100644 index 000000000..0b870b68e --- /dev/null +++ b/src/GToolkit-Coder-UI/String.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #String } + +{ #category : #'*GToolkit-Coder-UI' } +String >> asFilterShortListModelItem [ + ^ GtFilterShortListModelStringItem new string: self +] diff --git a/src/GToolkit-Coder-UI/TFilterWithWithFilterModel.trait.st b/src/GToolkit-Coder-UI/TFilterWithWithFilterModel.trait.st new file mode 100644 index 000000000..47556c373 --- /dev/null +++ b/src/GToolkit-Coder-UI/TFilterWithWithFilterModel.trait.st @@ -0,0 +1,7 @@ +Trait { + #name : #TFilterWithWithFilterModel, + #instVars : [ + 'filterModel' + ], + #category : #'GToolkit-Coder-UI-Filters - Models' +} diff --git a/src/GToolkit-Coder-UI/TGtWithFilterModel.trait.st b/src/GToolkit-Coder-UI/TGtWithFilterModel.trait.st new file mode 100644 index 000000000..c4937d4b3 --- /dev/null +++ b/src/GToolkit-Coder-UI/TGtWithFilterModel.trait.st @@ -0,0 +1,42 @@ +Trait { + #name : #TGtWithFilterModel, + #instVars : [ + 'filterModel' + ], + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #'api - filter model' } +TGtWithFilterModel >> filterModel [ + self + assert: [ filterModel isNotNil ] + description: [ 'Filter model must be defined' ]. + ^ filterModel +] + +{ #category : #'api - filter model' } +TGtWithFilterModel >> filterModel: aFilterModel [ + filterModel = aFilterModel ifTrue: [ ^ self ]. + + filterModel ifNotNil: [ self unsubscribeFromFilterModel ]. + filterModel := aFilterModel. + self onFilterModelChanged. + self subscribeToFilterModel +] + +{ #category : #'api - filter model' } +TGtWithFilterModel >> hasFilterModel [ + ^ filterModel isNotNil +] + +{ #category : #'api - filter model' } +TGtWithFilterModel >> onFilterModelChanged [ +] + +{ #category : #'api - filter model' } +TGtWithFilterModel >> subscribeToFilterModel [ +] + +{ #category : #'api - filter model' } +TGtWithFilterModel >> unsubscribeFromFilterModel [ +] diff --git a/src/GToolkit-Coder-UI/TGtWithFilterViewModel.trait.st b/src/GToolkit-Coder-UI/TGtWithFilterViewModel.trait.st new file mode 100644 index 000000000..1401f7e0c --- /dev/null +++ b/src/GToolkit-Coder-UI/TGtWithFilterViewModel.trait.st @@ -0,0 +1,48 @@ +Trait { + #name : #TGtWithFilterViewModel, + #instVars : [ + 'filterViewModel' + ], + #category : #'GToolkit-Coder-UI-Filters - View Models' +} + +{ #category : #'api - filter view model' } +TGtWithFilterViewModel >> filterViewModel [ + self + assert: [ filterViewModel isNotNil ] + description: [ 'Filter view model must be defined' ]. + ^ filterViewModel +] + +{ #category : #'api - filter view model' } +TGtWithFilterViewModel >> filterViewModel: aFilterModel [ + filterViewModel = aFilterModel ifTrue: [ ^ self ]. + + filterViewModel ifNotNil: [ self unsubscribeFromFilterViewModel ]. + filterViewModel := aFilterModel. + self onFilterViewModelChanged. + self subscribeToFilterViewModel +] + +{ #category : #'api - filter view model' } +TGtWithFilterViewModel >> filterViewModelDo: aBlock [ + self hasFilterViewModel ifTrue: [ + aBlock cull: self filterViewModel ] +] + +{ #category : #'api - filter view model' } +TGtWithFilterViewModel >> hasFilterViewModel [ + ^ filterViewModel isNotNil +] + +{ #category : #'api - filter view model' } +TGtWithFilterViewModel >> onFilterViewModelChanged [ +] + +{ #category : #'api - filter view model' } +TGtWithFilterViewModel >> subscribeToFilterViewModel [ +] + +{ #category : #'api - filter view model' } +TGtWithFilterViewModel >> unsubscribeFromFilterViewModel [ +] From 95189638d353cdba6da8cf25c1dcb6c6ce9c694b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Tue, 3 Sep 2024 15:31:57 +0200 Subject: [PATCH 0663/1268] Expand coder actions with custom properties and an enabled status [feenkcom/gtoolkit#3942] --- .../GtCoderActionsElement.class.st | 3 ++ src/GToolkit-Coder/GtCoderAction.class.st | 45 ++++++++++++++++++- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st index e132f140d..33ba34162 100644 --- a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st @@ -95,6 +95,9 @@ GtCoderActionsElement >> newButtonForAction: aGtCoderAction [ handleButton: aButtonElement action: aGtCoderAction onEvent: anEvent ]. + aGtCoderAction isDisabled ifTrue: [ + self disableButton: button action: aGtCoderAction ]. + self initializeAltClick: aGtCoderAction element: button. self initializePrimaryClick: aGtCoderAction element: button. ^ button diff --git a/src/GToolkit-Coder/GtCoderAction.class.st b/src/GToolkit-Coder/GtCoderAction.class.st index f48974f52..a76ae0543 100644 --- a/src/GToolkit-Coder/GtCoderAction.class.st +++ b/src/GToolkit-Coder/GtCoderAction.class.st @@ -9,7 +9,9 @@ Class { 'shortcutKey', 'allowPrimaryClick', 'allowAltClick', - 'actionDefinition' + 'actionDefinition', + 'isEnabled', + 'properties' ], #category : #'GToolkit-Coder-Coders - Addons' } @@ -67,6 +69,16 @@ GtCoderAction >> computeActionDefinition [ ifFalse: [ nil ] ] +{ #category : #accessing } +GtCoderAction >> disableAction [ + isEnabled := false +] + +{ #category : #accessing } +GtCoderAction >> enableAction [ + isEnabled := true +] + { #category : #evaluating } GtCoderAction >> gtValueWithArgs: anArray [ ^ self action valueWithPossibleArgs: anArray @@ -106,6 +118,16 @@ GtCoderAction >> id: anObject [ id := anObject ] +{ #category : #testing } +GtCoderAction >> isDisabled [ + ^ self isEnabled not +] + +{ #category : #testing } +GtCoderAction >> isEnabled [ + ^ isEnabled ifNil: [ true ] +] + { #category : #accessing } GtCoderAction >> leaveAction [ ^ nil @@ -130,6 +152,27 @@ GtCoderAction >> printOn: aStream [ nextPut: $) ] +{ #category : #'accessing properties' } +GtCoderAction >> properties [ + ^ properties ifNil: [ + properties := Dictionary new ] +] + +{ #category : #'accessing properties' } +GtCoderAction >> propertyAt: propName ifAbsent: aBlock [ + properties ifNil: [ ^aBlock value ]. + ^ self properties + at: propName + ifAbsent: aBlock +] + +{ #category : #'accessing properties' } +GtCoderAction >> propertyAt: propName put: propValue [ + ^ self properties + at: propName + ifAbsentPut: propValue +] + { #category : #accessing } GtCoderAction >> shortcutKey [ From ee819c22f6a2521a68cfb7215ca36f0d2d1674e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Tue, 3 Sep 2024 15:32:14 +0200 Subject: [PATCH 0664/1268] Return the computation result from GtCoderCodeExecutor [feenkcom/gtoolkit#3942] --- src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st b/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st index 026a97305..fb785ec06 100644 --- a/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st +++ b/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st @@ -112,7 +112,7 @@ GtCoderCodeExecutor >> event: anObject [ { #category : #'api - execution' } GtCoderCodeExecutor >> execute [ - GtCoderExecutionContextVariable + ^ GtCoderExecutionContextVariable element: self element do: [ | coderViewModel | coderViewModel := self coderViewModel. From aa794920b50e783e70e20f6a95afe081b2a03fc1 Mon Sep 17 00:00:00 2001 From: Sven Van Caekenberghe Date: Thu, 5 Sep 2024 15:30:47 +0200 Subject: [PATCH 0665/1268] Added GtLineDiffSplitter class>>#ignoringEOLChars GtDiffSplitterExamples>>#lineIgnoringEOLSplitterExample GtDiffBuilderExamples>>#changeInMiddleAndDeletionAtEnd --- .../GtDiffBuilderExamples.class.st | 22 +++++++++++++++++++ .../GtDiffSplitterExamples.class.st | 13 +++++++++++ .../GtLineDiffSplitter.class.st | 7 ++++++ 3 files changed, 42 insertions(+) diff --git a/src/GToolkit-Coder-Examples/GtDiffBuilderExamples.class.st b/src/GToolkit-Coder-Examples/GtDiffBuilderExamples.class.st index 821d9280a..04315a70f 100644 --- a/src/GToolkit-Coder-Examples/GtDiffBuilderExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtDiffBuilderExamples.class.st @@ -4,6 +4,28 @@ Class { #category : #'GToolkit-Coder-Examples-Diff' } +{ #category : #examples } +GtDiffBuilderExamples >> changeInMiddleAndDeletionAtEnd [ + + | differences from to change | + from := String cr join: ((1 to: 10) collect: #asWords). + to := String cr join: (((1 to: 10) collect: #asWords) + at: 2 put: 'two plus'; + allButLast). + change := GtDiffBuilder + computeDifferencesFrom: from + to: to + using: GtLineDiffSplitter ignoringEOLChars. + differences := change changes. + self assert: differences size equals: 2. + self assert: differences first isReplacement. + self assert: differences first deletedObjects equals: 'two'. + self assert: differences first insertedObjects equals: 'two plus'. + self assert: differences second isDeletion. + self assert: differences second deletedObjects equals: 'ten'. + ^ change +] + { #category : #examples } GtDiffBuilderExamples >> deletionsAtBeginningExample [ diff --git a/src/GToolkit-Coder-Examples/GtDiffSplitterExamples.class.st b/src/GToolkit-Coder-Examples/GtDiffSplitterExamples.class.st index e4472db9e..34b166f15 100644 --- a/src/GToolkit-Coder-Examples/GtDiffSplitterExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtDiffSplitterExamples.class.st @@ -39,6 +39,19 @@ GtDiffSplitterExamples >> javascriptDiffSplitter [ ^ splits ] +{ #category : #lines } +GtDiffSplitterExamples >> lineIgnoringEOLSplitterExample [ + + | splitter splits string | + string := '1' , String crlf , '2' , String cr , '3' , String lf , '4'. + splitter := GtLineDiffSplitter ignoringEOLChars. + splits := splitter split: string. + self assert: splits size = 4. + self assert: (splits at: 1) object equals: '1'. + self assert: (splits at: 4) object equals: '4'. + ^ splits +] + { #category : #lines } GtDiffSplitterExamples >> lineWithEOLSplitterExample [ diff --git a/src/GToolkit-Coder/GtLineDiffSplitter.class.st b/src/GToolkit-Coder/GtLineDiffSplitter.class.st index f202bf741..13fe71481 100644 --- a/src/GToolkit-Coder/GtLineDiffSplitter.class.st +++ b/src/GToolkit-Coder/GtLineDiffSplitter.class.st @@ -7,6 +7,13 @@ Class { #category : #'GToolkit-Coder-Diff-Algorithm' } +{ #category : #'instance creation' } +GtLineDiffSplitter class >> ignoringEOLChars [ + ^ self new + includeEOLChars: false; + yourself +] + { #category : #accessing } GtLineDiffSplitter >> includeEOLChars [ ^ includeEOLChars From e8382f189e9e44616ea6ac62ce8992a5ccf7121b Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 5 Sep 2024 08:45:08 -0500 Subject: [PATCH 0666/1268] Fix classification of new methods in debugger: [feenkcom/gtoolkit#3985] --- .../GtCoderProtocolChanged.class.st | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/GToolkit-Coder/GtCoderProtocolChanged.class.st diff --git a/src/GToolkit-Coder/GtCoderProtocolChanged.class.st b/src/GToolkit-Coder/GtCoderProtocolChanged.class.st new file mode 100644 index 000000000..4181e11a7 --- /dev/null +++ b/src/GToolkit-Coder/GtCoderProtocolChanged.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtCoderProtocolChanged, + #superclass : #GtSourceCoderAnnouncement, + #instVars : [ + 'newProtocol' + ], + #category : #'GToolkit-Coder-Event' +} + +{ #category : #accessing } +GtCoderProtocolChanged >> newProtocol [ + ^ newProtocol +] + +{ #category : #accessing } +GtCoderProtocolChanged >> newProtocol: anObject [ + newProtocol := anObject +] From 8bb9c9fd1d753e42ba5fe4a7b201553610e87176 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Thu, 5 Sep 2024 17:44:07 +0200 Subject: [PATCH 0667/1268] Make async execution support more generic and do not store the execution strategy in the coder view model --- .../GtCoderCodeExecutor.class.st | 33 +++++----- .../GtSourceCoderViewModel.class.st | 61 +++++++++++++------ 2 files changed, 61 insertions(+), 33 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st b/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st index fb785ec06..121bc2e5d 100644 --- a/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st +++ b/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st @@ -11,8 +11,7 @@ Class { #instVars : [ 'coderUIModel', 'action', - 'element', - 'executionStrategy' + 'element' ], #category : #'GToolkit-Coder-UI-Execution' } @@ -29,6 +28,13 @@ GtCoderCodeExecutor class >> doItAndGo [ ^ self new doItAndGo ] +{ #category : #'api - instance creation' } +GtCoderCodeExecutor class >> doItAndGoAsynchronous [ + "Execute a code block asynchronously and display the execution result" + + ^ self new doItAndGoAsynchronous +] + { #category : #'api - instance creation' } GtCoderCodeExecutor class >> doItAndGoSerialized [ "Execute a code and display the execution result" @@ -76,6 +82,13 @@ GtCoderCodeExecutor >> doItAndGo [ action := #doItAndGo ] +{ #category : #initialization } +GtCoderCodeExecutor >> doItAndGoAsynchronous [ + "Execute a code block asynchronously and display the execution result" + + action := #doItAndGoAsynchronous +] + { #category : #initialization } GtCoderCodeExecutor >> doItAndGoSerialized [ "Execute a code and display the execution result" @@ -114,20 +127,8 @@ GtCoderCodeExecutor >> event: anObject [ GtCoderCodeExecutor >> execute [ ^ GtCoderExecutionContextVariable element: self element - do: [ | coderViewModel | - coderViewModel := self coderViewModel. - coderViewModel executionStrategy: executionStrategy. - coderViewModel perform: action ] -] - -{ #category : #accessing } -GtCoderCodeExecutor >> executionStrategy [ - ^ executionStrategy -] - -{ #category : #accessing } -GtCoderCodeExecutor >> executionStrategy: anObject [ - executionStrategy := anObject + do: [ + self coderViewModel perform: action ] ] { #category : #initialization } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st index 6f1106f5b..62784a11a 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st @@ -3,8 +3,7 @@ Class { #superclass : #GtTextualCoderViewModel, #instVars : [ 'evaluationResult', - 'evaluationStatus', - 'executionStrategy' + 'evaluationStatus' ], #category : #'GToolkit-Coder-UI-Coder - Source Model' } @@ -14,6 +13,11 @@ GtSourceCoderViewModel >> asCoderRequesterObject [ ^ GtCoderViewModelRequester new coderViewModel: self ] +{ #category : #accessing } +GtSourceCoderViewModel >> asynchronusExecutionStrategy [ + ^ nil +] + { #category : #'api - actions' } GtSourceCoderViewModel >> debug [ ^ self selection isEmpty @@ -111,6 +115,16 @@ GtSourceCoderViewModel >> doItAndGoAll [ self coder doItAndGoInContext: self evaluationContext all ] ] +{ #category : #'api - actions' } +GtSourceCoderViewModel >> doItAndGoAllAsynchronous [ + "Evaluate the whole source code and inspect the result" + + ^ self handleCoderEvaluationUnhandledErrorDuring: [ + self doItAndGoAsynchronousInContext: (self evaluationContext + all; + yourself) ] +] + { #category : #'api - actions' } GtSourceCoderViewModel >> doItAndGoAllSerialized [ "Evaluate the whole source code and inspect the result" @@ -119,15 +133,36 @@ GtSourceCoderViewModel >> doItAndGoAllSerialized [ serializationStrategy: #GtRsrStonSerializationStrategy) ] +{ #category : #'api - actions' } +GtSourceCoderViewModel >> doItAndGoAsynchronous [ + + ^ self selection isEmpty + ifTrue: [ self doItAndGoAllAsynchronous ] + ifFalse: [ self doItAndGoAsynchronous: self selectedTextInterval ] +] + { #category : #'api - actions' } GtSourceCoderViewModel >> doItAndGoAsynchronous: aTextInterval [ "Evaluate a piece of source code within an interval and inspect a result." ^ self handleCoderEvaluationUnhandledErrorDuring: [ - self coder doItAndGoAsynchronousInContext: ( + self doItAndGoAsynchronousInContext: ( self evaluationContext - from: aTextInterval first - to: aTextInterval last) ] + from: aTextInterval first to: aTextInterval last; + yourself) ] +] + +{ #category : #'api - actions' } +GtSourceCoderViewModel >> doItAndGoAsynchronousInContext: aGtSourceCoderEvaluationContext [ + | executionResult | + + aGtSourceCoderEvaluationContext + executionStrategy: self asynchronusExecutionStrategy. + executionResult := self coder + doItAndGoInContext: aGtSourceCoderEvaluationContext. + self updatWithAsyncExecution: executionResult value. + + ^ executionResult ] { #category : #'api - actions' } @@ -204,18 +239,6 @@ GtSourceCoderViewModel >> evaluationStatus: aNewStatus [ self onEvaluationStatusChanged ] -{ #category : #accessing } -GtSourceCoderViewModel >> executionStrategy [ - - ^ executionStrategy -] - -{ #category : #accessing } -GtSourceCoderViewModel >> executionStrategy: anObject [ - - executionStrategy := anObject -] - { #category : #'private - event handling' } GtSourceCoderViewModel >> handleCoderEvaluationUnhandledErrorDuring: aBlock [ ^ [ GtCoderUserSnippetDynamicVariable @@ -403,3 +426,7 @@ GtSourceCoderViewModel >> subscribeToCoderModel [ send: #onShowDebuggerRequest: to: self ] + +{ #category : #updating } +GtSourceCoderViewModel >> updatWithAsyncExecution: aCoderExecutionResult [ +] From e541882c54cad2a101874afc8486045129aee956 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Thu, 5 Sep 2024 19:08:04 +0200 Subject: [PATCH 0668/1268] Render disabled menu items in coder using a different color. --- .../GtCoderContextMenuContent.class.st | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st index 0fb4de4ea..026d34f2e 100644 --- a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st +++ b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st @@ -30,16 +30,25 @@ GtCoderContextMenuContent >> editorElement: anEditorElement [ { #category : #initialization } GtCoderContextMenuContent >> menuItemStencil [ ^ [ :eachGtCoderContextMenuAction :aRowIndex | - | element | + | element labelText | element := BrHorizontalPane new id: (GtCoderContextMenuItemId indexed: aRowIndex); hMatchParent; vFitContent; alignCenter; addAptitude: self selectionAptitude; - padding: self itemPadding; - addChild: (self itemLabelFor: eachGtCoderContextMenuAction title asRopedText); - when: BlClickEvent + padding: self itemPadding. + + labelText := eachGtCoderContextMenuAction title asRopedText . + eachGtCoderContextMenuAction isEnabled + ifFalse: [ labelText := labelText + foreground: BrGlamorousColors disabledButtonTextColor ]. + element addChild: (self itemLabelFor: labelText). + + eachGtCoderContextMenuAction isEnabled + ifTrue: [ + element + when: BlClickEvent do: [ :anEvent | anEvent consumed: true. eachGtCoderContextMenuAction action @@ -47,7 +56,7 @@ GtCoderContextMenuContent >> menuItemStencil [ cull: self editorElement cull: anEvent. self fireEvent: BrDropdownHideWish new. - self fireEvent: BrContextMenuHideWish new ]. + self fireEvent: BrContextMenuHideWish new ] ]. ((eachGtCoderContextMenuAction shortcutKey respondsTo: #isEmpty) and: [ eachGtCoderContextMenuAction shortcutKey isEmpty not ]) ifTrue: [ element @@ -70,12 +79,14 @@ GtCoderContextMenuContent >> menuItemStencil [ ifNotNil: [ :hover | element when: BlMouseEnterEvent - do: [ :anEvent | hover cull: self editorElement textualCoderViewModel cull: anEvent ] ]. + do: [ :anEvent | + hover cull: self editorElement textualCoderViewModel cull: anEvent ] ]. eachGtCoderContextMenuAction leaveAction ifNotNil: [ :leave | element when: BlMouseLeaveEvent - do: [ :anEvent | leave cull: self editorElement textualCoderViewModel cull: anEvent ] ]. + do: [ :anEvent | + leave cull: self editorElement textualCoderViewModel cull: anEvent ] ]. eachGtCoderContextMenuAction name ifNotNil: [ :anActionName | element containerName: anActionName ]. element ] From d67a43f4f56a25389f50f575be4c2f7c1f743639 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Thu, 5 Sep 2024 19:08:39 +0200 Subject: [PATCH 0669/1268] Add an asynchronous shortcut --- ...oItAndInspectAsynchronousShortcut.class.st | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectAsynchronousShortcut.class.st diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectAsynchronousShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectAsynchronousShortcut.class.st new file mode 100644 index 000000000..9624c6cc5 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectAsynchronousShortcut.class.st @@ -0,0 +1,34 @@ +Class { + #name : #GtSourceCoderDoItAndInspectAsynchronousShortcut, + #superclass : #GtSourceCoderShortcut, + #category : #'GToolkit-Coder-UI-Shortcuts' +} + +{ #category : #accessing } +GtSourceCoderDoItAndInspectAsynchronousShortcut >> description [ + ^ 'Evaluates asynchronously the whole source code or just the selection and inspects the result.' +] + +{ #category : #initialization } +GtSourceCoderDoItAndInspectAsynchronousShortcut >> initialize [ + super initialize. + + combination := BlKeyCombination primaryG +] + +{ #category : #accessing } +GtSourceCoderDoItAndInspectAsynchronousShortcut >> name [ + ^ 'Do it and inspect asynchronous' +] + +{ #category : #evaluation } +GtSourceCoderDoItAndInspectAsynchronousShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ + GtCoderExecutionContextVariable + element: aBrEditorElement + do: [ + aSourceCoderViewModel hasAsyncExecution + ifTrue: [ + self inform: 'Cannot start async execution: already running' ] + ifFalse: [ + aSourceCoderViewModel doItAndGoAsynchronous ] ] +] From fcfccc001caeaa1a2e8d64c0fc2a9a3838fdac5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Thu, 5 Sep 2024 19:11:26 +0200 Subject: [PATCH 0670/1268] Return the created coder action --- src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st | 2 +- src/GToolkit-Coder/GtCoderAddOns.class.st | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st index 907608ddf..f945a4953 100644 --- a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st +++ b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st @@ -2,7 +2,7 @@ Extension { #name : #GtTextualCoder } { #category : #'*GToolkit-Coder-AddOns' } GtTextualCoder >> addContextMenuItemFrom: shortcut withId: menuId to: coderAddOns [ - coderAddOns + ^ coderAddOns addContextMenuItem: shortcut name action: [ :aCoderViewModel :anEditorElement | shortcut diff --git a/src/GToolkit-Coder/GtCoderAddOns.class.st b/src/GToolkit-Coder/GtCoderAddOns.class.st index 18ab1e4ce..b42a874fd 100644 --- a/src/GToolkit-Coder/GtCoderAddOns.class.st +++ b/src/GToolkit-Coder/GtCoderAddOns.class.st @@ -162,7 +162,8 @@ GtCoderAddOns >> addContextMenuItem: aString hover: hoverBlock leave: leaveBlock leaveAction: leaveBlock; id: aSymbol; shortcutKey: shortcutString. - self addContextMenuAction: newAction + self addContextMenuAction: newAction. + ^ newAction ] { #category : #'api - context menu' } From 973ddd695555f0cd7ee5e4598fdc60a4a0a7aea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Fri, 6 Sep 2024 18:42:45 +0200 Subject: [PATCH 0671/1268] Add async do-it support --- .../GtTextualCoder.extension.st | 12 +++++ .../GtCoderCodeExecutor.class.st | 13 +++++ ...oItAndInspectAsynchronousShortcut.class.st | 2 +- ...SourceCoderDoItAndInspectShortcut.class.st | 10 ++-- ...urceCoderDoItAsynchronousActionId.class.st | 10 ++++ ...urceCoderDoItAsynchronousShortcut.class.st | 29 ++++++++++ .../GtSourceCoderDoItShortcut.class.st | 10 ++-- .../GtSourceCoderPrintItShortcut.class.st | 10 ++-- .../GtSourceCoderViewModel.class.st | 53 +++++++++++++++++++ src/GToolkit-Coder/GtCoderAddOns.class.st | 3 +- 10 files changed, 129 insertions(+), 23 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderDoItAsynchronousActionId.class.st create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderDoItAsynchronousShortcut.class.st diff --git a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st index f945a4953..a11f1d880 100644 --- a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st +++ b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st @@ -13,6 +13,18 @@ GtTextualCoder >> addContextMenuItemFrom: shortcut withId: menuId to: coderAddOn shortcutKey: shortcut combinationForPlatform gtDisplayString ] +{ #category : #'*GToolkit-Coder-AddOns' } +GtTextualCoder >> addContextMenuItemWithNoShortcutFrom: shortcut withId: menuId to: coderAddOns [ + ^ coderAddOns + addContextMenuItem: shortcut name + action: [ :aCoderViewModel :anEditorElement | + shortcut + performOnEditor: anEditorElement editor + element: anEditorElement + dueTo: nil ] + id: menuId +] + { #category : #'*GToolkit-Coder-AddOns' } GtTextualCoder >> addCopyCutPasteContextMenuAddOnsAst: anAst to: coderAddOns [ diff --git a/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st b/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st index 121bc2e5d..3711725e0 100644 --- a/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st +++ b/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st @@ -41,6 +41,12 @@ GtCoderCodeExecutor class >> doItAndGoSerialized [ ^ self new doItAndGoSerialized ] +{ #category : #'api - instance creation' } +GtCoderCodeExecutor class >> doItAsynchronous [ + "Execute code asynchronously (and do not display the execution result)" + ^ self new doItAsynchronous +] + { #category : #'api - instance creation' } GtCoderCodeExecutor class >> playAll [ "Execute a method code (and do not display the execution result)" @@ -96,6 +102,13 @@ GtCoderCodeExecutor >> doItAndGoSerialized [ action := #doItAndGoSerialized ] +{ #category : #initialization } +GtCoderCodeExecutor >> doItAsynchronous [ + "Execute code asynchronously (and do not display the execution result)" + + action := #doItAsynchronous +] + { #category : #'api - accessing' } GtCoderCodeExecutor >> element [ ^ element diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectAsynchronousShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectAsynchronousShortcut.class.st index 9624c6cc5..7f1280158 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectAsynchronousShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectAsynchronousShortcut.class.st @@ -18,7 +18,7 @@ GtSourceCoderDoItAndInspectAsynchronousShortcut >> initialize [ { #category : #accessing } GtSourceCoderDoItAndInspectAsynchronousShortcut >> name [ - ^ 'Do it and inspect asynchronous' + ^ 'Do it and inspect (asynchronous)' ] { #category : #evaluation } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectShortcut.class.st index 9fe5585b6..ab4dd14b0 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectShortcut.class.st @@ -1,7 +1,7 @@ Class { #name : #GtSourceCoderDoItAndInspectShortcut, #superclass : #GtSourceCoderShortcut, - #category : 'GToolkit-Coder-UI-Shortcuts' + #category : #'GToolkit-Coder-UI-Shortcuts' } { #category : #accessing } @@ -13,12 +13,8 @@ GtSourceCoderDoItAndInspectShortcut >> description [ GtSourceCoderDoItAndInspectShortcut >> initialize [ super initialize. - combination := BlKeyCombination primaryG -] - -{ #category : #accessing } -GtSourceCoderDoItAndInspectShortcut >> name [ - ^ 'Do it and inspect' + combination := BlKeyCombination primaryG. + name := 'Do it and inspect'. ] { #category : #evaluation } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDoItAsynchronousActionId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDoItAsynchronousActionId.class.st new file mode 100644 index 000000000..1510f2954 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderDoItAsynchronousActionId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtSourceCoderDoItAsynchronousActionId, + #superclass : #GtCoderElementId, + #category : #'GToolkit-Coder-UI-Coder - Ids' +} + +{ #category : #converting } +GtSourceCoderDoItAsynchronousActionId >> asSymbol [ + ^ #'source-coder--doit-asynchronous-action' +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDoItAsynchronousShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDoItAsynchronousShortcut.class.st new file mode 100644 index 000000000..91d2be6d6 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderDoItAsynchronousShortcut.class.st @@ -0,0 +1,29 @@ +Class { + #name : #GtSourceCoderDoItAsynchronousShortcut, + #superclass : #GtSourceCoderShortcut, + #category : #'GToolkit-Coder-UI-Shortcuts' +} + +{ #category : #accessing } +GtSourceCoderDoItAsynchronousShortcut >> description [ + ^ 'Evaluates the whole source code (method) or just the selection.' +] + +{ #category : #initialization } +GtSourceCoderDoItAsynchronousShortcut >> initialize [ + super initialize. + + combination := BlKeyCombination primaryD +] + +{ #category : #accessing } +GtSourceCoderDoItAsynchronousShortcut >> name [ + ^ 'Do it (asynchronous)' +] + +{ #category : #evaluation } +GtSourceCoderDoItAsynchronousShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ + GtCoderExecutionContextVariable + element: aBrEditorElement + do: [ aSourceCoderViewModel doItAsynchronous ] +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDoItShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDoItShortcut.class.st index edfc70fb3..f06676c3b 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderDoItShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderDoItShortcut.class.st @@ -1,7 +1,7 @@ Class { #name : #GtSourceCoderDoItShortcut, #superclass : #GtSourceCoderShortcut, - #category : 'GToolkit-Coder-UI-Shortcuts' + #category : #'GToolkit-Coder-UI-Shortcuts' } { #category : #accessing } @@ -13,12 +13,8 @@ GtSourceCoderDoItShortcut >> description [ GtSourceCoderDoItShortcut >> initialize [ super initialize. - combination := BlKeyCombination primaryD -] - -{ #category : #accessing } -GtSourceCoderDoItShortcut >> name [ - ^ 'Do it' + combination := BlKeyCombination primaryD. + name := 'Do it'. ] { #category : #evaluation } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderPrintItShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderPrintItShortcut.class.st index 6b18b26ce..a45f97e14 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderPrintItShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderPrintItShortcut.class.st @@ -1,7 +1,7 @@ Class { #name : #GtSourceCoderPrintItShortcut, #superclass : #GtSourceCoderShortcut, - #category : 'GToolkit-Coder-UI-Shortcuts' + #category : #'GToolkit-Coder-UI-Shortcuts' } { #category : #accessing } @@ -13,12 +13,8 @@ GtSourceCoderPrintItShortcut >> description [ GtSourceCoderPrintItShortcut >> initialize [ super initialize. - combination := BlKeyCombination primaryP -] - -{ #category : #accessing } -GtSourceCoderPrintItShortcut >> name [ - ^ 'Print' + combination := BlKeyCombination primaryP. + name := 'Print'. ] { #category : #evaluation } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st index 62784a11a..891c8627f 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st @@ -77,6 +77,16 @@ GtSourceCoderViewModel >> doItAll [ ^ self doItAllRequestedBy: self ] +{ #category : #'api - actions' } +GtSourceCoderViewModel >> doItAllAsynchronousRequestedBy: aRequesterObject [ + "Evaluate the whole source code independent from the selection and return the result" + + ^ self handleCoderEvaluationUnhandledErrorDuring: [ + self doItAsynchronousInContext: (self evaluationContext + all; + requesterObject: aRequesterObject) ] +] + { #category : #'api - actions' } GtSourceCoderViewModel >> doItAllRequestedBy: aRequesterObject [ "Evaluate the whole source code independent from the selection and return the result" @@ -160,6 +170,7 @@ GtSourceCoderViewModel >> doItAndGoAsynchronousInContext: aGtSourceCoderEvaluati executionStrategy: self asynchronusExecutionStrategy. executionResult := self coder doItAndGoInContext: aGtSourceCoderEvaluationContext. + self updatWithAsyncExecution: executionResult value. ^ executionResult @@ -182,6 +193,48 @@ GtSourceCoderViewModel >> doItAndGoSerialized: aTextInterval [ serializationStrategy: #GtRsrStonSerializationStrategy) ] +{ #category : #'api - actions' } +GtSourceCoderViewModel >> doItAsynchronous [ + "Evaluate a piece of source code within a selection interval or everything if nothing is selected and return a result" + + + ^ self doItAsynchronousRequestedBy: self +] + +{ #category : #'api - actions' } +GtSourceCoderViewModel >> doItAsynchronous: aTextInterval requestedBy: aRequesterObject [ + "Evaluate source code within given text interval and return the result" + + ^ self handleCoderEvaluationUnhandledErrorDuring: [ + self doItAsynchronousInContext: ( + self evaluationContext + from: aTextInterval first to: aTextInterval last; + requesterObject: aRequesterObject) ] +] + +{ #category : #'api - actions' } +GtSourceCoderViewModel >> doItAsynchronousInContext: aGtSourceCoderEvaluationContext [ + | executionResult | + + aGtSourceCoderEvaluationContext + executionStrategy: self asynchronusExecutionStrategy. + executionResult := self coder + doItInContext: aGtSourceCoderEvaluationContext. + + self updatWithAsyncExecution: executionResult value. + + ^ executionResult +] + +{ #category : #'api - actions' } +GtSourceCoderViewModel >> doItAsynchronousRequestedBy: aRequesterObject [ + "Evaluate selected source code or everything if there is nothing selected and return the result" + + ^ self selection isEmpty + ifTrue: [ self doItAllAsynchronousRequestedBy: aRequesterObject ] + ifFalse: [ self doItAsynchronous: self selectedTextInterval requestedBy: aRequesterObject ] +] + { #category : #'api - actions' } GtSourceCoderViewModel >> doItRequestedBy: aRequesterObject [ "Evaluate selected source code or everything if there is nothing selected and return the result" diff --git a/src/GToolkit-Coder/GtCoderAddOns.class.st b/src/GToolkit-Coder/GtCoderAddOns.class.st index b42a874fd..8650da6e2 100644 --- a/src/GToolkit-Coder/GtCoderAddOns.class.st +++ b/src/GToolkit-Coder/GtCoderAddOns.class.st @@ -149,7 +149,8 @@ GtCoderAddOns >> addContextMenuItem: aString hover: hoverBlock leave: leaveBlock hoverAction: hoverBlock; leaveAction: leaveBlock; id: aSymbol. - self addContextMenuAction: newAction + self addContextMenuAction: newAction. + ^ newAction ] { #category : #'api - context menu' } From 351874553467f77699d8aec30bd21aed13e7b9c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Mon, 9 Sep 2024 09:17:46 +0200 Subject: [PATCH 0672/1268] Add an attribute for the evaluation result --- .../GtCoderEvaluationResultAttributeElementId.class.st | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/GToolkit-Coder-UI/GtCoderEvaluationResultAttributeElementId.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderEvaluationResultAttributeElementId.class.st b/src/GToolkit-Coder-UI/GtCoderEvaluationResultAttributeElementId.class.st new file mode 100644 index 000000000..55c0324e1 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderEvaluationResultAttributeElementId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtCoderEvaluationResultAttributeElementId, + #superclass : #GtCoderElementId, + #category : #'GToolkit-Coder-UI-Coder - Ids' +} + +{ #category : #converting } +GtCoderEvaluationResultAttributeElementId >> asSymbol [ + ^ #'coder-evaluate-result-attribute-element' +] From a2f205b82384fd1d41e43f56a5361a3c384c8680 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Thu, 19 Sep 2024 13:14:05 +0200 Subject: [PATCH 0673/1268] Update priority for addons views --- src/GToolkit-Coder/GtCoderModel.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder/GtCoderModel.class.st b/src/GToolkit-Coder/GtCoderModel.class.st index 89a8bebc1..6b7ece528 100644 --- a/src/GToolkit-Coder/GtCoderModel.class.st +++ b/src/GToolkit-Coder/GtCoderModel.class.st @@ -50,7 +50,7 @@ GtCoderModel class >> gtAstCoderAddOnsFor: aView context: aPhlowContext [ ^ aView forward title: 'Coder Addons'; tooltip: 'The methods that extend the Coder with AddOns'; - priority: 40; + priority: 45; object: [ (GtSearchMethodsInClassFilter new forClass: self; includeSuperclass: true) @@ -73,7 +73,7 @@ GtCoderModel class >> gtContextMenuAddOnsFor: aView [ ^ aView forward title: 'Menu addons'; tooltip: 'The methods that extend the Coder with context menu items'; - priority: 45; + priority: 45.1; object: [ (GtSearchMethodsInClassFilter new forClass: self; includeSuperclass: true) & self contextMenuAddOnsPragma gtPragmas ]; From e85e68c21f68f60f68955dc7f0cec7e2803ede9b Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 19 Sep 2024 14:11:24 +0200 Subject: [PATCH 0674/1268] [feenkcom/gtoolkit#4017] add drag and drop of methods on protocol and classes --- src/GToolkit-Coder-UI/GtCoderElement.class.st | 6 + ...gationClassesHierarchyTreeElement.class.st | 148 +++++++++++-- ...igationPackagesTagsClassesElement.class.st | 208 ++++++++++++++---- ...derNavigationProtocolsGroupedList.class.st | 30 +++ .../GtProtocolSlotTabAptitude.class.st | 4 +- 5 files changed, 328 insertions(+), 68 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderElement.class.st b/src/GToolkit-Coder-UI/GtCoderElement.class.st index e19b065ae..1aa94f435 100644 --- a/src/GToolkit-Coder-UI/GtCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderElement.class.st @@ -24,6 +24,11 @@ Class { #category : #'GToolkit-Coder-UI-! Core' } +{ #category : #'instance creation' } +GtCoderElement class >> defaultSidebarWidth [ + ^ 1.0 +] + { #category : #'private - accessing' } GtCoderElement >> contentElement [ @@ -45,6 +50,7 @@ GtCoderElement >> createPlaygroundElement [ GtCoderElement >> createSidebarElement [ ^ GtPhlowHorizontalSidebarElement new beLeft; + resizerStrategy: (BrResizerElementLength weight: self class defaultSidebarWidth); contentStencil: (GtCoderNavigationTabsStencil new navigationModel: self navigationModel) ] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st index 0b652e12a..9bd3fb862 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st @@ -19,6 +19,48 @@ GtCoderNavigationClassesHierarchyTreeElement class >> fromClasses: aCollectionOf ^ self new initializeWithClasses: aCollectionOfClasses ] +{ #category : #'private - context menu' } +GtCoderNavigationClassesHierarchyTreeElement >> addPreviewButtonFor: refactoring to: elem cancelBlock: aBlock [ + | button | + elem removeChildNamed: #preview. + button := GtRefactoringsPreviewButton new. + button vMatchParent. + button refactorings: [ {refactoring} ]. + button cancelBlock: aBlock. + button + padding: (BlInsets + top: 1 + right: 4 + bottom: 0 + left: 4). + button beMiniSize. + button + when: GtRefactoringsAppliedEvent + do: [ :anEvent | elem removeChild: anEvent currentTarget ]. + ^ elem addChild: button as: #preview +] + +{ #category : #'private - context menu' } +GtCoderNavigationClassesHierarchyTreeElement >> addPreviewButtonFor: refactoring to: elem cancelSelector: cancelSelector [ + | button | + elem removeChildNamed: #preview. + button := GtRefactoringsPreviewButton new. + button vMatchParent. + button refactorings: [ {refactoring} ]. + button cancelBlock: [ self perform: cancelSelector ]. + button + padding: (BlInsets + top: 1 + right: 4 + bottom: 0 + left: 4). + button beMiniSize. + button + when: GtRefactoringsAppliedEvent + do: [ :anEvent | elem removeChild: anEvent currentTarget ]. + ^ elem addChild: button as: #preview +] + { #category : #initialization } GtCoderNavigationClassesHierarchyTreeElement >> browseReferencesTo: aClass [ self phlow spawnObject: (aClass gtReferences) @@ -55,7 +97,7 @@ GtCoderNavigationClassesHierarchyTreeElement >> contextMenuItemsFor: aClass [ -> [ :elem | self convertToSibling: aClass inElement: elem ]} ]) ] -{ #category : #initialization } +{ #category : #'private - context menu' } GtCoderNavigationClassesHierarchyTreeElement >> convertToSibling: aClass inElement: elem [ | refactoring label refactoringButton edit acceptButton | refactoringButton := GtRefactoringsWithInputPreviewElement new. @@ -125,6 +167,46 @@ GtCoderNavigationClassesHierarchyTreeElement >> convertToSibling: aClass inEleme elem addChild: refactoringButton as: #refactoringButton ] +{ #category : #'private - drag and drop' } +GtCoderNavigationClassesHierarchyTreeElement >> createClassDropHandler [ + ^ BlDropHandler new + acceptDomainObjectsSuchThat: [ :anObject | anObject isCompiledMethod ]; + whenDroppedDo: [ :anItemsDroppedEvent | self onDropCompiledMethodsOnClass: anItemsDroppedEvent ]; + whenDragEnteredDo: [ :anItemsDraggedOverEvent | + anItemsDraggedOverEvent currentTarget + effect: (BlOverlayAboveEffect new paint: (Color gray alpha: 0.2)) ]; + whenDragLeftDo: [ :anItemsLeftEvent | anItemsLeftEvent currentTarget effect: BlNullEffect new ] +] + +{ #category : #'private - context menu' } +GtCoderNavigationClassesHierarchyTreeElement >> createLabel: aString description: description [ + ^ aString asRopedText glamorousRegularFont + , ((' ' , description) asRopedText + glamorousCodeFont; + foreground: Color gray; + glamorousCodeTinySize) +] + +{ #category : #initialization } +GtCoderNavigationClassesHierarchyTreeElement >> createNodeElement [ + | aLabelAptitude | + + aLabelAptitude := BrGlamorousLabelAptitude new. + aLabelAptitude add: BrGlamorousListItemAptitude. + aLabelAptitude + add: (BrGlamorousWithContextMenuAptitude + content: [ :aWidget | + GtCoderNavigationContextMenuContent new + items: (self contextMenuItemsFor: (aWidget userData at: #'coder-class')) ]). + + ^ BrLabel new + hMatchParent; + vFitContent; + beSmallSize; + aptitude: aLabelAptitude; + addEventHandler: self createClassDropHandler +] + { #category : #initialization } GtCoderNavigationClassesHierarchyTreeElement >> initialize [ super initialize. @@ -132,25 +214,15 @@ GtCoderNavigationClassesHierarchyTreeElement >> initialize [ self rowStencil: BrGlamorousSimpleTreeSelectableRowElementStencilBuilder new. self - nodeStencil: [ BrHorizontalPane new - hMatchParent; - vFitContent ]; + nodeStencil: [ self createNodeElement ]; nodeDataBinder: [ :aClassElement :aClassHierarchyTree :aTreeNode | - | label | aClassElement - id: (GtCoderNavigationClassesHierarchyTreeElementId indexed: aTreeNode indexInTree); - removeChildren; - aptitude: BrGlamorousListItemAptitude new - + (BrGlamorousWithContextMenuAptitude - content: [ GtCoderNavigationContextMenuContent new - items: (self contextMenuItemsFor: aClassHierarchyTree rootClass) ]). - label := BrLabel new - matchParent; - beSmallSize; - aptitude: BrGlamorousLabelAptitude. - aClassElement addChild: label. + id: (GtCoderNavigationClassesHierarchyTreeElementId indexed: aTreeNode indexInTree). + + aClassElement userData at: #'coder-class' put: aClassHierarchyTree rootClass. + aClassHierarchyTree - ifNil: [ label text: '' asRopedText ] + ifNil: [ aClassElement text: '' asRopedText ] ifNotNil: [ | aClass aText | aClass := aClassHierarchyTree rootClass. aText := aClass gtDisplayText asRopedText. @@ -158,7 +230,7 @@ GtCoderNavigationClassesHierarchyTreeElement >> initialize [ ifTrue: [ aText italic ]. aClass isDeprecated ifTrue: [ aText append: ' (deprecated)' asRopedText italic ]. - label text: aText ] ]. + aClassElement text: aText ] ]. self when: BrSelectionDoubleClicked do: [ :evt | self initializeWithHierachyForClass: self selectedClass ] @@ -187,7 +259,7 @@ GtCoderNavigationClassesHierarchyTreeElement >> initializeWithHierachyForClass: self expandAll ] -{ #category : #initialization } +{ #category : #'private - context menu' } GtCoderNavigationClassesHierarchyTreeElement >> newSubclassOf: aClass [ | dropdown tabGroup | tabGroup := self @@ -198,7 +270,41 @@ GtCoderNavigationClassesHierarchyTreeElement >> newSubclassOf: aClass [ dropdown dispatchEvent: BrDropdownShowWish new. ] -{ #category : #initialization } +{ #category : #'private - drag and drop' } +GtCoderNavigationClassesHierarchyTreeElement >> onDropCompiledMethodsOnClass: anItemsDroppedEvent [ + | aClass aModel compositeChange| + + aClass := anItemsDroppedEvent currentTarget userData at: #'coder-class'. + + aModel := RBNamespace new. + + anItemsDroppedEvent items do: [ :eachDragItem | + | eachCompiledMethod aTargetClass | + + eachCompiledMethod := eachDragItem domainObject. + + aTargetClass := eachCompiledMethod isClassSide + ifTrue: [ aClass classSide ] + ifFalse: [ aClass instanceSide ]. + + eachCompiledMethod methodClass = aTargetClass + ifFalse: [ + eachDragItem shouldCopy + ifFalse: [ + aModel + removeMethod: eachCompiledMethod selector + from: eachCompiledMethod methodClass ]. + + aModel + compile: eachCompiledMethod sourceCode + in: aTargetClass + classified: eachCompiledMethod protocol ] ]. + + compositeChange := aModel changes. + compositeChange execute +] + +{ #category : #'private - context menu' } GtCoderNavigationClassesHierarchyTreeElement >> removeClass: aClass inElement: elem [ | change button | change := RBRemoveClassChange remove: aClass. @@ -216,7 +322,7 @@ GtCoderNavigationClassesHierarchyTreeElement >> removeClass: aClass inElement: e ^ elem addChild: button as: #preview ] -{ #category : #initialization } +{ #category : #'private - context menu' } GtCoderNavigationClassesHierarchyTreeElement >> renameClass: aClass inElement: elem [ | refactoring edit childs | edit := BrEditableLabel new. diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index fe9730360..b3bcb0bc2 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -77,12 +77,14 @@ GtCoderNavigationPackagesTagsClassesElement >> browseSlotReferencesFor: aString GtCoderNavigationPackagesTagsClassesElement >> buildCategorySlotTabs [ | aTabGroup | aTabGroup := BrTabGroup new - aptitude: BrGlamorousTabGroupAptitude - BrTabGroupSplitterAptitude; + aptitude: BrGlamorousTabGroupProportionalAptitude - BrTabGroupSplitterAptitude; addTab: (BrTab new + hMatchParent; aptitude: GtProtocolSlotTabAptitude new; label: 'Categories' asRopedText glamorousCodeSmallSize; stencil: [ methodProtocolsList ]); addTab: (BrTab new + hMatchParent; aptitude: GtProtocolSlotTabAptitude new; label: 'Slots' asRopedText glamorousCodeSmallSize; stencil: [ slotsGroupList ]). @@ -101,32 +103,6 @@ GtCoderNavigationPackagesTagsClassesElement >> buildGroupList [ headerDataBinder: [ :label :each | label text: each domainObject asRopedText ] ] -{ #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> buildGroupWithBinder: binderBlock onClick: clickBlock [ - | classGroup instanceGroup | - instanceGroup := BrGroup new - domainObject: 'instance side'; - stream: #() asAsyncStream; - itemStencil: [ - | aLabel | - aLabel := BrLabel new. - aLabel - hMatchParent; - vFitContent; - beSmallSize; - aptitude: BrGlamorousLabelAptitude + BrGlamorousListItemAptitude + - (BrGlamorousWithContextMenuAptitude - content: [ GtCoderNavigationContextMenuContent new - items: (self protocolListContextMenuItemsFor: (aLabel userData at: #protocol)) ]); - when: BlClickEvent do: clickBlock. - aLabel ]; - itemDataBinder: binderBlock; - shouldShowWithoutItems: false. - classGroup := instanceGroup copy domainObject: 'class side'. - ^ {instanceGroup. - classGroup} -] - { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> buildMethodGroupList [ | list | @@ -149,18 +125,7 @@ GtCoderNavigationPackagesTagsClassesElement >> buildMethodGroupWithBinder: binde instanceGroup := BrGroup new domainObject: 'instance side'; stream: #() asAsyncStream; - itemStencil: [ | aLabel | - aLabel := BrLabel new. - aLabel - hMatchParent; - vFitContent; - beSmallSize; - aptitude: BrGlamorousLabelAptitude + BrGlamorousListItemAptitude + - (BrGlamorousWithContextMenuAptitude - content: [ GtCoderNavigationContextMenuContent new - items: (self methodListContextMenuItemsFor: (aLabel userData at: #method)) ]); - when: BlClickEvent do: clickBlock. - aLabel ]; + itemStencil: [ self buildMethodItemWithOnClick: clickBlock ]; itemDataBinder: binderBlock; shouldShowWithoutItems: false. classGroup := instanceGroup copy domainObject: 'class side'. @@ -168,14 +133,38 @@ GtCoderNavigationPackagesTagsClassesElement >> buildMethodGroupWithBinder: binde classGroup} ] +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> buildMethodItemWithOnClick: clickBlock [ + + | aLabel | + aLabel := BrLabel new. + aLabel + hMatchParent; + vFitContent; + beSmallSize; + aptitude: BrGlamorousLabelAptitude + BrGlamorousListItemAptitude + + (BrGlamorousWithContextMenuAptitude + content: [ GtCoderNavigationContextMenuContent new + items: (self methodListContextMenuItemsFor: (aLabel userData at: #method)) ]); + when: BlClickEvent do: clickBlock. + + aLabel addEventHandler: self createMethodDragHandler. + + ^ aLabel +] + { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> buildProtocolGroupList [ | list | list := self buildGroupList. protocolGroup := self - buildGroupWithBinder: [ :element :item | + buildProtocolGroupWithBinder: [ :element :item | + | itemText | + + itemText := item name asRopedText, ' ' asRopedText, (item methodSelectors size asRopedText foreground: (self theme button disabledTextColor)). + element userData at: #protocol put: item. - element text: item name asRopedText ] + element text: itemText ] onClick: [ :event | event consumed: true. self onProtocolListSelectionChanged ]. @@ -183,6 +172,45 @@ GtCoderNavigationPackagesTagsClassesElement >> buildProtocolGroupList [ ^ list ] +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> buildProtocolGroupWithBinder: binderBlock onClick: clickBlock [ + | classGroup instanceGroup | + instanceGroup := BrGroup new + domainObject: 'instance side'; + stream: #() asAsyncStream; + itemStencil: [ self buildProtocolItemWithOnClick: clickBlock ]; + itemDataBinder: binderBlock; + shouldShowWithoutItems: false. + classGroup := instanceGroup copy domainObject: 'class side'. + ^ {instanceGroup. + classGroup} +] + +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> buildProtocolItemWithOnClick: clickBlock [ + "An element that represents a protocol within a list of protocols" + + | aLabelAptitude | + aLabelAptitude := BrGlamorousLabelAptitude new + padding: (BlInsets + top: 2 + bottom: 2 + left: 1 + right: 1); + add: BrGlamorousListItemAptitude; + add: (BrGlamorousWithContextMenuAptitude + content: [ :aWidget | GtCoderNavigationContextMenuContent new + items: (self protocolListContextMenuItemsFor: (aWidget userData at: #protocol)) ]). + + ^ BrLabel new + hMatchParent; + vFitContent; + beSmallSize; + aptitude: aLabelAptitude; + when: BlClickEvent do: clickBlock; + addEventHandler: self createProtocolDropHandler +] + { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> buildSlotGroupWithBinder: binderBlock onClick: clickBlock [ | classSlotGroup instanceGroup classVarGroup | @@ -239,6 +267,44 @@ GtCoderNavigationPackagesTagsClassesElement >> classMethodsForAProtocol: aSelect ifNil: [ #() ] ] +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> createDraggedMethodItem: aDragItem [ + + ^ BrLabel new + aptitude: (BrGlamorousLabelAptitude new padding: (BlInsets all: 5)) + BrShadowAptitude; + beSmallSize; + opacity: 0.85; + margin: (BlInsets all: 5); + background: Color white; + beFocusable; + requestFocus; + geometry: (BlRoundedRectangleGeometry cornerRadius: 5); + fitContent; + text: aDragItem domainObject printString +] + +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> createMethodDragHandler [ + ^ BlDragHandler new + enableCopy; + liftItem: [ :aLabelElement | + BlDragItem new + sourceElement: aLabelElement; + domainObject: (aLabelElement userData at: #method); + stencil: [ :aDragItem | self createDraggedMethodItem: aDragItem ] ] +] + +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> createProtocolDropHandler [ + ^ BlDropHandler new + acceptDomainObjectsSuchThat: [ :anObject | anObject isCompiledMethod ]; + whenDroppedDo: [ :anItemsDroppedEvent | self onDropCompiledMethodsOnProtocol: anItemsDroppedEvent ]; + whenDragEnteredDo: [ :anItemsDraggedOverEvent | + anItemsDraggedOverEvent currentTarget + effect: (BlOverlayAboveEffect new paint: (Color gray alpha: 0.2)) ]; + whenDragLeftDo: [ :anItemsLeftEvent | anItemsLeftEvent currentTarget effect: BlNullEffect new ] +] + { #category : #'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> deselectPackages [ packagesList deselectAll @@ -395,6 +461,44 @@ GtCoderNavigationPackagesTagsClassesElement >> onClassSelected: anAnnouncement [ tag: anAnnouncement tag ] ] +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> onDropCompiledMethodsOnProtocol: anItemsDroppedEvent [ + | aProtocol aProtocolClass aModel compositeChange| + + aProtocol := anItemsDroppedEvent currentTarget userData at: #protocol. + aProtocolClass := aProtocol protocolClass. + + aModel := RBNamespace new. + + anItemsDroppedEvent items do: [ :eachDragItem | + | aTargetProtocolClass eachCompiledMethod | + + eachCompiledMethod := eachDragItem domainObject. + aTargetProtocolClass := eachCompiledMethod isClassSide + ifTrue: [ aProtocolClass classSide ] + ifFalse: [ aProtocolClass instanceSide ]. + + eachCompiledMethod methodClass = aTargetProtocolClass + ifTrue: [ + aModel + selector: eachCompiledMethod selector + in: aTargetProtocolClass + classified: aProtocol name ] + ifFalse: [ + eachDragItem shouldCopy + ifFalse: [ + aModel + removeMethod: eachCompiledMethod selector + from: eachCompiledMethod methodClass ]. + aModel + compile: eachCompiledMethod sourceCode + in: aTargetProtocolClass + classified: aProtocol name ] ]. + + compositeChange := aModel changes. + compositeChange execute +] + { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onMethodChanged: anAnnouncement [ self updateProtocolList @@ -1034,23 +1138,26 @@ GtCoderNavigationPackagesTagsClassesElement >> updatePackageLists [ { #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updateProtocolList [ - | methodProtocols classProtocols extension | + | methodProtocols currentClass classProtocols extension | navigationModel hasSelectedClass ifFalse: [ self updateProtocolListWith: #() and: #(). self updateMethodListWith: #() and: #(). methodProtocolsList visibility: BlVisibility hidden. methodsLabel visibility: BlVisibility hidden. ^ self ]. - classProtocols := navigationModel selectedClass class organization protocols + + currentClass := navigationModel selectedClass. + + classProtocols := currentClass class organization protocols reject: [ :prot | (navigationModel selectedClass class methods select: [ :meth | (prot includesSelector: meth selector) and: [ meth isFromTrait not ] ]) isEmpty ]. - methodProtocols := navigationModel selectedClass organization protocols. + methodProtocols := currentClass organization protocols. extension := false. navigationModel selectedPackageDo: [ :pkg | - pkg ~= navigationModel selectedClass package + pkg ~= currentClass package ifTrue: [ | protocolName | extension := true. protocolName := '*' , pkg name. @@ -1058,6 +1165,17 @@ GtCoderNavigationPackagesTagsClassesElement >> updateProtocolList [ select: [ :each | each name beginsWith: protocolName ]. classProtocols := classProtocols select: [ :each | each name beginsWith: protocolName ] ] ]. + + methodProtocols := methodProtocols collect: [ :eachProtocol | + GtPharoProtocol + protocol: eachProtocol + class: currentClass ]. + + classProtocols := classProtocols collect: [ :eachProtocol | + GtPharoProtocol + protocol: eachProtocol + class: currentClass ]. + self updateProtocolListWith: methodProtocols and: classProtocols. extension ifTrue: [ methodProtocolsList selectOne: 2. diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st new file mode 100644 index 000000000..c67c565f5 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st @@ -0,0 +1,30 @@ +Class { + #name : #GtCoderNavigationProtocolsGroupedList, + #superclass : #BrGroupedList, + #category : #'GToolkit-Coder-UI-Navigation' +} + +{ #category : #initialization } +GtCoderNavigationProtocolsGroupedList >> buildProtocolItemWithOnClick: clickBlock [ + "An element that represents a protocol within a list of protocols" + + | aLabelAptitude | + aLabelAptitude := BrGlamorousLabelAptitude new + padding: (BlInsets + top: 2 + bottom: 2 + left: 1 + right: 1); + add: BrGlamorousListItemAptitude; + add: (BrGlamorousWithContextMenuAptitude + content: [ :aWidget | GtCoderNavigationContextMenuContent new + items: (self protocolListContextMenuItemsFor: (aWidget userData at: #protocol)) ]). + + ^ BrLabel new + hMatchParent; + vFitContent; + beSmallSize; + aptitude: aLabelAptitude; + when: BlClickEvent do: clickBlock; + addEventHandler: self createProtocolDropHandler +] diff --git a/src/GToolkit-Coder-UI/GtProtocolSlotTabAptitude.class.st b/src/GToolkit-Coder-UI/GtProtocolSlotTabAptitude.class.st index 152771fa7..300a1b43c 100644 --- a/src/GToolkit-Coder-UI/GtProtocolSlotTabAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtProtocolSlotTabAptitude.class.st @@ -31,9 +31,9 @@ GtProtocolSlotTabAptitude >> initialize [ aStyle padding: (BlInsets - top: 0 + top: 2 left: 12 - bottom: 0 + bottom: 2 right: 12) ]). self add: From 85a8125a392572a85ca8a15ddc778dd7a4c9cd0f Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 19 Sep 2024 15:52:15 +0200 Subject: [PATCH 0675/1268] [feenkcom/gtoolkit#4017] extract coder protocols list in a separate element --- ...gationClassesHierarchyTreeElement.class.st | 4 +- ...igationPackagesTagsClassesElement.class.st | 177 +---------------- ...oderNavigationPackagesTreeElement.class.st | 4 +- ...derNavigationProtocolsGroupedList.class.st | 187 +++++++++++++++++- ...GtCoderNavigationWithContextMenu.trait.st} | 14 +- 5 files changed, 198 insertions(+), 188 deletions(-) rename src/GToolkit-Coder-UI/{TNavigationWithContextMenu.trait.st => TGtCoderNavigationWithContextMenu.trait.st} (70%) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st index 9bd3fb862..b582d58f0 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st @@ -6,8 +6,8 @@ I show a list of classes grouping them based on the inheritance hierarchy and so Class { #name : #GtCoderNavigationClassesHierarchyTreeElement, #superclass : #BrSimpleTree, - #traits : 'TNavigationWithContextMenu', - #classTraits : 'TNavigationWithContextMenu classTrait', + #traits : 'TGtCoderNavigationWithContextMenu', + #classTraits : 'TGtCoderNavigationWithContextMenu classTrait', #instVars : [ 'classesTree' ], diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index b3bcb0bc2..a5db5a82d 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -1,15 +1,14 @@ Class { #name : #GtCoderNavigationPackagesTagsClassesElement, #superclass : #GtCoderNavigationElement, - #traits : 'TNavigationWithContextMenu', - #classTraits : 'TNavigationWithContextMenu classTrait', + #traits : 'TGtCoderNavigationWithContextMenu', + #classTraits : 'TGtCoderNavigationWithContextMenu classTrait', #instVars : [ 'packagesList', 'methodProtocolsList', 'methodsLabel', 'methodGroup', 'methodGroupList', - 'protocolGroup', 'slotsGroup', 'slotsGroupList', 'classesLabel' @@ -155,60 +154,7 @@ GtCoderNavigationPackagesTagsClassesElement >> buildMethodItemWithOnClick: click { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> buildProtocolGroupList [ - | list | - list := self buildGroupList. - protocolGroup := self - buildProtocolGroupWithBinder: [ :element :item | - | itemText | - - itemText := item name asRopedText, ' ' asRopedText, (item methodSelectors size asRopedText foreground: (self theme button disabledTextColor)). - - element userData at: #protocol put: item. - element text: itemText ] - onClick: [ :event | - event consumed: true. - self onProtocolListSelectionChanged ]. - list groups: protocolGroup. - ^ list -] - -{ #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> buildProtocolGroupWithBinder: binderBlock onClick: clickBlock [ - | classGroup instanceGroup | - instanceGroup := BrGroup new - domainObject: 'instance side'; - stream: #() asAsyncStream; - itemStencil: [ self buildProtocolItemWithOnClick: clickBlock ]; - itemDataBinder: binderBlock; - shouldShowWithoutItems: false. - classGroup := instanceGroup copy domainObject: 'class side'. - ^ {instanceGroup. - classGroup} -] - -{ #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> buildProtocolItemWithOnClick: clickBlock [ - "An element that represents a protocol within a list of protocols" - - | aLabelAptitude | - aLabelAptitude := BrGlamorousLabelAptitude new - padding: (BlInsets - top: 2 - bottom: 2 - left: 1 - right: 1); - add: BrGlamorousListItemAptitude; - add: (BrGlamorousWithContextMenuAptitude - content: [ :aWidget | GtCoderNavigationContextMenuContent new - items: (self protocolListContextMenuItemsFor: (aWidget userData at: #protocol)) ]). - - ^ BrLabel new - hMatchParent; - vFitContent; - beSmallSize; - aptitude: aLabelAptitude; - when: BlClickEvent do: clickBlock; - addEventHandler: self createProtocolDropHandler + ^ GtCoderNavigationProtocolsGroupedList new ] { #category : #initialization } @@ -294,17 +240,6 @@ GtCoderNavigationPackagesTagsClassesElement >> createMethodDragHandler [ stencil: [ :aDragItem | self createDraggedMethodItem: aDragItem ] ] ] -{ #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> createProtocolDropHandler [ - ^ BlDropHandler new - acceptDomainObjectsSuchThat: [ :anObject | anObject isCompiledMethod ]; - whenDroppedDo: [ :anItemsDroppedEvent | self onDropCompiledMethodsOnProtocol: anItemsDroppedEvent ]; - whenDragEnteredDo: [ :anItemsDraggedOverEvent | - anItemsDraggedOverEvent currentTarget - effect: (BlOverlayAboveEffect new paint: (Color gray alpha: 0.2)) ]; - whenDragLeftDo: [ :anItemsLeftEvent | anItemsLeftEvent currentTarget effect: BlNullEffect new ] -] - { #category : #'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> deselectPackages [ packagesList deselectAll @@ -461,44 +396,6 @@ GtCoderNavigationPackagesTagsClassesElement >> onClassSelected: anAnnouncement [ tag: anAnnouncement tag ] ] -{ #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> onDropCompiledMethodsOnProtocol: anItemsDroppedEvent [ - | aProtocol aProtocolClass aModel compositeChange| - - aProtocol := anItemsDroppedEvent currentTarget userData at: #protocol. - aProtocolClass := aProtocol protocolClass. - - aModel := RBNamespace new. - - anItemsDroppedEvent items do: [ :eachDragItem | - | aTargetProtocolClass eachCompiledMethod | - - eachCompiledMethod := eachDragItem domainObject. - aTargetProtocolClass := eachCompiledMethod isClassSide - ifTrue: [ aProtocolClass classSide ] - ifFalse: [ aProtocolClass instanceSide ]. - - eachCompiledMethod methodClass = aTargetProtocolClass - ifTrue: [ - aModel - selector: eachCompiledMethod selector - in: aTargetProtocolClass - classified: aProtocol name ] - ifFalse: [ - eachDragItem shouldCopy - ifFalse: [ - aModel - removeMethod: eachCompiledMethod selector - from: eachCompiledMethod methodClass ]. - aModel - compile: eachCompiledMethod sourceCode - in: aTargetProtocolClass - classified: aProtocol name ] ]. - - compositeChange := aModel changes. - compositeChange execute -] - { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onMethodChanged: anAnnouncement [ self updateProtocolList @@ -648,14 +545,6 @@ GtCoderNavigationPackagesTagsClassesElement >> onSlotsListSelectionChanged [ self updateMethodListWith: instMeths and: classMeths ] -{ #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> protocolListContextMenuItemsFor: item [ - ^ {(self createLabel: 'Remove ' description: item name) - -> [ :elem | self removeProtocol: item name in: elem ]. - (self createLabel: 'Rename ' description: item name) - -> [ :elem | self renameProtocol: item name in: elem ]} -] - { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> pushDownMethod: aSelector inElement: elem [ | refactoring | @@ -723,18 +612,6 @@ GtCoderNavigationPackagesTagsClassesElement >> removePackage: aPackage tag: aPac self reselectPackageOrTag: aSelectedPackageOrTag afterRemovalOfTagNamed: aPackageTagName. ] -{ #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> removeProtocol: protocolName in: elem [ - | refactoring | - refactoring := RBRemoveProtocolChange - removeProtocolNamed: protocolName - in: self selectedClass. - ^ self - addPreviewButtonFor: refactoring - to: elem - cancelSelector: #updateProtocolList -] - { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> renameMethod: aSelector inElement: elem [ | refactoring edit | @@ -786,32 +663,6 @@ GtCoderNavigationPackagesTagsClassesElement >> renamePackageTag: aPackageTag old self selectPackageOrTag: aSelectedPackageOrTag ]. ] -{ #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> renameProtocol: protocolName in: elem [ - | refactoring edit | - edit := BrEditableLabel new. - edit - aptitude: (BrGlamorousEditableLabelAptitude new - fontSize: 11.9; "Force the font to match the label font" - background: Color transparent); - text: protocolName; - when: BrEditorAcceptWish - do: [ :aWish | - refactoring := GtRBRenameProtocolRefactoring - renameProtocol: protocolName - in: self selectedClass - to: aWish text asString. - edit switchToLabel. - self - addPreviewButtonFor: refactoring - to: elem - cancelSelector: #updateProtocolList ]; - switchToEditor. - edit requestFocus. - elem removeChildren. - elem addChild: edit -] - { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> renameSlot: slotName inElement: elem [ | edit | @@ -955,12 +806,7 @@ GtCoderNavigationPackagesTagsClassesElement >> selectedPackageTagNodeDo: aBlock { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> selectedProtocol [ - | theIndices anIndex | - theIndices := methodProtocolsList selectedIndices ifEmpty: [ ^nil]. - anIndex := theIndices first. - (anIndex between: 1 and: methodProtocolsList viewModel entityCount) - ifFalse: [ ^nil ]. - ^ (methodProtocolsList viewModel entityAt: anIndex) value object + ^ methodProtocolsList selectedProtocol ] { #category : #'showing / hiding' } @@ -1190,20 +1036,7 @@ GtCoderNavigationPackagesTagsClassesElement >> updateProtocolList [ { #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updateProtocolListWith: instanceProtocols and: classProtocols [ - | instStream classStream | - methodProtocolsList deselectAll. - instStream := instanceProtocols - asSortedCollection: [ :a :b | a name < b name ]. - - classStream := classProtocols - asSortedCollection: [ :a :b | a name < b name ]. - - protocolGroup - with: {instStream. - classStream} - do: [ :grp :str | grp items: str ]. - - methodProtocolsList groups: protocolGroup + methodProtocolsList updateProtocolListWith: instanceProtocols and: classProtocols ] { #category : #'updating lists' } diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st index ad1765f15..f73d085e5 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st @@ -6,8 +6,8 @@ I show a simple list of packages sorting alphabetically Class { #name : #GtCoderNavigationPackagesTreeElement, #superclass : #BrSimpleTree, - #traits : 'TNavigationWithContextMenu', - #classTraits : 'TNavigationWithContextMenu classTrait', + #traits : 'TGtCoderNavigationWithContextMenu', + #classTraits : 'TGtCoderNavigationWithContextMenu classTrait', #category : #'GToolkit-Coder-UI-Navigation' } diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st index c67c565f5..8e5675233 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st @@ -1,12 +1,45 @@ +" +#Navigation protocol list + +Displays a list of instance and class side protocols as a grouped list with an ability to drag and drop method on a protocol to move or copy a method there. +" Class { #name : #GtCoderNavigationProtocolsGroupedList, #superclass : #BrGroupedList, + #traits : 'TGtCoderNavigationWithContextMenu', + #classTraits : 'TGtCoderNavigationWithContextMenu classTrait', + #instVars : [ + 'protocolGroups' + ], #category : #'GToolkit-Coder-UI-Navigation' } -{ #category : #initialization } -GtCoderNavigationProtocolsGroupedList >> buildProtocolItemWithOnClick: clickBlock [ +{ #category : #'private - instance creation' } +GtCoderNavigationProtocolsGroupedList >> bindProtocol: item toElement: element [ + | itemText | + itemText := item name asRopedText , ' ' asRopedText + , (item methodSelectors size asRopedText + foreground: self theme button disabledTextColor). + + element userData at: #protocol put: item. + ^ element text: itemText +] + +{ #category : #'private - instance creation' } +GtCoderNavigationProtocolsGroupedList >> createProtocolDropHandler [ + ^ BlDropHandler new + acceptDomainObjectsSuchThat: [ :anObject | anObject isCompiledMethod ]; + whenDroppedDo: [ :anItemsDroppedEvent | self onDropCompiledMethodsOnProtocol: anItemsDroppedEvent ]; + whenDragEnteredDo: [ :anItemsDraggedOverEvent | + anItemsDraggedOverEvent currentTarget + effect: (BlOverlayAboveEffect new paint: (Color gray alpha: 0.2)) ]; + whenDragLeftDo: [ :anItemsLeftEvent | anItemsLeftEvent currentTarget effect: BlNullEffect new ] +] + +{ #category : #'private - instance creation' } +GtCoderNavigationProtocolsGroupedList >> createProtocolElement [ "An element that represents a protocol within a list of protocols" + | aLabelAptitude | aLabelAptitude := BrGlamorousLabelAptitude new @@ -17,14 +50,158 @@ GtCoderNavigationProtocolsGroupedList >> buildProtocolItemWithOnClick: clickBloc right: 1); add: BrGlamorousListItemAptitude; add: (BrGlamorousWithContextMenuAptitude - content: [ :aWidget | GtCoderNavigationContextMenuContent new - items: (self protocolListContextMenuItemsFor: (aWidget userData at: #protocol)) ]). + content: [ :aWidget | + GtCoderNavigationContextMenuContent new + items: (self createProtocolListContextMenuItemsFor: (aWidget userData at: #protocol)) ]). ^ BrLabel new hMatchParent; vFitContent; beSmallSize; aptitude: aLabelAptitude; - when: BlClickEvent do: clickBlock; addEventHandler: self createProtocolDropHandler ] + +{ #category : #'private - instance creation' } +GtCoderNavigationProtocolsGroupedList >> createProtocolGroups [ + | classGroup instanceGroup | + instanceGroup := BrGroup new + domainObject: 'instance side'; + stream: #() asAsyncStream; + itemStencil: [ self createProtocolElement ]; + itemDataBinder: [ :element :item | self bindProtocol: item toElement: element ]; + shouldShowWithoutItems: false. + classGroup := instanceGroup copy domainObject: 'class side'. + ^ {instanceGroup. + classGroup} +] + +{ #category : #'private - instance creation' } +GtCoderNavigationProtocolsGroupedList >> createProtocolListContextMenuItemsFor: item [ + ^ {(self createLabel: 'Remove ' description: item name) + -> [ :elem | self removeProtocol: item name in: elem ]. + (self createLabel: 'Rename ' description: item name) + -> [ :elem | self renameProtocol: item name in: elem ]} +] + +{ #category : #initialization } +GtCoderNavigationProtocolsGroupedList >> initialize [ + super initialize. + + self + padding: (BlInsets left: 5 right: 10); + matchParent; + headerElementStencil: [ BrLabel new + beSmallSize; + aptitude: (BrGlamorousLabelAptitude new foreground: Color gray) ]; + headerDataBinder: [ :label :each | label text: each domainObject asRopedText ]. + + protocolGroups := self createProtocolGroups. + self groups: protocolGroups +] + +{ #category : #'private - refactorings' } +GtCoderNavigationProtocolsGroupedList >> onDropCompiledMethodsOnProtocol: anItemsDroppedEvent [ + | aProtocol aProtocolClass aModel compositeChange| + + aProtocol := anItemsDroppedEvent currentTarget userData at: #protocol. + aProtocolClass := aProtocol protocolClass. + + aModel := RBNamespace new. + + anItemsDroppedEvent items do: [ :eachDragItem | + | aTargetProtocolClass eachCompiledMethod | + + eachCompiledMethod := eachDragItem domainObject. + aTargetProtocolClass := eachCompiledMethod isClassSide + ifTrue: [ aProtocolClass classSide ] + ifFalse: [ aProtocolClass instanceSide ]. + + eachCompiledMethod methodClass = aTargetProtocolClass + ifTrue: [ + aModel + selector: eachCompiledMethod selector + in: aTargetProtocolClass + classified: aProtocol name ] + ifFalse: [ + eachDragItem shouldCopy + ifFalse: [ + aModel + removeMethod: eachCompiledMethod selector + from: eachCompiledMethod methodClass ]. + aModel + compile: eachCompiledMethod sourceCode + in: aTargetProtocolClass + classified: aProtocol name ] ]. + + compositeChange := aModel changes. + compositeChange execute +] + +{ #category : #'private - refactorings' } +GtCoderNavigationProtocolsGroupedList >> removeProtocol: protocolName in: elem [ + | refactoring | + refactoring := RBRemoveProtocolChange + removeProtocolNamed: protocolName + in: self selectedClass. + ^ self + addPreviewButtonFor: refactoring + to: elem + cancelSelector: #updateProtocolList +] + +{ #category : #'private - refactorings' } +GtCoderNavigationProtocolsGroupedList >> renameProtocol: protocolName in: elem [ + | refactoring edit | + edit := BrEditableLabel new. + edit + aptitude: (BrGlamorousEditableLabelAptitude new + fontSize: 11.9; "Force the font to match the label font" + background: Color transparent); + text: protocolName; + when: BrEditorAcceptWish + do: [ :aWish | + refactoring := GtRBRenameProtocolRefactoring + renameProtocol: protocolName + in: self selectedClass + to: aWish text asString. + edit switchToLabel. + self + addPreviewButtonFor: refactoring + to: elem + cancelSelector: #updateProtocolList ]; + switchToEditor. + edit requestFocus. + elem removeChildren. + elem addChild: edit +] + +{ #category : #'api - list' } +GtCoderNavigationProtocolsGroupedList >> selectedProtocol [ + + | theIndices anIndex | + + theIndices := self selectedIndices ifEmpty: [ ^nil]. + anIndex := theIndices first. + (anIndex between: 1 and: self viewModel entityCount) + ifFalse: [ ^ nil ]. + ^ (self viewModel entityAt: anIndex) value object +] + +{ #category : #'api - list' } +GtCoderNavigationProtocolsGroupedList >> updateProtocolListWith: instanceGtPharoProtocols and: classGtPharoProtocols [ + | instStream classStream | + self deselectAll. + instStream := instanceGtPharoProtocols + asSortedCollection: [ :a :b | a name < b name ]. + + classStream := classGtPharoProtocols + asSortedCollection: [ :a :b | a name < b name ]. + + protocolGroups + with: {instStream. + classStream} + do: [ :grp :str | grp items: str ]. + + self groups: protocolGroups +] diff --git a/src/GToolkit-Coder-UI/TNavigationWithContextMenu.trait.st b/src/GToolkit-Coder-UI/TGtCoderNavigationWithContextMenu.trait.st similarity index 70% rename from src/GToolkit-Coder-UI/TNavigationWithContextMenu.trait.st rename to src/GToolkit-Coder-UI/TGtCoderNavigationWithContextMenu.trait.st index 70eb316ea..8add164c2 100644 --- a/src/GToolkit-Coder-UI/TNavigationWithContextMenu.trait.st +++ b/src/GToolkit-Coder-UI/TGtCoderNavigationWithContextMenu.trait.st @@ -1,10 +1,10 @@ Trait { - #name : #TNavigationWithContextMenu, + #name : #TGtCoderNavigationWithContextMenu, #category : #'GToolkit-Coder-UI-Navigation' } -{ #category : #accessing } -TNavigationWithContextMenu >> addPreviewButtonFor: refactoring to: elem cancelBlock: aBlock [ +{ #category : #'private - context menu' } +TGtCoderNavigationWithContextMenu >> addPreviewButtonFor: refactoring to: elem cancelBlock: aBlock [ | button | elem removeChildNamed: #preview. button := GtRefactoringsPreviewButton new. @@ -24,8 +24,8 @@ TNavigationWithContextMenu >> addPreviewButtonFor: refactoring to: elem cancelBl ^ elem addChild: button as: #preview ] -{ #category : #accessing } -TNavigationWithContextMenu >> addPreviewButtonFor: refactoring to: elem cancelSelector: cancelSelector [ +{ #category : #'private - context menu' } +TGtCoderNavigationWithContextMenu >> addPreviewButtonFor: refactoring to: elem cancelSelector: cancelSelector [ | button | elem removeChildNamed: #preview. button := GtRefactoringsPreviewButton new. @@ -45,8 +45,8 @@ TNavigationWithContextMenu >> addPreviewButtonFor: refactoring to: elem cancelSe ^ elem addChild: button as: #preview ] -{ #category : #accessing } -TNavigationWithContextMenu >> createLabel: aString description: description [ +{ #category : #'private - context menu' } +TGtCoderNavigationWithContextMenu >> createLabel: aString description: description [ ^ aString asRopedText glamorousRegularFont , ((' ' , description) asRopedText glamorousCodeFont; From fa1adbd9068d515e88ae1c977f31166d2c908986 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 23 Sep 2024 17:42:19 -0300 Subject: [PATCH 0676/1268] add filter text widget [feenkcom/gtoolkit#3983] --- ...GtFilterElementByScripterExamples.class.st | 8 ++++ .../GtFilterBooleanViewModel.class.st | 6 --- .../GtFilterItemsElement.class.st | 19 +++++++++ .../GtFilterItemsModel.class.st | 33 +++++++++++++++ .../GtFilterNameElement.class.st | 2 +- .../GtFilterSettingsId.class.st | 10 +++++ .../GtFilterShortListViewModel.class.st | 6 --- .../GtFilterTextModel.class.st | 28 ++++++++++++- ...FilterTextModelInputFilterChanged.class.st | 18 +++++++++ .../GtFilterTextSettingsElement.class.st | 40 ++++++++++++++++--- .../GtFilterTextViewModel.class.st | 27 +++++++++---- ...erTextViewModelInputFilterChanged.class.st | 18 +++++++++ .../GtFilterViewModel.class.st | 5 +++ .../GtFiltersAnnouncement.class.st | 18 +++++++++ src/GToolkit-Coder-UI/GtFiltersModel.class.st | 7 ++++ .../GtFiltersModelItemsChanged.class.st | 5 +++ 16 files changed, 221 insertions(+), 29 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtFilterItemsElement.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterItemsModel.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterSettingsId.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterTextModelInputFilterChanged.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterTextViewModelInputFilterChanged.class.st create mode 100644 src/GToolkit-Coder-UI/GtFiltersAnnouncement.class.st create mode 100644 src/GToolkit-Coder-UI/GtFiltersModel.class.st create mode 100644 src/GToolkit-Coder-UI/GtFiltersModelItemsChanged.class.st diff --git a/src/GToolkit-Coder-Examples/GtFilterElementByScripterExamples.class.st b/src/GToolkit-Coder-Examples/GtFilterElementByScripterExamples.class.st index 7a57e076c..0a302f827 100644 --- a/src/GToolkit-Coder-Examples/GtFilterElementByScripterExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtFilterElementByScripterExamples.class.st @@ -36,5 +36,13 @@ GtFilterElementByScripterExamples >> textElement [ scripterWithModel: [ GtFilterModelExamples new textModel ] element: [ :aModel | GtFilterNameElement new filterViewModel: aModel asFilterViewModel ]. + aScripter editor + click; + selectAll; + typeText: 'Class'; + assertTextEqualsTo: 'Class'; + // GtFilterSettingsId; + play. + ^ aScripter ] diff --git a/src/GToolkit-Coder-UI/GtFilterBooleanViewModel.class.st b/src/GToolkit-Coder-UI/GtFilterBooleanViewModel.class.st index e1aee8b10..867ef6086 100644 --- a/src/GToolkit-Coder-UI/GtFilterBooleanViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterBooleanViewModel.class.st @@ -32,9 +32,3 @@ GtFilterBooleanViewModel >> subscribeToFilterModel [ send: #onSwitchChanged: to: self ] - -{ #category : #'api - filter model' } -GtFilterBooleanViewModel >> unsubscribeFromFilterModel [ - super unsubscribeFromFilterModel. - self filterModel unsubscribe: self -] diff --git a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st new file mode 100644 index 000000000..469e2a55c --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st @@ -0,0 +1,19 @@ +Class { + #name : #GtFilterItemsElement, + #superclass : #BlElement, + #traits : 'TBrLayoutResizable', + #classTraits : 'TBrLayoutResizable classTrait', + #category : #'GToolkit-Coder-UI-Filters - Widgets' +} + +{ #category : #initialization } +GtFilterItemsElement >> defaultLayout [ + ^ BlFlowLayout horizontal +] + +{ #category : #initialization } +GtFilterItemsElement >> initialize [ + super initialize. + self hFitContentLimited. + self vFitContent +] diff --git a/src/GToolkit-Coder-UI/GtFilterItemsModel.class.st b/src/GToolkit-Coder-UI/GtFilterItemsModel.class.st new file mode 100644 index 000000000..1b6f6f1e3 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterItemsModel.class.st @@ -0,0 +1,33 @@ +Class { + #name : #GtFilterItemsModel, + #superclass : #GtFiltersModel, + #instVars : [ + 'items' + ], + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #initialization } +GtFilterItemsModel >> initialize [ + super initialize. + items := Array empty +] + +{ #category : #accessing } +GtFilterItemsModel >> items [ + + ^ items +] + +{ #category : #accessing } +GtFilterItemsModel >> items: aCollection [ + self items = aCollection ifTrue: [ ^ self ]. + + items := aCollection. + self notifyItemsChanged. +] + +{ #category : #'private - notifying' } +GtFilterItemsModel >> notifyItemsChanged [ + self announce: (GtFiltersModelItemsChanged new model: self) +] diff --git a/src/GToolkit-Coder-UI/GtFilterNameElement.class.st b/src/GToolkit-Coder-UI/GtFilterNameElement.class.st index 023c9c4f1..f8682d6cc 100644 --- a/src/GToolkit-Coder-UI/GtFilterNameElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterNameElement.class.st @@ -12,7 +12,7 @@ Class { { #category : #'private - updating' } GtFilterNameElement >> addSettingsElement: anElement [ - settingsContainer addChild: anElement as: #settings + settingsContainer addChild: anElement as: GtFilterSettingsId ] { #category : #initialization } diff --git a/src/GToolkit-Coder-UI/GtFilterSettingsId.class.st b/src/GToolkit-Coder-UI/GtFilterSettingsId.class.st new file mode 100644 index 000000000..4726208ac --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterSettingsId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtFilterSettingsId, + #superclass : #BlElementUniqueId, + #category : #'GToolkit-Coder-UI-Filters - Widgets' +} + +{ #category : #converting } +GtFilterSettingsId >> asSymbol [ + ^ #'filter--settings' +] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListViewModel.class.st b/src/GToolkit-Coder-UI/GtFilterShortListViewModel.class.st index 70b87ac19..8cd48c21c 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListViewModel.class.st @@ -68,9 +68,3 @@ GtFilterShortListViewModel >> subscribeToFilterModel [ send: #onSelectedItemChanged: to: self ] - -{ #category : #'api - filter model' } -GtFilterShortListViewModel >> unsubscribeFromFilterModel [ - super unsubscribeFromFilterModel. - self filterModel unsubscribe: self -] diff --git a/src/GToolkit-Coder-UI/GtFilterTextModel.class.st b/src/GToolkit-Coder-UI/GtFilterTextModel.class.st index 2f3003c40..3572d9134 100644 --- a/src/GToolkit-Coder-UI/GtFilterTextModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTextModel.class.st @@ -2,7 +2,8 @@ Class { #name : #GtFilterTextModel, #superclass : #GtFilterModel, #instVars : [ - 'text' + 'text', + 'inputFilter' ], #category : #'GToolkit-Coder-UI-Filters - Models' } @@ -15,10 +16,33 @@ GtFilterTextModel >> filterViewModelClass [ { #category : #initialization } GtFilterTextModel >> initialize [ super initialize. - text := BlText empty + text := BlText empty. + inputFilter := BrTextEditorNoLineBreakInputFilter new. ] { #category : #accessing } +GtFilterTextModel >> inputFilter [ + + ^ inputFilter +] + +{ #category : #accessing } +GtFilterTextModel >> inputFilter: anInputFilter [ + inputFilter = anInputFilter ifTrue: [ ^ self ]. + + inputFilter := anInputFilter. + self notifyInputFilterChanged. +] + +{ #category : #'private - notifying' } +GtFilterTextModel >> notifyInputFilterChanged [ + self + announce: (GtFilterTextModelInputFilterChanged new + model: self; + inputFilter: self inputFilter) +] + +{ #category : #'private - notifying' } GtFilterTextModel >> notifyTextChanged [ self announce: (GtFilterTextModelTextChanged new diff --git a/src/GToolkit-Coder-UI/GtFilterTextModelInputFilterChanged.class.st b/src/GToolkit-Coder-UI/GtFilterTextModelInputFilterChanged.class.st new file mode 100644 index 000000000..763e6120e --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterTextModelInputFilterChanged.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtFilterTextModelInputFilterChanged, + #superclass : #GtFilterModelAnnouncement, + #instVars : [ + 'inputFilter' + ], + #category : #'GToolkit-Coder-UI-Filters - Events' +} + +{ #category : #accessing } +GtFilterTextModelInputFilterChanged >> inputFilter [ + ^ inputFilter +] + +{ #category : #accessing } +GtFilterTextModelInputFilterChanged >> inputFilter: anObject [ + inputFilter := anObject +] diff --git a/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st index 865c94a03..06b710bc5 100644 --- a/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st @@ -22,21 +22,29 @@ GtFilterTextSettingsElement >> initializeEditorElement [ background: self theme default contentBackgroundColor; aptitude: BrGlamorousRegularEditorAptitude new glamorousRegularSmallSize; - text: '' + text: ''; + padding: (BlInsets top: 1 right: 2 bottom: 1 left: 2) ] -{ #category : #'as yet unclassified' } +{ #category : #'api - filter view model' } GtFilterTextSettingsElement >> onFilterViewModelChanged [ super onFilterViewModelChanged. self updateEditorElement ] +{ #category : #'event handling' } +GtFilterTextSettingsElement >> onInputFilterChanged: anAnnouncement [ + BlTaskAction + enqueueElement: self + action: [ self updateEditorElementInputFilter ] +] + { #category : #'event handling' } GtFilterTextSettingsElement >> onTextChanged: anAnnouncement [ BlTaskAction enqueueElement: self - action: [ self updateEditorElement ] + action: [ self updateEditorElementText ] ] { #category : #'api - filter view model' } @@ -44,12 +52,32 @@ GtFilterTextSettingsElement >> subscribeToFilterViewModel [ super subscribeToFilterViewModel. self filterViewModel weak - when: GtFilterTextModelTextChanged - send: #onTextChanged: - to: self + when: GtFilterTextViewModelTextChanged + send: #onTextChanged: + to: self; + when: GtFilterTextViewModelInputFilterChanged + send: #onInputFilterChanged: + to: self ] { #category : #'private - updating' } GtFilterTextSettingsElement >> updateEditorElement [ + self updateEditorElementInputFilter. + self updateEditorElementText. +] + +{ #category : #'private - updating' } +GtFilterTextSettingsElement >> updateEditorElementInputFilter [ + (editorElement editor inputFilter = self filterViewModel inputFilter) + ifTrue: [ ^ self ]. + + editorElement inputFilter: self filterViewModel inputFilter +] + +{ #category : #'private - updating' } +GtFilterTextSettingsElement >> updateEditorElementText [ + (editorElement text equals: self filterViewModel text) + ifTrue: [ ^ self ]. + editorElement text: self filterViewModel text copy ] diff --git a/src/GToolkit-Coder-UI/GtFilterTextViewModel.class.st b/src/GToolkit-Coder-UI/GtFilterTextViewModel.class.st index 2b0f71d81..a4c35bfac 100644 --- a/src/GToolkit-Coder-UI/GtFilterTextViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTextViewModel.class.st @@ -9,6 +9,20 @@ GtFilterTextViewModel >> filterElementClass [ ^ GtFilterTextSettingsElement ] +{ #category : #testing } +GtFilterTextViewModel >> inputFilter [ + + ^ self filterModel inputFilter +] + +{ #category : #'event handling' } +GtFilterTextViewModel >> onInputFilterChanged: anAnnouncement [ + self + announce: (GtFilterTextViewModelInputFilterChanged new + viewModel: self; + inputFilter: anAnnouncement inputFilter) +] + { #category : #'event handling' } GtFilterTextViewModel >> onTextChanged: anAnnouncement [ self @@ -22,17 +36,14 @@ GtFilterTextViewModel >> subscribeToFilterModel [ super subscribeToFilterModel. self filterModel weak when: GtFilterTextModelTextChanged - send: #onTextChanged: - to: self + send: #onTextChanged: + to: self; + when: GtFilterTextModelInputFilterChanged + send: #onInputFilterChanged: + to: self ] { #category : #testing } GtFilterTextViewModel >> text [ ^ self filterModel text ] - -{ #category : #'api - filter model' } -GtFilterTextViewModel >> unsubscribeFromFilterModel [ - super unsubscribeFromFilterModel. - self filterModel unsubscribe: self -] diff --git a/src/GToolkit-Coder-UI/GtFilterTextViewModelInputFilterChanged.class.st b/src/GToolkit-Coder-UI/GtFilterTextViewModelInputFilterChanged.class.st new file mode 100644 index 000000000..4f27b197d --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterTextViewModelInputFilterChanged.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtFilterTextViewModelInputFilterChanged, + #superclass : #GtFilterViewModelAnnouncement, + #instVars : [ + 'inputFilter' + ], + #category : #'GToolkit-Coder-UI-Filters - Events' +} + +{ #category : #accessing } +GtFilterTextViewModelInputFilterChanged >> inputFilter [ + ^ inputFilter +] + +{ #category : #accessing } +GtFilterTextViewModelInputFilterChanged >> inputFilter: anObject [ + inputFilter := anObject +] diff --git a/src/GToolkit-Coder-UI/GtFilterViewModel.class.st b/src/GToolkit-Coder-UI/GtFilterViewModel.class.st index 84dbf9b98..ee5459c44 100644 --- a/src/GToolkit-Coder-UI/GtFilterViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterViewModel.class.st @@ -26,3 +26,8 @@ GtFilterViewModel >> filterElementClass [ ^ self subclassResponsibility ] + +{ #category : #'api - filter model' } +GtFilterViewModel >> unsubscribeFromFilterModel [ + self filterModel unsubscribe: self +] diff --git a/src/GToolkit-Coder-UI/GtFiltersAnnouncement.class.st b/src/GToolkit-Coder-UI/GtFiltersAnnouncement.class.st new file mode 100644 index 000000000..e5aea63cb --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFiltersAnnouncement.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtFiltersAnnouncement, + #superclass : #Announcement, + #instVars : [ + 'model' + ], + #category : #'GToolkit-Coder-UI-Filters - Events' +} + +{ #category : #accessing } +GtFiltersAnnouncement >> model [ + ^ model +] + +{ #category : #accessing } +GtFiltersAnnouncement >> model: anObject [ + model := anObject +] diff --git a/src/GToolkit-Coder-UI/GtFiltersModel.class.st b/src/GToolkit-Coder-UI/GtFiltersModel.class.st new file mode 100644 index 000000000..93f505211 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFiltersModel.class.st @@ -0,0 +1,7 @@ +Class { + #name : #GtFiltersModel, + #superclass : #Object, + #traits : 'TGtAnnouncer', + #classTraits : 'TGtAnnouncer classTrait', + #category : #'GToolkit-Coder-UI-Filters - Models' +} diff --git a/src/GToolkit-Coder-UI/GtFiltersModelItemsChanged.class.st b/src/GToolkit-Coder-UI/GtFiltersModelItemsChanged.class.st new file mode 100644 index 000000000..021ca56a3 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFiltersModelItemsChanged.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtFiltersModelItemsChanged, + #superclass : #GtFiltersAnnouncement, + #category : #'GToolkit-Coder-UI-Filters - Events' +} From 09b52050c96bf3213699b3e3e2759461f73dc90b Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 26 Sep 2024 09:43:32 +0200 Subject: [PATCH 0677/1268] move item computation logic to the coder model --- src/GToolkit-Coder-UI/GtCoderElement.class.st | 2 +- ...igationPackagesTagsClassesElement.class.st | 99 +++++++------------ ...derNavigationProtocolsGroupedList.class.st | 11 ++- 3 files changed, 45 insertions(+), 67 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderElement.class.st b/src/GToolkit-Coder-UI/GtCoderElement.class.st index 1aa94f435..e2420b8c1 100644 --- a/src/GToolkit-Coder-UI/GtCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderElement.class.st @@ -130,7 +130,7 @@ GtCoderElement >> selectMethodProtocolNamed: aMethodProtocolName [ classProtocols := navigationModel selectedClass organization protocols. classProtocols detect: [ :aProtocol | aProtocol name = aMethodProtocolName ] - ifFound: [ :aProtocol | self navigationModel selectMethodProtocol: aProtocol source: self ] + ifFound: [ :aProtocol | self navigationModel selectProtocol: aProtocol source: self ] ifNone: [ "ignore" ] ] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index a5db5a82d..214bb3296 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -203,16 +203,6 @@ GtCoderNavigationPackagesTagsClassesElement >> buildSlotsGroupList [ ^ list ] -{ #category : #'event handling' } -GtCoderNavigationPackagesTagsClassesElement >> classMethodsForAProtocol: aSelectedItem [ - ^ (self selectedClass class organization protocolNamed: aSelectedItem name) - ifNotNil: [ :s | - (s methodSelectors - collect: [ :sel | self selectedClass class >> sel ] - thenReject: [ :meth | meth isFromTrait ]) asArray ] - ifNil: [ #() ] -] - { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> createDraggedMethodItem: aDragItem [ @@ -340,14 +330,6 @@ GtCoderNavigationPackagesTagsClassesElement >> initializeLayout [ c vertical matchParent ] ] -{ #category : #'event handling' } -GtCoderNavigationPackagesTagsClassesElement >> instanceMethodsForAProtocol: aSelectedItem [ - self selectedClass ifNil: [ ^ #() ]. - ^ (self selectedClass organization protocolNamed: aSelectedItem name) - ifNotNil: [ :s | s methodSelectors collect: [ :sel | self selectedClass >> sel ] as: Array ] - ifNil: [ #() ] -] - { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> methodList [ ^ methodGroup flatCollect: [ :grp | grp itemsProvider currentItems ] @@ -517,20 +499,18 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackagesSelected: anAnnouncer [ { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onProtocolListSelectionChanged [ - | aSelectedItem instMeths classMeths | + | aSelectedItem | slotsGroupList deselectAll. - aSelectedItem := self selectedProtocol. + aSelectedItem := methodProtocolsList selectedProtocol. aSelectedItem ifNil: [^self]. - self navigationModel selectMethodProtocol: aSelectedItem source: self. - instMeths := self instanceMethodsForAProtocol: aSelectedItem. - classMeths := self classMethodsForAProtocol: aSelectedItem. + self navigationModel selectProtocol: aSelectedItem source: self. methodGroupList deselectAll. - self updateMethodListWith: instMeths and: classMeths + self updateMethodListWith: self navigationModel methodsToShow. ] { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> onSlotsListSelectionChanged [ - | theIndices anIndex aSelectedItem instMeths classMeths | + | theIndices anIndex aSelectedItem | supressListChanges ifTrue: [ ^ self ]. methodProtocolsList deselectAll. theIndices := slotsGroupList selectedIndices ifEmpty: [ ^ self ]. @@ -539,10 +519,8 @@ GtCoderNavigationPackagesTagsClassesElement >> onSlotsListSelectionChanged [ ifFalse: [ ^ self ]. aSelectedItem := (slotsGroupList viewModel entityAt: anIndex) value object. self navigationModel selectSlot: aSelectedItem source: self. - instMeths := self selectedClass methodsAccessingSlot: aSelectedItem. - classMeths := self selectedClass class methodsAccessingSlot: aSelectedItem. methodGroupList deselectAll. - self updateMethodListWith: instMeths and: classMeths + self updateMethodListWith: self navigationModel methodsToShow. ] { #category : #initialization } @@ -806,7 +784,7 @@ GtCoderNavigationPackagesTagsClassesElement >> selectedPackageTagNodeDo: aBlock { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> selectedProtocol [ - ^ methodProtocolsList selectedProtocol + ^ self navigationModel selectedProtocol ] { #category : #'showing / hiding' } @@ -953,14 +931,19 @@ GtCoderNavigationPackagesTagsClassesElement >> updateContent [ ] { #category : #'updating lists' } -GtCoderNavigationPackagesTagsClassesElement >> updateMethodListWith: instanceMethods and: classMethods [ - | instMethStream classMethStream | +GtCoderNavigationPackagesTagsClassesElement >> updateMethodListWith: aCollectionOfCompiledMethods [ + | instMethStream classMethStream instanceMethods classMethods | methodGroupList deselectAll. - instMethStream := instanceMethods - asSortedCollection: [ :a :b | a selector < b selector ]. - classMethStream := classMethods - asSortedCollection: [ :a :b | a selector < b selector ]. + instanceMethods := aCollectionOfCompiledMethods + select: [ :each | each methodClass isInstanceSide ]. + + classMethods := aCollectionOfCompiledMethods + select: [ :each | each methodClass isClassSide ]. + + instMethStream := instanceMethods asSortedCollection: GtMethodsSortFunction new. + + classMethStream := classMethods asSortedCollection: GtMethodsSortFunction new. methodGroup with: {instMethStream. @@ -984,22 +967,18 @@ GtCoderNavigationPackagesTagsClassesElement >> updatePackageLists [ { #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updateProtocolList [ - | methodProtocols currentClass classProtocols extension | + | currentClass extension protocolsToShow | navigationModel hasSelectedClass - ifFalse: [ self updateProtocolListWith: #() and: #(). - self updateMethodListWith: #() and: #(). + ifFalse: [ + self updateProtocolListWith: #(). + self updateMethodListWith: #(). methodProtocolsList visibility: BlVisibility hidden. methodsLabel visibility: BlVisibility hidden. ^ self ]. currentClass := navigationModel selectedClass. - classProtocols := currentClass class organization protocols - reject: [ :prot | - (navigationModel selectedClass class methods - select: [ :meth | (prot includesSelector: meth selector) and: [ meth isFromTrait not ] ]) - isEmpty ]. - methodProtocols := currentClass organization protocols. + protocolsToShow := navigationModel protocolsToShow. extension := false. navigationModel selectedPackageDo: [ :pkg | @@ -1007,36 +986,28 @@ GtCoderNavigationPackagesTagsClassesElement >> updateProtocolList [ ifTrue: [ | protocolName | extension := true. protocolName := '*' , pkg name. - methodProtocols := methodProtocols - select: [ :each | each name beginsWith: protocolName ]. - classProtocols := classProtocols + protocolsToShow := protocolsToShow select: [ :each | each name beginsWith: protocolName ] ] ]. - - methodProtocols := methodProtocols collect: [ :eachProtocol | - GtPharoProtocol - protocol: eachProtocol - class: currentClass ]. - - classProtocols := classProtocols collect: [ :eachProtocol | - GtPharoProtocol - protocol: eachProtocol - class: currentClass ]. - - self updateProtocolListWith: methodProtocols and: classProtocols. + + self updateProtocolListWith: protocolsToShow. extension - ifTrue: [ methodProtocolsList selectOne: 2. + ifTrue: [ + methodProtocolsList selectOne: 2. self onProtocolListSelectionChanged ] - ifFalse: [ self + ifFalse: [ + self updateMethodListWith: self navigationModel methodsToShow. + self flag: #TODO. + "self updateMethodListWith: navigationModel selectedClass methods and: (navigationModel selectedClass class methods - reject: [ :meth | meth isFromTrait ]) ]. + reject: [ :meth | meth isFromTrait ])" ]. methodProtocolsList visibility: BlVisibility visible. methodsLabel visibility: BlVisibility visible ] { #category : #'updating lists' } -GtCoderNavigationPackagesTagsClassesElement >> updateProtocolListWith: instanceProtocols and: classProtocols [ - methodProtocolsList updateProtocolListWith: instanceProtocols and: classProtocols +GtCoderNavigationPackagesTagsClassesElement >> updateProtocolListWith: pharoProtocols [ + methodProtocolsList updateProtocolListWith: pharoProtocols ] { #category : #'updating lists' } diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st index 8e5675233..1d961fd37 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st @@ -189,9 +189,16 @@ GtCoderNavigationProtocolsGroupedList >> selectedProtocol [ ] { #category : #'api - list' } -GtCoderNavigationProtocolsGroupedList >> updateProtocolListWith: instanceGtPharoProtocols and: classGtPharoProtocols [ - | instStream classStream | +GtCoderNavigationProtocolsGroupedList >> updateProtocolListWith: theGtPharoProtocols [ + | instStream classStream instanceGtPharoProtocols classGtPharoProtocols | self deselectAll. + + instanceGtPharoProtocols := theGtPharoProtocols + reject: [ :eachPharoProtocol | eachPharoProtocol isClassSide ]. + + classGtPharoProtocols := theGtPharoProtocols + select: [ :eachPharoProtocol | eachPharoProtocol isClassSide ]. + instStream := instanceGtPharoProtocols asSortedCollection: [ :a :b | a name < b name ]. From f97edb7688387738de6872ad4e01012ae7ac4ce9 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 26 Sep 2024 10:26:01 +0200 Subject: [PATCH 0678/1268] add virtual protocols group to the protocols list --- ...derNavigationProtocolsGroupedList.class.st | 34 +++++++++++++------ 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st index 1d961fd37..56364fd5a 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st @@ -64,16 +64,20 @@ GtCoderNavigationProtocolsGroupedList >> createProtocolElement [ { #category : #'private - instance creation' } GtCoderNavigationProtocolsGroupedList >> createProtocolGroups [ - | classGroup instanceGroup | - instanceGroup := BrGroup new - domainObject: 'instance side'; + | virtualGroup instanceGroup classGroup | + virtualGroup := BrGroup new + domainObject: 'virtual'; stream: #() asAsyncStream; itemStencil: [ self createProtocolElement ]; itemDataBinder: [ :element :item | self bindProtocol: item toElement: element ]; shouldShowWithoutItems: false. - classGroup := instanceGroup copy domainObject: 'class side'. - ^ {instanceGroup. - classGroup} + + instanceGroup := virtualGroup copy domainObject: 'instance side'. + classGroup := virtualGroup copy domainObject: 'class side'. + ^ { + virtualGroup. + instanceGroup. + classGroup } ] { #category : #'private - instance creation' } @@ -190,14 +194,20 @@ GtCoderNavigationProtocolsGroupedList >> selectedProtocol [ { #category : #'api - list' } GtCoderNavigationProtocolsGroupedList >> updateProtocolListWith: theGtPharoProtocols [ - | instStream classStream instanceGtPharoProtocols classGtPharoProtocols | + | virtualStream instStream classStream virtualGtPharoProtocols instanceGtPharoProtocols classGtPharoProtocols | self deselectAll. + virtualGtPharoProtocols := theGtPharoProtocols + select: [ :eachPharoProtocol | eachPharoProtocol isVirtualProtocol ]. + instanceGtPharoProtocols := theGtPharoProtocols - reject: [ :eachPharoProtocol | eachPharoProtocol isClassSide ]. + select: [ :eachPharoProtocol | eachPharoProtocol isVirtualProtocol not and: [ eachPharoProtocol isClassSide not ] ]. classGtPharoProtocols := theGtPharoProtocols - select: [ :eachPharoProtocol | eachPharoProtocol isClassSide ]. + select: [ :eachPharoProtocol | eachPharoProtocol isVirtualProtocol not and: [ eachPharoProtocol isClassSide ] ]. + + virtualStream := virtualGtPharoProtocols + asSortedCollection: [ :a :b | a name < b name ]. instStream := instanceGtPharoProtocols asSortedCollection: [ :a :b | a name < b name ]. @@ -206,8 +216,10 @@ GtCoderNavigationProtocolsGroupedList >> updateProtocolListWith: theGtPharoProto asSortedCollection: [ :a :b | a name < b name ]. protocolGroups - with: {instStream. - classStream} + with: { + virtualStream. + instStream. + classStream} do: [ :grp :str | grp items: str ]. self groups: protocolGroups From 6b40f817bf72a5065df6862c6de4673f9de594c2 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 26 Sep 2024 10:45:52 -0300 Subject: [PATCH 0679/1268] add filters widget [feenkcom/gtoolkit#3983] It is possible to add and remove filters. --- ...GtFilterElementByScripterExamples.class.st | 13 ++ .../GtFilterModelExamples.class.st | 17 ++ src/GToolkit-Coder-UI/Class.extension.st | 6 + .../GtFilterBooleanModel.class.st | 10 ++ .../GtFilterItemsElement.class.st | 149 +++++++++++++++++- .../GtFilterItemsModel.class.st | 63 +++++++- ...thodsCoderAvailableFiltersBuilder.class.st | 33 ++++ src/GToolkit-Coder-UI/GtFilterModel.class.st | 98 +++++++++++- .../GtFilterModelLabelChanged.class.st | 18 +++ .../GtFilterNameElement.class.st | 37 ++++- ...GtFilterRemoveFilterViewModelWish.class.st | 18 +++ .../GtFilterRemoveWish.class.st | 5 + .../GtFilterShortListClassSideItem.class.st | 10 ++ ...GtFilterShortListInstanceSideItem.class.st | 15 ++ .../GtFilterShortListModel.class.st | 21 ++- ...rShortListModelAbstractMethodItem.class.st | 15 ++ .../GtFilterShortListModelClassItem.class.st | 39 +++++ ...lterShortListModelClassOriginItem.class.st | 10 ++ ...erShortListModelDefinedMethodItem.class.st | 10 ++ .../GtFilterShortListModelItem.class.st | 15 ++ ...hortListModelMethodDefinitionItem.class.st | 10 ++ ...terShortListModelMethodOriginItem.class.st | 10 ++ .../GtFilterShortListModelNoItem.class.st | 17 ++ .../GtFilterShortListModelStringItem.class.st | 15 ++ ...lterShortListModelTraitOriginItem.class.st | 15 ++ .../GtFilterShortListSettingsElement.class.st | 11 +- .../GtFilterShortListSideItem.class.st | 10 ++ .../GtFilterTextModel.class.st | 20 ++- .../GtFilterTextSettingsElement.class.st | 35 +++- .../GtFilterTextViewModel.class.st | 5 + .../GtFilterViewModel.class.st | 22 +++ .../GtFilterViewModelLabelChanged.class.st | 18 +++ .../GtFiltersItemsViewModel.class.st | 51 ++++++ src/GToolkit-Coder-UI/GtFiltersModel.class.st | 59 +++++++ ...st => GtFiltersModelAnnouncement.class.st} | 6 +- .../GtFiltersModelItemsChanged.class.st | 15 +- .../GtFiltersModelUpdated.class.st | 5 + .../GtFiltersViewModel.class.st | 70 ++++++++ .../GtFiltersViewModelAnnouncement.class.st | 18 +++ .../GtFiltersViewModelItemsChanged.class.st | 18 +++ .../TGtWithFiltersModel.trait.st | 47 ++++++ .../TGtWithFiltersViewModel.trait.st | 48 ++++++ 42 files changed, 1105 insertions(+), 22 deletions(-) create mode 100644 src/GToolkit-Coder-UI/Class.extension.st create mode 100644 src/GToolkit-Coder-UI/GtFilterMethodsCoderAvailableFiltersBuilder.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterModelLabelChanged.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterRemoveFilterViewModelWish.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterRemoveWish.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterShortListClassSideItem.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterShortListInstanceSideItem.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterShortListModelAbstractMethodItem.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterShortListModelClassItem.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterShortListModelClassOriginItem.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterShortListModelDefinedMethodItem.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterShortListModelMethodDefinitionItem.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterShortListModelMethodOriginItem.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterShortListModelNoItem.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterShortListModelTraitOriginItem.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterShortListSideItem.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterViewModelLabelChanged.class.st create mode 100644 src/GToolkit-Coder-UI/GtFiltersItemsViewModel.class.st rename src/GToolkit-Coder-UI/{GtFiltersAnnouncement.class.st => GtFiltersModelAnnouncement.class.st} (62%) create mode 100644 src/GToolkit-Coder-UI/GtFiltersModelUpdated.class.st create mode 100644 src/GToolkit-Coder-UI/GtFiltersViewModel.class.st create mode 100644 src/GToolkit-Coder-UI/GtFiltersViewModelAnnouncement.class.st create mode 100644 src/GToolkit-Coder-UI/GtFiltersViewModelItemsChanged.class.st create mode 100644 src/GToolkit-Coder-UI/TGtWithFiltersModel.trait.st create mode 100644 src/GToolkit-Coder-UI/TGtWithFiltersViewModel.trait.st diff --git a/src/GToolkit-Coder-Examples/GtFilterElementByScripterExamples.class.st b/src/GToolkit-Coder-Examples/GtFilterElementByScripterExamples.class.st index 0a302f827..ef8886dca 100644 --- a/src/GToolkit-Coder-Examples/GtFilterElementByScripterExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtFilterElementByScripterExamples.class.st @@ -17,6 +17,19 @@ GtFilterElementByScripterExamples >> booleanElement [ ^ aScripter ] +{ #category : #examples } +GtFilterElementByScripterExamples >> itemsModel [ + + | aScripter | + aScripter := self + scripterWithModel: [ GtFilterModelExamples new itemsModel ] + element: [ :aModel | GtFilterItemsElement new filtersViewModel: aModel asFiltersViewModel ]. + + + + ^ aScripter +] + { #category : #examples } GtFilterElementByScripterExamples >> shortListElement [ diff --git a/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st b/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st index d3c077cd3..82346ee6b 100644 --- a/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st @@ -10,11 +10,26 @@ GtFilterModelExamples >> booleanModel [ | aModel | aModel := GtFilterBooleanModel new. aModel switchedOn: true. + aModel label: 'Trait methods'. self assert: aModel isSwitchedOn. ^ aModel ] +{ #category : #examples } +GtFilterModelExamples >> itemsModel [ + + | aModel | + aModel := GtFilterItemsModel new. + aModel + items: {self textModel. + self shortListModel. + self booleanModel}. + self assert: aModel items size equals: 3. + + ^ aModel +] + { #category : #examples } GtFilterModelExamples >> shortListModel [ @@ -24,6 +39,7 @@ GtFilterModelExamples >> shortListModel [ items: {'instance'. 'class'}. aModel selectedItem: 'class'. + aModel label: 'Side'. self assert: aModel items equals: ({'instance'. @@ -39,6 +55,7 @@ GtFilterModelExamples >> textModel [ | aModel | aModel := GtFilterTextModel new. aModel text: 'Object'. + aModel label: 'Methods up to'. self assert: (aModel text equals: 'Object' asRopedText). ^ aModel diff --git a/src/GToolkit-Coder-UI/Class.extension.st b/src/GToolkit-Coder-UI/Class.extension.st new file mode 100644 index 000000000..e004cb7b8 --- /dev/null +++ b/src/GToolkit-Coder-UI/Class.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #Class } + +{ #category : #'*GToolkit-Coder-UI' } +Class >> asFilterShortListModelItem [ + ^ GtFilterShortListModelClassItem new itemClass: self +] diff --git a/src/GToolkit-Coder-UI/GtFilterBooleanModel.class.st b/src/GToolkit-Coder-UI/GtFilterBooleanModel.class.st index f4992ec97..59407489b 100644 --- a/src/GToolkit-Coder-UI/GtFilterBooleanModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterBooleanModel.class.st @@ -1,6 +1,9 @@ Class { #name : #GtFilterBooleanModel, #superclass : #GtFilterModel, + #instVars : [ + 'switchedOn' + ], #category : #'GToolkit-Coder-UI-Filters - Models' } @@ -33,6 +36,13 @@ GtFilterBooleanModel >> notifySwitchChanged [ switchedOn: self isSwitchedOn) ] +{ #category : #accessing } +GtFilterBooleanModel >> selectedValue [ + "Return a filter value, e.g., selected item, input text." + + ^ self switchedOn +] + { #category : #accessing } GtFilterBooleanModel >> switchedOn [ diff --git a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st index 469e2a55c..110165e7c 100644 --- a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st @@ -1,11 +1,61 @@ Class { #name : #GtFilterItemsElement, #superclass : #BlElement, - #traits : 'TBrLayoutResizable', - #classTraits : 'TBrLayoutResizable classTrait', + #traits : 'TBrLayoutResizable + TGtWithFiltersViewModel', + #classTraits : 'TBrLayoutResizable classTrait + TGtWithFiltersViewModel classTrait', #category : #'GToolkit-Coder-UI-Filters - Widgets' } +{ #category : #'private - updating' } +GtFilterItemsElement >> addElementForFilterViewModel: aFilterViewModel [ + | anElement | + anElement := GtFilterNameElement new filterViewModel: aFilterViewModel. + anElement margin: (BlInsets left: 3 right: 3). + anElement + constraintsDo: [ :c | + c flow vertical alignCenter. + c flow horizontal alignLeft ]. + self addChild: anElement +] + +{ #category : #'private - updating' } +GtFilterItemsElement >> addNewFilterElement [ + self addChild: self newAddFilterButton as: #add +] + +{ #category : #'private - updating' } +GtFilterItemsElement >> createDropdownContent [ + ^ BrSimpleList new + vFitContentLimited; + hFitContentLimited; + constraintsDo: [ :c | + c maxHeight: 200 ]; + stencil: [ :eachFilterModel :eachIndex | + BrHorizontalPane new + id: (GtFilterTagPickerItemId indexed: eachIndex); + hMatchParent; + vFitContent; + padding: (BlInsets all: 5); + addAptitude: (BrStyleCommonAptitude new + default: [ :s | s background: Color transparent ]; + hovered: [ :s | s background: self theme button defaultBorderColor ]; + yourself); + when: BlClickEvent + do: [ :anEvent | + anEvent consumed: true. + anEvent currentTarget fireEvent: BrDropdownHideWish new. + self requestAddFilterModel: eachFilterModel ]; + addChild: (BrLabel new + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont glamorousCodeSmallSize; + text: eachFilterModel label; + yourself); + yourself ]; + items: (self hasFiltersViewModel + ifTrue: [ self filtersViewModel availableFilters ] + ifFalse: [ #() ]); + yourself +] + { #category : #initialization } GtFilterItemsElement >> defaultLayout [ ^ BlFlowLayout horizontal @@ -15,5 +65,98 @@ GtFilterItemsElement >> defaultLayout [ GtFilterItemsElement >> initialize [ super initialize. self hFitContentLimited. - self vFitContent + self vFitContent. + self padding: (BlInsets all: 2). + self initializeEventHandlers. +] + +{ #category : #initialization } +GtFilterItemsElement >> initializeEventHandlers [ + self + when: GtFilterRemoveFilterViewModelWish + do: [ :anEvent | self onRemoveFilterViewModelWish: anEvent ] +] + +{ #category : #'private - updating' } +GtFilterItemsElement >> newAddFilterButton [ + ^ self newAddFilterHandleElement + id: GtFiltersAddButtonId; + addAptitude: BrGlamorousButtonWithLabelTooltipAptitude new; + addAptitude: (BrStyleCommonAptitude new + default: [ :aStyle | + aStyle + border: BlBorder empty; + background: self theme status neutralBackgroundColor ]; + hovered: [ :aStyle | + aStyle background: self theme status neutralBackgroundColor darker ]; + pressed: [ :aStyle | + aStyle background: self theme status neutralBackgroundColor darker darker ]; + focused: [ :aStyle | + aStyle border: (BlBorder paint: self theme editor focusedBorderColor width: 1) ]); + addAptitude: (BrGlamorousWithDropdownAptitude + handle: [ self newAddFilterHandleElement ] + content: [ self createDropdownContent ]); + margin: (BlInsets left: 2); + constraintsDo: [ :c | c flow vertical alignCenter ]; + addShortcut: + (BlShortcutWithAction new + combination: BlKeyCombination enter; + action: [ :anEvent | anEvent currentTarget dispatchEvent: BrDropdownShowWish new ]) +] + +{ #category : #'private - updating' } +GtFilterItemsElement >> newAddFilterHandleElement [ + ^ BrButton new + aptitude: BrGlamorousButtonRectangularAptitude new; + addAptitude: BrGlamorousButtonIconAptitude new; + icon: BrGlamorousVectorIcons add; + label: 'Add Filter'; + beSmallSize; + hExact: 20 +] + +{ #category : #'api - filter view model' } +GtFilterItemsElement >> onFiltersViewModelChanged [ + self updateItemsElement +] + +{ #category : #'event handling' } +GtFilterItemsElement >> onItemsChanged: anAnnouncement [ + BlTaskAction enqueueElement: self action: [ self updateItemsElement ] +] + +{ #category : #'event handling' } +GtFilterItemsElement >> onRemoveFilterViewModelWish: anEvent [ + anEvent filterViewModel ifNil: [ ^ self ]. + self hasFiltersViewModel ifFalse: [ ^ self ]. + + self filtersViewModel removeFilterViewModel: anEvent filterViewModel +] + +{ #category : #'event handling' } +GtFilterItemsElement >> requestAddFilterModel: aFilterModel [ + self hasFiltersViewModel ifFalse: [ ^ self ]. + + self filtersViewModel addFilterModel: aFilterModel +] + +{ #category : #'api - filter view model' } +GtFilterItemsElement >> subscribeToFiltersViewModel [ + self filtersViewModel weak + when: GtFiltersViewModelItemsChanged + send: #onItemsChanged: + to: self +] + +{ #category : #'api - filter view model' } +GtFilterItemsElement >> unsubscribeFromFiltersViewModel [ + self filtersViewModel unsubscribe: self +] + +{ #category : #'private - updating' } +GtFilterItemsElement >> updateItemsElement [ + self removeChildren. + self filtersViewModel items do: [ :eachFilterViewModel | + self addElementForFilterViewModel: eachFilterViewModel ]. + self addNewFilterElement ] diff --git a/src/GToolkit-Coder-UI/GtFilterItemsModel.class.st b/src/GToolkit-Coder-UI/GtFilterItemsModel.class.st index 1b6f6f1e3..126e3df6c 100644 --- a/src/GToolkit-Coder-UI/GtFilterItemsModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterItemsModel.class.st @@ -7,6 +7,31 @@ Class { #category : #'GToolkit-Coder-UI-Filters - Models' } +{ #category : #'add / remove' } +GtFilterItemsModel >> addFilterModel: aFilterModel [ + self items: (self items copyWith: aFilterModel) +] + +{ #category : #accessing } +GtFilterItemsModel >> filtersViewModelClass [ + + ^ GtFiltersItemsViewModel +] + +{ #category : #'gt - extensions' } +GtFilterItemsModel >> gtItemsFor: aView [ + + ^ aView columnedList + title: 'Items'; + items: [ self items ifNil: [ #() ] ]; + column: 'Index' + text: [ :_ :anIndex | anIndex ] + width: 40; + column: 'Name' text: #yourself; + column: 'Selected value' text: #selectedValue; + actionUpdateButton +] + { #category : #initialization } GtFilterItemsModel >> initialize [ super initialize. @@ -24,10 +49,46 @@ GtFilterItemsModel >> items: aCollection [ self items = aCollection ifTrue: [ ^ self ]. items := aCollection. + self subscribeToItems. self notifyItemsChanged. + self notifyFiltersUpdated. +] + +{ #category : #'private - notifying' } +GtFilterItemsModel >> notifyFiltersUpdated [ + self announce: (GtFiltersModelUpdated new model: self) ] { #category : #'private - notifying' } GtFilterItemsModel >> notifyItemsChanged [ - self announce: (GtFiltersModelItemsChanged new model: self) + self + announce: (GtFiltersModelItemsChanged new + model: self; + items: self items) +] + +{ #category : #'event handling' } +GtFilterItemsModel >> onFilterModelAnnouncement: anAnnouncement [ + self notifyFiltersUpdated +] + +{ #category : #'add / remove' } +GtFilterItemsModel >> removeFilterModel: aFilterModel [ + self items: (self items copyWithout: aFilterModel) +] + +{ #category : #private } +GtFilterItemsModel >> subscribeToItem: aFilterModel [ + (aFilterModel hasSubscriber: self) ifTrue: [ ^ self ]. + + aFilterModel weak + when: GtFilterModelAnnouncement + send: #onFilterModelAnnouncement: + to: self +] + +{ #category : #private } +GtFilterItemsModel >> subscribeToItems [ + self items do: [ :eachItem | + self subscribeToItem: eachItem ] ] diff --git a/src/GToolkit-Coder-UI/GtFilterMethodsCoderAvailableFiltersBuilder.class.st b/src/GToolkit-Coder-UI/GtFilterMethodsCoderAvailableFiltersBuilder.class.st new file mode 100644 index 000000000..2589e7c2c --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterMethodsCoderAvailableFiltersBuilder.class.st @@ -0,0 +1,33 @@ +Class { + #name : #GtFilterMethodsCoderAvailableFiltersBuilder, + #superclass : #Object, + #instVars : [ + 'coders' + ], + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #building } +GtFilterMethodsCoderAvailableFiltersBuilder >> availableFilters [ + + | availableFilters | + availableFilters := SortedCollection sortBlock: [ :a :b | a order < b order ]. + + coders ifNil: [ ^ #() ]. + + GtSearchMethodsFilter withAllSubclassesDo: [ :eachClass | + eachClass filterDescriptors2For: coders into: availableFilters ]. + + ^ availableFilters +] + +{ #category : #accessing } +GtFilterMethodsCoderAvailableFiltersBuilder >> coders [ + + ^ coders +] + +{ #category : #accessing } +GtFilterMethodsCoderAvailableFiltersBuilder >> coders: aMethodsCoder [ + coders := aMethodsCoder +] diff --git a/src/GToolkit-Coder-UI/GtFilterModel.class.st b/src/GToolkit-Coder-UI/GtFilterModel.class.st index 39edba99b..0658bf9a6 100644 --- a/src/GToolkit-Coder-UI/GtFilterModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModel.class.st @@ -4,7 +4,10 @@ Class { #traits : 'TGtAnnouncer', #classTraits : 'TGtAnnouncer classTrait', #instVars : [ - 'announcer' + 'announcer', + 'label', + 'order', + 'creator' ], #category : #'GToolkit-Coder-UI-Filters - Models' } @@ -21,14 +24,107 @@ GtFilterModel >> asFilterViewModel [ ^ self filterViewModelClass new filterModel: self ] +{ #category : #converting } +GtFilterModel >> asSearchFilter [ + + ^ creator cull: self selectedValue cull: self +] + { #category : #converting } GtFilterModel >> asUserSettingsElement [ ^ self asFilterViewModel asUserSettingsElement ] +{ #category : #accessing } +GtFilterModel >> creator [ + ^ creator +] + +{ #category : #accessing } +GtFilterModel >> creator: anObject [ + creator := anObject +] + +{ #category : #initialization } +GtFilterModel >> defaultFilterLabel [ + ^ self class name copyFrom: 9 to: self class name size - 5 +] + +{ #category : #initialization } +GtFilterModel >> defaultFilterOrder [ + ^ 50 +] + { #category : #accessing } GtFilterModel >> filterViewModelClass [ ^ self subclassResponsibility ] + +{ #category : #'gt - extensions' } +GtFilterModel >> gtLiveFor: aView [ + + ^ aView explicit + title: 'Live'; + stencil: [ (GtFilterNameElement new filterViewModel: self asFilterViewModel) + margin: (BlInsets all: 10) ] +] + +{ #category : #accessing } +GtFilterModel >> label [ + "Return filter label" + + + ^ label ifNil: [ label := self defaultFilterLabel ] +] + +{ #category : #accessing } +GtFilterModel >> label: aString [ + label = aString ifTrue: [ ^ self ]. + + label := aString. + self notifyLabelChanged. +] + +{ #category : #accessing } +GtFilterModel >> named: aString [ + self label: aString +] + +{ #category : #'private - notifying' } +GtFilterModel >> notifyLabelChanged [ + self + announce: (GtFilterModelLabelChanged new + model: self; + label: self label) +] + +{ #category : #accessing } +GtFilterModel >> order [ + ^ order ifNil: [ order := self defaultFilterOrder ] +] + +{ #category : #accessing } +GtFilterModel >> order: anObject [ + order := anObject +] + +{ #category : #printing } +GtFilterModel >> printOn: aStream [ + super printOn: aStream. + + aStream + nextPut: $(; + nextPutAll: self label asString; + nextPutAll: ', order: '; + print: self order; + nextPut: $) +] + +{ #category : #accessing } +GtFilterModel >> selectedValue [ + "Return a filter value, e.g., selected item, input text." + + ^ nil +] diff --git a/src/GToolkit-Coder-UI/GtFilterModelLabelChanged.class.st b/src/GToolkit-Coder-UI/GtFilterModelLabelChanged.class.st new file mode 100644 index 000000000..2898f9516 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModelLabelChanged.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtFilterModelLabelChanged, + #superclass : #GtFilterModelAnnouncement, + #instVars : [ + 'label' + ], + #category : #'GToolkit-Coder-UI-Filters - Events' +} + +{ #category : #accessing } +GtFilterModelLabelChanged >> label [ + ^ label +] + +{ #category : #accessing } +GtFilterModelLabelChanged >> label: anObject [ + label := anObject +] diff --git a/src/GToolkit-Coder-UI/GtFilterNameElement.class.st b/src/GToolkit-Coder-UI/GtFilterNameElement.class.st index f8682d6cc..5015daae3 100644 --- a/src/GToolkit-Coder-UI/GtFilterNameElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterNameElement.class.st @@ -40,7 +40,8 @@ GtFilterNameElement >> initialize [ { #category : #initialization } GtFilterNameElement >> initializeEventHandlers [ - self when: BlClickEvent do: [ :anEvent | self onClickEvent: anEvent ] + self when: BlClickEvent do: [ :anEvent | self onClickEvent: anEvent ]. + self when: GtFilterRemoveWish do: [ :anEvent | self requestRemoveFilter ]. ] { #category : #initialization } @@ -96,7 +97,12 @@ GtFilterNameElement >> onClickEvent: anEvent [ { #category : #'api - filter view model' } GtFilterNameElement >> onFilterViewModelChanged [ - self updateSettingsContainer + self updateElement +] + +{ #category : #'event handling' } +GtFilterNameElement >> onLabelChanged: anAnnouncement [ + BlTaskAction enqueueElement: self action: [ self updateLabelElement ] ] { #category : #'private - updating' } @@ -106,6 +112,33 @@ GtFilterNameElement >> removeSettingsElement [ { #category : #'event handling' } GtFilterNameElement >> requestRemoveFilter [ + self hasFilterViewModel ifFalse: [ ^ self ]. + self fireEvent: (GtFilterRemoveFilterViewModelWish new + filterViewModel: self filterViewModel) +] + +{ #category : #'api - filter view model' } +GtFilterNameElement >> subscribeToFilterViewModel [ + self filterViewModel weak + when: GtFilterViewModelLabelChanged + send: #onLabelChanged: + to: self +] + +{ #category : #'api - filter view model' } +GtFilterNameElement >> unsubscribeFromFilterViewModel [ + self filterViewModel unsubscribe: self +] + +{ #category : #'private - updating' } +GtFilterNameElement >> updateElement [ + self updateLabelElement. + self updateSettingsContainer. +] + +{ #category : #'private - updating' } +GtFilterNameElement >> updateLabelElement [ + labelElement text: self filterViewModel label ] { #category : #'private - updating' } diff --git a/src/GToolkit-Coder-UI/GtFilterRemoveFilterViewModelWish.class.st b/src/GToolkit-Coder-UI/GtFilterRemoveFilterViewModelWish.class.st new file mode 100644 index 000000000..dda165da9 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterRemoveFilterViewModelWish.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtFilterRemoveFilterViewModelWish, + #superclass : #BrWish, + #instVars : [ + 'filterViewModel' + ], + #category : #'GToolkit-Coder-UI-Filters - Events' +} + +{ #category : #accessing } +GtFilterRemoveFilterViewModelWish >> filterViewModel [ + ^ filterViewModel +] + +{ #category : #accessing } +GtFilterRemoveFilterViewModelWish >> filterViewModel: anObject [ + filterViewModel := anObject +] diff --git a/src/GToolkit-Coder-UI/GtFilterRemoveWish.class.st b/src/GToolkit-Coder-UI/GtFilterRemoveWish.class.st new file mode 100644 index 000000000..ae5aae3c3 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterRemoveWish.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtFilterRemoveWish, + #superclass : #BrWish, + #category : #'GToolkit-Coder-UI-Filters - Events' +} diff --git a/src/GToolkit-Coder-UI/GtFilterShortListClassSideItem.class.st b/src/GToolkit-Coder-UI/GtFilterShortListClassSideItem.class.st new file mode 100644 index 000000000..bd947ec6b --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterShortListClassSideItem.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtFilterShortListClassSideItem, + #superclass : #GtFilterShortListSideItem, + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #accessing } +GtFilterShortListClassSideItem >> label [ + ^ 'class' +] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListInstanceSideItem.class.st b/src/GToolkit-Coder-UI/GtFilterShortListInstanceSideItem.class.st new file mode 100644 index 000000000..05ec4d6d2 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterShortListInstanceSideItem.class.st @@ -0,0 +1,15 @@ +Class { + #name : #GtFilterShortListInstanceSideItem, + #superclass : #GtFilterShortListSideItem, + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #testing } +GtFilterShortListInstanceSideItem >> isInstanceSideMethod [ + ^ true +] + +{ #category : #accessing } +GtFilterShortListInstanceSideItem >> label [ + ^ 'instance' +] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st index c5fe56820..45235ced7 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st @@ -51,9 +51,21 @@ GtFilterShortListModel >> notifySelectedItemChanged [ selectedItem: self selectedItem) ] +{ #category : #initialization } +GtFilterShortListModel >> selectFirstItem [ + self items ifEmpty: [ ^ self ]. + self selectedItem: self items first +] + +{ #category : #initialization } +GtFilterShortListModel >> selectLastItem [ + self items ifEmpty: [ ^ self ]. + self selectedItem: self items last +] + { #category : #accessing } GtFilterShortListModel >> selectedItem [ - ^ selectedItem + ^ selectedItem ifNil: [ selectedItem := GtFilterShortListModelNoItem default ] ] { #category : #accessing } @@ -65,3 +77,10 @@ GtFilterShortListModel >> selectedItem: anItem [ selectedItem := aNewItem. self notifySelectedItemChanged ] + +{ #category : #accessing } +GtFilterShortListModel >> selectedValue [ + "Return a filter value, e.g., selected item, input text." + + ^ self selectedItem +] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModelAbstractMethodItem.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModelAbstractMethodItem.class.st new file mode 100644 index 000000000..6c3df1695 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterShortListModelAbstractMethodItem.class.st @@ -0,0 +1,15 @@ +Class { + #name : #GtFilterShortListModelAbstractMethodItem, + #superclass : #GtFilterShortListModelMethodDefinitionItem, + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #testing } +GtFilterShortListModelAbstractMethodItem >> isSubclassResponsibilityMethod [ + ^ true +] + +{ #category : #accessing } +GtFilterShortListModelAbstractMethodItem >> label [ + ^ 'abstract' +] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModelClassItem.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModelClassItem.class.st new file mode 100644 index 000000000..5f97cc555 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterShortListModelClassItem.class.st @@ -0,0 +1,39 @@ +Class { + #name : #GtFilterShortListModelClassItem, + #superclass : #GtFilterShortListModelItem, + #instVars : [ + 'itemClass' + ], + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #accessing } +GtFilterShortListModelClassItem >> itemClass [ + ^ itemClass +] + +{ #category : #accessing } +GtFilterShortListModelClassItem >> itemClass: anObject [ + itemClass := anObject +] + +{ #category : #accessing } +GtFilterShortListModelClassItem >> itemSymbol [ + ^ self itemClass instanceSide name asSymbol +] + +{ #category : #accessing } +GtFilterShortListModelClassItem >> label [ + + ^ self itemClass name +] + +{ #category : #printing } +GtFilterShortListModelClassItem >> printOn: aStream [ + super printOn: aStream. + + aStream + nextPut: $(; + print: self itemClass; + nextPut: $) +] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModelClassOriginItem.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModelClassOriginItem.class.st new file mode 100644 index 000000000..9944288bb --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterShortListModelClassOriginItem.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtFilterShortListModelClassOriginItem, + #superclass : #GtFilterShortListModelMethodOriginItem, + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #accessing } +GtFilterShortListModelClassOriginItem >> label [ + ^ 'non-trait' +] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModelDefinedMethodItem.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModelDefinedMethodItem.class.st new file mode 100644 index 000000000..3db1e7992 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterShortListModelDefinedMethodItem.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtFilterShortListModelDefinedMethodItem, + #superclass : #GtFilterShortListModelMethodDefinitionItem, + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #testing } +GtFilterShortListModelDefinedMethodItem >> label [ + ^ 'defined' +] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModelItem.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModelItem.class.st index 185f1b2b2..8afc40934 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListModelItem.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListModelItem.class.st @@ -23,6 +23,21 @@ GtFilterShortListModelItem >> hash [ ^ self class hash bitXor: self label hash ] +{ #category : #accessing } +GtFilterShortListModelItem >> ifSome: aBlock [ + ^ self ifSome: aBlock ifNone: [ nil ] +] + +{ #category : #accessing } +GtFilterShortListModelItem >> ifSome: aBlock ifNone: aNoneBlock [ + ^ aBlock cull: self itemValue cull: self +] + +{ #category : #accessing } +GtFilterShortListModelItem >> itemValue [ + ^ self +] + { #category : #accessing } GtFilterShortListModelItem >> label [ diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModelMethodDefinitionItem.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModelMethodDefinitionItem.class.st new file mode 100644 index 000000000..eaef10e34 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterShortListModelMethodDefinitionItem.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtFilterShortListModelMethodDefinitionItem, + #superclass : #GtFilterShortListModelItem, + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #testing } +GtFilterShortListModelMethodDefinitionItem >> isSubclassResponsibilityMethod [ + ^ false +] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModelMethodOriginItem.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModelMethodOriginItem.class.st new file mode 100644 index 000000000..d844eb14e --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterShortListModelMethodOriginItem.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtFilterShortListModelMethodOriginItem, + #superclass : #GtFilterShortListModelItem, + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #testing } +GtFilterShortListModelMethodOriginItem >> isTraitOrigin [ + ^ false +] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModelNoItem.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModelNoItem.class.st new file mode 100644 index 000000000..9ee2f3dca --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterShortListModelNoItem.class.st @@ -0,0 +1,17 @@ +Class { + #name : #GtFilterShortListModelNoItem, + #superclass : #GtFilterShortListModelItem, + #traits : 'TGtUniqueInstance', + #classTraits : 'TGtUniqueInstance classTrait', + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #accessing } +GtFilterShortListModelNoItem >> ifSome: aBlock ifNone: aNoneBlock [ + ^ aNoneBlock value +] + +{ #category : #accessing } +GtFilterShortListModelNoItem >> label [ + ^ '' +] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModelStringItem.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModelStringItem.class.st index a6e666606..91e882ccb 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListModelStringItem.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListModelStringItem.class.st @@ -21,12 +21,27 @@ GtFilterShortListModelStringItem >> hash [ ^ self class hash bitXor: self string hash ] +{ #category : #accessing } +GtFilterShortListModelStringItem >> itemValue [ + ^ self string +] + { #category : #accessing } GtFilterShortListModelStringItem >> label [ ^ self string ] +{ #category : #printing } +GtFilterShortListModelStringItem >> printOn: aStream [ + super printOn: aStream. + + aStream + nextPut: $(; + nextPutAll: self string asString; + nextPut: $) +] + { #category : #accessing } GtFilterShortListModelStringItem >> string [ ^ string diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModelTraitOriginItem.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModelTraitOriginItem.class.st new file mode 100644 index 000000000..a6d847b74 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterShortListModelTraitOriginItem.class.st @@ -0,0 +1,15 @@ +Class { + #name : #GtFilterShortListModelTraitOriginItem, + #superclass : #GtFilterShortListModelMethodOriginItem, + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #testing } +GtFilterShortListModelTraitOriginItem >> isTraitOrigin [ + ^ true +] + +{ #category : #accessing } +GtFilterShortListModelTraitOriginItem >> label [ + ^ 'trait' +] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st index 6868a7118..b2a4be9d3 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st @@ -67,7 +67,7 @@ GtFilterShortListSettingsElement >> newContentElement [ ^ anElement ]. aListElement := BrSimpleList new - fitContent; + fitContentLimited; itemStencil: [ :anItemType :aListWidget | self newItemElement ]; itemDataBinder: [ :anItemElement :anItemObject :anItemIndex | anItemElement @@ -174,11 +174,12 @@ GtFilterShortListSettingsElement >> updateHandleElement: anElement [ GtFilterShortListSettingsElement >> updateListElement [ | aHeight aWidth | aHeight := self filterViewModel itemsCount * 12. - aWidth := (self filterViewModel items detectMax: #labelSize) labelSize * 12. + aWidth := (self filterViewModel items detectMax: #labelSize) + ifNotNil: [ :anItem | anItem labelSize * 12 ] + ifNil: [ 30 ]. buttonAptitude preferredExtent: aHeight @ aWidth. - - self listElementDo: [ :anElement | - self updateListElement: anElement ]. + + self listElementDo: [ :anElement | self updateListElement: anElement ] ] { #category : #'private - updating' } diff --git a/src/GToolkit-Coder-UI/GtFilterShortListSideItem.class.st b/src/GToolkit-Coder-UI/GtFilterShortListSideItem.class.st new file mode 100644 index 000000000..906047c68 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterShortListSideItem.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtFilterShortListSideItem, + #superclass : #GtFilterShortListModelItem, + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #testing } +GtFilterShortListSideItem >> isInstanceSideMethod [ + ^ false +] diff --git a/src/GToolkit-Coder-UI/GtFilterTextModel.class.st b/src/GToolkit-Coder-UI/GtFilterTextModel.class.st index 3572d9134..12f377758 100644 --- a/src/GToolkit-Coder-UI/GtFilterTextModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTextModel.class.st @@ -3,11 +3,22 @@ Class { #superclass : #GtFilterModel, #instVars : [ 'text', - 'inputFilter' + 'inputFilter', + 'completion' ], #category : #'GToolkit-Coder-UI-Filters - Models' } +{ #category : #accessing } +GtFilterTextModel >> completion [ + ^ completion +] + +{ #category : #accessing } +GtFilterTextModel >> completion: aCompletionBuilder [ + completion := aCompletionBuilder +] + { #category : #accessing } GtFilterTextModel >> filterViewModelClass [ ^ GtFilterTextViewModel @@ -50,6 +61,13 @@ GtFilterTextModel >> notifyTextChanged [ text: self text) ] +{ #category : #accessing } +GtFilterTextModel >> selectedValue [ + "Return a filter value, e.g., selected item, input text." + + ^ self text asString +] + { #category : #accessing } GtFilterTextModel >> text [ diff --git a/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st index 06b710bc5..2896f9232 100644 --- a/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st @@ -23,7 +23,14 @@ GtFilterTextSettingsElement >> initializeEditorElement [ aptitude: BrGlamorousRegularEditorAptitude new glamorousRegularSmallSize; text: ''; - padding: (BlInsets top: 1 right: 2 bottom: 1 left: 2) + padding: (BlInsets top: 1 right: 2 bottom: 1 left: 2); + constraintsDo: [ :c | c minWidth: 20 ]; + when: BrTextEditorModifiedEvent do: [ :anEvent | + self onTextEditorModified: anEvent ]; + addShortcut: (BlShortcutWithAction new + combination: BlKeyCombination enter; + action: [ :anEvent | + self onTextEditorModificationAccepted: anEvent ]). ] { #category : #'api - filter view model' } @@ -47,6 +54,22 @@ GtFilterTextSettingsElement >> onTextChanged: anAnnouncement [ action: [ self updateEditorElementText ] ] +{ #category : #'event handling' } +GtFilterTextSettingsElement >> onTextEditorModificationAccepted: anEvent [ + self hasFilterViewModel ifFalse: [ ^ self ]. + self filterViewModel + text: (editorElement text copy trimmer + bothSeparators; + trimmed) +] + +{ #category : #'event handling' } +GtFilterTextSettingsElement >> onTextEditorModified: anEvent [ + true ifTrue: [ ^ self ]. + self hasFilterViewModel ifFalse: [ ^ self ]. + self filterViewModel text: editorElement text +] + { #category : #'api - filter view model' } GtFilterTextSettingsElement >> subscribeToFilterViewModel [ super subscribeToFilterViewModel. @@ -76,8 +99,12 @@ GtFilterTextSettingsElement >> updateEditorElementInputFilter [ { #category : #'private - updating' } GtFilterTextSettingsElement >> updateEditorElementText [ - (editorElement text equals: self filterViewModel text) - ifTrue: [ ^ self ]. + | aText aTrimmedText | + aText := self filterViewModel text. + (editorElement text equals: aText) ifTrue: [ ^ self ]. - editorElement text: self filterViewModel text copy + aTrimmedText := aText trimmer + bothSeparators; + trimmed. + editorElement text: aTrimmedText ] diff --git a/src/GToolkit-Coder-UI/GtFilterTextViewModel.class.st b/src/GToolkit-Coder-UI/GtFilterTextViewModel.class.st index a4c35bfac..79948ec91 100644 --- a/src/GToolkit-Coder-UI/GtFilterTextViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTextViewModel.class.st @@ -47,3 +47,8 @@ GtFilterTextViewModel >> subscribeToFilterModel [ GtFilterTextViewModel >> text [ ^ self filterModel text ] + +{ #category : #testing } +GtFilterTextViewModel >> text: aText [ + self filterModel text: aText +] diff --git a/src/GToolkit-Coder-UI/GtFilterViewModel.class.st b/src/GToolkit-Coder-UI/GtFilterViewModel.class.st index ee5459c44..dc744bff8 100644 --- a/src/GToolkit-Coder-UI/GtFilterViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterViewModel.class.st @@ -27,6 +27,28 @@ GtFilterViewModel >> filterElementClass [ ^ self subclassResponsibility ] +{ #category : #accessing } +GtFilterViewModel >> label [ + + ^ self filterModel label +] + +{ #category : #'event handling' } +GtFilterViewModel >> onLabelChanged: anAnnouncement [ + self + announce: (GtFilterViewModelLabelChanged new + viewModel: self; + label: anAnnouncement label) +] + +{ #category : #'api - filter model' } +GtFilterViewModel >> subscribeToFilterModel [ + self filterModel weak + when: GtFilterModelLabelChanged + send: #onLabelChanged: + to: self +] + { #category : #'api - filter model' } GtFilterViewModel >> unsubscribeFromFilterModel [ self filterModel unsubscribe: self diff --git a/src/GToolkit-Coder-UI/GtFilterViewModelLabelChanged.class.st b/src/GToolkit-Coder-UI/GtFilterViewModelLabelChanged.class.st new file mode 100644 index 000000000..3bc31e835 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterViewModelLabelChanged.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtFilterViewModelLabelChanged, + #superclass : #GtFilterViewModelAnnouncement, + #instVars : [ + 'label' + ], + #category : #'GToolkit-Coder-UI-Filters - Events' +} + +{ #category : #accessing } +GtFilterViewModelLabelChanged >> label [ + ^ label +] + +{ #category : #accessing } +GtFilterViewModelLabelChanged >> label: anObject [ + label := anObject +] diff --git a/src/GToolkit-Coder-UI/GtFiltersItemsViewModel.class.st b/src/GToolkit-Coder-UI/GtFiltersItemsViewModel.class.st new file mode 100644 index 000000000..d3d06d12c --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFiltersItemsViewModel.class.st @@ -0,0 +1,51 @@ +Class { + #name : #GtFiltersItemsViewModel, + #superclass : #GtFiltersViewModel, + #category : #'GToolkit-Coder-UI-Filters - View Models' +} + +{ #category : #accessing } +GtFiltersItemsViewModel >> filtersElementClass [ + ^ GtFilterItemsElement +] + +{ #category : #accessing } +GtFiltersItemsViewModel >> items [ + + ^ self filtersModel items collect: [ :eachFilterModel | + self ensureFilterViewModelFor: eachFilterModel ] +] + +{ #category : #'event handling' } +GtFiltersItemsViewModel >> onItemsChanged: anAnnouncement [ + self removeOldFilterViewModelsFor: anAnnouncement items. + self + announce: (GtFiltersViewModelItemsChanged new + viewModel: self; + items: self items) +] + +{ #category : #'event handling' } +GtFiltersItemsViewModel >> removeOldFilterViewModelsFor: aCollectionOfFilterModels [ + "Remove filter view models of removed filter models. + New filter view models are added on #items call." + + | toRemove | + toRemove := filterViewModels keys reject: [ :each | + aCollectionOfFilterModels includes: each ]. + toRemove do: [ :eachKey | + filterViewModels removeKey: eachKey ifAbsent: [ "ignore" ] ] +] + +{ #category : #'api - filter model' } +GtFiltersItemsViewModel >> subscribeToFiltersModel [ + self filtersModel weak + when: GtFiltersModelItemsChanged + send: #onItemsChanged: + to: self +] + +{ #category : #'api - filter model' } +GtFiltersItemsViewModel >> unsubscribeFromFiltersModel [ + self filtersModel unsubscribe: self +] diff --git a/src/GToolkit-Coder-UI/GtFiltersModel.class.st b/src/GToolkit-Coder-UI/GtFiltersModel.class.st index 93f505211..1d9f826cd 100644 --- a/src/GToolkit-Coder-UI/GtFiltersModel.class.st +++ b/src/GToolkit-Coder-UI/GtFiltersModel.class.st @@ -3,5 +3,64 @@ Class { #superclass : #Object, #traits : 'TGtAnnouncer', #classTraits : 'TGtAnnouncer classTrait', + #instVars : [ + 'announcer', + 'availableFiltersBuilder' + ], #category : #'GToolkit-Coder-UI-Filters - Models' } + +{ #category : #'add / remove' } +GtFiltersModel >> addFilterModel: aFilterModel [ + self subclassResponsibility +] + +{ #category : #announcer } +GtFiltersModel >> announcer [ + + ^ announcer ifNil: [ announcer := Announcer new ] +] + +{ #category : #converting } +GtFiltersModel >> asFiltersElement [ + + ^ self asFiltersViewModel asFiltersElement +] + +{ #category : #converting } +GtFiltersModel >> asFiltersViewModel [ + + ^ self filtersViewModelClass new filtersModel: self +] + +{ #category : #accessing } +GtFiltersModel >> availableFilters [ + "Return a collection of available filters" + + + ^ availableFiltersBuilder ifNotNil: #availableFilters ifNil: [ #() ] +] + +{ #category : #accessing } +GtFiltersModel >> availableFiltersBuilder [ + ^ availableFiltersBuilder +] + +{ #category : #accessing } +GtFiltersModel >> availableFiltersBuilder: aBuilder [ + availableFiltersBuilder := aBuilder +] + +{ #category : #accessing } +GtFiltersModel >> filtersViewModelClass [ + + ^ self subclassResponsibility +] + +{ #category : #'gt - extensions' } +GtFiltersModel >> gtLiveFor: aView [ + + ^ aView explicit + title: 'Live'; + stencil: [ self asFiltersElement margin: (BlInsets all: 10) ] +] diff --git a/src/GToolkit-Coder-UI/GtFiltersAnnouncement.class.st b/src/GToolkit-Coder-UI/GtFiltersModelAnnouncement.class.st similarity index 62% rename from src/GToolkit-Coder-UI/GtFiltersAnnouncement.class.st rename to src/GToolkit-Coder-UI/GtFiltersModelAnnouncement.class.st index e5aea63cb..48d2cb888 100644 --- a/src/GToolkit-Coder-UI/GtFiltersAnnouncement.class.st +++ b/src/GToolkit-Coder-UI/GtFiltersModelAnnouncement.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtFiltersAnnouncement, + #name : #GtFiltersModelAnnouncement, #superclass : #Announcement, #instVars : [ 'model' @@ -8,11 +8,11 @@ Class { } { #category : #accessing } -GtFiltersAnnouncement >> model [ +GtFiltersModelAnnouncement >> model [ ^ model ] { #category : #accessing } -GtFiltersAnnouncement >> model: anObject [ +GtFiltersModelAnnouncement >> model: anObject [ model := anObject ] diff --git a/src/GToolkit-Coder-UI/GtFiltersModelItemsChanged.class.st b/src/GToolkit-Coder-UI/GtFiltersModelItemsChanged.class.st index 021ca56a3..fbb2c7bc2 100644 --- a/src/GToolkit-Coder-UI/GtFiltersModelItemsChanged.class.st +++ b/src/GToolkit-Coder-UI/GtFiltersModelItemsChanged.class.st @@ -1,5 +1,18 @@ Class { #name : #GtFiltersModelItemsChanged, - #superclass : #GtFiltersAnnouncement, + #superclass : #GtFiltersModelAnnouncement, + #instVars : [ + 'items' + ], #category : #'GToolkit-Coder-UI-Filters - Events' } + +{ #category : #accessing } +GtFiltersModelItemsChanged >> items [ + ^ items +] + +{ #category : #accessing } +GtFiltersModelItemsChanged >> items: anObject [ + items := anObject +] diff --git a/src/GToolkit-Coder-UI/GtFiltersModelUpdated.class.st b/src/GToolkit-Coder-UI/GtFiltersModelUpdated.class.st new file mode 100644 index 000000000..4e909094c --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFiltersModelUpdated.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtFiltersModelUpdated, + #superclass : #GtFiltersModelAnnouncement, + #category : #'GToolkit-Coder-UI-Filters - Events' +} diff --git a/src/GToolkit-Coder-UI/GtFiltersViewModel.class.st b/src/GToolkit-Coder-UI/GtFiltersViewModel.class.st new file mode 100644 index 000000000..8902296d6 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFiltersViewModel.class.st @@ -0,0 +1,70 @@ +Class { + #name : #GtFiltersViewModel, + #superclass : #Object, + #traits : 'TGtWithFiltersModel + TGtAnnouncer', + #classTraits : 'TGtWithFiltersModel classTrait + TGtAnnouncer classTrait', + #instVars : [ + 'announcer', + 'filterViewModels' + ], + #category : #'GToolkit-Coder-UI-Filters - View Models' +} + +{ #category : #'add / remove' } +GtFiltersViewModel >> addFilterModel: aFilterModel [ + self hasFiltersModel ifFalse: [ ^ self ]. + + ^ self filtersModel addFilterModel: aFilterModel +] + +{ #category : #announcer } +GtFiltersViewModel >> announcer [ + + ^ announcer ifNil: [ announcer := Announcer new ] +] + +{ #category : #converting } +GtFiltersViewModel >> asFiltersElement [ + ^ self filtersElementClass new filtersViewModel: self +] + +{ #category : #accessing } +GtFiltersViewModel >> availableFilters [ + "Return a collection of available filters" + + + ^ self filtersModel availableFilters +] + +{ #category : #private } +GtFiltersViewModel >> createFilterViewModelFor: aFilterModel [ + ^ aFilterModel asFilterViewModel +] + +{ #category : #private } +GtFiltersViewModel >> ensureFilterViewModelFor: aFilterModel [ + ^ filterViewModels + at: aFilterModel + ifPresent: [ :aFilterViewModel | aFilterViewModel ] + ifAbsentPut: [ self createFilterViewModelFor: aFilterModel ] +] + +{ #category : #accessing } +GtFiltersViewModel >> filtersElementClass [ + ^ self subclassResponsibility +] + +{ #category : #initialization } +GtFiltersViewModel >> initialize [ + super initialize. + filterViewModels := Dictionary new +] + +{ #category : #'add / remove' } +GtFiltersViewModel >> removeFilterViewModel: aFilterViewModel [ + aFilterViewModel hasFilterModel ifFalse: [ ^ self ]. + filterViewModels removeKey: aFilterViewModel filterModel ifAbsent: [ "ignore" ]. + + self hasFiltersModel ifFalse: [ ^ self ]. + self filtersModel removeFilterModel: aFilterViewModel filterModel +] diff --git a/src/GToolkit-Coder-UI/GtFiltersViewModelAnnouncement.class.st b/src/GToolkit-Coder-UI/GtFiltersViewModelAnnouncement.class.st new file mode 100644 index 000000000..80a58a941 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFiltersViewModelAnnouncement.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtFiltersViewModelAnnouncement, + #superclass : #Announcement, + #instVars : [ + 'viewModel' + ], + #category : #'GToolkit-Coder-UI-Filters - Events' +} + +{ #category : #accessing } +GtFiltersViewModelAnnouncement >> viewModel [ + ^ viewModel +] + +{ #category : #accessing } +GtFiltersViewModelAnnouncement >> viewModel: anObject [ + viewModel := anObject +] diff --git a/src/GToolkit-Coder-UI/GtFiltersViewModelItemsChanged.class.st b/src/GToolkit-Coder-UI/GtFiltersViewModelItemsChanged.class.st new file mode 100644 index 000000000..7e69dd3d8 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFiltersViewModelItemsChanged.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtFiltersViewModelItemsChanged, + #superclass : #GtFiltersViewModelAnnouncement, + #instVars : [ + 'items' + ], + #category : #'GToolkit-Coder-UI-Filters - Events' +} + +{ #category : #accessing } +GtFiltersViewModelItemsChanged >> items [ + ^ items +] + +{ #category : #accessing } +GtFiltersViewModelItemsChanged >> items: anObject [ + items := anObject +] diff --git a/src/GToolkit-Coder-UI/TGtWithFiltersModel.trait.st b/src/GToolkit-Coder-UI/TGtWithFiltersModel.trait.st new file mode 100644 index 000000000..eddecc534 --- /dev/null +++ b/src/GToolkit-Coder-UI/TGtWithFiltersModel.trait.st @@ -0,0 +1,47 @@ +Trait { + #name : #TGtWithFiltersModel, + #instVars : [ + 'filterModels' + ], + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #'api - filter model' } +TGtWithFiltersModel >> filtersModel [ + self + assert: [ filterModels isNotNil ] + description: [ 'Filters model must be defined' ]. + ^ filterModels +] + +{ #category : #'api - filter model' } +TGtWithFiltersModel >> filtersModel: aFiltersModel [ + filterModels = aFiltersModel ifTrue: [ ^ self ]. + + filterModels ifNotNil: [ self unsubscribeFromFiltersModel ]. + filterModels := aFiltersModel. + self onFiltersModelChanged. + self subscribeToFiltersModel +] + +{ #category : #'api - filter model' } +TGtWithFiltersModel >> filtersModelDo: aBlock [ + self hasFiltersModel ifTrue: [ aBlock cull: self filtersModel ] +] + +{ #category : #'api - filter model' } +TGtWithFiltersModel >> hasFiltersModel [ + ^ filterModels isNotNil +] + +{ #category : #'api - filter model' } +TGtWithFiltersModel >> onFiltersModelChanged [ +] + +{ #category : #'api - filter model' } +TGtWithFiltersModel >> subscribeToFiltersModel [ +] + +{ #category : #'api - filter model' } +TGtWithFiltersModel >> unsubscribeFromFiltersModel [ +] diff --git a/src/GToolkit-Coder-UI/TGtWithFiltersViewModel.trait.st b/src/GToolkit-Coder-UI/TGtWithFiltersViewModel.trait.st new file mode 100644 index 000000000..58f3b76bb --- /dev/null +++ b/src/GToolkit-Coder-UI/TGtWithFiltersViewModel.trait.st @@ -0,0 +1,48 @@ +Trait { + #name : #TGtWithFiltersViewModel, + #instVars : [ + 'filtersViewModel' + ], + #category : #'GToolkit-Coder-UI-Filters - View Models' +} + +{ #category : #'api - filter view model' } +TGtWithFiltersViewModel >> filtersViewModel [ + self + assert: [ filtersViewModel isNotNil ] + description: [ 'Filters view model must be defined' ]. + ^ filtersViewModel +] + +{ #category : #'api - filter view model' } +TGtWithFiltersViewModel >> filtersViewModel: aFiltersModel [ + filtersViewModel = aFiltersModel ifTrue: [ ^ self ]. + + filtersViewModel ifNotNil: [ self unsubscribeFromFiltersViewModel ]. + filtersViewModel := aFiltersModel. + self onFiltersViewModelChanged. + self subscribeToFiltersViewModel +] + +{ #category : #'api - filter view model' } +TGtWithFiltersViewModel >> filtersViewModelDo: aBlock [ + self hasFiltersViewModel ifTrue: [ + aBlock cull: self filtersViewModel ] +] + +{ #category : #'api - filter view model' } +TGtWithFiltersViewModel >> hasFiltersViewModel [ + ^ filtersViewModel isNotNil +] + +{ #category : #'api - filter view model' } +TGtWithFiltersViewModel >> onFiltersViewModelChanged [ +] + +{ #category : #'api - filter view model' } +TGtWithFiltersViewModel >> subscribeToFiltersViewModel [ +] + +{ #category : #'api - filter view model' } +TGtWithFiltersViewModel >> unsubscribeFromFiltersViewModel [ +] From dcdad06eb8d9855804b2234cea4aaa3abaa1a777 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 26 Sep 2024 11:36:02 -0300 Subject: [PATCH 0680/1268] add editor completion [feenkcom/gtoolkit#3983] --- src/GToolkit-Coder-UI/GtFilterTextModel.class.st | 12 +++++++++--- .../GtFilterTextSettingsElement.class.st | 15 ++++++++++++++- .../GtFilterTextViewModel.class.st | 6 ++++++ 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterTextModel.class.st b/src/GToolkit-Coder-UI/GtFilterTextModel.class.st index 12f377758..4d8acb6c3 100644 --- a/src/GToolkit-Coder-UI/GtFilterTextModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTextModel.class.st @@ -4,19 +4,25 @@ Class { #instVars : [ 'text', 'inputFilter', - 'completion' + 'completionBuilder' ], #category : #'GToolkit-Coder-UI-Filters - Models' } { #category : #accessing } GtFilterTextModel >> completion [ - ^ completion + + ^ completionBuilder value ] { #category : #accessing } GtFilterTextModel >> completion: aCompletionBuilder [ - completion := aCompletionBuilder + completionBuilder := aCompletionBuilder +] + +{ #category : #accessing } +GtFilterTextModel >> completionDo: aBlock [ + self completion ifNotNil: aBlock ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st index 2896f9232..12ff115de 100644 --- a/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st @@ -2,7 +2,8 @@ Class { #name : #GtFilterTextSettingsElement, #superclass : #GtFilterSettingsElement, #instVars : [ - 'editorElement' + 'editorElement', + 'completionController' ], #category : #'GToolkit-Coder-UI-Filters - Widgets' } @@ -83,10 +84,22 @@ GtFilterTextSettingsElement >> subscribeToFilterViewModel [ to: self ] +{ #category : #'private - updating' } +GtFilterTextSettingsElement >> updateEditorCompletionController [ + completionController ifNotNil: [ :aController | + completionController := nil. + aController uninstall ]. + + self filterViewModel completionDo: [ :aStrategy | + completionController := GtCompletionController on: editorElement strategy: aStrategy. + completionController install ] +] + { #category : #'private - updating' } GtFilterTextSettingsElement >> updateEditorElement [ self updateEditorElementInputFilter. self updateEditorElementText. + self updateEditorCompletionController. ] { #category : #'private - updating' } diff --git a/src/GToolkit-Coder-UI/GtFilterTextViewModel.class.st b/src/GToolkit-Coder-UI/GtFilterTextViewModel.class.st index 79948ec91..49b3f001a 100644 --- a/src/GToolkit-Coder-UI/GtFilterTextViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTextViewModel.class.st @@ -4,6 +4,12 @@ Class { #category : #'GToolkit-Coder-UI-Filters - View Models' } +{ #category : #accessing } +GtFilterTextViewModel >> completionDo: aBlock [ + self hasFilterModel ifFalse: [ ^ self ]. + self filterModel completionDo: aBlock +] + { #category : #accessing } GtFilterTextViewModel >> filterElementClass [ ^ GtFilterTextSettingsElement From 43d6249529b11c736f71e478940054326667a10f Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 26 Sep 2024 11:41:11 -0300 Subject: [PATCH 0681/1268] text filter widget accepts changes on focus-out [feenkcom/gtoolkit#3983] --- .../GtFilterTextSettingsElement.class.st | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st index 12ff115de..c3e0c8ed0 100644 --- a/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st @@ -26,12 +26,13 @@ GtFilterTextSettingsElement >> initializeEditorElement [ text: ''; padding: (BlInsets top: 1 right: 2 bottom: 1 left: 2); constraintsDo: [ :c | c minWidth: 20 ]; - when: BrTextEditorModifiedEvent do: [ :anEvent | - self onTextEditorModified: anEvent ]; addShortcut: (BlShortcutWithAction new combination: BlKeyCombination enter; action: [ :anEvent | - self onTextEditorModificationAccepted: anEvent ]). + self onTextEditorModificationAccepted: anEvent ]); + when: BlFocusOutEvent do: [ :anEvent | + anEvent isDueToRemoval ifFalse: [ + self onTextEditorModificationAccepted: anEvent ] ]. ] { #category : #'api - filter view model' } @@ -64,13 +65,6 @@ GtFilterTextSettingsElement >> onTextEditorModificationAccepted: anEvent [ trimmed) ] -{ #category : #'event handling' } -GtFilterTextSettingsElement >> onTextEditorModified: anEvent [ - true ifTrue: [ ^ self ]. - self hasFilterViewModel ifFalse: [ ^ self ]. - self filterViewModel text: editorElement text -] - { #category : #'api - filter view model' } GtFilterTextSettingsElement >> subscribeToFilterViewModel [ super subscribeToFilterViewModel. From bc1e129a5fa209e6cd2ac910342d865feaff02ed Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 26 Sep 2024 18:05:51 -0300 Subject: [PATCH 0682/1268] filter widgets are navigable using `(shift+)tab` and `left` and `right` arrow keys [feenkcom/gtoolkit#3983] --- .../GtFilterItemsElement.class.st | 32 +++++++++++++++++++ .../GtFilterTextSettingsElement.class.st | 5 ++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st index 110165e7c..e40b8856f 100644 --- a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st @@ -15,9 +15,39 @@ GtFilterItemsElement >> addElementForFilterViewModel: aFilterViewModel [ constraintsDo: [ :c | c flow vertical alignCenter. c flow horizontal alignLeft ]. + + self addNavigationShortcutsTo: anElement. + self addChild: anElement ] +{ #category : #'private - updating' } +GtFilterItemsElement >> addNavigationShortcutsTo: anElement [ + anElement + addShortcut: (BlShortcutWithAction new + name: 'Move to next filter'; + description: 'Moves to the next form item. If none is found, we cycle back to the first.'; + combination: (BlKeyCombination tab or: BlKeyCombination arrowRight); + overrideChildren: false; + action: [ :anEvent | + BlFocusFinder new + direction: BlFocusSearchDirectionForward new; + root: self; + referenceElement: anEvent currentTarget; + nextFocusDo: #requestFocus ifNone: [ ] ]); + addShortcut: (BlShortcutWithAction new + name: 'Move to previous form item'; + description: 'Moves to the previous form item. If none is found, we cycle back to the last.'; + combination: (BlKeyCombination shiftTab or: BlKeyCombination arrowLeft); + overrideChildren: false; + action: [ :anEvent | + BlFocusFinder new + direction: BlFocusSearchDirectionBackward new; + root: self; + referenceElement: anEvent currentTarget; + nextFocusDo: #requestFocus ifNone: [ ] ]). +] + { #category : #'private - updating' } GtFilterItemsElement >> addNewFilterElement [ self addChild: self newAddFilterButton as: #add @@ -98,6 +128,8 @@ GtFilterItemsElement >> newAddFilterButton [ content: [ self createDropdownContent ]); margin: (BlInsets left: 2); constraintsDo: [ :c | c flow vertical alignCenter ]; + beFocusable; + in: [ :anElement | self addNavigationShortcutsTo: anElement ]; addShortcut: (BlShortcutWithAction new combination: BlKeyCombination enter; diff --git a/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st index c3e0c8ed0..d1fb450ca 100644 --- a/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st @@ -30,9 +30,12 @@ GtFilterTextSettingsElement >> initializeEditorElement [ combination: BlKeyCombination enter; action: [ :anEvent | self onTextEditorModificationAccepted: anEvent ]); + when: BlFocusInEvent do: [ :anEvent | + anEvent currentTarget selecter all select ]; when: BlFocusOutEvent do: [ :anEvent | + anEvent currentTarget deselecter all deselect. anEvent isDueToRemoval ifFalse: [ - self onTextEditorModificationAccepted: anEvent ] ]. + self onTextEditorModificationAccepted: anEvent ] ] ] { #category : #'api - filter view model' } From 8ecace5093f6004fe17dcc3cf40c53500ed038da Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 26 Sep 2024 18:26:26 -0300 Subject: [PATCH 0683/1268] better shortcut descriptions [feenkcom/gtoolkit#3983] --- src/GToolkit-Coder-UI/GtFilterItemsElement.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st index e40b8856f..09dd397dc 100644 --- a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st @@ -26,7 +26,7 @@ GtFilterItemsElement >> addNavigationShortcutsTo: anElement [ anElement addShortcut: (BlShortcutWithAction new name: 'Move to next filter'; - description: 'Moves to the next form item. If none is found, we cycle back to the first.'; + description: 'Moves to the next filter. If none is found, we cycle back to the first.'; combination: (BlKeyCombination tab or: BlKeyCombination arrowRight); overrideChildren: false; action: [ :anEvent | @@ -37,7 +37,7 @@ GtFilterItemsElement >> addNavigationShortcutsTo: anElement [ nextFocusDo: #requestFocus ifNone: [ ] ]); addShortcut: (BlShortcutWithAction new name: 'Move to previous form item'; - description: 'Moves to the previous form item. If none is found, we cycle back to the last.'; + description: 'Moves to the previous filter. If none is found, we cycle back to the last.'; combination: (BlKeyCombination shiftTab or: BlKeyCombination arrowLeft); overrideChildren: false; action: [ :anEvent | From 5463bcd7f47b0ffbc47060683cb393e1e4905f6c Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 26 Sep 2024 18:33:35 -0300 Subject: [PATCH 0684/1268] the short list filter widget has a dropdown icon [feenkcom/gtoolkit#3983] --- .../GtFilterShortListSettingsElement.class.st | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st index b2a4be9d3..f938a9563 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st @@ -34,7 +34,7 @@ GtFilterShortListSettingsElement >> initialize [ { #category : #initialization } GtFilterShortListSettingsElement >> initializeButtonElement [ buttonElement := self newButtonElement - aptitude: BrGlamorousButtonWithLabelAptitude + aptitude: BrGlamorousButtonWithLabelAndIconAptitude ] { #category : #initialization } @@ -55,6 +55,7 @@ GtFilterShortListSettingsElement >> newButtonElement [ ^ BrButton new beSmallSize; label: self defaultItemLabel; + icon: BrGlamorousVectorIcons downwards; fitContent ] @@ -93,7 +94,8 @@ GtFilterShortListSettingsElement >> newHandleElement [ aHandle := self newButtonElement disable; aptitude: BrGlamorousButtonRectangularAptitude; - addAptitude: BrGlamorousButtonLabelAptitude. + addAptitude: BrGlamorousButtonLabelAptitude; + addAptitude: BrGlamorousButtonIconAptitude. self updateHandleElement: aHandle. handleElement at: 1 put: aHandle. From 5eaa1f8a9b8683c00e8f18a22b391595bd29a65c Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 26 Sep 2024 20:16:22 -0300 Subject: [PATCH 0685/1268] delete filter button as a tooltip with a key combination [feenkcom/gtoolkit#3983] --- .../GtFilterItemsElement.class.st | 43 +++++++++++++++++++ .../GtFilterNameElement.class.st | 2 +- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st index 09dd397dc..5cef3144f 100644 --- a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st @@ -17,6 +17,7 @@ GtFilterItemsElement >> addElementForFilterViewModel: aFilterViewModel [ c flow horizontal alignLeft ]. self addNavigationShortcutsTo: anElement. + self addRemoveButtonIconTo: anElement. self addChild: anElement ] @@ -53,6 +54,27 @@ GtFilterItemsElement >> addNewFilterElement [ self addChild: self newAddFilterButton as: #add ] +{ #category : #'private - updating' } +GtFilterItemsElement >> addRemoveButtonIconTo: anElement [ + | aRemoveButton aKeyMap | + aKeyMap := 'Backspace | Delete'. + anElement clipChildren: false. + aRemoveButton := self newRemoveButton. + aRemoveButton visibility: BlVisibility gone. + aRemoveButton addAptitude: (BrGlamorousWithLabelTooltipAptitude + text: 'Remove' + keymap: aKeyMap). + aRemoveButton action: [ :aButton | + self onRemoveFilterViewModelOfElement: anElement from: aButton ]. + anElement + when: BlMouseEnterEvent + do: [ :anEvent | aRemoveButton visibility: BlVisibility visible ]. + anElement + when: BlMouseLeaveEvent + do: [ :anEvent | aRemoveButton visibility: BlVisibility gone ]. + anElement addChild: aRemoveButton +] + { #category : #'private - updating' } GtFilterItemsElement >> createDropdownContent [ ^ BrSimpleList new @@ -97,6 +119,7 @@ GtFilterItemsElement >> initialize [ self hFitContentLimited. self vFitContent. self padding: (BlInsets all: 2). + self clipChildren: false. self initializeEventHandlers. ] @@ -147,6 +170,18 @@ GtFilterItemsElement >> newAddFilterHandleElement [ hExact: 20 ] +{ #category : #'private - updating' } +GtFilterItemsElement >> newRemoveButton [ + ^ GtInspectorRoundButtonStencil mini asElement + icon: (BrPlusIconStencil close radius: 3) asElement; + zIndex: 10; + id: GtPagerClosePageButtonElementId; + constraintsDo: [ :c | + c ignoreByLayout. + c ignored horizontal alignCenterAt: 1.0. + c ignored vertical alignCenterAt: 0.0 ] +] + { #category : #'api - filter view model' } GtFilterItemsElement >> onFiltersViewModelChanged [ self updateItemsElement @@ -157,6 +192,14 @@ GtFilterItemsElement >> onItemsChanged: anAnnouncement [ BlTaskAction enqueueElement: self action: [ self updateItemsElement ] ] +{ #category : #'private - updating' } +GtFilterItemsElement >> onRemoveFilterViewModelOfElement: anElement from: aButton [ + anElement hasFilterViewModel ifFalse: [ ^ self ]. + self hasFiltersViewModel ifFalse: [ ^ self ]. + + self filtersViewModel removeFilterViewModel: anElement filterViewModel +] + { #category : #'event handling' } GtFilterItemsElement >> onRemoveFilterViewModelWish: anEvent [ anEvent filterViewModel ifNil: [ ^ self ]. diff --git a/src/GToolkit-Coder-UI/GtFilterNameElement.class.st b/src/GToolkit-Coder-UI/GtFilterNameElement.class.st index 5015daae3..369d84333 100644 --- a/src/GToolkit-Coder-UI/GtFilterNameElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterNameElement.class.st @@ -68,7 +68,7 @@ GtFilterNameElement >> initializeSettingsContainer [ GtFilterNameElement >> initializeShortcuts [ self addShortcut: (BlShortcutWithAction new - combination: BlKeyCombination backspace; + combination: (BlKeyCombination backspace or: BlKeyCombination delete); action: [ self requestRemoveFilter ]) ] From dde313494ddb6d3a287d00dafec8056afaa2b310 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 27 Sep 2024 15:53:03 -0300 Subject: [PATCH 0686/1268] add filter toggle widget [feenkcom/gtoolkit#3983] --- .../GtFilterModelExamples.class.st | 28 ++++- src/GToolkit-Coder-UI/Class.extension.st | 2 +- .../GtFilterInvariableModel.class.st | 11 ++ ...GtFilterInvariableSettingsElement.class.st | 5 + .../GtFilterInvariableViewModel.class.st | 11 ++ .../GtFilterModelItem.class.st | 88 ++++++++++++++ ....st => GtFilterModelItemsChanged.class.st} | 6 +- ....class.st => GtFilterModelNoItem.class.st} | 8 +- ...GtFilterModelSelectedItemChanged.class.st} | 6 +- .../GtFilterNameElement.class.st | 1 + .../GtFilterShortListModel.class.st | 14 +-- .../GtFilterShortListModelClassItem.class.st | 2 +- .../GtFilterShortListModelItem.class.st | 51 -------- ...hortListModelMethodDefinitionItem.class.st | 2 +- ...terShortListModelMethodOriginItem.class.st | 2 +- .../GtFilterShortListModelStringItem.class.st | 2 +- .../GtFilterShortListSettingsElement.class.st | 6 +- .../GtFilterShortListSideItem.class.st | 2 +- .../GtFilterShortListViewModel.class.st | 10 +- .../GtFilterToggleModel.class.st | 87 ++++++++++++++ .../GtFilterToggleSettingsElement.class.st | 111 ++++++++++++++++++ .../GtFilterToggleViewModel.class.st | 64 ++++++++++ ...=> GtFilterViewModelItemsChanged.class.st} | 6 +- ...lterViewModelSelectedItemChanged.class.st} | 6 +- src/GToolkit-Coder-UI/String.extension.st | 2 +- 25 files changed, 442 insertions(+), 91 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtFilterInvariableModel.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterInvariableSettingsElement.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterInvariableViewModel.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterModelItem.class.st rename src/GToolkit-Coder-UI/{GtFilterShortListModelItemsChanged.class.st => GtFilterModelItemsChanged.class.st} (59%) rename src/GToolkit-Coder-UI/{GtFilterShortListModelNoItem.class.st => GtFilterModelNoItem.class.st} (54%) rename src/GToolkit-Coder-UI/{GtFilterShortListModelSelectedItemChanged.class.st => GtFilterModelSelectedItemChanged.class.st} (56%) delete mode 100644 src/GToolkit-Coder-UI/GtFilterShortListModelItem.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterToggleModel.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterToggleSettingsElement.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterToggleViewModel.class.st rename src/GToolkit-Coder-UI/{GtFilterShortListViewModelItemsChanged.class.st => GtFilterViewModelItemsChanged.class.st} (58%) rename src/GToolkit-Coder-UI/{GtFilterShortListViewModelSelectedItemChanged.class.st => GtFilterViewModelSelectedItemChanged.class.st} (55%) diff --git a/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st b/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st index 82346ee6b..c039a444e 100644 --- a/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st @@ -16,6 +16,16 @@ GtFilterModelExamples >> booleanModel [ ^ aModel ] +{ #category : #examples } +GtFilterModelExamples >> invariableModel [ + + | aModel | + aModel := GtFilterInvariableModel new. + aModel label: 'Stable tests'. + + ^ aModel +] + { #category : #examples } GtFilterModelExamples >> itemsModel [ @@ -43,8 +53,8 @@ GtFilterModelExamples >> shortListModel [ self assert: aModel items equals: ({'instance'. - 'class'} collect: #asFilterShortListModelItem). - self assert: aModel selectedItem equals: 'class' asFilterShortListModelItem. + 'class'} collect: #asFilterModelItem). + self assert: aModel selectedItem equals: 'class' asFilterModelItem. ^ aModel ] @@ -60,3 +70,17 @@ GtFilterModelExamples >> textModel [ ^ aModel ] + +{ #category : #examples } +GtFilterModelExamples >> toggleModel [ + + | aModel | + aModel := GtFilterToggleModel new. + aModel label: 'Side'. + aModel + items: {GtFilterShortListInstanceSideItem new. + GtFilterShortListClassSideItem new}. + aModel selectFirstItem. + + ^ aModel +] diff --git a/src/GToolkit-Coder-UI/Class.extension.st b/src/GToolkit-Coder-UI/Class.extension.st index e004cb7b8..e5e307e2c 100644 --- a/src/GToolkit-Coder-UI/Class.extension.st +++ b/src/GToolkit-Coder-UI/Class.extension.st @@ -1,6 +1,6 @@ Extension { #name : #Class } { #category : #'*GToolkit-Coder-UI' } -Class >> asFilterShortListModelItem [ +Class >> asFilterModelItem [ ^ GtFilterShortListModelClassItem new itemClass: self ] diff --git a/src/GToolkit-Coder-UI/GtFilterInvariableModel.class.st b/src/GToolkit-Coder-UI/GtFilterInvariableModel.class.st new file mode 100644 index 000000000..8b19a50da --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterInvariableModel.class.st @@ -0,0 +1,11 @@ +Class { + #name : #GtFilterInvariableModel, + #superclass : #GtFilterModel, + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #accessing } +GtFilterInvariableModel >> filterViewModelClass [ + + ^ GtFilterInvariableViewModel +] diff --git a/src/GToolkit-Coder-UI/GtFilterInvariableSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterInvariableSettingsElement.class.st new file mode 100644 index 000000000..a48ea01b2 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterInvariableSettingsElement.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtFilterInvariableSettingsElement, + #superclass : #GtFilterSettingsElement, + #category : #'GToolkit-Coder-UI-Filters - Widgets' +} diff --git a/src/GToolkit-Coder-UI/GtFilterInvariableViewModel.class.st b/src/GToolkit-Coder-UI/GtFilterInvariableViewModel.class.st new file mode 100644 index 000000000..b6f109e21 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterInvariableViewModel.class.st @@ -0,0 +1,11 @@ +Class { + #name : #GtFilterInvariableViewModel, + #superclass : #GtFilterViewModel, + #category : #'GToolkit-Coder-UI-Filters - View Models' +} + +{ #category : #accessing } +GtFilterInvariableViewModel >> filterElementClass [ + + ^ GtFilterInvariableSettingsElement +] diff --git a/src/GToolkit-Coder-UI/GtFilterModelItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelItem.class.st new file mode 100644 index 000000000..2b32ac588 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModelItem.class.st @@ -0,0 +1,88 @@ +Class { + #name : #GtFilterModelItem, + #superclass : #Object, + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #comparing } +GtFilterModelItem >> = anObject [ + self == anObject ifTrue: [ ^ true ]. + + self class = anObject class ifFalse: [ ^ false ]. + + ^ self label = anObject label +] + +{ #category : #converting } +GtFilterModelItem >> asFilterModelItem [ + ^ self +] + +{ #category : #comparing } +GtFilterModelItem >> hash [ + ^ self class hash bitXor: self label hash +] + +{ #category : #accessing } +GtFilterModelItem >> icon [ + + ^ nil +] + +{ #category : #accessing } +GtFilterModelItem >> ifIcon: anIconBlock [ + ^ self + ifIconAndLabel: anIconBlock + ifIcon: anIconBlock + ifLabel: [ "ignore" ] +] + +{ #category : #accessing } +GtFilterModelItem >> ifIconAndLabel: anIconAndLabelBlock ifIcon: anIconBlock ifLabel: aLabelBlock [ + ^ self label + ifNil: [ + self icon + ifNil: [ "ignore" ] + ifNotNil: [ :anIcon | anIconBlock cull: anIcon ] ] + ifNotNil: [ :aLabel | + self icon + ifNil: [ aLabelBlock cull: aLabel ] + ifNotNil: [ :anIcon | anIconAndLabelBlock cull: anIcon cull: aLabel ] ] +] + +{ #category : #accessing } +GtFilterModelItem >> ifLabel: aLabelBlock [ + ^ self + ifIconAndLabel: [ :anIcon :aLabel | aLabelBlock cull: aLabel ] + ifIcon: [ "ignore" ] + ifLabel: aLabelBlock +] + +{ #category : #accessing } +GtFilterModelItem >> ifSome: aBlock [ + ^ self ifSome: aBlock ifNone: [ nil ] +] + +{ #category : #accessing } +GtFilterModelItem >> ifSome: aBlock ifNone: aNoneBlock [ + ^ aBlock cull: self itemValue cull: self +] + +{ #category : #accessing } +GtFilterModelItem >> itemValue [ + ^ self +] + +{ #category : #accessing } +GtFilterModelItem >> label [ + "Return item label or nil" + + + ^ self subclassResponsibility +] + +{ #category : #accessing } +GtFilterModelItem >> labelSize [ + + ^ self label ifNotNil: #size ifNil: [ 0 ] +] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModelItemsChanged.class.st b/src/GToolkit-Coder-UI/GtFilterModelItemsChanged.class.st similarity index 59% rename from src/GToolkit-Coder-UI/GtFilterShortListModelItemsChanged.class.st rename to src/GToolkit-Coder-UI/GtFilterModelItemsChanged.class.st index ddea7b8a6..5b7a4f80d 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListModelItemsChanged.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelItemsChanged.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtFilterShortListModelItemsChanged, + #name : #GtFilterModelItemsChanged, #superclass : #GtFilterModelAnnouncement, #instVars : [ 'items' @@ -8,11 +8,11 @@ Class { } { #category : #accessing } -GtFilterShortListModelItemsChanged >> items [ +GtFilterModelItemsChanged >> items [ ^ items ] { #category : #accessing } -GtFilterShortListModelItemsChanged >> items: anObject [ +GtFilterModelItemsChanged >> items: anObject [ items := anObject ] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModelNoItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelNoItem.class.st similarity index 54% rename from src/GToolkit-Coder-UI/GtFilterShortListModelNoItem.class.st rename to src/GToolkit-Coder-UI/GtFilterModelNoItem.class.st index 9ee2f3dca..97c959879 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListModelNoItem.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelNoItem.class.st @@ -1,17 +1,17 @@ Class { - #name : #GtFilterShortListModelNoItem, - #superclass : #GtFilterShortListModelItem, + #name : #GtFilterModelNoItem, + #superclass : #GtFilterModelItem, #traits : 'TGtUniqueInstance', #classTraits : 'TGtUniqueInstance classTrait', #category : #'GToolkit-Coder-UI-Filters - Models' } { #category : #accessing } -GtFilterShortListModelNoItem >> ifSome: aBlock ifNone: aNoneBlock [ +GtFilterModelNoItem >> ifSome: aBlock ifNone: aNoneBlock [ ^ aNoneBlock value ] { #category : #accessing } -GtFilterShortListModelNoItem >> label [ +GtFilterModelNoItem >> label [ ^ '' ] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModelSelectedItemChanged.class.st b/src/GToolkit-Coder-UI/GtFilterModelSelectedItemChanged.class.st similarity index 56% rename from src/GToolkit-Coder-UI/GtFilterShortListModelSelectedItemChanged.class.st rename to src/GToolkit-Coder-UI/GtFilterModelSelectedItemChanged.class.st index 5cc42e1ea..944b73b1d 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListModelSelectedItemChanged.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelSelectedItemChanged.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtFilterShortListModelSelectedItemChanged, + #name : #GtFilterModelSelectedItemChanged, #superclass : #GtFilterModelAnnouncement, #instVars : [ 'selectedItem' @@ -8,11 +8,11 @@ Class { } { #category : #accessing } -GtFilterShortListModelSelectedItemChanged >> selectedItem [ +GtFilterModelSelectedItemChanged >> selectedItem [ ^ selectedItem ] { #category : #accessing } -GtFilterShortListModelSelectedItemChanged >> selectedItem: anObject [ +GtFilterModelSelectedItemChanged >> selectedItem: anObject [ selectedItem := anObject ] diff --git a/src/GToolkit-Coder-UI/GtFilterNameElement.class.st b/src/GToolkit-Coder-UI/GtFilterNameElement.class.st index 369d84333..9fe8d91da 100644 --- a/src/GToolkit-Coder-UI/GtFilterNameElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterNameElement.class.st @@ -58,6 +58,7 @@ GtFilterNameElement >> initializeLabelElement [ { #category : #initialization } GtFilterNameElement >> initializeSettingsContainer [ settingsContainer := BrFrame new + background: self theme default contentBackgroundColor; hFitContentLimited; vFitContent; margin: (BlInsets all: 2); diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st index 45235ced7..e0c8c7b83 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st @@ -28,25 +28,25 @@ GtFilterShortListModel >> items [ { #category : #accessing } GtFilterShortListModel >> items: aCollection [ | aNewCollection | - aNewCollection := aCollection collect: #asFilterShortListModelItem. + aNewCollection := aCollection collect: #asFilterModelItem. self items = aNewCollection ifTrue: [ ^ self ]. items := aNewCollection. self notifyItemsChanged. ] -{ #category : #accessing } +{ #category : #'private - notifying' } GtFilterShortListModel >> notifyItemsChanged [ self - announce: (GtFilterShortListModelItemsChanged new + announce: (GtFilterModelItemsChanged new model: self; items: self items) ] -{ #category : #accessing } +{ #category : #'private - notifying' } GtFilterShortListModel >> notifySelectedItemChanged [ self - announce: (GtFilterShortListModelSelectedItemChanged new + announce: (GtFilterModelSelectedItemChanged new model: self; selectedItem: self selectedItem) ] @@ -65,13 +65,13 @@ GtFilterShortListModel >> selectLastItem [ { #category : #accessing } GtFilterShortListModel >> selectedItem [ - ^ selectedItem ifNil: [ selectedItem := GtFilterShortListModelNoItem default ] + ^ selectedItem ifNil: [ selectedItem := GtFilterModelNoItem default ] ] { #category : #accessing } GtFilterShortListModel >> selectedItem: anItem [ | aNewItem | - aNewItem := anItem asFilterShortListModelItem. + aNewItem := anItem asFilterModelItem. self selectedItem = aNewItem ifTrue: [ ^ self ]. selectedItem := aNewItem. diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModelClassItem.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModelClassItem.class.st index 5f97cc555..57a9999e2 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListModelClassItem.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListModelClassItem.class.st @@ -1,6 +1,6 @@ Class { #name : #GtFilterShortListModelClassItem, - #superclass : #GtFilterShortListModelItem, + #superclass : #GtFilterModelItem, #instVars : [ 'itemClass' ], diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModelItem.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModelItem.class.st deleted file mode 100644 index 8afc40934..000000000 --- a/src/GToolkit-Coder-UI/GtFilterShortListModelItem.class.st +++ /dev/null @@ -1,51 +0,0 @@ -Class { - #name : #GtFilterShortListModelItem, - #superclass : #Object, - #category : #'GToolkit-Coder-UI-Filters - Models' -} - -{ #category : #comparing } -GtFilterShortListModelItem >> = anObject [ - self == anObject ifTrue: [ ^ true ]. - - self class = anObject class ifFalse: [ ^ false ]. - - ^ self label = anObject label -] - -{ #category : #converting } -GtFilterShortListModelItem >> asFilterShortListModelItem [ - ^ self -] - -{ #category : #comparing } -GtFilterShortListModelItem >> hash [ - ^ self class hash bitXor: self label hash -] - -{ #category : #accessing } -GtFilterShortListModelItem >> ifSome: aBlock [ - ^ self ifSome: aBlock ifNone: [ nil ] -] - -{ #category : #accessing } -GtFilterShortListModelItem >> ifSome: aBlock ifNone: aNoneBlock [ - ^ aBlock cull: self itemValue cull: self -] - -{ #category : #accessing } -GtFilterShortListModelItem >> itemValue [ - ^ self -] - -{ #category : #accessing } -GtFilterShortListModelItem >> label [ - - ^ self subclassResponsibility -] - -{ #category : #accessing } -GtFilterShortListModelItem >> labelSize [ - - ^ self label size -] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModelMethodDefinitionItem.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModelMethodDefinitionItem.class.st index eaef10e34..e09ec7bef 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListModelMethodDefinitionItem.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListModelMethodDefinitionItem.class.st @@ -1,6 +1,6 @@ Class { #name : #GtFilterShortListModelMethodDefinitionItem, - #superclass : #GtFilterShortListModelItem, + #superclass : #GtFilterModelItem, #category : #'GToolkit-Coder-UI-Filters - Models' } diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModelMethodOriginItem.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModelMethodOriginItem.class.st index d844eb14e..c30ecbea9 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListModelMethodOriginItem.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListModelMethodOriginItem.class.st @@ -1,6 +1,6 @@ Class { #name : #GtFilterShortListModelMethodOriginItem, - #superclass : #GtFilterShortListModelItem, + #superclass : #GtFilterModelItem, #category : #'GToolkit-Coder-UI-Filters - Models' } diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModelStringItem.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModelStringItem.class.st index 91e882ccb..7761326bd 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListModelStringItem.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListModelStringItem.class.st @@ -1,6 +1,6 @@ Class { #name : #GtFilterShortListModelStringItem, - #superclass : #GtFilterShortListModelItem, + #superclass : #GtFilterModelItem, #instVars : [ 'string' ], diff --git a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st index f938a9563..956515356 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st @@ -131,7 +131,7 @@ GtFilterShortListSettingsElement >> onItemsChanged: anAnnouncement [ ] { #category : #'event handling' } -GtFilterShortListSettingsElement >> onSelectedItemChanged: anAnnouncement [. +GtFilterShortListSettingsElement >> onSelectedItemChanged: anAnnouncement [ BlTaskAction enqueueElement: self action: [ self updateElement ] ] @@ -139,10 +139,10 @@ GtFilterShortListSettingsElement >> onSelectedItemChanged: anAnnouncement [. GtFilterShortListSettingsElement >> subscribeToFilterViewModel [ super subscribeToFilterViewModel. self filterViewModel weak - when: GtFilterShortListViewModelItemsChanged + when: GtFilterViewModelItemsChanged send: #onItemsChanged: to: self; - when: GtFilterShortListViewModelSelectedItemChanged + when: GtFilterViewModelSelectedItemChanged send: #onSelectedItemChanged: to: self ] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListSideItem.class.st b/src/GToolkit-Coder-UI/GtFilterShortListSideItem.class.st index 906047c68..357534969 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListSideItem.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListSideItem.class.st @@ -1,6 +1,6 @@ Class { #name : #GtFilterShortListSideItem, - #superclass : #GtFilterShortListModelItem, + #superclass : #GtFilterModelItem, #category : #'GToolkit-Coder-UI-Filters - Models' } diff --git a/src/GToolkit-Coder-UI/GtFilterShortListViewModel.class.st b/src/GToolkit-Coder-UI/GtFilterShortListViewModel.class.st index 8cd48c21c..9f3c039f8 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListViewModel.class.st @@ -31,10 +31,10 @@ GtFilterShortListViewModel >> itemsWithoutSelection [ ^ self filterModel items reject: [ :each | aSelectedItem = each ] ] -{ #category : #'api - filter model' } +{ #category : #'event handling' } GtFilterShortListViewModel >> onItemsChanged: anAnnouncement [ self - announce: (GtFilterShortListViewModelItemsChanged new + announce: (GtFilterViewModelItemsChanged new viewModel: self; items: anAnnouncement items) ] @@ -42,7 +42,7 @@ GtFilterShortListViewModel >> onItemsChanged: anAnnouncement [ { #category : #'api - filter model' } GtFilterShortListViewModel >> onSelectedItemChanged: anAnnouncement [ self - announce: (GtFilterShortListViewModelSelectedItemChanged new + announce: (GtFilterViewModelSelectedItemChanged new viewModel: self; selectedItem: anAnnouncement selectedItem) ] @@ -61,10 +61,10 @@ GtFilterShortListViewModel >> selectedItem: anItem [ GtFilterShortListViewModel >> subscribeToFilterModel [ super subscribeToFilterModel. self filterModel weak - when: GtFilterShortListModelItemsChanged + when: GtFilterModelItemsChanged send: #onItemsChanged: to: self; - when: GtFilterShortListModelSelectedItemChanged + when: GtFilterModelSelectedItemChanged send: #onSelectedItemChanged: to: self ] diff --git a/src/GToolkit-Coder-UI/GtFilterToggleModel.class.st b/src/GToolkit-Coder-UI/GtFilterToggleModel.class.st new file mode 100644 index 000000000..bc33ea128 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterToggleModel.class.st @@ -0,0 +1,87 @@ +Class { + #name : #GtFilterToggleModel, + #superclass : #GtFilterModel, + #instVars : [ + 'items', + 'selectedItem' + ], + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #accessing } +GtFilterToggleModel >> filterViewModelClass [ + + ^ GtFilterToggleViewModel +] + +{ #category : #initialization } +GtFilterToggleModel >> initialize [ + super initialize. + items := #() +] + +{ #category : #accessing } +GtFilterToggleModel >> items [ + + ^ items +] + +{ #category : #accessing } +GtFilterToggleModel >> items: aCollection [ + | aNewCollection | + aNewCollection := aCollection collect: #asFilterModelItem. + self items = aNewCollection ifTrue: [ ^ self ]. + + items := aNewCollection. + self notifyItemsChanged. +] + +{ #category : #'private - notifying' } +GtFilterToggleModel >> notifyItemsChanged [ + self + announce: (GtFilterModelItemsChanged new + model: self; + items: self items) +] + +{ #category : #'private - notifying' } +GtFilterToggleModel >> notifySelectedItemChanged [ + self + announce: (GtFilterModelSelectedItemChanged new + model: self; + selectedItem: self selectedItem) +] + +{ #category : #initialization } +GtFilterToggleModel >> selectFirstItem [ + self items ifEmpty: [ ^ self ]. + self selectedItem: self items first +] + +{ #category : #initialization } +GtFilterToggleModel >> selectLastItem [ + self items ifEmpty: [ ^ self ]. + self selectedItem: self items last +] + +{ #category : #accessing } +GtFilterToggleModel >> selectedItem [ + ^ selectedItem ifNil: [ selectedItem := GtFilterModelNoItem default ] +] + +{ #category : #accessing } +GtFilterToggleModel >> selectedItem: anItem [ + | aNewItem | + aNewItem := anItem asFilterModelItem. + self selectedItem = aNewItem ifTrue: [ ^ self ]. + + selectedItem := aNewItem. + self notifySelectedItemChanged +] + +{ #category : #accessing } +GtFilterToggleModel >> selectedValue [ + "Return a filter value, e.g., selected item, input text." + + ^ self selectedItem +] diff --git a/src/GToolkit-Coder-UI/GtFilterToggleSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterToggleSettingsElement.class.st new file mode 100644 index 000000000..557820eae --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterToggleSettingsElement.class.st @@ -0,0 +1,111 @@ +Class { + #name : #GtFilterToggleSettingsElement, + #superclass : #GtFilterSettingsElement, + #instVars : [ + 'toggleGroupElement' + ], + #category : #'GToolkit-Coder-UI-Filters - Widgets' +} + +{ #category : #initialization } +GtFilterToggleSettingsElement >> initialize [ + super initialize. + self initializeToggleGroupElement. + + self addChild: toggleGroupElement as: #toggles +] + +{ #category : #initialization } +GtFilterToggleSettingsElement >> initializeToggleGroupElement [ + toggleGroupElement := BrToggleGroup new + aptitude: BrGlamorousToggleGroupAptitude new; + when: BrToggleActivatedEvent + do: [ :anEvent | self onToggleActivatedEvent: anEvent ] +] + +{ #category : #'private - updating' } +GtFilterToggleSettingsElement >> newAptitudeForItem: anItem [ + | anAptitude | + anAptitude := anItem + ifIconAndLabel: [ BrGlamorousToggleWithIconAndLabelAptitude new ] + ifIcon: [ BrGlamorousToggleWithIconAptitude new ] + ifLabel: [ BrGlamorousToggleWithLabelAptitude new ]. + + "anAptitude - BrGlamorousToggleBackgroundAptitude. + anAptitude add: (BrToggleAptitude new + activated: [ :aStyle | aStyle visibility: BlVisibility visible ]; + default: [ :aStyle | aStyle visibility: BlVisibility hidden ])" + + ^ anAptitude +] + +{ #category : #'api - filter view model' } +GtFilterToggleSettingsElement >> onFilterViewModelChanged [ + super onFilterViewModelChanged. + self updateElement +] + +{ #category : #'event handling' } +GtFilterToggleSettingsElement >> onItemsChanged: anAnnouncement [ + BlTaskAction enqueueElement: self action: [ self updateElement ] +] + +{ #category : #'event handling' } +GtFilterToggleSettingsElement >> onSelectedItemChanged: anAnnouncement [ + BlTaskAction enqueueElement: self action: [ self updateActiveToggle ] +] + +{ #category : #initialization } +GtFilterToggleSettingsElement >> onToggleActivatedEvent: anEvent [ + self hasFilterViewModel ifFalse: [ ^ self ]. + anEvent toggle model ifNotNil: [ :anItem | + self filterViewModel selectedItem: anItem ] +] + +{ #category : #'api - filter view model' } +GtFilterToggleSettingsElement >> subscribeToFilterViewModel [ + super subscribeToFilterViewModel. + self filterViewModel weak + when: GtFilterViewModelItemsChanged + send: #onItemsChanged: + to: self; + when: GtFilterViewModelSelectedItemChanged + send: #onSelectedItemChanged: + to: self +] + +{ #category : #'private - updating' } +GtFilterToggleSettingsElement >> updateActiveToggle [ + | aSelectedItem | + aSelectedItem := self filterViewModel selectedItem. + toggleGroupElement activatedToggle viewModel model == aSelectedItem + ifTrue: [ ^ self ]. + toggleGroupElement viewModel toggles + do: [ :eachToggle | + eachToggle viewModel model == aSelectedItem + ifTrue: [ eachToggle activate ] ] +] + +{ #category : #'private - updating' } +GtFilterToggleSettingsElement >> updateElement [ + self updateToggles +] + +{ #category : #'private - updating' } +GtFilterToggleSettingsElement >> updateToggles [ + | aSelectedItem | + toggleGroupElement removeToggles. + aSelectedItem := self filterViewModel selectedItem. + + self filterViewModel items + do: [ :eachItem | + | aToggle | + aToggle := BrToggle new. + aToggle beSmallSize. + aToggle viewModel model: eachItem. + eachItem == aSelectedItem ifTrue: [ aToggle activate ]. + eachItem ifIcon: [ :anIcon | aToggle icon: anIcon ]. + eachItem ifLabel: [ :aLabel | aToggle label: aLabel ]. + aToggle aptitude: (self newAptitudeForItem: eachItem). + toggleGroupElement addToggle: aToggle ] +] diff --git a/src/GToolkit-Coder-UI/GtFilterToggleViewModel.class.st b/src/GToolkit-Coder-UI/GtFilterToggleViewModel.class.st new file mode 100644 index 000000000..80cd6d99a --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterToggleViewModel.class.st @@ -0,0 +1,64 @@ +Class { + #name : #GtFilterToggleViewModel, + #superclass : #GtFilterViewModel, + #category : #'GToolkit-Coder-UI-Filters - View Models' +} + +{ #category : #accessing } +GtFilterToggleViewModel >> filterElementClass [ + + ^ GtFilterToggleSettingsElement +] + +{ #category : #accessing } +GtFilterToggleViewModel >> items [ + ^ self filterModel items +] + +{ #category : #accessing } +GtFilterToggleViewModel >> items: aCollection [ + self filterModel items: aCollection +] + +{ #category : #accessing } +GtFilterToggleViewModel >> itemsCount [ + ^ self filterModel items size +] + +{ #category : #'event handling' } +GtFilterToggleViewModel >> onItemsChanged: anAnnouncement [ + self + announce: (GtFilterViewModelItemsChanged new + viewModel: self; + items: anAnnouncement items) +] + +{ #category : #'event handling' } +GtFilterToggleViewModel >> onSelectedItemChanged: anAnnouncement [ + self + announce: (GtFilterViewModelSelectedItemChanged new + viewModel: self; + selectedItem: anAnnouncement selectedItem) +] + +{ #category : #accessing } +GtFilterToggleViewModel >> selectedItem [ + ^ self filterModel selectedItem +] + +{ #category : #accessing } +GtFilterToggleViewModel >> selectedItem: anItem [ + self filterModel selectedItem: anItem +] + +{ #category : #'api - filter model' } +GtFilterToggleViewModel >> subscribeToFilterModel [ + super subscribeToFilterModel. + self filterModel weak + when: GtFilterModelItemsChanged + send: #onItemsChanged: + to: self; + when: GtFilterModelSelectedItemChanged + send: #onSelectedItemChanged: + to: self +] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListViewModelItemsChanged.class.st b/src/GToolkit-Coder-UI/GtFilterViewModelItemsChanged.class.st similarity index 58% rename from src/GToolkit-Coder-UI/GtFilterShortListViewModelItemsChanged.class.st rename to src/GToolkit-Coder-UI/GtFilterViewModelItemsChanged.class.st index 912bf362b..21c97fc62 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListViewModelItemsChanged.class.st +++ b/src/GToolkit-Coder-UI/GtFilterViewModelItemsChanged.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtFilterShortListViewModelItemsChanged, + #name : #GtFilterViewModelItemsChanged, #superclass : #GtFilterViewModelAnnouncement, #instVars : [ 'items' @@ -8,11 +8,11 @@ Class { } { #category : #accessing } -GtFilterShortListViewModelItemsChanged >> items [ +GtFilterViewModelItemsChanged >> items [ ^ items ] { #category : #accessing } -GtFilterShortListViewModelItemsChanged >> items: anObject [ +GtFilterViewModelItemsChanged >> items: anObject [ items := anObject ] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListViewModelSelectedItemChanged.class.st b/src/GToolkit-Coder-UI/GtFilterViewModelSelectedItemChanged.class.st similarity index 55% rename from src/GToolkit-Coder-UI/GtFilterShortListViewModelSelectedItemChanged.class.st rename to src/GToolkit-Coder-UI/GtFilterViewModelSelectedItemChanged.class.st index 6e725e601..36ad4bed7 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListViewModelSelectedItemChanged.class.st +++ b/src/GToolkit-Coder-UI/GtFilterViewModelSelectedItemChanged.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtFilterShortListViewModelSelectedItemChanged, + #name : #GtFilterViewModelSelectedItemChanged, #superclass : #GtFilterViewModelAnnouncement, #instVars : [ 'selectedItem' @@ -8,11 +8,11 @@ Class { } { #category : #accessing } -GtFilterShortListViewModelSelectedItemChanged >> selectedItem [ +GtFilterViewModelSelectedItemChanged >> selectedItem [ ^ selectedItem ] { #category : #accessing } -GtFilterShortListViewModelSelectedItemChanged >> selectedItem: anObject [ +GtFilterViewModelSelectedItemChanged >> selectedItem: anObject [ selectedItem := anObject ] diff --git a/src/GToolkit-Coder-UI/String.extension.st b/src/GToolkit-Coder-UI/String.extension.st index 0b870b68e..663763bfa 100644 --- a/src/GToolkit-Coder-UI/String.extension.st +++ b/src/GToolkit-Coder-UI/String.extension.st @@ -1,6 +1,6 @@ Extension { #name : #String } { #category : #'*GToolkit-Coder-UI' } -String >> asFilterShortListModelItem [ +String >> asFilterModelItem [ ^ GtFilterShortListModelStringItem new string: self ] From fe89f39826b4b8241152484cee3d1b0706a1fda1 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 27 Sep 2024 18:44:12 -0300 Subject: [PATCH 0687/1268] add `FilterModel>>#=` and `#hash` methods [feenkcom/gtoolkit#3983] --- src/GToolkit-Coder-UI/GtFilterModel.class.st | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtFilterModel.class.st b/src/GToolkit-Coder-UI/GtFilterModel.class.st index 0658bf9a6..5c7937399 100644 --- a/src/GToolkit-Coder-UI/GtFilterModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModel.class.st @@ -12,6 +12,15 @@ Class { #category : #'GToolkit-Coder-UI-Filters - Models' } +{ #category : #comparing } +GtFilterModel >> = anObject [ + self == anObject ifTrue: [ ^ true ]. + + ^ self class = anObject class + and: [ self label = anObject label + and: [ self order = anObject order ] ] +] + { #category : #announcer } GtFilterModel >> announcer [ @@ -71,6 +80,13 @@ GtFilterModel >> gtLiveFor: aView [ margin: (BlInsets all: 10) ] ] +{ #category : #comparing } +GtFilterModel >> hash [ + ^ self class hash + bitXor: (self label hash + bitXor: self order hash) +] + { #category : #accessing } GtFilterModel >> label [ "Return filter label" From 4eff96fd51cca82f9f5412858d89c64f8d7bc96e Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Sun, 29 Sep 2024 12:40:54 +0200 Subject: [PATCH 0688/1268] only show possible protocol action in the context menu --- ...derNavigationProtocolsGroupedList.class.st | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st index 56364fd5a..b1fe0d99e 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st @@ -81,11 +81,18 @@ GtCoderNavigationProtocolsGroupedList >> createProtocolGroups [ ] { #category : #'private - instance creation' } -GtCoderNavigationProtocolsGroupedList >> createProtocolListContextMenuItemsFor: item [ - ^ {(self createLabel: 'Remove ' description: item name) - -> [ :elem | self removeProtocol: item name in: elem ]. - (self createLabel: 'Rename ' description: item name) - -> [ :elem | self renameProtocol: item name in: elem ]} +GtCoderNavigationProtocolsGroupedList >> createProtocolListContextMenuItemsFor: aPharoProtocol [ + ^ Array + streamContents: [ :aStream | + aPharoProtocol canBeRemoved + ifTrue: [ aStream + nextPut: (self createLabel: 'Remove ' description: aPharoProtocol name) + -> [ :elem | self removeProtocol: aPharoProtocol in: elem ] ]. + + aPharoProtocol canBeRenamed + ifTrue: [ aStream + nextPut: (self createLabel: 'Rename ' description: aPharoProtocol name) + -> [ :elem | self renameProtocol: aPharoProtocol name in: elem ] ] ] ] { #category : #initialization } @@ -143,11 +150,11 @@ GtCoderNavigationProtocolsGroupedList >> onDropCompiledMethodsOnProtocol: anItem ] { #category : #'private - refactorings' } -GtCoderNavigationProtocolsGroupedList >> removeProtocol: protocolName in: elem [ +GtCoderNavigationProtocolsGroupedList >> removeProtocol: aGtPharoProtocol in: elem [ | refactoring | refactoring := RBRemoveProtocolChange - removeProtocolNamed: protocolName - in: self selectedClass. + removeProtocolNamed: aGtPharoProtocol name + in: aGtPharoProtocol protocolClass. ^ self addPreviewButtonFor: refactoring to: elem @@ -155,19 +162,19 @@ GtCoderNavigationProtocolsGroupedList >> removeProtocol: protocolName in: elem [ ] { #category : #'private - refactorings' } -GtCoderNavigationProtocolsGroupedList >> renameProtocol: protocolName in: elem [ +GtCoderNavigationProtocolsGroupedList >> renameProtocol: aGtPharoProtocol in: elem [ | refactoring edit | edit := BrEditableLabel new. edit aptitude: (BrGlamorousEditableLabelAptitude new fontSize: 11.9; "Force the font to match the label font" background: Color transparent); - text: protocolName; + text: aGtPharoProtocol name; when: BrEditorAcceptWish do: [ :aWish | refactoring := GtRBRenameProtocolRefactoring - renameProtocol: protocolName - in: self selectedClass + renameProtocol: aGtPharoProtocol name + in: aGtPharoProtocol protocolClass to: aWish text asString. edit switchToLabel. self From 13258ddc84d4bb90b5611d315ce91727d3a744c3 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 30 Sep 2024 10:18:05 -0300 Subject: [PATCH 0689/1268] rename `GtFilterModelItem` subclasses [feenkcom/gtoolkit#3983] --- .../GtFilterModelExamples.class.st | 10 ++++++---- src/GToolkit-Coder-UI/Class.extension.st | 2 +- .../GtFilterModelAbstractMethodItem.class.st | 15 +++++++++++++++ ....class.st => GtFilterModelClassItem.class.st} | 12 ++++++------ .../GtFilterModelClassOriginItem.class.st | 10 ++++++++++ .../GtFilterModelClassSideItem.class.st | 10 ++++++++++ .../GtFilterModelDefinedMethodItem.class.st | 10 ++++++++++ .../GtFilterModelInstanceSideItem.class.st | 15 +++++++++++++++ ...> GtFilterModelMethodDefinitionItem.class.st} | 4 ++-- ...st => GtFilterModelMethodOriginItem.class.st} | 4 ++-- ...m.class.st => GtFilterModelSideItem.class.st} | 4 ++-- ...class.st => GtFilterModelStringItem.class.st} | 16 ++++++++-------- .../GtFilterModelTraitOriginItem.class.st | 15 +++++++++++++++ .../GtFilterShortListClassSideItem.class.st | 10 ---------- .../GtFilterShortListInstanceSideItem.class.st | 15 --------------- ...lterShortListModelAbstractMethodItem.class.st | 15 --------------- ...tFilterShortListModelClassOriginItem.class.st | 10 ---------- ...ilterShortListModelDefinedMethodItem.class.st | 10 ---------- ...tFilterShortListModelTraitOriginItem.class.st | 15 --------------- src/GToolkit-Coder-UI/String.extension.st | 2 +- 20 files changed, 103 insertions(+), 101 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtFilterModelAbstractMethodItem.class.st rename src/GToolkit-Coder-UI/{GtFilterShortListModelClassItem.class.st => GtFilterModelClassItem.class.st} (62%) create mode 100644 src/GToolkit-Coder-UI/GtFilterModelClassOriginItem.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterModelClassSideItem.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterModelDefinedMethodItem.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterModelInstanceSideItem.class.st rename src/GToolkit-Coder-UI/{GtFilterShortListModelMethodDefinitionItem.class.st => GtFilterModelMethodDefinitionItem.class.st} (50%) rename src/GToolkit-Coder-UI/{GtFilterShortListModelMethodOriginItem.class.st => GtFilterModelMethodOriginItem.class.st} (55%) rename src/GToolkit-Coder-UI/{GtFilterShortListSideItem.class.st => GtFilterModelSideItem.class.st} (59%) rename src/GToolkit-Coder-UI/{GtFilterShortListModelStringItem.class.st => GtFilterModelStringItem.class.st} (64%) create mode 100644 src/GToolkit-Coder-UI/GtFilterModelTraitOriginItem.class.st delete mode 100644 src/GToolkit-Coder-UI/GtFilterShortListClassSideItem.class.st delete mode 100644 src/GToolkit-Coder-UI/GtFilterShortListInstanceSideItem.class.st delete mode 100644 src/GToolkit-Coder-UI/GtFilterShortListModelAbstractMethodItem.class.st delete mode 100644 src/GToolkit-Coder-UI/GtFilterShortListModelClassOriginItem.class.st delete mode 100644 src/GToolkit-Coder-UI/GtFilterShortListModelDefinedMethodItem.class.st delete mode 100644 src/GToolkit-Coder-UI/GtFilterShortListModelTraitOriginItem.class.st diff --git a/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st b/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st index c039a444e..ada10d949 100644 --- a/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st @@ -34,8 +34,10 @@ GtFilterModelExamples >> itemsModel [ aModel items: {self textModel. self shortListModel. - self booleanModel}. - self assert: aModel items size equals: 3. + self booleanModel. + self invariableModel. + self toggleModel.}. + self assert: aModel items size equals: 5. ^ aModel ] @@ -78,8 +80,8 @@ GtFilterModelExamples >> toggleModel [ aModel := GtFilterToggleModel new. aModel label: 'Side'. aModel - items: {GtFilterShortListInstanceSideItem new. - GtFilterShortListClassSideItem new}. + items: {GtFilterModelInstanceSideItem new. + GtFilterModelClassSideItem new}. aModel selectFirstItem. ^ aModel diff --git a/src/GToolkit-Coder-UI/Class.extension.st b/src/GToolkit-Coder-UI/Class.extension.st index e5e307e2c..95deb2c2c 100644 --- a/src/GToolkit-Coder-UI/Class.extension.st +++ b/src/GToolkit-Coder-UI/Class.extension.st @@ -2,5 +2,5 @@ Extension { #name : #Class } { #category : #'*GToolkit-Coder-UI' } Class >> asFilterModelItem [ - ^ GtFilterShortListModelClassItem new itemClass: self + ^ GtFilterModelClassItem new itemClass: self ] diff --git a/src/GToolkit-Coder-UI/GtFilterModelAbstractMethodItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelAbstractMethodItem.class.st new file mode 100644 index 000000000..7ac9c02e9 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModelAbstractMethodItem.class.st @@ -0,0 +1,15 @@ +Class { + #name : #GtFilterModelAbstractMethodItem, + #superclass : #GtFilterModelMethodDefinitionItem, + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #testing } +GtFilterModelAbstractMethodItem >> isSubclassResponsibilityMethod [ + ^ true +] + +{ #category : #accessing } +GtFilterModelAbstractMethodItem >> label [ + ^ 'abstract' +] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModelClassItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelClassItem.class.st similarity index 62% rename from src/GToolkit-Coder-UI/GtFilterShortListModelClassItem.class.st rename to src/GToolkit-Coder-UI/GtFilterModelClassItem.class.st index 57a9999e2..be1ff875e 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListModelClassItem.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelClassItem.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtFilterShortListModelClassItem, + #name : #GtFilterModelClassItem, #superclass : #GtFilterModelItem, #instVars : [ 'itemClass' @@ -8,28 +8,28 @@ Class { } { #category : #accessing } -GtFilterShortListModelClassItem >> itemClass [ +GtFilterModelClassItem >> itemClass [ ^ itemClass ] { #category : #accessing } -GtFilterShortListModelClassItem >> itemClass: anObject [ +GtFilterModelClassItem >> itemClass: anObject [ itemClass := anObject ] { #category : #accessing } -GtFilterShortListModelClassItem >> itemSymbol [ +GtFilterModelClassItem >> itemSymbol [ ^ self itemClass instanceSide name asSymbol ] { #category : #accessing } -GtFilterShortListModelClassItem >> label [ +GtFilterModelClassItem >> label [ ^ self itemClass name ] { #category : #printing } -GtFilterShortListModelClassItem >> printOn: aStream [ +GtFilterModelClassItem >> printOn: aStream [ super printOn: aStream. aStream diff --git a/src/GToolkit-Coder-UI/GtFilterModelClassOriginItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelClassOriginItem.class.st new file mode 100644 index 000000000..b25a010c0 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModelClassOriginItem.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtFilterModelClassOriginItem, + #superclass : #GtFilterModelMethodOriginItem, + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #accessing } +GtFilterModelClassOriginItem >> label [ + ^ 'non-trait' +] diff --git a/src/GToolkit-Coder-UI/GtFilterModelClassSideItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelClassSideItem.class.st new file mode 100644 index 000000000..1bffc42a5 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModelClassSideItem.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtFilterModelClassSideItem, + #superclass : #GtFilterModelSideItem, + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #accessing } +GtFilterModelClassSideItem >> label [ + ^ 'class' +] diff --git a/src/GToolkit-Coder-UI/GtFilterModelDefinedMethodItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelDefinedMethodItem.class.st new file mode 100644 index 000000000..836d16590 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModelDefinedMethodItem.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtFilterModelDefinedMethodItem, + #superclass : #GtFilterModelMethodDefinitionItem, + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #testing } +GtFilterModelDefinedMethodItem >> label [ + ^ 'defined' +] diff --git a/src/GToolkit-Coder-UI/GtFilterModelInstanceSideItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelInstanceSideItem.class.st new file mode 100644 index 000000000..0e9e926e8 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModelInstanceSideItem.class.st @@ -0,0 +1,15 @@ +Class { + #name : #GtFilterModelInstanceSideItem, + #superclass : #GtFilterModelSideItem, + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #testing } +GtFilterModelInstanceSideItem >> isInstanceSideMethod [ + ^ true +] + +{ #category : #accessing } +GtFilterModelInstanceSideItem >> label [ + ^ 'instance' +] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModelMethodDefinitionItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelMethodDefinitionItem.class.st similarity index 50% rename from src/GToolkit-Coder-UI/GtFilterShortListModelMethodDefinitionItem.class.st rename to src/GToolkit-Coder-UI/GtFilterModelMethodDefinitionItem.class.st index e09ec7bef..162628a0d 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListModelMethodDefinitionItem.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelMethodDefinitionItem.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtFilterShortListModelMethodDefinitionItem, + #name : #GtFilterModelMethodDefinitionItem, #superclass : #GtFilterModelItem, #category : #'GToolkit-Coder-UI-Filters - Models' } { #category : #testing } -GtFilterShortListModelMethodDefinitionItem >> isSubclassResponsibilityMethod [ +GtFilterModelMethodDefinitionItem >> isSubclassResponsibilityMethod [ ^ false ] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModelMethodOriginItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelMethodOriginItem.class.st similarity index 55% rename from src/GToolkit-Coder-UI/GtFilterShortListModelMethodOriginItem.class.st rename to src/GToolkit-Coder-UI/GtFilterModelMethodOriginItem.class.st index c30ecbea9..eb8f31fe7 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListModelMethodOriginItem.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelMethodOriginItem.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtFilterShortListModelMethodOriginItem, + #name : #GtFilterModelMethodOriginItem, #superclass : #GtFilterModelItem, #category : #'GToolkit-Coder-UI-Filters - Models' } { #category : #testing } -GtFilterShortListModelMethodOriginItem >> isTraitOrigin [ +GtFilterModelMethodOriginItem >> isTraitOrigin [ ^ false ] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListSideItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelSideItem.class.st similarity index 59% rename from src/GToolkit-Coder-UI/GtFilterShortListSideItem.class.st rename to src/GToolkit-Coder-UI/GtFilterModelSideItem.class.st index 357534969..0957046a4 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListSideItem.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelSideItem.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtFilterShortListSideItem, + #name : #GtFilterModelSideItem, #superclass : #GtFilterModelItem, #category : #'GToolkit-Coder-UI-Filters - Models' } { #category : #testing } -GtFilterShortListSideItem >> isInstanceSideMethod [ +GtFilterModelSideItem >> isInstanceSideMethod [ ^ false ] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModelStringItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelStringItem.class.st similarity index 64% rename from src/GToolkit-Coder-UI/GtFilterShortListModelStringItem.class.st rename to src/GToolkit-Coder-UI/GtFilterModelStringItem.class.st index 7761326bd..6b1491fce 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListModelStringItem.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelStringItem.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtFilterShortListModelStringItem, + #name : #GtFilterModelStringItem, #superclass : #GtFilterModelItem, #instVars : [ 'string' @@ -8,7 +8,7 @@ Class { } { #category : #comparing } -GtFilterShortListModelStringItem >> = anObject [ +GtFilterModelStringItem >> = anObject [ self == anObject ifTrue: [ ^ true ]. self class = anObject class ifFalse: [ ^ false ]. @@ -17,23 +17,23 @@ GtFilterShortListModelStringItem >> = anObject [ ] { #category : #comparing } -GtFilterShortListModelStringItem >> hash [ +GtFilterModelStringItem >> hash [ ^ self class hash bitXor: self string hash ] { #category : #accessing } -GtFilterShortListModelStringItem >> itemValue [ +GtFilterModelStringItem >> itemValue [ ^ self string ] { #category : #accessing } -GtFilterShortListModelStringItem >> label [ +GtFilterModelStringItem >> label [ ^ self string ] { #category : #printing } -GtFilterShortListModelStringItem >> printOn: aStream [ +GtFilterModelStringItem >> printOn: aStream [ super printOn: aStream. aStream @@ -43,11 +43,11 @@ GtFilterShortListModelStringItem >> printOn: aStream [ ] { #category : #accessing } -GtFilterShortListModelStringItem >> string [ +GtFilterModelStringItem >> string [ ^ string ] { #category : #accessing } -GtFilterShortListModelStringItem >> string: aString [ +GtFilterModelStringItem >> string: aString [ string := aString ] diff --git a/src/GToolkit-Coder-UI/GtFilterModelTraitOriginItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelTraitOriginItem.class.st new file mode 100644 index 000000000..058715bf1 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModelTraitOriginItem.class.st @@ -0,0 +1,15 @@ +Class { + #name : #GtFilterModelTraitOriginItem, + #superclass : #GtFilterModelMethodOriginItem, + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #testing } +GtFilterModelTraitOriginItem >> isTraitOrigin [ + ^ true +] + +{ #category : #accessing } +GtFilterModelTraitOriginItem >> label [ + ^ 'trait' +] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListClassSideItem.class.st b/src/GToolkit-Coder-UI/GtFilterShortListClassSideItem.class.st deleted file mode 100644 index bd947ec6b..000000000 --- a/src/GToolkit-Coder-UI/GtFilterShortListClassSideItem.class.st +++ /dev/null @@ -1,10 +0,0 @@ -Class { - #name : #GtFilterShortListClassSideItem, - #superclass : #GtFilterShortListSideItem, - #category : #'GToolkit-Coder-UI-Filters - Models' -} - -{ #category : #accessing } -GtFilterShortListClassSideItem >> label [ - ^ 'class' -] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListInstanceSideItem.class.st b/src/GToolkit-Coder-UI/GtFilterShortListInstanceSideItem.class.st deleted file mode 100644 index 05ec4d6d2..000000000 --- a/src/GToolkit-Coder-UI/GtFilterShortListInstanceSideItem.class.st +++ /dev/null @@ -1,15 +0,0 @@ -Class { - #name : #GtFilterShortListInstanceSideItem, - #superclass : #GtFilterShortListSideItem, - #category : #'GToolkit-Coder-UI-Filters - Models' -} - -{ #category : #testing } -GtFilterShortListInstanceSideItem >> isInstanceSideMethod [ - ^ true -] - -{ #category : #accessing } -GtFilterShortListInstanceSideItem >> label [ - ^ 'instance' -] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModelAbstractMethodItem.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModelAbstractMethodItem.class.st deleted file mode 100644 index 6c3df1695..000000000 --- a/src/GToolkit-Coder-UI/GtFilterShortListModelAbstractMethodItem.class.st +++ /dev/null @@ -1,15 +0,0 @@ -Class { - #name : #GtFilterShortListModelAbstractMethodItem, - #superclass : #GtFilterShortListModelMethodDefinitionItem, - #category : #'GToolkit-Coder-UI-Filters - Models' -} - -{ #category : #testing } -GtFilterShortListModelAbstractMethodItem >> isSubclassResponsibilityMethod [ - ^ true -] - -{ #category : #accessing } -GtFilterShortListModelAbstractMethodItem >> label [ - ^ 'abstract' -] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModelClassOriginItem.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModelClassOriginItem.class.st deleted file mode 100644 index 9944288bb..000000000 --- a/src/GToolkit-Coder-UI/GtFilterShortListModelClassOriginItem.class.st +++ /dev/null @@ -1,10 +0,0 @@ -Class { - #name : #GtFilterShortListModelClassOriginItem, - #superclass : #GtFilterShortListModelMethodOriginItem, - #category : #'GToolkit-Coder-UI-Filters - Models' -} - -{ #category : #accessing } -GtFilterShortListModelClassOriginItem >> label [ - ^ 'non-trait' -] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModelDefinedMethodItem.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModelDefinedMethodItem.class.st deleted file mode 100644 index 3db1e7992..000000000 --- a/src/GToolkit-Coder-UI/GtFilterShortListModelDefinedMethodItem.class.st +++ /dev/null @@ -1,10 +0,0 @@ -Class { - #name : #GtFilterShortListModelDefinedMethodItem, - #superclass : #GtFilterShortListModelMethodDefinitionItem, - #category : #'GToolkit-Coder-UI-Filters - Models' -} - -{ #category : #testing } -GtFilterShortListModelDefinedMethodItem >> label [ - ^ 'defined' -] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModelTraitOriginItem.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModelTraitOriginItem.class.st deleted file mode 100644 index a6d847b74..000000000 --- a/src/GToolkit-Coder-UI/GtFilterShortListModelTraitOriginItem.class.st +++ /dev/null @@ -1,15 +0,0 @@ -Class { - #name : #GtFilterShortListModelTraitOriginItem, - #superclass : #GtFilterShortListModelMethodOriginItem, - #category : #'GToolkit-Coder-UI-Filters - Models' -} - -{ #category : #testing } -GtFilterShortListModelTraitOriginItem >> isTraitOrigin [ - ^ true -] - -{ #category : #accessing } -GtFilterShortListModelTraitOriginItem >> label [ - ^ 'trait' -] diff --git a/src/GToolkit-Coder-UI/String.extension.st b/src/GToolkit-Coder-UI/String.extension.st index 663763bfa..c9da6ff92 100644 --- a/src/GToolkit-Coder-UI/String.extension.st +++ b/src/GToolkit-Coder-UI/String.extension.st @@ -2,5 +2,5 @@ Extension { #name : #String } { #category : #'*GToolkit-Coder-UI' } String >> asFilterModelItem [ - ^ GtFilterShortListModelStringItem new string: self + ^ GtFilterModelStringItem new string: self ] From 3d6e76b9996ce7e4d20ab71e33dc694e1caf889f Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 30 Sep 2024 13:57:11 -0300 Subject: [PATCH 0690/1268] add filter short list icon support [feenkcom/gtoolkit#3983] --- .../GtFilterModelExamples.class.st | 27 +++++++++++++++ .../GtFilterModelClassItem.class.st | 11 +++++++ .../GtFilterShortListSettingsElement.class.st | 33 +++++++++++++++---- 3 files changed, 64 insertions(+), 7 deletions(-) diff --git a/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st b/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st index ada10d949..525498a31 100644 --- a/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st @@ -61,6 +61,33 @@ GtFilterModelExamples >> shortListModel [ ^ aModel ] +{ #category : #examples } +GtFilterModelExamples >> shortListModelWithIcons [ + + | aModel | + aModel := GtFilterShortListModel new. + aModel + items: {GtFilterModelClassItem new itemClass: Array. + GtFilterModelClassItem new itemClass: OrderedCollection. + GtFilterModelClassItem new itemClass: TGtAnnouncer. + GtFilterModelClassItem new itemClass: Object. + GtFilterModelClassItem new itemClass: ProtoObject}. + aModel selectFirstItem. + aModel label: 'Classes'. + self + assert: aModel items + equals: {GtFilterModelClassItem new itemClass: Array. + GtFilterModelClassItem new itemClass: OrderedCollection. + GtFilterModelClassItem new itemClass: TGtAnnouncer. + GtFilterModelClassItem new itemClass: Object. + GtFilterModelClassItem new itemClass: ProtoObject}. + self + assert: aModel selectedItem + equals: (GtFilterModelClassItem new itemClass: Array). + + ^ aModel +] + { #category : #examples } GtFilterModelExamples >> textModel [ diff --git a/src/GToolkit-Coder-UI/GtFilterModelClassItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelClassItem.class.st index be1ff875e..6e82b9518 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelClassItem.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelClassItem.class.st @@ -7,6 +7,17 @@ Class { #category : #'GToolkit-Coder-UI-Filters - Models' } +{ #category : #accessing } +GtFilterModelClassItem >> icon [ + | anIconName | + self itemClass ifNil: [ ^ nil ]. + + anIconName := self itemClass gtSystemIconName. + anIconName ifNil: [ ^ nil ]. + + ^ self itemClass gtSafeIconNamed: anIconName +] + { #category : #accessing } GtFilterModelClassItem >> itemClass [ ^ itemClass diff --git a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st index 956515356..f0c7df711 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st @@ -10,9 +10,14 @@ Class { #category : #'GToolkit-Coder-UI-Filters - Widgets' } +{ #category : #initialization } +GtFilterShortListSettingsElement >> defaultItemIcon [ + ^ BrFrame new exact: 0 @ 0 +] + { #category : #initialization } GtFilterShortListSettingsElement >> defaultItemLabel [ - ^ 'item' + ^ '' ] { #category : #initialization } @@ -34,7 +39,8 @@ GtFilterShortListSettingsElement >> initialize [ { #category : #initialization } GtFilterShortListSettingsElement >> initializeButtonElement [ buttonElement := self newButtonElement - aptitude: BrGlamorousButtonWithLabelAndIconAptitude + aptitude: BrGlamorousButtonWithIconAndLabelAptitude; + addAptitude: BrGlamorousButtonIconDropdownAptitude ] { #category : #initialization } @@ -55,7 +61,7 @@ GtFilterShortListSettingsElement >> newButtonElement [ ^ BrButton new beSmallSize; label: self defaultItemLabel; - icon: BrGlamorousVectorIcons downwards; + icon: self defaultItemIcon; fitContent ] @@ -72,11 +78,13 @@ GtFilterShortListSettingsElement >> newContentElement [ itemStencil: [ :anItemType :aListWidget | self newItemElement ]; itemDataBinder: [ :anItemElement :anItemObject :anItemIndex | anItemElement - label: anItemObject label; + label: (anItemObject label ifNil: [ self defaultItemLabel ]); + icon: (anItemObject icon ifNil: [ self defaultItemIcon ]); model: anItemObject ]; itemDataUnbinder: [ :anItemElement :anItemObject :anItemIndex | anItemElement label: self defaultItemLabel; + icon: self defaultItemIcon; model: nil ]. self updateListElement: aListElement. @@ -94,8 +102,9 @@ GtFilterShortListSettingsElement >> newHandleElement [ aHandle := self newButtonElement disable; aptitude: BrGlamorousButtonRectangularAptitude; + addAptitude: BrGlamorousButtonIconAptitude; addAptitude: BrGlamorousButtonLabelAptitude; - addAptitude: BrGlamorousButtonIconAptitude. + addAptitude: BrGlamorousButtonIconDropdownAptitude. self updateHandleElement: aHandle. handleElement at: 1 put: aHandle. @@ -106,6 +115,7 @@ GtFilterShortListSettingsElement >> newHandleElement [ GtFilterShortListSettingsElement >> newItemElement [ ^ self newButtonElement aptitude: BrGlamorousButtonRectangularAptitude; + addAptitude: BrGlamorousButtonIconAptitude; addAptitude: BrGlamorousButtonLabelAptitude; label: 'item'; action: [ :aButton | self onItemClick: aButton ] @@ -149,7 +159,7 @@ GtFilterShortListSettingsElement >> subscribeToFilterViewModel [ { #category : #'private - updating' } GtFilterShortListSettingsElement >> updateButtonElement [ - buttonElement label: self filterViewModel selectedItem label + self updateHandleElement: buttonElement ] { #category : #'private - updating' } @@ -169,7 +179,16 @@ GtFilterShortListSettingsElement >> updateHandleElement [ GtFilterShortListSettingsElement >> updateHandleElement: anElement [ self hasFilterViewModel ifFalse: [ ^ self ]. - anElement label: self filterViewModel selectedItem label + self filterViewModel selectedItem + ifIconAndLabel: [ :anIcon :aLabel | + anElement icon: anIcon. + anElement label: aLabel ] + ifIcon: [ :anIcon | + anElement icon: anIcon. + anElement label: self defaultItemLabel ] + ifLabel: [ :aLabel | + anElement icon: self defaultItemIcon. + anElement label: aLabel ] ] { #category : #'private - updating' } From cd9f459c21996c5a9cf4cb2d7c85699468425349 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 30 Sep 2024 14:21:55 -0300 Subject: [PATCH 0691/1268] add filter toggle group icon support [feenkcom/gtoolkit#3983] --- .../GtFilterModelExamples.class.st | 14 ++++++++++++++ .../GtFilterModelClassOriginItem.class.st | 5 +++++ .../GtFilterModelTraitOriginItem.class.st | 5 +++++ 3 files changed, 24 insertions(+) diff --git a/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st b/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st index 525498a31..7cee27a92 100644 --- a/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st @@ -113,3 +113,17 @@ GtFilterModelExamples >> toggleModel [ ^ aModel ] + +{ #category : #examples } +GtFilterModelExamples >> toggleModelWithIcons [ + + | aModel | + aModel := GtFilterToggleModel new. + aModel label: 'Origin'. + aModel + items: {GtFilterModelTraitOriginItem new. + GtFilterModelClassOriginItem new}. + aModel selectFirstItem. + + ^ aModel +] diff --git a/src/GToolkit-Coder-UI/GtFilterModelClassOriginItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelClassOriginItem.class.st index b25a010c0..45197792f 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelClassOriginItem.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelClassOriginItem.class.st @@ -4,6 +4,11 @@ Class { #category : #'GToolkit-Coder-UI-Filters - Models' } +{ #category : #accessing } +GtFilterModelClassOriginItem >> icon [ + ^ self iconNamed: #class +] + { #category : #accessing } GtFilterModelClassOriginItem >> label [ ^ 'non-trait' diff --git a/src/GToolkit-Coder-UI/GtFilterModelTraitOriginItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelTraitOriginItem.class.st index 058715bf1..2f3228021 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelTraitOriginItem.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelTraitOriginItem.class.st @@ -4,6 +4,11 @@ Class { #category : #'GToolkit-Coder-UI-Filters - Models' } +{ #category : #accessing } +GtFilterModelTraitOriginItem >> icon [ + ^ self iconNamed: #trait +] + { #category : #testing } GtFilterModelTraitOriginItem >> isTraitOrigin [ ^ true From 020c0f6268e1c0b99c0cd448eeee774b36dd907d Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 30 Sep 2024 14:36:32 -0300 Subject: [PATCH 0692/1268] filter string items can have icons [feenkcom/gtoolkit#3983] --- .../GtFilterModelStringItem.class.st | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtFilterModelStringItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelStringItem.class.st index 6b1491fce..aa8928697 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelStringItem.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelStringItem.class.st @@ -2,7 +2,8 @@ Class { #name : #GtFilterModelStringItem, #superclass : #GtFilterModelItem, #instVars : [ - 'string' + 'string', + 'iconStencil' ], #category : #'GToolkit-Coder-UI-Filters - Models' } @@ -21,6 +22,17 @@ GtFilterModelStringItem >> hash [ ^ self class hash bitXor: self string hash ] +{ #category : #accessing } +GtFilterModelStringItem >> icon [ + + ^ iconStencil ifNotNil: #asElement +] + +{ #category : #accessing } +GtFilterModelStringItem >> icon: anElementStencil [ + iconStencil := anElementStencil +] + { #category : #accessing } GtFilterModelStringItem >> itemValue [ ^ self string From 2984d1a6a5b94714b15e7b585fa9a93b44fd386e Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Tue, 1 Oct 2024 16:34:59 +0200 Subject: [PATCH 0693/1268] [feenkcom/gtoolkit#4059] refactor navigation update announcements --- .../GtCoderContentElement.class.st | 2 +- ...erNavigationClassHierarchyElement.class.st | 4 +- .../GtCoderNavigationElement.class.st | 29 +++- ...igationPackagesTagsClassesElement.class.st | 159 ++++++++++++------ ...derNavigationProtocolsGroupedList.class.st | 62 ++++++- .../GtCoderNavigationClassAdded.class.st | 5 - .../GtCoderNavigationClassDeselected.class.st | 20 +++ .../GtCoderNavigationClassRemoved.class.st | 5 - ...derNavigationClassesToShowChanged.class.st | 5 + .../GtCoderNavigationCoderChanged.class.st | 5 + ...NavigationItemsToShowAnnouncement.class.st | 5 + .../GtCoderNavigationMethodSelected.class.st | 18 ++ ...derNavigationMethodsToShowChanged.class.st | 5 + ...CoderNavigationProtocolDeselected.class.st | 18 ++ ...GtCoderNavigationProtocolSelected.class.st | 18 ++ ...rNavigationProtocolsToShowChanged.class.st | 5 + .../GtCoderNavigationSlotSelected.class.st | 18 ++ 17 files changed, 307 insertions(+), 76 deletions(-) delete mode 100644 src/GToolkit-Coder/GtCoderNavigationClassAdded.class.st create mode 100644 src/GToolkit-Coder/GtCoderNavigationClassDeselected.class.st delete mode 100644 src/GToolkit-Coder/GtCoderNavigationClassRemoved.class.st create mode 100644 src/GToolkit-Coder/GtCoderNavigationClassesToShowChanged.class.st create mode 100644 src/GToolkit-Coder/GtCoderNavigationCoderChanged.class.st create mode 100644 src/GToolkit-Coder/GtCoderNavigationItemsToShowAnnouncement.class.st create mode 100644 src/GToolkit-Coder/GtCoderNavigationMethodSelected.class.st create mode 100644 src/GToolkit-Coder/GtCoderNavigationMethodsToShowChanged.class.st create mode 100644 src/GToolkit-Coder/GtCoderNavigationProtocolDeselected.class.st create mode 100644 src/GToolkit-Coder/GtCoderNavigationProtocolSelected.class.st create mode 100644 src/GToolkit-Coder/GtCoderNavigationProtocolsToShowChanged.class.st create mode 100644 src/GToolkit-Coder/GtCoderNavigationSlotSelected.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderContentElement.class.st b/src/GToolkit-Coder-UI/GtCoderContentElement.class.st index 4d1a0ada0..90f3fcddc 100644 --- a/src/GToolkit-Coder-UI/GtCoderContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderContentElement.class.st @@ -40,7 +40,7 @@ GtCoderContentElement >> onRemovedFromSceneGraph [ GtCoderContentElement >> subscribeToNavigationModel [ super subscribeToNavigationModel. self navigationModel weak - when: GtCoderNavigationSelectionAnnouncement send: #updateCoder: to: self. + when: GtCoderNavigationCoderChanged send: #updateCoder: to: self. ] { #category : #'private - event handling' } diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st index 2f5efbdba..e35939892 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st @@ -95,7 +95,7 @@ GtCoderNavigationClassHierarchyElement >> subscribeToNavigationModel [ ] { #category : #'updating lists' } -GtCoderNavigationClassHierarchyElement >> updateClassLists [ +GtCoderNavigationClassHierarchyElement >> updateClassList [ self hasNavigationModel ifFalse: [ ^ self ]. navigationModel hasSelectedClass ifTrue: [ self updateClassListsWith: navigationModel selectedClass ] @@ -109,6 +109,6 @@ GtCoderNavigationClassHierarchyElement >> updateClassListsWith: aClass [ { #category : #'updating lists' } GtCoderNavigationClassHierarchyElement >> updateContent [ - self updateClassLists. + self updateClassList. self updateSelectedClass ] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st index 8b82f73e2..57d9a466c 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st @@ -21,6 +21,11 @@ GtCoderNavigationElement >> classesList [ ^classesList ] +{ #category : #'api - class selections' } +GtCoderNavigationElement >> deselectClass: aClass [ + classesList deselectAll +] + { #category : #'api - class selections' } GtCoderNavigationElement >> deselectClasses [ classesList deselectAll @@ -78,7 +83,12 @@ GtCoderNavigationElement >> navigationModel: aGtCoderNavigationPackagesTagsClass { #category : #'event handling' } GtCoderNavigationElement >> onClassAdded: anAnnouncement [ self - suppressListChangeEventsDuring: [ self updateClassLists ] + suppressListChangeEventsDuring: [ self updateClassList ] +] + +{ #category : #'event handling' } +GtCoderNavigationElement >> onClassDeselected: anAnnouncement [ + self subclassResponsibility ] { #category : #'event handling' } @@ -140,7 +150,7 @@ GtCoderNavigationElement >> renameClass: aClass oldName: anOldName newName: aNew indexOfSuchThat: [ :aTree | aTree rootClass = aClass ] do: [ :aTree | - self updateClassLists. + self updateClassList. self updateSelectedClass ]. ] @@ -191,11 +201,12 @@ GtCoderNavigationElement >> subscribeToNavigationModel [ | subscriptions | self hasNavigationModel ifFalse: [ ^ self ]. - subscriptions := {GtCoderNavigationClassSelected -> #onClassSelected:. - GtCoderNavigationClassRenamed -> #onClassRenamed:. - GtCoderNavigationClassModified -> #onClassModified:. - GtCoderNavigationClassAdded-> #onClassAdded:. - GtCoderNavigationClassRemoved -> #onClassRemoved: }. + subscriptions := { + GtCoderNavigationClassSelected -> #onClassSelected:. + GtCoderNavigationClassDeselected -> #onClassDeselected:. + GtCoderNavigationClassRenamed -> #onClassRenamed:. + GtCoderNavigationClassModified -> #onClassModified: + }. subscriptions do: [ :sub | @@ -230,12 +241,12 @@ GtCoderNavigationElement >> updateClass: aClass inPackage: aPackage tag: aTag [ indexOfSuchThat: [ :aTree | aTree rootClass = aClass ] do: [ :aTree | - self updateClassLists. + self updateClassList. self updateSelectedClass ]. ] { #category : #'updating lists' } -GtCoderNavigationElement >> updateClassLists [ +GtCoderNavigationElement >> updateClassList [ "Update class list" ] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 214bb3296..c6c8ef76a 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -235,11 +235,6 @@ GtCoderNavigationPackagesTagsClassesElement >> deselectPackages [ packagesList deselectAll ] -{ #category : #'updating lists' } -GtCoderNavigationPackagesTagsClassesElement >> emptyMethodProtocolList [ - methodProtocolsList initializeWithProtocols: #(). -] - { #category : #'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> expandPackage: aRPackage [ packagesList viewModel root @@ -360,6 +355,12 @@ GtCoderNavigationPackagesTagsClassesElement >> methodProtocolsList [ ^ methodProtocolsList ] +{ #category : #'event handling - selection' } +GtCoderNavigationPackagesTagsClassesElement >> onClassDeselected: anAnnouncement [ + self + suppressListChangeEventsDuring: [ self deselectClass: anAnnouncement theClass ] +] + { #category : #accessing } GtCoderNavigationPackagesTagsClassesElement >> onClassRemoved: anAnnouncement [ | aPackageOrTag | @@ -369,13 +370,15 @@ GtCoderNavigationPackagesTagsClassesElement >> onClassRemoved: anAnnouncement [ self selectPackage: aPackageOrTag ] ] -{ #category : #accessing } +{ #category : #'event handling - selection' } GtCoderNavigationPackagesTagsClassesElement >> onClassSelected: anAnnouncement [ self - suppressListChangeEventsDuring: [ self - selectClass: anAnnouncement theClass - inPackage: anAnnouncement package - tag: anAnnouncement tag ] + suppressListChangeEventsDuring: [ self selectClass: anAnnouncement theClass ] +] + +{ #category : #'event handling' } +GtCoderNavigationPackagesTagsClassesElement >> onClassesToShowChanged: anAnnouncement [ + self updateClassList ] { #category : #'event handling' } @@ -389,6 +392,11 @@ GtCoderNavigationPackagesTagsClassesElement >> onMethodListSelectionChanged: aMe self navigationModel selectMethod: aMethod ] +{ #category : #'event handling - selection' } +GtCoderNavigationPackagesTagsClassesElement >> onMethodSelected: anAnnouncement [ + +] + { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onMethodsCoderFiltersChanged: aGtCodersFiltersChanged [ aGtCodersFiltersChanged source = self ifTrue: [ ^ self ]. @@ -414,6 +422,11 @@ GtCoderNavigationPackagesTagsClassesElement >> onMethodsCoderFiltersChanged: aGt self suppressListChangeEventsDuring: [ methodProtocolsList deselectAll ] ] +{ #category : #'event handling' } +GtCoderNavigationPackagesTagsClassesElement >> onMethodsToShowChanged: anAnnouncement [ + self updateMethodListWith: self navigationModel methodsToShow +] + { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageListSelectionChanged [ | anIndex aSelectedItem theIndices | @@ -447,11 +460,7 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackageRenamed: anAnnouncement { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onPackageSelected: anAnnouncer [ - self - inUIProcessDo: [ self - suppressListChangeEventsDuring: [ self selectPackage: anAnnouncer package. - self showClassList. - self deselectClasses ] ] + self inUIProcessDo: [ self suppressListChangeEventsDuring: [ self selectPackage: anAnnouncer package ] ] ] { #category : #'event handling' } @@ -475,12 +484,12 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackageTagRenamed: anAnnounceme newName: anAnnouncement newName ] ] -{ #category : #'event handling' } +{ #category : #'event handling - selection' } GtCoderNavigationPackagesTagsClassesElement >> onPackageTagSelected: anAnnouncer [ self inUIProcessDo: [ self suppressListChangeEventsDuring: [ self selectPackage: anAnnouncer package tag: anAnnouncer tag. - self deselectClasses ] ] + "self deselectClasses" ] ] ] { #category : #'event handling' } @@ -489,7 +498,7 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackageUnregistered: anAnnounce suppressListChangeEventsDuring: [ self removePackage: anAnnouncement package ] ] -{ #category : #'event handling' } +{ #category : #'event handling - selection' } GtCoderNavigationPackagesTagsClassesElement >> onPackagesSelected: anAnnouncer [ self inUIProcessDo: [ self @@ -497,6 +506,11 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackagesSelected: anAnnouncer [ self deselectClasses ] ] ] +{ #category : #'event handling - selection' } +GtCoderNavigationPackagesTagsClassesElement >> onProtocolDeselected: anAnnouncement [ + methodProtocolsList deselectProtocol: anAnnouncement protocol +] + { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onProtocolListSelectionChanged [ | aSelectedItem | @@ -504,8 +518,24 @@ GtCoderNavigationPackagesTagsClassesElement >> onProtocolListSelectionChanged [ aSelectedItem := methodProtocolsList selectedProtocol. aSelectedItem ifNil: [^self]. self navigationModel selectProtocol: aSelectedItem source: self. - methodGroupList deselectAll. - self updateMethodListWith: self navigationModel methodsToShow. + "methodGroupList deselectAll. + self updateMethodListWith: self navigationModel methodsToShow." +] + +{ #category : #'event handling - selection' } +GtCoderNavigationPackagesTagsClassesElement >> onProtocolSelected: anAnnouncement [ + methodProtocolsList selectProtocol: anAnnouncement protocol +] + +{ #category : #'event handling' } +GtCoderNavigationPackagesTagsClassesElement >> onProtocolsToShowChanged: anAnnouncement [ + self hasNavigationModel ifFalse: [ ^ self ]. + methodProtocolsList updateProtocolListWith: self navigationModel protocolsToShow +] + +{ #category : #'event handling - selection' } +GtCoderNavigationPackagesTagsClassesElement >> onSlotSelected: anAnnouncement [ + ] { #category : #initialization } @@ -704,6 +734,8 @@ GtCoderNavigationPackagesTagsClassesElement >> selectClass: aClass inPackage: aP { #category : #'api - package selections' } GtCoderNavigationPackagesTagsClassesElement >> selectPackage: aPackage [ | aPreviousIndex | + + self expandPackage: aPackage. aPreviousIndex := packagesList selectedIndice. packagesList viewModel indexOf: aPackage @@ -714,9 +746,7 @@ GtCoderNavigationPackagesTagsClassesElement >> selectPackage: aPackage [ (self scrollIndexFromPrevious: aPreviousIndex current: aNewIndex - max: packagesList viewModel itemCount) ]. - self updateClassLists. - self hideOrShowClassList + max: packagesList viewModel itemCount) ] ] { #category : #'api - package selections' } @@ -735,9 +765,7 @@ GtCoderNavigationPackagesTagsClassesElement >> selectPackage: aPackage tag: aPac scrollToIndex: (self scrollIndexFromPrevious: aPreviousIndex current: aNewIndex - max: packagesList viewModel itemCount) ]. - self updateClassLists. - self hideOrShowClassList + max: packagesList viewModel itemCount) ] ] { #category : #'api - package selections' } @@ -870,12 +898,13 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToContent [ self subscribeToSlotList. ] -{ #category : #'api - package updates' } +{ #category : #subscriptions } GtCoderNavigationPackagesTagsClassesElement >> subscribeToNavigationModel [ | subscriptions | self hasNavigationModel ifFalse: [ ^ self ]. super subscribeToNavigationModel. - subscriptions := {GtCoderNavigationPackagesSelected -> #onPackagesSelected:. + subscriptions := { + GtCoderNavigationPackagesSelected -> #onPackagesSelected:. GtCoderNavigationPackageSelected -> #onPackageSelected:. GtCoderNavigationPackageTagSelected -> #onPackageTagSelected:. GtCoderNavigationPackageRegistered -> #onPackageRegistered:. @@ -884,8 +913,20 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToNavigationModel [ GtCoderNavigationPackageTagAdded -> #onPackageTagAdded:. GtCoderNavigationPackageTagRemoved -> #onPackageTagRemoved:. GtCoderNavigationPackageTagRenamed -> #onPackageTagRenamed:. + "Announcement when items selected" + "GtCoderNavigationClassSelected -> #onClassSelected:. <--- defined in the superclass" + GtCoderNavigationProtocolSelected -> #onProtocolSelected:. + GtCoderNavigationProtocolDeselected -> #onProtocolDeselected:. + GtCoderNavigationSlotSelected -> #onSlotSelected:. + GtCoderNavigationMethodSelected -> #onMethodSelected:. + "Announcements when we need to update items in the lists" + GtCoderNavigationClassesToShowChanged -> #onClassesToShowChanged:. + GtCoderNavigationProtocolsToShowChanged -> #onProtocolsToShowChanged:. + GtCoderNavigationMethodsToShowChanged -> #onMethodsToShowChanged:. + GtCodersFiltersChanged -> #onMethodsCoderFiltersChanged:. - GtCoderNavigationMethodModification -> #onMethodChanged:}. + GtCoderNavigationMethodModification -> #onMethodChanged: + }. subscriptions do: [ :sub | navigationModel weak @@ -916,18 +957,32 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToSlotList [ ] { #category : #'updating lists' } -GtCoderNavigationPackagesTagsClassesElement >> updateClassLists [ - self hasNavigationModel ifFalse: [ ^ self ]. +GtCoderNavigationPackagesTagsClassesElement >> updateClassList [ + self hasNavigationModel + ifFalse: [ ^ self ]. + classesList initializeWithClasses: navigationModel classesToShow. - self updateProtocolList. - self updateSlotList + + navigationModel selectedClass + ifNotNil: [ :aClass | self selectClass: aClass ] ] { #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updateContent [ - self updatePackageAndClassLists. + "self updatePackageAndClassLists. self updateSelections. - self hideOrShowClassList + self hideOrShowClassList" + + self updatePackageLists. + self updateClassList. + self updateProtocolList. + self updateMethodList +] + +{ #category : #'updating lists' } +GtCoderNavigationPackagesTagsClassesElement >> updateMethodList [ + self hasNavigationModel ifFalse: [ ^ self ]. + self updateMethodListWith: self navigationModel methodsToShow ] { #category : #'updating lists' } @@ -953,21 +1008,28 @@ GtCoderNavigationPackagesTagsClassesElement >> updateMethodListWith: aCollection methodGroupList groups: methodGroup ] -{ #category : #'updating lists' } -GtCoderNavigationPackagesTagsClassesElement >> updatePackageAndClassLists [ - self updatePackageLists. - self updateClassLists. -] - { #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updatePackageLists [ - self hasNavigationModel ifFalse: [ ^ self ]. + self hasNavigationModel + ifFalse: [ ^ self ]. + packagesList initializeWithPackages: navigationModel packagesToShow. + + navigationModel selectedPackage + ifNotNil: [ :aPackage | self selectPackage: aPackage tag: navigationModel selectedTag ] ] { #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updateProtocolList [ - | currentClass extension protocolsToShow | + self hasNavigationModel + ifFalse: [ ^ self ]. + + methodProtocolsList updateProtocolListWith: self navigationModel protocolsToShow. + + self navigationModel selectedProtocol + ifNotNil: [ :aProtocol | methodProtocolsList selectProtocol: aProtocol ] + + "| currentClass extension protocolsToShow | navigationModel hasSelectedClass ifFalse: [ self updateProtocolListWith: #(). @@ -997,17 +1059,12 @@ GtCoderNavigationPackagesTagsClassesElement >> updateProtocolList [ ifFalse: [ self updateMethodListWith: self navigationModel methodsToShow. self flag: #TODO. - "self + ""self updateMethodListWith: navigationModel selectedClass methods and: (navigationModel selectedClass class methods - reject: [ :meth | meth isFromTrait ])" ]. + reject: [ :meth | meth isFromTrait ])"" ]. methodProtocolsList visibility: BlVisibility visible. - methodsLabel visibility: BlVisibility visible -] - -{ #category : #'updating lists' } -GtCoderNavigationPackagesTagsClassesElement >> updateProtocolListWith: pharoProtocols [ - methodProtocolsList updateProtocolListWith: pharoProtocols + methodsLabel visibility: BlVisibility visible" ] { #category : #'updating lists' } diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st index b1fe0d99e..8f83f5cd5 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st @@ -67,7 +67,7 @@ GtCoderNavigationProtocolsGroupedList >> createProtocolGroups [ | virtualGroup instanceGroup classGroup | virtualGroup := BrGroup new domainObject: 'virtual'; - stream: #() asAsyncStream; + items: #(); itemStencil: [ self createProtocolElement ]; itemDataBinder: [ :element :item | self bindProtocol: item toElement: element ]; shouldShowWithoutItems: false. @@ -95,6 +95,45 @@ GtCoderNavigationProtocolsGroupedList >> createProtocolListContextMenuItemsFor: -> [ :elem | self renameProtocol: aPharoProtocol name in: elem ] ] ] ] +{ #category : #'api - list' } +GtCoderNavigationProtocolsGroupedList >> deselectProtocol: aGtPharoProtocol [ + self deselectAll +] + +{ #category : #'private - selection' } +GtCoderNavigationProtocolsGroupedList >> detectProtocolIndex: aGtPharoProtocol inGroups: aCollectionOfArrayOfProtocols [ + | aSelectionIndex | + + aGtPharoProtocol ifNil: [ ^ 0 ]. + + aSelectionIndex := 0. + + aCollectionOfArrayOfProtocols detect: [ :eachGroup | + eachGroup + ifEmpty: [ false ] + ifNotEmpty: [ + | anIndexInGroup | + "add 1 for the header" + aSelectionIndex := aSelectionIndex + 1. + anIndexInGroup := eachGroup + detectIndex: [ :eachProtocol | eachProtocol = aGtPharoProtocol ] + ifNone: [ 0 ]. + + anIndexInGroup > 0 + ifTrue: [ + aSelectionIndex := aSelectionIndex + anIndexInGroup. + true ] + ifFalse: [ + aSelectionIndex := aSelectionIndex + eachGroup size. + false + ] + ]. + ] + ifNone: [ ^ 0 ]. + + ^ aSelectionIndex +] + { #category : #initialization } GtCoderNavigationProtocolsGroupedList >> initialize [ super initialize. @@ -187,6 +226,19 @@ GtCoderNavigationProtocolsGroupedList >> renameProtocol: aGtPharoProtocol in: el elem addChild: edit ] +{ #category : #'api - list' } +GtCoderNavigationProtocolsGroupedList >> selectProtocol: aGtPharoProtocol [ + | selectionIndex | + + selectionIndex := self + detectProtocolIndex: aGtPharoProtocol + inGroups: (protocolGroups collect: [ :eachGroup | eachGroup itemsProvider currentItems ]). + + selectionIndex > 0 + ifTrue: [ self selectOne: selectionIndex ] + ifFalse: [ self deselectAll ] +] + { #category : #'api - list' } GtCoderNavigationProtocolsGroupedList >> selectedProtocol [ @@ -201,8 +253,7 @@ GtCoderNavigationProtocolsGroupedList >> selectedProtocol [ { #category : #'api - list' } GtCoderNavigationProtocolsGroupedList >> updateProtocolListWith: theGtPharoProtocols [ - | virtualStream instStream classStream virtualGtPharoProtocols instanceGtPharoProtocols classGtPharoProtocols | - self deselectAll. + | virtualStream instStream classStream virtualGtPharoProtocols instanceGtPharoProtocols classGtPharoProtocols groupItems | virtualGtPharoProtocols := theGtPharoProtocols select: [ :eachPharoProtocol | eachPharoProtocol isVirtualProtocol ]. @@ -222,6 +273,11 @@ GtCoderNavigationProtocolsGroupedList >> updateProtocolListWith: theGtPharoProto classStream := classGtPharoProtocols asSortedCollection: [ :a :b | a name < b name ]. + groupItems := { + virtualStream. + instStream. + classStream}. + protocolGroups with: { virtualStream. diff --git a/src/GToolkit-Coder/GtCoderNavigationClassAdded.class.st b/src/GToolkit-Coder/GtCoderNavigationClassAdded.class.st deleted file mode 100644 index e7e56c2bf..000000000 --- a/src/GToolkit-Coder/GtCoderNavigationClassAdded.class.st +++ /dev/null @@ -1,5 +0,0 @@ -Class { - #name : #GtCoderNavigationClassAdded, - #superclass : #GtCoderNavigationClassAnnouncement, - #category : #'GToolkit-Coder-Navigation - Events' -} diff --git a/src/GToolkit-Coder/GtCoderNavigationClassDeselected.class.st b/src/GToolkit-Coder/GtCoderNavigationClassDeselected.class.st new file mode 100644 index 000000000..adf9def3b --- /dev/null +++ b/src/GToolkit-Coder/GtCoderNavigationClassDeselected.class.st @@ -0,0 +1,20 @@ +Class { + #name : #GtCoderNavigationClassDeselected, + #superclass : #GtCoderNavigationSelectionAnnouncement, + #instVars : [ + 'theClass' + ], + #category : #'GToolkit-Coder-Navigation - Events' +} + +{ #category : #accessing } +GtCoderNavigationClassDeselected >> theClass [ + + + ^ theClass +] + +{ #category : #accessing } +GtCoderNavigationClassDeselected >> theClass: anObject [ + theClass := anObject +] diff --git a/src/GToolkit-Coder/GtCoderNavigationClassRemoved.class.st b/src/GToolkit-Coder/GtCoderNavigationClassRemoved.class.st deleted file mode 100644 index d8f21e6d3..000000000 --- a/src/GToolkit-Coder/GtCoderNavigationClassRemoved.class.st +++ /dev/null @@ -1,5 +0,0 @@ -Class { - #name : #GtCoderNavigationClassRemoved, - #superclass : #GtCoderNavigationClassAnnouncement, - #category : #'GToolkit-Coder-Navigation - Events' -} diff --git a/src/GToolkit-Coder/GtCoderNavigationClassesToShowChanged.class.st b/src/GToolkit-Coder/GtCoderNavigationClassesToShowChanged.class.st new file mode 100644 index 000000000..7a64be207 --- /dev/null +++ b/src/GToolkit-Coder/GtCoderNavigationClassesToShowChanged.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtCoderNavigationClassesToShowChanged, + #superclass : #GtCoderNavigationItemsToShowAnnouncement, + #category : #'GToolkit-Coder-Navigation - Events' +} diff --git a/src/GToolkit-Coder/GtCoderNavigationCoderChanged.class.st b/src/GToolkit-Coder/GtCoderNavigationCoderChanged.class.st new file mode 100644 index 000000000..f8e9f2982 --- /dev/null +++ b/src/GToolkit-Coder/GtCoderNavigationCoderChanged.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtCoderNavigationCoderChanged, + #superclass : #GtCoderNavigationAnnouncement, + #category : #'GToolkit-Coder-Navigation - Events' +} diff --git a/src/GToolkit-Coder/GtCoderNavigationItemsToShowAnnouncement.class.st b/src/GToolkit-Coder/GtCoderNavigationItemsToShowAnnouncement.class.st new file mode 100644 index 000000000..102176509 --- /dev/null +++ b/src/GToolkit-Coder/GtCoderNavigationItemsToShowAnnouncement.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtCoderNavigationItemsToShowAnnouncement, + #superclass : #GtCoderNavigationAnnouncement, + #category : #'GToolkit-Coder-Navigation - Events' +} diff --git a/src/GToolkit-Coder/GtCoderNavigationMethodSelected.class.st b/src/GToolkit-Coder/GtCoderNavigationMethodSelected.class.st new file mode 100644 index 000000000..910944ad5 --- /dev/null +++ b/src/GToolkit-Coder/GtCoderNavigationMethodSelected.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtCoderNavigationMethodSelected, + #superclass : #GtCoderNavigationSelectionAnnouncement, + #instVars : [ + 'method' + ], + #category : #'GToolkit-Coder-Navigation - Events' +} + +{ #category : #accessing } +GtCoderNavigationMethodSelected >> method [ + ^ method +] + +{ #category : #accessing } +GtCoderNavigationMethodSelected >> method: aCompiledMethod [ + method := aCompiledMethod +] diff --git a/src/GToolkit-Coder/GtCoderNavigationMethodsToShowChanged.class.st b/src/GToolkit-Coder/GtCoderNavigationMethodsToShowChanged.class.st new file mode 100644 index 000000000..12addf985 --- /dev/null +++ b/src/GToolkit-Coder/GtCoderNavigationMethodsToShowChanged.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtCoderNavigationMethodsToShowChanged, + #superclass : #GtCoderNavigationItemsToShowAnnouncement, + #category : #'GToolkit-Coder-Navigation - Events' +} diff --git a/src/GToolkit-Coder/GtCoderNavigationProtocolDeselected.class.st b/src/GToolkit-Coder/GtCoderNavigationProtocolDeselected.class.st new file mode 100644 index 000000000..fddd72440 --- /dev/null +++ b/src/GToolkit-Coder/GtCoderNavigationProtocolDeselected.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtCoderNavigationProtocolDeselected, + #superclass : #GtCoderNavigationSelectionAnnouncement, + #instVars : [ + 'protocol' + ], + #category : #'GToolkit-Coder-Navigation - Events' +} + +{ #category : #accessing } +GtCoderNavigationProtocolDeselected >> protocol [ + ^ protocol +] + +{ #category : #accessing } +GtCoderNavigationProtocolDeselected >> protocol: anObject [ + protocol := anObject +] diff --git a/src/GToolkit-Coder/GtCoderNavigationProtocolSelected.class.st b/src/GToolkit-Coder/GtCoderNavigationProtocolSelected.class.st new file mode 100644 index 000000000..e3a90f412 --- /dev/null +++ b/src/GToolkit-Coder/GtCoderNavigationProtocolSelected.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtCoderNavigationProtocolSelected, + #superclass : #GtCoderNavigationSelectionAnnouncement, + #instVars : [ + 'protocol' + ], + #category : #'GToolkit-Coder-Navigation - Events' +} + +{ #category : #accessing } +GtCoderNavigationProtocolSelected >> protocol [ + ^ protocol +] + +{ #category : #accessing } +GtCoderNavigationProtocolSelected >> protocol: anObject [ + protocol := anObject +] diff --git a/src/GToolkit-Coder/GtCoderNavigationProtocolsToShowChanged.class.st b/src/GToolkit-Coder/GtCoderNavigationProtocolsToShowChanged.class.st new file mode 100644 index 000000000..42ee72177 --- /dev/null +++ b/src/GToolkit-Coder/GtCoderNavigationProtocolsToShowChanged.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtCoderNavigationProtocolsToShowChanged, + #superclass : #GtCoderNavigationItemsToShowAnnouncement, + #category : #'GToolkit-Coder-Navigation - Events' +} diff --git a/src/GToolkit-Coder/GtCoderNavigationSlotSelected.class.st b/src/GToolkit-Coder/GtCoderNavigationSlotSelected.class.st new file mode 100644 index 000000000..e125112f8 --- /dev/null +++ b/src/GToolkit-Coder/GtCoderNavigationSlotSelected.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtCoderNavigationSlotSelected, + #superclass : #GtCoderNavigationSelectionAnnouncement, + #instVars : [ + 'slot' + ], + #category : #'GToolkit-Coder-Navigation - Events' +} + +{ #category : #accessing } +GtCoderNavigationSlotSelected >> slot [ + ^ slot +] + +{ #category : #accessing } +GtCoderNavigationSlotSelected >> slot: anObject [ + slot := anObject +] From f4026cdd88255f6f09f572ac334c3389c52c7be1 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Tue, 1 Oct 2024 17:51:16 +0200 Subject: [PATCH 0694/1268] [feenkcom/gtoolkit#4059] simplify method modification handling in the navigation --- ...erNavigationClassHierarchyElement.class.st | 5 +++ ...igationPackagesTagsClassesElement.class.st | 6 ---- ...derNavigationProtocolsGroupedList.class.st | 35 +++++++++++++++---- ...CoderNavigationMethodModification.class.st | 20 ----------- 4 files changed, 34 insertions(+), 32 deletions(-) delete mode 100644 src/GToolkit-Coder/GtCoderNavigationMethodModification.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st index e35939892..0835f49e6 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st @@ -19,6 +19,11 @@ GtCoderNavigationClassHierarchyElement >> initializeLayout [ c vertical matchParent ]. ] +{ #category : #'event handling' } +GtCoderNavigationClassHierarchyElement >> onClassDeselected: aGtCoderNavigationClassDeselected [ + self deselectClass: aGtCoderNavigationClassDeselected theClass +] + { #category : #subscriptions } GtCoderNavigationClassHierarchyElement >> onClassModified: anAnnouncement [ self diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index c6c8ef76a..e2a3bef1b 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -381,11 +381,6 @@ GtCoderNavigationPackagesTagsClassesElement >> onClassesToShowChanged: anAnnounc self updateClassList ] -{ #category : #'event handling' } -GtCoderNavigationPackagesTagsClassesElement >> onMethodChanged: anAnnouncement [ - self updateProtocolList -] - { #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> onMethodListSelectionChanged: aMethod [ supressListChanges ifTrue: [ ^ self ]. @@ -925,7 +920,6 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToNavigationModel [ GtCoderNavigationMethodsToShowChanged -> #onMethodsToShowChanged:. GtCodersFiltersChanged -> #onMethodsCoderFiltersChanged:. - GtCoderNavigationMethodModification -> #onMethodChanged: }. subscriptions do: [ :sub | diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st index 8f83f5cd5..68745539c 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st @@ -62,6 +62,27 @@ GtCoderNavigationProtocolsGroupedList >> createProtocolElement [ addEventHandler: self createProtocolDropHandler ] +{ #category : #initialization } +GtCoderNavigationProtocolsGroupedList >> createProtocolGroupHeader [ + ^ BrHorizontalPane new + alignCenterLeft; + hMatchParent; + vFitContent; + addChild: (BrLabel new beSmallSize + padding: (BlInsets top: 2 bottom: 2); + aptitude: (BrGlamorousLabelAptitude new foreground: Color gray)); + addChild: (BrButton new + beTinySize; + aptitude: (BrGlamorousButtonRectangularAptitude paddingScale: 0) + + (BrGlamorousButtonFlatExteriorAptitude new + backgroundPaint: (Color gray alpha: 0.1)) + + BrGlamorousButtonIconAptitude + + BrGlamorousButtonWithLabelTooltipAptitude; + icon: BrGlamorousVectorIcons add; + label: 'Add new protocol'); + yourself +] + { #category : #'private - instance creation' } GtCoderNavigationProtocolsGroupedList >> createProtocolGroups [ | virtualGroup instanceGroup classGroup | @@ -137,15 +158,17 @@ GtCoderNavigationProtocolsGroupedList >> detectProtocolIndex: aGtPharoProtocol i { #category : #initialization } GtCoderNavigationProtocolsGroupedList >> initialize [ super initialize. - + self padding: (BlInsets left: 5 right: 10); matchParent; - headerElementStencil: [ BrLabel new - beSmallSize; - aptitude: (BrGlamorousLabelAptitude new foreground: Color gray) ]; - headerDataBinder: [ :label :each | label text: each domainObject asRopedText ]. - + headerElementStencil: [ self createProtocolGroupHeader ]; + headerDataBinder: [ :header :each | + each domainObject = 'virtual' + ifTrue: [ header children second visibility: BlVisibility gone ] + ifFalse: [ header children second visibility: BlVisibility visible ]. + header children first text: each domainObject asRopedText ]. + protocolGroups := self createProtocolGroups. self groups: protocolGroups ] diff --git a/src/GToolkit-Coder/GtCoderNavigationMethodModification.class.st b/src/GToolkit-Coder/GtCoderNavigationMethodModification.class.st deleted file mode 100644 index 95c9aad03..000000000 --- a/src/GToolkit-Coder/GtCoderNavigationMethodModification.class.st +++ /dev/null @@ -1,20 +0,0 @@ -Class { - #name : #GtCoderNavigationMethodModification, - #superclass : #GtCoderNavigationSystemChangesAnnouncement, - #instVars : [ - 'method' - ], - #category : #'GToolkit-Coder-Navigation - Events' -} - -{ #category : #accessing } -GtCoderNavigationMethodModification >> methodModified [ - - ^ method -] - -{ #category : #accessing } -GtCoderNavigationMethodModification >> methodModified: aMethod [ - - method := aMethod -] From d7529d57358aad267987981fc4aa0a2ee17958df Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Tue, 1 Oct 2024 21:19:10 +0200 Subject: [PATCH 0695/1268] [feenkcom/gtoolkit#4059] improve method recategorization and logic of package/tag selection --- ...erNavigationPackagesTagsClassesElement.class.st | 14 ++++++++++---- .../GtCoderNavigationProtocolsGroupedList.class.st | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index e2a3bef1b..e3909be16 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -381,7 +381,7 @@ GtCoderNavigationPackagesTagsClassesElement >> onClassesToShowChanged: anAnnounc self updateClassList ] -{ #category : #'updating lists' } +{ #category : #'event handling - selection' } GtCoderNavigationPackagesTagsClassesElement >> onMethodListSelectionChanged: aMethod [ supressListChanges ifTrue: [ ^ self ]. self navigationModel selectMethod: aMethod @@ -503,7 +503,7 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackagesSelected: anAnnouncer [ { #category : #'event handling - selection' } GtCoderNavigationPackagesTagsClassesElement >> onProtocolDeselected: anAnnouncement [ - methodProtocolsList deselectProtocol: anAnnouncement protocol + methodProtocolsList deselectProtocol ] { #category : #'event handling' } @@ -524,8 +524,14 @@ GtCoderNavigationPackagesTagsClassesElement >> onProtocolSelected: anAnnouncemen { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onProtocolsToShowChanged: anAnnouncement [ - self hasNavigationModel ifFalse: [ ^ self ]. - methodProtocolsList updateProtocolListWith: self navigationModel protocolsToShow + self hasNavigationModel + ifFalse: [ ^ self ]. + + methodProtocolsList updateProtocolListWith: self navigationModel protocolsToShow. + + self navigationModel selectedProtocol + ifNil: [ methodProtocolsList deselectProtocol ] + ifNotNil: [ :aProtocol | methodProtocolsList selectProtocol: aProtocol ] ] { #category : #'event handling - selection' } diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st index 68745539c..06188db88 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st @@ -117,7 +117,7 @@ GtCoderNavigationProtocolsGroupedList >> createProtocolListContextMenuItemsFor: ] { #category : #'api - list' } -GtCoderNavigationProtocolsGroupedList >> deselectProtocol: aGtPharoProtocol [ +GtCoderNavigationProtocolsGroupedList >> deselectProtocol [ self deselectAll ] From 803083debb58d0e58fb9e59a6e9ee54d28e78c8d Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Tue, 1 Oct 2024 22:21:02 +0200 Subject: [PATCH 0696/1268] [feenkcom/gtoolkit#4059] correctly select extending package and tag + extension protocol --- .../GtCoderNavigationPackagesTagsClassesElement.class.st | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index e3909be16..915d171d7 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -738,6 +738,8 @@ GtCoderNavigationPackagesTagsClassesElement >> selectPackage: aPackage [ self expandPackage: aPackage. aPreviousIndex := packagesList selectedIndice. + + packagesList deselectAll. packagesList viewModel indexOf: aPackage do: [ :aNewIndex | @@ -747,7 +749,7 @@ GtCoderNavigationPackagesTagsClassesElement >> selectPackage: aPackage [ (self scrollIndexFromPrevious: aPreviousIndex current: aNewIndex - max: packagesList viewModel itemCount) ] + max: packagesList viewModel itemCount) ]. ] { #category : #'api - package selections' } @@ -755,6 +757,8 @@ GtCoderNavigationPackagesTagsClassesElement >> selectPackage: aPackage tag: aPac | aPreviousIndex | (self hasPackageTagsIn: aPackage) ifFalse: [ ^ self selectPackage: aPackage ]. aPackageTag isNil ifTrue: [ ^ self selectPackage: aPackage ]. + + packagesList deselectAll. self expandPackage: aPackage. aPreviousIndex := packagesList selectedIndice. From b4ca0dca89651adcccb901598aac497ee48b9bc0 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 2 Oct 2024 19:12:17 -0300 Subject: [PATCH 0697/1268] exemplify `Methods up to` and `Category` filters [feenkcom/gtoolkit#3983] The short list and toggle filter models can compute items on demand. --- .../GtFilteredCodersModel.class.st | 9 ++- .../BlockClosure.extension.st | 6 ++ src/GToolkit-Coder-UI/Collection.extension.st | 6 ++ ...GtFilterBooleanModelSwitchChanged.class.st | 7 ++ .../GtFilterElementId.class.st | 5 ++ src/GToolkit-Coder-UI/GtFilterItemId.class.st | 10 +++ .../GtFilterItemsElement.class.st | 25 +++--- .../GtFilterItemsModel.class.st | 1 + .../GtFilterModelAnnouncement.class.st | 7 ++ .../GtFilterModelEmptyItemsBuilder.class.st | 22 ++++++ ...GtFilterModelExplicitItemsBuilder.class.st | 47 ++++++++++++ .../GtFilterModelItemsBuilder.class.st | 39 ++++++++++ .../GtFilterModelItemsChanged.class.st | 13 +++- .../GtFilterModelSelectedItemChanged.class.st | 7 ++ ...GtFilterModelValuableItemsBuilder.class.st | 35 +++++++++ src/GToolkit-Coder-UI/GtFilterNameId.class.st | 10 +++ .../GtFilterSettingsId.class.st | 2 +- .../GtFilterShortListModel.class.st | 42 ++++++---- .../GtFilterShortListSettingsElement.class.st | 19 +++-- .../GtFilterShortListViewModel.class.st | 10 ++- src/GToolkit-Coder-UI/GtFilterSignal.class.st | 5 ++ src/GToolkit-Coder-UI/GtFilterStep.class.st | 76 +++++++++++++++++++ .../GtFilterTextModelTextChanged.class.st | 7 ++ .../GtFilterToggleModel.class.st | 41 ++++++---- .../GtFilterViewModel.class.st | 5 ++ .../GtFilterViewModelItemsChanged.class.st | 13 +++- src/GToolkit-Coder-UI/GtFiltersAddId.class.st | 10 +++ .../TBlDevScripterActionStep.extension.st | 11 +++ 28 files changed, 426 insertions(+), 64 deletions(-) create mode 100644 src/GToolkit-Coder-UI/BlockClosure.extension.st create mode 100644 src/GToolkit-Coder-UI/Collection.extension.st create mode 100644 src/GToolkit-Coder-UI/GtFilterElementId.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterItemId.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterModelEmptyItemsBuilder.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterModelExplicitItemsBuilder.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterModelItemsBuilder.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterModelValuableItemsBuilder.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterNameId.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterSignal.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterStep.class.st create mode 100644 src/GToolkit-Coder-UI/GtFiltersAddId.class.st create mode 100644 src/GToolkit-Coder-UI/TBlDevScripterActionStep.extension.st diff --git a/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st b/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st index b28b1e5dc..5a7fe3040 100644 --- a/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st +++ b/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st @@ -33,8 +33,12 @@ GtFilteredCodersModel >> additionalFilters: aCollectionOfFilters [ { #category : #'api - accessing' } GtFilteredCodersModel >> compositeFilter [ - + "I am combination of: + - the main filter (see the `filter` method), and + - additional filters (see the `additionalFilters` method). + If `filter` is kind of input filter, `compositeFilter` is kind of output filter." + ^ compositeFilter ] @@ -58,8 +62,9 @@ GtFilteredCodersModel >> createCombinedFilterFor: aMainSearchFilter andAdditiona { #category : #'api - accessing' } GtFilteredCodersModel >> filter [ - + "I am a main filter whose items may be futher filtered using additional filters" + ^ filter ] diff --git a/src/GToolkit-Coder-UI/BlockClosure.extension.st b/src/GToolkit-Coder-UI/BlockClosure.extension.st new file mode 100644 index 000000000..e1f79141a --- /dev/null +++ b/src/GToolkit-Coder-UI/BlockClosure.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #BlockClosure } + +{ #category : #'*GToolkit-Coder-UI' } +BlockClosure >> asFilterModelItemsBuilder [ + ^ GtFilterModelValuableItemsBuilder new valuable: self +] diff --git a/src/GToolkit-Coder-UI/Collection.extension.st b/src/GToolkit-Coder-UI/Collection.extension.st new file mode 100644 index 000000000..76aec61f8 --- /dev/null +++ b/src/GToolkit-Coder-UI/Collection.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #Collection } + +{ #category : #'*GToolkit-Coder-UI' } +Collection >> asFilterModelItemsBuilder [ + ^ GtFilterModelExplicitItemsBuilder new items: self +] diff --git a/src/GToolkit-Coder-UI/GtFilterBooleanModelSwitchChanged.class.st b/src/GToolkit-Coder-UI/GtFilterBooleanModelSwitchChanged.class.st index 39ea7cf1c..c22d925d4 100644 --- a/src/GToolkit-Coder-UI/GtFilterBooleanModelSwitchChanged.class.st +++ b/src/GToolkit-Coder-UI/GtFilterBooleanModelSwitchChanged.class.st @@ -7,6 +7,13 @@ Class { #category : #'GToolkit-Coder-UI-Filters - Events' } +{ #category : #testing } +GtFilterBooleanModelSwitchChanged >> changesFilteredResult [ + "Indicates whether it changes a result of filtered items, e.g., list of method coders." + + ^ true +] + { #category : #testing } GtFilterBooleanModelSwitchChanged >> isOff [ ^ self switchedOn not diff --git a/src/GToolkit-Coder-UI/GtFilterElementId.class.st b/src/GToolkit-Coder-UI/GtFilterElementId.class.st new file mode 100644 index 000000000..901ae5d10 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterElementId.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtFilterElementId, + #superclass : #BlElementUniqueId, + #category : #'GToolkit-Coder-UI-Filters - Widgets' +} diff --git a/src/GToolkit-Coder-UI/GtFilterItemId.class.st b/src/GToolkit-Coder-UI/GtFilterItemId.class.st new file mode 100644 index 000000000..aa9d46dfc --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterItemId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtFilterItemId, + #superclass : #GtFilterElementId, + #category : #'GToolkit-Coder-UI-Filters - Widgets' +} + +{ #category : #converting } +GtFilterItemId >> asSymbol [ + ^ #'filter--item' +] diff --git a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st index 5cef3144f..65b5e9cb7 100644 --- a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st @@ -7,15 +7,16 @@ Class { } { #category : #'private - updating' } -GtFilterItemsElement >> addElementForFilterViewModel: aFilterViewModel [ +GtFilterItemsElement >> addElementForFilterViewModel: aFilterViewModel index: anIndex [ | anElement | - anElement := GtFilterNameElement new filterViewModel: aFilterViewModel. - anElement margin: (BlInsets left: 3 right: 3). - anElement - constraintsDo: [ :c | - c flow vertical alignCenter. - c flow horizontal alignLeft ]. - + anElement := GtFilterNameElement new + filterViewModel: aFilterViewModel; + id: (GtFilterNameId indexed: anIndex); + margin: (BlInsets left: 3 right: 3); + constraintsDo: [ :c | + c flow vertical alignCenter. + c flow horizontal alignLeft ]. + self addNavigationShortcutsTo: anElement. self addRemoveButtonIconTo: anElement. @@ -51,7 +52,7 @@ GtFilterItemsElement >> addNavigationShortcutsTo: anElement [ { #category : #'private - updating' } GtFilterItemsElement >> addNewFilterElement [ - self addChild: self newAddFilterButton as: #add + self addChild: self newAddFilterButton as: GtFiltersAddId ] { #category : #'private - updating' } @@ -84,7 +85,7 @@ GtFilterItemsElement >> createDropdownContent [ c maxHeight: 200 ]; stencil: [ :eachFilterModel :eachIndex | BrHorizontalPane new - id: (GtFilterTagPickerItemId indexed: eachIndex); + id: (GtFilterItemId indexed: eachIndex); hMatchParent; vFitContent; padding: (BlInsets all: 5); @@ -231,7 +232,7 @@ GtFilterItemsElement >> unsubscribeFromFiltersViewModel [ { #category : #'private - updating' } GtFilterItemsElement >> updateItemsElement [ self removeChildren. - self filtersViewModel items do: [ :eachFilterViewModel | - self addElementForFilterViewModel: eachFilterViewModel ]. + self filtersViewModel items withIndexDo: [ :eachFilterViewModel :anIndex | + self addElementForFilterViewModel: eachFilterViewModel index: anIndex ]. self addNewFilterElement ] diff --git a/src/GToolkit-Coder-UI/GtFilterItemsModel.class.st b/src/GToolkit-Coder-UI/GtFilterItemsModel.class.st index 126e3df6c..655b65aa3 100644 --- a/src/GToolkit-Coder-UI/GtFilterItemsModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterItemsModel.class.st @@ -69,6 +69,7 @@ GtFilterItemsModel >> notifyItemsChanged [ { #category : #'event handling' } GtFilterItemsModel >> onFilterModelAnnouncement: anAnnouncement [ + anAnnouncement changesFilteredResult ifFalse: [ ^ self ]. self notifyFiltersUpdated ] diff --git a/src/GToolkit-Coder-UI/GtFilterModelAnnouncement.class.st b/src/GToolkit-Coder-UI/GtFilterModelAnnouncement.class.st index 5a1391ff2..a0deb2b53 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelAnnouncement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelAnnouncement.class.st @@ -7,6 +7,13 @@ Class { #category : #'GToolkit-Coder-UI-Filters - Events' } +{ #category : #testing } +GtFilterModelAnnouncement >> changesFilteredResult [ + "Indicates whether it changes a result of filtered items, e.g., list of method coders." + + ^ false +] + { #category : #accessing } GtFilterModelAnnouncement >> model [ ^ model diff --git a/src/GToolkit-Coder-UI/GtFilterModelEmptyItemsBuilder.class.st b/src/GToolkit-Coder-UI/GtFilterModelEmptyItemsBuilder.class.st new file mode 100644 index 000000000..6115c08a7 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModelEmptyItemsBuilder.class.st @@ -0,0 +1,22 @@ +Class { + #name : #GtFilterModelEmptyItemsBuilder, + #superclass : #GtFilterModelItemsBuilder, + #traits : 'TGtUniqueInstance', + #classTraits : 'TGtUniqueInstance classTrait', + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #'api - instantiation' } +GtFilterModelEmptyItemsBuilder >> create [ + ^ Array empty +] + +{ #category : #accessing } +GtFilterModelEmptyItemsBuilder >> firstItemDo: aBlock [ + "do nothing" +] + +{ #category : #accessing } +GtFilterModelEmptyItemsBuilder >> lastItemDo: aBlock [ + "do nothing" +] diff --git a/src/GToolkit-Coder-UI/GtFilterModelExplicitItemsBuilder.class.st b/src/GToolkit-Coder-UI/GtFilterModelExplicitItemsBuilder.class.st new file mode 100644 index 000000000..72812b456 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModelExplicitItemsBuilder.class.st @@ -0,0 +1,47 @@ +Class { + #name : #GtFilterModelExplicitItemsBuilder, + #superclass : #GtFilterModelItemsBuilder, + #instVars : [ + 'items' + ], + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #comparing } +GtFilterModelExplicitItemsBuilder >> = anObject [ + self == anObject ifTrue: [ ^ true ]. + + ^ self class = anObject class and: [ self items = anObject items ] +] + +{ #category : #'api - instantiation' } +GtFilterModelExplicitItemsBuilder >> create [ + ^ self items ifNil: [ Array empty ] +] + +{ #category : #accessing } +GtFilterModelExplicitItemsBuilder >> firstItemDo: aBlock [ + self items ifEmpty: [ ^ self ]. + aBlock cull: self items first +] + +{ #category : #comparing } +GtFilterModelExplicitItemsBuilder >> hash [ + ^ self class hash bitXor: self items hash +] + +{ #category : #accessing } +GtFilterModelExplicitItemsBuilder >> items [ + ^ items +] + +{ #category : #accessing } +GtFilterModelExplicitItemsBuilder >> items: aCollection [ + items := aCollection collect: #asFilterModelItem +] + +{ #category : #accessing } +GtFilterModelExplicitItemsBuilder >> lastItemDo: aBlock [ + self items ifEmpty: [ ^ self ]. + aBlock cull: self items last +] diff --git a/src/GToolkit-Coder-UI/GtFilterModelItemsBuilder.class.st b/src/GToolkit-Coder-UI/GtFilterModelItemsBuilder.class.st new file mode 100644 index 000000000..7d70b4c5c --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModelItemsBuilder.class.st @@ -0,0 +1,39 @@ +Class { + #name : #GtFilterModelItemsBuilder, + #superclass : #Object, + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #converting } +GtFilterModelItemsBuilder >> asFilterModelItemsBuilder [ + ^ self +] + +{ #category : #'api - instantiation' } +GtFilterModelItemsBuilder >> create [ + + ^ self subclassResponsibility +] + +{ #category : #initialization } +GtFilterModelItemsBuilder >> filterModel: aFilterModel [ + "Subclasses may use it to trigger item updates or other activities" + + +] + +{ #category : #accessing } +GtFilterModelItemsBuilder >> firstItemDo: aBlock [ + | aCollection | + aCollection := self create. + aCollection ifEmpty: [ ^ self ]. + aBlock cull: aCollection first +] + +{ #category : #accessing } +GtFilterModelItemsBuilder >> lastItemDo: aBlock [ + | aCollection | + aCollection := self create. + aCollection ifEmpty: [ ^ self ]. + aBlock cull: aCollection last +] diff --git a/src/GToolkit-Coder-UI/GtFilterModelItemsChanged.class.st b/src/GToolkit-Coder-UI/GtFilterModelItemsChanged.class.st index 5b7a4f80d..b90fb690b 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelItemsChanged.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelItemsChanged.class.st @@ -2,17 +2,22 @@ Class { #name : #GtFilterModelItemsChanged, #superclass : #GtFilterModelAnnouncement, #instVars : [ - 'items' + 'itemsBuilder' ], #category : #'GToolkit-Coder-UI-Filters - Events' } { #category : #accessing } GtFilterModelItemsChanged >> items [ - ^ items + ^ itemsBuilder create ] { #category : #accessing } -GtFilterModelItemsChanged >> items: anObject [ - items := anObject +GtFilterModelItemsChanged >> itemsBuilder [ + ^ itemsBuilder +] + +{ #category : #accessing } +GtFilterModelItemsChanged >> itemsBuilder: aBuilder [ + itemsBuilder := aBuilder ] diff --git a/src/GToolkit-Coder-UI/GtFilterModelSelectedItemChanged.class.st b/src/GToolkit-Coder-UI/GtFilterModelSelectedItemChanged.class.st index 944b73b1d..8b7073c12 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelSelectedItemChanged.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelSelectedItemChanged.class.st @@ -7,6 +7,13 @@ Class { #category : #'GToolkit-Coder-UI-Filters - Events' } +{ #category : #testing } +GtFilterModelSelectedItemChanged >> changesFilteredResult [ + "Indicates whether it changes a result of filtered items, e.g., list of method coders." + + ^ true +] + { #category : #accessing } GtFilterModelSelectedItemChanged >> selectedItem [ ^ selectedItem diff --git a/src/GToolkit-Coder-UI/GtFilterModelValuableItemsBuilder.class.st b/src/GToolkit-Coder-UI/GtFilterModelValuableItemsBuilder.class.st new file mode 100644 index 000000000..4300a1572 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModelValuableItemsBuilder.class.st @@ -0,0 +1,35 @@ +Class { + #name : #GtFilterModelValuableItemsBuilder, + #superclass : #GtFilterModelItemsBuilder, + #instVars : [ + 'valuable' + ], + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #comparing } +GtFilterModelValuableItemsBuilder >> = anObject [ + self == anObject ifTrue: [ ^ true ]. + + ^ self class = anObject class and: [ self valuable = anObject valuable ] +] + +{ #category : #'api - instantiation' } +GtFilterModelValuableItemsBuilder >> create [ + ^ self valuable value collect: #asFilterModelItem +] + +{ #category : #comparing } +GtFilterModelValuableItemsBuilder >> hash [ + ^ self class hash bitXor: self valuable hash +] + +{ #category : #accessing } +GtFilterModelValuableItemsBuilder >> valuable [ + ^ valuable +] + +{ #category : #accessing } +GtFilterModelValuableItemsBuilder >> valuable: aValuable [ + valuable := aValuable +] diff --git a/src/GToolkit-Coder-UI/GtFilterNameId.class.st b/src/GToolkit-Coder-UI/GtFilterNameId.class.st new file mode 100644 index 000000000..489d206ef --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterNameId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtFilterNameId, + #superclass : #GtFilterElementId, + #category : #'GToolkit-Coder-UI-Filters - Widgets' +} + +{ #category : #converting } +GtFilterNameId >> asSymbol [ + ^ #'filter--name' +] diff --git a/src/GToolkit-Coder-UI/GtFilterSettingsId.class.st b/src/GToolkit-Coder-UI/GtFilterSettingsId.class.st index 4726208ac..cde60b544 100644 --- a/src/GToolkit-Coder-UI/GtFilterSettingsId.class.st +++ b/src/GToolkit-Coder-UI/GtFilterSettingsId.class.st @@ -1,6 +1,6 @@ Class { #name : #GtFilterSettingsId, - #superclass : #BlElementUniqueId, + #superclass : #GtFilterElementId, #category : #'GToolkit-Coder-UI-Filters - Widgets' } diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st index e0c8c7b83..64ee13f83 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st @@ -2,8 +2,8 @@ Class { #name : #GtFilterShortListModel, #superclass : #GtFilterModel, #instVars : [ - 'items', - 'selectedItem' + 'selectedItem', + 'itemsBuilder' ], #category : #'GToolkit-Coder-UI-Filters - Models' } @@ -16,23 +16,35 @@ GtFilterShortListModel >> filterViewModelClass [ { #category : #initialization } GtFilterShortListModel >> initialize [ super initialize. - items := #() + itemsBuilder := GtFilterModelEmptyItemsBuilder default. ] { #category : #accessing } GtFilterShortListModel >> items [ - - ^ items + + ^ itemsBuilder create ] { #category : #accessing } -GtFilterShortListModel >> items: aCollection [ - | aNewCollection | - aNewCollection := aCollection collect: #asFilterModelItem. - self items = aNewCollection ifTrue: [ ^ self ]. +GtFilterShortListModel >> items: anObject [ + self itemsBuilder: anObject +] + +{ #category : #accessing } +GtFilterShortListModel >> itemsBuilder [ + + ^ itemsBuilder +] + +{ #category : #accessing } +GtFilterShortListModel >> itemsBuilder: anObject [ + | aNewItemsBuilder | + aNewItemsBuilder := anObject asFilterModelItemsBuilder. + self itemsBuilder = aNewItemsBuilder ifTrue: [ ^ self ]. + itemsBuilder := aNewItemsBuilder. + aNewItemsBuilder filterModel: self. - items := aNewCollection. - self notifyItemsChanged. + self notifyItemsChanged ] { #category : #'private - notifying' } @@ -40,7 +52,7 @@ GtFilterShortListModel >> notifyItemsChanged [ self announce: (GtFilterModelItemsChanged new model: self; - items: self items) + itemsBuilder: self itemsBuilder) ] { #category : #'private - notifying' } @@ -53,14 +65,12 @@ GtFilterShortListModel >> notifySelectedItemChanged [ { #category : #initialization } GtFilterShortListModel >> selectFirstItem [ - self items ifEmpty: [ ^ self ]. - self selectedItem: self items first + self itemsBuilder firstItemDo: [ :anItem | self selectedItem: anItem ] ] { #category : #initialization } GtFilterShortListModel >> selectLastItem [ - self items ifEmpty: [ ^ self ]. - self selectedItem: self items last + self itemsBuilder lastItemDo: [ :anItem | self selectedItem: anItem ] ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st index f0c7df711..09878ca36 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st @@ -80,11 +80,13 @@ GtFilterShortListSettingsElement >> newContentElement [ anItemElement label: (anItemObject label ifNil: [ self defaultItemLabel ]); icon: (anItemObject icon ifNil: [ self defaultItemIcon ]); + id: (GtFilterItemId indexed: anItemIndex); model: anItemObject ]; itemDataUnbinder: [ :anItemElement :anItemObject :anItemIndex | anItemElement label: self defaultItemLabel; icon: self defaultItemIcon; + id: nil; model: nil ]. self updateListElement: aListElement. @@ -193,12 +195,17 @@ GtFilterShortListSettingsElement >> updateHandleElement: anElement [ { #category : #'private - updating' } GtFilterShortListSettingsElement >> updateListElement [ - | aHeight aWidth | - aHeight := self filterViewModel itemsCount * 12. - aWidth := (self filterViewModel items detectMax: #labelSize) - ifNotNil: [ :anItem | anItem labelSize * 12 ] - ifNil: [ 30 ]. - buttonAptitude preferredExtent: aHeight @ aWidth. + | aHeight aWidth anExtent | + aHeight := self filterViewModel items size. + aWidth := self filterViewModel items + inject: 3 + into: [ :aMax :each | + aMax > each labelSize + ifTrue: [ aMax ] + ifFalse: [ each labelSize ] ]. + anExtent := (aWidth * 12) @ (aHeight * 12). + + buttonAptitude preferredExtent: anExtent. self listElementDo: [ :anElement | self updateListElement: anElement ] ] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListViewModel.class.st b/src/GToolkit-Coder-UI/GtFilterShortListViewModel.class.st index 9f3c039f8..ec5a8c6b8 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListViewModel.class.st @@ -11,6 +11,7 @@ GtFilterShortListViewModel >> filterElementClass [ { #category : #accessing } GtFilterShortListViewModel >> items [ + ^ self filterModel items ] @@ -21,14 +22,14 @@ GtFilterShortListViewModel >> items: aCollection [ { #category : #accessing } GtFilterShortListViewModel >> itemsCount [ + ^ self filterModel items size ] { #category : #accessing } GtFilterShortListViewModel >> itemsWithoutSelection [ - | aSelectedItem | - aSelectedItem := self selectedItem. - ^ self filterModel items reject: [ :each | aSelectedItem = each ] + + ^ self filterModel items select: [ :each | self selectedItem ~= each ] ] { #category : #'event handling' } @@ -36,7 +37,7 @@ GtFilterShortListViewModel >> onItemsChanged: anAnnouncement [ self announce: (GtFilterViewModelItemsChanged new viewModel: self; - items: anAnnouncement items) + itemsBuilder: anAnnouncement itemsBuilder) ] { #category : #'api - filter model' } @@ -49,6 +50,7 @@ GtFilterShortListViewModel >> onSelectedItemChanged: anAnnouncement [ { #category : #accessing } GtFilterShortListViewModel >> selectedItem [ + ^ self filterModel selectedItem ] diff --git a/src/GToolkit-Coder-UI/GtFilterSignal.class.st b/src/GToolkit-Coder-UI/GtFilterSignal.class.st new file mode 100644 index 000000000..e35e81b0f --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterSignal.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtFilterSignal, + #superclass : #ContextStackSignal, + #category : #'GToolkit-Coder-UI-Filters - Events' +} diff --git a/src/GToolkit-Coder-UI/GtFilterStep.class.st b/src/GToolkit-Coder-UI/GtFilterStep.class.st new file mode 100644 index 000000000..a6bccf661 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterStep.class.st @@ -0,0 +1,76 @@ +Class { + #name : #GtFilterStep, + #superclass : #BlDevScripterToolActionStep, + #category : #'GToolkit-Coder-UI-Filters - Widgets' +} + +{ #category : #'steps - checks' } +GtFilterStep >> assertFilterModelAtIndex: anIndex itemsCountIs: anItemsCount [ + ^ self assert + label: ('Assert filter model no. {1} has {2} {3}' + format: {anIndex. + anItemsCount. + 'item' asPluralBasedOn: anItemsCount}); + referenceSender; + onParentStepTarget: self; + value: [ :aFilterItemsElement | (aFilterItemsElement filtersViewModel items at: anIndex) items size ] + equals: anItemsCount +] + +{ #category : #'steps - checks' } +GtFilterStep >> assertFilterModelAtIndex: anIndex itemsCountIsAtLeast: anItemsCount [ + ^ self assert + label: ('Assert filter model no. {1} has at least {2} {3}' + format: {anIndex. + anItemsCount. + 'item' asPluralBasedOn: anItemsCount}); + referenceSender; + onParentStepTarget: self; + satisfies: [ :aFilterItemsElement | + (aFilterItemsElement filtersViewModel items at: anIndex) items size + >= anItemsCount ] + description: [ :aFilterItemsElement | + 'Filter at position {1} must have at least {2} {3}, but have {4}' + format: {anIndex. + anItemsCount. + 'item' asPluralBasedOn: anItemsCount. + (aFilterItemsElement filtersViewModel items at: anIndex) items size} ] +] + +{ #category : #'steps - checks' } +GtFilterStep >> assertFilterModelAtIndex: anIndex selectedValueIs: aValue [ + ^ self assert + label: ('Assert filter model no. {1} has selected item: {2}' + format: {anIndex. + aValue}); + referenceSender; + onParentStepTarget: self; + value: [ :aFilterItemsElement | (aFilterItemsElement filtersViewModel items at: anIndex) selectedValue ] + equals: aValue +] + +{ #category : #'steps - interactions' } +GtFilterStep >> clickOnAddFilter [ + ^ self click + referenceSender; + // GtFiltersAddId +] + +{ #category : #'steps - interactions' } +GtFilterStep >> clickOnDropdownFilterItemAtIndex: anIndex [ + ^ self click + label: ('Click on dropdown item at index {1}' format: { anIndex }); + referenceSender; + onSpaceRoot; + // BrAnchoredOuterContainer; + // (GtFilterItemId indexed: anIndex) +] + +{ #category : #'steps - interactions' } +GtFilterStep >> clickOnFilterSettingsAtIndex: anIndex [ + ^ self click + label: ('Click on filter settings at index {1}' format: { anIndex }); + referenceSender; + // (GtFilterNameId indexed: anIndex); + // GtFilterSettingsId +] diff --git a/src/GToolkit-Coder-UI/GtFilterTextModelTextChanged.class.st b/src/GToolkit-Coder-UI/GtFilterTextModelTextChanged.class.st index cbc31186c..c32599d38 100644 --- a/src/GToolkit-Coder-UI/GtFilterTextModelTextChanged.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTextModelTextChanged.class.st @@ -7,6 +7,13 @@ Class { #category : #'GToolkit-Coder-UI-Filters - Events' } +{ #category : #testing } +GtFilterTextModelTextChanged >> changesFilteredResult [ + "Indicates whether it changes a result of filtered items, e.g., list of method coders." + + ^ true +] + { #category : #accessing } GtFilterTextModelTextChanged >> text [ ^ text diff --git a/src/GToolkit-Coder-UI/GtFilterToggleModel.class.st b/src/GToolkit-Coder-UI/GtFilterToggleModel.class.st index bc33ea128..af5f0bc1d 100644 --- a/src/GToolkit-Coder-UI/GtFilterToggleModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterToggleModel.class.st @@ -3,7 +3,8 @@ Class { #superclass : #GtFilterModel, #instVars : [ 'items', - 'selectedItem' + 'selectedItem', + 'itemsBuilder' ], #category : #'GToolkit-Coder-UI-Filters - Models' } @@ -17,23 +18,35 @@ GtFilterToggleModel >> filterViewModelClass [ { #category : #initialization } GtFilterToggleModel >> initialize [ super initialize. - items := #() + itemsBuilder := GtFilterModelEmptyItemsBuilder default. ] { #category : #accessing } GtFilterToggleModel >> items [ - - ^ items + + ^ itemsBuilder create ] { #category : #accessing } -GtFilterToggleModel >> items: aCollection [ - | aNewCollection | - aNewCollection := aCollection collect: #asFilterModelItem. - self items = aNewCollection ifTrue: [ ^ self ]. +GtFilterToggleModel >> items: anObject [ + self itemsBuilder: anObject +] + +{ #category : #accessing } +GtFilterToggleModel >> itemsBuilder [ + + ^ itemsBuilder +] + +{ #category : #accessing } +GtFilterToggleModel >> itemsBuilder: anObject [ + | aNewItemsBuilder | + aNewItemsBuilder := anObject asFilterModelItemsBuilder. + self itemsBuilder = aNewItemsBuilder ifTrue: [ ^ self ]. + itemsBuilder := aNewItemsBuilder. + aNewItemsBuilder filterModel: self. - items := aNewCollection. - self notifyItemsChanged. + self notifyItemsChanged ] { #category : #'private - notifying' } @@ -41,7 +54,7 @@ GtFilterToggleModel >> notifyItemsChanged [ self announce: (GtFilterModelItemsChanged new model: self; - items: self items) + itemsBuilder: self itemsBuilder) ] { #category : #'private - notifying' } @@ -54,14 +67,12 @@ GtFilterToggleModel >> notifySelectedItemChanged [ { #category : #initialization } GtFilterToggleModel >> selectFirstItem [ - self items ifEmpty: [ ^ self ]. - self selectedItem: self items first + self itemsBuilder firstItemDo: [ :anItem | self selectedItem: anItem ] ] { #category : #initialization } GtFilterToggleModel >> selectLastItem [ - self items ifEmpty: [ ^ self ]. - self selectedItem: self items last + self itemsBuilder lastItemDo: [ :anItem | self selectedItem: anItem ] ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtFilterViewModel.class.st b/src/GToolkit-Coder-UI/GtFilterViewModel.class.st index dc744bff8..91f1c9fd5 100644 --- a/src/GToolkit-Coder-UI/GtFilterViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterViewModel.class.st @@ -41,6 +41,11 @@ GtFilterViewModel >> onLabelChanged: anAnnouncement [ label: anAnnouncement label) ] +{ #category : #accessing } +GtFilterViewModel >> selectedValue [ + ^ self filterModel selectedValue +] + { #category : #'api - filter model' } GtFilterViewModel >> subscribeToFilterModel [ self filterModel weak diff --git a/src/GToolkit-Coder-UI/GtFilterViewModelItemsChanged.class.st b/src/GToolkit-Coder-UI/GtFilterViewModelItemsChanged.class.st index 21c97fc62..9dee42b41 100644 --- a/src/GToolkit-Coder-UI/GtFilterViewModelItemsChanged.class.st +++ b/src/GToolkit-Coder-UI/GtFilterViewModelItemsChanged.class.st @@ -2,17 +2,22 @@ Class { #name : #GtFilterViewModelItemsChanged, #superclass : #GtFilterViewModelAnnouncement, #instVars : [ - 'items' + 'itemsBuilder' ], #category : #'GToolkit-Coder-UI-Filters - Events' } { #category : #accessing } GtFilterViewModelItemsChanged >> items [ - ^ items + ^ itemsBuilder create ] { #category : #accessing } -GtFilterViewModelItemsChanged >> items: anObject [ - items := anObject +GtFilterViewModelItemsChanged >> itemsBuilder [ + ^ itemsBuilder +] + +{ #category : #accessing } +GtFilterViewModelItemsChanged >> itemsBuilder: aBuilder [ + itemsBuilder := aBuilder ] diff --git a/src/GToolkit-Coder-UI/GtFiltersAddId.class.st b/src/GToolkit-Coder-UI/GtFiltersAddId.class.st new file mode 100644 index 000000000..08e395983 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFiltersAddId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtFiltersAddId, + #superclass : #GtFilterElementId, + #category : #'GToolkit-Coder-UI-Filters - Widgets' +} + +{ #category : #converting } +GtFiltersAddId >> asSymbol [ + ^ #'filter--add' +] diff --git a/src/GToolkit-Coder-UI/TBlDevScripterActionStep.extension.st b/src/GToolkit-Coder-UI/TBlDevScripterActionStep.extension.st new file mode 100644 index 000000000..c1e820772 --- /dev/null +++ b/src/GToolkit-Coder-UI/TBlDevScripterActionStep.extension.st @@ -0,0 +1,11 @@ +Extension { #name : #TBlDevScripterActionStep } + +{ #category : #'*GToolkit-Coder-UI' } +TBlDevScripterActionStep >> filterStep [ + ^ self + addStep: (GtFilterStep new + label: 'Filter'; + referenceSender; + onParentStepTarget: self; + onThisOrBreadthFirstChildOfKind: GtFilterItemsElement) +] From 54f1c35aa707d66468b986a79f6859795ae9f32b Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 4 Oct 2024 17:26:15 -0300 Subject: [PATCH 0698/1268] Properly construct filter view models [feenkcom/gtoolkit#3983] --- src/GToolkit-Coder-UI/GtFilterItemsModel.class.st | 15 +++++++++++++++ src/GToolkit-Coder-UI/GtFilterModel.class.st | 2 ++ .../GtFilterModelClassItem.class.st | 5 +++++ src/GToolkit-Coder-UI/GtFiltersViewModel.class.st | 2 +- 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtFilterItemsModel.class.st b/src/GToolkit-Coder-UI/GtFilterItemsModel.class.st index 655b65aa3..1ab7c044e 100644 --- a/src/GToolkit-Coder-UI/GtFilterItemsModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterItemsModel.class.st @@ -48,6 +48,7 @@ GtFilterItemsModel >> items [ GtFilterItemsModel >> items: aCollection [ self items = aCollection ifTrue: [ ^ self ]. + self unsubscribeFromItems. items := aCollection. self subscribeToItems. self notifyItemsChanged. @@ -69,12 +70,15 @@ GtFilterItemsModel >> notifyItemsChanged [ { #category : #'event handling' } GtFilterItemsModel >> onFilterModelAnnouncement: anAnnouncement [ + self assert: [ (self items identityIncludes: anAnnouncement model) ]. + anAnnouncement changesFilteredResult ifFalse: [ ^ self ]. self notifyFiltersUpdated ] { #category : #'add / remove' } GtFilterItemsModel >> removeFilterModel: aFilterModel [ + self unsubscribeFromItem: aFilterModel. self items: (self items copyWithout: aFilterModel) ] @@ -93,3 +97,14 @@ GtFilterItemsModel >> subscribeToItems [ self items do: [ :eachItem | self subscribeToItem: eachItem ] ] + +{ #category : #private } +GtFilterItemsModel >> unsubscribeFromItem: aFilterModel [ + aFilterModel unsubscribe: self +] + +{ #category : #private } +GtFilterItemsModel >> unsubscribeFromItems [ + self items do: [ :eachItem | + self unsubscribeFromItem: eachItem ] +] diff --git a/src/GToolkit-Coder-UI/GtFilterModel.class.st b/src/GToolkit-Coder-UI/GtFilterModel.class.st index 5c7937399..ce27b257c 100644 --- a/src/GToolkit-Coder-UI/GtFilterModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModel.class.st @@ -133,6 +133,8 @@ GtFilterModel >> printOn: aStream [ aStream nextPut: $(; nextPutAll: self label asString; + nextPutAll: ': '; + print: (self selectedValue ifNotNil: #itemValue); nextPutAll: ', order: '; print: self order; nextPut: $) diff --git a/src/GToolkit-Coder-UI/GtFilterModelClassItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelClassItem.class.st index 6e82b9518..a218ab401 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelClassItem.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelClassItem.class.st @@ -33,6 +33,11 @@ GtFilterModelClassItem >> itemSymbol [ ^ self itemClass instanceSide name asSymbol ] +{ #category : #accessing } +GtFilterModelClassItem >> itemValue [ + ^ self itemClass +] + { #category : #accessing } GtFilterModelClassItem >> label [ diff --git a/src/GToolkit-Coder-UI/GtFiltersViewModel.class.st b/src/GToolkit-Coder-UI/GtFiltersViewModel.class.st index 8902296d6..a42d5a9f5 100644 --- a/src/GToolkit-Coder-UI/GtFiltersViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtFiltersViewModel.class.st @@ -57,7 +57,7 @@ GtFiltersViewModel >> filtersElementClass [ { #category : #initialization } GtFiltersViewModel >> initialize [ super initialize. - filterViewModels := Dictionary new + filterViewModels := IdentityDictionary new ] { #category : #'add / remove' } From f632f24def6f45ac0e1851a85457c4863ff57ca5 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Sun, 6 Oct 2024 12:54:46 +0200 Subject: [PATCH 0699/1268] extract protocol add button to a separate method --- ...derNavigationProtocolsGroupedList.class.st | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st index 06188db88..49b8a9e41 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st @@ -25,6 +25,25 @@ GtCoderNavigationProtocolsGroupedList >> bindProtocol: item toElement: element [ ^ element text: itemText ] +{ #category : #initialization } +GtCoderNavigationProtocolsGroupedList >> createAddProtocolButton [ + | aPopUp | + + aPopUp := BrGlamorousWithDropdownAptitude + content: [ :aButton | + + ]. + + ^ BrButton new + beTinySize; + aptitude: (BrGlamorousButtonRectangularAptitude paddingScale: 0) + + (BrGlamorousButtonFlatExteriorAptitude new + backgroundPaint: (Color gray alpha: 0.1)) + BrGlamorousButtonIconAptitude + + BrGlamorousButtonWithLabelTooltipAptitude; + icon: BrGlamorousVectorIcons add; + label: 'Add new protocol' +] + { #category : #'private - instance creation' } GtCoderNavigationProtocolsGroupedList >> createProtocolDropHandler [ ^ BlDropHandler new @@ -71,15 +90,7 @@ GtCoderNavigationProtocolsGroupedList >> createProtocolGroupHeader [ addChild: (BrLabel new beSmallSize padding: (BlInsets top: 2 bottom: 2); aptitude: (BrGlamorousLabelAptitude new foreground: Color gray)); - addChild: (BrButton new - beTinySize; - aptitude: (BrGlamorousButtonRectangularAptitude paddingScale: 0) - + (BrGlamorousButtonFlatExteriorAptitude new - backgroundPaint: (Color gray alpha: 0.1)) - + BrGlamorousButtonIconAptitude - + BrGlamorousButtonWithLabelTooltipAptitude; - icon: BrGlamorousVectorIcons add; - label: 'Add new protocol'); + addChild: self createAddProtocolButton; yourself ] From 2d6f4281c1cdc345073d14ea423f3d3be4374a21 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Sun, 6 Oct 2024 21:50:23 +0200 Subject: [PATCH 0700/1268] add a new protocol form --- ...igationPackagesTagsClassesElement.class.st | 5 +- ...derNavigationProtocolsGroupedList.class.st | 123 ++++++++++++++++-- 2 files changed, 110 insertions(+), 18 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 915d171d7..729ac8976 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -973,10 +973,6 @@ GtCoderNavigationPackagesTagsClassesElement >> updateClassList [ { #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updateContent [ - "self updatePackageAndClassLists. - self updateSelections. - self hideOrShowClassList" - self updatePackageLists. self updateClassList. self updateProtocolList. @@ -1028,6 +1024,7 @@ GtCoderNavigationPackagesTagsClassesElement >> updateProtocolList [ self hasNavigationModel ifFalse: [ ^ self ]. + methodProtocolsList navigationModel: self navigationModel. methodProtocolsList updateProtocolListWith: self navigationModel protocolsToShow. self navigationModel selectedProtocol diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st index 49b8a9e41..a9ccc5f25 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st @@ -9,11 +9,31 @@ Class { #traits : 'TGtCoderNavigationWithContextMenu', #classTraits : 'TGtCoderNavigationWithContextMenu classTrait', #instVars : [ - 'protocolGroups' + 'protocolGroups', + 'navigationModel' ], #category : #'GToolkit-Coder-UI-Navigation' } +{ #category : #'private - refactorings' } +GtCoderNavigationProtocolsGroupedList >> addProtocolFrom: aProtocolEditor [ + self navigationModel + selectedClassDo: [ :aClass | self addProtocolNamed: aProtocolEditor text asString trimmed in: aClass ]. + + ^ aProtocolEditor fireEvent: BrDropdownHideWish new +] + +{ #category : #'private - refactorings' } +GtCoderNavigationProtocolsGroupedList >> addProtocolNamed: aProtocolName in: aClass [ + | refactoring | + + refactoring := RBAddProtocolChange + addProtocolNamed: aProtocolName + in: aClass. + + refactoring execute +] + { #category : #'private - instance creation' } GtCoderNavigationProtocolsGroupedList >> bindProtocol: item toElement: element [ | itemText | @@ -27,23 +47,88 @@ GtCoderNavigationProtocolsGroupedList >> bindProtocol: item toElement: element [ { #category : #initialization } GtCoderNavigationProtocolsGroupedList >> createAddProtocolButton [ - | aPopUp | - + | aButtonStencil aPopUp | + aButtonStencil := [ + BrButton new + beTinySize; + aptitude: (BrGlamorousButtonRectangularAptitude paddingScale: 0) + BrGlamorousButtonIconAptitude; + icon: BrGlamorousVectorIcons add ] asStencil. + aPopUp := BrGlamorousWithDropdownAptitude - content: [ :aButton | - - ]. - - ^ BrButton new - beTinySize; - aptitude: (BrGlamorousButtonRectangularAptitude paddingScale: 0) - + (BrGlamorousButtonFlatExteriorAptitude new - backgroundPaint: (Color gray alpha: 0.1)) + BrGlamorousButtonIconAptitude - + BrGlamorousButtonWithLabelTooltipAptitude; - icon: BrGlamorousVectorIcons add; + handle: aButtonStencil + content: [ :aButton | self createNewProtocolForm ]. + + ^ aButtonStencil asElement + addAptitude: (BrGlamorousButtonFlatExteriorAptitude new + backgroundPaint: (Color gray alpha: 0.1)); + addAptitude: BrGlamorousButtonWithLabelTooltipAptitude; + addAptitude: aPopUp; label: 'Add new protocol' ] +{ #category : #initialization } +GtCoderNavigationProtocolsGroupedList >> createNewProtocolForm [ + | aContainer aProtocolEditor aDefaultText aProtocolCompleter anAcceptButton | + aDefaultText := '' asRopedText + attribute: (BrGhostTextAttribute + for: ('new protocol name' asRopedText glamorousFormEditorCodeFontAndSize + foreground: Color lightGray)). + + aContainer := BrHorizontalPane new + padding: (BlInsets + top: 6 + right: 2 + bottom: 6 + left: 2); + cellSpacing: 6; + alignCenterLeft; + fitContent. + + aProtocolEditor := BrEditor new + aptitude: BrGlamorousRegularEditorAptitude new glamorousRegularSmallSize + + BrGlamorousInputFieldSpacingAptitude; + beMode: BrTextEditorEditableSingleLineMode new; + geometry: (BlRoundedRectangleGeometry cornerRadius: 4); + vFitContent; + hFitContent; + constraintsDo: [ :c | c minWidth: 150 ]; + text: aDefaultText; + requestFocus. + + aProtocolCompleter := GtCompletionController + on: aProtocolEditor + strategy: GtMethodProtocolCompletionStrategy new. + + aProtocolCompleter install. + + aProtocolEditor + addEditorShortcut: (BlShortcutWithAction new + combination: BlKeyCombination escape; + action: [ :anEvent | anEvent currentTarget fireEvent: BrDropdownHideWish new ]). + + aProtocolEditor + addEditorShortcut: (BlShortcutWithAction new + combination: BlKeyCombination enter; + action: [ :anEvent | self addProtocolFrom: aProtocolEditor ]). + + aContainer addChild: aProtocolEditor. + + anAcceptButton := BrButton new + beSmallSize; + aptitude: (BrGlamorousButtonRectangularAptitude paddingScale: 0.5) + + BrGlamorousButtonIconAptitude + + (BrGlamorousButtonFlatExteriorAptitude new + backgroundPaint: (Color gray alpha: 0.1)) + + BrGlamorousButtonWithLabelTooltipAptitude; + icon: BrGlamorousVectorIcons accept; + label: 'Add protocol'; + action: [ self addProtocolFrom: aProtocolEditor ]. + + aContainer addChild: anAcceptButton. + + ^ aContainer +] + { #category : #'private - instance creation' } GtCoderNavigationProtocolsGroupedList >> createProtocolDropHandler [ ^ BlDropHandler new @@ -184,6 +269,16 @@ GtCoderNavigationProtocolsGroupedList >> initialize [ self groups: protocolGroups ] +{ #category : #accessing } +GtCoderNavigationProtocolsGroupedList >> navigationModel [ + ^ navigationModel +] + +{ #category : #accessing } +GtCoderNavigationProtocolsGroupedList >> navigationModel: anObject [ + navigationModel := anObject +] + { #category : #'private - refactorings' } GtCoderNavigationProtocolsGroupedList >> onDropCompiledMethodsOnProtocol: anItemsDroppedEvent [ | aProtocol aProtocolClass aModel compositeChange| From 8445ace6a2f5cfd1181a888ee00ecc5c2b53db2a Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 7 Oct 2024 11:25:27 -0300 Subject: [PATCH 0701/1268] add `GtFilterStep` interactions [feenkcom/gtoolkit#3983] --- src/GToolkit-Coder-UI/GtFilterModel.class.st | 17 ++++--- src/GToolkit-Coder-UI/GtFilterStep.class.st | 51 +++++++++++++++++++ .../GtFilterViewModel.class.st | 10 ++++ 3 files changed, 72 insertions(+), 6 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterModel.class.st b/src/GToolkit-Coder-UI/GtFilterModel.class.st index ce27b257c..0ec4f9fe8 100644 --- a/src/GToolkit-Coder-UI/GtFilterModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModel.class.st @@ -127,17 +127,22 @@ GtFilterModel >> order: anObject [ ] { #category : #printing } -GtFilterModel >> printOn: aStream [ - super printOn: aStream. - +GtFilterModel >> printDetailsOn: aStream [ aStream - nextPut: $(; nextPutAll: self label asString; nextPutAll: ': '; print: (self selectedValue ifNotNil: #itemValue); nextPutAll: ', order: '; - print: self order; - nextPut: $) + print: self order +] + +{ #category : #printing } +GtFilterModel >> printOn: aStream [ + super printOn: aStream. + + aStream nextPut: $(. + self printDetailsOn: aStream. + aStream nextPut: $) ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtFilterStep.class.st b/src/GToolkit-Coder-UI/GtFilterStep.class.st index a6bccf661..b7c250358 100644 --- a/src/GToolkit-Coder-UI/GtFilterStep.class.st +++ b/src/GToolkit-Coder-UI/GtFilterStep.class.st @@ -49,6 +49,40 @@ GtFilterStep >> assertFilterModelAtIndex: anIndex selectedValueIs: aValue [ equals: aValue ] +{ #category : #'steps - checks' } +GtFilterStep >> assertFilterModelLabeled: aLabel [ + ^ self assert + label: ('Assert filter model with label {1} exists' format: {aLabel}); + referenceSender; + onParentStepTarget: self; + onChildFromBlock: [ :aFilterItemsElement | aFilterItemsElement filtersViewModel items ]; + anySatisfy: [ :aFilterViewModel | aFilterViewModel label = aLabel ] + description: [ :someFilterViewModels | + 'Filter with label {1} is missing: {2}' + format: {aLabel. + someFilterViewModels} ] +] + +{ #category : #'steps - checks' } +GtFilterStep >> assertFilterModelsCountIs: anItemsCount [ + ^ self assert + label: ('Assert filter models count is {1}' format: {anItemsCount}); + referenceSender; + onParentStepTarget: self; + value: [ :aFilterItemsElement | (aFilterItemsElement filtersViewModel items size) ] + equals: anItemsCount +] + +{ #category : #'steps - checks' } +GtFilterStep >> assertMethodProtocolFilterModel [ + ^ self assertFilterModelLabeled: GtSearchMethodCategoryFilter filterName +] + +{ #category : #'steps - checks' } +GtFilterStep >> assertMethodsUpToFilterModel [ + ^ self assertFilterModelLabeled: GtSearchMethodCategoryFilter filterName +] + { #category : #'steps - interactions' } GtFilterStep >> clickOnAddFilter [ ^ self click @@ -66,6 +100,23 @@ GtFilterStep >> clickOnDropdownFilterItemAtIndex: anIndex [ // (GtFilterItemId indexed: anIndex) ] +{ #category : #'steps - interactions' } +GtFilterStep >> clickOnDropdownFilterItemLabeled: aLabel [ + ^ self click + label: ('Click on dropdown item with label {1}' format: {aLabel}); + referenceSender; + onSpaceRoot; + // BrAnchoredOuterContainer; + // #scrollable; + onChildFromBlock: [ :anElement | anElement children detect: [ :each | each children last text asString = aLabel ] ] +] + +{ #category : #'steps - interactions' } +GtFilterStep >> clickOnDropdownMethodProtocolItem [ + ^ self + clickOnDropdownFilterItemLabeled: GtSearchMethodCategoryFilter filterName +] + { #category : #'steps - interactions' } GtFilterStep >> clickOnFilterSettingsAtIndex: anIndex [ ^ self click diff --git a/src/GToolkit-Coder-UI/GtFilterViewModel.class.st b/src/GToolkit-Coder-UI/GtFilterViewModel.class.st index 91f1c9fd5..12fc6c4ba 100644 --- a/src/GToolkit-Coder-UI/GtFilterViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterViewModel.class.st @@ -41,6 +41,16 @@ GtFilterViewModel >> onLabelChanged: anAnnouncement [ label: anAnnouncement label) ] +{ #category : #printing } +GtFilterViewModel >> printOn: aStream [ + super printOn: aStream. + + self hasFilterModel ifFalse: [ ^ self ]. + aStream nextPut: $(. + self filterModel printDetailsOn: aStream. + aStream nextPut: $) +] + { #category : #accessing } GtFilterViewModel >> selectedValue [ ^ self filterModel selectedValue From ea3fcb4de61184a1de864f3f3a394e39ac219996 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 7 Oct 2024 11:29:03 -0300 Subject: [PATCH 0702/1268] move methods to `gt4pharo` [feenkcom/gtoolkit#3983] --- src/GToolkit-Coder-UI/GtFilterStep.class.st | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterStep.class.st b/src/GToolkit-Coder-UI/GtFilterStep.class.st index b7c250358..097141fcf 100644 --- a/src/GToolkit-Coder-UI/GtFilterStep.class.st +++ b/src/GToolkit-Coder-UI/GtFilterStep.class.st @@ -73,16 +73,6 @@ GtFilterStep >> assertFilterModelsCountIs: anItemsCount [ equals: anItemsCount ] -{ #category : #'steps - checks' } -GtFilterStep >> assertMethodProtocolFilterModel [ - ^ self assertFilterModelLabeled: GtSearchMethodCategoryFilter filterName -] - -{ #category : #'steps - checks' } -GtFilterStep >> assertMethodsUpToFilterModel [ - ^ self assertFilterModelLabeled: GtSearchMethodCategoryFilter filterName -] - { #category : #'steps - interactions' } GtFilterStep >> clickOnAddFilter [ ^ self click @@ -111,12 +101,6 @@ GtFilterStep >> clickOnDropdownFilterItemLabeled: aLabel [ onChildFromBlock: [ :anElement | anElement children detect: [ :each | each children last text asString = aLabel ] ] ] -{ #category : #'steps - interactions' } -GtFilterStep >> clickOnDropdownMethodProtocolItem [ - ^ self - clickOnDropdownFilterItemLabeled: GtSearchMethodCategoryFilter filterName -] - { #category : #'steps - interactions' } GtFilterStep >> clickOnFilterSettingsAtIndex: anIndex [ ^ self click From 37065c02afe57e0b190ee7726895729a3ac23f53 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 7 Oct 2024 13:13:00 -0300 Subject: [PATCH 0703/1268] add `GtFilteredCodersModel>>#addOrReplaceFilter:` [feenkcom/gtoolkit#3983] --- .../GtFilteredCodersViewModel.class.st | 7 ++++++- .../GtFilteredCodersModel.class.st | 21 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-StreamingCoders-UI/GtFilteredCodersViewModel.class.st b/src/GToolkit-Coder-StreamingCoders-UI/GtFilteredCodersViewModel.class.st index 08b41b2ba..8a0d10e76 100644 --- a/src/GToolkit-Coder-StreamingCoders-UI/GtFilteredCodersViewModel.class.st +++ b/src/GToolkit-Coder-StreamingCoders-UI/GtFilteredCodersViewModel.class.st @@ -7,6 +7,11 @@ Class { #category : #'GToolkit-Coder-StreamingCoders-UI-Coder' } +{ #category : #'api - accessing' } +GtFilteredCodersViewModel >> addOrReplaceFilter: aFilter [ + streamingCodersModel addOrReplaceFilter: aFilter +] + { #category : #'api - accessing' } GtFilteredCodersViewModel >> additionalFilters [ @@ -14,7 +19,7 @@ GtFilteredCodersViewModel >> additionalFilters [ ^ streamingCodersModel additionalFilters ] -{ #category : #accessing } +{ #category : #'api - accessing' } GtFilteredCodersViewModel >> additionalFilters: aCollectionOfFilter [ "Change the additional filters of the coders model" diff --git a/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st b/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st index 5a7fe3040..af4ce7d39 100644 --- a/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st +++ b/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st @@ -14,6 +14,27 @@ GtFilteredCodersModel class >> forFilter: aGtSearchFilter [ ^ self new filter: aGtSearchFilter ] +{ #category : #'api - accessing' } +GtFilteredCodersModel >> addOrReplaceFilter: aFilter [ + "Add or replace one additional filter. + A filter of the same class is replaced by the given filter." + + | newFilters isChanged | + isChanged := false. + newFilters := self additionalFilters + collect: [ :eachFilter | + eachFilter class = aFilter class + ifTrue: [ + isChanged := true. + aFilter ] + ifFalse: [ + eachFilter ] ]. + + isChanged ifFalse: [ + newFilters := newFilters , {aFilter} ]. + self additionalFilters: newFilters +] + { #category : #'api - accessing' } GtFilteredCodersModel >> additionalFilters [ From 8c47d4161abe247ff43ce37e67859792f7f542e9 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Tue, 8 Oct 2024 12:05:32 +0200 Subject: [PATCH 0704/1268] [feenkcom/gtoolkit#4078] update rename protocol action --- ...derNavigationProtocolsGroupedList.class.st | 231 +++++++++++++----- 1 file changed, 172 insertions(+), 59 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st index a9ccc5f25..1103cd0dd 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st @@ -10,7 +10,9 @@ Class { #classTraits : 'TGtCoderNavigationWithContextMenu classTrait', #instVars : [ 'protocolGroups', - 'navigationModel' + 'navigationModel', + 'protocolToRename', + 'renamingEditor' ], #category : #'GToolkit-Coder-UI-Navigation' } @@ -27,6 +29,8 @@ GtCoderNavigationProtocolsGroupedList >> addProtocolFrom: aProtocolEditor [ GtCoderNavigationProtocolsGroupedList >> addProtocolNamed: aProtocolName in: aClass [ | refactoring | + aProtocolName ifEmpty: [ ^ self ]. + refactoring := RBAddProtocolChange addProtocolNamed: aProtocolName in: aClass. @@ -37,6 +41,7 @@ GtCoderNavigationProtocolsGroupedList >> addProtocolNamed: aProtocolName in: aCl { #category : #'private - instance creation' } GtCoderNavigationProtocolsGroupedList >> bindProtocol: item toElement: element [ | itemText | + itemText := item name asRopedText , ' ' asRopedText , (item methodSelectors size asRopedText foreground: self theme button disabledTextColor). @@ -45,7 +50,7 @@ GtCoderNavigationProtocolsGroupedList >> bindProtocol: item toElement: element [ ^ element text: itemText ] -{ #category : #initialization } +{ #category : #'private - instance creation' } GtCoderNavigationProtocolsGroupedList >> createAddProtocolButton [ | aButtonStencil aPopUp | aButtonStencil := [ @@ -66,7 +71,7 @@ GtCoderNavigationProtocolsGroupedList >> createAddProtocolButton [ label: 'Add new protocol' ] -{ #category : #initialization } +{ #category : #'private - instance creation' } GtCoderNavigationProtocolsGroupedList >> createNewProtocolForm [ | aContainer aProtocolEditor aDefaultText aProtocolCompleter anAcceptButton | aDefaultText := '' asRopedText @@ -104,7 +109,7 @@ GtCoderNavigationProtocolsGroupedList >> createNewProtocolForm [ aProtocolEditor addEditorShortcut: (BlShortcutWithAction new combination: BlKeyCombination escape; - action: [ :anEvent | anEvent currentTarget fireEvent: BrDropdownHideWish new ]). + action: [ :anEvent | aProtocolEditor fireEvent: BrDropdownHideWish new ]). aProtocolEditor addEditorShortcut: (BlShortcutWithAction new @@ -141,32 +146,6 @@ GtCoderNavigationProtocolsGroupedList >> createProtocolDropHandler [ ] { #category : #'private - instance creation' } -GtCoderNavigationProtocolsGroupedList >> createProtocolElement [ - "An element that represents a protocol within a list of protocols" - - - | aLabelAptitude | - aLabelAptitude := BrGlamorousLabelAptitude new - padding: (BlInsets - top: 2 - bottom: 2 - left: 1 - right: 1); - add: BrGlamorousListItemAptitude; - add: (BrGlamorousWithContextMenuAptitude - content: [ :aWidget | - GtCoderNavigationContextMenuContent new - items: (self createProtocolListContextMenuItemsFor: (aWidget userData at: #protocol)) ]). - - ^ BrLabel new - hMatchParent; - vFitContent; - beSmallSize; - aptitude: aLabelAptitude; - addEventHandler: self createProtocolDropHandler -] - -{ #category : #initialization } GtCoderNavigationProtocolsGroupedList >> createProtocolGroupHeader [ ^ BrHorizontalPane new alignCenterLeft; @@ -181,12 +160,30 @@ GtCoderNavigationProtocolsGroupedList >> createProtocolGroupHeader [ { #category : #'private - instance creation' } GtCoderNavigationProtocolsGroupedList >> createProtocolGroups [ - | virtualGroup instanceGroup classGroup | + | virtualGroup instanceGroup classGroup | + virtualGroup := BrGroup new domainObject: 'virtual'; items: #(); - itemStencil: [ self createProtocolElement ]; - itemDataBinder: [ :element :item | self bindProtocol: item toElement: element ]; + itemType: [ :aTypeFactory :eachPharoProtocol | + eachPharoProtocol = protocolToRename + ifTrue: [ #rename ] + ifFalse: [ #display ] ]; + itemStencil: [ :anItemType | + anItemType = #rename + ifTrue: [ + BrFrame new + id: #'coder--protocol-rename'; + hMatchParent; + vFitContent ] + ifFalse: [ self createProtocolLabelElement ] ]; + itemDataBinder: [ :element :item | + element id asSymbol = #'coder--protocol-rename' + ifTrue: [ + element removeChildren. + renamingEditor ifNil: [ renamingEditor := self createRenameProtocolForm: item ]. + element addChild: renamingEditor ] + ifFalse: [ self bindProtocol: item toElement: element ] ]; shouldShowWithoutItems: false. instanceGroup := virtualGroup copy domainObject: 'instance side'. @@ -197,19 +194,122 @@ GtCoderNavigationProtocolsGroupedList >> createProtocolGroups [ classGroup } ] +{ #category : #'private - instance creation' } +GtCoderNavigationProtocolsGroupedList >> createProtocolLabelElement [ + "An element that represents a protocol within a list of protocols" + + | aLabelAptitude | + + aLabelAptitude := BrGlamorousLabelAptitude new + padding: (BlInsets + top: 2 + bottom: 2 + left: 1 + right: 1); + add: BrGlamorousListItemAptitude; + add: (BrGlamorousWithContextMenuAptitude + content: [ :aWidget | + GtCoderNavigationContextMenuContent new + items: (self createProtocolListContextMenuItemsFor: (aWidget userData at: #protocol)) ]). + + ^ BrLabel new + hMatchParent; + vFitContent; + beSmallSize; + beFocusable; + aptitude: aLabelAptitude; + addEventHandler: self createProtocolDropHandler +] + { #category : #'private - instance creation' } GtCoderNavigationProtocolsGroupedList >> createProtocolListContextMenuItemsFor: aPharoProtocol [ ^ Array streamContents: [ :aStream | - aPharoProtocol canBeRemoved + "aPharoProtocol canBeRemoved ifTrue: [ aStream nextPut: (self createLabel: 'Remove ' description: aPharoProtocol name) - -> [ :elem | self removeProtocol: aPharoProtocol in: elem ] ]. + -> [ :elem | self removeProtocol: aPharoProtocol in: elem ] ]." aPharoProtocol canBeRenamed ifTrue: [ aStream nextPut: (self createLabel: 'Rename ' description: aPharoProtocol name) - -> [ :elem | self renameProtocol: aPharoProtocol name in: elem ] ] ] + -> [ :elem | self requestRenameProtocol: aPharoProtocol ] ] ] +] + +{ #category : #'private - instance creation' } +GtCoderNavigationProtocolsGroupedList >> createRenameProtocolForm: aPharoProtocol [ + | aContainer aProtocolEditor aDefaultText aProtocolCompleter anAcceptButton aCancelButton | + + aDefaultText := aPharoProtocol name asRopedText + attribute: (BrGhostTextAttribute + for: ('protocol name' asRopedText glamorousFormEditorCodeFontAndSize + foreground: Color lightGray)). + + aContainer := BrHorizontalPane new + alignCenterLeft; + hMatchParent; + vFitContent. + + aProtocolEditor := BrEditor new + aptitude: BrGlamorousRegularEditorAptitude new glamorousRegularSmallSize + + BrGlamorousInputFieldSpacingAptitude; + beMode: BrTextEditorEditableSingleLineMode new; + geometry: (BlRoundedRectangleGeometry cornerRadius: 4); + padding: (BlInsets top: 2 left: 5 bottom: 2 right: 5); + hMatchParent; + vFitContent; + text: aDefaultText; + requestFocus. + + aProtocolEditor navigator moveToEnd apply. + aProtocolEditor selecter all select. + + aProtocolCompleter := GtCompletionController + on: aProtocolEditor + strategy: GtMethodProtocolCompletionStrategy new. + + aProtocolCompleter install. + + aProtocolEditor + addEditorShortcut: (BlShortcutWithAction new + combination: BlKeyCombination escape; + action: [ :anEvent | self privateEndRenameProtocol ]). + + aProtocolEditor + addEditorShortcut: (BlShortcutWithAction new + combination: BlKeyCombination enter; + action: [ :anEvent | self privateRenameProtocol: aPharoProtocol from: aProtocolEditor ]). + + aContainer addChild: aProtocolEditor. + + anAcceptButton := BrButton new + beTinySize; + margin: (BlInsets left: 5 right: 2); + aptitude: (BrGlamorousButtonRectangularAptitude paddingScale: 0.5) + + BrGlamorousButtonIconAptitude + + (BrGlamorousButtonFlatExteriorAptitude new + backgroundPaint: (Color gray alpha: 0.1)) + + BrGlamorousButtonWithLabelTooltipAptitude; + icon: BrGlamorousVectorIcons accept; + label: 'Rename protocol'; + action: [ self privateRenameProtocol: aPharoProtocol from: aProtocolEditor ]. + + aCancelButton := BrButton new + beTinySize; + margin: (BlInsets left: 2 right: 2); + aptitude: (BrGlamorousButtonRectangularAptitude paddingScale: 0.5) + + BrGlamorousButtonIconAptitude + + (BrGlamorousButtonFlatExteriorAptitude new + backgroundPaint: (Color gray alpha: 0.1)) + + BrGlamorousButtonWithLabelTooltipAptitude; + icon: BrGlamorousVectorIcons cancel; + label: 'Cancel'; + action: [ self privateEndRenameProtocol ]. + + aContainer addChild: anAcceptButton. + aContainer addChild: aCancelButton. + + ^ aContainer ] { #category : #'api - list' } @@ -265,6 +365,8 @@ GtCoderNavigationProtocolsGroupedList >> initialize [ ifFalse: [ header children second visibility: BlVisibility visible ]. header children first text: each domainObject asRopedText ]. + self when: BrSelectionChanged do: [ self privateEndRenameProtocol ]. + protocolGroups := self createProtocolGroups. self groups: protocolGroups ] @@ -317,6 +419,31 @@ GtCoderNavigationProtocolsGroupedList >> onDropCompiledMethodsOnProtocol: anItem compositeChange execute ] +{ #category : #'private - refactorings' } +GtCoderNavigationProtocolsGroupedList >> privateEndRenameProtocol [ + "Removes protocol editing UI" + + protocolToRename := nil. + renamingEditor := nil. + self dispatchEvent: (BrItemsProviderItemsChangedEvent new + viewModel: self viewModel; + isSynchronous: true) +] + +{ #category : #'private - refactorings' } +GtCoderNavigationProtocolsGroupedList >> privateRenameProtocol: aPharoProtocol from: aProtocolEditor [ + "Performs a rename protocol action and updates UI removing a protocol editor" + | aNewName | + + aNewName := aProtocolEditor text asString trimmed. + + self navigationModel + renameProtocol: aPharoProtocol + to: aNewName. + + self privateEndRenameProtocol +] + { #category : #'private - refactorings' } GtCoderNavigationProtocolsGroupedList >> removeProtocol: aGtPharoProtocol in: elem [ | refactoring | @@ -330,29 +457,15 @@ GtCoderNavigationProtocolsGroupedList >> removeProtocol: aGtPharoProtocol in: el ] { #category : #'private - refactorings' } -GtCoderNavigationProtocolsGroupedList >> renameProtocol: aGtPharoProtocol in: elem [ - | refactoring edit | - edit := BrEditableLabel new. - edit - aptitude: (BrGlamorousEditableLabelAptitude new - fontSize: 11.9; "Force the font to match the label font" - background: Color transparent); - text: aGtPharoProtocol name; - when: BrEditorAcceptWish - do: [ :aWish | - refactoring := GtRBRenameProtocolRefactoring - renameProtocol: aGtPharoProtocol name - in: aGtPharoProtocol protocolClass - to: aWish text asString. - edit switchToLabel. - self - addPreviewButtonFor: refactoring - to: elem - cancelSelector: #updateProtocolList ]; - switchToEditor. - edit requestFocus. - elem removeChildren. - elem addChild: edit +GtCoderNavigationProtocolsGroupedList >> requestRenameProtocol: aGtPharoProtocol [ + "An entrance point to the rename protocol action. + Presents a UI to rename a given protocol" + + protocolToRename := aGtPharoProtocol. + renamingEditor := nil. + self dispatchEvent: ((BrItemsProviderItemsChangedEvent new + viewModel: self viewModel; + isSynchronous: true)) ] { #category : #'api - list' } From 311507de257030ec8b389166018267d668e3e621 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Tue, 8 Oct 2024 19:11:40 +0200 Subject: [PATCH 0705/1268] [feenkcom/gtoolkit#4079] all virtual protocol displays also class methods --- .../GtCoderNavigationProtocolsGroupedList.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st index 1103cd0dd..47fbfbc0c 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st @@ -43,7 +43,7 @@ GtCoderNavigationProtocolsGroupedList >> bindProtocol: item toElement: element [ | itemText | itemText := item name asRopedText , ' ' asRopedText - , (item methodSelectors size asRopedText + , (item allMethods size asRopedText foreground: self theme button disabledTextColor). element userData at: #protocol put: item. From 7cd05adbbc8b1c0aa8a4eeae609bcfb4ea85f9c3 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Tue, 8 Oct 2024 21:45:51 +0200 Subject: [PATCH 0706/1268] [feenkcom/gtoolkit#4077] revisit classes hierarchy tree --- ...assesHierarchyListElementExamples.class.st | 2 +- ....st => GtCoderClassesTreeElement.class.st} | 55 ++--- ...erNavigationClassHierarchyElement.class.st | 190 ++++++++++++------ ...erNavigationClassesTreeElementId.class.st} | 4 +- .../GtCoderNavigationElement.class.st | 10 +- ...igationPackagesTagsClassesElement.class.st | 8 +- ...CoderProtocolsGroupedListElement.class.st} | 54 ++--- .../GtCoderClassesHierarchyTree.class.st | 8 + 8 files changed, 207 insertions(+), 124 deletions(-) rename src/GToolkit-Coder-UI/{GtCoderNavigationClassesHierarchyTreeElement.class.st => GtCoderClassesTreeElement.class.st} (84%) rename src/GToolkit-Coder-UI/{GtCoderNavigationClassesHierarchyTreeElementId.class.st => GtCoderNavigationClassesTreeElementId.class.st} (58%) rename src/GToolkit-Coder-UI/{GtCoderNavigationProtocolsGroupedList.class.st => GtCoderProtocolsGroupedListElement.class.st} (88%) diff --git a/src/GToolkit-Coder-Examples/GtCoderNavigationClassesHierarchyListElementExamples.class.st b/src/GToolkit-Coder-Examples/GtCoderNavigationClassesHierarchyListElementExamples.class.st index 0f3de236e..3455b6754 100644 --- a/src/GToolkit-Coder-Examples/GtCoderNavigationClassesHierarchyListElementExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtCoderNavigationClassesHierarchyListElementExamples.class.st @@ -8,6 +8,6 @@ Class { GtCoderNavigationClassesHierarchyListElementExamples >> fromCollectionClasses [ - ^ GtCoderNavigationClassesHierarchyTreeElement + ^ GtCoderClassesTreeElement fromClasses: #'Collections-Abstract' asPackage definedClasses ] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st similarity index 84% rename from src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st rename to src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index b582d58f0..2c4aeb648 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -1,26 +1,29 @@ " -I show a list of classes grouping them based on the inheritance hierarchy and sorting alphabetically +#Classes tree element +I show a list of classes grouping them based on the inheritance hierarchy and sorting alphabetically. +It is a building block of the navigation UI in Coder. +{{gtExample:GtCoderNavigationClassesHierarchyListElementExamples>>#fromCollectionClasses|previewShow=#gtLiveFor:|noCode|previewHeight=180}} " Class { - #name : #GtCoderNavigationClassesHierarchyTreeElement, + #name : #GtCoderClassesTreeElement, #superclass : #BrSimpleTree, #traits : 'TGtCoderNavigationWithContextMenu', #classTraits : 'TGtCoderNavigationWithContextMenu classTrait', #instVars : [ 'classesTree' ], - #category : #'GToolkit-Coder-UI-Navigation' + #category : #'GToolkit-Coder-UI-Navigation - Helpers' } { #category : #'instance creation' } -GtCoderNavigationClassesHierarchyTreeElement class >> fromClasses: aCollectionOfClasses [ +GtCoderClassesTreeElement class >> fromClasses: aCollectionOfClasses [ ^ self new initializeWithClasses: aCollectionOfClasses ] { #category : #'private - context menu' } -GtCoderNavigationClassesHierarchyTreeElement >> addPreviewButtonFor: refactoring to: elem cancelBlock: aBlock [ +GtCoderClassesTreeElement >> addPreviewButtonFor: refactoring to: elem cancelBlock: aBlock [ | button | elem removeChildNamed: #preview. button := GtRefactoringsPreviewButton new. @@ -41,7 +44,7 @@ GtCoderNavigationClassesHierarchyTreeElement >> addPreviewButtonFor: refactoring ] { #category : #'private - context menu' } -GtCoderNavigationClassesHierarchyTreeElement >> addPreviewButtonFor: refactoring to: elem cancelSelector: cancelSelector [ +GtCoderClassesTreeElement >> addPreviewButtonFor: refactoring to: elem cancelSelector: cancelSelector [ | button | elem removeChildNamed: #preview. button := GtRefactoringsPreviewButton new. @@ -62,12 +65,12 @@ GtCoderNavigationClassesHierarchyTreeElement >> addPreviewButtonFor: refactoring ] { #category : #initialization } -GtCoderNavigationClassesHierarchyTreeElement >> browseReferencesTo: aClass [ +GtCoderClassesTreeElement >> browseReferencesTo: aClass [ self phlow spawnObject: (aClass gtReferences) ] { #category : #initialization } -GtCoderNavigationClassesHierarchyTreeElement >> buildRemoveClassLabelFor: aClass [ +GtCoderClassesTreeElement >> buildRemoveClassLabelFor: aClass [ | labelText | labelText := (aClass isReferenced ifTrue: [ '<1s> is referenced. Remove anyway?' ] @@ -81,8 +84,14 @@ GtCoderNavigationClassesHierarchyTreeElement >> buildRemoveClassLabelFor: aClass text: labelText asRopedText ] +{ #category : #'as yet unclassified' } +GtCoderClassesTreeElement >> containsClass: aClass [ + "Return true if the classes tree contains a given class, false otherwise" + ^ classesTree containsClass: aClass +] + { #category : #initialization } -GtCoderNavigationClassesHierarchyTreeElement >> contextMenuItemsFor: aClass [ +GtCoderClassesTreeElement >> contextMenuItemsFor: aClass [ ^ {(self createLabel: 'Browse references' description: aClass name) -> [ :elem | self browseReferencesTo: aClass ]. (self createLabel: 'New Subclass' description: aClass name) @@ -98,7 +107,7 @@ GtCoderNavigationClassesHierarchyTreeElement >> contextMenuItemsFor: aClass [ ] { #category : #'private - context menu' } -GtCoderNavigationClassesHierarchyTreeElement >> convertToSibling: aClass inElement: elem [ +GtCoderClassesTreeElement >> convertToSibling: aClass inElement: elem [ | refactoring label refactoringButton edit acceptButton | refactoringButton := GtRefactoringsWithInputPreviewElement new. refactoringButton cancelBlock: [ ]. @@ -168,7 +177,7 @@ GtCoderNavigationClassesHierarchyTreeElement >> convertToSibling: aClass inEleme ] { #category : #'private - drag and drop' } -GtCoderNavigationClassesHierarchyTreeElement >> createClassDropHandler [ +GtCoderClassesTreeElement >> createClassDropHandler [ ^ BlDropHandler new acceptDomainObjectsSuchThat: [ :anObject | anObject isCompiledMethod ]; whenDroppedDo: [ :anItemsDroppedEvent | self onDropCompiledMethodsOnClass: anItemsDroppedEvent ]; @@ -179,7 +188,7 @@ GtCoderNavigationClassesHierarchyTreeElement >> createClassDropHandler [ ] { #category : #'private - context menu' } -GtCoderNavigationClassesHierarchyTreeElement >> createLabel: aString description: description [ +GtCoderClassesTreeElement >> createLabel: aString description: description [ ^ aString asRopedText glamorousRegularFont , ((' ' , description) asRopedText glamorousCodeFont; @@ -188,7 +197,7 @@ GtCoderNavigationClassesHierarchyTreeElement >> createLabel: aString description ] { #category : #initialization } -GtCoderNavigationClassesHierarchyTreeElement >> createNodeElement [ +GtCoderClassesTreeElement >> createNodeElement [ | aLabelAptitude | aLabelAptitude := BrGlamorousLabelAptitude new. @@ -208,7 +217,7 @@ GtCoderNavigationClassesHierarchyTreeElement >> createNodeElement [ ] { #category : #initialization } -GtCoderNavigationClassesHierarchyTreeElement >> initialize [ +GtCoderClassesTreeElement >> initialize [ super initialize. self rowStencil: BrGlamorousSimpleTreeSelectableRowElementStencilBuilder new. @@ -217,7 +226,7 @@ GtCoderNavigationClassesHierarchyTreeElement >> initialize [ nodeStencil: [ self createNodeElement ]; nodeDataBinder: [ :aClassElement :aClassHierarchyTree :aTreeNode | aClassElement - id: (GtCoderNavigationClassesHierarchyTreeElementId indexed: aTreeNode indexInTree). + id: (GtCoderNavigationClassesTreeElementId indexed: aTreeNode indexInTree). aClassElement userData at: #'coder-class' put: aClassHierarchyTree rootClass. @@ -237,7 +246,7 @@ GtCoderNavigationClassesHierarchyTreeElement >> initialize [ ] { #category : #'api - initialization' } -GtCoderNavigationClassesHierarchyTreeElement >> initializeWithClasses: aCollectionOfClasses [ +GtCoderClassesTreeElement >> initializeWithClasses: aCollectionOfClasses [ | newTree | newTree := (GtCoderClassesHierarchyTree fromClasses: aCollectionOfClasses) sortByClassName. @@ -250,7 +259,7 @@ GtCoderNavigationClassesHierarchyTreeElement >> initializeWithClasses: aCollecti ] { #category : #'api - initialization' } -GtCoderNavigationClassesHierarchyTreeElement >> initializeWithHierachyForClass: aClass [ +GtCoderClassesTreeElement >> initializeWithHierachyForClass: aClass [ classesTree := (GtCoderGrowingClassesHierarchyTree hierarchyForClass: aClass) sortByClassName. self @@ -260,7 +269,7 @@ GtCoderNavigationClassesHierarchyTreeElement >> initializeWithHierachyForClass: ] { #category : #'private - context menu' } -GtCoderNavigationClassesHierarchyTreeElement >> newSubclassOf: aClass [ +GtCoderClassesTreeElement >> newSubclassOf: aClass [ | dropdown tabGroup | tabGroup := self withAllParentsDetect: [ :each | each class == BrTabGroup ] @@ -271,7 +280,7 @@ GtCoderNavigationClassesHierarchyTreeElement >> newSubclassOf: aClass [ ] { #category : #'private - drag and drop' } -GtCoderNavigationClassesHierarchyTreeElement >> onDropCompiledMethodsOnClass: anItemsDroppedEvent [ +GtCoderClassesTreeElement >> onDropCompiledMethodsOnClass: anItemsDroppedEvent [ | aClass aModel compositeChange| aClass := anItemsDroppedEvent currentTarget userData at: #'coder-class'. @@ -305,7 +314,7 @@ GtCoderNavigationClassesHierarchyTreeElement >> onDropCompiledMethodsOnClass: an ] { #category : #'private - context menu' } -GtCoderNavigationClassesHierarchyTreeElement >> removeClass: aClass inElement: elem [ +GtCoderClassesTreeElement >> removeClass: aClass inElement: elem [ | change button | change := RBRemoveClassChange remove: aClass. button := GtPreviewChangeButton new @@ -323,7 +332,7 @@ GtCoderNavigationClassesHierarchyTreeElement >> removeClass: aClass inElement: e ] { #category : #'private - context menu' } -GtCoderNavigationClassesHierarchyTreeElement >> renameClass: aClass inElement: elem [ +GtCoderClassesTreeElement >> renameClass: aClass inElement: elem [ | refactoring edit childs | edit := BrEditableLabel new. childs := elem children. @@ -350,14 +359,14 @@ GtCoderNavigationClassesHierarchyTreeElement >> renameClass: aClass inElement: e ] { #category : #'api - selection' } -GtCoderNavigationClassesHierarchyTreeElement >> selectedClass [ +GtCoderClassesTreeElement >> selectedClass [ self selectedNodeDo: [ :aNode | ^ aNode value rootClass ]. ^ nil ] { #category : #'api - selection' } -GtCoderNavigationClassesHierarchyTreeElement >> selectedIndice [ +GtCoderClassesTreeElement >> selectedIndice [ "Return selected indice or zero" self selectedIndices diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st index 0835f49e6..35be5c552 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st @@ -1,110 +1,168 @@ +" +I show a list of classes grouping them based on the inheritance hierarchy and sorting alphabetically. + + +" Class { #name : #GtCoderNavigationClassHierarchyElement, - #superclass : #GtCoderNavigationElement, + #superclass : #BlElement, + #instVars : [ + 'supressListChanges', + 'classesList', + 'navigationModel' + ], #category : #'GToolkit-Coder-UI-Navigation' } -{ #category : #initialization } -GtCoderNavigationClassHierarchyElement >> initializeElement [ - super initializeElement. - self addChild: classesList +{ #category : #'api - class selections' } +GtCoderNavigationClassHierarchyElement >> deselectClass: aClass [ + classesList deselectAll +] + +{ #category : #'api - class selections' } +GtCoderNavigationClassHierarchyElement >> deselectClasses [ + classesList deselectAll +] + +{ #category : #'updating lists' } +GtCoderNavigationClassHierarchyElement >> emptyClassList [ + classesList initializeWithClasses: #(). +] + +{ #category : #testing } +GtCoderNavigationClassHierarchyElement >> hasNavigationModel [ + ^ self navigationModel isNotNil and: [ + self navigationModel isNavigationModel ] ] -{ #category : #initialization } -GtCoderNavigationClassHierarchyElement >> initializeLayout [ - super initializeLayout. +{ #category : #'as yet unclassified' } +GtCoderNavigationClassHierarchyElement >> initialize [ + super initialize. + self layout: BlLinearLayout vertical. self constraintsDo: [ :c | c horizontal matchParent. c vertical matchParent ]. + + classesList := GtCoderClassesTreeElement new. + + self addChild: classesList ] -{ #category : #'event handling' } -GtCoderNavigationClassHierarchyElement >> onClassDeselected: aGtCoderNavigationClassDeselected [ - self deselectClass: aGtCoderNavigationClassDeselected theClass +{ #category : #accessing } +GtCoderNavigationClassHierarchyElement >> navigationModel [ + + + ^ navigationModel ] -{ #category : #subscriptions } -GtCoderNavigationClassHierarchyElement >> onClassModified: anAnnouncement [ - self - suppressListChangeEventsDuring: [ self - updateClass: anAnnouncement theClass - inPackage: anAnnouncement package - tag: anAnnouncement tag ] +{ #category : #accessing } +GtCoderNavigationClassHierarchyElement >> navigationModel: aGtCoderNavigationPackagesTagsClassesModel [ + self unsubscribeFromNavigationModel. + navigationModel := aGtCoderNavigationPackagesTagsClassesModel. + self onNavigationModelChanged. ] -{ #category : #subscriptions } -GtCoderNavigationClassHierarchyElement >> onClassRemoved: anAnnouncement [ - | newSelection | - newSelection := anAnnouncement theClass superclass. - self - inUIProcessDo: [ self updateClassListsWith: newSelection. - self selectClass: newSelection ] +{ #category : #'event handling' } +GtCoderNavigationClassHierarchyElement >> onClassDeselected: aGtCoderNavigationClassDeselected [ + self deselectClass: aGtCoderNavigationClassDeselected theClass ] -{ #category : #subscriptions } -GtCoderNavigationClassHierarchyElement >> onClassRenamed: anAnnouncement [ - self - inUIProcessDo: [ self - suppressListChangeEventsDuring: [ self - renameClass: anAnnouncement theClass - oldName: anAnnouncement oldName - newName: anAnnouncement newName - inPackage: anAnnouncement package - tag: anAnnouncement tag ] ] +{ #category : #'event handling' } +GtCoderNavigationClassHierarchyElement >> onClassListSelectionChanged [ + | anIndex aSelectedItem theIndices | + + theIndices := classesList selectedIndices. + theIndices ifEmpty: [ ^ self ]. + anIndex := theIndices first. + (anIndex between: 1 and: classesList viewModel itemCount) + ifFalse: [ ^ self ]. + aSelectedItem := (classesList viewModel itemAt: anIndex) value rootClass. + self navigationModel selectClass: aSelectedItem ] { #category : #'event handling' } GtCoderNavigationClassHierarchyElement >> onClassSelected: anAnnouncement [ - self - suppressListChangeEventsDuring: [ self selectClass: anAnnouncement theClass ] + | aSelectedClass | + + aSelectedClass := anAnnouncement theClass. + (classesList containsClass: aSelectedClass) + ifFalse: [ self updateClassList ]. + self selectClass: aSelectedClass ] { #category : #'event handling' } -GtCoderNavigationClassHierarchyElement >> onPackageSelected: anAnnouncer [ - self - inUIProcessDo: [ self - suppressListChangeEventsDuring: [ self emptyClassList. - self deselectClasses ] ] +GtCoderNavigationClassHierarchyElement >> onNavigationModelChanged [ + "subclasses may perform actions on navigation model changes" + self updateContent. + self subscribeToNavigationModel. + self subscribeToClassList. ] -{ #category : #'event handling' } -GtCoderNavigationClassHierarchyElement >> onPackageTagSelected: anAnnouncer [ - self - inUIProcessDo: [ self - suppressListChangeEventsDuring: [ self emptyClassList. - self deselectClasses ] ] +{ #category : #'private - selection' } +GtCoderNavigationClassHierarchyElement >> scrollIndexFromPrevious: aPreviousIndex current: aNewIndex max: aNumberOfItems [ + + ^ (aPreviousIndex isZero or: [ aPreviousIndex >= aNewIndex ]) + ifTrue: [ aNewIndex - 5 max: 1 ] + ifFalse: [ aNewIndex + 5 min: aNumberOfItems ]. ] -{ #category : #'event handling' } -GtCoderNavigationClassHierarchyElement >> onPackagesSelected: anAnnouncer [ - self - inUIProcessDo: [ self - suppressListChangeEventsDuring: [ self emptyClassList. - self deselectClasses ] ] +{ #category : #'api - class selections' } +GtCoderNavigationClassHierarchyElement >> selectClass: aClass [ + | aPreviousIndex | + + aPreviousIndex := classesList selectedIndice. + classesList viewModel + indexOfSuchThat: [ :each | each rootClass = aClass ] + do: [ :aNewIndex | + classesList + selectOne: aNewIndex; + scrollToIndex: + (self + scrollIndexFromPrevious: aPreviousIndex + current: aNewIndex + max: classesList viewModel itemCount) ] ] { #category : #subscriptions } -GtCoderNavigationClassHierarchyElement >> subscribeToContent [ - super subscribeToContent. - self subscribeToClassList. +GtCoderNavigationClassHierarchyElement >> subscribeToClassList [ + classesList + when: BrSelectionChanged + do: [ :anEvent | self onClassListSelectionChanged ] ] { #category : #subscriptions } GtCoderNavigationClassHierarchyElement >> subscribeToNavigationModel [ + | subscriptions | + + self hasNavigationModel + ifFalse: [ ^ self ]. + + subscriptions := { + GtCoderNavigationClassSelected -> #onClassSelected:. + GtCoderNavigationClassDeselected -> #onClassDeselected: + }. + + subscriptions + do: [ :sub | + navigationModel weak + when: sub key + send: sub value + to: self ] +] + +{ #category : #subscriptions } +GtCoderNavigationClassHierarchyElement >> unsubscribeFromNavigationModel [ self hasNavigationModel ifFalse: [ ^ self ]. - super subscribeToNavigationModel. - navigationModel weak when: GtCoderNavigationPackagesSelected send: #onPackagesSelected: to: self. - navigationModel weak when: GtCoderNavigationPackageSelected send: #onPackageSelected: to: self. - navigationModel weak when: GtCoderNavigationPackageTagSelected send: #onPackageTagSelected: to: self. + navigationModel ifNotNil: [ :aModel | aModel unsubscribe: self ]. ] { #category : #'updating lists' } GtCoderNavigationClassHierarchyElement >> updateClassList [ self hasNavigationModel ifFalse: [ ^ self ]. - navigationModel hasSelectedClass + navigationModel hasSelectedClass ifTrue: [ self updateClassListsWith: navigationModel selectedClass ] - ifFalse: [ self emptyClassList ]. + ifFalse: [ self emptyClassList ] ] { #category : #'updating lists' } @@ -117,3 +175,9 @@ GtCoderNavigationClassHierarchyElement >> updateContent [ self updateClassList. self updateSelectedClass ] + +{ #category : #'updating lists' } +GtCoderNavigationClassHierarchyElement >> updateSelectedClass [ + self hasNavigationModel ifFalse: [ ^ self ]. + navigationModel selectedClassDo: [ :aClass | self selectClass: aClass ] +] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElementId.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassesTreeElementId.class.st similarity index 58% rename from src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElementId.class.st rename to src/GToolkit-Coder-UI/GtCoderNavigationClassesTreeElementId.class.st index bd306530e..eccf4e0bd 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassesHierarchyTreeElementId.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassesTreeElementId.class.st @@ -1,10 +1,10 @@ Class { - #name : #GtCoderNavigationClassesHierarchyTreeElementId, + #name : #GtCoderNavigationClassesTreeElementId, #superclass : #BlElementUniqueId, #category : #'GToolkit-Coder-UI-Navigation' } { #category : #accessing } -GtCoderNavigationClassesHierarchyTreeElementId >> asSymbol [ +GtCoderNavigationClassesTreeElementId >> asSymbol [ ^ #'coder-sidebar--classes-hierarchy-tree-item' ] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st index 57d9a466c..4060b8102 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st @@ -53,7 +53,7 @@ GtCoderNavigationElement >> initialize [ { #category : #initialization } GtCoderNavigationElement >> initializeContent [ - classesList := GtCoderNavigationClassesHierarchyTreeElement new. + classesList := GtCoderClassesTreeElement new. ] { #category : #initialization } @@ -135,6 +135,11 @@ GtCoderNavigationElement >> onClassSelected: anAnnouncement [ self subclassResponsibility ] +{ #category : #'event handling' } +GtCoderNavigationElement >> onClassesToShowChanged: anAnnouncement [ + self updateClassList +] + { #category : #'event handling' } GtCoderNavigationElement >> onNavigationModelChanged [ "subclasses may perform actions on navigation model changes" @@ -205,7 +210,8 @@ GtCoderNavigationElement >> subscribeToNavigationModel [ GtCoderNavigationClassSelected -> #onClassSelected:. GtCoderNavigationClassDeselected -> #onClassDeselected:. GtCoderNavigationClassRenamed -> #onClassRenamed:. - GtCoderNavigationClassModified -> #onClassModified: + GtCoderNavigationClassModified -> #onClassModified:. + GtCoderNavigationClassesToShowChanged -> #onClassesToShowChanged:. }. subscriptions diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 729ac8976..618afdba5 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -154,7 +154,7 @@ GtCoderNavigationPackagesTagsClassesElement >> buildMethodItemWithOnClick: click { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> buildProtocolGroupList [ - ^ GtCoderNavigationProtocolsGroupedList new + ^ GtCoderProtocolsGroupedListElement new ] { #category : #initialization } @@ -376,11 +376,6 @@ GtCoderNavigationPackagesTagsClassesElement >> onClassSelected: anAnnouncement [ suppressListChangeEventsDuring: [ self selectClass: anAnnouncement theClass ] ] -{ #category : #'event handling' } -GtCoderNavigationPackagesTagsClassesElement >> onClassesToShowChanged: anAnnouncement [ - self updateClassList -] - { #category : #'event handling - selection' } GtCoderNavigationPackagesTagsClassesElement >> onMethodListSelectionChanged: aMethod [ supressListChanges ifTrue: [ ^ self ]. @@ -925,7 +920,6 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToNavigationModel [ GtCoderNavigationSlotSelected -> #onSlotSelected:. GtCoderNavigationMethodSelected -> #onMethodSelected:. "Announcements when we need to update items in the lists" - GtCoderNavigationClassesToShowChanged -> #onClassesToShowChanged:. GtCoderNavigationProtocolsToShowChanged -> #onProtocolsToShowChanged:. GtCoderNavigationMethodsToShowChanged -> #onMethodsToShowChanged:. diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st similarity index 88% rename from src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st rename to src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st index 47fbfbc0c..47b8e3fe6 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationProtocolsGroupedList.class.st +++ b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st @@ -2,9 +2,11 @@ #Navigation protocol list Displays a list of instance and class side protocols as a grouped list with an ability to drag and drop method on a protocol to move or copy a method there. + + " Class { - #name : #GtCoderNavigationProtocolsGroupedList, + #name : #GtCoderProtocolsGroupedListElement, #superclass : #BrGroupedList, #traits : 'TGtCoderNavigationWithContextMenu', #classTraits : 'TGtCoderNavigationWithContextMenu classTrait', @@ -14,11 +16,11 @@ Class { 'protocolToRename', 'renamingEditor' ], - #category : #'GToolkit-Coder-UI-Navigation' + #category : #'GToolkit-Coder-UI-Navigation - Helpers' } { #category : #'private - refactorings' } -GtCoderNavigationProtocolsGroupedList >> addProtocolFrom: aProtocolEditor [ +GtCoderProtocolsGroupedListElement >> addProtocolFrom: aProtocolEditor [ self navigationModel selectedClassDo: [ :aClass | self addProtocolNamed: aProtocolEditor text asString trimmed in: aClass ]. @@ -26,7 +28,7 @@ GtCoderNavigationProtocolsGroupedList >> addProtocolFrom: aProtocolEditor [ ] { #category : #'private - refactorings' } -GtCoderNavigationProtocolsGroupedList >> addProtocolNamed: aProtocolName in: aClass [ +GtCoderProtocolsGroupedListElement >> addProtocolNamed: aProtocolName in: aClass [ | refactoring | aProtocolName ifEmpty: [ ^ self ]. @@ -39,7 +41,7 @@ GtCoderNavigationProtocolsGroupedList >> addProtocolNamed: aProtocolName in: aCl ] { #category : #'private - instance creation' } -GtCoderNavigationProtocolsGroupedList >> bindProtocol: item toElement: element [ +GtCoderProtocolsGroupedListElement >> bindProtocol: item toElement: element [ | itemText | itemText := item name asRopedText , ' ' asRopedText @@ -51,7 +53,7 @@ GtCoderNavigationProtocolsGroupedList >> bindProtocol: item toElement: element [ ] { #category : #'private - instance creation' } -GtCoderNavigationProtocolsGroupedList >> createAddProtocolButton [ +GtCoderProtocolsGroupedListElement >> createAddProtocolButton [ | aButtonStencil aPopUp | aButtonStencil := [ BrButton new @@ -72,7 +74,7 @@ GtCoderNavigationProtocolsGroupedList >> createAddProtocolButton [ ] { #category : #'private - instance creation' } -GtCoderNavigationProtocolsGroupedList >> createNewProtocolForm [ +GtCoderProtocolsGroupedListElement >> createNewProtocolForm [ | aContainer aProtocolEditor aDefaultText aProtocolCompleter anAcceptButton | aDefaultText := '' asRopedText attribute: (BrGhostTextAttribute @@ -135,7 +137,7 @@ GtCoderNavigationProtocolsGroupedList >> createNewProtocolForm [ ] { #category : #'private - instance creation' } -GtCoderNavigationProtocolsGroupedList >> createProtocolDropHandler [ +GtCoderProtocolsGroupedListElement >> createProtocolDropHandler [ ^ BlDropHandler new acceptDomainObjectsSuchThat: [ :anObject | anObject isCompiledMethod ]; whenDroppedDo: [ :anItemsDroppedEvent | self onDropCompiledMethodsOnProtocol: anItemsDroppedEvent ]; @@ -146,7 +148,7 @@ GtCoderNavigationProtocolsGroupedList >> createProtocolDropHandler [ ] { #category : #'private - instance creation' } -GtCoderNavigationProtocolsGroupedList >> createProtocolGroupHeader [ +GtCoderProtocolsGroupedListElement >> createProtocolGroupHeader [ ^ BrHorizontalPane new alignCenterLeft; hMatchParent; @@ -159,7 +161,7 @@ GtCoderNavigationProtocolsGroupedList >> createProtocolGroupHeader [ ] { #category : #'private - instance creation' } -GtCoderNavigationProtocolsGroupedList >> createProtocolGroups [ +GtCoderProtocolsGroupedListElement >> createProtocolGroups [ | virtualGroup instanceGroup classGroup | virtualGroup := BrGroup new @@ -195,7 +197,7 @@ GtCoderNavigationProtocolsGroupedList >> createProtocolGroups [ ] { #category : #'private - instance creation' } -GtCoderNavigationProtocolsGroupedList >> createProtocolLabelElement [ +GtCoderProtocolsGroupedListElement >> createProtocolLabelElement [ "An element that represents a protocol within a list of protocols" | aLabelAptitude | @@ -222,7 +224,7 @@ GtCoderNavigationProtocolsGroupedList >> createProtocolLabelElement [ ] { #category : #'private - instance creation' } -GtCoderNavigationProtocolsGroupedList >> createProtocolListContextMenuItemsFor: aPharoProtocol [ +GtCoderProtocolsGroupedListElement >> createProtocolListContextMenuItemsFor: aPharoProtocol [ ^ Array streamContents: [ :aStream | "aPharoProtocol canBeRemoved @@ -237,7 +239,7 @@ GtCoderNavigationProtocolsGroupedList >> createProtocolListContextMenuItemsFor: ] { #category : #'private - instance creation' } -GtCoderNavigationProtocolsGroupedList >> createRenameProtocolForm: aPharoProtocol [ +GtCoderProtocolsGroupedListElement >> createRenameProtocolForm: aPharoProtocol [ | aContainer aProtocolEditor aDefaultText aProtocolCompleter anAcceptButton aCancelButton | aDefaultText := aPharoProtocol name asRopedText @@ -313,12 +315,12 @@ GtCoderNavigationProtocolsGroupedList >> createRenameProtocolForm: aPharoProtoco ] { #category : #'api - list' } -GtCoderNavigationProtocolsGroupedList >> deselectProtocol [ +GtCoderProtocolsGroupedListElement >> deselectProtocol [ self deselectAll ] { #category : #'private - selection' } -GtCoderNavigationProtocolsGroupedList >> detectProtocolIndex: aGtPharoProtocol inGroups: aCollectionOfArrayOfProtocols [ +GtCoderProtocolsGroupedListElement >> detectProtocolIndex: aGtPharoProtocol inGroups: aCollectionOfArrayOfProtocols [ | aSelectionIndex | aGtPharoProtocol ifNil: [ ^ 0 ]. @@ -352,7 +354,7 @@ GtCoderNavigationProtocolsGroupedList >> detectProtocolIndex: aGtPharoProtocol i ] { #category : #initialization } -GtCoderNavigationProtocolsGroupedList >> initialize [ +GtCoderProtocolsGroupedListElement >> initialize [ super initialize. self @@ -372,17 +374,17 @@ GtCoderNavigationProtocolsGroupedList >> initialize [ ] { #category : #accessing } -GtCoderNavigationProtocolsGroupedList >> navigationModel [ +GtCoderProtocolsGroupedListElement >> navigationModel [ ^ navigationModel ] { #category : #accessing } -GtCoderNavigationProtocolsGroupedList >> navigationModel: anObject [ +GtCoderProtocolsGroupedListElement >> navigationModel: anObject [ navigationModel := anObject ] { #category : #'private - refactorings' } -GtCoderNavigationProtocolsGroupedList >> onDropCompiledMethodsOnProtocol: anItemsDroppedEvent [ +GtCoderProtocolsGroupedListElement >> onDropCompiledMethodsOnProtocol: anItemsDroppedEvent [ | aProtocol aProtocolClass aModel compositeChange| aProtocol := anItemsDroppedEvent currentTarget userData at: #protocol. @@ -420,7 +422,7 @@ GtCoderNavigationProtocolsGroupedList >> onDropCompiledMethodsOnProtocol: anItem ] { #category : #'private - refactorings' } -GtCoderNavigationProtocolsGroupedList >> privateEndRenameProtocol [ +GtCoderProtocolsGroupedListElement >> privateEndRenameProtocol [ "Removes protocol editing UI" protocolToRename := nil. @@ -431,7 +433,7 @@ GtCoderNavigationProtocolsGroupedList >> privateEndRenameProtocol [ ] { #category : #'private - refactorings' } -GtCoderNavigationProtocolsGroupedList >> privateRenameProtocol: aPharoProtocol from: aProtocolEditor [ +GtCoderProtocolsGroupedListElement >> privateRenameProtocol: aPharoProtocol from: aProtocolEditor [ "Performs a rename protocol action and updates UI removing a protocol editor" | aNewName | @@ -445,7 +447,7 @@ GtCoderNavigationProtocolsGroupedList >> privateRenameProtocol: aPharoProtocol f ] { #category : #'private - refactorings' } -GtCoderNavigationProtocolsGroupedList >> removeProtocol: aGtPharoProtocol in: elem [ +GtCoderProtocolsGroupedListElement >> removeProtocol: aGtPharoProtocol in: elem [ | refactoring | refactoring := RBRemoveProtocolChange removeProtocolNamed: aGtPharoProtocol name @@ -457,7 +459,7 @@ GtCoderNavigationProtocolsGroupedList >> removeProtocol: aGtPharoProtocol in: el ] { #category : #'private - refactorings' } -GtCoderNavigationProtocolsGroupedList >> requestRenameProtocol: aGtPharoProtocol [ +GtCoderProtocolsGroupedListElement >> requestRenameProtocol: aGtPharoProtocol [ "An entrance point to the rename protocol action. Presents a UI to rename a given protocol" @@ -469,7 +471,7 @@ GtCoderNavigationProtocolsGroupedList >> requestRenameProtocol: aGtPharoProtocol ] { #category : #'api - list' } -GtCoderNavigationProtocolsGroupedList >> selectProtocol: aGtPharoProtocol [ +GtCoderProtocolsGroupedListElement >> selectProtocol: aGtPharoProtocol [ | selectionIndex | selectionIndex := self @@ -482,7 +484,7 @@ GtCoderNavigationProtocolsGroupedList >> selectProtocol: aGtPharoProtocol [ ] { #category : #'api - list' } -GtCoderNavigationProtocolsGroupedList >> selectedProtocol [ +GtCoderProtocolsGroupedListElement >> selectedProtocol [ | theIndices anIndex | @@ -494,7 +496,7 @@ GtCoderNavigationProtocolsGroupedList >> selectedProtocol [ ] { #category : #'api - list' } -GtCoderNavigationProtocolsGroupedList >> updateProtocolListWith: theGtPharoProtocols [ +GtCoderProtocolsGroupedListElement >> updateProtocolListWith: theGtPharoProtocols [ | virtualStream instStream classStream virtualGtPharoProtocols instanceGtPharoProtocols classGtPharoProtocols groupItems | virtualGtPharoProtocols := theGtPharoProtocols diff --git a/src/GToolkit-Coder/GtCoderClassesHierarchyTree.class.st b/src/GToolkit-Coder/GtCoderClassesHierarchyTree.class.st index 39e7c5be1..f2d6647a3 100644 --- a/src/GToolkit-Coder/GtCoderClassesHierarchyTree.class.st +++ b/src/GToolkit-Coder/GtCoderClassesHierarchyTree.class.st @@ -71,6 +71,14 @@ GtCoderClassesHierarchyTree >> classes [ ^ self subclassTrees collect: [ :eachTree | eachTree rootClass ] ] +{ #category : #testing } +GtCoderClassesHierarchyTree >> containsClass: aClass [ + rootClass = aClass + ifTrue: [ ^ true ]. + + ^ self subclassTrees anySatisfy: [ :eachTree | eachTree containsClass: aClass ] +] + { #category : #accessing } GtCoderClassesHierarchyTree >> first [ From 8b4f4bd2358e7da5464ee5ddfc055d4f19271c7e Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 8 Oct 2024 20:04:21 -0300 Subject: [PATCH 0707/1268] ensure that search filters creates filter models correctly and vice versa [feenkcom/gtoolkit#3983] --- .../GtFilteredCodersModel.class.st | 12 +++- ...odersModelAdditionalFiltersSignal.class.st | 63 +++++++++++++++++++ .../GtFilterItemsChangedSignal.class.st | 53 ++++++++++++++++ .../GtFilterItemsModel.class.st | 12 +++- .../GtFilterItemsModelComparator.class.st | 39 ++++++++++++ src/GToolkit-Coder-UI/GtFilterModel.class.st | 12 +++- ...GtFilterModelMethodDefinitionItem.class.st | 2 + .../GtFilterModelMethodOriginItem.class.st | 2 + .../GtFilterModelSideItem.class.st | 2 + .../GtFilterTextModel.class.st | 1 + .../GtSubstringFilter.extension.st | 7 +++ .../UndefinedObject.extension.st | 6 ++ .../GtSearchFilter.class.st | 12 ++++ 13 files changed, 218 insertions(+), 5 deletions(-) create mode 100644 src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModelAdditionalFiltersSignal.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterItemsChangedSignal.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterItemsModelComparator.class.st create mode 100644 src/GToolkit-Coder-UI/GtSubstringFilter.extension.st create mode 100644 src/GToolkit-Coder-UI/UndefinedObject.extension.st diff --git a/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st b/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st index af4ce7d39..fa39b0d72 100644 --- a/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st +++ b/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st @@ -44,12 +44,20 @@ GtFilteredCodersModel >> additionalFilters [ { #category : #'api - accessing' } GtFilteredCodersModel >> additionalFilters: aCollectionOfFilters [ + | aSignal aNewCollection | + aNewCollection := aCollectionOfFilters asArray. + additionalFilters = aNewCollection ifTrue: [ ^ self ]. + aSignal := GtFilteredCodersModelAdditionalFiltersSignal new + incomingAdditionalFilters: aCollectionOfFilters; + existingAdditionalFilters: additionalFilters; + emit. monitor critical: [ - additionalFilters := aCollectionOfFilters asArray. + additionalFilters := aNewCollection. compositeFilter := self createCombinedFilterFor: filter andAdditionalFilters: additionalFilters. - self refreshItemsStreamDueTo: GtFilteredCodersAdditionalFiltersReason new ] + self refreshItemsStreamDueTo: GtFilteredCodersAdditionalFiltersReason new ]. + aSignal usedAdditionalFilters: additionalFilters. ] { #category : #'api - accessing' } diff --git a/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModelAdditionalFiltersSignal.class.st b/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModelAdditionalFiltersSignal.class.st new file mode 100644 index 000000000..bfa86145f --- /dev/null +++ b/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModelAdditionalFiltersSignal.class.st @@ -0,0 +1,63 @@ +Class { + #name : #GtFilteredCodersModelAdditionalFiltersSignal, + #superclass : #GtFilterSignal, + #instVars : [ + 'incomingAdditionalFilters', + 'existingAdditionalFilters', + 'usedAdditionalFilters' + ], + #category : #'GToolkit-Coder-StreamingCoders-Signals' +} + +{ #category : #accessing } +GtFilteredCodersModelAdditionalFiltersSignal >> existingAdditionalFilters [ + ^ existingAdditionalFilters +] + +{ #category : #accessing } +GtFilteredCodersModelAdditionalFiltersSignal >> existingAdditionalFilters: anObject [ + existingAdditionalFilters := anObject +] + +{ #category : #'gt - extensions' } +GtFilteredCodersModelAdditionalFiltersSignal >> gtAdditionalFiltersFor: aView [ + + ^ aView columnedList + title: 'Incoming filters'; + priority: -1; + items: [ self incomingAdditionalFilters ]; + column: 'Name' text: #yourself weight: 3; + column: 'Is used' text: [ :aFilter | self usedAdditionalFilters identityIncludes: aFilter ]; + column: 'Previously used' text: [ :aFilter | self existingAdditionalFilters identityIncludes: aFilter ] +] + +{ #category : #'gt - extensions' } +GtFilteredCodersModelAdditionalFiltersSignal >> gtUsedFiltersFor: aView [ + + ^ aView columnedList + title: 'Used filters'; + priority: 0; + items: [ self usedAdditionalFilters ]; + column: 'Name' text: #yourself; + column: 'Is incoming' text: [ :aFilter | self incomingAdditionalFilters identityIncludes: aFilter ] +] + +{ #category : #accessing } +GtFilteredCodersModelAdditionalFiltersSignal >> incomingAdditionalFilters [ + ^ incomingAdditionalFilters ifNil: [ #() ] +] + +{ #category : #accessing } +GtFilteredCodersModelAdditionalFiltersSignal >> incomingAdditionalFilters: anObject [ + incomingAdditionalFilters := anObject +] + +{ #category : #accessing } +GtFilteredCodersModelAdditionalFiltersSignal >> usedAdditionalFilters [ + ^ usedAdditionalFilters ifNil: [ #() ] +] + +{ #category : #accessing } +GtFilteredCodersModelAdditionalFiltersSignal >> usedAdditionalFilters: anObject [ + usedAdditionalFilters := anObject +] diff --git a/src/GToolkit-Coder-UI/GtFilterItemsChangedSignal.class.st b/src/GToolkit-Coder-UI/GtFilterItemsChangedSignal.class.st new file mode 100644 index 000000000..6e957d089 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterItemsChangedSignal.class.st @@ -0,0 +1,53 @@ +Class { + #name : #GtFilterItemsChangedSignal, + #superclass : #GtFilterSignal, + #instVars : [ + 'incomingItems', + 'previousItems' + ], + #category : #'GToolkit-Coder-UI-Filters - Events' +} + +{ #category : #'gt - extensions' } +GtFilterItemsChangedSignal >> gtIncomingItemsFor: aView [ + + ^ aView columnedList + title: 'Incoming items'; + priority: -1; + items: [ self incomingItems ]; + column: 'Name' text: #yourself weight: 4; + column: 'Was used' text: [ :anItem | self previousItems identityIncludes: anItem ]; + column: 'Is similar' text: [ :anItem | self previousItems includes: anItem ] +] + +{ #category : #'gt - extensions' } +GtFilterItemsChangedSignal >> gtPreviousItemsFor: aView [ + + ^ aView columnedList + title: 'Previous items'; + priority: 0; + items: [ self previousItems ]; + column: 'Name' text: #yourself weight: 4; + column: 'Is reused' text: [ :anItem | self incomingItems identityIncludes: anItem ]; + column: 'Is similar' text: [ :anItem | self incomingItems includes: anItem ] +] + +{ #category : #accessing } +GtFilterItemsChangedSignal >> incomingItems [ + ^ incomingItems +] + +{ #category : #accessing } +GtFilterItemsChangedSignal >> incomingItems: anObject [ + incomingItems := anObject +] + +{ #category : #accessing } +GtFilterItemsChangedSignal >> previousItems [ + ^ previousItems +] + +{ #category : #accessing } +GtFilterItemsChangedSignal >> previousItems: anObject [ + previousItems := anObject +] diff --git a/src/GToolkit-Coder-UI/GtFilterItemsModel.class.st b/src/GToolkit-Coder-UI/GtFilterItemsModel.class.st index 1ab7c044e..ebde4f07f 100644 --- a/src/GToolkit-Coder-UI/GtFilterItemsModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterItemsModel.class.st @@ -46,8 +46,16 @@ GtFilterItemsModel >> items [ { #category : #accessing } GtFilterItemsModel >> items: aCollection [ - self items = aCollection ifTrue: [ ^ self ]. - + GtFilterItemsModelComparator new + incomingItems: aCollection; + existingItems: items; + ifEqual: [ ^ self ]. + + GtFilterItemsChangedSignal new + incomingItems: aCollection; + previousItems: items; + emit. + self unsubscribeFromItems. items := aCollection. self subscribeToItems. diff --git a/src/GToolkit-Coder-UI/GtFilterItemsModelComparator.class.st b/src/GToolkit-Coder-UI/GtFilterItemsModelComparator.class.st new file mode 100644 index 000000000..feb6a5cdc --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterItemsModelComparator.class.st @@ -0,0 +1,39 @@ +Class { + #name : #GtFilterItemsModelComparator, + #superclass : #Object, + #instVars : [ + 'incomingItems', + 'existingItems' + ], + #category : #'GToolkit-Coder-UI-Filters - Support' +} + +{ #category : #accessing } +GtFilterItemsModelComparator >> existingItems [ + ^ existingItems +] + +{ #category : #accessing } +GtFilterItemsModelComparator >> existingItems: anObject [ + existingItems := anObject +] + +{ #category : #comparing } +GtFilterItemsModelComparator >> ifEqual: aBlock [ + existingItems size = incomingItems size ifFalse: [ ^ self ]. + + existingItems with: incomingItems do: [ :anExisting :anIncoming | + (anExisting equals: anIncoming) ifFalse: [ ^ self ] ]. + + ^ aBlock value +] + +{ #category : #accessing } +GtFilterItemsModelComparator >> incomingItems [ + ^ incomingItems +] + +{ #category : #accessing } +GtFilterItemsModelComparator >> incomingItems: anObject [ + incomingItems := anObject +] diff --git a/src/GToolkit-Coder-UI/GtFilterModel.class.st b/src/GToolkit-Coder-UI/GtFilterModel.class.st index 0ec4f9fe8..09d0dfd0b 100644 --- a/src/GToolkit-Coder-UI/GtFilterModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModel.class.st @@ -14,6 +14,9 @@ Class { { #category : #comparing } GtFilterModel >> = anObject [ + "I compare similarity of two filter models. + I must not compare selected items. For such cases, use #equals:." + self == anObject ifTrue: [ ^ true ]. ^ self class = anObject class @@ -65,6 +68,13 @@ GtFilterModel >> defaultFilterOrder [ ^ 50 ] +{ #category : #comparing } +GtFilterModel >> equals: anObject [ + self = anObject ifFalse: [ ^ false ]. + + ^ self selectedValue = anObject selectedValue +] + { #category : #accessing } GtFilterModel >> filterViewModelClass [ @@ -131,7 +141,7 @@ GtFilterModel >> printDetailsOn: aStream [ aStream nextPutAll: self label asString; nextPutAll: ': '; - print: (self selectedValue ifNotNil: #itemValue); + print: (self selectedValue ifNotNil: [ :aValue | aValue asFilterModelItem itemValue ]); nextPutAll: ', order: '; print: self order ] diff --git a/src/GToolkit-Coder-UI/GtFilterModelMethodDefinitionItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelMethodDefinitionItem.class.st index 162628a0d..63f13f114 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelMethodDefinitionItem.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelMethodDefinitionItem.class.st @@ -1,6 +1,8 @@ Class { #name : #GtFilterModelMethodDefinitionItem, #superclass : #GtFilterModelItem, + #traits : 'TGtUniqueInstance', + #classTraits : 'TGtUniqueInstance classTrait', #category : #'GToolkit-Coder-UI-Filters - Models' } diff --git a/src/GToolkit-Coder-UI/GtFilterModelMethodOriginItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelMethodOriginItem.class.st index eb8f31fe7..d6a0b90c8 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelMethodOriginItem.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelMethodOriginItem.class.st @@ -1,6 +1,8 @@ Class { #name : #GtFilterModelMethodOriginItem, #superclass : #GtFilterModelItem, + #traits : 'TGtUniqueInstance', + #classTraits : 'TGtUniqueInstance classTrait', #category : #'GToolkit-Coder-UI-Filters - Models' } diff --git a/src/GToolkit-Coder-UI/GtFilterModelSideItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelSideItem.class.st index 0957046a4..8d1f78f11 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelSideItem.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelSideItem.class.st @@ -1,6 +1,8 @@ Class { #name : #GtFilterModelSideItem, #superclass : #GtFilterModelItem, + #traits : 'TGtUniqueInstance', + #classTraits : 'TGtUniqueInstance classTrait', #category : #'GToolkit-Coder-UI-Filters - Models' } diff --git a/src/GToolkit-Coder-UI/GtFilterTextModel.class.st b/src/GToolkit-Coder-UI/GtFilterTextModel.class.st index 4d8acb6c3..123153389 100644 --- a/src/GToolkit-Coder-UI/GtFilterTextModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTextModel.class.st @@ -83,6 +83,7 @@ GtFilterTextModel >> text [ { #category : #accessing } GtFilterTextModel >> text: aText [ | aNewText | + aText ifNil: [ ^ self ]. aNewText := aText asRopedText. (self text equals: aNewText) ifTrue: [ ^ self ]. diff --git a/src/GToolkit-Coder-UI/GtSubstringFilter.extension.st b/src/GToolkit-Coder-UI/GtSubstringFilter.extension.st new file mode 100644 index 000000000..e6da74d71 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSubstringFilter.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #GtSubstringFilter } + +{ #category : #'*GToolkit-Coder-UI' } +GtSubstringFilter >> filterDescriptor2For: aMethodsCoder [ + ^ (super filterDescriptor2For: aMethodsCoder) + ifNotNil: [ :aFilterModel | aFilterModel text: self substring ] +] diff --git a/src/GToolkit-Coder-UI/UndefinedObject.extension.st b/src/GToolkit-Coder-UI/UndefinedObject.extension.st new file mode 100644 index 000000000..5cbef537a --- /dev/null +++ b/src/GToolkit-Coder-UI/UndefinedObject.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #UndefinedObject } + +{ #category : #'*GToolkit-Coder-UI' } +UndefinedObject >> asFilterModelItem [ + ^ GtFilterModelNoItem default +] diff --git a/src/GToolkit-SearchFilters/GtSearchFilter.class.st b/src/GToolkit-SearchFilters/GtSearchFilter.class.st index 90ab80557..20c887785 100644 --- a/src/GToolkit-SearchFilters/GtSearchFilter.class.st +++ b/src/GToolkit-SearchFilters/GtSearchFilter.class.st @@ -39,6 +39,13 @@ GtSearchFilter >> - aFilter [ ^ GtSearchDisjunctionFilter forFilter: self filter: aFilter ] +{ #category : #comparing } +GtSearchFilter >> = anObject [ + self == anObject ifTrue: [ ^ true ]. + + ^ self class = anObject class +] + { #category : #evaluating } GtSearchFilter >> applyInScope: aStream [ ^ self resultType new @@ -88,6 +95,11 @@ GtSearchFilter >> filterValueString [ ^ nil ] +{ #category : #comparing } +GtSearchFilter >> hash [ + ^ self class hash +] + { #category : #testing } GtSearchFilter >> isEmpty [ ^ self notEmpty not From 578d94135f31ef4a0aab08623f38a4e70b1629a6 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 8 Oct 2024 21:48:40 -0300 Subject: [PATCH 0708/1268] remove a signal [feenkcom/gtoolkit#3983] --- .../GtFilteredCodersModel.class.st | 7 +-- ...odersModelAdditionalFiltersSignal.class.st | 63 ------------------- 2 files changed, 1 insertion(+), 69 deletions(-) delete mode 100644 src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModelAdditionalFiltersSignal.class.st diff --git a/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st b/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st index fa39b0d72..f92faa249 100644 --- a/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st +++ b/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st @@ -44,20 +44,15 @@ GtFilteredCodersModel >> additionalFilters [ { #category : #'api - accessing' } GtFilteredCodersModel >> additionalFilters: aCollectionOfFilters [ - | aSignal aNewCollection | + | aNewCollection | aNewCollection := aCollectionOfFilters asArray. additionalFilters = aNewCollection ifTrue: [ ^ self ]. - aSignal := GtFilteredCodersModelAdditionalFiltersSignal new - incomingAdditionalFilters: aCollectionOfFilters; - existingAdditionalFilters: additionalFilters; - emit. monitor critical: [ additionalFilters := aNewCollection. compositeFilter := self createCombinedFilterFor: filter andAdditionalFilters: additionalFilters. self refreshItemsStreamDueTo: GtFilteredCodersAdditionalFiltersReason new ]. - aSignal usedAdditionalFilters: additionalFilters. ] { #category : #'api - accessing' } diff --git a/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModelAdditionalFiltersSignal.class.st b/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModelAdditionalFiltersSignal.class.st deleted file mode 100644 index bfa86145f..000000000 --- a/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModelAdditionalFiltersSignal.class.st +++ /dev/null @@ -1,63 +0,0 @@ -Class { - #name : #GtFilteredCodersModelAdditionalFiltersSignal, - #superclass : #GtFilterSignal, - #instVars : [ - 'incomingAdditionalFilters', - 'existingAdditionalFilters', - 'usedAdditionalFilters' - ], - #category : #'GToolkit-Coder-StreamingCoders-Signals' -} - -{ #category : #accessing } -GtFilteredCodersModelAdditionalFiltersSignal >> existingAdditionalFilters [ - ^ existingAdditionalFilters -] - -{ #category : #accessing } -GtFilteredCodersModelAdditionalFiltersSignal >> existingAdditionalFilters: anObject [ - existingAdditionalFilters := anObject -] - -{ #category : #'gt - extensions' } -GtFilteredCodersModelAdditionalFiltersSignal >> gtAdditionalFiltersFor: aView [ - - ^ aView columnedList - title: 'Incoming filters'; - priority: -1; - items: [ self incomingAdditionalFilters ]; - column: 'Name' text: #yourself weight: 3; - column: 'Is used' text: [ :aFilter | self usedAdditionalFilters identityIncludes: aFilter ]; - column: 'Previously used' text: [ :aFilter | self existingAdditionalFilters identityIncludes: aFilter ] -] - -{ #category : #'gt - extensions' } -GtFilteredCodersModelAdditionalFiltersSignal >> gtUsedFiltersFor: aView [ - - ^ aView columnedList - title: 'Used filters'; - priority: 0; - items: [ self usedAdditionalFilters ]; - column: 'Name' text: #yourself; - column: 'Is incoming' text: [ :aFilter | self incomingAdditionalFilters identityIncludes: aFilter ] -] - -{ #category : #accessing } -GtFilteredCodersModelAdditionalFiltersSignal >> incomingAdditionalFilters [ - ^ incomingAdditionalFilters ifNil: [ #() ] -] - -{ #category : #accessing } -GtFilteredCodersModelAdditionalFiltersSignal >> incomingAdditionalFilters: anObject [ - incomingAdditionalFilters := anObject -] - -{ #category : #accessing } -GtFilteredCodersModelAdditionalFiltersSignal >> usedAdditionalFilters [ - ^ usedAdditionalFilters ifNil: [ #() ] -] - -{ #category : #accessing } -GtFilteredCodersModelAdditionalFiltersSignal >> usedAdditionalFilters: anObject [ - usedAdditionalFilters := anObject -] From 24d747c6edbd13e3abaf6fb90ebb0c29c3e1a17f Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 8 Oct 2024 22:08:04 -0300 Subject: [PATCH 0709/1268] more top space for filter remove buttons [feenkcom/gtoolkit#3983] --- src/GToolkit-Coder-UI/GtFilterItemsElement.class.st | 2 +- src/GToolkit-Coder-UI/GtFilterNameElement.class.st | 1 - .../GtFilterShortListSettingsElement.class.st | 2 ++ src/GToolkit-Coder-UI/GtSubstringFilter.extension.st | 7 ------- 4 files changed, 3 insertions(+), 9 deletions(-) delete mode 100644 src/GToolkit-Coder-UI/GtSubstringFilter.extension.st diff --git a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st index 65b5e9cb7..45105210b 100644 --- a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st @@ -119,7 +119,7 @@ GtFilterItemsElement >> initialize [ super initialize. self hFitContentLimited. self vFitContent. - self padding: (BlInsets all: 2). + self padding: (BlInsets top: 5 right: 2 bottom: 2 left: 1). self clipChildren: false. self initializeEventHandlers. ] diff --git a/src/GToolkit-Coder-UI/GtFilterNameElement.class.st b/src/GToolkit-Coder-UI/GtFilterNameElement.class.st index 9fe8d91da..369d84333 100644 --- a/src/GToolkit-Coder-UI/GtFilterNameElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterNameElement.class.st @@ -58,7 +58,6 @@ GtFilterNameElement >> initializeLabelElement [ { #category : #initialization } GtFilterNameElement >> initializeSettingsContainer [ settingsContainer := BrFrame new - background: self theme default contentBackgroundColor; hFitContentLimited; vFitContent; margin: (BlInsets all: 2); diff --git a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st index 09878ca36..b1832e333 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st @@ -119,6 +119,8 @@ GtFilterShortListSettingsElement >> newItemElement [ aptitude: BrGlamorousButtonRectangularAptitude; addAptitude: BrGlamorousButtonIconAptitude; addAptitude: BrGlamorousButtonLabelAptitude; + hMatchParent; + alignCenterLeft; label: 'item'; action: [ :aButton | self onItemClick: aButton ] ] diff --git a/src/GToolkit-Coder-UI/GtSubstringFilter.extension.st b/src/GToolkit-Coder-UI/GtSubstringFilter.extension.st deleted file mode 100644 index e6da74d71..000000000 --- a/src/GToolkit-Coder-UI/GtSubstringFilter.extension.st +++ /dev/null @@ -1,7 +0,0 @@ -Extension { #name : #GtSubstringFilter } - -{ #category : #'*GToolkit-Coder-UI' } -GtSubstringFilter >> filterDescriptor2For: aMethodsCoder [ - ^ (super filterDescriptor2For: aMethodsCoder) - ifNotNil: [ :aFilterModel | aFilterModel text: self substring ] -] From 37c036447d699a12c5ac35558b7f88439f51c78f Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 8 Oct 2024 22:35:31 -0300 Subject: [PATCH 0710/1268] enqueue click actions [feenkcom/gtoolkit#3983] --- .../GtFilterShortListSettingsElement.class.st | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st index b1832e333..0405b1f22 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st @@ -134,9 +134,12 @@ GtFilterShortListSettingsElement >> onFilterViewModelChanged [ { #category : #'event handling' } GtFilterShortListSettingsElement >> onItemClick: aButton [ self hasFilterViewModel ifFalse: [ ^ self ]. - aButton fireEvent: BrDropdownHideWish new. - - self filterViewModel selectedItem: aButton model + BlTaskAction + enqueueElement: self + action: [ aButton fireEvent: BrDropdownHideWish new ]. + BlTaskAction + enqueueElement: self + action: [ self filterViewModel selectedItem: aButton model ] ] { #category : #'event handling' } From 0263c695308616b7a5a9b933353adf022e52faf2 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 9 Oct 2024 11:50:07 -0300 Subject: [PATCH 0711/1268] Short list filter element can pick dropdown items using keyboard keys [feenkcom/gtoolkit#3983] --- .../GtFilterItemsElement.class.st | 65 +++++++++++-------- .../GtFilterItemsModel.class.st | 3 +- .../GtFilterShortListSettingsElement.class.st | 37 ++++++++++- 3 files changed, 76 insertions(+), 29 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st index 45105210b..78c87fc24 100644 --- a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st @@ -81,32 +81,41 @@ GtFilterItemsElement >> createDropdownContent [ ^ BrSimpleList new vFitContentLimited; hFitContentLimited; - constraintsDo: [ :c | - c maxHeight: 200 ]; - stencil: [ :eachFilterModel :eachIndex | - BrHorizontalPane new - id: (GtFilterItemId indexed: eachIndex); - hMatchParent; - vFitContent; - padding: (BlInsets all: 5); - addAptitude: (BrStyleCommonAptitude new - default: [ :s | s background: Color transparent ]; - hovered: [ :s | s background: self theme button defaultBorderColor ]; - yourself); - when: BlClickEvent - do: [ :anEvent | - anEvent consumed: true. - anEvent currentTarget fireEvent: BrDropdownHideWish new. - self requestAddFilterModel: eachFilterModel ]; - addChild: (BrLabel new - aptitude: BrGlamorousLabelAptitude new glamorousRegularFont glamorousCodeSmallSize; - text: eachFilterModel label; - yourself); - yourself ]; - items: (self hasFiltersViewModel - ifTrue: [ self filtersViewModel availableFilters ] - ifFalse: [ #() ]); - yourself + constraintsDo: [ :c | c maxHeight: 200 ]; + itemStencil: [ self createItemElement ]; + itemDataBinder: [ :anItemElement :anItemObject :anItemIndex | + anItemElement id: (GtFilterItemId indexed: anItemIndex). + anItemElement userData at: GtFilterModel put: anItemObject. + (anItemElement childAt: 1) text: anItemObject label. + anItemElement ]; + itemDataUnbinder: [ :anItemElement :anItemObject :anItemIndex | + anItemElement id: nil. + anItemElement userData removeKey: GtFilterModel ifAbsent: [ "ignore" ]. + (anItemElement childAt: 1) text: ''. + anItemElement ]; + items: (self hasFiltersViewModel + ifTrue: [ self filtersViewModel availableFilters ] + ifFalse: [ #() ]) +] + +{ #category : #'private - updating' } +GtFilterItemsElement >> createItemElement [ + ^ BrHorizontalPane new + hMatchParent; + vFitContent; + padding: (BlInsets all: 5); + addAptitude: (BrStyleCommonAptitude new + default: [ :s | s background: Color transparent ]; + hovered: [ :s | s background: self theme button defaultBorderColor ]); + when: BlClickEvent + do: [ :anEvent | + | aModel | + anEvent consumed: true. + anEvent currentTarget fireEvent: BrDropdownHideWish new. + aModel := anEvent currentTarget userData at: GtFilterModel ifAbsent: [ nil ]. + self requestAddFilterModel: aModel ]; + addChild: (BrLabel new + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont glamorousCodeSmallSize) ] { #category : #initialization } @@ -149,7 +158,8 @@ GtFilterItemsElement >> newAddFilterButton [ aStyle border: (BlBorder paint: self theme editor focusedBorderColor width: 1) ]); addAptitude: (BrGlamorousWithDropdownAptitude handle: [ self newAddFilterHandleElement ] - content: [ self createDropdownContent ]); + content: [ self createDropdownContent ]) + beNotResizable; margin: (BlInsets left: 2); constraintsDo: [ :c | c flow vertical alignCenter ]; beFocusable; @@ -211,6 +221,7 @@ GtFilterItemsElement >> onRemoveFilterViewModelWish: anEvent [ { #category : #'event handling' } GtFilterItemsElement >> requestAddFilterModel: aFilterModel [ + aFilterModel ifNil: [ ^ self ]. self hasFiltersViewModel ifFalse: [ ^ self ]. self filtersViewModel addFilterModel: aFilterModel diff --git a/src/GToolkit-Coder-UI/GtFilterItemsModel.class.st b/src/GToolkit-Coder-UI/GtFilterItemsModel.class.st index ebde4f07f..d32c3ee6b 100644 --- a/src/GToolkit-Coder-UI/GtFilterItemsModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterItemsModel.class.st @@ -87,7 +87,8 @@ GtFilterItemsModel >> onFilterModelAnnouncement: anAnnouncement [ { #category : #'add / remove' } GtFilterItemsModel >> removeFilterModel: aFilterModel [ self unsubscribeFromItem: aFilterModel. - self items: (self items copyWithout: aFilterModel) + + self items: (self items reject: [ :each | each == aFilterModel ]) ] { #category : #private } diff --git a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st index 0405b1f22..9eee3952e 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st @@ -20,6 +20,13 @@ GtFilterShortListSettingsElement >> defaultItemLabel [ ^ '' ] +{ #category : #'event handling' } +GtFilterShortListSettingsElement >> focusFirstItemElementInList: aListElement [ + aListElement requestFocus. + aListElement selectFirst. + aListElement scrollToSelection +] + { #category : #initialization } GtFilterShortListSettingsElement >> handleElementDo: aBlock [ (handleElement at: 1) ifNotNil: aBlock @@ -87,7 +94,14 @@ GtFilterShortListSettingsElement >> newContentElement [ label: self defaultItemLabel; icon: self defaultItemIcon; id: nil; - model: nil ]. + model: nil ]; + when: BlElementAddedToSceneGraphEvent + do: [ :anEvent | self onListElementAddedToSceneGraph: anEvent ]; + addShortcut: (BlShortcutWithAction new + name: 'Pick selected filter item'; + description: 'Pick selected item as the filter selected item'; + combination: BlKeyCombination builder enter build; + action: [ :aShortcutEvent :aShortcut | self pickSelectedItem: aShortcutEvent ]). self updateListElement: aListElement. listElement at: 1 put: aListElement. @@ -147,11 +161,32 @@ GtFilterShortListSettingsElement >> onItemsChanged: anAnnouncement [ BlTaskAction enqueueElement: self action: [ self updateElement ] ] +{ #category : #'event handling' } +GtFilterShortListSettingsElement >> onListElementAddedToSceneGraph: anEvent [ + BlTaskAction + enqueueElement: anEvent currentTarget + action: [ self focusFirstItemElementInList: anEvent currentTarget ] +] + { #category : #'event handling' } GtFilterShortListSettingsElement >> onSelectedItemChanged: anAnnouncement [ BlTaskAction enqueueElement: self action: [ self updateElement ] ] +{ #category : #'event handling' } +GtFilterShortListSettingsElement >> pickSelectedItem: aShortcutEvent [ + | anElementList | + anElementList := aShortcutEvent currentTarget. + anElementList + selectedItemDo: [ :anItem :anIndex | + BlTaskAction + enqueueElement: self + action: [ anElementList fireEvent: BrDropdownHideWish new ]. + BlTaskAction + enqueueElement: self + action: [ self filterViewModel selectedItem: anItem ] ] +] + { #category : #'api - filter view model' } GtFilterShortListSettingsElement >> subscribeToFilterViewModel [ super subscribeToFilterViewModel. From b5ee7354b730063e034831150b8adea1036b45c4 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 9 Oct 2024 12:10:55 -0300 Subject: [PATCH 0712/1268] Short list filter element selects mouse-hovered items [feenkcom/gtoolkit#3983] --- .../GtFilterShortListSettingsElement.class.st | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st index 9eee3952e..0cc68e103 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st @@ -136,7 +136,9 @@ GtFilterShortListSettingsElement >> newItemElement [ hMatchParent; alignCenterLeft; label: 'item'; - action: [ :aButton | self onItemClick: aButton ] + action: [ :aButton | self onItemClick: aButton ]; + when: BlMouseEnterEvent + do: [ :anEvent | self onItemMouseEnterEvent: anEvent ] ] { #category : #'api - filter view model' } @@ -156,6 +158,21 @@ GtFilterShortListSettingsElement >> onItemClick: aButton [ action: [ self filterViewModel selectedItem: aButton model ] ] +{ #category : #'event handling' } +GtFilterShortListSettingsElement >> onItemMouseEnterEvent: anEvent [ + "Select the hovered item" + + | aButton aFilterItem | + aButton := anEvent currentTarget. + aFilterItem := aButton model. + aFilterItem ifNil: [ ^ self ]. + self + listElementDo: [ :aListElement | + aListElement + itemSuchThat: [ :eachItem | eachItem == aFilterItem ] + do: [ :anIndex | aListElement selectOne: anIndex ] ] +] + { #category : #'event handling' } GtFilterShortListSettingsElement >> onItemsChanged: anAnnouncement [ BlTaskAction enqueueElement: self action: [ self updateElement ] From bc08ddef1113d54e675de0c5d792fdddcc29520d Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 9 Oct 2024 15:08:37 -0300 Subject: [PATCH 0713/1268] Add new filter dropdown items can be selected using keyboard keys [feenkcom/gtoolkit#3983] --- .../GtFilterItemsElement.class.st | 86 ++++++++++++++++--- .../GtFilterShortListSettingsElement.class.st | 20 ++--- 2 files changed, 81 insertions(+), 25 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st index 78c87fc24..cd4389506 100644 --- a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st @@ -78,11 +78,13 @@ GtFilterItemsElement >> addRemoveButtonIconTo: anElement [ { #category : #'private - updating' } GtFilterItemsElement >> createDropdownContent [ - ^ BrSimpleList new + | aListElement | + aListElement := BrSimpleList new. + ^ aListElement vFitContentLimited; hFitContentLimited; - constraintsDo: [ :c | c maxHeight: 200 ]; - itemStencil: [ self createItemElement ]; + constraintsDo: [ :c | c maxHeight: 100 ]; + itemStencil: [ :anItemType | self createItemElementForListElement: aListElement ]; itemDataBinder: [ :anItemElement :anItemObject :anItemIndex | anItemElement id: (GtFilterItemId indexed: anItemIndex). anItemElement userData at: GtFilterModel put: anItemObject. @@ -95,27 +97,35 @@ GtFilterItemsElement >> createDropdownContent [ anItemElement ]; items: (self hasFiltersViewModel ifTrue: [ self filtersViewModel availableFilters ] - ifFalse: [ #() ]) + ifFalse: [ #() ]); + when: BlElementAddedToSceneGraphEvent + do: [ :anEvent | self onListElementAddedToSceneGraph: anEvent ]; + addShortcut: (BlShortcutWithAction new + name: 'Add selected filter'; + description: 'Add selected filter'; + combination: BlKeyCombination builder enter build; + action: [ :aShortcutEvent :aShortcut | self onAddSelectedItemEvent: aShortcutEvent ]) ] { #category : #'private - updating' } -GtFilterItemsElement >> createItemElement [ +GtFilterItemsElement >> createItemElementForListElement: aListElement [ + self + assert: [ aListElement isNotNil ] + description: [ 'List element must be non-nil' ]. + ^ BrHorizontalPane new hMatchParent; vFitContent; padding: (BlInsets all: 5); addAptitude: (BrStyleCommonAptitude new default: [ :s | s background: Color transparent ]; - hovered: [ :s | s background: self theme button defaultBorderColor ]); - when: BlClickEvent - do: [ :anEvent | - | aModel | - anEvent consumed: true. - anEvent currentTarget fireEvent: BrDropdownHideWish new. - aModel := anEvent currentTarget userData at: GtFilterModel ifAbsent: [ nil ]. - self requestAddFilterModel: aModel ]; + hovered: [ :s | s background: self theme button defaultBorderColor ]; + selected: [ :s | s background: self theme button defaultBorderColor ]); addChild: (BrLabel new - aptitude: BrGlamorousLabelAptitude new glamorousRegularFont glamorousCodeSmallSize) + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont glamorousCodeSmallSize); + when: BlClickEvent do: [ :anEvent | self onItemMouseClickEvent: anEvent ]; + when: BlMouseEnterEvent + do: [ :anEvent | self onItemMouseEnterEvent: anEvent listElement: aListElement ] ] { #category : #initialization } @@ -123,6 +133,13 @@ GtFilterItemsElement >> defaultLayout [ ^ BlFlowLayout horizontal ] +{ #category : #'event handling' } +GtFilterItemsElement >> focusFirstItemElementInList: aListElement [ + aListElement requestFocus. + aListElement selectFirst. + aListElement scrollToSelection +] + { #category : #initialization } GtFilterItemsElement >> initialize [ super initialize. @@ -193,16 +210,57 @@ GtFilterItemsElement >> newRemoveButton [ c ignored vertical alignCenterAt: 0.0 ] ] +{ #category : #'event handling' } +GtFilterItemsElement >> onAddSelectedItemEvent: aShortcutEvent [ + | anElementList | + anElementList := aShortcutEvent currentTarget. + anElementList + selectedItemDo: [ :aFilterModel :anIndex | + BlTaskAction + enqueueElement: self + action: [ anElementList fireEvent: BrDropdownHideWish new ]. + BlTaskAction + enqueueElement: self + action: [ self requestAddFilterModel: aFilterModel ] ] +] + { #category : #'api - filter view model' } GtFilterItemsElement >> onFiltersViewModelChanged [ self updateItemsElement ] +{ #category : #'event handling' } +GtFilterItemsElement >> onItemMouseClickEvent: anEvent [ + | aModel | + anEvent consumed: true. + anEvent currentTarget fireEvent: BrDropdownHideWish new. + aModel := anEvent currentTarget userData at: GtFilterModel ifAbsent: [ nil ]. + self requestAddFilterModel: aModel +] + +{ #category : #'event handling' } +GtFilterItemsElement >> onItemMouseEnterEvent: anEvent listElement: aListElement [ + "Select the hovered item" + + | anItemElement aFilter | + anItemElement := anEvent currentTarget. + aFilter := anItemElement userData at: GtFilterModel ifAbsent: [ nil ]. + aFilter ifNil: [ ^ self ]. + aListElement + itemSuchThat: [ :eachItem | eachItem == aFilter ] + do: [ :anIndex | aListElement selectOne: anIndex ] +] + { #category : #'event handling' } GtFilterItemsElement >> onItemsChanged: anAnnouncement [ BlTaskAction enqueueElement: self action: [ self updateItemsElement ] ] +{ #category : #'event handling' } +GtFilterItemsElement >> onListElementAddedToSceneGraph: anEvent [ + self focusFirstItemElementInList: anEvent currentTarget +] + { #category : #'private - updating' } GtFilterItemsElement >> onRemoveFilterViewModelOfElement: anElement from: aButton [ anElement hasFilterViewModel ifFalse: [ ^ self ]. diff --git a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st index 0cc68e103..8a04cdbed 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st @@ -58,7 +58,7 @@ GtFilterShortListSettingsElement >> initializeDropdownAptitude [ buttonAptitude beNotResizable. ] -{ #category : #initialization } +{ #category : #accessing } GtFilterShortListSettingsElement >> listElementDo: aBlock [ (listElement at: 1) ifNotNil: aBlock ] @@ -101,7 +101,7 @@ GtFilterShortListSettingsElement >> newContentElement [ name: 'Pick selected filter item'; description: 'Pick selected item as the filter selected item'; combination: BlKeyCombination builder enter build; - action: [ :aShortcutEvent :aShortcut | self pickSelectedItem: aShortcutEvent ]). + action: [ :aShortcutEvent :aShortcut | self onPickSelectedItemEvent: aShortcutEvent ]). self updateListElement: aListElement. listElement at: 1 put: aListElement. @@ -180,18 +180,11 @@ GtFilterShortListSettingsElement >> onItemsChanged: anAnnouncement [ { #category : #'event handling' } GtFilterShortListSettingsElement >> onListElementAddedToSceneGraph: anEvent [ - BlTaskAction - enqueueElement: anEvent currentTarget - action: [ self focusFirstItemElementInList: anEvent currentTarget ] -] - -{ #category : #'event handling' } -GtFilterShortListSettingsElement >> onSelectedItemChanged: anAnnouncement [ - BlTaskAction enqueueElement: self action: [ self updateElement ] + self focusFirstItemElementInList: anEvent currentTarget ] { #category : #'event handling' } -GtFilterShortListSettingsElement >> pickSelectedItem: aShortcutEvent [ +GtFilterShortListSettingsElement >> onPickSelectedItemEvent: aShortcutEvent [ | anElementList | anElementList := aShortcutEvent currentTarget. anElementList @@ -204,6 +197,11 @@ GtFilterShortListSettingsElement >> pickSelectedItem: aShortcutEvent [ action: [ self filterViewModel selectedItem: anItem ] ] ] +{ #category : #'event handling' } +GtFilterShortListSettingsElement >> onSelectedItemChanged: anAnnouncement [ + BlTaskAction enqueueElement: self action: [ self updateElement ] +] + { #category : #'api - filter view model' } GtFilterShortListSettingsElement >> subscribeToFilterViewModel [ super subscribeToFilterViewModel. From 68bf860182e98438c9cb604133680b74296d9d73 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 9 Oct 2024 16:46:15 -0300 Subject: [PATCH 0714/1268] focus newly added filter element [feenkcom/gtoolkit#3983] remove the previous filter element on filter removal --- .../GtFilterItemsElement.class.st | 69 ++++++++++++++++++- .../GtFilterItemsModel.class.st | 51 +++++++++++++- .../GtFiltersItemsViewModel.class.st | 45 ++++++++++-- .../GtFiltersModelItemAdded.class.st | 18 +++++ .../GtFiltersModelItemRemoved.class.st | 18 +++++ .../GtFiltersViewModel.class.st | 1 - .../GtFiltersViewModelItemAdded.class.st | 18 +++++ .../GtFiltersViewModelItemRemoved.class.st | 18 +++++ 8 files changed, 224 insertions(+), 14 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtFiltersModelItemAdded.class.st create mode 100644 src/GToolkit-Coder-UI/GtFiltersModelItemRemoved.class.st create mode 100644 src/GToolkit-Coder-UI/GtFiltersViewModelItemAdded.class.st create mode 100644 src/GToolkit-Coder-UI/GtFiltersViewModelItemRemoved.class.st diff --git a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st index cd4389506..47b284335 100644 --- a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st @@ -20,7 +20,20 @@ GtFilterItemsElement >> addElementForFilterViewModel: aFilterViewModel index: an self addNavigationShortcutsTo: anElement. self addRemoveButtonIconTo: anElement. - self addChild: anElement + self addChild: anElement at: anIndex. + + ^ anElement +] + +{ #category : #'private - updating' } +GtFilterItemsElement >> addItemElementForViewModel: aFilterViewModel [ + | anIndex anElement | + anIndex := self filtersViewModel items + detectIndex: [ :each | each == aFilterViewModel ] + ifNone: [ ^ self ]. + + anElement := self addElementForFilterViewModel: aFilterViewModel index: anIndex. + anElement requestFocus ] { #category : #'private - updating' } @@ -229,6 +242,13 @@ GtFilterItemsElement >> onFiltersViewModelChanged [ self updateItemsElement ] +{ #category : #'event handling' } +GtFilterItemsElement >> onItemAdded: anAnnouncement [ + BlTaskAction + enqueueElement: self + action: [ self addItemElementForViewModel: anAnnouncement item ] +] + { #category : #'event handling' } GtFilterItemsElement >> onItemMouseClickEvent: anEvent [ | aModel | @@ -251,6 +271,13 @@ GtFilterItemsElement >> onItemMouseEnterEvent: anEvent listElement: aListElement do: [ :anIndex | aListElement selectOne: anIndex ] ] +{ #category : #'event handling' } +GtFilterItemsElement >> onItemRemoved: anAnnouncement [ + BlTaskAction + enqueueElement: self + action: [ self removeItemElementForViewModel: anAnnouncement item ] +] + { #category : #'event handling' } GtFilterItemsElement >> onItemsChanged: anAnnouncement [ BlTaskAction enqueueElement: self action: [ self updateItemsElement ] @@ -277,6 +304,28 @@ GtFilterItemsElement >> onRemoveFilterViewModelWish: anEvent [ self filtersViewModel removeFilterViewModel: anEvent filterViewModel ] +{ #category : #'private - updating' } +GtFilterItemsElement >> removeItemElementForViewModel: aFilterViewModel [ + | aChildToFocus | + aChildToFocus := nil. + self + childrenDo: [ :aChild | + ((aChild id = GtFiltersAddButtonId uniqueInstance) not + and: [ aChild filterViewModel == aFilterViewModel ]) + ifTrue: [ | isChildFocused | + isChildFocused := aChild isFocused. + aChild removeFromParent. + isChildFocused + ifTrue: [ aChildToFocus + ifNotNil: [ aChildToFocus requestFocus ] + ifNil: [ self + childrenDo: [ :anotherChild | + anotherChild requestFocus. + ^ self ] ] ]. + ^ self ]. + aChildToFocus := aChild ] +] + { #category : #'event handling' } GtFilterItemsElement >> requestAddFilterModel: aFilterModel [ aFilterModel ifNil: [ ^ self ]. @@ -289,8 +338,14 @@ GtFilterItemsElement >> requestAddFilterModel: aFilterModel [ GtFilterItemsElement >> subscribeToFiltersViewModel [ self filtersViewModel weak when: GtFiltersViewModelItemsChanged - send: #onItemsChanged: - to: self + send: #onItemsChanged: + to: self; + when: GtFiltersViewModelItemAdded + send: #onItemAdded: + to: self; + when: GtFiltersViewModelItemRemoved + send: #onItemRemoved: + to: self ] { #category : #'api - filter view model' } @@ -305,3 +360,11 @@ GtFilterItemsElement >> updateItemsElement [ self addElementForFilterViewModel: eachFilterViewModel index: anIndex ]. self addNewFilterElement ] + +{ #category : #'private - updating' } +GtFilterItemsElement >> updateItemsElementDueTo: aReason [ + self removeChildren. + self filtersViewModel items withIndexDo: [ :eachFilterViewModel :anIndex | + self addElementForFilterViewModel: eachFilterViewModel index: anIndex ]. + self addNewFilterElement +] diff --git a/src/GToolkit-Coder-UI/GtFilterItemsModel.class.st b/src/GToolkit-Coder-UI/GtFilterItemsModel.class.st index d32c3ee6b..4bc51c387 100644 --- a/src/GToolkit-Coder-UI/GtFilterItemsModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterItemsModel.class.st @@ -9,7 +9,22 @@ Class { { #category : #'add / remove' } GtFilterItemsModel >> addFilterModel: aFilterModel [ - self items: (self items copyWith: aFilterModel) + | aCollection | + self + assert: [ (self items identityIncludes: aFilterModel) not ] + description: [ 'Filter model can be added only once: {1}' format: {aFilterModel} ]. + + aCollection := (self items copyWith: aFilterModel). + + GtFilterItemsChangedSignal new + incomingItems: aCollection; + previousItems: items; + emit. + + items := aCollection. + self subscribeToItem: aFilterModel. + self notifyItemAdded: aFilterModel. + self notifyFiltersUpdated. ] { #category : #accessing } @@ -68,6 +83,22 @@ GtFilterItemsModel >> notifyFiltersUpdated [ self announce: (GtFiltersModelUpdated new model: self) ] +{ #category : #'private - notifying' } +GtFilterItemsModel >> notifyItemAdded: aFilterModel [ + self + announce: (GtFiltersModelItemAdded new + model: self; + item: aFilterModel) +] + +{ #category : #'private - notifying' } +GtFilterItemsModel >> notifyItemRemoved: aFilterModel [ + self + announce: (GtFiltersModelItemRemoved new + model: self; + item: aFilterModel) +] + { #category : #'private - notifying' } GtFilterItemsModel >> notifyItemsChanged [ self @@ -86,9 +117,23 @@ GtFilterItemsModel >> onFilterModelAnnouncement: anAnnouncement [ { #category : #'add / remove' } GtFilterItemsModel >> removeFilterModel: aFilterModel [ - self unsubscribeFromItem: aFilterModel. + | aCollection | + self + assert: [ self items identityIncludes: aFilterModel ] + description: [ 'Filter model is missing and therefore cannot be removed: {1}' + format: {aFilterModel} ]. + + aCollection := self items reject: [ :each | each == aFilterModel ]. - self items: (self items reject: [ :each | each == aFilterModel ]) + GtFilterItemsChangedSignal new + incomingItems: aCollection; + previousItems: items; + emit. + + self unsubscribeFromItem: aFilterModel. + items := aCollection. + self notifyItemRemoved: aFilterModel. + self notifyFiltersUpdated. ] { #category : #private } diff --git a/src/GToolkit-Coder-UI/GtFiltersItemsViewModel.class.st b/src/GToolkit-Coder-UI/GtFiltersItemsViewModel.class.st index d3d06d12c..d1a28a7cd 100644 --- a/src/GToolkit-Coder-UI/GtFiltersItemsViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtFiltersItemsViewModel.class.st @@ -16,6 +16,27 @@ GtFiltersItemsViewModel >> items [ self ensureFilterViewModelFor: eachFilterModel ] ] +{ #category : #'api - filter model' } +GtFiltersItemsViewModel >> onItemAdded: anAnnouncement [ + | aViewModel | + aViewModel := self ensureFilterViewModelFor: anAnnouncement item. + self + announce: (GtFiltersViewModelItemAdded new + viewModel: self; + item: aViewModel) +] + +{ #category : #'api - filter model' } +GtFiltersItemsViewModel >> onItemRemoved: anAnnouncement [ + | aViewModel | + aViewModel := self removeOldFilterViewModelFor: anAnnouncement item. + aViewModel ifNil: [ ^ self ]. + self + announce: (GtFiltersViewModelItemRemoved new + viewModel: self; + item: aViewModel) +] + { #category : #'event handling' } GtFiltersItemsViewModel >> onItemsChanged: anAnnouncement [ self removeOldFilterViewModelsFor: anAnnouncement items. @@ -25,24 +46,34 @@ GtFiltersItemsViewModel >> onItemsChanged: anAnnouncement [ items: self items) ] +{ #category : #'event handling' } +GtFiltersItemsViewModel >> removeOldFilterViewModelFor: aFilterModel [ + ^ filterViewModels removeKey: aFilterModel ifAbsent: [ nil ] +] + { #category : #'event handling' } GtFiltersItemsViewModel >> removeOldFilterViewModelsFor: aCollectionOfFilterModels [ "Remove filter view models of removed filter models. New filter view models are added on #items call." - + | toRemove | - toRemove := filterViewModels keys reject: [ :each | - aCollectionOfFilterModels includes: each ]. - toRemove do: [ :eachKey | - filterViewModels removeKey: eachKey ifAbsent: [ "ignore" ] ] + toRemove := filterViewModels keys + reject: [ :each | aCollectionOfFilterModels identityIncludes: each ]. + toRemove do: [ :eachFilterModel | self removeOldFilterViewModelFor: eachFilterModel ] ] { #category : #'api - filter model' } GtFiltersItemsViewModel >> subscribeToFiltersModel [ self filtersModel weak when: GtFiltersModelItemsChanged - send: #onItemsChanged: - to: self + send: #onItemsChanged: + to: self; + when: GtFiltersModelItemAdded + send: #onItemAdded: + to: self; + when: GtFiltersModelItemRemoved + send: #onItemRemoved: + to: self ] { #category : #'api - filter model' } diff --git a/src/GToolkit-Coder-UI/GtFiltersModelItemAdded.class.st b/src/GToolkit-Coder-UI/GtFiltersModelItemAdded.class.st new file mode 100644 index 000000000..04956181e --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFiltersModelItemAdded.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtFiltersModelItemAdded, + #superclass : #GtFiltersModelAnnouncement, + #instVars : [ + 'item' + ], + #category : #'GToolkit-Coder-UI-Filters - Events' +} + +{ #category : #accessing } +GtFiltersModelItemAdded >> item [ + ^ item +] + +{ #category : #accessing } +GtFiltersModelItemAdded >> item: anObject [ + item := anObject +] diff --git a/src/GToolkit-Coder-UI/GtFiltersModelItemRemoved.class.st b/src/GToolkit-Coder-UI/GtFiltersModelItemRemoved.class.st new file mode 100644 index 000000000..162b39f9d --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFiltersModelItemRemoved.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtFiltersModelItemRemoved, + #superclass : #GtFiltersModelAnnouncement, + #instVars : [ + 'item' + ], + #category : #'GToolkit-Coder-UI-Filters - Events' +} + +{ #category : #accessing } +GtFiltersModelItemRemoved >> item [ + ^ item +] + +{ #category : #accessing } +GtFiltersModelItemRemoved >> item: anObject [ + item := anObject +] diff --git a/src/GToolkit-Coder-UI/GtFiltersViewModel.class.st b/src/GToolkit-Coder-UI/GtFiltersViewModel.class.st index a42d5a9f5..f4613d92b 100644 --- a/src/GToolkit-Coder-UI/GtFiltersViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtFiltersViewModel.class.st @@ -63,7 +63,6 @@ GtFiltersViewModel >> initialize [ { #category : #'add / remove' } GtFiltersViewModel >> removeFilterViewModel: aFilterViewModel [ aFilterViewModel hasFilterModel ifFalse: [ ^ self ]. - filterViewModels removeKey: aFilterViewModel filterModel ifAbsent: [ "ignore" ]. self hasFiltersModel ifFalse: [ ^ self ]. self filtersModel removeFilterModel: aFilterViewModel filterModel diff --git a/src/GToolkit-Coder-UI/GtFiltersViewModelItemAdded.class.st b/src/GToolkit-Coder-UI/GtFiltersViewModelItemAdded.class.st new file mode 100644 index 000000000..da24108b2 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFiltersViewModelItemAdded.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtFiltersViewModelItemAdded, + #superclass : #GtFiltersViewModelAnnouncement, + #instVars : [ + 'item' + ], + #category : #'GToolkit-Coder-UI-Filters - Events' +} + +{ #category : #accessing } +GtFiltersViewModelItemAdded >> item [ + ^ item +] + +{ #category : #accessing } +GtFiltersViewModelItemAdded >> item: anObject [ + item := anObject +] diff --git a/src/GToolkit-Coder-UI/GtFiltersViewModelItemRemoved.class.st b/src/GToolkit-Coder-UI/GtFiltersViewModelItemRemoved.class.st new file mode 100644 index 000000000..d373e737c --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFiltersViewModelItemRemoved.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtFiltersViewModelItemRemoved, + #superclass : #GtFiltersViewModelAnnouncement, + #instVars : [ + 'item' + ], + #category : #'GToolkit-Coder-UI-Filters - Events' +} + +{ #category : #accessing } +GtFiltersViewModelItemRemoved >> item [ + ^ item +] + +{ #category : #accessing } +GtFiltersViewModelItemRemoved >> item: anObject [ + item := anObject +] From 6918f023fd94341e0b346fa49e9623df5184b1a5 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 9 Oct 2024 17:13:05 -0300 Subject: [PATCH 0715/1268] clean code related to filter removal [feenkcom/gtoolkit#3983] --- .../GtFilterItemsElement.class.st | 38 +++++++++++-------- .../GtFilterNameElement.class.st | 13 +------ ...GtFilterRemoveFilterViewModelWish.class.st | 18 --------- .../GtFilterRemoveWish.class.st | 5 --- 4 files changed, 23 insertions(+), 51 deletions(-) delete mode 100644 src/GToolkit-Coder-UI/GtFilterRemoveFilterViewModelWish.class.st delete mode 100644 src/GToolkit-Coder-UI/GtFilterRemoveWish.class.st diff --git a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st index 47b284335..27b1af62b 100644 --- a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st @@ -37,19 +37,19 @@ GtFilterItemsElement >> addItemElementForViewModel: aFilterViewModel [ ] { #category : #'private - updating' } -GtFilterItemsElement >> addNavigationShortcutsTo: anElement [ - anElement +GtFilterItemsElement >> addNavigationShortcutsTo: anElement [ + anElement addShortcut: (BlShortcutWithAction new - name: 'Move to next filter'; - description: 'Moves to the next filter. If none is found, we cycle back to the first.'; - combination: (BlKeyCombination tab or: BlKeyCombination arrowRight); - overrideChildren: false; - action: [ :anEvent | - BlFocusFinder new - direction: BlFocusSearchDirectionForward new; - root: self; - referenceElement: anEvent currentTarget; - nextFocusDo: #requestFocus ifNone: [ ] ]); + name: 'Move to next filter'; + description: 'Moves to the next filter. If none is found, we cycle back to the first.'; + combination: (BlKeyCombination tab or: BlKeyCombination arrowRight); + overrideChildren: false; + action: [ :anEvent | + BlFocusFinder new + direction: BlFocusSearchDirectionForward new; + root: self; + referenceElement: anEvent currentTarget; + nextFocusDo: #requestFocus ifNone: [ ] ]); addShortcut: (BlShortcutWithAction new name: 'Move to previous form item'; description: 'Moves to the previous filter. If none is found, we cycle back to the last.'; @@ -60,7 +60,15 @@ GtFilterItemsElement >> addNavigationShortcutsTo: anElement [ direction: BlFocusSearchDirectionBackward new; root: self; referenceElement: anEvent currentTarget; - nextFocusDo: #requestFocus ifNone: [ ] ]). + nextFocusDo: #requestFocus ifNone: [ ] ]); + addShortcut: (BlShortcutWithAction new + name: 'Remove filter'; + combination: (BlKeyCombination backspace or: BlKeyCombination delete); + overrideChildren: false; + action: [ :anEvent | + self + onRemoveFilterViewModelOfElement: anEvent currentTarget + from: anEvent currentTarget ]) ] { #category : #'private - updating' } @@ -165,9 +173,7 @@ GtFilterItemsElement >> initialize [ { #category : #initialization } GtFilterItemsElement >> initializeEventHandlers [ - self - when: GtFilterRemoveFilterViewModelWish - do: [ :anEvent | self onRemoveFilterViewModelWish: anEvent ] + ] { #category : #'private - updating' } diff --git a/src/GToolkit-Coder-UI/GtFilterNameElement.class.st b/src/GToolkit-Coder-UI/GtFilterNameElement.class.st index 369d84333..fe346d6e4 100644 --- a/src/GToolkit-Coder-UI/GtFilterNameElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterNameElement.class.st @@ -41,7 +41,6 @@ GtFilterNameElement >> initialize [ { #category : #initialization } GtFilterNameElement >> initializeEventHandlers [ self when: BlClickEvent do: [ :anEvent | self onClickEvent: anEvent ]. - self when: GtFilterRemoveWish do: [ :anEvent | self requestRemoveFilter ]. ] { #category : #initialization } @@ -66,10 +65,7 @@ GtFilterNameElement >> initializeSettingsContainer [ { #category : #initialization } GtFilterNameElement >> initializeShortcuts [ - self - addShortcut: (BlShortcutWithAction new - combination: (BlKeyCombination backspace or: BlKeyCombination delete); - action: [ self requestRemoveFilter ]) + ] { #category : #initialization } @@ -110,13 +106,6 @@ GtFilterNameElement >> removeSettingsElement [ settingsContainer removeChildren ] -{ #category : #'event handling' } -GtFilterNameElement >> requestRemoveFilter [ - self hasFilterViewModel ifFalse: [ ^ self ]. - self fireEvent: (GtFilterRemoveFilterViewModelWish new - filterViewModel: self filterViewModel) -] - { #category : #'api - filter view model' } GtFilterNameElement >> subscribeToFilterViewModel [ self filterViewModel weak diff --git a/src/GToolkit-Coder-UI/GtFilterRemoveFilterViewModelWish.class.st b/src/GToolkit-Coder-UI/GtFilterRemoveFilterViewModelWish.class.st deleted file mode 100644 index dda165da9..000000000 --- a/src/GToolkit-Coder-UI/GtFilterRemoveFilterViewModelWish.class.st +++ /dev/null @@ -1,18 +0,0 @@ -Class { - #name : #GtFilterRemoveFilterViewModelWish, - #superclass : #BrWish, - #instVars : [ - 'filterViewModel' - ], - #category : #'GToolkit-Coder-UI-Filters - Events' -} - -{ #category : #accessing } -GtFilterRemoveFilterViewModelWish >> filterViewModel [ - ^ filterViewModel -] - -{ #category : #accessing } -GtFilterRemoveFilterViewModelWish >> filterViewModel: anObject [ - filterViewModel := anObject -] diff --git a/src/GToolkit-Coder-UI/GtFilterRemoveWish.class.st b/src/GToolkit-Coder-UI/GtFilterRemoveWish.class.st deleted file mode 100644 index ae5aae3c3..000000000 --- a/src/GToolkit-Coder-UI/GtFilterRemoveWish.class.st +++ /dev/null @@ -1,5 +0,0 @@ -Class { - #name : #GtFilterRemoveWish, - #superclass : #BrWish, - #category : #'GToolkit-Coder-UI-Filters - Events' -} From 4a125a8dd9d61eff300cb50992b63a9dc9cc9d10 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 9 Oct 2024 19:03:14 -0300 Subject: [PATCH 0716/1268] short list filter can be set using enter or space keys [feenkcom/gtoolkit#3983] --- .../GtFilterEditWish.class.st | 5 +++ .../GtFilterFocusWish.class.st | 5 +++ .../GtFilterItemsElement.class.st | 12 ++++- .../GtFilterNameElement.class.st | 16 +++++++ .../GtFilterShortListSettingsElement.class.st | 44 ++++++++++++++++++- 5 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtFilterEditWish.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterFocusWish.class.st diff --git a/src/GToolkit-Coder-UI/GtFilterEditWish.class.st b/src/GToolkit-Coder-UI/GtFilterEditWish.class.st new file mode 100644 index 000000000..da4c99ca5 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterEditWish.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtFilterEditWish, + #superclass : #BrWish, + #category : #'GToolkit-Coder-UI-Filters - Events' +} diff --git a/src/GToolkit-Coder-UI/GtFilterFocusWish.class.st b/src/GToolkit-Coder-UI/GtFilterFocusWish.class.st new file mode 100644 index 000000000..26e46d635 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterFocusWish.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtFilterFocusWish, + #superclass : #BrWish, + #category : #'GToolkit-Coder-UI-Filters - Events' +} diff --git a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st index 27b1af62b..897c87f85 100644 --- a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st @@ -68,7 +68,12 @@ GtFilterItemsElement >> addNavigationShortcutsTo: anElement [ action: [ :anEvent | self onRemoveFilterViewModelOfElement: anEvent currentTarget - from: anEvent currentTarget ]) + from: anEvent currentTarget ]); + addShortcut: (BlShortcutWithAction new + name: 'Edit filter'; + combination: (BlKeyCombination space or: BlKeyCombination enter); + overrideChildren: false; + action: [ :anEvent | self onEditItemsEvent: anEvent ]) ] { #category : #'private - updating' } @@ -243,6 +248,11 @@ GtFilterItemsElement >> onAddSelectedItemEvent: aShortcutEvent [ action: [ self requestAddFilterModel: aFilterModel ] ] ] +{ #category : #'event handling' } +GtFilterItemsElement >> onEditItemsEvent: anEvent [ + anEvent currentTarget dispatchEvent: GtFilterEditWish new +] + { #category : #'api - filter view model' } GtFilterItemsElement >> onFiltersViewModelChanged [ self updateItemsElement diff --git a/src/GToolkit-Coder-UI/GtFilterNameElement.class.st b/src/GToolkit-Coder-UI/GtFilterNameElement.class.st index fe346d6e4..b6a075e7a 100644 --- a/src/GToolkit-Coder-UI/GtFilterNameElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterNameElement.class.st @@ -41,6 +41,8 @@ GtFilterNameElement >> initialize [ { #category : #initialization } GtFilterNameElement >> initializeEventHandlers [ self when: BlClickEvent do: [ :anEvent | self onClickEvent: anEvent ]. + self when: GtFilterEditWish do: [ :anEvent | self onEditWish: anEvent ]. + self when: GtFilterFocusWish do: [ :anEvent | self onFocusWish: anEvent ] ] { #category : #initialization } @@ -91,11 +93,25 @@ GtFilterNameElement >> onClickEvent: anEvent [ self requestFocus ] +{ #category : #'event handling' } +GtFilterNameElement >> onEditWish: anEvent [ + settingsContainer + childWithId: GtFilterSettingsId + ifFound: [ :anElement | anElement dispatchEvent: GtFilterEditWish new ] + ifNone: [ ] +] + { #category : #'api - filter view model' } GtFilterNameElement >> onFilterViewModelChanged [ self updateElement ] +{ #category : #'event handling' } +GtFilterNameElement >> onFocusWish: anEvent [ + anEvent consumed: true. + self requestFocus +] + { #category : #'event handling' } GtFilterNameElement >> onLabelChanged: anAnnouncement [ BlTaskAction enqueueElement: self action: [ self updateLabelElement ] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st index 8a04cdbed..d743b47e8 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st @@ -20,6 +20,11 @@ GtFilterShortListSettingsElement >> defaultItemLabel [ ^ '' ] +{ #category : #'private - updating' } +GtFilterShortListSettingsElement >> dispatchShowItemsWish [ + buttonElement dispatchEvent: BrDropdownShowWish new +] + { #category : #'event handling' } GtFilterShortListSettingsElement >> focusFirstItemElementInList: aListElement [ aListElement requestFocus. @@ -40,7 +45,9 @@ GtFilterShortListSettingsElement >> initialize [ self initializeButtonElement. self initializeDropdownAptitude. buttonElement addAptitude: buttonAptitude. - self addChild: buttonElement as: #button + self addChild: buttonElement as: #button. + self initializeEventHandlers. + self initializeShortcuts. ] { #category : #initialization } @@ -56,6 +63,24 @@ GtFilterShortListSettingsElement >> initializeDropdownAptitude [ handle: [ self newHandleElement ] content: [ self newContentElement ]. buttonAptitude beNotResizable. + buttonAptitude + when: BrDropdownIsHidden + do: [ :anEvent | self onDropdownIsHiddenEvent: anEvent ] +] + +{ #category : #initialization } +GtFilterShortListSettingsElement >> initializeEventHandlers [ + self when: GtFilterEditWish do: [ :anEvent | self onEditWish: anEvent ] +] + +{ #category : #initialization } +GtFilterShortListSettingsElement >> initializeShortcuts [ + self + addShortcut: (BlShortcutWithAction new + name: 'Display items'; + combination: (BlKeyCombination space or: BlKeyCombination enter); + overrideChildren: false; + action: [ :anEvent | self onDisplayItemsEvent: anEvent ]) ] { #category : #accessing } @@ -141,6 +166,23 @@ GtFilterShortListSettingsElement >> newItemElement [ do: [ :anEvent | self onItemMouseEnterEvent: anEvent ] ] +{ #category : #'event handling' } +GtFilterShortListSettingsElement >> onDisplayItemsEvent: anEvent [ + anEvent consumed: true. + self dispatchShowItemsWish +] + +{ #category : #'event handling' } +GtFilterShortListSettingsElement >> onDropdownIsHiddenEvent: anEvent [ + self fireEvent: GtFilterFocusWish new +] + +{ #category : #'event handling' } +GtFilterShortListSettingsElement >> onEditWish: anEvent [ + anEvent consumed: true. + self dispatchShowItemsWish +] + { #category : #'api - filter view model' } GtFilterShortListSettingsElement >> onFilterViewModelChanged [ super onFilterViewModelChanged. From 91fda17d458bb2cb19526b703475df7337bdcd68 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 9 Oct 2024 19:24:42 -0300 Subject: [PATCH 0717/1268] add arrow up and arrow down navigation shortcuts [feenkcom/gtoolkit#3983] --- .../GtFilterItemsElement.class.st | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st index 897c87f85..ffc7e3fe6 100644 --- a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st @@ -61,6 +61,28 @@ GtFilterItemsElement >> addNavigationShortcutsTo: anElement [ root: self; referenceElement: anEvent currentTarget; nextFocusDo: #requestFocus ifNone: [ ] ]); + addShortcut: (BlShortcutWithAction new + name: 'Move to upper filter'; + description: 'Moves to the upper filter. If none is found, we stay in the current.'; + combination: (BlKeyCombination arrowUp); + overrideChildren: false; + action: [ :anEvent | + BlFocusFinder new + up; + root: self; + referenceElement: anEvent currentTarget; + nextFocusDo: #requestFocus ifNone: [ ] ]); + addShortcut: (BlShortcutWithAction new + name: 'Move to lower filter'; + description: 'Moves to the lower filter. If none is found, we stay in the current.'; + combination: (BlKeyCombination arrowDown); + overrideChildren: false; + action: [ :anEvent | + BlFocusFinder new + down; + root: self; + referenceElement: anEvent currentTarget; + nextFocusDo: #requestFocus ifNone: [ ] ]); addShortcut: (BlShortcutWithAction new name: 'Remove filter'; combination: (BlKeyCombination backspace or: BlKeyCombination delete); From 9ccc94c5e16f652592d666ef0f356cbd1bed8af6 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 10 Oct 2024 00:14:40 -0300 Subject: [PATCH 0718/1268] text filter can be navigated and edited using keyboard keys [feenkcom/gtoolkit#3983] --- .../GtFilterExcludingFocusFinder.class.st | 36 +++++++ .../GtFilterFocusFirstPartWish.class.st | 5 + .../GtFilterFocusNextFilterWish.class.st | 5 + .../GtFilterFocusNextPartWish.class.st | 5 + ...ass.st => GtFilterFocusWholeWish.class.st} | 2 +- .../GtFilterItemsElement.class.st | 21 +++- .../GtFilterNameElement.class.st | 24 ++++- .../GtFilterShortListSettingsElement.class.st | 2 +- .../GtFilterTextSettingsElement.class.st | 96 +++++++++++++++++++ 9 files changed, 189 insertions(+), 7 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtFilterExcludingFocusFinder.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterFocusFirstPartWish.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterFocusNextFilterWish.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterFocusNextPartWish.class.st rename src/GToolkit-Coder-UI/{GtFilterFocusWish.class.st => GtFilterFocusWholeWish.class.st} (71%) diff --git a/src/GToolkit-Coder-UI/GtFilterExcludingFocusFinder.class.st b/src/GToolkit-Coder-UI/GtFilterExcludingFocusFinder.class.st new file mode 100644 index 000000000..69b9e5baa --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterExcludingFocusFinder.class.st @@ -0,0 +1,36 @@ +Class { + #name : #GtFilterExcludingFocusFinder, + #superclass : #BlFocusFinder, + #instVars : [ + 'excludedElement' + ], + #category : #'GToolkit-Coder-UI-Filters - Support' +} + +{ #category : #accessing } +GtFilterExcludingFocusFinder >> excludedElement [ + ^ excludedElement +] + +{ #category : #accessing } +GtFilterExcludingFocusFinder >> excludedElement: anObject [ + excludedElement := anObject +] + +{ #category : #'api - finder' } +GtFilterExcludingFocusFinder >> focusableCandidates [ + | theFocusCandidates someFocusCandidates | + theFocusCandidates := BlFocusFinderCandidates new. + someFocusCandidates := super focusableCandidates. + someFocusCandidates + do: [ :eachCandidate | + | toExclude | + toExclude := false. + eachCandidate == excludedElement + ifTrue: [ eachCandidate isFocused ifFalse: [ toExclude := true ] ] + ifFalse: [ eachCandidate allParentsDo: [ :eachParent | + eachParent == excludedElement + ifTrue: [ toExclude := true ] ] ]. + toExclude ifFalse: [ theFocusCandidates add: eachCandidate ] ]. + ^ theFocusCandidates +] diff --git a/src/GToolkit-Coder-UI/GtFilterFocusFirstPartWish.class.st b/src/GToolkit-Coder-UI/GtFilterFocusFirstPartWish.class.st new file mode 100644 index 000000000..48dc929d7 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterFocusFirstPartWish.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtFilterFocusFirstPartWish, + #superclass : #BrWish, + #category : #'GToolkit-Coder-UI-Filters - Events' +} diff --git a/src/GToolkit-Coder-UI/GtFilterFocusNextFilterWish.class.st b/src/GToolkit-Coder-UI/GtFilterFocusNextFilterWish.class.st new file mode 100644 index 000000000..4c7cd6e9b --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterFocusNextFilterWish.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtFilterFocusNextFilterWish, + #superclass : #BrWish, + #category : #'GToolkit-Coder-UI-Filters - Events' +} diff --git a/src/GToolkit-Coder-UI/GtFilterFocusNextPartWish.class.st b/src/GToolkit-Coder-UI/GtFilterFocusNextPartWish.class.st new file mode 100644 index 000000000..3a01289c0 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterFocusNextPartWish.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtFilterFocusNextPartWish, + #superclass : #BrWish, + #category : #'GToolkit-Coder-UI-Filters - Events' +} diff --git a/src/GToolkit-Coder-UI/GtFilterFocusWish.class.st b/src/GToolkit-Coder-UI/GtFilterFocusWholeWish.class.st similarity index 71% rename from src/GToolkit-Coder-UI/GtFilterFocusWish.class.st rename to src/GToolkit-Coder-UI/GtFilterFocusWholeWish.class.st index 26e46d635..40eeb7f29 100644 --- a/src/GToolkit-Coder-UI/GtFilterFocusWish.class.st +++ b/src/GToolkit-Coder-UI/GtFilterFocusWholeWish.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtFilterFocusWish, + #name : #GtFilterFocusWholeWish, #superclass : #BrWish, #category : #'GToolkit-Coder-UI-Filters - Events' } diff --git a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st index ffc7e3fe6..673b5f5a2 100644 --- a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st @@ -15,13 +15,15 @@ GtFilterItemsElement >> addElementForFilterViewModel: aFilterViewModel index: an margin: (BlInsets left: 3 right: 3); constraintsDo: [ :c | c flow vertical alignCenter. - c flow horizontal alignLeft ]. + c flow horizontal alignLeft ]; + when: GtFilterFocusNextFilterWish + do: [ :anEvent | self onFocusNextFilterWish: anEvent ]. self addNavigationShortcutsTo: anElement. self addRemoveButtonIconTo: anElement. self addChild: anElement at: anIndex. - + ^ anElement ] @@ -33,7 +35,7 @@ GtFilterItemsElement >> addItemElementForViewModel: aFilterViewModel [ ifNone: [ ^ self ]. anElement := self addElementForFilterViewModel: aFilterViewModel index: anIndex. - anElement requestFocus + anElement fireEvent: GtFilterFocusFirstPartWish new ] { #category : #'private - updating' } @@ -280,6 +282,19 @@ GtFilterItemsElement >> onFiltersViewModelChanged [ self updateItemsElement ] +{ #category : #'event handling' } +GtFilterItemsElement >> onFocusNextFilterWish: anEvent [ + anEvent consumed: true. + BlTaskAction enqueueElement: self action: [ + GtFilterExcludingFocusFinder new + direction: BlFocusSearchDirectionForward new; + root: self; + referenceElement: anEvent currentTarget; + excludedElement: anEvent currentTarget; + nextFocusDo: [ :anElement | + anElement requestFocus ] ifNone: [ ] ] +] + { #category : #'event handling' } GtFilterItemsElement >> onItemAdded: anAnnouncement [ BlTaskAction diff --git a/src/GToolkit-Coder-UI/GtFilterNameElement.class.st b/src/GToolkit-Coder-UI/GtFilterNameElement.class.st index b6a075e7a..b7a436373 100644 --- a/src/GToolkit-Coder-UI/GtFilterNameElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterNameElement.class.st @@ -42,7 +42,9 @@ GtFilterNameElement >> initialize [ GtFilterNameElement >> initializeEventHandlers [ self when: BlClickEvent do: [ :anEvent | self onClickEvent: anEvent ]. self when: GtFilterEditWish do: [ :anEvent | self onEditWish: anEvent ]. - self when: GtFilterFocusWish do: [ :anEvent | self onFocusWish: anEvent ] + self when: GtFilterFocusFirstPartWish do: [ :anEvent | self onFocusFirstPartWish: anEvent ]. + self when: GtFilterFocusWholeWish do: [ :anEvent | self onFocusWholeWish: anEvent ]. + self when: GtFilterFocusNextPartWish do: [ :anEvent | self onFocusNextPartdWish: anEvent ] ] { #category : #initialization } @@ -107,7 +109,25 @@ GtFilterNameElement >> onFilterViewModelChanged [ ] { #category : #'event handling' } -GtFilterNameElement >> onFocusWish: anEvent [ +GtFilterNameElement >> onFocusFirstPartWish: anEvent [ + anEvent consumed: true. + BlFocusFinder new + right; + root: settingsContainer; + referenceElement: settingsContainer; + nextFocusDo: [ :anElement | anElement requestFocus ] + ifNone: [ self requestFocus ] +] + +{ #category : #'event handling' } +GtFilterNameElement >> onFocusNextPartdWish: anEvent [ + anEvent consumed: true. + self requestFocus. + self fireEvent: GtFilterFocusNextFilterWish new +] + +{ #category : #'event handling' } +GtFilterNameElement >> onFocusWholeWish: anEvent [ anEvent consumed: true. self requestFocus ] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st index d743b47e8..da7fb50ee 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st @@ -174,7 +174,7 @@ GtFilterShortListSettingsElement >> onDisplayItemsEvent: anEvent [ { #category : #'event handling' } GtFilterShortListSettingsElement >> onDropdownIsHiddenEvent: anEvent [ - self fireEvent: GtFilterFocusWish new + self fireEvent: GtFilterFocusWholeWish new ] { #category : #'event handling' } diff --git a/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st index d1fb450ca..861f6cd9e 100644 --- a/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st @@ -20,6 +20,7 @@ GtFilterTextSettingsElement >> initializeEditorElement [ editorElement := BrEditor new hFitContentLimited; vFitContent; + beMode: BrTextEditorEditableSingleLineMode new; background: self theme default contentBackgroundColor; aptitude: BrGlamorousRegularEditorAptitude new glamorousRegularSmallSize; @@ -27,9 +28,36 @@ GtFilterTextSettingsElement >> initializeEditorElement [ padding: (BlInsets top: 1 right: 2 bottom: 1 left: 2); constraintsDo: [ :c | c minWidth: 20 ]; addShortcut: (BlShortcutWithAction new + name: 'Accept new text'; + description: 'Accept new text and store it into the filter model'; combination: BlKeyCombination enter; action: [ :anEvent | self onTextEditorModificationAccepted: anEvent ]); + addShortcut: (BlShortcutWithAction new + name: 'Move cursor left or focus current filter'; + combination: (BlKeyCombination arrowLeft); + action: [ :anEvent | + self onTextEditorArrowLeftEvent: anEvent ]); + addShortcut: (BlShortcutWithAction new + name: 'Move cursor right or focus next filter'; + combination: (BlKeyCombination arrowRight); + action: [ :anEvent | + self onTextEditorArrowRightEvent: anEvent ]); + addShortcut: (BlShortcutWithAction new + name: 'Focus previous filter'; + combination: (BlKeyCombination shiftTab); + action: [ :anEvent | + self onTextEditorShiftTabEvent: anEvent ]); + addShortcut: (BlShortcutWithAction new + name: 'Focus next filter'; + combination: (BlKeyCombination tab); + action: [ :anEvent | + self onTextEditorTabEvent: anEvent ]); + addShortcut: (BlShortcutWithAction new + name: 'Delete text or focus current filter'; + combination: (BlKeyCombination backspace); + action: [ :anEvent | + self onTextEditorDeleteEvent: anEvent ]); when: BlFocusInEvent do: [ :anEvent | anEvent currentTarget selecter all select ]; when: BlFocusOutEvent do: [ :anEvent | @@ -59,15 +87,83 @@ GtFilterTextSettingsElement >> onTextChanged: anAnnouncement [ action: [ self updateEditorElementText ] ] +{ #category : #'event handling' } +GtFilterTextSettingsElement >> onTextEditorArrowLeftEvent: anEvent [ + | anElement anEditor | + anElement := anEvent currentTarget. + anEditor := anElement editor. + anEvent consumed: true. + (anEditor cursors positions includes: 0) + ifTrue: [ self fireEvent: GtFilterFocusWholeWish new. + ^ self ]. + + anEditor selection isEmpty + ifTrue: [ anEditor navigator + moveLeft; + apply ] + ifFalse: [ anEditor deselecter + all; + deselect ] +] + +{ #category : #'event handling' } +GtFilterTextSettingsElement >> onTextEditorArrowRightEvent: anEvent [ + | anElement anEditor | + anElement := anEvent currentTarget. + anEditor := anElement editor. + anEvent consumed: true. + (anEditor cursors positions includes: anEditor text size) + ifTrue: [ self fireEvent: GtFilterFocusNextPartWish new. + ^ self ]. + + anEditor selection isEmpty + ifTrue: [ anEditor navigator + moveRight; + apply ] + ifFalse: [ anEditor deselecter + all; + deselect ] +] + +{ #category : #'event handling' } +GtFilterTextSettingsElement >> onTextEditorDeleteEvent: anEvent [ + | anElement anEditor | + anElement := anEvent currentTarget. + anEditor := anElement editor. + anEvent consumed: true. + (anEditor cursors positions includes: 0) + ifTrue: [ self fireEvent: GtFilterFocusWholeWish new. + ^ self ]. + + anEditor deleter + selected; + oneBeforeCursorIfOutsideOfSelection; + surroundings: anEditor surroundMap; + delete +] + { #category : #'event handling' } GtFilterTextSettingsElement >> onTextEditorModificationAccepted: anEvent [ self hasFilterViewModel ifFalse: [ ^ self ]. + anEvent consumed: true. self filterViewModel text: (editorElement text copy trimmer bothSeparators; trimmed) ] +{ #category : #'event handling' } +GtFilterTextSettingsElement >> onTextEditorShiftTabEvent: anEvent [ + anEvent consumed: true. + self fireEvent: GtFilterFocusWholeWish new +] + +{ #category : #'event handling' } +GtFilterTextSettingsElement >> onTextEditorTabEvent: anEvent [ + anEvent consumed: true. + self fireEvent: GtFilterFocusNextPartWish new +] + { #category : #'api - filter view model' } GtFilterTextSettingsElement >> subscribeToFilterViewModel [ super subscribeToFilterViewModel. From b0aeba9311d161b62a2c5af6df9968e71d30e2a9 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 10 Oct 2024 00:20:59 -0300 Subject: [PATCH 0719/1268] text filter can be navigated and edited using keyboard keys [feenkcom/gtoolkit#3983] --- .../GtFilterTextSettingsElement.class.st | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st index 861f6cd9e..ba93f6246 100644 --- a/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st @@ -12,7 +12,8 @@ Class { GtFilterTextSettingsElement >> initialize [ super initialize. self initializeEditorElement. - self addChild: editorElement as: #editor + self addChild: editorElement as: #editor. + self initializeEventHandlers. ] { #category : #initialization } @@ -66,6 +67,17 @@ GtFilterTextSettingsElement >> initializeEditorElement [ self onTextEditorModificationAccepted: anEvent ] ] ] +{ #category : #initialization } +GtFilterTextSettingsElement >> initializeEventHandlers [ + self when: GtFilterEditWish do: [ :anEvent | self onEditWish: anEvent ] +] + +{ #category : #'event handling' } +GtFilterTextSettingsElement >> onEditWish: anEvent [ + anEvent consumed: true. + editorElement requestFocus +] + { #category : #'api - filter view model' } GtFilterTextSettingsElement >> onFilterViewModelChanged [ super onFilterViewModelChanged. From 4b03e6df45f3028e3f92fc4e42c9a515ade6a552 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 10 Oct 2024 00:42:39 -0300 Subject: [PATCH 0720/1268] return focus back to the add filter button when its dropdown gets closed [feenkcom/gtoolkit#3983] --- src/GToolkit-Coder-UI/GtFilterItemsElement.class.st | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st index 673b5f5a2..795b17405 100644 --- a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st @@ -232,7 +232,9 @@ GtFilterItemsElement >> newAddFilterButton [ addShortcut: (BlShortcutWithAction new combination: BlKeyCombination enter; - action: [ :anEvent | anEvent currentTarget dispatchEvent: BrDropdownShowWish new ]) + action: [ :anEvent | anEvent currentTarget dispatchEvent: BrDropdownShowWish new ]); + when: BrDropdownIsHidden + do: [ :anEvent | self onAddFilterDropdownIsHiddenEvent: anEvent ] ] { #category : #'private - updating' } @@ -258,6 +260,11 @@ GtFilterItemsElement >> newRemoveButton [ c ignored vertical alignCenterAt: 0.0 ] ] +{ #category : #'private - updating' } +GtFilterItemsElement >> onAddFilterDropdownIsHiddenEvent: anEvent [ + anEvent currentTarget requestFocus +] + { #category : #'event handling' } GtFilterItemsElement >> onAddSelectedItemEvent: aShortcutEvent [ | anElementList | From 4cd2fd4b7fa37e26a28709bd53d36aea1639015f Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 10 Oct 2024 14:14:18 -0300 Subject: [PATCH 0721/1268] indicate empty lists using a virtual item [feenkcom/gtoolkit#3983] --- .../GtFilterModelEmptyItem.class.st | 26 ++++++++++++++ .../GtFilterModelItem.class.st | 5 +++ .../GtFilterModelNoItem.class.st | 2 +- .../GtFilterShortListSettingsElement.class.st | 36 +++++++++++-------- 4 files changed, 53 insertions(+), 16 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtFilterModelEmptyItem.class.st diff --git a/src/GToolkit-Coder-UI/GtFilterModelEmptyItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelEmptyItem.class.st new file mode 100644 index 000000000..083baa23a --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModelEmptyItem.class.st @@ -0,0 +1,26 @@ +" +I am a {{gtClass:GtFilterModelItem}}. +I am used to indicate that there are no items in a list. +" +Class { + #name : #GtFilterModelEmptyItem, + #superclass : #GtFilterModelItem, + #traits : 'TGtUniqueInstance', + #classTraits : 'TGtUniqueInstance classTrait', + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #accessing } +GtFilterModelEmptyItem >> ifSome: aBlock ifNone: aNoneBlock [ + ^ aNoneBlock value +] + +{ #category : #testing } +GtFilterModelEmptyItem >> isVirtualFilterModelItem [ + ^ true +] + +{ #category : #accessing } +GtFilterModelEmptyItem >> label [ + ^ 'empty list' +] diff --git a/src/GToolkit-Coder-UI/GtFilterModelItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelItem.class.st index 2b32ac588..fd71b7fc6 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelItem.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelItem.class.st @@ -68,6 +68,11 @@ GtFilterModelItem >> ifSome: aBlock ifNone: aNoneBlock [ ^ aBlock cull: self itemValue cull: self ] +{ #category : #testing } +GtFilterModelItem >> isVirtualFilterModelItem [ + ^ false +] + { #category : #accessing } GtFilterModelItem >> itemValue [ ^ self diff --git a/src/GToolkit-Coder-UI/GtFilterModelNoItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelNoItem.class.st index 97c959879..0d3f3e613 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelNoItem.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelNoItem.class.st @@ -13,5 +13,5 @@ GtFilterModelNoItem >> ifSome: aBlock ifNone: aNoneBlock [ { #category : #accessing } GtFilterModelNoItem >> label [ - ^ '' + ^ 'none' ] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st index da7fb50ee..e0bf65ed1 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st @@ -109,6 +109,7 @@ GtFilterShortListSettingsElement >> newContentElement [ fitContentLimited; itemStencil: [ :anItemType :aListWidget | self newItemElement ]; itemDataBinder: [ :anItemElement :anItemObject :anItemIndex | + anItemElement disabled: anItemObject isVirtualFilterModelItem. anItemElement label: (anItemObject label ifNil: [ self defaultItemLabel ]); icon: (anItemObject icon ifNil: [ self defaultItemIcon ]); @@ -192,12 +193,7 @@ GtFilterShortListSettingsElement >> onFilterViewModelChanged [ { #category : #'event handling' } GtFilterShortListSettingsElement >> onItemClick: aButton [ self hasFilterViewModel ifFalse: [ ^ self ]. - BlTaskAction - enqueueElement: self - action: [ aButton fireEvent: BrDropdownHideWish new ]. - BlTaskAction - enqueueElement: self - action: [ self filterViewModel selectedItem: aButton model ] + self updateSelectedItem: aButton model from: aButton. ] { #category : #'event handling' } @@ -229,14 +225,8 @@ GtFilterShortListSettingsElement >> onListElementAddedToSceneGraph: anEvent [ GtFilterShortListSettingsElement >> onPickSelectedItemEvent: aShortcutEvent [ | anElementList | anElementList := aShortcutEvent currentTarget. - anElementList - selectedItemDo: [ :anItem :anIndex | - BlTaskAction - enqueueElement: self - action: [ anElementList fireEvent: BrDropdownHideWish new ]. - BlTaskAction - enqueueElement: self - action: [ self filterViewModel selectedItem: anItem ] ] + anElementList selectedItemDo: [ :anItem :anIndex | + self updateSelectedItem: anItem from: anElementList ] ] { #category : #'event handling' } @@ -309,7 +299,23 @@ GtFilterShortListSettingsElement >> updateListElement [ { #category : #'private - updating' } GtFilterShortListSettingsElement >> updateListElement: anElement [ + | aCollection | self hasFilterViewModel ifFalse: [ ^ self ]. + aCollection := self filterViewModel itemsWithoutSelection. + aCollection + ifEmpty: [ anElement items: {GtFilterModelEmptyItem default} ] + ifNotEmpty: [ anElement items: aCollection ] +] - anElement items: self filterViewModel itemsWithoutSelection +{ #category : #'private - updating' } +GtFilterShortListSettingsElement >> updateSelectedItem: aFilterModelItem from: anElement [ + aFilterModelItem ifNil: [ ^ self ]. + aFilterModelItem isVirtualFilterModelItem ifTrue: [ ^ self ]. + self hasFilterViewModel ifFalse: [ ^ self ]. + BlTaskAction + enqueueElement: self + action: [ anElement fireEvent: BrDropdownHideWish new ]. + BlTaskAction + enqueueElement: self + action: [ self filterViewModel selectedItem: aFilterModelItem ] ] From 17aa7c463ddc3ea5962db97004f38da533ce8da3 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 10 Oct 2024 16:31:24 -0300 Subject: [PATCH 0722/1268] fix example and test case filters [feenkcom/gtoolkit#3983] --- .../GtExampleState.extension.st | 6 +++ ...FilterModelExampleResultStateItem.class.st | 46 ++++++++++++++++++ .../GtFilterModelObjectItem.class.st | 48 +++++++++++++++++++ ...ilterModelTestCaseResultStateItem.class.st | 46 ++++++++++++++++++ src/GToolkit-Coder-UI/Object.extension.st | 6 +++ 5 files changed, 152 insertions(+) create mode 100644 src/GToolkit-Coder-UI/GtExampleState.extension.st create mode 100644 src/GToolkit-Coder-UI/GtFilterModelExampleResultStateItem.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterModelObjectItem.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterModelTestCaseResultStateItem.class.st create mode 100644 src/GToolkit-Coder-UI/Object.extension.st diff --git a/src/GToolkit-Coder-UI/GtExampleState.extension.st b/src/GToolkit-Coder-UI/GtExampleState.extension.st new file mode 100644 index 000000000..d00a34f1a --- /dev/null +++ b/src/GToolkit-Coder-UI/GtExampleState.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #GtExampleState } + +{ #category : #'*GToolkit-Coder-UI' } +GtExampleState >> asFilterModelItem [ + ^ GtFilterModelExampleResultStateItem new resultState: self +] diff --git a/src/GToolkit-Coder-UI/GtFilterModelExampleResultStateItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelExampleResultStateItem.class.st new file mode 100644 index 000000000..e48ca528e --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModelExampleResultStateItem.class.st @@ -0,0 +1,46 @@ +Class { + #name : #GtFilterModelExampleResultStateItem, + #superclass : #GtFilterModelItem, + #instVars : [ + 'resultState' + ], + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #accessing } +GtFilterModelExampleResultStateItem >> icon [ + ^ BlElement new + size: 8 @ 8; + background: self resultState color; + geometry: BlRectangleGeometry new +] + +{ #category : #accessing } +GtFilterModelExampleResultStateItem >> itemValue [ + ^ self resultState +] + +{ #category : #accessing } +GtFilterModelExampleResultStateItem >> label [ + ^ self resultState label +] + +{ #category : #printing } +GtFilterModelExampleResultStateItem >> printOn: aStream [ + super printOn: aStream. + + aStream + nextPut: $(; + print: (self resultState ifNotNil: #label); + nextPut: $) +] + +{ #category : #accessing } +GtFilterModelExampleResultStateItem >> resultState [ + ^ resultState +] + +{ #category : #accessing } +GtFilterModelExampleResultStateItem >> resultState: anObject [ + resultState := anObject +] diff --git a/src/GToolkit-Coder-UI/GtFilterModelObjectItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelObjectItem.class.st new file mode 100644 index 000000000..27aabac66 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModelObjectItem.class.st @@ -0,0 +1,48 @@ +Class { + #name : #GtFilterModelObjectItem, + #superclass : #GtFilterModelItem, + #instVars : [ + 'object' + ], + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #accessing } +GtFilterModelObjectItem >> icon [ + | anIconName | + anIconName := self object gtIconName. + (anIconName isNil or: [ anIconName = Object gtIconName ]) ifTrue: [ ^ nil ]. + + ^ self object gtSafeIconNamed: anIconName +] + +{ #category : #accessing } +GtFilterModelObjectItem >> itemValue [ + ^ self object +] + +{ #category : #accessing } +GtFilterModelObjectItem >> label [ + + ^ self object asString +] + +{ #category : #accessing } +GtFilterModelObjectItem >> object [ + ^ object +] + +{ #category : #accessing } +GtFilterModelObjectItem >> object: anObject [ + object := anObject +] + +{ #category : #printing } +GtFilterModelObjectItem >> printOn: aStream [ + super printOn: aStream. + + aStream + nextPut: $(; + print: self object; + nextPut: $) +] diff --git a/src/GToolkit-Coder-UI/GtFilterModelTestCaseResultStateItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelTestCaseResultStateItem.class.st new file mode 100644 index 000000000..afaa46b82 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModelTestCaseResultStateItem.class.st @@ -0,0 +1,46 @@ +Class { + #name : #GtFilterModelTestCaseResultStateItem, + #superclass : #GtFilterModelItem, + #instVars : [ + 'resultState' + ], + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #accessing } +GtFilterModelTestCaseResultStateItem >> icon [ + ^ BlElement new + background: self resultState color; + border: self resultState border; + size: 8 @ 8 +] + +{ #category : #accessing } +GtFilterModelTestCaseResultStateItem >> itemValue [ + ^ self resultState +] + +{ #category : #accessing } +GtFilterModelTestCaseResultStateItem >> label [ + ^ self resultState label +] + +{ #category : #printing } +GtFilterModelTestCaseResultStateItem >> printOn: aStream [ + super printOn: aStream. + + aStream + nextPut: $(; + print: (self resultState ifNotNil: #label); + nextPut: $) +] + +{ #category : #accessing } +GtFilterModelTestCaseResultStateItem >> resultState [ + ^ resultState +] + +{ #category : #accessing } +GtFilterModelTestCaseResultStateItem >> resultState: anObject [ + resultState := anObject +] diff --git a/src/GToolkit-Coder-UI/Object.extension.st b/src/GToolkit-Coder-UI/Object.extension.st new file mode 100644 index 000000000..9e7f4b630 --- /dev/null +++ b/src/GToolkit-Coder-UI/Object.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #Object } + +{ #category : #'*GToolkit-Coder-UI' } +Object >> asFilterModelItem [ + ^ GtFilterModelObjectItem new object: self +] From 415ed698ba9c6e5e26266a31a95c70d98c723cc5 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 10 Oct 2024 16:33:10 -0300 Subject: [PATCH 0723/1268] move a method to different repository [feenkcom/gtoolkit#3983] --- src/GToolkit-Coder-UI/GtExampleState.extension.st | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 src/GToolkit-Coder-UI/GtExampleState.extension.st diff --git a/src/GToolkit-Coder-UI/GtExampleState.extension.st b/src/GToolkit-Coder-UI/GtExampleState.extension.st deleted file mode 100644 index d00a34f1a..000000000 --- a/src/GToolkit-Coder-UI/GtExampleState.extension.st +++ /dev/null @@ -1,6 +0,0 @@ -Extension { #name : #GtExampleState } - -{ #category : #'*GToolkit-Coder-UI' } -GtExampleState >> asFilterModelItem [ - ^ GtFilterModelExampleResultStateItem new resultState: self -] From 333c9b6dacb592962a37b52ff3f3e5e5fe3b1d03 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 10 Oct 2024 19:23:25 -0300 Subject: [PATCH 0724/1268] add filter model pluggable item [feenkcom/gtoolkit#3983] --- ...FilterModelItemIconStencilBuilder.class.st | 37 ++++++++++ ...ilterModelItemLabelStencilBuilder.class.st | 35 ++++++++++ .../GtFilterModelPluggableItem.class.st | 70 +++++++++++++++++++ ...tFilterModelPluggableItemsBuilder.class.st | 61 ++++++++++++++++ .../GtFilterShortListModel.class.st | 11 +++ .../GtFilterToggleModel.class.st | 11 +++ 6 files changed, 225 insertions(+) create mode 100644 src/GToolkit-Coder-UI/GtFilterModelItemIconStencilBuilder.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterModelItemLabelStencilBuilder.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterModelPluggableItem.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterModelPluggableItemsBuilder.class.st diff --git a/src/GToolkit-Coder-UI/GtFilterModelItemIconStencilBuilder.class.st b/src/GToolkit-Coder-UI/GtFilterModelItemIconStencilBuilder.class.st new file mode 100644 index 000000000..bceec40a1 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModelItemIconStencilBuilder.class.st @@ -0,0 +1,37 @@ +Class { + #name : #GtFilterModelItemIconStencilBuilder, + #superclass : #BrStencilBuilder, + #instVars : [ + 'object' + ], + #category : #'GToolkit-Coder-UI-Filters - Support' +} + +{ #category : #'api - instantiation' } +GtFilterModelItemIconStencilBuilder >> buildDefault [ + ^ BlElement new + size: 8 @ 8; + background: BlBackground transparent +] + +{ #category : #accessing } +GtFilterModelItemIconStencilBuilder >> object [ + ^ object +] + +{ #category : #accessing } +GtFilterModelItemIconStencilBuilder >> object: anObject [ + object := anObject +] + +{ #category : #'api - instantiation' } +GtFilterModelItemIconStencilBuilder >> paramsOn: aStencilExecutor [ + super paramsOn: aStencilExecutor. + + aStencilExecutor push: object +] + +{ #category : #initialization } +GtFilterModelItemIconStencilBuilder >> reset [ + object := nil +] diff --git a/src/GToolkit-Coder-UI/GtFilterModelItemLabelStencilBuilder.class.st b/src/GToolkit-Coder-UI/GtFilterModelItemLabelStencilBuilder.class.st new file mode 100644 index 000000000..975932876 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModelItemLabelStencilBuilder.class.st @@ -0,0 +1,35 @@ +Class { + #name : #GtFilterModelItemLabelStencilBuilder, + #superclass : #BrStencilBuilder, + #instVars : [ + 'object' + ], + #category : #'GToolkit-Coder-UI-Filters - Support' +} + +{ #category : #'api - instantiation' } +GtFilterModelItemLabelStencilBuilder >> buildDefault [ + ^ 'none' +] + +{ #category : #accessing } +GtFilterModelItemLabelStencilBuilder >> object [ + ^ object +] + +{ #category : #accessing } +GtFilterModelItemLabelStencilBuilder >> object: anObject [ + object := anObject +] + +{ #category : #'api - instantiation' } +GtFilterModelItemLabelStencilBuilder >> paramsOn: aStencilExecutor [ + super paramsOn: aStencilExecutor. + + aStencilExecutor push: object +] + +{ #category : #initialization } +GtFilterModelItemLabelStencilBuilder >> reset [ + object := nil +] diff --git a/src/GToolkit-Coder-UI/GtFilterModelPluggableItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelPluggableItem.class.st new file mode 100644 index 000000000..d6aae601e --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModelPluggableItem.class.st @@ -0,0 +1,70 @@ +Class { + #name : #GtFilterModelPluggableItem, + #superclass : #GtFilterModelItem, + #instVars : [ + 'object', + 'iconStencilBuilder', + 'labelStencilBuilder' + ], + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #'instance creation' } +GtFilterModelPluggableItem class >> forCollection: aCollection icon: anIconStencilBuilder label: aLabelStencilBuilder [ + ^ aCollection + collect: [ :eachObject | + self new + object: eachObject; + icon: anIconStencilBuilder; + label: aLabelStencilBuilder ] +] + +{ #category : #accessing } +GtFilterModelPluggableItem >> icon [ + + ^ iconStencilBuilder + object: self object; + asElement +] + +{ #category : #accessing } +GtFilterModelPluggableItem >> icon: aStencilBuilder [ + iconStencilBuilder := aStencilBuilder + asStencilBuilder: GtFilterModelItemIconStencilBuilder new +] + +{ #category : #initialization } +GtFilterModelPluggableItem >> initialize [ + super initialize. + iconStencilBuilder := GtFilterModelItemIconStencilBuilder new. + labelStencilBuilder := GtFilterModelItemLabelStencilBuilder new +] + +{ #category : #accessing } +GtFilterModelPluggableItem >> itemValue [ + ^ self object +] + +{ #category : #accessing } +GtFilterModelPluggableItem >> label [ + + ^ labelStencilBuilder + object: self object; + create +] + +{ #category : #accessing } +GtFilterModelPluggableItem >> label: aStencilBuilder [ + labelStencilBuilder := aStencilBuilder + asStencilBuilder: GtFilterModelItemLabelStencilBuilder new +] + +{ #category : #accessing } +GtFilterModelPluggableItem >> object [ + ^ object +] + +{ #category : #accessing } +GtFilterModelPluggableItem >> object: anObject [ + object := anObject +] diff --git a/src/GToolkit-Coder-UI/GtFilterModelPluggableItemsBuilder.class.st b/src/GToolkit-Coder-UI/GtFilterModelPluggableItemsBuilder.class.st new file mode 100644 index 000000000..652a5ff84 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModelPluggableItemsBuilder.class.st @@ -0,0 +1,61 @@ +Class { + #name : #GtFilterModelPluggableItemsBuilder, + #superclass : #GtFilterModelItemsBuilder, + #instVars : [ + 'iconStencilBuilder', + 'labelStencilBuilder', + 'itemsBuilder' + ], + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #'api - instantiation' } +GtFilterModelPluggableItemsBuilder >> create [ + + ^ self itemsBuilder create + collect: [ :eachItem | + GtFilterModelPluggableItem new + object: eachItem itemValue; + icon: self iconStencilBuilder; + label: self labelStencilBuilder ] +] + +{ #category : #accessing } +GtFilterModelPluggableItemsBuilder >> iconStencilBuilder [ + ^ iconStencilBuilder +] + +{ #category : #accessing } +GtFilterModelPluggableItemsBuilder >> iconStencilBuilder: aStencilBuilder [ + iconStencilBuilder := aStencilBuilder + asStencilBuilder: GtFilterModelItemIconStencilBuilder new +] + +{ #category : #initialization } +GtFilterModelPluggableItemsBuilder >> initialize [ + super initialize. + iconStencilBuilder := GtFilterModelItemIconStencilBuilder new. + labelStencilBuilder := GtFilterModelItemLabelStencilBuilder new +] + +{ #category : #accessing } +GtFilterModelPluggableItemsBuilder >> itemsBuilder [ + + ^ itemsBuilder +] + +{ #category : #accessing } +GtFilterModelPluggableItemsBuilder >> itemsBuilder: anObject [ + itemsBuilder := anObject +] + +{ #category : #accessing } +GtFilterModelPluggableItemsBuilder >> labelStencilBuilder [ + ^ labelStencilBuilder +] + +{ #category : #accessing } +GtFilterModelPluggableItemsBuilder >> labelStencilBuilder: aStencilBuilder [ + labelStencilBuilder := aStencilBuilder + asStencilBuilder: GtFilterModelItemLabelStencilBuilder new +] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st index 64ee13f83..f4a6a932a 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st @@ -30,6 +30,17 @@ GtFilterShortListModel >> items: anObject [ self itemsBuilder: anObject ] +{ #category : #accessing } +GtFilterShortListModel >> items: anObject icon: anIconStencilBuilder label: aLabelStencilBuilder [ + | aNewItemsBuilder aPluggableItemsBuilder | + aNewItemsBuilder := anObject asFilterModelItemsBuilder. + aPluggableItemsBuilder := GtFilterModelPluggableItemsBuilder new + itemsBuilder: aNewItemsBuilder; + iconStencilBuilder: anIconStencilBuilder; + labelStencilBuilder: aLabelStencilBuilder. + self itemsBuilder: aPluggableItemsBuilder +] + { #category : #accessing } GtFilterShortListModel >> itemsBuilder [ diff --git a/src/GToolkit-Coder-UI/GtFilterToggleModel.class.st b/src/GToolkit-Coder-UI/GtFilterToggleModel.class.st index af5f0bc1d..ba1d14416 100644 --- a/src/GToolkit-Coder-UI/GtFilterToggleModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterToggleModel.class.st @@ -32,6 +32,17 @@ GtFilterToggleModel >> items: anObject [ self itemsBuilder: anObject ] +{ #category : #accessing } +GtFilterToggleModel >> items: anObject icon: anIconStencilBuilder label: aLabelStencilBuilder [ + | aNewItemsBuilder aPluggableItemsBuilder | + aNewItemsBuilder := anObject asFilterModelItemsBuilder. + aPluggableItemsBuilder := GtFilterModelPluggableItemsBuilder new + itemsBuilder: aNewItemsBuilder; + iconStencilBuilder: anIconStencilBuilder; + labelStencilBuilder: aLabelStencilBuilder. + self itemsBuilder: aPluggableItemsBuilder +] + { #category : #accessing } GtFilterToggleModel >> itemsBuilder [ From 47c8e4302d68f0b7263f74dea239236f749046c7 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 10 Oct 2024 19:26:22 -0300 Subject: [PATCH 0725/1268] add filter model pluggable item [feenkcom/gtoolkit#3983] --- src/GToolkit-Coder-UI/GtFilterModelPluggableItem.class.st | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtFilterModelPluggableItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelPluggableItem.class.st index d6aae601e..ea4ba07e8 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelPluggableItem.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelPluggableItem.class.st @@ -19,6 +19,14 @@ GtFilterModelPluggableItem class >> forCollection: aCollection icon: anIconStenc label: aLabelStencilBuilder ] ] +{ #category : #'instance creation' } +GtFilterModelPluggableItem class >> forObject: anObject icon: anIconStencilBuilder label: aLabelStencilBuilder [ + ^ self new + object: anObject; + icon: anIconStencilBuilder; + label: aLabelStencilBuilder +] + { #category : #accessing } GtFilterModelPluggableItem >> icon [ From bf136be861cf7d0d60862b0e69f2da8bb8d17d14 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 10 Oct 2024 19:51:00 -0300 Subject: [PATCH 0726/1268] exemplify filter model pluggable item [feenkcom/gtoolkit#3983] --- .../GtFilterModelExamples.class.st | 125 ++++++++++++++++++ ...FilterModelItemIconStencilBuilder.class.st | 4 +- ...ilterModelItemLabelStencilBuilder.class.st | 2 +- .../GtFilterModelPluggableItem.class.st | 42 +++++- ...tFilterModelPluggableItemsBuilder.class.st | 4 +- .../GtFilterShortListModel.class.st | 20 +++ 6 files changed, 186 insertions(+), 11 deletions(-) diff --git a/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st b/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st index 7cee27a92..36e1252c8 100644 --- a/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st @@ -61,6 +61,131 @@ GtFilterModelExamples >> shortListModel [ ^ aModel ] +{ #category : #examples } +GtFilterModelExamples >> shortListModelPluggableItems [ + + | aModel allItems aCollection anIconBuilder aLabelBuilder | + aModel := GtFilterShortListModel new. + + aCollection := {Array. + OrderedCollection. + TGtAnnouncer. + Object. + ProtoObject}. + anIconBuilder := [ :aClass | + aClass gtSystemIconName + ifNotNil: [ :anIconName | aClass gtSafeIconNamed: anIconName ] ]. + aLabelBuilder := [ :aClass | aClass name ]. + allItems := GtFilterModelPluggableItem + forCollection: aCollection + icon: anIconBuilder + label: aLabelBuilder. + + aModel items: allItems. + aModel selectFirstItem. + aModel label: 'Classes'. + + self + assert: aModel selectedItem + equals: (GtFilterModelPluggableItem new + object: Array; + icon: anIconBuilder; + label: aLabelBuilder). + self assert: aModel selectedItem icon isNotNil. + + ^ aModel +] + +{ #category : #examples } +GtFilterModelExamples >> shortListModelPluggableItemsWithIconAndLabelBuilders [ + + | aModel aCollection anIconBuilder aLabelBuilder | + aModel := GtFilterShortListModel new. + + aCollection := {Array. + OrderedCollection. + TGtAnnouncer. + Object. + ProtoObject}. + anIconBuilder := [ :aClass | + aClass gtSystemIconName + ifNotNil: [ :anIconName | aClass gtSafeIconNamed: anIconName ] ]. + aLabelBuilder := [ :aClass | aClass name ]. + + aModel items: aCollection icon: anIconBuilder label: aLabelBuilder. + aModel selectFirstItem. + aModel label: 'Classes'. + + self + assert: aModel selectedItem + equals: (GtFilterModelPluggableItem new + object: Array; + icon: anIconBuilder; + label: aLabelBuilder). + self assert: aModel selectedItem icon isNotNil. + self assert: aModel selectedItem label equals: 'Array'. + + ^ aModel +] + +{ #category : #examples } +GtFilterModelExamples >> shortListModelPluggableItemsWithoutIconBuilder [ + + | aModel aCollection aLabelBuilder | + aModel := GtFilterShortListModel new. + + aCollection := {Array. + OrderedCollection. + TGtAnnouncer. + Object. + ProtoObject}. + aLabelBuilder := [ :aClass | '+ ', aClass name ]. + + aModel items: aCollection label: aLabelBuilder. + aModel selectFirstItem. + aModel label: 'Classes'. + + self + assert: aModel selectedItem + equals: (GtFilterModelPluggableItem new + object: Array; + label: aLabelBuilder). + self assert: aModel selectedItem icon isNil. + self assert: aModel selectedItem label equals: '+ Array'. + + ^ aModel +] + +{ #category : #examples } +GtFilterModelExamples >> shortListModelPluggableItemsWithoutLabelBuilder [ + + | aModel aCollection anIconBuilder | + aModel := GtFilterShortListModel new. + + aCollection := {Array. + OrderedCollection. + TGtAnnouncer. + Object. + ProtoObject}. + anIconBuilder := [ :aClass | + aClass gtSystemIconName + ifNotNil: [ :anIconName | aClass gtSafeIconNamed: anIconName ] ]. + + aModel items: aCollection icon: anIconBuilder. + aModel selectFirstItem. + aModel label: 'Classes'. + + self + assert: aModel selectedItem + equals: (GtFilterModelPluggableItem new + object: Array; + icon: anIconBuilder). + self assert: aModel selectedItem icon isNotNil. + self assert: aModel selectedItem label equals: 'Array'. + + ^ aModel +] + { #category : #examples } GtFilterModelExamples >> shortListModelWithIcons [ diff --git a/src/GToolkit-Coder-UI/GtFilterModelItemIconStencilBuilder.class.st b/src/GToolkit-Coder-UI/GtFilterModelItemIconStencilBuilder.class.st index bceec40a1..828948ddd 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelItemIconStencilBuilder.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelItemIconStencilBuilder.class.st @@ -9,9 +9,7 @@ Class { { #category : #'api - instantiation' } GtFilterModelItemIconStencilBuilder >> buildDefault [ - ^ BlElement new - size: 8 @ 8; - background: BlBackground transparent + ^ nil ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtFilterModelItemLabelStencilBuilder.class.st b/src/GToolkit-Coder-UI/GtFilterModelItemLabelStencilBuilder.class.st index 975932876..053f26fc8 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelItemLabelStencilBuilder.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelItemLabelStencilBuilder.class.st @@ -9,7 +9,7 @@ Class { { #category : #'api - instantiation' } GtFilterModelItemLabelStencilBuilder >> buildDefault [ - ^ 'none' + ^ object gtDisplayString ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtFilterModelPluggableItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelPluggableItem.class.st index ea4ba07e8..4b5f59e0b 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelPluggableItem.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelPluggableItem.class.st @@ -9,6 +9,15 @@ Class { #category : #'GToolkit-Coder-UI-Filters - Models' } +{ #category : #'instance creation' } +GtFilterModelPluggableItem class >> forCollection: aCollection icon: anIconStencilBuilder [ + ^ aCollection + collect: [ :eachObject | + self new + object: eachObject; + icon: anIconStencilBuilder ] +] + { #category : #'instance creation' } GtFilterModelPluggableItem class >> forCollection: aCollection icon: anIconStencilBuilder label: aLabelStencilBuilder [ ^ aCollection @@ -19,6 +28,22 @@ GtFilterModelPluggableItem class >> forCollection: aCollection icon: anIconStenc label: aLabelStencilBuilder ] ] +{ #category : #'instance creation' } +GtFilterModelPluggableItem class >> forCollection: aCollection label: aLabelStencilBuilder [ + ^ aCollection + collect: [ :eachObject | + self new + object: eachObject; + label: aLabelStencilBuilder ] +] + +{ #category : #'instance creation' } +GtFilterModelPluggableItem class >> forObject: anObject icon: anIconStencilBuilder [ + ^ self new + object: anObject; + icon: anIconStencilBuilder +] + { #category : #'instance creation' } GtFilterModelPluggableItem class >> forObject: anObject icon: anIconStencilBuilder label: aLabelStencilBuilder [ ^ self new @@ -27,18 +52,25 @@ GtFilterModelPluggableItem class >> forObject: anObject icon: anIconStencilBuild label: aLabelStencilBuilder ] +{ #category : #'instance creation' } +GtFilterModelPluggableItem class >> forObject: anObject label: aLabelStencilBuilder [ + ^ self new + object: anObject; + label: aLabelStencilBuilder +] + { #category : #accessing } GtFilterModelPluggableItem >> icon [ - + ^ iconStencilBuilder object: self object; - asElement + build ] { #category : #accessing } GtFilterModelPluggableItem >> icon: aStencilBuilder [ iconStencilBuilder := aStencilBuilder - asStencilBuilder: GtFilterModelItemIconStencilBuilder new + asStencilBuilder: GtFilterModelItemIconStencilBuilder ] { #category : #initialization } @@ -58,13 +90,13 @@ GtFilterModelPluggableItem >> label [ ^ labelStencilBuilder object: self object; - create + build ] { #category : #accessing } GtFilterModelPluggableItem >> label: aStencilBuilder [ labelStencilBuilder := aStencilBuilder - asStencilBuilder: GtFilterModelItemLabelStencilBuilder new + asStencilBuilder: GtFilterModelItemLabelStencilBuilder ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtFilterModelPluggableItemsBuilder.class.st b/src/GToolkit-Coder-UI/GtFilterModelPluggableItemsBuilder.class.st index 652a5ff84..ca0b220b2 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelPluggableItemsBuilder.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelPluggableItemsBuilder.class.st @@ -28,7 +28,7 @@ GtFilterModelPluggableItemsBuilder >> iconStencilBuilder [ { #category : #accessing } GtFilterModelPluggableItemsBuilder >> iconStencilBuilder: aStencilBuilder [ iconStencilBuilder := aStencilBuilder - asStencilBuilder: GtFilterModelItemIconStencilBuilder new + asStencilBuilder: GtFilterModelItemIconStencilBuilder ] { #category : #initialization } @@ -57,5 +57,5 @@ GtFilterModelPluggableItemsBuilder >> labelStencilBuilder [ { #category : #accessing } GtFilterModelPluggableItemsBuilder >> labelStencilBuilder: aStencilBuilder [ labelStencilBuilder := aStencilBuilder - asStencilBuilder: GtFilterModelItemLabelStencilBuilder new + asStencilBuilder: GtFilterModelItemLabelStencilBuilder ] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st index f4a6a932a..8b128100c 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st @@ -30,6 +30,16 @@ GtFilterShortListModel >> items: anObject [ self itemsBuilder: anObject ] +{ #category : #accessing } +GtFilterShortListModel >> items: anObject icon: anIconStencilBuilder [ + | aNewItemsBuilder aPluggableItemsBuilder | + aNewItemsBuilder := anObject asFilterModelItemsBuilder. + aPluggableItemsBuilder := GtFilterModelPluggableItemsBuilder new + itemsBuilder: aNewItemsBuilder; + iconStencilBuilder: anIconStencilBuilder. + self itemsBuilder: aPluggableItemsBuilder +] + { #category : #accessing } GtFilterShortListModel >> items: anObject icon: anIconStencilBuilder label: aLabelStencilBuilder [ | aNewItemsBuilder aPluggableItemsBuilder | @@ -41,6 +51,16 @@ GtFilterShortListModel >> items: anObject icon: anIconStencilBuilder label: aLab self itemsBuilder: aPluggableItemsBuilder ] +{ #category : #accessing } +GtFilterShortListModel >> items: anObject label: aLabelStencilBuilder [ + | aNewItemsBuilder aPluggableItemsBuilder | + aNewItemsBuilder := anObject asFilterModelItemsBuilder. + aPluggableItemsBuilder := GtFilterModelPluggableItemsBuilder new + itemsBuilder: aNewItemsBuilder; + labelStencilBuilder: aLabelStencilBuilder. + self itemsBuilder: aPluggableItemsBuilder +] + { #category : #accessing } GtFilterShortListModel >> itemsBuilder [ From 6366fb78f93d44688691d24362cadd245410ed8c Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 10 Oct 2024 19:58:42 -0300 Subject: [PATCH 0727/1268] clean filter model pluggable item [feenkcom/gtoolkit#3983] --- ...FilterModelItemIconStencilBuilder.class.st | 7 ++++++- .../GtFilterModelObjectItem.class.st | 2 +- .../GtFilterModelPluggableItem.class.st | 10 ++++++++++ .../GtFilterToggleModel.class.st | 20 +++++++++++++++++++ 4 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterModelItemIconStencilBuilder.class.st b/src/GToolkit-Coder-UI/GtFilterModelItemIconStencilBuilder.class.st index 828948ddd..89b5af25e 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelItemIconStencilBuilder.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelItemIconStencilBuilder.class.st @@ -9,7 +9,12 @@ Class { { #category : #'api - instantiation' } GtFilterModelItemIconStencilBuilder >> buildDefault [ - ^ nil + + | anIconName | + anIconName := self object gtIconName. + (anIconName isNil or: [ anIconName = Object gtIconName ]) ifTrue: [ ^ nil ]. + + ^ (self object gtSafeIconNamed: anIconName) ifNotNil: #asElement ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtFilterModelObjectItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelObjectItem.class.st index 27aabac66..742367016 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelObjectItem.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelObjectItem.class.st @@ -24,7 +24,7 @@ GtFilterModelObjectItem >> itemValue [ { #category : #accessing } GtFilterModelObjectItem >> label [ - ^ self object asString + ^ self object gtDisplayString ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtFilterModelPluggableItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelPluggableItem.class.st index 4b5f59e0b..33a4ac98d 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelPluggableItem.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelPluggableItem.class.st @@ -108,3 +108,13 @@ GtFilterModelPluggableItem >> object [ GtFilterModelPluggableItem >> object: anObject [ object := anObject ] + +{ #category : #printing } +GtFilterModelPluggableItem >> printOn: aStream [ + super printOn: aStream. + + aStream + nextPut: $(; + print: self object; + nextPut: $) +] diff --git a/src/GToolkit-Coder-UI/GtFilterToggleModel.class.st b/src/GToolkit-Coder-UI/GtFilterToggleModel.class.st index ba1d14416..c51168525 100644 --- a/src/GToolkit-Coder-UI/GtFilterToggleModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterToggleModel.class.st @@ -32,6 +32,16 @@ GtFilterToggleModel >> items: anObject [ self itemsBuilder: anObject ] +{ #category : #accessing } +GtFilterToggleModel >> items: anObject icon: anIconStencilBuilder [ + | aNewItemsBuilder aPluggableItemsBuilder | + aNewItemsBuilder := anObject asFilterModelItemsBuilder. + aPluggableItemsBuilder := GtFilterModelPluggableItemsBuilder new + itemsBuilder: aNewItemsBuilder; + iconStencilBuilder: anIconStencilBuilder. + self itemsBuilder: aPluggableItemsBuilder +] + { #category : #accessing } GtFilterToggleModel >> items: anObject icon: anIconStencilBuilder label: aLabelStencilBuilder [ | aNewItemsBuilder aPluggableItemsBuilder | @@ -43,6 +53,16 @@ GtFilterToggleModel >> items: anObject icon: anIconStencilBuilder label: aLabelS self itemsBuilder: aPluggableItemsBuilder ] +{ #category : #accessing } +GtFilterToggleModel >> items: anObject label: aLabelStencilBuilder [ + | aNewItemsBuilder aPluggableItemsBuilder | + aNewItemsBuilder := anObject asFilterModelItemsBuilder. + aPluggableItemsBuilder := GtFilterModelPluggableItemsBuilder new + itemsBuilder: aNewItemsBuilder; + labelStencilBuilder: aLabelStencilBuilder. + self itemsBuilder: aPluggableItemsBuilder +] + { #category : #accessing } GtFilterToggleModel >> itemsBuilder [ From b880b8c58f83bdb0dc9bd36a384d321640359ade Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 10 Oct 2024 22:45:39 -0300 Subject: [PATCH 0728/1268] notify about filters updates only if an added/removed filter has a selected value [feenkcom/gtoolkit#3983] --- .../GtFilterModelExamples.class.st | 267 ++++++++++++++++++ .../GtFilterItemsModel.class.st | 8 + src/GToolkit-Coder-UI/GtFilterModel.class.st | 8 + .../GtFilterShortListModel.class.st | 8 + .../GtFilterTextModel.class.st | 8 + .../GtFilterToggleModel.class.st | 8 + 6 files changed, 307 insertions(+) diff --git a/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st b/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st index 36e1252c8..f43280ab8 100644 --- a/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st @@ -42,6 +42,273 @@ GtFilterModelExamples >> itemsModel [ ^ aModel ] +{ #category : #examples } +GtFilterModelExamples >> itemsModelWithAddingShortListModelWithSelectedValue [ + + | aFiltersModel aFilterModel someAnnouncements | + someAnnouncements := OrderedCollection new. + aFiltersModel := GtFilterItemsModel new. + aFiltersModel weak + when: GtFiltersModelUpdated + send: #add: + to: someAnnouncements. + + aFilterModel := self shortListModel. + self assert: (aFilterModel selectedItem ifSome: [ true ] ifNone: [ false ]). + + aFiltersModel addFilterModel: aFilterModel. + + self assert: aFiltersModel items size equals: 1. + self assert: someAnnouncements size equals: 1. + + ^ aFiltersModel +] + +{ #category : #examples } +GtFilterModelExamples >> itemsModelWithAddingShortListModelWithoutSelectedValue [ + + | aFiltersModel aFilterModel someAnnouncements | + someAnnouncements := OrderedCollection new. + aFiltersModel := GtFilterItemsModel new. + aFiltersModel weak + when: GtFiltersModelUpdated + send: #add: + to: someAnnouncements. + + aFilterModel := self shortListModel. + aFilterModel selectedItem: GtFilterModelNoItem default. + self assert: (aFilterModel selectedItem ifSome: [ false ] ifNone: [ true ]). + + aFiltersModel addFilterModel: aFilterModel. + + self assert: aFiltersModel items size equals: 1. + self assert: someAnnouncements size equals: 0. + + ^ aFiltersModel +] + +{ #category : #examples } +GtFilterModelExamples >> itemsModelWithAddingTextModelWithEmptyText [ + + | aFiltersModel aFilterModel someAnnouncements | + someAnnouncements := OrderedCollection new. + aFiltersModel := GtFilterItemsModel new. + aFiltersModel weak + when: GtFiltersModelUpdated + send: #add: + to: someAnnouncements. + + aFilterModel := self textModel. + aFilterModel text: ''. + self assert: aFilterModel text isEmpty. + + aFiltersModel addFilterModel: aFilterModel. + + self assert: aFiltersModel items size equals: 1. + self assert: someAnnouncements size equals: 0. + + ^ aFiltersModel +] + +{ #category : #examples } +GtFilterModelExamples >> itemsModelWithAddingTextModelWithNonEmptyText [ + + | aFiltersModel aFilterModel someAnnouncements | + someAnnouncements := OrderedCollection new. + aFiltersModel := GtFilterItemsModel new. + aFiltersModel weak + when: GtFiltersModelUpdated + send: #add: + to: someAnnouncements. + + aFilterModel := self textModel. + self assert: aFilterModel text isEmpty not. + + aFiltersModel addFilterModel: aFilterModel. + + self assert: aFiltersModel items size equals: 1. + self assert: someAnnouncements size equals: 1. + + ^ aFiltersModel +] + +{ #category : #examples } +GtFilterModelExamples >> itemsModelWithAddingToggleModelWithSelectedValue [ + + | aFiltersModel aFilterModel someAnnouncements | + someAnnouncements := OrderedCollection new. + aFiltersModel := GtFilterItemsModel new. + aFiltersModel weak + when: GtFiltersModelUpdated + send: #add: + to: someAnnouncements. + + aFilterModel := self toggleModel. + self assert: (aFilterModel selectedItem ifSome: [ true ] ifNone: [ false ]). + + aFiltersModel addFilterModel: aFilterModel. + + self assert: aFiltersModel items size equals: 1. + self assert: someAnnouncements size equals: 1. + + ^ aFiltersModel +] + +{ #category : #examples } +GtFilterModelExamples >> itemsModelWithAddingToggleModelWithoutSelectedValue [ + + | aFiltersModel aFilterModel someAnnouncements | + someAnnouncements := OrderedCollection new. + aFiltersModel := GtFilterItemsModel new. + aFiltersModel weak + when: GtFiltersModelUpdated + send: #add: + to: someAnnouncements. + + aFilterModel := self toggleModel. + aFilterModel selectedItem: GtFilterModelNoItem default. + self assert: (aFilterModel selectedItem ifSome: [ false ] ifNone: [ true ]). + + aFiltersModel addFilterModel: aFilterModel. + + self assert: aFiltersModel items size equals: 1. + self assert: someAnnouncements size equals: 0. + + ^ aFiltersModel +] + +{ #category : #examples } +GtFilterModelExamples >> itemsModelWithRemovingShortListModelWithSelectedValue [ + + | aFiltersModel aFilterModel someAnnouncements | + someAnnouncements := OrderedCollection new. + aFiltersModel := self itemsModelWithAddingShortListModelWithSelectedValue. + aFiltersModel weak + when: GtFiltersModelUpdated + send: #add: + to: someAnnouncements. + + aFilterModel := aFiltersModel items first. + self assert: (aFilterModel selectedItem ifSome: [ true ] ifNone: [ false ]). + + aFiltersModel removeFilterModel: aFilterModel. + + self assert: aFiltersModel items size equals: 0. + self assert: someAnnouncements size equals: 1. + + ^ aFiltersModel +] + +{ #category : #examples } +GtFilterModelExamples >> itemsModelWithRemovingShortListModelWithoutSelectedValue [ + + | aFiltersModel aFilterModel someAnnouncements | + someAnnouncements := OrderedCollection new. + aFiltersModel := self itemsModelWithAddingShortListModelWithoutSelectedValue. + aFiltersModel weak + when: GtFiltersModelUpdated + send: #add: + to: someAnnouncements. + + aFilterModel := aFiltersModel items first. + self assert: (aFilterModel selectedItem ifSome: [ false ] ifNone: [ true ]). + + aFiltersModel removeFilterModel: aFilterModel. + + self assert: aFiltersModel items size equals: 0. + self assert: someAnnouncements size equals: 0. + + ^ aFiltersModel +] + +{ #category : #examples } +GtFilterModelExamples >> itemsModelWithRemovingTextModelWithEmptyText [ + + | aFiltersModel aFilterModel someAnnouncements | + someAnnouncements := OrderedCollection new. + aFiltersModel := self itemsModelWithAddingTextModelWithEmptyText. + aFiltersModel weak + when: GtFiltersModelUpdated + send: #add: + to: someAnnouncements. + + aFilterModel := aFiltersModel items first. + self assert: aFilterModel text isEmpty. + + aFiltersModel removeFilterModel: aFilterModel. + + self assert: aFiltersModel items size equals: 0. + self assert: someAnnouncements size equals: 0. + + ^ aFiltersModel +] + +{ #category : #examples } +GtFilterModelExamples >> itemsModelWithRemovingTextModelWithNonEmptyText [ + + | aFiltersModel aFilterModel someAnnouncements | + someAnnouncements := OrderedCollection new. + aFiltersModel := self itemsModelWithAddingTextModelWithNonEmptyText. + aFiltersModel weak + when: GtFiltersModelUpdated + send: #add: + to: someAnnouncements. + + aFilterModel := aFiltersModel items first. + self assert: aFilterModel text isEmpty not. + + aFiltersModel removeFilterModel: aFilterModel. + + self assert: aFiltersModel items size equals: 0. + self assert: someAnnouncements size equals: 1. + + ^ aFiltersModel +] + +{ #category : #examples } +GtFilterModelExamples >> itemsModelWithRemovingToggleModelWithSelectedValue [ + + | aFiltersModel aFilterModel someAnnouncements | + someAnnouncements := OrderedCollection new. + aFiltersModel := self itemsModelWithAddingToggleModelWithSelectedValue. + aFiltersModel weak + when: GtFiltersModelUpdated + send: #add: + to: someAnnouncements. + + aFilterModel := aFiltersModel items first. + self assert: (aFilterModel selectedItem ifSome: [ true ] ifNone: [ false ]). + + aFiltersModel removeFilterModel: aFilterModel. + + self assert: aFiltersModel items size equals: 0. + self assert: someAnnouncements size equals: 1. + + ^ aFiltersModel +] + +{ #category : #examples } +GtFilterModelExamples >> itemsModelWithRemovingToggleModelWithoutSelectedValue [ + + | aFiltersModel aFilterModel someAnnouncements | + someAnnouncements := OrderedCollection new. + aFiltersModel := self itemsModelWithAddingToggleModelWithoutSelectedValue. + aFiltersModel weak + when: GtFiltersModelUpdated + send: #add: + to: someAnnouncements. + + aFilterModel := aFiltersModel items first. + self assert: (aFilterModel selectedItem ifSome: [ false ] ifNone: [ true ]). + + aFiltersModel removeFilterModel: aFilterModel. + + self assert: aFiltersModel items size equals: 0. + self assert: someAnnouncements size equals: 0. + + ^ aFiltersModel +] + { #category : #examples } GtFilterModelExamples >> shortListModel [ diff --git a/src/GToolkit-Coder-UI/GtFilterItemsModel.class.st b/src/GToolkit-Coder-UI/GtFilterItemsModel.class.st index 4bc51c387..10b28e787 100644 --- a/src/GToolkit-Coder-UI/GtFilterItemsModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterItemsModel.class.st @@ -24,6 +24,8 @@ GtFilterItemsModel >> addFilterModel: aFilterModel [ items := aCollection. self subscribeToItem: aFilterModel. self notifyItemAdded: aFilterModel. + + aFilterModel changesFilteredResult ifFalse: [ ^ self ]. self notifyFiltersUpdated. ] @@ -80,6 +82,10 @@ GtFilterItemsModel >> items: aCollection [ { #category : #'private - notifying' } GtFilterItemsModel >> notifyFiltersUpdated [ + "This announcement must be delivered only if the update changes search filter results. + For example, we do not want to announce it if an added or removed filter model + does not have a selected value." + self announce: (GtFiltersModelUpdated new model: self) ] @@ -133,6 +139,8 @@ GtFilterItemsModel >> removeFilterModel: aFilterModel [ self unsubscribeFromItem: aFilterModel. items := aCollection. self notifyItemRemoved: aFilterModel. + + aFilterModel changesFilteredResult ifFalse: [ ^ self ]. self notifyFiltersUpdated. ] diff --git a/src/GToolkit-Coder-UI/GtFilterModel.class.st b/src/GToolkit-Coder-UI/GtFilterModel.class.st index 09d0dfd0b..896203ddd 100644 --- a/src/GToolkit-Coder-UI/GtFilterModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModel.class.st @@ -48,6 +48,14 @@ GtFilterModel >> asUserSettingsElement [ ^ self asFilterViewModel asUserSettingsElement ] +{ #category : #testing } +GtFilterModel >> changesFilteredResult [ + "Indicates whether it changes a result of filtered items, e.g., list of method coders." + + + ^ true +] + { #category : #accessing } GtFilterModel >> creator [ ^ creator diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st index 8b128100c..da16d72b5 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st @@ -8,6 +8,14 @@ Class { #category : #'GToolkit-Coder-UI-Filters - Models' } +{ #category : #testing } +GtFilterShortListModel >> changesFilteredResult [ + "Indicates whether it changes a result of filtered items, e.g., list of method coders." + + + ^ self selectedItem ifSome: [ true ] ifNone: [ false ] +] + { #category : #accessing } GtFilterShortListModel >> filterViewModelClass [ ^ GtFilterShortListViewModel diff --git a/src/GToolkit-Coder-UI/GtFilterTextModel.class.st b/src/GToolkit-Coder-UI/GtFilterTextModel.class.st index 123153389..4d4fe7fc4 100644 --- a/src/GToolkit-Coder-UI/GtFilterTextModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTextModel.class.st @@ -9,6 +9,14 @@ Class { #category : #'GToolkit-Coder-UI-Filters - Models' } +{ #category : #testing } +GtFilterTextModel >> changesFilteredResult [ + "Indicates whether it changes a result of filtered items, e.g., list of method coders." + + + ^ self text isEmpty ifFalse: [ true ] ifTrue: [ false ] +] + { #category : #accessing } GtFilterTextModel >> completion [ diff --git a/src/GToolkit-Coder-UI/GtFilterToggleModel.class.st b/src/GToolkit-Coder-UI/GtFilterToggleModel.class.st index c51168525..66e59d70b 100644 --- a/src/GToolkit-Coder-UI/GtFilterToggleModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterToggleModel.class.st @@ -9,6 +9,14 @@ Class { #category : #'GToolkit-Coder-UI-Filters - Models' } +{ #category : #testing } +GtFilterToggleModel >> changesFilteredResult [ + "Indicates whether it changes a result of filtered items, e.g., list of method coders." + + + ^ self selectedItem ifSome: [ true ] ifNone: [ false ] +] + { #category : #accessing } GtFilterToggleModel >> filterViewModelClass [ From 9650d6c9e7d50a98c7fdba6ae30411cc4a12250c Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 10 Oct 2024 23:18:00 -0300 Subject: [PATCH 0729/1268] focus text filter editor when the widget is added to the scene [feenkcom/gtoolkit#3983] --- ...rFocusIntendedPartAfterAddingWish.class.st | 5 +++ .../GtFilterItemsElement.class.st | 2 +- .../GtFilterNameElement.class.st | 39 +++++++++++++------ .../GtFilterTextSettingsElement.class.st | 11 +++++- 4 files changed, 44 insertions(+), 13 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtFilterFocusIntendedPartAfterAddingWish.class.st diff --git a/src/GToolkit-Coder-UI/GtFilterFocusIntendedPartAfterAddingWish.class.st b/src/GToolkit-Coder-UI/GtFilterFocusIntendedPartAfterAddingWish.class.st new file mode 100644 index 000000000..008aabca0 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterFocusIntendedPartAfterAddingWish.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtFilterFocusIntendedPartAfterAddingWish, + #superclass : #BrWish, + #category : #'GToolkit-Coder-UI-Filters - Events' +} diff --git a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st index 795b17405..a2a229284 100644 --- a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st @@ -35,7 +35,7 @@ GtFilterItemsElement >> addItemElementForViewModel: aFilterViewModel [ ifNone: [ ^ self ]. anElement := self addElementForFilterViewModel: aFilterViewModel index: anIndex. - anElement fireEvent: GtFilterFocusFirstPartWish new + anElement fireEvent: GtFilterFocusIntendedPartAfterAddingWish new ] { #category : #'private - updating' } diff --git a/src/GToolkit-Coder-UI/GtFilterNameElement.class.st b/src/GToolkit-Coder-UI/GtFilterNameElement.class.st index b7a436373..9f81e17c9 100644 --- a/src/GToolkit-Coder-UI/GtFilterNameElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterNameElement.class.st @@ -42,7 +42,8 @@ GtFilterNameElement >> initialize [ GtFilterNameElement >> initializeEventHandlers [ self when: BlClickEvent do: [ :anEvent | self onClickEvent: anEvent ]. self when: GtFilterEditWish do: [ :anEvent | self onEditWish: anEvent ]. - self when: GtFilterFocusFirstPartWish do: [ :anEvent | self onFocusFirstPartWish: anEvent ]. + self when: GtFilterFocusIntendedPartAfterAddingWish do: [ :anEvent | + self onFocusFirstPartWish: anEvent ]. self when: GtFilterFocusWholeWish do: [ :anEvent | self onFocusWholeWish: anEvent ]. self when: GtFilterFocusNextPartWish do: [ :anEvent | self onFocusNextPartdWish: anEvent ] ] @@ -97,10 +98,8 @@ GtFilterNameElement >> onClickEvent: anEvent [ { #category : #'event handling' } GtFilterNameElement >> onEditWish: anEvent [ - settingsContainer - childWithId: GtFilterSettingsId - ifFound: [ :anElement | anElement dispatchEvent: GtFilterEditWish new ] - ifNone: [ ] + self + settingsElementDo: [ :anElement | anElement dispatchEvent: GtFilterEditWish new ] ] { #category : #'api - filter view model' } @@ -111,12 +110,23 @@ GtFilterNameElement >> onFilterViewModelChanged [ { #category : #'event handling' } GtFilterNameElement >> onFocusFirstPartWish: anEvent [ anEvent consumed: true. - BlFocusFinder new - right; - root: settingsContainer; - referenceElement: settingsContainer; - nextFocusDo: [ :anElement | anElement requestFocus ] - ifNone: [ self requestFocus ] + self + settingsElementDo: [ :aSettingsElement | + | aWish | + aWish := GtFilterFocusFirstPartWish new. + aSettingsElement dispatchEvent: aWish. + aWish isConsumed ifFalse: [ self requestFocus ] ]. + + true ifTrue: [ ^ self ]. + self requestFocus. + BlTaskAction + enqueueElement: self + action: [ BlFocusFinder new + right; + root: settingsContainer; + referenceElement: settingsContainer; + nextFocusDo: [ :anElement | anElement requestFocus ] + ifNone: [ self requestFocus ] ] ] { #category : #'event handling' } @@ -142,6 +152,13 @@ GtFilterNameElement >> removeSettingsElement [ settingsContainer removeChildren ] +{ #category : #accessing } +GtFilterNameElement >> settingsElementDo: aBlock [ + | aChild | + aChild := settingsContainer children at: 1 ifAbsent: [ ^ self ]. + aBlock cull: aChild +] + { #category : #'api - filter view model' } GtFilterNameElement >> subscribeToFilterViewModel [ self filterViewModel weak diff --git a/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st index ba93f6246..3dedf0d4a 100644 --- a/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st @@ -69,7 +69,10 @@ GtFilterTextSettingsElement >> initializeEditorElement [ { #category : #initialization } GtFilterTextSettingsElement >> initializeEventHandlers [ - self when: GtFilterEditWish do: [ :anEvent | self onEditWish: anEvent ] + self when: GtFilterEditWish do: [ :anEvent | self onEditWish: anEvent ]. + self + when: GtFilterFocusFirstPartWish + do: [ :anEvent | self onFocusFirstPartWish: anEvent ] ] { #category : #'event handling' } @@ -85,6 +88,12 @@ GtFilterTextSettingsElement >> onFilterViewModelChanged [ self updateEditorElement ] +{ #category : #'event handling' } +GtFilterTextSettingsElement >> onFocusFirstPartWish: anEvent [ + anEvent consumed: true. + editorElement requestFocus +] + { #category : #'event handling' } GtFilterTextSettingsElement >> onInputFilterChanged: anAnnouncement [ BlTaskAction From 10281232f07443e5c57637b271ee3f1eb3bcf186 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 10 Oct 2024 23:18:45 -0300 Subject: [PATCH 0730/1268] use backspace shortcut only on filter widgets [feenkcom/gtoolkit#3983] --- .../GtFilterItemsElement.class.st | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st index a2a229284..66862a60d 100644 --- a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st @@ -22,6 +22,16 @@ GtFilterItemsElement >> addElementForFilterViewModel: aFilterViewModel index: an self addNavigationShortcutsTo: anElement. self addRemoveButtonIconTo: anElement. + anElement + addShortcut: (BlShortcutWithAction new + name: 'Remove filter'; + combination: (BlKeyCombination backspace or: BlKeyCombination delete); + overrideChildren: false; + action: [ :anEvent | + self + onRemoveFilterViewModelOfElement: anEvent currentTarget + from: anEvent currentTarget ]). + self addChild: anElement at: anIndex. ^ anElement @@ -85,14 +95,6 @@ GtFilterItemsElement >> addNavigationShortcutsTo: anElement [ root: self; referenceElement: anEvent currentTarget; nextFocusDo: #requestFocus ifNone: [ ] ]); - addShortcut: (BlShortcutWithAction new - name: 'Remove filter'; - combination: (BlKeyCombination backspace or: BlKeyCombination delete); - overrideChildren: false; - action: [ :anEvent | - self - onRemoveFilterViewModelOfElement: anEvent currentTarget - from: anEvent currentTarget ]); addShortcut: (BlShortcutWithAction new name: 'Edit filter'; combination: (BlKeyCombination space or: BlKeyCombination enter); From 537a158765c64c5d9db95e1b8499ae14a518cb07 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 11 Oct 2024 09:39:42 -0300 Subject: [PATCH 0731/1268] Refactor same code to `GtFilterSelectableItemModel` [feenkcom/gtoolkit#3983] --- .../GtFilterSelectableItemModel.class.st | 136 ++++++++++++++++++ .../GtFilterShortListModel.class.st | 127 +--------------- .../GtFilterToggleModel.class.st | 128 +---------------- 3 files changed, 138 insertions(+), 253 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtFilterSelectableItemModel.class.st diff --git a/src/GToolkit-Coder-UI/GtFilterSelectableItemModel.class.st b/src/GToolkit-Coder-UI/GtFilterSelectableItemModel.class.st new file mode 100644 index 000000000..cb2b43296 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterSelectableItemModel.class.st @@ -0,0 +1,136 @@ +Class { + #name : #GtFilterSelectableItemModel, + #superclass : #GtFilterModel, + #instVars : [ + 'items', + 'selectedItem', + 'itemsBuilder' + ], + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #testing } +GtFilterSelectableItemModel class >> isAbstract [ + ^ self name = #GtFilterSelectableItemModel +] + +{ #category : #testing } +GtFilterSelectableItemModel >> changesFilteredResult [ + "Indicates whether it changes a result of filtered items, e.g., list of method coders." + + + ^ self selectedItem ifSome: [ true ] ifNone: [ false ] +] + +{ #category : #initialization } +GtFilterSelectableItemModel >> initialize [ + super initialize. + itemsBuilder := GtFilterModelEmptyItemsBuilder default. +] + +{ #category : #accessing } +GtFilterSelectableItemModel >> items [ + + ^ itemsBuilder create +] + +{ #category : #accessing } +GtFilterSelectableItemModel >> items: anObject [ + self itemsBuilder: anObject +] + +{ #category : #accessing } +GtFilterSelectableItemModel >> items: anObject icon: anIconStencilBuilder [ + | aNewItemsBuilder aPluggableItemsBuilder | + aNewItemsBuilder := anObject asFilterModelItemsBuilder. + aPluggableItemsBuilder := GtFilterModelPluggableItemsBuilder new + itemsBuilder: aNewItemsBuilder; + iconStencilBuilder: anIconStencilBuilder. + self itemsBuilder: aPluggableItemsBuilder +] + +{ #category : #accessing } +GtFilterSelectableItemModel >> items: anObject icon: anIconStencilBuilder label: aLabelStencilBuilder [ + | aNewItemsBuilder aPluggableItemsBuilder | + aNewItemsBuilder := anObject asFilterModelItemsBuilder. + aPluggableItemsBuilder := GtFilterModelPluggableItemsBuilder new + itemsBuilder: aNewItemsBuilder; + iconStencilBuilder: anIconStencilBuilder; + labelStencilBuilder: aLabelStencilBuilder. + self itemsBuilder: aPluggableItemsBuilder +] + +{ #category : #accessing } +GtFilterSelectableItemModel >> items: anObject label: aLabelStencilBuilder [ + | aNewItemsBuilder aPluggableItemsBuilder | + aNewItemsBuilder := anObject asFilterModelItemsBuilder. + aPluggableItemsBuilder := GtFilterModelPluggableItemsBuilder new + itemsBuilder: aNewItemsBuilder; + labelStencilBuilder: aLabelStencilBuilder. + self itemsBuilder: aPluggableItemsBuilder +] + +{ #category : #accessing } +GtFilterSelectableItemModel >> itemsBuilder [ + + ^ itemsBuilder +] + +{ #category : #accessing } +GtFilterSelectableItemModel >> itemsBuilder: anObject [ + | aNewItemsBuilder | + aNewItemsBuilder := anObject asFilterModelItemsBuilder. + self itemsBuilder = aNewItemsBuilder ifTrue: [ ^ self ]. + itemsBuilder := aNewItemsBuilder. + aNewItemsBuilder filterModel: self. + + self notifyItemsChanged +] + +{ #category : #'private - notifying' } +GtFilterSelectableItemModel >> notifyItemsChanged [ + self + announce: (GtFilterModelItemsChanged new + model: self; + itemsBuilder: self itemsBuilder) +] + +{ #category : #'private - notifying' } +GtFilterSelectableItemModel >> notifySelectedItemChanged [ + self + announce: (GtFilterModelSelectedItemChanged new + model: self; + selectedItem: self selectedItem) +] + +{ #category : #initialization } +GtFilterSelectableItemModel >> selectFirstItem [ + self itemsBuilder firstItemDo: [ :anItem | self selectedItem: anItem ] +] + +{ #category : #initialization } +GtFilterSelectableItemModel >> selectLastItem [ + self itemsBuilder lastItemDo: [ :anItem | self selectedItem: anItem ] +] + +{ #category : #accessing } +GtFilterSelectableItemModel >> selectedItem [ + ^ selectedItem ifNil: [ selectedItem := GtFilterModelNoItem default ] +] + +{ #category : #accessing } +GtFilterSelectableItemModel >> selectedItem: anItem [ + | aNewItem | + aNewItem := anItem asFilterModelItem. + self selectedItem = aNewItem ifTrue: [ ^ self ]. + + selectedItem := aNewItem. + self notifySelectedItemChanged +] + +{ #category : #accessing } +GtFilterSelectableItemModel >> selectedValue [ + "Return a filter value, e.g., selected item, input text." + + ^ self selectedItem +] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st index da16d72b5..0153994ba 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st @@ -1,135 +1,10 @@ Class { #name : #GtFilterShortListModel, - #superclass : #GtFilterModel, - #instVars : [ - 'selectedItem', - 'itemsBuilder' - ], + #superclass : #GtFilterSelectableItemModel, #category : #'GToolkit-Coder-UI-Filters - Models' } -{ #category : #testing } -GtFilterShortListModel >> changesFilteredResult [ - "Indicates whether it changes a result of filtered items, e.g., list of method coders." - - - ^ self selectedItem ifSome: [ true ] ifNone: [ false ] -] - { #category : #accessing } GtFilterShortListModel >> filterViewModelClass [ ^ GtFilterShortListViewModel ] - -{ #category : #initialization } -GtFilterShortListModel >> initialize [ - super initialize. - itemsBuilder := GtFilterModelEmptyItemsBuilder default. -] - -{ #category : #accessing } -GtFilterShortListModel >> items [ - - ^ itemsBuilder create -] - -{ #category : #accessing } -GtFilterShortListModel >> items: anObject [ - self itemsBuilder: anObject -] - -{ #category : #accessing } -GtFilterShortListModel >> items: anObject icon: anIconStencilBuilder [ - | aNewItemsBuilder aPluggableItemsBuilder | - aNewItemsBuilder := anObject asFilterModelItemsBuilder. - aPluggableItemsBuilder := GtFilterModelPluggableItemsBuilder new - itemsBuilder: aNewItemsBuilder; - iconStencilBuilder: anIconStencilBuilder. - self itemsBuilder: aPluggableItemsBuilder -] - -{ #category : #accessing } -GtFilterShortListModel >> items: anObject icon: anIconStencilBuilder label: aLabelStencilBuilder [ - | aNewItemsBuilder aPluggableItemsBuilder | - aNewItemsBuilder := anObject asFilterModelItemsBuilder. - aPluggableItemsBuilder := GtFilterModelPluggableItemsBuilder new - itemsBuilder: aNewItemsBuilder; - iconStencilBuilder: anIconStencilBuilder; - labelStencilBuilder: aLabelStencilBuilder. - self itemsBuilder: aPluggableItemsBuilder -] - -{ #category : #accessing } -GtFilterShortListModel >> items: anObject label: aLabelStencilBuilder [ - | aNewItemsBuilder aPluggableItemsBuilder | - aNewItemsBuilder := anObject asFilterModelItemsBuilder. - aPluggableItemsBuilder := GtFilterModelPluggableItemsBuilder new - itemsBuilder: aNewItemsBuilder; - labelStencilBuilder: aLabelStencilBuilder. - self itemsBuilder: aPluggableItemsBuilder -] - -{ #category : #accessing } -GtFilterShortListModel >> itemsBuilder [ - - ^ itemsBuilder -] - -{ #category : #accessing } -GtFilterShortListModel >> itemsBuilder: anObject [ - | aNewItemsBuilder | - aNewItemsBuilder := anObject asFilterModelItemsBuilder. - self itemsBuilder = aNewItemsBuilder ifTrue: [ ^ self ]. - itemsBuilder := aNewItemsBuilder. - aNewItemsBuilder filterModel: self. - - self notifyItemsChanged -] - -{ #category : #'private - notifying' } -GtFilterShortListModel >> notifyItemsChanged [ - self - announce: (GtFilterModelItemsChanged new - model: self; - itemsBuilder: self itemsBuilder) -] - -{ #category : #'private - notifying' } -GtFilterShortListModel >> notifySelectedItemChanged [ - self - announce: (GtFilterModelSelectedItemChanged new - model: self; - selectedItem: self selectedItem) -] - -{ #category : #initialization } -GtFilterShortListModel >> selectFirstItem [ - self itemsBuilder firstItemDo: [ :anItem | self selectedItem: anItem ] -] - -{ #category : #initialization } -GtFilterShortListModel >> selectLastItem [ - self itemsBuilder lastItemDo: [ :anItem | self selectedItem: anItem ] -] - -{ #category : #accessing } -GtFilterShortListModel >> selectedItem [ - ^ selectedItem ifNil: [ selectedItem := GtFilterModelNoItem default ] -] - -{ #category : #accessing } -GtFilterShortListModel >> selectedItem: anItem [ - | aNewItem | - aNewItem := anItem asFilterModelItem. - self selectedItem = aNewItem ifTrue: [ ^ self ]. - - selectedItem := aNewItem. - self notifySelectedItemChanged -] - -{ #category : #accessing } -GtFilterShortListModel >> selectedValue [ - "Return a filter value, e.g., selected item, input text." - - ^ self selectedItem -] diff --git a/src/GToolkit-Coder-UI/GtFilterToggleModel.class.st b/src/GToolkit-Coder-UI/GtFilterToggleModel.class.st index 66e59d70b..f128903d6 100644 --- a/src/GToolkit-Coder-UI/GtFilterToggleModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterToggleModel.class.st @@ -1,137 +1,11 @@ Class { #name : #GtFilterToggleModel, - #superclass : #GtFilterModel, - #instVars : [ - 'items', - 'selectedItem', - 'itemsBuilder' - ], + #superclass : #GtFilterSelectableItemModel, #category : #'GToolkit-Coder-UI-Filters - Models' } -{ #category : #testing } -GtFilterToggleModel >> changesFilteredResult [ - "Indicates whether it changes a result of filtered items, e.g., list of method coders." - - - ^ self selectedItem ifSome: [ true ] ifNone: [ false ] -] - { #category : #accessing } GtFilterToggleModel >> filterViewModelClass [ ^ GtFilterToggleViewModel ] - -{ #category : #initialization } -GtFilterToggleModel >> initialize [ - super initialize. - itemsBuilder := GtFilterModelEmptyItemsBuilder default. -] - -{ #category : #accessing } -GtFilterToggleModel >> items [ - - ^ itemsBuilder create -] - -{ #category : #accessing } -GtFilterToggleModel >> items: anObject [ - self itemsBuilder: anObject -] - -{ #category : #accessing } -GtFilterToggleModel >> items: anObject icon: anIconStencilBuilder [ - | aNewItemsBuilder aPluggableItemsBuilder | - aNewItemsBuilder := anObject asFilterModelItemsBuilder. - aPluggableItemsBuilder := GtFilterModelPluggableItemsBuilder new - itemsBuilder: aNewItemsBuilder; - iconStencilBuilder: anIconStencilBuilder. - self itemsBuilder: aPluggableItemsBuilder -] - -{ #category : #accessing } -GtFilterToggleModel >> items: anObject icon: anIconStencilBuilder label: aLabelStencilBuilder [ - | aNewItemsBuilder aPluggableItemsBuilder | - aNewItemsBuilder := anObject asFilterModelItemsBuilder. - aPluggableItemsBuilder := GtFilterModelPluggableItemsBuilder new - itemsBuilder: aNewItemsBuilder; - iconStencilBuilder: anIconStencilBuilder; - labelStencilBuilder: aLabelStencilBuilder. - self itemsBuilder: aPluggableItemsBuilder -] - -{ #category : #accessing } -GtFilterToggleModel >> items: anObject label: aLabelStencilBuilder [ - | aNewItemsBuilder aPluggableItemsBuilder | - aNewItemsBuilder := anObject asFilterModelItemsBuilder. - aPluggableItemsBuilder := GtFilterModelPluggableItemsBuilder new - itemsBuilder: aNewItemsBuilder; - labelStencilBuilder: aLabelStencilBuilder. - self itemsBuilder: aPluggableItemsBuilder -] - -{ #category : #accessing } -GtFilterToggleModel >> itemsBuilder [ - - ^ itemsBuilder -] - -{ #category : #accessing } -GtFilterToggleModel >> itemsBuilder: anObject [ - | aNewItemsBuilder | - aNewItemsBuilder := anObject asFilterModelItemsBuilder. - self itemsBuilder = aNewItemsBuilder ifTrue: [ ^ self ]. - itemsBuilder := aNewItemsBuilder. - aNewItemsBuilder filterModel: self. - - self notifyItemsChanged -] - -{ #category : #'private - notifying' } -GtFilterToggleModel >> notifyItemsChanged [ - self - announce: (GtFilterModelItemsChanged new - model: self; - itemsBuilder: self itemsBuilder) -] - -{ #category : #'private - notifying' } -GtFilterToggleModel >> notifySelectedItemChanged [ - self - announce: (GtFilterModelSelectedItemChanged new - model: self; - selectedItem: self selectedItem) -] - -{ #category : #initialization } -GtFilterToggleModel >> selectFirstItem [ - self itemsBuilder firstItemDo: [ :anItem | self selectedItem: anItem ] -] - -{ #category : #initialization } -GtFilterToggleModel >> selectLastItem [ - self itemsBuilder lastItemDo: [ :anItem | self selectedItem: anItem ] -] - -{ #category : #accessing } -GtFilterToggleModel >> selectedItem [ - ^ selectedItem ifNil: [ selectedItem := GtFilterModelNoItem default ] -] - -{ #category : #accessing } -GtFilterToggleModel >> selectedItem: anItem [ - | aNewItem | - aNewItem := anItem asFilterModelItem. - self selectedItem = aNewItem ifTrue: [ ^ self ]. - - selectedItem := aNewItem. - self notifySelectedItemChanged -] - -{ #category : #accessing } -GtFilterToggleModel >> selectedValue [ - "Return a filter value, e.g., selected item, input text." - - ^ self selectedItem -] From 6a93c184c8cc57110212a1a21153274d9e79a2ce Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 11 Oct 2024 09:49:48 -0300 Subject: [PATCH 0732/1268] Refactor same code to `GtFilterSelectableItemViewModel` [feenkcom/gtoolkit#3983] --- .../GtFilterSelectableItemViewModel.class.st | 58 +++++++++++++++++++ .../GtFilterShortListViewModel.class.st | 58 +------------------ .../GtFilterToggleViewModel.class.st | 55 +----------------- 3 files changed, 60 insertions(+), 111 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtFilterSelectableItemViewModel.class.st diff --git a/src/GToolkit-Coder-UI/GtFilterSelectableItemViewModel.class.st b/src/GToolkit-Coder-UI/GtFilterSelectableItemViewModel.class.st new file mode 100644 index 000000000..b738be116 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterSelectableItemViewModel.class.st @@ -0,0 +1,58 @@ +Class { + #name : #GtFilterSelectableItemViewModel, + #superclass : #GtFilterViewModel, + #category : #'GToolkit-Coder-UI-Filters - View Models' +} + +{ #category : #accessing } +GtFilterSelectableItemViewModel >> items [ + ^ self filterModel items +] + +{ #category : #accessing } +GtFilterSelectableItemViewModel >> items: aCollection [ + self filterModel items: aCollection +] + +{ #category : #accessing } +GtFilterSelectableItemViewModel >> itemsCount [ + ^ self filterModel items size +] + +{ #category : #'event handling' } +GtFilterSelectableItemViewModel >> onItemsChanged: anAnnouncement [ + self + announce: (GtFilterViewModelItemsChanged new + viewModel: self; + itemsBuilder: anAnnouncement itemsBuilder) +] + +{ #category : #'event handling' } +GtFilterSelectableItemViewModel >> onSelectedItemChanged: anAnnouncement [ + self + announce: (GtFilterViewModelSelectedItemChanged new + viewModel: self; + selectedItem: anAnnouncement selectedItem) +] + +{ #category : #accessing } +GtFilterSelectableItemViewModel >> selectedItem [ + ^ self filterModel selectedItem +] + +{ #category : #accessing } +GtFilterSelectableItemViewModel >> selectedItem: anItem [ + self filterModel selectedItem: anItem +] + +{ #category : #'api - filter model' } +GtFilterSelectableItemViewModel >> subscribeToFilterModel [ + super subscribeToFilterModel. + self filterModel weak + when: GtFilterModelItemsChanged + send: #onItemsChanged: + to: self; + when: GtFilterModelSelectedItemChanged + send: #onSelectedItemChanged: + to: self +] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListViewModel.class.st b/src/GToolkit-Coder-UI/GtFilterShortListViewModel.class.st index ec5a8c6b8..71efd4ba0 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListViewModel.class.st @@ -1,6 +1,6 @@ Class { #name : #GtFilterShortListViewModel, - #superclass : #GtFilterViewModel, + #superclass : #GtFilterSelectableItemViewModel, #category : #'GToolkit-Coder-UI-Filters - View Models' } @@ -9,64 +9,8 @@ GtFilterShortListViewModel >> filterElementClass [ ^ GtFilterShortListSettingsElement ] -{ #category : #accessing } -GtFilterShortListViewModel >> items [ - - ^ self filterModel items -] - -{ #category : #accessing } -GtFilterShortListViewModel >> items: aCollection [ - self filterModel items: aCollection -] - -{ #category : #accessing } -GtFilterShortListViewModel >> itemsCount [ - - ^ self filterModel items size -] - { #category : #accessing } GtFilterShortListViewModel >> itemsWithoutSelection [ ^ self filterModel items select: [ :each | self selectedItem ~= each ] ] - -{ #category : #'event handling' } -GtFilterShortListViewModel >> onItemsChanged: anAnnouncement [ - self - announce: (GtFilterViewModelItemsChanged new - viewModel: self; - itemsBuilder: anAnnouncement itemsBuilder) -] - -{ #category : #'api - filter model' } -GtFilterShortListViewModel >> onSelectedItemChanged: anAnnouncement [ - self - announce: (GtFilterViewModelSelectedItemChanged new - viewModel: self; - selectedItem: anAnnouncement selectedItem) -] - -{ #category : #accessing } -GtFilterShortListViewModel >> selectedItem [ - - ^ self filterModel selectedItem -] - -{ #category : #accessing } -GtFilterShortListViewModel >> selectedItem: anItem [ - self filterModel selectedItem: anItem -] - -{ #category : #'api - filter model' } -GtFilterShortListViewModel >> subscribeToFilterModel [ - super subscribeToFilterModel. - self filterModel weak - when: GtFilterModelItemsChanged - send: #onItemsChanged: - to: self; - when: GtFilterModelSelectedItemChanged - send: #onSelectedItemChanged: - to: self -] diff --git a/src/GToolkit-Coder-UI/GtFilterToggleViewModel.class.st b/src/GToolkit-Coder-UI/GtFilterToggleViewModel.class.st index 80cd6d99a..4f399a695 100644 --- a/src/GToolkit-Coder-UI/GtFilterToggleViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterToggleViewModel.class.st @@ -1,6 +1,6 @@ Class { #name : #GtFilterToggleViewModel, - #superclass : #GtFilterViewModel, + #superclass : #GtFilterSelectableItemViewModel, #category : #'GToolkit-Coder-UI-Filters - View Models' } @@ -9,56 +9,3 @@ GtFilterToggleViewModel >> filterElementClass [ ^ GtFilterToggleSettingsElement ] - -{ #category : #accessing } -GtFilterToggleViewModel >> items [ - ^ self filterModel items -] - -{ #category : #accessing } -GtFilterToggleViewModel >> items: aCollection [ - self filterModel items: aCollection -] - -{ #category : #accessing } -GtFilterToggleViewModel >> itemsCount [ - ^ self filterModel items size -] - -{ #category : #'event handling' } -GtFilterToggleViewModel >> onItemsChanged: anAnnouncement [ - self - announce: (GtFilterViewModelItemsChanged new - viewModel: self; - items: anAnnouncement items) -] - -{ #category : #'event handling' } -GtFilterToggleViewModel >> onSelectedItemChanged: anAnnouncement [ - self - announce: (GtFilterViewModelSelectedItemChanged new - viewModel: self; - selectedItem: anAnnouncement selectedItem) -] - -{ #category : #accessing } -GtFilterToggleViewModel >> selectedItem [ - ^ self filterModel selectedItem -] - -{ #category : #accessing } -GtFilterToggleViewModel >> selectedItem: anItem [ - self filterModel selectedItem: anItem -] - -{ #category : #'api - filter model' } -GtFilterToggleViewModel >> subscribeToFilterModel [ - super subscribeToFilterModel. - self filterModel weak - when: GtFilterModelItemsChanged - send: #onItemsChanged: - to: self; - when: GtFilterModelSelectedItemChanged - send: #onSelectedItemChanged: - to: self -] From 5153675e29d58993b19b6296125c16e9d78f0aa4 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 11 Oct 2024 14:01:33 -0300 Subject: [PATCH 0733/1268] toggle filter widget is navigable using keyboard keys [feenkcom/gtoolkit#3983] --- .../GtFilterToggleSettingsElement.class.st | 145 ++++++++++++++++-- 1 file changed, 128 insertions(+), 17 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterToggleSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterToggleSettingsElement.class.st index 557820eae..3fe76076c 100644 --- a/src/GToolkit-Coder-UI/GtFilterToggleSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterToggleSettingsElement.class.st @@ -12,13 +12,28 @@ GtFilterToggleSettingsElement >> initialize [ super initialize. self initializeToggleGroupElement. - self addChild: toggleGroupElement as: #toggles + self addChild: toggleGroupElement as: #toggles. + self initializeEventHandlers. + self initializeShortcuts +] + +{ #category : #initialization } +GtFilterToggleSettingsElement >> initializeEventHandlers [ + self when: GtFilterEditWish do: [ :anEvent | self onEditWish: anEvent ]. + self + when: GtFilterFocusFirstPartWish + do: [ :anEvent | self onFocusFirstPartWish: anEvent ] +] + +{ #category : #initialization } +GtFilterToggleSettingsElement >> initializeShortcuts [ ] { #category : #initialization } GtFilterToggleSettingsElement >> initializeToggleGroupElement [ toggleGroupElement := BrToggleGroup new aptitude: BrGlamorousToggleGroupAptitude new; + background: self theme default contentBackgroundColor; when: BrToggleActivatedEvent do: [ :anEvent | self onToggleActivatedEvent: anEvent ] ] @@ -30,21 +45,52 @@ GtFilterToggleSettingsElement >> newAptitudeForItem: anItem [ ifIconAndLabel: [ BrGlamorousToggleWithIconAndLabelAptitude new ] ifIcon: [ BrGlamorousToggleWithIconAptitude new ] ifLabel: [ BrGlamorousToggleWithLabelAptitude new ]. - - "anAptitude - BrGlamorousToggleBackgroundAptitude. - anAptitude add: (BrToggleAptitude new - activated: [ :aStyle | aStyle visibility: BlVisibility visible ]; - default: [ :aStyle | aStyle visibility: BlVisibility hidden ])" - + ^ anAptitude ] +{ #category : #'private - updating' } +GtFilterToggleSettingsElement >> newToggleForItem: aFilterItem index: anIndex [ + | aToggle | + aToggle := BrToggle new. + aToggle id: (GtFilterItemId indexed: anIndex). + aToggle beFocusable. + aToggle beSmallSize. + aToggle viewModel model: aFilterItem. + aFilterItem == self filterViewModel selectedItem ifTrue: [ aToggle activate ]. + aFilterItem ifIcon: [ :anIcon | aToggle icon: anIcon ]. + aFilterItem ifLabel: [ :aLabel | aToggle label: aLabel ]. + aToggle aptitude: (self newAptitudeForItem: aFilterItem). + aToggle addAptitude: (BrStyleCommonAptitude new + // #label; + default: [ :aStyle | aStyle foreground: self theme button defaultTextColor ]; + focused: [ :aStyle | aStyle foreground: self theme button hoveredTextColor ]). + aToggle + when: BlMouseEnterEvent + do: [ :anEvent | self onToggleMouseEnterEvent: anEvent ]. + + self registerNavigationShortcutsForToggle: aToggle. + ^ aToggle +] + +{ #category : #'private - updating' } +GtFilterToggleSettingsElement >> onEditWish: anEvent [ + anEvent consumed: true. + self requestToggleFocus +] + { #category : #'api - filter view model' } GtFilterToggleSettingsElement >> onFilterViewModelChanged [ super onFilterViewModelChanged. self updateElement ] +{ #category : #'event handling' } +GtFilterToggleSettingsElement >> onFocusFirstPartWish: anEvent [ + anEvent consumed: true. + self requestToggleFocus +] + { #category : #'event handling' } GtFilterToggleSettingsElement >> onItemsChanged: anAnnouncement [ BlTaskAction enqueueElement: self action: [ self updateElement ] @@ -62,6 +108,79 @@ GtFilterToggleSettingsElement >> onToggleActivatedEvent: anEvent [ self filterViewModel selectedItem: anItem ] ] +{ #category : #'event handling' } +GtFilterToggleSettingsElement >> onToggleEnterShortcutEvent: anEvent [ + self hasFilterViewModel ifFalse: [ ^ self ]. + anEvent consumed: true. + anEvent currentTarget activate. +] + +{ #category : #'event handling' } +GtFilterToggleSettingsElement >> onToggleMouseEnterEvent: anEvent [ + "Change focused if another toggle is focused." + + | aHoveredToggle aResult | + anEvent consumed: true. + aResult := toggleGroupElement viewModel toggles + anySatisfy: [ :eachToggle | + | isToggleFocused | + isToggleFocused := false. + eachToggle widgetDo: [ :aWidget | isToggleFocused := aWidget isFocused ]. + isToggleFocused ]. + aResult ifFalse: [ ^ self ]. + + aHoveredToggle := anEvent currentTarget. + aHoveredToggle requestFocus +] + +{ #category : #'event handling' } +GtFilterToggleSettingsElement >> onToggleMoveLeftShortcutEvent: anEvent [ + anEvent consumed: true. + BlFocusFinder new + left; + root: toggleGroupElement; + referenceElement: anEvent currentTarget; + nextFocusDo: #requestFocus + ifNone: [ self fireEvent: GtFilterFocusWholeWish new ] +] + +{ #category : #'event handling' } +GtFilterToggleSettingsElement >> onToggleMoveRightShortcutEvent: anEvent [ + anEvent consumed: true. + BlFocusFinder new + right; + root: toggleGroupElement; + referenceElement: anEvent currentTarget; + nextFocusDo: #requestFocus + ifNone: [ self fireEvent: GtFilterFocusNextPartWish new ] +] + +{ #category : #'private - updating' } +GtFilterToggleSettingsElement >> registerNavigationShortcutsForToggle: aToggle [ + aToggle + addShortcut: (BlShortcutWithAction new + name: 'Select filter item'; + description: 'Accept new filter item and store it into the filter model'; + combination: BlKeyCombination enter; + action: [ :anEvent | self onToggleEnterShortcutEvent: anEvent ]); + addShortcut: (BlShortcutWithAction new + name: 'Move previous filter item'; + combination: (BlKeyCombination arrowLeft or: BlKeyCombination shiftTab); + action: [ :anEvent | self onToggleMoveLeftShortcutEvent: anEvent ]); + addShortcut: (BlShortcutWithAction new + name: 'Move next filter item'; + combination: (BlKeyCombination arrowRight or: BlKeyCombination tab); + action: [ :anEvent | self onToggleMoveRightShortcutEvent: anEvent ]) +] + +{ #category : #'event handling' } +GtFilterToggleSettingsElement >> requestToggleFocus [ + toggleGroupElement viewModel hasActivatedToggle + ifTrue: [ toggleGroupElement activatedToggle requestFocus ] + ifFalse: [ toggleGroupElement toggles + ifNotEmpty: [ :aCollection | aCollection first requestFocus ] ] +] + { #category : #'api - filter view model' } GtFilterToggleSettingsElement >> subscribeToFilterViewModel [ super subscribeToFilterViewModel. @@ -93,19 +212,11 @@ GtFilterToggleSettingsElement >> updateElement [ { #category : #'private - updating' } GtFilterToggleSettingsElement >> updateToggles [ - | aSelectedItem | toggleGroupElement removeToggles. - aSelectedItem := self filterViewModel selectedItem. self filterViewModel items - do: [ :eachItem | + doWithIndex: [ :eachItem :anIndex | | aToggle | - aToggle := BrToggle new. - aToggle beSmallSize. - aToggle viewModel model: eachItem. - eachItem == aSelectedItem ifTrue: [ aToggle activate ]. - eachItem ifIcon: [ :anIcon | aToggle icon: anIcon ]. - eachItem ifLabel: [ :aLabel | aToggle label: aLabel ]. - aToggle aptitude: (self newAptitudeForItem: eachItem). + aToggle := self newToggleForItem: eachItem index: anIndex. toggleGroupElement addToggle: aToggle ] ] From 4ce370b3d94bd06b8bc45102b9f65a1f89a887f4 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 11 Oct 2024 20:50:09 -0300 Subject: [PATCH 0734/1268] improve `GtSourceCoderShortcut>>#gtSourceCodeFor:` --- .../GtSourceCoderShortcut.extension.st | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-Extensions/GtSourceCoderShortcut.extension.st b/src/GToolkit-Coder-Extensions/GtSourceCoderShortcut.extension.st index fed9eee31..48bfcc954 100644 --- a/src/GToolkit-Coder-Extensions/GtSourceCoderShortcut.extension.st +++ b/src/GToolkit-Coder-Extensions/GtSourceCoderShortcut.extension.st @@ -1,11 +1,13 @@ Extension { #name : #GtSourceCoderShortcut } { #category : #'*GToolkit-Coder-Extensions' } -GtSourceCoderShortcut >> gtSourceCodeFor: aView [ +GtSourceCoderShortcut >> gtSourceCodeFor: aView [ - ^ aView forward title: 'Source'; - object: [ self class >> #performOnEditor:element:coderViewModel:dueTo: ]; + object: [ + (self class includesSelector: #performOnEditor:element:coderViewModel:dueTo:) + ifTrue: [ self class >> #performOnEditor:element:coderViewModel:dueTo: ] + ifFalse: [ self class >> #performOnEditor:element:coder:dueTo:requesterObject: ] ]; view: #gtSourceFor: ] From ca910004e3229cad0b138e84e2109213f5434729 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 11 Oct 2024 21:28:58 -0300 Subject: [PATCH 0735/1268] add focus filters widgeet shortcut [feenkcom/gtoolkit#3983] 2x `PRIMARY+SHIFT+S` focuses methods coder's filters --- .../GtFilterItemsElement.class.st | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st index 66862a60d..6a1506e56 100644 --- a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st @@ -200,6 +200,7 @@ GtFilterItemsElement >> initialize [ self padding: (BlInsets top: 5 right: 2 bottom: 2 left: 1). self clipChildren: false. self initializeEventHandlers. + self initializeShortcuts. ] { #category : #initialization } @@ -207,6 +208,19 @@ GtFilterItemsElement >> initializeEventHandlers [ ] +{ #category : #initialization } +GtFilterItemsElement >> initializeShortcuts [ + self + addShortcut: (BlShortcutWithAction new + name: 'Add new filter'; + combination: (BlKeyCombination builder + shift; + primary; + s; + build); + action: [ :anEvent | self onAddNewFilterShortcutEvent: anEvent ]) +] + { #category : #'private - updating' } GtFilterItemsElement >> newAddFilterButton [ ^ self newAddFilterHandleElement @@ -236,7 +250,9 @@ GtFilterItemsElement >> newAddFilterButton [ combination: BlKeyCombination enter; action: [ :anEvent | anEvent currentTarget dispatchEvent: BrDropdownShowWish new ]); when: BrDropdownIsHidden - do: [ :anEvent | self onAddFilterDropdownIsHiddenEvent: anEvent ] + do: [ :anEvent | self onAddFilterDropdownIsHiddenEvent: anEvent ]; + when: GtFilterEditWish + do: [ :anEvent | anEvent currentTarget dispatchEvent: BrDropdownShowWish new ] ] { #category : #'private - updating' } @@ -267,6 +283,15 @@ GtFilterItemsElement >> onAddFilterDropdownIsHiddenEvent: anEvent [ anEvent currentTarget requestFocus ] +{ #category : #'event handling' } +GtFilterItemsElement >> onAddNewFilterShortcutEvent: anEvent [ + self hasChildren ifFalse: [ ^ self ]. + anEvent consumed: true. + self children last + requestFocus; + dispatchEvent: GtFilterEditWish new +] + { #category : #'event handling' } GtFilterItemsElement >> onAddSelectedItemEvent: aShortcutEvent [ | anElementList | From cd94121c17ef6d5c789a65f325cf826c07480042 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 11 Oct 2024 21:46:17 -0300 Subject: [PATCH 0736/1268] indicate empty add-model dropdown [feenkcom/gtoolkit#3983] --- .../GtFilterItemsElement.class.st | 9 ++++++--- src/GToolkit-Coder-UI/GtFilterModel.class.st | 5 +++++ .../GtFilterVirtualEmptyModel.class.st | 17 +++++++++++++++++ 3 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtFilterVirtualEmptyModel.class.st diff --git a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st index 6a1506e56..9ed44e496 100644 --- a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st @@ -135,7 +135,8 @@ GtFilterItemsElement >> createDropdownContent [ ^ aListElement vFitContentLimited; hFitContentLimited; - constraintsDo: [ :c | c maxHeight: 100 ]; + constraintsDo: [ :c | + c maxHeight: 100 ]; itemStencil: [ :anItemType | self createItemElementForListElement: aListElement ]; itemDataBinder: [ :anItemElement :anItemObject :anItemIndex | anItemElement id: (GtFilterItemId indexed: anItemIndex). @@ -148,8 +149,8 @@ GtFilterItemsElement >> createDropdownContent [ (anItemElement childAt: 1) text: ''. anItemElement ]; items: (self hasFiltersViewModel - ifTrue: [ self filtersViewModel availableFilters ] - ifFalse: [ #() ]); + ifTrue: [ self filtersViewModel availableFilters ifEmpty: [ {GtFilterVirtualEmptyModel default} ] ] + ifFalse: [ {GtFilterVirtualEmptyModel default} ]); when: BlElementAddedToSceneGraphEvent do: [ :anEvent | self onListElementAddedToSceneGraph: anEvent ]; addShortcut: (BlShortcutWithAction new @@ -342,6 +343,7 @@ GtFilterItemsElement >> onItemMouseClickEvent: anEvent [ anEvent consumed: true. anEvent currentTarget fireEvent: BrDropdownHideWish new. aModel := anEvent currentTarget userData at: GtFilterModel ifAbsent: [ nil ]. + aModel isVirtualFilterModel ifTrue: [ ^ self ]. self requestAddFilterModel: aModel ] @@ -416,6 +418,7 @@ GtFilterItemsElement >> removeItemElementForViewModel: aFilterViewModel [ { #category : #'event handling' } GtFilterItemsElement >> requestAddFilterModel: aFilterModel [ aFilterModel ifNil: [ ^ self ]. + aFilterModel isVirtualFilterModel ifTrue: [ ^ self ]. self hasFiltersViewModel ifFalse: [ ^ self ]. self filtersViewModel addFilterModel: aFilterModel diff --git a/src/GToolkit-Coder-UI/GtFilterModel.class.st b/src/GToolkit-Coder-UI/GtFilterModel.class.st index 896203ddd..fd0e13067 100644 --- a/src/GToolkit-Coder-UI/GtFilterModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModel.class.st @@ -105,6 +105,11 @@ GtFilterModel >> hash [ bitXor: self order hash) ] +{ #category : #testing } +GtFilterModel >> isVirtualFilterModel [ + ^ false +] + { #category : #accessing } GtFilterModel >> label [ "Return filter label" diff --git a/src/GToolkit-Coder-UI/GtFilterVirtualEmptyModel.class.st b/src/GToolkit-Coder-UI/GtFilterVirtualEmptyModel.class.st new file mode 100644 index 000000000..5530eab09 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterVirtualEmptyModel.class.st @@ -0,0 +1,17 @@ +Class { + #name : #GtFilterVirtualEmptyModel, + #superclass : #GtFilterModel, + #traits : 'TGtUniqueInstance', + #classTraits : 'TGtUniqueInstance classTrait', + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #testing } +GtFilterVirtualEmptyModel >> isVirtualFilterModel [ + ^ true +] + +{ #category : #accessing } +GtFilterVirtualEmptyModel >> label [ + ^ 'empty' +] From a33bf04cd486cd4e604a9421cb2d375f673a22da Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 14 Oct 2024 12:18:40 +0200 Subject: [PATCH 0737/1268] [feenkcom/gtoolkit#4085] extract protocols group header element into a separate class. correctly handle class side --- ...tCoderProtocolsGroupHeaderElement.class.st | 151 ++++++++++++++++++ ...tCoderProtocolsGroupedListElement.class.st | 129 +-------------- 2 files changed, 156 insertions(+), 124 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderProtocolsGroupHeaderElement.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupHeaderElement.class.st b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupHeaderElement.class.st new file mode 100644 index 000000000..e4686f8f9 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupHeaderElement.class.st @@ -0,0 +1,151 @@ +Class { + #name : #GtCoderProtocolsGroupHeaderElement, + #superclass : #BrHorizontalPane, + #instVars : [ + 'targetClass', + 'addProtocolButton', + 'protocolLabel' + ], + #category : #'GToolkit-Coder-UI-Navigation - Helpers' +} + +{ #category : #'as yet unclassified' } +GtCoderProtocolsGroupHeaderElement >> addProtocolFrom: aProtocolEditor [ + self + addProtocolNamed: aProtocolEditor text asString trimmed + in: targetClass. + + ^ aProtocolEditor fireEvent: BrDropdownHideWish new +] + +{ #category : #'as yet unclassified' } +GtCoderProtocolsGroupHeaderElement >> addProtocolNamed: aProtocolName in: aClass [ + | refactoring | + + aProtocolName ifEmpty: [ ^ self ]. + aClass ifNil: [ ^ self ]. + + refactoring := RBAddProtocolChange + addProtocolNamed: aProtocolName + in: aClass. + + refactoring execute +] + +{ #category : #'as yet unclassified' } +GtCoderProtocolsGroupHeaderElement >> createAddProtocolButton [ + | aButtonStencil aPopUp | + aButtonStencil := [ + BrButton new + beTinySize; + aptitude: (BrGlamorousButtonRectangularAptitude paddingScale: 0) + BrGlamorousButtonIconAptitude; + icon: BrGlamorousVectorIcons add ] asStencil. + + aPopUp := BrGlamorousWithDropdownAptitude + handle: aButtonStencil + content: [ :aButton | self createNewProtocolForm ]. + + ^ aButtonStencil asElement + addAptitude: (BrGlamorousButtonFlatExteriorAptitude new + backgroundPaint: (Color gray alpha: 0.1)); + addAptitude: BrGlamorousButtonWithLabelTooltipAptitude; + addAptitude: aPopUp; + label: 'Add new protocol' +] + +{ #category : #'as yet unclassified' } +GtCoderProtocolsGroupHeaderElement >> createNewProtocolForm [ + | aContainer aProtocolEditor aDefaultText aProtocolCompleter anAcceptButton | + aDefaultText := '' asRopedText + attribute: (BrGhostTextAttribute + for: ('new protocol name' asRopedText glamorousFormEditorCodeFontAndSize + foreground: Color lightGray)). + + aContainer := BrHorizontalPane new + padding: (BlInsets + top: 6 + right: 2 + bottom: 6 + left: 2); + cellSpacing: 6; + alignCenterLeft; + fitContent. + + aProtocolEditor := BrEditor new + aptitude: BrGlamorousRegularEditorAptitude new glamorousRegularSmallSize + + BrGlamorousInputFieldSpacingAptitude; + beMode: BrTextEditorEditableSingleLineMode new; + geometry: (BlRoundedRectangleGeometry cornerRadius: 4); + vFitContent; + hFitContent; + constraintsDo: [ :c | c minWidth: 150 ]; + text: aDefaultText; + requestFocus. + + aProtocolCompleter := GtCompletionController + on: aProtocolEditor + strategy: GtMethodProtocolCompletionStrategy new. + + aProtocolCompleter install. + + aProtocolEditor + addEditorShortcut: (BlShortcutWithAction new + combination: BlKeyCombination escape; + action: [ :anEvent | aProtocolEditor fireEvent: BrDropdownHideWish new ]). + + aProtocolEditor + addEditorShortcut: (BlShortcutWithAction new + combination: BlKeyCombination enter; + action: [ :anEvent | self addProtocolFrom: aProtocolEditor ]). + + aContainer addChild: aProtocolEditor. + + anAcceptButton := BrButton new + beSmallSize; + aptitude: (BrGlamorousButtonRectangularAptitude paddingScale: 0.5) + + BrGlamorousButtonIconAptitude + + (BrGlamorousButtonFlatExteriorAptitude new + backgroundPaint: (Color gray alpha: 0.1)) + + BrGlamorousButtonWithLabelTooltipAptitude; + icon: BrGlamorousVectorIcons accept; + label: 'Add protocol'; + action: [ self addProtocolFrom: aProtocolEditor ]. + + aContainer addChild: anAcceptButton. + + ^ aContainer +] + +{ #category : #'as yet unclassified' } +GtCoderProtocolsGroupHeaderElement >> initialize [ + super initialize. + + self + alignCenterLeft; + hMatchParent; + vFitContent. + + protocolLabel := BrLabel new + beSmallSize + padding: (BlInsets top: 2 bottom: 2); + aptitude: (BrGlamorousLabelAptitude new foreground: Color gray). + + addProtocolButton := self createAddProtocolButton. + self addChildren: { protocolLabel . addProtocolButton } +] + +{ #category : #'as yet unclassified' } +GtCoderProtocolsGroupHeaderElement >> protocolsGroupName: aGroupName targetClass: aClass [ + protocolLabel text: aGroupName asRopedText. + + targetClass := nil. + aClass ifNotNil: [ + aGroupName = 'instance side' + ifTrue: [ targetClass := aClass instanceSide ]. + aGroupName = 'class side' + ifTrue: [ targetClass := aClass classSide ] ]. + + targetClass + ifNil: [ addProtocolButton visibility: BlVisibility gone ] + ifNotNil: [ addProtocolButton visibility: BlVisibility visible ]. +] diff --git a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st index 47b8e3fe6..42b272187 100644 --- a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st @@ -19,27 +19,6 @@ Class { #category : #'GToolkit-Coder-UI-Navigation - Helpers' } -{ #category : #'private - refactorings' } -GtCoderProtocolsGroupedListElement >> addProtocolFrom: aProtocolEditor [ - self navigationModel - selectedClassDo: [ :aClass | self addProtocolNamed: aProtocolEditor text asString trimmed in: aClass ]. - - ^ aProtocolEditor fireEvent: BrDropdownHideWish new -] - -{ #category : #'private - refactorings' } -GtCoderProtocolsGroupedListElement >> addProtocolNamed: aProtocolName in: aClass [ - | refactoring | - - aProtocolName ifEmpty: [ ^ self ]. - - refactoring := RBAddProtocolChange - addProtocolNamed: aProtocolName - in: aClass. - - refactoring execute -] - { #category : #'private - instance creation' } GtCoderProtocolsGroupedListElement >> bindProtocol: item toElement: element [ | itemText | @@ -52,90 +31,6 @@ GtCoderProtocolsGroupedListElement >> bindProtocol: item toElement: element [ ^ element text: itemText ] -{ #category : #'private - instance creation' } -GtCoderProtocolsGroupedListElement >> createAddProtocolButton [ - | aButtonStencil aPopUp | - aButtonStencil := [ - BrButton new - beTinySize; - aptitude: (BrGlamorousButtonRectangularAptitude paddingScale: 0) + BrGlamorousButtonIconAptitude; - icon: BrGlamorousVectorIcons add ] asStencil. - - aPopUp := BrGlamorousWithDropdownAptitude - handle: aButtonStencil - content: [ :aButton | self createNewProtocolForm ]. - - ^ aButtonStencil asElement - addAptitude: (BrGlamorousButtonFlatExteriorAptitude new - backgroundPaint: (Color gray alpha: 0.1)); - addAptitude: BrGlamorousButtonWithLabelTooltipAptitude; - addAptitude: aPopUp; - label: 'Add new protocol' -] - -{ #category : #'private - instance creation' } -GtCoderProtocolsGroupedListElement >> createNewProtocolForm [ - | aContainer aProtocolEditor aDefaultText aProtocolCompleter anAcceptButton | - aDefaultText := '' asRopedText - attribute: (BrGhostTextAttribute - for: ('new protocol name' asRopedText glamorousFormEditorCodeFontAndSize - foreground: Color lightGray)). - - aContainer := BrHorizontalPane new - padding: (BlInsets - top: 6 - right: 2 - bottom: 6 - left: 2); - cellSpacing: 6; - alignCenterLeft; - fitContent. - - aProtocolEditor := BrEditor new - aptitude: BrGlamorousRegularEditorAptitude new glamorousRegularSmallSize - + BrGlamorousInputFieldSpacingAptitude; - beMode: BrTextEditorEditableSingleLineMode new; - geometry: (BlRoundedRectangleGeometry cornerRadius: 4); - vFitContent; - hFitContent; - constraintsDo: [ :c | c minWidth: 150 ]; - text: aDefaultText; - requestFocus. - - aProtocolCompleter := GtCompletionController - on: aProtocolEditor - strategy: GtMethodProtocolCompletionStrategy new. - - aProtocolCompleter install. - - aProtocolEditor - addEditorShortcut: (BlShortcutWithAction new - combination: BlKeyCombination escape; - action: [ :anEvent | aProtocolEditor fireEvent: BrDropdownHideWish new ]). - - aProtocolEditor - addEditorShortcut: (BlShortcutWithAction new - combination: BlKeyCombination enter; - action: [ :anEvent | self addProtocolFrom: aProtocolEditor ]). - - aContainer addChild: aProtocolEditor. - - anAcceptButton := BrButton new - beSmallSize; - aptitude: (BrGlamorousButtonRectangularAptitude paddingScale: 0.5) - + BrGlamorousButtonIconAptitude - + (BrGlamorousButtonFlatExteriorAptitude new - backgroundPaint: (Color gray alpha: 0.1)) - + BrGlamorousButtonWithLabelTooltipAptitude; - icon: BrGlamorousVectorIcons accept; - label: 'Add protocol'; - action: [ self addProtocolFrom: aProtocolEditor ]. - - aContainer addChild: anAcceptButton. - - ^ aContainer -] - { #category : #'private - instance creation' } GtCoderProtocolsGroupedListElement >> createProtocolDropHandler [ ^ BlDropHandler new @@ -147,19 +42,6 @@ GtCoderProtocolsGroupedListElement >> createProtocolDropHandler [ whenDragLeftDo: [ :anItemsLeftEvent | anItemsLeftEvent currentTarget effect: BlNullEffect new ] ] -{ #category : #'private - instance creation' } -GtCoderProtocolsGroupedListElement >> createProtocolGroupHeader [ - ^ BrHorizontalPane new - alignCenterLeft; - hMatchParent; - vFitContent; - addChild: (BrLabel new beSmallSize - padding: (BlInsets top: 2 bottom: 2); - aptitude: (BrGlamorousLabelAptitude new foreground: Color gray)); - addChild: self createAddProtocolButton; - yourself -] - { #category : #'private - instance creation' } GtCoderProtocolsGroupedListElement >> createProtocolGroups [ | virtualGroup instanceGroup classGroup | @@ -360,12 +242,11 @@ GtCoderProtocolsGroupedListElement >> initialize [ self padding: (BlInsets left: 5 right: 10); matchParent; - headerElementStencil: [ self createProtocolGroupHeader ]; - headerDataBinder: [ :header :each | - each domainObject = 'virtual' - ifTrue: [ header children second visibility: BlVisibility gone ] - ifFalse: [ header children second visibility: BlVisibility visible ]. - header children first text: each domainObject asRopedText ]. + headerElementStencil: [ GtCoderProtocolsGroupHeaderElement new ]; + headerDataBinder: [ :header :each | + header + protocolsGroupName: each domainObject + targetClass: self navigationModel selectedClass ]. self when: BrSelectionChanged do: [ self privateEndRenameProtocol ]. From e9d2b8731913fdcbca5b706f67a9c1e8505bada4 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 14 Oct 2024 12:46:00 +0200 Subject: [PATCH 0738/1268] [feenkcom/gtoolkit#4086][feenkcom/gtoolkit#4087] add auto-categorize protocol option and remove protocol --- ...tCoderProtocolsGroupedListElement.class.st | 35 +++++++++++++------ 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st index 42b272187..d886b183e 100644 --- a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st @@ -19,6 +19,16 @@ Class { #category : #'GToolkit-Coder-UI-Navigation - Helpers' } +{ #category : #'private - refactorings' } +GtCoderProtocolsGroupedListElement >> autoCategorizeProtocol: aPharoProtocol [ + | classifier | + + classifier := MethodClassifier new. + + aPharoProtocol methodSelectors do: [ :selector| + classifier classify: aPharoProtocol protocolClass >> selector ] +] + { #category : #'private - instance creation' } GtCoderProtocolsGroupedListElement >> bindProtocol: item toElement: element [ | itemText | @@ -109,15 +119,23 @@ GtCoderProtocolsGroupedListElement >> createProtocolLabelElement [ GtCoderProtocolsGroupedListElement >> createProtocolListContextMenuItemsFor: aPharoProtocol [ ^ Array streamContents: [ :aStream | - "aPharoProtocol canBeRemoved - ifTrue: [ aStream - nextPut: (self createLabel: 'Remove ' description: aPharoProtocol name) - -> [ :elem | self removeProtocol: aPharoProtocol in: elem ] ]." - + aPharoProtocol name = Protocol unclassified + ifTrue: [ + aStream + nextPut: (self createLabel: 'Auto-categorize methods' description: '') + -> [ :elem | self autoCategorizeProtocol: aPharoProtocol ] ]. + aPharoProtocol canBeRenamed ifTrue: [ aStream nextPut: (self createLabel: 'Rename ' description: aPharoProtocol name) - -> [ :elem | self requestRenameProtocol: aPharoProtocol ] ] ] + -> [ :elem | self requestRenameProtocol: aPharoProtocol ] ]. + + aPharoProtocol canBeRemoved + ifTrue: [ aStream + nextPut: (self createLabel: 'Remove ' description: aPharoProtocol name) + -> [ :elem | self removeProtocol: aPharoProtocol in: elem ] ]. + + ] ] { #category : #'private - instance creation' } @@ -333,10 +351,7 @@ GtCoderProtocolsGroupedListElement >> removeProtocol: aGtPharoProtocol in: elem refactoring := RBRemoveProtocolChange removeProtocolNamed: aGtPharoProtocol name in: aGtPharoProtocol protocolClass. - ^ self - addPreviewButtonFor: refactoring - to: elem - cancelSelector: #updateProtocolList + refactoring execute ] { #category : #'private - refactorings' } From 884f0ab53b840aad6f5d667ab254ecd6b512ec5b Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 14 Oct 2024 21:31:55 +0200 Subject: [PATCH 0739/1268] [feenkcom/gtoolkit#4092] add a class icon next to the class name --- .../GtCoderClassesTreeElement.class.st | 45 +++++------- .../GtCoderClassesTreeItemElement.class.st | 72 +++++++++++++++++++ 2 files changed, 88 insertions(+), 29 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderClassesTreeItemElement.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index 2c4aeb648..53429ba00 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -64,6 +64,14 @@ GtCoderClassesTreeElement >> addPreviewButtonFor: refactoring to: elem cancelSel ^ elem addChild: button as: #preview ] +{ #category : #initialization } +GtCoderClassesTreeElement >> bind: aClassHierarchyTree element: aClassElement index: anIndexInTree [ + aClassElement + id: (GtCoderNavigationClassesTreeElementId indexed: anIndexInTree). + + aClassElement classHierarchyTree: aClassHierarchyTree +] + { #category : #initialization } GtCoderClassesTreeElement >> browseReferencesTo: aClass [ self phlow spawnObject: (aClass gtReferences) @@ -198,22 +206,12 @@ GtCoderClassesTreeElement >> createLabel: aString description: description [ { #category : #initialization } GtCoderClassesTreeElement >> createNodeElement [ - | aLabelAptitude | - - aLabelAptitude := BrGlamorousLabelAptitude new. - aLabelAptitude add: BrGlamorousListItemAptitude. - aLabelAptitude - add: (BrGlamorousWithContextMenuAptitude + ^ GtCoderClassesTreeItemElement new + addEventHandler: self createClassDropHandler; + addAptitude: (BrGlamorousWithContextMenuAptitude content: [ :aWidget | GtCoderNavigationContextMenuContent new - items: (self contextMenuItemsFor: (aWidget userData at: #'coder-class')) ]). - - ^ BrLabel new - hMatchParent; - vFitContent; - beSmallSize; - aptitude: aLabelAptitude; - addEventHandler: self createClassDropHandler + items: (self contextMenuItemsFor: aWidget theClass) ]) ] { #category : #initialization } @@ -225,21 +223,10 @@ GtCoderClassesTreeElement >> initialize [ self nodeStencil: [ self createNodeElement ]; nodeDataBinder: [ :aClassElement :aClassHierarchyTree :aTreeNode | - aClassElement - id: (GtCoderNavigationClassesTreeElementId indexed: aTreeNode indexInTree). - - aClassElement userData at: #'coder-class' put: aClassHierarchyTree rootClass. - - aClassHierarchyTree - ifNil: [ aClassElement text: '' asRopedText ] - ifNotNil: [ | aClass aText | - aClass := aClassHierarchyTree rootClass. - aText := aClass gtDisplayText asRopedText. - (aClass isAbstract or: [ aClass hasAbstractMethods ]) - ifTrue: [ aText italic ]. - aClass isDeprecated - ifTrue: [ aText append: ' (deprecated)' asRopedText italic ]. - aClassElement text: aText ] ]. + self + bind: aClassHierarchyTree + element: aClassElement + index: aTreeNode indexInTree ]. self when: BrSelectionDoubleClicked do: [ :evt | self initializeWithHierachyForClass: self selectedClass ] diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeItemElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeItemElement.class.st new file mode 100644 index 000000000..72fa45044 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeItemElement.class.st @@ -0,0 +1,72 @@ +Class { + #name : #GtCoderClassesTreeItemElement, + #superclass : #BrHorizontalPane, + #instVars : [ + 'theClass', + 'classNameLabel', + 'classIconContainer', + 'currentIconName' + ], + #category : #'GToolkit-Coder-UI-Navigation - Helpers' +} + +{ #category : #accessing } +GtCoderClassesTreeItemElement >> classHierarchyTree: aClassHierarchyTree [ + | aNewIconName anIcon anIconForm | + + theClass := aClassHierarchyTree ifNotNil: #rootClass. + + theClass + ifNil: [ classNameLabel text: '' asRopedText ] + ifNotNil: [ + | aText | + aText := theClass gtDisplayText asRopedText. + (theClass isAbstract or: [ theClass hasAbstractMethods ]) + ifTrue: [ aText italic ]. + theClass isDeprecated + ifTrue: [ + aText append: ' (deprecated)' asRopedText italic. + aText lineThrough ]. + classNameLabel text: aText ]. + + aNewIconName := theClass gtSystemIconName. + aNewIconName = currentIconName + ifTrue: [ ^ self ]. + + aNewIconName ifNil: [ classIconContainer visibility: BlVisibility hidden ]. + anIconForm := theClass gtSafeIconNamed: aNewIconName. + anIcon := anIconForm asElement. + + classIconContainer removeChildren. + classIconContainer addChild: anIcon. + currentIconName := aNewIconName +] + +{ #category : #initialization } +GtCoderClassesTreeItemElement >> createClassNameLabel [ + ^ BrLabel new + hMatchParent; + vFitContent; + beSmallSize; + aptitude: BrGlamorousLabelAptitude +] + +{ #category : #initialization } +GtCoderClassesTreeItemElement >> initialize [ + super initialize. + + self hMatchParent. + self vFitContent. + self alignCenterLeft. + + classIconContainer := BrFrame new + fitContent; + margin: (BlInsets right: 2). + classNameLabel := self createClassNameLabel. + self addChildren: { classIconContainer . classNameLabel } +] + +{ #category : #accessing } +GtCoderClassesTreeItemElement >> theClass [ + ^ theClass +] From 9d6c73377ae57057677a7f874653c1a9c0cffb59 Mon Sep 17 00:00:00 2001 From: Alistair Grant Date: Tue, 15 Oct 2024 13:24:36 +0200 Subject: [PATCH 0740/1268] [feenkcom/gtoolkit#4072] Automated refactoring --- ...erNavigationPackagesTagsClassesElement.class.st | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 618afdba5..46628289a 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -707,14 +707,12 @@ GtCoderNavigationPackagesTagsClassesElement >> reselectPackageOrTag: aSelectedPa { #category : #'api - package reselections' } GtCoderNavigationPackagesTagsClassesElement >> reselectPackageOrTag: aSelectedPackageOrTag afterRemovalOfTagNamed: aRemovedTagName [ - aSelectedPackageOrTag ifNotNil: [ - self deselectPackages. - aSelectedPackageOrTag name = aRemovedTagName - ifTrue: [ - self expandPackage: aSelectedPackageOrTag package. - self hideClassList. ] - ifFalse: [ - self selectPackageOrTag: aSelectedPackageOrTag ] ] + aSelectedPackageOrTag + ifNotNil: [ self deselectPackages. + (aSelectedPackageOrTag name sameContentAs: aRemovedTagName) + ifTrue: [ self expandPackage: aSelectedPackageOrTag package. + self hideClassList ] + ifFalse: [ self selectPackageOrTag: aSelectedPackageOrTag ] ] ] { #category : #'api - class selections' } From eb87c092dc95095745d9c877d750296e3f294636 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 15 Oct 2024 16:21:03 -0300 Subject: [PATCH 0741/1268] Fix `GtFilterToggleSettingsElement>>#requestToggleFocus` [feenkcom/gtoolkit#3983] --- src/GToolkit-Coder-UI/GtFilterToggleSettingsElement.class.st | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterToggleSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterToggleSettingsElement.class.st index 3fe76076c..47c6783ab 100644 --- a/src/GToolkit-Coder-UI/GtFilterToggleSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterToggleSettingsElement.class.st @@ -177,8 +177,9 @@ GtFilterToggleSettingsElement >> registerNavigationShortcutsForToggle: aToggle [ GtFilterToggleSettingsElement >> requestToggleFocus [ toggleGroupElement viewModel hasActivatedToggle ifTrue: [ toggleGroupElement activatedToggle requestFocus ] - ifFalse: [ toggleGroupElement toggles - ifNotEmpty: [ :aCollection | aCollection first requestFocus ] ] + ifFalse: [ toggleGroupElement viewModel toggles + ifNotEmpty: [ :aCollection | aCollection first widgetDo: [ :aWidget | + aWidget requestFocus ] ] ] ] { #category : #'api - filter view model' } From eca7ea26fc18eef346f27a02ed68ccf793cea247 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 15 Oct 2024 20:10:01 -0300 Subject: [PATCH 0742/1268] add prefix and suffix label elements [feenkcom/gtoolkit#3983] --- ...GtFilterElementByScripterExamples.class.st | 6 +- .../GtFilterItemsElement.class.st | 5 +- ...class.st => GtFilterLabelElement.class.st} | 54 +++++------ src/GToolkit-Coder-UI/GtFilterModel.class.st | 92 ++++++++++++++++--- .../GtFilterModelExplicitPrefixLabel.class.st | 30 ++++++ .../GtFilterModelExplicitSuffixLabel.class.st | 35 +++++++ .../GtFilterModelImplicitPrefixLabel.class.st | 36 ++++++++ .../GtFilterModelLabel.class.st | 16 ++++ .../GtFilterModelLabelChanged.class.st | 10 ++ .../GtFilterPrefixLabelElement.class.st | 14 +++ .../GtFilterSuffixLabelElement.class.st | 14 +++ .../GtFilterViewModel.class.st | 14 +++ .../GtFilterVirtualEmptyModel.class.st | 5 + 13 files changed, 284 insertions(+), 47 deletions(-) rename src/GToolkit-Coder-UI/{GtFilterNameElement.class.st => GtFilterLabelElement.class.st} (76%) create mode 100644 src/GToolkit-Coder-UI/GtFilterModelExplicitPrefixLabel.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterModelExplicitSuffixLabel.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterModelImplicitPrefixLabel.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterModelLabel.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterPrefixLabelElement.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterSuffixLabelElement.class.st diff --git a/src/GToolkit-Coder-Examples/GtFilterElementByScripterExamples.class.st b/src/GToolkit-Coder-Examples/GtFilterElementByScripterExamples.class.st index ef8886dca..050b972ca 100644 --- a/src/GToolkit-Coder-Examples/GtFilterElementByScripterExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtFilterElementByScripterExamples.class.st @@ -12,7 +12,7 @@ GtFilterElementByScripterExamples >> booleanElement [ | aScripter | aScripter := self scripterWithModel: [ GtFilterModelExamples new booleanModel ] - element: [ :aModel | GtFilterNameElement new filterViewModel: aModel asFilterViewModel ]. + element: [ :aModel | aModel asFilterLabeledElement ]. ^ aScripter ] @@ -36,7 +36,7 @@ GtFilterElementByScripterExamples >> shortListElement [ | aScripter | aScripter := self scripterWithModel: [ GtFilterModelExamples new shortListModel ] - element: [ :aModel | GtFilterNameElement new filterViewModel: aModel asFilterViewModel ]. + element: [ :aModel | aModel asFilterLabeledElement ]. ^ aScripter ] @@ -47,7 +47,7 @@ GtFilterElementByScripterExamples >> textElement [ | aScripter | aScripter := self scripterWithModel: [ GtFilterModelExamples new textModel ] - element: [ :aModel | GtFilterNameElement new filterViewModel: aModel asFilterViewModel ]. + element: [ :aModel | aModel asFilterLabeledElement ]. aScripter editor click; diff --git a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st index 9ed44e496..c5decf1d6 100644 --- a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st @@ -9,8 +9,7 @@ Class { { #category : #'private - updating' } GtFilterItemsElement >> addElementForFilterViewModel: aFilterViewModel index: anIndex [ | anElement | - anElement := GtFilterNameElement new - filterViewModel: aFilterViewModel; + anElement := aFilterViewModel asFilterLabeledElement id: (GtFilterNameId indexed: anIndex); margin: (BlInsets left: 3 right: 3); constraintsDo: [ :c | @@ -141,7 +140,7 @@ GtFilterItemsElement >> createDropdownContent [ itemDataBinder: [ :anItemElement :anItemObject :anItemIndex | anItemElement id: (GtFilterItemId indexed: anItemIndex). anItemElement userData at: GtFilterModel put: anItemObject. - (anItemElement childAt: 1) text: anItemObject label. + (anItemElement childAt: 1) text: anItemObject name. anItemElement ]; itemDataUnbinder: [ :anItemElement :anItemObject :anItemIndex | anItemElement id: nil. diff --git a/src/GToolkit-Coder-UI/GtFilterNameElement.class.st b/src/GToolkit-Coder-UI/GtFilterLabelElement.class.st similarity index 76% rename from src/GToolkit-Coder-UI/GtFilterNameElement.class.st rename to src/GToolkit-Coder-UI/GtFilterLabelElement.class.st index 9f81e17c9..1a3f6c45f 100644 --- a/src/GToolkit-Coder-UI/GtFilterNameElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterLabelElement.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtFilterNameElement, + #name : #GtFilterLabelElement, #superclass : #BlElement, #traits : 'TBrLayoutResizable + TGtWithFilterViewModel', #classTraits : 'TBrLayoutResizable classTrait + TGtWithFilterViewModel classTrait', @@ -11,27 +11,24 @@ Class { } { #category : #'private - updating' } -GtFilterNameElement >> addSettingsElement: anElement [ +GtFilterLabelElement >> addSettingsElement: anElement [ settingsContainer addChild: anElement as: GtFilterSettingsId ] { #category : #initialization } -GtFilterNameElement >> defaultLayout [ +GtFilterLabelElement >> defaultLayout [ ^ BlLinearLayout horizontal ] { #category : #initialization } -GtFilterNameElement >> initialize [ +GtFilterLabelElement >> initialize [ super initialize. self fitContent. self beFocusable. self beInSingleCompositionLayer. - self padding: (BlInsets top: 0 right: 0 bottom: 0 left: 2). self initializeLabelElement. self initializeSettingsContainer. - self addChild: labelElement. - self addChild: settingsContainer as: #container. self initializeStyling. self initializeEventHandlers. @@ -39,7 +36,7 @@ GtFilterNameElement >> initialize [ ] { #category : #initialization } -GtFilterNameElement >> initializeEventHandlers [ +GtFilterLabelElement >> initializeEventHandlers [ self when: BlClickEvent do: [ :anEvent | self onClickEvent: anEvent ]. self when: GtFilterEditWish do: [ :anEvent | self onEditWish: anEvent ]. self when: GtFilterFocusIntendedPartAfterAddingWish do: [ :anEvent | @@ -49,7 +46,7 @@ GtFilterNameElement >> initializeEventHandlers [ ] { #category : #initialization } -GtFilterNameElement >> initializeLabelElement [ +GtFilterLabelElement >> initializeLabelElement [ labelElement := BrLabel new id: GtFilterTagLabelId; text: 'Filter'; @@ -60,21 +57,23 @@ GtFilterNameElement >> initializeLabelElement [ ] { #category : #initialization } -GtFilterNameElement >> initializeSettingsContainer [ +GtFilterLabelElement >> initializeSettingsContainer [ settingsContainer := BrFrame new hFitContentLimited; vFitContent; margin: (BlInsets all: 2); - constraintsDo: [ :c | c linear vertical alignCenter ] + constraintsDo: [ :c | + c linear vertical alignCenter. + c minHeight: 20 ] ] { #category : #initialization } -GtFilterNameElement >> initializeShortcuts [ +GtFilterLabelElement >> initializeShortcuts [ ] { #category : #initialization } -GtFilterNameElement >> initializeStyling [ +GtFilterLabelElement >> initializeStyling [ self addAptitude: (BrStyleCommonAptitude new default: [ :aStyle | @@ -91,24 +90,24 @@ GtFilterNameElement >> initializeStyling [ ] { #category : #'event handling' } -GtFilterNameElement >> onClickEvent: anEvent [ +GtFilterLabelElement >> onClickEvent: anEvent [ anEvent consumed: true. self requestFocus ] { #category : #'event handling' } -GtFilterNameElement >> onEditWish: anEvent [ +GtFilterLabelElement >> onEditWish: anEvent [ self settingsElementDo: [ :anElement | anElement dispatchEvent: GtFilterEditWish new ] ] { #category : #'api - filter view model' } -GtFilterNameElement >> onFilterViewModelChanged [ +GtFilterLabelElement >> onFilterViewModelChanged [ self updateElement ] { #category : #'event handling' } -GtFilterNameElement >> onFocusFirstPartWish: anEvent [ +GtFilterLabelElement >> onFocusFirstPartWish: anEvent [ anEvent consumed: true. self settingsElementDo: [ :aSettingsElement | @@ -130,37 +129,37 @@ GtFilterNameElement >> onFocusFirstPartWish: anEvent [ ] { #category : #'event handling' } -GtFilterNameElement >> onFocusNextPartdWish: anEvent [ +GtFilterLabelElement >> onFocusNextPartdWish: anEvent [ anEvent consumed: true. self requestFocus. self fireEvent: GtFilterFocusNextFilterWish new ] { #category : #'event handling' } -GtFilterNameElement >> onFocusWholeWish: anEvent [ +GtFilterLabelElement >> onFocusWholeWish: anEvent [ anEvent consumed: true. self requestFocus ] { #category : #'event handling' } -GtFilterNameElement >> onLabelChanged: anAnnouncement [ +GtFilterLabelElement >> onLabelChanged: anAnnouncement [ BlTaskAction enqueueElement: self action: [ self updateLabelElement ] ] { #category : #'private - updating' } -GtFilterNameElement >> removeSettingsElement [ +GtFilterLabelElement >> removeSettingsElement [ settingsContainer removeChildren ] { #category : #accessing } -GtFilterNameElement >> settingsElementDo: aBlock [ +GtFilterLabelElement >> settingsElementDo: aBlock [ | aChild | aChild := settingsContainer children at: 1 ifAbsent: [ ^ self ]. aBlock cull: aChild ] { #category : #'api - filter view model' } -GtFilterNameElement >> subscribeToFilterViewModel [ +GtFilterLabelElement >> subscribeToFilterViewModel [ self filterViewModel weak when: GtFilterViewModelLabelChanged send: #onLabelChanged: @@ -168,26 +167,27 @@ GtFilterNameElement >> subscribeToFilterViewModel [ ] { #category : #'api - filter view model' } -GtFilterNameElement >> unsubscribeFromFilterViewModel [ +GtFilterLabelElement >> unsubscribeFromFilterViewModel [ self filterViewModel unsubscribe: self ] { #category : #'private - updating' } -GtFilterNameElement >> updateElement [ +GtFilterLabelElement >> updateElement [ self updateLabelElement. self updateSettingsContainer. ] { #category : #'private - updating' } -GtFilterNameElement >> updateLabelElement [ +GtFilterLabelElement >> updateLabelElement [ labelElement text: self filterViewModel label ] { #category : #'private - updating' } -GtFilterNameElement >> updateSettingsContainer [ +GtFilterLabelElement >> updateSettingsContainer [ | anElement | self removeSettingsElement. anElement := self filterViewModel asUserSettingsElement. anElement ifNil: [ ^ self ]. + anElement constraintsDo: [ :c | c frame vertical alignCenter ]. self addSettingsElement: anElement ] diff --git a/src/GToolkit-Coder-UI/GtFilterModel.class.st b/src/GToolkit-Coder-UI/GtFilterModel.class.st index fd0e13067..3f10eebfd 100644 --- a/src/GToolkit-Coder-UI/GtFilterModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModel.class.st @@ -5,9 +5,10 @@ Class { #classTraits : 'TGtAnnouncer classTrait', #instVars : [ 'announcer', - 'label', 'order', - 'creator' + 'creator', + 'name', + 'labelBuilder' ], #category : #'GToolkit-Coder-UI-Filters - Models' } @@ -30,6 +31,12 @@ GtFilterModel >> announcer [ ^ announcer ifNil: [ announcer := Announcer new ] ] +{ #category : #converting } +GtFilterModel >> asFilterLabeledElement [ + + ^ self filterLabelElementClass new filterViewModel: self asFilterViewModel +] + { #category : #converting } GtFilterModel >> asFilterViewModel [ @@ -67,8 +74,11 @@ GtFilterModel >> creator: anObject [ ] { #category : #initialization } -GtFilterModel >> defaultFilterLabel [ - ^ self class name copyFrom: 9 to: self class name size - 5 +GtFilterModel >> defaultFilterName [ + | aToIndex aFromIndex | + aToIndex := (self class name size - 5 max: 1). + aFromIndex := 9 min: aToIndex. + ^ self class name copyFrom: aFromIndex to: aToIndex ] { #category : #initialization } @@ -83,10 +93,16 @@ GtFilterModel >> equals: anObject [ ^ self selectedValue = anObject selectedValue ] +{ #category : #accessing } +GtFilterModel >> filterLabelElementClass [ + + ^ labelBuilder labelElementClass +] + { #category : #accessing } GtFilterModel >> filterViewModelClass [ - ^ self subclassResponsibility + ^ labelBuilder labelElementClass ] { #category : #'gt - extensions' } @@ -94,8 +110,7 @@ GtFilterModel >> gtLiveFor: aView [ ^ aView explicit title: 'Live'; - stencil: [ (GtFilterNameElement new filterViewModel: self asFilterViewModel) - margin: (BlInsets all: 10) ] + stencil: [ self asFilterLabeledElement margin: (BlInsets all: 10) ] ] { #category : #comparing } @@ -105,6 +120,12 @@ GtFilterModel >> hash [ bitXor: self order hash) ] +{ #category : #initialization } +GtFilterModel >> initialize [ + super initialize. + labelBuilder := GtFilterModelImplicitPrefixLabel new model: self +] + { #category : #testing } GtFilterModel >> isVirtualFilterModel [ ^ false @@ -115,20 +136,39 @@ GtFilterModel >> label [ "Return filter label" - ^ label ifNil: [ label := self defaultFilterLabel ] + ^ labelBuilder label ] { #category : #accessing } GtFilterModel >> label: aString [ - label = aString ifTrue: [ ^ self ]. - - label := aString. - self notifyLabelChanged. + self + deprecated: 'Use name: instead' + transformWith: '`@receiver label: `@argument' -> '`@receiver name: `@argument'. + self name: aString +] + +{ #category : #accessing } +GtFilterModel >> name [ + "Return filter name" + + + ^ name ifNil: [ name := self defaultFilterName ] +] + +{ #category : #accessing } +GtFilterModel >> name: aString [ + "Set filter name. + The name is used in a filter selection (dropdown) list." + + name = aString ifTrue: [ ^ self ]. + + name := aString. + self notifyLabelChanged ] { #category : #accessing } GtFilterModel >> named: aString [ - self label: aString + self name: aString ] { #category : #'private - notifying' } @@ -149,10 +189,22 @@ GtFilterModel >> order: anObject [ order := anObject ] +{ #category : #accessing } +GtFilterModel >> prefixLabel: aString [ + "Display a filter label before a setting widget." + + | aLabel | + aLabel := GtFilterModelExplicitPrefixLabel new label: aString. + labelBuilder = aLabel ifTrue: [ ^ self ]. + + labelBuilder := aLabel. + self notifyLabelChanged +] + { #category : #printing } GtFilterModel >> printDetailsOn: aStream [ aStream - nextPutAll: self label asString; + nextPutAll: self name asString; nextPutAll: ': '; print: (self selectedValue ifNotNil: [ :aValue | aValue asFilterModelItem itemValue ]); nextPutAll: ', order: '; @@ -174,3 +226,15 @@ GtFilterModel >> selectedValue [ ^ nil ] + +{ #category : #accessing } +GtFilterModel >> suffixLabel: aString [ + "Display a filter label after a setting widget." + + | aLabel | + aLabel := GtFilterModelExplicitSuffixLabel new label: aString. + labelBuilder = aLabel ifTrue: [ ^ self ]. + + labelBuilder := aLabel. + self notifyLabelChanged +] diff --git a/src/GToolkit-Coder-UI/GtFilterModelExplicitPrefixLabel.class.st b/src/GToolkit-Coder-UI/GtFilterModelExplicitPrefixLabel.class.st new file mode 100644 index 000000000..1110750f3 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModelExplicitPrefixLabel.class.st @@ -0,0 +1,30 @@ +Class { + #name : #GtFilterModelExplicitPrefixLabel, + #superclass : #GtFilterModelLabel, + #instVars : [ + 'label' + ], + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #comparing } +GtFilterModelExplicitPrefixLabel >> = anObject [ + self == anObject ifTrue: [ ^ true ]. + + ^ self class = anObject class and: [ self label = anObject label ] +] + +{ #category : #comparing } +GtFilterModelExplicitPrefixLabel >> hash [ + ^ self class hash bitXor: self label hash +] + +{ #category : #accessing } +GtFilterModelExplicitPrefixLabel >> label [ + ^ label +] + +{ #category : #accessing } +GtFilterModelExplicitPrefixLabel >> label: anObject [ + label := anObject +] diff --git a/src/GToolkit-Coder-UI/GtFilterModelExplicitSuffixLabel.class.st b/src/GToolkit-Coder-UI/GtFilterModelExplicitSuffixLabel.class.st new file mode 100644 index 000000000..c59d8ad3e --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModelExplicitSuffixLabel.class.st @@ -0,0 +1,35 @@ +Class { + #name : #GtFilterModelExplicitSuffixLabel, + #superclass : #GtFilterModelLabel, + #instVars : [ + 'label' + ], + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #comparing } +GtFilterModelExplicitSuffixLabel >> = anObject [ + self == anObject ifTrue: [ ^ true ]. + + ^ self class = anObject class and: [ self label = anObject label ] +] + +{ #category : #comparing } +GtFilterModelExplicitSuffixLabel >> hash [ + ^ self class hash bitXor: self label hash +] + +{ #category : #accessing } +GtFilterModelExplicitSuffixLabel >> label [ + ^ label +] + +{ #category : #accessing } +GtFilterModelExplicitSuffixLabel >> label: anObject [ + label := anObject +] + +{ #category : #accessing } +GtFilterModelExplicitSuffixLabel >> labelElementClass [ + ^ GtFilterSuffixLabelElement +] diff --git a/src/GToolkit-Coder-UI/GtFilterModelImplicitPrefixLabel.class.st b/src/GToolkit-Coder-UI/GtFilterModelImplicitPrefixLabel.class.st new file mode 100644 index 000000000..72ddee5ea --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModelImplicitPrefixLabel.class.st @@ -0,0 +1,36 @@ +Class { + #name : #GtFilterModelImplicitPrefixLabel, + #superclass : #GtFilterModelLabel, + #instVars : [ + 'model' + ], + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #comparing } +GtFilterModelImplicitPrefixLabel >> = anObject [ + self == anObject ifTrue: [ ^ true ]. + + ^ self class = anObject class and: [ self model = anObject model ] +] + +{ #category : #comparing } +GtFilterModelImplicitPrefixLabel >> hash [ + ^ self class hash bitXor: self model hash +] + +{ #category : #'as yet unclassified' } +GtFilterModelImplicitPrefixLabel >> label [ + ^ self model name +] + +{ #category : #accessing } +GtFilterModelImplicitPrefixLabel >> model [ + + ^ model +] + +{ #category : #accessing } +GtFilterModelImplicitPrefixLabel >> model: aFilterModel [ + model := aFilterModel +] diff --git a/src/GToolkit-Coder-UI/GtFilterModelLabel.class.st b/src/GToolkit-Coder-UI/GtFilterModelLabel.class.st new file mode 100644 index 000000000..254e74120 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModelLabel.class.st @@ -0,0 +1,16 @@ +Class { + #name : #GtFilterModelLabel, + #superclass : #Object, + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #accessing } +GtFilterModelLabel >> label [ + + ^ self subclassResponsibility +] + +{ #category : #accessing } +GtFilterModelLabel >> labelElementClass [ + ^ GtFilterPrefixLabelElement +] diff --git a/src/GToolkit-Coder-UI/GtFilterModelLabelChanged.class.st b/src/GToolkit-Coder-UI/GtFilterModelLabelChanged.class.st index 2898f9516..bc7a87d59 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelLabelChanged.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelLabelChanged.class.st @@ -16,3 +16,13 @@ GtFilterModelLabelChanged >> label [ GtFilterModelLabelChanged >> label: anObject [ label := anObject ] + +{ #category : #accessing } +GtFilterModelLabelChanged >> name [ + ^ label +] + +{ #category : #accessing } +GtFilterModelLabelChanged >> name: aString [ + label := aString +] diff --git a/src/GToolkit-Coder-UI/GtFilterPrefixLabelElement.class.st b/src/GToolkit-Coder-UI/GtFilterPrefixLabelElement.class.st new file mode 100644 index 000000000..dddb033c5 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterPrefixLabelElement.class.st @@ -0,0 +1,14 @@ +Class { + #name : #GtFilterPrefixLabelElement, + #superclass : #GtFilterLabelElement, + #category : #'GToolkit-Coder-UI-Filters - Widgets' +} + +{ #category : #'as yet unclassified' } +GtFilterPrefixLabelElement >> initialize [ + super initialize. + self padding: (BlInsets top: 0 right: 0 bottom: 0 left: 2). + + self addChild: labelElement. + self addChild: settingsContainer as: #container +] diff --git a/src/GToolkit-Coder-UI/GtFilterSuffixLabelElement.class.st b/src/GToolkit-Coder-UI/GtFilterSuffixLabelElement.class.st new file mode 100644 index 000000000..810b6cea2 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterSuffixLabelElement.class.st @@ -0,0 +1,14 @@ +Class { + #name : #GtFilterSuffixLabelElement, + #superclass : #GtFilterLabelElement, + #category : #'GToolkit-Coder-UI-Filters - Widgets' +} + +{ #category : #'as yet unclassified' } +GtFilterSuffixLabelElement >> initialize [ + super initialize. + self padding: (BlInsets top: 0 right: 2 bottom: 0 left: 0). + + self addChild: settingsContainer as: #container. + self addChild: labelElement +] diff --git a/src/GToolkit-Coder-UI/GtFilterViewModel.class.st b/src/GToolkit-Coder-UI/GtFilterViewModel.class.st index 12fc6c4ba..c78155ddb 100644 --- a/src/GToolkit-Coder-UI/GtFilterViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterViewModel.class.st @@ -15,6 +15,12 @@ GtFilterViewModel >> announcer [ ^ announcer ifNil: [ announcer := Announcer new ] ] +{ #category : #converting } +GtFilterViewModel >> asFilterLabeledElement [ + + ^ self filterLabelElementClass new filterViewModel: self +] + { #category : #converting } GtFilterViewModel >> asUserSettingsElement [ @@ -27,6 +33,14 @@ GtFilterViewModel >> filterElementClass [ ^ self subclassResponsibility ] +{ #category : #accessing } +GtFilterViewModel >> filterLabelElementClass [ + + ^ self hasFilterModel + ifTrue: [ self filterModel filterLabelElementClass ] + ifFalse: [ GtFilterPrefixLabelElement ] +] + { #category : #accessing } GtFilterViewModel >> label [ diff --git a/src/GToolkit-Coder-UI/GtFilterVirtualEmptyModel.class.st b/src/GToolkit-Coder-UI/GtFilterVirtualEmptyModel.class.st index 5530eab09..2d958741a 100644 --- a/src/GToolkit-Coder-UI/GtFilterVirtualEmptyModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterVirtualEmptyModel.class.st @@ -15,3 +15,8 @@ GtFilterVirtualEmptyModel >> isVirtualFilterModel [ GtFilterVirtualEmptyModel >> label [ ^ 'empty' ] + +{ #category : #accessing } +GtFilterVirtualEmptyModel >> name [ + ^ 'empty' +] From 5443ccd3e35c118afdcfbde1a29a4a95b1980fee Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 15 Oct 2024 20:46:39 -0300 Subject: [PATCH 0743/1268] compare filter model name instead of label [feenkcom/gtoolkit#3983] --- src/GToolkit-Coder-UI/GtFilterModel.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterModel.class.st b/src/GToolkit-Coder-UI/GtFilterModel.class.st index 3f10eebfd..4a39ddcac 100644 --- a/src/GToolkit-Coder-UI/GtFilterModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModel.class.st @@ -21,7 +21,7 @@ GtFilterModel >> = anObject [ self == anObject ifTrue: [ ^ true ]. ^ self class = anObject class - and: [ self label = anObject label + and: [ self name = anObject name and: [ self order = anObject order ] ] ] @@ -116,7 +116,7 @@ GtFilterModel >> gtLiveFor: aView [ { #category : #comparing } GtFilterModel >> hash [ ^ self class hash - bitXor: (self label hash + bitXor: (self name hash bitXor: self order hash) ] From ccdef4f3ef8cad860dac38b6e74026d76d42bf90 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Wed, 16 Oct 2024 11:40:05 +0200 Subject: [PATCH 0744/1268] [feenkcom/gtoolkit#4099] strikethrough deprecated methods in navigation --- ...oderNavigationPackagesTagsClassesElement.class.st | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 46628289a..7e972d291 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -107,9 +107,15 @@ GtCoderNavigationPackagesTagsClassesElement >> buildMethodGroupList [ | list | list := self buildGroupList. methodGroup := self - buildMethodGroupWithBinder: [ :element :item | - element userData at: #method put: item. - element text: item selector asRopedText. ] + buildMethodGroupWithBinder: [ :element :eachCompiledMethod | + | aSelector | + element userData at: #method put: eachCompiledMethod. + + aSelector := eachCompiledMethod selector asRopedText. + eachCompiledMethod isDeprecated + ifTrue: [ aSelector lineThrough ]. + + element text: aSelector ] onClick: [ :event | event consumed: true. self From e76435de631c3f3c3f29d4d083b11148c2746b6b Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 16 Oct 2024 16:14:49 -0300 Subject: [PATCH 0745/1268] access filter context [feenkcom/gtoolkit#3983] --- .../GtFilteredCodersModel.class.st | 5 +++++ src/GToolkit-SearchFilters/GtSearchFilter.class.st | 7 +++++++ .../GtSearchFilterCoderMethodContext.class.st | 5 ----- 3 files changed, 12 insertions(+), 5 deletions(-) delete mode 100644 src/GToolkit-SearchFilters/GtSearchFilterCoderMethodContext.class.st diff --git a/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st b/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st index f92faa249..c2982cf67 100644 --- a/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st +++ b/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st @@ -115,3 +115,8 @@ GtFilteredCodersModel >> initialize [ GtFilteredCodersModel >> newItemsStream [ ^ compositeFilter asAsyncStream ] + +{ #category : #'api - accessing' } +GtFilteredCodersModel >> requesterContextDo: aBlock [ + ^ filter requesterContextDo: aBlock +] diff --git a/src/GToolkit-SearchFilters/GtSearchFilter.class.st b/src/GToolkit-SearchFilters/GtSearchFilter.class.st index 20c887785..5834dc5f5 100644 --- a/src/GToolkit-SearchFilters/GtSearchFilter.class.st +++ b/src/GToolkit-SearchFilters/GtSearchFilter.class.st @@ -129,6 +129,13 @@ GtSearchFilter >> notEmpty [ ^ self result hasNext wait ] +{ #category : #'api - accessing' } +GtSearchFilter >> requesterContextDo: aBlock [ + "Pass a requester context to aBlock if the context is available" + + ^ nil +] + { #category : #converting } GtSearchFilter >> result [ ^ self applyInScope: self defaultFilterScope diff --git a/src/GToolkit-SearchFilters/GtSearchFilterCoderMethodContext.class.st b/src/GToolkit-SearchFilters/GtSearchFilterCoderMethodContext.class.st deleted file mode 100644 index c15262695..000000000 --- a/src/GToolkit-SearchFilters/GtSearchFilterCoderMethodContext.class.st +++ /dev/null @@ -1,5 +0,0 @@ -Class { - #name : #GtSearchFilterCoderMethodContext, - #superclass : #GtSearchFilterContext, - #category : #'GToolkit-SearchFilters' -} From 8485e46f2583e98e025e80f69e21e26ab3c90610 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 16 Oct 2024 16:40:36 -0300 Subject: [PATCH 0746/1268] define default filter models [feenkcom/gtoolkit#3983] --- src/GToolkit-Coder-UI/GtFilterModel.class.st | 21 ++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterModel.class.st b/src/GToolkit-Coder-UI/GtFilterModel.class.st index 4a39ddcac..693ab9076 100644 --- a/src/GToolkit-Coder-UI/GtFilterModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModel.class.st @@ -8,7 +8,8 @@ Class { 'order', 'creator', 'name', - 'labelBuilder' + 'labelBuilder', + 'isDefault' ], #category : #'GToolkit-Coder-UI-Filters - Models' } @@ -55,6 +56,16 @@ GtFilterModel >> asUserSettingsElement [ ^ self asFilterViewModel asUserSettingsElement ] +{ #category : #initialization } +GtFilterModel >> beDefault [ + isDefault := true +] + +{ #category : #initialization } +GtFilterModel >> beNotDefault [ + isDefault := false +] + { #category : #testing } GtFilterModel >> changesFilteredResult [ "Indicates whether it changes a result of filtered items, e.g., list of method coders." @@ -123,7 +134,13 @@ GtFilterModel >> hash [ { #category : #initialization } GtFilterModel >> initialize [ super initialize. - labelBuilder := GtFilterModelImplicitPrefixLabel new model: self + labelBuilder := GtFilterModelImplicitPrefixLabel new model: self. + isDefault := false. +] + +{ #category : #testing } +GtFilterModel >> isDefaultFilterModel [ + ^ isDefault ] { #category : #testing } From 15f3b0fa2d8b83cdbf76dbefad8677096cca5660 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Thu, 17 Oct 2024 11:11:43 +0200 Subject: [PATCH 0747/1268] [feenkcom/gtoolkit#4072] Use a symbol for the pragma name --- src/GToolkit-SearchFilters/GtSearchFilter.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-SearchFilters/GtSearchFilter.class.st b/src/GToolkit-SearchFilters/GtSearchFilter.class.st index 5834dc5f5..8fb62124e 100644 --- a/src/GToolkit-SearchFilters/GtSearchFilter.class.st +++ b/src/GToolkit-SearchFilters/GtSearchFilter.class.st @@ -7,7 +7,7 @@ Class { { #category : #accessing } GtSearchFilter class >> allSearchFilterMethods [ | methods | - methods := ((Pragma allNamed: 'gtSearchFilter') + methods := ((Pragma allNamed: #gtSearchFilter) select: [ :each | each method methodClass isClassSide and: [ each method numArgs = 0 ] ]) collect: [ :each | each method ]. ^ methods From 9081314210a04be2894820dbb3a23af6f7e2196e Mon Sep 17 00:00:00 2001 From: Alistair Grant Date: Thu, 17 Oct 2024 12:38:53 +0200 Subject: [PATCH 0748/1268] [feenkcom/gtoolkit#4072] GtSearchFilter class>>allSearchFilterMethods pragma name is a Symbol --- src/GToolkit-SearchFilters/GtSearchFilter.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-SearchFilters/GtSearchFilter.class.st b/src/GToolkit-SearchFilters/GtSearchFilter.class.st index 5834dc5f5..8fb62124e 100644 --- a/src/GToolkit-SearchFilters/GtSearchFilter.class.st +++ b/src/GToolkit-SearchFilters/GtSearchFilter.class.st @@ -7,7 +7,7 @@ Class { { #category : #accessing } GtSearchFilter class >> allSearchFilterMethods [ | methods | - methods := ((Pragma allNamed: 'gtSearchFilter') + methods := ((Pragma allNamed: #gtSearchFilter) select: [ :each | each method methodClass isClassSide and: [ each method numArgs = 0 ] ]) collect: [ :each | each method ]. ^ methods From 9956ec682c3cf440a4782c76e753d06578663409 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 17 Oct 2024 10:03:36 -0300 Subject: [PATCH 0749/1268] do not block UI if available filters takes time to compute [feenkcom/gtoolkit#3983] --- .../GtFilterItemsElement.class.st | 26 +++++++++++--- src/GToolkit-Coder-UI/GtFilterModel.class.st | 5 +++ .../GtFilterVirtualEmptyModel.class.st | 8 ++--- .../GtFilterVirtualExceptionModel.class.st | 36 +++++++++++++++++++ .../GtFilterVirtualWaitingModel.class.st | 17 +++++++++ 5 files changed, 82 insertions(+), 10 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtFilterVirtualExceptionModel.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterVirtualWaitingModel.class.st diff --git a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st index c5decf1d6..e2b8e435b 100644 --- a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st @@ -127,6 +127,14 @@ GtFilterItemsElement >> addRemoveButtonIconTo: anElement [ anElement addChild: aRemoveButton ] +{ #category : #'private - updating' } +GtFilterItemsElement >> availableFilters [ + ^ self hasFiltersViewModel + ifTrue: [ self filtersViewModel availableFilters + ifEmpty: [ {GtFilterVirtualEmptyModel default} ] ] + ifFalse: [ {GtFilterVirtualEmptyModel default} ] +] + { #category : #'private - updating' } GtFilterItemsElement >> createDropdownContent [ | aListElement | @@ -147,16 +155,22 @@ GtFilterItemsElement >> createDropdownContent [ anItemElement userData removeKey: GtFilterModel ifAbsent: [ "ignore" ]. (anItemElement childAt: 1) text: ''. anItemElement ]; - items: (self hasFiltersViewModel - ifTrue: [ self filtersViewModel availableFilters ifEmpty: [ {GtFilterVirtualEmptyModel default} ] ] - ifFalse: [ {GtFilterVirtualEmptyModel default} ]); when: BlElementAddedToSceneGraphEvent do: [ :anEvent | self onListElementAddedToSceneGraph: anEvent ]; addShortcut: (BlShortcutWithAction new name: 'Add selected filter'; description: 'Add selected filter'; combination: BlKeyCombination builder enter build; - action: [ :aShortcutEvent :aShortcut | self onAddSelectedItemEvent: aShortcutEvent ]) + action: [ :aShortcutEvent :aShortcut | self onAddSelectedItemEvent: aShortcutEvent ]); + withAsyncFutureDo: [ :anElementFuture | + anElementFuture + whenPending: [ :theListElement | + theListElement items: { GtFilterVirtualWaitingModel default } ]; + whenError: [ :theListElement :anError | + theListElement items: { GtFilterVirtualExceptionModel new exception: anError } ]; + whenSuccess: [ :theListElement :aCollection | + theListElement items: aCollection ]; + future: [ self availableFilters ] asAsyncFuture ] ] { #category : #'private - updating' } @@ -342,7 +356,6 @@ GtFilterItemsElement >> onItemMouseClickEvent: anEvent [ anEvent consumed: true. anEvent currentTarget fireEvent: BrDropdownHideWish new. aModel := anEvent currentTarget userData at: GtFilterModel ifAbsent: [ nil ]. - aModel isVirtualFilterModel ifTrue: [ ^ self ]. self requestAddFilterModel: aModel ] @@ -417,6 +430,9 @@ GtFilterItemsElement >> removeItemElementForViewModel: aFilterViewModel [ { #category : #'event handling' } GtFilterItemsElement >> requestAddFilterModel: aFilterModel [ aFilterModel ifNil: [ ^ self ]. + aFilterModel isExceptionFilterModel ifTrue: [ + self phlow spawnObject: aFilterModel exception. + ^ self ]. aFilterModel isVirtualFilterModel ifTrue: [ ^ self ]. self hasFiltersViewModel ifFalse: [ ^ self ]. diff --git a/src/GToolkit-Coder-UI/GtFilterModel.class.st b/src/GToolkit-Coder-UI/GtFilterModel.class.st index 693ab9076..6be4d22c7 100644 --- a/src/GToolkit-Coder-UI/GtFilterModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModel.class.st @@ -143,6 +143,11 @@ GtFilterModel >> isDefaultFilterModel [ ^ isDefault ] +{ #category : #testing } +GtFilterModel >> isExceptionFilterModel [ + ^ false +] + { #category : #testing } GtFilterModel >> isVirtualFilterModel [ ^ false diff --git a/src/GToolkit-Coder-UI/GtFilterVirtualEmptyModel.class.st b/src/GToolkit-Coder-UI/GtFilterVirtualEmptyModel.class.st index 2d958741a..ffc7e52b3 100644 --- a/src/GToolkit-Coder-UI/GtFilterVirtualEmptyModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterVirtualEmptyModel.class.st @@ -3,6 +3,9 @@ Class { #superclass : #GtFilterModel, #traits : 'TGtUniqueInstance', #classTraits : 'TGtUniqueInstance classTrait', + #classInstVars : [ + 'uniqueInstance' + ], #category : #'GToolkit-Coder-UI-Filters - Models' } @@ -11,11 +14,6 @@ GtFilterVirtualEmptyModel >> isVirtualFilterModel [ ^ true ] -{ #category : #accessing } -GtFilterVirtualEmptyModel >> label [ - ^ 'empty' -] - { #category : #accessing } GtFilterVirtualEmptyModel >> name [ ^ 'empty' diff --git a/src/GToolkit-Coder-UI/GtFilterVirtualExceptionModel.class.st b/src/GToolkit-Coder-UI/GtFilterVirtualExceptionModel.class.st new file mode 100644 index 000000000..b6697c3f2 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterVirtualExceptionModel.class.st @@ -0,0 +1,36 @@ +Class { + #name : #GtFilterVirtualExceptionModel, + #superclass : #GtFilterModel, + #instVars : [ + 'exception' + ], + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #accessing } +GtFilterVirtualExceptionModel >> exception [ + ^ exception +] + +{ #category : #accessing } +GtFilterVirtualExceptionModel >> exception: anException [ + | anExceptionCopy | + anExceptionCopy := GtSystemUtility freeze: anException. + + exception := anExceptionCopy +] + +{ #category : #testing } +GtFilterVirtualExceptionModel >> isExceptionFilterModel [ + ^ true +] + +{ #category : #testing } +GtFilterVirtualExceptionModel >> isVirtualFilterModel [ + ^ true +] + +{ #category : #accessing } +GtFilterVirtualExceptionModel >> name [ + ^ 'exception' +] diff --git a/src/GToolkit-Coder-UI/GtFilterVirtualWaitingModel.class.st b/src/GToolkit-Coder-UI/GtFilterVirtualWaitingModel.class.st new file mode 100644 index 000000000..efdd9fc52 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterVirtualWaitingModel.class.st @@ -0,0 +1,17 @@ +Class { + #name : #GtFilterVirtualWaitingModel, + #superclass : #GtFilterModel, + #traits : 'TGtUniqueInstance', + #classTraits : 'TGtUniqueInstance classTrait', + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #testing } +GtFilterVirtualWaitingModel >> isVirtualFilterModel [ + ^ true +] + +{ #category : #accessing } +GtFilterVirtualWaitingModel >> name [ + ^ 'rendering...' +] From d4e4fc5385f7cd78bbe969411273f5e0b1692880 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 17 Oct 2024 20:52:59 +0200 Subject: [PATCH 0750/1268] fix method drop on a class --- src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index 53429ba00..7cf0e6ad1 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -270,7 +270,7 @@ GtCoderClassesTreeElement >> newSubclassOf: aClass [ GtCoderClassesTreeElement >> onDropCompiledMethodsOnClass: anItemsDroppedEvent [ | aClass aModel compositeChange| - aClass := anItemsDroppedEvent currentTarget userData at: #'coder-class'. + aClass := anItemsDroppedEvent currentTarget theClass. aModel := RBNamespace new. From 5710fcc62938904a774a793591ca61606fd96f55 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 17 Oct 2024 16:52:09 -0300 Subject: [PATCH 0751/1268] Remove unused instance variable [feenkcom/gtoolkit#3983] --- src/GToolkit-Coder-UI/GtFilterSelectableItemModel.class.st | 1 - 1 file changed, 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtFilterSelectableItemModel.class.st b/src/GToolkit-Coder-UI/GtFilterSelectableItemModel.class.st index cb2b43296..618066660 100644 --- a/src/GToolkit-Coder-UI/GtFilterSelectableItemModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterSelectableItemModel.class.st @@ -2,7 +2,6 @@ Class { #name : #GtFilterSelectableItemModel, #superclass : #GtFilterModel, #instVars : [ - 'items', 'selectedItem', 'itemsBuilder' ], From d1892f92168701d807577379f6b860fde0129261 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 17 Oct 2024 18:48:48 -0300 Subject: [PATCH 0752/1268] it is possible to display all short-list-filter items, including selected item [feenkcom/gtoolkit#3983] In this case, selected items are disabled to visually notice that it is the selected item. --- .../GtFilterModelAllItemsSelector.class.st | 11 ++++ .../GtFilterModelItemsSelector.class.st | 29 ++++++++++ ...lItemsWithoutSelectedItemSelector.class.st | 11 ++++ .../GtFilterShortListModel.class.st | 27 +++++++++ .../GtFilterShortListSettingsElement.class.st | 57 ++++++++++++++++++- .../GtFilterShortListViewModel.class.st | 4 +- 6 files changed, 134 insertions(+), 5 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtFilterModelAllItemsSelector.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterModelItemsSelector.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterModelItemsWithoutSelectedItemSelector.class.st diff --git a/src/GToolkit-Coder-UI/GtFilterModelAllItemsSelector.class.st b/src/GToolkit-Coder-UI/GtFilterModelAllItemsSelector.class.st new file mode 100644 index 000000000..be36da2aa --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModelAllItemsSelector.class.st @@ -0,0 +1,11 @@ +Class { + #name : #GtFilterModelAllItemsSelector, + #superclass : #GtFilterModelItemsSelector, + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #accessing } +GtFilterModelAllItemsSelector >> items [ + + ^ self filterModel items +] diff --git a/src/GToolkit-Coder-UI/GtFilterModelItemsSelector.class.st b/src/GToolkit-Coder-UI/GtFilterModelItemsSelector.class.st new file mode 100644 index 000000000..80c82215a --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModelItemsSelector.class.st @@ -0,0 +1,29 @@ +Class { + #name : #GtFilterModelItemsSelector, + #superclass : #Object, + #instVars : [ + 'filterModel' + ], + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #accessing } +GtFilterModelItemsSelector >> filterModel [ + ^ filterModel +] + +{ #category : #accessing } +GtFilterModelItemsSelector >> filterModel: anObject [ + filterModel := anObject +] + +{ #category : #accessing } +GtFilterModelItemsSelector >> items [ + + ^ self subclassResponsibility +] + +{ #category : #accessing } +GtFilterModelItemsSelector >> selectedItem [ + ^ self filterModel selectedItem +] diff --git a/src/GToolkit-Coder-UI/GtFilterModelItemsWithoutSelectedItemSelector.class.st b/src/GToolkit-Coder-UI/GtFilterModelItemsWithoutSelectedItemSelector.class.st new file mode 100644 index 000000000..230a6cc03 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModelItemsWithoutSelectedItemSelector.class.st @@ -0,0 +1,11 @@ +Class { + #name : #GtFilterModelItemsWithoutSelectedItemSelector, + #superclass : #GtFilterModelItemsSelector, + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #'as yet unclassified' } +GtFilterModelItemsWithoutSelectedItemSelector >> items [ + + ^ self filterModel items reject: [ :each | self selectedItem = each ] +] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st index 0153994ba..73deef7e7 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st @@ -1,10 +1,37 @@ Class { #name : #GtFilterShortListModel, #superclass : #GtFilterSelectableItemModel, + #instVars : [ + 'itemsSelector' + ], #category : #'GToolkit-Coder-UI-Filters - Models' } +{ #category : #initialization } +GtFilterShortListModel >> displayAllItems [ + "Display all items, including the selected item in a dropdown list." + + itemsSelector := GtFilterModelAllItemsSelector new filterModel: self +] + +{ #category : #initialization } +GtFilterShortListModel >> displayItemsWithoutSelectedItem [ + itemsSelector := GtFilterModelItemsWithoutSelectedItemSelector new filterModel: self +] + { #category : #accessing } GtFilterShortListModel >> filterViewModelClass [ ^ GtFilterShortListViewModel ] + +{ #category : #initialization } +GtFilterShortListModel >> initialize [ + super initialize. + itemsSelector := GtFilterModelItemsWithoutSelectedItemSelector new filterModel: self +] + +{ #category : #accessing } +GtFilterShortListModel >> someItems [ + + ^ itemsSelector items +] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st index e0bf65ed1..f3990a074 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st @@ -29,6 +29,9 @@ GtFilterShortListSettingsElement >> dispatchShowItemsWish [ GtFilterShortListSettingsElement >> focusFirstItemElementInList: aListElement [ aListElement requestFocus. aListElement selectFirst. + aListElement selectedItemDo: [ :anItem | + (self filterViewModel selectedItem = anItem) + ifTrue: [ aListElement selectNext ] ]. aListElement scrollToSelection ] @@ -109,7 +112,8 @@ GtFilterShortListSettingsElement >> newContentElement [ fitContentLimited; itemStencil: [ :anItemType :aListWidget | self newItemElement ]; itemDataBinder: [ :anItemElement :anItemObject :anItemIndex | - anItemElement disabled: anItemObject isVirtualFilterModelItem. + anItemElement disabled: (anItemObject isVirtualFilterModelItem or: [ + anItemObject = self filterViewModel selectedItem ]). anItemElement label: (anItemObject label ifNil: [ self defaultItemLabel ]); icon: (anItemObject icon ifNil: [ self defaultItemIcon ]); @@ -127,7 +131,19 @@ GtFilterShortListSettingsElement >> newContentElement [ name: 'Pick selected filter item'; description: 'Pick selected item as the filter selected item'; combination: BlKeyCombination builder enter build; - action: [ :aShortcutEvent :aShortcut | self onPickSelectedItemEvent: aShortcutEvent ]). + action: [ :aShortcutEvent :aShortcut | self onPickSelectedItemEvent: aShortcutEvent ]); + addShortcut: (BlShortcutWithAction new + combination: BlKeyCombination builder arrowDown build; + action: [ self selectNextItemInList: aListElement ]); + addShortcut: (BlShortcutWithAction new + combination: BlKeyCombination builder arrowUp build; + action: [ self selectPreviousItemInList: aListElement ])"; + addShortcut: (BlShortcutWithAction new + combination: BlKeyCombination builder primary home build; + action: [ self selectFirst; scrollToSelection ]); + addShortcut: (BlShortcutWithAction new + combination: BlKeyCombination builder primary end build; + action: [ self selectLast; scrollToSelection ] )". self updateListElement: aListElement. listElement at: 1 put: aListElement. @@ -234,6 +250,40 @@ GtFilterShortListSettingsElement >> onSelectedItemChanged: anAnnouncement [ BlTaskAction enqueueElement: self action: [ self updateElement ] ] +{ #category : #'event handling' } +GtFilterShortListSettingsElement >> selectNextItemInList: aListElement [ + | aCurrentSelection | + aCurrentSelection := aListElement selectedIndices. + aListElement selectNext. + aListElement selectedItemDo: [ :anItem | + (self filterViewModel selectedItem = anItem) + ifTrue: [ aListElement selectNext ] ]. + aListElement selectedItemDo: [ :anItem | + (self filterViewModel selectedItem = anItem) + ifTrue: [ + aListElement selectPrevious. + ^ self ] ]. + + aListElement scrollToSelection +] + +{ #category : #'event handling' } +GtFilterShortListSettingsElement >> selectPreviousItemInList: aListElement [ + | aCurrentSelection | + aCurrentSelection := aListElement selectedIndices. + aListElement selectPrevious. + aListElement selectedItemDo: [ :anItem | + (self filterViewModel selectedItem = anItem) + ifTrue: [ aListElement selectPrevious ] ]. + aListElement selectedItemDo: [ :anItem | + (self filterViewModel selectedItem = anItem) + ifTrue: [ + aListElement selectNext. + ^ self ] ]. + + aListElement scrollToSelection +] + { #category : #'api - filter view model' } GtFilterShortListSettingsElement >> subscribeToFilterViewModel [ super subscribeToFilterViewModel. @@ -301,7 +351,7 @@ GtFilterShortListSettingsElement >> updateListElement [ GtFilterShortListSettingsElement >> updateListElement: anElement [ | aCollection | self hasFilterViewModel ifFalse: [ ^ self ]. - aCollection := self filterViewModel itemsWithoutSelection. + aCollection := self filterViewModel someItems. aCollection ifEmpty: [ anElement items: {GtFilterModelEmptyItem default} ] ifNotEmpty: [ anElement items: aCollection ] @@ -312,6 +362,7 @@ GtFilterShortListSettingsElement >> updateSelectedItem: aFilterModelItem from: a aFilterModelItem ifNil: [ ^ self ]. aFilterModelItem isVirtualFilterModelItem ifTrue: [ ^ self ]. self hasFilterViewModel ifFalse: [ ^ self ]. + aFilterModelItem = self filterViewModel selectedItem ifTrue: [ ^ self ]. BlTaskAction enqueueElement: self action: [ anElement fireEvent: BrDropdownHideWish new ]. diff --git a/src/GToolkit-Coder-UI/GtFilterShortListViewModel.class.st b/src/GToolkit-Coder-UI/GtFilterShortListViewModel.class.st index 71efd4ba0..34542dd78 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListViewModel.class.st @@ -10,7 +10,7 @@ GtFilterShortListViewModel >> filterElementClass [ ] { #category : #accessing } -GtFilterShortListViewModel >> itemsWithoutSelection [ +GtFilterShortListViewModel >> someItems [ - ^ self filterModel items select: [ :each | self selectedItem ~= each ] + ^ self filterModel someItems ] From 9e2231658b748c1bc0ad32b6ba4377e8a5875bfb Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 17 Oct 2024 23:35:50 -0300 Subject: [PATCH 0753/1268] refactoring [feenkcom/gtoolkit#3983] --- .../GtFilterModelExamples.class.st | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st b/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st index f43280ab8..ede2cbfb0 100644 --- a/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st @@ -10,9 +10,9 @@ GtFilterModelExamples >> booleanModel [ | aModel | aModel := GtFilterBooleanModel new. aModel switchedOn: true. - aModel label: 'Trait methods'. + aModel name: 'Trait methods'. self assert: aModel isSwitchedOn. - + ^ aModel ] @@ -21,8 +21,8 @@ GtFilterModelExamples >> invariableModel [ | aModel | aModel := GtFilterInvariableModel new. - aModel label: 'Stable tests'. - + aModel name: 'Stable tests'. + ^ aModel ] @@ -318,7 +318,7 @@ GtFilterModelExamples >> shortListModel [ items: {'instance'. 'class'}. aModel selectedItem: 'class'. - aModel label: 'Side'. + aModel name: 'Side'. self assert: aModel items equals: ({'instance'. @@ -486,7 +486,7 @@ GtFilterModelExamples >> textModel [ | aModel | aModel := GtFilterTextModel new. aModel text: 'Object'. - aModel label: 'Methods up to'. + aModel name: 'Methods up to'. self assert: (aModel text equals: 'Object' asRopedText). ^ aModel @@ -497,7 +497,7 @@ GtFilterModelExamples >> toggleModel [ | aModel | aModel := GtFilterToggleModel new. - aModel label: 'Side'. + aModel name: 'Side'. aModel items: {GtFilterModelInstanceSideItem new. GtFilterModelClassSideItem new}. From 97f375f9ebff6153da148eb836f2c8e8f414231b Mon Sep 17 00:00:00 2001 From: Alistair Grant Date: Fri, 18 Oct 2024 17:27:30 +0200 Subject: [PATCH 0754/1268] GtFilterModelExamples avoid deprecated methods --- .../GtFilterModelExamples.class.st | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st b/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st index ede2cbfb0..ac33e0978 100644 --- a/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st @@ -350,7 +350,7 @@ GtFilterModelExamples >> shortListModelPluggableItems [ aModel items: allItems. aModel selectFirstItem. - aModel label: 'Classes'. + aModel name: 'Classes'. self assert: aModel selectedItem @@ -378,11 +378,14 @@ GtFilterModelExamples >> shortListModelPluggableItemsWithIconAndLabelBuilders [ aClass gtSystemIconName ifNotNil: [ :anIconName | aClass gtSafeIconNamed: anIconName ] ]. aLabelBuilder := [ :aClass | aClass name ]. - - aModel items: aCollection icon: anIconBuilder label: aLabelBuilder. + + aModel + items: aCollection + icon: anIconBuilder + label: aLabelBuilder. aModel selectFirstItem. - aModel label: 'Classes'. - + aModel name: 'Classes'. + self assert: aModel selectedItem equals: (GtFilterModelPluggableItem new @@ -406,12 +409,12 @@ GtFilterModelExamples >> shortListModelPluggableItemsWithoutIconBuilder [ TGtAnnouncer. Object. ProtoObject}. - aLabelBuilder := [ :aClass | '+ ', aClass name ]. - + aLabelBuilder := [ :aClass | '+ ' , aClass name ]. + aModel items: aCollection label: aLabelBuilder. aModel selectFirstItem. - aModel label: 'Classes'. - + aModel name: 'Classes'. + self assert: aModel selectedItem equals: (GtFilterModelPluggableItem new @@ -440,8 +443,8 @@ GtFilterModelExamples >> shortListModelPluggableItemsWithoutLabelBuilder [ aModel items: aCollection icon: anIconBuilder. aModel selectFirstItem. - aModel label: 'Classes'. - + aModel name: 'Classes'. + self assert: aModel selectedItem equals: (GtFilterModelPluggableItem new @@ -465,7 +468,7 @@ GtFilterModelExamples >> shortListModelWithIcons [ GtFilterModelClassItem new itemClass: Object. GtFilterModelClassItem new itemClass: ProtoObject}. aModel selectFirstItem. - aModel label: 'Classes'. + aModel name: 'Classes'. self assert: aModel items equals: {GtFilterModelClassItem new itemClass: Array. @@ -511,7 +514,7 @@ GtFilterModelExamples >> toggleModelWithIcons [ | aModel | aModel := GtFilterToggleModel new. - aModel label: 'Origin'. + aModel name: 'Origin'. aModel items: {GtFilterModelTraitOriginItem new. GtFilterModelClassOriginItem new}. From 1e84fbc85cf6bd5fde644a2de2b8543226cb676f Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Fri, 18 Oct 2024 18:25:15 +0200 Subject: [PATCH 0755/1268] rename gtViewActionSourceCodeFor: to #gtSourceCode: --- src/GToolkit-Coder-Extensions/GtCoderAction.extension.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-Extensions/GtCoderAction.extension.st b/src/GToolkit-Coder-Extensions/GtCoderAction.extension.st index 02c2f66b7..8d81c521a 100644 --- a/src/GToolkit-Coder-Extensions/GtCoderAction.extension.st +++ b/src/GToolkit-Coder-Extensions/GtCoderAction.extension.st @@ -1,7 +1,7 @@ Extension { #name : #GtCoderAction } { #category : #'*GToolkit-Coder-Extensions' } -GtCoderAction >> gtViewActionSourceCodeFor: aView [ +GtCoderAction >> gtSourceCodeFor: aView [ ^ self action ifNil: [ aView ] From 80954061dd722ea993f0d8881c61d3ebc42299fd Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Sun, 20 Oct 2024 16:04:32 -0300 Subject: [PATCH 0756/1268] `GtFilteredCodersModel>>#addOrReplaceFilter:` uses `GtSearchFilter>>#filterType` [feenkcom/gtoolkit#3983] --- .../GtFilteredCodersModel.class.st | 2 +- src/GToolkit-SearchFilters/GtSearchFilter.class.st | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st b/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st index c2982cf67..f3dd75bd0 100644 --- a/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st +++ b/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st @@ -23,7 +23,7 @@ GtFilteredCodersModel >> addOrReplaceFilter: aFilter [ isChanged := false. newFilters := self additionalFilters collect: [ :eachFilter | - eachFilter class = aFilter class + eachFilter filterType = aFilter filterType ifTrue: [ isChanged := true. aFilter ] diff --git a/src/GToolkit-SearchFilters/GtSearchFilter.class.st b/src/GToolkit-SearchFilters/GtSearchFilter.class.st index 8fb62124e..6657fcd3d 100644 --- a/src/GToolkit-SearchFilters/GtSearchFilter.class.st +++ b/src/GToolkit-SearchFilters/GtSearchFilter.class.st @@ -90,6 +90,13 @@ GtSearchFilter >> filterLabel [ ^ nil ] +{ #category : #accessing } +GtSearchFilter >> filterType [ + "Filter type is used to compare whether two filters are of a same type." + + ^ self class +] + { #category : #accessing } GtSearchFilter >> filterValueString [ ^ nil From e0eb47eaec76249fa854504e0b77118110e0f3f7 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Sun, 20 Oct 2024 16:36:08 -0300 Subject: [PATCH 0757/1268] filter toggle aptitudes with white border [feenkcom/gtoolkit#3983] --- .../GtFilterToggleBackgroundAptitude.class.st | 15 ++++++++++++++ .../GtFilterToggleGroupAptitude.class.st | 20 +++++++++++++++++++ .../GtFilterToggleSettingsElement.class.st | 6 ++++-- 3 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtFilterToggleBackgroundAptitude.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterToggleGroupAptitude.class.st diff --git a/src/GToolkit-Coder-UI/GtFilterToggleBackgroundAptitude.class.st b/src/GToolkit-Coder-UI/GtFilterToggleBackgroundAptitude.class.st new file mode 100644 index 000000000..a2356f18f --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterToggleBackgroundAptitude.class.st @@ -0,0 +1,15 @@ +Class { + #name : #GtFilterToggleBackgroundAptitude, + #superclass : #BrToggleAptitude, + #category : #'GToolkit-Coder-UI-Filters - Support' +} + +{ #category : #initialization } +GtFilterToggleBackgroundAptitude >> initialize [ + super initialize. + self + activated: [ :aStyle | + aStyle background: self theme button defaultBorderColor lighter. + aStyle + border: (BlBorder paint: self theme button defaultBackgroundColor width: 1) ] +] diff --git a/src/GToolkit-Coder-UI/GtFilterToggleGroupAptitude.class.st b/src/GToolkit-Coder-UI/GtFilterToggleGroupAptitude.class.st new file mode 100644 index 000000000..74eb951f2 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterToggleGroupAptitude.class.st @@ -0,0 +1,20 @@ +Class { + #name : #GtFilterToggleGroupAptitude, + #superclass : #BrToggleGroupAptitude, + #category : #'GToolkit-Coder-UI-Filters - Support' +} + +{ #category : #initialization } +GtFilterToggleGroupAptitude >> initialize [ + super initialize. + self + addChangeProperty: #(widget layout) + with: [ BlLinearLayout horizontal cellSpacing: 0 ]. + self + addChangeProperty: #(widget geometry) + with: [ BlRoundedRectangleGeometry cornerRadius: 3 ]. + self + addChangeProperty: #(widget background) + with: + [ self theme default contentBackgroundColor ]. +] diff --git a/src/GToolkit-Coder-UI/GtFilterToggleSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterToggleSettingsElement.class.st index 47c6783ab..58e7b63c2 100644 --- a/src/GToolkit-Coder-UI/GtFilterToggleSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterToggleSettingsElement.class.st @@ -32,8 +32,7 @@ GtFilterToggleSettingsElement >> initializeShortcuts [ { #category : #initialization } GtFilterToggleSettingsElement >> initializeToggleGroupElement [ toggleGroupElement := BrToggleGroup new - aptitude: BrGlamorousToggleGroupAptitude new; - background: self theme default contentBackgroundColor; + aptitude: GtFilterToggleGroupAptitude new; when: BrToggleActivatedEvent do: [ :anEvent | self onToggleActivatedEvent: anEvent ] ] @@ -46,6 +45,9 @@ GtFilterToggleSettingsElement >> newAptitudeForItem: anItem [ ifIcon: [ BrGlamorousToggleWithIconAptitude new ] ifLabel: [ BrGlamorousToggleWithLabelAptitude new ]. + anAptitude - BrGlamorousToggleBackgroundAptitude. + anAptitude + GtFilterToggleBackgroundAptitude. + ^ anAptitude ] From 88b2d266cc83874dce932d48094c7f3378041a0b Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 21 Oct 2024 16:10:55 +0200 Subject: [PATCH 0758/1268] [feenkcom/gtoolkit#4097] don't cache extended classes in an extension tag --- .../GtCoderPackageExtensionTag.class.st | 28 ++++++------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/src/GToolkit-Coder/GtCoderPackageExtensionTag.class.st b/src/GToolkit-Coder/GtCoderPackageExtensionTag.class.st index 94da7190e..1900a7a09 100644 --- a/src/GToolkit-Coder/GtCoderPackageExtensionTag.class.st +++ b/src/GToolkit-Coder/GtCoderPackageExtensionTag.class.st @@ -2,8 +2,7 @@ Class { #name : #GtCoderPackageExtensionTag, #superclass : #Object, #instVars : [ - 'package', - 'classes' + 'package' ], #category : #'GToolkit-Coder-Navigation - Model' } @@ -15,19 +14,14 @@ GtCoderPackageExtensionTag class >> forPackage: aRPackage [ { #category : #testing } GtCoderPackageExtensionTag >> = anObject [ - ^ self class == anObject class - and: [ package = anObject package and: [ classes = anObject classes ] ] + ^ self class = anObject class + and: [ package = anObject package ] ] { #category : #accessing } GtCoderPackageExtensionTag >> classes [ - ^ classes -] - -{ #category : #accessing } -GtCoderPackageExtensionTag >> classes: anObject [ - classes := anObject + ^ self package extendedClasses asArray ] { #category : #accessing } @@ -38,12 +32,12 @@ GtCoderPackageExtensionTag >> gtTagName [ { #category : #testing } GtCoderPackageExtensionTag >> hasExtendedClasses [ - ^ self classes isNotEmpty + ^ self package gtDoesExtendClasses ] { #category : #testing } GtCoderPackageExtensionTag >> hash [ - ^ package hash bitXor: classes hash + ^ package hash ] { #category : #testing } @@ -61,11 +55,6 @@ GtCoderPackageExtensionTag >> name [ ^ 'Extensions' ] -{ #category : #hooks } -GtCoderPackageExtensionTag >> onPackageChange [ - self classes: self package extendedClasses asArray -] - { #category : #accessing } GtCoderPackageExtensionTag >> package [ @@ -74,11 +63,10 @@ GtCoderPackageExtensionTag >> package [ { #category : #accessing } GtCoderPackageExtensionTag >> package: aRPackage [ - package := aRPackage. - self onPackageChange. + package := aRPackage ] { #category : #accessing } GtCoderPackageExtensionTag >> packageName [ - ^ self package name. + ^ self package name ] From ff13405de4fe7bed86bc5b91c372615dd7ca7038 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 21 Oct 2024 15:53:07 -0300 Subject: [PATCH 0759/1268] add a search filter requester context setter [feenkcom/gtoolkit#3983] --- src/GToolkit-SearchFilters/GtSearchFilter.class.st | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/GToolkit-SearchFilters/GtSearchFilter.class.st b/src/GToolkit-SearchFilters/GtSearchFilter.class.st index 6657fcd3d..3ca325913 100644 --- a/src/GToolkit-SearchFilters/GtSearchFilter.class.st +++ b/src/GToolkit-SearchFilters/GtSearchFilter.class.st @@ -136,6 +136,13 @@ GtSearchFilter >> notEmpty [ ^ self result hasNext wait ] +{ #category : #'api - accessing' } +GtSearchFilter >> requesterContext: aRequesterContext [ + "Set a requester context" + + +] + { #category : #'api - accessing' } GtSearchFilter >> requesterContextDo: aBlock [ "Pass a requester context to aBlock if the context is available" From dbf2bb806751d55a56de0d360457f3b0a8f84a90 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 21 Oct 2024 21:21:22 -0300 Subject: [PATCH 0760/1268] add `GtFilterDefaultSearchFilters` [feenkcom/gtoolkit#3983] --- .../GtFilterDefaultSearchFilters.class.st | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 src/GToolkit-Coder-UI/GtFilterDefaultSearchFilters.class.st diff --git a/src/GToolkit-Coder-UI/GtFilterDefaultSearchFilters.class.st b/src/GToolkit-Coder-UI/GtFilterDefaultSearchFilters.class.st new file mode 100644 index 000000000..76b4cc481 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterDefaultSearchFilters.class.st @@ -0,0 +1,62 @@ +Class { + #name : #GtFilterDefaultSearchFilters, + #superclass : #Object, + #traits : 'TGtUniqueInstance', + #classTraits : 'TGtUniqueInstance classTrait', + #instVars : [ + 'searchFilters' + ], + #category : #'GToolkit-Coder-UI-Filters - Support' +} + +{ #category : #'add / remove' } +GtFilterDefaultSearchFilters class >> addSearchFilter: aSearchFilter [ + self default addSearchFilter: aSearchFilter +] + +{ #category : #'add / remove' } +GtFilterDefaultSearchFilters class >> addSearchFilters: aCollectionOfSearchFilters [ + self default addSearchFilters: aCollectionOfSearchFilters +] + +{ #category : #accessing } +GtFilterDefaultSearchFilters class >> searchFilters [ + ^ self default searchFilters +] + +{ #category : #accessing } +GtFilterDefaultSearchFilters class >> searchFilters: aCollectionOfSearchFilters [ + self default searchFilters: aCollectionOfSearchFilters +] + +{ #category : #'add / remove' } +GtFilterDefaultSearchFilters >> addSearchFilter: aSearchFilter [ + searchFilters := self searchFilters copyWith: aSearchFilter +] + +{ #category : #'add / remove' } +GtFilterDefaultSearchFilters >> addSearchFilters: aCollectionOfSearchFilters [ + searchFilters := self searchFilters copyWithAll: aCollectionOfSearchFilters +] + +{ #category : #accessing } +GtFilterDefaultSearchFilters >> collectSearchFilters [ + ^ self pragmaSearchFilters + collect: [ :eachPragma | self perform: eachPragma methodSelector ] +] + +{ #category : #accessing } +GtFilterDefaultSearchFilters >> searchFilters [ + ^ searchFilters ifNil: [ searchFilters := self collectSearchFilters ] +] + +{ #category : #accessing } +GtFilterDefaultSearchFilters >> searchFilters: aCollectionOfSearchFilters [ + searchFilters := aCollectionOfSearchFilters +] + +{ #category : #default } +GtFilterDefaultSearchFilters >> traitSearchFilter [ + + ^ GtSearchNonTraitMethodsFilter new +] From 95394788fef857974799a993db5f4ef90f3ddb17 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 21 Oct 2024 22:56:36 -0300 Subject: [PATCH 0761/1268] fix `GtFilterDefaultSearchFilters` [feenkcom/gtoolkit#3983] --- .../GtFilterDefaultSearchFilters.class.st | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtFilterDefaultSearchFilters.class.st b/src/GToolkit-Coder-UI/GtFilterDefaultSearchFilters.class.st index 76b4cc481..1c00764c7 100644 --- a/src/GToolkit-Coder-UI/GtFilterDefaultSearchFilters.class.st +++ b/src/GToolkit-Coder-UI/GtFilterDefaultSearchFilters.class.st @@ -45,6 +45,15 @@ GtFilterDefaultSearchFilters >> collectSearchFilters [ collect: [ :eachPragma | self perform: eachPragma methodSelector ] ] +{ #category : #accessing } +GtFilterDefaultSearchFilters >> pragmaSearchFilters [ + ^ Pragma + allNamed: #gtDefaultSearchFilter: + from: self class + to: GtFilterDefaultSearchFilters + sortedByArgument: 1 +] + { #category : #accessing } GtFilterDefaultSearchFilters >> searchFilters [ ^ searchFilters ifNil: [ searchFilters := self collectSearchFilters ] From efc4c7a65913fbad1f272b19281721d25441321c Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 21 Oct 2024 22:56:51 -0300 Subject: [PATCH 0762/1268] fix `GtFilterDefaultSearchFilters` [feenkcom/gtoolkit#3983] --- src/GToolkit-Coder-UI/GtFilterDefaultSearchFilters.class.st | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterDefaultSearchFilters.class.st b/src/GToolkit-Coder-UI/GtFilterDefaultSearchFilters.class.st index 1c00764c7..82b887329 100644 --- a/src/GToolkit-Coder-UI/GtFilterDefaultSearchFilters.class.st +++ b/src/GToolkit-Coder-UI/GtFilterDefaultSearchFilters.class.st @@ -63,9 +63,3 @@ GtFilterDefaultSearchFilters >> searchFilters [ GtFilterDefaultSearchFilters >> searchFilters: aCollectionOfSearchFilters [ searchFilters := aCollectionOfSearchFilters ] - -{ #category : #default } -GtFilterDefaultSearchFilters >> traitSearchFilter [ - - ^ GtSearchNonTraitMethodsFilter new -] From 1e23111e24d0f20cf78106339bf4c3df564ddfe2 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Tue, 22 Oct 2024 11:28:31 +0200 Subject: [PATCH 0763/1268] [feenkcom/gtoolkit#4088] support moving a method to `as yet unclassified` protocol --- ...tCoderProtocolsGroupedListElement.class.st | 74 +++++++++++-------- 1 file changed, 45 insertions(+), 29 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st index d886b183e..a829295d0 100644 --- a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st @@ -284,39 +284,55 @@ GtCoderProtocolsGroupedListElement >> navigationModel: anObject [ { #category : #'private - refactorings' } GtCoderProtocolsGroupedListElement >> onDropCompiledMethodsOnProtocol: anItemsDroppedEvent [ - | aProtocol aProtocolClass aModel compositeChange| - + | aProtocol aProtocolClass aModel compositeChange | aProtocol := anItemsDroppedEvent currentTarget userData at: #protocol. aProtocolClass := aProtocol protocolClass. - + aModel := RBNamespace new. - - anItemsDroppedEvent items do: [ :eachDragItem | - | aTargetProtocolClass eachCompiledMethod | - - eachCompiledMethod := eachDragItem domainObject. - aTargetProtocolClass := eachCompiledMethod isClassSide - ifTrue: [ aProtocolClass classSide ] - ifFalse: [ aProtocolClass instanceSide ]. - - eachCompiledMethod methodClass = aTargetProtocolClass - ifTrue: [ - aModel - selector: eachCompiledMethod selector - in: aTargetProtocolClass - classified: aProtocol name ] - ifFalse: [ - eachDragItem shouldCopy - ifFalse: [ - aModel - removeMethod: eachCompiledMethod selector - from: eachCompiledMethod methodClass ]. - aModel - compile: eachCompiledMethod sourceCode - in: aTargetProtocolClass - classified: aProtocol name ] ]. - + + anItemsDroppedEvent items + do: [ :eachDragItem | + | aTargetProtocolClass eachCompiledMethod | + eachCompiledMethod := eachDragItem domainObject. + aTargetProtocolClass := eachCompiledMethod isClassSide + ifTrue: [ aProtocolClass classSide ] + ifFalse: [ aProtocolClass instanceSide ]. + + eachCompiledMethod methodClass = aTargetProtocolClass + ifTrue: [ + aProtocol name = Protocol unclassified + ifTrue: [ + "To circumvent Pharo's behavior we first + remove a method and then add it as unclassified back" + aModel + removeMethod: eachCompiledMethod selector + from: eachCompiledMethod methodClass. + + aModel + compile: eachCompiledMethod sourceCode + in: aTargetProtocolClass + classified: aProtocol name ] + ifFalse: [ + "Pharo doesn't allow to change method's protocol + to `as yet unclassified` if that method's was + already classified" + aModel + selector: eachCompiledMethod selector + in: aTargetProtocolClass + classified: aProtocol name ] ] + ifFalse: [ + eachDragItem shouldCopy + ifFalse: [ + aModel + removeMethod: eachCompiledMethod selector + from: eachCompiledMethod methodClass ]. + aModel + compile: eachCompiledMethod sourceCode + in: aTargetProtocolClass + classified: aProtocol name ] ]. + compositeChange := aModel changes. + compositeChange execute ] From a6c0fe0ab39cd8ff9fed170f14981ef9fd0411ae Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Tue, 22 Oct 2024 11:34:35 +0200 Subject: [PATCH 0764/1268] [feenkcom/gtoolkit#4089] support moving a method from instance to class side by dragging on a protocol --- .../GtCoderProtocolsGroupedListElement.class.st | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st index a829295d0..58ef7c2fd 100644 --- a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st @@ -294,9 +294,7 @@ GtCoderProtocolsGroupedListElement >> onDropCompiledMethodsOnProtocol: anItemsDr do: [ :eachDragItem | | aTargetProtocolClass eachCompiledMethod | eachCompiledMethod := eachDragItem domainObject. - aTargetProtocolClass := eachCompiledMethod isClassSide - ifTrue: [ aProtocolClass classSide ] - ifFalse: [ aProtocolClass instanceSide ]. + aTargetProtocolClass := aProtocolClass. eachCompiledMethod methodClass = aTargetProtocolClass ifTrue: [ From a939c14d95ec3249bf9e7fb75b636b6991d1f966 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 22 Oct 2024 10:12:12 -0300 Subject: [PATCH 0765/1268] distinguish between coder and filter search filters [feenkcom/gtoolkit#3983] --- .../GtFilterDefaultSearchFilters.class.st | 107 ++++++++++++++---- 1 file changed, 83 insertions(+), 24 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterDefaultSearchFilters.class.st b/src/GToolkit-Coder-UI/GtFilterDefaultSearchFilters.class.st index 82b887329..075c0e7ef 100644 --- a/src/GToolkit-Coder-UI/GtFilterDefaultSearchFilters.class.st +++ b/src/GToolkit-Coder-UI/GtFilterDefaultSearchFilters.class.st @@ -4,62 +4,121 @@ Class { #traits : 'TGtUniqueInstance', #classTraits : 'TGtUniqueInstance classTrait', #instVars : [ - 'searchFilters' + 'coderSearchFilters', + 'filterSearchFilters' + ], + #classInstVars : [ + 'uniqueInstance' ], #category : #'GToolkit-Coder-UI-Filters - Support' } { #category : #'add / remove' } -GtFilterDefaultSearchFilters class >> addSearchFilter: aSearchFilter [ - self default addSearchFilter: aSearchFilter +GtFilterDefaultSearchFilters class >> addCoderSearchFilter: aSearchFilter [ + self default addCoderSearchFilter: aSearchFilter +] + +{ #category : #'add / remove' } +GtFilterDefaultSearchFilters class >> addCoderSearchFilters: aCollectionOfSearchFilters [ + self default addCoderSearchFilters: aCollectionOfSearchFilters ] { #category : #'add / remove' } -GtFilterDefaultSearchFilters class >> addSearchFilters: aCollectionOfSearchFilters [ - self default addSearchFilters: aCollectionOfSearchFilters +GtFilterDefaultSearchFilters class >> addFilterSearchFilter: aSearchFilter [ + self default addFilterSearchFilter: aSearchFilter +] + +{ #category : #'add / remove' } +GtFilterDefaultSearchFilters class >> addFilterSearchFilters: aCollectionOfSearchFilters [ + self default addFilterSearchFilters: aCollectionOfSearchFilters ] { #category : #accessing } -GtFilterDefaultSearchFilters class >> searchFilters [ - ^ self default searchFilters +GtFilterDefaultSearchFilters class >> coderSearchFilters [ + ^ self default coderSearchFilters ] { #category : #accessing } -GtFilterDefaultSearchFilters class >> searchFilters: aCollectionOfSearchFilters [ - self default searchFilters: aCollectionOfSearchFilters +GtFilterDefaultSearchFilters class >> coderSearchFilters: aCollectionOfSearchFilters [ + self default coderSearchFilters: aCollectionOfSearchFilters +] + +{ #category : #accessing } +GtFilterDefaultSearchFilters class >> filterSearchFilters [ + ^ self default filterSearchFilters +] + +{ #category : #accessing } +GtFilterDefaultSearchFilters class >> filterSearchFilters: aCollectionOfSearchFilters [ + self default filterSearchFilters: aCollectionOfSearchFilters +] + +{ #category : #'add / remove' } +GtFilterDefaultSearchFilters >> addCoderSearchFilter: aSearchFilter [ + coderSearchFilters := self coderSearchFilters copyWith: aSearchFilter ] { #category : #'add / remove' } -GtFilterDefaultSearchFilters >> addSearchFilter: aSearchFilter [ - searchFilters := self searchFilters copyWith: aSearchFilter +GtFilterDefaultSearchFilters >> addCoderSearchFilters: aCollectionOfSearchFilters [ + coderSearchFilters := self coderSearchFilters copyWithAll: aCollectionOfSearchFilters ] { #category : #'add / remove' } -GtFilterDefaultSearchFilters >> addSearchFilters: aCollectionOfSearchFilters [ - searchFilters := self searchFilters copyWithAll: aCollectionOfSearchFilters +GtFilterDefaultSearchFilters >> addFilterSearchFilter: aSearchFilter [ + filterSearchFilters := self filterSearchFilters copyWith: aSearchFilter +] + +{ #category : #'add / remove' } +GtFilterDefaultSearchFilters >> addFilterSearchFilters: aCollectionOfSearchFilters [ + filterSearchFilters := self filterSearchFilters copyWithAll: aCollectionOfSearchFilters +] + +{ #category : #accessing } +GtFilterDefaultSearchFilters >> coderSearchFilters [ + ^ coderSearchFilters ifNil: [ coderSearchFilters := self collectCoderSearchFilters ] +] + +{ #category : #accessing } +GtFilterDefaultSearchFilters >> coderSearchFilters: aCollectionOfSearchFilters [ + coderSearchFilters := aCollectionOfSearchFilters ] { #category : #accessing } -GtFilterDefaultSearchFilters >> collectSearchFilters [ - ^ self pragmaSearchFilters +GtFilterDefaultSearchFilters >> collectCoderSearchFilters [ + ^ self pragmaCoderSearchFilters collect: [ :eachPragma | self perform: eachPragma methodSelector ] ] { #category : #accessing } -GtFilterDefaultSearchFilters >> pragmaSearchFilters [ +GtFilterDefaultSearchFilters >> collectFilterSearchFilters [ + ^ self pragmaFilterSearchFilters + collect: [ :eachPragma | self perform: eachPragma methodSelector ] +] + +{ #category : #accessing } +GtFilterDefaultSearchFilters >> filterSearchFilters [ + ^ filterSearchFilters ifNil: [ filterSearchFilters := self collectFilterSearchFilters ] +] + +{ #category : #accessing } +GtFilterDefaultSearchFilters >> filterSearchFilters: aCollectionOfSearchFilters [ + filterSearchFilters := aCollectionOfSearchFilters +] + +{ #category : #accessing } +GtFilterDefaultSearchFilters >> pragmaCoderSearchFilters [ ^ Pragma - allNamed: #gtDefaultSearchFilter: + allNamed: #gtCoderSearchFilter: from: self class to: GtFilterDefaultSearchFilters sortedByArgument: 1 ] { #category : #accessing } -GtFilterDefaultSearchFilters >> searchFilters [ - ^ searchFilters ifNil: [ searchFilters := self collectSearchFilters ] -] - -{ #category : #accessing } -GtFilterDefaultSearchFilters >> searchFilters: aCollectionOfSearchFilters [ - searchFilters := aCollectionOfSearchFilters +GtFilterDefaultSearchFilters >> pragmaFilterSearchFilters [ + ^ Pragma + allNamed: #gtFilterSearchFilter: + from: self class + to: GtFilterDefaultSearchFilters + sortedByArgument: 1 ] From c651552920c30f62e6b8f8d62600bbff1c216e0a Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 22 Oct 2024 11:30:11 -0300 Subject: [PATCH 0766/1268] fix examples [feenkcom/gtoolkit#3983] --- .../GtFilterSelectableItemViewModel.class.st | 5 ++++ src/GToolkit-Coder-UI/GtFilterStep.class.st | 25 +++++++++++++++---- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterSelectableItemViewModel.class.st b/src/GToolkit-Coder-UI/GtFilterSelectableItemViewModel.class.st index b738be116..6215ad2d1 100644 --- a/src/GToolkit-Coder-UI/GtFilterSelectableItemViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterSelectableItemViewModel.class.st @@ -19,6 +19,11 @@ GtFilterSelectableItemViewModel >> itemsCount [ ^ self filterModel items size ] +{ #category : #accessing } +GtFilterSelectableItemViewModel >> name [ + ^ self filterModel name +] + { #category : #'event handling' } GtFilterSelectableItemViewModel >> onItemsChanged: anAnnouncement [ self diff --git a/src/GToolkit-Coder-UI/GtFilterStep.class.st b/src/GToolkit-Coder-UI/GtFilterStep.class.st index 097141fcf..8dcbdd093 100644 --- a/src/GToolkit-Coder-UI/GtFilterStep.class.st +++ b/src/GToolkit-Coder-UI/GtFilterStep.class.st @@ -50,19 +50,34 @@ GtFilterStep >> assertFilterModelAtIndex: anIndex selectedValueIs: aValue [ ] { #category : #'steps - checks' } -GtFilterStep >> assertFilterModelLabeled: aLabel [ +GtFilterStep >> assertFilterModelNamed: aFilterName [ ^ self assert - label: ('Assert filter model with label {1} exists' format: {aLabel}); + label: ('Assert filter model with name {1} exists' format: {aFilterName}); referenceSender; onParentStepTarget: self; onChildFromBlock: [ :aFilterItemsElement | aFilterItemsElement filtersViewModel items ]; - anySatisfy: [ :aFilterViewModel | aFilterViewModel label = aLabel ] + anySatisfy: [ :aFilterViewModel | aFilterViewModel name = aFilterName ] description: [ :someFilterViewModels | - 'Filter with label {1} is missing: {2}' - format: {aLabel. + 'Filter with name {1} is missing: {2}' + format: {aFilterName. someFilterViewModels} ] ] +{ #category : #'steps - checks' } +GtFilterStep >> assertFilterModelNamed: aFilterName selectedValueIs: aValue [ + ^ self assert + label: ('Assert filter model with name {1} has selected item: {2}' + format: {aFilterName. aValue}); + referenceSender; + onParentStepTarget: self; + onChildFromBlock: [ :aFilterItemsElement | aFilterItemsElement filtersViewModel items ]; + anySatisfy: [ :aFilterViewModel | aFilterViewModel name = aFilterName and: [ + aFilterViewModel selectedValue = aValue ] ] + description: [ :someFilterViewModels | + 'Filter with name {1} and {2} selected value is missing: {3}.' + format: {aFilterName. aValue. someFilterViewModels} ] +] + { #category : #'steps - checks' } GtFilterStep >> assertFilterModelsCountIs: anItemsCount [ ^ self assert From d22010e731c70cc6b87e0cfdf3e5b71875561a37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Thu, 24 Oct 2024 10:53:29 +0200 Subject: [PATCH 0767/1268] [feenkcom/gtoolkit#4072] Use same contents for comparing values --- src/GToolkit-Coder-UI/GtFilterModelStringItem.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtFilterModelStringItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelStringItem.class.st index aa8928697..7b569a52d 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelStringItem.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelStringItem.class.st @@ -14,7 +14,7 @@ GtFilterModelStringItem >> = anObject [ self class = anObject class ifFalse: [ ^ false ]. - ^ self string = anObject string + ^ self string sameContentAs: anObject string ] { #category : #comparing } From dc54e4b2a9e73bfeb99c602f22190ac0f001b4bc Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Fri, 25 Oct 2024 18:02:49 +0200 Subject: [PATCH 0768/1268] [feenkcom/gtoolkit#4120] add slots to show event --- ...igationPackagesTagsClassesElement.class.st | 92 +++++++------------ ...CoderNavigationSlotsToShowChanged.class.st | 5 + 2 files changed, 39 insertions(+), 58 deletions(-) create mode 100644 src/GToolkit-Coder/GtCoderNavigationSlotsToShowChanged.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 7e972d291..673697d00 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -167,7 +167,7 @@ GtCoderNavigationPackagesTagsClassesElement >> buildProtocolGroupList [ GtCoderNavigationPackagesTagsClassesElement >> buildSlotGroupWithBinder: binderBlock onClick: clickBlock [ | classSlotGroup instanceGroup classVarGroup | instanceGroup := BrGroup new - domainObject: 'instance slots'; + domainObject: 'instance-side vars'; stream: #() asAsyncStream; itemStencil: [ BrHorizontalPane new aptitude: BrGlamorousListItemAptitude; @@ -176,8 +176,8 @@ GtCoderNavigationPackagesTagsClassesElement >> buildSlotGroupWithBinder: binderB when: BlClickEvent do: clickBlock ]; itemDataBinder: binderBlock; shouldShowWithoutItems: false. - classSlotGroup := instanceGroup copy domainObject: 'class slots'. - classVarGroup := instanceGroup copy domainObject: 'class variables'. + classSlotGroup := instanceGroup copy domainObject: 'class-side vars'. + classVarGroup := instanceGroup copy domainObject: 'static vars'. ^ {instanceGroup. classSlotGroup. classVarGroup} @@ -544,15 +544,20 @@ GtCoderNavigationPackagesTagsClassesElement >> onSlotSelected: anAnnouncement [ GtCoderNavigationPackagesTagsClassesElement >> onSlotsListSelectionChanged [ | theIndices anIndex aSelectedItem | supressListChanges ifTrue: [ ^ self ]. - methodProtocolsList deselectAll. theIndices := slotsGroupList selectedIndices ifEmpty: [ ^ self ]. anIndex := theIndices first. (anIndex between: 1 and: slotsGroupList viewModel entityCount) ifFalse: [ ^ self ]. aSelectedItem := (slotsGroupList viewModel entityAt: anIndex) value object. - self navigationModel selectSlot: aSelectedItem source: self. - methodGroupList deselectAll. - self updateMethodListWith: self navigationModel methodsToShow. + self navigationModel selectSlot: aSelectedItem source: self +] + +{ #category : #'event handling' } +GtCoderNavigationPackagesTagsClassesElement >> onSlotsToShowChanged: anAnnouncement [ + self hasNavigationModel + ifFalse: [ ^ self ]. + + self updateSlotList ] { #category : #initialization } @@ -925,6 +930,7 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToNavigationModel [ GtCoderNavigationMethodSelected -> #onMethodSelected:. "Announcements when we need to update items in the lists" GtCoderNavigationProtocolsToShowChanged -> #onProtocolsToShowChanged:. + GtCoderNavigationSlotsToShowChanged -> #onSlotsToShowChanged:. GtCoderNavigationMethodsToShowChanged -> #onMethodsToShowChanged:. GtCodersFiltersChanged -> #onMethodsCoderFiltersChanged:. @@ -974,6 +980,7 @@ GtCoderNavigationPackagesTagsClassesElement >> updateContent [ self updatePackageLists. self updateClassList. self updateProtocolList. + self updateSlotList. self updateMethodList ] @@ -1027,43 +1034,6 @@ GtCoderNavigationPackagesTagsClassesElement >> updateProtocolList [ self navigationModel selectedProtocol ifNotNil: [ :aProtocol | methodProtocolsList selectProtocol: aProtocol ] - - "| currentClass extension protocolsToShow | - navigationModel hasSelectedClass - ifFalse: [ - self updateProtocolListWith: #(). - self updateMethodListWith: #(). - methodProtocolsList visibility: BlVisibility hidden. - methodsLabel visibility: BlVisibility hidden. - ^ self ]. - - currentClass := navigationModel selectedClass. - - protocolsToShow := navigationModel protocolsToShow. - extension := false. - navigationModel - selectedPackageDo: [ :pkg | - pkg ~= currentClass package - ifTrue: [ | protocolName | - extension := true. - protocolName := '*' , pkg name. - protocolsToShow := protocolsToShow - select: [ :each | each name beginsWith: protocolName ] ] ]. - - self updateProtocolListWith: protocolsToShow. - extension - ifTrue: [ - methodProtocolsList selectOne: 2. - self onProtocolListSelectionChanged ] - ifFalse: [ - self updateMethodListWith: self navigationModel methodsToShow. - self flag: #TODO. - ""self - updateMethodListWith: navigationModel selectedClass methods - and: (navigationModel selectedClass class methods - reject: [ :meth | meth isFromTrait ])"" ]. - methodProtocolsList visibility: BlVisibility visible. - methodsLabel visibility: BlVisibility visible" ] { #category : #'updating lists' } @@ -1080,21 +1050,27 @@ GtCoderNavigationPackagesTagsClassesElement >> updateSelections [ tag: navigationModel selectedTag ] ] ] -{ #category : #'api - class selections' } +{ #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updateSlotList [ - | slotStream classSlotStream classVarStream streams | + | slotsToShow newSlotGroups instanceSideSlots classSideSlots staticVars | + self hasNavigationModel ifFalse: [ ^ self ]. + slotsGroupList deselectAll. - navigationModel hasSelectedClass - ifTrue: [ slotStream := navigationModel selectedClass instanceVariables. - classSlotStream := navigationModel selectedClass class instanceVariables. - classVarStream := navigationModel selectedClass classVariables. - streams := {slotStream. - classSlotStream. - classVarStream} - collect: [ :each | each asSortedCollection: [ :a :b | a name < b name ] ] ] - ifFalse: [ streams := {#(). - #(). - #()} ]. - slotsGroup with: streams do: [ :grp :str | grp items: str ]. + + slotsToShow := self navigationModel slotsToShow. + instanceSideSlots := slotsToShow + select: [ :eachSlot | eachSlot isInstanceVariable and: [ eachSlot owningClass isClassSide not ] ]. + + classSideSlots := slotsToShow + select: [ :eachSlot | eachSlot isInstanceVariable and: [ eachSlot owningClass isClassSide ] ]. + + staticVars := slotsToShow select: [ :eachSlot | eachSlot isClassVariable ]. + + newSlotGroups := {instanceSideSlots. + classSideSlots. + staticVars} + collect: [ :each | each asSortedCollection: [ :a :b | a name < b name ] ]. + + slotsGroup with: newSlotGroups do: [ :grp :str | grp items: str ]. slotsGroupList groups: slotsGroup ] diff --git a/src/GToolkit-Coder/GtCoderNavigationSlotsToShowChanged.class.st b/src/GToolkit-Coder/GtCoderNavigationSlotsToShowChanged.class.st new file mode 100644 index 000000000..fc31aee59 --- /dev/null +++ b/src/GToolkit-Coder/GtCoderNavigationSlotsToShowChanged.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtCoderNavigationSlotsToShowChanged, + #superclass : #GtCoderNavigationItemsToShowAnnouncement, + #category : #'GToolkit-Coder-Navigation - Events' +} From 698a126911056b9162c7f2134cd160cd13bb0900 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 25 Oct 2024 15:47:21 -0300 Subject: [PATCH 0769/1268] add `All methods` item to `Instance slots` filter widget --- .../GtFilterModelAllItem.class.st | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/GToolkit-Coder-UI/GtFilterModelAllItem.class.st diff --git a/src/GToolkit-Coder-UI/GtFilterModelAllItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelAllItem.class.st new file mode 100644 index 000000000..044fc1ba1 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModelAllItem.class.st @@ -0,0 +1,43 @@ +Class { + #name : #GtFilterModelAllItem, + #superclass : #GtFilterModelItem, + #instVars : [ + 'label' + ], + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #factory } +GtFilterModelAllItem class >> default [ + ^ self new +] + +{ #category : #factory } +GtFilterModelAllItem class >> methodsLabel [ + ^ self new label: 'All methods' +] + +{ #category : #accessing } +GtFilterModelAllItem >> ifSome: aBlock ifNone: aNoneBlock [ + ^ aNoneBlock value +] + +{ #category : #initialization } +GtFilterModelAllItem >> initialize [ + super initialize. + label := 'All' +] + +{ #category : #accessing } +GtFilterModelAllItem >> label [ + ^ 'All' +] + +{ #category : #factory } +GtFilterModelAllItem >> label: aString [ +] + +{ #category : #convenience } +GtFilterModelAllItem >> withAll: aCollection [ + ^ Array with: self withAll: aCollection +] From 20ff75a37ec143101bdfa84d35052a930c72fac6 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 28 Oct 2024 10:52:57 +0100 Subject: [PATCH 0770/1268] [feenkcom/gtoolkit#4123] revert `variable`name to `slot` --- .../GtCoderNavigationPackagesTagsClassesElement.class.st | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 673697d00..d4f2d05f6 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -167,7 +167,7 @@ GtCoderNavigationPackagesTagsClassesElement >> buildProtocolGroupList [ GtCoderNavigationPackagesTagsClassesElement >> buildSlotGroupWithBinder: binderBlock onClick: clickBlock [ | classSlotGroup instanceGroup classVarGroup | instanceGroup := BrGroup new - domainObject: 'instance-side vars'; + domainObject: 'instance-side slots'; stream: #() asAsyncStream; itemStencil: [ BrHorizontalPane new aptitude: BrGlamorousListItemAptitude; @@ -176,8 +176,8 @@ GtCoderNavigationPackagesTagsClassesElement >> buildSlotGroupWithBinder: binderB when: BlClickEvent do: clickBlock ]; itemDataBinder: binderBlock; shouldShowWithoutItems: false. - classSlotGroup := instanceGroup copy domainObject: 'class-side vars'. - classVarGroup := instanceGroup copy domainObject: 'static vars'. + classSlotGroup := instanceGroup copy domainObject: 'class-side slots'. + classVarGroup := instanceGroup copy domainObject: 'class vars'. ^ {instanceGroup. classSlotGroup. classVarGroup} From 7305fb97187e01a49644a4facc553ffcc2344d98 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 28 Oct 2024 09:56:41 -0300 Subject: [PATCH 0771/1268] use `Class>>#gtReferencesWithSubclasses` --- src/GToolkit-Coder/Announcement.extension.st | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/GToolkit-Coder/Announcement.extension.st b/src/GToolkit-Coder/Announcement.extension.st index 31da0f484..e7f4185d5 100644 --- a/src/GToolkit-Coder/Announcement.extension.st +++ b/src/GToolkit-Coder/Announcement.extension.st @@ -7,11 +7,6 @@ Announcement class >> gtAllKindOfReferencesFor: aView [ title: 'Announcement references'; tooltip: 'Class and subclass references'; priority: 41; - stencil: [ - | aFilter | - aFilter := self gtReferences. - self allSubclassesDo: [ :eachClass | - aFilter := aFilter | eachClass gtReferences ]. - aFilter ]; + stencil: [ self gtReferencesWithSubclasses ]; actionUpdateButtonTooltip: 'Update reference list' ] From ec4617a2d3d53bc5838c398bfcc6d65efae7243b Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 28 Oct 2024 14:31:33 +0100 Subject: [PATCH 0772/1268] [feenkcom/gtoolkit#4120] handle slots from superclasses --- ...vigationPackagesTagsClassesElement.class.st | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index d4f2d05f6..9ecb65301 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -189,14 +189,17 @@ GtCoderNavigationPackagesTagsClassesElement >> buildSlotsGroupList [ list := self buildGroupList. slotsGroup := self buildSlotGroupWithBinder: [ :element :item | - | label | + | label slotText| element removeChildren. label := BrLabel new hMatchParent; vFitContent; beSmallSize; aptitude: BrGlamorousLabelAptitude. - label text: item name asRopedText. + + slotText := self computeSlotItemText: item. + + label text: slotText. label addAptitude: (BrGlamorousWithContextMenuAptitude content: [ GtCoderNavigationContextMenuContent new @@ -209,6 +212,17 @@ GtCoderNavigationPackagesTagsClassesElement >> buildSlotsGroupList [ ^ list ] +{ #category : #initialization } +GtCoderNavigationPackagesTagsClassesElement >> computeSlotItemText: aSlot [ + | slotText | + + slotText := aSlot name asRopedText. + self navigationModel selectedClass = aSlot definingClass instanceSide + ifFalse: [ slotText, (' ({1})' format: { aSlot definingClass name }) asRopedText italic ]. + + ^ slotText +] + { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> createDraggedMethodItem: aDragItem [ From 8dfcc69497ea5c350bf7466922d06aad352a74a8 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 28 Oct 2024 15:36:40 +0100 Subject: [PATCH 0773/1268] [feenkcom/gtoolkit#4120] use gray color for the slot's superclass --- .../GtCoderNavigationPackagesTagsClassesElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 9ecb65301..595ab1d20 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -218,7 +218,7 @@ GtCoderNavigationPackagesTagsClassesElement >> computeSlotItemText: aSlot [ slotText := aSlot name asRopedText. self navigationModel selectedClass = aSlot definingClass instanceSide - ifFalse: [ slotText, (' ({1})' format: { aSlot definingClass name }) asRopedText italic ]. + ifFalse: [ slotText, ((' ({1})' format: { aSlot definingClass name }) asRopedText foreground: Color gray) ]. ^ slotText ] From 9b7a09355602626b59f8c484abf8b9a4b7ace0da Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Tue, 29 Oct 2024 13:07:54 +0100 Subject: [PATCH 0774/1268] [feenkcom/gtoolkit#4133] extract slots and methods list to separate classes --- .../GtCoderMethodsGroupedListElement.class.st | 313 ++++++++++++ ...igationPackagesTagsClassesElement.class.st | 475 +----------------- ...tCoderProtocolsGroupedListElement.class.st | 11 +- ...oderProtocolsSlotsTabGroupElement.class.st | 26 + .../GtCoderSlotsGroupedListElement.class.st | 271 ++++++++++ 5 files changed, 627 insertions(+), 469 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderProtocolsSlotsTabGroupElement.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st new file mode 100644 index 000000000..175f3b122 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -0,0 +1,313 @@ +Class { + #name : #GtCoderMethodsGroupedListElement, + #superclass : #BrGroupedList, + #traits : 'TGtCoderNavigationWithContextMenu', + #classTraits : 'TGtCoderNavigationWithContextMenu classTrait', + #instVars : [ + 'navigationModel', + 'methodGroups' + ], + #category : #'GToolkit-Coder-UI-Navigation - Helpers' +} + +{ #category : #'private - actions' } +GtCoderMethodsGroupedListElement >> browseHierarchyImplementorsOf: aSymbol [ + self phlow + spawnObject: (GtSearchMethodsInClassFilter forClass: self selectedClass) withSuperclasses + withSubclasses & aSymbol gtImplementors +] + +{ #category : #'private - actions' } +GtCoderMethodsGroupedListElement >> browseHierarchyReferencesOf: aSymbol [ + self phlow + spawnObject: (GtSearchMethodsInClassFilter forClass: self selectedClass) withSuperclasses + withSubclasses & aSymbol gtSenders +] + +{ #category : #'private - actions' } +GtCoderMethodsGroupedListElement >> browseImplementorsOf: aSymbol [ + self phlow spawnObject: (GtSearchImplementorsFilter selector: aSymbol) +] + +{ #category : #'private - actions' } +GtCoderMethodsGroupedListElement >> browseReferencesOf: aSymbol [ + self phlow spawnObject: (GtSearchReferencesFilter literal: aSymbol) +] + +{ #category : #'private - insance creation' } +GtCoderMethodsGroupedListElement >> buildMethodItem [ + + | aLabel | + aLabel := BrLabel new. + aLabel + hMatchParent; + vFitContent; + beSmallSize; + aptitude: BrGlamorousLabelAptitude + BrGlamorousListItemAptitude + + (BrGlamorousWithContextMenuAptitude + content: [ GtCoderNavigationContextMenuContent new + items: (self methodListContextMenuItemsFor: (aLabel userData at: #method)) ]). + + aLabel addEventHandler: self createMethodDragHandler. + + ^ aLabel +] + +{ #category : #'private - insance creation' } +GtCoderMethodsGroupedListElement >> createDraggedMethodItem: aDragItem [ + + ^ BrLabel new + aptitude: (BrGlamorousLabelAptitude new padding: (BlInsets all: 5)) + BrShadowAptitude; + beSmallSize; + opacity: 0.85; + margin: (BlInsets all: 5); + background: Color white; + beFocusable; + requestFocus; + geometry: (BlRoundedRectangleGeometry cornerRadius: 5); + fitContent; + text: aDragItem domainObject printString +] + +{ #category : #'private - insance creation' } +GtCoderMethodsGroupedListElement >> createMethodDragHandler [ + ^ BlDragHandler new + enableCopy; + liftItem: [ :aLabelElement | + BlDragItem new + sourceElement: aLabelElement; + domainObject: (aLabelElement userData at: #method); + stencil: [ :aDragItem | self createDraggedMethodItem: aDragItem ] ] +] + +{ #category : #'private - insance creation' } +GtCoderMethodsGroupedListElement >> createMethodGroups [ + | classGroup instanceGroup | + instanceGroup := BrGroup new + domainObject: 'instance side'; + stream: #() asAsyncStream; + itemStencil: [ self buildMethodItem ]; + itemDataBinder: [ :element :eachCompiledMethod | + | aSelector | + element userData at: #method put: eachCompiledMethod. + + aSelector := eachCompiledMethod selector asRopedText. + eachCompiledMethod isDeprecated + ifTrue: [ aSelector lineThrough ]. + + element text: aSelector ]; + shouldShowWithoutItems: false. + classGroup := instanceGroup copy domainObject: 'class side'. + ^ {instanceGroup. + classGroup} +] + +{ #category : #initialization } +GtCoderMethodsGroupedListElement >> initialize [ + super initialize. + + self + padding: (BlInsets left: 5 right: 10); + matchParent; + headerElementStencil: [ BrLabel new + beSmallSize; + aptitude: (BrGlamorousLabelAptitude new foreground: Color gray) ]; + headerDataBinder: [ :label :each | label text: each domainObject asRopedText ]. + + methodGroups := self createMethodGroups. + self groups: methodGroups. + + self + when: BrSelectionChanged + do: [ :anEvent | self onMethodsListSelectionChanged ] +] + +{ #category : #accessing } +GtCoderMethodsGroupedListElement >> methodList [ + ^ methodGroups flatCollect: [ :grp | grp itemsProvider currentItems ] +] + +{ #category : #'private - context menu' } +GtCoderMethodsGroupedListElement >> methodListContextMenuItemsFor: item [ + ^ {(self createLabel: 'Browse implementors' description: item selector) + -> [ :elem | self browseImplementorsOf: item selector ]. + (self createLabel: 'Browse hierarachy implementors' description: item selector) + -> [ :elem | self browseHierarchyImplementorsOf: item selector ]. + (self createLabel: 'Browse references' description: item selector) + -> [ :elem | self browseReferencesOf: item selector ]. + (self createLabel: 'Browse hierarchy references' description: item selector) + -> [ :elem | self browseHierarchyReferencesOf: item selector ]. + (self createLabel: 'Push up method' description: item selector) + -> [ :elem | self pushUpMethod: item selector inElement: elem ]. + (self createLabel: 'Push down method' description: item selector) + -> [ :elem | self pushDownMethod: item selector inElement: elem ]. + (self createLabel: 'Rename message' description: item selector) + -> [ :elem | self renameMethod: item selector inElement: elem ]. + (self createLabel: 'Remove method' description: item selector) + -> [ :elem | self removeMethod: item selector inElement: elem ]} +] + +{ #category : #accessing } +GtCoderMethodsGroupedListElement >> navigationModel [ + ^ navigationModel +] + +{ #category : #accessing } +GtCoderMethodsGroupedListElement >> navigationModel: anObject [ + navigationModel == anObject + ifTrue: [ ^ self ]. + + self unsubscribeFromNavigationModel. + navigationModel := anObject. + self subscribeToNavigationModel. + + self updateMethodList +] + +{ #category : #'event handling - selection' } +GtCoderMethodsGroupedListElement >> onMethodSelected: anAnnouncement [ + +] + +{ #category : #'event handling - selection' } +GtCoderMethodsGroupedListElement >> onMethodsListSelectionChanged [ + | theIndices anIndex aSelectedItem | + + theIndices := self selectedIndices ifEmpty: [ ^ self ]. + anIndex := theIndices first. + (anIndex between: 1 and: self viewModel entityCount) + ifFalse: [ ^ self ]. + aSelectedItem := (self viewModel entityAt: anIndex) value object. + self navigationModel selectMethod: aSelectedItem +] + +{ #category : #'event handling' } +GtCoderMethodsGroupedListElement >> onMethodsToShowChanged: anAnnouncement [ + self updateMethodList +] + +{ #category : #'private - actions' } +GtCoderMethodsGroupedListElement >> pushDownMethod: aSelector inElement: elem [ + | refactoring | + refactoring := RBPushDownMethodRefactoring + pushDown: {aSelector} + from: self selectedClass. + ^ self + addPreviewButtonFor: refactoring + to: elem + cancelSelector: #updateProtocolList +] + +{ #category : #'private - actions' } +GtCoderMethodsGroupedListElement >> pushUpMethod: aSelector inElement: elem [ + | refactoring | + refactoring := RBPullUpMethodRefactoring + pullUp: {aSelector} + from: self selectedClass. + ^ self + addPreviewButtonFor: refactoring + to: elem + cancelSelector: #updateProtocolList +] + +{ #category : #'private - actions' } +GtCoderMethodsGroupedListElement >> removeMethod: aSelector inElement: elem [ + | change button | + change := RBRemoveMethodChange remove: aSelector from: self selectedClass. + button := GtPreviewChangeButton new + icon: BrGlamorousVectorIcons remove; + label: 'Remove'; + changeAction: [ change gtExecuteWithUndo ]; + changeStencil: [ GtPharoRemoveMethodPreviewStencil new + selectorToRemove: aSelector; + isEmptyMethod: false; + anElement: self; + create ]. + button + when: GtRefactoringsAppliedEvent + do: [ :anEvent | elem removeChild: anEvent currentTarget ]. + ^ elem addChild: button as: #preview +] + +{ #category : #'private - actions' } +GtCoderMethodsGroupedListElement >> renameMethod: aSelector inElement: elem [ + | refactoring edit | + edit := BrEditableLabel new. + edit + aptitude: (BrGlamorousEditableLabelAptitude new + fontSize: 11.9; "Force the font to match the label font" + background: Color transparent); + text: aSelector; + when: BrEditorAcceptWish + do: [ :aWish | + refactoring := GtRBRenameMethodRefactoring + renameMethod: aSelector + in: self selectedClass + to: aWish text asString + permutation: (1 to: aSelector numArgs). + edit switchToLabel. + self + addPreviewButtonFor: refactoring + to: elem + cancelSelector: #updateProtocolList ]; + switchToEditor. + edit requestFocus. + elem removeChildren. + elem addChild: edit +] + +{ #category : #accessing } +GtCoderMethodsGroupedListElement >> selectedClass [ + ^ navigationModel selectedClass +] + +{ #category : #'private - subscriptions' } +GtCoderMethodsGroupedListElement >> subscribeToNavigationModel [ + | subscriptions | + + subscriptions := { + GtCoderNavigationMethodsToShowChanged -> #onMethodsToShowChanged:. + GtCoderNavigationMethodSelected -> #onMethodSelected:. + }. + + subscriptions + do: [ :sub | + navigationModel weak + when: sub key + send: sub value + to: self ] +] + +{ #category : #'private - subscriptions' } +GtCoderMethodsGroupedListElement >> unsubscribeFromNavigationModel [ + navigationModel ifNotNil: [ :aModel | aModel unsubscribe: self ] +] + +{ #category : #'updating lists' } +GtCoderMethodsGroupedListElement >> updateMethodList [ + self navigationModel ifNil: [ ^ self ]. + self updateMethodListWith: self navigationModel methodsToShow +] + +{ #category : #'updating lists' } +GtCoderMethodsGroupedListElement >> updateMethodListWith: aCollectionOfCompiledMethods [ + | instMethStream classMethStream instanceMethods classMethods | + self deselectAll. + + instanceMethods := aCollectionOfCompiledMethods + select: [ :each | each methodClass isInstanceSide ]. + + classMethods := aCollectionOfCompiledMethods + select: [ :each | each methodClass isClassSide ]. + + instMethStream := instanceMethods asSortedCollection: GtMethodsSortFunction new. + + classMethStream := classMethods asSortedCollection: GtMethodsSortFunction new. + + methodGroups + with: {instMethStream. + classMethStream} + do: [ :grp :str | grp items: str ]. + + self groups: methodGroups +] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 595ab1d20..3a039c577 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -7,7 +7,6 @@ Class { 'packagesList', 'methodProtocolsList', 'methodsLabel', - 'methodGroup', 'methodGroupList', 'slotsGroup', 'slotsGroupList', @@ -40,38 +39,6 @@ GtCoderNavigationPackagesTagsClassesElement >> addPackage: aPackage tag: aPackag self selectPackageOrTag: aSelectedPackageOrTag ]. ] -{ #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> browseHierarchyImplementorsOf: aSymbol [ - self phlow - spawnObject: (GtSearchMethodsInClassFilter forClass: self selectedClass) withSuperclasses - withSubclasses & aSymbol gtImplementors -] - -{ #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> browseHierarchyReferencesOf: aSymbol [ - self phlow - spawnObject: (GtSearchMethodsInClassFilter forClass: self selectedClass) withSuperclasses - withSubclasses & aSymbol gtSenders -] - -{ #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> browseImplementorsOf: aSymbol [ - self phlow spawnObject: (GtSearchImplementorsFilter selector: aSymbol) -] - -{ #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> browseReferencesOf: aSymbol [ - self phlow spawnObject: (GtSearchReferencesFilter literal: aSymbol) -] - -{ #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> browseSlotReferencesFor: aString [ - self phlow - spawnObject: (GtSearchInstanceSlotReferenceFilter - forClassAndSubclasses: self selectedClass - andVariable: aString) -] - { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> buildCategorySlotTabs [ | aTabGroup | @@ -104,58 +71,7 @@ GtCoderNavigationPackagesTagsClassesElement >> buildGroupList [ { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> buildMethodGroupList [ - | list | - list := self buildGroupList. - methodGroup := self - buildMethodGroupWithBinder: [ :element :eachCompiledMethod | - | aSelector | - element userData at: #method put: eachCompiledMethod. - - aSelector := eachCompiledMethod selector asRopedText. - eachCompiledMethod isDeprecated - ifTrue: [ aSelector lineThrough ]. - - element text: aSelector ] - onClick: [ :event | - event consumed: true. - self - onMethodListSelectionChanged: (event currentTarget userData at: #method) ]. - list groups: methodGroup. - ^ list -] - -{ #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> buildMethodGroupWithBinder: binderBlock onClick: clickBlock [ - | classGroup instanceGroup | - instanceGroup := BrGroup new - domainObject: 'instance side'; - stream: #() asAsyncStream; - itemStencil: [ self buildMethodItemWithOnClick: clickBlock ]; - itemDataBinder: binderBlock; - shouldShowWithoutItems: false. - classGroup := instanceGroup copy domainObject: 'class side'. - ^ {instanceGroup. - classGroup} -] - -{ #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> buildMethodItemWithOnClick: clickBlock [ - - | aLabel | - aLabel := BrLabel new. - aLabel - hMatchParent; - vFitContent; - beSmallSize; - aptitude: BrGlamorousLabelAptitude + BrGlamorousListItemAptitude - + (BrGlamorousWithContextMenuAptitude - content: [ GtCoderNavigationContextMenuContent new - items: (self methodListContextMenuItemsFor: (aLabel userData at: #method)) ]); - when: BlClickEvent do: clickBlock. - - aLabel addEventHandler: self createMethodDragHandler. - - ^ aLabel + ^ GtCoderMethodsGroupedListElement new ] { #category : #initialization } @@ -163,91 +79,9 @@ GtCoderNavigationPackagesTagsClassesElement >> buildProtocolGroupList [ ^ GtCoderProtocolsGroupedListElement new ] -{ #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> buildSlotGroupWithBinder: binderBlock onClick: clickBlock [ - | classSlotGroup instanceGroup classVarGroup | - instanceGroup := BrGroup new - domainObject: 'instance-side slots'; - stream: #() asAsyncStream; - itemStencil: [ BrHorizontalPane new - aptitude: BrGlamorousListItemAptitude; - hMatchParent; - vFitContent; - when: BlClickEvent do: clickBlock ]; - itemDataBinder: binderBlock; - shouldShowWithoutItems: false. - classSlotGroup := instanceGroup copy domainObject: 'class-side slots'. - classVarGroup := instanceGroup copy domainObject: 'class vars'. - ^ {instanceGroup. - classSlotGroup. - classVarGroup} -] - { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> buildSlotsGroupList [ - | list | - list := self buildGroupList. - slotsGroup := self - buildSlotGroupWithBinder: [ :element :item | - | label slotText| - element removeChildren. - label := BrLabel new - hMatchParent; - vFitContent; - beSmallSize; - aptitude: BrGlamorousLabelAptitude. - - slotText := self computeSlotItemText: item. - - label text: slotText. - label - addAptitude: (BrGlamorousWithContextMenuAptitude - content: [ GtCoderNavigationContextMenuContent new - items: (self slotListContextMenuItemsFor: item) ]). - element addChild: label ] - onClick: [ :event | - event consumed: true. - self onSlotsListSelectionChanged ]. - list groups: slotsGroup. - ^ list -] - -{ #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> computeSlotItemText: aSlot [ - | slotText | - - slotText := aSlot name asRopedText. - self navigationModel selectedClass = aSlot definingClass instanceSide - ifFalse: [ slotText, ((' ({1})' format: { aSlot definingClass name }) asRopedText foreground: Color gray) ]. - - ^ slotText -] - -{ #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> createDraggedMethodItem: aDragItem [ - - ^ BrLabel new - aptitude: (BrGlamorousLabelAptitude new padding: (BlInsets all: 5)) + BrShadowAptitude; - beSmallSize; - opacity: 0.85; - margin: (BlInsets all: 5); - background: Color white; - beFocusable; - requestFocus; - geometry: (BlRoundedRectangleGeometry cornerRadius: 5); - fitContent; - text: aDragItem domainObject printString -] - -{ #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> createMethodDragHandler [ - ^ BlDragHandler new - enableCopy; - liftItem: [ :aLabelElement | - BlDragItem new - sourceElement: aLabelElement; - domainObject: (aLabelElement userData at: #method); - stencil: [ :aDragItem | self createDraggedMethodItem: aDragItem ] ] + ^ GtCoderSlotsGroupedListElement new ] { #category : #'api - package selections' } @@ -345,32 +179,7 @@ GtCoderNavigationPackagesTagsClassesElement >> initializeLayout [ c vertical matchParent ] ] -{ #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> methodList [ - ^ methodGroup flatCollect: [ :grp | grp itemsProvider currentItems ] -] - -{ #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> methodListContextMenuItemsFor: item [ - ^ {(self createLabel: 'Browse implementors' description: item selector) - -> [ :elem | self browseImplementorsOf: item selector ]. - (self createLabel: 'Browse hierarachy implementors' description: item selector) - -> [ :elem | self browseHierarchyImplementorsOf: item selector ]. - (self createLabel: 'Browse references' description: item selector) - -> [ :elem | self browseReferencesOf: item selector ]. - (self createLabel: 'Browse hierarchy references' description: item selector) - -> [ :elem | self browseHierarchyReferencesOf: item selector ]. - (self createLabel: 'Push up method' description: item selector) - -> [ :elem | self pushUpMethod: item selector inElement: elem ]. - (self createLabel: 'Push down method' description: item selector) - -> [ :elem | self pushDownMethod: item selector inElement: elem ]. - (self createLabel: 'Rename message' description: item selector) - -> [ :elem | self renameMethod: item selector inElement: elem ]. - (self createLabel: 'Remove method' description: item selector) - -> [ :elem | self removeMethod: item selector inElement: elem ]} -] - -{ #category : #'private-accessing' } +{ #category : #'private - accessing' } GtCoderNavigationPackagesTagsClassesElement >> methodProtocolsList [ ^ methodProtocolsList ] @@ -381,7 +190,7 @@ GtCoderNavigationPackagesTagsClassesElement >> onClassDeselected: anAnnouncement suppressListChangeEventsDuring: [ self deselectClass: anAnnouncement theClass ] ] -{ #category : #accessing } +{ #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onClassRemoved: anAnnouncement [ | aPackageOrTag | self @@ -396,17 +205,6 @@ GtCoderNavigationPackagesTagsClassesElement >> onClassSelected: anAnnouncement [ suppressListChangeEventsDuring: [ self selectClass: anAnnouncement theClass ] ] -{ #category : #'event handling - selection' } -GtCoderNavigationPackagesTagsClassesElement >> onMethodListSelectionChanged: aMethod [ - supressListChanges ifTrue: [ ^ self ]. - self navigationModel selectMethod: aMethod -] - -{ #category : #'event handling - selection' } -GtCoderNavigationPackagesTagsClassesElement >> onMethodSelected: anAnnouncement [ - -] - { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onMethodsCoderFiltersChanged: aGtCodersFiltersChanged [ aGtCodersFiltersChanged source = self ifTrue: [ ^ self ]. @@ -433,8 +231,11 @@ GtCoderNavigationPackagesTagsClassesElement >> onMethodsCoderFiltersChanged: aGt ] { #category : #'event handling' } -GtCoderNavigationPackagesTagsClassesElement >> onMethodsToShowChanged: anAnnouncement [ - self updateMethodListWith: self navigationModel methodsToShow +GtCoderNavigationPackagesTagsClassesElement >> onNavigationModelChanged [ + slotsGroupList navigationModel: self navigationModel. + methodGroupList navigationModel: self navigationModel. + + super onNavigationModelChanged ] { #category : #'event handling' } @@ -549,74 +350,6 @@ GtCoderNavigationPackagesTagsClassesElement >> onProtocolsToShowChanged: anAnnou ifNotNil: [ :aProtocol | methodProtocolsList selectProtocol: aProtocol ] ] -{ #category : #'event handling - selection' } -GtCoderNavigationPackagesTagsClassesElement >> onSlotSelected: anAnnouncement [ - -] - -{ #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> onSlotsListSelectionChanged [ - | theIndices anIndex aSelectedItem | - supressListChanges ifTrue: [ ^ self ]. - theIndices := slotsGroupList selectedIndices ifEmpty: [ ^ self ]. - anIndex := theIndices first. - (anIndex between: 1 and: slotsGroupList viewModel entityCount) - ifFalse: [ ^ self ]. - aSelectedItem := (slotsGroupList viewModel entityAt: anIndex) value object. - self navigationModel selectSlot: aSelectedItem source: self -] - -{ #category : #'event handling' } -GtCoderNavigationPackagesTagsClassesElement >> onSlotsToShowChanged: anAnnouncement [ - self hasNavigationModel - ifFalse: [ ^ self ]. - - self updateSlotList -] - -{ #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> pushDownMethod: aSelector inElement: elem [ - | refactoring | - refactoring := RBPushDownMethodRefactoring - pushDown: {aSelector} - from: self selectedClass. - ^ self - addPreviewButtonFor: refactoring - to: elem - cancelSelector: #updateProtocolList -] - -{ #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> pushUpMethod: aSelector inElement: elem [ - | refactoring | - refactoring := RBPullUpMethodRefactoring - pullUp: {aSelector} - from: self selectedClass. - ^ self - addPreviewButtonFor: refactoring - to: elem - cancelSelector: #updateProtocolList -] - -{ #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> removeMethod: aSelector inElement: elem [ - | change button | - change := RBRemoveMethodChange remove: aSelector from: self selectedClass. - button := GtPreviewChangeButton new - icon: BrGlamorousVectorIcons remove; - label: 'Remove'; - changeAction: [ change gtExecuteWithUndo ]; - changeStencil: [ GtPharoRemoveMethodPreviewStencil new - selectorToRemove: aSelector; - isEmptyMethod: false; - anElement: self; - create ]. - button - when: GtRefactoringsAppliedEvent - do: [ :anEvent | elem removeChild: anEvent currentTarget ]. - ^ elem addChild: button as: #preview -] - { #category : #'api - package updates' } GtCoderNavigationPackagesTagsClassesElement >> removePackage: aPackage [ | aSelectedPackageOrTag anIndex | @@ -641,33 +374,6 @@ GtCoderNavigationPackagesTagsClassesElement >> removePackage: aPackage tag: aPac self reselectPackageOrTag: aSelectedPackageOrTag afterRemovalOfTagNamed: aPackageTagName. ] -{ #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> renameMethod: aSelector inElement: elem [ - | refactoring edit | - edit := BrEditableLabel new. - edit - aptitude: (BrGlamorousEditableLabelAptitude new - fontSize: 11.9; "Force the font to match the label font" - background: Color transparent); - text: aSelector; - when: BrEditorAcceptWish - do: [ :aWish | - refactoring := GtRBRenameMethodRefactoring - renameMethod: aSelector - in: self selectedClass - to: aWish text asString - permutation: (1 to: aSelector numArgs). - edit switchToLabel. - self - addPreviewButtonFor: refactoring - to: elem - cancelSelector: #updateProtocolList ]; - switchToEditor. - edit requestFocus. - elem removeChildren. - elem addChild: edit -] - { #category : #'api - package updates' } GtCoderNavigationPackagesTagsClassesElement >> renamePackage: aPackage oldName: anOldName newName: aNewName [ | aSelectedPackageOrTag | @@ -692,33 +398,6 @@ GtCoderNavigationPackagesTagsClassesElement >> renamePackageTag: aPackageTag old self selectPackageOrTag: aSelectedPackageOrTag ]. ] -{ #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> renameSlot: slotName inElement: elem [ - | edit | - edit := BrEditableLabel new. - edit - aptitude: (BrGlamorousEditableLabelAptitude new - fontSize: 11.9; "Force the font to match the label font" - background: Color transparent); - text: slotName; - when: BrEditorAcceptWish - do: [ :aWish | - | refactoring | - refactoring := RBRenameInstanceVariableRefactoring - rename: slotName - to: aWish text asString - in: self selectedClass. - edit switchToLabel. - self - addPreviewButtonFor: refactoring - to: elem - cancelSelector: #updateSlotList ]; - switchToEditor. - edit requestFocus. - elem removeChildren. - elem addChild: edit -] - { #category : #'api - package reselections' } GtCoderNavigationPackagesTagsClassesElement >> reselectPackageOrTag: aSelectedPackageOrTag afterRemovalOfPackageNamed: aRemovedPackageOrTagName [ aSelectedPackageOrTag ifNotNil: [ @@ -833,7 +512,7 @@ GtCoderNavigationPackagesTagsClassesElement >> selectedPackageTagNodeDo: aBlock ^ packagesList selectedPackageTagNodeDo: aBlock ] -{ #category : #'event handling' } +{ #category : #'private - accessing' } GtCoderNavigationPackagesTagsClassesElement >> selectedProtocol [ ^ self navigationModel selectedProtocol ] @@ -844,81 +523,12 @@ GtCoderNavigationPackagesTagsClassesElement >> showClassList [ classesLabel visibility: BlVisibility visible ] -{ #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> slotListContextMenuItemsFor: item [ - ^ {(self createLabel: 'Browse references' description: item name) - -> [ :elem | self browseSlotReferencesFor: item name ]. - (self createLabel: 'Push up' description: item name) - -> [ :elem | - | refactoring | - refactoring := RBPullUpInstanceVariableRefactoring - variable: item name - class: self selectedClass superclass. - self - addPreviewButtonFor: refactoring - to: elem - cancelSelector: #updateProtocolList ]. - (self createLabel: 'Push down' description: item name) - -> [ :elem | - | refactoring | - refactoring := GtPushDownInstanceVariableRefactoring - variable: item name - class: self selectedClass. - self - addPreviewButtonFor: refactoring - to: elem - cancelSelector: #updateProtocolList ]. - (self createLabel: 'Create accessors' description: item name) - -> [ :elem | - | refactoring | - refactoring := RBCreateAccessorsForVariableRefactoring - instanceVariable: item name - class: self selectedClass. - self - addPreviewButtonFor: refactoring - to: elem - cancelSelector: #updateProtocolList ]. - (self createLabel: 'Abstract' description: item name) - -> [ :elem | - | refactoring | - refactoring := RBAbstractInstanceVariableRefactoring - variable: item name - class: self selectedClass. - self - addPreviewButtonFor: refactoring - to: elem - cancelSelector: #updateProtocolList ]. - (self createLabel: 'Protect' description: item name) - -> [ :elem | - | refactoring | - refactoring := RBProtectInstanceVariableRefactoring - variable: item name - class: self selectedClass. - self - addPreviewButtonFor: refactoring - to: elem - cancelSelector: #updateProtocolList ]. - (self createLabel: 'Remove' description: item name) - -> [ :elem | - | refactoring | - refactoring := RBRemoveInstanceVariableRefactoring - variable: item name - class: self selectedClass. - self - addPreviewButtonFor: refactoring - to: elem - cancelSelector: #updateProtocolList ]. - (self createLabel: 'Rename slot' description: item name) - -> [ :elem | self renameSlot: item name inElement: elem ]} -] - { #category : #subscriptions } GtCoderNavigationPackagesTagsClassesElement >> subscribeToContent [ super subscribeToContent. self subscribeToPackageList. self subscribeToClassList. self subscribeToProtocolList. - self subscribeToSlotList. ] { #category : #subscriptions } @@ -940,13 +550,8 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToNavigationModel [ "GtCoderNavigationClassSelected -> #onClassSelected:. <--- defined in the superclass" GtCoderNavigationProtocolSelected -> #onProtocolSelected:. GtCoderNavigationProtocolDeselected -> #onProtocolDeselected:. - GtCoderNavigationSlotSelected -> #onSlotSelected:. - GtCoderNavigationMethodSelected -> #onMethodSelected:. "Announcements when we need to update items in the lists" GtCoderNavigationProtocolsToShowChanged -> #onProtocolsToShowChanged:. - GtCoderNavigationSlotsToShowChanged -> #onSlotsToShowChanged:. - GtCoderNavigationMethodsToShowChanged -> #onMethodsToShowChanged:. - GtCodersFiltersChanged -> #onMethodsCoderFiltersChanged:. }. subscriptions @@ -971,13 +576,6 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToProtocolList [ do: [ :anEvent | self onProtocolListSelectionChanged ] ] -{ #category : #subscriptions } -GtCoderNavigationPackagesTagsClassesElement >> subscribeToSlotList [ - slotsGroupList - when: BrSelectionChanged - do: [ :anEvent | self onSlotsListSelectionChanged ] -] - { #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updateClassList [ self hasNavigationModel @@ -994,37 +592,6 @@ GtCoderNavigationPackagesTagsClassesElement >> updateContent [ self updatePackageLists. self updateClassList. self updateProtocolList. - self updateSlotList. - self updateMethodList -] - -{ #category : #'updating lists' } -GtCoderNavigationPackagesTagsClassesElement >> updateMethodList [ - self hasNavigationModel ifFalse: [ ^ self ]. - self updateMethodListWith: self navigationModel methodsToShow -] - -{ #category : #'updating lists' } -GtCoderNavigationPackagesTagsClassesElement >> updateMethodListWith: aCollectionOfCompiledMethods [ - | instMethStream classMethStream instanceMethods classMethods | - methodGroupList deselectAll. - - instanceMethods := aCollectionOfCompiledMethods - select: [ :each | each methodClass isInstanceSide ]. - - classMethods := aCollectionOfCompiledMethods - select: [ :each | each methodClass isClassSide ]. - - instMethStream := instanceMethods asSortedCollection: GtMethodsSortFunction new. - - classMethStream := classMethods asSortedCollection: GtMethodsSortFunction new. - - methodGroup - with: {instMethStream. - classMethStream} - do: [ :grp :str | grp items: str ]. - - methodGroupList groups: methodGroup ] { #category : #'updating lists' } @@ -1066,25 +633,5 @@ GtCoderNavigationPackagesTagsClassesElement >> updateSelections [ { #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updateSlotList [ - | slotsToShow newSlotGroups instanceSideSlots classSideSlots staticVars | - self hasNavigationModel ifFalse: [ ^ self ]. - - slotsGroupList deselectAll. - - slotsToShow := self navigationModel slotsToShow. - instanceSideSlots := slotsToShow - select: [ :eachSlot | eachSlot isInstanceVariable and: [ eachSlot owningClass isClassSide not ] ]. - - classSideSlots := slotsToShow - select: [ :eachSlot | eachSlot isInstanceVariable and: [ eachSlot owningClass isClassSide ] ]. - - staticVars := slotsToShow select: [ :eachSlot | eachSlot isClassVariable ]. - - newSlotGroups := {instanceSideSlots. - classSideSlots. - staticVars} - collect: [ :each | each asSortedCollection: [ :a :b | a name < b name ] ]. - - slotsGroup with: newSlotGroups do: [ :grp :str | grp items: str ]. - slotsGroupList groups: slotsGroup + slotsGroupList updateSlotList ] diff --git a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st index 58ef7c2fd..17f6e89eb 100644 --- a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st @@ -21,12 +21,13 @@ Class { { #category : #'private - refactorings' } GtCoderProtocolsGroupedListElement >> autoCategorizeProtocol: aPharoProtocol [ - | classifier | - + | classifier allMethods| + + allMethods := aPharoProtocol methodSelectors collect: [ :selector| + aPharoProtocol protocolClass >> selector ]. + classifier := MethodClassifier new. - - aPharoProtocol methodSelectors do: [ :selector| - classifier classify: aPharoProtocol protocolClass >> selector ] + classifier classifyAll: allMethods ] { #category : #'private - instance creation' } diff --git a/src/GToolkit-Coder-UI/GtCoderProtocolsSlotsTabGroupElement.class.st b/src/GToolkit-Coder-UI/GtCoderProtocolsSlotsTabGroupElement.class.st new file mode 100644 index 000000000..79d9a7107 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderProtocolsSlotsTabGroupElement.class.st @@ -0,0 +1,26 @@ +Class { + #name : #GtCoderProtocolsSlotsTabGroupElement, + #superclass : #BrTabGroup, + #instVars : [ + 'methodProtocolsList', + 'slotsGroupList' + ], + #category : #'GToolkit-Coder-UI-Navigation - Helpers' +} + +{ #category : #initialization } +GtCoderProtocolsSlotsTabGroupElement >> initialize [ + super initialize. + + self aptitude: BrGlamorousTabGroupProportionalAptitude - BrTabGroupSplitterAptitude; + addTab: (BrTab new + hMatchParent; + aptitude: GtProtocolSlotTabAptitude new; + label: 'Categories' asRopedText glamorousCodeSmallSize; + stencil: [ methodProtocolsList ]); + addTab: (BrTab new + hMatchParent; + aptitude: GtProtocolSlotTabAptitude new; + label: 'Slots' asRopedText glamorousCodeSmallSize; + stencil: [ slotsGroupList ]) +] diff --git a/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st new file mode 100644 index 000000000..6e9414dfd --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st @@ -0,0 +1,271 @@ +Class { + #name : #GtCoderSlotsGroupedListElement, + #superclass : #BrGroupedList, + #traits : 'TGtCoderNavigationWithContextMenu', + #classTraits : 'TGtCoderNavigationWithContextMenu classTrait', + #instVars : [ + 'slotsGroup', + 'navigationModel' + ], + #category : #'GToolkit-Coder-UI-Navigation - Helpers' +} + +{ #category : #'private - actions' } +GtCoderSlotsGroupedListElement >> browseSlotReferencesFor: aString [ + self phlow + spawnObject: (GtSearchInstanceSlotReferenceFilter + forClassAndSubclasses: self selectedClass + andVariable: aString) +] + +{ #category : #initialization } +GtCoderSlotsGroupedListElement >> computeSlotItemText: aSlot [ + | slotText | + + slotText := aSlot name asRopedText. + self navigationModel selectedClass = aSlot definingClass instanceSide + ifFalse: [ slotText, ((' ({1})' format: { aSlot definingClass name }) asRopedText foreground: Color gray) ]. + + ^ slotText +] + +{ #category : #initialization } +GtCoderSlotsGroupedListElement >> createSlotGroups [ + | classSlotGroup instanceGroup classVarGroup | + instanceGroup := BrGroup new + domainObject: 'instance-side slots'; + stream: #() asAsyncStream; + itemStencil: [ BrHorizontalPane new + aptitude: BrGlamorousListItemAptitude; + hMatchParent; + vFitContent ]; + itemDataBinder: [ :element :item | + | label slotText| + element removeChildren. + label := BrLabel new + hMatchParent; + vFitContent; + beSmallSize; + aptitude: BrGlamorousLabelAptitude. + + slotText := self computeSlotItemText: item. + + label text: slotText. + label + addAptitude: (BrGlamorousWithContextMenuAptitude + content: [ GtCoderNavigationContextMenuContent new + items: (self slotListContextMenuItemsFor: item) ]). + element addChild: label ]; + shouldShowWithoutItems: false. + classSlotGroup := instanceGroup copy domainObject: 'class-side slots'. + classVarGroup := instanceGroup copy domainObject: 'class vars'. + ^ {instanceGroup. + classSlotGroup. + classVarGroup} +] + +{ #category : #initialization } +GtCoderSlotsGroupedListElement >> initialize [ + super initialize. + + self + padding: (BlInsets left: 5 right: 10); + matchParent; + headerElementStencil: [ BrLabel new + beSmallSize; + aptitude: (BrGlamorousLabelAptitude new foreground: Color gray) ]; + headerDataBinder: [ :label :each | label text: each domainObject asRopedText ]. + + slotsGroup := self createSlotGroups. + self groups: slotsGroup. + + self + when: BrSelectionChanged + do: [ :anEvent | self onSlotsListSelectionChanged ] +] + +{ #category : #accessing } +GtCoderSlotsGroupedListElement >> navigationModel [ + ^ navigationModel +] + +{ #category : #accessing } +GtCoderSlotsGroupedListElement >> navigationModel: anObject [ + navigationModel == anObject + ifTrue: [ ^ self ]. + + self unsubscribeFromNavigationModel. + navigationModel := anObject. + self subscribeToNavigationModel. + + self updateSlotList +] + +{ #category : #'event handling - selection' } +GtCoderSlotsGroupedListElement >> onSlotSelected: anAnnouncement [ + +] + +{ #category : #'event handling - selection' } +GtCoderSlotsGroupedListElement >> onSlotsListSelectionChanged [ + | theIndices anIndex aSelectedItem | + + theIndices := self selectedIndices ifEmpty: [ ^ self ]. + anIndex := theIndices first. + (anIndex between: 1 and: self viewModel entityCount) + ifFalse: [ ^ self ]. + aSelectedItem := (self viewModel entityAt: anIndex) value object. + self navigationModel selectSlot: aSelectedItem source: self +] + +{ #category : #'event handling' } +GtCoderSlotsGroupedListElement >> onSlotsToShowChanged: anAnnouncement [ + self updateSlotList +] + +{ #category : #'private - actions' } +GtCoderSlotsGroupedListElement >> renameSlot: slotName inElement: elem [ + | edit | + edit := BrEditableLabel new. + edit + aptitude: (BrGlamorousEditableLabelAptitude new + fontSize: 11.9; "Force the font to match the label font" + background: Color transparent); + text: slotName; + when: BrEditorAcceptWish + do: [ :aWish | + | refactoring | + refactoring := RBRenameInstanceVariableRefactoring + rename: slotName + to: aWish text asString + in: self selectedClass. + edit switchToLabel. + self + addPreviewButtonFor: refactoring + to: elem + cancelSelector: #updateSlotList ]; + switchToEditor. + edit requestFocus. + elem removeChildren. + elem addChild: edit +] + +{ #category : #accessing } +GtCoderSlotsGroupedListElement >> selectedClass [ + ^ navigationModel selectedClass +] + +{ #category : #'private - actions' } +GtCoderSlotsGroupedListElement >> slotListContextMenuItemsFor: item [ + ^ {(self createLabel: 'Browse references' description: item name) + -> [ :elem | self browseSlotReferencesFor: item name ]. + (self createLabel: 'Push up' description: item name) + -> [ :elem | + | refactoring | + refactoring := RBPullUpInstanceVariableRefactoring + variable: item name + class: self selectedClass superclass. + self + addPreviewButtonFor: refactoring + to: elem + cancelSelector: #updateProtocolList ]. + (self createLabel: 'Push down' description: item name) + -> [ :elem | + | refactoring | + refactoring := GtPushDownInstanceVariableRefactoring + variable: item name + class: self selectedClass. + self + addPreviewButtonFor: refactoring + to: elem + cancelSelector: #updateProtocolList ]. + (self createLabel: 'Create accessors' description: item name) + -> [ :elem | + | refactoring | + refactoring := RBCreateAccessorsForVariableRefactoring + instanceVariable: item name + class: self selectedClass. + self + addPreviewButtonFor: refactoring + to: elem + cancelSelector: #updateProtocolList ]. + (self createLabel: 'Abstract' description: item name) + -> [ :elem | + | refactoring | + refactoring := RBAbstractInstanceVariableRefactoring + variable: item name + class: self selectedClass. + self + addPreviewButtonFor: refactoring + to: elem + cancelSelector: #updateProtocolList ]. + (self createLabel: 'Protect' description: item name) + -> [ :elem | + | refactoring | + refactoring := RBProtectInstanceVariableRefactoring + variable: item name + class: self selectedClass. + self + addPreviewButtonFor: refactoring + to: elem + cancelSelector: #updateProtocolList ]. + (self createLabel: 'Remove' description: item name) + -> [ :elem | + | refactoring | + refactoring := RBRemoveInstanceVariableRefactoring + variable: item name + class: self selectedClass. + self + addPreviewButtonFor: refactoring + to: elem + cancelSelector: #updateProtocolList ]. + "(self createLabel: 'Rename slot' description: item name) + -> [ :elem | self renameSlot: item name inElement: elem ]"} +] + +{ #category : #'private - subscriptions' } +GtCoderSlotsGroupedListElement >> subscribeToNavigationModel [ + | subscriptions | + + subscriptions := { + GtCoderNavigationSlotsToShowChanged -> #onSlotsToShowChanged:. + GtCoderNavigationSlotSelected -> #onSlotSelected:. + }. + + subscriptions + do: [ :sub | + navigationModel weak + when: sub key + send: sub value + to: self ] +] + +{ #category : #subscriptions } +GtCoderSlotsGroupedListElement >> unsubscribeFromNavigationModel [ + navigationModel ifNotNil: [ :aModel | aModel unsubscribe: self ] +] + +{ #category : #'updating lists' } +GtCoderSlotsGroupedListElement >> updateSlotList [ + | slotsToShow newSlotGroups instanceSideSlots classSideSlots staticVars | + self navigationModel ifNil: [ ^ self ]. + + self deselectAll. + + slotsToShow := self navigationModel slotsToShow. + instanceSideSlots := slotsToShow + select: [ :eachSlot | eachSlot isInstanceVariable and: [ eachSlot owningClass isClassSide not ] ]. + + classSideSlots := slotsToShow + select: [ :eachSlot | eachSlot isInstanceVariable and: [ eachSlot owningClass isClassSide ] ]. + + staticVars := slotsToShow select: [ :eachSlot | eachSlot isClassVariable ]. + + newSlotGroups := {instanceSideSlots. + classSideSlots. + staticVars} + collect: [ :each | each asSortedCollection: [ :a :b | a name < b name ] ]. + + slotsGroup with: newSlotGroups do: [ :grp :str | grp items: str ]. + self groups: slotsGroup +] From 727a538c4f687c92b527b53868fdf32d6eb587b7 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 29 Oct 2024 09:44:36 -0300 Subject: [PATCH 0775/1268] add `GtFilteredCodersModel>>#addOrReplaceFilters:` --- .../GtFilteredCodersModel.class.st | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st b/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st index f3dd75bd0..421dde513 100644 --- a/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st +++ b/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st @@ -35,6 +35,32 @@ GtFilteredCodersModel >> addOrReplaceFilter: aFilter [ self additionalFilters: newFilters ] +{ #category : #'api - accessing' } +GtFilteredCodersModel >> addOrReplaceFilters: aCollectionOfFilters [ + "Add or replace given additional filters. + Each filter of the same filter type (class) is replaced by the given filters." + + | newFilters isChanged usedFilters | + + isChanged := false. + usedFilters := OrderedCollection new. + newFilters := self additionalFilters + collect: [ :existingFilter | + aCollectionOfFilters + detect: [ :givenFilter | + existingFilter filterType = givenFilter filterType ] + ifFound: [ :givenFilter | + isChanged := true. + usedFilters add: givenFilter. + givenFilter ] + ifNone: [ + existingFilter ] ]. + + isChanged ifFalse: [ + newFilters := newFilters , (aCollectionOfFilters copyWithoutAll: usedFilters) ]. + self additionalFilters: newFilters +] + { #category : #'api - accessing' } GtFilteredCodersModel >> additionalFilters [ From 34b7a884c09f1e08722440565922d5aa5603d9b3 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 29 Oct 2024 09:55:59 -0300 Subject: [PATCH 0776/1268] add `GtFilteredCodersViewModel>>#addOrReplaceFilters:` --- .../GtFilteredCodersViewModel.class.st | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/GToolkit-Coder-StreamingCoders-UI/GtFilteredCodersViewModel.class.st b/src/GToolkit-Coder-StreamingCoders-UI/GtFilteredCodersViewModel.class.st index 8a0d10e76..729b21078 100644 --- a/src/GToolkit-Coder-StreamingCoders-UI/GtFilteredCodersViewModel.class.st +++ b/src/GToolkit-Coder-StreamingCoders-UI/GtFilteredCodersViewModel.class.st @@ -12,6 +12,11 @@ GtFilteredCodersViewModel >> addOrReplaceFilter: aFilter [ streamingCodersModel addOrReplaceFilter: aFilter ] +{ #category : #'api - accessing' } +GtFilteredCodersViewModel >> addOrReplaceFilters: aCollectionOfFilters [ + streamingCodersModel addOrReplaceFilters: aCollectionOfFilters +] + { #category : #'api - accessing' } GtFilteredCodersViewModel >> additionalFilters [ From 5410b02591db4dfaa07a3564ab346ed2425c234b Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 29 Oct 2024 11:42:54 -0300 Subject: [PATCH 0777/1268] fix `GtFilteredCodersModel>>#addOrReplaceFilters:` --- .../GtFilteredCodersModel.class.st | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st b/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st index 421dde513..f713cd20e 100644 --- a/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st +++ b/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st @@ -41,7 +41,6 @@ GtFilteredCodersModel >> addOrReplaceFilters: aCollectionOfFilters [ Each filter of the same filter type (class) is replaced by the given filters." | newFilters isChanged usedFilters | - isChanged := false. usedFilters := OrderedCollection new. newFilters := self additionalFilters @@ -56,8 +55,7 @@ GtFilteredCodersModel >> addOrReplaceFilters: aCollectionOfFilters [ ifNone: [ existingFilter ] ]. - isChanged ifFalse: [ - newFilters := newFilters , (aCollectionOfFilters copyWithoutAll: usedFilters) ]. + newFilters := newFilters , (aCollectionOfFilters copyWithoutAll: usedFilters). self additionalFilters: newFilters ] From 66ea328c2dabdbf7c51d2aaf6ab89eb94973bebd Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Tue, 29 Oct 2024 16:29:10 +0100 Subject: [PATCH 0778/1268] [feenkcom/gtoolkit#4133] move protocols list updating to the protocol list itself --- .../GtCoderMethodsGroupedListElement.class.st | 6 +- ...erNavigationClassHierarchyElement.class.st | 71 ++++++++++++++++-- ...igationPackagesTagsClassesElement.class.st | 55 +------------- ...tCoderProtocolsGroupedListElement.class.st | 72 ++++++++++++++++++- ...oderProtocolsSlotsTabGroupElement.class.st | 26 ------- .../GtCoderSlotsGroupedListElement.class.st | 14 ++-- 6 files changed, 147 insertions(+), 97 deletions(-) delete mode 100644 src/GToolkit-Coder-UI/GtCoderProtocolsSlotsTabGroupElement.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index 175f3b122..e1f69c96d 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -195,7 +195,7 @@ GtCoderMethodsGroupedListElement >> pushDownMethod: aSelector inElement: elem [ ^ self addPreviewButtonFor: refactoring to: elem - cancelSelector: #updateProtocolList + cancelSelector: #updateProtocolsList ] { #category : #'private - actions' } @@ -207,7 +207,7 @@ GtCoderMethodsGroupedListElement >> pushUpMethod: aSelector inElement: elem [ ^ self addPreviewButtonFor: refactoring to: elem - cancelSelector: #updateProtocolList + cancelSelector: #updateProtocolsList ] { #category : #'private - actions' } @@ -249,7 +249,7 @@ GtCoderMethodsGroupedListElement >> renameMethod: aSelector inElement: elem [ self addPreviewButtonFor: refactoring to: elem - cancelSelector: #updateProtocolList ]; + cancelSelector: #updateProtocolsList ]; switchToEditor. edit requestFocus. elem removeChildren. diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st index 35be5c552..a65174251 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st @@ -9,7 +9,10 @@ Class { #instVars : [ 'supressListChanges', 'classesList', - 'navigationModel' + 'navigationModel', + 'methodsList', + 'protocolsList', + 'slotsList' ], #category : #'GToolkit-Coder-UI-Navigation' } @@ -35,18 +38,68 @@ GtCoderNavigationClassHierarchyElement >> hasNavigationModel [ self navigationModel isNavigationModel ] ] -{ #category : #'as yet unclassified' } +{ #category : #initialization } +GtCoderNavigationClassHierarchyElement >> headerLabel [ + | label | + label := BrLabel new. + label + aptitude: (BrGlamorousLabelAptitude new + fontSize: 12; + foreground: Color gray). + ^ label +] + +{ #category : #initialization } GtCoderNavigationClassHierarchyElement >> initialize [ + | protocolsSlotsTabGroup pane1 pane2 pane3 | super initialize. - self layout: BlLinearLayout vertical. + self layout: BlLinearLayout horizontal. self constraintsDo: [ :c | c horizontal matchParent. c vertical matchParent ]. - classesList := GtCoderClassesTreeElement new. + classesList := GtCoderClassesTreeElement new. + protocolsList := GtCoderProtocolsGroupedListElement new. + slotsList := GtCoderSlotsGroupedListElement new. + methodsList := GtCoderMethodsGroupedListElement new. + + protocolsSlotsTabGroup := BrTabGroup new + aptitude: BrGlamorousTabGroupProportionalAptitude - BrTabGroupSplitterAptitude; + addTab: (BrTab new + hMatchParent; + aptitude: GtProtocolSlotTabAptitude new; + label: 'Categories' asRopedText glamorousCodeSmallSize; + stencil: [ protocolsList ]); + addTab: (BrTab new + hMatchParent; + aptitude: GtProtocolSlotTabAptitude new; + label: 'Slots' asRopedText glamorousCodeSmallSize; + stencil: [ slotsList ]). + + pane1 := BrVerticalPane new + addAptitude: BrGlamorousWithHorizontalResizerAptitude; + matchParent; + addChildren: { + self headerLabel text: 'Classes'. + classesList }. + pane2 := BrVerticalPane new + addAptitude: BrGlamorousWithHorizontalResizerAptitude; + matchParent; + addChildren: { + protocolsSlotsTabGroup }. + + pane3 := BrVerticalPane new + matchParent; + addChildren: { + self headerLabel text: 'Methods'. + methodsList}. + + self + addChildren: {pane1. + pane2. + pane3} - self addChild: classesList ] { #category : #accessing } @@ -97,6 +150,14 @@ GtCoderNavigationClassHierarchyElement >> onNavigationModelChanged [ self updateContent. self subscribeToNavigationModel. self subscribeToClassList. + + protocolsList navigationModel: self navigationModel. + protocolsList updateProtocolListWith: self navigationModel protocolsToShow. + self navigationModel selectedProtocol + ifNotNil: [ :aProtocol | protocolsList selectProtocol: aProtocol ]. + + slotsList navigationModel: self navigationModel. + methodsList navigationModel: self navigationModel ] { #category : #'private - selection' } diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 3a039c577..be1b3024d 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -232,6 +232,7 @@ GtCoderNavigationPackagesTagsClassesElement >> onMethodsCoderFiltersChanged: aGt { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onNavigationModelChanged [ + methodProtocolsList navigationModel: self navigationModel. slotsGroupList navigationModel: self navigationModel. methodGroupList navigationModel: self navigationModel. @@ -317,39 +318,6 @@ GtCoderNavigationPackagesTagsClassesElement >> onPackagesSelected: anAnnouncer [ self deselectClasses ] ] ] -{ #category : #'event handling - selection' } -GtCoderNavigationPackagesTagsClassesElement >> onProtocolDeselected: anAnnouncement [ - methodProtocolsList deselectProtocol -] - -{ #category : #'event handling' } -GtCoderNavigationPackagesTagsClassesElement >> onProtocolListSelectionChanged [ - | aSelectedItem | - slotsGroupList deselectAll. - aSelectedItem := methodProtocolsList selectedProtocol. - aSelectedItem ifNil: [^self]. - self navigationModel selectProtocol: aSelectedItem source: self. - "methodGroupList deselectAll. - self updateMethodListWith: self navigationModel methodsToShow." -] - -{ #category : #'event handling - selection' } -GtCoderNavigationPackagesTagsClassesElement >> onProtocolSelected: anAnnouncement [ - methodProtocolsList selectProtocol: anAnnouncement protocol -] - -{ #category : #'event handling' } -GtCoderNavigationPackagesTagsClassesElement >> onProtocolsToShowChanged: anAnnouncement [ - self hasNavigationModel - ifFalse: [ ^ self ]. - - methodProtocolsList updateProtocolListWith: self navigationModel protocolsToShow. - - self navigationModel selectedProtocol - ifNil: [ methodProtocolsList deselectProtocol ] - ifNotNil: [ :aProtocol | methodProtocolsList selectProtocol: aProtocol ] -] - { #category : #'api - package updates' } GtCoderNavigationPackagesTagsClassesElement >> removePackage: aPackage [ | aSelectedPackageOrTag anIndex | @@ -528,7 +496,6 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToContent [ super subscribeToContent. self subscribeToPackageList. self subscribeToClassList. - self subscribeToProtocolList. ] { #category : #subscriptions } @@ -548,10 +515,7 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToNavigationModel [ GtCoderNavigationPackageTagRenamed -> #onPackageTagRenamed:. "Announcement when items selected" "GtCoderNavigationClassSelected -> #onClassSelected:. <--- defined in the superclass" - GtCoderNavigationProtocolSelected -> #onProtocolSelected:. - GtCoderNavigationProtocolDeselected -> #onProtocolDeselected:. "Announcements when we need to update items in the lists" - GtCoderNavigationProtocolsToShowChanged -> #onProtocolsToShowChanged:. GtCodersFiltersChanged -> #onMethodsCoderFiltersChanged:. }. subscriptions @@ -569,13 +533,6 @@ GtCoderNavigationPackagesTagsClassesElement >> subscribeToPackageList [ do: [ :anEvent | self onPackageListSelectionChanged ] ] -{ #category : #subscriptions } -GtCoderNavigationPackagesTagsClassesElement >> subscribeToProtocolList [ - methodProtocolsList - when: BrSelectionChanged - do: [ :anEvent | self onProtocolListSelectionChanged ] -] - { #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updateClassList [ self hasNavigationModel @@ -591,7 +548,6 @@ GtCoderNavigationPackagesTagsClassesElement >> updateClassList [ GtCoderNavigationPackagesTagsClassesElement >> updateContent [ self updatePackageLists. self updateClassList. - self updateProtocolList. ] { #category : #'updating lists' } @@ -607,14 +563,7 @@ GtCoderNavigationPackagesTagsClassesElement >> updatePackageLists [ { #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updateProtocolList [ - self hasNavigationModel - ifFalse: [ ^ self ]. - - methodProtocolsList navigationModel: self navigationModel. - methodProtocolsList updateProtocolListWith: self navigationModel protocolsToShow. - - self navigationModel selectedProtocol - ifNotNil: [ :aProtocol | methodProtocolsList selectProtocol: aProtocol ] + methodProtocolsList updateProtocolsList ] { #category : #'updating lists' } diff --git a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st index 17f6e89eb..b3d378c30 100644 --- a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st @@ -267,7 +267,9 @@ GtCoderProtocolsGroupedListElement >> initialize [ protocolsGroupName: each domainObject targetClass: self navigationModel selectedClass ]. - self when: BrSelectionChanged do: [ self privateEndRenameProtocol ]. + self when: BrSelectionChanged do: [ + self privateEndRenameProtocol. + self onProtocolListSelectionChanged ]. protocolGroups := self createProtocolGroups. self groups: protocolGroups @@ -280,7 +282,14 @@ GtCoderProtocolsGroupedListElement >> navigationModel [ { #category : #accessing } GtCoderProtocolsGroupedListElement >> navigationModel: anObject [ - navigationModel := anObject + navigationModel == anObject + ifTrue: [ ^ self ]. + + self unsubscribeFromNavigationModel. + navigationModel := anObject. + self subscribeToNavigationModel. + + self updateProtocolsList ] { #category : #'private - refactorings' } @@ -335,6 +344,31 @@ GtCoderProtocolsGroupedListElement >> onDropCompiledMethodsOnProtocol: anItemsDr compositeChange execute ] +{ #category : #'event handling' } +GtCoderProtocolsGroupedListElement >> onProtocolDeselected: anAnnouncement [ + self deselectProtocol +] + +{ #category : #'event handling' } +GtCoderProtocolsGroupedListElement >> onProtocolListSelectionChanged [ + | aSelectedItem | + aSelectedItem := self selectedProtocol. + aSelectedItem ifNil: [ ^ self ]. + + self navigationModel + ifNotNil: [ :aModel | aModel selectProtocol: aSelectedItem source: self ] +] + +{ #category : #'event handling' } +GtCoderProtocolsGroupedListElement >> onProtocolSelected: anAnnouncement [ + self selectProtocol: anAnnouncement protocol +] + +{ #category : #'event handling' } +GtCoderProtocolsGroupedListElement >> onProtocolsToShowChanged: anAnnouncement [ + self updateProtocolsList +] + { #category : #'private - refactorings' } GtCoderProtocolsGroupedListElement >> privateEndRenameProtocol [ "Removes protocol editing UI" @@ -406,7 +440,30 @@ GtCoderProtocolsGroupedListElement >> selectedProtocol [ ^ (self viewModel entityAt: anIndex) value object ] -{ #category : #'api - list' } +{ #category : #'private - subscriptions' } +GtCoderProtocolsGroupedListElement >> subscribeToNavigationModel [ + | subscriptions | + + subscriptions := { + GtCoderNavigationProtocolsToShowChanged -> #onProtocolsToShowChanged:. + GtCoderNavigationProtocolSelected -> #onProtocolSelected:. + GtCoderNavigationProtocolDeselected -> #onProtocolDeselected:. + }. + + subscriptions + do: [ :sub | + navigationModel weak + when: sub key + send: sub value + to: self ] +] + +{ #category : #subscriptions } +GtCoderProtocolsGroupedListElement >> unsubscribeFromNavigationModel [ + navigationModel ifNotNil: [ :aModel | aModel unsubscribe: self ] +] + +{ #category : #'private - updating' } GtCoderProtocolsGroupedListElement >> updateProtocolListWith: theGtPharoProtocols [ | virtualStream instStream classStream virtualGtPharoProtocols instanceGtPharoProtocols classGtPharoProtocols groupItems | @@ -442,3 +499,12 @@ GtCoderProtocolsGroupedListElement >> updateProtocolListWith: theGtPharoProtocol self groups: protocolGroups ] + +{ #category : #'private - updating' } +GtCoderProtocolsGroupedListElement >> updateProtocolsList [ + self updateProtocolListWith: self navigationModel protocolsToShow. + + self navigationModel selectedProtocol + ifNil: [ self deselectProtocol ] + ifNotNil: [ :aProtocol | self selectProtocol: aProtocol ] +] diff --git a/src/GToolkit-Coder-UI/GtCoderProtocolsSlotsTabGroupElement.class.st b/src/GToolkit-Coder-UI/GtCoderProtocolsSlotsTabGroupElement.class.st deleted file mode 100644 index 79d9a7107..000000000 --- a/src/GToolkit-Coder-UI/GtCoderProtocolsSlotsTabGroupElement.class.st +++ /dev/null @@ -1,26 +0,0 @@ -Class { - #name : #GtCoderProtocolsSlotsTabGroupElement, - #superclass : #BrTabGroup, - #instVars : [ - 'methodProtocolsList', - 'slotsGroupList' - ], - #category : #'GToolkit-Coder-UI-Navigation - Helpers' -} - -{ #category : #initialization } -GtCoderProtocolsSlotsTabGroupElement >> initialize [ - super initialize. - - self aptitude: BrGlamorousTabGroupProportionalAptitude - BrTabGroupSplitterAptitude; - addTab: (BrTab new - hMatchParent; - aptitude: GtProtocolSlotTabAptitude new; - label: 'Categories' asRopedText glamorousCodeSmallSize; - stencil: [ methodProtocolsList ]); - addTab: (BrTab new - hMatchParent; - aptitude: GtProtocolSlotTabAptitude new; - label: 'Slots' asRopedText glamorousCodeSmallSize; - stencil: [ slotsGroupList ]) -] diff --git a/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st index 6e9414dfd..19394572b 100644 --- a/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st @@ -155,7 +155,7 @@ GtCoderSlotsGroupedListElement >> selectedClass [ ^ navigationModel selectedClass ] -{ #category : #'private - actions' } +{ #category : #'private - context menu' } GtCoderSlotsGroupedListElement >> slotListContextMenuItemsFor: item [ ^ {(self createLabel: 'Browse references' description: item name) -> [ :elem | self browseSlotReferencesFor: item name ]. @@ -168,7 +168,7 @@ GtCoderSlotsGroupedListElement >> slotListContextMenuItemsFor: item [ self addPreviewButtonFor: refactoring to: elem - cancelSelector: #updateProtocolList ]. + cancelSelector: #updateSlotList ]. (self createLabel: 'Push down' description: item name) -> [ :elem | | refactoring | @@ -178,7 +178,7 @@ GtCoderSlotsGroupedListElement >> slotListContextMenuItemsFor: item [ self addPreviewButtonFor: refactoring to: elem - cancelSelector: #updateProtocolList ]. + cancelSelector: #updateSlotList ]. (self createLabel: 'Create accessors' description: item name) -> [ :elem | | refactoring | @@ -188,7 +188,7 @@ GtCoderSlotsGroupedListElement >> slotListContextMenuItemsFor: item [ self addPreviewButtonFor: refactoring to: elem - cancelSelector: #updateProtocolList ]. + cancelSelector: #updateSlotList ]. (self createLabel: 'Abstract' description: item name) -> [ :elem | | refactoring | @@ -198,7 +198,7 @@ GtCoderSlotsGroupedListElement >> slotListContextMenuItemsFor: item [ self addPreviewButtonFor: refactoring to: elem - cancelSelector: #updateProtocolList ]. + cancelSelector: #updateSlotList ]. (self createLabel: 'Protect' description: item name) -> [ :elem | | refactoring | @@ -208,7 +208,7 @@ GtCoderSlotsGroupedListElement >> slotListContextMenuItemsFor: item [ self addPreviewButtonFor: refactoring to: elem - cancelSelector: #updateProtocolList ]. + cancelSelector: #updateSlotList ]. (self createLabel: 'Remove' description: item name) -> [ :elem | | refactoring | @@ -218,7 +218,7 @@ GtCoderSlotsGroupedListElement >> slotListContextMenuItemsFor: item [ self addPreviewButtonFor: refactoring to: elem - cancelSelector: #updateProtocolList ]. + cancelSelector: #updateSlotList ]. "(self createLabel: 'Rename slot' description: item name) -> [ :elem | self renameSlot: item name inElement: elem ]"} ] From 8c614cece39e1ab2b08580e96cadcadfa7211432 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 29 Oct 2024 16:09:22 -0300 Subject: [PATCH 0779/1268] add Collections-Sequenceable dependency --- .../ManifestGToolkitCoderStreamingCoders.class.st | 1 + 1 file changed, 1 insertion(+) diff --git a/src/GToolkit-Coder-StreamingCoders/ManifestGToolkitCoderStreamingCoders.class.st b/src/GToolkit-Coder-StreamingCoders/ManifestGToolkitCoderStreamingCoders.class.st index 83c07e14c..c73917b25 100644 --- a/src/GToolkit-Coder-StreamingCoders/ManifestGToolkitCoderStreamingCoders.class.st +++ b/src/GToolkit-Coder-StreamingCoders/ManifestGToolkitCoderStreamingCoders.class.st @@ -12,6 +12,7 @@ ManifestGToolkitCoderStreamingCoders class >> mustOnlyDependOn [ ^ { 'Announcements-Core'. 'Collections-Unordered'. + 'Collections-Sequenceable'. 'Futures'. 'GToolkit-SearchFilters'. 'Kernel' From c9d8385f09b990f374d71f50b0c039aa7eda686c Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 30 Oct 2024 18:22:10 -0300 Subject: [PATCH 0780/1268] define coder's and filter's `GtPhlowToolCommonViewModel` [feenkcom/gtoolkit#3422] --- src/GToolkit-Coder-UI/GtCoderElement.class.st | 6 +++++- .../GtPhlowSearchFilterToolElement.class.st | 11 +++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderElement.class.st b/src/GToolkit-Coder-UI/GtCoderElement.class.st index e2420b8c1..f0803251b 100644 --- a/src/GToolkit-Coder-UI/GtCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderElement.class.st @@ -90,7 +90,11 @@ GtCoderElement >> initialize [ self addChild: contentElement as: #content. - self phlow beView + self phlow beView. + self phlow + accessTool: (GtPhlowToolClassType forClass: GtCoderElement) + viewModel: #navigationModel + object: #navigationModel ] { #category : #'private - hooks' } diff --git a/src/GToolkit-SearchFilters-PhlowTool/GtPhlowSearchFilterToolElement.class.st b/src/GToolkit-SearchFilters-PhlowTool/GtPhlowSearchFilterToolElement.class.st index 4487d7d38..b9e88b011 100644 --- a/src/GToolkit-SearchFilters-PhlowTool/GtPhlowSearchFilterToolElement.class.st +++ b/src/GToolkit-SearchFilters-PhlowTool/GtPhlowSearchFilterToolElement.class.st @@ -98,6 +98,11 @@ GtPhlowSearchFilterToolElement >> initialize [ self initializeContent. self initializeTitleNotifier. + + self phlow + accessTool: (GtPhlowToolClassType forClass: GtSearchFilter) + viewModel: #searchFilter + object: #searchFilter ] { #category : #initialization } @@ -137,6 +142,12 @@ GtPhlowSearchFilterToolElement >> playgroundElement [ ^ self childNamed: #playgroundPage ] +{ #category : #accessing } +GtPhlowSearchFilterToolElement >> searchFilter [ + + ^ searchFilter +] + { #category : #accessing } GtPhlowSearchFilterToolElement >> searchFilter: aSearchFilter [ searchFilter := aSearchFilter. From 9521716d233a2733a369f17c93343229d2834eff Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Sun, 10 Nov 2024 22:58:11 -0300 Subject: [PATCH 0781/1268] rename `GtPhlowValuableTool` to `GtPhlowExplicitTool` [feenkcom/gtoolkit#4168] --- src/GToolkit-Coder-UI/Behavior.extension.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/Behavior.extension.st b/src/GToolkit-Coder-UI/Behavior.extension.st index 943f06fff..1ccbbf056 100644 --- a/src/GToolkit-Coder-UI/Behavior.extension.st +++ b/src/GToolkit-Coder-UI/Behavior.extension.st @@ -15,9 +15,9 @@ Behavior >> gtBrowseButtonFor: anAction [ anEvent modifiers isPrimaryModifier ifTrue: [ self gtBrowseFromButton: aButton ] ifFalse: [ aButton phlow - spawnTool: (GtPhlowValuableTool new + spawnTool: (GtPhlowExplicitTool new name: self gtDisplayString; - valuable: [ | aCoder | + stencil: [ | aCoder | aButton phlow firstParentCoderNavigationModel coderDo: [ :oldCoder | aCoder := GtCoderElement forCoder: oldCoder asNewCoderModelWithSameSubject ]. aCoder ]) ] ]. From f1ce58d8c1d002d521bb0a647856e8abd0523c11 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Mon, 11 Nov 2024 08:50:30 -0600 Subject: [PATCH 0782/1268] Add fold noise shortcut [[feenkcom/gtoolkit#4141]] --- .../GtSourceCoderFoldNoiseShortcut.class.st | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderFoldNoiseShortcut.class.st diff --git a/src/GToolkit-Coder-UI/GtSourceCoderFoldNoiseShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderFoldNoiseShortcut.class.st new file mode 100644 index 000000000..ee0c5ecbe --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderFoldNoiseShortcut.class.st @@ -0,0 +1,36 @@ +Class { + #name : #GtSourceCoderFoldNoiseShortcut, + #superclass : #GtSourceCoderShortcut, + #category : #'GToolkit-Coder-UI-Shortcuts' +} + +{ #category : #accessing } +GtSourceCoderFoldNoiseShortcut >> description [ + ^ 'Folds instrumentation messages' +] + +{ #category : #initialization } +GtSourceCoderFoldNoiseShortcut >> initialize [ + super initialize. + + combination := BlKeyCombination primaryShiftN +] + +{ #category : #accessing } +GtSourceCoderFoldNoiseShortcut >> name [ + ^ 'Fold Noise' +] + +{ #category : #evaluation } +GtSourceCoderFoldNoiseShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent requesterObject: aRequester [ + | folding | + folding := nil. + aBrTextEditor text + attributesDo: [ :arr | + arr + detect: [ :att | att class == GtTextFolderAttribute ] + ifFound: [ :att | + folding ifNil: [ folding := att isExpanded ]. + att isExpanded: folding not. + att applyExpandedOrCollapsedAttributesOn: nil in: aBrTextEditor ] ] +] From 4d57d867da62e20ff1fa052966d0216dfb7113ec Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 12 Nov 2024 11:12:45 -0300 Subject: [PATCH 0783/1268] set package baselines view as `` --- src/GToolkit-Coder-Extensions/RPackage.extension.st | 1 + 1 file changed, 1 insertion(+) diff --git a/src/GToolkit-Coder-Extensions/RPackage.extension.st b/src/GToolkit-Coder-Extensions/RPackage.extension.st index 7e196cd2c..643cd9054 100644 --- a/src/GToolkit-Coder-Extensions/RPackage.extension.st +++ b/src/GToolkit-Coder-Extensions/RPackage.extension.st @@ -23,6 +23,7 @@ RPackage >> gtAllowedDependenciesFor: aView [ { #category : #'*GToolkit-Coder-Extensions' } RPackage >> gtBaselinesFor: aView [ + ^ aView forward title: 'References'; From 99425ed6532245ca4589e0d6c67afe5e301fd509 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Fri, 15 Nov 2024 09:08:18 +0100 Subject: [PATCH 0784/1268] [feenkcom/gtoolkit#4174] mark coder element as ViewContent --- src/GToolkit-Coder-UI/GtCoderElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderElement.class.st b/src/GToolkit-Coder-UI/GtCoderElement.class.st index f0803251b..b70b56e5b 100644 --- a/src/GToolkit-Coder-UI/GtCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderElement.class.st @@ -90,7 +90,7 @@ GtCoderElement >> initialize [ self addChild: contentElement as: #content. - self phlow beView. + self phlow beViewContent. self phlow accessTool: (GtPhlowToolClassType forClass: GtCoderElement) viewModel: #navigationModel From 4d032db7bd8f33ebddd9307d7879bd4f286169b3 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 19 Nov 2024 10:53:36 -0300 Subject: [PATCH 0785/1268] rename `#firstParentWithView` to `#firstParentWithViewContent` [feenkcom/gtoolkit#4174] --- src/GToolkit-Coder-UI/GtPhlowElementContext.extension.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtPhlowElementContext.extension.st b/src/GToolkit-Coder-UI/GtPhlowElementContext.extension.st index 2d08913d2..7fba5abb4 100644 --- a/src/GToolkit-Coder-UI/GtPhlowElementContext.extension.st +++ b/src/GToolkit-Coder-UI/GtPhlowElementContext.extension.st @@ -20,7 +20,7 @@ GtPhlowElementContext >> coderNavigationModel [ GtPhlowElementContext >> firstParentCoder [ | anElement | - anElement := self firstParentWithView. + anElement := self firstParentWithViewContent. self assert: [ anElement isNotNil ] description: [ 'Coder (element) must be non-nil' ]. From 85aed4e716b014046a3ed0c9ef940f4769178491 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 20 Nov 2024 11:13:44 -0300 Subject: [PATCH 0786/1268] add `GtCoderNavigationBasicClassHierarchyElement` [feenkcom/gtoolkit#4184] --- src/GToolkit-Coder-UI/Behavior.extension.st | 1 + ...igationBasicClassHierarchyElement.class.st | 196 ++++++++++++++++++ ...erNavigationClassHierarchyElement.class.st | 182 +--------------- .../GtCoderNavigationTabsStencil.class.st | 35 +++- 4 files changed, 234 insertions(+), 180 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderNavigationBasicClassHierarchyElement.class.st diff --git a/src/GToolkit-Coder-UI/Behavior.extension.st b/src/GToolkit-Coder-UI/Behavior.extension.st index 1ccbbf056..ca9b707b9 100644 --- a/src/GToolkit-Coder-UI/Behavior.extension.st +++ b/src/GToolkit-Coder-UI/Behavior.extension.st @@ -52,6 +52,7 @@ Behavior >> gtHierarchyButtonFor: anAction [ BlElement new size: GtPharoCoderHierarchyDropdownConfiguration preferredExtent; addChild: ((GtCoderNavigationTabsStencil new + pragmaName: #gtCoderDropdownNavigation; navigationModel: aNavigationModel; asElement) background: Color white) ] ] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationBasicClassHierarchyElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationBasicClassHierarchyElement.class.st new file mode 100644 index 000000000..bfee9955c --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderNavigationBasicClassHierarchyElement.class.st @@ -0,0 +1,196 @@ +Class { + #name : #GtCoderNavigationBasicClassHierarchyElement, + #superclass : #BlElement, + #instVars : [ + 'classesList', + 'navigationModel' + ], + #category : #'GToolkit-Coder-UI-Navigation' +} + +{ #category : #'api - class selections' } +GtCoderNavigationBasicClassHierarchyElement >> deselectClass: aClass [ + classesList deselectAll +] + +{ #category : #'api - class selections' } +GtCoderNavigationBasicClassHierarchyElement >> deselectClasses [ + classesList deselectAll +] + +{ #category : #'updating lists' } +GtCoderNavigationBasicClassHierarchyElement >> emptyClassList [ + classesList initializeWithClasses: #(). +] + +{ #category : #testing } +GtCoderNavigationBasicClassHierarchyElement >> hasNavigationModel [ + ^ self navigationModel isNotNil and: [ + self navigationModel isNavigationModel ] +] + +{ #category : #initialization } +GtCoderNavigationBasicClassHierarchyElement >> headerLabel [ + | label | + label := BrLabel new. + label + aptitude: (BrGlamorousLabelAptitude new + fontSize: 12; + foreground: Color gray). + ^ label +] + +{ #category : #initialization } +GtCoderNavigationBasicClassHierarchyElement >> initialize [ + | pane1 | + super initialize. + + self layout: BlLinearLayout horizontal. + self constraintsDo: [ :c | + c horizontal matchParent. + c vertical matchParent ]. + + classesList := GtCoderClassesTreeElement new. + + pane1 := BrVerticalPane new + addAptitude: BrGlamorousWithHorizontalResizerAptitude; + matchParent; + addChildren: { + self headerLabel text: 'Classes'. + classesList }. + + self addChild: pane1 +] + +{ #category : #accessing } +GtCoderNavigationBasicClassHierarchyElement >> navigationModel [ + + + ^ navigationModel +] + +{ #category : #accessing } +GtCoderNavigationBasicClassHierarchyElement >> navigationModel: aGtCoderNavigationPackagesTagsClassesModel [ + self unsubscribeFromNavigationModel. + navigationModel := aGtCoderNavigationPackagesTagsClassesModel. + self onNavigationModelChanged. +] + +{ #category : #'event handling' } +GtCoderNavigationBasicClassHierarchyElement >> onClassDeselected: aGtCoderNavigationClassDeselected [ + self deselectClass: aGtCoderNavigationClassDeselected theClass +] + +{ #category : #'event handling' } +GtCoderNavigationBasicClassHierarchyElement >> onClassListSelectionChanged [ + | anIndex aSelectedItem theIndices | + + theIndices := classesList selectedIndices. + theIndices ifEmpty: [ ^ self ]. + anIndex := theIndices first. + (anIndex between: 1 and: classesList viewModel itemCount) + ifFalse: [ ^ self ]. + aSelectedItem := (classesList viewModel itemAt: anIndex) value rootClass. + self navigationModel selectClass: aSelectedItem +] + +{ #category : #'event handling' } +GtCoderNavigationBasicClassHierarchyElement >> onClassSelected: anAnnouncement [ + | aSelectedClass | + + aSelectedClass := anAnnouncement theClass. + (classesList containsClass: aSelectedClass) + ifFalse: [ self updateClassList ]. + self selectClass: aSelectedClass +] + +{ #category : #'event handling' } +GtCoderNavigationBasicClassHierarchyElement >> onNavigationModelChanged [ + "subclasses may perform actions on navigation model changes" + self updateContent. + self subscribeToNavigationModel. + self subscribeToClassList. +] + +{ #category : #'private - selection' } +GtCoderNavigationBasicClassHierarchyElement >> scrollIndexFromPrevious: aPreviousIndex current: aNewIndex max: aNumberOfItems [ + + ^ (aPreviousIndex isZero or: [ aPreviousIndex >= aNewIndex ]) + ifTrue: [ aNewIndex - 5 max: 1 ] + ifFalse: [ aNewIndex + 5 min: aNumberOfItems ]. +] + +{ #category : #'api - class selections' } +GtCoderNavigationBasicClassHierarchyElement >> selectClass: aClass [ + | aPreviousIndex | + + aPreviousIndex := classesList selectedIndice. + classesList viewModel + indexOfSuchThat: [ :each | each rootClass = aClass ] + do: [ :aNewIndex | + classesList + selectOne: aNewIndex; + scrollToIndex: + (self + scrollIndexFromPrevious: aPreviousIndex + current: aNewIndex + max: classesList viewModel itemCount) ] +] + +{ #category : #subscriptions } +GtCoderNavigationBasicClassHierarchyElement >> subscribeToClassList [ + classesList + when: BrSelectionChanged + do: [ :anEvent | self onClassListSelectionChanged ] +] + +{ #category : #subscriptions } +GtCoderNavigationBasicClassHierarchyElement >> subscribeToNavigationModel [ + | subscriptions | + + self hasNavigationModel + ifFalse: [ ^ self ]. + + subscriptions := { + GtCoderNavigationClassSelected -> #onClassSelected:. + GtCoderNavigationClassDeselected -> #onClassDeselected: + }. + + subscriptions + do: [ :sub | + navigationModel weak + when: sub key + send: sub value + to: self ] +] + +{ #category : #subscriptions } +GtCoderNavigationBasicClassHierarchyElement >> unsubscribeFromNavigationModel [ + self hasNavigationModel ifFalse: [ ^ self ]. + navigationModel ifNotNil: [ :aModel | aModel unsubscribe: self ]. +] + +{ #category : #'updating lists' } +GtCoderNavigationBasicClassHierarchyElement >> updateClassList [ + self hasNavigationModel ifFalse: [ ^ self ]. + navigationModel hasSelectedClass + ifTrue: [ self updateClassListsWith: navigationModel selectedClass ] + ifFalse: [ self emptyClassList ] +] + +{ #category : #'updating lists' } +GtCoderNavigationBasicClassHierarchyElement >> updateClassListsWith: aClass [ + classesList initializeWithHierachyForClass: aClass. +] + +{ #category : #'updating lists' } +GtCoderNavigationBasicClassHierarchyElement >> updateContent [ + self updateClassList. + self updateSelectedClass +] + +{ #category : #'updating lists' } +GtCoderNavigationBasicClassHierarchyElement >> updateSelectedClass [ + self hasNavigationModel ifFalse: [ ^ self ]. + navigationModel selectedClassDo: [ :aClass | self selectClass: aClass ] +] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st index a65174251..5ee7bbd8a 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st @@ -5,11 +5,8 @@ I show a list of classes grouping them based on the inheritance hierarchy and so " Class { #name : #GtCoderNavigationClassHierarchyElement, - #superclass : #BlElement, + #superclass : #GtCoderNavigationBasicClassHierarchyElement, #instVars : [ - 'supressListChanges', - 'classesList', - 'navigationModel', 'methodsList', 'protocolsList', 'slotsList' @@ -17,49 +14,11 @@ Class { #category : #'GToolkit-Coder-UI-Navigation' } -{ #category : #'api - class selections' } -GtCoderNavigationClassHierarchyElement >> deselectClass: aClass [ - classesList deselectAll -] - -{ #category : #'api - class selections' } -GtCoderNavigationClassHierarchyElement >> deselectClasses [ - classesList deselectAll -] - -{ #category : #'updating lists' } -GtCoderNavigationClassHierarchyElement >> emptyClassList [ - classesList initializeWithClasses: #(). -] - -{ #category : #testing } -GtCoderNavigationClassHierarchyElement >> hasNavigationModel [ - ^ self navigationModel isNotNil and: [ - self navigationModel isNavigationModel ] -] - -{ #category : #initialization } -GtCoderNavigationClassHierarchyElement >> headerLabel [ - | label | - label := BrLabel new. - label - aptitude: (BrGlamorousLabelAptitude new - fontSize: 12; - foreground: Color gray). - ^ label -] - { #category : #initialization } GtCoderNavigationClassHierarchyElement >> initialize [ - | protocolsSlotsTabGroup pane1 pane2 pane3 | + | protocolsSlotsTabGroup pane2 pane3 | super initialize. - self layout: BlLinearLayout horizontal. - self constraintsDo: [ :c | - c horizontal matchParent. - c vertical matchParent ]. - - classesList := GtCoderClassesTreeElement new. protocolsList := GtCoderProtocolsGroupedListElement new. slotsList := GtCoderSlotsGroupedListElement new. methodsList := GtCoderMethodsGroupedListElement new. @@ -77,12 +36,6 @@ GtCoderNavigationClassHierarchyElement >> initialize [ label: 'Slots' asRopedText glamorousCodeSmallSize; stencil: [ slotsList ]). - pane1 := BrVerticalPane new - addAptitude: BrGlamorousWithHorizontalResizerAptitude; - matchParent; - addChildren: { - self headerLabel text: 'Classes'. - classesList }. pane2 := BrVerticalPane new addAptitude: BrGlamorousWithHorizontalResizerAptitude; matchParent; @@ -96,60 +49,16 @@ GtCoderNavigationClassHierarchyElement >> initialize [ methodsList}. self - addChildren: {pane1. + addChildren: { pane2. pane3} ] -{ #category : #accessing } -GtCoderNavigationClassHierarchyElement >> navigationModel [ - - - ^ navigationModel -] - -{ #category : #accessing } -GtCoderNavigationClassHierarchyElement >> navigationModel: aGtCoderNavigationPackagesTagsClassesModel [ - self unsubscribeFromNavigationModel. - navigationModel := aGtCoderNavigationPackagesTagsClassesModel. - self onNavigationModelChanged. -] - -{ #category : #'event handling' } -GtCoderNavigationClassHierarchyElement >> onClassDeselected: aGtCoderNavigationClassDeselected [ - self deselectClass: aGtCoderNavigationClassDeselected theClass -] - -{ #category : #'event handling' } -GtCoderNavigationClassHierarchyElement >> onClassListSelectionChanged [ - | anIndex aSelectedItem theIndices | - - theIndices := classesList selectedIndices. - theIndices ifEmpty: [ ^ self ]. - anIndex := theIndices first. - (anIndex between: 1 and: classesList viewModel itemCount) - ifFalse: [ ^ self ]. - aSelectedItem := (classesList viewModel itemAt: anIndex) value rootClass. - self navigationModel selectClass: aSelectedItem -] - -{ #category : #'event handling' } -GtCoderNavigationClassHierarchyElement >> onClassSelected: anAnnouncement [ - | aSelectedClass | - - aSelectedClass := anAnnouncement theClass. - (classesList containsClass: aSelectedClass) - ifFalse: [ self updateClassList ]. - self selectClass: aSelectedClass -] - { #category : #'event handling' } GtCoderNavigationClassHierarchyElement >> onNavigationModelChanged [ "subclasses may perform actions on navigation model changes" - self updateContent. - self subscribeToNavigationModel. - self subscribeToClassList. + super onNavigationModelChanged. protocolsList navigationModel: self navigationModel. protocolsList updateProtocolListWith: self navigationModel protocolsToShow. @@ -159,86 +68,3 @@ GtCoderNavigationClassHierarchyElement >> onNavigationModelChanged [ slotsList navigationModel: self navigationModel. methodsList navigationModel: self navigationModel ] - -{ #category : #'private - selection' } -GtCoderNavigationClassHierarchyElement >> scrollIndexFromPrevious: aPreviousIndex current: aNewIndex max: aNumberOfItems [ - - ^ (aPreviousIndex isZero or: [ aPreviousIndex >= aNewIndex ]) - ifTrue: [ aNewIndex - 5 max: 1 ] - ifFalse: [ aNewIndex + 5 min: aNumberOfItems ]. -] - -{ #category : #'api - class selections' } -GtCoderNavigationClassHierarchyElement >> selectClass: aClass [ - | aPreviousIndex | - - aPreviousIndex := classesList selectedIndice. - classesList viewModel - indexOfSuchThat: [ :each | each rootClass = aClass ] - do: [ :aNewIndex | - classesList - selectOne: aNewIndex; - scrollToIndex: - (self - scrollIndexFromPrevious: aPreviousIndex - current: aNewIndex - max: classesList viewModel itemCount) ] -] - -{ #category : #subscriptions } -GtCoderNavigationClassHierarchyElement >> subscribeToClassList [ - classesList - when: BrSelectionChanged - do: [ :anEvent | self onClassListSelectionChanged ] -] - -{ #category : #subscriptions } -GtCoderNavigationClassHierarchyElement >> subscribeToNavigationModel [ - | subscriptions | - - self hasNavigationModel - ifFalse: [ ^ self ]. - - subscriptions := { - GtCoderNavigationClassSelected -> #onClassSelected:. - GtCoderNavigationClassDeselected -> #onClassDeselected: - }. - - subscriptions - do: [ :sub | - navigationModel weak - when: sub key - send: sub value - to: self ] -] - -{ #category : #subscriptions } -GtCoderNavigationClassHierarchyElement >> unsubscribeFromNavigationModel [ - self hasNavigationModel ifFalse: [ ^ self ]. - navigationModel ifNotNil: [ :aModel | aModel unsubscribe: self ]. -] - -{ #category : #'updating lists' } -GtCoderNavigationClassHierarchyElement >> updateClassList [ - self hasNavigationModel ifFalse: [ ^ self ]. - navigationModel hasSelectedClass - ifTrue: [ self updateClassListsWith: navigationModel selectedClass ] - ifFalse: [ self emptyClassList ] -] - -{ #category : #'updating lists' } -GtCoderNavigationClassHierarchyElement >> updateClassListsWith: aClass [ - classesList initializeWithHierachyForClass: aClass. -] - -{ #category : #'updating lists' } -GtCoderNavigationClassHierarchyElement >> updateContent [ - self updateClassList. - self updateSelectedClass -] - -{ #category : #'updating lists' } -GtCoderNavigationClassHierarchyElement >> updateSelectedClass [ - self hasNavigationModel ifFalse: [ ^ self ]. - navigationModel selectedClassDo: [ :aClass | self selectClass: aClass ] -] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index 54a117fa5..dddf4b9f3 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -4,7 +4,8 @@ Class { #instVars : [ 'navigations', 'navigationModel', - 'formCache' + 'formCache', + 'pragmaName' ], #category : #'GToolkit-Coder-UI-Navigation' } @@ -79,10 +80,15 @@ GtCoderNavigationTabsStencil >> defaultNavigations [ ^ GtPhlowViewsCollector new fromObject: self; - pragmaName: #gtCoderNavigation; + pragmaName: self pragmaName; collect ] +{ #category : #defaults } +GtCoderNavigationTabsStencil >> defaultPragmaName [ + ^ #gtCoderNavigation +] + { #category : #accessing } GtCoderNavigationTabsStencil >> formCache [ ^ formCache @@ -93,6 +99,20 @@ GtCoderNavigationTabsStencil >> formCache: anObject [ formCache := anObject ] +{ #category : #'gt-extensions' } +GtCoderNavigationTabsStencil >> gtClassDropdownHierarchyFor: aView [ + + | explicitView | + self navigationModel ifNil: [ ^ aView empty ]. + explicitView := aView explicit + title: 'Class Hierarchy'; + priority: 2; + stencil: [ GtCoderNavigationBasicClassHierarchyElement new + navigationModel: self navigationModel ]. + self addButtonsTo: explicitView. + ^ explicitView +] + { #category : #'gt-extensions' } GtCoderNavigationTabsStencil >> gtClassHierarchyFor: aView [ @@ -158,6 +178,7 @@ GtCoderNavigationTabsStencil >> gtCreationInterface: look [ { #category : #'gt-extensions' } GtCoderNavigationTabsStencil >> gtPackagesTagsClassesFor: aView [ + | explicitView | self navigationModel ifNil: [ ^ aView empty ]. explicitView := aView explicit @@ -195,3 +216,13 @@ GtCoderNavigationTabsStencil >> navigations [ GtCoderNavigationTabsStencil >> navigations: anArrayOfPhlowViews [ navigations := anArrayOfPhlowViews ] + +{ #category : #accessing } +GtCoderNavigationTabsStencil >> pragmaName [ + ^ pragmaName ifNil: [ pragmaName := self defaultPragmaName ] +] + +{ #category : #accessing } +GtCoderNavigationTabsStencil >> pragmaName: anObject [ + pragmaName := anObject +] From bf07bd36b9b813c9e2d7074f689f184218492e6f Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 20 Nov 2024 12:36:01 -0300 Subject: [PATCH 0787/1268] add `GtCoderNavigationBasicPackagesTagsClassesElement` [feenkcom/gtoolkit#4184] --- ...onBasicPackagesTagsClassesElement.class.st | 450 ++++++++++++++++++ ...igationPackagesTagsClassesElement.class.st | 441 +---------------- .../GtCoderNavigationTabsStencil.class.st | 15 +- 3 files changed, 468 insertions(+), 438 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderNavigationBasicPackagesTagsClassesElement.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationBasicPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationBasicPackagesTagsClassesElement.class.st new file mode 100644 index 000000000..3a32bb63d --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderNavigationBasicPackagesTagsClassesElement.class.st @@ -0,0 +1,450 @@ +Class { + #name : #GtCoderNavigationBasicPackagesTagsClassesElement, + #superclass : #GtCoderNavigationElement, + #instVars : [ + 'packagesList', + 'classesLabel' + ], + #category : #'GToolkit-Coder-UI-Navigation' +} + +{ #category : #'api - package updates' } +GtCoderNavigationBasicPackagesTagsClassesElement >> addPackage: aPackage [ + | aSelectedPackageOrTag | + + packagesList selectedNodeDo: [ :aNode | + aSelectedPackageOrTag := aNode value ]. + + self updatePackageLists. + aSelectedPackageOrTag ifNotNil: [ + self selectPackageOrTag: aSelectedPackageOrTag ]. +] + +{ #category : #'api - package updates' } +GtCoderNavigationBasicPackagesTagsClassesElement >> addPackage: aPackage tag: aPackageTag [ + | aSelectedPackageOrTag | + + packagesList selectedNodeDo: [ :aNode | + aSelectedPackageOrTag := aNode value ]. + + self updatePackageLists. + aSelectedPackageOrTag ifNotNil: [ + self selectPackageOrTag: aSelectedPackageOrTag ]. +] + +{ #category : #'api - package selections' } +GtCoderNavigationBasicPackagesTagsClassesElement >> deselectPackages [ + packagesList deselectAll +] + +{ #category : #'api - package selections' } +GtCoderNavigationBasicPackagesTagsClassesElement >> expandPackage: aRPackage [ + packagesList viewModel root + allChildrenNodesBreadthFirstDo: [ :eachTreeNode | + eachTreeNode value = aRPackage + ifTrue: [ eachTreeNode expand ] ] +] + +{ #category : #'private - testing' } +GtCoderNavigationBasicPackagesTagsClassesElement >> hasPackageTagsIn: aRPackage [ + + | noTags noExtensions | + noTags := (aRPackage classTags size = 1 and: [ aRPackage classTags anyOne name = aRPackage name ]). + noExtensions := aRPackage extendedClasses isEmpty. + ^ noTags not or: [ noExtensions not ] +] + +{ #category : #initialization } +GtCoderNavigationBasicPackagesTagsClassesElement >> headerLabel [ + | label | + label := BrLabel new. + label + aptitude: (BrGlamorousLabelAptitude new + fontSize: 12; + foreground: Color gray). + ^ label +] + +{ #category : #'showing / hiding' } +GtCoderNavigationBasicPackagesTagsClassesElement >> hideClassList [ + classesLabel visibility: BlVisibility hidden. +] + +{ #category : #'showing / hiding' } +GtCoderNavigationBasicPackagesTagsClassesElement >> hideOrShowClassList [ + classesList maxSelectionIndex isZero + ifTrue: [ self hideClassList ] + ifFalse: [ self showClassList ] +] + +{ #category : #initialization } +GtCoderNavigationBasicPackagesTagsClassesElement >> initializeContent [ + super initializeContent. + packagesList := GtCoderNavigationPackagesTreeElement new + padding: (BlInsets right: 10). +] + +{ #category : #initialization } +GtCoderNavigationBasicPackagesTagsClassesElement >> initializeElement [ + | pane1 pane2 | + super initializeElement. + pane1 := BrVerticalPane new + addAptitude: BrGlamorousWithHorizontalResizerAptitude; + matchParent; + addChildren: {self headerLabel text: 'Packages'. + packagesList}. + pane2 := BrVerticalPane new + addAptitude: BrGlamorousWithHorizontalResizerAptitude; + matchParent; + addChildren: {classesLabel := self headerLabel text: 'Classes'. + classesList}. + self addChildren: { pane1. pane2 } +] + +{ #category : #initialization } +GtCoderNavigationBasicPackagesTagsClassesElement >> initializeLayout [ + super initializeLayout. + self layout: BlLinearLayout new beHorizontal. + self + constraintsDo: [ :c | + c horizontal matchParent. + c vertical matchParent ] +] + +{ #category : #'event handling - selection' } +GtCoderNavigationBasicPackagesTagsClassesElement >> onClassDeselected: anAnnouncement [ + self + suppressListChangeEventsDuring: [ self deselectClass: anAnnouncement theClass ] +] + +{ #category : #'event handling' } +GtCoderNavigationBasicPackagesTagsClassesElement >> onClassRemoved: anAnnouncement [ + | aPackageOrTag | + self + inUIProcessDo: [ aPackageOrTag := self selectedPackageOrTag. + packagesList deselectAll. + self selectPackage: aPackageOrTag ] +] + +{ #category : #'event handling - selection' } +GtCoderNavigationBasicPackagesTagsClassesElement >> onClassSelected: anAnnouncement [ + self + suppressListChangeEventsDuring: [ self selectClass: anAnnouncement theClass ] +] + +{ #category : #'event handling' } +GtCoderNavigationBasicPackagesTagsClassesElement >> onPackageListSelectionChanged [ + | anIndex aSelectedItem theIndices | + supressListChanges ifTrue: [ ^ self ]. + theIndices := packagesList selectedIndices. + theIndices ifEmpty: [ ^ self ]. + anIndex := theIndices first. + (anIndex between: 1 and: packagesList viewModel itemCount) ifFalse: [ ^ self ]. + aSelectedItem := (packagesList viewModel itemAt: anIndex) value. + (aSelectedItem isKindOf: RPackage) + ifTrue: [ self navigationModel selectPackage: aSelectedItem ] + ifFalse: [ self navigationModel selectPackageTag: aSelectedItem ]. + self showClassList. + self deselectClasses +] + +{ #category : #'event handling' } +GtCoderNavigationBasicPackagesTagsClassesElement >> onPackageRegistered: anAnnouncement [ + self + suppressListChangeEventsDuring: [ self addPackage: anAnnouncement package ] +] + +{ #category : #'event handling' } +GtCoderNavigationBasicPackagesTagsClassesElement >> onPackageRenamed: anAnnouncement [ + self + suppressListChangeEventsDuring: [ self + renamePackage: anAnnouncement package + oldName: anAnnouncement oldName + newName: anAnnouncement newName ] +] + +{ #category : #'event handling' } +GtCoderNavigationBasicPackagesTagsClassesElement >> onPackageSelected: anAnnouncer [ + self inUIProcessDo: [ self suppressListChangeEventsDuring: [ self selectPackage: anAnnouncer package ] ] +] + +{ #category : #'event handling' } +GtCoderNavigationBasicPackagesTagsClassesElement >> onPackageTagAdded: anAnnouncement [ + self + suppressListChangeEventsDuring: [ self addPackage: anAnnouncement package tag: anAnnouncement tag ] +] + +{ #category : #'event handling' } +GtCoderNavigationBasicPackagesTagsClassesElement >> onPackageTagRemoved: anAnnouncement [ + self + suppressListChangeEventsDuring: [ self removePackage: anAnnouncement package tag: anAnnouncement tag ] +] + +{ #category : #'event handling' } +GtCoderNavigationBasicPackagesTagsClassesElement >> onPackageTagRenamed: anAnnouncement [ + self + suppressListChangeEventsDuring: [ self + renamePackageTag: anAnnouncement package + oldName: anAnnouncement oldName + newName: anAnnouncement newName ] +] + +{ #category : #'event handling - selection' } +GtCoderNavigationBasicPackagesTagsClassesElement >> onPackageTagSelected: anAnnouncer [ + self + inUIProcessDo: [ self + suppressListChangeEventsDuring: [ self selectPackage: anAnnouncer package tag: anAnnouncer tag. + "self deselectClasses" ] ] +] + +{ #category : #'event handling' } +GtCoderNavigationBasicPackagesTagsClassesElement >> onPackageUnregistered: anAnnouncement [ + self + suppressListChangeEventsDuring: [ self removePackage: anAnnouncement package ] +] + +{ #category : #'event handling - selection' } +GtCoderNavigationBasicPackagesTagsClassesElement >> onPackagesSelected: anAnnouncer [ + self + inUIProcessDo: [ self + suppressListChangeEventsDuring: [ self deselectPackages. + self deselectClasses ] ] +] + +{ #category : #'api - package updates' } +GtCoderNavigationBasicPackagesTagsClassesElement >> removePackage: aPackage [ + | aSelectedPackageOrTag anIndex | + anIndex := packagesList viewModel indexOf: aPackage. + anIndex > 0 ifFalse: [ ^ self ]. + aSelectedPackageOrTag := self selectedPackageOrTag. + + self updatePackageLists. + self + reselectPackageOrTag: aSelectedPackageOrTag + afterRemovalOfPackageNamed: aPackage name +] + +{ #category : #'api - package updates' } +GtCoderNavigationBasicPackagesTagsClassesElement >> removePackage: aPackage tag: aPackageTagName [ + | aSelectedPackageOrTag anIndex | + anIndex := packagesList viewModel indexOf: aPackage. + anIndex > 0 ifFalse: [ ^ self ]. + packagesList selectedNodeDo: [ :aNode | + aSelectedPackageOrTag := aNode value ]. + self updatePackageLists. + self reselectPackageOrTag: aSelectedPackageOrTag afterRemovalOfTagNamed: aPackageTagName. +] + +{ #category : #'api - package updates' } +GtCoderNavigationBasicPackagesTagsClassesElement >> renamePackage: aPackage oldName: anOldName newName: aNewName [ + | aSelectedPackageOrTag | + + packagesList selectedNodeDo: [ :aNode | + aSelectedPackageOrTag := aNode value ]. + + self updatePackageLists. + aSelectedPackageOrTag ifNotNil: [ + self selectPackageOrTag: aSelectedPackageOrTag ]. +] + +{ #category : #'api - package updates' } +GtCoderNavigationBasicPackagesTagsClassesElement >> renamePackageTag: aPackageTag oldName: anOldName newName: aNewName [ + | aSelectedPackageOrTag | + + packagesList selectedNodeDo: [ :aNode | + aSelectedPackageOrTag := aNode value ]. + + self updatePackageLists. + aSelectedPackageOrTag ifNotNil: [ + self selectPackageOrTag: aSelectedPackageOrTag ]. +] + +{ #category : #'api - package reselections' } +GtCoderNavigationBasicPackagesTagsClassesElement >> reselectPackageOrTag: aSelectedPackageOrTag afterRemovalOfPackageNamed: aRemovedPackageOrTagName [ + aSelectedPackageOrTag ifNotNil: [ + self deselectPackages. + aSelectedPackageOrTag name = aRemovedPackageOrTagName + ifTrue: [ + self hideClassList ] + ifFalse: [ + self selectPackageOrTag: aSelectedPackageOrTag ] ] +] + +{ #category : #'api - package reselections' } +GtCoderNavigationBasicPackagesTagsClassesElement >> reselectPackageOrTag: aSelectedPackageOrTag afterRemovalOfTagNamed: aRemovedTagName [ + aSelectedPackageOrTag + ifNotNil: [ self deselectPackages. + (aSelectedPackageOrTag name sameContentAs: aRemovedTagName) + ifTrue: [ self expandPackage: aSelectedPackageOrTag package. + self hideClassList ] + ifFalse: [ self selectPackageOrTag: aSelectedPackageOrTag ] ] +] + +{ #category : #'api - class selections' } +GtCoderNavigationBasicPackagesTagsClassesElement >> selectClass: aClass inPackage: aPackage tag: aPackageTag [ + self selectedPackage ~= aPackage + ifTrue: [ self selectPackage: aPackage tag: aPackageTag ]. + + self selectClass: aClass. + self updateProtocolList. + self updateSlotList +] + +{ #category : #'api - package selections' } +GtCoderNavigationBasicPackagesTagsClassesElement >> selectPackage: aPackage [ + | aPreviousIndex | + + self expandPackage: aPackage. + aPreviousIndex := packagesList selectedIndice. + + packagesList deselectAll. + packagesList viewModel + indexOf: aPackage + do: [ :aNewIndex | + packagesList + selectOne: aNewIndex; + scrollToIndex: + (self + scrollIndexFromPrevious: aPreviousIndex + current: aNewIndex + max: packagesList viewModel itemCount) ]. +] + +{ #category : #'api - package selections' } +GtCoderNavigationBasicPackagesTagsClassesElement >> selectPackage: aPackage tag: aPackageTag [ + | aPreviousIndex | + (self hasPackageTagsIn: aPackage) ifFalse: [ ^ self selectPackage: aPackage ]. + aPackageTag isNil ifTrue: [ ^ self selectPackage: aPackage ]. + + packagesList deselectAll. + self expandPackage: aPackage. + + aPreviousIndex := packagesList selectedIndice. + packagesList viewModel + indexOf: aPackageTag + do: [ :aNewIndex | + packagesList + selectOne: aNewIndex; + scrollToIndex: (self + scrollIndexFromPrevious: aPreviousIndex + current: aNewIndex + max: packagesList viewModel itemCount) ] +] + +{ #category : #'api - package selections' } +GtCoderNavigationBasicPackagesTagsClassesElement >> selectPackageOrTag: aPackageOrTag [ + (aPackageOrTag isKindOf: RPackage) + ifTrue: [ self selectPackage: aPackageOrTag ] + ifFalse: [ self selectPackage: aPackageOrTag package tag: aPackageOrTag ] +] + +{ #category : #'api - class selections' } +GtCoderNavigationBasicPackagesTagsClassesElement >> selectedClass [ + + ^ classesList selectedClass +] + +{ #category : #'api - package selections' } +GtCoderNavigationBasicPackagesTagsClassesElement >> selectedPackage [ + + ^ packagesList selectedPackage +] + +{ #category : #'api - package selections' } +GtCoderNavigationBasicPackagesTagsClassesElement >> selectedPackageNodeDo: aBlock [ + ^ packagesList selectedPackageNodeDo: aBlock +] + +{ #category : #'api - package updates' } +GtCoderNavigationBasicPackagesTagsClassesElement >> selectedPackageOrTag [ + | aSelectedPackageOrTag | + packagesList selectedNodeDo: [ :aNode | aSelectedPackageOrTag := aNode value ]. + ^ aSelectedPackageOrTag +] + +{ #category : #'api - package selections' } +GtCoderNavigationBasicPackagesTagsClassesElement >> selectedPackageTag [ + + ^ packagesList selectedPackageTag +] + +{ #category : #'api - package selections' } +GtCoderNavigationBasicPackagesTagsClassesElement >> selectedPackageTagNodeDo: aBlock [ + ^ packagesList selectedPackageTagNodeDo: aBlock +] + +{ #category : #'showing / hiding' } +GtCoderNavigationBasicPackagesTagsClassesElement >> showClassList [ + classesList visibility: BlVisibility visible. + classesLabel visibility: BlVisibility visible +] + +{ #category : #subscriptions } +GtCoderNavigationBasicPackagesTagsClassesElement >> subscribeToContent [ + super subscribeToContent. + self subscribeToPackageList. + self subscribeToClassList. +] + +{ #category : #subscriptions } +GtCoderNavigationBasicPackagesTagsClassesElement >> subscribeToNavigationModel [ + | subscriptions | + self hasNavigationModel ifFalse: [ ^ self ]. + super subscribeToNavigationModel. + subscriptions := { + GtCoderNavigationPackagesSelected -> #onPackagesSelected:. + GtCoderNavigationPackageSelected -> #onPackageSelected:. + GtCoderNavigationPackageTagSelected -> #onPackageTagSelected:. + GtCoderNavigationPackageRegistered -> #onPackageRegistered:. + GtCoderNavigationPackageUnregistered -> #onPackageUnregistered:. + GtCoderNavigationPackageRenamed -> #onPackageRenamed:. + GtCoderNavigationPackageTagAdded -> #onPackageTagAdded:. + GtCoderNavigationPackageTagRemoved -> #onPackageTagRemoved:. + GtCoderNavigationPackageTagRenamed -> #onPackageTagRenamed:. + "Announcement when items selected" + "GtCoderNavigationClassSelected -> #onClassSelected:. <--- defined in the superclass" + "Announcements when we need to update items in the lists" + GtCodersFiltersChanged -> #onMethodsCoderFiltersChanged:. + }. + subscriptions + do: [ :sub | + navigationModel weak + when: sub key + send: sub value + to: self ] +] + +{ #category : #subscriptions } +GtCoderNavigationBasicPackagesTagsClassesElement >> subscribeToPackageList [ + packagesList + when: BrSelectionChanged + do: [ :anEvent | self onPackageListSelectionChanged ] +] + +{ #category : #'updating lists' } +GtCoderNavigationBasicPackagesTagsClassesElement >> updateClassList [ + self hasNavigationModel + ifFalse: [ ^ self ]. + + classesList initializeWithClasses: navigationModel classesToShow. + + navigationModel selectedClass + ifNotNil: [ :aClass | self selectClass: aClass ] +] + +{ #category : #'updating lists' } +GtCoderNavigationBasicPackagesTagsClassesElement >> updateContent [ + self updatePackageLists. + self updateClassList. +] + +{ #category : #'updating lists' } +GtCoderNavigationBasicPackagesTagsClassesElement >> updatePackageLists [ + self hasNavigationModel + ifFalse: [ ^ self ]. + + packagesList initializeWithPackages: navigationModel packagesToShow. + + navigationModel selectedPackage + ifNotNil: [ :aPackage | self selectPackage: aPackage tag: navigationModel selectedTag ] +] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index be1b3024d..17766605f 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -1,44 +1,18 @@ Class { #name : #GtCoderNavigationPackagesTagsClassesElement, - #superclass : #GtCoderNavigationElement, + #superclass : #GtCoderNavigationBasicPackagesTagsClassesElement, #traits : 'TGtCoderNavigationWithContextMenu', #classTraits : 'TGtCoderNavigationWithContextMenu classTrait', #instVars : [ - 'packagesList', 'methodProtocolsList', 'methodsLabel', 'methodGroupList', 'slotsGroup', - 'slotsGroupList', - 'classesLabel' + 'slotsGroupList' ], #category : #'GToolkit-Coder-UI-Navigation' } -{ #category : #'api - package updates' } -GtCoderNavigationPackagesTagsClassesElement >> addPackage: aPackage [ - | aSelectedPackageOrTag | - - packagesList selectedNodeDo: [ :aNode | - aSelectedPackageOrTag := aNode value ]. - - self updatePackageLists. - aSelectedPackageOrTag ifNotNil: [ - self selectPackageOrTag: aSelectedPackageOrTag ]. -] - -{ #category : #'api - package updates' } -GtCoderNavigationPackagesTagsClassesElement >> addPackage: aPackage tag: aPackageTag [ - | aSelectedPackageOrTag | - - packagesList selectedNodeDo: [ :aNode | - aSelectedPackageOrTag := aNode value ]. - - self updatePackageLists. - aSelectedPackageOrTag ifNotNil: [ - self selectPackageOrTag: aSelectedPackageOrTag ]. -] - { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> buildCategorySlotTabs [ | aTabGroup | @@ -84,56 +58,9 @@ GtCoderNavigationPackagesTagsClassesElement >> buildSlotsGroupList [ ^ GtCoderSlotsGroupedListElement new ] -{ #category : #'api - package selections' } -GtCoderNavigationPackagesTagsClassesElement >> deselectPackages [ - packagesList deselectAll -] - -{ #category : #'api - package selections' } -GtCoderNavigationPackagesTagsClassesElement >> expandPackage: aRPackage [ - packagesList viewModel root - allChildrenNodesBreadthFirstDo: [ :eachTreeNode | - eachTreeNode value = aRPackage - ifTrue: [ eachTreeNode expand ] ] -] - -{ #category : #'private - testing' } -GtCoderNavigationPackagesTagsClassesElement >> hasPackageTagsIn: aRPackage [ - - | noTags noExtensions | - noTags := (aRPackage classTags size = 1 and: [ aRPackage classTags anyOne name = aRPackage name ]). - noExtensions := aRPackage extendedClasses isEmpty. - ^ noTags not or: [ noExtensions not ] -] - -{ #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> headerLabel [ - | label | - label := BrLabel new. - label - aptitude: (BrGlamorousLabelAptitude new - fontSize: 12; - foreground: Color gray). - ^ label -] - -{ #category : #'showing / hiding' } -GtCoderNavigationPackagesTagsClassesElement >> hideClassList [ - classesLabel visibility: BlVisibility hidden. -] - -{ #category : #'showing / hiding' } -GtCoderNavigationPackagesTagsClassesElement >> hideOrShowClassList [ - classesList maxSelectionIndex isZero - ifTrue: [ self hideClassList ] - ifFalse: [ self showClassList ] -] - { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> initializeContent [ super initializeContent. - packagesList := GtCoderNavigationPackagesTreeElement new - padding: (BlInsets right: 10). methodProtocolsList := self buildProtocolGroupList. slotsGroupList := self buildSlotsGroupList. methodGroupList := self buildMethodGroupList @@ -141,18 +68,8 @@ GtCoderNavigationPackagesTagsClassesElement >> initializeContent [ { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> initializeElement [ - | pane1 pane2 pane3 pane4 | + | pane3 pane4 | super initializeElement. - pane1 := BrVerticalPane new - addAptitude: BrGlamorousWithHorizontalResizerAptitude; - matchParent; - addChildren: {self headerLabel text: 'Packages'. - packagesList}. - pane2 := BrVerticalPane new - addAptitude: BrGlamorousWithHorizontalResizerAptitude; - matchParent; - addChildren: {classesLabel := self headerLabel text: 'Classes'. - classesList}. pane3 := BrVerticalPane new addAptitude: BrGlamorousWithHorizontalResizerAptitude; matchParent; @@ -163,48 +80,15 @@ GtCoderNavigationPackagesTagsClassesElement >> initializeElement [ addChildren: {methodsLabel := self headerLabel text: 'Methods'. methodGroupList}. self - addChildren: {pane1. - pane2. - pane3. + addChildren: {pane3. pane4} ] -{ #category : #initialization } -GtCoderNavigationPackagesTagsClassesElement >> initializeLayout [ - super initializeLayout. - self layout: BlLinearLayout new beHorizontal. - self - constraintsDo: [ :c | - c horizontal matchParent. - c vertical matchParent ] -] - { #category : #'private - accessing' } GtCoderNavigationPackagesTagsClassesElement >> methodProtocolsList [ ^ methodProtocolsList ] -{ #category : #'event handling - selection' } -GtCoderNavigationPackagesTagsClassesElement >> onClassDeselected: anAnnouncement [ - self - suppressListChangeEventsDuring: [ self deselectClass: anAnnouncement theClass ] -] - -{ #category : #'event handling' } -GtCoderNavigationPackagesTagsClassesElement >> onClassRemoved: anAnnouncement [ - | aPackageOrTag | - self - inUIProcessDo: [ aPackageOrTag := self selectedPackageOrTag. - packagesList deselectAll. - self selectPackage: aPackageOrTag ] -] - -{ #category : #'event handling - selection' } -GtCoderNavigationPackagesTagsClassesElement >> onClassSelected: anAnnouncement [ - self - suppressListChangeEventsDuring: [ self selectClass: anAnnouncement theClass ] -] - { #category : #'event handling' } GtCoderNavigationPackagesTagsClassesElement >> onMethodsCoderFiltersChanged: aGtCodersFiltersChanged [ aGtCodersFiltersChanged source = self ifTrue: [ ^ self ]. @@ -239,328 +123,11 @@ GtCoderNavigationPackagesTagsClassesElement >> onNavigationModelChanged [ super onNavigationModelChanged ] -{ #category : #'event handling' } -GtCoderNavigationPackagesTagsClassesElement >> onPackageListSelectionChanged [ - | anIndex aSelectedItem theIndices | - supressListChanges ifTrue: [ ^ self ]. - theIndices := packagesList selectedIndices. - theIndices ifEmpty: [ ^ self ]. - anIndex := theIndices first. - (anIndex between: 1 and: packagesList viewModel itemCount) ifFalse: [ ^ self ]. - aSelectedItem := (packagesList viewModel itemAt: anIndex) value. - (aSelectedItem isKindOf: RPackage) - ifTrue: [ self navigationModel selectPackage: aSelectedItem ] - ifFalse: [ self navigationModel selectPackageTag: aSelectedItem ]. - self showClassList. - self deselectClasses -] - -{ #category : #'event handling' } -GtCoderNavigationPackagesTagsClassesElement >> onPackageRegistered: anAnnouncement [ - self - suppressListChangeEventsDuring: [ self addPackage: anAnnouncement package ] -] - -{ #category : #'event handling' } -GtCoderNavigationPackagesTagsClassesElement >> onPackageRenamed: anAnnouncement [ - self - suppressListChangeEventsDuring: [ self - renamePackage: anAnnouncement package - oldName: anAnnouncement oldName - newName: anAnnouncement newName ] -] - -{ #category : #'event handling' } -GtCoderNavigationPackagesTagsClassesElement >> onPackageSelected: anAnnouncer [ - self inUIProcessDo: [ self suppressListChangeEventsDuring: [ self selectPackage: anAnnouncer package ] ] -] - -{ #category : #'event handling' } -GtCoderNavigationPackagesTagsClassesElement >> onPackageTagAdded: anAnnouncement [ - self - suppressListChangeEventsDuring: [ self addPackage: anAnnouncement package tag: anAnnouncement tag ] -] - -{ #category : #'event handling' } -GtCoderNavigationPackagesTagsClassesElement >> onPackageTagRemoved: anAnnouncement [ - self - suppressListChangeEventsDuring: [ self removePackage: anAnnouncement package tag: anAnnouncement tag ] -] - -{ #category : #'event handling' } -GtCoderNavigationPackagesTagsClassesElement >> onPackageTagRenamed: anAnnouncement [ - self - suppressListChangeEventsDuring: [ self - renamePackageTag: anAnnouncement package - oldName: anAnnouncement oldName - newName: anAnnouncement newName ] -] - -{ #category : #'event handling - selection' } -GtCoderNavigationPackagesTagsClassesElement >> onPackageTagSelected: anAnnouncer [ - self - inUIProcessDo: [ self - suppressListChangeEventsDuring: [ self selectPackage: anAnnouncer package tag: anAnnouncer tag. - "self deselectClasses" ] ] -] - -{ #category : #'event handling' } -GtCoderNavigationPackagesTagsClassesElement >> onPackageUnregistered: anAnnouncement [ - self - suppressListChangeEventsDuring: [ self removePackage: anAnnouncement package ] -] - -{ #category : #'event handling - selection' } -GtCoderNavigationPackagesTagsClassesElement >> onPackagesSelected: anAnnouncer [ - self - inUIProcessDo: [ self - suppressListChangeEventsDuring: [ self deselectPackages. - self deselectClasses ] ] -] - -{ #category : #'api - package updates' } -GtCoderNavigationPackagesTagsClassesElement >> removePackage: aPackage [ - | aSelectedPackageOrTag anIndex | - anIndex := packagesList viewModel indexOf: aPackage. - anIndex > 0 ifFalse: [ ^ self ]. - aSelectedPackageOrTag := self selectedPackageOrTag. - - self updatePackageLists. - self - reselectPackageOrTag: aSelectedPackageOrTag - afterRemovalOfPackageNamed: aPackage name -] - -{ #category : #'api - package updates' } -GtCoderNavigationPackagesTagsClassesElement >> removePackage: aPackage tag: aPackageTagName [ - | aSelectedPackageOrTag anIndex | - anIndex := packagesList viewModel indexOf: aPackage. - anIndex > 0 ifFalse: [ ^ self ]. - packagesList selectedNodeDo: [ :aNode | - aSelectedPackageOrTag := aNode value ]. - self updatePackageLists. - self reselectPackageOrTag: aSelectedPackageOrTag afterRemovalOfTagNamed: aPackageTagName. -] - -{ #category : #'api - package updates' } -GtCoderNavigationPackagesTagsClassesElement >> renamePackage: aPackage oldName: anOldName newName: aNewName [ - | aSelectedPackageOrTag | - - packagesList selectedNodeDo: [ :aNode | - aSelectedPackageOrTag := aNode value ]. - - self updatePackageLists. - aSelectedPackageOrTag ifNotNil: [ - self selectPackageOrTag: aSelectedPackageOrTag ]. -] - -{ #category : #'api - package updates' } -GtCoderNavigationPackagesTagsClassesElement >> renamePackageTag: aPackageTag oldName: anOldName newName: aNewName [ - | aSelectedPackageOrTag | - - packagesList selectedNodeDo: [ :aNode | - aSelectedPackageOrTag := aNode value ]. - - self updatePackageLists. - aSelectedPackageOrTag ifNotNil: [ - self selectPackageOrTag: aSelectedPackageOrTag ]. -] - -{ #category : #'api - package reselections' } -GtCoderNavigationPackagesTagsClassesElement >> reselectPackageOrTag: aSelectedPackageOrTag afterRemovalOfPackageNamed: aRemovedPackageOrTagName [ - aSelectedPackageOrTag ifNotNil: [ - self deselectPackages. - aSelectedPackageOrTag name = aRemovedPackageOrTagName - ifTrue: [ - self hideClassList ] - ifFalse: [ - self selectPackageOrTag: aSelectedPackageOrTag ] ] -] - -{ #category : #'api - package reselections' } -GtCoderNavigationPackagesTagsClassesElement >> reselectPackageOrTag: aSelectedPackageOrTag afterRemovalOfTagNamed: aRemovedTagName [ - aSelectedPackageOrTag - ifNotNil: [ self deselectPackages. - (aSelectedPackageOrTag name sameContentAs: aRemovedTagName) - ifTrue: [ self expandPackage: aSelectedPackageOrTag package. - self hideClassList ] - ifFalse: [ self selectPackageOrTag: aSelectedPackageOrTag ] ] -] - -{ #category : #'api - class selections' } -GtCoderNavigationPackagesTagsClassesElement >> selectClass: aClass inPackage: aPackage tag: aPackageTag [ - self selectedPackage ~= aPackage - ifTrue: [ self selectPackage: aPackage tag: aPackageTag ]. - - self selectClass: aClass. - self updateProtocolList. - self updateSlotList -] - -{ #category : #'api - package selections' } -GtCoderNavigationPackagesTagsClassesElement >> selectPackage: aPackage [ - | aPreviousIndex | - - self expandPackage: aPackage. - aPreviousIndex := packagesList selectedIndice. - - packagesList deselectAll. - packagesList viewModel - indexOf: aPackage - do: [ :aNewIndex | - packagesList - selectOne: aNewIndex; - scrollToIndex: - (self - scrollIndexFromPrevious: aPreviousIndex - current: aNewIndex - max: packagesList viewModel itemCount) ]. -] - -{ #category : #'api - package selections' } -GtCoderNavigationPackagesTagsClassesElement >> selectPackage: aPackage tag: aPackageTag [ - | aPreviousIndex | - (self hasPackageTagsIn: aPackage) ifFalse: [ ^ self selectPackage: aPackage ]. - aPackageTag isNil ifTrue: [ ^ self selectPackage: aPackage ]. - - packagesList deselectAll. - self expandPackage: aPackage. - - aPreviousIndex := packagesList selectedIndice. - packagesList viewModel - indexOf: aPackageTag - do: [ :aNewIndex | - packagesList - selectOne: aNewIndex; - scrollToIndex: (self - scrollIndexFromPrevious: aPreviousIndex - current: aNewIndex - max: packagesList viewModel itemCount) ] -] - -{ #category : #'api - package selections' } -GtCoderNavigationPackagesTagsClassesElement >> selectPackageOrTag: aPackageOrTag [ - (aPackageOrTag isKindOf: RPackage) - ifTrue: [ self selectPackage: aPackageOrTag ] - ifFalse: [ self selectPackage: aPackageOrTag package tag: aPackageOrTag ] -] - -{ #category : #'api - class selections' } -GtCoderNavigationPackagesTagsClassesElement >> selectedClass [ - - ^ classesList selectedClass -] - -{ #category : #'api - package selections' } -GtCoderNavigationPackagesTagsClassesElement >> selectedPackage [ - - ^ packagesList selectedPackage -] - -{ #category : #'api - package selections' } -GtCoderNavigationPackagesTagsClassesElement >> selectedPackageNodeDo: aBlock [ - ^ packagesList selectedPackageNodeDo: aBlock -] - -{ #category : #'api - package updates' } -GtCoderNavigationPackagesTagsClassesElement >> selectedPackageOrTag [ - | aSelectedPackageOrTag | - packagesList selectedNodeDo: [ :aNode | aSelectedPackageOrTag := aNode value ]. - ^ aSelectedPackageOrTag -] - -{ #category : #'api - package selections' } -GtCoderNavigationPackagesTagsClassesElement >> selectedPackageTag [ - - ^ packagesList selectedPackageTag -] - -{ #category : #'api - package selections' } -GtCoderNavigationPackagesTagsClassesElement >> selectedPackageTagNodeDo: aBlock [ - ^ packagesList selectedPackageTagNodeDo: aBlock -] - { #category : #'private - accessing' } GtCoderNavigationPackagesTagsClassesElement >> selectedProtocol [ ^ self navigationModel selectedProtocol ] -{ #category : #'showing / hiding' } -GtCoderNavigationPackagesTagsClassesElement >> showClassList [ - classesList visibility: BlVisibility visible. - classesLabel visibility: BlVisibility visible -] - -{ #category : #subscriptions } -GtCoderNavigationPackagesTagsClassesElement >> subscribeToContent [ - super subscribeToContent. - self subscribeToPackageList. - self subscribeToClassList. -] - -{ #category : #subscriptions } -GtCoderNavigationPackagesTagsClassesElement >> subscribeToNavigationModel [ - | subscriptions | - self hasNavigationModel ifFalse: [ ^ self ]. - super subscribeToNavigationModel. - subscriptions := { - GtCoderNavigationPackagesSelected -> #onPackagesSelected:. - GtCoderNavigationPackageSelected -> #onPackageSelected:. - GtCoderNavigationPackageTagSelected -> #onPackageTagSelected:. - GtCoderNavigationPackageRegistered -> #onPackageRegistered:. - GtCoderNavigationPackageUnregistered -> #onPackageUnregistered:. - GtCoderNavigationPackageRenamed -> #onPackageRenamed:. - GtCoderNavigationPackageTagAdded -> #onPackageTagAdded:. - GtCoderNavigationPackageTagRemoved -> #onPackageTagRemoved:. - GtCoderNavigationPackageTagRenamed -> #onPackageTagRenamed:. - "Announcement when items selected" - "GtCoderNavigationClassSelected -> #onClassSelected:. <--- defined in the superclass" - "Announcements when we need to update items in the lists" - GtCodersFiltersChanged -> #onMethodsCoderFiltersChanged:. - }. - subscriptions - do: [ :sub | - navigationModel weak - when: sub key - send: sub value - to: self ] -] - -{ #category : #subscriptions } -GtCoderNavigationPackagesTagsClassesElement >> subscribeToPackageList [ - packagesList - when: BrSelectionChanged - do: [ :anEvent | self onPackageListSelectionChanged ] -] - -{ #category : #'updating lists' } -GtCoderNavigationPackagesTagsClassesElement >> updateClassList [ - self hasNavigationModel - ifFalse: [ ^ self ]. - - classesList initializeWithClasses: navigationModel classesToShow. - - navigationModel selectedClass - ifNotNil: [ :aClass | self selectClass: aClass ] -] - -{ #category : #'updating lists' } -GtCoderNavigationPackagesTagsClassesElement >> updateContent [ - self updatePackageLists. - self updateClassList. -] - -{ #category : #'updating lists' } -GtCoderNavigationPackagesTagsClassesElement >> updatePackageLists [ - self hasNavigationModel - ifFalse: [ ^ self ]. - - packagesList initializeWithPackages: navigationModel packagesToShow. - - navigationModel selectedPackage - ifNotNil: [ :aPackage | self selectPackage: aPackage tag: navigationModel selectedTag ] -] - { #category : #'updating lists' } GtCoderNavigationPackagesTagsClassesElement >> updateProtocolList [ methodProtocolsList updateProtocolsList diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index dddf4b9f3..c3c9a08a3 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -175,10 +175,23 @@ GtCoderNavigationTabsStencil >> gtCreationInterface: look [ ^ contentTabs ] +{ #category : #'gt-extensions' } +GtCoderNavigationTabsStencil >> gtPackagesTagsClassesDropdownFor: aView [ + + | explicitView | + self navigationModel ifNil: [ ^ aView empty ]. + explicitView := aView explicit + title: 'Package Hierarchy'; + priority: 1; + stencil: [ GtCoderNavigationBasicPackagesTagsClassesElement new + navigationModel: self navigationModel ]. + self addButtonsTo: explicitView. + ^ explicitView +] + { #category : #'gt-extensions' } GtCoderNavigationTabsStencil >> gtPackagesTagsClassesFor: aView [ - | explicitView | self navigationModel ifNil: [ ^ aView empty ]. explicitView := aView explicit From 07ca6a79a7795bed617ecd63a26e3f35114c407a Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 20 Nov 2024 15:32:05 -0300 Subject: [PATCH 0788/1268] make the navigation dropdown widget configurable [feenkcom/gtoolkit#4184] It can display (i) only packages and classes; or (ii) that plus method protocols, variables, and methods. --- .../GtCoderNavigationTabsStencil.class.st | 42 +++++++++++++++++-- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index c3c9a08a3..ec3521aac 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -7,9 +7,32 @@ Class { 'formCache', 'pragmaName' ], + #classVars : [ + 'DisplayFullDropdownNavigation' + ], #category : #'GToolkit-Coder-UI-Navigation' } +{ #category : #configuration } +GtCoderNavigationTabsStencil class >> beBasicDropdownNavigation [ + DisplayFullDropdownNavigation := false +] + +{ #category : #configuration } +GtCoderNavigationTabsStencil class >> beFullDropdownNavigation [ + DisplayFullDropdownNavigation := true +] + +{ #category : #initialization } +GtCoderNavigationTabsStencil class >> initialize [ + self beFullDropdownNavigation +] + +{ #category : #testing } +GtCoderNavigationTabsStencil class >> isFullDropdownNavigation [ + ^ DisplayFullDropdownNavigation ifNil: [ true ] +] + { #category : #'gt-extensions' } GtCoderNavigationTabsStencil >> addButtonsTo: explicitView [ explicitView @@ -107,8 +130,11 @@ GtCoderNavigationTabsStencil >> gtClassDropdownHierarchyFor: aView [ explicitView := aView explicit title: 'Class Hierarchy'; priority: 2; - stencil: [ GtCoderNavigationBasicClassHierarchyElement new - navigationModel: self navigationModel ]. + stencil: [ self isFullDropdownNavigation + ifTrue: [ GtCoderNavigationClassHierarchyElement new + navigationModel: self navigationModel ] + ifFalse: [ GtCoderNavigationBasicClassHierarchyElement new + navigationModel: self navigationModel ] ]. self addButtonsTo: explicitView. ^ explicitView ] @@ -183,8 +209,11 @@ GtCoderNavigationTabsStencil >> gtPackagesTagsClassesDropdownFor: aView [ explicitView := aView explicit title: 'Package Hierarchy'; priority: 1; - stencil: [ GtCoderNavigationBasicPackagesTagsClassesElement new - navigationModel: self navigationModel ]. + stencil: [ self isFullDropdownNavigation + ifTrue: [ GtCoderNavigationPackagesTagsClassesElement new + navigationModel: self navigationModel ] + ifFalse: [ GtCoderNavigationBasicPackagesTagsClassesElement new + navigationModel: self navigationModel ] ]. self addButtonsTo: explicitView. ^ explicitView ] @@ -208,6 +237,11 @@ GtCoderNavigationTabsStencil >> initialize [ formCache := Dictionary new. ] +{ #category : #testing } +GtCoderNavigationTabsStencil >> isFullDropdownNavigation [ + ^ self class isFullDropdownNavigation +] + { #category : #accessing } GtCoderNavigationTabsStencil >> navigationModel [ From 08b6d260974025f39ff8661db6924207fa8da496 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 20 Nov 2024 16:32:54 -0300 Subject: [PATCH 0789/1268] Set default `GtPharoCoderHierarchyDropdownConfiguration class>>#preferredExtent` value to `800 @ 400` --- .../GtPharoCoderHierarchyDropdownConfiguration.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtPharoCoderHierarchyDropdownConfiguration.class.st b/src/GToolkit-Coder-UI/GtPharoCoderHierarchyDropdownConfiguration.class.st index 9024cec90..557e58a73 100644 --- a/src/GToolkit-Coder-UI/GtPharoCoderHierarchyDropdownConfiguration.class.st +++ b/src/GToolkit-Coder-UI/GtPharoCoderHierarchyDropdownConfiguration.class.st @@ -30,7 +30,7 @@ GtPharoCoderHierarchyDropdownConfiguration class >> gtConfigurationFor: aView [ { #category : #accessing } GtPharoCoderHierarchyDropdownConfiguration class >> preferredExtent [ - ^ preferredExtent ifNil: [ preferredExtent := 400 @ 400 ] + ^ preferredExtent ifNil: [ preferredExtent := 800 @ 400 ] ] { #category : #accessing } From 7b451c4ae0cdce2b3da16c778343f7a4a8910949 Mon Sep 17 00:00:00 2001 From: John Brant Date: Wed, 20 Nov 2024 15:06:44 -0600 Subject: [PATCH 0790/1268] adding interval to the evaluated attributed --- ...tPlaygroundEvaluatedCodeButtonAttribute.class.st | 13 ++++++++++++- .../GtSourceCoderEvaluationHighlighter.class.st | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st b/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st index dfb767754..9fbc91281 100644 --- a/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st @@ -4,7 +4,8 @@ Class { #instVars : [ 'result', 'action', - 'coder' + 'coder', + 'evaluationInterval' ], #category : #'GToolkit-Coder-UI-Coder - Source Attributes' } @@ -67,6 +68,16 @@ GtPlaygroundEvaluatedCodeButtonAttribute >> coder: anObject [ coder := anObject ] +{ #category : #accessing } +GtPlaygroundEvaluatedCodeButtonAttribute >> evaluationInterval [ + ^ evaluationInterval +] + +{ #category : #accessing } +GtPlaygroundEvaluatedCodeButtonAttribute >> evaluationInterval: anObject [ + evaluationInterval := anObject +] + { #category : #initialization } GtPlaygroundEvaluatedCodeButtonAttribute >> initialize [ super initialize. diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEvaluationHighlighter.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEvaluationHighlighter.class.st index 49bc18175..342c17d20 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEvaluationHighlighter.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEvaluationHighlighter.class.st @@ -14,6 +14,7 @@ GtSourceCoderEvaluationHighlighter >> addAttributesFor: anEvaluationResult withi aResultButtonAttribute := GtPlaygroundEvaluatedCodeButtonAttribute new result: anEvaluationResult value; coder: anEvaluationResult sourceCoder; + evaluationInterval: aTextInterval; beNotOverwritableByStyler. "Pass the coder to get the spawn destination" (self text from: aTextInterval last to: aTextInterval last) From fad44e3ee7147a99e2bebe5e7a20a7409b0c08de Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 21 Nov 2024 19:41:56 +0100 Subject: [PATCH 0791/1268] [feenkcom/gtoolkit#4191] add Geometry suffix to geometry classes --- src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st | 1 - src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st | 2 +- .../GtCoderExpanderWithoutShadowAptitude.class.st | 4 ++-- src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st | 7 ++++--- src/GToolkit-Coder-UI/GtDiffElement.class.st | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index 7cf0e6ad1..2eab64308 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -237,7 +237,6 @@ GtCoderClassesTreeElement >> initializeWithClasses: aCollectionOfClasses [ | newTree | newTree := (GtCoderClassesHierarchyTree fromClasses: aCollectionOfClasses) sortByClassName. - newTree = classesTree ifTrue: [ ^ self ]. classesTree := newTree. self items: classesTree subclassTrees diff --git a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st index a5378d996..c6ad482b9 100644 --- a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st @@ -87,7 +87,7 @@ GtCoderExampleStateElement >> initialize [ self layout: BlLinearLayout horizontal; - geometry: BlSquare new; + geometry: BlSquareGeometry new; margin: (BlInsets all: 1); exact: 12@12. diff --git a/src/GToolkit-Coder-UI/GtCoderExpanderWithoutShadowAptitude.class.st b/src/GToolkit-Coder-UI/GtCoderExpanderWithoutShadowAptitude.class.st index 8a0881d81..575a7316c 100644 --- a/src/GToolkit-Coder-UI/GtCoderExpanderWithoutShadowAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExpanderWithoutShadowAptitude.class.st @@ -126,7 +126,7 @@ GtCoderExpanderWithoutShadowAptitude >> initialize [ { #category : #'private - instance creation' } GtCoderExpanderWithoutShadowAptitude >> newCollapsedTriangleGeometry [ - ^ BlPolygon vertices: { + ^ BlPolygonGeometry vertices: { (0 @ 0). (8 @ 4). (0 @ 8) @@ -135,7 +135,7 @@ GtCoderExpanderWithoutShadowAptitude >> newCollapsedTriangleGeometry [ { #category : #'private - instance creation' } GtCoderExpanderWithoutShadowAptitude >> newExpandedTriangleGeometry [ - ^ BlPolygon vertices: { + ^ BlPolygonGeometry vertices: { (0 @ 0). (8 @ 0). (4 @ 8) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st index 4060b8102..1589aea95 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st @@ -120,14 +120,14 @@ GtCoderNavigationElement >> onClassRemoved: anAnnouncement [ { #category : #'event handling' } GtCoderNavigationElement >> onClassRenamed: anAnnouncement [ - self + "self inUIProcessDo: [ self suppressListChangeEventsDuring: [ self renameClass: anAnnouncement theClass oldName: anAnnouncement oldName newName: anAnnouncement newName inPackage: anAnnouncement package - tag: anAnnouncement tag ] ] + tag: anAnnouncement tag ] ]" ] { #category : #'event handling' } @@ -137,7 +137,8 @@ GtCoderNavigationElement >> onClassSelected: anAnnouncement [ { #category : #'event handling' } GtCoderNavigationElement >> onClassesToShowChanged: anAnnouncement [ - self updateClassList + "Refactorings that are executed from a non-UI process should schedule an update task" + self inUIProcessDo: [ self updateClassList ] ] { #category : #'event handling' } diff --git a/src/GToolkit-Coder-UI/GtDiffElement.class.st b/src/GToolkit-Coder-UI/GtDiffElement.class.st index 1d6ebebb7..063cc969e 100644 --- a/src/GToolkit-Coder-UI/GtDiffElement.class.st +++ b/src/GToolkit-Coder-UI/GtDiffElement.class.st @@ -325,7 +325,7 @@ GtDiffElement >> outlineFor: aSyncScrollRange [ add: leftBounds right @ leftBottom; add: leftBounds left @ leftBottom; add: leftBounds left @ leftTop. - ^ BlPolyline vertices: vertices + ^ BlPolylineGeometry vertices: vertices ] { #category : #'event handling' } From dbd43d22797dc3a58f0689e8fbb218e6f75803d2 Mon Sep 17 00:00:00 2001 From: John Brant Date: Fri, 22 Nov 2024 06:32:22 -0600 Subject: [PATCH 0792/1268] highlight evaluated code when hovering evaluated code button --- ...PlaygroundEvaluatedCodeButtonAttribute.class.st | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st b/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st index 9fbc91281..231cd167e 100644 --- a/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st @@ -23,9 +23,10 @@ GtPlaygroundEvaluatedCodeButtonAttribute >> action: aBlock [ { #category : #initialization } GtPlaygroundEvaluatedCodeButtonAttribute >> affect: aTBrTextEditorTextualPiece in: anEditorElement [ - | aButton | + | aButton hoverAttribute | aButton := BrButton new. - + hoverAttribute := BlTextHighlightAttribute + paint: BrGlamorousColors textHighlightColor. ^ aButton aptitude: (BrLazyStyleCommonAptitude new default: [ :aStyle | aStyle background: BrGlamorousColors defaultButtonBorderColor ]; @@ -50,6 +51,15 @@ GtPlaygroundEvaluatedCodeButtonAttribute >> affect: aTBrTextEditorTextualPiece i geometry: BlEllipseGeometry new; margin: (BlInsets left: 2 right: 2); action: [ :aButtonElement :aButtonModel :anEvent | self clickEvent: anEvent from: aButtonElement ]; + when: BlMouseEnterEvent + do: [ :anEvent | + evaluationInterval + ifNotNil: [ (anEditorElement text + from: (evaluationInterval first min: anEditorElement text size) + to: (evaluationInterval last min: anEditorElement text size)) + attribute: hoverAttribute ] ]; + when: BlMouseLeaveEvent + do: [ :anEvent | anEditorElement text clearAttributes: [ :each | each == hoverAttribute ] ]; yourself ] From f382df06753ed2423e913c0ad16ab3cb0a38ce96 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 22 Nov 2024 09:42:26 -0600 Subject: [PATCH 0793/1268] Remove unused instance variable --- src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st | 1 - 1 file changed, 1 deletion(-) diff --git a/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st b/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st index 36615c447..e989062b5 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st @@ -5,7 +5,6 @@ Class { 'cursorLocation', 'selectAll', 'filter', - 'editorShortcuts', 'requestInitialFocus', 'styler', 'coordinateFocus', From e0eb779acdf62a5fb2cbec790e86628920caa880 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Sat, 23 Nov 2024 11:58:00 +0100 Subject: [PATCH 0794/1268] [feenkcom/gtoolkit#4198] make source text computation synchronous --- ...gationPackagesListElementExamples.class.st | 2 +- ...erListEmbeddedRenameEditorElement.class.st | 158 ++++++++++++++++++ ...onBasicPackagesTagsClassesElement.class.st | 2 +- ...st => GtCoderPackagesTreeElement.class.st} | 123 ++++++++++---- ...> GtCoderPackagesTreeItemElement.class.st} | 18 +- .../GtCoderPackagesTreeRenameEditor.class.st | 15 ++ ...GtCoderProtocolsGroupRenameEditor.class.st | 15 ++ ...tCoderProtocolsGroupedListElement.class.st | 93 +---------- .../GtExpandableSourceCoderElement.class.st | 2 +- .../GtTextualCoderEditorElement.class.st | 2 +- .../GtTextualCoderViewModel.class.st | 47 +++--- .../GtCoderCompiledMethodTextSource.class.st | 8 +- .../GtCoderExplicitStringSource.class.st | 8 +- .../GtCoderExplicitTextSource.class.st | 8 +- .../GtCoderFutureTextSource.class.st | 23 --- src/GToolkit-Coder/GtCoderTextSource.class.st | 76 ++++----- src/GToolkit-Coder/GtTextualCoder.class.st | 34 ++-- 17 files changed, 378 insertions(+), 256 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderListEmbeddedRenameEditorElement.class.st rename src/GToolkit-Coder-UI/{GtCoderNavigationPackagesTreeElement.class.st => GtCoderPackagesTreeElement.class.st} (65%) rename src/GToolkit-Coder-UI/{GtCoderNavigationPackagesTreeItemElement.class.st => GtCoderPackagesTreeItemElement.class.st} (56%) create mode 100644 src/GToolkit-Coder-UI/GtCoderPackagesTreeRenameEditor.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderProtocolsGroupRenameEditor.class.st delete mode 100644 src/GToolkit-Coder/GtCoderFutureTextSource.class.st diff --git a/src/GToolkit-Coder-Examples/GtCoderNavigationPackagesListElementExamples.class.st b/src/GToolkit-Coder-Examples/GtCoderNavigationPackagesListElementExamples.class.st index 0c2226454..b6e0756a8 100644 --- a/src/GToolkit-Coder-Examples/GtCoderNavigationPackagesListElementExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtCoderNavigationPackagesListElementExamples.class.st @@ -8,5 +8,5 @@ Class { GtCoderNavigationPackagesListElementExamples >> fromAllPackages [ - ^ GtCoderNavigationPackagesTreeElement fromPackages: RPackageOrganizer default packages + ^ GtCoderPackagesTreeElement fromPackages: RPackageOrganizer default packages ] diff --git a/src/GToolkit-Coder-UI/GtCoderListEmbeddedRenameEditorElement.class.st b/src/GToolkit-Coder-UI/GtCoderListEmbeddedRenameEditorElement.class.st new file mode 100644 index 000000000..f09ed8340 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderListEmbeddedRenameEditorElement.class.st @@ -0,0 +1,158 @@ +Class { + #name : #GtCoderListEmbeddedRenameEditorElement, + #superclass : #BrHorizontalPane, + #instVars : [ + 'itemToRename', + 'ghostText', + 'editorElement', + 'renameAction', + 'endRenameAction' + ], + #category : #'GToolkit-Coder-UI-Navigation - Helpers' +} + +{ #category : #initialization } +GtCoderListEmbeddedRenameEditorElement >> createAcceptButton [ + ^ BrButton new + beTinySize; + margin: (BlInsets left: 5 right: 2); + aptitude: (BrGlamorousButtonRectangularAptitude paddingScale: 0.5) + + BrGlamorousButtonIconAptitude + + (BrGlamorousButtonFlatExteriorAptitude new + backgroundPaint: (BrGlamorousColors neutralBackgroundColor); + hoveredBackgroundPaint: (BrGlamorousColors secondaryHeaderBackgroundColor)) + + BrGlamorousButtonWithLabelTooltipAptitude; + icon: BrGlamorousVectorIcons accept; + label: 'Rename protocol'; + action: [ self privatePerformRename ] +] + +{ #category : #initialization } +GtCoderListEmbeddedRenameEditorElement >> createCancelButton [ + ^ BrButton new + beTinySize; + margin: (BlInsets left: 2 right: 2); + aptitude: (BrGlamorousButtonRectangularAptitude paddingScale: 0.5) + + BrGlamorousButtonIconAptitude + + (BrGlamorousButtonFlatExteriorAptitude new + backgroundPaint: (BrGlamorousColors neutralBackgroundColor); + hoveredBackgroundPaint: (BrGlamorousColors secondaryHeaderBackgroundColor)) + + BrGlamorousButtonWithLabelTooltipAptitude; + icon: BrGlamorousVectorIcons cancel; + label: 'Cancel'; + action: [ self privateEndRename ] +] + +{ #category : #'private - actions' } +GtCoderListEmbeddedRenameEditorElement >> createCompleterStrategy [ + ^ self subclassResponsibility +] + +{ #category : #initialization } +GtCoderListEmbeddedRenameEditorElement >> createEditorElement [ + | aEditorElement aCompleter | + + aEditorElement := BrEditor new + aptitude: BrGlamorousRegularEditorAptitude new glamorousRegularSmallSize + + BrGlamorousInputFieldSpacingAptitude; + beMode: BrTextEditorEditableSingleLineMode new; + geometry: (BlRoundedRectangleGeometry cornerRadius: 4); + padding: (BlInsets + top: 2 + left: 5 + bottom: 2 + right: 5); + hMatchParent; + vFitContent; + text: ''; + requestFocus. + + aCompleter := GtCompletionController + on: aEditorElement + strategy: self createCompleterStrategy. + + aCompleter install. + + aEditorElement + addEditorShortcut: (BlShortcutWithAction new + combination: BlKeyCombination escape; + action: [ :anEvent | self privateEndRename ]). + + aEditorElement + addEditorShortcut: (BlShortcutWithAction new + combination: BlKeyCombination enter; + action: [ :anEvent | self privatePerformRename ]). + + ^ aEditorElement +] + +{ #category : #initialization } +GtCoderListEmbeddedRenameEditorElement >> createGhostTestAttribute [ + ^ BrGhostTextAttribute + for: (ghostText asRopedText glamorousFormEditorCodeFontAndSize + foreground: Color lightGray) +] + +{ #category : #accessing } +GtCoderListEmbeddedRenameEditorElement >> endRenameAction: aBlock [ + endRenameAction := aBlock +] + +{ #category : #initialization } +GtCoderListEmbeddedRenameEditorElement >> initialize [ + | anAcceptButton aCancelButton | + super initialize. + + self alignCenterLeft; + hMatchParent; + vFitContent. + + ghostText := 'new name'. + renameAction := [ :anItemToRename :aNewName | ]. + endRenameAction := [ :anItemToRename | ]. + + editorElement := self createEditorElement. + anAcceptButton := self createAcceptButton. + aCancelButton := self createCancelButton. + + self addChildren: { editorElement . anAcceptButton . aCancelButton }. +] + +{ #category : #'private - actions' } +GtCoderListEmbeddedRenameEditorElement >> itemLabelOf: anItemToRename [ + ^ self subclassResponsibility +] + +{ #category : #accessing } +GtCoderListEmbeddedRenameEditorElement >> itemToRename: anItemToRename [ + | anItemText | + + itemToRename := anItemToRename. + anItemText := (self itemLabelOf: itemToRename) asRopedText attribute: self createGhostTestAttribute. + + editorElement text: anItemText. + editorElement navigator moveToEnd apply. + editorElement selecter all select. +] + +{ #category : #'private - actions' } +GtCoderListEmbeddedRenameEditorElement >> privateEndRename [ + endRenameAction cull: itemToRename +] + +{ #category : #'private - actions' } +GtCoderListEmbeddedRenameEditorElement >> privatePerformRename [ + "Performs a rename protocol action and updates UI removing a protocol editor" + | aNewName | + + aNewName := editorElement text asString trimmed. + + renameAction cull: itemToRename cull: aNewName. + + self privateEndRename +] + +{ #category : #accessing } +GtCoderListEmbeddedRenameEditorElement >> renameAction: aBlock [ + renameAction := aBlock +] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationBasicPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationBasicPackagesTagsClassesElement.class.st index 3a32bb63d..75e6612a2 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationBasicPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationBasicPackagesTagsClassesElement.class.st @@ -80,7 +80,7 @@ GtCoderNavigationBasicPackagesTagsClassesElement >> hideOrShowClassList [ { #category : #initialization } GtCoderNavigationBasicPackagesTagsClassesElement >> initializeContent [ super initializeContent. - packagesList := GtCoderNavigationPackagesTreeElement new + packagesList := GtCoderPackagesTreeElement new padding: (BlInsets right: 10). ] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st similarity index 65% rename from src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st rename to src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st index f73d085e5..acdb1e7de 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st @@ -4,20 +4,24 @@ I show a simple list of packages sorting alphabetically " Class { - #name : #GtCoderNavigationPackagesTreeElement, + #name : #GtCoderPackagesTreeElement, #superclass : #BrSimpleTree, #traits : 'TGtCoderNavigationWithContextMenu', #classTraits : 'TGtCoderNavigationWithContextMenu classTrait', - #category : #'GToolkit-Coder-UI-Navigation' + #instVars : [ + 'packageToRename', + 'renamingEditor' + ], + #category : #'GToolkit-Coder-UI-Navigation - Helpers' } { #category : #'instance creation' } -GtCoderNavigationPackagesTreeElement class >> fromPackages: aCollectionOfPackages [ +GtCoderPackagesTreeElement class >> fromPackages: aCollectionOfPackages [ ^ self new initializeWithPackages: aCollectionOfPackages ] { #category : #initialization } -GtCoderNavigationPackagesTreeElement >> buildRemovePackageLabelFor: aPackage [ +GtCoderPackagesTreeElement >> buildRemovePackageLabelFor: aPackage [ | labelText | labelText := 'Remove package <1s>' expandMacrosWith: aPackage name. ^ BrLabel new @@ -27,7 +31,7 @@ GtCoderNavigationPackagesTreeElement >> buildRemovePackageLabelFor: aPackage [ ] { #category : #initialization } -GtCoderNavigationPackagesTreeElement >> buildRemoveTagLabelFor: aTag [ +GtCoderPackagesTreeElement >> buildRemoveTagLabelFor: aTag [ | labelText | labelText := 'Remove package <1s>' expandMacrosWith: aTag name. ^ BrLabel new @@ -37,7 +41,7 @@ GtCoderNavigationPackagesTreeElement >> buildRemoveTagLabelFor: aTag [ ] { #category : #'private - enumeration' } -GtCoderNavigationPackagesTreeElement >> childrenForPackageOrTag: aPackageOrTag [ +GtCoderPackagesTreeElement >> childrenForPackageOrTag: aPackageOrTag [ | theTags anExtension | (aPackageOrTag isKindOf: RPackage) ifFalse: [ ^ #() ]. theTags := aPackageOrTag classTags asOrderedCollection. @@ -56,52 +60,84 @@ GtCoderNavigationPackagesTreeElement >> childrenForPackageOrTag: aPackageOrTag [ ] { #category : #initialization } -GtCoderNavigationPackagesTreeElement >> contextMenuItemsFor: aPackageOrTag [ +GtCoderPackagesTreeElement >> contextMenuItemsFor: aPackageOrTag [ | items | items := {(self createLabel: 'New package / tag' description: '') -> [ :elem | self newPackage ]} asOrderedCollection. aPackageOrTag class == RPackage ifTrue: [ items addAll: {(self createLabel: 'Rename package' description: aPackageOrTag name) - -> [ :elem | self renamePackage: aPackageOrTag inElement: elem ]. + -> [ :elem | self requestRenamePackage: aPackageOrTag ]. (self createLabel: 'Remove package' description: aPackageOrTag name) -> [ :elem | self removePackage: aPackageOrTag inElement: elem ]} ] ifFalse: [ items addAll: {(self createLabel: 'Rename tag' description: aPackageOrTag name) - -> [ :elem | self renameTag: aPackageOrTag inElement: elem ]. + -> [ :elem | self requestRenamePackage: aPackageOrTag ]. (self createLabel: 'Remove tag' description: aPackageOrTag name) -> [ :elem | self removeTag: aPackageOrTag inElement: elem ]} ]. ^ items ] +{ #category : #'as yet unclassified' } +GtCoderPackagesTreeElement >> createRenamePackageForm: aPackageOrTag [ + ^ GtCoderPackagesTreeRenameEditor new + itemToRename: aPackageOrTag; + renameAction: [ :anItemToRename :aNewName | + (anItemToRename isKindOf: RPackage) + ifTrue: [ + (GtRBRenamePackageRefactoring + from: anItemToRename name + to: aNewName) + execute ]. + (anItemToRename isKindOf: RPackageTag) + ifTrue: [ + (GtRBRenamePackageTagRefactoring + packageName: anItemToRename package name + from: anItemToRename name + to: aNewName) + execute ] ]; + endRenameAction: [ self privateEndRenamePackage ] +] + { #category : #initialization } -GtCoderNavigationPackagesTreeElement >> demotePackage: aPackageOrTag inElement: elem [ +GtCoderPackagesTreeElement >> demotePackage: aPackageOrTag inElement: elem [ self notYetImplemented ] { #category : #initialization } -GtCoderNavigationPackagesTreeElement >> initialize [ +GtCoderPackagesTreeElement >> initialize [ super initialize. self rowStencil: BrGlamorousSimpleTreeSelectableRowElementStencilBuilder new. self - nodeStencil: [ - | anItemElement | - anItemElement := GtCoderNavigationPackagesTreeItemElement new. - anItemElement - hMatchParent; - vFitContent; - addAptitude: (BrGlamorousWithContextMenuAptitude + nodeType: [ :aTypeFactory :aTreeNode | aTreeNode value = packageToRename ifTrue: [ #rename ] ifFalse: [ #display ] ]; + nodeStencil: [ :anItemType | + anItemType = #rename + ifTrue: [ BrFrame new + id: #'coder--package-rename'; + hMatchParent; + vFitContent ] + ifFalse: [ | anItemElement | + anItemElement := GtCoderPackagesTreeItemElement new. + anItemElement + hMatchParent; + vFitContent; + addAptitude: (BrGlamorousWithContextMenuAptitude content: [ GtCoderNavigationContextMenuContent new - items: (self contextMenuItemsFor: anItemElement packageOrTag) ]) ]; + items: (self contextMenuItemsFor: anItemElement packageOrTag) ]) ] ]; nodeDataBinder: [ :aPackageElement :aPackage | - aPackageElement packageOrTag: aPackage ] + aPackageElement id asSymbol = #'coder--package-rename' + ifTrue: [ aPackageElement removeChildren. + renamingEditor + ifNil: [ renamingEditor := self createRenamePackageForm: aPackage ]. + aPackageElement addChild: renamingEditor ] + ifFalse: [ aPackageElement packageOrTag: aPackage ] ] ] { #category : #'api - initialization' } -GtCoderNavigationPackagesTreeElement >> initializeWithPackages: aCollectionOfPackages [ +GtCoderPackagesTreeElement >> initializeWithPackages: aCollectionOfPackages [ | theSortedPackages | theSortedPackages := aCollectionOfPackages asArray sorted: @@ -113,7 +149,7 @@ GtCoderNavigationPackagesTreeElement >> initializeWithPackages: aCollectionOfPac ] { #category : #'private - testing' } -GtCoderNavigationPackagesTreeElement >> isTag: tagA lessThan: tagB [ +GtCoderPackagesTreeElement >> isTag: tagA lessThan: tagB [ tagA class = GtCoderPackageUncategorizedTag ifTrue: [ ^ true ]. tagB class = GtCoderPackageUncategorizedTag ifTrue: [ ^ false ]. ^ tagA name < tagB name @@ -121,7 +157,7 @@ GtCoderNavigationPackagesTreeElement >> isTag: tagA lessThan: tagB [ ] { #category : #initialization } -GtCoderNavigationPackagesTreeElement >> newPackage [ +GtCoderPackagesTreeElement >> newPackage [ | dropdown tabGroup | tabGroup := self withAllParentsDetect: [ :each | each class == BrTabGroup ] @@ -133,17 +169,26 @@ GtCoderNavigationPackagesTreeElement >> newPackage [ ] { #category : #initialization } -GtCoderNavigationPackagesTreeElement >> newTagFor: aPackage inElement: elem [ +GtCoderPackagesTreeElement >> newTagFor: aPackage inElement: elem [ self notYetImplemented ] +{ #category : #'as yet unclassified' } +GtCoderPackagesTreeElement >> privateEndRenamePackage [ + "Removes package editing UI" + + packageToRename := nil. + renamingEditor := nil. + self viewModel notifyChildrenChanged +] + { #category : #initialization } -GtCoderNavigationPackagesTreeElement >> promoteTag: aPackageOrTag inElement: elem [ +GtCoderPackagesTreeElement >> promoteTag: aPackageOrTag inElement: elem [ self notYetImplemented ] { #category : #initialization } -GtCoderNavigationPackagesTreeElement >> removePackage: aPackage inElement: elem [ +GtCoderPackagesTreeElement >> removePackage: aPackage inElement: elem [ | change button | change := RBRemovePackageChange removePackageNamed: aPackage name. button := GtPreviewChangeButton new @@ -158,7 +203,7 @@ GtCoderNavigationPackagesTreeElement >> removePackage: aPackage inElement: elem ] { #category : #initialization } -GtCoderNavigationPackagesTreeElement >> removeTag: aTag inElement: elem [ +GtCoderPackagesTreeElement >> removeTag: aTag inElement: elem [ | change button | change := GtRBRemovePackageTagChange packageName: aTag package name tagName: aTag name. button := GtPreviewChangeButton new @@ -173,7 +218,7 @@ GtCoderNavigationPackagesTreeElement >> removeTag: aTag inElement: elem [ ] { #category : #initialization } -GtCoderNavigationPackagesTreeElement >> renamePackage: aPackage inElement: elem [ +GtCoderPackagesTreeElement >> renamePackage: aPackage inElement: elem [ | refactoring edit childs | childs := elem children. edit := BrEditableLabel new. @@ -200,7 +245,7 @@ GtCoderNavigationPackagesTreeElement >> renamePackage: aPackage inElement: elem ] { #category : #initialization } -GtCoderNavigationPackagesTreeElement >> renameTag: aPackageOrTag inElement: elem [ +GtCoderPackagesTreeElement >> renameTag: aPackageOrTag inElement: elem [ | refactoring edit childs | childs := elem children. edit := BrEditableLabel new. @@ -227,8 +272,18 @@ GtCoderNavigationPackagesTreeElement >> renameTag: aPackageOrTag inElement: elem elem addChild: edit ] +{ #category : #'as yet unclassified' } +GtCoderPackagesTreeElement >> requestRenamePackage: aPackageOrTag [ + "An entrance point to the rename package action. + Presents a UI to rename a given package" + + packageToRename := aPackageOrTag. + renamingEditor := nil. + self viewModel notifyChildrenChanged +] + { #category : #'api - selection' } -GtCoderNavigationPackagesTreeElement >> selectedIndice [ +GtCoderPackagesTreeElement >> selectedIndice [ "Return selected indice or zero" self selectedIndices @@ -239,26 +294,26 @@ GtCoderNavigationPackagesTreeElement >> selectedIndice [ ] { #category : #'api - selection' } -GtCoderNavigationPackagesTreeElement >> selectedPackage [ +GtCoderPackagesTreeElement >> selectedPackage [ ^ self selectedPackageNodeDo: #value ] { #category : #'api - selection' } -GtCoderNavigationPackagesTreeElement >> selectedPackageNodeDo: aBlock [ +GtCoderPackagesTreeElement >> selectedPackageNodeDo: aBlock [ self selectedNodeDo: [ :aNode | aNode depth = 0 ifTrue: [ ^ aBlock cull: aNode ] ]. ^ nil ] { #category : #'api - selection' } -GtCoderNavigationPackagesTreeElement >> selectedPackageTag [ +GtCoderPackagesTreeElement >> selectedPackageTag [ ^ self selectedPackageTagNodeDo: #value ] { #category : #'api - selection' } -GtCoderNavigationPackagesTreeElement >> selectedPackageTagNodeDo: aBlock [ +GtCoderPackagesTreeElement >> selectedPackageTagNodeDo: aBlock [ self selectedNodeDo: [ :aNode | aNode depth = 1 ifTrue: [ ^ aBlock cull: aNode ] ]. ^ nil diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeItemElement.class.st b/src/GToolkit-Coder-UI/GtCoderPackagesTreeItemElement.class.st similarity index 56% rename from src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeItemElement.class.st rename to src/GToolkit-Coder-UI/GtCoderPackagesTreeItemElement.class.st index 53e4d01cc..6d5d7dbcf 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTreeItemElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPackagesTreeItemElement.class.st @@ -1,35 +1,37 @@ Class { - #name : #GtCoderNavigationPackagesTreeItemElement, + #name : #GtCoderPackagesTreeItemElement, #superclass : #BrHorizontalPane, #instVars : [ 'packageOrTag', 'label' ], - #category : #'GToolkit-Coder-UI-Navigation' + #category : #'GToolkit-Coder-UI-Navigation - Helpers' } { #category : #initialization } -GtCoderNavigationPackagesTreeItemElement >> initialize [ +GtCoderPackagesTreeItemElement >> initialize [ super initialize. - self addAptitude: BrGlamorousListItemAptitude new. - label := BrLabel new matchParent; text: ''; beSmallSize; - aptitude: BrGlamorousLabelAptitude. + aptitude: (BrGlamorousLabelAptitude new padding: (BlInsets + top: 2 + bottom: 2 + left: 1 + right: 1)). self addChild: label ] { #category : #accessing } -GtCoderNavigationPackagesTreeItemElement >> packageOrTag [ +GtCoderPackagesTreeItemElement >> packageOrTag [ ^ packageOrTag ] { #category : #accessing } -GtCoderNavigationPackagesTreeItemElement >> packageOrTag: aPackageOrTag [ +GtCoderPackagesTreeItemElement >> packageOrTag: aPackageOrTag [ packageOrTag = aPackageOrTag ifTrue: [ ^ self ]. diff --git a/src/GToolkit-Coder-UI/GtCoderPackagesTreeRenameEditor.class.st b/src/GToolkit-Coder-UI/GtCoderPackagesTreeRenameEditor.class.st new file mode 100644 index 000000000..c05c60deb --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderPackagesTreeRenameEditor.class.st @@ -0,0 +1,15 @@ +Class { + #name : #GtCoderPackagesTreeRenameEditor, + #superclass : #GtCoderListEmbeddedRenameEditorElement, + #category : #'GToolkit-Coder-UI-Navigation - Helpers' +} + +{ #category : #'as yet unclassified' } +GtCoderPackagesTreeRenameEditor >> createCompleterStrategy [ + ^ GtMethodProtocolCompletionStrategy new +] + +{ #category : #'as yet unclassified' } +GtCoderPackagesTreeRenameEditor >> itemLabelOf: aPackage [ + ^ aPackage name +] diff --git a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupRenameEditor.class.st b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupRenameEditor.class.st new file mode 100644 index 000000000..e904dd569 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupRenameEditor.class.st @@ -0,0 +1,15 @@ +Class { + #name : #GtCoderProtocolsGroupRenameEditor, + #superclass : #GtCoderListEmbeddedRenameEditorElement, + #category : #'GToolkit-Coder-UI-Navigation - Helpers' +} + +{ #category : #'as yet unclassified' } +GtCoderProtocolsGroupRenameEditor >> createCompleterStrategy [ + ^ GtMethodProtocolCompletionStrategy new +] + +{ #category : #'as yet unclassified' } +GtCoderProtocolsGroupRenameEditor >> itemLabelOf: aProtocol [ + ^ aProtocol name +] diff --git a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st index b3d378c30..c1862028a 100644 --- a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st @@ -141,78 +141,13 @@ GtCoderProtocolsGroupedListElement >> createProtocolListContextMenuItemsFor: aPh { #category : #'private - instance creation' } GtCoderProtocolsGroupedListElement >> createRenameProtocolForm: aPharoProtocol [ - | aContainer aProtocolEditor aDefaultText aProtocolCompleter anAcceptButton aCancelButton | - - aDefaultText := aPharoProtocol name asRopedText - attribute: (BrGhostTextAttribute - for: ('protocol name' asRopedText glamorousFormEditorCodeFontAndSize - foreground: Color lightGray)). - - aContainer := BrHorizontalPane new - alignCenterLeft; - hMatchParent; - vFitContent. - - aProtocolEditor := BrEditor new - aptitude: BrGlamorousRegularEditorAptitude new glamorousRegularSmallSize - + BrGlamorousInputFieldSpacingAptitude; - beMode: BrTextEditorEditableSingleLineMode new; - geometry: (BlRoundedRectangleGeometry cornerRadius: 4); - padding: (BlInsets top: 2 left: 5 bottom: 2 right: 5); - hMatchParent; - vFitContent; - text: aDefaultText; - requestFocus. - - aProtocolEditor navigator moveToEnd apply. - aProtocolEditor selecter all select. - - aProtocolCompleter := GtCompletionController - on: aProtocolEditor - strategy: GtMethodProtocolCompletionStrategy new. - - aProtocolCompleter install. - - aProtocolEditor - addEditorShortcut: (BlShortcutWithAction new - combination: BlKeyCombination escape; - action: [ :anEvent | self privateEndRenameProtocol ]). - - aProtocolEditor - addEditorShortcut: (BlShortcutWithAction new - combination: BlKeyCombination enter; - action: [ :anEvent | self privateRenameProtocol: aPharoProtocol from: aProtocolEditor ]). - - aContainer addChild: aProtocolEditor. - - anAcceptButton := BrButton new - beTinySize; - margin: (BlInsets left: 5 right: 2); - aptitude: (BrGlamorousButtonRectangularAptitude paddingScale: 0.5) - + BrGlamorousButtonIconAptitude - + (BrGlamorousButtonFlatExteriorAptitude new - backgroundPaint: (Color gray alpha: 0.1)) - + BrGlamorousButtonWithLabelTooltipAptitude; - icon: BrGlamorousVectorIcons accept; - label: 'Rename protocol'; - action: [ self privateRenameProtocol: aPharoProtocol from: aProtocolEditor ]. - - aCancelButton := BrButton new - beTinySize; - margin: (BlInsets left: 2 right: 2); - aptitude: (BrGlamorousButtonRectangularAptitude paddingScale: 0.5) - + BrGlamorousButtonIconAptitude - + (BrGlamorousButtonFlatExteriorAptitude new - backgroundPaint: (Color gray alpha: 0.1)) - + BrGlamorousButtonWithLabelTooltipAptitude; - icon: BrGlamorousVectorIcons cancel; - label: 'Cancel'; - action: [ self privateEndRenameProtocol ]. - - aContainer addChild: anAcceptButton. - aContainer addChild: aCancelButton. - - ^ aContainer + ^ GtCoderProtocolsGroupRenameEditor new + itemToRename: aPharoProtocol; + renameAction: [ :anItemToRename :aNewName | + self navigationModel + renameProtocol: anItemToRename + to: aNewName ]; + endRenameAction: [ self privateEndRenameProtocol ] ] { #category : #'api - list' } @@ -380,20 +315,6 @@ GtCoderProtocolsGroupedListElement >> privateEndRenameProtocol [ isSynchronous: true) ] -{ #category : #'private - refactorings' } -GtCoderProtocolsGroupedListElement >> privateRenameProtocol: aPharoProtocol from: aProtocolEditor [ - "Performs a rename protocol action and updates UI removing a protocol editor" - | aNewName | - - aNewName := aProtocolEditor text asString trimmed. - - self navigationModel - renameProtocol: aPharoProtocol - to: aNewName. - - self privateEndRenameProtocol -] - { #category : #'private - refactorings' } GtCoderProtocolsGroupedListElement >> removeProtocol: aGtPharoProtocol in: elem [ | refactoring | diff --git a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st index c1e8b7957..862adabfe 100644 --- a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st @@ -250,5 +250,5 @@ GtExpandableSourceCoderElement >> updateElement [ { #category : #'private - update' } GtExpandableSourceCoderElement >> updateModificationIndicator [ - modificationIndicator asyncPromise promise: textualCoderViewModel isTextModified + modificationIndicator asyncPromise promise: textualCoderViewModel isTextModifiedPromise ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index a0ea65d92..c44906715 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -301,7 +301,7 @@ GtTextualCoderEditorElement >> onTextualCoderViewModelChanged [ which we will restore once new text is set" "Related to: https://github.com/feenkcom/gtoolkit/issues/3727" - self privateUpdateEditorState: self textualCoderViewModel asEditorState wait. + self privateUpdateEditorState: self textualCoderViewModel asEditorState. "self asyncPromise promise: self textualCoderViewModel asEditorState." diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 633e27e35..77dbd6341 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -117,30 +117,29 @@ GtTextualCoderViewModel >> applyTextEditCommand: aTextEditCommand [ { #category : #converting } GtTextualCoderViewModel >> asEditorState [ - + + | anEditorText aMemento | - ^ self coderModel currentSourceTextPromise then: [ :aText | - | anEditorText aMemento | - - anEditorText := aText copy. - - self extraTextAttributes do: [ :eachCoderAttributes | - eachCoderAttributes applyOnEditorText: anEditorText ]. - - aMemento := BrTextEditorCompositeMemento new - addMemento: (BrTextEditorCursorsMemento new cursors: cursors copy); - addMemento: (BrTextEditorSelectionMemento new selection: selection copy). - - self hasStyledText - ifTrue: [ - aMemento addMemento: (BrTextEditorStyledTextMemento new - text: self styledText; - styler: self compositeStyler) ] - ifFalse: [ - aMemento - addMemento: (BrTextEditorTextMemento new text: anEditorText); - addMemento: (BrTextEditorStylerMemento new styler: self compositeStyler) ]. - aMemento ] + anEditorText := self coderModel currentSourceText copy. + + self extraTextAttributes do: [ :eachCoderAttributes | + eachCoderAttributes applyOnEditorText: anEditorText ]. + + aMemento := BrTextEditorCompositeMemento new + addMemento: (BrTextEditorCursorsMemento new cursors: cursors copy); + addMemento: (BrTextEditorSelectionMemento new selection: selection copy). + + self hasStyledText + ifTrue: [ + aMemento addMemento: (BrTextEditorStyledTextMemento new + text: self styledText; + styler: self compositeStyler) ] + ifFalse: [ + aMemento + addMemento: (BrTextEditorTextMemento new text: anEditorText); + addMemento: (BrTextEditorStylerMemento new styler: self compositeStyler) ]. + + ^ aMemento ] { #category : #'*GToolkit-Coder-UI' } @@ -458,7 +457,7 @@ GtTextualCoderViewModel >> initialize [ ] { #category : #'api - text' } -GtTextualCoderViewModel >> isTextModified [ +GtTextualCoderViewModel >> isTextModifiedPromise [ "Return a promise which is resolved to true if the text is modified, false otherwise. Should be used together with {{gtClass:GtTextualCoderViewModelTextChanged}} to update the modification status in the UI" diff --git a/src/GToolkit-Coder/GtCoderCompiledMethodTextSource.class.st b/src/GToolkit-Coder/GtCoderCompiledMethodTextSource.class.st index 93d3ef05b..23451e6c9 100644 --- a/src/GToolkit-Coder/GtCoderCompiledMethodTextSource.class.st +++ b/src/GToolkit-Coder/GtCoderCompiledMethodTextSource.class.st @@ -18,12 +18,10 @@ GtCoderCompiledMethodTextSource >> compiledMethod: anObject [ self critical: [ compiledMethod := anObject. - originalSourceTextPromise := nil ] + originalSourceText := nil ] ] { #category : #initialization } -GtCoderCompiledMethodTextSource >> originalSourceTextFuture [ - - - ^ [ compiledMethod sourceCode asRopedText ] asAsyncFuture +GtCoderCompiledMethodTextSource >> computeOriginalSourceText [ + ^ compiledMethod sourceCode asRopedText ] diff --git a/src/GToolkit-Coder/GtCoderExplicitStringSource.class.st b/src/GToolkit-Coder/GtCoderExplicitStringSource.class.st index 03a305fb4..c7920968d 100644 --- a/src/GToolkit-Coder/GtCoderExplicitStringSource.class.st +++ b/src/GToolkit-Coder/GtCoderExplicitStringSource.class.st @@ -8,10 +8,8 @@ Class { } { #category : #initialization } -GtCoderExplicitStringSource >> originalSourceTextFuture [ - - - ^ [ source asRopedText ] asAsyncFuture +GtCoderExplicitStringSource >> computeOriginalSourceText [ + ^ source asRopedText ] { #category : #accessing } @@ -25,5 +23,5 @@ GtCoderExplicitStringSource >> source: anObject [ self critical: [ source := anObject. - originalSourceTextPromise := nil ] + originalSourceText := nil ] ] diff --git a/src/GToolkit-Coder/GtCoderExplicitTextSource.class.st b/src/GToolkit-Coder/GtCoderExplicitTextSource.class.st index 3e2af7c43..d3ca3ab9d 100644 --- a/src/GToolkit-Coder/GtCoderExplicitTextSource.class.st +++ b/src/GToolkit-Coder/GtCoderExplicitTextSource.class.st @@ -8,10 +8,8 @@ Class { } { #category : #initialization } -GtCoderExplicitTextSource >> originalSourceTextFuture [ - - - ^ [ text copy ] asAsyncFuture +GtCoderExplicitTextSource >> computeOriginalSourceText [ + ^ text copy ] { #category : #accessing } @@ -24,5 +22,5 @@ GtCoderExplicitTextSource >> text: aStringOrText [ self critical: [ text := aStringOrText asRopedText. - originalSourceTextPromise := nil ] + originalSourceText := nil ] ] diff --git a/src/GToolkit-Coder/GtCoderFutureTextSource.class.st b/src/GToolkit-Coder/GtCoderFutureTextSource.class.st deleted file mode 100644 index 01a4e1f8e..000000000 --- a/src/GToolkit-Coder/GtCoderFutureTextSource.class.st +++ /dev/null @@ -1,23 +0,0 @@ -Class { - #name : #GtCoderFutureTextSource, - #superclass : #GtCoderTextSource, - #instVars : [ - 'futureBlock' - ], - #category : #'GToolkit-Coder-Coders - Source Text' -} - -{ #category : #accessing } -GtCoderFutureTextSource >> future: aBlock [ - - self critical: [ - futureBlock := aBlock. - originalSourceTextPromise := nil ] -] - -{ #category : #initialization } -GtCoderFutureTextSource >> originalSourceTextFuture [ - - - ^ futureBlock value map: [ :aString | aString asRopedText ] -] diff --git a/src/GToolkit-Coder/GtCoderTextSource.class.st b/src/GToolkit-Coder/GtCoderTextSource.class.st index 8b34a7d85..3445a0ad2 100644 --- a/src/GToolkit-Coder/GtCoderTextSource.class.st +++ b/src/GToolkit-Coder/GtCoderTextSource.class.st @@ -6,8 +6,8 @@ Class { #superclass : #Object, #instVars : [ 'monitor', - 'originalSourceTextPromise', - 'currentSourceText' + 'currentSourceText', + 'originalSourceText' ], #category : #'GToolkit-Coder-Coders - Source Text' } @@ -17,6 +17,11 @@ GtCoderTextSource >> asCompiledMethodSourceCode: aCompiledMethod [ ^ (GtCoderCompiledMethodTextSource new fromSourceCode: self) compiledMethod: aCompiledMethod ] +{ #category : #initialization } +GtCoderTextSource >> computeOriginalSourceText [ + ^ self subclassResponsibility +] + { #category : #'mutual exclusion' } GtCoderTextSource >> critical: aBlock [ ^ monitor critical: aBlock @@ -25,26 +30,25 @@ GtCoderTextSource >> critical: aBlock [ { #category : #'api - accessing' } GtCoderTextSource >> currentSourceString [ "Return a string representation of the current source text" - - - ^ self critical: [ self currentSourceText then: [ :aGtCoderSourceText | aGtCoderSourceText asSourceString ] ] + + + ^ self critical: [ self currentSourceText asSourceString ] ] { #category : #'api - accessing' } GtCoderTextSource >> currentSourceString: aString [ "Set a new source text" - self critical: [ currentSourceText := GtCoderSourceText new text: aString asRopedText ] + self critical: [ currentSourceText := GtCoderSourceText new + text: aString asRopedText; + yourself ] ] { #category : #'api - accessing' } GtCoderTextSource >> currentSourceText [ - + - ^ self critical: [ - currentSourceText - ifNotNil: [ :aSourceText | aSourceText asAsyncPromise ] - ifNil: [ self originalSourceTextPromise ] ] + ^ self critical: [ currentSourceText ifNil: [ self originalSourceText ] ] ] { #category : #'api - accessing' } @@ -53,12 +57,13 @@ GtCoderTextSource >> currentSourceText: aText [ self critical: [ currentSourceText := GtCoderSourceText new - text: aText copyWithoutExternalReferences ] + text: aText copyWithoutExternalReferences; + yourself ] ] { #category : #initialization } GtCoderTextSource >> fromSourceCode: aGtCoderTextSource [ - originalSourceTextPromise := aGtCoderTextSource privateGetOriginalSourceTextPromise. + originalSourceText := aGtCoderTextSource privateGetOriginalSourceText. currentSourceText := aGtCoderTextSource privateGetCurrentSourceText ] @@ -66,7 +71,7 @@ GtCoderTextSource >> fromSourceCode: aGtCoderTextSource [ GtCoderTextSource >> hasSourceText [ - ^ self critical: [ originalSourceTextPromise notNil ] + ^ originalSourceText notNil ] { #category : #initialization } @@ -75,38 +80,23 @@ GtCoderTextSource >> initialize [ monitor := Monitor new. currentSourceText := nil. - originalSourceTextPromise := nil + originalSourceText := nil ] { #category : #'api - testing' } GtCoderTextSource >> isModified [ - ^ self isModifiedPromise wait -] - -{ #category : #'api - testing' } -GtCoderTextSource >> isModifiedPromise [ - currentSourceText - ifNil: [ ^ false asAsyncPromise ]. - - ^ self originalSourceTextPromise then: [ :anOriginalSourceText | self currentSourceText then: [ :aCurrentSourceText | anOriginalSourceText text characters ~= aCurrentSourceText text characters ] ] -] - -{ #category : #initialization } -GtCoderTextSource >> originalSourceTextFuture [ - - - ^ self subclassResponsibility + ^ self critical: [ + currentSourceText + ifNil: [ ^ false ]. + self originalSourceText text characters ~= self currentSourceText text characters ] ] -{ #category : #initialization } -GtCoderTextSource >> originalSourceTextPromise [ - - - ^ self critical: [ - originalSourceTextPromise ifNil: [ - originalSourceTextPromise := ( - self originalSourceTextFuture map: [ :aText | - GtCoderSourceText new text: aText ]) asAsyncPromise ] ] +{ #category : #'api - accessing' } +GtCoderTextSource >> originalSourceText [ + ^ self + critical: [ originalSourceText + ifNil: [ originalSourceText := GtCoderSourceText new + text: self computeOriginalSourceText ] ] ] { #category : #'private - accessing' } @@ -115,8 +105,8 @@ GtCoderTextSource >> privateGetCurrentSourceText [ ] { #category : #'private - accessing' } -GtCoderTextSource >> privateGetOriginalSourceTextPromise [ - ^ originalSourceTextPromise +GtCoderTextSource >> privateGetOriginalSourceText [ + ^ originalSourceText ] { #category : #'api - accessing' } @@ -124,7 +114,7 @@ GtCoderTextSource >> resetSourceText [ "Remove the cached source text forcing it to be recomputed next time it is accessed" self critical: [ - originalSourceTextPromise := nil. + originalSourceText := nil. currentSourceText := nil ] ] diff --git a/src/GToolkit-Coder/GtTextualCoder.class.st b/src/GToolkit-Coder/GtTextualCoder.class.st index 401015912..4b2ee8e3a 100644 --- a/src/GToolkit-Coder/GtTextualCoder.class.st +++ b/src/GToolkit-Coder/GtTextualCoder.class.st @@ -42,11 +42,13 @@ GtTextualCoder >> asNewCoderModelWithSameSubject [ GtTextualCoder >> ast [ - ^ self critical: [ astPromise ifNil: [ astPromise := self sourceCode currentSourceString asyncThen: [ :aGtCoderSourceString | + ^ self critical: [ astPromise ifNil: [ astPromise := [ + | aGtCoderSourceString | + aGtCoderSourceString := self sourceCode currentSourceString. GtCoderAst new ast: (self computeAst: aGtCoderSourceString string); sourceString: aGtCoderSourceString; - epoch: aGtCoderSourceString epoch ] ] ] + epoch: aGtCoderSourceString epoch ] asAsyncPromise ] ] ] { #category : #'api - ast' } @@ -67,18 +69,19 @@ GtTextualCoder >> astAwaitDo: aBlock [ { #category : #'api - text' } GtTextualCoder >> collapsedText [ + | aCurrentText | - ^ self collapsedTextPromise wait + aCurrentText := self currentSourceText. + ^ aCurrentText + ifEmpty: [ '' asRopedText ] + ifNotEmpty: [ aCurrentText iterator nextLine ] ] { #category : #'api - text' } GtTextualCoder >> collapsedTextPromise [ - ^ self currentSourceTextPromise asyncThen: [ :aCurrentText | - aCurrentText - ifEmpty: [ '' asRopedText ] - ifNotEmpty: [ aCurrentText iterator nextLine ] ] + ^ [ self collapsedText ] asAsyncPromise ] { #category : #'api - ast' } @@ -108,7 +111,7 @@ GtTextualCoder >> currentSourceString [ "Return a String representation of the current source text" - ^ self currentSourceStringPromise wait + ^ self sourceCode currentSourceString string ] { #category : #'api - text' } @@ -118,19 +121,12 @@ GtTextualCoder >> currentSourceString: aString [ self currentSourceText: aString asRopedText ] -{ #category : #'api - text' } -GtTextualCoder >> currentSourceStringPromise [ - "Return a String representation of the current source text" - - - ^ self critical: [ self sourceCode currentSourceString then: [ :aGtCoderSourceString | aGtCoderSourceString string ] ] -] - { #category : #'api - text' } GtTextualCoder >> currentSourceText [ + "Set a new source text" - ^ self currentSourceTextPromise wait + ^ self sourceCode currentSourceText text ] { #category : #'api - text' } @@ -180,7 +176,7 @@ GtTextualCoder >> currentSourceText: aText withEditCommand: anEditCommand [ GtTextualCoder >> currentSourceTextPromise [ - ^ self critical: [ self sourceCode currentSourceText then: [ :aGtCoderSourceText | aGtCoderSourceText text ] ] + ^ [ self currentSourceText ] asAsyncPromise ] { #category : #'api - text' } @@ -223,7 +219,7 @@ GtTextualCoder >> isModified [ GtTextualCoder >> isModifiedPromise [ - ^ self sourceCode isModifiedPromise + ^ [ self sourceCode isModified ] asAsyncPromise ] { #category : #'private - notifying' } From 7380a92d61b16bbdaded8c970c2b2318ba398ac4 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 25 Nov 2024 11:53:43 -0300 Subject: [PATCH 0795/1268] remove space key combination from the `Edit filter` shortcut. --- src/GToolkit-Coder-UI/GtFilterItemsElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st index e2b8e435b..ea887352b 100644 --- a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st @@ -96,7 +96,7 @@ GtFilterItemsElement >> addNavigationShortcutsTo: anElement [ nextFocusDo: #requestFocus ifNone: [ ] ]); addShortcut: (BlShortcutWithAction new name: 'Edit filter'; - combination: (BlKeyCombination space or: BlKeyCombination enter); + combination: BlKeyCombination enter; overrideChildren: false; action: [ :anEvent | self onEditItemsEvent: anEvent ]) ] From b1e2374cc002ed0b2c8196f942aab1246fbbe458 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 25 Nov 2024 16:50:26 -0300 Subject: [PATCH 0796/1268] add `GtFilterStep>>#clickOnDropdownFilterItem:` [feenkcom/gtoolkit#4207] --- src/GToolkit-Coder-UI/GtFilterStep.class.st | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtFilterStep.class.st b/src/GToolkit-Coder-UI/GtFilterStep.class.st index 8dcbdd093..b69081102 100644 --- a/src/GToolkit-Coder-UI/GtFilterStep.class.st +++ b/src/GToolkit-Coder-UI/GtFilterStep.class.st @@ -95,6 +95,17 @@ GtFilterStep >> clickOnAddFilter [ // GtFiltersAddId ] +{ #category : #'steps - interactions' } +GtFilterStep >> clickOnDropdownFilterItem: aFilterItem [ + ^ self click + label: ('Click on dropdown item: {1}' format: { aFilterItem }); + referenceSender; + onSpaceRoot; + // BrAnchoredOuterContainer; + // #scrollable; + onChildFromBlock: [ :anElement | anElement children detect: [ :each | each viewModel model = aFilterItem ] ] +] + { #category : #'steps - interactions' } GtFilterStep >> clickOnDropdownFilterItemAtIndex: anIndex [ ^ self click From d5062b2f460da7be220bd8f5022e64e0f1ee6a81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Thu, 28 Nov 2024 10:07:46 +0100 Subject: [PATCH 0797/1268] Do not update the tree of classes in coder if the tree is the same --- src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index 2eab64308..3eca613a7 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -237,6 +237,8 @@ GtCoderClassesTreeElement >> initializeWithClasses: aCollectionOfClasses [ | newTree | newTree := (GtCoderClassesHierarchyTree fromClasses: aCollectionOfClasses) sortByClassName. + + newTree = classesTree ifTrue: [ ^ self ]. classesTree := newTree. self items: classesTree subclassTrees From f9c4fd1f13854e66fa59fbf1bbb29ab5f5cf421b Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 28 Nov 2024 21:18:40 +0100 Subject: [PATCH 0798/1268] [feenkcom/gtoolkit#4214] migrate addons and ast computation to futures --- ...haviorCoderBehaviorDeleteButtonId.class.st | 10 ++ .../GtCoderActivatableAction.extension.st | 2 +- ...derViewModelRecomputeAddOnRequest.class.st | 18 ++++ .../GtSingleCoderViewModel.class.st | 82 +++++++++++------ .../GtSourceCoderActionsElement.class.st | 2 - .../GtSourceCoderEditorElement.class.st | 17 ++-- .../GtTextualCoderEditorElement.class.st | 71 ++++++++------ .../GtTextualCoderViewModel.class.st | 44 ++++++--- src/GToolkit-Coder/GtCoderAddOns.class.st | 6 +- src/GToolkit-Coder/GtCoderAstStyler.class.st | 4 +- src/GToolkit-Coder/GtSourceCoder.class.st | 6 +- src/GToolkit-Coder/GtTextCoder.class.st | 5 - src/GToolkit-Coder/GtTextualCoder.class.st | 92 +++++++++++++------ 13 files changed, 241 insertions(+), 118 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorDeleteButtonId.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderViewModelRecomputeAddOnRequest.class.st diff --git a/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorDeleteButtonId.class.st b/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorDeleteButtonId.class.st new file mode 100644 index 000000000..06d982ee9 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorDeleteButtonId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtBehaviorCoderBehaviorDeleteButtonId, + #superclass : #GtCoderElementId, + #category : #'GToolkit-Coder-UI-Coder - Ids' +} + +{ #category : #converting } +GtBehaviorCoderBehaviorDeleteButtonId >> asSymbol [ + ^ #'behavior-coder--behavior-delete-button' +] diff --git a/src/GToolkit-Coder-UI/GtCoderActivatableAction.extension.st b/src/GToolkit-Coder-UI/GtCoderActivatableAction.extension.st index e04d30145..b7ce031f6 100644 --- a/src/GToolkit-Coder-UI/GtCoderActivatableAction.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderActivatableAction.extension.st @@ -8,7 +8,7 @@ GtCoderActivatableAction >> buildElementIn: aCoderActionsElement [ aButton enabled: (enabledBlock cull: aCoderActionsElement coderViewModel). updateAnnouncement ifNotNil: [ - aCoderActionsElement coderViewModel announcerUIModel weak + aCoderActionsElement coderViewModel announcer weak when: updateAnnouncement send: #enabled: to: aButton ]. ^ aButton diff --git a/src/GToolkit-Coder-UI/GtCoderViewModelRecomputeAddOnRequest.class.st b/src/GToolkit-Coder-UI/GtCoderViewModelRecomputeAddOnRequest.class.st new file mode 100644 index 000000000..c9a1370b4 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderViewModelRecomputeAddOnRequest.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtCoderViewModelRecomputeAddOnRequest, + #superclass : #Announcement, + #instVars : [ + 'coderViewModel' + ], + #category : #'GToolkit-Coder-UI-Coder - Basic' +} + +{ #category : #accessing } +GtCoderViewModelRecomputeAddOnRequest >> coderViewModel [ + ^ coderViewModel +] + +{ #category : #accessing } +GtCoderViewModelRecomputeAddOnRequest >> coderViewModel: anObject [ + coderViewModel := anObject +] diff --git a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st index 873284adb..51760fa88 100644 --- a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st @@ -2,7 +2,8 @@ 1. Coder UI Model Wraps {{gtClass:GtCoderModel}} and optionally adds UI related api and state. Coder UI Model should be passed to any Coder UI element instead of the {{gtClass:GtCoderModel}} - +##Add-ons +Coders are extensible using a concept of an add-on. " Class { #name : #GtSingleCoderViewModel, @@ -14,7 +15,9 @@ Class { 'codersUIModel', 'coderModel', 'extraAddOns', - 'addOnPromise' + 'addOnPromise', + 'currentAddOns', + 'addOnsCache' ], #category : #'GToolkit-Coder-UI-Coder - Basic' } @@ -37,7 +40,17 @@ GtSingleCoderViewModel >> addMainAction: aGtCoderAction [ GtSingleCoderViewModel >> addOns [ - ^ self ensureAddOns + ^ self addOnsFuture await: self class addOnsExecutionConfiguration +] + +{ #category : #'api - add-ons' } +GtSingleCoderViewModel >> addOnsFuture [ + "Return a future that will be resolved to coder addons" + + + ^ AsyncCachedFuture + forFuture: self computeAddOnsFuture + cache: addOnsCache ] { #category : #accessing } @@ -47,6 +60,10 @@ GtSingleCoderViewModel >> announcer [ { #category : #accessing } GtSingleCoderViewModel >> announcerUIModel [ + self + deprecated: 'Use #announcer instead' + transformWith: '`@receiver announcerUIModel' -> '`@receiver announcer'. + ^ self announcer ] @@ -124,28 +141,16 @@ GtSingleCoderViewModel >> computeAddOns [ self subclassResponsibility ] -{ #category : #accessing } -GtSingleCoderViewModel >> elementClass [ +{ #category : #'private - addons' } +GtSingleCoderViewModel >> computeAddOnsFuture [ + + ^ self subclassResponsibility ] -{ #category : #'private - addons' } -GtSingleCoderViewModel >> ensureAddOns [ - - - ^ addOnPromise ifNil: [ - addOnPromise := self computeAddOns - then: [ :theAddOns | - self onAddOnsChanged: theAddOns ] - otherwise: [ :anError | - anError emit. - - NonInteractiveTranscript stderr - nextPutAll: 'Error computing addons: '; - space; - print: anError; - cr ]; - yourself ] +{ #category : #accessing } +GtSingleCoderViewModel >> elementClass [ + ^ self subclassResponsibility ] { #category : #accessing } @@ -193,6 +198,13 @@ GtSingleCoderViewModel >> hasFocus: aBoolean [ self focused: aBoolean ] +{ #category : #initialization } +GtSingleCoderViewModel >> initialize [ + super initialize. + + addOnsCache := AsyncFutureCache new +] + { #category : #testing } GtSingleCoderViewModel >> isModified [ ^ self coder isModified @@ -200,7 +212,9 @@ GtSingleCoderViewModel >> isModified [ { #category : #'private - event handling' } GtSingleCoderViewModel >> onAddOnsChanged: theAddOns [ - + "Is sent by Coder Element from a UI thread when new add-ons are computed" + + currentAddOns := theAddOns ] { #category : #'api - coder model' } @@ -208,12 +222,15 @@ GtSingleCoderViewModel >> onCoderModelChanged [ "Is sent when a new coder model is assigned to the view model" ] +{ #category : #'api - coder model' } +GtSingleCoderViewModel >> onCoderRecomputeAddOnsRequest: aCoderAddOnsUpdateRequest [ + self requestUpdateAddOns +] + { #category : #'api - add-ons' } GtSingleCoderViewModel >> requestUpdateAddOns [ - - - addOnPromise := nil. - ^ self ensureAddOns + addOnsCache resetCache. + self announcer announce: (GtCoderViewModelRecomputeAddOnRequest new coderViewModel: self) ] { #category : #'api - coder model' } @@ -222,7 +239,12 @@ GtSingleCoderViewModel >> subscribeToCoderModel [ It is required to unsubscribe from the domain model by implementing #unsubscribeFromCoderModel if view model subscribes to them" - self coderModel subscribeToSystem + self coderModel subscribeToSystem. + + self coderModel announcer weak + when: GtCoderAddOnsUpdateRequest + send: #onCoderRecomputeAddOnsRequest: + to: self ] { #category : #'api - coder model' } @@ -230,6 +252,8 @@ GtSingleCoderViewModel >> unsubscribeFromCoderModel [ "Is sent before a new coder model is assigned to the view model. View models that subscribe to coder model are required to implement this methods" - "unsubscribing here is not good, what if there are multiple view models on the same coder model?" + self coderModel announcer unsubscribe: self + + "unsubscribing from system here is not good, what if there are multiple view models on the same coder model?" "self coderModel unsubscribeFromSystem" ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st index 0ba51e9c4..13c75a007 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st @@ -88,8 +88,6 @@ GtSourceCoderActionsElement >> onPostTextualCoderViewModelChanged [ "I am an optional hook method that is sent after #subscribeToTextualCoderViewModel. I do nothing by default but allow users to perform update operations when a receiver object is already subscribed to announcements." - - self textualCoderViewModel ensureAddOns ] { #category : #'api - textual coder view model' } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st index 781a913c5..3bc69151b 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st @@ -13,14 +13,19 @@ GtSourceCoderEditorElement >> onTextualCoderViewModelChanged [ ifNotNil: [ :aResult | evaluationHighlighter displayResult: aResult ] ] +{ #category : #'as yet unclassified' } +GtSourceCoderEditorElement >> onUpdateAddOnsRequest: aGtCoderAddOnsUpdateRequest [ + "To be deleted" +] + { #category : #registration } GtSourceCoderEditorElement >> onViewModelEvaluationStatusChanged: anAnnouncement [ - BlTaskAction - enqueueElement: self - action: [ anAnnouncement evaluationStatus - handleStatusChangedAnnouncement: anAnnouncement - sourceCoderElement: self. - self styleText ] + self + enqueueTask: (BlTaskAction new + action: [ anAnnouncement evaluationStatus + handleStatusChangedAnnouncement: anAnnouncement + sourceCoderElement: self. + self styleText ]) ] { #category : #registration } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index c44906715..ec655ee78 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -9,7 +9,8 @@ Class { 'evaluationPrinter', 'shortcuts', 'cursorsUpdater', - 'textUpdater' + 'textUpdater', + 'addOnsElementFuture' ], #category : #'GToolkit-Coder-UI-Coder - Textual' } @@ -128,8 +129,13 @@ GtTextualCoderEditorElement >> initialize [ element: self; action: (MessageSend receiver: self selector: #privateUpdateText:announcement:). + addOnsElementFuture := (BrAsyncElementFuture on: self) + executionConfiguration: (GtSingleCoderViewModel addOnsExecutionConfiguration); + whenSuccess: [ :anEditorElement :theAddOns | + self textualCoderViewModel onAddOnsChanged: theAddOns ]. + self initializeListeners. - + self withAsyncPromiseDo: [ :anElementPromise | anElementPromise whenSuccess: [ :anEditorElement :anEditorState | anEditorElement privateUpdateEditorState: anEditorState ]; @@ -161,7 +167,7 @@ GtTextualCoderEditorElement >> initializeListeners [ self editor when: BrTextEditorTextStyledEvent - do: [ :anEvent | self textualCoderViewModel styledText: anEvent styledText ] + do: [ :anEvent | self onTextStyled: anEvent ] ] { #category : #'hooks - children' } @@ -229,15 +235,8 @@ GtTextualCoderEditorElement >> onPostTextualCoderViewModelChanged [ "I am an optional hook method that is sent after #subscribeToTextualCoderViewModel. I do nothing by default but allow users to perform update operations when a receiver object is already subscribed to announcements." - | anAddOnsPromise | - self textualCoderViewModel hasStyledText - ifTrue: [ ^ self ]. - - "the add-ons will not compute themselves unless we tell them to" - anAddOnsPromise := self textualCoderViewModel addOns then: [ :theAddOns | self onViewModelReadyToStyle ]. - "this works as a marker to indicate that we are waiting for the promise to finish" - self enqueueTask: (BlPromiseTask new promise: anAddOnsPromise) + self textualCoderViewModel requestUpdateAddOns ] { #category : #'private - event handling' } @@ -286,6 +285,13 @@ GtTextualCoderEditorElement >> onTextModifiedDueToEvent: aTextModifiedEvent [ dueToEvent: aTextModifiedEvent ] +{ #category : #'private - event handling' } +GtTextualCoderEditorElement >> onTextStyled: anEvent [ + "An underlying editor styled the text" + + self textualCoderViewModel styledText: anEvent styledText +] + { #category : #'api - textual coder view model' } GtTextualCoderEditorElement >> onTextualCoderViewModelChanged [ "Is sent when a new textualCoder view model is assigned to the element. @@ -302,9 +308,6 @@ GtTextualCoderEditorElement >> onTextualCoderViewModelChanged [ "Related to: https://github.com/feenkcom/gtoolkit/issues/3727" self privateUpdateEditorState: self textualCoderViewModel asEditorState. - - "self asyncPromise - promise: self textualCoderViewModel asEditorState." self editor model: self textualCoderViewModel. @@ -323,11 +326,6 @@ GtTextualCoderEditorElement >> onToolSpawnRequest: anAnnouncement [ withDestination: anAnnouncement spawnDestination ] ]) ] -{ #category : #'private - event handling' } -GtTextualCoderEditorElement >> onUpdateAddOnsRequest: anAnnouncement [ - self enqueueTask: (BlPromiseTask new promise: self textualCoderViewModel requestUpdateAddOns) -] - { #category : #'private - event handling' } GtTextualCoderEditorElement >> onViewModelCursorsChanged: aCursorsChangedAnnouncement [ "Is sent when the cursors changes in the View Model. @@ -347,7 +345,15 @@ GtTextualCoderEditorElement >> onViewModelCursorsChanged: aCursorsChangedAnnounc { #category : #'private - event handling' } GtTextualCoderEditorElement >> onViewModelReadyToStyle [ - self styleText + self enqueueTask: (BlTaskAction new action: [ self styleText ]) +] + +{ #category : #registration } +GtTextualCoderEditorElement >> onViewModelRecomputeAddOns: aRecomputeAddOnRequest [ + aRecomputeAddOnRequest coderViewModel == self textualCoderViewModel + ifFalse: [ ^ self ]. + + addOnsElementFuture future: self textualCoderViewModel addOnsFuture ] { #category : #'private - event handling' } @@ -411,17 +417,22 @@ GtTextualCoderEditorElement >> onViewModelTextAttributesRemoved: anAnnouncement { #category : #'private - event handling' } GtTextualCoderEditorElement >> onViewModelTextChanged: aGtTextualCoderViewModelTextChanged [ + "Text changed in a view model and should be synchronised on the UI side. + There can be multiple sources of the text change: + - an editor element itself + - other sources that changed text through coder model api. + + When the source is a text editor element (`self`) we don't reset the text in the editor. + If an announcement comes from a different view model, we skip it." - "When text is modified, the view model starts to recompute addOns" - self enqueueTask: (BlPromiseTask new promise: self textualCoderViewModel addOns). - aGtTextualCoderViewModelTextChanged source == self - ifTrue: [ ^ self hideHighlighters ]. - - "do nothing if it comes from a different view model" + "Do nothing if it comes from a different view model" aGtTextualCoderViewModelTextChanged textualCoderViewModel == self textualCoderViewModel ifFalse: [ ^ self ]. + aGtTextualCoderViewModelTextChanged source == self + ifTrue: [ ^ self hideHighlighters ]. + aGtTextualCoderViewModelTextChanged isSynchronous ifTrue: [ self privateUpdateText: self announcement: aGtTextualCoderViewModelTextChanged ] ifFalse: [ textUpdater requestUpdate: aGtTextualCoderViewModelTextChanged ] @@ -480,15 +491,12 @@ GtTextualCoderEditorElement >> privateUpdateText: anEditorElement announcement: textForUpdate := self computeTextForUpdateForTextChangedEvent: aGtTextualCoderViewModelTextChanged. self text: textForUpdate. - self hideHighlighters + self hideHighlighters. ] { #category : #registration } GtTextualCoderEditorElement >> registerCoderModelAnnouncementsFor: aCoderModel [ aCoderModel announcer weak - when: GtCoderAddOnsUpdateRequest - send: #onUpdateAddOnsRequest: - to: self; when: GtCoderStyleTextRequest send: #onStyleTextRequest: to: self; when: GtCoderParseError send: #onCoderParseError: to: self; when: GtCoderObjectSpawnRequest @@ -504,6 +512,9 @@ GtTextualCoderEditorElement >> registerCoderModelAnnouncementsFor: aCoderModel [ { #category : #registration } GtTextualCoderEditorElement >> registerCoderViewModelAnnouncementsFor: aGtSourceCoderUIModel [ aGtSourceCoderUIModel weak + when: GtCoderViewModelRecomputeAddOnRequest + send: #onViewModelRecomputeAddOns: + to: self; when: GtTextualCoderViewModelFocusChanged send: #onFocusChangedAnnouncement: to: self; diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 77dbd6341..6f53fddb8 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -32,6 +32,13 @@ GtTextualCoderViewModel >> addLocateDebuggerInSpaceAction: aSpace [ self requestUpdateAddOns ] +{ #category : #'api - add-ons' } +GtTextualCoderViewModel >> addOnsFuture [ + "Return a future that will be resolved to coder addons" + + ^ self computeAddOnsFuture +] + { #category : #'api - shortcuts' } GtTextualCoderViewModel >> addShortcut: aShortcut [ "Add an extra shortcut add-on independent from the dynamically computed add-ons" @@ -158,7 +165,16 @@ GtTextualCoderViewModel >> astAsyncDo: aBlock [ { #category : #'api - coder model' } GtTextualCoderViewModel >> astAwait [ - ^ self coderModel astAwait + self + deprecated: 'Please use #astSync instead.' + transformWith: '`@receiver astAwait' -> '`@receiver astSync'. + + ^ self astSync +] + +{ #category : #'api - coder model' } +GtTextualCoderViewModel >> astSync [ + ^ self coderModel astSync ] { #category : #'api - expansion' } @@ -197,11 +213,17 @@ GtTextualCoderViewModel >> compositeStyler [ { #category : #'api - add-ons' } GtTextualCoderViewModel >> computeAddOns [ - | aCoderModel | + ^ self addOnsFuture await +] - aCoderModel := self coderModel. +{ #category : #'api - add-ons' } +GtTextualCoderViewModel >> computeAddOnsFuture [ + "Return a future that will be resolved to coder addons" + + | aCoderModel | - ^ aCoderModel ast asyncThen: [ :aCoderAst | + aCoderModel := self coderModel. + ^ aCoderModel coderAstFuture map: [ :aCoderAst | | theAst newAddOns pragmas | theAst := aCoderAst ast. @@ -237,7 +259,7 @@ GtTextualCoderViewModel >> computeAddOns [ "view model add-ons override coder model add-ons" newAddOns addAddOns: extraAddOns. newAddOns markAsUpdated. - newAddOns ]. + newAddOns ] ] { #category : #'private - addons' } @@ -246,7 +268,7 @@ GtTextualCoderViewModel >> computeContextMenuAstAddOns [ aCoderModel := self coderModel. - theAst := aCoderModel astAwait. + theAst := aCoderModel astSync. pragmas := aCoderModel pragmasNamed: #gtCoderContextMenuAddOns: inHierarchy: aCoderModel class. @@ -384,7 +406,7 @@ GtTextualCoderViewModel >> gtInfo [ aStream nextPut: (#cursors -> self cursors). aStream nextPut: (#selection -> self selection). aStream nextPut: (#addOns -> self addOns wait). - aStream nextPut: (#ast -> self astAwait). + aStream nextPut: (#ast -> self astSync). aStream nextPut: (#stylers -> self stylers). aStream nextPut: (#mainActions -> self mainActions). aStream nextPut: (#contextActions -> self contextActions). @@ -529,7 +551,7 @@ GtTextualCoderViewModel >> notifyExpansionChanged: aBoolean [ { #category : #'private - notifying' } GtTextualCoderViewModel >> notifyFocusChanged: aBoolean from: aSourceObject [ - self announcerUIModel announce: (GtTextualCoderViewModelFocusChanged new + self announcer announce: (GtTextualCoderViewModelFocusChanged new focused: aBoolean; source: aSourceObject) ] @@ -550,9 +572,10 @@ GtTextualCoderViewModel >> notifyStyledTextChanged [ { #category : #'private - event handling' } GtTextualCoderViewModel >> onAddOnsChanged: theAddOns [ - "Is sent when new add-ons are computed" - + "Is sent by Coder Element from a UI thread when new add-ons are computed" | someContextActions | + super onAddOnsChanged: theAddOns. + self shortcuts: theAddOns shortcuts. self mainActions: theAddOns mainActions. @@ -603,7 +626,6 @@ GtTextualCoderViewModel >> onSourceCodeChanged: anSourceCodeChangedAnnouncement addOnPromise := nil. isTextModifiedPromise := nil. - self ensureAddOns. self announce: (GtTextualCoderViewModelTextChanged new textualCoderViewModel: self; diff --git a/src/GToolkit-Coder/GtCoderAddOns.class.st b/src/GToolkit-Coder/GtCoderAddOns.class.st index 8650da6e2..037007e8a 100644 --- a/src/GToolkit-Coder/GtCoderAddOns.class.st +++ b/src/GToolkit-Coder/GtCoderAddOns.class.st @@ -185,7 +185,8 @@ GtCoderAddOns >> addDropDownAction: aString icon: anIcon stencil: aBlock [ title: aString; icon: anIcon; stencil: aBlock. - mainActions add: newAction + mainActions add: newAction. + ^ newAction ] { #category : #'api - main actions' } @@ -196,7 +197,8 @@ GtCoderAddOns >> addDropDownWithPreviewAction: aString icon: anIcon action: acti icon: anIcon; changeAction: actionBlock; changeStencil: stencilBlock. - mainActions add: newAction + mainActions add: newAction. + ^ newAction ] { #category : #'api - main actions' } diff --git a/src/GToolkit-Coder/GtCoderAstStyler.class.st b/src/GToolkit-Coder/GtCoderAstStyler.class.st index 8af025242..5e702c9ed 100644 --- a/src/GToolkit-Coder/GtCoderAstStyler.class.st +++ b/src/GToolkit-Coder/GtCoderAstStyler.class.st @@ -4,7 +4,7 @@ Class { #instVars : [ 'coderViewModel' ], - #category : 'GToolkit-Coder-Styler/Highlighter' + #category : #'GToolkit-Coder-Styler/Highlighter' } { #category : #'api - styling' } @@ -54,7 +54,7 @@ GtCoderAstStyler >> privateStyle: aText [ | theAst | "Styling happens in a non-UI process, therefore it is fine to wait until AST is computed in a blocking way" - theAst := self coderViewModel coderModel astAwait. + theAst := self coderViewModel coderModel astSync. theAst ifNil: [ ^ aText ]. diff --git a/src/GToolkit-Coder/GtSourceCoder.class.st b/src/GToolkit-Coder/GtSourceCoder.class.st index b5339675e..6f11a5f22 100644 --- a/src/GToolkit-Coder/GtSourceCoder.class.st +++ b/src/GToolkit-Coder/GtSourceCoder.class.st @@ -277,7 +277,7 @@ GtSourceCoder >> nodeAt: aTextPosition ifFound: aFoundBlock ifNone: aNoneBlock [ [ | theAST innerNode | - theAST := self astAwait. + theAST := self astSync. theAST withAllNodesDo: [ :node | (aTextPosition between: node startPosition - 1 and: node stopPosition) @@ -319,7 +319,7 @@ GtSourceCoder >> nodeWithin: anInterval ifFound: aFoundBlock ifNone: aNoneBlock [ | theAST | - theAST := self astAwait. + theAST := self astSync. ^ theAST bestNodeFor: anInterval ifFound: aFoundBlock @@ -462,7 +462,7 @@ GtSourceCoder >> validateSyntax [ { #category : #'private - actions' } GtSourceCoder >> validateSyntaxInContext: aGtPharoSourceCoderEvaluationContext [ - [ self computeAst ] + [ self computeCoderAst ] on: SmaCCParserError do: [ :ex | self diff --git a/src/GToolkit-Coder/GtTextCoder.class.st b/src/GToolkit-Coder/GtTextCoder.class.st index f9ea3f13d..7eda3ab5d 100644 --- a/src/GToolkit-Coder/GtTextCoder.class.st +++ b/src/GToolkit-Coder/GtTextCoder.class.st @@ -42,8 +42,3 @@ GtTextCoder >> parserStartingState [ GtTextCoder >> parserStartingState: anObject [ parserStartingState := anObject ] - -{ #category : #'api - ast' } -GtTextCoder >> supportsAstCache [ - ^ false -] diff --git a/src/GToolkit-Coder/GtTextualCoder.class.st b/src/GToolkit-Coder/GtTextualCoder.class.st index 4b2ee8e3a..91f27ac7a 100644 --- a/src/GToolkit-Coder/GtTextualCoder.class.st +++ b/src/GToolkit-Coder/GtTextualCoder.class.st @@ -3,7 +3,8 @@ Class { #superclass : #GtCoderModel, #instVars : [ 'sourceCode', - 'astPromise' + 'astPromise', + 'astCache' ], #category : #'GToolkit-Coder-Coders' } @@ -42,28 +43,59 @@ GtTextualCoder >> asNewCoderModelWithSameSubject [ GtTextualCoder >> ast [ - ^ self critical: [ astPromise ifNil: [ astPromise := [ - | aGtCoderSourceString | - aGtCoderSourceString := self sourceCode currentSourceString. - GtCoderAst new - ast: (self computeAst: aGtCoderSourceString string); - sourceString: aGtCoderSourceString; - epoch: aGtCoderSourceString epoch ] asAsyncPromise ] ] + ^ self coderAst ] { #category : #'api - ast' } GtTextualCoder >> astAsyncDo: aBlock [ - self ast asyncThen: [ :aGtCoderAst | aBlock value: aGtCoderAst ast ] + self coderAst asyncThen: [ :aGtCoderAst | aBlock value: aGtCoderAst ast ] ] { #category : #'api - ast' } GtTextualCoder >> astAwait [ - ^ self ast wait ast + self + deprecated: 'Please use #astSync instead.' + transformWith: '`@receiver astAwait' -> '`@receiver astSync'. + + ^ self astSync ] { #category : #'api - ast' } -GtTextualCoder >> astAwaitDo: aBlock [ - aBlock value: self astAwait +GtTextualCoder >> astFuture [ + + + ^ self coderAstFuture map: [ :aCoderAst | aCoderAst ast ] +] + +{ #category : #'api - ast' } +GtTextualCoder >> astSync [ + ^ self coderAstSync ast +] + +{ #category : #'api - ast' } +GtTextualCoder >> coderAst [ + + + ^ self coderAstFuture await +] + +{ #category : #'api - ast' } +GtTextualCoder >> coderAstFuture [ + + + ^ AsyncCachedFuture new + future: [ self computeCoderAst ] asAsyncFuture + cache: astCache +] + +{ #category : #'api - ast' } +GtTextualCoder >> coderAstSync [ + "Attempt to take a Coder AST from cache, otherwise compute it synchronously" + + + ^ astCache + ifSome: [ :aValue | aValue ] + ifNonePut: [ self computeCoderAst] ] { #category : #'api - text' } @@ -85,13 +117,22 @@ GtTextualCoder >> collapsedTextPromise [ ] { #category : #'api - ast' } -GtTextualCoder >> computeAst [ - ^ self computeAst: self currentSourceString +GtTextualCoder >> computeAst: theSourceString [ + "Given a string, compute and return a domain specific AST" + + ^ self subclassResponsibility ] { #category : #'api - ast' } -GtTextualCoder >> computeAst: theSourceString [ - ^ self subclassResponsibility +GtTextualCoder >> computeCoderAst [ + + | aGtCoderSourceString | + + aGtCoderSourceString := self sourceCode currentSourceString. + ^ GtCoderAst new + ast: (self computeAst: aGtCoderSourceString string); + sourceString: aGtCoderSourceString; + epoch: aGtCoderSourceString epoch ] { #category : #'api - text' } @@ -204,7 +245,8 @@ GtTextualCoder >> ensureAst [ { #category : #initialize } GtTextualCoder >> initialize [ super initialize. - + + astCache := AsyncFutureCache new. self reset ] @@ -272,7 +314,9 @@ GtTextualCoder >> reset [ { #category : #'private - ast' } GtTextualCoder >> resetAstCache [ - astPromise := nil + self critical: [ + astPromise := nil. + astCache resetCache ] ] { #category : #'event handling' } @@ -284,12 +328,13 @@ GtTextualCoder >> sourceChangedTo: aNewText [ { #category : #'event handling' } GtTextualCoder >> sourceChangedTo: aNewText from: aPreviousText with: anUpdateStrategy dueTo: aReason [ - astPromise := nil. + self resetAstCache. self notifySourceChangedTo: aNewText from: aPreviousText with: anUpdateStrategy - dueTo: aReason + dueTo: aReason. + self requestUpdateAddOns ] { #category : #'event handling' } @@ -366,10 +411,3 @@ GtTextualCoder >> sourceTextDo: aBlock [ GtTextualCoder >> stylers [ ^ #() ] - -{ #category : #'api - ast' } -GtTextualCoder >> supportsAstCache [ - "Return true if ast cache should be used, false otherwise" - - ^ true -] From b31871a7a65ccfe5d4b0515e5e3d6fe2482248e1 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 29 Nov 2024 16:53:55 -0300 Subject: [PATCH 0799/1268] Display main tool actions [feenkcom/gtoolkit#4214] --- .../GtBehaviorCoderActionsElement.class.st | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtBehaviorCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtBehaviorCoderActionsElement.class.st index 00cb92887..c0613f2b4 100644 --- a/src/GToolkit-Coder-UI/GtBehaviorCoderActionsElement.class.st +++ b/src/GToolkit-Coder-UI/GtBehaviorCoderActionsElement.class.st @@ -4,7 +4,8 @@ Class { #instVars : [ 'behaviorCoderViewModel', 'toolbarElement', - 'previewsElement' + 'previewsElement', + 'addOnsElementFuture' ], #category : #'GToolkit-Coder-UI-Coder - Basic' } @@ -76,6 +77,11 @@ GtBehaviorCoderActionsElement >> initialize [ toolbarElement := self newToolbarElement labeled: 'Main toolbar'. + + addOnsElementFuture := (BrAsyncElementFuture on: self) + executionConfiguration: (GtSingleCoderViewModel addOnsExecutionConfiguration); + whenSuccess: [ :anEditorElement :theAddOns | + self behaviorCoderViewModel onAddOnsChanged: theAddOns ]. self addChildren: { previewsElement. toolbarElement } ] @@ -94,7 +100,16 @@ GtBehaviorCoderActionsElement >> newToolbarElement [ { #category : #callbacks } GtBehaviorCoderActionsElement >> onBehaviourCoderViewModelChanged [ self updatePreviews. - self updateToolbarActions + self updateToolbarActions. + addOnsElementFuture future: self behaviorCoderViewModel addOnsFuture +] + +{ #category : #'event handling' } +GtBehaviorCoderActionsElement >> onViewModelRecomputeAddOns: aRecomputeAddOnRequest [ + aRecomputeAddOnRequest coderViewModel == self behaviorCoderViewModel + ifFalse: [ ^ self ]. + + addOnsElementFuture future: self behaviorCoderViewModel addOnsFuture ] { #category : #updating } @@ -110,11 +125,13 @@ GtBehaviorCoderActionsElement >> removeToolbarActions [ { #category : #subscriptions } GtBehaviorCoderActionsElement >> subscribeToBehaviorCoderViewModel [ - self behaviorCoderViewModel weak - when: GtPharoBehaviorCoderViewModelAddonsChangedAnnouncement - send: #updateContent - to: self + when: GtPharoBehaviorCoderViewModelAddonsChangedAnnouncement + send: #updateContent + to: self; + when: GtCoderViewModelRecomputeAddOnRequest + send: #onViewModelRecomputeAddOns: + to: self ] { #category : #subscriptions } From 1e43f4469bc3ab827457094772a035a00f10cb98 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 29 Nov 2024 16:59:31 -0300 Subject: [PATCH 0800/1268] set `GtPreviewChangeButton` id [feenkcom/gtoolkit#4214] --- .../GtCoderDropDownWithPreviewAction.extension.st | 1 + 1 file changed, 1 insertion(+) diff --git a/src/GToolkit-Coder-UI/GtCoderDropDownWithPreviewAction.extension.st b/src/GToolkit-Coder-UI/GtCoderDropDownWithPreviewAction.extension.st index c2697730e..fe6a05499 100644 --- a/src/GToolkit-Coder-UI/GtCoderDropDownWithPreviewAction.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderDropDownWithPreviewAction.extension.st @@ -3,6 +3,7 @@ Extension { #name : #GtCoderDropDownWithPreviewAction } { #category : #'*GToolkit-Coder-UI' } GtCoderDropDownWithPreviewAction >> buildElementIn: aCoderActionsElement [ ^ GtPreviewChangeButton new + id: self id; icon: self icon; label: self title; changeAction: self changeAction; From a0c32bde5946a428d9bd66b4ce74bcd0c2793d10 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 29 Nov 2024 16:59:58 -0300 Subject: [PATCH 0801/1268] fix `GtCoderAction>>#gtSourceCodeFor:` view --- src/GToolkit-Coder-Extensions/GtCoderAction.extension.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-Extensions/GtCoderAction.extension.st b/src/GToolkit-Coder-Extensions/GtCoderAction.extension.st index 8d81c521a..5cc0e7275 100644 --- a/src/GToolkit-Coder-Extensions/GtCoderAction.extension.st +++ b/src/GToolkit-Coder-Extensions/GtCoderAction.extension.st @@ -4,6 +4,6 @@ Extension { #name : #GtCoderAction } GtCoderAction >> gtSourceCodeFor: aView [ ^ self action - ifNil: [ aView ] + ifNil: [ aView empty ] ifNotNil: [ self action gtSourceCodeFor: aView ] ] From 76310ab9b36c9e80f5b5523b072993f8b50ee4f2 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 4 Dec 2024 10:47:35 -0300 Subject: [PATCH 0802/1268] use `anElement phlow spawnPreviousEvent:` [feenkcom/gtoolkit#4222] --- src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st | 5 ++--- .../GtPlaygroundEvaluatedCodeButtonAttribute.class.st | 7 +------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st index c6ad482b9..15d9778ff 100644 --- a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st @@ -182,9 +182,8 @@ GtCoderExampleStateElement >> newTooltipContent [ | aContainer | aContainer := BrFrame new fitContent; - when: GtPhlowObjectToSpawn do: [ :anEvent | self fireEvent: (GtPhlowObjectToSpawn new - object: anEvent object; - sourceElement: anEvent target) ]. + when: GtPhlowObjectToSpawn do: [ :anEvent | + self phlow spawnPreviousEvent: anEvent ]. aContainer addChild: (self example hasResult ifTrue: [ self newInspectorWithExampleResult ] ifFalse: [ self newNotExecutedTooltipContent ]). diff --git a/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st b/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st index 231cd167e..46b27a6e8 100644 --- a/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st @@ -40,12 +40,7 @@ GtPlaygroundEvaluatedCodeButtonAttribute >> affect: aTBrTextEditorTextualPiece i c vertical fitContent ]; when: GtPhlowObjectToSpawn do: [ :anEvent | - aButton - fireEvent: (GtPhlowObjectToSpawn new - previousSpawnEvent: anEvent; - tool: anEvent tool; - sourceElement: aButton; - spawnDestination: self spawnDestination) ]. + aButton phlow spawnPreviousEvent: anEvent ]. self playgroundElementIn: aContainer ]) showDelay: 200 milliSeconds); size: 8 @ 8; geometry: BlEllipseGeometry new; From cc9a606bd8488fe48be99e85b89e0a92c47b8892 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 6 Dec 2024 17:05:47 -0300 Subject: [PATCH 0803/1268] introduce `GtCoderObject` and `GtCoderUndefinedObject` [feenkcom/gtoolkit#4230] --- .../GtCoderViewModelRequester.class.st | 5 ++ .../TGtCoderWithSelfObjectHolder.trait.st | 64 +++++++++++++++++ src/GToolkit-Coder/GtCoderObject.class.st | 61 +++++++++++++++++ .../GtCoderUndefinedObject.class.st | 34 ++++++++++ src/GToolkit-Coder/TGtCoderObject.trait.st | 17 +++++ .../TGtCoderWithBehaviorHolder.trait.st | 68 +++++++++++++++++++ .../TGtCoderWithObjectHolder.trait.st | 62 +++++++++++++++++ 7 files changed, 311 insertions(+) create mode 100644 src/GToolkit-Coder-UI/TGtCoderWithSelfObjectHolder.trait.st create mode 100644 src/GToolkit-Coder/GtCoderObject.class.st create mode 100644 src/GToolkit-Coder/GtCoderUndefinedObject.class.st create mode 100644 src/GToolkit-Coder/TGtCoderObject.trait.st create mode 100644 src/GToolkit-Coder/TGtCoderWithBehaviorHolder.trait.st create mode 100644 src/GToolkit-Coder/TGtCoderWithObjectHolder.trait.st diff --git a/src/GToolkit-Coder-UI/GtCoderViewModelRequester.class.st b/src/GToolkit-Coder-UI/GtCoderViewModelRequester.class.st index 12ba7372b..4d9f2beff 100644 --- a/src/GToolkit-Coder-UI/GtCoderViewModelRequester.class.st +++ b/src/GToolkit-Coder-UI/GtCoderViewModelRequester.class.st @@ -46,3 +46,8 @@ GtCoderViewModelRequester >> notifyShowDebuggerRequest: aDebugSession dueTo: anE GtCoderViewModelRequester >> selfObject [ ^ self coderViewModel selfObject ] + +{ #category : #accessing } +GtCoderViewModelRequester >> selfObjectHolder [ + ^ self coderViewModel selfObjectHolder +] diff --git a/src/GToolkit-Coder-UI/TGtCoderWithSelfObjectHolder.trait.st b/src/GToolkit-Coder-UI/TGtCoderWithSelfObjectHolder.trait.st new file mode 100644 index 000000000..14e1746e0 --- /dev/null +++ b/src/GToolkit-Coder-UI/TGtCoderWithSelfObjectHolder.trait.st @@ -0,0 +1,64 @@ +Trait { + #name : #TGtCoderWithSelfObjectHolder, + #instVars : [ + 'selfObjectHolder' + ], + #category : #'GToolkit-Coder-UI-Coder - Basic' +} + +{ #category : #'api - self object' } +TGtCoderWithSelfObjectHolder >> hasSelfObject [ + ^ self ifSelfObject: [ :anObject | true ] ifNone: [ false ] +] + +{ #category : #'api - self object' } +TGtCoderWithSelfObjectHolder >> ifSelfObject: definedBlock ifNone: noneBlock [ + ^ self selfObjectHolder ifDefined: definedBlock ifNone: noneBlock +] + +{ #category : #'api - self object' } +TGtCoderWithSelfObjectHolder >> onSelfObjectHolderChanged [ + "Trait users can perform other actions using this hook." + + +] + +{ #category : #'api - self object' } +TGtCoderWithSelfObjectHolder >> selfObject [ + "Return an object that should be bound to `self` during code evaluation. + Favor using #ifSelfObject:ifNone: to distinguish between defined + self-objects and nil values." + + ^ self selfObjectHolder ifDefined: [ :anObject | anObject ] ifNone: [ nil ] +] + +{ #category : #'api - self object' } +TGtCoderWithSelfObjectHolder >> selfObject: anObject [ + "Assign an object that should be bound to `self` during code evaluation" + + self selfObjectHolder: (GtCoderObject forValue: anObject) +] + +{ #category : #'api - self object' } +TGtCoderWithSelfObjectHolder >> selfObjectHolder [ + + ^ selfObjectHolder ifNil: [ + selfObjectHolder := GtCoderUndefinedObject default ] +] + +{ #category : #'api - self object' } +TGtCoderWithSelfObjectHolder >> selfObjectHolder: aTGtCoderObject [ + self + assert: [ aTGtCoderObject isNotNil ] + description: [ 'selfObject holder must not be nil.' ]. + + self selfObjectHolder = aTGtCoderObject ifTrue: [ ^ self ]. + + selfObjectHolder := aTGtCoderObject. + self onSelfObjectHolderChanged +] + +{ #category : #'api - self object' } +TGtCoderWithSelfObjectHolder >> selfObjectIfNone: noneBlock [ + ^ self ifSelfObject: #yourself ifNone: noneBlock +] diff --git a/src/GToolkit-Coder/GtCoderObject.class.st b/src/GToolkit-Coder/GtCoderObject.class.st new file mode 100644 index 000000000..132b30149 --- /dev/null +++ b/src/GToolkit-Coder/GtCoderObject.class.st @@ -0,0 +1,61 @@ +" +I am a basic value holder, identifying an existing value. +Users can use {{gtMethod:GtCoderObject>>#ifDefined:ifNone:}} to distinguish between defined and undefined values. + +" +Class { + #name : #GtCoderObject, + #superclass : #Object, + #traits : 'TGtCoderObject', + #classTraits : 'TGtCoderObject classTrait', + #instVars : [ + 'value' + ], + #category : #'GToolkit-Coder-Object Holder' +} + +{ #category : #'instance creation' } +GtCoderObject class >> forValue: anObject [ + ^ self new value: anObject +] + +{ #category : #comparing } +GtCoderObject >> = anObject [ + self == anObject ifTrue: [ ^ true ]. + + ^ self class = anObject class and: [ self value = anObject value ] +] + +{ #category : #printing } +GtCoderObject >> gtDisplayOn: aStream [ + self value gtDisplayOn: aStream +] + +{ #category : #comparing } +GtCoderObject >> hash [ + ^ self value hash +] + +{ #category : #'api - accessing' } +GtCoderObject >> ifDefined: definedBlock ifNone: noneBlock [ + ^ definedBlock cull: value +] + +{ #category : #printing } +GtCoderObject >> printOn: aStream [ + super printOn: aStream. + aStream + nextPut: $(; + print: value; + nextPut: $) +] + +{ #category : #accessing } +GtCoderObject >> value [ + ^ value +] + +{ #category : #accessing } +GtCoderObject >> value: anObject [ + value := anObject +] diff --git a/src/GToolkit-Coder/GtCoderUndefinedObject.class.st b/src/GToolkit-Coder/GtCoderUndefinedObject.class.st new file mode 100644 index 000000000..b7f03124b --- /dev/null +++ b/src/GToolkit-Coder/GtCoderUndefinedObject.class.st @@ -0,0 +1,34 @@ +" +I am a basic value holder, identifying that a value does not exist. +Users can use {{gtMethod:GtCoderUndefinedObject>>#ifDefined:ifNone:}} to distinguish between defined and undefined values. + +" +Class { + #name : #GtCoderUndefinedObject, + #superclass : #Object, + #traits : 'TGtCoderObject + TGtUniqueInstance', + #classTraits : 'TGtCoderObject classTrait + TGtUniqueInstance classTrait', + #classInstVars : [ + 'uniqueInstance' + ], + #category : #'GToolkit-Coder-Object Holder' +} + +{ #category : #printing } +GtCoderUndefinedObject >> gtDisplayOn: aStream [ + aStream nextPutAll: 'Missing object' +] + +{ #category : #'api - accessing' } +GtCoderUndefinedObject >> ifDefined: definedBlock ifNone: noneBlock [ + ^ noneBlock value +] + +{ #category : #printing } +GtCoderUndefinedObject >> printOn: aStream [ + super printOn: aStream. + aStream + nextPut: $(; + nextPutAll: 'Missing object'; + nextPut: $) +] diff --git a/src/GToolkit-Coder/TGtCoderObject.trait.st b/src/GToolkit-Coder/TGtCoderObject.trait.st new file mode 100644 index 000000000..88b4b5494 --- /dev/null +++ b/src/GToolkit-Coder/TGtCoderObject.trait.st @@ -0,0 +1,17 @@ +" +I define common API for object holders. +See my users for more details: {{gtClass:TGtCoderObject | show= #gtUsersFor: | expanded=true}}. +" +Trait { + #name : #TGtCoderObject, + #category : #'GToolkit-Coder-Object Holder' +} + +{ #category : #'api - accessing' } +TGtCoderObject >> ifDefined: definedBlock ifNone: noneBlock [ + "Evaluate definedBlock if a self-object is defined, + passing the object as an argument: [ :aSelfObject | ]. + Evaluate noneBlock if the self-object is not defined." + + ^ self explicitRequirement +] diff --git a/src/GToolkit-Coder/TGtCoderWithBehaviorHolder.trait.st b/src/GToolkit-Coder/TGtCoderWithBehaviorHolder.trait.st new file mode 100644 index 000000000..5ab1791aa --- /dev/null +++ b/src/GToolkit-Coder/TGtCoderWithBehaviorHolder.trait.st @@ -0,0 +1,68 @@ +Trait { + #name : #TGtCoderWithBehaviorHolder, + #instVars : [ + 'behaviorHolder' + ], + #category : #'GToolkit-Coder-Object Holder' +} + +{ #category : #'api - object' } +TGtCoderWithBehaviorHolder >> behavior [ + "Return an assigned object. + Favor using #ifBehavior:ifNone: to distinguish between defined + behaviors and UndeclaredVariable." + + ^ self behaviorHolder ifDefined: [ :anObject | anObject ] ifNone: [ UndeclaredVariable ] +] + +{ #category : #'api - object' } +TGtCoderWithBehaviorHolder >> behavior: aBehavior [ + "Assign a behavior" + + self + assert: [ (aBehavior = nil) not ] + description: [ 'Behavior must be non-nil' ]. + + self behaviorHolder: (GtCoderObject forValue: aBehavior) +] + +{ #category : #'api - object' } +TGtCoderWithBehaviorHolder >> behaviorHolder [ + + ^ behaviorHolder ifNil: [ + behaviorHolder := GtCoderUndefinedObject default ] +] + +{ #category : #'api - object' } +TGtCoderWithBehaviorHolder >> behaviorHolder: aTGtCoderObject [ + self + assert: [ aTGtCoderObject isNotNil ] + description: [ 'behavior holder must not be nil.' ]. + + self behaviorHolder = aTGtCoderObject ifTrue: [ ^ self ]. + + behaviorHolder := aTGtCoderObject. + self onBehaviorHolderChanged +] + +{ #category : #'api - object' } +TGtCoderWithBehaviorHolder >> behaviorIfNone: noneBlock [ + ^ self ifBehavior: #yourself ifNone: noneBlock +] + +{ #category : #'api - object' } +TGtCoderWithBehaviorHolder >> hasBehavior [ + ^ self ifBehavior: [ :aBehavior | true ] ifNone: [ false ] +] + +{ #category : #'api - object' } +TGtCoderWithBehaviorHolder >> ifBehavior: definedBlock ifNone: noneBlock [ + ^ self behaviorHolder ifDefined: definedBlock ifNone: noneBlock +] + +{ #category : #'api - object' } +TGtCoderWithBehaviorHolder >> onBehaviorHolderChanged [ + "Trait users can perform other actions using this hook." + + +] diff --git a/src/GToolkit-Coder/TGtCoderWithObjectHolder.trait.st b/src/GToolkit-Coder/TGtCoderWithObjectHolder.trait.st new file mode 100644 index 000000000..e7a3620b8 --- /dev/null +++ b/src/GToolkit-Coder/TGtCoderWithObjectHolder.trait.st @@ -0,0 +1,62 @@ +Trait { + #name : #TGtCoderWithObjectHolder, + #instVars : [ + 'objectHolder' + ], + #category : #'GToolkit-Coder-Object Holder' +} + +{ #category : #'api - object' } +TGtCoderWithObjectHolder >> hasObject [ + ^ self ifObject: [ :anObject | true ] ifNone: [ false ] +] + +{ #category : #'api - object' } +TGtCoderWithObjectHolder >> ifObject: definedBlock ifNone: noneBlock [ + ^ self objectHolder ifDefined: definedBlock ifNone: noneBlock +] + +{ #category : #'api - object' } +TGtCoderWithObjectHolder >> object [ + "Return an assigned object. + Favor using #ifObject:ifNone: to distinguish between defined + objects and nil values." + + ^ self objectHolder ifDefined: [ :anObject | anObject ] ifNone: [ nil ] +] + +{ #category : #'api - object' } +TGtCoderWithObjectHolder >> object: anObject [ + self objectHolder: (GtCoderObject forValue: anObject) +] + +{ #category : #'api - object' } +TGtCoderWithObjectHolder >> objectHolder [ + + ^ objectHolder ifNil: [ + objectHolder := GtCoderUndefinedObject default ] +] + +{ #category : #'api - object' } +TGtCoderWithObjectHolder >> objectHolder: aTGtCoderObject [ + self + assert: [ aTGtCoderObject isNotNil ] + description: [ 'object holder must not be nil.' ]. + + self objectHolder = aTGtCoderObject ifTrue: [ ^ self ]. + + objectHolder := aTGtCoderObject. + self onObjectHolderChanged +] + +{ #category : #'api - object' } +TGtCoderWithObjectHolder >> objectIfNone: noneBlock [ + ^ self ifObject: #yourself ifNone: noneBlock +] + +{ #category : #'api - object' } +TGtCoderWithObjectHolder >> onObjectHolderChanged [ + "Trait users can perform other actions using this hook." + + +] From 2de1db050d502fe51a8d611b06c6f8a4495668c5 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Sat, 7 Dec 2024 09:00:45 +0100 Subject: [PATCH 0804/1268] split up coder addons computation into multiple workers --- .../GtBehaviorCoderActionsElement.class.st | 2 +- .../GtSingleCoderViewModel.class.st | 25 +++++++++++++++++-- .../GtTextualCoderEditorElement.class.st | 2 +- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtBehaviorCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtBehaviorCoderActionsElement.class.st index c0613f2b4..8bcf10400 100644 --- a/src/GToolkit-Coder-UI/GtBehaviorCoderActionsElement.class.st +++ b/src/GToolkit-Coder-UI/GtBehaviorCoderActionsElement.class.st @@ -79,7 +79,7 @@ GtBehaviorCoderActionsElement >> initialize [ labeled: 'Main toolbar'. addOnsElementFuture := (BrAsyncElementFuture on: self) - executionConfiguration: (GtSingleCoderViewModel addOnsExecutionConfiguration); + executionConfiguration: (GtSingleCoderViewModel behaviourAddOnsExecutionConfiguration); whenSuccess: [ :anEditorElement :theAddOns | self behaviorCoderViewModel onAddOnsChanged: theAddOns ]. diff --git a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st index 51760fa88..8cd58059e 100644 --- a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st @@ -24,8 +24,29 @@ Class { { #category : #accessing } GtSingleCoderViewModel class >> addOnsExecutionConfiguration [ + ^ self methodAddOnsExecutionConfiguration +] + +{ #category : #accessing } +GtSingleCoderViewModel class >> behaviourAddOnsExecutionConfiguration [ + ^ AsyncFutureExecutionConfiguration new + customGroup: #ClassCoderAddOn; + lowPriority +] + +{ #category : #accessing } +GtSingleCoderViewModel class >> methodAddOnsExecutionConfiguration [ + ^ AsyncFutureExecutionConfiguration new + customGroup: #MethodCoderAddOn; + maxAmountOfWorkers: 2; + defaultPriority +] + +{ #category : #accessing } +GtSingleCoderViewModel class >> secondaryMethodAddOnsExecutionConfiguration [ ^ AsyncFutureExecutionConfiguration new - customGroup: #CoderAddOn; + customGroup: #SecondaryMethodCoderAddOn; + maxAmountOfWorkers: 1; lowPriority ] @@ -40,7 +61,7 @@ GtSingleCoderViewModel >> addMainAction: aGtCoderAction [ GtSingleCoderViewModel >> addOns [ - ^ self addOnsFuture await: self class addOnsExecutionConfiguration + ^ self addOnsFuture await: self class methodAddOnsExecutionConfiguration ] { #category : #'api - add-ons' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index ec655ee78..0e76c5c05 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -130,7 +130,7 @@ GtTextualCoderEditorElement >> initialize [ action: (MessageSend receiver: self selector: #privateUpdateText:announcement:). addOnsElementFuture := (BrAsyncElementFuture on: self) - executionConfiguration: (GtSingleCoderViewModel addOnsExecutionConfiguration); + executionConfiguration: (GtSingleCoderViewModel methodAddOnsExecutionConfiguration); whenSuccess: [ :anEditorElement :theAddOns | self textualCoderViewModel onAddOnsChanged: theAddOns ]. From f9ac56ec881f15a724c88584b3a5d8a5c63b8b25 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Sat, 7 Dec 2024 13:48:39 -0300 Subject: [PATCH 0805/1268] add `TCoderByScripterExamples>>#scripterInPagerForBlock:` [feenkcom/gtoolkit#4231] --- .../TCoderByScripterExamples.trait.st | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st b/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st index bc3f145c1..86d6b451e 100644 --- a/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st +++ b/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st @@ -50,6 +50,26 @@ TCoderByScripterExamples >> scripterForBlock: aBlock [ ^ aScripter ] +{ #category : #utilities } +TCoderByScripterExamples >> scripterInPagerForBlock: aBlock [ + + | aScripter | + aScripter := self scripter. + aScripter substep: 'Initialize Coder Model and UI' do: [ :aStep | + aStep set + label: 'Initialize Coder Model'; + model: aBlock; + play. + aStep set + label: 'Initialize Coder UI'; + element: [ :aCoder | + GtPager createWrappedOn: aCoder asElement ]; + onModel; + play ]. + + ^ aScripter +] + { #category : #utilities } TCoderByScripterExamples >> selectTextFor: aScripterOrStep from: aStartPosition to: aToPosition andCheck: aSelectedString [ From c46f2daa46634789189f318041d125a30a9284e0 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 9 Dec 2024 11:07:39 -0300 Subject: [PATCH 0806/1268] add `GtTextualCoderMenu` [feenkcom/gtoolkit#4180] --- .../GtTextualCoderMenu.class.st | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st diff --git a/src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st b/src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st new file mode 100644 index 000000000..1fe5f8509 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st @@ -0,0 +1,51 @@ +Class { + #name : #GtTextualCoderMenu, + #superclass : #BrMenu, + #instVars : [ + 'coder', + 'coderViewModelStencil' + ], + #category : #'GToolkit-Coder-UI-Menu' +} + +{ #category : #'api - converting' } +GtTextualCoderMenu >> asElement [ + | aCoderViewModel aCoderElement | + coderViewModelStencil ifNil: [ ^ nil ]. + aCoderViewModel := coderViewModelStencil create. + aCoderViewModel ifNil: [ ^ nil ]. + + aCoderElement := aCoderViewModel asExpandedOnlyElement. + aCoderElement + hExact: 500; + vExact: 400; + geometry: (BlChildrenWrappingGeometry cornerRadius: 4); + background: aCoderElement theme default contentBackgroundColor; + addAptitude: BrMenuPinnableAptitude new. + + self announcer weak + when: BrMenuHideRequest + send: #removeFromParent + to: aCoderElement. + ^ aCoderElement +] + +{ #category : #'api - initialization' } +GtTextualCoderMenu >> coder: aCoder [ + self coderViewModelStencil: [ aCoder asCoderViewModel ] asStencil +] + +{ #category : #'api - initialization' } +GtTextualCoderMenu >> coderStencil: aCoderStencil [ + self coderViewModelStencil: [ aCoderStencil asStencil create asCoderViewModel ] asStencil +] + +{ #category : #'api - initialization' } +GtTextualCoderMenu >> coderViewModel: aCoderViewModel [ + self coderViewModelStencil: [ aCoderViewModel ] asStencil +] + +{ #category : #'api - initialization' } +GtTextualCoderMenu >> coderViewModelStencil: aCoderViewModelStencil [ + coderViewModelStencil := aCoderViewModelStencil asStencil +] From 1bb6c4fa137223f926353f499775da5efbc090f1 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 9 Dec 2024 17:40:05 -0300 Subject: [PATCH 0807/1268] menu: use `BrMenuCommonAptitude` [feenkcom/gtoolkit#4180] --- src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st b/src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st index 1fe5f8509..13f3e8047 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st @@ -18,10 +18,10 @@ GtTextualCoderMenu >> asElement [ aCoderElement := aCoderViewModel asExpandedOnlyElement. aCoderElement hExact: 500; - vExact: 400; - geometry: (BlChildrenWrappingGeometry cornerRadius: 4); - background: aCoderElement theme default contentBackgroundColor; - addAptitude: BrMenuPinnableAptitude new. + vFitContentLimited; + addAptitude: BrGlamorousFocusableShadowAptitude new; + addAptitude: BrMenuPinnableAptitude new; + addAptitude: BrMenuCommonAptitude new. self announcer weak when: BrMenuHideRequest From eca8f26946248498542b3218d9f95e5555369349 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 12 Dec 2024 10:02:56 -0300 Subject: [PATCH 0808/1268] coder by scripter: scroll to a given context menu item --- .../TCoderByScripterExamples.trait.st | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st b/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st index 86d6b451e..0f9ce5286 100644 --- a/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st +++ b/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st @@ -9,6 +9,15 @@ TCoderByScripterExamples >> openAndClickOnContextMenuItemFor: aScripterOrStep id aScripterOrStep secondaryClickStep: [:s | s label: 'Open context menu'; // GtSourceCoderEditorId]. + + aScripterOrStep do + label: 'Scroll to ', aBlElementId asSymbol; + block: [ :aList | aList scrollToItemSuchThat: [ :each | + each id asBlocElementId = aBlElementId asBlocElementId ] ]; + onSpaceRoot; + // BrAnchoredOuterContainer; + onThisOrBreadthFirstChildOfKind: BrList; + play. aScripterOrStep mouseMoveOverStep: [:s | s label: 'Hover ' , aBlElementId asSymbol; From 330578f82de799dbf40919bb8b2cfc20b0731576 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 13 Dec 2024 13:30:18 -0300 Subject: [PATCH 0809/1268] fix `Behavior>>#gtBrowseButtonFor:` button --- src/GToolkit-Coder-UI/Behavior.extension.st | 47 +++++++-------------- 1 file changed, 16 insertions(+), 31 deletions(-) diff --git a/src/GToolkit-Coder-UI/Behavior.extension.st b/src/GToolkit-Coder-UI/Behavior.extension.st index ca9b707b9..fe7939dff 100644 --- a/src/GToolkit-Coder-UI/Behavior.extension.st +++ b/src/GToolkit-Coder-UI/Behavior.extension.st @@ -3,38 +3,23 @@ Extension { #name : #Behavior } { #category : #'*GToolkit-Coder-UI' } Behavior >> gtBrowseButtonFor: anAction [ - ^ anAction explicit + + ^ anAction button priority: 1; - stencil: [ | button | - button := BrButton new - id: GtCoderBrowseCoderButtonId; - aptitude: BrGlamorousButtonWithIconAptitude; - label: 'Browse class'; - icon: BrGlamorousVectorIcons emphasizedBrowse; - action: [ :aButton :aModel :anEvent | - anEvent modifiers isPrimaryModifier - ifTrue: [ self gtBrowseFromButton: aButton ] - ifFalse: [ aButton phlow - spawnTool: (GtPhlowExplicitTool new - name: self gtDisplayString; - stencil: [ | aCoder | - aButton phlow firstParentCoderNavigationModel - coderDo: [ :oldCoder | aCoder := GtCoderElement forCoder: oldCoder asNewCoderModelWithSameSubject ]. - aCoder ]) ] ]. - button viewModel - when: BlClickEvent - do: [ :anEvent | - anEvent modifiers isPrimaryModifier - ifTrue: [ button viewModel clickEvent: anEvent ] ]. - button viewModel - when: BlMouseEnterEvent - do: [ :anEvent | - anEvent consumed: true. - anEvent modifiers isPrimaryModifier - ifTrue: [ anEvent target mouseCursor: BlCopyCursor new ] - ifFalse: [ anEvent target mouseCursor: nil ]. - anEvent target requestFocus ]. - button ] + tooltip: 'Browse class'; + icon: BrGlamorousVectorIcons emphasizedBrowse; + action: [ :aButton | + aButton phlow + spawnTool: (GtPhlowExplicitTool new + name: self gtDisplayString; + stencil: [ + | aCoder | + aButton phlow firstParentCoderNavigationModel + coderDo: [ :oldCoder | + aCoder := GtCoderElement forCoder: oldCoder asNewCoderModelWithSameSubject ]. + aCoder ]) ]; + primaryModifierAction: [ :aButton | self gtBrowseFromButton: aButton ] + mouseCursor: BlCopyCursor new. ] { #category : #'*GToolkit-Coder-UI' } From e3e2229c0dbb5a88ce2ad5d414e65ed88b7af49f Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 13 Dec 2024 14:06:20 -0300 Subject: [PATCH 0810/1268] move some UI code to UI package --- .../GtCoderModel.extension.st | 42 +++++++++++++++++++ .../GtCompositeDiffChange.extension.st | 8 ++++ .../GtSourceCoder.extension.st | 23 ++++++++++ .../GtSourceCoderRequester.extension.st | 14 +++++++ .../RPackage.extension.st | 2 +- src/GToolkit-Coder/GtCoderModel.class.st | 42 ------------------- .../GtCompositeDiffChange.class.st | 7 ---- src/GToolkit-Coder/GtSourceCoder.class.st | 22 ---------- .../GtSourceCoderRequester.class.st | 13 ------ 9 files changed, 88 insertions(+), 85 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCompositeDiffChange.extension.st create mode 100644 src/GToolkit-Coder-UI/GtSourceCoder.extension.st create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderRequester.extension.st rename src/{GToolkit-Coder => GToolkit-Coder-UI}/RPackage.extension.st (72%) diff --git a/src/GToolkit-Coder-UI/GtCoderModel.extension.st b/src/GToolkit-Coder-UI/GtCoderModel.extension.st index 780141be3..d32cb8cfc 100644 --- a/src/GToolkit-Coder-UI/GtCoderModel.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderModel.extension.st @@ -35,3 +35,45 @@ GtCoderModel >> coderLook: aLookOrBlock [ GtCoderModel >> elementClass [ ^ GtExpandableSourceCoderElement ] + +{ #category : #'*GToolkit-Coder-UI' } +GtCoderModel class >> gtAstCoderAddOnsFor: aView context: aPhlowContext [ + + ^ aView forward + title: 'Coder Addons'; + tooltip: 'The methods that extend the Coder with AddOns'; + priority: 45; + object: [ (GtSearchMethodsInClassFilter new + forClass: self; + includeSuperclass: true) + & (self astExtensionsPragma gtPragmas | #initializeAddOns: gtImplementors + | #initializeAddOns:viewModel: gtImplementors) ]; + view: #gtItemsFor:; + actionButtonIcon: BrGlamorousVectorIcons inspect + tooltip: 'Inspect Addons' + action: [ :aButton | + aButton phlow + spawnObject: (GtSearchMethodsInClassFilter new + forClass: self; + includeSuperclass: true) & self astExtensionsPragma gtPragmas ] +] + +{ #category : #'*GToolkit-Coder-UI' } +GtCoderModel class >> gtContextMenuAddOnsFor: aView [ + + + ^ aView forward + title: 'Menu addons'; + tooltip: 'The methods that extend the Coder with context menu items'; + priority: 45.1; + object: [ (GtSearchMethodsInClassFilter new + forClass: self; + includeSuperclass: true) & self contextMenuAddOnsPragma gtPragmas ]; + view: #gtItemsFor:; + actionButtonIcon: BrGlamorousVectorIcons inspect + tooltip: 'Inspect Addons' + action: [ :aButton | + aButton phlow spawnObject: (GtSearchMethodsInClassFilter new + forClass: self; + includeSuperclass: true) & self contextMenuAddOnsPragma gtPragmas ] +] diff --git a/src/GToolkit-Coder-UI/GtCompositeDiffChange.extension.st b/src/GToolkit-Coder-UI/GtCompositeDiffChange.extension.st new file mode 100644 index 000000000..a875fbe50 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCompositeDiffChange.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #GtCompositeDiffChange } + +{ #category : #'*GToolkit-Coder-UI' } +GtCompositeDiffChange >> asElement [ + ^ (GtDiffElement onChange: self) + addAptitude: GtDiffFlatAptitude; + showButtons +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoder.extension.st b/src/GToolkit-Coder-UI/GtSourceCoder.extension.st new file mode 100644 index 000000000..551fbe11f --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoder.extension.st @@ -0,0 +1,23 @@ +Extension { #name : #GtSourceCoder } + +{ #category : #'*GToolkit-Coder-UI' } +GtSourceCoder >> notifyShowDebuggerRequest: aDebugSession dueTo: anException sourceString: aSourceString sourceInterval: aSourceInterval evaluationInfo: anEvaluationInfo [ + "Return true if announcement was handled (and debugger displayed in some way). + Return false otherwise." + + + | anAnnouncement aSharedDebugSession | + aSharedDebugSession := GtSharedDebugSession new + session: aDebugSession. + anAnnouncement := GtCoderShowDebuggerRequest new + coder: self; + debugSession: aDebugSession; + sharedDebugSession: aSharedDebugSession; + exception: anException; + sourceString: aSourceString; + sourceInterval: aSourceInterval; + evaluationInfo: anEvaluationInfo. + self announce: anAnnouncement. + + ^ anAnnouncement isDelivered +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderRequester.extension.st b/src/GToolkit-Coder-UI/GtSourceCoderRequester.extension.st new file mode 100644 index 000000000..be3f55c25 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderRequester.extension.st @@ -0,0 +1,14 @@ +Extension { #name : #GtSourceCoderRequester } + +{ #category : #'*GToolkit-Coder-UI' } +GtSourceCoderRequester >> notifyShowDebuggerRequest: aDebugSession dueTo: anException sourceString: aSourceString sourceInterval: aSourceInterval evaluationInfo: anEvaluationInfo [ + "Return true if announcement was handled (and debugger displayed in some way). + Return false otherwise." + + ^ self coder + notifyShowDebuggerRequest: aDebugSession + dueTo: anException + sourceString: aSourceString + sourceInterval: aSourceInterval + evaluationInfo: anEvaluationInfo +] diff --git a/src/GToolkit-Coder/RPackage.extension.st b/src/GToolkit-Coder-UI/RPackage.extension.st similarity index 72% rename from src/GToolkit-Coder/RPackage.extension.st rename to src/GToolkit-Coder-UI/RPackage.extension.st index b904326af..091f229b7 100644 --- a/src/GToolkit-Coder/RPackage.extension.st +++ b/src/GToolkit-Coder-UI/RPackage.extension.st @@ -1,6 +1,6 @@ Extension { #name : #RPackage } -{ #category : #'*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder-UI' } RPackage >> gtSpawnCoder [ ^ GtPackageCoderTool package: self ] diff --git a/src/GToolkit-Coder/GtCoderModel.class.st b/src/GToolkit-Coder/GtCoderModel.class.st index 6b7ece528..76205aa5b 100644 --- a/src/GToolkit-Coder/GtCoderModel.class.st +++ b/src/GToolkit-Coder/GtCoderModel.class.st @@ -44,48 +44,6 @@ GtCoderModel class >> contextMenuAddOnsPragma [ ^ #gtCoderContextMenuAddOns: ] -{ #category : #'private - addons' } -GtCoderModel class >> gtAstCoderAddOnsFor: aView context: aPhlowContext [ - - ^ aView forward - title: 'Coder Addons'; - tooltip: 'The methods that extend the Coder with AddOns'; - priority: 45; - object: [ (GtSearchMethodsInClassFilter new - forClass: self; - includeSuperclass: true) - & (self astExtensionsPragma gtPragmas | #initializeAddOns: gtImplementors - | #initializeAddOns:viewModel: gtImplementors) ]; - view: #gtItemsFor:; - actionButtonIcon: BrGlamorousVectorIcons inspect - tooltip: 'Inspect Addons' - action: [ :aButton | - aButton phlow - spawnObject: (GtSearchMethodsInClassFilter new - forClass: self; - includeSuperclass: true) & self astExtensionsPragma gtPragmas ] -] - -{ #category : #'private - addons' } -GtCoderModel class >> gtContextMenuAddOnsFor: aView [ - - - ^ aView forward - title: 'Menu addons'; - tooltip: 'The methods that extend the Coder with context menu items'; - priority: 45.1; - object: [ (GtSearchMethodsInClassFilter new - forClass: self; - includeSuperclass: true) & self contextMenuAddOnsPragma gtPragmas ]; - view: #gtItemsFor:; - actionButtonIcon: BrGlamorousVectorIcons inspect - tooltip: 'Inspect Addons' - action: [ :aButton | - aButton phlow spawnObject: (GtSearchMethodsInClassFilter new - forClass: self; - includeSuperclass: true) & self contextMenuAddOnsPragma gtPragmas ] -] - { #category : #'class initialization' } GtCoderModel class >> initialize [ UniqueIdGenerator := BlUniqueIdGenerator new diff --git a/src/GToolkit-Coder/GtCompositeDiffChange.class.st b/src/GToolkit-Coder/GtCompositeDiffChange.class.st index b83c52f67..a8db0b21f 100644 --- a/src/GToolkit-Coder/GtCompositeDiffChange.class.st +++ b/src/GToolkit-Coder/GtCompositeDiffChange.class.st @@ -35,13 +35,6 @@ GtCompositeDiffChange >> applyAttributesToOutput: aText [ changes do: [ :each | each applyAttributesToOutput: aText ] ] -{ #category : #accessing } -GtCompositeDiffChange >> asElement [ - ^ (GtDiffElement onChange: self) - addAptitude: GtDiffFlatAptitude; - showButtons -] - { #category : #accessing } GtCompositeDiffChange >> changes [ ^ changes diff --git a/src/GToolkit-Coder/GtSourceCoder.class.st b/src/GToolkit-Coder/GtSourceCoder.class.st index 6f11a5f22..5dd47b30d 100644 --- a/src/GToolkit-Coder/GtSourceCoder.class.st +++ b/src/GToolkit-Coder/GtSourceCoder.class.st @@ -377,28 +377,6 @@ GtSourceCoder >> notifyPrintResult: anEvaluationResult [ coder: self) ] -{ #category : #'api - notifying' } -GtSourceCoder >> notifyShowDebuggerRequest: aDebugSession dueTo: anException sourceString: aSourceString sourceInterval: aSourceInterval evaluationInfo: anEvaluationInfo [ - "Return true if announcement was handled (and debugger displayed in some way). - Return false otherwise." - - - | anAnnouncement aSharedDebugSession | - aSharedDebugSession := GtSharedDebugSession new - session: aDebugSession. - anAnnouncement := GtCoderShowDebuggerRequest new - coder: self; - debugSession: aDebugSession; - sharedDebugSession: aSharedDebugSession; - exception: anException; - sourceString: aSourceString; - sourceInterval: aSourceInterval; - evaluationInfo: anEvaluationInfo. - self announce: anAnnouncement. - - ^ anAnnouncement isDelivered -] - { #category : #'private - notifying' } GtSourceCoder >> notifyToolSpawn: aTool withDestination: aSpawnDestination requesterObject: aRequester [ self announce: (GtCoderToolSpawnRequest new diff --git a/src/GToolkit-Coder/GtSourceCoderRequester.class.st b/src/GToolkit-Coder/GtSourceCoderRequester.class.st index 7bbd960e5..071922403 100644 --- a/src/GToolkit-Coder/GtSourceCoderRequester.class.st +++ b/src/GToolkit-Coder/GtSourceCoderRequester.class.st @@ -18,16 +18,3 @@ GtSourceCoderRequester >> coder [ GtSourceCoderRequester >> coder: anObject [ coder := anObject ] - -{ #category : #'api - notifying' } -GtSourceCoderRequester >> notifyShowDebuggerRequest: aDebugSession dueTo: anException sourceString: aSourceString sourceInterval: aSourceInterval evaluationInfo: anEvaluationInfo [ - "Return true if announcement was handled (and debugger displayed in some way). - Return false otherwise." - - ^ self coder - notifyShowDebuggerRequest: aDebugSession - dueTo: anException - sourceString: aSourceString - sourceInterval: aSourceInterval - evaluationInfo: anEvaluationInfo -] From dd604f51301498c5b4e2767bfd0a1706c6d9f290 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 13 Dec 2024 14:07:31 -0300 Subject: [PATCH 0811/1268] use `BrMenuModel` to create textual coder context menus [feenkcom/gtoolkit#4180] --- .../GtCoderContextMenuAction.extension.st | 9 +++ .../GtCoderMenuActionItem.class.st | 65 +++++++++++++++++++ .../GtCoderMenuActionItemElement.class.st | 26 ++++++++ .../GtTextualCoderEditorElement.class.st | 34 +++++++++- .../GtTextualCoderViewModel.class.st | 2 + src/GToolkit-Coder/GtCoderAction.class.st | 5 ++ src/GToolkit-Coder/GtCoderAddOns.class.st | 1 + src/GToolkit-Coder/GtCoderModel.class.st | 2 +- 8 files changed, 142 insertions(+), 2 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderContextMenuAction.extension.st create mode 100644 src/GToolkit-Coder-UI/GtCoderMenuActionItem.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderMenuActionItemElement.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderContextMenuAction.extension.st b/src/GToolkit-Coder-UI/GtCoderContextMenuAction.extension.st new file mode 100644 index 000000000..ffbf3834d --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderContextMenuAction.extension.st @@ -0,0 +1,9 @@ +Extension { #name : #GtCoderContextMenuAction } + +{ #category : #'*GToolkit-Coder-UI' } +GtCoderContextMenuAction >> asBrMenuItemForCoderElement: aTextualCoderEditorElement [ + ^ GtCoderMenuActionItem new + textualCoderEditorElement: aTextualCoderEditorElement; + coderContextMenuAction: self; + yourself +] diff --git a/src/GToolkit-Coder-UI/GtCoderMenuActionItem.class.st b/src/GToolkit-Coder-UI/GtCoderMenuActionItem.class.st new file mode 100644 index 000000000..18eb799ef --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderMenuActionItem.class.st @@ -0,0 +1,65 @@ +Class { + #name : #GtCoderMenuActionItem, + #superclass : #BrMenuActionItem, + #instVars : [ + 'textualCoderEditorElement' + ], + #category : #'GToolkit-Coder-UI-Coder - Addons' +} + +{ #category : #accessing } +GtCoderMenuActionItem >> coderContextMenuAction [ + + ^ self action +] + +{ #category : #accessing } +GtCoderMenuActionItem >> coderContextMenuAction: anAction [ + self action: anAction. + self id: anAction id. + anAction shortcutKey + ifNotEmpty: [ self label: anAction title shortcut: anAction shortcutKey ] + ifEmpty: [ self label: anAction title ] +] + +{ #category : #'api - converting' } +GtCoderMenuActionItem >> elementType [ + ^ GtCoderMenuActionItemElement +] + +{ #category : #'as yet unclassified' } +GtCoderMenuActionItem >> hoverAction [ + ^ self coderContextMenuAction hoverAction +] + +{ #category : #'as yet unclassified' } +GtCoderMenuActionItem >> leaveAction [ + ^ self coderContextMenuAction leaveAction +] + +{ #category : #'event handling' } +GtCoderMenuActionItem >> onClick: anEvent element: anElement model: aButtonModel [ + self coderContextMenuAction ifNil: [ ^ self ]. + self coderContextMenuAction action ifNotNil: [ :anAction | + anAction gtValueWithArgs: { + textualCoderEditorElement textualCoderViewModel. + textualCoderEditorElement. + anEvent } ]. + self hideOnClick ifTrue: [ self hideAll ] +] + +{ #category : #accessing } +GtCoderMenuActionItem >> textualCoderEditorElement [ + + ^ textualCoderEditorElement +] + +{ #category : #accessing } +GtCoderMenuActionItem >> textualCoderEditorElement: aCoderElement [ + textualCoderEditorElement := aCoderElement +] + +{ #category : #accessing } +GtCoderMenuActionItem >> textualCoderViewModel [ + ^ self textualCoderEditorElement textualCoderViewModel +] diff --git a/src/GToolkit-Coder-UI/GtCoderMenuActionItemElement.class.st b/src/GToolkit-Coder-UI/GtCoderMenuActionItemElement.class.st new file mode 100644 index 000000000..1a554628f --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderMenuActionItemElement.class.st @@ -0,0 +1,26 @@ +Class { + #name : #GtCoderMenuActionItemElement, + #superclass : #BrMenuActionItemElement, + #category : #'GToolkit-Coder-UI-Coder - Addons' +} + +{ #category : #initialization } +GtCoderMenuActionItemElement >> initialize [ + super initialize +] + +{ #category : #'event handling' } +GtCoderMenuActionItemElement >> onMouseEnterEvent: anEvent [ + super onMouseEnterEvent: anEvent. + + self menuModel hoverAction ifNotNil: [ :aHoverBlock | + aHoverBlock cull: self menuModel textualCoderViewModel cull: anEvent ] +] + +{ #category : #'event handling' } +GtCoderMenuActionItemElement >> onMouseLeaveEvent: anEvent [ + super onMouseLeaveEvent: anEvent. + + self menuModel leaveAction ifNotNil: [ :aLeaveBlock | + aLeaveBlock cull: self menuModel textualCoderViewModel cull: anEvent ] +] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 0e76c5c05..5552f0c73 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -47,6 +47,36 @@ GtTextualCoderEditorElement >> computeTextForUpdateForTextChangedEvent: aGtTextu aGtTextualCoderViewModelTextChanged text copy ] ] +{ #category : #'instance creation' } +GtTextualCoderEditorElement >> createContextMenu [ + "wait for the addons to be computed" + + + | aMenu aMenuItemsPromise | + aMenu := BrMenuItems new. + + aMenuItemsPromise := self textualCoderViewModel addOns + asyncThen: [ :theAddOns | + | theItems theContextMenuAstAddons theMenuItems | + "extra context menu items that depend on ast and view model state such as selection" + theContextMenuAstAddons := self textualCoderViewModel + computeContextMenuAstAddOns. + theItems := theAddOns contextMenuActions, theContextMenuAstAddons contextMenuActions. + theItems := theItems reject: [ :e | e title isNil ]. + + theMenuItems := theItems + collect: [ :eachAction | eachAction asBrMenuItemForCoderElement: self ] + thenReject: #isNil. + + self enqueueTask: (BlTaskAction new + action: [ + aMenu items: theMenuItems ]) ]. + + self enqueueTask: (BlPromiseTask new promise: aMenuItemsPromise). + + ^ aMenu +] + { #category : #'instance creation' } GtTextualCoderEditorElement >> createContextMenuContent [ "wait for the addons to be computed" @@ -108,7 +138,9 @@ GtTextualCoderEditorElement >> initialize [ super initialize. self - aptitude: BrGlamorousCodeEditorAptitude + (BrGlamorousWithContextMenuAptitude content: [ self createContextMenuContent ]); + aptitude: BrGlamorousCodeEditorAptitude; + "addAptitude: (BrGlamorousWithContextMenuAptitude content: [ self createContextMenuContent ]);" + addAptitude: (BrWithExplicitMenuAptitude new stencil: [ self createContextMenu ]); padding: BlInsets empty; hMatchParent; vFitContent. diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 6f53fddb8..404e688e4 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -264,6 +264,7 @@ GtTextualCoderViewModel >> computeAddOnsFuture [ { #category : #'private - addons' } GtTextualCoderViewModel >> computeContextMenuAstAddOns [ + | aCoderModel newAddOns pragmas theAst | aCoderModel := self coderModel. @@ -311,6 +312,7 @@ GtTextualCoderViewModel >> contextActions: theContextActions [ { #category : #'api - add-ons' } GtTextualCoderViewModel >> contextMenuActions [ + ^ contextMenuActions ] diff --git a/src/GToolkit-Coder/GtCoderAction.class.st b/src/GToolkit-Coder/GtCoderAction.class.st index a76ae0543..6aab335fd 100644 --- a/src/GToolkit-Coder/GtCoderAction.class.st +++ b/src/GToolkit-Coder/GtCoderAction.class.st @@ -62,6 +62,11 @@ GtCoderAction >> allowPrimaryClick: anObject [ allowPrimaryClick := anObject ] +{ #category : #converting } +GtCoderAction >> asBrMenuItemForCoderElement: aTextualCoderEditorElement [ + ^ nil +] + { #category : #initialization } GtCoderAction >> computeActionDefinition [ ^ self action isClosure diff --git a/src/GToolkit-Coder/GtCoderAddOns.class.st b/src/GToolkit-Coder/GtCoderAddOns.class.st index 037007e8a..276f050ab 100644 --- a/src/GToolkit-Coder/GtCoderAddOns.class.st +++ b/src/GToolkit-Coder/GtCoderAddOns.class.st @@ -292,6 +292,7 @@ GtCoderAddOns >> contextActions [ { #category : #'api - context menu' } GtCoderAddOns >> contextMenuActions [ + ^ contextMenuActions ] diff --git a/src/GToolkit-Coder/GtCoderModel.class.st b/src/GToolkit-Coder/GtCoderModel.class.st index 76205aa5b..fa3269ffa 100644 --- a/src/GToolkit-Coder/GtCoderModel.class.st +++ b/src/GToolkit-Coder/GtCoderModel.class.st @@ -132,7 +132,7 @@ GtCoderModel >> contextActions [ { #category : #'api - actions' } GtCoderModel >> contextMenuActions [ - + ^ self addOns contextMenuActions ] From facb705e5ca2464ba59cebdca8c640e7d23885ee Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 13 Dec 2024 16:49:08 -0300 Subject: [PATCH 0812/1268] menu: call leave action on click [feenkcom/gtoolkit#4180] --- .../GtCoderMenuActionItemElement.class.st | 38 ++++++++++++++----- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderMenuActionItemElement.class.st b/src/GToolkit-Coder-UI/GtCoderMenuActionItemElement.class.st index 1a554628f..b473e0a13 100644 --- a/src/GToolkit-Coder-UI/GtCoderMenuActionItemElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMenuActionItemElement.class.st @@ -4,23 +4,43 @@ Class { #category : #'GToolkit-Coder-UI-Coder - Addons' } -{ #category : #initialization } -GtCoderMenuActionItemElement >> initialize [ - super initialize +{ #category : #'event handling' } +GtCoderMenuActionItemElement >> leaveOnEvent: anEvent [ + | aMenuModel | + aMenuModel := self menuModel. + aMenuModel ifNil: [ ^ self ]. + aMenuModel leaveAction ifNotNil: [ :aLeaveBlock | + aLeaveBlock cull: aMenuModel textualCoderViewModel cull: anEvent ] +] + +{ #category : #'event handling' } +GtCoderMenuActionItemElement >> onClick: anEvent element: anElement model: aButtonModel [ + | aMenuModel aCoderAction | + aMenuModel := self menuModel. + aMenuModel ifNil: [ ^ self ]. + self leaveOnEvent: anEvent. + aCoderAction := aMenuModel coderContextMenuAction. + aCoderAction ifNil: [ ^ self ]. + aCoderAction action ifNotNil: [ :anAction | + anAction gtValueWithArgs: { + aMenuModel textualCoderEditorElement textualCoderViewModel. + aMenuModel textualCoderEditorElement. + anEvent } ]. + aMenuModel hideOnClick ifTrue: [ aMenuModel hideAll ] ] { #category : #'event handling' } GtCoderMenuActionItemElement >> onMouseEnterEvent: anEvent [ + | aMenuModel | super onMouseEnterEvent: anEvent. - - self menuModel hoverAction ifNotNil: [ :aHoverBlock | - aHoverBlock cull: self menuModel textualCoderViewModel cull: anEvent ] + aMenuModel := self menuModel. + aMenuModel ifNil: [ ^ self ]. + aMenuModel hoverAction ifNotNil: [ :aHoverBlock | + aHoverBlock cull: aMenuModel textualCoderViewModel cull: anEvent ] ] { #category : #'event handling' } GtCoderMenuActionItemElement >> onMouseLeaveEvent: anEvent [ super onMouseLeaveEvent: anEvent. - - self menuModel leaveAction ifNotNil: [ :aLeaveBlock | - aLeaveBlock cull: self menuModel textualCoderViewModel cull: anEvent ] + self leaveOnEvent: anEvent ] From 79efb283573ca277df715161557b729196455777 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 13 Dec 2024 16:50:03 -0300 Subject: [PATCH 0813/1268] menu: remove `GtCoderMenuActionItem>>#onClick:element:model:` [feenkcom/gtoolkit#4180] --- src/GToolkit-Coder-UI/GtCoderMenuActionItem.class.st | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderMenuActionItem.class.st b/src/GToolkit-Coder-UI/GtCoderMenuActionItem.class.st index 18eb799ef..810c03356 100644 --- a/src/GToolkit-Coder-UI/GtCoderMenuActionItem.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMenuActionItem.class.st @@ -37,17 +37,6 @@ GtCoderMenuActionItem >> leaveAction [ ^ self coderContextMenuAction leaveAction ] -{ #category : #'event handling' } -GtCoderMenuActionItem >> onClick: anEvent element: anElement model: aButtonModel [ - self coderContextMenuAction ifNil: [ ^ self ]. - self coderContextMenuAction action ifNotNil: [ :anAction | - anAction gtValueWithArgs: { - textualCoderEditorElement textualCoderViewModel. - textualCoderEditorElement. - anEvent } ]. - self hideOnClick ifTrue: [ self hideAll ] -] - { #category : #accessing } GtCoderMenuActionItem >> textualCoderEditorElement [ From 64900020d2ea610de4b73b06f8d48f86934e375f Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Sat, 14 Dec 2024 14:04:26 -0300 Subject: [PATCH 0814/1268] menu: support context menu item groups [feenkcom/gtoolkit#4180] --- .../GtTextualCoder.extension.st | 14 ++++ .../GtCoderMenuActionItem.class.st | 2 + .../GtTextualCoderEditorElement.class.st | 1 + src/GToolkit-Coder/GtCoderAddOns.class.st | 68 ++++++++++++++++++- .../GtCoderContextMenuAction.class.st | 14 +++- 5 files changed, 97 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st index a11f1d880..13dd9bb4d 100644 --- a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st +++ b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st @@ -1,5 +1,19 @@ Extension { #name : #GtTextualCoder } +{ #category : #'*GToolkit-Coder-AddOns' } +GtTextualCoder >> addContextMenuItemFrom: shortcut group: menuGroup withId: menuId to: coderAddOns [ + ^ coderAddOns + addContextMenuItem: shortcut name + group: menuGroup + action: [ :aCoderViewModel :anEditorElement | + shortcut + performOnEditor: anEditorElement editor + element: anEditorElement + dueTo: nil ] + id: menuId + shortcutKey: shortcut combinationForPlatform gtDisplayString +] + { #category : #'*GToolkit-Coder-AddOns' } GtTextualCoder >> addContextMenuItemFrom: shortcut withId: menuId to: coderAddOns [ ^ coderAddOns diff --git a/src/GToolkit-Coder-UI/GtCoderMenuActionItem.class.st b/src/GToolkit-Coder-UI/GtCoderMenuActionItem.class.st index 810c03356..12c043d01 100644 --- a/src/GToolkit-Coder-UI/GtCoderMenuActionItem.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMenuActionItem.class.st @@ -17,6 +17,8 @@ GtCoderMenuActionItem >> coderContextMenuAction [ GtCoderMenuActionItem >> coderContextMenuAction: anAction [ self action: anAction. self id: anAction id. + anAction group ifNotNil: [ :aGroup | + self group: aGroup ]. anAction shortcutKey ifNotEmpty: [ self label: anAction title shortcut: anAction shortcutKey ] ifEmpty: [ self label: anAction title ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 5552f0c73..fc8bae8ed 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -54,6 +54,7 @@ GtTextualCoderEditorElement >> createContextMenu [ | aMenu aMenuItemsPromise | aMenu := BrMenuItems new. + aMenu beGroupedElementType. aMenuItemsPromise := self textualCoderViewModel addOns asyncThen: [ :theAddOns | diff --git a/src/GToolkit-Coder/GtCoderAddOns.class.st b/src/GToolkit-Coder/GtCoderAddOns.class.st index 276f050ab..008fad06f 100644 --- a/src/GToolkit-Coder/GtCoderAddOns.class.st +++ b/src/GToolkit-Coder/GtCoderAddOns.class.st @@ -131,8 +131,74 @@ GtCoderAddOns >> addContextMenuItem: aString action: aBlock shortcutKey: shortcu ] { #category : #'api - context menu' } -GtCoderAddOns >> addContextMenuItem: aString hover: hoverBlock leave: leaveBlock action: aBlock [ +GtCoderAddOns >> addContextMenuItem: aString group: menuGroup action: aBlock id: aSymbol shortcutKey: shortcutString [ + ^ self + addContextMenuItem: aString + group: menuGroup + hover: nil + leave: nil + action: aBlock + id: aSymbol + shortcutKey: shortcutString +] + +{ #category : #'api - context menu' } +GtCoderAddOns >> addContextMenuItem: aString group: menuGroup hover: hoverBlock leave: leaveBlock action: aBlock [ + + ^ self + addContextMenuItem: aString + group: menuGroup + hover: hoverBlock + leave: leaveBlock + action: aBlock + id: nil +] + +{ #category : #'api - context menu' } +GtCoderAddOns >> addContextMenuItem: aString group: menuGroup hover: hoverBlock leave: leaveBlock action: aBlock id: aSymbol [ + | newAction | + newAction := GtCoderContextMenuAction new + title: aString; + group: menuGroup; + action: aBlock; + hoverAction: hoverBlock; + leaveAction: leaveBlock; + id: aSymbol. + self addContextMenuAction: newAction. + ^ newAction +] + +{ #category : #'api - context menu' } +GtCoderAddOns >> addContextMenuItem: aString group: menuGroup hover: hoverBlock leave: leaveBlock action: aBlock id: aSymbol shortcutKey: shortcutString [ + | newAction | + newAction := GtCoderContextMenuAction new + title: aString; + group: menuGroup; + action: aBlock; + hoverAction: hoverBlock; + leaveAction: leaveBlock; + id: aSymbol; + shortcutKey: shortcutString. + self addContextMenuAction: newAction. + ^ newAction +] + +{ #category : #'api - context menu' } +GtCoderAddOns >> addContextMenuItem: aString group: menuGroup hover: hoverBlock leave: leaveBlock action: aBlock shortcutKey: shortcutString [ self + addContextMenuItem: aString + group: menuGroup + hover: hoverBlock + leave: leaveBlock + action: aBlock + id: nil + shortcutKey: shortcutString +] + +{ #category : #'api - context menu' } +GtCoderAddOns >> addContextMenuItem: aString hover: hoverBlock leave: leaveBlock action: aBlock [ + + ^ self addContextMenuItem: aString hover: hoverBlock leave: leaveBlock diff --git a/src/GToolkit-Coder/GtCoderContextMenuAction.class.st b/src/GToolkit-Coder/GtCoderContextMenuAction.class.st index 3ddf2a155..1a2346df8 100644 --- a/src/GToolkit-Coder/GtCoderContextMenuAction.class.st +++ b/src/GToolkit-Coder/GtCoderContextMenuAction.class.st @@ -3,11 +3,23 @@ Class { #superclass : #GtCoderAction, #instVars : [ 'hoverAction', - 'leaveAction' + 'leaveAction', + 'group' ], #category : #'GToolkit-Coder-Coders - Addons' } +{ #category : #accessing } +GtCoderContextMenuAction >> group [ + + ^ group +] + +{ #category : #accessing } +GtCoderContextMenuAction >> group: aMenuItemGroupConfiguration [ + group := aMenuItemGroupConfiguration +] + { #category : #accessing } GtCoderContextMenuAction >> hoverAction [ ^ hoverAction From 243c4f043bbfaeadeeb57ad8563a7ec958b885d1 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Sat, 14 Dec 2024 15:53:30 -0300 Subject: [PATCH 0815/1268] menu: support context menu item groups [feenkcom/gtoolkit#4180] --- .../GtTextualCoder.extension.st | 13 +++++++++++++ src/GToolkit-Coder/GtCoderAddOns.class.st | 11 +++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st index 13dd9bb4d..8de0a3e0c 100644 --- a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st +++ b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st @@ -27,6 +27,19 @@ GtTextualCoder >> addContextMenuItemFrom: shortcut withId: menuId to: coderAddOn shortcutKey: shortcut combinationForPlatform gtDisplayString ] +{ #category : #'*GToolkit-Coder-AddOns' } +GtTextualCoder >> addContextMenuItemWithNoShortcutFrom: shortcut group: menuGroup withId: menuId to: coderAddOns [ + ^ coderAddOns + addContextMenuItem: shortcut name + group: menuGroup + action: [ :aCoderViewModel :anEditorElement | + shortcut + performOnEditor: anEditorElement editor + element: anEditorElement + dueTo: nil ] + id: menuId +] + { #category : #'*GToolkit-Coder-AddOns' } GtTextualCoder >> addContextMenuItemWithNoShortcutFrom: shortcut withId: menuId to: coderAddOns [ ^ coderAddOns diff --git a/src/GToolkit-Coder/GtCoderAddOns.class.st b/src/GToolkit-Coder/GtCoderAddOns.class.st index 008fad06f..56bf78738 100644 --- a/src/GToolkit-Coder/GtCoderAddOns.class.st +++ b/src/GToolkit-Coder/GtCoderAddOns.class.st @@ -130,6 +130,17 @@ GtCoderAddOns >> addContextMenuItem: aString action: aBlock shortcutKey: shortcu shortcutKey: shortcut ] +{ #category : #'api - context menu' } +GtCoderAddOns >> addContextMenuItem: aString group: menuGroup action: aBlock id: aSymbol [ + ^ self + addContextMenuItem: aString + group: menuGroup + hover: nil + leave: nil + action: aBlock + id: aSymbol +] + { #category : #'api - context menu' } GtCoderAddOns >> addContextMenuItem: aString group: menuGroup action: aBlock id: aSymbol shortcutKey: shortcutString [ ^ self From eb00b55edb256ef94001010f6746882e5efbb47b Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Sun, 15 Dec 2024 09:19:15 -0300 Subject: [PATCH 0816/1268] menu: scroll in a grouped list [feenkcom/gtoolkit#4180] --- .../TCoderByScripterExamples.trait.st | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st b/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st index 0f9ce5286..da24fe478 100644 --- a/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st +++ b/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st @@ -12,10 +12,31 @@ TCoderByScripterExamples >> openAndClickOnContextMenuItemFor: aScripterOrStep id aScripterOrStep do label: 'Scroll to ', aBlElementId asSymbol; - block: [ :aList | aList scrollToItemSuchThat: [ :each | - each id asBlocElementId = aBlElementId asBlocElementId ] ]; + block: [ :aList | + (aList isKindOf: BrUngroupedList) + ifTrue: [ + aList scrollToItemSuchThat: [ :each | + each id asBlocElementId = aBlElementId asBlocElementId ] ] + ifFalse: [ + | aQuery anAttemptCount | + anAttemptCount := 0. + [ + | isVisible | + aQuery := aList query // aBlElementId asBlocElementId. + isVisible := aQuery isEmpty not and: [ + aQuery anyOne isVisibleFullyInParent: aList ]. + anAttemptCount < 5 and: [ isVisible not ] + ] whileTrue: [ + aList scrollBy: 0 @ 100. + anAttemptCount := anAttemptCount + 1. + ]. + self + assert: aQuery isEmpty not + description: [ 'Grouped list {2} does not include {2} element id' + format: { aList. aBlElementId } ] + ] ]; onSpaceRoot; - // BrAnchoredOuterContainer; + // BrMenuSteppedElement; onThisOrBreadthFirstChildOfKind: BrList; play. From c933ed34572f6979d3cd541f8b08ff3bd0720bce Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 16 Dec 2024 12:25:13 +0100 Subject: [PATCH 0817/1268] add initial coder addon signals --- .../GtCoderAddOnCreatedSignal.class.st | 29 +++++++++++++++++++ .../GtCoderAddOnEventsCollector.class.st | 15 ++++++++++ .../GtCoderAddOnEventsGrouper.class.st | 5 ++++ .../GtCoderAddOnSignal.class.st | 23 +++++++++++++++ ...erAddOnsComputationFinishedSignal.class.st | 10 +++++++ .../GtCoderAddOnsComputationSignal.class.st | 20 +++++++++++++ ...derAddOnsComputationStartedSignal.class.st | 10 +++++++ .../GtCoderAddOnsComputedEvent.class.st | 5 ++++ .../GtTextualCoderViewModel.class.st | 20 +++++++++++-- 9 files changed, 135 insertions(+), 2 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderAddOnCreatedSignal.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderAddOnEventsCollector.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderAddOnEventsGrouper.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderAddOnSignal.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderAddOnsComputationFinishedSignal.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderAddOnsComputationSignal.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderAddOnsComputationStartedSignal.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderAddOnsComputedEvent.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderAddOnCreatedSignal.class.st b/src/GToolkit-Coder-UI/GtCoderAddOnCreatedSignal.class.st new file mode 100644 index 000000000..0be87ef57 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderAddOnCreatedSignal.class.st @@ -0,0 +1,29 @@ +Class { + #name : #GtCoderAddOnCreatedSignal, + #superclass : #GtCoderAddOnsComputationSignal, + #instVars : [ + 'addOnClass', + 'addOnSelector' + ], + #category : #'GToolkit-Coder-UI-Signals' +} + +{ #category : #accessing } +GtCoderAddOnCreatedSignal >> addOnClass [ + ^ addOnClass +] + +{ #category : #accessing } +GtCoderAddOnCreatedSignal >> addOnClass: anObject [ + addOnClass := anObject +] + +{ #category : #accessing } +GtCoderAddOnCreatedSignal >> addOnSelector [ + ^ addOnSelector +] + +{ #category : #accessing } +GtCoderAddOnCreatedSignal >> addOnSelector: anObject [ + addOnSelector := anObject +] diff --git a/src/GToolkit-Coder-UI/GtCoderAddOnEventsCollector.class.st b/src/GToolkit-Coder-UI/GtCoderAddOnEventsCollector.class.st new file mode 100644 index 000000000..30aad1c5c --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderAddOnEventsCollector.class.st @@ -0,0 +1,15 @@ +Class { + #name : #GtCoderAddOnEventsCollector, + #superclass : #GtBeaconEventsCollector, + #category : #'GToolkit-Coder-UI-Signals' +} + +{ #category : #'as yet unclassified' } +GtCoderAddOnEventsCollector >> createDefaultEventsGrouper [ + ^ GtCoderAddOnEventsGrouper new +] + +{ #category : #'as yet unclassified' } +GtCoderAddOnEventsCollector >> relevantSignalType [ + ^ GtCoderAddOnsComputationSignal +] diff --git a/src/GToolkit-Coder-UI/GtCoderAddOnEventsGrouper.class.st b/src/GToolkit-Coder-UI/GtCoderAddOnEventsGrouper.class.st new file mode 100644 index 000000000..a97f64e2c --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderAddOnEventsGrouper.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtCoderAddOnEventsGrouper, + #superclass : #GtBeaconEventsGrouper, + #category : #'GToolkit-Coder-UI-Signals' +} diff --git a/src/GToolkit-Coder-UI/GtCoderAddOnSignal.class.st b/src/GToolkit-Coder-UI/GtCoderAddOnSignal.class.st new file mode 100644 index 000000000..195fc064d --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderAddOnSignal.class.st @@ -0,0 +1,23 @@ +Class { + #name : #GtCoderAddOnSignal, + #superclass : #BeaconSignal, + #instVars : [ + 'coderViewModel' + ], + #category : #'GToolkit-Coder-UI-Signals' +} + +{ #category : #accessing } +GtCoderAddOnSignal >> coderViewModel [ + ^ coderViewModel +] + +{ #category : #accessing } +GtCoderAddOnSignal >> coderViewModel: anObject [ + coderViewModel := anObject +] + +{ #category : #'as yet unclassified' } +GtCoderAddOnSignal >> signalTypeLabel [ + ^ self class name asString +] diff --git a/src/GToolkit-Coder-UI/GtCoderAddOnsComputationFinishedSignal.class.st b/src/GToolkit-Coder-UI/GtCoderAddOnsComputationFinishedSignal.class.st new file mode 100644 index 000000000..9babba8ce --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderAddOnsComputationFinishedSignal.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtCoderAddOnsComputationFinishedSignal, + #superclass : #GtCoderAddOnsComputationSignal, + #category : #'GToolkit-Coder-UI-Signals' +} + +{ #category : #'as yet unclassified' } +GtCoderAddOnsComputationFinishedSignal >> isEndSignalType [ + ^ true +] diff --git a/src/GToolkit-Coder-UI/GtCoderAddOnsComputationSignal.class.st b/src/GToolkit-Coder-UI/GtCoderAddOnsComputationSignal.class.st new file mode 100644 index 000000000..7a5dc048a --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderAddOnsComputationSignal.class.st @@ -0,0 +1,20 @@ +Class { + #name : #GtCoderAddOnsComputationSignal, + #superclass : #GtCoderAddOnSignal, + #category : #'GToolkit-Coder-UI-Signals' +} + +{ #category : #'as yet unclassified' } +GtCoderAddOnsComputationSignal class >> eventType [ + ^ GtCoderAddOnsComputedEvent +] + +{ #category : #'as yet unclassified' } +GtCoderAddOnsComputationSignal >> isEndSignalType [ + ^ false +] + +{ #category : #'as yet unclassified' } +GtCoderAddOnsComputationSignal >> isStartSignalType [ + ^ false +] diff --git a/src/GToolkit-Coder-UI/GtCoderAddOnsComputationStartedSignal.class.st b/src/GToolkit-Coder-UI/GtCoderAddOnsComputationStartedSignal.class.st new file mode 100644 index 000000000..35be6399c --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderAddOnsComputationStartedSignal.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtCoderAddOnsComputationStartedSignal, + #superclass : #GtCoderAddOnsComputationSignal, + #category : #'GToolkit-Coder-UI-Signals' +} + +{ #category : #'as yet unclassified' } +GtCoderAddOnsComputationStartedSignal >> isStartSignalType [ + ^ true +] diff --git a/src/GToolkit-Coder-UI/GtCoderAddOnsComputedEvent.class.st b/src/GToolkit-Coder-UI/GtCoderAddOnsComputedEvent.class.st new file mode 100644 index 000000000..58d6b0515 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderAddOnsComputedEvent.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtCoderAddOnsComputedEvent, + #superclass : #GtBeaconLogEvent, + #category : #'GToolkit-Coder-UI-Signals' +} diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 6f53fddb8..becfd0463 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -225,6 +225,10 @@ GtTextualCoderViewModel >> computeAddOnsFuture [ aCoderModel := self coderModel. ^ aCoderModel coderAstFuture map: [ :aCoderAst | | theAst newAddOns pragmas | + + GtCoderAddOnsComputationStartedSignal new + coderViewModel: self; + emit. theAst := aCoderAst ast. @@ -240,9 +244,16 @@ GtTextualCoderViewModel >> computeAddOnsFuture [ aCoderModel initializeAddOns: newAddOns viewModel: self. theAst ifNotNil: [ pragmas reverseDo: [ :eachPragma | - [ aCoderModel + [ + aCoderModel perform: eachPragma methodSelector - withEnoughArguments: { theAst . newAddOns . self } ] + withEnoughArguments: { theAst . newAddOns . self }. + + GtCoderAddOnCreatedSignal new + coderViewModel: self; + addOnClass: eachPragma methodClass; + addOnSelector: eachPragma methodSelector; + emit. ] on: Error do: [ :anError | "emit as a beacon signal" @@ -259,6 +270,11 @@ GtTextualCoderViewModel >> computeAddOnsFuture [ "view model add-ons override coder model add-ons" newAddOns addAddOns: extraAddOns. newAddOns markAsUpdated. + + GtCoderAddOnsComputationFinishedSignal new + coderViewModel: self; + emit. + newAddOns ] ] From 25c7319bbd2e878785b0b892181c34be22e622a4 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 16 Dec 2024 08:58:23 -0300 Subject: [PATCH 0818/1268] menu: adopt examples to a new menu model/widget implementation [feenkcom/gtoolkit#4180] --- src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st b/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st index da24fe478..e42e9b292 100644 --- a/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st +++ b/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st @@ -43,11 +43,13 @@ TCoderByScripterExamples >> openAndClickOnContextMenuItemFor: aScripterOrStep id aScripterOrStep mouseMoveOverStep: [:s | s label: 'Hover ' , aBlElementId asSymbol; onSpaceRoot; + // BrMenuSteppedElement; // aBlElementId]. aScripterOrStep clickStep: [:s | s label: 'Click ' , aBlElementId asSymbol; onSpaceRoot; + // BrMenuSteppedElement; // aBlElementId] ] From e753b954369d940f6984c6998c4714df42bf6e4c Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 17 Dec 2024 09:34:01 -0300 Subject: [PATCH 0819/1268] use blocks instead of symbols --- src/GToolkit-Coder/TGtCoderWithBehaviorHolder.trait.st | 2 +- src/GToolkit-Coder/TGtCoderWithObjectHolder.trait.st | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder/TGtCoderWithBehaviorHolder.trait.st b/src/GToolkit-Coder/TGtCoderWithBehaviorHolder.trait.st index 5ab1791aa..a22db5311 100644 --- a/src/GToolkit-Coder/TGtCoderWithBehaviorHolder.trait.st +++ b/src/GToolkit-Coder/TGtCoderWithBehaviorHolder.trait.st @@ -47,7 +47,7 @@ TGtCoderWithBehaviorHolder >> behaviorHolder: aTGtCoderObject [ { #category : #'api - object' } TGtCoderWithBehaviorHolder >> behaviorIfNone: noneBlock [ - ^ self ifBehavior: #yourself ifNone: noneBlock + ^ self ifBehavior: [ :anObject | anObject ] ifNone: noneBlock ] { #category : #'api - object' } diff --git a/src/GToolkit-Coder/TGtCoderWithObjectHolder.trait.st b/src/GToolkit-Coder/TGtCoderWithObjectHolder.trait.st index e7a3620b8..ed68ddf08 100644 --- a/src/GToolkit-Coder/TGtCoderWithObjectHolder.trait.st +++ b/src/GToolkit-Coder/TGtCoderWithObjectHolder.trait.st @@ -51,7 +51,7 @@ TGtCoderWithObjectHolder >> objectHolder: aTGtCoderObject [ { #category : #'api - object' } TGtCoderWithObjectHolder >> objectIfNone: noneBlock [ - ^ self ifObject: #yourself ifNone: noneBlock + ^ self ifObject: [ :anObject | anObject ] ifNone: noneBlock ] { #category : #'api - object' } From 9b04b37988d39be79692c9b65c61fd27165c9034 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 23 Dec 2024 20:14:38 -0300 Subject: [PATCH 0820/1268] menu: use `BrMenuPinnableAptitude` [feenkcom/gtoolkit#4180] --- src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st b/src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st index 13f3e8047..3b5f77030 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st @@ -20,13 +20,10 @@ GtTextualCoderMenu >> asElement [ hExact: 500; vFitContentLimited; addAptitude: BrGlamorousFocusableShadowAptitude new; - addAptitude: BrMenuPinnableAptitude new; + addAptitude: (BrMenuPinnableAptitude new menuModel: self); + addAptitude: (BrMenuHideableAptitude new menuModel: self); addAptitude: BrMenuCommonAptitude new. - - self announcer weak - when: BrMenuHideRequest - send: #removeFromParent - to: aCoderElement. + ^ aCoderElement ] From 87c0e77f017b59bf8ff0485250068aa9363e2e2e Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 27 Dec 2024 09:24:42 -0600 Subject: [PATCH 0821/1268] Add scrollbar to GtSourceCoderExpandedContentElement --- .../GtSourceCoderExpandedContentElement.class.st | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st index 48ee4bafa..a14148598 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st @@ -21,8 +21,12 @@ GtSourceCoderExpandedContentElement >> initialize [ editorElement := self newEditorElement. actions := self newActionsElement. - self addChildren: { editorElement . actions }. - self addAptitude: (BrLayoutResizerAptitude new inherit: editorElement) + self + addChildren: {editorElement. + actions}. + self addAptitude: (BrLayoutResizerAptitude new inherit: editorElement). + self + addAptitude: (BrGlamorousWithVerticalScrollbarAptitude new scrollableName: editorElement id) ] { #category : #'instance creation' } From fe8419dafbd05d6feacc50284d1d73112c84cb18 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 27 Dec 2024 15:39:20 -0300 Subject: [PATCH 0822/1268] add `GtCoderExplicitContextMenuItemAction` [feenkcom/gtoolkit#4180] --- .../GtTextualCoder.extension.st | 5 ++++ ...ExplicitContextMenuItemAction.extension.st | 10 +++++++ .../GtCoderMenuActionItem.class.st | 14 +++++----- .../GtTextualCoderEditorElement.class.st | 3 +- src/GToolkit-Coder/GtCoderAddOns.class.st | 10 +++++++ ...oderExplicitContextMenuItemAction.class.st | 28 +++++++++++++++++++ 6 files changed, 62 insertions(+), 8 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderExplicitContextMenuItemAction.extension.st create mode 100644 src/GToolkit-Coder/GtCoderExplicitContextMenuItemAction.class.st diff --git a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st index 8de0a3e0c..8fc2be05f 100644 --- a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st +++ b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st @@ -66,3 +66,8 @@ GtTextualCoder >> addCopyCutPasteContextMenuAddOnsAst: anAst to: coderAddOns [ withId: GtTextualCoderPasteContextMenuItemId to: coderAddOns ] + +{ #category : #'*GToolkit-Coder-AddOns' } +GtTextualCoder >> addExplicitContextMenu: aString block: aBlock to: coderAddOns [ + ^ coderAddOns addExplicitContextMenu: aString block: aBlock +] diff --git a/src/GToolkit-Coder-UI/GtCoderExplicitContextMenuItemAction.extension.st b/src/GToolkit-Coder-UI/GtCoderExplicitContextMenuItemAction.extension.st new file mode 100644 index 000000000..567cc78e4 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderExplicitContextMenuItemAction.extension.st @@ -0,0 +1,10 @@ +Extension { #name : #GtCoderExplicitContextMenuItemAction } + +{ #category : #'*GToolkit-Coder-UI' } +GtCoderExplicitContextMenuItemAction >> asBrMenuItemForCoderElement: aTextualCoderEditorElement [ + + ^ menuItemBlock + cull: aTextualCoderEditorElement + cull: aTextualCoderEditorElement textualCoderViewModel + cull: self +] diff --git a/src/GToolkit-Coder-UI/GtCoderMenuActionItem.class.st b/src/GToolkit-Coder-UI/GtCoderMenuActionItem.class.st index 12c043d01..829cc2498 100644 --- a/src/GToolkit-Coder-UI/GtCoderMenuActionItem.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMenuActionItem.class.st @@ -14,14 +14,14 @@ GtCoderMenuActionItem >> coderContextMenuAction [ ] { #category : #accessing } -GtCoderMenuActionItem >> coderContextMenuAction: anAction [ - self action: anAction. - self id: anAction id. - anAction group ifNotNil: [ :aGroup | +GtCoderMenuActionItem >> coderContextMenuAction: aCoderContextMenuAction [ + self action: aCoderContextMenuAction. + self id: aCoderContextMenuAction id. + aCoderContextMenuAction group ifNotNil: [ :aGroup | self group: aGroup ]. - anAction shortcutKey - ifNotEmpty: [ self label: anAction title shortcut: anAction shortcutKey ] - ifEmpty: [ self label: anAction title ] + aCoderContextMenuAction shortcutKey + ifNotEmpty: [ self label: aCoderContextMenuAction title shortcut: aCoderContextMenuAction shortcutKey ] + ifEmpty: [ self label: aCoderContextMenuAction title ] ] { #category : #'api - converting' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index fc8bae8ed..0c4e3116b 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -80,7 +80,8 @@ GtTextualCoderEditorElement >> createContextMenu [ { #category : #'instance creation' } GtTextualCoderEditorElement >> createContextMenuContent [ - "wait for the addons to be computed" + "wait for the addons to be computed. + Deprected: Use #createContextMenu instead." | theContextMenu aContextMenuPromise | theContextMenu := GtCoderContextMenuContent new editorElement: self. diff --git a/src/GToolkit-Coder/GtCoderAddOns.class.st b/src/GToolkit-Coder/GtCoderAddOns.class.st index 56bf78738..1f7bb941b 100644 --- a/src/GToolkit-Coder/GtCoderAddOns.class.st +++ b/src/GToolkit-Coder/GtCoderAddOns.class.st @@ -278,6 +278,16 @@ GtCoderAddOns >> addDropDownWithPreviewAction: aString icon: anIcon action: acti ^ newAction ] +{ #category : #'api - context menu' } +GtCoderAddOns >> addExplicitContextMenu: aString block: aBlock [ + | newAction | + newAction := GtCoderExplicitContextMenuItemAction new + title: aString; + menuItem: aBlock. + self addContextMenuAction: newAction. + ^ newAction +] + { #category : #'api - main actions' } GtCoderAddOns >> addMainAction: aGtCoderAction [ self diff --git a/src/GToolkit-Coder/GtCoderExplicitContextMenuItemAction.class.st b/src/GToolkit-Coder/GtCoderExplicitContextMenuItemAction.class.st new file mode 100644 index 000000000..fe349e364 --- /dev/null +++ b/src/GToolkit-Coder/GtCoderExplicitContextMenuItemAction.class.st @@ -0,0 +1,28 @@ +Class { + #name : #GtCoderExplicitContextMenuItemAction, + #superclass : #GtCoderAction, + #instVars : [ + 'menuItemBlock', + 'group' + ], + #category : #'GToolkit-Coder-Coders - Addons' +} + +{ #category : #accessing } +GtCoderExplicitContextMenuItemAction >> group [ + + ^ group +] + +{ #category : #accessing } +GtCoderExplicitContextMenuItemAction >> group: aMenuItemGroupConfiguration [ + group := aMenuItemGroupConfiguration +] + +{ #category : #accessing } +GtCoderExplicitContextMenuItemAction >> menuItem: aBlock [ + "Set block that creates a menu item, an instance of `BrMenuItem`. + The block have two arguments [ :aTextualCoderEditorElement :aTextualCoderViewModel :aCoderAction | ]" + + menuItemBlock := aBlock +] From f1f289abf07a65932f211f3c48ec17ca1203e0a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Sun, 29 Dec 2024 16:22:39 +0200 Subject: [PATCH 0823/1268] Move rename method refactorings to GToolkit-Pharo-GtRefactorings [feenkcom/gtoolkit#3736] --- .../GtCoderRenameMethodRefactoring.class.st | 27 ------------------- .../GtRBRenameMethodRefactoring.class.st | 20 -------------- 2 files changed, 47 deletions(-) delete mode 100644 src/GToolkit-Coder/GtCoderRenameMethodRefactoring.class.st delete mode 100644 src/GToolkit-Coder/GtRBRenameMethodRefactoring.class.st diff --git a/src/GToolkit-Coder/GtCoderRenameMethodRefactoring.class.st b/src/GToolkit-Coder/GtCoderRenameMethodRefactoring.class.st deleted file mode 100644 index 0a620836a..000000000 --- a/src/GToolkit-Coder/GtCoderRenameMethodRefactoring.class.st +++ /dev/null @@ -1,27 +0,0 @@ -Class { - #name : #GtCoderRenameMethodRefactoring, - #superclass : #GtRBRenameMethodRefactoring, - #instVars : [ - 'methodCoder' - ], - #category : #'GToolkit-Coder-Refactoring' -} - -{ #category : #accessing } -GtCoderRenameMethodRefactoring >> methodCoder [ - ^ methodCoder -] - -{ #category : #accessing } -GtCoderRenameMethodRefactoring >> methodCoder: anObject [ - methodCoder := anObject -] - -{ #category : #transforming } -GtCoderRenameMethodRefactoring >> transform [ - self changes addChange: (GtCoderRenameMethodChange new - methodCoder: self methodCoder; - newSelector: newSelector; - oldSelector: oldSelector). - super transform. -] diff --git a/src/GToolkit-Coder/GtRBRenameMethodRefactoring.class.st b/src/GToolkit-Coder/GtRBRenameMethodRefactoring.class.st deleted file mode 100644 index 1c62793de..000000000 --- a/src/GToolkit-Coder/GtRBRenameMethodRefactoring.class.st +++ /dev/null @@ -1,20 +0,0 @@ -Class { - #name : #GtRBRenameMethodRefactoring, - #superclass : #RBRenameMethodRefactoring, - #category : #'GToolkit-Coder-Refactorings' -} - -{ #category : #accessing } -GtRBRenameMethodRefactoring >> executeRenameExtensions [ - (Pragma - allNamed: #gtRename - from: self class - to: GtRBRenameMethodRefactoring) - do: [ :each | self perform: each method selector ] -] - -{ #category : #accessing } -GtRBRenameMethodRefactoring >> renameMessageSends [ - super renameMessageSends. - self executeRenameExtensions -] From 88ab7e6f44f2211d70ec3c0ec50845809fdbb550 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Sun, 29 Dec 2024 16:29:34 +0200 Subject: [PATCH 0824/1268] Do not define some methods in refactorings as extensions [feenkcom/gtoolkit#3736] --- .../RBRemoveClassRefactoring.extension.st | 6 ------ .../RBRemoveClassVariableRefactoring.extension.st | 12 ------------ ...BRemoveInstanceVariableRefactoring.extension.st | 12 ------------ .../RBRenameClassRefactoring.extension.st | 12 ------------ .../RBRenameClassVariableRefactoring.extension.st | 14 -------------- .../RBRenameMethodRefactoring.extension.st | 6 ------ ...BRemoveInstanceVariableRefactoring.extension.st | 11 ----------- 7 files changed, 73 deletions(-) delete mode 100644 src/GToolkit-Coder-UI/RBRemoveClassRefactoring.extension.st delete mode 100644 src/GToolkit-Coder-UI/RBRemoveClassVariableRefactoring.extension.st delete mode 100644 src/GToolkit-Coder-UI/RBRemoveInstanceVariableRefactoring.extension.st delete mode 100644 src/GToolkit-Coder-UI/RBRenameClassRefactoring.extension.st delete mode 100644 src/GToolkit-Coder-UI/RBRenameClassVariableRefactoring.extension.st delete mode 100644 src/GToolkit-Coder-UI/RBRenameMethodRefactoring.extension.st delete mode 100644 src/GToolkit-Coder/RBRemoveInstanceVariableRefactoring.extension.st diff --git a/src/GToolkit-Coder-UI/RBRemoveClassRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRemoveClassRefactoring.extension.st deleted file mode 100644 index 8f09d1dde..000000000 --- a/src/GToolkit-Coder-UI/RBRemoveClassRefactoring.extension.st +++ /dev/null @@ -1,6 +0,0 @@ -Extension { #name : #RBRemoveClassRefactoring } - -{ #category : #'*GToolkit-Coder-UI' } -RBRemoveClassRefactoring >> gtDescription [ - ^ 'Remove class ' , classNames anyOne -] diff --git a/src/GToolkit-Coder-UI/RBRemoveClassVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRemoveClassVariableRefactoring.extension.st deleted file mode 100644 index ce703fb44..000000000 --- a/src/GToolkit-Coder-UI/RBRemoveClassVariableRefactoring.extension.st +++ /dev/null @@ -1,12 +0,0 @@ -Extension { #name : #RBRemoveClassVariableRefactoring } - -{ #category : #'*GToolkit-Coder-UI' } -RBRemoveClassVariableRefactoring >> gtDescription [ - - - ^ ('Remove' asRopedText glamorousRoundedBackground) - append: ' class variable ' asRopedText; - append: variableName asRopedText glamorousRoundedBackground; - append: ' from ' asRopedText; - append: class name asRopedText -] diff --git a/src/GToolkit-Coder-UI/RBRemoveInstanceVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRemoveInstanceVariableRefactoring.extension.st deleted file mode 100644 index fe4600f8c..000000000 --- a/src/GToolkit-Coder-UI/RBRemoveInstanceVariableRefactoring.extension.st +++ /dev/null @@ -1,12 +0,0 @@ -Extension { #name : #RBRemoveInstanceVariableRefactoring } - -{ #category : #'*GToolkit-Coder-UI' } -RBRemoveInstanceVariableRefactoring >> gtDescription [ - - - ^ ('Remove' asRopedText glamorousRoundedBackground) - append: ' instance variable ' asRopedText; - append: variableName asRopedText glamorousRoundedBackground; - append: ' from ' asRopedText; - append: class printString asRopedText -] diff --git a/src/GToolkit-Coder-UI/RBRenameClassRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRenameClassRefactoring.extension.st deleted file mode 100644 index 507949114..000000000 --- a/src/GToolkit-Coder-UI/RBRenameClassRefactoring.extension.st +++ /dev/null @@ -1,12 +0,0 @@ -Extension { #name : #RBRenameClassRefactoring } - -{ #category : #'*GToolkit-Coder-UI' } -RBRenameClassRefactoring >> gtDescription [ - - - ^ ('Rename' asRopedText glamorousRoundedBackground) - append: ' class ' asRopedText; - append: className asRopedText; - append: ' to ' asRopedText; - append: newName asRopedText glamorousRoundedBackground -] diff --git a/src/GToolkit-Coder-UI/RBRenameClassVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRenameClassVariableRefactoring.extension.st deleted file mode 100644 index 7be6da90e..000000000 --- a/src/GToolkit-Coder-UI/RBRenameClassVariableRefactoring.extension.st +++ /dev/null @@ -1,14 +0,0 @@ -Extension { #name : #RBRenameClassVariableRefactoring } - -{ #category : #'*GToolkit-Coder-UI' } -RBRenameClassVariableRefactoring >> gtDescription [ - - - ^ ('Rename' asRopedText glamorousRoundedBackground) - append: ' class variable ' asRopedText; - append: variableName asRopedText glamorousRoundedBackground; - append: ' to ' asRopedText; - append: newName asRopedText glamorousRoundedBackground; - append: ' in ' asRopedText; - append: class name asRopedText -] diff --git a/src/GToolkit-Coder-UI/RBRenameMethodRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRenameMethodRefactoring.extension.st deleted file mode 100644 index a67e72a03..000000000 --- a/src/GToolkit-Coder-UI/RBRenameMethodRefactoring.extension.st +++ /dev/null @@ -1,6 +0,0 @@ -Extension { #name : #RBRenameMethodRefactoring } - -{ #category : #'*GToolkit-Coder-UI' } -RBRenameMethodRefactoring >> gtDescription [ - ^ 'Rename method ' , oldSelector , ' to ' , newSelector -] diff --git a/src/GToolkit-Coder/RBRemoveInstanceVariableRefactoring.extension.st b/src/GToolkit-Coder/RBRemoveInstanceVariableRefactoring.extension.st deleted file mode 100644 index 80a3fe941..000000000 --- a/src/GToolkit-Coder/RBRemoveInstanceVariableRefactoring.extension.st +++ /dev/null @@ -1,11 +0,0 @@ -Extension { #name : #RBRemoveInstanceVariableRefactoring } - -{ #category : #'*GToolkit-Coder' } -RBRemoveInstanceVariableRefactoring >> gtPreconditions [ - | references | - - references := RBCondition hierarchyOf: class referencesInstanceVariable: variableName. - references errorMacro: ( '<1s> is referenced.' expandMacrosWith: variableName). - - ^ ( RBCondition definesInstanceVariable: variableName asString in: class ) & references not -] From 67b68439cfdb1e0924fd5db7f65d4f369e05087d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Mon, 30 Dec 2024 18:42:11 +0100 Subject: [PATCH 0825/1268] Use #pseudoVariables in Pharo 12 [feenkcom/gtoolkit#3736] --- .../GtReservedVariablesBindings.class.st | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/GToolkit-VariableBindings/GtReservedVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtReservedVariablesBindings.class.st index f9c73be59..6c75d69dc 100644 --- a/src/GToolkit-VariableBindings/GtReservedVariablesBindings.class.st +++ b/src/GToolkit-VariableBindings/GtReservedVariablesBindings.class.st @@ -3,7 +3,7 @@ Class { #superclass : #Object, #traits : 'TGtVariablesBindings', #classTraits : 'TGtVariablesBindings classTrait', - #category : 'GToolkit-VariableBindings-Bindings' + #category : #'GToolkit-VariableBindings-Bindings' } { #category : #comparing } @@ -14,7 +14,7 @@ GtReservedVariablesBindings >> = anObject [ { #category : #binding } GtReservedVariablesBindings >> bindingNames [ - ^ self class environment reservedVariables keys collect: [ :each | each asSymbol ] + ^ self pseudoVariables keys collect: [ :each | each asSymbol ] ] { #category : #binding } @@ -24,19 +24,27 @@ GtReservedVariablesBindings >> bindingOf: aSymbol [ Return nil, if the variable has no value assigned." - ^ self class environment reservedVariables - at: aSymbol - ifAbsent: [ nil ] + ^ self pseudoVariables + at: aSymbol + ifAbsent: [ nil ] ] { #category : #testing } GtReservedVariablesBindings >> hasBindingOf: aSymbol [ - ^ self class environment reservedVariables includesKey: aSymbol + ^ self pseudoVariables + includesKey: aSymbol ] { #category : #comparing } GtReservedVariablesBindings >> hash [ ^ self class hash ] + +{ #category : #binding } +GtReservedVariablesBindings >> pseudoVariables [ + ^ self + forPharo12: [ self class environment pseudoVariables ] + forPharo11AndPharo10: [ self class environment reservedVariables ] +] From c0cc6823b5dec8c5e3a2b9c57c11cfd7547b9eb6 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 30 Dec 2024 15:59:53 -0300 Subject: [PATCH 0826/1268] coder view model: add some extra information to a phlow view --- src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st | 9 +++++++++ src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st | 3 ++- .../GtTextualCoderViewModelBehaviorChanged.class.st | 6 ++++++ src/GToolkit-Coder/GtCoderBehaviorChanged.class.st | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st index 891c8627f..24b035956 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st @@ -292,6 +292,15 @@ GtSourceCoderViewModel >> evaluationStatus: aNewStatus [ self onEvaluationStatusChanged ] +{ #category : #'gt-extension' } +GtSourceCoderViewModel >> gtInfo [ + ^ super gtInfo, (Array streamContents: [ :aStream | + aStream nextPut: #evaluationContext -> self evaluationContext. + aStream nextPut: #evaluationResult -> self evaluationResult. + aStream nextPut: #evaluationStatus -> self evaluationStatus. + aStream nextPut: #selectedTextInterval -> self selectedTextInterval ]) +] + { #category : #'private - event handling' } GtSourceCoderViewModel >> handleCoderEvaluationUnhandledErrorDuring: aBlock [ ^ [ GtCoderUserSnippetDynamicVariable diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 591dfb2cc..519dd70f7 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -432,7 +432,8 @@ GtTextualCoderViewModel >> gtInfo [ aStream nextPut: (#shortcuts -> self shortcuts). aStream nextPut: (#attributes -> self extraTextAttributes). aStream nextPut: (#hasFocus -> self focused). - aStream nextPut: (#expanded -> self expanded) ] + aStream nextPut: (#expanded -> self expanded). + aStream nextPut: (#wantsHeader -> self wantsHeader) ] ] { #category : #'gt-extension' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelBehaviorChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelBehaviorChanged.class.st index 41739b4d8..a41b10fe2 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelBehaviorChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelBehaviorChanged.class.st @@ -7,6 +7,12 @@ Class { #category : #'GToolkit-Coder-UI-Coder - Textual Model - Events' } +{ #category : #accessing } +GtTextualCoderViewModelBehaviorChanged >> newBehavior [ + + ^ newBehavior +] + { #category : #accessing } GtTextualCoderViewModelBehaviorChanged >> newBehavior: aBehavior [ newBehavior := aBehavior diff --git a/src/GToolkit-Coder/GtCoderBehaviorChanged.class.st b/src/GToolkit-Coder/GtCoderBehaviorChanged.class.st index 9c6d3792e..53ac9ef33 100644 --- a/src/GToolkit-Coder/GtCoderBehaviorChanged.class.st +++ b/src/GToolkit-Coder/GtCoderBehaviorChanged.class.st @@ -9,6 +9,7 @@ Class { { #category : #accessing } GtCoderBehaviorChanged >> newBehavior [ + ^ newBehavior ] From 62df60c75144db381923cc796ae7d8a19327698e Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 30 Dec 2024 19:26:34 -0300 Subject: [PATCH 0827/1268] menu: spawn from pinned menu widgets [feenkcom/gtoolkit#4180] --- src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st b/src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st index 3b5f77030..6adc6a470 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st @@ -20,7 +20,9 @@ GtTextualCoderMenu >> asElement [ hExact: 500; vFitContentLimited; addAptitude: BrGlamorousFocusableShadowAptitude new; - addAptitude: (BrMenuPinnableAptitude new menuModel: self); + addAptitude: (BrMenuPinnableAptitude new + menuModel: self; + withAllExtraEventHandlers); addAptitude: (BrMenuHideableAptitude new menuModel: self); addAptitude: BrMenuCommonAptitude new. From a64e67232ac9680b45c5aed40d7fb118e976013c Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 31 Dec 2024 09:25:46 -0300 Subject: [PATCH 0828/1268] menu: add resizers [feenkcom/gtoolkit#4180] --- src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st b/src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st index 6adc6a470..b1b0fc4ad 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st @@ -22,7 +22,8 @@ GtTextualCoderMenu >> asElement [ addAptitude: BrGlamorousFocusableShadowAptitude new; addAptitude: (BrMenuPinnableAptitude new menuModel: self; - withAllExtraEventHandlers); + withResizers; + withAllPinActions); addAptitude: (BrMenuHideableAptitude new menuModel: self); addAptitude: BrMenuCommonAptitude new. From e67ccb6084cc764f42dd74bb207211a3e03391bf Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Mon, 6 Jan 2025 14:24:52 +0100 Subject: [PATCH 0829/1268] Make diff splitters print a bit nicer [feenkcom/gtoolkit#4066] --- .../GtCharacterGroupDiffSplitter.class.st | 10 ++++++++++ src/GToolkit-Coder/GtSmaCCDiffSplitter.class.st | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/GToolkit-Coder/GtCharacterGroupDiffSplitter.class.st b/src/GToolkit-Coder/GtCharacterGroupDiffSplitter.class.st index 1b7c707a9..9e1e2b8d3 100644 --- a/src/GToolkit-Coder/GtCharacterGroupDiffSplitter.class.st +++ b/src/GToolkit-Coder/GtCharacterGroupDiffSplitter.class.st @@ -46,6 +46,16 @@ GtCharacterGroupDiffSplitter >> initialize [ groups := OrderedCollection new ] +{ #category : #'as yet unclassified' } +GtCharacterGroupDiffSplitter >> printOn: aStream [ + super printOn: aStream. + + aStream + nextPut: $(; + nextPutAll: (', ' join: groups); + nextPut: $) +] + { #category : #accessing } GtCharacterGroupDiffSplitter >> split: aString into: aGtDiffSplits [ | stream start groupId nextGroupId | diff --git a/src/GToolkit-Coder/GtSmaCCDiffSplitter.class.st b/src/GToolkit-Coder/GtSmaCCDiffSplitter.class.st index 2a288b1d8..19fb19cc9 100644 --- a/src/GToolkit-Coder/GtSmaCCDiffSplitter.class.st +++ b/src/GToolkit-Coder/GtSmaCCDiffSplitter.class.st @@ -7,6 +7,16 @@ Class { #category : #'GToolkit-Coder-Diff-Algorithm' } +{ #category : #'as yet unclassified' } +GtSmaCCDiffSplitter >> printOn: aStream [ + super printOn: aStream. + + aStream + nextPut: $(; + nextPutAll: scannerClass asString; + nextPut: $) +] + { #category : #accessing } GtSmaCCDiffSplitter >> scannerClass [ ^ scannerClass From 1b8cf22d221e13b69dda3428835dfccf1fc1f2c7 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Tue, 7 Jan 2025 10:08:18 +0100 Subject: [PATCH 0830/1268] Add descriptionString to splitters --- src/GToolkit-Coder/GtCharacterGroupDiffSplitter.class.st | 5 +++++ src/GToolkit-Coder/GtDiffSplitter.class.st | 5 +++++ src/GToolkit-Coder/GtLineDiffSplitter.class.st | 5 +++++ src/GToolkit-Coder/GtNullDiffSplitter.class.st | 5 +++++ src/GToolkit-Coder/GtSmaCCDiffSplitter.class.st | 5 +++++ 5 files changed, 25 insertions(+) diff --git a/src/GToolkit-Coder/GtCharacterGroupDiffSplitter.class.st b/src/GToolkit-Coder/GtCharacterGroupDiffSplitter.class.st index 9e1e2b8d3..9cbaf7496 100644 --- a/src/GToolkit-Coder/GtCharacterGroupDiffSplitter.class.st +++ b/src/GToolkit-Coder/GtCharacterGroupDiffSplitter.class.st @@ -29,6 +29,11 @@ GtCharacterGroupDiffSplitter >> classify: aCharacter [ ifNone: [ groups size + 1 ] ] +{ #category : #'as yet unclassified' } +GtCharacterGroupDiffSplitter >> descriptionString [ + ^ 'split by character groups (' , (', ' join: groups) , ')' +] + { #category : #initialization } GtCharacterGroupDiffSplitter >> ignoreWhitespace [ shouldIgnoreWhitespace := true diff --git a/src/GToolkit-Coder/GtDiffSplitter.class.st b/src/GToolkit-Coder/GtDiffSplitter.class.st index 8871d4c07..2603af852 100644 --- a/src/GToolkit-Coder/GtDiffSplitter.class.st +++ b/src/GToolkit-Coder/GtDiffSplitter.class.st @@ -7,6 +7,11 @@ Class { #category : #'GToolkit-Coder-Diff-Algorithm' } +{ #category : #'as yet unclassified' } +GtDiffSplitter >> descriptionString [ + ^ self subclassResponsibility +] + { #category : #actions } GtDiffSplitter >> split: aCollection [ | splits | diff --git a/src/GToolkit-Coder/GtLineDiffSplitter.class.st b/src/GToolkit-Coder/GtLineDiffSplitter.class.st index 13fe71481..c12598ae5 100644 --- a/src/GToolkit-Coder/GtLineDiffSplitter.class.st +++ b/src/GToolkit-Coder/GtLineDiffSplitter.class.st @@ -14,6 +14,11 @@ GtLineDiffSplitter class >> ignoringEOLChars [ yourself ] +{ #category : #'as yet unclassified' } +GtLineDiffSplitter >> descriptionString [ + ^ 'split by lines' +] + { #category : #accessing } GtLineDiffSplitter >> includeEOLChars [ ^ includeEOLChars diff --git a/src/GToolkit-Coder/GtNullDiffSplitter.class.st b/src/GToolkit-Coder/GtNullDiffSplitter.class.st index 69d3cd852..8b8ade8ad 100644 --- a/src/GToolkit-Coder/GtNullDiffSplitter.class.st +++ b/src/GToolkit-Coder/GtNullDiffSplitter.class.st @@ -4,6 +4,11 @@ Class { #category : #'GToolkit-Coder-Diff-Algorithm' } +{ #category : #'as yet unclassified' } +GtNullDiffSplitter >> descriptionString [ + ^ 'do not split' +] + { #category : #actions } GtNullDiffSplitter >> split: aCollection into: aGtDiffSplits [ 1 diff --git a/src/GToolkit-Coder/GtSmaCCDiffSplitter.class.st b/src/GToolkit-Coder/GtSmaCCDiffSplitter.class.st index 19fb19cc9..e490d399e 100644 --- a/src/GToolkit-Coder/GtSmaCCDiffSplitter.class.st +++ b/src/GToolkit-Coder/GtSmaCCDiffSplitter.class.st @@ -7,6 +7,11 @@ Class { #category : #'GToolkit-Coder-Diff-Algorithm' } +{ #category : #'as yet unclassified' } +GtSmaCCDiffSplitter >> descriptionString [ + ^ 'split using ' , self scannerClass asString +] + { #category : #'as yet unclassified' } GtSmaCCDiffSplitter >> printOn: aStream [ super printOn: aStream. From cc4877a93785cf738b3a9137460e47f0369a9229 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Tue, 7 Jan 2025 13:04:48 +0100 Subject: [PATCH 0831/1268] Better description string in diff splitters --- src/GToolkit-Coder/GtCharacterGroupDiffSplitter.class.st | 2 +- src/GToolkit-Coder/GtLineDiffSplitter.class.st | 2 +- src/GToolkit-Coder/GtSmaCCDiffSplitter.class.st | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder/GtCharacterGroupDiffSplitter.class.st b/src/GToolkit-Coder/GtCharacterGroupDiffSplitter.class.st index 9cbaf7496..5df204913 100644 --- a/src/GToolkit-Coder/GtCharacterGroupDiffSplitter.class.st +++ b/src/GToolkit-Coder/GtCharacterGroupDiffSplitter.class.st @@ -31,7 +31,7 @@ GtCharacterGroupDiffSplitter >> classify: aCharacter [ { #category : #'as yet unclassified' } GtCharacterGroupDiffSplitter >> descriptionString [ - ^ 'split by character groups (' , (', ' join: groups) , ')' + ^ 'by character groups (' , (', ' join: groups) , ')' ] { #category : #initialization } diff --git a/src/GToolkit-Coder/GtLineDiffSplitter.class.st b/src/GToolkit-Coder/GtLineDiffSplitter.class.st index c12598ae5..be90a1dfa 100644 --- a/src/GToolkit-Coder/GtLineDiffSplitter.class.st +++ b/src/GToolkit-Coder/GtLineDiffSplitter.class.st @@ -16,7 +16,7 @@ GtLineDiffSplitter class >> ignoringEOLChars [ { #category : #'as yet unclassified' } GtLineDiffSplitter >> descriptionString [ - ^ 'split by lines' + ^ 'by lines' ] { #category : #accessing } diff --git a/src/GToolkit-Coder/GtSmaCCDiffSplitter.class.st b/src/GToolkit-Coder/GtSmaCCDiffSplitter.class.st index e490d399e..eeec959d1 100644 --- a/src/GToolkit-Coder/GtSmaCCDiffSplitter.class.st +++ b/src/GToolkit-Coder/GtSmaCCDiffSplitter.class.st @@ -9,7 +9,7 @@ Class { { #category : #'as yet unclassified' } GtSmaCCDiffSplitter >> descriptionString [ - ^ 'split using ' , self scannerClass asString + ^ 'using ' , self scannerClass asString ] { #category : #'as yet unclassified' } From 3f4f9df8820b269db04318901f036c55d84501db Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 13 Jan 2025 13:02:05 -0300 Subject: [PATCH 0832/1268] filter model: add short list parameter [feenkcom/gtoolkit#4268] --- .../GtFilterModelExamples.class.st | 66 ++++++++++ .../GtFilterLabelElement.class.st | 6 +- src/GToolkit-Coder-UI/GtFilterModel.class.st | 6 + .../GtFilterModelItem.class.st | 5 + .../GtFilterModelItemsBuilder.class.st | 9 ++ .../GtFilterModelParameter.class.st | 80 ++++++++++++ .../GtFilterModelParameterUpdated.class.st | 31 +++++ .../GtFilterModelPluggableItem.class.st | 25 +++- .../GtFilterParametersElement.class.st | 31 +++++ .../GtFilterPrefixLabelElement.class.st | 20 ++- .../GtFilterSelectableItemModel.class.st | 107 +--------------- ...ilterSelectableItemModelParameter.class.st | 23 ++++ .../GtFilterSelectableItemViewModel.class.st | 2 + .../GtFilterShortListModel.class.st | 29 +---- .../GtFilterShortListModelParameter.class.st | 12 ++ .../GtFilterShortListSettingsElement.class.st | 2 +- .../GtFilterViewModel.class.st | 12 ++ .../GtFiltersModelUpdated.class.st | 5 + .../TFilterWithWithFilterModel.trait.st | 7 -- .../TGtFilterViewModelParameters.trait.st | 10 ++ .../TGtWithFilterModelParameters.trait.st | 65 ++++++++++ .../TGtWithItemsSelector.trait.st | 43 +++++++ .../TGtWithSelectableItem.trait.st | 115 ++++++++++++++++++ 23 files changed, 569 insertions(+), 142 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtFilterModelParameter.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterModelParameterUpdated.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterParametersElement.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterSelectableItemModelParameter.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterShortListModelParameter.class.st delete mode 100644 src/GToolkit-Coder-UI/TFilterWithWithFilterModel.trait.st create mode 100644 src/GToolkit-Coder-UI/TGtFilterViewModelParameters.trait.st create mode 100644 src/GToolkit-Coder-UI/TGtWithFilterModelParameters.trait.st create mode 100644 src/GToolkit-Coder-UI/TGtWithItemsSelector.trait.st create mode 100644 src/GToolkit-Coder-UI/TGtWithSelectableItem.trait.st diff --git a/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st b/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st index ac33e0978..136fcfdce 100644 --- a/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st @@ -328,6 +328,39 @@ GtFilterModelExamples >> shortListModel [ ^ aModel ] +{ #category : #examples } +GtFilterModelExamples >> shortListModelParameter [ + + | aModel | + aModel := GtFilterShortListModelParameter new + updater: [ :aFilter :anItem | + anItem + ifSome: [ :aValue | + anItem onCreateFilter: aFilter ] + ifNone: [ ] ]; + items: [ { + GtFilterModelPluggableItem new + label: 'readers and writers'; + filterUpdater: [ :aFilter | + aFilter includeReaders: true. + aFilter includeWriters: true ]. + GtFilterModelPluggableItem new + label: 'readers only'; + filterUpdater: [ :aFilter | + aFilter includeReaders: true. + aFilter includeWriters: false ]. + GtFilterModelPluggableItem new + label: 'writers only'; + filterUpdater: [ :aFilter | + aFilter includeReaders: false. + aFilter includeWriters: true ] } ]; + selectFirstItem; + displayAllItems. + self assert: aModel items size equals: 3. + + ^ aModel +] + { #category : #examples } GtFilterModelExamples >> shortListModelPluggableItems [ @@ -483,6 +516,39 @@ GtFilterModelExamples >> shortListModelWithIcons [ ^ aModel ] +{ #category : #examples } +GtFilterModelExamples >> shortListModelWithParameter [ + + | aModel | + aModel := self shortListModel. + aModel parameter: self shortListModelParameter. + self assert: aModel parameters size equals: 1. + + ^ aModel +] + +{ #category : #examples } +GtFilterModelExamples >> shortListModelWithParameter_changeParameterValue [ + + | aModel aCollection aParameter anAnnouncement | + aModel := self shortListModelWithParameter. + + aCollection := OrderedCollection new. + aModel weak + when: GtFilterModelAnnouncement + send: #add: + to: aCollection. + + aParameter := aModel parameters first. + aParameter selectedItem: aParameter items second. + self assert: aCollection size equals: 1. + anAnnouncement := aCollection first. + self assert: anAnnouncement class equals: GtFilterModelParameterUpdated. + self assert: anAnnouncement changesFilteredResult. + + ^ aModel +] + { #category : #examples } GtFilterModelExamples >> textModel [ diff --git a/src/GToolkit-Coder-UI/GtFilterLabelElement.class.st b/src/GToolkit-Coder-UI/GtFilterLabelElement.class.st index 1a3f6c45f..a30302902 100644 --- a/src/GToolkit-Coder-UI/GtFilterLabelElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterLabelElement.class.st @@ -58,7 +58,7 @@ GtFilterLabelElement >> initializeLabelElement [ { #category : #initialization } GtFilterLabelElement >> initializeSettingsContainer [ - settingsContainer := BrFrame new + settingsContainer := BrHorizontalPane new hFitContentLimited; vFitContent; margin: (BlInsets all: 2); @@ -188,6 +188,8 @@ GtFilterLabelElement >> updateSettingsContainer [ self removeSettingsElement. anElement := self filterViewModel asUserSettingsElement. anElement ifNil: [ ^ self ]. - anElement constraintsDo: [ :c | c frame vertical alignCenter ]. + anElement constraintsDo: [ :c | + c linear vertical alignCenter. + c frame vertical alignCenter ]. self addSettingsElement: anElement ] diff --git a/src/GToolkit-Coder-UI/GtFilterModel.class.st b/src/GToolkit-Coder-UI/GtFilterModel.class.st index 6be4d22c7..87cf01d0a 100644 --- a/src/GToolkit-Coder-UI/GtFilterModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModel.class.st @@ -50,6 +50,12 @@ GtFilterModel >> asSearchFilter [ ^ creator cull: self selectedValue cull: self ] +{ #category : #converting } +GtFilterModel >> asUserParametersElement [ + + ^ self asFilterViewModel asUserParametersElement +] + { #category : #converting } GtFilterModel >> asUserSettingsElement [ diff --git a/src/GToolkit-Coder-UI/GtFilterModelItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelItem.class.st index fd71b7fc6..53d67c25e 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelItem.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelItem.class.st @@ -91,3 +91,8 @@ GtFilterModelItem >> labelSize [ ^ self label ifNotNil: #size ifNil: [ 0 ] ] + +{ #category : #converting } +GtFilterModelItem >> onCreateFilter: aFilter [ + ^ self +] diff --git a/src/GToolkit-Coder-UI/GtFilterModelItemsBuilder.class.st b/src/GToolkit-Coder-UI/GtFilterModelItemsBuilder.class.st index 7d70b4c5c..2e69f145d 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelItemsBuilder.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelItemsBuilder.class.st @@ -30,6 +30,15 @@ GtFilterModelItemsBuilder >> firstItemDo: aBlock [ aBlock cull: aCollection first ] +{ #category : #accessing } +GtFilterModelItemsBuilder >> itemAt: anIndex do: aBlock [ + | aCollection | + aCollection := self create. + aCollection ifEmpty: [ ^ self ]. + aCollection size < anIndex ifTrue: [ ^ self ]. + aBlock cull: (aCollection at: anIndex) +] + { #category : #accessing } GtFilterModelItemsBuilder >> lastItemDo: aBlock [ | aCollection | diff --git a/src/GToolkit-Coder-UI/GtFilterModelParameter.class.st b/src/GToolkit-Coder-UI/GtFilterModelParameter.class.st new file mode 100644 index 000000000..4310a6729 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModelParameter.class.st @@ -0,0 +1,80 @@ +Class { + #name : #GtFilterModelParameter, + #superclass : #Object, + #traits : 'TGtAnnouncer', + #classTraits : 'TGtAnnouncer classTrait', + #instVars : [ + 'updater', + 'announcer' + ], + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #announcer } +GtFilterModelParameter >> announcer [ + + ^ announcer ifNil: [ announcer := Announcer new ] +] + +{ #category : #converting } +GtFilterModelParameter >> asFilterViewModel [ + + ^ self filterViewModelClass new filterModel: self +] + +{ #category : #converting } +GtFilterModelParameter >> asUserParametersElement [ + + ^ self asFilterViewModel asUserParametersElement +] + +{ #category : #testing } +GtFilterModelParameter >> changesFilteredResult [ + "Indicates whether it changes a result of filtered items, e.g., list of method coders." + + + ^ false +] + +{ #category : #accessing } +GtFilterModelParameter >> filterViewModelClass [ + ^ self subclassResponsibility +] + +{ #category : #'gt - extensions' } +GtFilterModelParameter >> gtLiveFor: aView [ + + ^ aView explicit + title: 'Live'; + stencil: [ self asUserParametersElement margin: (BlInsets all: 10) ] +] + +{ #category : #converting } +GtFilterModelParameter >> onCreateFilter: aFilter [ + updater ifNil: [ ^ self ]. + updater cull: aFilter cull: self selectedValue cull: self. +] + +{ #category : #printing } +GtFilterModelParameter >> printDetailsOn: aStream [ + aStream + print: (self selectedValue ifNotNil: [ :aValue | aValue asFilterModelItem itemValue ]) +] + +{ #category : #accessing } +GtFilterModelParameter >> selectedValue [ + "Return a filter value, e.g., selected item, input text." + + ^ nil +] + +{ #category : #accessing } +GtFilterModelParameter >> updater [ + ^ updater +] + +{ #category : #accessing } +GtFilterModelParameter >> updater: aBlock [ + + updater := aBlock +] diff --git a/src/GToolkit-Coder-UI/GtFilterModelParameterUpdated.class.st b/src/GToolkit-Coder-UI/GtFilterModelParameterUpdated.class.st new file mode 100644 index 000000000..da6086503 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModelParameterUpdated.class.st @@ -0,0 +1,31 @@ +" +I am announced when a parameter is is changed, implying new {{gtClass:GtSearchFilter}} results. +" +Class { + #name : #GtFilterModelParameterUpdated, + #superclass : #GtFilterModelAnnouncement, + #instVars : [ + 'originalAnnouncement' + ], + #category : #'GToolkit-Coder-UI-Filters - Events' +} + +{ #category : #testing } +GtFilterModelParameterUpdated >> changesFilteredResult [ + ^ self originalAnnouncement changesFilteredResult +] + +{ #category : #accessing } +GtFilterModelParameterUpdated >> originalAnnouncement [ + ^ originalAnnouncement +] + +{ #category : #accessing } +GtFilterModelParameterUpdated >> originalAnnouncement: anAnnouncement [ + originalAnnouncement := anAnnouncement +] + +{ #category : #accessing } +GtFilterModelParameterUpdated >> parameterModel [ + self originalAnnouncement ifNotNil: #model +] diff --git a/src/GToolkit-Coder-UI/GtFilterModelPluggableItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelPluggableItem.class.st index 33a4ac98d..3b35db2c0 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelPluggableItem.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelPluggableItem.class.st @@ -4,7 +4,8 @@ Class { #instVars : [ 'object', 'iconStencilBuilder', - 'labelStencilBuilder' + 'labelStencilBuilder', + 'filterUpdater' ], #category : #'GToolkit-Coder-UI-Filters - Models' } @@ -59,6 +60,19 @@ GtFilterModelPluggableItem class >> forObject: anObject label: aLabelStencilBuil label: aLabelStencilBuilder ] +{ #category : #accessing } +GtFilterModelPluggableItem >> filterUpdater [ + ^ filterUpdater +] + +{ #category : #accessing } +GtFilterModelPluggableItem >> filterUpdater: aBlock [ + "Set a filter block that is called when a filter model is updated and new filter created. + It receives two arguments: [ :aFilter :anItem | ]." + + filterUpdater := aBlock +] + { #category : #accessing } GtFilterModelPluggableItem >> icon [ @@ -77,7 +91,8 @@ GtFilterModelPluggableItem >> icon: aStencilBuilder [ GtFilterModelPluggableItem >> initialize [ super initialize. iconStencilBuilder := GtFilterModelItemIconStencilBuilder new. - labelStencilBuilder := GtFilterModelItemLabelStencilBuilder new + labelStencilBuilder := GtFilterModelItemLabelStencilBuilder new. + filterUpdater := [ :aFilter :anItem | "do nothing" ] ] { #category : #accessing } @@ -109,6 +124,12 @@ GtFilterModelPluggableItem >> object: anObject [ object := anObject ] +{ #category : #converting } +GtFilterModelPluggableItem >> onCreateFilter: aFilter [ + filterUpdater ifNil: [ ^ self ]. + filterUpdater cull: aFilter cull: self +] + { #category : #printing } GtFilterModelPluggableItem >> printOn: aStream [ super printOn: aStream. diff --git a/src/GToolkit-Coder-UI/GtFilterParametersElement.class.st b/src/GToolkit-Coder-UI/GtFilterParametersElement.class.st new file mode 100644 index 000000000..dcb9a1604 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterParametersElement.class.st @@ -0,0 +1,31 @@ +Class { + #name : #GtFilterParametersElement, + #superclass : #GtFilterSettingsElement, + #category : #'GToolkit-Coder-UI-Filters - Widgets' +} + +{ #category : #'api - filter view model' } +GtFilterParametersElement >> onFilterViewModelChanged [ + super onFilterViewModelChanged. + self updateElement +] + +{ #category : #'private - updating' } +GtFilterParametersElement >> updateElement [ + | someParameters someElements | + someParameters := self filterViewModel parameters. + + self removeChildren. + + someParameters + ifEmpty: [ + self visibility: BlVisibility gone. + ^ self ] + ifNotEmpty: [ + self visibility: BlVisibility visible ]. + + true ifTrue: [ ^ self ]. + + someElements := someParameters collect: #asUserParametersElement. + self addChildren: someElements +] diff --git a/src/GToolkit-Coder-UI/GtFilterPrefixLabelElement.class.st b/src/GToolkit-Coder-UI/GtFilterPrefixLabelElement.class.st index dddb033c5..5d0c0c0cc 100644 --- a/src/GToolkit-Coder-UI/GtFilterPrefixLabelElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterPrefixLabelElement.class.st @@ -4,7 +4,7 @@ Class { #category : #'GToolkit-Coder-UI-Filters - Widgets' } -{ #category : #'as yet unclassified' } +{ #category : #initialization } GtFilterPrefixLabelElement >> initialize [ super initialize. self padding: (BlInsets top: 0 right: 0 bottom: 0 left: 2). @@ -12,3 +12,21 @@ GtFilterPrefixLabelElement >> initialize [ self addChild: labelElement. self addChild: settingsContainer as: #container ] + +{ #category : #'private - updating' } +GtFilterPrefixLabelElement >> updateSettingsContainer [ + | someParameters someElements | + super updateSettingsContainer. + + someParameters := self filterViewModel parameters. + + someParameters ifEmpty: [ ^ self ]. + + someElements := someParameters collect: #asUserParametersElement. + someElements do: [ :eachElement | + eachElement constraintsDo: [ :c | + c linear vertical alignCenter. + c frame vertical alignCenter ] ]. + + settingsContainer addChildren: someElements. +] diff --git a/src/GToolkit-Coder-UI/GtFilterSelectableItemModel.class.st b/src/GToolkit-Coder-UI/GtFilterSelectableItemModel.class.st index 618066660..c146d2101 100644 --- a/src/GToolkit-Coder-UI/GtFilterSelectableItemModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterSelectableItemModel.class.st @@ -1,10 +1,8 @@ Class { #name : #GtFilterSelectableItemModel, #superclass : #GtFilterModel, - #instVars : [ - 'selectedItem', - 'itemsBuilder' - ], + #traits : 'TGtWithFilterModelParameters + TGtWithSelectableItem', + #classTraits : 'TGtWithFilterModelParameters classTrait + TGtWithSelectableItem classTrait', #category : #'GToolkit-Coder-UI-Filters - Models' } @@ -18,72 +16,9 @@ GtFilterSelectableItemModel >> changesFilteredResult [ "Indicates whether it changes a result of filtered items, e.g., list of method coders." - ^ self selectedItem ifSome: [ true ] ifNone: [ false ] -] - -{ #category : #initialization } -GtFilterSelectableItemModel >> initialize [ - super initialize. - itemsBuilder := GtFilterModelEmptyItemsBuilder default. -] - -{ #category : #accessing } -GtFilterSelectableItemModel >> items [ - - ^ itemsBuilder create -] - -{ #category : #accessing } -GtFilterSelectableItemModel >> items: anObject [ - self itemsBuilder: anObject -] - -{ #category : #accessing } -GtFilterSelectableItemModel >> items: anObject icon: anIconStencilBuilder [ - | aNewItemsBuilder aPluggableItemsBuilder | - aNewItemsBuilder := anObject asFilterModelItemsBuilder. - aPluggableItemsBuilder := GtFilterModelPluggableItemsBuilder new - itemsBuilder: aNewItemsBuilder; - iconStencilBuilder: anIconStencilBuilder. - self itemsBuilder: aPluggableItemsBuilder -] - -{ #category : #accessing } -GtFilterSelectableItemModel >> items: anObject icon: anIconStencilBuilder label: aLabelStencilBuilder [ - | aNewItemsBuilder aPluggableItemsBuilder | - aNewItemsBuilder := anObject asFilterModelItemsBuilder. - aPluggableItemsBuilder := GtFilterModelPluggableItemsBuilder new - itemsBuilder: aNewItemsBuilder; - iconStencilBuilder: anIconStencilBuilder; - labelStencilBuilder: aLabelStencilBuilder. - self itemsBuilder: aPluggableItemsBuilder -] - -{ #category : #accessing } -GtFilterSelectableItemModel >> items: anObject label: aLabelStencilBuilder [ - | aNewItemsBuilder aPluggableItemsBuilder | - aNewItemsBuilder := anObject asFilterModelItemsBuilder. - aPluggableItemsBuilder := GtFilterModelPluggableItemsBuilder new - itemsBuilder: aNewItemsBuilder; - labelStencilBuilder: aLabelStencilBuilder. - self itemsBuilder: aPluggableItemsBuilder -] - -{ #category : #accessing } -GtFilterSelectableItemModel >> itemsBuilder [ - - ^ itemsBuilder -] - -{ #category : #accessing } -GtFilterSelectableItemModel >> itemsBuilder: anObject [ - | aNewItemsBuilder | - aNewItemsBuilder := anObject asFilterModelItemsBuilder. - self itemsBuilder = aNewItemsBuilder ifTrue: [ ^ self ]. - itemsBuilder := aNewItemsBuilder. - aNewItemsBuilder filterModel: self. - - self notifyItemsChanged + ^ self selectedItem + ifSome: [ true ] + ifNone: [ self parameters anySatisfy: #changesFilteredResult ] ] { #category : #'private - notifying' } @@ -101,35 +36,3 @@ GtFilterSelectableItemModel >> notifySelectedItemChanged [ model: self; selectedItem: self selectedItem) ] - -{ #category : #initialization } -GtFilterSelectableItemModel >> selectFirstItem [ - self itemsBuilder firstItemDo: [ :anItem | self selectedItem: anItem ] -] - -{ #category : #initialization } -GtFilterSelectableItemModel >> selectLastItem [ - self itemsBuilder lastItemDo: [ :anItem | self selectedItem: anItem ] -] - -{ #category : #accessing } -GtFilterSelectableItemModel >> selectedItem [ - ^ selectedItem ifNil: [ selectedItem := GtFilterModelNoItem default ] -] - -{ #category : #accessing } -GtFilterSelectableItemModel >> selectedItem: anItem [ - | aNewItem | - aNewItem := anItem asFilterModelItem. - self selectedItem = aNewItem ifTrue: [ ^ self ]. - - selectedItem := aNewItem. - self notifySelectedItemChanged -] - -{ #category : #accessing } -GtFilterSelectableItemModel >> selectedValue [ - "Return a filter value, e.g., selected item, input text." - - ^ self selectedItem -] diff --git a/src/GToolkit-Coder-UI/GtFilterSelectableItemModelParameter.class.st b/src/GToolkit-Coder-UI/GtFilterSelectableItemModelParameter.class.st new file mode 100644 index 000000000..e62766342 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterSelectableItemModelParameter.class.st @@ -0,0 +1,23 @@ +Class { + #name : #GtFilterSelectableItemModelParameter, + #superclass : #GtFilterModelParameter, + #traits : 'TGtWithSelectableItem', + #classTraits : 'TGtWithSelectableItem classTrait', + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #'private - notifying' } +GtFilterSelectableItemModelParameter >> notifyItemsChanged [ + self + announce: (GtFilterModelItemsChanged new + model: self; + itemsBuilder: self itemsBuilder) +] + +{ #category : #'private - notifying' } +GtFilterSelectableItemModelParameter >> notifySelectedItemChanged [ + self + announce: (GtFilterModelSelectedItemChanged new + model: self; + selectedItem: self selectedItem) +] diff --git a/src/GToolkit-Coder-UI/GtFilterSelectableItemViewModel.class.st b/src/GToolkit-Coder-UI/GtFilterSelectableItemViewModel.class.st index 6215ad2d1..202160afb 100644 --- a/src/GToolkit-Coder-UI/GtFilterSelectableItemViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterSelectableItemViewModel.class.st @@ -1,6 +1,8 @@ Class { #name : #GtFilterSelectableItemViewModel, #superclass : #GtFilterViewModel, + #traits : 'TGtFilterViewModelParameters', + #classTraits : 'TGtFilterViewModelParameters classTrait', #category : #'GToolkit-Coder-UI-Filters - View Models' } diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st index 73deef7e7..f4cee0813 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListModel.class.st @@ -1,37 +1,12 @@ Class { #name : #GtFilterShortListModel, #superclass : #GtFilterSelectableItemModel, - #instVars : [ - 'itemsSelector' - ], + #traits : 'TGtWithItemsSelector', + #classTraits : 'TGtWithItemsSelector classTrait', #category : #'GToolkit-Coder-UI-Filters - Models' } -{ #category : #initialization } -GtFilterShortListModel >> displayAllItems [ - "Display all items, including the selected item in a dropdown list." - - itemsSelector := GtFilterModelAllItemsSelector new filterModel: self -] - -{ #category : #initialization } -GtFilterShortListModel >> displayItemsWithoutSelectedItem [ - itemsSelector := GtFilterModelItemsWithoutSelectedItemSelector new filterModel: self -] - { #category : #accessing } GtFilterShortListModel >> filterViewModelClass [ ^ GtFilterShortListViewModel ] - -{ #category : #initialization } -GtFilterShortListModel >> initialize [ - super initialize. - itemsSelector := GtFilterModelItemsWithoutSelectedItemSelector new filterModel: self -] - -{ #category : #accessing } -GtFilterShortListModel >> someItems [ - - ^ itemsSelector items -] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListModelParameter.class.st b/src/GToolkit-Coder-UI/GtFilterShortListModelParameter.class.st new file mode 100644 index 000000000..5f21c3b1c --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterShortListModelParameter.class.st @@ -0,0 +1,12 @@ +Class { + #name : #GtFilterShortListModelParameter, + #superclass : #GtFilterSelectableItemModelParameter, + #traits : 'TGtWithItemsSelector', + #classTraits : 'TGtWithItemsSelector classTrait', + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #accessing } +GtFilterShortListModelParameter >> filterViewModelClass [ + ^ GtFilterShortListViewModel +] diff --git a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st index f3990a074..639984bd4 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st @@ -305,7 +305,7 @@ GtFilterShortListSettingsElement >> updateButtonElement [ GtFilterShortListSettingsElement >> updateElement [ self updateButtonElement. self updateHandleElement. - self updateListElement + self updateListElement. ] { #category : #'private - updating' } diff --git a/src/GToolkit-Coder-UI/GtFilterViewModel.class.st b/src/GToolkit-Coder-UI/GtFilterViewModel.class.st index c78155ddb..57865dd9e 100644 --- a/src/GToolkit-Coder-UI/GtFilterViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterViewModel.class.st @@ -21,6 +21,12 @@ GtFilterViewModel >> asFilterLabeledElement [ ^ self filterLabelElementClass new filterViewModel: self ] +{ #category : #converting } +GtFilterViewModel >> asUserParametersElement [ + + ^ self filterElementClass new filterViewModel: self +] + { #category : #converting } GtFilterViewModel >> asUserSettingsElement [ @@ -55,6 +61,12 @@ GtFilterViewModel >> onLabelChanged: anAnnouncement [ label: anAnnouncement label) ] +{ #category : #accessing } +GtFilterViewModel >> parameters [ + + ^ #() +] + { #category : #printing } GtFilterViewModel >> printOn: aStream [ super printOn: aStream. diff --git a/src/GToolkit-Coder-UI/GtFiltersModelUpdated.class.st b/src/GToolkit-Coder-UI/GtFiltersModelUpdated.class.st index 4e909094c..4b30fe224 100644 --- a/src/GToolkit-Coder-UI/GtFiltersModelUpdated.class.st +++ b/src/GToolkit-Coder-UI/GtFiltersModelUpdated.class.st @@ -1,3 +1,8 @@ +" +I announce that a {{gtClass:GtFiltersModel}} changed. +I am announced only if an update changes search filter results. +In other words, I must not be announced if an added or removed filter model does not have a selected value. +" Class { #name : #GtFiltersModelUpdated, #superclass : #GtFiltersModelAnnouncement, diff --git a/src/GToolkit-Coder-UI/TFilterWithWithFilterModel.trait.st b/src/GToolkit-Coder-UI/TFilterWithWithFilterModel.trait.st deleted file mode 100644 index 47556c373..000000000 --- a/src/GToolkit-Coder-UI/TFilterWithWithFilterModel.trait.st +++ /dev/null @@ -1,7 +0,0 @@ -Trait { - #name : #TFilterWithWithFilterModel, - #instVars : [ - 'filterModel' - ], - #category : #'GToolkit-Coder-UI-Filters - Models' -} diff --git a/src/GToolkit-Coder-UI/TGtFilterViewModelParameters.trait.st b/src/GToolkit-Coder-UI/TGtFilterViewModelParameters.trait.st new file mode 100644 index 000000000..ff8a8cf4e --- /dev/null +++ b/src/GToolkit-Coder-UI/TGtFilterViewModelParameters.trait.st @@ -0,0 +1,10 @@ +Trait { + #name : #TGtFilterViewModelParameters, + #category : #'GToolkit-Coder-UI-Filters - View Models' +} + +{ #category : #accessing } +TGtFilterViewModelParameters >> parameters [ + + ^ self filterModel parameters +] diff --git a/src/GToolkit-Coder-UI/TGtWithFilterModelParameters.trait.st b/src/GToolkit-Coder-UI/TGtWithFilterModelParameters.trait.st new file mode 100644 index 000000000..beb566a57 --- /dev/null +++ b/src/GToolkit-Coder-UI/TGtWithFilterModelParameters.trait.st @@ -0,0 +1,65 @@ +Trait { + #name : #TGtWithFilterModelParameters, + #instVars : [ + 'parameters' + ], + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #parameters } +TGtWithFilterModelParameters >> addParameter: aFilterModelParameter [ + self parameters add: aFilterModelParameter. + self subscribeToParameter: aFilterModelParameter. +] + +{ #category : #converting } +TGtWithFilterModelParameters >> asSearchFilter [ + | aFilter | + aFilter := super asSearchFilter. + self parameters do: [ :eachParameter | + eachParameter onCreateFilter: aFilter ]. + ^ aFilter +] + +{ #category : #'event handling' } +TGtWithFilterModelParameters >> onParameterModelAnnouncement: anAnnouncement [ + anAnnouncement changesFilteredResult ifFalse: [ ^ self ]. + + self announce: (GtFilterModelParameterUpdated new + model: self; + originalAnnouncement: anAnnouncement) +] + +{ #category : #parameters } +TGtWithFilterModelParameters >> parameter: aFilterModelParameter [ + self parameters add: aFilterModelParameter. + self subscribeToParameter: aFilterModelParameter. +] + +{ #category : #parameters } +TGtWithFilterModelParameters >> parameterAt: anIndex do: aBlock [ + | aParameter | + aParameter := self parameters at: anIndex ifAbsent: [ nil ]. + aParameter ifNotNil: aBlock +] + +{ #category : #accessing } +TGtWithFilterModelParameters >> parameters [ + + ^ parameters ifNil: [ parameters := OrderedCollection new: 1 ] +] + +{ #category : #accessing } +TGtWithFilterModelParameters >> parameters: aCollection [ + parameters := aCollection. + aCollection do: [ :eachParameter | + self subscribeToParameter: eachParameter ] +] + +{ #category : #'private - subscriptions' } +TGtWithFilterModelParameters >> subscribeToParameter: aFilterModelParameter [ + aFilterModelParameter weak + when: GtFilterModelAnnouncement + send: #onParameterModelAnnouncement: + to: self +] diff --git a/src/GToolkit-Coder-UI/TGtWithItemsSelector.trait.st b/src/GToolkit-Coder-UI/TGtWithItemsSelector.trait.st new file mode 100644 index 000000000..a78ad221f --- /dev/null +++ b/src/GToolkit-Coder-UI/TGtWithItemsSelector.trait.st @@ -0,0 +1,43 @@ +Trait { + #name : #TGtWithItemsSelector, + #instVars : [ + 'itemsSelector' + ], + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #initialization } +TGtWithItemsSelector >> defaultItemsSelector [ + ^ GtFilterModelItemsWithoutSelectedItemSelector new filterModel: self +] + +{ #category : #initialization } +TGtWithItemsSelector >> displayAllItems [ + "Display all items, including the selected item in a dropdown list." + + self itemsSelector: (GtFilterModelAllItemsSelector new filterModel: self) +] + +{ #category : #initialization } +TGtWithItemsSelector >> displayItemsWithoutSelectedItem [ + self itemsSelector: (GtFilterModelItemsWithoutSelectedItemSelector new filterModel: self) +] + +{ #category : #accessing } +TGtWithItemsSelector >> itemsSelector [ + + ^ itemsSelector ifNil: [ itemsSelector := self defaultItemsSelector ] +] + +{ #category : #accessing } +TGtWithItemsSelector >> itemsSelector: anItemsSelector [ + itemsSelector := anItemsSelector +] + +{ #category : #accessing } +TGtWithItemsSelector >> someItems [ + "Return items that should be displayed in a list" + + + ^ self itemsSelector items +] diff --git a/src/GToolkit-Coder-UI/TGtWithSelectableItem.trait.st b/src/GToolkit-Coder-UI/TGtWithSelectableItem.trait.st new file mode 100644 index 000000000..acd9cd05c --- /dev/null +++ b/src/GToolkit-Coder-UI/TGtWithSelectableItem.trait.st @@ -0,0 +1,115 @@ +Trait { + #name : #TGtWithSelectableItem, + #instVars : [ + 'selectedItem', + 'itemsBuilder' + ], + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #accessing } +TGtWithSelectableItem >> items [ + + ^ itemsBuilder create +] + +{ #category : #accessing } +TGtWithSelectableItem >> items: anObject [ + self itemsBuilder: anObject +] + +{ #category : #accessing } +TGtWithSelectableItem >> items: anObject icon: anIconStencilBuilder [ + | aNewItemsBuilder aPluggableItemsBuilder | + aNewItemsBuilder := anObject asFilterModelItemsBuilder. + aPluggableItemsBuilder := GtFilterModelPluggableItemsBuilder new + itemsBuilder: aNewItemsBuilder; + iconStencilBuilder: anIconStencilBuilder. + self itemsBuilder: aPluggableItemsBuilder +] + +{ #category : #accessing } +TGtWithSelectableItem >> items: anObject icon: anIconStencilBuilder label: aLabelStencilBuilder [ + | aNewItemsBuilder aPluggableItemsBuilder | + aNewItemsBuilder := anObject asFilterModelItemsBuilder. + aPluggableItemsBuilder := GtFilterModelPluggableItemsBuilder new + itemsBuilder: aNewItemsBuilder; + iconStencilBuilder: anIconStencilBuilder; + labelStencilBuilder: aLabelStencilBuilder. + self itemsBuilder: aPluggableItemsBuilder +] + +{ #category : #accessing } +TGtWithSelectableItem >> items: anObject label: aLabelStencilBuilder [ + | aNewItemsBuilder aPluggableItemsBuilder | + aNewItemsBuilder := anObject asFilterModelItemsBuilder. + aPluggableItemsBuilder := GtFilterModelPluggableItemsBuilder new + itemsBuilder: aNewItemsBuilder; + labelStencilBuilder: aLabelStencilBuilder. + self itemsBuilder: aPluggableItemsBuilder +] + +{ #category : #accessing } +TGtWithSelectableItem >> itemsBuilder [ + + ^ itemsBuilder ifNil: [ + itemsBuilder := GtFilterModelEmptyItemsBuilder default ] +] + +{ #category : #accessing } +TGtWithSelectableItem >> itemsBuilder: anObject [ + | aNewItemsBuilder | + aNewItemsBuilder := anObject asFilterModelItemsBuilder. + self itemsBuilder = aNewItemsBuilder ifTrue: [ ^ self ]. + itemsBuilder := aNewItemsBuilder. + aNewItemsBuilder filterModel: self. + + self notifyItemsChanged +] + +{ #category : #'private - notifying' } +TGtWithSelectableItem >> notifyItemsChanged [ + self explicitRequirement +] + +{ #category : #'private - notifying' } +TGtWithSelectableItem >> notifySelectedItemChanged [ + self explicitRequirement +] + +{ #category : #initialization } +TGtWithSelectableItem >> selectFirstItem [ + self itemsBuilder firstItemDo: [ :anItem | self selectedItem: anItem ] +] + +{ #category : #initialization } +TGtWithSelectableItem >> selectItemAt: anIndex [ + self itemsBuilder itemAt: anIndex do: [ :anItem | self selectedItem: anItem ] +] + +{ #category : #initialization } +TGtWithSelectableItem >> selectLastItem [ + self itemsBuilder lastItemDo: [ :anItem | self selectedItem: anItem ] +] + +{ #category : #accessing } +TGtWithSelectableItem >> selectedItem [ + ^ selectedItem ifNil: [ selectedItem := GtFilterModelNoItem default ] +] + +{ #category : #accessing } +TGtWithSelectableItem >> selectedItem: anItem [ + | aNewItem | + aNewItem := anItem asFilterModelItem. + self selectedItem = aNewItem ifTrue: [ ^ self ]. + + selectedItem := aNewItem. + self notifySelectedItemChanged +] + +{ #category : #accessing } +TGtWithSelectableItem >> selectedValue [ + "Return a filter value, e.g., selected item, input text." + + ^ self selectedItem +] From 61d8376d774fd191f38543e9b956f01e4ed4e798 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 15 Jan 2025 10:16:28 -0300 Subject: [PATCH 0833/1268] fix class comment [feenkcom/gtoolkit#4268] --- src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st index 026d34f2e..3672396f4 100644 --- a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st +++ b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st @@ -1,7 +1,7 @@ " I represent a Coder context menu. #Examples -The following example shows a case during which a context menu height does not fit and a scrollbar is displayed: {{gtExample:GtPharoCoderByScripterExamples>>#displayPharoMethodContextMenuExtentIn800x300Space | previewExpanded=true | codeExpanded=false | previewHeight=500}} +The following example shows a case during which a context menu height does not fit and a scrollbar is displayed: {{gtExample:GtPharoCoderByScripterExamples>>#displayPharoMethodContextMenuExtentIn800x330Space | previewExpanded=true | codeExpanded=false | previewHeight=500}} " Class { From 6c169ff69e3ae60dfc66bfb9200dd76d07c8f8cc Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 15 Jan 2025 11:16:08 -0300 Subject: [PATCH 0834/1268] menu: set background [feenkcom/gtoolkit#4180] --- src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st | 1 + 1 file changed, 1 insertion(+) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st b/src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st index b1b0fc4ad..8e7f838bb 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st @@ -19,6 +19,7 @@ GtTextualCoderMenu >> asElement [ aCoderElement hExact: 500; vFitContentLimited; + background: aCoderElement theme default contentBackgroundColor; addAptitude: BrGlamorousFocusableShadowAptitude new; addAptitude: (BrMenuPinnableAptitude new menuModel: self; From 2e5a0b91a8405a94fb4f7088a2dc3b5b5087734d Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 15 Jan 2025 11:33:37 -0300 Subject: [PATCH 0835/1268] menu: use handle [feenkcom/gtoolkit#4180] --- src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 0c4e3116b..16289c69c 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -142,7 +142,7 @@ GtTextualCoderEditorElement >> initialize [ self aptitude: BrGlamorousCodeEditorAptitude; "addAptitude: (BrGlamorousWithContextMenuAptitude content: [ self createContextMenuContent ]);" - addAptitude: (BrWithExplicitMenuAptitude new stencil: [ self createContextMenu ]); + addAptitude: (BrWithExplicitMenuAptitude new withHandleSubmenu: [ self createContextMenu ]); padding: BlInsets empty; hMatchParent; vFitContent. From bf483af602101b7ae086f16114835b223370d9f0 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 16 Jan 2025 10:45:06 -0300 Subject: [PATCH 0836/1268] menu: clean code [feenkcom/gtoolkit#4180] - rename and repackage some methods --- src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 16289c69c..0066c44aa 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -142,7 +142,7 @@ GtTextualCoderEditorElement >> initialize [ self aptitude: BrGlamorousCodeEditorAptitude; "addAptitude: (BrGlamorousWithContextMenuAptitude content: [ self createContextMenuContent ]);" - addAptitude: (BrWithExplicitMenuAptitude new withHandleSubmenu: [ self createContextMenu ]); + addAptitude: (BrWithExplicitMenuAptitude new handleSubmenu: [ self createContextMenu ]); padding: BlInsets empty; hMatchParent; vFitContent. From 71b4bd57369939b19f88e96a18a7781ade448ee6 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 17 Jan 2025 16:15:24 -0300 Subject: [PATCH 0837/1268] menu: use `BrWithExplicitContextMenuAptitude` [feenkcom/gtoolkit#4180] --- src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 0066c44aa..5e34de710 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -142,7 +142,7 @@ GtTextualCoderEditorElement >> initialize [ self aptitude: BrGlamorousCodeEditorAptitude; "addAptitude: (BrGlamorousWithContextMenuAptitude content: [ self createContextMenuContent ]);" - addAptitude: (BrWithExplicitMenuAptitude new handleSubmenu: [ self createContextMenu ]); + addAptitude: (BrWithExplicitContextMenuAptitude menu: [ self createContextMenu ]); padding: BlInsets empty; hMatchParent; vFitContent. From d896841d4a29e4a3e5475d08c3c848c3a21928b4 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Mon, 20 Jan 2025 09:26:25 -0600 Subject: [PATCH 0838/1268] Fix incorrect deprecation rewrite --- src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st b/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st index 6d11ced9e..4c09c5ea1 100644 --- a/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st @@ -24,8 +24,8 @@ GtExpandedOnlyCoderElement >> coder: aCoderUIModel [ self deprecated: 'Use #coderUIModel: instead.' - transformWith: '`@receiver coder: `@arg' -> '`@receiver coderUIModel: `@arg'. - + transformWith: '`@receiver coder: `@arg' -> '`@receiver coderViewModel: `@arg'. + ^ self coderViewModel: aCoderUIModel ] From 8fa04a6e37695d2ecf5e70427535587607fbed96 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 21 Jan 2025 11:33:58 -0600 Subject: [PATCH 0839/1268] Remove scrollbars from GtSourceCoderExpandedContentElement [[feenkcom/gtoolkit#4267]] --- .../GtSourceCoderExpandedContentElement.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st index a14148598..35929b6b0 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st @@ -25,8 +25,8 @@ GtSourceCoderExpandedContentElement >> initialize [ addChildren: {editorElement. actions}. self addAptitude: (BrLayoutResizerAptitude new inherit: editorElement). - self - addAptitude: (BrGlamorousWithVerticalScrollbarAptitude new scrollableName: editorElement id) + "self + addAptitude: (BrGlamorousWithVerticalScrollbarAptitude new scrollableName: editorElement id)" ] { #category : #'instance creation' } From a758c24504e679758171c9429ac40d91c0a35de7 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 21 Jan 2025 11:44:43 -0600 Subject: [PATCH 0840/1268] Add back scrollbars to single source editors [[feenkcom/gtoolkit#4267]] --- src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st | 1 + .../GtSourceCoderExpandedContentElement.class.st | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st b/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st index 4c09c5ea1..6706ba177 100644 --- a/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st @@ -70,6 +70,7 @@ GtExpandedOnlyCoderElement >> newExpandedElement: aCoderModel [ ^ GtSourceCoderExpandedContentElement new textualCoderViewModel: aCoderModel; in: [ :anElement | self addCodersCoderLook: aCoderModel to: anElement ]; + showScrollbars; yourself ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st index 35929b6b0..319844117 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st @@ -25,8 +25,6 @@ GtSourceCoderExpandedContentElement >> initialize [ addChildren: {editorElement. actions}. self addAptitude: (BrLayoutResizerAptitude new inherit: editorElement). - "self - addAptitude: (BrGlamorousWithVerticalScrollbarAptitude new scrollableName: editorElement id)" ] { #category : #'instance creation' } @@ -49,3 +47,9 @@ GtSourceCoderExpandedContentElement >> onTextualCoderViewModelChanged [ actions coderViewModel: textualCoderViewModel. editorElement textualCoderViewModel: textualCoderViewModel ] + +{ #category : #initialization } +GtSourceCoderExpandedContentElement >> showScrollbars [ + self + addAptitude: (BrGlamorousWithVerticalScrollbarAptitude new scrollableName: editorElement id) +] From c2cece32ba3fa9f44c82c8b4111d72e2d6f69359 Mon Sep 17 00:00:00 2001 From: Sven Van Caekenberghe Date: Wed, 22 Jan 2025 09:39:29 +0100 Subject: [PATCH 0841/1268] Added GtDiffBuilderExamples>>#byteArrayDiff --- .../GtDiffBuilderExamples.class.st | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/GToolkit-Coder-Examples/GtDiffBuilderExamples.class.st b/src/GToolkit-Coder-Examples/GtDiffBuilderExamples.class.st index 04315a70f..db9b4c91e 100644 --- a/src/GToolkit-Coder-Examples/GtDiffBuilderExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtDiffBuilderExamples.class.st @@ -4,6 +4,22 @@ Class { #category : #'GToolkit-Coder-Examples-Diff' } +{ #category : #examples } +GtDiffBuilderExamples >> byteArrayDiff [ + + | originalByteArray modifiedByteArray | + originalByteArray := (1 to: 64) + collect: [ :_ | 256 atRandom - 1 ] + as: ByteArray. + modifiedByteArray := originalByteArray copy. + 8 timesRepeat: [ + modifiedByteArray at: modifiedByteArray size atRandom put: 256 atRandom - 1 ]. + ^ GtDiffBuilder + computeDifferencesFrom: originalByteArray + to: modifiedByteArray + using: GtNullDiffSplitter new +] + { #category : #examples } GtDiffBuilderExamples >> changeInMiddleAndDeletionAtEnd [ From bd86474fe4b12520d90002e2a2e8961a85e05ad1 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Sat, 25 Jan 2025 14:53:00 -0300 Subject: [PATCH 0842/1268] menu: use glamorous aptitudes and element builder [feenkcom/gtoolkit#4180] --- ...BrGlamorousMenuElementBuilder.extension.st | 23 +++++++++++++++++++ .../BrMenuElementBuilder.extension.st | 6 +++++ .../GtCoderMenuActionItem.class.st | 5 ++++ .../GtTextualCoderEditorElement.class.st | 2 +- .../GtTextualCoderMenu.class.st | 10 ++++++++ .../TBrMenuModelVisitor.extension.st | 11 +++++++++ 6 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 src/GToolkit-Coder-UI/BrGlamorousMenuElementBuilder.extension.st create mode 100644 src/GToolkit-Coder-UI/BrMenuElementBuilder.extension.st create mode 100644 src/GToolkit-Coder-UI/TBrMenuModelVisitor.extension.st diff --git a/src/GToolkit-Coder-UI/BrGlamorousMenuElementBuilder.extension.st b/src/GToolkit-Coder-UI/BrGlamorousMenuElementBuilder.extension.st new file mode 100644 index 000000000..1e1e813e5 --- /dev/null +++ b/src/GToolkit-Coder-UI/BrGlamorousMenuElementBuilder.extension.st @@ -0,0 +1,23 @@ +Extension { #name : #BrGlamorousMenuElementBuilder } + +{ #category : #'*GToolkit-Coder-UI' } +BrGlamorousMenuElementBuilder >> visitTextualCoderMenu: aMenuModel [ + | aCoderViewModel aCoderElement | + aMenuModel coderViewModelStencil ifNil: [ ^ nil ]. + aCoderViewModel := aMenuModel coderViewModelStencil create. + aCoderViewModel ifNil: [ ^ nil ]. + + aCoderElement := aCoderViewModel asExpandedOnlyElement. + aCoderElement + hExact: 500; + vFitContentLimited; + background: aCoderElement theme default contentBackgroundColor; + addAptitude: (BrMenuPinnableAptitude new + menuModel: aMenuModel; + withResizers; + withAllPinActions); + addAptitude: (BrMenuHideableAptitude new menuModel: aMenuModel); + addAptitude: BrMenuCommonAptitude new. + + ^ aCoderElement +] diff --git a/src/GToolkit-Coder-UI/BrMenuElementBuilder.extension.st b/src/GToolkit-Coder-UI/BrMenuElementBuilder.extension.st new file mode 100644 index 000000000..091b5813c --- /dev/null +++ b/src/GToolkit-Coder-UI/BrMenuElementBuilder.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #BrMenuElementBuilder } + +{ #category : #'*GToolkit-Coder-UI' } +BrMenuElementBuilder >> visitCoderMenuActionItem: aMenuModel [ + ^ GtCoderMenuActionItemElement new menuModel: aMenuModel +] diff --git a/src/GToolkit-Coder-UI/GtCoderMenuActionItem.class.st b/src/GToolkit-Coder-UI/GtCoderMenuActionItem.class.st index 829cc2498..6ab0689d3 100644 --- a/src/GToolkit-Coder-UI/GtCoderMenuActionItem.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMenuActionItem.class.st @@ -7,6 +7,11 @@ Class { #category : #'GToolkit-Coder-UI-Coder - Addons' } +{ #category : #visiting } +GtCoderMenuActionItem >> acceptVisitor: aVisitor [ + ^ aVisitor visitCoderMenuActionItem: self +] + { #category : #accessing } GtCoderMenuActionItem >> coderContextMenuAction [ diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 5e34de710..c5fb26e0a 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -142,7 +142,7 @@ GtTextualCoderEditorElement >> initialize [ self aptitude: BrGlamorousCodeEditorAptitude; "addAptitude: (BrGlamorousWithContextMenuAptitude content: [ self createContextMenuContent ]);" - addAptitude: (BrWithExplicitContextMenuAptitude menu: [ self createContextMenu ]); + addAptitude: (BrGlamorousWithExplicitContextMenuAptitude menu: [ self createContextMenu ]); padding: BlInsets empty; hMatchParent; vFitContent. diff --git a/src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st b/src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st index 8e7f838bb..fde06210d 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st @@ -8,6 +8,11 @@ Class { #category : #'GToolkit-Coder-UI-Menu' } +{ #category : #visiting } +GtTextualCoderMenu >> acceptVisitor: aVisitor [ + ^ aVisitor visitTextualCoderMenu: self +] + { #category : #'api - converting' } GtTextualCoderMenu >> asElement [ | aCoderViewModel aCoderElement | @@ -46,6 +51,11 @@ GtTextualCoderMenu >> coderViewModel: aCoderViewModel [ self coderViewModelStencil: [ aCoderViewModel ] asStencil ] +{ #category : #accessing } +GtTextualCoderMenu >> coderViewModelStencil [ + ^ coderViewModelStencil +] + { #category : #'api - initialization' } GtTextualCoderMenu >> coderViewModelStencil: aCoderViewModelStencil [ coderViewModelStencil := aCoderViewModelStencil asStencil diff --git a/src/GToolkit-Coder-UI/TBrMenuModelVisitor.extension.st b/src/GToolkit-Coder-UI/TBrMenuModelVisitor.extension.st new file mode 100644 index 000000000..6d0be95f1 --- /dev/null +++ b/src/GToolkit-Coder-UI/TBrMenuModelVisitor.extension.st @@ -0,0 +1,11 @@ +Extension { #name : #TBrMenuModelVisitor } + +{ #category : #'*GToolkit-Coder-UI' } +TBrMenuModelVisitor >> visitCoderMenuActionItem: aMenuModel [ + ^ self visitMenuActionItem: aMenuModel +] + +{ #category : #'*GToolkit-Coder-UI' } +TBrMenuModelVisitor >> visitTextualCoderMenu: aMenuModel [ + ^ self visitMenu: aMenuModel +] From c025230ad5b13e9ab54ea0d5e5f22ec5eba6c84c Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Sat, 25 Jan 2025 17:27:27 -0300 Subject: [PATCH 0843/1268] menu: add `BrGlamorousMenuPinnableAptitude` [feenkcom/gtoolkit#4180] Fix examples, remove unused code. --- ...BrGlamorousMenuElementBuilder.extension.st | 2 +- .../GtCoderMenuActionItem.class.st | 5 ---- .../GtTextualCoderMenu.class.st | 23 ------------------- 3 files changed, 1 insertion(+), 29 deletions(-) diff --git a/src/GToolkit-Coder-UI/BrGlamorousMenuElementBuilder.extension.st b/src/GToolkit-Coder-UI/BrGlamorousMenuElementBuilder.extension.st index 1e1e813e5..f21437072 100644 --- a/src/GToolkit-Coder-UI/BrGlamorousMenuElementBuilder.extension.st +++ b/src/GToolkit-Coder-UI/BrGlamorousMenuElementBuilder.extension.st @@ -12,7 +12,7 @@ BrGlamorousMenuElementBuilder >> visitTextualCoderMenu: aMenuModel [ hExact: 500; vFitContentLimited; background: aCoderElement theme default contentBackgroundColor; - addAptitude: (BrMenuPinnableAptitude new + addAptitude: (BrGlamorousMenuPinnableAptitude new menuModel: aMenuModel; withResizers; withAllPinActions); diff --git a/src/GToolkit-Coder-UI/GtCoderMenuActionItem.class.st b/src/GToolkit-Coder-UI/GtCoderMenuActionItem.class.st index 6ab0689d3..7d5dcc6dc 100644 --- a/src/GToolkit-Coder-UI/GtCoderMenuActionItem.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMenuActionItem.class.st @@ -29,11 +29,6 @@ GtCoderMenuActionItem >> coderContextMenuAction: aCoderContextMenuAction [ ifEmpty: [ self label: aCoderContextMenuAction title ] ] -{ #category : #'api - converting' } -GtCoderMenuActionItem >> elementType [ - ^ GtCoderMenuActionItemElement -] - { #category : #'as yet unclassified' } GtCoderMenuActionItem >> hoverAction [ ^ self coderContextMenuAction hoverAction diff --git a/src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st b/src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st index fde06210d..896881a39 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderMenu.class.st @@ -13,29 +13,6 @@ GtTextualCoderMenu >> acceptVisitor: aVisitor [ ^ aVisitor visitTextualCoderMenu: self ] -{ #category : #'api - converting' } -GtTextualCoderMenu >> asElement [ - | aCoderViewModel aCoderElement | - coderViewModelStencil ifNil: [ ^ nil ]. - aCoderViewModel := coderViewModelStencil create. - aCoderViewModel ifNil: [ ^ nil ]. - - aCoderElement := aCoderViewModel asExpandedOnlyElement. - aCoderElement - hExact: 500; - vFitContentLimited; - background: aCoderElement theme default contentBackgroundColor; - addAptitude: BrGlamorousFocusableShadowAptitude new; - addAptitude: (BrMenuPinnableAptitude new - menuModel: self; - withResizers; - withAllPinActions); - addAptitude: (BrMenuHideableAptitude new menuModel: self); - addAptitude: BrMenuCommonAptitude new. - - ^ aCoderElement -] - { #category : #'api - initialization' } GtTextualCoderMenu >> coder: aCoder [ self coderViewModelStencil: [ aCoder asCoderViewModel ] asStencil From d6d7a3c24c3bf6e7fe71b952429f448ddfa7b09c Mon Sep 17 00:00:00 2001 From: John Brant Date: Mon, 27 Jan 2025 06:52:33 -0600 Subject: [PATCH 0844/1268] [feenkcom/gtoolkit#4276] adding example to check slots index changed after class changed --- .../GtCoderNavigationPackagesTagsClassesElement.class.st | 1 + 1 file changed, 1 insertion(+) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index 17766605f..ffb59ba92 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -24,6 +24,7 @@ GtCoderNavigationPackagesTagsClassesElement >> buildCategorySlotTabs [ label: 'Categories' asRopedText glamorousCodeSmallSize; stencil: [ methodProtocolsList ]); addTab: (BrTab new + id: #slots; hMatchParent; aptitude: GtProtocolSlotTabAptitude new; label: 'Slots' asRopedText glamorousCodeSmallSize; From 264e0e6fcdeba40bb595e7a7f15eee4864a9a1a6 Mon Sep 17 00:00:00 2001 From: Vincent Blondeau Date: Wed, 29 Jan 2025 00:17:58 +0100 Subject: [PATCH 0845/1268] On parsing error, the textElement displaying the message should be focuseable to accept shortcuts --- src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st index 083928ca7..7045d2de2 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st @@ -49,9 +49,11 @@ GtSourceCoderErrorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditor textElement := BlTextElement new. textElement text: text. textElement padding: (BlInsets all: 10). + textElement beFocusable. textElement when: BlClickEvent do: [ :event | clickAction cull: anEditorElement cull: aptitude hide ]. + {BlKeyCombination escape. BlKeyCombination enter. BlKeyCombination backspace} From d30f34878935e056095b2b6c223ba0c54d24d9f1 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 30 Jan 2025 10:53:12 -0600 Subject: [PATCH 0846/1268] Refactor ExpandButton attributes --- src/GToolkit-Coder-UI/GtSourceCoderFoldNoiseShortcut.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderFoldNoiseShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderFoldNoiseShortcut.class.st index ee0c5ecbe..7f13cb8fb 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderFoldNoiseShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderFoldNoiseShortcut.class.st @@ -32,5 +32,5 @@ GtSourceCoderFoldNoiseShortcut >> performOnEditor: aBrTextEditor element: aBrEdi ifFound: [ :att | folding ifNil: [ folding := att isExpanded ]. att isExpanded: folding not. - att applyExpandedOrCollapsedAttributesOn: nil in: aBrTextEditor ] ] + att applyExpandedOrCollapsedAttributesOnText: aBrTextEditor text ] ] ] From 1dde70e58adcf8135fcff07a2acc5bfd2b2ead96 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Mon, 3 Feb 2025 12:45:58 -0600 Subject: [PATCH 0847/1268] Allow stylers to detect if there is a cursor in a given text range --- src/GToolkit-Coder/GtCoderAstStyler.class.st | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/GToolkit-Coder/GtCoderAstStyler.class.st b/src/GToolkit-Coder/GtCoderAstStyler.class.st index 5e702c9ed..230082ded 100644 --- a/src/GToolkit-Coder/GtCoderAstStyler.class.st +++ b/src/GToolkit-Coder/GtCoderAstStyler.class.st @@ -7,6 +7,12 @@ Class { #category : #'GToolkit-Coder-Styler/Highlighter' } +{ #category : #'as yet unclassified' } +GtCoderAstStyler >> anyCursorsInRange: textRange [ + ^ self coderViewModel cursors positions + noneSatisfy: [ :each | textRange includes: each ] +] + { #category : #'api - styling' } GtCoderAstStyler >> attribute: aTextAttribute from: aStart to: anEnd [ self attributes: { aTextAttribute } from: aStart to: anEnd From 3024e848828ecae974d5da056b29cb4431b58acb Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 5 Feb 2025 14:01:49 -0600 Subject: [PATCH 0848/1268] Refactor hiding styler to start to support highlighted searches. --- src/GToolkit-Coder/GtCoderAstStyler.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder/GtCoderAstStyler.class.st b/src/GToolkit-Coder/GtCoderAstStyler.class.st index 230082ded..1b6093f5b 100644 --- a/src/GToolkit-Coder/GtCoderAstStyler.class.st +++ b/src/GToolkit-Coder/GtCoderAstStyler.class.st @@ -10,7 +10,7 @@ Class { { #category : #'as yet unclassified' } GtCoderAstStyler >> anyCursorsInRange: textRange [ ^ self coderViewModel cursors positions - noneSatisfy: [ :each | textRange includes: each ] + anySatisfy: [ :each | textRange includes: each ] ] { #category : #'api - styling' } From d235a255d03405e5a4b40ccf660eed0cd309d6b9 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Wed, 26 Feb 2025 12:26:55 +0100 Subject: [PATCH 0849/1268] Remove deprecations sending `halt` [feenkcom/gtoolkit#4324] --- src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st b/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st index 3711725e0..3bf15ee7e 100644 --- a/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st +++ b/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st @@ -123,19 +123,6 @@ GtCoderCodeExecutor >> element: anElement [ element := anElement ] -{ #category : #'api - accessing' } -GtCoderCodeExecutor >> event [ - self flag: 'I should not keep events, but rather #element'. - self halt. - ^ nil -] - -{ #category : #'api - accessing' } -GtCoderCodeExecutor >> event: anObject [ - self halt. - self flag: 'I should not receive events, but rather #element:'. -] - { #category : #'api - execution' } GtCoderCodeExecutor >> execute [ ^ GtCoderExecutionContextVariable From 456c832fd04f10c61b8ff28daf3f5c7243303b20 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 27 Feb 2025 12:36:12 -0300 Subject: [PATCH 0850/1268] filter widgets: use `BrGlamorousWithExplicitDropdownAptitude` [feenkcom/gtoolkit#4180] --- .../GtFilterShortListSettingsElement.class.st | 34 +++++-------------- 1 file changed, 8 insertions(+), 26 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st index 639984bd4..5504ceab3 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st @@ -46,8 +46,6 @@ GtFilterShortListSettingsElement >> initialize [ handleElement := nil asWeakReference. listElement := nil asWeakReference. self initializeButtonElement. - self initializeDropdownAptitude. - buttonElement addAptitude: buttonAptitude. self addChild: buttonElement as: #button. self initializeEventHandlers. self initializeShortcuts. @@ -57,18 +55,14 @@ GtFilterShortListSettingsElement >> initialize [ GtFilterShortListSettingsElement >> initializeButtonElement [ buttonElement := self newButtonElement aptitude: BrGlamorousButtonWithIconAndLabelAptitude; - addAptitude: BrGlamorousButtonIconDropdownAptitude -] - -{ #category : #initialization } -GtFilterShortListSettingsElement >> initializeDropdownAptitude [ - buttonAptitude := BrGlamorousWithDropdownAptitude - handle: [ self newHandleElement ] - content: [ self newContentElement ]. - buttonAptitude beNotResizable. - buttonAptitude - when: BrDropdownIsHidden - do: [ :anEvent | self onDropdownIsHiddenEvent: anEvent ] + addAptitude: BrGlamorousButtonIconDropdownAptitude; + addAptitude: (BrGlamorousWithExplicitDropdownAptitude + handle: [ self newHandleElement ] + content: [ self newContentElement ] + do: [ :theAptitude | + theAptitude + when: BrDropdownIsHidden + do: [ :anEvent | self onDropdownIsHiddenEvent: anEvent ] ]) ] { #category : #initialization } @@ -332,18 +326,6 @@ GtFilterShortListSettingsElement >> updateHandleElement: anElement [ { #category : #'private - updating' } GtFilterShortListSettingsElement >> updateListElement [ - | aHeight aWidth anExtent | - aHeight := self filterViewModel items size. - aWidth := self filterViewModel items - inject: 3 - into: [ :aMax :each | - aMax > each labelSize - ifTrue: [ aMax ] - ifFalse: [ each labelSize ] ]. - anExtent := (aWidth * 12) @ (aHeight * 12). - - buttonAptitude preferredExtent: anExtent. - self listElementDo: [ :anElement | self updateListElement: anElement ] ] From c3361fc36a8bc7d03d8904e36f2858362d7ef9a6 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 27 Feb 2025 16:00:20 -0300 Subject: [PATCH 0851/1268] filter widgets: use new dropdown aptitude [feenkcom/gtoolkit#4180] --- src/GToolkit-Coder-UI/GtFilterStep.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtFilterStep.class.st b/src/GToolkit-Coder-UI/GtFilterStep.class.st index b69081102..75db8a99b 100644 --- a/src/GToolkit-Coder-UI/GtFilterStep.class.st +++ b/src/GToolkit-Coder-UI/GtFilterStep.class.st @@ -101,7 +101,7 @@ GtFilterStep >> clickOnDropdownFilterItem: aFilterItem [ label: ('Click on dropdown item: {1}' format: { aFilterItem }); referenceSender; onSpaceRoot; - // BrAnchoredOuterContainer; + onDropdown: true; // #scrollable; onChildFromBlock: [ :anElement | anElement children detect: [ :each | each viewModel model = aFilterItem ] ] ] From 257c71f613763d1bb628bdd91001d1f1152f2238 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 27 Feb 2025 18:09:44 -0300 Subject: [PATCH 0852/1268] filter widgets: compute items in a future process [feenkcom/gtoolkit#4327] --- .../GtFilterModelAllItem.class.st | 10 ++- .../GtFilterModelComputingItem.class.st | 22 ++++++ .../GtFilterModelExceptionItem.class.st | 78 +++++++++++++++++++ .../GtFilterModelItem.class.st | 7 +- .../GtFilterShortListSettingsElement.class.st | 23 ++++-- .../GtFilterShortListViewModel.class.st | 8 ++ .../TGtWithItemsSelector.trait.st | 8 ++ 7 files changed, 148 insertions(+), 8 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtFilterModelComputingItem.class.st create mode 100644 src/GToolkit-Coder-UI/GtFilterModelExceptionItem.class.st diff --git a/src/GToolkit-Coder-UI/GtFilterModelAllItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelAllItem.class.st index 044fc1ba1..2515907c2 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelAllItem.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelAllItem.class.st @@ -17,6 +17,11 @@ GtFilterModelAllItem class >> methodsLabel [ ^ self new label: 'All methods' ] +{ #category : #factory } +GtFilterModelAllItem class >> pragmasLabel [ + ^ self new label: 'All pragmas' +] + { #category : #accessing } GtFilterModelAllItem >> ifSome: aBlock ifNone: aNoneBlock [ ^ aNoneBlock value @@ -30,11 +35,12 @@ GtFilterModelAllItem >> initialize [ { #category : #accessing } GtFilterModelAllItem >> label [ - ^ 'All' + ^ label ] { #category : #factory } -GtFilterModelAllItem >> label: aString [ +GtFilterModelAllItem >> label: aString [ + label := aString ] { #category : #convenience } diff --git a/src/GToolkit-Coder-UI/GtFilterModelComputingItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelComputingItem.class.st new file mode 100644 index 000000000..6db5c409c --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModelComputingItem.class.st @@ -0,0 +1,22 @@ +Class { + #name : #GtFilterModelComputingItem, + #superclass : #GtFilterModelItem, + #traits : 'TGtUniqueInstance', + #classTraits : 'TGtUniqueInstance classTrait', + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #accessing } +GtFilterModelComputingItem >> ifSome: aBlock ifNone: aNoneBlock [ + ^ aNoneBlock value +] + +{ #category : #testing } +GtFilterModelComputingItem >> isVirtualFilterModelItem [ + ^ true +] + +{ #category : #accessing } +GtFilterModelComputingItem >> label [ + ^ 'computing...' +] diff --git a/src/GToolkit-Coder-UI/GtFilterModelExceptionItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelExceptionItem.class.st new file mode 100644 index 000000000..117151df8 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterModelExceptionItem.class.st @@ -0,0 +1,78 @@ +" +I am displayed if there is an exception while computing model items. +For intenal use only. I must not be used as an expected model item. +" +Class { + #name : #GtFilterModelExceptionItem, + #superclass : #GtFilterModelItem, + #instVars : [ + 'exception' + ], + #category : #'GToolkit-Coder-UI-Filters - Models' +} + +{ #category : #'instance creation' } +GtFilterModelExceptionItem class >> freeze: anException [ + ^ self new exception: (GtSystemUtility freeze: anException) +] + +{ #category : #accessing } +GtFilterModelExceptionItem >> exception [ + ^ exception +] + +{ #category : #accessing } +GtFilterModelExceptionItem >> exception: anObject [ + exception := anObject +] + +{ #category : #'gt - extensions' } +GtFilterModelExceptionItem >> gtExceptionMessageFor: aView [ + + exception ifNil: [ ^ aView empty ]. + + ^ aView forward + title: 'Exception message'; + object: [ exception ]; + view: #gtMessageTextFor: +] + +{ #category : #'gt - extensions' } +GtFilterModelExceptionItem >> gtExceptionStackFor: aView [ + + exception ifNil: [ ^ aView empty ]. + + ^ aView forward + title: 'Exception stack'; + object: [ exception ]; + view: #gtLiveFor: +] + +{ #category : #accessing } +GtFilterModelExceptionItem >> icon [ + ^ BrGlamorousVectorIcons debug +] + +{ #category : #accessing } +GtFilterModelExceptionItem >> ifSome: aBlock ifNone: aNoneBlock [ + "Exception item is not expected in any model. + We therefore treat it as an item without a value. + Widgets can treat it differently using #isExceptionFilterModelItem." + + ^ aNoneBlock value +] + +{ #category : #testing } +GtFilterModelExceptionItem >> isExceptionFilterModelItem [ + ^ true +] + +{ #category : #accessing } +GtFilterModelExceptionItem >> label [ + "Return item label or nil" + + + ^ self exception + ifNotNil: [ :anException | anException printStringLimitedTo: 30 ] + ifNil: [ 'exception' ] +] diff --git a/src/GToolkit-Coder-UI/GtFilterModelItem.class.st b/src/GToolkit-Coder-UI/GtFilterModelItem.class.st index 53d67c25e..aba2ba1df 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelItem.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelItem.class.st @@ -20,7 +20,7 @@ GtFilterModelItem >> asFilterModelItem [ { #category : #comparing } GtFilterModelItem >> hash [ - ^ self class hash bitXor: self label hash + ^ self label hash ] { #category : #accessing } @@ -68,6 +68,11 @@ GtFilterModelItem >> ifSome: aBlock ifNone: aNoneBlock [ ^ aBlock cull: self itemValue cull: self ] +{ #category : #testing } +GtFilterModelItem >> isExceptionFilterModelItem [ + ^ false +] + { #category : #testing } GtFilterModelItem >> isVirtualFilterModelItem [ ^ false diff --git a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st index 5504ceab3..ea25bb59f 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st @@ -61,6 +61,7 @@ GtFilterShortListSettingsElement >> initializeButtonElement [ content: [ self newContentElement ] do: [ :theAptitude | theAptitude + withContainerDownUpDropdown; when: BrDropdownIsHidden do: [ :anEvent | self onDropdownIsHiddenEvent: anEvent ] ]) ] @@ -119,6 +120,16 @@ GtFilterShortListSettingsElement >> newContentElement [ icon: self defaultItemIcon; id: nil; model: nil ]; + withAsyncFutureDo: [ :anElementFuture | + anElementFuture + whenPending: [ :theListElement | + theListElement items: { GtFilterModelComputingItem default } ]; + whenError: [ :theListElement :anError | + theListElement items: { (GtFilterModelExceptionItem freeze: anError) } ]; + whenSuccess: [ :theListElement :aCollection | + aCollection + ifEmpty: [ theListElement items: {GtFilterModelEmptyItem default} ] + ifNotEmpty: [ theListElement items: aCollection ] ] ]; when: BlElementAddedToSceneGraphEvent do: [ :anEvent | self onListElementAddedToSceneGraph: anEvent ]; addShortcut: (BlShortcutWithAction new @@ -331,18 +342,20 @@ GtFilterShortListSettingsElement >> updateListElement [ { #category : #'private - updating' } GtFilterShortListSettingsElement >> updateListElement: anElement [ - | aCollection | self hasFilterViewModel ifFalse: [ ^ self ]. - aCollection := self filterViewModel someItems. - aCollection - ifEmpty: [ anElement items: {GtFilterModelEmptyItem default} ] - ifNotEmpty: [ anElement items: aCollection ] + + anElement withAsyncFutureDo: [ :anElementFuture | + anElementFuture future: self filterViewModel someItemsFuture asAsyncFuture ]. ] { #category : #'private - updating' } GtFilterShortListSettingsElement >> updateSelectedItem: aFilterModelItem from: anElement [ aFilterModelItem ifNil: [ ^ self ]. aFilterModelItem isVirtualFilterModelItem ifTrue: [ ^ self ]. + aFilterModelItem isExceptionFilterModelItem ifTrue: [ + anElement phlow spawnObject: aFilterModelItem. + ^ self ]. + self hasFilterViewModel ifFalse: [ ^ self ]. aFilterModelItem = self filterViewModel selectedItem ifTrue: [ ^ self ]. BlTaskAction diff --git a/src/GToolkit-Coder-UI/GtFilterShortListViewModel.class.st b/src/GToolkit-Coder-UI/GtFilterShortListViewModel.class.st index 34542dd78..df565c598 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListViewModel.class.st @@ -14,3 +14,11 @@ GtFilterShortListViewModel >> someItems [ ^ self filterModel someItems ] + +{ #category : #accessing } +GtFilterShortListViewModel >> someItemsFuture [ + "Return an async future that computes list items" + + + ^ self filterModel someItemsFuture +] diff --git a/src/GToolkit-Coder-UI/TGtWithItemsSelector.trait.st b/src/GToolkit-Coder-UI/TGtWithItemsSelector.trait.st index a78ad221f..5963d02b4 100644 --- a/src/GToolkit-Coder-UI/TGtWithItemsSelector.trait.st +++ b/src/GToolkit-Coder-UI/TGtWithItemsSelector.trait.st @@ -41,3 +41,11 @@ TGtWithItemsSelector >> someItems [ ^ self itemsSelector items ] + +{ #category : #accessing } +TGtWithItemsSelector >> someItemsFuture [ + "Return an async future that computes list items" + + + ^ [ self someItems ] asAsyncFuture +] From 758d31ea6433418ee65fd7fa06e861ad34d87cfb Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 27 Feb 2025 18:46:22 -0300 Subject: [PATCH 0853/1268] filter widgets: use low priority to compute items [feenkcom/gtoolkit#4327] --- .../GtFilterShortListSettingsElement.class.st | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st index ea25bb59f..e1ed5c189 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st @@ -122,6 +122,9 @@ GtFilterShortListSettingsElement >> newContentElement [ model: nil ]; withAsyncFutureDo: [ :anElementFuture | anElementFuture + executionConfiguration: (AsyncFutureExecutionConfiguration new + customGroup: #CoderFilter; + lowPriority); whenPending: [ :theListElement | theListElement items: { GtFilterModelComputingItem default } ]; whenError: [ :theListElement :anError | From 8d66a132c852b36763288bfb318ca8ea12aef553 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 28 Feb 2025 12:34:22 -0300 Subject: [PATCH 0854/1268] filter widgets: add a UI blocking code for demo purposes [feenkcom/gtoolkit#4327] --- .../GtFilterShortListSettingsElement.class.st | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st index e1ed5c189..417d455c2 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st @@ -130,9 +130,7 @@ GtFilterShortListSettingsElement >> newContentElement [ whenError: [ :theListElement :anError | theListElement items: { (GtFilterModelExceptionItem freeze: anError) } ]; whenSuccess: [ :theListElement :aCollection | - aCollection - ifEmpty: [ theListElement items: {GtFilterModelEmptyItem default} ] - ifNotEmpty: [ theListElement items: aCollection ] ] ]; + self updateListElement: theListElement items: aCollection ] ]; when: BlElementAddedToSceneGraphEvent do: [ :anEvent | self onListElementAddedToSceneGraph: anEvent ]; addShortcut: (BlShortcutWithAction new @@ -351,6 +349,25 @@ GtFilterShortListSettingsElement >> updateListElement: anElement [ anElementFuture future: self filterViewModel someItemsFuture asAsyncFuture ]. ] +{ #category : #'private - updating' } +GtFilterShortListSettingsElement >> updateListElement: theListElement items: aCollection [ + aCollection + ifEmpty: [ theListElement items: {GtFilterModelEmptyItem default} ] + ifNotEmpty: [ theListElement items: aCollection ] +] + +{ #category : #'private - updating' } +GtFilterShortListSettingsElement >> updateListElementOldWay: anElement [ + "We use this method to demo a UI blocking issue. + See https://github.com/feenkcom/gtoolkit/issues/4327" + + | aCollection | + self hasFilterViewModel ifFalse: [ ^ self ]. + + aCollection := self filterViewModel someItems. + self updateListElement: anElement items: aCollection +] + { #category : #'private - updating' } GtFilterShortListSettingsElement >> updateSelectedItem: aFilterModelItem from: anElement [ aFilterModelItem ifNil: [ ^ self ]. From 1004e887aa0263ab16d1e954996e48c52ac16699 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 28 Feb 2025 14:11:31 -0300 Subject: [PATCH 0855/1268] spawn filter model method definitions on alt+click [feenkcom/gtoolkit#4329] --- .../GtFilterLabelElement.class.st | 8 +++- .../GtFilterMethodDefinitionSpawner.class.st | 47 +++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 src/GToolkit-Coder-UI/GtFilterMethodDefinitionSpawner.class.st diff --git a/src/GToolkit-Coder-UI/GtFilterLabelElement.class.st b/src/GToolkit-Coder-UI/GtFilterLabelElement.class.st index a30302902..d22043fab 100644 --- a/src/GToolkit-Coder-UI/GtFilterLabelElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterLabelElement.class.st @@ -92,7 +92,13 @@ GtFilterLabelElement >> initializeStyling [ { #category : #'event handling' } GtFilterLabelElement >> onClickEvent: anEvent [ anEvent consumed: true. - self requestFocus + anEvent modifiers isSoftAltOnly ifFalse: [ + self requestFocus. + ^ self ]. + + GtFilterMethodDefinitionSpawner new + filterElement: self; + spawn ] { #category : #'event handling' } diff --git a/src/GToolkit-Coder-UI/GtFilterMethodDefinitionSpawner.class.st b/src/GToolkit-Coder-UI/GtFilterMethodDefinitionSpawner.class.st new file mode 100644 index 000000000..35538a765 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtFilterMethodDefinitionSpawner.class.st @@ -0,0 +1,47 @@ +" +I find and spawn {{gtClass:GtFilterModel}} compiled method definitions. +" +Class { + #name : #GtFilterMethodDefinitionSpawner, + #superclass : #Object, + #instVars : [ + 'filterElement' + ], + #category : #'GToolkit-Coder-UI-Filters - Support' +} + +{ #category : #accessing } +GtFilterMethodDefinitionSpawner >> filterElement [ + ^ filterElement +] + +{ #category : #accessing } +GtFilterMethodDefinitionSpawner >> filterElement: anElement [ + filterElement := anElement +] + +{ #category : #'api - spawning' } +GtFilterMethodDefinitionSpawner >> methodDefinition [ + + | aSearchFilter aMethod aClass | + filterElement hasFilterViewModel ifFalse: [ ^ nil ]. + + aSearchFilter := filterElement filterViewModel filterModel asSearchFilter. + aSearchFilter ifNil: [ ^ nil ]. + + aClass := aSearchFilter class classSide. + aMethod := aClass lookupSelector: #filterDescriptor2For:. + (aMethod isNil + or: [ aMethod = (GtSearchFilter class >> #filterDescriptor2For:) ]) + ifTrue: [ aMethod := aClass lookupSelector: #globalFilterDescriptor2 ]. + + ^ aMethod +] + +{ #category : #'api - spawning' } +GtFilterMethodDefinitionSpawner >> spawn [ + filterElement ifNil: [ ^ self ]. + + self methodDefinition ifNotNil: [ :aMethod | + filterElement phlow spawnTool: (GtMethodCoderTool compiledMethod: aMethod) ]. +] From 03a03d4893130cb045efd02393b6b6440f769ecb Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 28 Feb 2025 14:47:15 -0300 Subject: [PATCH 0856/1268] filter widgets: return `TAsyncFuture` instances instead of computed items [feenkcom/gtoolkit#4327] --- .../GtFilterModelAllItemsSelector.class.st | 6 ++++++ .../GtFilterModelEmptyItemsBuilder.class.st | 5 +++++ .../GtFilterModelExplicitItemsBuilder.class.st | 5 +++++ .../GtFilterModelItemsBuilder.class.st | 8 ++++++++ .../GtFilterModelItemsSelector.class.st | 8 ++++++++ ...lterModelItemsWithoutSelectedItemSelector.class.st | 7 +++++++ .../GtFilterModelPluggableItemsBuilder.class.st | 11 +++++++++++ .../GtFilterModelValuableItemsBuilder.class.st | 5 +++++ src/GToolkit-Coder-UI/TGtWithItemsSelector.trait.st | 2 +- src/GToolkit-Coder-UI/TGtWithSelectableItem.trait.st | 8 ++++++++ 10 files changed, 64 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtFilterModelAllItemsSelector.class.st b/src/GToolkit-Coder-UI/GtFilterModelAllItemsSelector.class.st index be36da2aa..3787c87d5 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelAllItemsSelector.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelAllItemsSelector.class.st @@ -9,3 +9,9 @@ GtFilterModelAllItemsSelector >> items [ ^ self filterModel items ] + +{ #category : #accessing } +GtFilterModelAllItemsSelector >> itemsFuture [ + + ^ self filterModel itemsFuture +] diff --git a/src/GToolkit-Coder-UI/GtFilterModelEmptyItemsBuilder.class.st b/src/GToolkit-Coder-UI/GtFilterModelEmptyItemsBuilder.class.st index 6115c08a7..c1be359bb 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelEmptyItemsBuilder.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelEmptyItemsBuilder.class.st @@ -11,6 +11,11 @@ GtFilterModelEmptyItemsBuilder >> create [ ^ Array empty ] +{ #category : #'api - instantiation' } +GtFilterModelEmptyItemsBuilder >> createFuture [ + ^ Array empty asAsyncFuture +] + { #category : #accessing } GtFilterModelEmptyItemsBuilder >> firstItemDo: aBlock [ "do nothing" diff --git a/src/GToolkit-Coder-UI/GtFilterModelExplicitItemsBuilder.class.st b/src/GToolkit-Coder-UI/GtFilterModelExplicitItemsBuilder.class.st index 72812b456..fa057a308 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelExplicitItemsBuilder.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelExplicitItemsBuilder.class.st @@ -19,6 +19,11 @@ GtFilterModelExplicitItemsBuilder >> create [ ^ self items ifNil: [ Array empty ] ] +{ #category : #'api - instantiation' } +GtFilterModelExplicitItemsBuilder >> createFuture [ + ^ self create asAsyncFuture +] + { #category : #accessing } GtFilterModelExplicitItemsBuilder >> firstItemDo: aBlock [ self items ifEmpty: [ ^ self ]. diff --git a/src/GToolkit-Coder-UI/GtFilterModelItemsBuilder.class.st b/src/GToolkit-Coder-UI/GtFilterModelItemsBuilder.class.st index 2e69f145d..7c07343ba 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelItemsBuilder.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelItemsBuilder.class.st @@ -12,6 +12,14 @@ GtFilterModelItemsBuilder >> asFilterModelItemsBuilder [ { #category : #'api - instantiation' } GtFilterModelItemsBuilder >> create [ + self deprecated: 'Use #createFuture instead'. + + ^ self subclassResponsibility +] + +{ #category : #'api - instantiation' } +GtFilterModelItemsBuilder >> createFuture [ + ^ self subclassResponsibility ] diff --git a/src/GToolkit-Coder-UI/GtFilterModelItemsSelector.class.st b/src/GToolkit-Coder-UI/GtFilterModelItemsSelector.class.st index 80c82215a..1963acc14 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelItemsSelector.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelItemsSelector.class.st @@ -20,6 +20,14 @@ GtFilterModelItemsSelector >> filterModel: anObject [ { #category : #accessing } GtFilterModelItemsSelector >> items [ + self deprecated: 'Use #createFuture instead'. + + ^ self subclassResponsibility +] + +{ #category : #accessing } +GtFilterModelItemsSelector >> itemsFuture [ + ^ self subclassResponsibility ] diff --git a/src/GToolkit-Coder-UI/GtFilterModelItemsWithoutSelectedItemSelector.class.st b/src/GToolkit-Coder-UI/GtFilterModelItemsWithoutSelectedItemSelector.class.st index 230a6cc03..39ab71ea9 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelItemsWithoutSelectedItemSelector.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelItemsWithoutSelectedItemSelector.class.st @@ -9,3 +9,10 @@ GtFilterModelItemsWithoutSelectedItemSelector >> items [ ^ self filterModel items reject: [ :each | self selectedItem = each ] ] + +{ #category : #'as yet unclassified' } +GtFilterModelItemsWithoutSelectedItemSelector >> itemsFuture [ + + ^ self filterModel itemsFuture map: [ :anArray | + anArray reject: [ :each | self selectedItem = each ] ] +] diff --git a/src/GToolkit-Coder-UI/GtFilterModelPluggableItemsBuilder.class.st b/src/GToolkit-Coder-UI/GtFilterModelPluggableItemsBuilder.class.st index ca0b220b2..e9c0fd9c6 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelPluggableItemsBuilder.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelPluggableItemsBuilder.class.st @@ -20,6 +20,17 @@ GtFilterModelPluggableItemsBuilder >> create [ label: self labelStencilBuilder ] ] +{ #category : #'api - instantiation' } +GtFilterModelPluggableItemsBuilder >> createFuture [ + ^ self itemsBuilder createFuture + map: [ :anArray | + anArray collect: [ :eachItem | + GtFilterModelPluggableItem new + object: eachItem itemValue; + icon: self iconStencilBuilder; + label: self labelStencilBuilder ] ] +] + { #category : #accessing } GtFilterModelPluggableItemsBuilder >> iconStencilBuilder [ ^ iconStencilBuilder diff --git a/src/GToolkit-Coder-UI/GtFilterModelValuableItemsBuilder.class.st b/src/GToolkit-Coder-UI/GtFilterModelValuableItemsBuilder.class.st index 4300a1572..b17b166c5 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelValuableItemsBuilder.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelValuableItemsBuilder.class.st @@ -19,6 +19,11 @@ GtFilterModelValuableItemsBuilder >> create [ ^ self valuable value collect: #asFilterModelItem ] +{ #category : #'api - instantiation' } +GtFilterModelValuableItemsBuilder >> createFuture [ + ^ [ self create ] asAsyncFuture +] + { #category : #comparing } GtFilterModelValuableItemsBuilder >> hash [ ^ self class hash bitXor: self valuable hash diff --git a/src/GToolkit-Coder-UI/TGtWithItemsSelector.trait.st b/src/GToolkit-Coder-UI/TGtWithItemsSelector.trait.st index 5963d02b4..ee3251dc0 100644 --- a/src/GToolkit-Coder-UI/TGtWithItemsSelector.trait.st +++ b/src/GToolkit-Coder-UI/TGtWithItemsSelector.trait.st @@ -47,5 +47,5 @@ TGtWithItemsSelector >> someItemsFuture [ "Return an async future that computes list items" - ^ [ self someItems ] asAsyncFuture + ^ self itemsSelector itemsFuture asAsyncFuture ] diff --git a/src/GToolkit-Coder-UI/TGtWithSelectableItem.trait.st b/src/GToolkit-Coder-UI/TGtWithSelectableItem.trait.st index acd9cd05c..ec6ce0eb5 100644 --- a/src/GToolkit-Coder-UI/TGtWithSelectableItem.trait.st +++ b/src/GToolkit-Coder-UI/TGtWithSelectableItem.trait.st @@ -10,6 +10,8 @@ Trait { { #category : #accessing } TGtWithSelectableItem >> items [ + self deprecated: 'Use #itemsFuture instead'. + ^ itemsBuilder create ] @@ -67,6 +69,12 @@ TGtWithSelectableItem >> itemsBuilder: anObject [ self notifyItemsChanged ] +{ #category : #accessing } +TGtWithSelectableItem >> itemsFuture [ + + ^ itemsBuilder createFuture +] + { #category : #'private - notifying' } TGtWithSelectableItem >> notifyItemsChanged [ self explicitRequirement From d491035c0c7392d0d4cfa003a80586cd1b08cbd4 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 28 Feb 2025 15:30:28 -0300 Subject: [PATCH 0857/1268] filter widgets: flatten future results [feenkcom/gtoolkit#4327] --- .../GtFilterModelPluggableItemsBuilder.class.st | 2 +- .../GtFilterModelValuableItemsBuilder.class.st | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterModelPluggableItemsBuilder.class.st b/src/GToolkit-Coder-UI/GtFilterModelPluggableItemsBuilder.class.st index e9c0fd9c6..613771f73 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelPluggableItemsBuilder.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelPluggableItemsBuilder.class.st @@ -22,7 +22,7 @@ GtFilterModelPluggableItemsBuilder >> create [ { #category : #'api - instantiation' } GtFilterModelPluggableItemsBuilder >> createFuture [ - ^ self itemsBuilder createFuture + ^ self itemsBuilder createFuture flatten map: [ :anArray | anArray collect: [ :eachItem | GtFilterModelPluggableItem new diff --git a/src/GToolkit-Coder-UI/GtFilterModelValuableItemsBuilder.class.st b/src/GToolkit-Coder-UI/GtFilterModelValuableItemsBuilder.class.st index b17b166c5..04340a8cc 100644 --- a/src/GToolkit-Coder-UI/GtFilterModelValuableItemsBuilder.class.st +++ b/src/GToolkit-Coder-UI/GtFilterModelValuableItemsBuilder.class.st @@ -21,7 +21,8 @@ GtFilterModelValuableItemsBuilder >> create [ { #category : #'api - instantiation' } GtFilterModelValuableItemsBuilder >> createFuture [ - ^ [ self create ] asAsyncFuture + ^ self valuable asAsyncFuture flatten + map: [ :anArray | anArray collect: #asFilterModelItem ] ] { #category : #comparing } From 3d1df2757676c1529ca5857c51db02420acd3156 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 28 Feb 2025 20:43:20 -0300 Subject: [PATCH 0858/1268] filter widgets: toggle element uses `#itemsFuture` [feenkcom/gtoolkit#4327] fix examples --- .../GtFilterModelExamples.class.st | 8 ++-- .../GtFilterSelectableItemViewModel.class.st | 10 ++--- src/GToolkit-Coder-UI/GtFilterStep.class.st | 6 +-- .../GtFilterToggleSettingsElement.class.st | 38 +++++++++++++++---- 4 files changed, 40 insertions(+), 22 deletions(-) diff --git a/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st b/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st index 136fcfdce..9a7be997f 100644 --- a/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st @@ -320,7 +320,7 @@ GtFilterModelExamples >> shortListModel [ aModel selectedItem: 'class'. aModel name: 'Side'. self - assert: aModel items + assert: aModel itemsFuture wait equals: ({'instance'. 'class'} collect: #asFilterModelItem). self assert: aModel selectedItem equals: 'class' asFilterModelItem. @@ -356,7 +356,7 @@ GtFilterModelExamples >> shortListModelParameter [ aFilter includeWriters: true ] } ]; selectFirstItem; displayAllItems. - self assert: aModel items size equals: 3. + self assert: aModel itemsFuture wait size equals: 3. ^ aModel ] @@ -503,7 +503,7 @@ GtFilterModelExamples >> shortListModelWithIcons [ aModel selectFirstItem. aModel name: 'Classes'. self - assert: aModel items + assert: aModel itemsFuture wait equals: {GtFilterModelClassItem new itemClass: Array. GtFilterModelClassItem new itemClass: OrderedCollection. GtFilterModelClassItem new itemClass: TGtAnnouncer. @@ -540,7 +540,7 @@ GtFilterModelExamples >> shortListModelWithParameter_changeParameterValue [ to: aCollection. aParameter := aModel parameters first. - aParameter selectedItem: aParameter items second. + aParameter selectedItem: aParameter itemsFuture wait second. self assert: aCollection size equals: 1. anAnnouncement := aCollection first. self assert: anAnnouncement class equals: GtFilterModelParameterUpdated. diff --git a/src/GToolkit-Coder-UI/GtFilterSelectableItemViewModel.class.st b/src/GToolkit-Coder-UI/GtFilterSelectableItemViewModel.class.st index 202160afb..bea937acb 100644 --- a/src/GToolkit-Coder-UI/GtFilterSelectableItemViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtFilterSelectableItemViewModel.class.st @@ -6,19 +6,15 @@ Class { #category : #'GToolkit-Coder-UI-Filters - View Models' } -{ #category : #accessing } -GtFilterSelectableItemViewModel >> items [ - ^ self filterModel items -] - { #category : #accessing } GtFilterSelectableItemViewModel >> items: aCollection [ self filterModel items: aCollection ] { #category : #accessing } -GtFilterSelectableItemViewModel >> itemsCount [ - ^ self filterModel items size +GtFilterSelectableItemViewModel >> itemsFuture [ + + ^ self filterModel itemsFuture ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtFilterStep.class.st b/src/GToolkit-Coder-UI/GtFilterStep.class.st index 75db8a99b..6099ee8bc 100644 --- a/src/GToolkit-Coder-UI/GtFilterStep.class.st +++ b/src/GToolkit-Coder-UI/GtFilterStep.class.st @@ -13,7 +13,7 @@ GtFilterStep >> assertFilterModelAtIndex: anIndex itemsCountIs: anItemsCount [ 'item' asPluralBasedOn: anItemsCount}); referenceSender; onParentStepTarget: self; - value: [ :aFilterItemsElement | (aFilterItemsElement filtersViewModel items at: anIndex) items size ] + value: [ :aFilterItemsElement | (aFilterItemsElement filtersViewModel items at: anIndex) itemsFuture wait size ] equals: anItemsCount ] @@ -27,14 +27,14 @@ GtFilterStep >> assertFilterModelAtIndex: anIndex itemsCountIsAtLeast: anItemsCo referenceSender; onParentStepTarget: self; satisfies: [ :aFilterItemsElement | - (aFilterItemsElement filtersViewModel items at: anIndex) items size + (aFilterItemsElement filtersViewModel items at: anIndex) itemsFuture wait size >= anItemsCount ] description: [ :aFilterItemsElement | 'Filter at position {1} must have at least {2} {3}, but have {4}' format: {anIndex. anItemsCount. 'item' asPluralBasedOn: anItemsCount. - (aFilterItemsElement filtersViewModel items at: anIndex) items size} ] + (aFilterItemsElement filtersViewModel items at: anIndex) itemsFuture wait size} ] ] { #category : #'steps - checks' } diff --git a/src/GToolkit-Coder-UI/GtFilterToggleSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterToggleSettingsElement.class.st index 58e7b63c2..90dc608e7 100644 --- a/src/GToolkit-Coder-UI/GtFilterToggleSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterToggleSettingsElement.class.st @@ -34,7 +34,22 @@ GtFilterToggleSettingsElement >> initializeToggleGroupElement [ toggleGroupElement := BrToggleGroup new aptitude: GtFilterToggleGroupAptitude new; when: BrToggleActivatedEvent - do: [ :anEvent | self onToggleActivatedEvent: anEvent ] + do: [ :anEvent | self onToggleActivatedEvent: anEvent ]; + withAsyncFutureDo: [ :anElementFuture | + anElementFuture + executionConfiguration: (AsyncFutureExecutionConfiguration new + customGroup: #CoderFilter; + lowPriority); + whenPending: [ :theToggleGroup | + self + updateToggleElement: theToggleGroup + items: { GtFilterModelComputingItem default } ]; + whenError: [ :theToggleGroup :anError | + self + updateToggleElement: theToggleGroup + items: { GtFilterModelExceptionItem freeze: anError } ]; + whenSuccess: [ :theToggleGroup :aCollection | + self updateToggleElement: theToggleGroup items: aCollection ] ] ] { #category : #'private - updating' } @@ -213,13 +228,20 @@ GtFilterToggleSettingsElement >> updateElement [ self updateToggles ] +{ #category : #initialization } +GtFilterToggleSettingsElement >> updateToggleElement: aToggleGroup items: aCollection [ + aToggleGroup removeToggles. + + aCollection doWithIndex: [ :eachItem :anIndex | + | aToggle | + aToggle := self newToggleForItem: eachItem index: anIndex. + aToggleGroup addToggle: aToggle ] +] + { #category : #'private - updating' } GtFilterToggleSettingsElement >> updateToggles [ - toggleGroupElement removeToggles. - - self filterViewModel items - doWithIndex: [ :eachItem :anIndex | - | aToggle | - aToggle := self newToggleForItem: eachItem index: anIndex. - toggleGroupElement addToggle: aToggle ] + self hasFilterViewModel ifFalse: [ ^ self ]. + + toggleGroupElement withAsyncFutureDo: [ :anElementFuture | + anElementFuture future: self filterViewModel itemsFuture asAsyncFuture ]. ] From 397d77d7d0337a97fb8ca2acccd47cb5cc21b4f3 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Sat, 1 Mar 2025 08:45:50 -0300 Subject: [PATCH 0859/1268] menu: fix class comment [feenkcom/gtoolkit#4180] --- src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st index 3672396f4..744448e7d 100644 --- a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st +++ b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st @@ -1,7 +1,7 @@ " I represent a Coder context menu. #Examples -The following example shows a case during which a context menu height does not fit and a scrollbar is displayed: {{gtExample:GtPharoCoderByScripterExamples>>#displayPharoMethodContextMenuExtentIn800x330Space | previewExpanded=true | codeExpanded=false | previewHeight=500}} +The following example shows a case during which a context menu height does not fit and a scrollbar is displayed: {{gtExample:GtPharoCoderByScripterExamples>>#displayPharoMethodContextMenuExtentIn800x345Space | previewExpanded=true | codeExpanded=false | previewHeight=500}} " Class { From c21dc1c687ea87ee9d9fc56dbc59e47598986384 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Sun, 2 Mar 2025 16:34:14 -0300 Subject: [PATCH 0860/1268] filter widget: stop future computation on filter removal [feenkcom/gtoolkit#4327] --- .../GtFilterShortListSettingsElement.class.st | 32 ++++++++++++++++++- .../GtFiltersItemsViewModel.class.st | 8 +++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st index 417d455c2..3daa4be34 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st @@ -81,6 +81,15 @@ GtFilterShortListSettingsElement >> initializeShortcuts [ action: [ :anEvent | self onDisplayItemsEvent: anEvent ]) ] +{ #category : #'event handling' } +GtFilterShortListSettingsElement >> interruptListElementFuture [ + self listElementDo: [ :anElement | + anElement withAsyncFutureDo: [ :anElementFuture | + anElementFuture + cancelHard; + interrupt ] ] +] + { #category : #accessing } GtFilterShortListSettingsElement >> listElementDo: aBlock [ (listElement at: 1) ifNotNil: aBlock @@ -151,6 +160,14 @@ GtFilterShortListSettingsElement >> newContentElement [ combination: BlKeyCombination builder primary end build; action: [ self selectLast; scrollToSelection ] )". + + aListElement finalizationRegistry + add: aListElement + finalizer: (ObjectFinalizer new + receiver: self; + selector: #onListElementFinalization; + arguments: #()). + self updateListElement: aListElement. listElement at: 1 put: aListElement. ^ aListElement @@ -212,6 +229,11 @@ GtFilterShortListSettingsElement >> onFilterViewModelChanged [ self updateElement ] +{ #category : #'event handling' } +GtFilterShortListSettingsElement >> onFiltersViewModelItemRemoved: anAnnouncement [ + BlTaskAction enqueueElement: self action: [ self interruptListElementFuture ] +] + { #category : #'event handling' } GtFilterShortListSettingsElement >> onItemClick: aButton [ self hasFilterViewModel ifFalse: [ ^ self ]. @@ -243,6 +265,11 @@ GtFilterShortListSettingsElement >> onListElementAddedToSceneGraph: anEvent [ self focusFirstItemElementInList: anEvent currentTarget ] +{ #category : #'event handling' } +GtFilterShortListSettingsElement >> onListElementFinalization [ + self interruptListElementFuture +] + { #category : #'event handling' } GtFilterShortListSettingsElement >> onPickSelectedItemEvent: aShortcutEvent [ | anElementList | @@ -299,7 +326,10 @@ GtFilterShortListSettingsElement >> subscribeToFilterViewModel [ to: self; when: GtFilterViewModelSelectedItemChanged send: #onSelectedItemChanged: - to: self + to: self; + when: GtFiltersViewModelItemRemoved + send: #onFiltersViewModelItemRemoved: + to: self. ] { #category : #'private - updating' } diff --git a/src/GToolkit-Coder-UI/GtFiltersItemsViewModel.class.st b/src/GToolkit-Coder-UI/GtFiltersItemsViewModel.class.st index d1a28a7cd..c0cd4f46d 100644 --- a/src/GToolkit-Coder-UI/GtFiltersItemsViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtFiltersItemsViewModel.class.st @@ -21,6 +21,10 @@ GtFiltersItemsViewModel >> onItemAdded: anAnnouncement [ | aViewModel | aViewModel := self ensureFilterViewModelFor: anAnnouncement item. self + announce: (GtFiltersViewModelItemAdded new + viewModel: self; + item: aViewModel). + aViewModel announce: (GtFiltersViewModelItemAdded new viewModel: self; item: aViewModel) @@ -32,6 +36,10 @@ GtFiltersItemsViewModel >> onItemRemoved: anAnnouncement [ aViewModel := self removeOldFilterViewModelFor: anAnnouncement item. aViewModel ifNil: [ ^ self ]. self + announce: (GtFiltersViewModelItemRemoved new + viewModel: self; + item: aViewModel). + aViewModel announce: (GtFiltersViewModelItemRemoved new viewModel: self; item: aViewModel) From 4830cf8eb6c673c0aa407b44fdabd0b03ed24ff0 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Sun, 2 Mar 2025 16:38:15 -0300 Subject: [PATCH 0861/1268] filter widget: stop future computation on filter removal [feenkcom/gtoolkit#4327] --- .../GtFilterShortListSettingsElement.class.st | 2 +- .../GtFilterToggleSettingsElement.class.st | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st index 3daa4be34..5cc4c62ce 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st @@ -231,7 +231,7 @@ GtFilterShortListSettingsElement >> onFilterViewModelChanged [ { #category : #'event handling' } GtFilterShortListSettingsElement >> onFiltersViewModelItemRemoved: anAnnouncement [ - BlTaskAction enqueueElement: self action: [ self interruptListElementFuture ] + self interruptListElementFuture ] { #category : #'event handling' } diff --git a/src/GToolkit-Coder-UI/GtFilterToggleSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterToggleSettingsElement.class.st index 90dc608e7..5aeba72e0 100644 --- a/src/GToolkit-Coder-UI/GtFilterToggleSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterToggleSettingsElement.class.st @@ -52,6 +52,14 @@ GtFilterToggleSettingsElement >> initializeToggleGroupElement [ self updateToggleElement: theToggleGroup items: aCollection ] ] ] +{ #category : #'event handling' } +GtFilterToggleSettingsElement >> interruptToggleGroupFuture [ + toggleGroupElement withAsyncFutureDo: [ :anElementFuture | + anElementFuture + cancelHard; + interrupt ] +] + { #category : #'private - updating' } GtFilterToggleSettingsElement >> newAptitudeForItem: anItem [ | anAptitude | @@ -102,6 +110,11 @@ GtFilterToggleSettingsElement >> onFilterViewModelChanged [ self updateElement ] +{ #category : #'event handling' } +GtFilterToggleSettingsElement >> onFiltersViewModelItemRemoved: anAnnouncement [ + BlTaskAction enqueueElement: self action: [ self interruptToggleGroupFuture ] +] + { #category : #'event handling' } GtFilterToggleSettingsElement >> onFocusFirstPartWish: anEvent [ anEvent consumed: true. @@ -208,7 +221,10 @@ GtFilterToggleSettingsElement >> subscribeToFilterViewModel [ to: self; when: GtFilterViewModelSelectedItemChanged send: #onSelectedItemChanged: - to: self + to: self; + when: GtFiltersViewModelItemRemoved + send: #onFiltersViewModelItemRemoved: + to: self. ] { #category : #'private - updating' } From ac36d47b946d746d9efaff7f775f6c92ddf96870 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 4 Mar 2025 09:05:02 -0600 Subject: [PATCH 0862/1268] Make folded text retain folded status between styling. [[feenkcom/gtoolkit#4337]] --- .../GtTextualCoderViewModel.class.st | 37 ++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 519dd70f7..8536c98ec 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -16,7 +16,8 @@ Class { 'shouldHaveHeader', 'isTextModifiedPromise', 'completionStrategy', - 'debuggerInSpace' + 'debuggerInSpace', + 'nodeAttributeMap' ], #category : #'GToolkit-Coder-UI-Coder - Textual Model' } @@ -114,6 +115,11 @@ GtTextualCoderViewModel >> addTextAttributes: aCollectionOfTextAttributes onText ^ newCoderTextAttributes ] +{ #category : #'api - styling' } +GtTextualCoderViewModel >> allSavedAttributes [ + ^ self nodeAttributeMap values +] + { #category : #'api - text' } GtTextualCoderViewModel >> applyTextEditCommand: aTextEditCommand [ self announce: (GtTextualCoderViewModelTextEditCommandRequestAnnouncement new @@ -480,21 +486,22 @@ GtTextualCoderViewModel >> headerElementClass [ { #category : #initialization } GtTextualCoderViewModel >> initialize [ super initialize. - + extraAddOns := GtTextualCoderAddOns new. stylers := #(). shortcuts := #(). mainActions := #(). contextActions := #(). contextMenuActions := #(). - + cursors := BrTextEditorMultipleCursor new. selection := BlCompositeSelection new. extraTextAttributes := OrderedCollection new. - + hasFocus := false. expanded := true. - shouldHaveHeader := true + shouldHaveHeader := true. + self resetNodeAttributeMap ] { #category : #'api - text' } @@ -555,6 +562,16 @@ GtTextualCoderViewModel >> newCompletionStrategy [ ^ GtCompletionStrategy new ] +{ #category : #accessing } +GtTextualCoderViewModel >> nodeAttributeMap [ + ^ nodeAttributeMap +] + +{ #category : #accessing } +GtTextualCoderViewModel >> nodeAttributeMap: anObject [ + nodeAttributeMap := anObject +] + { #category : #'private - notifying' } GtTextualCoderViewModel >> notifyCursorsChanged: aBrTextEditorCursor from: aSourceObject [ self announce: (GtTextualCoderViewModelCursorsChanged new @@ -691,6 +708,16 @@ GtTextualCoderViewModel >> removeStylersOfClass: aGtCoderStylerClass [ extraAddOns removeStylersOfClass: aGtCoderStylerClass ] +{ #category : #'as yet unclassified' } +GtTextualCoderViewModel >> resetNodeAttributeMap [ + nodeAttributeMap := Dictionary new +] + +{ #category : #'as yet unclassified' } +GtTextualCoderViewModel >> saveAttribute: folder forNode: aNode [ + self nodeAttributeMap at: aNode put: folder +] + { #category : #'api - selection' } GtTextualCoderViewModel >> select: aFromCursorIndex to: aToCursorIndex [ self selection: (self selection copy select: aFromCursorIndex to: aToCursorIndex) From dd2449c9f20eb9a234d6d299676e511df090040d Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 4 Mar 2025 16:50:39 -0600 Subject: [PATCH 0863/1268] Categorize methods [[feenkcom/gtoolkit#4337]] --- src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 8536c98ec..7a229840b 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -708,12 +708,12 @@ GtTextualCoderViewModel >> removeStylersOfClass: aGtCoderStylerClass [ extraAddOns removeStylersOfClass: aGtCoderStylerClass ] -{ #category : #'as yet unclassified' } +{ #category : #'api - attribute state' } GtTextualCoderViewModel >> resetNodeAttributeMap [ nodeAttributeMap := Dictionary new ] -{ #category : #'as yet unclassified' } +{ #category : #'api - attribute state' } GtTextualCoderViewModel >> saveAttribute: folder forNode: aNode [ self nodeAttributeMap at: aNode put: folder ] From a1a23a5a1d4438fc34d99bd698b6d936cc7a55e8 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 5 Mar 2025 10:10:33 -0300 Subject: [PATCH 0864/1268] menu: use new dropdown aptitude [feenkcom/gtoolkit#4180] --- .../GtFixItAttribute.class.st | 2 +- .../GtCoderActionsElement.class.st | 2 +- .../GtCoderPrintStringAttribute.class.st | 2 +- ...tCoderProtocolsGroupHeaderElement.class.st | 2 +- .../GtFilterItemsElement.class.st | 5 ++--- .../GtFilterTagElement.class.st | 4 ++-- .../GtPreviewChangeButton.class.st | 2 +- .../GtSourceCoderErrorAttribute.class.st | 22 +++++++++---------- 8 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st index dbd7bcd26..220af8695 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st @@ -69,7 +69,7 @@ GtFixItAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ button beTinySize. button label: (label ifNil: [ 'Fix it' ]). - dropDownAptitude := BrGlamorousWithDropdownAptitude + dropDownAptitude := BrGlamorousWithExplicitDropdownAptitude handle: [ | dropdownButton | dropdownButton := BrButton new. diff --git a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st index 33ba34162..13cb60589 100644 --- a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st @@ -146,7 +146,7 @@ GtCoderActionsElement >> newDropButtonForAction: aGtCoderAction [ ^ button beTinySize; aptitude: BrGlamorousButtonWithIconAptitude + - (BrGlamorousWithDropdownAptitude + (BrGlamorousWithExplicitDropdownAptitude handle: [ | aButton | aButton := BrButton new. aGtCoderAction title diff --git a/src/GToolkit-Coder-UI/GtCoderPrintStringAttribute.class.st b/src/GToolkit-Coder-UI/GtCoderPrintStringAttribute.class.st index 13d6900c4..0a515c6d2 100644 --- a/src/GToolkit-Coder-UI/GtCoderPrintStringAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPrintStringAttribute.class.st @@ -138,7 +138,7 @@ GtCoderPrintStringAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditor when: BlElementRemovedFromParentEvent do: [ :anEvent | anEditorElement requestFocus ]; addChild: (hamburgerButton := BrButton new - aptitude: self actionButtonLook + (BrGlamorousWithDropdownAptitude + aptitude: self actionButtonLook + (BrGlamorousWithExplicitDropdownAptitude handle: [ BrButton new aptitude: BrGlamorousButtonIconAptitude + BrGlamorousButtonLayoutAptitude; icon: BrGlamorousVectorIcons hamburger; diff --git a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupHeaderElement.class.st b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupHeaderElement.class.st index e4686f8f9..5460172f3 100644 --- a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupHeaderElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupHeaderElement.class.st @@ -41,7 +41,7 @@ GtCoderProtocolsGroupHeaderElement >> createAddProtocolButton [ aptitude: (BrGlamorousButtonRectangularAptitude paddingScale: 0) + BrGlamorousButtonIconAptitude; icon: BrGlamorousVectorIcons add ] asStencil. - aPopUp := BrGlamorousWithDropdownAptitude + aPopUp := BrGlamorousWithExplicitDropdownAptitude handle: aButtonStencil content: [ :aButton | self createNewProtocolForm ]. diff --git a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st index ea887352b..d3f62a4db 100644 --- a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st @@ -251,10 +251,9 @@ GtFilterItemsElement >> newAddFilterButton [ aStyle background: self theme status neutralBackgroundColor darker darker ]; focused: [ :aStyle | aStyle border: (BlBorder paint: self theme editor focusedBorderColor width: 1) ]); - addAptitude: (BrGlamorousWithDropdownAptitude + addAptitude: (BrGlamorousWithExplicitDropdownAptitude handle: [ self newAddFilterHandleElement ] - content: [ self createDropdownContent ]) - beNotResizable; + content: [ self createDropdownContent ]); margin: (BlInsets left: 2); constraintsDo: [ :c | c flow vertical alignCenter ]; beFocusable; diff --git a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st index a3dbb19d3..65751d02d 100644 --- a/src/GToolkit-Coder-UI/GtFilterTagElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTagElement.class.st @@ -66,7 +66,7 @@ GtFilterTagElement >> createAndAddCompletionValuesDropdown [ self addChild: (self createFilterLabel id: GtFilterTagLabelId; text: aDefaultValue; - addAptitude: (BrGlamorousWithDropdownAptitude + addAptitude: (BrGlamorousWithExplicitDropdownAptitude handle: [ BrHorizontalPane new fitContent; @@ -211,7 +211,7 @@ GtFilterTagElement >> createFilterLabel [ GtFilterTagElement >> createFilterLabelHandle [ ^ self createFilterLabel id: GtFilterTagLabelId; - addAptitude: (BrGlamorousWithDropdownAptitude + addAptitude: (BrGlamorousWithExplicitDropdownAptitude handle: [ BrHorizontalPane new fitContent; diff --git a/src/GToolkit-Coder-UI/GtPreviewChangeButton.class.st b/src/GToolkit-Coder-UI/GtPreviewChangeButton.class.st index f3e755ec1..6327f45d2 100644 --- a/src/GToolkit-Coder-UI/GtPreviewChangeButton.class.st +++ b/src/GToolkit-Coder-UI/GtPreviewChangeButton.class.st @@ -64,7 +64,7 @@ GtPreviewChangeButton >> initialize [ self beTinySize. self aptitude: BrGlamorousButtonWithIconAptitude new + - (BrGlamorousWithDropdownAptitude + (BrGlamorousWithExplicitDropdownAptitude handle: [ BrButton new icon: BrGlamorousIcons empty; diff --git a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st index 7045d2de2..668e1f792 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st @@ -34,7 +34,7 @@ GtSourceCoderErrorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditor button := self errorButton. button id: GtSourceCoderErrorButtonElementId. button - addAptitude: (aptitude := BrGlamorousWithDropdownAptitude + addAptitude: (aptitude := BrGlamorousWithExplicitDropdownAptitude handle: [ self errorButton ] content: [ | textElement pane | pane := BrVerticalPane new. @@ -52,7 +52,9 @@ GtSourceCoderErrorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditor textElement beFocusable. textElement when: BlClickEvent - do: [ :event | clickAction cull: anEditorElement cull: aptitude hide ]. + do: [ :event | + event currentTarget fireEvent: BrDropdownHideWish new. + clickAction cull: anEditorElement cull: aptitude ]. {BlKeyCombination escape. BlKeyCombination enter. @@ -63,23 +65,19 @@ GtSourceCoderErrorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditor combination: each; repeatable: false; action: [ :element | - aptitude hide. + element fireEvent: BrDropdownHideWish new. anEditorElement requestFocus ]) ]. textElement enqueueTask: [ textElement requestFocus ] asBlTask. pane addChild: textElement ]. pane ] - aptitudeDo: [ :look | - look - allActorsDepthFirstDo: [ :each | - (each isKindOf: BrGlamorousAnchoredAptitude) - ifTrue: [ each - addChangeProperty: #(widget border) - with: [ BlBorder paint: BrGlamorousColors errorBackgroundColor asBlPaint width: 1 ] ] ]. - look background: BrGlamorousColors errorBackgroundColor ]). + containerDo: [ :aMenuContainer | + aMenuContainer + border: (BlBorder paint: BrGlamorousColors errorBackgroundColor); + background: BrGlamorousColors errorBackgroundColor ]). openOnFirstShow ifTrue: [ button enqueueTask: [ openOnFirstShow := false. - aptitude show ] asBlTask ]. + button dispatchEvent: BrDropdownShowWish new ] asBlTask ]. ^ button ] From 03ede85d631475471fba8bb00abe1cd37183b7c5 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 5 Mar 2025 12:00:27 -0300 Subject: [PATCH 0865/1268] menu: fix examples [feenkcom/gtoolkit#4180] --- src/GToolkit-Coder-UI/GtFilterStep.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtFilterStep.class.st b/src/GToolkit-Coder-UI/GtFilterStep.class.st index 6099ee8bc..63423edbb 100644 --- a/src/GToolkit-Coder-UI/GtFilterStep.class.st +++ b/src/GToolkit-Coder-UI/GtFilterStep.class.st @@ -122,7 +122,7 @@ GtFilterStep >> clickOnDropdownFilterItemLabeled: aLabel [ label: ('Click on dropdown item with label {1}' format: {aLabel}); referenceSender; onSpaceRoot; - // BrAnchoredOuterContainer; + onDropdown: true; // #scrollable; onChildFromBlock: [ :anElement | anElement children detect: [ :each | each children last text asString = aLabel ] ] ] From aa5296ff69c6181ed2bec6cf77fceb9f750d3e86 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Wed, 5 Mar 2025 16:04:42 +0100 Subject: [PATCH 0866/1268] add telemetry to textual coder addons and stylers --- .../GtTextualCoderViewModel.class.st | 7 +++++++ .../GtCoderAstCompositeStyler.class.st | 9 +++++++- src/GToolkit-Coder/GtCoderAstStyler.class.st | 21 +++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 519dd70f7..02a8a581d 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -245,9 +245,14 @@ GtTextualCoderViewModel >> computeAddOnsFuture [ theAst ifNotNil: [ pragmas reverseDo: [ :eachPragma | [ + + BlFrameTelemetry telemetryComputationStartSignal: eachPragma. + aCoderModel perform: eachPragma methodSelector withEnoughArguments: { theAst . newAddOns . self }. + + BlFrameTelemetry telemetryComputationEndSignal: eachPragma. GtCoderAddOnCreatedSignal new coderViewModel: self; @@ -256,6 +261,8 @@ GtTextualCoderViewModel >> computeAddOnsFuture [ emit. ] on: Error do: [ :anError | + BlFrameTelemetry telemetryComputationEndSignal: eachPragma. + "emit as a beacon signal" anError emit. diff --git a/src/GToolkit-Coder/GtCoderAstCompositeStyler.class.st b/src/GToolkit-Coder/GtCoderAstCompositeStyler.class.st index 9ef068d9c..366fee24f 100644 --- a/src/GToolkit-Coder/GtCoderAstCompositeStyler.class.st +++ b/src/GToolkit-Coder/GtCoderAstCompositeStyler.class.st @@ -19,11 +19,18 @@ GtCoderAstCompositeStyler >> extraStyle: aText ast: theAst [ GtCoderAstCompositeStyler >> style: aText ast: theAst [ self stylers do: [ :eachStyler | [ + GtCoderAstStyler telemetryComputationStartSignal: eachStyler. + BlTextStylerTelemetry time: [ 'Style using ', eachStyler class name ] - during: [ eachStyler style: aText ast: theAst ] ] + during: [ eachStyler style: aText ast: theAst ]. + + GtCoderAstStyler telemetryComputationEndSignal: eachStyler. + ] on: Error do: [ :anError | + GtCoderAstStyler telemetryComputationEndSignal: eachStyler. + BlTextStylerTelemetry time: [ 'Handle an error in ', eachStyler class name ] during: [ diff --git a/src/GToolkit-Coder/GtCoderAstStyler.class.st b/src/GToolkit-Coder/GtCoderAstStyler.class.st index 1b6093f5b..fe57fd020 100644 --- a/src/GToolkit-Coder/GtCoderAstStyler.class.st +++ b/src/GToolkit-Coder/GtCoderAstStyler.class.st @@ -7,6 +7,27 @@ Class { #category : #'GToolkit-Coder-Styler/Highlighter' } +{ #category : #'as yet unclassified' } +GtCoderAstStyler class >> primitiveTelemetryComputationSignal: isStart object: anObject process: aProcess [ + +] + +{ #category : #'as yet unclassified' } +GtCoderAstStyler class >> telemetryComputationEndSignal: anObject [ + self + primitiveTelemetryComputationSignal: false + object: anObject + process: Processor activeProcess +] + +{ #category : #'as yet unclassified' } +GtCoderAstStyler class >> telemetryComputationStartSignal: anObject [ + self + primitiveTelemetryComputationSignal: true + object: anObject + process: Processor activeProcess +] + { #category : #'as yet unclassified' } GtCoderAstStyler >> anyCursorsInRange: textRange [ ^ self coderViewModel cursors positions From 9208bc4f47529aab470e5bbd1efeacc30c7ab101 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 5 Mar 2025 13:33:17 -0600 Subject: [PATCH 0867/1268] Remove unused methods --- src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st | 5 ----- src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st | 5 ----- 2 files changed, 10 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st index 8cd58059e..26bf982b7 100644 --- a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st @@ -157,11 +157,6 @@ GtSingleCoderViewModel >> codersUIModel: anObject [ codersUIModel := anObject ] -{ #category : #'private - addons' } -GtSingleCoderViewModel >> computeAddOns [ - self subclassResponsibility -] - { #category : #'private - addons' } GtSingleCoderViewModel >> computeAddOnsFuture [ diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 7a229840b..7ab04ce94 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -217,11 +217,6 @@ GtTextualCoderViewModel >> compositeStyler [ yourself ] -{ #category : #'api - add-ons' } -GtTextualCoderViewModel >> computeAddOns [ - ^ self addOnsFuture await -] - { #category : #'api - add-ons' } GtTextualCoderViewModel >> computeAddOnsFuture [ "Return a future that will be resolved to coder addons" From b1bdb21bf7d250886a1c8e2780ad81f09cd47bd0 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 6 Mar 2025 14:05:10 -0300 Subject: [PATCH 0868/1268] menu: use new context menu aptitude [feenkcom/gtoolkit#4180] --- .../GtCoderClassesTreeElement.class.st | 8 ++++---- .../GtCoderMethodsGroupedListElement.class.st | 5 ++--- .../GtCoderPackagesTreeElement.class.st | 5 ++--- .../GtCoderProtocolsGroupedListElement.class.st | 11 +++++------ .../GtCoderSlotsGroupedListElement.class.st | 5 ++--- src/GToolkit-Coder-UI/GtCreationForm.class.st | 2 +- 6 files changed, 16 insertions(+), 20 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index 3eca613a7..282030da0 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -208,10 +208,10 @@ GtCoderClassesTreeElement >> createLabel: aString description: description [ GtCoderClassesTreeElement >> createNodeElement [ ^ GtCoderClassesTreeItemElement new addEventHandler: self createClassDropHandler; - addAptitude: (BrGlamorousWithContextMenuAptitude - content: [ :aWidget | - GtCoderNavigationContextMenuContent new - items: (self contextMenuItemsFor: aWidget theClass) ]) + in: [ :aWidget | + aWidget addAptitude: (BrGlamorousWithExplicitContextMenuAptitude + itemsWithAnchorActions: [ (self contextMenuItemsFor: aWidget theClass) ]) ]; + yourself. ] { #category : #initialization } diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index e1f69c96d..ac69c7eb6 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -44,9 +44,8 @@ GtCoderMethodsGroupedListElement >> buildMethodItem [ vFitContent; beSmallSize; aptitude: BrGlamorousLabelAptitude + BrGlamorousListItemAptitude - + (BrGlamorousWithContextMenuAptitude - content: [ GtCoderNavigationContextMenuContent new - items: (self methodListContextMenuItemsFor: (aLabel userData at: #method)) ]). + + (BrGlamorousWithExplicitContextMenuAptitude + itemsWithAnchorActions: [ (self methodListContextMenuItemsFor: (aLabel userData at: #method)) ]). aLabel addEventHandler: self createMethodDragHandler. diff --git a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st index acdb1e7de..c42046bc6 100644 --- a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st @@ -124,9 +124,8 @@ GtCoderPackagesTreeElement >> initialize [ anItemElement hMatchParent; vFitContent; - addAptitude: (BrGlamorousWithContextMenuAptitude - content: [ GtCoderNavigationContextMenuContent new - items: (self contextMenuItemsFor: anItemElement packageOrTag) ]) ] ]; + addAptitude: (BrGlamorousWithExplicitContextMenuAptitude + itemsWithAnchorActions: [ (self contextMenuItemsFor: anItemElement packageOrTag) ]) ] ]; nodeDataBinder: [ :aPackageElement :aPackage | aPackageElement id asSymbol = #'coder--package-rename' ifTrue: [ aPackageElement removeChildren. diff --git a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st index c1862028a..99b50da36 100644 --- a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st @@ -93,7 +93,8 @@ GtCoderProtocolsGroupedListElement >> createProtocolGroups [ GtCoderProtocolsGroupedListElement >> createProtocolLabelElement [ "An element that represents a protocol within a list of protocols" - | aLabelAptitude | + | aLabel aLabelAptitude | + aLabel := BrLabel new. aLabelAptitude := BrGlamorousLabelAptitude new padding: (BlInsets @@ -102,12 +103,10 @@ GtCoderProtocolsGroupedListElement >> createProtocolLabelElement [ left: 1 right: 1); add: BrGlamorousListItemAptitude; - add: (BrGlamorousWithContextMenuAptitude - content: [ :aWidget | - GtCoderNavigationContextMenuContent new - items: (self createProtocolListContextMenuItemsFor: (aWidget userData at: #protocol)) ]). + add: (BrGlamorousWithExplicitContextMenuAptitude + itemsWithAnchorActions: [ (self createProtocolListContextMenuItemsFor: (aLabel userData at: #protocol)) ]). - ^ BrLabel new + ^ aLabel hMatchParent; vFitContent; beSmallSize; diff --git a/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st index 19394572b..41044250b 100644 --- a/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st @@ -52,9 +52,8 @@ GtCoderSlotsGroupedListElement >> createSlotGroups [ label text: slotText. label - addAptitude: (BrGlamorousWithContextMenuAptitude - content: [ GtCoderNavigationContextMenuContent new - items: (self slotListContextMenuItemsFor: item) ]). + addAptitude: (BrGlamorousWithExplicitContextMenuAptitude + itemsWithAnchorActions: [ (self slotListContextMenuItemsFor: item) ]). element addChild: label ]; shouldShowWithoutItems: false. classSlotGroup := instanceGroup copy domainObject: 'class-side slots'. diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index 0ea2d23eb..16ac035ba 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -214,7 +214,7 @@ GtCreationForm >> taggerStencilWithCompletion: aCompletionStrategy andContextMen ifNotNil: [ (GtCompletionController on: aLabel strategy: aCompletionStrategy) install ]. aContextMenuBlock ifNotNil: [ aLabel - addAptitude: (BrGlamorousWithContextMenuAptitude + addAptitude: (BrGlamorousWithExplicitContextMenuAptitude content: [ aContextMenuBlock value: aTag name value: aLabel From f1486ea00ad77d7c398b9ceb67de1c53c88618a7 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 6 Mar 2025 19:41:18 -0300 Subject: [PATCH 0869/1268] menu: fix `GtCoderNavigationContextMenuContent>>#menuItemStencil` [feenkcom/gtoolkit#4180] --- .../GtCoderNavigationContextMenuContent.class.st | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationContextMenuContent.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationContextMenuContent.class.st index 2b1bc4d95..64d8a85d8 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationContextMenuContent.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationContextMenuContent.class.st @@ -15,8 +15,10 @@ GtCoderNavigationContextMenuContent >> menuItemStencil [ padding: self itemPadding; when: BlClickEvent do: [ e value cull: self anchor. - self anchor - dispatchEvent: (BrContextMenuHideWish new + self fireEvent: (BrContextMenuHideWish new + anchor: self anchor; + yourself). + self fireEvent: (BrDropdownHideWish new anchor: self anchor; yourself) ]; addChild: (self itemLabelFor: e key); From 4134d128a66627634f919eb22970ce2968efece7 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 7 Mar 2025 18:51:48 -0300 Subject: [PATCH 0870/1268] menu: add support for menu item icons [feenkcom/gtoolkit#4180] --- src/GToolkit-Coder-UI/BrMenuElementBuilder.extension.st | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 src/GToolkit-Coder-UI/BrMenuElementBuilder.extension.st diff --git a/src/GToolkit-Coder-UI/BrMenuElementBuilder.extension.st b/src/GToolkit-Coder-UI/BrMenuElementBuilder.extension.st deleted file mode 100644 index 091b5813c..000000000 --- a/src/GToolkit-Coder-UI/BrMenuElementBuilder.extension.st +++ /dev/null @@ -1,6 +0,0 @@ -Extension { #name : #BrMenuElementBuilder } - -{ #category : #'*GToolkit-Coder-UI' } -BrMenuElementBuilder >> visitCoderMenuActionItem: aMenuModel [ - ^ GtCoderMenuActionItemElement new menuModel: aMenuModel -] From 44f7bd652f6039c1e609f4ccaf697ab17aab3958 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Mon, 10 Mar 2025 13:08:14 -0500 Subject: [PATCH 0871/1268] Make snippet text editor fitContentLimited to avoid failures when containing large amounts (> 500 lines) of text. [[feenkcom/gtoolkit#4349]] --- src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index c5fb26e0a..74d67ec1f 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -145,7 +145,7 @@ GtTextualCoderEditorElement >> initialize [ addAptitude: (BrGlamorousWithExplicitContextMenuAptitude menu: [ self createContextMenu ]); padding: BlInsets empty; hMatchParent; - vFitContent. + vFitContentLimited. self id: GtSourceCoderEditorId. From 564a6e75bf416866c2a7ee0cc5ab8fce0720b3cb Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 12 Mar 2025 09:38:44 -0300 Subject: [PATCH 0872/1268] menu: add coder dropdown action API [feenkcom/gtoolkit#4180] Add: - `GtCoderAddOns>>#addDropDownAction:icon:menu:` - `GtCoderAddOns>>#addDropDownAction:icon:items:` - `GtCoderAddOns>>#addDropDownAction:icon:content:` --- .../GtCoderActionsElement.class.st | 132 ++++++++++++------ .../GtCoderDropDownMenuAction.extension.st | 6 + src/GToolkit-Coder/GtCoderAction.class.st | 6 + src/GToolkit-Coder/GtCoderAddOns.class.st | 41 +++++- .../GtCoderDropDownAction.class.st | 3 + .../GtCoderDropDownMenuAction.class.st | 40 ++++++ 6 files changed, 179 insertions(+), 49 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderDropDownMenuAction.extension.st create mode 100644 src/GToolkit-Coder/GtCoderDropDownMenuAction.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st index 13cb60589..630496e37 100644 --- a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st @@ -103,6 +103,35 @@ GtCoderActionsElement >> newButtonForAction: aGtCoderAction [ ^ button ] +{ #category : #'instance creation' } +GtCoderActionsElement >> newDropButtonDefaultMenuForAction: aGtCoderAction [ + | titleElement containerElement classCompleter | + containerElement := BlElement new + layout: BlLinearLayout vertical; + constraintsDo: [ :c | + c horizontal exact: 200. + c vertical fitContent ]. + titleElement := BrEditorElement new + aptitude: BrGlamorousInputFieldSpacingAptitude; + editor: (BrTextEditorModel new text: '' asRopedText); + requestFocus; + constraintsDo: [ :c | + c margin: (BlInsets top: 1). + c horizontal matchParent. + c vertical fitContent ]. + classCompleter := GtCompletionController + on: titleElement + strategy: GtCoderClassWithPackageCompletionStrategy new. + classCompleter install. + classCompleter announcer + when: GtCompleterCompletionAccepted + do: [ :event | + aGtCoderAction action value: titleElement editor text asString asClass. + titleElement fireEvent: BrDropdownHideWish new ]. + containerElement addChild: titleElement. + ^ containerElement +] + { #category : #'instance creation' } GtCoderActionsElement >> newDropButtonForAction: aGtCoderAction [ @@ -111,57 +140,68 @@ GtCoderActionsElement >> newDropButtonForAction: aGtCoderAction [ aGtCoderAction title ifNotNil: [ button label: aGtCoderAction title asRopedText ]. - aGtCoderAction icon - ifNotNil: [ button icon: aGtCoderAction icon asElement ]. - + aGtCoderAction icon ifNotNil: [ button icon: aGtCoderAction icon asElement ]. + aContentStencil := aGtCoderAction stencil - ifNil: [ | classCompleter containerElement titleElement | - containerElement := BlElement new - layout: BlLinearLayout vertical; - constraintsDo: [ :c | - c horizontal exact: 200. - c vertical fitContent ]. - titleElement := BrEditorElement new - aptitude: BrGlamorousInputFieldSpacingAptitude; - editor: (BrTextEditorModel new text: '' asRopedText); - requestFocus; - constraintsDo: [ :c | - c margin: (BlInsets top: 1). - c horizontal matchParent. - c vertical fitContent ]. - classCompleter := GtCompletionController - on: titleElement - strategy: GtCoderClassWithPackageCompletionStrategy new. - classCompleter install. - classCompleter announcer - when: GtCompleterCompletionAccepted - do: [ :event | - aGtCoderAction action value: titleElement editor text asString asClass. - titleElement fireEvent: BrDropdownHideWish new ]. - containerElement addChild: titleElement. - containerElement ]. + ifNil: [ self newDropButtonDefaultMenuForAction: aGtCoderAction ]. + + self initializeAltClick: aGtCoderAction element: button. + + ^ button + beTinySize; + aptitude: BrGlamorousButtonWithIconAptitude + + (BrGlamorousWithExplicitDropdownAptitude + handle: [ | aButton | + aButton := BrButton new. + aGtCoderAction title + ifNotNil: [ aButton label: aGtCoderAction title asRopedText ]. + aGtCoderAction icon + ifNotNil: [ aButton icon: aGtCoderAction icon asElement ]. + aButton + beSmallSize; + aptitude: BrGlamorousButtonWithIconAptitude - BrGlamorousButtonWithLabelTooltipAptitude + - BrGlamorousButtonExteriorAptitude; + padding: BlInsets empty; + margin: BlInsets empty; + yourself ] + content: aContentStencil); + yourself +] + +{ #category : #'instance creation' } +GtCoderActionsElement >> newDropButtonMenuForAction: aGtCoderAction [ + + | button aMenuStencil | + button := BrButton new. + + aGtCoderAction title + ifNotNil: [ button label: aGtCoderAction title asRopedText ]. + aGtCoderAction icon ifNotNil: [ button icon: aGtCoderAction icon asElement ]. + + aMenuStencil := aGtCoderAction menuStencil + ifNil: [ [ BrMenuExplicit new + stencil: [ self newDropButtonDefaultMenuForAction: aGtCoderAction ] ] ]. self initializeAltClick: aGtCoderAction element: button. - + ^ button beTinySize; - aptitude: BrGlamorousButtonWithIconAptitude + - (BrGlamorousWithExplicitDropdownAptitude - handle: [ | aButton | - aButton := BrButton new. - aGtCoderAction title - ifNotNil: [ aButton label: aGtCoderAction title asRopedText ]. - aGtCoderAction icon - ifNotNil: [ aButton icon: aGtCoderAction icon asElement ]. - aButton - beSmallSize; - aptitude: - BrGlamorousButtonWithIconAptitude - BrGlamorousButtonWithLabelTooltipAptitude - - BrGlamorousButtonExteriorAptitude; - padding: BlInsets empty; - margin: BlInsets empty; - yourself ] - content: aContentStencil); + aptitude: BrGlamorousButtonWithIconAptitude + + (BrGlamorousWithExplicitDropdownAptitude + handle: [ | aButton | + aButton := BrButton new. + aGtCoderAction title + ifNotNil: [ aButton label: aGtCoderAction title asRopedText ]. + aGtCoderAction icon + ifNotNil: [ aButton icon: aGtCoderAction icon asElement ]. + aButton + beSmallSize; + aptitude: BrGlamorousButtonWithIconAptitude - BrGlamorousButtonWithLabelTooltipAptitude + - BrGlamorousButtonExteriorAptitude; + padding: BlInsets empty; + margin: BlInsets empty; + yourself ] + menu: aMenuStencil); yourself ] diff --git a/src/GToolkit-Coder-UI/GtCoderDropDownMenuAction.extension.st b/src/GToolkit-Coder-UI/GtCoderDropDownMenuAction.extension.st new file mode 100644 index 000000000..d499d904f --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderDropDownMenuAction.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #GtCoderDropDownMenuAction } + +{ #category : #'*GToolkit-Coder-UI' } +GtCoderDropDownMenuAction >> buildElementIn: aCoderActionsElement [ + ^ aCoderActionsElement newDropButtonMenuForAction: self +] diff --git a/src/GToolkit-Coder/GtCoderAction.class.st b/src/GToolkit-Coder/GtCoderAction.class.st index 6aab335fd..eec202f92 100644 --- a/src/GToolkit-Coder/GtCoderAction.class.st +++ b/src/GToolkit-Coder/GtCoderAction.class.st @@ -47,6 +47,12 @@ GtCoderAction >> actionDefinition [ ifNil: [ GtCoderActionNoDefinition default ] ] ] +{ #category : #accessing } +GtCoderAction >> actionDefinitionFromBlock: aBlock [ + aBlock isClosure ifFalse: [ ^ self ]. + actionDefinition := GtCoderActionClosureDefinition new closure: aBlock +] + { #category : #testing } GtCoderAction >> allowAltClick [ ^ (allowAltClick ifNil: [ true ]) and: [ self actionDefinition isDefined ] diff --git a/src/GToolkit-Coder/GtCoderAddOns.class.st b/src/GToolkit-Coder/GtCoderAddOns.class.st index 1f7bb941b..079443118 100644 --- a/src/GToolkit-Coder/GtCoderAddOns.class.st +++ b/src/GToolkit-Coder/GtCoderAddOns.class.st @@ -256,12 +256,47 @@ GtCoderAddOns >> addContextMenuItem: aString hover: hoverBlock leave: leaveBlock ] { #category : #'api - main actions' } -GtCoderAddOns >> addDropDownAction: aString icon: anIcon stencil: aBlock [ +GtCoderAddOns >> addDropDownAction: aString icon: anIcon content: aBlock [ | newAction | - newAction := GtCoderDropDownAction new + newAction := GtCoderDropDownMenuAction new title: aString; icon: anIcon; - stencil: aBlock. + content: aBlock. + mainActions add: newAction. + ^ newAction +] + +{ #category : #'api - main actions' } +GtCoderAddOns >> addDropDownAction: aString icon: anIcon items: aBlock [ + | newAction | + newAction := GtCoderDropDownMenuAction new + title: aString; + icon: anIcon; + items: aBlock. + mainActions add: newAction. + ^ newAction +] + +{ #category : #'api - main actions' } +GtCoderAddOns >> addDropDownAction: aString icon: anIcon menu: aBlock [ + | newAction | + newAction := GtCoderDropDownMenuAction new + title: aString; + icon: anIcon; + menu: aBlock. + mainActions add: newAction. + ^ newAction +] + +{ #category : #'api - main actions' } +GtCoderAddOns >> addDropDownAction: aString icon: anIcon stencil: aBlock [ + "Use #GtCoderAddOns>>#addDropDownAction:icon:content: instead." + + | newAction | + newAction := GtCoderDropDownAction new + title: aString; + icon: anIcon; + stencil: aBlock. mainActions add: newAction. ^ newAction ] diff --git a/src/GToolkit-Coder/GtCoderDropDownAction.class.st b/src/GToolkit-Coder/GtCoderDropDownAction.class.st index bd65486c1..b4c9399f5 100644 --- a/src/GToolkit-Coder/GtCoderDropDownAction.class.st +++ b/src/GToolkit-Coder/GtCoderDropDownAction.class.st @@ -1,3 +1,6 @@ +" +Use {{gtClass:GtCoderDropDownMenuAction}} instead. +" Class { #name : #GtCoderDropDownAction, #superclass : #GtCoderAction, diff --git a/src/GToolkit-Coder/GtCoderDropDownMenuAction.class.st b/src/GToolkit-Coder/GtCoderDropDownMenuAction.class.st new file mode 100644 index 000000000..b96302f9d --- /dev/null +++ b/src/GToolkit-Coder/GtCoderDropDownMenuAction.class.st @@ -0,0 +1,40 @@ +Class { + #name : #GtCoderDropDownMenuAction, + #superclass : #GtCoderAction, + #instVars : [ + 'menuStencil' + ], + #category : #'GToolkit-Coder-Coders - Addons' +} + +{ #category : #initialization } +GtCoderDropDownMenuAction >> computeActionDefinition [ + self menuStencil isClosure + ifTrue: [ ^ GtCoderActionClosureDefinition new closure: self menuStencil ]. + ^ nil +] + +{ #category : #accessing } +GtCoderDropDownMenuAction >> content: aBlock [ + self actionDefinitionFromBlock: aBlock. + self menu: [ BrMenuExplicit new stencil: aBlock ] +] + +{ #category : #accessing } +GtCoderDropDownMenuAction >> items: aBlock [ + self actionDefinitionFromBlock: aBlock. + self + menu: [ BrMenuItems new + in: [ :theMenuItems | aBlock cull: theMenuItems ]; + yourself ] +] + +{ #category : #accessing } +GtCoderDropDownMenuAction >> menu: aBlockOrStencil [ + menuStencil := aBlockOrStencil +] + +{ #category : #accessing } +GtCoderDropDownMenuAction >> menuStencil [ + ^ menuStencil +] From 52060a1d2e7d2f2ae97a29b1bb79d35df6b12e5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Thu, 13 Mar 2025 14:26:39 +0100 Subject: [PATCH 0873/1268] Set a custom name to the composite tool defined in GtSearchFilter [feenkcom/gtoolkit#4336] --- .../GtSearchFilter.extension.st | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-SearchFilters-PhlowTool/GtSearchFilter.extension.st b/src/GToolkit-SearchFilters-PhlowTool/GtSearchFilter.extension.st index 58860851c..876ac2e34 100644 --- a/src/GToolkit-SearchFilters-PhlowTool/GtSearchFilter.extension.st +++ b/src/GToolkit-SearchFilters-PhlowTool/GtSearchFilter.extension.st @@ -4,5 +4,6 @@ Extension { #name : #GtSearchFilter } GtSearchFilter >> gtDefaultInspectorTool [ ^ GtPhlowCompositeTool new addTool: (GtPhlowSearchFilterTool forSearchFilter: self); - addTool: (super gtDefaultInspectorTool) + addTool: (super gtDefaultInspectorTool); + name: 'Filter: ', self gtDisplayString ] From 48896e275dee787c12b47083b2ef37efec607a71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Thu, 13 Mar 2025 22:16:17 +0100 Subject: [PATCH 0874/1268] Add local versions view to RGMethodDefinition [feenkcom/gtoolkit#4354] --- .../RGMethodDefinition.extension.st | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/GToolkit-Coder-Extensions/RGMethodDefinition.extension.st diff --git a/src/GToolkit-Coder-Extensions/RGMethodDefinition.extension.st b/src/GToolkit-Coder-Extensions/RGMethodDefinition.extension.st new file mode 100644 index 000000000..40847604d --- /dev/null +++ b/src/GToolkit-Coder-Extensions/RGMethodDefinition.extension.st @@ -0,0 +1,14 @@ +Extension { #name : #RGMethodDefinition } + +{ #category : #'*GToolkit-Coder-Extensions' } +RGMethodDefinition >> gtLocalVersionsFor: aView [ + + + self isDefined ifFalse: [ ^aView empty]. + + ^aView forward + title: 'Local versions'; + object: [ self compiledMethod ]; + priority: 10; + view: #gtLocalVersionsFor: +] From c230d1ae416fd4dc3ec50bcda9f36f817a88a9ed Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 17 Mar 2025 14:49:38 -0300 Subject: [PATCH 0875/1268] menu: fix dragging menu error due to missing menu container [feenkcom/gtoolkit#4359] --- .../BrGlamorousMenuElementBuilder.extension.st | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/GToolkit-Coder-UI/BrGlamorousMenuElementBuilder.extension.st b/src/GToolkit-Coder-UI/BrGlamorousMenuElementBuilder.extension.st index f21437072..d04a4fad5 100644 --- a/src/GToolkit-Coder-UI/BrGlamorousMenuElementBuilder.extension.st +++ b/src/GToolkit-Coder-UI/BrGlamorousMenuElementBuilder.extension.st @@ -18,6 +18,9 @@ BrGlamorousMenuElementBuilder >> visitTextualCoderMenu: aMenuModel [ withAllPinActions); addAptitude: (BrMenuHideableAptitude new menuModel: aMenuModel); addAptitude: BrMenuCommonAptitude new. + + aMenuModel id ifNotNil: [ :anId | + aCoderElement id: anId ]. ^ aCoderElement ] From e13e13e4eac6e16eaa14e5c804c5bdd9065fb20a Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 20 Mar 2025 08:58:42 -0500 Subject: [PATCH 0876/1268] Make hiding stylers work with multiple stylers. --- .../GtTextualCoderViewModel.class.st | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 50b790caf..11d4773cb 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -116,8 +116,8 @@ GtTextualCoderViewModel >> addTextAttributes: aCollectionOfTextAttributes onText ] { #category : #'api - styling' } -GtTextualCoderViewModel >> allSavedAttributes [ - ^ self nodeAttributeMap values +GtTextualCoderViewModel >> allSavedAttributesForStyler: aStyler [ + ^ (self nodeAttributeMapForStyler: aStyler) values ] { #category : #'api - text' } @@ -503,7 +503,7 @@ GtTextualCoderViewModel >> initialize [ hasFocus := false. expanded := true. shouldHaveHeader := true. - self resetNodeAttributeMap + nodeAttributeMap := Dictionary new ] { #category : #'api - text' } @@ -565,13 +565,8 @@ GtTextualCoderViewModel >> newCompletionStrategy [ ] { #category : #accessing } -GtTextualCoderViewModel >> nodeAttributeMap [ - ^ nodeAttributeMap -] - -{ #category : #accessing } -GtTextualCoderViewModel >> nodeAttributeMap: anObject [ - nodeAttributeMap := anObject +GtTextualCoderViewModel >> nodeAttributeMapForStyler: aStyler [ + ^ nodeAttributeMap at: aStyler class ifAbsentPut: [Dictionary new] ] { #category : #'private - notifying' } @@ -711,13 +706,13 @@ GtTextualCoderViewModel >> removeStylersOfClass: aGtCoderStylerClass [ ] { #category : #'api - attribute state' } -GtTextualCoderViewModel >> resetNodeAttributeMap [ - nodeAttributeMap := Dictionary new +GtTextualCoderViewModel >> resetNodeAttributeMapForStyler: aStyler [ + nodeAttributeMap at: aStyler class put: Dictionary new ] { #category : #'api - attribute state' } -GtTextualCoderViewModel >> saveAttribute: folder forNode: aNode [ - self nodeAttributeMap at: aNode put: folder +GtTextualCoderViewModel >> saveAttribute: folder forNode: aNode andStyler: aStyler [ + (self nodeAttributeMapForStyler: aStyler) at: aNode put: folder ] { #category : #'api - selection' } From 0bb7062422fb4051c69c37a6410b03ad408c50dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Thu, 20 Mar 2025 15:22:47 +0100 Subject: [PATCH 0877/1268] Add a utility method for iterating methods in a package without creating a set [feenkcom/gtoolkit#4369] --- src/GToolkit-Coder-Extensions/RPackage.extension.st | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/GToolkit-Coder-Extensions/RPackage.extension.st b/src/GToolkit-Coder-Extensions/RPackage.extension.st index 643cd9054..ec6d5740b 100644 --- a/src/GToolkit-Coder-Extensions/RPackage.extension.st +++ b/src/GToolkit-Coder-Extensions/RPackage.extension.st @@ -56,6 +56,14 @@ RPackage >> gtDefinedClassesFor: aView context: aPhlowContext [ stencil: [ aPhlowContext packageCoder classesCoder asElement ] ] +{ #category : #'*GToolkit-Coder-Extensions' } +RPackage >> gtDefinedClassesWithPossibleDuplicatesDo: aBlock [ + classes do: [:each | + Smalltalk globals + at: each + ifPresent: [:aClass| aBlock value: aClass ]]. +] + { #category : #'*GToolkit-Coder-Extensions' } RPackage >> gtDefinedTagsFor: aView context: aPhlowContext [ From 48ce83610119e4095953527d552a6d0441996979 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 20 Mar 2025 14:17:01 -0300 Subject: [PATCH 0878/1268] menu: `Behavior>>#gtHierarchyButtonFor:` passes explicit menu model [feenkcom/gtoolkit#4180] --- src/GToolkit-Coder-UI/Behavior.extension.st | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/Behavior.extension.st b/src/GToolkit-Coder-UI/Behavior.extension.st index fe7939dff..3533cc10c 100644 --- a/src/GToolkit-Coder-UI/Behavior.extension.st +++ b/src/GToolkit-Coder-UI/Behavior.extension.st @@ -31,7 +31,7 @@ Behavior >> gtHierarchyButtonFor: anAction [ id: GtCoderClassHierarchyButtonId; priority: 3; preferredExtentFrom: GtPharoCoderHierarchyDropdownConfiguration; - content: [ :aButton | + content: [ :aButton :aTargetElement :anExplicitMenu | | aNavigationModel | aNavigationModel := aButton phlow firstParentCoderNavigationModel. BlElement new @@ -39,5 +39,8 @@ Behavior >> gtHierarchyButtonFor: anAction [ addChild: ((GtCoderNavigationTabsStencil new pragmaName: #gtCoderDropdownNavigation; navigationModel: aNavigationModel; - asElement) background: Color white) ] + asElement) background: Color white); + addAptitude: (BrGlamorousMenuPinnableAptitude new + withAllPinActions; + menuModel: anExplicitMenu) ] ] From e78f2faa4bc404483db91464dac0615aa3978c43 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 20 Mar 2025 18:15:16 -0300 Subject: [PATCH 0879/1268] add configuration cleanup and accessors [feenkcom/gtoolkit#4374] --- ...derHierarchyDropdownConfiguration.class.st | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtPharoCoderHierarchyDropdownConfiguration.class.st b/src/GToolkit-Coder-UI/GtPharoCoderHierarchyDropdownConfiguration.class.st index 557e58a73..3bdd9f07f 100644 --- a/src/GToolkit-Coder-UI/GtPharoCoderHierarchyDropdownConfiguration.class.st +++ b/src/GToolkit-Coder-UI/GtPharoCoderHierarchyDropdownConfiguration.class.st @@ -7,6 +7,16 @@ Class { #category : #'GToolkit-Coder-UI' } +{ #category : #cleanup } +GtPharoCoderHierarchyDropdownConfiguration class >> cleanUp: aggressive [ + aggressive ifTrue: [ preferredExtent := nil ] +] + +{ #category : #accessing } +GtPharoCoderHierarchyDropdownConfiguration class >> defaultPreferredExtent [ + ^ 800 @ 400 +] + { #category : #accessing } GtPharoCoderHierarchyDropdownConfiguration class >> gtConfiguration [ ^ {GtPhlowOverviewItem new @@ -30,10 +40,17 @@ GtPharoCoderHierarchyDropdownConfiguration class >> gtConfigurationFor: aView [ { #category : #accessing } GtPharoCoderHierarchyDropdownConfiguration class >> preferredExtent [ - ^ preferredExtent ifNil: [ preferredExtent := 800 @ 400 ] + ^ preferredExtent ifNil: [ preferredExtent := self defaultPreferredExtent ] ] { #category : #accessing } GtPharoCoderHierarchyDropdownConfiguration class >> preferredExtent: anObject [ preferredExtent := anObject ] + +{ #category : #accessing } +GtPharoCoderHierarchyDropdownConfiguration class >> preferredExtentOrNil [ + "Just for testing purposes." + + ^ preferredExtent +] From 87e17abb17d0f9dd96c9fa535ae3caa4beb85009 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 21 Mar 2025 09:20:33 -0300 Subject: [PATCH 0880/1268] fix `GtSourceCoderErrorAttribute>>#doAffect:in:` escape shortcut action --- src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st index 668e1f792..9c3513751 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st @@ -64,8 +64,8 @@ GtSourceCoderErrorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditor addShortcut: (BlShortcutWithAction new combination: each; repeatable: false; - action: [ :element | - element fireEvent: BrDropdownHideWish new. + action: [ :aShortcutEvent :aShortcutAction | + aShortcutEvent currentTarget fireEvent: BrDropdownHideWish new. anEditorElement requestFocus ]) ]. textElement enqueueTask: [ textElement requestFocus ] asBlTask. pane addChild: textElement ]. From 8b73b978b6ff20b9a479fbedd0664f5f68971c7b Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Sat, 22 Mar 2025 07:25:43 -0500 Subject: [PATCH 0881/1268] Implement = correctly on stylers to prevent double styling [[feenkcom/gtoolkit#4380]] --- src/GToolkit-Coder/GtCoderAstCompositeStyler.class.st | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/GToolkit-Coder/GtCoderAstCompositeStyler.class.st b/src/GToolkit-Coder/GtCoderAstCompositeStyler.class.st index 366fee24f..c3c4dde9a 100644 --- a/src/GToolkit-Coder/GtCoderAstCompositeStyler.class.st +++ b/src/GToolkit-Coder/GtCoderAstCompositeStyler.class.st @@ -7,6 +7,11 @@ Class { #category : #'GToolkit-Coder-Styler/Highlighter' } +{ #category : #'as yet unclassified' } +GtCoderAstCompositeStyler >> = anObject [ + ^self class == anObject class and: [self stylers = anObject stylers] +] + { #category : #'api - styling' } GtCoderAstCompositeStyler >> extraStyle: aText ast: theAst [ self stylers do: [ :eachStyler | @@ -15,6 +20,11 @@ GtCoderAstCompositeStyler >> extraStyle: aText ast: theAst [ during: [ eachStyler extraStyle: aText ast: theAst ] ] ] +{ #category : #'as yet unclassified' } +GtCoderAstCompositeStyler >> hash [ + ^ self class hash xor: self stylers hash +] + { #category : #'api - styling' } GtCoderAstCompositeStyler >> style: aText ast: theAst [ self stylers do: [ :eachStyler | From 1000111bf819b0aec9a422a859634b19c2232f4d Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Sun, 23 Mar 2025 11:46:42 -0300 Subject: [PATCH 0882/1268] menu: use new tooltip aptitude [feenkcom/gtoolkit#4180] --- .../GtFixItAttribute.class.st | 19 ++--- .../GtCoderActionsElement.class.st | 4 +- .../GtCoderExampleStateElement.class.st | 2 +- ...erListEmbeddedRenameEditorElement.class.st | 12 +-- .../GtCoderPrintStringAttribute.class.st | 75 ++++++++++++------- ...tCoderProtocolsGroupHeaderElement.class.st | 12 +-- .../GtFilterItemsElement.class.st | 30 ++++---- .../GtFiltersElement.class.st | 18 ++--- ...roundEvaluatedCodeButtonAttribute.class.st | 2 +- 9 files changed, 89 insertions(+), 85 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st index 220af8695..acf983996 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st @@ -68,32 +68,29 @@ GtFixItAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ elementId ifNotNil: [ button id: elementId ]. button beTinySize. button label: (label ifNil: [ 'Fix it' ]). - + dropDownAptitude := BrGlamorousWithExplicitDropdownAptitude - handle: [ - | dropdownButton | + handle: [ | dropdownButton | dropdownButton := BrButton new. dropdownButton beTinySize. dropdownButton - aptitude: BrGlamorousButtonWithIconAptitude - BrGlamorousButtonWithLabelTooltipAptitude + aptitude: BrGlamorousButtonWithIconAptitude - BrGlamorousButtonWithLabelTooltipAptitude2 - BrGlamorousButtonExteriorAptitude. dropdownButton icon: BrGlamorousVectorIcons repair. self addHoveringStylingFor: anEditorElement to: dropdownButton. dropdownButton ] - content: [ - | element | + content: [ | element | element := self dropDownElementFor: anEditorElement. self addHoveringStylingFor: anEditorElement to: element. element ]. - + button - aptitude: BrGlamorousButtonWithIconAptitude - - BrGlamorousButtonExteriorAptitude - + dropDownAptitude. + aptitude: BrGlamorousButtonWithIconAptitude - BrGlamorousButtonExteriorAptitude + + dropDownAptitude. button userData at: #fixItAttribute put: self. button userData at: #dropDownAptitude put: dropDownAptitude. button icon: BrGlamorousVectorIcons repair. - + self addHoveringStylingFor: anEditorElement to: button. ^ button ] diff --git a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st index 630496e37..c47e1a6d2 100644 --- a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st @@ -159,7 +159,7 @@ GtCoderActionsElement >> newDropButtonForAction: aGtCoderAction [ ifNotNil: [ aButton icon: aGtCoderAction icon asElement ]. aButton beSmallSize; - aptitude: BrGlamorousButtonWithIconAptitude - BrGlamorousButtonWithLabelTooltipAptitude + aptitude: BrGlamorousButtonWithIconAptitude - BrGlamorousButtonWithLabelTooltipAptitude2 - BrGlamorousButtonExteriorAptitude; padding: BlInsets empty; margin: BlInsets empty; @@ -196,7 +196,7 @@ GtCoderActionsElement >> newDropButtonMenuForAction: aGtCoderAction [ ifNotNil: [ aButton icon: aGtCoderAction icon asElement ]. aButton beSmallSize; - aptitude: BrGlamorousButtonWithIconAptitude - BrGlamorousButtonWithLabelTooltipAptitude + aptitude: BrGlamorousButtonWithIconAptitude - BrGlamorousButtonWithLabelTooltipAptitude2 - BrGlamorousButtonExteriorAptitude; padding: BlInsets empty; margin: BlInsets empty; diff --git a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st index 15d9778ff..02ffe5514 100644 --- a/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExampleStateElement.class.st @@ -104,7 +104,7 @@ GtCoderExampleStateElement >> initializeInteractiveLook [ { #category : #initialization } GtCoderExampleStateElement >> initializeTooltipLook [ self addAptitude: - (BrGlamorousWithTooltipAptitude content: [ + (BrGlamorousWithExplicitTooltipAptitude content: [ self newTooltipContent ]) ] diff --git a/src/GToolkit-Coder-UI/GtCoderListEmbeddedRenameEditorElement.class.st b/src/GToolkit-Coder-UI/GtCoderListEmbeddedRenameEditorElement.class.st index f09ed8340..9c2db2cb2 100644 --- a/src/GToolkit-Coder-UI/GtCoderListEmbeddedRenameEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderListEmbeddedRenameEditorElement.class.st @@ -19,9 +19,9 @@ GtCoderListEmbeddedRenameEditorElement >> createAcceptButton [ aptitude: (BrGlamorousButtonRectangularAptitude paddingScale: 0.5) + BrGlamorousButtonIconAptitude + (BrGlamorousButtonFlatExteriorAptitude new - backgroundPaint: (BrGlamorousColors neutralBackgroundColor); - hoveredBackgroundPaint: (BrGlamorousColors secondaryHeaderBackgroundColor)) - + BrGlamorousButtonWithLabelTooltipAptitude; + backgroundPaint: BrGlamorousColors neutralBackgroundColor; + hoveredBackgroundPaint: BrGlamorousColors secondaryHeaderBackgroundColor) + + BrGlamorousButtonWithLabelTooltipAptitude2; icon: BrGlamorousVectorIcons accept; label: 'Rename protocol'; action: [ self privatePerformRename ] @@ -35,9 +35,9 @@ GtCoderListEmbeddedRenameEditorElement >> createCancelButton [ aptitude: (BrGlamorousButtonRectangularAptitude paddingScale: 0.5) + BrGlamorousButtonIconAptitude + (BrGlamorousButtonFlatExteriorAptitude new - backgroundPaint: (BrGlamorousColors neutralBackgroundColor); - hoveredBackgroundPaint: (BrGlamorousColors secondaryHeaderBackgroundColor)) - + BrGlamorousButtonWithLabelTooltipAptitude; + backgroundPaint: BrGlamorousColors neutralBackgroundColor; + hoveredBackgroundPaint: BrGlamorousColors secondaryHeaderBackgroundColor) + + BrGlamorousButtonWithLabelTooltipAptitude2; icon: BrGlamorousVectorIcons cancel; label: 'Cancel'; action: [ self privateEndRename ] diff --git a/src/GToolkit-Coder-UI/GtCoderPrintStringAttribute.class.st b/src/GToolkit-Coder-UI/GtCoderPrintStringAttribute.class.st index 0a515c6d2..1614397cb 100644 --- a/src/GToolkit-Coder-UI/GtCoderPrintStringAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPrintStringAttribute.class.st @@ -104,50 +104,67 @@ GtCoderPrintStringAttribute >> copyFromEditorElement: anEditorElement [ { #category : #accessing } GtCoderPrintStringAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ | hamburgerButton | - hamburgerButton := nil. - + ^ BrLabel new - aptitude: (BrGlamorousLabelAptitude new glamorousCodeFont labelDo: [ :aLabel | - aLabel addAptitude: (BrGlamorousWithTooltipAptitude new contentStencil: [ self buildTooltip ]) ]); + aptitude: (BrGlamorousLabelAptitude new glamorousCodeFont + labelDo: [ :aLabel | + aLabel + addAptitude: (BrGlamorousWithExplicitTooltipAptitude content: [ self buildTooltip ]) ]); beTinySize; id: GtCoderPrintStringElementId; text: object printString; background: BrGlamorousColors neutralBackgroundColor; - margin: (BlInsets top: 0 left: 4 bottom: 0 right: 4); - padding: (BlInsets top: 2 left: 4 bottom: 2 right: 4); + margin: (BlInsets + top: 0 + left: 4 + bottom: 0 + right: 4); + padding: (BlInsets + top: 2 + left: 4 + bottom: 2 + right: 4); geometry: (BlRoundedRectangleGeometry cornerRadius: 2); addAptitude: (BrStyleCommonAptitude new - focused: [ :aStyle | aStyle border: (BlBorder paint: (BrGlamorousColors focusedEditorBorderColor alpha: 0.75) width: 1) ]); + focused: [ :aStyle | + aStyle + border: (BlBorder + paint: (BrGlamorousColors focusedEditorBorderColor alpha: 0.75) + width: 1) ]); requestFocus; addShortcut: (BlShortcutWithAction new - combination: BlKeyCombination primaryC; - action: [ self copyFromEditorElement: anEditorElement ]); + combination: BlKeyCombination primaryC; + action: [ self copyFromEditorElement: anEditorElement ]); addShortcut: (BlShortcutWithAction new - combination: BlKeyCombination primaryI; - action: [ :aShortcutEvent | self spawnFromElement: aShortcutEvent currentTarget ]); + combination: BlKeyCombination primaryI; + action: [ :aShortcutEvent | self spawnFromElement: aShortcutEvent currentTarget ]); addShortcut: (BlShortcutWithAction new - combination: BlKeyCombination return; - action: [ self insertIntoTheEditorElement: anEditorElement ]); + combination: BlKeyCombination return; + action: [ self insertIntoTheEditorElement: anEditorElement ]); addShortcut: (BlShortcutWithAction new - combination: BlKeyCombination backspace; - action: [ self removeFromEditorElement: anEditorElement ]); - when: BlMouseDownEvent do: [ :anEvent | - anEvent consumed: true. - anEvent currentTarget requestFocus ]; - when: BlElementRemovedFromParentEvent do: [ :anEvent | - anEditorElement requestFocus ]; + combination: BlKeyCombination backspace; + action: [ self removeFromEditorElement: anEditorElement ]); + when: BlMouseDownEvent + do: [ :anEvent | + anEvent consumed: true. + anEvent currentTarget requestFocus ]; + when: BlElementRemovedFromParentEvent + do: [ :anEvent | anEditorElement requestFocus ]; addChild: (hamburgerButton := BrButton new - aptitude: self actionButtonLook + (BrGlamorousWithExplicitDropdownAptitude - handle: [ BrButton new - aptitude: BrGlamorousButtonIconAptitude + BrGlamorousButtonLayoutAptitude; + aptitude: self actionButtonLook + + (BrGlamorousWithExplicitDropdownAptitude + handle: [ BrButton new + aptitude: BrGlamorousButtonIconAptitude + BrGlamorousButtonLayoutAptitude; + icon: BrGlamorousVectorIcons hamburger; + beSmallSize; + exact: 16 @ 16 ] + content: [ self + buildMenuFor: hamburgerButton + fromEditorElement: anEditorElement ]); icon: BrGlamorousVectorIcons hamburger; - beSmallSize; - exact: 16@16 ] - content: [ self buildMenuFor: hamburgerButton fromEditorElement: anEditorElement ]); - icon: BrGlamorousVectorIcons hamburger; - beTinySize; - exact: 12@12) + beTinySize; + exact: 12 @ 12) ] { #category : #initialization } diff --git a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupHeaderElement.class.st b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupHeaderElement.class.st index 5460172f3..24b15fd7d 100644 --- a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupHeaderElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupHeaderElement.class.st @@ -35,10 +35,10 @@ GtCoderProtocolsGroupHeaderElement >> addProtocolNamed: aProtocolName in: aClass { #category : #'as yet unclassified' } GtCoderProtocolsGroupHeaderElement >> createAddProtocolButton [ | aButtonStencil aPopUp | - aButtonStencil := [ - BrButton new + aButtonStencil := [ BrButton new beTinySize; - aptitude: (BrGlamorousButtonRectangularAptitude paddingScale: 0) + BrGlamorousButtonIconAptitude; + aptitude: (BrGlamorousButtonRectangularAptitude paddingScale: 0) + + BrGlamorousButtonIconAptitude; icon: BrGlamorousVectorIcons add ] asStencil. aPopUp := BrGlamorousWithExplicitDropdownAptitude @@ -47,8 +47,8 @@ GtCoderProtocolsGroupHeaderElement >> createAddProtocolButton [ ^ aButtonStencil asElement addAptitude: (BrGlamorousButtonFlatExteriorAptitude new - backgroundPaint: (Color gray alpha: 0.1)); - addAptitude: BrGlamorousButtonWithLabelTooltipAptitude; + backgroundPaint: (Color gray alpha: 0.1)); + addAptitude: BrGlamorousButtonWithLabelTooltipAptitude2; addAptitude: aPopUp; label: 'Add new protocol' ] @@ -106,7 +106,7 @@ GtCoderProtocolsGroupHeaderElement >> createNewProtocolForm [ + BrGlamorousButtonIconAptitude + (BrGlamorousButtonFlatExteriorAptitude new backgroundPaint: (Color gray alpha: 0.1)) - + BrGlamorousButtonWithLabelTooltipAptitude; + + BrGlamorousButtonWithLabelTooltipAptitude2; icon: BrGlamorousVectorIcons accept; label: 'Add protocol'; action: [ self addProtocolFrom: aProtocolEditor ]. diff --git a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st index d3f62a4db..e2ba9ac64 100644 --- a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st @@ -113,9 +113,9 @@ GtFilterItemsElement >> addRemoveButtonIconTo: anElement [ anElement clipChildren: false. aRemoveButton := self newRemoveButton. aRemoveButton visibility: BlVisibility gone. - aRemoveButton addAptitude: (BrGlamorousWithLabelTooltipAptitude + aRemoveButton addAptitude: (BrGlamorousWithExplicitTooltipAptitude text: 'Remove' - keymap: aKeyMap). + shortcut: aKeyMap). aRemoveButton action: [ :aButton | self onRemoveFilterViewModelOfElement: anElement from: aButton ]. anElement @@ -239,27 +239,23 @@ GtFilterItemsElement >> initializeShortcuts [ GtFilterItemsElement >> newAddFilterButton [ ^ self newAddFilterHandleElement id: GtFiltersAddButtonId; - addAptitude: BrGlamorousButtonWithLabelTooltipAptitude new; + addAptitude: BrGlamorousButtonWithLabelTooltipAptitude2 new; addAptitude: (BrStyleCommonAptitude new - default: [ :aStyle | - aStyle - border: BlBorder empty; - background: self theme status neutralBackgroundColor ]; - hovered: [ :aStyle | - aStyle background: self theme status neutralBackgroundColor darker ]; - pressed: [ :aStyle | - aStyle background: self theme status neutralBackgroundColor darker darker ]; - focused: [ :aStyle | - aStyle border: (BlBorder paint: self theme editor focusedBorderColor width: 1) ]); + default: [ :aStyle | + aStyle + border: BlBorder empty; + background: self theme status neutralBackgroundColor ]; + hovered: [ :aStyle | aStyle background: self theme status neutralBackgroundColor darker ]; + pressed: [ :aStyle | aStyle background: self theme status neutralBackgroundColor darker darker ]; + focused: [ :aStyle | aStyle border: (BlBorder paint: self theme editor focusedBorderColor width: 1) ]); addAptitude: (BrGlamorousWithExplicitDropdownAptitude - handle: [ self newAddFilterHandleElement ] - content: [ self createDropdownContent ]); + handle: [ self newAddFilterHandleElement ] + content: [ self createDropdownContent ]); margin: (BlInsets left: 2); constraintsDo: [ :c | c flow vertical alignCenter ]; beFocusable; in: [ :anElement | self addNavigationShortcutsTo: anElement ]; - addShortcut: - (BlShortcutWithAction new + addShortcut: (BlShortcutWithAction new combination: BlKeyCombination enter; action: [ :anEvent | anEvent currentTarget dispatchEvent: BrDropdownShowWish new ]); when: BrDropdownIsHidden diff --git a/src/GToolkit-Coder-UI/GtFiltersElement.class.st b/src/GToolkit-Coder-UI/GtFiltersElement.class.st index caaebcdd1..2fb5093bf 100644 --- a/src/GToolkit-Coder-UI/GtFiltersElement.class.st +++ b/src/GToolkit-Coder-UI/GtFiltersElement.class.st @@ -156,21 +156,16 @@ GtFiltersElement >> initialize [ GtFiltersElement >> newAddTagButton [ ^ BrButton new id: GtFiltersAddButtonId; - aptitude: - BrGlamorousButtonRectangularAptitude new - + BrGlamorousButtonIconAptitude new - + BrGlamorousButtonWithLabelTooltipAptitude new + aptitude: BrGlamorousButtonRectangularAptitude new + BrGlamorousButtonIconAptitude new + + BrGlamorousButtonWithLabelTooltipAptitude2 new + (BrStyleCommonAptitude new default: [ :aStyle | aStyle border: BlBorder empty; background: self theme status neutralBackgroundColor ]; - hovered: [ :aStyle | - aStyle background: self theme status neutralBackgroundColor darker ]; - pressed: [ :aStyle | - aStyle background: self theme status neutralBackgroundColor darker darker ]; - focused: [ :aStyle | - aStyle border: (BlBorder paint: self theme editor focusedBorderColor width: 1) ]); + hovered: [ :aStyle | aStyle background: self theme status neutralBackgroundColor darker ]; + pressed: [ :aStyle | aStyle background: self theme status neutralBackgroundColor darker darker ]; + focused: [ :aStyle | aStyle border: (BlBorder paint: self theme editor focusedBorderColor width: 1) ]); icon: BrGlamorousVectorIcons add; label: 'Add Filter'; margin: (BlInsets all: 2); @@ -178,8 +173,7 @@ GtFiltersElement >> newAddTagButton [ hExact: 20; constraintsDo: [ :c | c flow vertical alignCenter ]; action: [ :aButton | self createNewTag ]; - addShortcut: - (BlShortcutWithAction new + addShortcut: (BlShortcutWithAction new combination: BlKeyCombination enter; action: [ :anEvent | self createNewTag ]) ] diff --git a/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st b/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st index 46b27a6e8..c19dd36ff 100644 --- a/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtPlaygroundEvaluatedCodeButtonAttribute.class.st @@ -31,7 +31,7 @@ GtPlaygroundEvaluatedCodeButtonAttribute >> affect: aTBrTextEditorTextualPiece i aptitude: (BrLazyStyleCommonAptitude new default: [ :aStyle | aStyle background: BrGlamorousColors defaultButtonBorderColor ]; hovered: [ :aStyle | aStyle background: BrGlamorousColors hoveredButtonBorderColor ]) - + ((BrGlamorousWithTooltipAptitude + + ((BrGlamorousWithExplicitTooltipAptitude content: [ | aContainer | aContainer := BlElement new layout: BlFrameLayout new; From 704bb875f5943ad8747ad2bced58060efcde86c7 Mon Sep 17 00:00:00 2001 From: John Brant Date: Mon, 24 Mar 2025 07:04:03 -0500 Subject: [PATCH 0883/1268] [feenkcom/gtoolkit#4378] disabled coder menu items --- src/GToolkit-Coder-UI/GtCoderContextMenuAction.extension.st | 1 + 1 file changed, 1 insertion(+) diff --git a/src/GToolkit-Coder-UI/GtCoderContextMenuAction.extension.st b/src/GToolkit-Coder-UI/GtCoderContextMenuAction.extension.st index ffbf3834d..c1fd537f6 100644 --- a/src/GToolkit-Coder-UI/GtCoderContextMenuAction.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderContextMenuAction.extension.st @@ -5,5 +5,6 @@ GtCoderContextMenuAction >> asBrMenuItemForCoderElement: aTextualCoderEditorElem ^ GtCoderMenuActionItem new textualCoderEditorElement: aTextualCoderEditorElement; coderContextMenuAction: self; + disableIf: [ self isDisabled ]; yourself ] From 2f1b14dcc6ff57b420d346bca7e006266bbe3f70 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Mon, 24 Mar 2025 08:05:04 -0500 Subject: [PATCH 0884/1268] Remove unused classes. --- src/GToolkit-Coder/GtCoderAddOns.class.st | 24 ------------------- ...derAddOnsContextActionsDifference.class.st | 5 ---- ...tCoderAddOnsContextMenuDifference.class.st | 5 ---- .../GtCoderAddOnsDifference.class.st | 5 ---- ...tCoderAddOnsMainActionsDifference.class.st | 5 ---- .../GtCoderAddOnsShortcutsDifference.class.st | 5 ---- .../GtCoderAddOnsStylersDifference.class.st | 5 ---- .../GtTextualCoderAddOns.class.st | 8 ------- 8 files changed, 62 deletions(-) delete mode 100644 src/GToolkit-Coder/GtCoderAddOnsContextActionsDifference.class.st delete mode 100644 src/GToolkit-Coder/GtCoderAddOnsContextMenuDifference.class.st delete mode 100644 src/GToolkit-Coder/GtCoderAddOnsDifference.class.st delete mode 100644 src/GToolkit-Coder/GtCoderAddOnsMainActionsDifference.class.st delete mode 100644 src/GToolkit-Coder/GtCoderAddOnsShortcutsDifference.class.st delete mode 100644 src/GToolkit-Coder/GtCoderAddOnsStylersDifference.class.st diff --git a/src/GToolkit-Coder/GtCoderAddOns.class.st b/src/GToolkit-Coder/GtCoderAddOns.class.st index 079443118..557a92335 100644 --- a/src/GToolkit-Coder/GtCoderAddOns.class.st +++ b/src/GToolkit-Coder/GtCoderAddOns.class.st @@ -418,30 +418,6 @@ GtCoderAddOns >> contextMenuActions [ ^ contextMenuActions ] -{ #category : #changes } -GtCoderAddOns >> differenceWith: aGtCoderAddOns [ - ^ Array streamContents: [ :aStream | self differenceWith: aGtCoderAddOns on: aStream ] -] - -{ #category : #changes } -GtCoderAddOns >> differenceWith: aGtCoderAddOns on: aStream [ - self - assert: [ self class = aGtCoderAddOns class ] - description: [ 'Coder AddOns type must be identical to compute the difference' ]. - - self mainActions = aGtCoderAddOns mainActions - ifFalse: [ aStream nextPut: GtCoderAddOnsMainActionsDifference new ]. - - self contextActions = aGtCoderAddOns contextActions - ifFalse: [ aStream nextPut: GtCoderAddOnsContextActionsDifference new ]. - - self contextMenuActions = aGtCoderAddOns contextMenuActions - ifFalse: [ aStream nextPut: GtCoderAddOnsContextMenuDifference new ]. - - self shortcuts = aGtCoderAddOns shortcuts - ifFalse: [ aStream nextPut: GtCoderAddOnsShortcutsDifference new ]. -] - { #category : #'initialize-release' } GtCoderAddOns >> initialize [ super initialize. diff --git a/src/GToolkit-Coder/GtCoderAddOnsContextActionsDifference.class.st b/src/GToolkit-Coder/GtCoderAddOnsContextActionsDifference.class.st deleted file mode 100644 index 3c0128383..000000000 --- a/src/GToolkit-Coder/GtCoderAddOnsContextActionsDifference.class.st +++ /dev/null @@ -1,5 +0,0 @@ -Class { - #name : #GtCoderAddOnsContextActionsDifference, - #superclass : #GtCoderAddOnsDifference, - #category : 'GToolkit-Coder-Coders - Addons' -} diff --git a/src/GToolkit-Coder/GtCoderAddOnsContextMenuDifference.class.st b/src/GToolkit-Coder/GtCoderAddOnsContextMenuDifference.class.st deleted file mode 100644 index 060ba11ad..000000000 --- a/src/GToolkit-Coder/GtCoderAddOnsContextMenuDifference.class.st +++ /dev/null @@ -1,5 +0,0 @@ -Class { - #name : #GtCoderAddOnsContextMenuDifference, - #superclass : #GtCoderAddOnsDifference, - #category : 'GToolkit-Coder-Coders - Addons' -} diff --git a/src/GToolkit-Coder/GtCoderAddOnsDifference.class.st b/src/GToolkit-Coder/GtCoderAddOnsDifference.class.st deleted file mode 100644 index 81b13bdf7..000000000 --- a/src/GToolkit-Coder/GtCoderAddOnsDifference.class.st +++ /dev/null @@ -1,5 +0,0 @@ -Class { - #name : #GtCoderAddOnsDifference, - #superclass : #Object, - #category : 'GToolkit-Coder-Coders - Addons' -} diff --git a/src/GToolkit-Coder/GtCoderAddOnsMainActionsDifference.class.st b/src/GToolkit-Coder/GtCoderAddOnsMainActionsDifference.class.st deleted file mode 100644 index 4419f0ce6..000000000 --- a/src/GToolkit-Coder/GtCoderAddOnsMainActionsDifference.class.st +++ /dev/null @@ -1,5 +0,0 @@ -Class { - #name : #GtCoderAddOnsMainActionsDifference, - #superclass : #GtCoderAddOnsDifference, - #category : 'GToolkit-Coder-Coders - Addons' -} diff --git a/src/GToolkit-Coder/GtCoderAddOnsShortcutsDifference.class.st b/src/GToolkit-Coder/GtCoderAddOnsShortcutsDifference.class.st deleted file mode 100644 index 5a6fe71bc..000000000 --- a/src/GToolkit-Coder/GtCoderAddOnsShortcutsDifference.class.st +++ /dev/null @@ -1,5 +0,0 @@ -Class { - #name : #GtCoderAddOnsShortcutsDifference, - #superclass : #GtCoderAddOnsDifference, - #category : 'GToolkit-Coder-Coders - Addons' -} diff --git a/src/GToolkit-Coder/GtCoderAddOnsStylersDifference.class.st b/src/GToolkit-Coder/GtCoderAddOnsStylersDifference.class.st deleted file mode 100644 index a7d3d76ee..000000000 --- a/src/GToolkit-Coder/GtCoderAddOnsStylersDifference.class.st +++ /dev/null @@ -1,5 +0,0 @@ -Class { - #name : #GtCoderAddOnsStylersDifference, - #superclass : #GtCoderAddOnsDifference, - #category : 'GToolkit-Coder-Coders - Addons' -} diff --git a/src/GToolkit-Coder/GtTextualCoderAddOns.class.st b/src/GToolkit-Coder/GtTextualCoderAddOns.class.st index 13262f2b8..0625e1941 100644 --- a/src/GToolkit-Coder/GtTextualCoderAddOns.class.st +++ b/src/GToolkit-Coder/GtTextualCoderAddOns.class.st @@ -40,14 +40,6 @@ GtTextualCoderAddOns >> ast: aGtCoderAst [ ast := aGtCoderAst ] -{ #category : #changes } -GtTextualCoderAddOns >> differenceWith: aGtCoderAddOns on: aStream [ - super differenceWith: aGtCoderAddOns on: aStream. - - self stylers = aGtCoderAddOns stylers - ifFalse: [ aStream nextPut: GtCoderAddOnsStylersDifference new ] -] - { #category : #'initialize-release' } GtTextualCoderAddOns >> initialize [ super initialize. From 0b6073c3aff205c6f8b3702e4c687e8763a5d643 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Mon, 24 Mar 2025 12:09:45 -0500 Subject: [PATCH 0885/1268] Make = work better for stylers that retain coderViewModels --- src/GToolkit-Coder/GtCoderAstStyler.class.st | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/GToolkit-Coder/GtCoderAstStyler.class.st b/src/GToolkit-Coder/GtCoderAstStyler.class.st index fe57fd020..6cb955b7e 100644 --- a/src/GToolkit-Coder/GtCoderAstStyler.class.st +++ b/src/GToolkit-Coder/GtCoderAstStyler.class.st @@ -28,6 +28,13 @@ GtCoderAstStyler class >> telemetryComputationStartSignal: anObject [ process: Processor activeProcess ] +{ #category : #comparing } +GtCoderAstStyler >> = anObject [ + self class == anObject class ifFalse: [^false]. + (self coderViewModel isNil or: [anObject coderViewModel isNil]) ifTrue: [^true]. + ^self coderViewModel = anObject coderViewModel +] + { #category : #'as yet unclassified' } GtCoderAstStyler >> anyCursorsInRange: textRange [ ^ self coderViewModel cursors positions @@ -76,6 +83,11 @@ GtCoderAstStyler >> coderViewModel: anObject [ GtCoderAstStyler >> extraStyle: aText ast: theAst [ ] +{ #category : #comparing } +GtCoderAstStyler >> hash [ + ^self class hash +] + { #category : #private } GtCoderAstStyler >> privateStyle: aText [ | theAst | From f4bd11ec9c8471f69023abe417dd5df065f6e90e Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 25 Mar 2025 08:00:32 -0500 Subject: [PATCH 0886/1268] [feenkcom/gtoolkit#4379] update class index on rename --- .../GtCoderClassesTreeElement.class.st | 36 ++++++------------- .../GtCoderPackagesTreeElement.class.st | 12 ++++--- ...TGtCoderNavigationWithContextMenu.trait.st | 8 +++-- .../GtCoderClassesHierarchyTree.class.st | 14 ++++++-- 4 files changed, 33 insertions(+), 37 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index 282030da0..25eb96ad3 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -22,27 +22,6 @@ GtCoderClassesTreeElement class >> fromClasses: aCollectionOfClasses [ ^ self new initializeWithClasses: aCollectionOfClasses ] -{ #category : #'private - context menu' } -GtCoderClassesTreeElement >> addPreviewButtonFor: refactoring to: elem cancelBlock: aBlock [ - | button | - elem removeChildNamed: #preview. - button := GtRefactoringsPreviewButton new. - button vMatchParent. - button refactorings: [ {refactoring} ]. - button cancelBlock: aBlock. - button - padding: (BlInsets - top: 1 - right: 4 - bottom: 0 - left: 4). - button beMiniSize. - button - when: GtRefactoringsAppliedEvent - do: [ :anEvent | elem removeChild: anEvent currentTarget ]. - ^ elem addChild: button as: #preview -] - { #category : #'private - context menu' } GtCoderClassesTreeElement >> addPreviewButtonFor: refactoring to: elem cancelSelector: cancelSelector [ | button | @@ -321,14 +300,19 @@ GtCoderClassesTreeElement >> removeClass: aClass inElement: elem [ { #category : #'private - context menu' } GtCoderClassesTreeElement >> renameClass: aClass inElement: elem [ - | refactoring edit childs | + | refactoring edit childs restoreBlock | edit := BrEditableLabel new. childs := elem children. + restoreBlock := [ (edit parent notNil + and: [ edit parent children identityIncludes: edit ]) + ifTrue: [ elem removeChildren. + elem addChildren: childs ] ]. edit aptitude: (BrGlamorousEditableLabelAptitude new - fontSize: 11.9; "Force the font to match the label font" + fontSize: 11.9; "Force the font to match the label font" background: Color transparent); text: aClass name; + when: BrEditorCancelWish do: [ :wish | restoreBlock value ]; when: BrEditorAcceptWish do: [ :aWish | refactoring := GtRBRenameClassRefactoring @@ -338,12 +322,12 @@ GtCoderClassesTreeElement >> renameClass: aClass inElement: elem [ self addPreviewButtonFor: refactoring to: elem - cancelBlock: [ elem removeChildren. - elem addChildren: childs ] ]; + appliedBlock: restoreBlock + cancelBlock: restoreBlock ]; switchToEditor. edit requestFocus. elem removeChildren. - elem addChild: edit + elem addChild: edit as: #renameClassEditor ] { #category : #'api - selection' } diff --git a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st index c42046bc6..89ffcb4f3 100644 --- a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st @@ -219,11 +219,11 @@ GtCoderPackagesTreeElement >> removeTag: aTag inElement: elem [ { #category : #initialization } GtCoderPackagesTreeElement >> renamePackage: aPackage inElement: elem [ | refactoring edit childs | - childs := elem children. + childs := elem children copy. edit := BrEditableLabel new. edit aptitude: (BrGlamorousEditableLabelAptitude new - fontSize: 11.9; "Force the font to match the label font" + fontSize: 11.9; "Force the font to match the label font" background: Color transparent); text: aPackage name; when: BrEditorAcceptWish @@ -235,6 +235,7 @@ GtCoderPackagesTreeElement >> renamePackage: aPackage inElement: elem [ self addPreviewButtonFor: refactoring to: elem + appliedBlock: [ ] cancelBlock: [ elem removeChildren. elem addChildren: childs ] ]; switchToEditor. @@ -246,11 +247,11 @@ GtCoderPackagesTreeElement >> renamePackage: aPackage inElement: elem [ { #category : #initialization } GtCoderPackagesTreeElement >> renameTag: aPackageOrTag inElement: elem [ | refactoring edit childs | - childs := elem children. + childs := elem children copy. edit := BrEditableLabel new. edit aptitude: (BrGlamorousEditableLabelAptitude new - fontSize: 11.9; + fontSize: 11.9; "Force the font to match the label font" background: Color transparent); text: aPackageOrTag name; when: BrEditorAcceptWish @@ -263,9 +264,10 @@ GtCoderPackagesTreeElement >> renameTag: aPackageOrTag inElement: elem [ self addPreviewButtonFor: refactoring to: elem + appliedBlock: [ ] cancelBlock: [ elem removeChildren. elem addChildren: childs ] ]; - switchToEditor. "Force the font to match the label font" + switchToEditor. edit requestFocus. elem removeChildren. elem addChild: edit diff --git a/src/GToolkit-Coder-UI/TGtCoderNavigationWithContextMenu.trait.st b/src/GToolkit-Coder-UI/TGtCoderNavigationWithContextMenu.trait.st index 8add164c2..154321913 100644 --- a/src/GToolkit-Coder-UI/TGtCoderNavigationWithContextMenu.trait.st +++ b/src/GToolkit-Coder-UI/TGtCoderNavigationWithContextMenu.trait.st @@ -4,13 +4,13 @@ Trait { } { #category : #'private - context menu' } -TGtCoderNavigationWithContextMenu >> addPreviewButtonFor: refactoring to: elem cancelBlock: aBlock [ +TGtCoderNavigationWithContextMenu >> addPreviewButtonFor: refactoring to: elem appliedBlock: appliedBlock cancelBlock: cancelBlock [ | button | elem removeChildNamed: #preview. button := GtRefactoringsPreviewButton new. button vMatchParent. button refactorings: [ {refactoring} ]. - button cancelBlock: aBlock. + button cancelBlock: cancelBlock. button padding: (BlInsets top: 1 @@ -20,7 +20,9 @@ TGtCoderNavigationWithContextMenu >> addPreviewButtonFor: refactoring to: elem c button beMiniSize. button when: GtRefactoringsAppliedEvent - do: [ :anEvent | elem removeChild: anEvent currentTarget ]. + do: [ :anEvent | + elem removeChild: anEvent currentTarget. + appliedBlock value ]. ^ elem addChild: button as: #preview ] diff --git a/src/GToolkit-Coder/GtCoderClassesHierarchyTree.class.st b/src/GToolkit-Coder/GtCoderClassesHierarchyTree.class.st index f2d6647a3..47a61889a 100644 --- a/src/GToolkit-Coder/GtCoderClassesHierarchyTree.class.st +++ b/src/GToolkit-Coder/GtCoderClassesHierarchyTree.class.st @@ -10,7 +10,8 @@ Class { #superclass : #Object, #instVars : [ 'rootClass', - 'subclassTrees' + 'subclassTrees', + 'rootClassName' ], #category : #'GToolkit-Coder-Navigation - Model' } @@ -54,7 +55,8 @@ GtCoderClassesHierarchyTree class >> hierarchyForClass: aClass [ GtCoderClassesHierarchyTree >> = anObject [ ^ anObject class = self class and: [ self rootClass = anObject rootClass - and: [ self subclassTrees = anObject subclassTrees ] ] + and: [ self rootClassName = anObject rootClassName + and: [ self subclassTrees = anObject subclassTrees ] ] ] ] { #category : #accessing } @@ -139,7 +141,13 @@ GtCoderClassesHierarchyTree >> rootClass [ { #category : #accessing } GtCoderClassesHierarchyTree >> rootClass: aClass [ - rootClass := aClass + rootClass := aClass. + rootClassName := rootClass name +] + +{ #category : #accessing } +GtCoderClassesHierarchyTree >> rootClassName [ + ^ rootClassName ] { #category : #accessing } From fa94114598fa5d7d5a1dc5463d114d49a072c0a1 Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 25 Mar 2025 09:21:00 -0500 Subject: [PATCH 0887/1268] [feenkcom/gtoolkit#4379] don't copy refactoring buttons when updating class index --- .../GtCoderClassesTreeItemElement.class.st | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeItemElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeItemElement.class.st index 72fa45044..ecb9dcff5 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeItemElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeItemElement.class.st @@ -13,30 +13,34 @@ Class { { #category : #accessing } GtCoderClassesTreeItemElement >> classHierarchyTree: aClassHierarchyTree [ | aNewIconName anIcon anIconForm | + (self children size = 2 + and: [ self children first = classIconContainer + and: [ self children last = classNameLabel ] ]) + ifFalse: [ self removeChildren. + self + addChildren: {classIconContainer. + classNameLabel} ]. theClass := aClassHierarchyTree ifNotNil: #rootClass. theClass ifNil: [ classNameLabel text: '' asRopedText ] - ifNotNil: [ - | aText | + ifNotNil: [ | aText | aText := theClass gtDisplayText asRopedText. (theClass isAbstract or: [ theClass hasAbstractMethods ]) ifTrue: [ aText italic ]. theClass isDeprecated - ifTrue: [ - aText append: ' (deprecated)' asRopedText italic. + ifTrue: [ aText append: ' (deprecated)' asRopedText italic. aText lineThrough ]. classNameLabel text: aText ]. - + aNewIconName := theClass gtSystemIconName. - aNewIconName = currentIconName - ifTrue: [ ^ self ]. + aNewIconName = currentIconName ifTrue: [ ^ self ]. aNewIconName ifNil: [ classIconContainer visibility: BlVisibility hidden ]. anIconForm := theClass gtSafeIconNamed: aNewIconName. anIcon := anIconForm asElement. - + classIconContainer removeChildren. classIconContainer addChild: anIcon. currentIconName := aNewIconName From 6d698040b788baaa9bae25418e09b3036e1af6d4 Mon Sep 17 00:00:00 2001 From: John Brant Date: Wed, 26 Mar 2025 06:11:12 -0500 Subject: [PATCH 0888/1268] [feenkcom/gtoolkit#4379] don't update methods & protocols from futures process --- .../GtCoderMethodsGroupedListElement.class.st | 5 +++-- .../GtCoderProtocolsGroupedListElement.class.st | 9 +++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index ac69c7eb6..cf7534ff8 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -284,8 +284,9 @@ GtCoderMethodsGroupedListElement >> unsubscribeFromNavigationModel [ { #category : #'updating lists' } GtCoderMethodsGroupedListElement >> updateMethodList [ - self navigationModel ifNil: [ ^ self ]. - self updateMethodListWith: self navigationModel methodsToShow + self + inUIProcessDo: [ self navigationModel + ifNotNil: [ self updateMethodListWith: self navigationModel methodsToShow ] ] ] { #category : #'updating lists' } diff --git a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st index 99b50da36..a894f30b6 100644 --- a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st @@ -422,9 +422,10 @@ GtCoderProtocolsGroupedListElement >> updateProtocolListWith: theGtPharoProtocol { #category : #'private - updating' } GtCoderProtocolsGroupedListElement >> updateProtocolsList [ - self updateProtocolListWith: self navigationModel protocolsToShow. + self + inUIProcessDo: [ self updateProtocolListWith: self navigationModel protocolsToShow. - self navigationModel selectedProtocol - ifNil: [ self deselectProtocol ] - ifNotNil: [ :aProtocol | self selectProtocol: aProtocol ] + self navigationModel selectedProtocol + ifNil: [ self deselectProtocol ] + ifNotNil: [ :aProtocol | self selectProtocol: aProtocol ] ] ] From b2f658f7af890b74916f890ac94763f90993040d Mon Sep 17 00:00:00 2001 From: John Brant Date: Mon, 31 Mar 2025 09:09:32 -0500 Subject: [PATCH 0889/1268] [feenkcom/gtoolkit#4399] update selected class in class hierarchy after double click --- .../GtCoderClassesTreeElement.class.st | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index 25eb96ad3..c41a5db2e 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -227,12 +227,20 @@ GtCoderClassesTreeElement >> initializeWithClasses: aCollectionOfClasses [ { #category : #'api - initialization' } GtCoderClassesTreeElement >> initializeWithHierachyForClass: aClass [ - classesTree := (GtCoderGrowingClassesHierarchyTree - hierarchyForClass: aClass) sortByClassName. + classesTree := (GtCoderGrowingClassesHierarchyTree hierarchyForClass: aClass) + sortByClassName. self items: classesTree subclassTrees lazy: [ :eachTree | eachTree subclassTrees ]. - self expandAll + self expandAll. + + self viewModel root + allChildrenNodesBreadthFirstDo: [ :treeNode | + treeNode ensureChildrenNodes. + aClass = treeNode value rootClass + ifTrue: [ self selectOne: treeNode indexInTree. + self scrollToIndex: treeNode indexInTree. + ^ self ] ] ] { #category : #'private - context menu' } From e5c57c7458f77e725e1787ba2b658a112b6ff35a Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 1 Apr 2025 08:07:20 -0500 Subject: [PATCH 0890/1268] [feenkcom/gtoolkit#4404] changing remove package in index to submenu --- .../GtCoderPackagesTreeElement.class.st | 124 ++++++++++++------ 1 file changed, 85 insertions(+), 39 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st index 89ffcb4f3..7acb9f84a 100644 --- a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st @@ -25,7 +25,6 @@ GtCoderPackagesTreeElement >> buildRemovePackageLabelFor: aPackage [ | labelText | labelText := 'Remove package <1s>' expandMacrosWith: aPackage name. ^ BrLabel new - margin: (BlInsets all: 10); aptitude: BrGlamorousLabelAptitude new glamorousRegularFont; text: labelText asRopedText ] @@ -33,9 +32,8 @@ GtCoderPackagesTreeElement >> buildRemovePackageLabelFor: aPackage [ { #category : #initialization } GtCoderPackagesTreeElement >> buildRemoveTagLabelFor: aTag [ | labelText | - labelText := 'Remove package <1s>' expandMacrosWith: aTag name. + labelText := 'Remove package tag <1s>' expandMacrosWith: aTag name. ^ BrLabel new - margin: (BlInsets all: 10); aptitude: BrGlamorousLabelAptitude new glamorousRegularFont; text: labelText asRopedText ] @@ -60,23 +58,29 @@ GtCoderPackagesTreeElement >> childrenForPackageOrTag: aPackageOrTag [ ] { #category : #initialization } -GtCoderPackagesTreeElement >> contextMenuItemsFor: aPackageOrTag [ - | items | - items := {(self createLabel: 'New package / tag' description: '') - -> [ :elem | self newPackage ]} asOrderedCollection. +GtCoderPackagesTreeElement >> contextMenuFor: aPackageOrTag [ + | menu | + menu := BrMenuItems new. + menu + addItemLabel: (self createLabel: 'New package / tag' description: '') + action: [ self newPackage ]. aPackageOrTag class == RPackage - ifTrue: [ items - addAll: {(self createLabel: 'Rename package' description: aPackageOrTag name) - -> [ :elem | self requestRenamePackage: aPackageOrTag ]. - (self createLabel: 'Remove package' description: aPackageOrTag name) - -> [ :elem | self removePackage: aPackageOrTag inElement: elem ]} ] - ifFalse: [ items - addAll: {(self createLabel: 'Rename tag' description: aPackageOrTag name) - -> [ :elem | self requestRenamePackage: aPackageOrTag ]. - (self createLabel: 'Remove tag' description: aPackageOrTag name) - -> [ :elem | self removeTag: aPackageOrTag inElement: elem ]} ]. - - ^ items + ifTrue: [ menu + addItemLabel: (self createLabel: 'Rename package' description: aPackageOrTag name) + action: [ self requestRenamePackage: aPackageOrTag ]. + menu + addItem: (BrMenuSubmenuItem new + label: (self createLabel: 'Remove package' description: aPackageOrTag name); + submenu: (BrMenuExplicit new stencil: [ self removePackageSubmenuFor: aPackageOrTag ])) ] + ifFalse: [ menu + addItemLabel: (self createLabel: 'Rename tag' description: aPackageOrTag name) + action: [ self requestRenamePackage: aPackageOrTag ]. + menu + addItem: (BrMenuSubmenuItem new + label: (self createLabel: 'Remove tag' description: aPackageOrTag name); + submenu: (BrMenuExplicit new stencil: [ self removePackageTagSubmenuFor: aPackageOrTag ])) ]. + + ^ menu ] { #category : #'as yet unclassified' } @@ -125,7 +129,7 @@ GtCoderPackagesTreeElement >> initialize [ hMatchParent; vFitContent; addAptitude: (BrGlamorousWithExplicitContextMenuAptitude - itemsWithAnchorActions: [ (self contextMenuItemsFor: anItemElement packageOrTag) ]) ] ]; + menu: [ self contextMenuFor: anItemElement packageOrTag ]) ] ]; nodeDataBinder: [ :aPackageElement :aPackage | aPackageElement id asSymbol = #'coder--package-rename' ifTrue: [ aPackageElement removeChildren. @@ -187,33 +191,75 @@ GtCoderPackagesTreeElement >> promoteTag: aPackageOrTag inElement: elem [ ] { #category : #initialization } -GtCoderPackagesTreeElement >> removePackage: aPackage inElement: elem [ - | change button | +GtCoderPackagesTreeElement >> removePackageSubmenuFor: aPackage [ + | element definedClasses extendedClasses change button | + element := BrVerticalPane new fitContent. + definedClasses := aPackage definedClassNames size. + extendedClasses := aPackage extendedClassNames size. + element + addChild: ((self buildRemovePackageLabelFor: aPackage) + margin: (BlInsets + top: 10 + bottom: 0 + left: 10 + right: 10)). + definedClasses > 0 + ifTrue: [ element + addChild: (BrLabel new + margin: (BlInsets left: 10 right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; + text: (definedClasses printString , ' defined class' + , (definedClasses > 1 ifTrue: [ 'es' ] ifFalse: [ '' ])) asRopedText) ]. + extendedClasses > 0 + ifTrue: [ element + addChild: (BrLabel new + margin: (BlInsets left: 10 right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; + text: (extendedClasses printString , ' extended class' + , (extendedClasses > 1 ifTrue: [ 'es' ] ifFalse: [ '' ])) asRopedText) ]. change := RBRemovePackageChange removePackageNamed: aPackage name. - button := GtPreviewChangeButton new + button := BrButton new + aptitude: BrGlamorousButtonWithIconAptitude; + beSmallSize; + margin: (BlInsets + top: 10 + bottom: 10 + left: 10 + right: 10); icon: BrGlamorousVectorIcons remove; label: 'Remove'; - changeAction: [ change execute ]; - changeStencil: [ self buildRemovePackageLabelFor: aPackage ]. - button - when: GtRefactoringsAppliedEvent - do: [ :anEvent | elem removeChild: anEvent currentTarget ]. - ^ elem addChild: button as: #preview + action: [ change execute ]. + element addChild: button as: #removeButton. + ^ element ] { #category : #initialization } -GtCoderPackagesTreeElement >> removeTag: aTag inElement: elem [ - | change button | - change := GtRBRemovePackageTagChange packageName: aTag package name tagName: aTag name. - button := GtPreviewChangeButton new +GtCoderPackagesTreeElement >> removePackageTagSubmenuFor: aPackageTag [ + | element change button | + element := BrVerticalPane new fitContent. + element + addChild: ((self buildRemoveTagLabelFor: aPackageTag) + margin: (BlInsets + top: 10 + bottom: 0 + left: 10 + right: 10)). + change := GtRBRemovePackageTagChange + packageName: aPackageTag package name + tagName: aPackageTag name. + button := BrButton new + aptitude: BrGlamorousButtonWithIconAptitude; + beSmallSize; + margin: (BlInsets + top: 10 + bottom: 10 + left: 10 + right: 10); icon: BrGlamorousVectorIcons remove; label: 'Remove'; - changeAction: [ change execute ]; - changeStencil: [ self buildRemoveTagLabelFor: aTag ]. - button - when: GtRefactoringsAppliedEvent - do: [ :anEvent | elem removeChild: anEvent currentTarget ]. - ^ elem addChild: button as: #preview + action: [ change execute ]. + element addChild: button as: #removeButton. + ^ element ] { #category : #initialization } From f0c42adff7fda2547462fbb604fa7430732274a7 Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 1 Apr 2025 08:53:08 -0500 Subject: [PATCH 0891/1268] [feenkcom/gtoolkit#4404] changing remove class in index to submenu --- .../GtCoderClassesTreeElement.class.st | 93 +++++++++++++------ 1 file changed, 64 insertions(+), 29 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index c41a5db2e..a433801bc 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -78,19 +78,27 @@ GtCoderClassesTreeElement >> containsClass: aClass [ ] { #category : #initialization } -GtCoderClassesTreeElement >> contextMenuItemsFor: aClass [ - ^ {(self createLabel: 'Browse references' description: aClass name) - -> [ :elem | self browseReferencesTo: aClass ]. - (self createLabel: 'New Subclass' description: aClass name) - -> [ :elem | self newSubclassOf: aClass ]. - (self createLabel: 'Rename class' description: aClass name) - -> [ :elem | self renameClass: aClass inElement: elem ]. - (self createLabel: 'Remove class' description: aClass name) - -> [ :elem | self removeClass: aClass inElement: elem ]} - , (aClass subclasses isEmpty - ifTrue: [ #() ] - ifFalse: [ {(self createLabel: 'Convert to sibling' description: aClass name) - -> [ :elem | self convertToSibling: aClass inElement: elem ]} ]) +GtCoderClassesTreeElement >> contextMenuFor: aClass in: anElement [ + | menu | + menu := BrMenuItems new. + menu + addItemLabel: (self createLabel: 'Browse references' description: aClass name) + action: [ self browseReferencesTo: aClass ]. + menu + addItemLabel: (self createLabel: 'New Subclass' description: aClass name) + action: [ self newSubclassOf: aClass ]. + menu + addItemLabel: (self createLabel: 'Rename class' description: aClass name) + action: [ self renameClass: aClass inElement: anElement ]. + menu + addItem: (BrMenuSubmenuItem new + label: (self createLabel: 'Remove class' description: aClass name); + submenu: (BrMenuExplicit new stencil: [ self removeClassSubmenuFor: aClass ])). + aClass subclasses notEmpty + ifTrue: [ menu + addItemLabel: (self createLabel: 'Convert to sibling' description: aClass name) + action: [ self convertToSibling: aClass inElement: anElement ] ]. + ^ menu ] { #category : #'private - context menu' } @@ -188,9 +196,10 @@ GtCoderClassesTreeElement >> createNodeElement [ ^ GtCoderClassesTreeItemElement new addEventHandler: self createClassDropHandler; in: [ :aWidget | - aWidget addAptitude: (BrGlamorousWithExplicitContextMenuAptitude - itemsWithAnchorActions: [ (self contextMenuItemsFor: aWidget theClass) ]) ]; - yourself. + aWidget + addAptitude: (BrGlamorousWithExplicitContextMenuAptitude + menu: [ self contextMenuFor: aWidget theClass in: aWidget ]) ]; + yourself ] { #category : #initialization } @@ -288,22 +297,48 @@ GtCoderClassesTreeElement >> onDropCompiledMethodsOnClass: anItemsDroppedEvent [ compositeChange execute ] -{ #category : #'private - context menu' } -GtCoderClassesTreeElement >> removeClass: aClass inElement: elem [ - | change button | +{ #category : #initialization } +GtCoderClassesTreeElement >> removeClassSubmenuFor: aClass [ + | element references subclasses change button | + element := BrVerticalPane new fitContent. + references := (GtPharoIndex current globalVariableReferencesTo: aClass binding) + size. + subclasses := aClass allSubclasses size. + element + addChild: ((self buildRemoveClassLabelFor: aClass) + margin: (BlInsets + top: 10 + bottom: 0 + left: 10 + right: 10)). + references > 0 + ifTrue: [ element + addChild: (BrLabel new + margin: (BlInsets left: 10 right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; + text: (references printString , ' reference' + , (references > 1 ifTrue: [ 's' ] ifFalse: [ '' ])) asRopedText) ]. + subclasses > 0 + ifTrue: [ element + addChild: (BrLabel new + margin: (BlInsets left: 10 right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; + text: (subclasses printString , ' subclass' + , (subclasses > 1 ifTrue: [ 'es' ] ifFalse: [ '' ])) asRopedText) ]. change := RBRemoveClassChange remove: aClass. - button := GtPreviewChangeButton new + button := BrButton new + aptitude: BrGlamorousButtonWithIconAptitude; + beSmallSize; + margin: (BlInsets + top: 10 + bottom: 10 + left: 10 + right: 10); icon: BrGlamorousVectorIcons remove; label: 'Remove'; - changeAction: [ change gtExecuteWithUndo ]; - changeStencil: [ GtPharoRemoveClassPreviewStencil new - classToRemove: aClass; - anElement: self; - create ]. - button - when: GtRefactoringsAppliedEvent - do: [ :anEvent | elem removeChild: anEvent currentTarget ]. - ^ elem addChild: button as: #preview + action: [ change execute ]. + element addChild: button as: #removeButton. + ^ element ] { #category : #'private - context menu' } From 2f7484bedea2f1dd9002a3632d3f75b2e699f3d7 Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 1 Apr 2025 09:43:27 -0500 Subject: [PATCH 0892/1268] [feenkcom/gtoolkit#4404] changing remove method in index to submenu --- .../GtCoderMethodsGroupedListElement.class.st | 106 +++++++++++------- 1 file changed, 68 insertions(+), 38 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index cf7534ff8..f0c389353 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -45,13 +45,45 @@ GtCoderMethodsGroupedListElement >> buildMethodItem [ beSmallSize; aptitude: BrGlamorousLabelAptitude + BrGlamorousListItemAptitude + (BrGlamorousWithExplicitContextMenuAptitude - itemsWithAnchorActions: [ (self methodListContextMenuItemsFor: (aLabel userData at: #method)) ]). + menu: [ self contextMenuFor: (aLabel userData at: #method) in: aLabel ]). aLabel addEventHandler: self createMethodDragHandler. ^ aLabel ] +{ #category : #'private - context menu' } +GtCoderMethodsGroupedListElement >> contextMenuFor: item in: anElement [ + | menu | + menu := BrMenuItems new. + menu + addItemLabel: (self createLabel: 'Browse implementors' description: item selector) + action: [ self browseImplementorsOf: item selector ]. + menu + addItemLabel: (self createLabel: 'Browse hierarachy implementors' description: item selector) + action: [ self browseHierarchyImplementorsOf: item selector ]. + menu + addItemLabel: (self createLabel: 'Browse references' description: item selector) + action: [ self browseReferencesOf: item selector ]. + menu + addItemLabel: (self createLabel: 'Browse hierarchy references' description: item selector) + action: [ self browseHierarchyReferencesOf: item selector ]. + menu + addItemLabel: (self createLabel: 'Push up method' description: item selector) + action: [ self pushUpMethod: item selector inElement: anElement ]. + menu + addItemLabel: (self createLabel: 'Push down method' description: item selector) + action: [ self pushDownMethod: item selector inElement: anElement ]. + menu + addItemLabel: (self createLabel: 'Rename message' description: item selector) + action: [ self renameMethod: item selector inElement: anElement ]. + menu + addItem: (BrMenuSubmenuItem new + label: (self createLabel: 'Remove method' description: item selector); + submenu: (BrMenuExplicit new stencil: [ self removeMethodFor: item selector ])). + ^ menu +] + { #category : #'private - insance creation' } GtCoderMethodsGroupedListElement >> createDraggedMethodItem: aDragItem [ @@ -126,26 +158,6 @@ GtCoderMethodsGroupedListElement >> methodList [ ^ methodGroups flatCollect: [ :grp | grp itemsProvider currentItems ] ] -{ #category : #'private - context menu' } -GtCoderMethodsGroupedListElement >> methodListContextMenuItemsFor: item [ - ^ {(self createLabel: 'Browse implementors' description: item selector) - -> [ :elem | self browseImplementorsOf: item selector ]. - (self createLabel: 'Browse hierarachy implementors' description: item selector) - -> [ :elem | self browseHierarchyImplementorsOf: item selector ]. - (self createLabel: 'Browse references' description: item selector) - -> [ :elem | self browseReferencesOf: item selector ]. - (self createLabel: 'Browse hierarchy references' description: item selector) - -> [ :elem | self browseHierarchyReferencesOf: item selector ]. - (self createLabel: 'Push up method' description: item selector) - -> [ :elem | self pushUpMethod: item selector inElement: elem ]. - (self createLabel: 'Push down method' description: item selector) - -> [ :elem | self pushDownMethod: item selector inElement: elem ]. - (self createLabel: 'Rename message' description: item selector) - -> [ :elem | self renameMethod: item selector inElement: elem ]. - (self createLabel: 'Remove method' description: item selector) - -> [ :elem | self removeMethod: item selector inElement: elem ]} -] - { #category : #accessing } GtCoderMethodsGroupedListElement >> navigationModel [ ^ navigationModel @@ -194,7 +206,7 @@ GtCoderMethodsGroupedListElement >> pushDownMethod: aSelector inElement: elem [ ^ self addPreviewButtonFor: refactoring to: elem - cancelSelector: #updateProtocolsList + cancelSelector: #updateMethodList ] { #category : #'private - actions' } @@ -206,26 +218,44 @@ GtCoderMethodsGroupedListElement >> pushUpMethod: aSelector inElement: elem [ ^ self addPreviewButtonFor: refactoring to: elem - cancelSelector: #updateProtocolsList + cancelSelector: #updateMethodList ] -{ #category : #'private - actions' } -GtCoderMethodsGroupedListElement >> removeMethod: aSelector inElement: elem [ - | change button | +{ #category : #'private - context menu' } +GtCoderMethodsGroupedListElement >> removeMethodFor: aSelector [ + | element references change button | + element := BrVerticalPane new fitContent. + references := (GtPharoIndex current sendersOf: aSelector) size. + element + addChild: (BrLabel new + margin: (BlInsets + top: 10 + bottom: 0 + left: 10 + right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont; + text: ('Remove ' , aSelector) asRopedText). + references > 0 + ifTrue: [ element + addChild: (BrLabel new + margin: (BlInsets left: 10 right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; + text: (references printString , ' reference' + , (references > 1 ifTrue: [ 's' ] ifFalse: [ '' ])) asRopedText) ]. change := RBRemoveMethodChange remove: aSelector from: self selectedClass. - button := GtPreviewChangeButton new + button := BrButton new + aptitude: BrGlamorousButtonWithIconAptitude; + beSmallSize; + margin: (BlInsets + top: 10 + bottom: 10 + left: 10 + right: 10); icon: BrGlamorousVectorIcons remove; label: 'Remove'; - changeAction: [ change gtExecuteWithUndo ]; - changeStencil: [ GtPharoRemoveMethodPreviewStencil new - selectorToRemove: aSelector; - isEmptyMethod: false; - anElement: self; - create ]. - button - when: GtRefactoringsAppliedEvent - do: [ :anEvent | elem removeChild: anEvent currentTarget ]. - ^ elem addChild: button as: #preview + action: [ change execute ]. + element addChild: button as: #removeButton. + ^ element ] { #category : #'private - actions' } @@ -248,7 +278,7 @@ GtCoderMethodsGroupedListElement >> renameMethod: aSelector inElement: elem [ self addPreviewButtonFor: refactoring to: elem - cancelSelector: #updateProtocolsList ]; + cancelSelector: #updateMethodList ]; switchToEditor. edit requestFocus. elem removeChildren. From 25a3c50eaa25c58b0da82c2df450da629ffadaf4 Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Wed, 2 Apr 2025 07:31:05 +0200 Subject: [PATCH 0893/1268] Use lower case for New Subclass refactoring --- src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index a433801bc..c400c317d 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -85,7 +85,7 @@ GtCoderClassesTreeElement >> contextMenuFor: aClass in: anElement [ addItemLabel: (self createLabel: 'Browse references' description: aClass name) action: [ self browseReferencesTo: aClass ]. menu - addItemLabel: (self createLabel: 'New Subclass' description: aClass name) + addItemLabel: (self createLabel: 'New subclass' description: aClass name) action: [ self newSubclassOf: aClass ]. menu addItemLabel: (self createLabel: 'Rename class' description: aClass name) From dc32c72602b986ba4ac5e6bdb9a5440ffc26607d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Wed, 2 Apr 2025 11:24:37 +0200 Subject: [PATCH 0894/1268] Do not attempt to update the execution result in case of syntax errors [feenkcom/gtoolkit#4363] --- src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st index 24b035956..678bf142f 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st @@ -171,6 +171,10 @@ GtSourceCoderViewModel >> doItAndGoAsynchronousInContext: aGtSourceCoderEvaluati executionResult := self coder doItAndGoInContext: aGtSourceCoderEvaluationContext. + executionResult isSyntaxError ifTrue: [ + "No update needed in case the result is a syntax error." + ^ executionResult ]. + self updatWithAsyncExecution: executionResult value. ^ executionResult @@ -221,6 +225,10 @@ GtSourceCoderViewModel >> doItAsynchronousInContext: aGtSourceCoderEvaluationCon executionResult := self coder doItInContext: aGtSourceCoderEvaluationContext. + executionResult isSyntaxError ifTrue: [ + "No update needed in case the result is a syntax error." + ^ executionResult ]. + self updatWithAsyncExecution: executionResult value. ^ executionResult From 36b1f56efd126421526237c191f0094cb2742d7e Mon Sep 17 00:00:00 2001 From: John Brant Date: Thu, 3 Apr 2025 09:48:09 -0500 Subject: [PATCH 0895/1268] [feenkcom/gtoolkit#4411][feenkcom/gtoolkit#4413] adding renaming items to submenus and allow convert to sibling (extract superclass) for classes with no subclasses --- .../GtCoderClassesTreeElement.class.st | 228 +++++++----------- .../GtCoderMethodsGroupedListElement.class.st | 69 +++--- .../GtCoderPackagesTreeElement.class.st | 182 ++++++++------ 3 files changed, 226 insertions(+), 253 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index c400c317d..7a81bea7b 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -78,7 +78,7 @@ GtCoderClassesTreeElement >> containsClass: aClass [ ] { #category : #initialization } -GtCoderClassesTreeElement >> contextMenuFor: aClass in: anElement [ +GtCoderClassesTreeElement >> contextMenuFor: aClass [ | menu | menu := BrMenuItems new. menu @@ -88,87 +88,40 @@ GtCoderClassesTreeElement >> contextMenuFor: aClass in: anElement [ addItemLabel: (self createLabel: 'New subclass' description: aClass name) action: [ self newSubclassOf: aClass ]. menu - addItemLabel: (self createLabel: 'Rename class' description: aClass name) - action: [ self renameClass: aClass inElement: anElement ]. + addItem: (BrMenuSubmenuItem new + label: (self createLabel: 'Rename class' description: aClass name); + submenu: (self renameClassSubmenuFor: aClass)). menu addItem: (BrMenuSubmenuItem new label: (self createLabel: 'Remove class' description: aClass name); - submenu: (BrMenuExplicit new stencil: [ self removeClassSubmenuFor: aClass ])). - aClass subclasses notEmpty - ifTrue: [ menu - addItemLabel: (self createLabel: 'Convert to sibling' description: aClass name) - action: [ self convertToSibling: aClass inElement: anElement ] ]. + submenu: (self removeClassSubmenuFor: aClass)). + menu + addItem: (BrMenuSubmenuItem new + label: (self + createLabel: (aClass subclasses notEmpty + ifTrue: [ 'Convert to sibling' ] + ifFalse: [ 'Extract superclass' ]) + description: aClass name); + submenu: (self convertToSiblingSubmenuFor: aClass)). ^ menu ] -{ #category : #'private - context menu' } -GtCoderClassesTreeElement >> convertToSibling: aClass inElement: elem [ - | refactoring label refactoringButton edit acceptButton | - refactoringButton := GtRefactoringsWithInputPreviewElement new. - refactoringButton cancelBlock: [ ]. - edit := BrHorizontalPane new. - edit padding: (BlInsets all: 10). - edit fitContent. - edit - addChild: (BrLabel new - fitContent; - aptitude: BrGlamorousLabelAptitude; - text: 'Superclass:'). - label := BrEditableLabel new. - label - aptitude: (BrGlamorousEditableLabelAptitude new - fontSize: 11.9; - background: Color transparent); - text: 'NewClass'; - focused: true; - when: BrEditorCancelWish - do: [ :wish | - refactoringButton previewButton fireEvent: BrDropdownHideWish new. - refactoringButton removeFromParent ]; - when: BrEditorAcceptWish - do: [ :aWish | - acceptButton removeFromParent. - edit - padding: (BlInsets - top: 10 - bottom: 0 - left: 10 - right: 10). - refactoring := RBChildrenToSiblingsRefactoring - name: aWish text asString +{ #category : #initialization } +GtCoderClassesTreeElement >> convertToSiblingSubmenuFor: aClass [ + | submenu | + submenu := BrMenuExplicit new. + submenu + stencil: [ GtRefactoringsWithInputPreviewElement + elementForRefactoring: [ :each | + GtChildrenToSiblingsRefactoring + name: each class: aClass - subclasses: aClass subclasses. - refactoringButton refactorings: [ {refactoring} ]. - label switchToLabel ]; - switchToEditor. - label viewModel - when: BrEditorModeChanged - do: [ :event | - event mode isEditable - ifTrue: [ edit padding: (BlInsets all: 10). - refactoringButton refactorings: [ #() ]. - edit addChild: acceptButton ] - ifFalse: [ refactoring - ifNotNil: [ refactoringButton refactorings: [ {refactoring} ]. - acceptButton removeFromParent ] ] ]. - edit addChild: label. - acceptButton := BrButton new - aptitude: BrGlamorousButtonWithIconAptitude new; - id: GtRefactoringsPreviewAcceptId; - icon: BrGlamorousVectorIcons accept; - beSmallSize; - requestFocus; - label: 'Save'; - margin: (BlInsets - top: 0 - left: 10 - bottom: 10 - right: 0); - action: [ label acceptEdition ]. - edit addChild: acceptButton. - refactoringButton editorElement: edit. - refactoringButton enqueueTask: [ refactoringButton openPreview ] asBlTask. - elem addChild: refactoringButton as: #refactoringButton + subclasses: aClass subclasses ] + labeled: 'Superclass: ' + initialValue: 'NewClass' + from: self + whenFinished: [ submenu hideAll ] ]. + ^ submenu ] { #category : #'private - drag and drop' } @@ -198,7 +151,7 @@ GtCoderClassesTreeElement >> createNodeElement [ in: [ :aWidget | aWidget addAptitude: (BrGlamorousWithExplicitContextMenuAptitude - menu: [ self contextMenuFor: aWidget theClass in: aWidget ]) ]; + menu: [ self contextMenuFor: aWidget theClass ]) ]; yourself ] @@ -299,78 +252,61 @@ GtCoderClassesTreeElement >> onDropCompiledMethodsOnClass: anItemsDroppedEvent [ { #category : #initialization } GtCoderClassesTreeElement >> removeClassSubmenuFor: aClass [ - | element references subclasses change button | - element := BrVerticalPane new fitContent. - references := (GtPharoIndex current globalVariableReferencesTo: aClass binding) - size. - subclasses := aClass allSubclasses size. - element - addChild: ((self buildRemoveClassLabelFor: aClass) - margin: (BlInsets - top: 10 - bottom: 0 - left: 10 - right: 10)). - references > 0 - ifTrue: [ element - addChild: (BrLabel new - margin: (BlInsets left: 10 right: 10); - aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; - text: (references printString , ' reference' - , (references > 1 ifTrue: [ 's' ] ifFalse: [ '' ])) asRopedText) ]. - subclasses > 0 - ifTrue: [ element - addChild: (BrLabel new - margin: (BlInsets left: 10 right: 10); - aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; - text: (subclasses printString , ' subclass' - , (subclasses > 1 ifTrue: [ 'es' ] ifFalse: [ '' ])) asRopedText) ]. - change := RBRemoveClassChange remove: aClass. - button := BrButton new - aptitude: BrGlamorousButtonWithIconAptitude; - beSmallSize; - margin: (BlInsets - top: 10 - bottom: 10 - left: 10 - right: 10); - icon: BrGlamorousVectorIcons remove; - label: 'Remove'; - action: [ change execute ]. - element addChild: button as: #removeButton. - ^ element + ^ BrMenuExplicit new + stencil: [ | element references subclasses change button | + element := BrVerticalPane new fitContent. + references := (GtPharoIndex current + globalVariableReferencesTo: aClass binding) size. + subclasses := aClass allSubclasses size. + element + addChild: ((self buildRemoveClassLabelFor: aClass) + margin: (BlInsets + top: 10 + bottom: 0 + left: 10 + right: 10)). + references > 0 + ifTrue: [ element + addChild: (BrLabel new + margin: (BlInsets left: 10 right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; + text: (references printString , ' reference' + , (references > 1 ifTrue: [ 's' ] ifFalse: [ '' ])) asRopedText) ]. + subclasses > 0 + ifTrue: [ element + addChild: (BrLabel new + margin: (BlInsets left: 10 right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; + text: (subclasses printString , ' subclass' + , (subclasses > 1 ifTrue: [ 'es' ] ifFalse: [ '' ])) asRopedText) ]. + change := RBRemoveClassChange remove: aClass. + button := BrButton new + aptitude: BrGlamorousButtonWithIconAptitude; + beSmallSize; + margin: (BlInsets + top: 10 + bottom: 10 + left: 10 + right: 10); + icon: BrGlamorousVectorIcons remove; + label: 'Remove'; + action: [ change execute ]. + element addChild: button as: #removeButton. + element ] ] -{ #category : #'private - context menu' } -GtCoderClassesTreeElement >> renameClass: aClass inElement: elem [ - | refactoring edit childs restoreBlock | - edit := BrEditableLabel new. - childs := elem children. - restoreBlock := [ (edit parent notNil - and: [ edit parent children identityIncludes: edit ]) - ifTrue: [ elem removeChildren. - elem addChildren: childs ] ]. - edit - aptitude: (BrGlamorousEditableLabelAptitude new - fontSize: 11.9; "Force the font to match the label font" - background: Color transparent); - text: aClass name; - when: BrEditorCancelWish do: [ :wish | restoreBlock value ]; - when: BrEditorAcceptWish - do: [ :aWish | - refactoring := GtRBRenameClassRefactoring - rename: aClass name - to: aWish text asString. - edit switchToLabel. - self - addPreviewButtonFor: refactoring - to: elem - appliedBlock: restoreBlock - cancelBlock: restoreBlock ]; - switchToEditor. - edit requestFocus. - elem removeChildren. - elem addChild: edit as: #renameClassEditor +{ #category : #initialization } +GtCoderClassesTreeElement >> renameClassSubmenuFor: aClass [ + | submenu | + submenu := BrMenuExplicit new. + submenu + stencil: [ GtRefactoringsWithInputPreviewElement + elementForRefactoring: [ :each | GtRBRenameClassRefactoring rename: aClass name to: each ] + labeled: 'Rename class: ' + initialValue: aClass name + from: self + whenFinished: [ submenu hideAll ] ]. + ^ submenu ] { #category : #'api - selection' } diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index f0c389353..4340209f9 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -80,7 +80,7 @@ GtCoderMethodsGroupedListElement >> contextMenuFor: item in: anElement [ menu addItem: (BrMenuSubmenuItem new label: (self createLabel: 'Remove method' description: item selector); - submenu: (BrMenuExplicit new stencil: [ self removeMethodFor: item selector ])). + submenu: (self removeMethodSubmenuFor: item selector)). ^ menu ] @@ -222,40 +222,41 @@ GtCoderMethodsGroupedListElement >> pushUpMethod: aSelector inElement: elem [ ] { #category : #'private - context menu' } -GtCoderMethodsGroupedListElement >> removeMethodFor: aSelector [ - | element references change button | - element := BrVerticalPane new fitContent. - references := (GtPharoIndex current sendersOf: aSelector) size. - element - addChild: (BrLabel new - margin: (BlInsets - top: 10 - bottom: 0 - left: 10 - right: 10); - aptitude: BrGlamorousLabelAptitude new glamorousRegularFont; - text: ('Remove ' , aSelector) asRopedText). - references > 0 - ifTrue: [ element +GtCoderMethodsGroupedListElement >> removeMethodSubmenuFor: aSelector [ + ^ BrMenuExplicit new + stencil: [ | element references change button | + element := BrVerticalPane new fitContent. + references := (GtPharoIndex current sendersOf: aSelector) size. + element addChild: (BrLabel new - margin: (BlInsets left: 10 right: 10); - aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; - text: (references printString , ' reference' - , (references > 1 ifTrue: [ 's' ] ifFalse: [ '' ])) asRopedText) ]. - change := RBRemoveMethodChange remove: aSelector from: self selectedClass. - button := BrButton new - aptitude: BrGlamorousButtonWithIconAptitude; - beSmallSize; - margin: (BlInsets - top: 10 - bottom: 10 - left: 10 - right: 10); - icon: BrGlamorousVectorIcons remove; - label: 'Remove'; - action: [ change execute ]. - element addChild: button as: #removeButton. - ^ element + margin: (BlInsets + top: 10 + bottom: 0 + left: 10 + right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont; + text: ('Remove ' , aSelector) asRopedText). + references > 0 + ifTrue: [ element + addChild: (BrLabel new + margin: (BlInsets left: 10 right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; + text: (references printString , ' reference' + , (references > 1 ifTrue: [ 's' ] ifFalse: [ '' ])) asRopedText) ]. + change := RBRemoveMethodChange remove: aSelector from: self selectedClass. + button := BrButton new + aptitude: BrGlamorousButtonWithIconAptitude; + beSmallSize; + margin: (BlInsets + top: 10 + bottom: 10 + left: 10 + right: 10); + icon: BrGlamorousVectorIcons remove; + label: 'Remove'; + action: [ change execute ]. + element addChild: button as: #removeButton. + element ] ] { #category : #'private - actions' } diff --git a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st index 7acb9f84a..08b65cdbf 100644 --- a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st @@ -66,24 +66,26 @@ GtCoderPackagesTreeElement >> contextMenuFor: aPackageOrTag [ action: [ self newPackage ]. aPackageOrTag class == RPackage ifTrue: [ menu - addItemLabel: (self createLabel: 'Rename package' description: aPackageOrTag name) - action: [ self requestRenamePackage: aPackageOrTag ]. + addItem: (BrMenuSubmenuItem new + label: (self createLabel: 'Rename package' description: aPackageOrTag name); + submenu: (self renamePackageSubmenuFor: aPackageOrTag)). menu addItem: (BrMenuSubmenuItem new label: (self createLabel: 'Remove package' description: aPackageOrTag name); - submenu: (BrMenuExplicit new stencil: [ self removePackageSubmenuFor: aPackageOrTag ])) ] + submenu: (self removePackageSubmenuFor: aPackageOrTag)) ] ifFalse: [ menu - addItemLabel: (self createLabel: 'Rename tag' description: aPackageOrTag name) - action: [ self requestRenamePackage: aPackageOrTag ]. + addItem: (BrMenuSubmenuItem new + label: (self createLabel: 'Rename tag' description: aPackageOrTag name); + submenu: (self renamePackageTagSubmenuFor: aPackageOrTag)). menu addItem: (BrMenuSubmenuItem new label: (self createLabel: 'Remove tag' description: aPackageOrTag name); - submenu: (BrMenuExplicit new stencil: [ self removePackageTagSubmenuFor: aPackageOrTag ])) ]. + submenu: (self removePackageTagSubmenuFor: aPackageOrTag)) ]. ^ menu ] -{ #category : #'as yet unclassified' } +{ #category : #'private - context menu' } GtCoderPackagesTreeElement >> createRenamePackageForm: aPackageOrTag [ ^ GtCoderPackagesTreeRenameEditor new itemToRename: aPackageOrTag; @@ -176,7 +178,7 @@ GtCoderPackagesTreeElement >> newTagFor: aPackage inElement: elem [ self notYetImplemented ] -{ #category : #'as yet unclassified' } +{ #category : #'private - context menu' } GtCoderPackagesTreeElement >> privateEndRenamePackage [ "Removes package editing UI" @@ -192,74 +194,76 @@ GtCoderPackagesTreeElement >> promoteTag: aPackageOrTag inElement: elem [ { #category : #initialization } GtCoderPackagesTreeElement >> removePackageSubmenuFor: aPackage [ - | element definedClasses extendedClasses change button | - element := BrVerticalPane new fitContent. - definedClasses := aPackage definedClassNames size. - extendedClasses := aPackage extendedClassNames size. - element - addChild: ((self buildRemovePackageLabelFor: aPackage) - margin: (BlInsets - top: 10 - bottom: 0 - left: 10 - right: 10)). - definedClasses > 0 - ifTrue: [ element - addChild: (BrLabel new - margin: (BlInsets left: 10 right: 10); - aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; - text: (definedClasses printString , ' defined class' - , (definedClasses > 1 ifTrue: [ 'es' ] ifFalse: [ '' ])) asRopedText) ]. - extendedClasses > 0 - ifTrue: [ element - addChild: (BrLabel new - margin: (BlInsets left: 10 right: 10); - aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; - text: (extendedClasses printString , ' extended class' - , (extendedClasses > 1 ifTrue: [ 'es' ] ifFalse: [ '' ])) asRopedText) ]. - change := RBRemovePackageChange removePackageNamed: aPackage name. - button := BrButton new - aptitude: BrGlamorousButtonWithIconAptitude; - beSmallSize; - margin: (BlInsets - top: 10 - bottom: 10 - left: 10 - right: 10); - icon: BrGlamorousVectorIcons remove; - label: 'Remove'; - action: [ change execute ]. - element addChild: button as: #removeButton. - ^ element + ^ BrMenuExplicit new + stencil: [ | element definedClasses extendedClasses change button | + element := BrVerticalPane new fitContent. + definedClasses := aPackage definedClassNames size. + extendedClasses := aPackage extendedClassNames size. + element + addChild: ((self buildRemovePackageLabelFor: aPackage) + margin: (BlInsets + top: 10 + bottom: 0 + left: 10 + right: 10)). + definedClasses > 0 + ifTrue: [ element + addChild: (BrLabel new + margin: (BlInsets left: 10 right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; + text: (definedClasses printString , ' defined class' + , (definedClasses > 1 ifTrue: [ 'es' ] ifFalse: [ '' ])) asRopedText) ]. + extendedClasses > 0 + ifTrue: [ element + addChild: (BrLabel new + margin: (BlInsets left: 10 right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; + text: (extendedClasses printString , ' extended class' + , (extendedClasses > 1 ifTrue: [ 'es' ] ifFalse: [ '' ])) asRopedText) ]. + change := RBRemovePackageChange removePackageNamed: aPackage name. + button := BrButton new + aptitude: BrGlamorousButtonWithIconAptitude; + beSmallSize; + margin: (BlInsets + top: 10 + bottom: 10 + left: 10 + right: 10); + icon: BrGlamorousVectorIcons remove; + label: 'Remove'; + action: [ change execute ]. + element addChild: button as: #removeButton. + element ] ] { #category : #initialization } GtCoderPackagesTreeElement >> removePackageTagSubmenuFor: aPackageTag [ - | element change button | - element := BrVerticalPane new fitContent. - element - addChild: ((self buildRemoveTagLabelFor: aPackageTag) - margin: (BlInsets - top: 10 - bottom: 0 - left: 10 - right: 10)). - change := GtRBRemovePackageTagChange - packageName: aPackageTag package name - tagName: aPackageTag name. - button := BrButton new - aptitude: BrGlamorousButtonWithIconAptitude; - beSmallSize; - margin: (BlInsets - top: 10 - bottom: 10 - left: 10 - right: 10); - icon: BrGlamorousVectorIcons remove; - label: 'Remove'; - action: [ change execute ]. - element addChild: button as: #removeButton. - ^ element + ^ BrMenuExplicit new + stencil: [ | element change button | + element := BrVerticalPane new fitContent. + element + addChild: ((self buildRemoveTagLabelFor: aPackageTag) + margin: (BlInsets + top: 10 + bottom: 0 + left: 10 + right: 10)). + change := GtRBRemovePackageTagChange + packageName: aPackageTag package name + tagName: aPackageTag name. + button := BrButton new + aptitude: BrGlamorousButtonWithIconAptitude; + beSmallSize; + margin: (BlInsets + top: 10 + bottom: 10 + left: 10 + right: 10); + icon: BrGlamorousVectorIcons remove; + label: 'Remove'; + action: [ change execute ]. + element addChild: button as: #removeButton. + element ] ] { #category : #initialization } @@ -290,6 +294,38 @@ GtCoderPackagesTreeElement >> renamePackage: aPackage inElement: elem [ elem addChild: edit ] +{ #category : #'private - context menu' } +GtCoderPackagesTreeElement >> renamePackageSubmenuFor: aPackage [ + | submenu | + submenu := BrMenuExplicit new. + submenu + stencil: [ GtRefactoringsWithInputPreviewElement + elementForRefactoring: [ :each | GtRBRenamePackageRefactoring from: aPackage name to: each ] + labeled: 'Rename package: ' + initialValue: aPackage name + from: self + whenFinished: [ submenu hideAll ] ]. + ^ submenu +] + +{ #category : #'private - context menu' } +GtCoderPackagesTreeElement >> renamePackageTagSubmenuFor: aPackageTag [ + | submenu | + submenu := BrMenuExplicit new. + submenu + stencil: [ GtRefactoringsWithInputPreviewElement + elementForRefactoring: [ :each | + GtRBRenamePackageTagRefactoring + packageName: aPackageTag packageName + from: aPackageTag name + to: each ] + labeled: 'Rename tag: ' + initialValue: aPackageTag name + from: self + whenFinished: [ submenu hideAll ] ]. + ^ submenu +] + { #category : #initialization } GtCoderPackagesTreeElement >> renameTag: aPackageOrTag inElement: elem [ | refactoring edit childs | @@ -319,7 +355,7 @@ GtCoderPackagesTreeElement >> renameTag: aPackageOrTag inElement: elem [ elem addChild: edit ] -{ #category : #'as yet unclassified' } +{ #category : #'private - context menu' } GtCoderPackagesTreeElement >> requestRenamePackage: aPackageOrTag [ "An entrance point to the rename package action. Presents a UI to rename a given package" From 2e674cff2b9289084e0ecf0a787dea62cfe836bd Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Thu, 3 Apr 2025 18:44:59 +0200 Subject: [PATCH 0896/1268] add coder as a default tool for a class description feenkcom/gtoolkit#4310 --- src/GToolkit-Coder/ClassDescription.extension.st | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/GToolkit-Coder/ClassDescription.extension.st b/src/GToolkit-Coder/ClassDescription.extension.st index c7ee1dafc..0e9e8eda9 100644 --- a/src/GToolkit-Coder/ClassDescription.extension.st +++ b/src/GToolkit-Coder/ClassDescription.extension.st @@ -1,5 +1,12 @@ Extension { #name : #ClassDescription } +{ #category : #'*GToolkit-Coder' } +ClassDescription >> gtDefaultInspectorTool [ + ^ GtPhlowCompositeTool new + addTool: (GtClassCoderTool forClass: self); + addTool: super gtDefaultInspectorTool +] + { #category : #'*GToolkit-Coder' } ClassDescription >> gtPackageScope [ ^ self package From d9882020f8857fee89226c0c0a4527aef5b4767b Mon Sep 17 00:00:00 2001 From: John Brant Date: Fri, 4 Apr 2025 06:56:42 -0500 Subject: [PATCH 0897/1268] [feenkcom/gtoolkit#4404] computing references in async widget --- .../GtCoderClassesTreeElement.class.st | 43 +++++++++++-------- .../GtCoderMethodsGroupedListElement.class.st | 25 +++++++---- .../GtCoderPackagesTreeElement.class.st | 43 +++++++++++-------- 3 files changed, 67 insertions(+), 44 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index 7a81bea7b..677474331 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -253,11 +253,8 @@ GtCoderClassesTreeElement >> onDropCompiledMethodsOnClass: anItemsDroppedEvent [ { #category : #initialization } GtCoderClassesTreeElement >> removeClassSubmenuFor: aClass [ ^ BrMenuExplicit new - stencil: [ | element references subclasses change button | + stencil: [ | element change button | element := BrVerticalPane new fitContent. - references := (GtPharoIndex current - globalVariableReferencesTo: aClass binding) size. - subclasses := aClass allSubclasses size. element addChild: ((self buildRemoveClassLabelFor: aClass) margin: (BlInsets @@ -265,20 +262,30 @@ GtCoderClassesTreeElement >> removeClassSubmenuFor: aClass [ bottom: 0 left: 10 right: 10)). - references > 0 - ifTrue: [ element - addChild: (BrLabel new - margin: (BlInsets left: 10 right: 10); - aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; - text: (references printString , ' reference' - , (references > 1 ifTrue: [ 's' ] ifFalse: [ '' ])) asRopedText) ]. - subclasses > 0 - ifTrue: [ element - addChild: (BrLabel new - margin: (BlInsets left: 10 right: 10); - aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; - text: (subclasses printString , ' subclass' - , (subclasses > 1 ifTrue: [ 'es' ] ifFalse: [ '' ])) asRopedText) ]. + element + addChild: (BrAsyncWidget new + fitContent; + stencil: [ | pane references subclasses | + references := (GtPharoIndex current + globalVariableReferencesTo: aClass binding) size. + subclasses := aClass allSubclasses size. + pane := BrVerticalPane new. + pane fitContent. + references > 0 + ifTrue: [ pane + addChild: (BrLabel new + margin: (BlInsets left: 10 right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; + text: (references printString , ' reference' + , (references > 1 ifTrue: [ 's' ] ifFalse: [ '' ])) asRopedText) ]. + subclasses > 0 + ifTrue: [ pane + addChild: (BrLabel new + margin: (BlInsets left: 10 right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; + text: (subclasses printString , ' subclass' + , (subclasses > 1 ifTrue: [ 'es' ] ifFalse: [ '' ])) asRopedText) ]. + pane ]). change := RBRemoveClassChange remove: aClass. button := BrButton new aptitude: BrGlamorousButtonWithIconAptitude; diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index 4340209f9..3f8efdcd6 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -224,9 +224,8 @@ GtCoderMethodsGroupedListElement >> pushUpMethod: aSelector inElement: elem [ { #category : #'private - context menu' } GtCoderMethodsGroupedListElement >> removeMethodSubmenuFor: aSelector [ ^ BrMenuExplicit new - stencil: [ | element references change button | + stencil: [ | element change button | element := BrVerticalPane new fitContent. - references := (GtPharoIndex current sendersOf: aSelector) size. element addChild: (BrLabel new margin: (BlInsets @@ -236,13 +235,21 @@ GtCoderMethodsGroupedListElement >> removeMethodSubmenuFor: aSelector [ right: 10); aptitude: BrGlamorousLabelAptitude new glamorousRegularFont; text: ('Remove ' , aSelector) asRopedText). - references > 0 - ifTrue: [ element - addChild: (BrLabel new - margin: (BlInsets left: 10 right: 10); - aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; - text: (references printString , ' reference' - , (references > 1 ifTrue: [ 's' ] ifFalse: [ '' ])) asRopedText) ]. + element + addChild: (BrAsyncWidget new + fitContent; + stencil: [ | pane references | + pane := BrVerticalPane new. + pane fitContent. + references := (GtPharoIndex current sendersOf: aSelector) size. + references > 0 + ifTrue: [ pane + addChild: (BrLabel new + margin: (BlInsets left: 10 right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; + text: (references printString , ' reference' + , (references > 1 ifTrue: [ 's' ] ifFalse: [ '' ])) asRopedText) ]. + pane ]). change := RBRemoveMethodChange remove: aSelector from: self selectedClass. button := BrButton new aptitude: BrGlamorousButtonWithIconAptitude; diff --git a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st index 08b65cdbf..43dc4df46 100644 --- a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st @@ -195,10 +195,8 @@ GtCoderPackagesTreeElement >> promoteTag: aPackageOrTag inElement: elem [ { #category : #initialization } GtCoderPackagesTreeElement >> removePackageSubmenuFor: aPackage [ ^ BrMenuExplicit new - stencil: [ | element definedClasses extendedClasses change button | + stencil: [ | element change button | element := BrVerticalPane new fitContent. - definedClasses := aPackage definedClassNames size. - extendedClasses := aPackage extendedClassNames size. element addChild: ((self buildRemovePackageLabelFor: aPackage) margin: (BlInsets @@ -206,20 +204,31 @@ GtCoderPackagesTreeElement >> removePackageSubmenuFor: aPackage [ bottom: 0 left: 10 right: 10)). - definedClasses > 0 - ifTrue: [ element - addChild: (BrLabel new - margin: (BlInsets left: 10 right: 10); - aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; - text: (definedClasses printString , ' defined class' - , (definedClasses > 1 ifTrue: [ 'es' ] ifFalse: [ '' ])) asRopedText) ]. - extendedClasses > 0 - ifTrue: [ element - addChild: (BrLabel new - margin: (BlInsets left: 10 right: 10); - aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; - text: (extendedClasses printString , ' extended class' - , (extendedClasses > 1 ifTrue: [ 'es' ] ifFalse: [ '' ])) asRopedText) ]. + element + addChild: (BrAsyncWidget new + fitContent; + stencil: [ | pane definedClasses extendedClasses | + pane := BrVerticalPane new. + pane fitContent. + definedClasses := aPackage definedClassNames size. + extendedClasses := aPackage extendedClassNames size. + definedClasses > 0 + ifTrue: [ pane + addChild: (BrLabel new + margin: (BlInsets left: 10 right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; + text: (definedClasses printString , ' defined class' + , (definedClasses > 1 ifTrue: [ 'es' ] ifFalse: [ '' ])) + asRopedText) ]. + extendedClasses > 0 + ifTrue: [ pane + addChild: (BrLabel new + margin: (BlInsets left: 10 right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; + text: (extendedClasses printString , ' extended class' + , (extendedClasses > 1 ifTrue: [ 'es' ] ifFalse: [ '' ])) + asRopedText) ]. + pane ]). change := RBRemovePackageChange removePackageNamed: aPackage name. button := BrButton new aptitude: BrGlamorousButtonWithIconAptitude; From 78fda96ffab2c3125b1787a6cafeab1f7b85c0a9 Mon Sep 17 00:00:00 2001 From: John Brant Date: Fri, 4 Apr 2025 08:46:03 -0500 Subject: [PATCH 0898/1268] [feenkcom/gtoolkit#4419] update class list on change --- ...igationBasicClassHierarchyElement.class.st | 145 ++---------------- 1 file changed, 13 insertions(+), 132 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationBasicClassHierarchyElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationBasicClassHierarchyElement.class.st index bfee9955c..d97de8acb 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationBasicClassHierarchyElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationBasicClassHierarchyElement.class.st @@ -1,34 +1,9 @@ Class { #name : #GtCoderNavigationBasicClassHierarchyElement, - #superclass : #BlElement, - #instVars : [ - 'classesList', - 'navigationModel' - ], + #superclass : #GtCoderNavigationElement, #category : #'GToolkit-Coder-UI-Navigation' } -{ #category : #'api - class selections' } -GtCoderNavigationBasicClassHierarchyElement >> deselectClass: aClass [ - classesList deselectAll -] - -{ #category : #'api - class selections' } -GtCoderNavigationBasicClassHierarchyElement >> deselectClasses [ - classesList deselectAll -] - -{ #category : #'updating lists' } -GtCoderNavigationBasicClassHierarchyElement >> emptyClassList [ - classesList initializeWithClasses: #(). -] - -{ #category : #testing } -GtCoderNavigationBasicClassHierarchyElement >> hasNavigationModel [ - ^ self navigationModel isNotNil and: [ - self navigationModel isNavigationModel ] -] - { #category : #initialization } GtCoderNavigationBasicClassHierarchyElement >> headerLabel [ | label | @@ -41,39 +16,24 @@ GtCoderNavigationBasicClassHierarchyElement >> headerLabel [ ] { #category : #initialization } -GtCoderNavigationBasicClassHierarchyElement >> initialize [ +GtCoderNavigationBasicClassHierarchyElement >> initializeElement [ | pane1 | - super initialize. - - self layout: BlLinearLayout horizontal. - self constraintsDo: [ :c | - c horizontal matchParent. - c vertical matchParent ]. - - classesList := GtCoderClassesTreeElement new. - pane1 := BrVerticalPane new addAptitude: BrGlamorousWithHorizontalResizerAptitude; matchParent; - addChildren: { - self headerLabel text: 'Classes'. - classesList }. - - self addChild: pane1 -] - -{ #category : #accessing } -GtCoderNavigationBasicClassHierarchyElement >> navigationModel [ - + addChildren: {self headerLabel text: 'Classes'. + classesList}. - ^ navigationModel + self addChild: pane1 ] -{ #category : #accessing } -GtCoderNavigationBasicClassHierarchyElement >> navigationModel: aGtCoderNavigationPackagesTagsClassesModel [ - self unsubscribeFromNavigationModel. - navigationModel := aGtCoderNavigationPackagesTagsClassesModel. - self onNavigationModelChanged. +{ #category : #initialization } +GtCoderNavigationBasicClassHierarchyElement >> initializeLayout [ + self layout: BlLinearLayout horizontal. + self + constraintsDo: [ :c | + c horizontal matchParent. + c vertical matchParent ] ] { #category : #'event handling' } @@ -81,19 +41,6 @@ GtCoderNavigationBasicClassHierarchyElement >> onClassDeselected: aGtCoderNaviga self deselectClass: aGtCoderNavigationClassDeselected theClass ] -{ #category : #'event handling' } -GtCoderNavigationBasicClassHierarchyElement >> onClassListSelectionChanged [ - | anIndex aSelectedItem theIndices | - - theIndices := classesList selectedIndices. - theIndices ifEmpty: [ ^ self ]. - anIndex := theIndices first. - (anIndex between: 1 and: classesList viewModel itemCount) - ifFalse: [ ^ self ]. - aSelectedItem := (classesList viewModel itemAt: anIndex) value rootClass. - self navigationModel selectClass: aSelectedItem -] - { #category : #'event handling' } GtCoderNavigationBasicClassHierarchyElement >> onClassSelected: anAnnouncement [ | aSelectedClass | @@ -106,70 +53,10 @@ GtCoderNavigationBasicClassHierarchyElement >> onClassSelected: anAnnouncement [ { #category : #'event handling' } GtCoderNavigationBasicClassHierarchyElement >> onNavigationModelChanged [ - "subclasses may perform actions on navigation model changes" - self updateContent. - self subscribeToNavigationModel. + super onNavigationModelChanged. self subscribeToClassList. ] -{ #category : #'private - selection' } -GtCoderNavigationBasicClassHierarchyElement >> scrollIndexFromPrevious: aPreviousIndex current: aNewIndex max: aNumberOfItems [ - - ^ (aPreviousIndex isZero or: [ aPreviousIndex >= aNewIndex ]) - ifTrue: [ aNewIndex - 5 max: 1 ] - ifFalse: [ aNewIndex + 5 min: aNumberOfItems ]. -] - -{ #category : #'api - class selections' } -GtCoderNavigationBasicClassHierarchyElement >> selectClass: aClass [ - | aPreviousIndex | - - aPreviousIndex := classesList selectedIndice. - classesList viewModel - indexOfSuchThat: [ :each | each rootClass = aClass ] - do: [ :aNewIndex | - classesList - selectOne: aNewIndex; - scrollToIndex: - (self - scrollIndexFromPrevious: aPreviousIndex - current: aNewIndex - max: classesList viewModel itemCount) ] -] - -{ #category : #subscriptions } -GtCoderNavigationBasicClassHierarchyElement >> subscribeToClassList [ - classesList - when: BrSelectionChanged - do: [ :anEvent | self onClassListSelectionChanged ] -] - -{ #category : #subscriptions } -GtCoderNavigationBasicClassHierarchyElement >> subscribeToNavigationModel [ - | subscriptions | - - self hasNavigationModel - ifFalse: [ ^ self ]. - - subscriptions := { - GtCoderNavigationClassSelected -> #onClassSelected:. - GtCoderNavigationClassDeselected -> #onClassDeselected: - }. - - subscriptions - do: [ :sub | - navigationModel weak - when: sub key - send: sub value - to: self ] -] - -{ #category : #subscriptions } -GtCoderNavigationBasicClassHierarchyElement >> unsubscribeFromNavigationModel [ - self hasNavigationModel ifFalse: [ ^ self ]. - navigationModel ifNotNil: [ :aModel | aModel unsubscribe: self ]. -] - { #category : #'updating lists' } GtCoderNavigationBasicClassHierarchyElement >> updateClassList [ self hasNavigationModel ifFalse: [ ^ self ]. @@ -188,9 +75,3 @@ GtCoderNavigationBasicClassHierarchyElement >> updateContent [ self updateClassList. self updateSelectedClass ] - -{ #category : #'updating lists' } -GtCoderNavigationBasicClassHierarchyElement >> updateSelectedClass [ - self hasNavigationModel ifFalse: [ ^ self ]. - navigationModel selectedClassDo: [ :aClass | self selectClass: aClass ] -] From 8e7307070ef91ae0c58a3f14ef0a6a853ce2cbed Mon Sep 17 00:00:00 2001 From: John Brant Date: Fri, 4 Apr 2025 09:15:26 -0500 Subject: [PATCH 0899/1268] [feenkcom/gtoolkit#4417] close menu before removing --- .../GtCoderClassesTreeElement.class.st | 7 +++++-- .../GtCoderMethodsGroupedListElement.class.st | 7 +++++-- .../GtCoderPackagesTreeElement.class.st | 14 ++++++++++---- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index 677474331..9e9eb6d31 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -252,7 +252,9 @@ GtCoderClassesTreeElement >> onDropCompiledMethodsOnClass: anItemsDroppedEvent [ { #category : #initialization } GtCoderClassesTreeElement >> removeClassSubmenuFor: aClass [ - ^ BrMenuExplicit new + | submenu | + submenu := BrMenuExplicit new. + ^ submenu stencil: [ | element change button | element := BrVerticalPane new fitContent. element @@ -297,7 +299,8 @@ GtCoderClassesTreeElement >> removeClassSubmenuFor: aClass [ right: 10); icon: BrGlamorousVectorIcons remove; label: 'Remove'; - action: [ change execute ]. + action: [ submenu hideAll. + change execute ]. element addChild: button as: #removeButton. element ] ] diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index 3f8efdcd6..f4f6e1f89 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -223,7 +223,9 @@ GtCoderMethodsGroupedListElement >> pushUpMethod: aSelector inElement: elem [ { #category : #'private - context menu' } GtCoderMethodsGroupedListElement >> removeMethodSubmenuFor: aSelector [ - ^ BrMenuExplicit new + | submenu | + submenu := BrMenuExplicit new. + ^ submenu stencil: [ | element change button | element := BrVerticalPane new fitContent. element @@ -261,7 +263,8 @@ GtCoderMethodsGroupedListElement >> removeMethodSubmenuFor: aSelector [ right: 10); icon: BrGlamorousVectorIcons remove; label: 'Remove'; - action: [ change execute ]. + action: [ submenu hideAll. + change execute ]. element addChild: button as: #removeButton. element ] ] diff --git a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st index 43dc4df46..5d0bdd68d 100644 --- a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st @@ -194,7 +194,9 @@ GtCoderPackagesTreeElement >> promoteTag: aPackageOrTag inElement: elem [ { #category : #initialization } GtCoderPackagesTreeElement >> removePackageSubmenuFor: aPackage [ - ^ BrMenuExplicit new + | submenu | + submenu := BrMenuExplicit new. + ^ submenu stencil: [ | element change button | element := BrVerticalPane new fitContent. element @@ -240,14 +242,17 @@ GtCoderPackagesTreeElement >> removePackageSubmenuFor: aPackage [ right: 10); icon: BrGlamorousVectorIcons remove; label: 'Remove'; - action: [ change execute ]. + action: [ submenu hideAll. + change execute ]. element addChild: button as: #removeButton. element ] ] { #category : #initialization } GtCoderPackagesTreeElement >> removePackageTagSubmenuFor: aPackageTag [ - ^ BrMenuExplicit new + | submenu | + submenu := BrMenuExplicit new. + ^ submenu stencil: [ | element change button | element := BrVerticalPane new fitContent. element @@ -270,7 +275,8 @@ GtCoderPackagesTreeElement >> removePackageTagSubmenuFor: aPackageTag [ right: 10); icon: BrGlamorousVectorIcons remove; label: 'Remove'; - action: [ change execute ]. + action: [ submenu hideAll. + change execute ]. element addChild: button as: #removeButton. element ] ] From 107d69fcad842e03573b61be3287e7e3b58b38dd Mon Sep 17 00:00:00 2001 From: John Brant Date: Fri, 4 Apr 2025 10:12:33 -0500 Subject: [PATCH 0900/1268] [feenkcom/gtoolkit#4417] close menu before running refactorings --- src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st | 4 ++-- src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index 9e9eb6d31..2dd4c0821 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -120,7 +120,7 @@ GtCoderClassesTreeElement >> convertToSiblingSubmenuFor: aClass [ labeled: 'Superclass: ' initialValue: 'NewClass' from: self - whenFinished: [ submenu hideAll ] ]. + beforeApplyingDo: [ submenu hideAll ] ]. ^ submenu ] @@ -315,7 +315,7 @@ GtCoderClassesTreeElement >> renameClassSubmenuFor: aClass [ labeled: 'Rename class: ' initialValue: aClass name from: self - whenFinished: [ submenu hideAll ] ]. + beforeApplyingDo: [ submenu hideAll ] ]. ^ submenu ] diff --git a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st index 5d0bdd68d..cb14df673 100644 --- a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st @@ -319,7 +319,7 @@ GtCoderPackagesTreeElement >> renamePackageSubmenuFor: aPackage [ labeled: 'Rename package: ' initialValue: aPackage name from: self - whenFinished: [ submenu hideAll ] ]. + beforeApplyingDo: [ submenu hideAll ] ]. ^ submenu ] @@ -337,7 +337,7 @@ GtCoderPackagesTreeElement >> renamePackageTagSubmenuFor: aPackageTag [ labeled: 'Rename tag: ' initialValue: aPackageTag name from: self - whenFinished: [ submenu hideAll ] ]. + beforeApplyingDo: [ submenu hideAll ] ]. ^ submenu ] From 99d14aa4538e2584f2581fca9aa3a150ed591f27 Mon Sep 17 00:00:00 2001 From: John Brant Date: Fri, 4 Apr 2025 16:20:21 -0500 Subject: [PATCH 0901/1268] [feenkcom/gtoolkit#4419] don't recompute class hierarchy on selection changed --- ...igationBasicClassHierarchyElement.class.st | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationBasicClassHierarchyElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationBasicClassHierarchyElement.class.st index d97de8acb..0293ae999 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationBasicClassHierarchyElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationBasicClassHierarchyElement.class.st @@ -41,6 +41,19 @@ GtCoderNavigationBasicClassHierarchyElement >> onClassDeselected: aGtCoderNaviga self deselectClass: aGtCoderNavigationClassDeselected theClass ] +{ #category : #'event handling' } +GtCoderNavigationBasicClassHierarchyElement >> onClassListSelectionChanged [ + | anIndex aSelectedItem theIndices | + supressListChanges ifTrue: [ ^ self ]. + theIndices := classesList selectedIndices. + theIndices ifEmpty: [ ^ self ]. + anIndex := theIndices first. + (anIndex between: 1 and: classesList viewModel itemCount) ifFalse: [ ^ self ]. + aSelectedItem := (classesList viewModel itemAt: anIndex) value rootClass. + self + suppressListChangeEventsDuring: [ self navigationModel selectClass: aSelectedItem ] +] + { #category : #'event handling' } GtCoderNavigationBasicClassHierarchyElement >> onClassSelected: anAnnouncement [ | aSelectedClass | @@ -51,6 +64,12 @@ GtCoderNavigationBasicClassHierarchyElement >> onClassSelected: anAnnouncement [ self selectClass: aSelectedClass ] +{ #category : #'event handling' } +GtCoderNavigationBasicClassHierarchyElement >> onClassesToShowChanged: anAnnouncement [ + supressListChanges ifTrue: [ ^ self ]. + self inUIProcessDo: [ self updateClassList ] +] + { #category : #'event handling' } GtCoderNavigationBasicClassHierarchyElement >> onNavigationModelChanged [ super onNavigationModelChanged. From 681d3aa15d05943ebb01a07689c2cda7b43deac2 Mon Sep 17 00:00:00 2001 From: John Brant Date: Mon, 7 Apr 2025 05:42:41 -0500 Subject: [PATCH 0902/1268] [feenkcom/gtoolkit#4411] allow extract superclass to be performed on classes with subclasses --- .../GtCoderClassesTreeElement.class.st | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index 2dd4c0821..c193cbab5 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -95,19 +95,20 @@ GtCoderClassesTreeElement >> contextMenuFor: aClass [ addItem: (BrMenuSubmenuItem new label: (self createLabel: 'Remove class' description: aClass name); submenu: (self removeClassSubmenuFor: aClass)). + aClass subclasses notEmpty + ifTrue: [ menu + addItem: (BrMenuSubmenuItem new + label: (self createLabel: 'Convert to sibling' description: aClass name); + submenu: (self convertToSiblingSubmenuFor: aClass siblings: aClass subclasses)) ]. menu addItem: (BrMenuSubmenuItem new - label: (self - createLabel: (aClass subclasses notEmpty - ifTrue: [ 'Convert to sibling' ] - ifFalse: [ 'Extract superclass' ]) - description: aClass name); - submenu: (self convertToSiblingSubmenuFor: aClass)). + label: (self createLabel: 'Extract superclass' description: aClass name); + submenu: (self convertToSiblingSubmenuFor: aClass siblings: #())). ^ menu ] { #category : #initialization } -GtCoderClassesTreeElement >> convertToSiblingSubmenuFor: aClass [ +GtCoderClassesTreeElement >> convertToSiblingSubmenuFor: aClass siblings: aCollection [ | submenu | submenu := BrMenuExplicit new. submenu @@ -116,7 +117,7 @@ GtCoderClassesTreeElement >> convertToSiblingSubmenuFor: aClass [ GtChildrenToSiblingsRefactoring name: each class: aClass - subclasses: aClass subclasses ] + subclasses: aCollection ] labeled: 'Superclass: ' initialValue: 'NewClass' from: self From c46498f177260a4eee39e8ee51fa0f35f88ac8aa Mon Sep 17 00:00:00 2001 From: John Brant Date: Mon, 7 Apr 2025 07:33:04 -0500 Subject: [PATCH 0903/1268] [feenkcom/gtoolkit#4413] submenu for rename method --- .../GtCoderMethodsGroupedListElement.class.st | 99 ++++++++++--------- 1 file changed, 50 insertions(+), 49 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index f4f6e1f89..3168bb207 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -69,14 +69,17 @@ GtCoderMethodsGroupedListElement >> contextMenuFor: item in: anElement [ addItemLabel: (self createLabel: 'Browse hierarchy references' description: item selector) action: [ self browseHierarchyReferencesOf: item selector ]. menu - addItemLabel: (self createLabel: 'Push up method' description: item selector) - action: [ self pushUpMethod: item selector inElement: anElement ]. + addItem: (BrMenuSubmenuItem new + label: (self createLabel: 'Push up method' description: item selector); + submenu: (self pushUpMethodSubmenuFor: item selector)). menu - addItemLabel: (self createLabel: 'Push down method' description: item selector) - action: [ self pushDownMethod: item selector inElement: anElement ]. + addItem: (BrMenuSubmenuItem new + label: (self createLabel: 'Push down method' description: item selector); + submenu: (self pushDownMethodSubmenuFor: item selector)). menu - addItemLabel: (self createLabel: 'Rename message' description: item selector) - action: [ self renameMethod: item selector inElement: anElement ]. + addItem: (BrMenuSubmenuItem new + label: (self createLabel: 'Rename message' description: item selector); + submenu: (self renameMethodSubmenuFor: item selector)). menu addItem: (BrMenuSubmenuItem new label: (self createLabel: 'Remove method' description: item selector); @@ -197,28 +200,34 @@ GtCoderMethodsGroupedListElement >> onMethodsToShowChanged: anAnnouncement [ self updateMethodList ] -{ #category : #'private - actions' } -GtCoderMethodsGroupedListElement >> pushDownMethod: aSelector inElement: elem [ - | refactoring | - refactoring := RBPushDownMethodRefactoring - pushDown: {aSelector} - from: self selectedClass. - ^ self - addPreviewButtonFor: refactoring - to: elem - cancelSelector: #updateMethodList +{ #category : #'private - context menu' } +GtCoderMethodsGroupedListElement >> pushDownMethodSubmenuFor: aSelector [ + | submenu | + submenu := BrMenuExplicit new. + submenu + stencil: [ GtRefactoringsWithInputPreviewElement + elementForRefactoring: [ RBPushDownMethodRefactoring + pushDown: {aSelector} + from: self selectedClass ] + confirmationLabeled: 'Push down ' , aSelector + from: self + beforeApplyingDo: [ submenu hideAll ] ]. + ^ submenu ] -{ #category : #'private - actions' } -GtCoderMethodsGroupedListElement >> pushUpMethod: aSelector inElement: elem [ - | refactoring | - refactoring := RBPullUpMethodRefactoring - pullUp: {aSelector} - from: self selectedClass. - ^ self - addPreviewButtonFor: refactoring - to: elem - cancelSelector: #updateMethodList +{ #category : #'private - context menu' } +GtCoderMethodsGroupedListElement >> pushUpMethodSubmenuFor: aSelector [ + | submenu | + submenu := BrMenuExplicit new. + submenu + stencil: [ GtRefactoringsWithInputPreviewElement + elementForRefactoring: [ RBPullUpMethodRefactoring + pullUp: {aSelector} + from: self selectedClass ] + confirmationLabeled: 'Pull up ' , aSelector + from: self + beforeApplyingDo: [ submenu hideAll ] ]. + ^ submenu ] { #category : #'private - context menu' } @@ -269,31 +278,23 @@ GtCoderMethodsGroupedListElement >> removeMethodSubmenuFor: aSelector [ element ] ] -{ #category : #'private - actions' } -GtCoderMethodsGroupedListElement >> renameMethod: aSelector inElement: elem [ - | refactoring edit | - edit := BrEditableLabel new. - edit - aptitude: (BrGlamorousEditableLabelAptitude new - fontSize: 11.9; "Force the font to match the label font" - background: Color transparent); - text: aSelector; - when: BrEditorAcceptWish - do: [ :aWish | - refactoring := GtRBRenameMethodRefactoring +{ #category : #'private - context menu' } +GtCoderMethodsGroupedListElement >> renameMethodSubmenuFor: aSelector [ + | submenu | + submenu := BrMenuExplicit new. + submenu + stencil: [ GtRefactoringsWithInputPreviewElement + elementForRefactoring: [ :each | + GtRBRenameMethodRefactoring renameMethod: aSelector in: self selectedClass - to: aWish text asString - permutation: (1 to: aSelector numArgs). - edit switchToLabel. - self - addPreviewButtonFor: refactoring - to: elem - cancelSelector: #updateMethodList ]; - switchToEditor. - edit requestFocus. - elem removeChildren. - elem addChild: edit + to: each + permutation: (1 to: aSelector numArgs) ] + labeled: 'Rename method: ' + initialValue: aSelector + from: self + beforeApplyingDo: [ submenu hideAll ] ]. + ^ submenu ] { #category : #accessing } From 2e600d255ee88b21a491f08929e50bebdf506af2 Mon Sep 17 00:00:00 2001 From: John Brant Date: Mon, 7 Apr 2025 08:16:12 -0500 Subject: [PATCH 0904/1268] [feenkcom/gtoolkit#4413] submenu for protocol refactorings --- ...tCoderProtocolsGroupedListElement.class.st | 124 ++++++++++++------ 1 file changed, 85 insertions(+), 39 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st index a894f30b6..2613d3e98 100644 --- a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st @@ -42,6 +42,27 @@ GtCoderProtocolsGroupedListElement >> bindProtocol: item toElement: element [ ^ element text: itemText ] +{ #category : #'private - instance creation' } +GtCoderProtocolsGroupedListElement >> contextMenuFor: aPharoProtocol [ + | menu | + menu := BrMenuItems new. + aPharoProtocol name = Protocol unclassified + ifTrue: [ menu + addItemLabel: (self createLabel: 'Auto-categorize methods' description: '') + action: [ self autoCategorizeProtocol: aPharoProtocol ] ]. + aPharoProtocol canBeRenamed + ifTrue: [ menu + addItem: (BrMenuSubmenuItem new + label: (self createLabel: 'Rename' description: aPharoProtocol name); + submenu: (self renameProtocolSubmenuFor: aPharoProtocol)) ]. + aPharoProtocol canBeRemoved + ifTrue: [ menu + addItem: (BrMenuSubmenuItem new + label: (self createLabel: 'Remove' description: aPharoProtocol name); + submenu: (self removeProtocolSubmenuFor: aPharoProtocol)) ]. + ^ menu +] + { #category : #'private - instance creation' } GtCoderProtocolsGroupedListElement >> createProtocolDropHandler [ ^ BlDropHandler new @@ -92,6 +113,7 @@ GtCoderProtocolsGroupedListElement >> createProtocolGroups [ { #category : #'private - instance creation' } GtCoderProtocolsGroupedListElement >> createProtocolLabelElement [ "An element that represents a protocol within a list of protocols" + | aLabel aLabelAptitude | aLabel := BrLabel new. @@ -104,7 +126,7 @@ GtCoderProtocolsGroupedListElement >> createProtocolLabelElement [ right: 1); add: BrGlamorousListItemAptitude; add: (BrGlamorousWithExplicitContextMenuAptitude - itemsWithAnchorActions: [ (self createProtocolListContextMenuItemsFor: (aLabel userData at: #protocol)) ]). + menu: [ self contextMenuFor: (aLabel userData at: #protocol) ]). ^ aLabel hMatchParent; @@ -115,29 +137,6 @@ GtCoderProtocolsGroupedListElement >> createProtocolLabelElement [ addEventHandler: self createProtocolDropHandler ] -{ #category : #'private - instance creation' } -GtCoderProtocolsGroupedListElement >> createProtocolListContextMenuItemsFor: aPharoProtocol [ - ^ Array - streamContents: [ :aStream | - aPharoProtocol name = Protocol unclassified - ifTrue: [ - aStream - nextPut: (self createLabel: 'Auto-categorize methods' description: '') - -> [ :elem | self autoCategorizeProtocol: aPharoProtocol ] ]. - - aPharoProtocol canBeRenamed - ifTrue: [ aStream - nextPut: (self createLabel: 'Rename ' description: aPharoProtocol name) - -> [ :elem | self requestRenameProtocol: aPharoProtocol ] ]. - - aPharoProtocol canBeRemoved - ifTrue: [ aStream - nextPut: (self createLabel: 'Remove ' description: aPharoProtocol name) - -> [ :elem | self removeProtocol: aPharoProtocol in: elem ] ]. - - ] -] - { #category : #'private - instance creation' } GtCoderProtocolsGroupedListElement >> createRenameProtocolForm: aPharoProtocol [ ^ GtCoderProtocolsGroupRenameEditor new @@ -315,24 +314,71 @@ GtCoderProtocolsGroupedListElement >> privateEndRenameProtocol [ ] { #category : #'private - refactorings' } -GtCoderProtocolsGroupedListElement >> removeProtocol: aGtPharoProtocol in: elem [ - | refactoring | - refactoring := RBRemoveProtocolChange - removeProtocolNamed: aGtPharoProtocol name - in: aGtPharoProtocol protocolClass. - refactoring execute +GtCoderProtocolsGroupedListElement >> removeProtocolSubmenuFor: aGtPharoProtocol [ + | submenu | + submenu := BrMenuExplicit new. + ^ submenu + stencil: [ | element change button | + element := BrVerticalPane new fitContent. + element + addChild: (BrLabel new + aptitude: BrGlamorousLabelAptitude new glamorousRegularFontAndSize; + text: (self createLabel: 'Remove ' description: aGtPharoProtocol name); + margin: (BlInsets + top: 10 + bottom: 0 + left: 10 + right: 10)). + element + addChild: (BrAsyncWidget new + fitContent; + stencil: [ | pane methods | + pane := BrVerticalPane new. + pane fitContent. + methods := aGtPharoProtocol methodSelectors size. + methods > 0 + ifTrue: [ pane + addChild: (BrLabel new + margin: (BlInsets left: 10 right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; + text: (methods printString , ' defined class' + , (methods > 1 ifTrue: [ 'es' ] ifFalse: [ '' ])) asRopedText) ]. + pane ]). + change := RBRemoveProtocolChange + removeProtocolNamed: aGtPharoProtocol name + in: aGtPharoProtocol protocolClass. + button := BrButton new + aptitude: BrGlamorousButtonWithIconAptitude; + beSmallSize; + margin: (BlInsets + top: 10 + bottom: 10 + left: 10 + right: 10); + icon: BrGlamorousVectorIcons remove; + label: 'Remove'; + action: [ submenu hideAll. + change execute ]. + element addChild: button as: #removeButton. + element ] ] { #category : #'private - refactorings' } -GtCoderProtocolsGroupedListElement >> requestRenameProtocol: aGtPharoProtocol [ - "An entrance point to the rename protocol action. - Presents a UI to rename a given protocol" - - protocolToRename := aGtPharoProtocol. - renamingEditor := nil. - self dispatchEvent: ((BrItemsProviderItemsChangedEvent new - viewModel: self viewModel; - isSynchronous: true)) +GtCoderProtocolsGroupedListElement >> renameProtocolSubmenuFor: aGtPharoProtocol [ + | submenu | + submenu := BrMenuExplicit new. + submenu + stencil: [ GtRefactoringsWithInputPreviewElement + elementForRefactoring: [ :each | + GtRBRenameProtocolRefactoring + renameProtocol: aGtPharoProtocol name + in: aGtPharoProtocol protocolClass + to: each ] + labeled: 'Rename protocol: ' + initialValue: aGtPharoProtocol name + from: self + beforeApplyingDo: [ submenu hideAll ] ]. + ^ submenu ] { #category : #'api - list' } From cb6b43b56756df11e163c0a2def69c1612af46d1 Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 8 Apr 2025 08:50:00 -0500 Subject: [PATCH 0905/1268] [feenkcom/gtoolkit#4413] submenu for slot refactorings --- .../GtCoderSlotsGroupedListElement.class.st | 285 ++++++++++++------ 1 file changed, 186 insertions(+), 99 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st index 41044250b..6c233bdaa 100644 --- a/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st @@ -10,6 +10,21 @@ Class { #category : #'GToolkit-Coder-UI-Navigation - Helpers' } +{ #category : #'private - context menu' } +GtCoderSlotsGroupedListElement >> abstractSubmenuFor: aString [ + | submenu | + submenu := BrMenuExplicit new. + submenu + stencil: [ GtRefactoringsWithInputPreviewElement + elementForRefactoring: [ RBAbstractInstanceVariableRefactoring + variable: aString + class: self selectedClass ] + confirmationLabeled: 'Abstract ' , aString + from: self + beforeApplyingDo: [ submenu hideAll ] ]. + ^ submenu +] + { #category : #'private - actions' } GtCoderSlotsGroupedListElement >> browseSlotReferencesFor: aString [ self phlow @@ -29,6 +44,59 @@ GtCoderSlotsGroupedListElement >> computeSlotItemText: aSlot [ ^ slotText ] +{ #category : #'private - context menu' } +GtCoderSlotsGroupedListElement >> contextMenuFor: item [ + | menu | + menu := BrMenuItems new. + menu + addItemLabel: (self createLabel: 'Browse references' description: item name) + action: [ self browseSlotReferencesFor: item name ]. + menu + addItem: (BrMenuSubmenuItem new + label: (self createLabel: 'Push up' description: item name); + submenu: (self pushUpSubmenuFor: item name)). + menu + addItem: (BrMenuSubmenuItem new + label: (self createLabel: 'Push down' description: item name); + submenu: (self pushDownSubmenuFor: item name)). + menu + addItem: (BrMenuSubmenuItem new + label: (self createLabel: 'Create accessors' description: item name); + submenu: (self createAccessorsSubmenuFor: item name)). + menu + addItem: (BrMenuSubmenuItem new + label: (self createLabel: 'Abstract' description: item name); + submenu: (self abstractSubmenuFor: item name)). + menu + addItem: (BrMenuSubmenuItem new + label: (self createLabel: 'Protect' description: item name); + submenu: (self protectSubmenuFor: item name)). + menu + addItem: (BrMenuSubmenuItem new + label: (self createLabel: 'Remove' description: item name); + submenu: (self removeSubmenuFor: item name)). + menu + addItem: (BrMenuSubmenuItem new + label: (self createLabel: 'Rename' description: item name); + submenu: (self renameSubmenuFor: item name)). + ^ menu +] + +{ #category : #'private - context menu' } +GtCoderSlotsGroupedListElement >> createAccessorsSubmenuFor: aString [ + | submenu | + submenu := BrMenuExplicit new. + submenu + stencil: [ GtRefactoringsWithInputPreviewElement + elementForRefactoring: [ RBCreateAccessorsForVariableRefactoring + instanceVariable: aString + class: self selectedClass ] + confirmationLabeled: 'Create accessors ' , aString + from: self + beforeApplyingDo: [ submenu hideAll ] ]. + ^ submenu +] + { #category : #initialization } GtCoderSlotsGroupedListElement >> createSlotGroups [ | classSlotGroup instanceGroup classVarGroup | @@ -36,24 +104,23 @@ GtCoderSlotsGroupedListElement >> createSlotGroups [ domainObject: 'instance-side slots'; stream: #() asAsyncStream; itemStencil: [ BrHorizontalPane new - aptitude: BrGlamorousListItemAptitude; + aptitude: BrGlamorousListItemAptitude; hMatchParent; vFitContent ]; itemDataBinder: [ :element :item | - | label slotText| + | label slotText | element removeChildren. label := BrLabel new hMatchParent; vFitContent; beSmallSize; aptitude: BrGlamorousLabelAptitude. - + slotText := self computeSlotItemText: item. - + label text: slotText. label - addAptitude: (BrGlamorousWithExplicitContextMenuAptitude - itemsWithAnchorActions: [ (self slotListContextMenuItemsFor: item) ]). + addAptitude: (BrGlamorousWithExplicitContextMenuAptitude menu: [ self contextMenuFor: item ]). element addChild: label ]; shouldShowWithoutItems: false. classSlotGroup := instanceGroup copy domainObject: 'class-side slots'. @@ -122,104 +189,124 @@ GtCoderSlotsGroupedListElement >> onSlotsToShowChanged: anAnnouncement [ self updateSlotList ] -{ #category : #'private - actions' } -GtCoderSlotsGroupedListElement >> renameSlot: slotName inElement: elem [ - | edit | - edit := BrEditableLabel new. - edit - aptitude: (BrGlamorousEditableLabelAptitude new - fontSize: 11.9; "Force the font to match the label font" - background: Color transparent); - text: slotName; - when: BrEditorAcceptWish - do: [ :aWish | - | refactoring | - refactoring := RBRenameInstanceVariableRefactoring - rename: slotName - to: aWish text asString - in: self selectedClass. - edit switchToLabel. - self - addPreviewButtonFor: refactoring - to: elem - cancelSelector: #updateSlotList ]; - switchToEditor. - edit requestFocus. - elem removeChildren. - elem addChild: edit +{ #category : #'private - context menu' } +GtCoderSlotsGroupedListElement >> protectSubmenuFor: aString [ + | submenu | + submenu := BrMenuExplicit new. + submenu + stencil: [ GtRefactoringsWithInputPreviewElement + elementForRefactoring: [ RBProtectInstanceVariableRefactoring + variable: aString + class: self selectedClass ] + confirmationLabeled: 'Protect ' , aString + from: self + beforeApplyingDo: [ submenu hideAll ] ]. + ^ submenu ] -{ #category : #accessing } -GtCoderSlotsGroupedListElement >> selectedClass [ - ^ navigationModel selectedClass +{ #category : #'private - context menu' } +GtCoderSlotsGroupedListElement >> pushDownSubmenuFor: aString [ + | submenu | + submenu := BrMenuExplicit new. + submenu + stencil: [ GtRefactoringsWithInputPreviewElement + elementForRefactoring: [ GtPushDownInstanceVariableRefactoring + variable: aString + class: self selectedClass ] + confirmationLabeled: 'Push down ' , aString + from: self + beforeApplyingDo: [ submenu hideAll ] ]. + ^ submenu +] + +{ #category : #'private - context menu' } +GtCoderSlotsGroupedListElement >> pushUpSubmenuFor: aString [ + | submenu | + submenu := BrMenuExplicit new. + submenu + stencil: [ GtRefactoringsWithInputPreviewElement + elementForRefactoring: [ RBPullUpInstanceVariableRefactoring + variable: aString + class: self selectedClass superclass ] + confirmationLabeled: 'Push up ' , aString + from: self + beforeApplyingDo: [ submenu hideAll ] ]. + ^ submenu +] + +{ #category : #'private - context menu' } +GtCoderSlotsGroupedListElement >> removeSubmenuFor: aString [ + | submenu | + submenu := BrMenuExplicit new. + ^ submenu + stencil: [ | element change button | + element := BrVerticalPane new fitContent. + element + addChild: (BrLabel new + margin: (BlInsets + top: 10 + bottom: 0 + left: 10 + right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont; + text: ('Remove ' , aString) asRopedText). + element + addChild: (BrAsyncWidget new + fitContent; + stencil: [ | pane references | + pane := BrVerticalPane new. + pane fitContent. + references := (GtSearchInstanceSlotReferenceFilter + forClassAndSubclasses: self selectedClass + andVariable: aString) size. + references > 0 + ifTrue: [ pane + addChild: (BrLabel new + margin: (BlInsets left: 10 right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; + text: (references printString , ' reference' + , (references > 1 ifTrue: [ 's' ] ifFalse: [ '' ])) asRopedText) ]. + pane ]). + change := RBRemoveInstanceVariableChange + remove: aString + from: self selectedClass. + button := BrButton new + aptitude: BrGlamorousButtonWithIconAptitude; + beSmallSize; + margin: (BlInsets + top: 10 + bottom: 10 + left: 10 + right: 10); + icon: BrGlamorousVectorIcons remove; + label: 'Remove'; + action: [ submenu hideAll. + change execute ]. + element addChild: button as: #removeButton. + element ] ] { #category : #'private - context menu' } -GtCoderSlotsGroupedListElement >> slotListContextMenuItemsFor: item [ - ^ {(self createLabel: 'Browse references' description: item name) - -> [ :elem | self browseSlotReferencesFor: item name ]. - (self createLabel: 'Push up' description: item name) - -> [ :elem | - | refactoring | - refactoring := RBPullUpInstanceVariableRefactoring - variable: item name - class: self selectedClass superclass. - self - addPreviewButtonFor: refactoring - to: elem - cancelSelector: #updateSlotList ]. - (self createLabel: 'Push down' description: item name) - -> [ :elem | - | refactoring | - refactoring := GtPushDownInstanceVariableRefactoring - variable: item name - class: self selectedClass. - self - addPreviewButtonFor: refactoring - to: elem - cancelSelector: #updateSlotList ]. - (self createLabel: 'Create accessors' description: item name) - -> [ :elem | - | refactoring | - refactoring := RBCreateAccessorsForVariableRefactoring - instanceVariable: item name - class: self selectedClass. - self - addPreviewButtonFor: refactoring - to: elem - cancelSelector: #updateSlotList ]. - (self createLabel: 'Abstract' description: item name) - -> [ :elem | - | refactoring | - refactoring := RBAbstractInstanceVariableRefactoring - variable: item name - class: self selectedClass. - self - addPreviewButtonFor: refactoring - to: elem - cancelSelector: #updateSlotList ]. - (self createLabel: 'Protect' description: item name) - -> [ :elem | - | refactoring | - refactoring := RBProtectInstanceVariableRefactoring - variable: item name - class: self selectedClass. - self - addPreviewButtonFor: refactoring - to: elem - cancelSelector: #updateSlotList ]. - (self createLabel: 'Remove' description: item name) - -> [ :elem | - | refactoring | - refactoring := RBRemoveInstanceVariableRefactoring - variable: item name - class: self selectedClass. - self - addPreviewButtonFor: refactoring - to: elem - cancelSelector: #updateSlotList ]. - "(self createLabel: 'Rename slot' description: item name) - -> [ :elem | self renameSlot: item name inElement: elem ]"} +GtCoderSlotsGroupedListElement >> renameSubmenuFor: aString [ + | submenu | + submenu := BrMenuExplicit new. + submenu + stencil: [ GtRefactoringsWithInputPreviewElement + elementForRefactoring: [ :each | + RBRenameInstanceVariableRefactoring + rename: aString + to: each + in: self selectedClass ] + labeled: 'Rename slot: ' + initialValue: aString + from: self + beforeApplyingDo: [ submenu hideAll ] ]. + ^ submenu +] + +{ #category : #accessing } +GtCoderSlotsGroupedListElement >> selectedClass [ + ^ navigationModel selectedClass ] { #category : #'private - subscriptions' } From 2f19b7acd45b197034811ca4f84042f6e13f3533 Mon Sep 17 00:00:00 2001 From: John Brant Date: Wed, 9 Apr 2025 05:29:55 -0500 Subject: [PATCH 0906/1268] [feenkcom/gtoolkit#4404] changing remove class label to not check for references/subclasses --- src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index c193cbab5..1d4dabc6a 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -59,12 +59,7 @@ GtCoderClassesTreeElement >> browseReferencesTo: aClass [ { #category : #initialization } GtCoderClassesTreeElement >> buildRemoveClassLabelFor: aClass [ | labelText | - labelText := (aClass isReferenced - ifTrue: [ '<1s> is referenced. Remove anyway?' ] - ifFalse: [ aClass subclasses isEmpty - ifTrue: [ 'Remove class <1s>' ] - ifFalse: [ '<1s> has subclasses. Remove anyway?' ] ]) - expandMacrosWith: aClass name. + labelText := 'Remove class ' , aClass name. ^ BrLabel new margin: (BlInsets all: 10); aptitude: BrGlamorousLabelAptitude new glamorousRegularFont; From d0d7529fcd5f761629a49d30339c7b3d81f2f4e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Fri, 11 Apr 2025 15:40:29 +0200 Subject: [PATCH 0907/1268] Set the name of the class code based on the class [feenkcom/gtoolkit#4460] --- src/GToolkit-Coder-UI/GtClassCoderTool.class.st | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtClassCoderTool.class.st b/src/GToolkit-Coder-UI/GtClassCoderTool.class.st index a69d11b29..33cc27737 100644 --- a/src/GToolkit-Coder-UI/GtClassCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtClassCoderTool.class.st @@ -17,6 +17,13 @@ GtClassCoderTool class >> observedClass: aClass [ ^ self new observedClass: aClass ] +{ #category : #'as yet unclassified' } +GtClassCoderTool >> name [ + ^ observedClass + ifNil: [super name] + ifNotNil: [ :aClass | aClass name ] +] + { #category : #converting } GtClassCoderTool >> newCoder [ ^ GtCoderElement forClass: self observedClass instanceSide From 4637887a3044859b0bdadbea14592a7a462e3d17 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Tue, 15 Apr 2025 13:03:50 +0200 Subject: [PATCH 0908/1268] [feenkcom/gtoolkit#4469] deprecate BrItemsProvider>>#itemSuchThat:do: --- src/GToolkit-Coder-UI/GtFilterItemsElement.class.st | 2 +- src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st index e2ba9ac64..c0f239ba0 100644 --- a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st @@ -364,7 +364,7 @@ GtFilterItemsElement >> onItemMouseEnterEvent: anEvent listElement: aListElement aFilter ifNil: [ ^ self ]. aListElement itemSuchThat: [ :eachItem | eachItem == aFilter ] - do: [ :anIndex | aListElement selectOne: anIndex ] + ifFound: [ :anIndex | aListElement selectOne: anIndex ] ] { #category : #'event handling' } diff --git a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st index 5cc4c62ce..91114fe2b 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st @@ -252,7 +252,7 @@ GtFilterShortListSettingsElement >> onItemMouseEnterEvent: anEvent [ listElementDo: [ :aListElement | aListElement itemSuchThat: [ :eachItem | eachItem == aFilterItem ] - do: [ :anIndex | aListElement selectOne: anIndex ] ] + ifFound: [ :anIndex | aListElement selectOne: anIndex ] ] ] { #category : #'event handling' } From 12e04591bbc42f4b9abe3c036a484c9fc0fadcee Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 15 Apr 2025 09:06:22 -0500 Subject: [PATCH 0909/1268] [feenkcom/gtoolkit#4451] allow underscores in variable names with renaming --- .../GtAbstractRenameAction.class.st | 2 +- .../GtVariableInputFilter.class.st | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 src/GToolkit-Coder-AddOns/GtVariableInputFilter.class.st diff --git a/src/GToolkit-Coder-AddOns/GtAbstractRenameAction.class.st b/src/GToolkit-Coder-AddOns/GtAbstractRenameAction.class.st index 6a706faed..8bad29565 100644 --- a/src/GToolkit-Coder-AddOns/GtAbstractRenameAction.class.st +++ b/src/GToolkit-Coder-AddOns/GtAbstractRenameAction.class.st @@ -102,7 +102,7 @@ GtAbstractRenameAction >> forText [ { #category : #'initialize-release' } GtAbstractRenameAction >> forVariableOrUnaryMessage [ validationBlock := [ :str | self validateVariable: str ]. - self filter: BrTextEditorAlphaNumericInputFilter new + self filter: GtVariableInputFilter new ] { #category : #initialization } diff --git a/src/GToolkit-Coder-AddOns/GtVariableInputFilter.class.st b/src/GToolkit-Coder-AddOns/GtVariableInputFilter.class.st new file mode 100644 index 000000000..33f748862 --- /dev/null +++ b/src/GToolkit-Coder-AddOns/GtVariableInputFilter.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtVariableInputFilter, + #superclass : #BrTextEditorInputFilter, + #category : #'GToolkit-Coder-AddOns-Inline rename' +} + +{ #category : #'as yet unclassified' } +GtVariableInputFilter >> filter: aString [ + ^ aString select: [ :each | each isAlphaNumeric or: [ each = $_ ] ] +] From cbe1b8eac27be0ae9588dec7e7f3247ae365510a Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 15 Apr 2025 13:25:50 -0400 Subject: [PATCH 0910/1268] use `BrGlamorousPopoverDefiningMethodAptitude` [feenkcom/gtoolkit#4473] --- .../BrGlamorousMenuElementBuilder.extension.st | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/GToolkit-Coder-UI/BrGlamorousMenuElementBuilder.extension.st b/src/GToolkit-Coder-UI/BrGlamorousMenuElementBuilder.extension.st index d04a4fad5..af4cdf942 100644 --- a/src/GToolkit-Coder-UI/BrGlamorousMenuElementBuilder.extension.st +++ b/src/GToolkit-Coder-UI/BrGlamorousMenuElementBuilder.extension.st @@ -8,19 +8,8 @@ BrGlamorousMenuElementBuilder >> visitTextualCoderMenu: aMenuModel [ aCoderViewModel ifNil: [ ^ nil ]. aCoderElement := aCoderViewModel asExpandedOnlyElement. - aCoderElement - hExact: 500; - vFitContentLimited; - background: aCoderElement theme default contentBackgroundColor; - addAptitude: (BrGlamorousMenuPinnableAptitude new - menuModel: aMenuModel; - withResizers; - withAllPinActions); - addAptitude: (BrMenuHideableAptitude new menuModel: aMenuModel); - addAptitude: BrMenuCommonAptitude new. - - aMenuModel id ifNotNil: [ :anId | - aCoderElement id: anId ]. + aCoderElement addAptitude: (BrGlamorousPopoverDefiningMethodAptitude new + menuModel: aMenuModel). ^ aCoderElement ] From f771d13ff92dffa1cf2ab3b4ade613dc322e0b9f Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Wed, 16 Apr 2025 11:19:11 +0200 Subject: [PATCH 0911/1268] [feenkcom/gtoolkit#4468] use Mutex instead of Monitor --- .../GtStreamingCodersViewModel.class.st | 12 ++++++------ .../GtFilteredCodersModel.class.st | 4 ++-- .../GtStreamingCodersModel.class.st | 14 +++++++------- src/GToolkit-Coder/GtCoderAnnouncer.class.st | 2 +- src/GToolkit-Coder/GtCoderModel.class.st | 2 +- src/GToolkit-Coder/GtCoderTextSource.class.st | 2 +- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModel.class.st b/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModel.class.st index 92273ffde..4daee79a2 100644 --- a/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModel.class.st +++ b/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModel.class.st @@ -5,11 +5,11 @@ Class { #classTraits : 'TGtWithStreamingCodersModel classTrait', #instVars : [ 'announcer', - 'monitor', 'coderViewModels', 'coderViewModelsStream', 'pendingCommands', - 'scrollTarget' + 'scrollTarget', + 'mutex' ], #category : #'GToolkit-Coder-StreamingCoders-UI-Coder' } @@ -29,7 +29,7 @@ GtStreamingCodersViewModel >> coderViewModelsStream [ { #category : #'api - commands' } GtStreamingCodersViewModel >> enqueueCommand: aViewModelCommand [ - monitor critical: [ + mutex critical: [ | theApplicableCoderViewModels | theApplicableCoderViewModels := OrderedCollection new. @@ -52,7 +52,7 @@ GtStreamingCodersViewModel >> hasScrollTarget [ GtStreamingCodersViewModel >> initialize [ super initialize. - monitor := Monitor new. + mutex := Mutex new. coderViewModels := AsyncSharedDictionary new. pendingCommands := OrderedCollection new. coderViewModelsStream := AsyncEmptyStream new @@ -96,7 +96,7 @@ GtStreamingCodersViewModel >> privateCoderViewModelsStream: anAsyncStream [ { #category : #'private - accessing' } GtStreamingCodersViewModel >> privateFetchCoderViewModelFor: aCoderModel [ - ^ monitor critical: [ + ^ mutex critical: [ coderViewModels at: aCoderModel ifAbsentPut: [ @@ -155,7 +155,7 @@ GtStreamingCodersViewModel >> unsubscribeFromStreamingCodersModel [ { #category : #'private - updating' } GtStreamingCodersViewModel >> updateCoderViewModelsStream [ - monitor critical: [ + mutex critical: [ self privateCoderViewModelsStream: (streamingCodersModel codersStream map: [ :eachCoder | self privateFetchCoderViewModelFor: eachCoder ]) ] ] diff --git a/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st b/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st index f713cd20e..14cfa5605 100644 --- a/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st +++ b/src/GToolkit-Coder-StreamingCoders/GtFilteredCodersModel.class.st @@ -71,7 +71,7 @@ GtFilteredCodersModel >> additionalFilters: aCollectionOfFilters [ | aNewCollection | aNewCollection := aCollectionOfFilters asArray. additionalFilters = aNewCollection ifTrue: [ ^ self ]. - monitor critical: [ + mutex critical: [ additionalFilters := aNewCollection. compositeFilter := self createCombinedFilterFor: filter @@ -118,7 +118,7 @@ GtFilteredCodersModel >> filter [ { #category : #'api - accessing' } GtFilteredCodersModel >> filter: aGtSearchFilter [ - monitor critical: [ + mutex critical: [ filter := aGtSearchFilter. compositeFilter := self createCombinedFilterFor: filter diff --git a/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersModel.class.st b/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersModel.class.st index cb9f5b87d..7513b9a83 100644 --- a/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersModel.class.st +++ b/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersModel.class.st @@ -3,10 +3,10 @@ Class { #superclass : #Object, #instVars : [ 'announcer', - 'monitor', 'coders', 'itemsStream', - 'codersStream' + 'codersStream', + 'mutex' ], #category : #'GToolkit-Coder-StreamingCoders-Coder' } @@ -36,7 +36,7 @@ GtStreamingCodersModel >> codersStream [ GtStreamingCodersModel >> initialize [ super initialize. - monitor := Monitor new. + mutex := Mutex new. coders := Dictionary new. itemsStream := AsyncEmptyStream new. codersStream := AsyncEmptyStream new @@ -59,7 +59,7 @@ GtStreamingCodersModel >> itemsStream: anAsyncStream dueTo: aReasonObject [ assert: [ itemsStream ~~ anAsyncStream ] description: [ 'Must not pass the same stream as the current one' ]. - monitor critical: [ + mutex critical: [ itemsStream := anAsyncStream cached. codersStream := itemsStream map: [ :eachItem | self newCoderFor: eachItem ] @@ -99,7 +99,7 @@ GtStreamingCodersModel >> privateAddCoderFor: aNewItem [ { #category : #'private - instance creation' } GtStreamingCodersModel >> privateFetchCoderFor: anObject [ - ^ monitor critical: [ + ^ mutex critical: [ coders at: (self newCoderCacheKeyFor: anObject) ifAbsentPut: [ self newCoderFor: anObject ] ] @@ -109,7 +109,7 @@ GtStreamingCodersModel >> privateFetchCoderFor: anObject [ GtStreamingCodersModel >> privateRemoveCoderFor: aRemovedItem [ | aRemovedCoder | - monitor critical: [ + mutex critical: [ aRemovedCoder := coders removeKey: (self newCoderCacheKeyFor: aRemovedItem) ifAbsent: [ nil ] ]. @@ -124,7 +124,7 @@ GtStreamingCodersModel >> privateSwapCodersFor: aFirstItem and: aSecondItem [ aFirstKey := self newCoderCacheKeyFor: aFirstItem. aSecondKey := self newCoderCacheKeyFor: aSecondItem. - monitor critical: [ + mutex critical: [ coders at: aFirstKey ifPresent: [ :aFirstCoder | diff --git a/src/GToolkit-Coder/GtCoderAnnouncer.class.st b/src/GToolkit-Coder/GtCoderAnnouncer.class.st index 2bc7a51ef..8df2352c0 100644 --- a/src/GToolkit-Coder/GtCoderAnnouncer.class.st +++ b/src/GToolkit-Coder/GtCoderAnnouncer.class.st @@ -20,7 +20,7 @@ GtCoderAnnouncer >> announce: anAnnouncement [ GtCoderAnnouncer >> initialize [ super initialize. - monitor := Monitor new. + monitor := Mutex new. suppressedAnnouncements := #() ] diff --git a/src/GToolkit-Coder/GtCoderModel.class.st b/src/GToolkit-Coder/GtCoderModel.class.st index fa3269ffa..1e1c092aa 100644 --- a/src/GToolkit-Coder/GtCoderModel.class.st +++ b/src/GToolkit-Coder/GtCoderModel.class.st @@ -162,7 +162,7 @@ GtCoderModel >> initialize [ super initialize. id := UniqueIdGenerator generateUniqueId. - monitor := Monitor new. + monitor := Mutex new. announcer := GtCoderAnnouncer new ] diff --git a/src/GToolkit-Coder/GtCoderTextSource.class.st b/src/GToolkit-Coder/GtCoderTextSource.class.st index 3445a0ad2..1ee9c2914 100644 --- a/src/GToolkit-Coder/GtCoderTextSource.class.st +++ b/src/GToolkit-Coder/GtCoderTextSource.class.st @@ -78,7 +78,7 @@ GtCoderTextSource >> hasSourceText [ GtCoderTextSource >> initialize [ super initialize. - monitor := Monitor new. + monitor := Mutex new. currentSourceText := nil. originalSourceText := nil ] From cef7cfbd176f1624f98092ac5d824a52fa68ae19 Mon Sep 17 00:00:00 2001 From: John Brant Date: Wed, 16 Apr 2025 08:57:52 -0500 Subject: [PATCH 0912/1268] [feenkcom/gtoolkit#4472] defer updating methods coder until refactoring changes performed --- .../GtFinishedBulkUpdateReason.class.st | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 src/GToolkit-Coder-StreamingCoders/GtFinishedBulkUpdateReason.class.st diff --git a/src/GToolkit-Coder-StreamingCoders/GtFinishedBulkUpdateReason.class.st b/src/GToolkit-Coder-StreamingCoders/GtFinishedBulkUpdateReason.class.st new file mode 100644 index 000000000..9aeb3f09a --- /dev/null +++ b/src/GToolkit-Coder-StreamingCoders/GtFinishedBulkUpdateReason.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtFinishedBulkUpdateReason, + #superclass : #GtStreamingCodersStreamChangedReason, + #category : #'GToolkit-Coder-StreamingCoders-Events' +} From af82edbdb5ecbdb015f8d103a655994ab5fa882e Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 16 Apr 2025 10:51:34 -0400 Subject: [PATCH 0913/1268] Rename some `Br*Menu*` classes to `Br*Popover*` [feenkcom/gtoolkit#4478] --- src/GToolkit-Coder-UI/Behavior.extension.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/Behavior.extension.st b/src/GToolkit-Coder-UI/Behavior.extension.st index 3533cc10c..a412fd79d 100644 --- a/src/GToolkit-Coder-UI/Behavior.extension.st +++ b/src/GToolkit-Coder-UI/Behavior.extension.st @@ -40,7 +40,7 @@ Behavior >> gtHierarchyButtonFor: anAction [ pragmaName: #gtCoderDropdownNavigation; navigationModel: aNavigationModel; asElement) background: Color white); - addAptitude: (BrGlamorousMenuPinnableAptitude new + addAptitude: (BrGlamorousPopoverPinnableAptitude new withAllPinActions; menuModel: anExplicitMenu) ] ] From d08d4b81987dd0c7d5f96162ab5fd9335fe08b7b Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 23 Apr 2025 12:34:22 -0400 Subject: [PATCH 0914/1268] handle toolbar action element creation errors [feenkcom/gtoolkit#4500] --- .../GtCoderActionsElement.class.st | 21 +++++++++++++++++++ .../GtSourceCoderActionsElement.class.st | 11 ++++++---- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st index c47e1a6d2..3dca80380 100644 --- a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st @@ -205,6 +205,27 @@ GtCoderActionsElement >> newDropButtonMenuForAction: aGtCoderAction [ yourself ] +{ #category : #'instace creation' } +GtCoderActionsElement >> newErrorButtonForAction: aGtCoderAction exception: anException [ + | aFrozenException aButton | + aFrozenException := GtSystemUtility freeze: anException. + + aButton := BrButton new + beTinySize; + aptitude: BrGlamorousButtonWithIconAndLabelAptitude; + addAptitude: (BrGlamorousWithExplicitTooltipAptitude text: anException printString); + label: 'Exception'; + icon: BrGlamorousVectorIcons debug; + action: [ :theButton | + theButton phlow + spawnObject: {aGtCoderAction. + aFrozenException} ]. + + self initializeAltClick: aGtCoderAction element: aButton. + + ^ aButton +] + { #category : #'instance creation' } GtCoderActionsElement >> newLocateDebuggerButtonForAction: aGtCoderAction [ diff --git a/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st index 13c75a007..b6c05f97e 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st @@ -15,7 +15,9 @@ Class { { #category : #private } GtSourceCoderActionsElement >> addContextToolbarActions [ contextToolbar addItems: (self textualCoderViewModel contextActions collect: [ :aGtCoderAction | - aGtCoderAction buildElementIn: self ]). + [ aGtCoderAction buildElementIn: self ] + on: Error + do: [ :anException | self newErrorButtonForAction: aGtCoderAction exception: anException ] ]). separator visibility: (contextToolbar hasItems @@ -26,11 +28,12 @@ GtSourceCoderActionsElement >> addContextToolbarActions [ { #category : #private } GtSourceCoderActionsElement >> addMainToolbarActions [ mainToolbar - addItems: - (self coderViewModel mainActions + addItems: (self coderViewModel mainActions collect: [ :aGtCoderAction | self flag: 'Temporary hack. Coder should to Phlow actions'. - aGtCoderAction buildElementIn: self ]) + [ aGtCoderAction buildElementIn: self ] + on: Error + do: [ :anException | self newErrorButtonForAction: aGtCoderAction exception: anException ] ]) ] { #category : #accessing } From d93594c3de608e89db9519275911db95e8e101ec Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 24 Apr 2025 11:24:37 -0400 Subject: [PATCH 0915/1268] an initial search text widget and support [feenkcom/gtoolkit#4504] work in progress --- .../GtTextualCoder.extension.st | 101 ++++++++++++++++++ .../GtCoderCustomAction.extension.st | 7 +- ...oderDropDownWithPreviewAction.extension.st | 9 +- .../GtSourceCoderSearchTextShortcut.class.st | 27 +++++ .../GtSourceCoderViewModel.class.st | 11 ++ ...CoderViewModelSearchTextRequested.class.st | 29 +++++ .../GtTextualCoderEditorElement.class.st | 41 ++++++- .../GtTextualCoderSearchTextSettings.class.st | 23 ++++ ...tTextualCoderSearchTextVisualizer.class.st | 62 +++++++++++ .../GtTextualCoderViewModel.class.st | 9 ++ ...llToCharacterPositionAnnouncement.class.st | 29 +++++ ...ualCoderViewModelSelectionChanged.class.st | 15 ++- 12 files changed, 357 insertions(+), 6 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderSearchTextShortcut.class.st create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderViewModelSearchTextRequested.class.st create mode 100644 src/GToolkit-Coder-UI/GtTextualCoderSearchTextSettings.class.st create mode 100644 src/GToolkit-Coder-UI/GtTextualCoderSearchTextVisualizer.class.st create mode 100644 src/GToolkit-Coder-UI/GtTextualCoderViewModelScrollToCharacterPositionAnnouncement.class.st diff --git a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st index 8fc2be05f..ebb80781c 100644 --- a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st +++ b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st @@ -71,3 +71,104 @@ GtTextualCoder >> addCopyCutPasteContextMenuAddOnsAst: anAst to: coderAddOns [ GtTextualCoder >> addExplicitContextMenu: aString block: aBlock to: coderAddOns [ ^ coderAddOns addExplicitContextMenu: aString block: aBlock ] + +{ #category : #'*GToolkit-Coder-AddOns' } +GtTextualCoder >> initializeAddOns: addOns viewModel: aCoderViewModel [ + | aStyler aWeakElement | + super initializeAddOns: addOns viewModel: aCoderViewModel. + + GtTextualCoderSearchTextSettings isEnabledInCoder ifFalse: [ ^ self ]. + + addOns addStyler: (aStyler := BrEditorSearchTextStyler new). + + addOns + addMainAction: (GtCoderCustomAction new + title: 'Search'; + stencil: [ BrButton new + aptitude: BrGlamorousButtonWithIconAptitude; + icon: BrGlamorousVectorIcons search; + id: GtMethodCoderSaveActionId; + label: 'Search'; + beTinySize; + when: BrDropdownIsHidden + do: [ :anEvent | + aStyler subtext: nil. + aCoderViewModel announce: (GtTextualCoderViewModelReadyToRestyle new). ]; + addAptitude: (BrGlamorousWithExplicitDropdownAptitude new + in: [ :theAptitude | + aCoderViewModel weak + when: GtSourceCoderViewModelSearchTextRequested + send: #show + to: theAptitude ]; + handle: [ BrButton new + aptitude: BrGlamorousButtonWithIconAptitude + - BrGlamorousButtonExteriorAptitude + - BrGlamorousButtonWithLabelTooltipAptitude2; + icon: BrGlamorousVectorIcons search; + beTinySize ] + content: [ :anExplicitMenu | + | anElement | + anElement := BrSearchTextElement new + styler: aStyler; + editorDo: [ :anEditor | anEditor requestFocus ]; + hFitContentLimited; + constraintsDo: [ :c | + c minWidth: 300. + c frame horizontal alignCenter. + c frame vertical alignCenter ]; + when: BrSearchTextPatternWish + do: [ :anEvent | + aStyler subtext: anEvent text. + aCoderViewModel announce: (GtTextualCoderViewModelReadyToRestyle new) ]; + when: BrSearchTextNextOccurenceWish + do: [ :anEvent | + aStyler nextItem. + aCoderViewModel announce: (GtTextualCoderViewModelReadyToRestyle new) ]; + when: BrSearchTextPreviousOccurenceWish + do: [ :anEvent | + aStyler previousItem. + aCoderViewModel announce: (GtTextualCoderViewModelReadyToRestyle new) ]; + when: BrSearchTextEndWish + do: [ :anEvent | + | aRange | + aRange := aStyler currentRange. + aStyler subtext: nil. + aRange ifNotNil: [ + | aSelection | + aSelection := BlCompositeSelection new select: aRange first - 1 to: aRange last. + aCoderViewModel announce: (GtTextualCoderViewModelSelectionChanged new + shouldUpdateCursor: true; + selection: aSelection; + source: aCoderViewModel) ]. + aCoderViewModel announce: (GtTextualCoderViewModelReadyToRestyle new). + aCoderViewModel announce: (GtTextualCoderViewModelFocusChanged new + focused: true; + source: aCoderViewModel). + anEvent currentTarget fireEvent: BrDropdownHideWish new ]. + aWeakElement := anElement asWeakReference. + BrFrame new + fitContentLimited; + padding: (BlInsets all: 5); + addChild: anElement ] ) ] ). + + aStyler + visualizer: (GtTextualCoderSearchTextVisualizer new + textualCoderViewModel: aCoderViewModel; + action: [ :aContext | + aWeakElement + ifNotNil: [ :aWeak | + (aWeak at: 1) + ifNotNil: [ :anElement | + BlTaskAction + enqueueElement: anElement + action: [ anElement index: aContext selectedItem total: aContext itemsCount ] ] ] ]). + + +] + +{ #category : #'*GToolkit-Coder-AddOns' } +GtTextualCoder >> initializeShortcuts: addOns [ + super initializeShortcuts: addOns. + + addOns addShortcut: GtSourceCoderSearchTextShortcut new +] diff --git a/src/GToolkit-Coder-UI/GtCoderCustomAction.extension.st b/src/GToolkit-Coder-UI/GtCoderCustomAction.extension.st index 4fc9cadb4..78847f42b 100644 --- a/src/GToolkit-Coder-UI/GtCoderCustomAction.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderCustomAction.extension.st @@ -2,5 +2,10 @@ Extension { #name : #GtCoderCustomAction } { #category : #'*GToolkit-Coder-UI' } GtCoderCustomAction >> buildElementIn: aCoderActionsElement [ - ^ stencil asStencil asElement + | anElement | + anElement := stencil asStencil asElement. + + aCoderActionsElement initializeAltClick: self element: anElement. + + ^ anElement ] diff --git a/src/GToolkit-Coder-UI/GtCoderDropDownWithPreviewAction.extension.st b/src/GToolkit-Coder-UI/GtCoderDropDownWithPreviewAction.extension.st index fe6a05499..048dbab9c 100644 --- a/src/GToolkit-Coder-UI/GtCoderDropDownWithPreviewAction.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderDropDownWithPreviewAction.extension.st @@ -2,7 +2,8 @@ Extension { #name : #GtCoderDropDownWithPreviewAction } { #category : #'*GToolkit-Coder-UI' } GtCoderDropDownWithPreviewAction >> buildElementIn: aCoderActionsElement [ - ^ GtPreviewChangeButton new + | aButton | + aButton := GtPreviewChangeButton new id: self id; icon: self icon; label: self title; @@ -10,5 +11,9 @@ GtCoderDropDownWithPreviewAction >> buildElementIn: aCoderActionsElement [ changeStencil: (self changeStencil isBlock ifTrue: [ self changeStencil asStencil arguments: {aCoderActionsElement} ] - ifFalse: [ self changeStencil ]) + ifFalse: [ self changeStencil ]). + + aCoderActionsElement initializeAltClick: self element: aButton. + + ^ aButton ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderSearchTextShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderSearchTextShortcut.class.st new file mode 100644 index 000000000..2f339d057 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderSearchTextShortcut.class.st @@ -0,0 +1,27 @@ +Class { + #name : #GtSourceCoderSearchTextShortcut, + #superclass : #GtSourceCoderShortcut, + #category : #'GToolkit-Coder-UI-Shortcuts' +} + +{ #category : #accessing } +GtSourceCoderSearchTextShortcut >> description [ + ^ 'Search text' +] + +{ #category : #initialization } +GtSourceCoderSearchTextShortcut >> initialize [ + super initialize. + + combination := BlKeyCombination primaryF +] + +{ #category : #accessing } +GtSourceCoderSearchTextShortcut >> name [ + ^ 'Search' +] + +{ #category : #evaluation } +GtSourceCoderSearchTextShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ + aSourceCoderViewModel requestSearch +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st index 678bf142f..c7fc0dd8e 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st @@ -467,6 +467,17 @@ GtSourceCoderViewModel >> requestSave [ ifFalse: [ self save ] ] +{ #category : #'api - actions' } +GtSourceCoderViewModel >> requestSearch [ + "Request the view model to start the saving process. We first send a corresponding announcement to + allow UI to intercept the saving request and show, for example, a confirmation dialog. If an announcement + was not consumed (= handled) proceed with the default save action" + | anAnnouncement | + + anAnnouncement := GtSourceCoderViewModelSearchTextRequested new textualCoderViewModel: self. + self announce: anAnnouncement. +] + { #category : #'api - actions' } GtSourceCoderViewModel >> save [ "Attempt to save the source code in a default context. For example in terms of a method, the changes would diff --git a/src/GToolkit-Coder-UI/GtSourceCoderViewModelSearchTextRequested.class.st b/src/GToolkit-Coder-UI/GtSourceCoderViewModelSearchTextRequested.class.st new file mode 100644 index 000000000..4d43eba35 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderViewModelSearchTextRequested.class.st @@ -0,0 +1,29 @@ +Class { + #name : #GtSourceCoderViewModelSearchTextRequested, + #superclass : #GtTextualCoderViewModelAnnouncement, + #instVars : [ + 'consumed' + ], + #category : #'GToolkit-Coder-UI-Coder - Source Events' +} + +{ #category : #accessing } +GtSourceCoderViewModelSearchTextRequested >> consumed [ + + + ^ consumed +] + +{ #category : #accessing } +GtSourceCoderViewModelSearchTextRequested >> consumed: aBoolean [ + "Prevents the default save action, when set to true by the event handler" + + consumed := aBoolean +] + +{ #category : #initialization } +GtSourceCoderViewModelSearchTextRequested >> initialize [ + super initialize. + + consumed := false +] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 74d67ec1f..8a9b085e8 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -291,6 +291,40 @@ GtTextualCoderEditorElement >> onRemovedFromSceneGraph [ emit ] +{ #category : #'private - event handling' } +GtTextualCoderEditorElement >> onScrollToCharacterPositionAnnouncement: anAnnouncement [ + | aStartPosition aFirstSegment aLastSegment aLineIndex aLineDistance | + aStartPosition := anAnnouncement characterPosition. + aLineIndex := anAnnouncement lineIndex. + + "Get range of visible lines and characters" + aFirstSegment := (self layout + findFirstVisibleChildClosestToStartCompletelyVisible: true + acceptPartiallyVisible: false) ifNotNil: #segment. + aLastSegment := (self layout + findFirstVisibleChildClosestToEndCompletelyVisible: true + acceptPartiallyVisible: false) ifNotNil: #segment. + + "Scroll only if the character is not visible" + (aFirstSegment isNotNil and: [ + aLastSegment isNotNil and: [ + aFirstSegment textStart >= aStartPosition and: [ + aLastSegment textEnd <= aStartPosition ] ] ]) + ifTrue: [ ^ self ]. + + "Check the distance" + (aFirstSegment isNotNil and: [ + aLastSegment isNotNil ]) + ifTrue: [ + aLineDistance := (aFirstSegment index - aLineIndex) abs + min: (aLastSegment index - aLineIndex) abs ]. + + "Scroll smoothly or jump to the position, depending on the distance." + (aLineDistance isNotNil and: [ aLineDistance < 100 ]) + ifTrue: [ self smoothScrollToPosition: aLineIndex ] + ifFalse: [ self scrollToPosition: aLineIndex ] +] + { #category : #'private - event handling' } GtTextualCoderEditorElement >> onStyleTextRequest: anEvent [ "onStyleTextRequest: may be sent from a non-UI thread" @@ -405,7 +439,9 @@ GtTextualCoderEditorElement >> onViewModelSelectionChanged: aSelectionChangedAnn self inUIProcessDo: [ self deselecter all deselect. self selecter - withoutCursorUpdate; + in: [ :aSelecter | + aSelectionChangedAnnouncement shouldUpdateCursor + ifFalse: [ aSelecter withoutCursorUpdate ] ]; all: aSelectionChangedAnnouncement selection; select ] ] @@ -581,6 +617,9 @@ GtTextualCoderEditorElement >> registerCoderViewModelAnnouncementsFor: aGtSource to: self; when: GtTextualCoderViewModelStyledTextChanged send: #onViewModelStyledTextChanged: + to: self; + when: GtTextualCoderViewModelScrollToCharacterPositionAnnouncement + send: #onScrollToCharacterPositionAnnouncement: to: self ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderSearchTextSettings.class.st b/src/GToolkit-Coder-UI/GtTextualCoderSearchTextSettings.class.st new file mode 100644 index 000000000..86681edc8 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtTextualCoderSearchTextSettings.class.st @@ -0,0 +1,23 @@ +Class { + #name : #GtTextualCoderSearchTextSettings, + #superclass : #Object, + #classVars : [ + 'IsEnabledInCoder' + ], + #category : #'GToolkit-Coder-UI-Coder - Textual Model' +} + +{ #category : #settings } +GtTextualCoderSearchTextSettings class >> disableInCoder [ + IsEnabledInCoder := false +] + +{ #category : #settings } +GtTextualCoderSearchTextSettings class >> enableInCoder [ + IsEnabledInCoder := true +] + +{ #category : #settings } +GtTextualCoderSearchTextSettings class >> isEnabledInCoder [ + ^ IsEnabledInCoder ifNil: [ false ] +] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderSearchTextVisualizer.class.st b/src/GToolkit-Coder-UI/GtTextualCoderSearchTextVisualizer.class.st new file mode 100644 index 000000000..9ab8ed9a9 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtTextualCoderSearchTextVisualizer.class.st @@ -0,0 +1,62 @@ +Class { + #name : #GtTextualCoderSearchTextVisualizer, + #superclass : #BrEditorSearchTextVisualizer, + #instVars : [ + 'textualCoderViewModel', + 'actions' + ], + #category : #'GToolkit-Coder-UI-Coder - Textual Model' +} + +{ #category : #accessing } +GtTextualCoderSearchTextVisualizer >> action: aBlock [ + "Add action this is executed on every finished styler. + The action is NOT executed in a UI process." + + actions := self actions copyWith: aBlock +] + +{ #category : #accessing } +GtTextualCoderSearchTextVisualizer >> actions [ + ^ actions ifNil: [ actions := Array empty ] +] + +{ #category : #accessing } +GtTextualCoderSearchTextVisualizer >> actions: anObject [ + actions := anObject +] + +{ #category : #'api - displaying' } +GtTextualCoderSearchTextVisualizer >> executeActionInContext: aBrEditorSearchTextVisualizerContext [ + self textualCoderViewModel ifNil: [ ^ self ]. + + self actions + do: [ :eachBlock | eachBlock cull: aBrEditorSearchTextVisualizerContext cull: self textualCoderViewModel ] +] + +{ #category : #'api - displaying' } +GtTextualCoderSearchTextVisualizer >> scrollContext: aBrEditorSearchTextVisualizerContext [ + self textualCoderViewModel ifNil: [ ^ self ]. + + self textualCoderViewModel + scrollToLine: aBrEditorSearchTextVisualizerContext selectedLine + withCharacterPosition: aBrEditorSearchTextVisualizerContext selectedStartPosition +] + +{ #category : #'api - displaying' } +GtTextualCoderSearchTextVisualizer >> selectionContext: aBrEditorSearchTextVisualizerContext [ + self textualCoderViewModel ifNil: [ ^ self ]. + + self scrollContext: aBrEditorSearchTextVisualizerContext. + self executeActionInContext: aBrEditorSearchTextVisualizerContext. +] + +{ #category : #accessing } +GtTextualCoderSearchTextVisualizer >> textualCoderViewModel [ + ^ textualCoderViewModel +] + +{ #category : #accessing } +GtTextualCoderSearchTextVisualizer >> textualCoderViewModel: anObject [ + textualCoderViewModel := anObject +] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 11d4773cb..590dd59a8 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -715,6 +715,15 @@ GtTextualCoderViewModel >> saveAttribute: folder forNode: aNode andStyler: aStyl (self nodeAttributeMapForStyler: aStyler) at: aNode put: folder ] +{ #category : #'api - scrolling' } +GtTextualCoderViewModel >> scrollToLine: aLineIndex withCharacterPosition: aCharacterPosition [ + self + announce: (GtTextualCoderViewModelScrollToCharacterPositionAnnouncement new + textualCoderViewModel: self; + lineIndex: aLineIndex; + characterPosition: aCharacterPosition) +] + { #category : #'api - selection' } GtTextualCoderViewModel >> select: aFromCursorIndex to: aToCursorIndex [ self selection: (self selection copy select: aFromCursorIndex to: aToCursorIndex) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelScrollToCharacterPositionAnnouncement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelScrollToCharacterPositionAnnouncement.class.st new file mode 100644 index 000000000..1df4f6d72 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelScrollToCharacterPositionAnnouncement.class.st @@ -0,0 +1,29 @@ +Class { + #name : #GtTextualCoderViewModelScrollToCharacterPositionAnnouncement, + #superclass : #GtTextualCoderViewModelAnnouncement, + #instVars : [ + 'characterPosition', + 'lineIndex' + ], + #category : #'GToolkit-Coder-UI-Coder - Textual Model - Events' +} + +{ #category : #accessing } +GtTextualCoderViewModelScrollToCharacterPositionAnnouncement >> characterPosition [ + ^ characterPosition +] + +{ #category : #accessing } +GtTextualCoderViewModelScrollToCharacterPositionAnnouncement >> characterPosition: anObject [ + characterPosition := anObject +] + +{ #category : #accessing } +GtTextualCoderViewModelScrollToCharacterPositionAnnouncement >> lineIndex [ + ^ lineIndex +] + +{ #category : #accessing } +GtTextualCoderViewModelScrollToCharacterPositionAnnouncement >> lineIndex: anObject [ + lineIndex := anObject +] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelSelectionChanged.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelSelectionChanged.class.st index fbdc887da..1a8cc7fc0 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelSelectionChanged.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelSelectionChanged.class.st @@ -3,9 +3,10 @@ Class { #superclass : #GtTextualCoderViewModelAnnouncement, #instVars : [ 'source', - 'selection' + 'selection', + 'shouldUpdateCursor' ], - #category : 'GToolkit-Coder-UI-Coder - Textual Model - Events' + #category : #'GToolkit-Coder-UI-Coder - Textual Model - Events' } { #category : #accessing } @@ -18,6 +19,16 @@ GtTextualCoderViewModelSelectionChanged >> selection: anObject [ selection := anObject ] +{ #category : #accessing } +GtTextualCoderViewModelSelectionChanged >> shouldUpdateCursor [ + ^ shouldUpdateCursor ifNil: [ false ] +] + +{ #category : #accessing } +GtTextualCoderViewModelSelectionChanged >> shouldUpdateCursor: aBoolean [ + shouldUpdateCursor := aBoolean +] + { #category : #accessing } GtTextualCoderViewModelSelectionChanged >> source [ ^ source From 4b89cdb3d2a3dbb7281e7f747af6574f7642c9bb Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 24 Apr 2025 16:47:53 -0500 Subject: [PATCH 0916/1268] Add smalltalkWordClassifier and examples --- .../GtSourceCoderExpandedContentElement.class.st | 1 + 1 file changed, 1 insertion(+) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st index 319844117..08762963b 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st @@ -19,6 +19,7 @@ GtSourceCoderExpandedContentElement >> initialize [ super initialize. editorElement := self newEditorElement. + editorElement editor doubleClickWordClassifier: editorElement editor smalltalkWordClassifier. actions := self newActionsElement. self From e0fee54cf2bafe8aec9e9b311689f651b52e6dcd Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Sun, 27 Apr 2025 22:33:30 -0500 Subject: [PATCH 0917/1268] Fix smalltalk word movement --- .../GtSourceCoderExpandedContentElement.class.st | 1 + 1 file changed, 1 insertion(+) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st index 08762963b..79051113f 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st @@ -20,6 +20,7 @@ GtSourceCoderExpandedContentElement >> initialize [ editorElement := self newEditorElement. editorElement editor doubleClickWordClassifier: editorElement editor smalltalkWordClassifier. + editorElement editor movementWordClassifier: editorElement editor smalltalkWordClassifier. actions := self newActionsElement. self From 4a1c6335e2e61e16d73a7a0cda1e1254d24ba5d4 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 28 Apr 2025 12:00:51 -0400 Subject: [PATCH 0918/1268] keep search text dropdown always visible [feenkcom/gtoolkit#4504] --- .../GtTextualCoder.extension.st | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st index ebb80781c..048bb2052 100644 --- a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st +++ b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st @@ -100,6 +100,18 @@ GtTextualCoder >> initializeAddOns: addOns viewModel: aCoderViewModel [ when: GtSourceCoderViewModelSearchTextRequested send: #show to: theAptitude ]; + withVisibleWidgetBoundsRelocator; + withContainerPermanentVisibilityUpdater; + menuContainerDo: [ :aContainer | + aContainer layout areaBuilders: { + BlSteppedLayoutAreaBuilder dropdownBottomRight. + BlSteppedLayoutAreaBuilder dropdownBottomLeft. + BlSteppedLayoutAreaBuilder allToBottom. + BlSteppedLayoutAreaBuilder allToRight. + BlSteppedLayoutAreaBuilder allToLeft. + BlSteppedLayoutAreaBuilder dropdownUpRight. + BlSteppedLayoutAreaBuilder dropdownUpLeft. + BlSteppedLayoutAreaBuilder allToUp.} ]; handle: [ BrButton new aptitude: BrGlamorousButtonWithIconAptitude - BrGlamorousButtonExteriorAptitude From 437e59b22c0f2ff864f1ef8b4a1c97f9f704a11a Mon Sep 17 00:00:00 2001 From: John Brant Date: Mon, 28 Apr 2025 11:36:59 -0500 Subject: [PATCH 0919/1268] [feenkcom/gtoolkit#4476] new rename method controller --- .../GtRenameEditorAttribute.class.st | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st b/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st index e989062b5..258ce3a28 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st @@ -111,8 +111,7 @@ GtRenameEditorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElem selectNone; moveCursorTo: ((cursorLocation ifNil: [ SmallInteger maxVal ]) min: renameEditor editor text size) ]. - - selectAll ifTrue: [ renameEditor editor selecter all select ]. + self selectAllOnCreate ifTrue: [ renameEditor editor selecter all select ]. ^ renameEditor ] @@ -203,6 +202,11 @@ GtRenameEditorAttribute >> selectAll: aBoolean [ selectAll := aBoolean ] +{ #category : #accessing } +GtRenameEditorAttribute >> selectAllOnCreate [ + ^self selectAll +] + { #category : #private } GtRenameEditorAttribute >> setupArrowKeysOn: anEditorElement [ renameEditor From 13c27e3cfb52123c77104dd0dc75c8c420db9736 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 29 Apr 2025 07:20:46 -0500 Subject: [PATCH 0920/1268] Refactor location of classifiers --- src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st | 7 +++++++ .../GtSourceCoderExpandedContentElement.class.st | 2 -- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st index 3bc69151b..a77327d71 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st @@ -4,6 +4,13 @@ Class { #category : #'GToolkit-Coder-UI-Coder - Source' } +{ #category : #initalization } +GtSourceCoderEditorElement >> initialize [ + super initialize. + self editor doubleClickWordClassifier: BrTextEditorModel smalltalkWordClassifier. + self editor movementWordClassifier: BrTextEditorModel smalltalkWordClassifier. +] + { #category : #'api - textual coder view model' } GtSourceCoderEditorElement >> onTextualCoderViewModelChanged [ super onTextualCoderViewModelChanged. diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st index 79051113f..319844117 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st @@ -19,8 +19,6 @@ GtSourceCoderExpandedContentElement >> initialize [ super initialize. editorElement := self newEditorElement. - editorElement editor doubleClickWordClassifier: editorElement editor smalltalkWordClassifier. - editorElement editor movementWordClassifier: editorElement editor smalltalkWordClassifier. actions := self newActionsElement. self From 01047a35cd070f6facc86cbca5b91a24176b5258 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 30 Apr 2025 08:47:28 -0500 Subject: [PATCH 0921/1268] Move classifiers to separate package --- src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st index a77327d71..214a58726 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st @@ -7,8 +7,8 @@ Class { { #category : #initalization } GtSourceCoderEditorElement >> initialize [ super initialize. - self editor doubleClickWordClassifier: BrTextEditorModel smalltalkWordClassifier. - self editor movementWordClassifier: BrTextEditorModel smalltalkWordClassifier. + self editor doubleClickWordClassifier: SmalltalkWordClassifier new. + self editor movementWordClassifier: CamelCaseWordClassifier new. ] { #category : #'api - textual coder view model' } From d7cd294b9e9fa55b0971bfcde6b64d7e4bd3d74e Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 30 Apr 2025 09:11:27 -0500 Subject: [PATCH 0922/1268] Revert "Move classifiers to separate package" This reverts commit 01047a35cd070f6facc86cbca5b91a24176b5258. --- src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st index 214a58726..a77327d71 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st @@ -7,8 +7,8 @@ Class { { #category : #initalization } GtSourceCoderEditorElement >> initialize [ super initialize. - self editor doubleClickWordClassifier: SmalltalkWordClassifier new. - self editor movementWordClassifier: CamelCaseWordClassifier new. + self editor doubleClickWordClassifier: BrTextEditorModel smalltalkWordClassifier. + self editor movementWordClassifier: BrTextEditorModel smalltalkWordClassifier. ] { #category : #'api - textual coder view model' } From 510347f613c7d2f88a1279b9d4cfda5e2b0d2b87 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 30 Apr 2025 13:02:25 -0500 Subject: [PATCH 0923/1268] Move classification into separate package --- src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st | 2 +- src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st b/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st index 550548971..c86a8dd18 100644 --- a/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st +++ b/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st @@ -71,7 +71,7 @@ BaselineOfGToolkitCoder >> baseline: spec [ package: 'GToolkit-Coder' with: [ spec requires: - #( 'Futures' 'GToolkitBasicUtility' 'GToolkitAnnouncerUtility' + #('Futures' 'GToolkitBasicUtility' 'GToolkitAnnouncerUtility' 'GToolkitPager' 'GToolkitCompleter' 'GToolkit-SearchFilters' ) ]; package: 'GToolkit-Coder-UI' with: [ spec requires: #( 'GToolkit-Coder' 'GToolkit-VariableBindings' diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st index a77327d71..214a58726 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st @@ -7,8 +7,8 @@ Class { { #category : #initalization } GtSourceCoderEditorElement >> initialize [ super initialize. - self editor doubleClickWordClassifier: BrTextEditorModel smalltalkWordClassifier. - self editor movementWordClassifier: BrTextEditorModel smalltalkWordClassifier. + self editor doubleClickWordClassifier: SmalltalkWordClassifier new. + self editor movementWordClassifier: CamelCaseWordClassifier new. ] { #category : #'api - textual coder view model' } From fa047afae9e33f5ec49383e6d9b74d4e9ed89b99 Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Thu, 1 May 2025 13:41:26 +0200 Subject: [PATCH 0924/1268] add Br prefix to classifiers feenkcom/gtoolkit#4516 --- src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st index 214a58726..abf6d7592 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st @@ -7,8 +7,8 @@ Class { { #category : #initalization } GtSourceCoderEditorElement >> initialize [ super initialize. - self editor doubleClickWordClassifier: SmalltalkWordClassifier new. - self editor movementWordClassifier: CamelCaseWordClassifier new. + self editor doubleClickWordClassifier: BrSmalltalkWordClassifier new. + self editor movementWordClassifier: BrCamelCaseWordClassifier new. ] { #category : #'api - textual coder view model' } From 7ecf35eb031a3c543ae6f3fa88e8ad8ab278feb1 Mon Sep 17 00:00:00 2001 From: John Brant Date: Thu, 1 May 2025 10:20:10 -0500 Subject: [PATCH 0925/1268] [feenkcom/gtoolkit#4517] show suggestions for undeclared variable compiler errors --- .../GtSourceCoderErrorAttribute.class.st | 87 ++++++++++--------- .../GtSourceCoderErrorFixItAttribute.class.st | 44 ++++++++++ .../GtTextualCoderEditorElement.class.st | 60 ++++++++----- src/GToolkit-Coder/GtCoderParseError.class.st | 18 +++- src/GToolkit-Coder/GtSourceCoder.class.st | 11 +++ 5 files changed, 160 insertions(+), 60 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderErrorFixItAttribute.class.st diff --git a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st index 9c3513751..41590c077 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st @@ -18,6 +18,43 @@ GtSourceCoderErrorAttribute class >> for: aString [ yourself ] +{ #category : #accessing } +GtSourceCoderErrorAttribute >> buildPopupIn: anEditorElement aptitude: aptitude [ + | pane text textElement | + pane := BrVerticalPane new. + pane id: GtSourceCoderErrorContentElementId. + pane matchParent. + pane background: BrGlamorousColors errorBackgroundColor. + string lines + do: [ :line | + text := line asRopedText + medium; + glamorousCodeFontAndSmallSize. + textElement := BlTextElement new. + textElement text: text. + textElement padding: (BlInsets all: 10). + textElement beFocusable. + textElement + when: BlClickEvent + do: [ :event | + event currentTarget fireEvent: BrDropdownHideWish new. + clickAction cull: anEditorElement cull: aptitude ]. + {BlKeyCombination escape. + BlKeyCombination enter. + BlKeyCombination backspace} + do: [ :each | + textElement + addShortcut: (BlShortcutWithAction new + combination: each; + repeatable: false; + action: [ :aShortcutEvent :aShortcutAction | + aShortcutEvent currentTarget fireEvent: BrDropdownHideWish new. + anEditorElement requestFocus ]) ]. + textElement enqueueTask: [ textElement requestFocus ] asBlTask. + pane addChild: textElement ]. + ^ pane +] + { #category : #accessing } GtSourceCoderErrorAttribute >> clickAction [ ^ clickAction @@ -30,50 +67,17 @@ GtSourceCoderErrorAttribute >> clickAction: aBlock [ { #category : #accessing } GtSourceCoderErrorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ - | text button aptitude | + | button aptitude | button := self errorButton. button id: GtSourceCoderErrorButtonElementId. button addAptitude: (aptitude := BrGlamorousWithExplicitDropdownAptitude handle: [ self errorButton ] - content: [ | textElement pane | - pane := BrVerticalPane new. - pane id: GtSourceCoderErrorContentElementId. - pane matchParent. - pane background: BrGlamorousColors errorBackgroundColor. - string lines - do: [ :line | - text := line asRopedText - medium; - glamorousCodeFontAndSmallSize. - textElement := BlTextElement new. - textElement text: text. - textElement padding: (BlInsets all: 10). - textElement beFocusable. - textElement - when: BlClickEvent - do: [ :event | - event currentTarget fireEvent: BrDropdownHideWish new. - clickAction cull: anEditorElement cull: aptitude ]. - - {BlKeyCombination escape. - BlKeyCombination enter. - BlKeyCombination backspace} - do: [ :each | - textElement - addShortcut: (BlShortcutWithAction new - combination: each; - repeatable: false; - action: [ :aShortcutEvent :aShortcutAction | - aShortcutEvent currentTarget fireEvent: BrDropdownHideWish new. - anEditorElement requestFocus ]) ]. - textElement enqueueTask: [ textElement requestFocus ] asBlTask. - pane addChild: textElement ]. - pane ] + content: [ self buildPopupIn: anEditorElement aptitude: aptitude ] containerDo: [ :aMenuContainer | - aMenuContainer - border: (BlBorder paint: BrGlamorousColors errorBackgroundColor); - background: BrGlamorousColors errorBackgroundColor ]). + aMenuContainer border: (BlBorder paint: BrGlamorousColors errorBackgroundColor). + self showErrorBackground + ifTrue: [ aMenuContainer background: BrGlamorousColors errorBackgroundColor ] ]). openOnFirstShow ifTrue: [ button enqueueTask: [ openOnFirstShow := false. @@ -86,7 +90,7 @@ GtSourceCoderErrorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditor GtSourceCoderErrorAttribute >> errorButton [ ^ BrButton new background: BrGlamorousColors errorBackgroundColor; - size: 12 @ 12; + size: 16 @ 16; border: (BlBorder paint: Color transparent width: 2); geometry: BlEllipseGeometry new; yourself @@ -113,3 +117,8 @@ GtSourceCoderErrorAttribute >> openOnFirstShow [ GtSourceCoderErrorAttribute >> openOnFirstShow: aBoolean [ openOnFirstShow := aBoolean ] + +{ #category : #accessing } +GtSourceCoderErrorAttribute >> showErrorBackground [ + ^ true +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderErrorFixItAttribute.class.st b/src/GToolkit-Coder-UI/GtSourceCoderErrorFixItAttribute.class.st new file mode 100644 index 000000000..2aada7d35 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderErrorFixItAttribute.class.st @@ -0,0 +1,44 @@ +Class { + #name : #GtSourceCoderErrorFixItAttribute, + #superclass : #GtSourceCoderErrorAttribute, + #instVars : [ + 'fixItAttribute' + ], + #category : #'GToolkit-Coder-UI-FixIt' +} + +{ #category : #'as yet unclassified' } +GtSourceCoderErrorFixItAttribute >> buildPopupIn: anEditorElement aptitude: aptitude [ + | element | + element := fixItAttribute dropDownElementFor: anEditorElement. + element id: #'error-fix-it'. + element beFocusable. + {BlKeyCombination escape. + BlKeyCombination enter. + BlKeyCombination backspace} + do: [ :key | + element + addShortcut: (BlShortcutWithAction new + combination: key; + repeatable: false; + action: [ :aShortcutEvent :aShortcutAction | + aShortcutEvent currentTarget fireEvent: BrDropdownHideWish new. + anEditorElement requestFocus ]) ]. + element enqueueTask: [ element requestFocus ] asBlTask. + ^ element +] + +{ #category : #accessing } +GtSourceCoderErrorFixItAttribute >> fixItAttribute [ + ^ fixItAttribute +] + +{ #category : #accessing } +GtSourceCoderErrorFixItAttribute >> fixItAttribute: anObject [ + fixItAttribute := anObject +] + +{ #category : #testing } +GtSourceCoderErrorFixItAttribute >> showErrorBackground [ + ^ false +] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 8a9b085e8..9ef7f5f4b 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -15,6 +15,19 @@ Class { #category : #'GToolkit-Coder-UI-Coder - Textual' } +{ #category : #private } +GtTextualCoderEditorElement >> addErrorAttribute: errorAttribute at: anInteger [ + | text position | + text := self editor text. + position := anInteger - 1 max: 0. + text size < position ifTrue: [ ^ self ]. + text clearAttributesOfClass: GtSourceCoderErrorAttribute. + text + attribute: errorAttribute + from: position + to: position +] + { #category : #'hooks - children' } GtTextualCoderEditorElement >> attachSpace [ super attachSpace. @@ -224,15 +237,14 @@ GtTextualCoderEditorElement >> onCodeEvaluated: anEvaluationAnnouncement [ { #category : #'private - event handling' } GtTextualCoderEditorElement >> onCoderParseError: aGtCoderParseError [ - (aGtCoderParseError requesterObject - isUndefinedOrCoderViewModel: self textualCoderViewModel) - ifFalse: [ ^ self ]. - - "A parse error can be notifying from a non-UI thread" - self enqueueTask: (BlTaskAction new action: [ - self - reportParseError: aGtCoderParseError errorMessage - at: aGtCoderParseError location ]) + (aGtCoderParseError requesterObject + isUndefinedOrCoderViewModel: self textualCoderViewModel) ifFalse: [ ^ self ]. "A parse error can be notifying from a non-UI thread" + self + enqueueTask: [ aGtCoderParseError isUndeclaredError + ifTrue: [ self reportUndeclaredError: aGtCoderParseError ] + ifFalse: [ self + reportParseError: aGtCoderParseError errorMessage + at: aGtCoderParseError location ] ] asBlTask ] { #category : #'private - event handling' } @@ -625,20 +637,28 @@ GtTextualCoderEditorElement >> registerCoderViewModelAnnouncementsFor: aGtSource { #category : #private } GtTextualCoderEditorElement >> reportParseError: aString at: anInteger [ - | text position error | - text := self editor text. - - position := anInteger - 1 max: 0. - text size < position ifTrue: [ ^ self ]. - - text clearAttributesOfClass: GtSourceCoderErrorAttribute. + | error | error := (aString endsWith: '->') ifTrue: [ aString allButLast: 2 ] ifFalse: [ aString ]. - text - attribute: (GtSourceCoderErrorAttribute for: error) - from: position - to: position + self addErrorAttribute: (GtSourceCoderErrorAttribute for: error) at: anInteger +] + +{ #category : #'private - event handling' } +GtTextualCoderEditorElement >> reportUndeclaredError: aGtCoderParseError [ + | rbNode interval gtNode ast errorAttribute | + rbNode := aGtCoderParseError exception node. + interval := rbNode sourceInterval. + ast := GtPharoParser + parse: rbNode methodNode source + startingAt: (rbNode methodNode isDoIt + ifTrue: [ GtPharoParser startingStateForDoItMethod ] + ifFalse: [ GtPharoParser startingStateForMethod ]). + gtNode := ast nodeForInterval: interval. + errorAttribute := GtUndeclaredVariableAdvice new + errorAttribute: gtNode + coderModel: aGtCoderParseError coder. + self addErrorAttribute: errorAttribute at: aGtCoderParseError location ] { #category : #private } diff --git a/src/GToolkit-Coder/GtCoderParseError.class.st b/src/GToolkit-Coder/GtCoderParseError.class.st index a854d14bd..43ab3439c 100644 --- a/src/GToolkit-Coder/GtCoderParseError.class.st +++ b/src/GToolkit-Coder/GtCoderParseError.class.st @@ -4,7 +4,8 @@ Class { #instVars : [ 'errorMessage', 'location', - 'requesterObject' + 'requesterObject', + 'exception' ], #category : #'GToolkit-Coder-Event' } @@ -19,6 +20,21 @@ GtCoderParseError >> errorMessage: anObject [ errorMessage := anObject ] +{ #category : #accessing } +GtCoderParseError >> exception [ + ^ exception +] + +{ #category : #accessing } +GtCoderParseError >> exception: anException [ + exception := anException +] + +{ #category : #testing } +GtCoderParseError >> isUndeclaredError [ + ^ exception isKindOf: OCUndeclaredVariableWarning +] + { #category : #accessing } GtCoderParseError >> location [ ^ location diff --git a/src/GToolkit-Coder/GtSourceCoder.class.st b/src/GToolkit-Coder/GtSourceCoder.class.st index 5dd47b30d..fdbf71935 100644 --- a/src/GToolkit-Coder/GtSourceCoder.class.st +++ b/src/GToolkit-Coder/GtSourceCoder.class.st @@ -370,6 +370,17 @@ GtSourceCoder >> notifyParseError: aString at: anInteger requesterObject: aReque requesterObject: aRequester) ] +{ #category : #'private - notifying' } +GtSourceCoder >> notifyParseError: aSemanticWarning requesterObject: aRequester [ + self + announce: (GtCoderParseError new + coder: self; + exception: aSemanticWarning; + errorMessage: aSemanticWarning errorMessage; + location: aSemanticWarning location; + requesterObject: aRequester) +] + { #category : #'private - notifying' } GtSourceCoder >> notifyPrintResult: anEvaluationResult [ self announce: (GtCoderPrintAnnouncement new From 9a9a353d8f3b87c057312d82345691b1151dbb2f Mon Sep 17 00:00:00 2001 From: John Brant Date: Mon, 5 May 2025 09:54:30 -0500 Subject: [PATCH 0926/1268] changing fix it attribute to fit contents for description --- src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st index acf983996..0ef3e75a5 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st @@ -38,7 +38,7 @@ GtFixItAttribute >> computeDescriptionTextInEditorElement: anEditorElement forFi foreground: BrGlamorousColors disabledButtonTextColor. ^ BrEditor new - vFitContent; + fitContent; aptitude: BrGlamorousRegularEditorAptitude new glamorousCodeSmallSize; text: text. @@ -110,10 +110,6 @@ GtFixItAttribute >> dropDownElementFor: anEditorElement [ labelText := self computeDescriptionTextInEditorElement: anEditorElement forFixItActions: computedFixItActions. - - menuItems isEmpty - ifTrue: [ labelText width: 200 ] - ifFalse: [ labelText hMatchParent ]. pane addChild: labelText ]. From 0aa8fbc6aab719b720c664730ebf1247a80ad693 Mon Sep 17 00:00:00 2001 From: Oscar Nierstrasz Date: Mon, 5 May 2025 16:59:52 +0200 Subject: [PATCH 0927/1268] Added pragma to examples. --- .../GtSystemS1AnotherClassC3.class.st | 1 + ...CoderClassesHierarchyTreeExamples.class.st | 80 ++++++++----- ...tCoderExampleStateElementExamples.class.st | 44 +++---- ...assesHierarchyListElementExamples.class.st | 2 +- ...gationPackagesListElementExamples.class.st | 2 +- .../GtCoderUncategorizedDummyClass.class.st | 9 +- .../GtDiffBuilderExamples.class.st | 31 +++-- .../GtDiffElementExamples.class.st | 48 +++++--- .../GtDiffSplitterExamples.class.st | 8 ++ .../GtFilterDescriptorExamples.class.st | 51 ++++---- ...GtFilterElementByScripterExamples.class.st | 6 +- .../GtFilterModelExamples.class.st | 94 +++++++++------ .../GtFilterTagElementExamples.class.st | 111 +++++++----------- .../GtFiltersElementExamples.class.st | 15 +-- .../GtIntersectionFilterExamples.class.st | 12 +- .../GtMagritteModelExamples.extension.st | 45 +++---- .../GtMagritteViewModelExamples.extension.st | 31 ++--- .../GtSearchNullFilterExamples.class.st | 9 +- .../GtSyncScrollRangesExamples.class.st | 12 ++ .../GtUnionFilterExamples.class.st | 3 + ...ssWithCommentsRefactoringExamples.class.st | 1 + 21 files changed, 347 insertions(+), 268 deletions(-) diff --git a/src/GToolkit-Coder-Examples-SystemS1/GtSystemS1AnotherClassC3.class.st b/src/GToolkit-Coder-Examples-SystemS1/GtSystemS1AnotherClassC3.class.st index abca81c81..c50cc321f 100644 --- a/src/GToolkit-Coder-Examples-SystemS1/GtSystemS1AnotherClassC3.class.st +++ b/src/GToolkit-Coder-Examples-SystemS1/GtSystemS1AnotherClassC3.class.st @@ -15,6 +15,7 @@ GtSystemS1AnotherClassC3 class >> isDeprecated [ { #category : #example } GtSystemS1AnotherClassC3 >> methodWithExample [ + ^ self class new ] diff --git a/src/GToolkit-Coder-Examples/GtCoderClassesHierarchyTreeExamples.class.st b/src/GToolkit-Coder-Examples/GtCoderClassesHierarchyTreeExamples.class.st index 16f59a508..a1a18c1e9 100644 --- a/src/GToolkit-Coder-Examples/GtCoderClassesHierarchyTreeExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtCoderClassesHierarchyTreeExamples.class.st @@ -7,50 +7,67 @@ Class { { #category : #'instance creation' } GtCoderClassesHierarchyTreeExamples >> fixedHierarchyForSequenceableCollectionClass [ + | aHierarchyTree aSequenceableCollectionTree | - - aHierarchyTree := GtCoderClassesHierarchyTree hierarchyForClass: SequenceableCollection. + aHierarchyTree := GtCoderClassesHierarchyTree + hierarchyForClass: SequenceableCollection. aSequenceableCollectionTree := aHierarchyTree first first first at: 1. - - self assert: aSequenceableCollectionTree rootClass equals: SequenceableCollection. + + self + assert: aSequenceableCollectionTree rootClass + equals: SequenceableCollection. self assert: aSequenceableCollectionTree subclassTrees isEmpty. self assert: aSequenceableCollectionTree size equals: 0. - + ^ aHierarchyTree ] { #category : #'instance creation' } GtCoderClassesHierarchyTreeExamples >> fromCollectionClasses [ + | aHierarchyTree | - aHierarchyTree := GtCoderClassesHierarchyTree - fromClasses: { Collection. Array . SequenceableCollection . OrderedCollection . Set . Dictionary . OrderedDictionary }. - + fromClasses: {Collection. + Array. + SequenceableCollection. + OrderedCollection. + Set. + Dictionary. + OrderedDictionary}. + self assert: aHierarchyTree size equals: 4. - self assert: aHierarchyTree classes asSet equals: { Set . Array. Collection . Dictionary } asSet. - self assert: (((aHierarchyTree sort: [:a :b | a name < b name ]) at: 2) classes asSet = { OrderedDictionary . SequenceableCollection } asSet). - + self + assert: aHierarchyTree classes asSet + equals: {Set. + Array. + Collection. + Dictionary} asSet. + self + assert: ((aHierarchyTree sort: [ :a :b | a name < b name ]) at: 2) classes asSet + = {OrderedDictionary. + SequenceableCollection} asSet. + ^ aHierarchyTree ] { #category : #'instance creation' } GtCoderClassesHierarchyTreeExamples >> growingHierarchyForArrayedCollectionClass [ + | aHierarchyTree aSequenceableCollectionTree anArrayedCollection | - aHierarchyTree := self growingHierarchyForSequenceableCollectionClass. aSequenceableCollectionTree := aHierarchyTree first first first at: 1. - anArrayedCollection := aSequenceableCollectionTree currentSubclassTrees - detect: [ :each | each rootClass = ArrayedCollection ]. - + anArrayedCollection := aSequenceableCollectionTree currentSubclassTrees + detect: [ :each | each rootClass = ArrayedCollection ]. + self assert: anArrayedCollection currentSubclassTrees isEmpty. - self assert: anArrayedCollection currentSize equals: 0. + self assert: anArrayedCollection currentSize equals: 0. self assert: anArrayedCollection subclassTrees size > 0. self assert: anArrayedCollection size > 0. self assert: anArrayedCollection currentSubclassTrees size > 0. - self assert: anArrayedCollection currentSize > 0. + self assert: anArrayedCollection currentSize > 0. ^ aHierarchyTree ] @@ -58,36 +75,41 @@ GtCoderClassesHierarchyTreeExamples >> growingHierarchyForArrayedCollectionClass { #category : #'instance creation' } GtCoderClassesHierarchyTreeExamples >> growingHierarchyForSequenceableCollectionClass [ + | aHierarchyTree aSequenceableCollectionTree | - aHierarchyTree := self hierarchyForSequenceableCollectionClass. aSequenceableCollectionTree := aHierarchyTree first first first at: 1. - - self assert: aSequenceableCollectionTree rootClass equals: SequenceableCollection. + + self + assert: aSequenceableCollectionTree rootClass + equals: SequenceableCollection. self assert: aSequenceableCollectionTree currentSubclassTrees isEmpty. self assert: aSequenceableCollectionTree currentSize equals: 0. self assert: aSequenceableCollectionTree size > 0. - + self assert: aSequenceableCollectionTree subclassTrees size > 0. self assert: aSequenceableCollectionTree size > 0. self assert: aSequenceableCollectionTree currentSubclassTrees size > 0. self assert: aSequenceableCollectionTree currentSize > 0. - + ^ aHierarchyTree ] { #category : #'instance creation' } GtCoderClassesHierarchyTreeExamples >> hierarchyForSequenceableCollectionClass [ + | aHierarchyTree | - - aHierarchyTree := GtCoderGrowingClassesHierarchyTree hierarchyForClass: SequenceableCollection. - + aHierarchyTree := GtCoderGrowingClassesHierarchyTree + hierarchyForClass: SequenceableCollection. + self assert: aHierarchyTree size equals: 1. - self assert: aHierarchyTree first classes equals: { Object }. - self assert: (aHierarchyTree first at: 1) classes equals: { Collection }. - self assert: (aHierarchyTree first first at: 1) classes equals: { SequenceableCollection }. - + self assert: aHierarchyTree first classes equals: {Object}. + self assert: (aHierarchyTree first at: 1) classes equals: {Collection}. + self + assert: (aHierarchyTree first first at: 1) classes + equals: {SequenceableCollection}. + ^ aHierarchyTree ] diff --git a/src/GToolkit-Coder-Examples/GtCoderExampleStateElementExamples.class.st b/src/GToolkit-Coder-Examples/GtCoderExampleStateElementExamples.class.st index 23f713c74..573fd3597 100644 --- a/src/GToolkit-Coder-Examples/GtCoderExampleStateElementExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtCoderExampleStateElementExamples.class.st @@ -25,6 +25,7 @@ GtCoderExampleStateElementExamples >> assert: anElement backgroundColor: aColor { #category : #accessing } GtCoderExampleStateElementExamples >> basicExampleStatusElement [ + | anElement | anElement := GtCoderExampleStateElement new. self assert: anElement example isNil. @@ -35,47 +36,46 @@ GtCoderExampleStateElementExamples >> basicExampleStatusElement [ { #category : #accessing } GtCoderExampleStateElementExamples >> errorExample [ - ^ (self class >>#three) gtExample asExampleWithResult + + ^ (self class >> #three) gtExample asExampleWithResult ] { #category : #accessing } GtCoderExampleStateElementExamples >> exampleStateElement_Error [ + | anElement anExample | anElement := self basicExampleStatusElement. anExample := self errorExample. anElement example: anExample. - + self assert: anElement example equals: anExample. - BlUseAsyncFeatures disableDuring: [ - anExample run ]. + BlUseAsyncFeatures disableDuring: [ anExample run ]. self assert: anElement exampleResult isNotNil. self assert: anElement exampleResult isError. - self - assert: anElement - backgroundColor: GtFilterExampleErrorState default color. + self assert: anElement backgroundColor: GtFilterExampleErrorState default color. ^ anElement ] { #category : #accessing } GtCoderExampleStateElementExamples >> exampleStateElement_Failure [ + | anElement anExample | anElement := self basicExampleStatusElement. anExample := self failingExample. anElement example: anExample. - + self assert: anElement example equals: anExample. - BlUseAsyncFeatures disableDuring: [ - anExample run ]. + BlUseAsyncFeatures disableDuring: [ anExample run ]. self assert: anElement exampleResult isNotNil. self assert: anElement exampleResult isFailure. - self - assert: anElement + self + assert: anElement backgroundColor: GtFilterExampleFailureState default color. ^ anElement ] @@ -83,14 +83,15 @@ GtCoderExampleStateElementExamples >> exampleStateElement_Failure [ { #category : #accessing } GtCoderExampleStateElementExamples >> exampleStateElement_NotExecuted [ + | anElement anExample | anElement := self basicExampleStatusElement. anExample := self successExample. anElement example: anExample. self assert: anElement example equals: anExample. self assert: anElement exampleResult isNil. - self - assert: anElement + self + assert: anElement backgroundColor: GtFilterExampleNotExecutedState default color. ^ anElement ] @@ -98,15 +99,15 @@ GtCoderExampleStateElementExamples >> exampleStateElement_NotExecuted [ { #category : #accessing } GtCoderExampleStateElementExamples >> exampleStateElement_Success [ + | anElement anExample | anElement := self exampleStateElement_NotExecuted. anExample := anElement example. - BlUseAsyncFeatures disableDuring: [ - anExample run ]. + BlUseAsyncFeatures disableDuring: [ anExample run ]. self assert: anElement exampleResult isNotNil. self assert: anElement exampleResult isSuccess. - self - assert: anElement + self + assert: anElement backgroundColor: GtFilterExampleSuccessState default color. ^ anElement ] @@ -114,19 +115,22 @@ GtCoderExampleStateElementExamples >> exampleStateElement_Success [ { #category : #accessing } GtCoderExampleStateElementExamples >> failingExample [ - ^ (self class >>#two) gtExample asExampleWithResult + + ^ (self class >> #two) gtExample asExampleWithResult ] { #category : #accessing } GtCoderExampleStateElementExamples >> one [ + ^ 1 ] { #category : #accessing } GtCoderExampleStateElementExamples >> successExample [ - ^ (self class >>#one) gtExample asExampleWithResult + + ^ (self class >> #one) gtExample asExampleWithResult ] { #category : #accessing } diff --git a/src/GToolkit-Coder-Examples/GtCoderNavigationClassesHierarchyListElementExamples.class.st b/src/GToolkit-Coder-Examples/GtCoderNavigationClassesHierarchyListElementExamples.class.st index 3455b6754..8523b6cd3 100644 --- a/src/GToolkit-Coder-Examples/GtCoderNavigationClassesHierarchyListElementExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtCoderNavigationClassesHierarchyListElementExamples.class.st @@ -7,7 +7,7 @@ Class { { #category : #'instance creation' } GtCoderNavigationClassesHierarchyListElementExamples >> fromCollectionClasses [ - + ^ GtCoderClassesTreeElement fromClasses: #'Collections-Abstract' asPackage definedClasses ] diff --git a/src/GToolkit-Coder-Examples/GtCoderNavigationPackagesListElementExamples.class.st b/src/GToolkit-Coder-Examples/GtCoderNavigationPackagesListElementExamples.class.st index b6e0756a8..49d8c0b40 100644 --- a/src/GToolkit-Coder-Examples/GtCoderNavigationPackagesListElementExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtCoderNavigationPackagesListElementExamples.class.st @@ -7,6 +7,6 @@ Class { { #category : #'instance creation' } GtCoderNavigationPackagesListElementExamples >> fromAllPackages [ - + ^ GtCoderPackagesTreeElement fromPackages: RPackageOrganizer default packages ] diff --git a/src/GToolkit-Coder-Examples/GtCoderUncategorizedDummyClass.class.st b/src/GToolkit-Coder-Examples/GtCoderUncategorizedDummyClass.class.st index 936ed931b..2b51e2f97 100644 --- a/src/GToolkit-Coder-Examples/GtCoderUncategorizedDummyClass.class.st +++ b/src/GToolkit-Coder-Examples/GtCoderUncategorizedDummyClass.class.st @@ -12,12 +12,13 @@ Class { { #category : #examples } GtCoderUncategorizedDummyClass >> checkUncategorized [ + | aPackage aPackageTag | - aPackage := self class package. - aPackageTag := aPackage classTags detect: [ :eachTag | eachTag name = aPackage name ]. - + aPackageTag := aPackage classTags + detect: [ :eachTag | eachTag name = aPackage name ]. + self assert: aPackage name equals: aPackageTag name. - + ^ aPackageTag ] diff --git a/src/GToolkit-Coder-Examples/GtDiffBuilderExamples.class.st b/src/GToolkit-Coder-Examples/GtDiffBuilderExamples.class.st index db9b4c91e..01df14cdd 100644 --- a/src/GToolkit-Coder-Examples/GtDiffBuilderExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtDiffBuilderExamples.class.st @@ -7,13 +7,14 @@ Class { { #category : #examples } GtDiffBuilderExamples >> byteArrayDiff [ + | originalByteArray modifiedByteArray | originalByteArray := (1 to: 64) collect: [ :_ | 256 atRandom - 1 ] as: ByteArray. modifiedByteArray := originalByteArray copy. - 8 timesRepeat: [ - modifiedByteArray at: modifiedByteArray size atRandom put: 256 atRandom - 1 ]. + 8 + timesRepeat: [ modifiedByteArray at: modifiedByteArray size atRandom put: 256 atRandom - 1 ]. ^ GtDiffBuilder computeDifferencesFrom: originalByteArray to: modifiedByteArray @@ -23,15 +24,17 @@ GtDiffBuilderExamples >> byteArrayDiff [ { #category : #examples } GtDiffBuilderExamples >> changeInMiddleAndDeletionAtEnd [ + | differences from to change | from := String cr join: ((1 to: 10) collect: #asWords). - to := String cr join: (((1 to: 10) collect: #asWords) - at: 2 put: 'two plus'; - allButLast). + to := String cr + join: (((1 to: 10) collect: #asWords) + at: 2 put: 'two plus'; + allButLast). change := GtDiffBuilder - computeDifferencesFrom: from - to: to - using: GtLineDiffSplitter ignoringEOLChars. + computeDifferencesFrom: from + to: to + using: GtLineDiffSplitter ignoringEOLChars. differences := change changes. self assert: differences size equals: 2. self assert: differences first isReplacement. @@ -45,6 +48,7 @@ GtDiffBuilderExamples >> changeInMiddleAndDeletionAtEnd [ { #category : #examples } GtDiffBuilderExamples >> deletionsAtBeginningExample [ + | differences from to change | from := '1' , String cr , '2' , String lf , '3'. to := from allButFirst: 2. @@ -63,6 +67,7 @@ GtDiffBuilderExamples >> deletionsAtBeginningExample [ { #category : #examples } GtDiffBuilderExamples >> deletionsAtEndExample [ + | differences from to change | from := '1' , String cr , '2' , String lf , '3'. to := from allButLast. @@ -81,6 +86,7 @@ GtDiffBuilderExamples >> deletionsAtEndExample [ { #category : #examples } GtDiffBuilderExamples >> deletionsInMiddle [ + | differences from to change | from := String cr join: ((1 to: 9) collect: #printString). to := String cr join: ((1 to: 4) , (7 to: 9) collect: #printString). @@ -100,6 +106,7 @@ GtDiffBuilderExamples >> deletionsInMiddle [ { #category : #examples } GtDiffBuilderExamples >> insertionsAtBeginningExample [ + | differences from to change | to := '1' , String cr , '2' , String lf , '3'. from := to allButFirst: 2. @@ -118,6 +125,7 @@ GtDiffBuilderExamples >> insertionsAtBeginningExample [ { #category : #examples } GtDiffBuilderExamples >> insertionsAtEndExample [ + | differences from to change | to := '1' , String cr , '2' , String lf , '3'. from := to allButLast. @@ -136,6 +144,7 @@ GtDiffBuilderExamples >> insertionsAtEndExample [ { #category : #examples } GtDiffBuilderExamples >> insertionsInMiddle [ + | differences from to change | to := String cr join: ((1 to: 9) collect: #printString). from := String cr join: ((1 to: 4) , (7 to: 9) collect: #printString). @@ -155,6 +164,7 @@ GtDiffBuilderExamples >> insertionsInMiddle [ { #category : #examples } GtDiffBuilderExamples >> multipleChanges [ + | differences from to change | from := String cr join: ((0 to: 9 by: 3) collect: #printString). to := String cr join: ((0 to: 9 by: 2) collect: #printString). @@ -171,6 +181,7 @@ GtDiffBuilderExamples >> multipleChanges [ { #category : #examples } GtDiffBuilderExamples >> multipleObjectChanges [ + | differences from to deletedObjects insertedObjects index change | from := 0 to: 1000 by: 2. to := 0 to: 1000 by: 7. @@ -205,6 +216,7 @@ GtDiffBuilderExamples >> multipleObjectChanges [ { #category : #examples } GtDiffBuilderExamples >> noDifferencesExample [ + | differences from to change | from := '1' , String cr , '2' , String lf , '3'. to := from copy. @@ -220,6 +232,7 @@ GtDiffBuilderExamples >> noDifferencesExample [ { #category : #examples } GtDiffBuilderExamples >> replacementInMiddle [ + | differences from to change | from := String cr join: ((1 to: 4) , (6 to: 9) collect: #printString). to := String cr join: ((1 to: 5) , (7 to: 9) collect: #printString). @@ -240,6 +253,7 @@ GtDiffBuilderExamples >> replacementInMiddle [ { #category : #examples } GtDiffBuilderExamples >> reversedTokenChanges [ + | differences from to change scannerClass | scannerClass := self class environment at: #GtPharoScanner ifAbsent: [ ^ nil ]. to := 'method: arg ^self inject: arg into: [:sum :each | sum + each]'. @@ -269,6 +283,7 @@ GtDiffBuilderExamples >> reversedTokenChanges [ { #category : #examples } GtDiffBuilderExamples >> tokenChanges [ + | differences from to change scannerClass | scannerClass := self class environment at: #GtPharoScanner ifAbsent: [ ^ nil ]. from := 'method: arg ^self inject: arg into: [:sum :each | sum + each]'. diff --git a/src/GToolkit-Coder-Examples/GtDiffElementExamples.class.st b/src/GToolkit-Coder-Examples/GtDiffElementExamples.class.st index 5ff074da7..e8ec436d2 100644 --- a/src/GToolkit-Coder-Examples/GtDiffElementExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtDiffElementExamples.class.st @@ -7,24 +7,28 @@ Class { { #category : #examples } GtDiffElementExamples >> changeElementExample [ + ^ (GtDiffElement onChange: self exampleChange) showButtons ] { #category : #examples } GtDiffElementExamples >> changeExampleFlat [ + ^ self changeElementExample aptitude: GtDiffFlatAptitude ] { #category : #examples } GtDiffElementExamples >> changeExampleShadow [ + ^ self changeElementExample aptitude: GtDiffShadowAptitude ] { #category : #examples } GtDiffElementExamples >> exampleChange [ + ^ GtDiffBuilder computeDifferencesFrom: self originalString to: self newString @@ -34,53 +38,65 @@ GtDiffElementExamples >> exampleChange [ { #category : #examples } GtDiffElementExamples >> exampleTextDiff [ + ^ TextDiffBuilder from: self originalString to: self newString ] { #category : #examples } GtDiffElementExamples >> newString [ + ^ String streamContents: [ :str | - 1 to: 1000 by: 6 do: [ :i | - str - print: i; - cr; - print: i + 1; - cr; - print: i + 2; - cr ] ] + 1 + to: 1000 + by: 6 + do: [ :i | + str + print: i; + cr; + print: i + 1; + cr; + print: i + 2; + cr ] ] ] { #category : #examples } GtDiffElementExamples >> originalString [ + ^ String streamContents: [ :str | - 1 to: 1000 by: 5 do: [ :i | - str - print: i; - cr; - print: i + 1; - cr; - print: i + 2; - cr ] ] + 1 + to: 1000 + by: 5 + do: [ :i | + str + print: i; + cr; + print: i + 1; + cr; + print: i + 2; + cr ] ] ] { #category : #examples } GtDiffElementExamples >> textDiffElementExample [ + ^ (GtDiffElement onDiff: self exampleTextDiff) showButtons ] { #category : #examples } GtDiffElementExamples >> textDiffExampleFlat [ + ^ self textDiffElementExample aptitude: GtDiffFlatAptitude ] { #category : #examples } GtDiffElementExamples >> textDiffExampleShadow [ + ^ self textDiffElementExample aptitude: GtDiffShadowAptitude ] diff --git a/src/GToolkit-Coder-Examples/GtDiffSplitterExamples.class.st b/src/GToolkit-Coder-Examples/GtDiffSplitterExamples.class.st index 34b166f15..abdd5bcdc 100644 --- a/src/GToolkit-Coder-Examples/GtDiffSplitterExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtDiffSplitterExamples.class.st @@ -7,6 +7,7 @@ Class { { #category : #'null splitter' } GtDiffSplitterExamples >> characterSplitterExample [ + ^ self compareNullSplits: '1234' ] @@ -30,6 +31,7 @@ GtDiffSplitterExamples >> compareNullSplits: aCollection [ { #category : #'token splitter' } GtDiffSplitterExamples >> javascriptDiffSplitter [ + | splits scannerClass splitter | scannerClass := self class environment at: #JSScanner ifAbsent: [ ^ nil ]. splitter := GtSmaCCDiffSplitter new scannerClass: scannerClass. @@ -42,6 +44,7 @@ GtDiffSplitterExamples >> javascriptDiffSplitter [ { #category : #lines } GtDiffSplitterExamples >> lineIgnoringEOLSplitterExample [ + | splitter splits string | string := '1' , String crlf , '2' , String cr , '3' , String lf , '4'. splitter := GtLineDiffSplitter ignoringEOLChars. @@ -55,6 +58,7 @@ GtDiffSplitterExamples >> lineIgnoringEOLSplitterExample [ { #category : #lines } GtDiffSplitterExamples >> lineWithEOLSplitterExample [ + | splitter splits string | string := '1' , String crlf , '2' , String cr , '3' , String lf , '4'. splitter := GtLineDiffSplitter new @@ -72,6 +76,7 @@ GtDiffSplitterExamples >> lineWithEOLSplitterExample [ { #category : #lines } GtDiffSplitterExamples >> lineWithoutEOLSplitterExample [ + | splitter splits string | string := '1' , String crlf , '1' , String cr , '1' , String lf , '1'. splitter := GtLineDiffSplitter new @@ -87,6 +92,7 @@ GtDiffSplitterExamples >> lineWithoutEOLSplitterExample [ { #category : #'null splitter' } GtDiffSplitterExamples >> objectSplitterExample [ + ^ self compareNullSplits: {1. 'foo'. @@ -98,6 +104,7 @@ GtDiffSplitterExamples >> objectSplitterExample [ { #category : #'character groups' } GtDiffSplitterExamples >> wordIgnoreWhitespaceSplitter [ + | splits words | words := #('This ' 'is ' 'a ' 'test' '. ' '123' ',' '45'). @@ -113,6 +120,7 @@ GtDiffSplitterExamples >> wordIgnoreWhitespaceSplitter [ { #category : #'character groups' } GtDiffSplitterExamples >> wordSplitter [ + | splits words | words := #('This' 'is' 'a' 'test'). splits := GtCharacterGroupDiffSplitter words split: (' ' join: words). diff --git a/src/GToolkit-Coder-Examples/GtFilterDescriptorExamples.class.st b/src/GToolkit-Coder-Examples/GtFilterDescriptorExamples.class.st index 2e0b23c66..b246dfa9c 100644 --- a/src/GToolkit-Coder-Examples/GtFilterDescriptorExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtFilterDescriptorExamples.class.st @@ -7,70 +7,73 @@ Class { { #category : #examples } GtFilterDescriptorExamples >> filterDescriptorOffersCompletionValues [ + | aFilterDescriptor | - aFilterDescriptor := self newFilterDescriptor - offerCompletionValues: true; - emptyDefaultValue: 'Lorem'; - completion: [ GtStreamedBlockCompletionStrategy new streamingBlock: [ :aText | (String loremIpsum piecesCutWhere: [:each :next | next = Character space]) asAsyncStream ] ]. - - self assert: aFilterDescriptor name equals: 'No name'. - self assert: aFilterDescriptor order equals: 1. - self assert: (aFilterDescriptor completion isKindOf: GtStreamedBlockCompletionStrategy). + offerCompletionValues: true; + emptyDefaultValue: 'Lorem'; + completion: [ GtStreamedBlockCompletionStrategy new + streamingBlock: [ :aText | + (String loremIpsum piecesCutWhere: [ :each :next | next = Character space ]) + asAsyncStream ] ]. + + self assert: aFilterDescriptor name equals: 'No name'. + self assert: aFilterDescriptor order equals: 1. + self + assert: (aFilterDescriptor completion isKindOf: GtStreamedBlockCompletionStrategy). self assert: aFilterDescriptor valueIsRequired. self assert: aFilterDescriptor isDefault. self assert: aFilterDescriptor emptyDefaultValue equals: 'Lorem'. self assert: aFilterDescriptor showAsDefaultWhenEmpty. self assert: aFilterDescriptor shouldOfferCompletionValues. - + self assert: (aFilterDescriptor newFilterWithValue: '') equals: GtSearchNullFilter new. - + ^ aFilterDescriptor ] { #category : #examples } GtFilterDescriptorExamples >> filterDescriptorValueNotRequired [ + | aFilterDescriptor | - - aFilterDescriptor := self newFilterDescriptor - valueNotRequired. - - self assert: aFilterDescriptor name equals: 'No name'. - self assert: aFilterDescriptor order equals: 1. + aFilterDescriptor := self newFilterDescriptor valueNotRequired. + + self assert: aFilterDescriptor name equals: 'No name'. + self assert: aFilterDescriptor order equals: 1. self assert: aFilterDescriptor completion equals: nil. self assert: aFilterDescriptor valueIsRequired not. self assert: aFilterDescriptor isDefault. self assert: aFilterDescriptor emptyDefaultValue equals: nil. self assert: aFilterDescriptor showAsDefaultWhenEmpty. - + self assert: (aFilterDescriptor newFilterWithValue: '') equals: GtSearchNullFilter new. - + ^ aFilterDescriptor ] { #category : #examples } GtFilterDescriptorExamples >> newFilterDescriptor [ + | aFilterDescriptor | - aFilterDescriptor := GtFilterDescriptor new. - - self assert: aFilterDescriptor name equals: 'No name'. - self assert: aFilterDescriptor order equals: 1. + + self assert: aFilterDescriptor name equals: 'No name'. + self assert: aFilterDescriptor order equals: 1. self assert: aFilterDescriptor completion equals: nil. self assert: aFilterDescriptor valueIsRequired. self assert: aFilterDescriptor isDefault. self assert: aFilterDescriptor emptyDefaultValue equals: nil. self assert: aFilterDescriptor showAsDefaultWhenEmpty not. - + self assert: (aFilterDescriptor newFilterWithValue: '') equals: GtSearchNullFilter new. - + ^ aFilterDescriptor ] diff --git a/src/GToolkit-Coder-Examples/GtFilterElementByScripterExamples.class.st b/src/GToolkit-Coder-Examples/GtFilterElementByScripterExamples.class.st index 050b972ca..2907b4406 100644 --- a/src/GToolkit-Coder-Examples/GtFilterElementByScripterExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtFilterElementByScripterExamples.class.st @@ -9,6 +9,7 @@ Class { { #category : #examples } GtFilterElementByScripterExamples >> booleanElement [ + | aScripter | aScripter := self scripterWithModel: [ GtFilterModelExamples new booleanModel ] @@ -20,12 +21,13 @@ GtFilterElementByScripterExamples >> booleanElement [ { #category : #examples } GtFilterElementByScripterExamples >> itemsModel [ + | aScripter | aScripter := self scripterWithModel: [ GtFilterModelExamples new itemsModel ] element: [ :aModel | GtFilterItemsElement new filtersViewModel: aModel asFiltersViewModel ]. - + ^ aScripter ] @@ -33,6 +35,7 @@ GtFilterElementByScripterExamples >> itemsModel [ { #category : #examples } GtFilterElementByScripterExamples >> shortListElement [ + | aScripter | aScripter := self scripterWithModel: [ GtFilterModelExamples new shortListModel ] @@ -44,6 +47,7 @@ GtFilterElementByScripterExamples >> shortListElement [ { #category : #examples } GtFilterElementByScripterExamples >> textElement [ + | aScripter | aScripter := self scripterWithModel: [ GtFilterModelExamples new textModel ] diff --git a/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st b/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st index 9a7be997f..d1bab504d 100644 --- a/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtFilterModelExamples.class.st @@ -7,6 +7,7 @@ Class { { #category : #examples } GtFilterModelExamples >> booleanModel [ + | aModel | aModel := GtFilterBooleanModel new. aModel switchedOn: true. @@ -19,6 +20,7 @@ GtFilterModelExamples >> booleanModel [ { #category : #examples } GtFilterModelExamples >> invariableModel [ + | aModel | aModel := GtFilterInvariableModel new. aModel name: 'Stable tests'. @@ -29,6 +31,7 @@ GtFilterModelExamples >> invariableModel [ { #category : #examples } GtFilterModelExamples >> itemsModel [ + | aModel | aModel := GtFilterItemsModel new. aModel @@ -36,7 +39,7 @@ GtFilterModelExamples >> itemsModel [ self shortListModel. self booleanModel. self invariableModel. - self toggleModel.}. + self toggleModel}. self assert: aModel items size equals: 5. ^ aModel @@ -45,6 +48,7 @@ GtFilterModelExamples >> itemsModel [ { #category : #examples } GtFilterModelExamples >> itemsModelWithAddingShortListModelWithSelectedValue [ + | aFiltersModel aFilterModel someAnnouncements | someAnnouncements := OrderedCollection new. aFiltersModel := GtFilterItemsModel new. @@ -55,7 +59,7 @@ GtFilterModelExamples >> itemsModelWithAddingShortListModelWithSelectedValue [ aFilterModel := self shortListModel. self assert: (aFilterModel selectedItem ifSome: [ true ] ifNone: [ false ]). - + aFiltersModel addFilterModel: aFilterModel. self assert: aFiltersModel items size equals: 1. @@ -67,6 +71,7 @@ GtFilterModelExamples >> itemsModelWithAddingShortListModelWithSelectedValue [ { #category : #examples } GtFilterModelExamples >> itemsModelWithAddingShortListModelWithoutSelectedValue [ + | aFiltersModel aFilterModel someAnnouncements | someAnnouncements := OrderedCollection new. aFiltersModel := GtFilterItemsModel new. @@ -78,7 +83,7 @@ GtFilterModelExamples >> itemsModelWithAddingShortListModelWithoutSelectedValue aFilterModel := self shortListModel. aFilterModel selectedItem: GtFilterModelNoItem default. self assert: (aFilterModel selectedItem ifSome: [ false ] ifNone: [ true ]). - + aFiltersModel addFilterModel: aFilterModel. self assert: aFiltersModel items size equals: 1. @@ -90,6 +95,7 @@ GtFilterModelExamples >> itemsModelWithAddingShortListModelWithoutSelectedValue { #category : #examples } GtFilterModelExamples >> itemsModelWithAddingTextModelWithEmptyText [ + | aFiltersModel aFilterModel someAnnouncements | someAnnouncements := OrderedCollection new. aFiltersModel := GtFilterItemsModel new. @@ -101,7 +107,7 @@ GtFilterModelExamples >> itemsModelWithAddingTextModelWithEmptyText [ aFilterModel := self textModel. aFilterModel text: ''. self assert: aFilterModel text isEmpty. - + aFiltersModel addFilterModel: aFilterModel. self assert: aFiltersModel items size equals: 1. @@ -113,6 +119,7 @@ GtFilterModelExamples >> itemsModelWithAddingTextModelWithEmptyText [ { #category : #examples } GtFilterModelExamples >> itemsModelWithAddingTextModelWithNonEmptyText [ + | aFiltersModel aFilterModel someAnnouncements | someAnnouncements := OrderedCollection new. aFiltersModel := GtFilterItemsModel new. @@ -123,7 +130,7 @@ GtFilterModelExamples >> itemsModelWithAddingTextModelWithNonEmptyText [ aFilterModel := self textModel. self assert: aFilterModel text isEmpty not. - + aFiltersModel addFilterModel: aFilterModel. self assert: aFiltersModel items size equals: 1. @@ -135,6 +142,7 @@ GtFilterModelExamples >> itemsModelWithAddingTextModelWithNonEmptyText [ { #category : #examples } GtFilterModelExamples >> itemsModelWithAddingToggleModelWithSelectedValue [ + | aFiltersModel aFilterModel someAnnouncements | someAnnouncements := OrderedCollection new. aFiltersModel := GtFilterItemsModel new. @@ -145,7 +153,7 @@ GtFilterModelExamples >> itemsModelWithAddingToggleModelWithSelectedValue [ aFilterModel := self toggleModel. self assert: (aFilterModel selectedItem ifSome: [ true ] ifNone: [ false ]). - + aFiltersModel addFilterModel: aFilterModel. self assert: aFiltersModel items size equals: 1. @@ -157,6 +165,7 @@ GtFilterModelExamples >> itemsModelWithAddingToggleModelWithSelectedValue [ { #category : #examples } GtFilterModelExamples >> itemsModelWithAddingToggleModelWithoutSelectedValue [ + | aFiltersModel aFilterModel someAnnouncements | someAnnouncements := OrderedCollection new. aFiltersModel := GtFilterItemsModel new. @@ -168,7 +177,7 @@ GtFilterModelExamples >> itemsModelWithAddingToggleModelWithoutSelectedValue [ aFilterModel := self toggleModel. aFilterModel selectedItem: GtFilterModelNoItem default. self assert: (aFilterModel selectedItem ifSome: [ false ] ifNone: [ true ]). - + aFiltersModel addFilterModel: aFilterModel. self assert: aFiltersModel items size equals: 1. @@ -180,6 +189,7 @@ GtFilterModelExamples >> itemsModelWithAddingToggleModelWithoutSelectedValue [ { #category : #examples } GtFilterModelExamples >> itemsModelWithRemovingShortListModelWithSelectedValue [ + | aFiltersModel aFilterModel someAnnouncements | someAnnouncements := OrderedCollection new. aFiltersModel := self itemsModelWithAddingShortListModelWithSelectedValue. @@ -190,7 +200,7 @@ GtFilterModelExamples >> itemsModelWithRemovingShortListModelWithSelectedValue [ aFilterModel := aFiltersModel items first. self assert: (aFilterModel selectedItem ifSome: [ true ] ifNone: [ false ]). - + aFiltersModel removeFilterModel: aFilterModel. self assert: aFiltersModel items size equals: 0. @@ -202,6 +212,7 @@ GtFilterModelExamples >> itemsModelWithRemovingShortListModelWithSelectedValue [ { #category : #examples } GtFilterModelExamples >> itemsModelWithRemovingShortListModelWithoutSelectedValue [ + | aFiltersModel aFilterModel someAnnouncements | someAnnouncements := OrderedCollection new. aFiltersModel := self itemsModelWithAddingShortListModelWithoutSelectedValue. @@ -212,7 +223,7 @@ GtFilterModelExamples >> itemsModelWithRemovingShortListModelWithoutSelectedValu aFilterModel := aFiltersModel items first. self assert: (aFilterModel selectedItem ifSome: [ false ] ifNone: [ true ]). - + aFiltersModel removeFilterModel: aFilterModel. self assert: aFiltersModel items size equals: 0. @@ -224,6 +235,7 @@ GtFilterModelExamples >> itemsModelWithRemovingShortListModelWithoutSelectedValu { #category : #examples } GtFilterModelExamples >> itemsModelWithRemovingTextModelWithEmptyText [ + | aFiltersModel aFilterModel someAnnouncements | someAnnouncements := OrderedCollection new. aFiltersModel := self itemsModelWithAddingTextModelWithEmptyText. @@ -234,7 +246,7 @@ GtFilterModelExamples >> itemsModelWithRemovingTextModelWithEmptyText [ aFilterModel := aFiltersModel items first. self assert: aFilterModel text isEmpty. - + aFiltersModel removeFilterModel: aFilterModel. self assert: aFiltersModel items size equals: 0. @@ -246,6 +258,7 @@ GtFilterModelExamples >> itemsModelWithRemovingTextModelWithEmptyText [ { #category : #examples } GtFilterModelExamples >> itemsModelWithRemovingTextModelWithNonEmptyText [ + | aFiltersModel aFilterModel someAnnouncements | someAnnouncements := OrderedCollection new. aFiltersModel := self itemsModelWithAddingTextModelWithNonEmptyText. @@ -256,7 +269,7 @@ GtFilterModelExamples >> itemsModelWithRemovingTextModelWithNonEmptyText [ aFilterModel := aFiltersModel items first. self assert: aFilterModel text isEmpty not. - + aFiltersModel removeFilterModel: aFilterModel. self assert: aFiltersModel items size equals: 0. @@ -268,6 +281,7 @@ GtFilterModelExamples >> itemsModelWithRemovingTextModelWithNonEmptyText [ { #category : #examples } GtFilterModelExamples >> itemsModelWithRemovingToggleModelWithSelectedValue [ + | aFiltersModel aFilterModel someAnnouncements | someAnnouncements := OrderedCollection new. aFiltersModel := self itemsModelWithAddingToggleModelWithSelectedValue. @@ -278,7 +292,7 @@ GtFilterModelExamples >> itemsModelWithRemovingToggleModelWithSelectedValue [ aFilterModel := aFiltersModel items first. self assert: (aFilterModel selectedItem ifSome: [ true ] ifNone: [ false ]). - + aFiltersModel removeFilterModel: aFilterModel. self assert: aFiltersModel items size equals: 0. @@ -290,6 +304,7 @@ GtFilterModelExamples >> itemsModelWithRemovingToggleModelWithSelectedValue [ { #category : #examples } GtFilterModelExamples >> itemsModelWithRemovingToggleModelWithoutSelectedValue [ + | aFiltersModel aFilterModel someAnnouncements | someAnnouncements := OrderedCollection new. aFiltersModel := self itemsModelWithAddingToggleModelWithoutSelectedValue. @@ -300,7 +315,7 @@ GtFilterModelExamples >> itemsModelWithRemovingToggleModelWithoutSelectedValue [ aFilterModel := aFiltersModel items first. self assert: (aFilterModel selectedItem ifSome: [ false ] ifNone: [ true ]). - + aFiltersModel removeFilterModel: aFilterModel. self assert: aFiltersModel items size equals: 0. @@ -312,6 +327,7 @@ GtFilterModelExamples >> itemsModelWithRemovingToggleModelWithoutSelectedValue [ { #category : #examples } GtFilterModelExamples >> shortListModel [ + | aModel | aModel := GtFilterShortListModel new. aModel @@ -331,29 +347,25 @@ GtFilterModelExamples >> shortListModel [ { #category : #examples } GtFilterModelExamples >> shortListModelParameter [ + | aModel | aModel := GtFilterShortListModelParameter new - updater: [ :aFilter :anItem | - anItem - ifSome: [ :aValue | - anItem onCreateFilter: aFilter ] - ifNone: [ ] ]; - items: [ { - GtFilterModelPluggableItem new - label: 'readers and writers'; - filterUpdater: [ :aFilter | - aFilter includeReaders: true. - aFilter includeWriters: true ]. - GtFilterModelPluggableItem new - label: 'readers only'; - filterUpdater: [ :aFilter | - aFilter includeReaders: true. - aFilter includeWriters: false ]. - GtFilterModelPluggableItem new - label: 'writers only'; - filterUpdater: [ :aFilter | - aFilter includeReaders: false. - aFilter includeWriters: true ] } ]; + updater: [ :aFilter :anItem | anItem ifSome: [ :aValue | anItem onCreateFilter: aFilter ] ifNone: [ ] ]; + items: [ {GtFilterModelPluggableItem new + label: 'readers and writers'; + filterUpdater: [ :aFilter | + aFilter includeReaders: true. + aFilter includeWriters: true ]. + GtFilterModelPluggableItem new + label: 'readers only'; + filterUpdater: [ :aFilter | + aFilter includeReaders: true. + aFilter includeWriters: false ]. + GtFilterModelPluggableItem new + label: 'writers only'; + filterUpdater: [ :aFilter | + aFilter includeReaders: false. + aFilter includeWriters: true ]} ]; selectFirstItem; displayAllItems. self assert: aModel itemsFuture wait size equals: 3. @@ -364,6 +376,7 @@ GtFilterModelExamples >> shortListModelParameter [ { #category : #examples } GtFilterModelExamples >> shortListModelPluggableItems [ + | aModel allItems aCollection anIconBuilder aLabelBuilder | aModel := GtFilterShortListModel new. @@ -380,11 +393,11 @@ GtFilterModelExamples >> shortListModelPluggableItems [ forCollection: aCollection icon: anIconBuilder label: aLabelBuilder. - + aModel items: allItems. aModel selectFirstItem. aModel name: 'Classes'. - + self assert: aModel selectedItem equals: (GtFilterModelPluggableItem new @@ -399,6 +412,7 @@ GtFilterModelExamples >> shortListModelPluggableItems [ { #category : #examples } GtFilterModelExamples >> shortListModelPluggableItemsWithIconAndLabelBuilders [ + | aModel aCollection anIconBuilder aLabelBuilder | aModel := GtFilterShortListModel new. @@ -434,6 +448,7 @@ GtFilterModelExamples >> shortListModelPluggableItemsWithIconAndLabelBuilders [ { #category : #examples } GtFilterModelExamples >> shortListModelPluggableItemsWithoutIconBuilder [ + | aModel aCollection aLabelBuilder | aModel := GtFilterShortListModel new. @@ -462,6 +477,7 @@ GtFilterModelExamples >> shortListModelPluggableItemsWithoutIconBuilder [ { #category : #examples } GtFilterModelExamples >> shortListModelPluggableItemsWithoutLabelBuilder [ + | aModel aCollection anIconBuilder | aModel := GtFilterShortListModel new. @@ -492,6 +508,7 @@ GtFilterModelExamples >> shortListModelPluggableItemsWithoutLabelBuilder [ { #category : #examples } GtFilterModelExamples >> shortListModelWithIcons [ + | aModel | aModel := GtFilterShortListModel new. aModel @@ -519,6 +536,7 @@ GtFilterModelExamples >> shortListModelWithIcons [ { #category : #examples } GtFilterModelExamples >> shortListModelWithParameter [ + | aModel | aModel := self shortListModel. aModel parameter: self shortListModelParameter. @@ -530,6 +548,7 @@ GtFilterModelExamples >> shortListModelWithParameter [ { #category : #examples } GtFilterModelExamples >> shortListModelWithParameter_changeParameterValue [ + | aModel aCollection aParameter anAnnouncement | aModel := self shortListModelWithParameter. @@ -552,6 +571,7 @@ GtFilterModelExamples >> shortListModelWithParameter_changeParameterValue [ { #category : #examples } GtFilterModelExamples >> textModel [ + | aModel | aModel := GtFilterTextModel new. aModel text: 'Object'. @@ -564,6 +584,7 @@ GtFilterModelExamples >> textModel [ { #category : #examples } GtFilterModelExamples >> toggleModel [ + | aModel | aModel := GtFilterToggleModel new. aModel name: 'Side'. @@ -578,6 +599,7 @@ GtFilterModelExamples >> toggleModel [ { #category : #examples } GtFilterModelExamples >> toggleModelWithIcons [ + | aModel | aModel := GtFilterToggleModel new. aModel name: 'Origin'. diff --git a/src/GToolkit-Coder-Examples/GtFilterTagElementExamples.class.st b/src/GToolkit-Coder-Examples/GtFilterTagElementExamples.class.st index 56bc86569..87d64eb60 100644 --- a/src/GToolkit-Coder-Examples/GtFilterTagElementExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtFilterTagElementExamples.class.st @@ -33,6 +33,7 @@ GtFilterTagElementExamples >> availableFilterDescriptors [ { #category : #examples } GtFilterTagElementExamples >> filterOffersCompletionValues [ + ^ GtFilterDescriptorExamples new filterDescriptorOffersCompletionValues named: 'Words' ] @@ -40,20 +41,17 @@ GtFilterTagElementExamples >> filterOffersCompletionValues [ { #category : #examples } GtFilterTagElementExamples >> filterTagCompletionOffersValues [ + | tagElement filterDescriptor | - filterDescriptor := self filterOffersCompletionValues. - + tagElement := GtFilterTagElement new - descriptor: filterDescriptor; - availableFilterDescriptors: self availableFilterDescriptors. + descriptor: filterDescriptor; + availableFilterDescriptors: self availableFilterDescriptors. self assert: (tagElement query // GtFilterTagLabelId) anyOne text asString - equals: 'Words'. - - "there is no editor" - "self assert: (tagElement query // GtFilterTagEditorId) isEmpty. + equals: 'Words'. "there is no editor" "self assert: (tagElement query // GtFilterTagEditorId) isEmpty. self assert: tagElement isValid." @@ -63,21 +61,19 @@ GtFilterTagElementExamples >> filterTagCompletionOffersValues [ { #category : #examples } GtFilterTagElementExamples >> filterTagValueNotRequired [ + | tagElement filterDescriptor | - filterDescriptor := self filterValueNotRequired. - + tagElement := GtFilterTagElement new - descriptor: filterDescriptor; - availableFilterDescriptors: self availableFilterDescriptors. + descriptor: filterDescriptor; + availableFilterDescriptors: self availableFilterDescriptors. self assert: (tagElement query // GtFilterTagLabelId) anyOne text asString - equals: 'Default without value'. - - "there is no editor" + equals: 'Default without value'. "there is no editor" self assert: (tagElement query // GtFilterTagEditorId) isEmpty. - + self assert: tagElement isValid. ^ tagElement @@ -86,6 +82,7 @@ GtFilterTagElementExamples >> filterTagValueNotRequired [ { #category : #examples } GtFilterTagElementExamples >> filterTagValueNotRequiredByScripter [ + | scripter | scripter := BlScripter new extent: 500 @ 400; @@ -157,11 +154,11 @@ GtFilterTagElementExamples >> filterTagValueNotRequiredByScripter [ { #category : #examples } GtFilterTagElementExamples >> filterTagValueRequiredWithDefault [ + | aTagElement | - aTagElement := GtFilterTagElement new - descriptor: self filterValueRequiredWithDefault; - availableFilterDescriptors: self availableFilterDescriptors. + descriptor: self filterValueRequiredWithDefault; + availableFilterDescriptors: self availableFilterDescriptors. ^ aTagElement ] @@ -169,20 +166,16 @@ GtFilterTagElementExamples >> filterTagValueRequiredWithDefault [ { #category : #examples } GtFilterTagElementExamples >> filterTagValueRequiredWithDefaultByScripter [ + | scripter | scripter := BlScripter new extent: 500 @ 400; element: self filterTagValueRequiredWithDefault. - scripter - assertStep: [ :s | - s - satisfies: [ :anElement | anElement isValid ] ]. + scripter assertStep: [ :s | s satisfies: [ :anElement | anElement isValid ] ]. scripter - assertStep: [ :s | - s - satisfies: [ :anElement | anElement hasFocus not ] ]. + assertStep: [ :s | s satisfies: [ :anElement | anElement hasFocus not ] ]. scripter assertStep: [ :s | @@ -204,13 +197,11 @@ GtFilterTagElementExamples >> filterTagValueRequiredWithDefaultByScripter [ { #category : #examples } GtFilterTagElementExamples >> filterTagValueRequiredWithDefaultByScripterRemoveText [ + | scripter | scripter := self filterTagValueRequiredWithDefaultByScripter. - scripter - clickStep: [ :s | - s - id: GtFilterTagEditorId ]. + scripter clickStep: [ :s | s id: GtFilterTagEditorId ]. scripter shortcut id: GtFilterTagEditorId; @@ -230,10 +221,7 @@ GtFilterTagElementExamples >> filterTagValueRequiredWithDefaultByScripterRemoveT id: GtFilterTagEditorId; value: [ :anEditor | anEditor text asString ] equals: '' ]. - scripter - assertStep: [ :s | - s - satisfies: [ :anEditor | anEditor isValid not ] ]. + scripter assertStep: [ :s | s satisfies: [ :anEditor | anEditor isValid not ] ]. scripter shortcut label: 'Accept changes with enter shortcut'; @@ -241,10 +229,7 @@ GtFilterTagElementExamples >> filterTagValueRequiredWithDefaultByScripterRemoveT combination: BlKeyCombination enter; play. - scripter - assertStep: [ :s | - s - eventNotFired: GtFilterTagUpdateWish ]. + scripter assertStep: [ :s | s eventNotFired: GtFilterTagUpdateWish ]. ^ scripter ] @@ -252,13 +237,11 @@ GtFilterTagElementExamples >> filterTagValueRequiredWithDefaultByScripterRemoveT { #category : #examples } GtFilterTagElementExamples >> filterTagValueRequiredWithDefaultByScripterTypeAndAcceptWithClickingAway [ + | scripter | scripter := self filterTagValueRequiredWithDefaultByScripter. - scripter - clickStep: [ :s | - s - id: GtFilterTagEditorId ]. + scripter clickStep: [ :s | s id: GtFilterTagEditorId ]. scripter assertStep: [ :s | @@ -282,7 +265,7 @@ GtFilterTagElementExamples >> filterTagValueRequiredWithDefaultByScripterTypeAnd s label: 'Check that the new value is typed in the editor'; id: GtFilterTagEditorId; - value: [ "intentionally added spaces to test trimming":anEditor | anEditor text asString ] + value: [ :anEditor "intentionally added spaces to test trimming" | anEditor text asString ] equals: ' New value ' ]. scripter @@ -291,10 +274,7 @@ GtFilterTagElementExamples >> filterTagValueRequiredWithDefaultByScripterTypeAnd id: GtFilterTagEditorId; satisfies: [ :anEditor | anEditor hasFocus ] ]. - scripter - clickStep: [ :s | - s - id: GtFilterTagLabelId ]. + scripter clickStep: [ :s | s id: GtFilterTagLabelId ]. scripter assertStep: [ :s | @@ -317,13 +297,11 @@ GtFilterTagElementExamples >> filterTagValueRequiredWithDefaultByScripterTypeAnd { #category : #examples } GtFilterTagElementExamples >> filterTagValueRequiredWithDefaultByScripterTypeAndAcceptWithShortcut [ + | scripter | scripter := self filterTagValueRequiredWithDefaultByScripter. - scripter - clickStep: [ :s | - s - id: GtFilterTagEditorId ]. + scripter clickStep: [ :s | s id: GtFilterTagEditorId ]. scripter assertStep: [ :s | @@ -347,7 +325,7 @@ GtFilterTagElementExamples >> filterTagValueRequiredWithDefaultByScripterTypeAnd s label: 'Check that the new value is typed in the editor'; id: GtFilterTagEditorId; - value: [ "intentionally added spaces to test trimming":anEditor | anEditor text asString ] + value: [ :anEditor "intentionally added spaces to test trimming" | anEditor text asString ] equals: ' New value ' ]. scripter shortcut @@ -371,11 +349,11 @@ GtFilterTagElementExamples >> filterTagValueRequiredWithDefaultByScripterTypeAnd { #category : #examples } GtFilterTagElementExamples >> filterTagValueRequiredWithoutDefault [ + | aTagElement | - aTagElement := GtFilterTagElement new - descriptor: self filterValueRequiredWithoutDefault; - availableFilterDescriptors: self availableFilterDescriptors. + descriptor: self filterValueRequiredWithoutDefault; + availableFilterDescriptors: self availableFilterDescriptors. ^ aTagElement ] @@ -383,15 +361,13 @@ GtFilterTagElementExamples >> filterTagValueRequiredWithoutDefault [ { #category : #examples } GtFilterTagElementExamples >> filterTagValueRequiredWithoutDefaultByScripter [ + | scripter | scripter := BlScripter new extent: 500 @ 400; element: self filterTagValueRequiredWithoutDefault. - scripter - assertStep: [ :s | - s - satisfies: [ :anElement | anElement isValid ] ]. + scripter assertStep: [ :s | s satisfies: [ :anElement | anElement isValid ] ]. scripter assertStep: [ :s | @@ -417,6 +393,7 @@ GtFilterTagElementExamples >> filterTagValueRequiredWithoutDefaultByScripter [ { #category : #examples } GtFilterTagElementExamples >> filterValueNotRequired [ + ^ GtFilterDescriptorExamples new filterDescriptorValueNotRequired named: 'Default without value' ] @@ -424,18 +401,16 @@ GtFilterTagElementExamples >> filterValueNotRequired [ { #category : #examples } GtFilterTagElementExamples >> filterValueRequiredWithDefault [ - - ^ (GtFilterDescriptorExamples new - newFilterDescriptor) - named: 'Default with value'; - emptyDefaultValue: 'Default' + + ^ GtFilterDescriptorExamples new newFilterDescriptor + named: 'Default with value'; + emptyDefaultValue: 'Default' ] { #category : #examples } GtFilterTagElementExamples >> filterValueRequiredWithoutDefault [ - - ^ (GtFilterDescriptorExamples new - newFilterDescriptor) - named: 'Default with value' + + ^ GtFilterDescriptorExamples new newFilterDescriptor + named: 'Default with value' ] diff --git a/src/GToolkit-Coder-Examples/GtFiltersElementExamples.class.st b/src/GToolkit-Coder-Examples/GtFiltersElementExamples.class.st index 9f580bb75..7e10cd4b2 100644 --- a/src/GToolkit-Coder-Examples/GtFiltersElementExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtFiltersElementExamples.class.st @@ -7,8 +7,8 @@ Class { { #category : #examples } GtFiltersElementExamples >> emptyFiltersElement [ + | aFiltersElement | - aFiltersElement := GtFiltersElement new. self assert: (aFiltersElement query // GtFiltersAddButtonId) isNotEmpty. @@ -46,6 +46,7 @@ GtFiltersElementExamples >> filterDescriptors [ { #category : #examples } GtFiltersElementExamples >> filtersElementWithDescriptors [ + | filtersElement scripter | filtersElement := self emptyFiltersElement. filtersElement descriptors: self filterDescriptors. @@ -65,6 +66,7 @@ GtFiltersElementExamples >> filtersElementWithDescriptors [ { #category : #examples } GtFiltersElementExamples >> filtersElementWithDescriptorsBuildFilters [ + | scripter | scripter := self filtersElementWithDescriptors. scripter element @@ -81,10 +83,7 @@ GtFiltersElementExamples >> filtersElementWithDescriptorsBuildFilters [ addFilterForDescriptor: eachFilterAndValue key andValue: eachFilterAndValue value ] ] ]. - scripter - clickStep: [ :s | - s - id: GtFiltersAddButtonId ]. + scripter clickStep: [ :s | s id: GtFiltersAddButtonId ]. scripter assertStep: [ :s | @@ -93,10 +92,7 @@ GtFiltersElementExamples >> filtersElementWithDescriptorsBuildFilters [ @ 3; satisfies: [ :aTagElement | aTagElement hasFocus ] ]. - scripter - assertStep: [ :s | - s - eventNotFired: GtFiltersChangedEvent ]. + scripter assertStep: [ :s | s eventNotFired: GtFiltersChangedEvent ]. scripter shortcut // GtFilterTagElement; @@ -117,6 +113,7 @@ GtFiltersElementExamples >> filtersElementWithDescriptorsBuildFilters [ { #category : #examples } GtFiltersElementExamples >> filtersElementWithDescriptorsReplaceFilterWithTheSameFilter [ + | scripter | scripter := self filtersElementWithDescriptors. diff --git a/src/GToolkit-Coder-Examples/GtIntersectionFilterExamples.class.st b/src/GToolkit-Coder-Examples/GtIntersectionFilterExamples.class.st index 698fc2562..3b9a91ba8 100644 --- a/src/GToolkit-Coder-Examples/GtIntersectionFilterExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtIntersectionFilterExamples.class.st @@ -7,25 +7,25 @@ Class { { #category : #'as yet unclassified' } GtIntersectionFilterExamples >> intersectionDifferentFilters [ + | filter1 filter2 intersection | - filter1 := #gtExample gtPragmas. filter2 := #filter gtReferences. intersection := filter1 & filter2. self assert: (intersection matches: thisContext method). - ^ intersection. + ^ intersection ] { #category : #'as yet unclassified' } GtIntersectionFilterExamples >> intersectionSameFilter [ + | filter intersection | - filter := #gtExample gtPragmas. intersection := filter & filter. - + self assert: intersection size equals: filter size. self assert: (intersection matches: thisContext method). - - ^ intersection. + + ^ intersection ] diff --git a/src/GToolkit-Coder-Examples/GtMagritteModelExamples.extension.st b/src/GToolkit-Coder-Examples/GtMagritteModelExamples.extension.st index db14ade55..e4331d14f 100644 --- a/src/GToolkit-Coder-Examples/GtMagritteModelExamples.extension.st +++ b/src/GToolkit-Coder-Examples/GtMagritteModelExamples.extension.st @@ -2,24 +2,25 @@ Extension { #name : #GtMagritteModelExamples } { #category : #'*GToolkit-Coder-Examples' } GtMagritteModelExamples >> simpleBaselineDescription [ - - ^ MAPriorityContainer withAll: { (MAStringDescription new - accessor: (MADictionaryAccessor key: #baseline); - beAlwaysEditable; - blocCompletion: [ GtClassesCompletionStrategy new ]; - beRequired; - addCondition: [ :aValue | aValue beginsWith: 'BaselineOf' ] - labelled: 'Baseline name must begin with BaselineOf'; - addCondition: [ :aValue | - (Smalltalk globals includesKey: aValue asSymbol) not ] - labelled: 'Baseline name must be a non-existent class'; - comment: 'Baseline name') } + + ^ MAPriorityContainer + withAll: {MAStringDescription new + accessor: (MADictionaryAccessor key: #baseline); + beAlwaysEditable; + blocCompletion: [ GtClassesCompletionStrategy new ]; + beRequired; + addCondition: [ :aValue | aValue beginsWith: 'BaselineOf' ] + labelled: 'Baseline name must begin with BaselineOf'; + addCondition: [ :aValue | (Smalltalk globals includesKey: aValue asSymbol) not ] + labelled: 'Baseline name must be a non-existent class'; + comment: 'Baseline name'} ] { #category : #'*GToolkit-Coder-Examples' } GtMagritteModelExamples >> simpleBaselinesDescription [ + ^ MAPriorityContainer withAll: {MAToManyRelationDescription new label: 'Baselines'; @@ -53,24 +54,24 @@ GtMagritteModelExamples >> simpleBaselinesDescription [ do: [ :aRequest | | aValue | aValue := (aTagger tags collect: #name) - add: aRequest tag name; - yourself. + add: aRequest tag name; + yourself. GtMagritteBuilderUtility - write: aValue - using: aDescription - memento: aMemento + write: aValue + using: aDescription + memento: aMemento element: aTagger ]. aTagger when: BrTaggerRemoveTagRequest do: [ :aRequest | | aValue | aValue := (aTagger tags collect: #name) - remove: aRequest tag name; - yourself. + remove: aRequest tag name; + yourself. GtMagritteBuilderUtility - write: aValue - using: aDescription - memento: aMemento + write: aValue + using: aDescription + memento: aMemento element: aTagger ]. aTagger withAsyncSinkDo: [ :anElementSink | diff --git a/src/GToolkit-Coder-Examples/GtMagritteViewModelExamples.extension.st b/src/GToolkit-Coder-Examples/GtMagritteViewModelExamples.extension.st index be13c22da..5805c8f77 100644 --- a/src/GToolkit-Coder-Examples/GtMagritteViewModelExamples.extension.st +++ b/src/GToolkit-Coder-Examples/GtMagritteViewModelExamples.extension.st @@ -2,14 +2,12 @@ Extension { #name : #GtMagritteViewModelExamples } { #category : #'*GToolkit-Coder-Examples' } GtMagritteViewModelExamples >> asyncViewModelWithSimpleBaseline [ - + | aViewModel anObject aDescription | anObject := self simpleBaselineObject. aDescription := self simpleBaselineDescription. - aViewModel := GtMagritteViewModel - forObject: anObject - description: aDescription. + aViewModel := GtMagritteViewModel forObject: anObject description: aDescription. self assert: aViewModel mementoFuture isAsyncFuture. @@ -18,15 +16,12 @@ GtMagritteViewModelExamples >> asyncViewModelWithSimpleBaseline [ { #category : #'*GToolkit-Coder-Examples' } GtMagritteViewModelExamples >> asyncViewModelWithSimpleBaselines [ - + | aViewModel anObject aDescription | anObject := GtMagritteModelExamples new simpleBaselinesObject. - aDescription := GtMagritteModelExamples new - simpleBaselinesDescription. - aViewModel := GtMagritteViewModel - forObject: anObject - description: aDescription. + aDescription := GtMagritteModelExamples new simpleBaselinesDescription. + aViewModel := GtMagritteViewModel forObject: anObject description: aDescription. self assert: aViewModel mementoFuture isAsyncFuture. @@ -35,12 +30,12 @@ GtMagritteViewModelExamples >> asyncViewModelWithSimpleBaselines [ { #category : #'*GToolkit-Coder-Examples' } GtMagritteViewModelExamples >> elementWithSimpleBaseline [ - + | aViewModel anElement | aViewModel := self asyncViewModelWithSimpleBaseline. anElement := aViewModel asElement. - + self assert: anElement isNotNil. ^ anElement @@ -48,22 +43,19 @@ GtMagritteViewModelExamples >> elementWithSimpleBaseline [ { #category : #'*GToolkit-Coder-Examples' } GtMagritteViewModelExamples >> simpleBaselineDescription [ - + ^ GtMagritteModelExamples new simpleBaselineDescription ] { #category : #'*GToolkit-Coder-Examples' } GtMagritteViewModelExamples >> viewModelWithBaselines [ - + | aViewModel anObject aDescription | anObject := GtMagritteModelExamples new simpleBaselinesObject. - aDescription := GtMagritteModelExamples new - simpleBaselinesDescription. - aViewModel := GtMagritteViewModel - forObject: anObject - description: aDescription. + aDescription := GtMagritteModelExamples new simpleBaselinesDescription. + aViewModel := GtMagritteViewModel forObject: anObject description: aDescription. self assert: aViewModel mementoFuture isAsyncFuture. @@ -73,6 +65,7 @@ GtMagritteViewModelExamples >> viewModelWithBaselines [ { #category : #'*GToolkit-Coder-Examples' } GtMagritteViewModelExamples >> viewModelWithBaselinesWithoutSaveOrCancelButton [ + | aViewModel | aViewModel := self viewModelWithBaselines. diff --git a/src/GToolkit-Coder-Examples/GtSearchNullFilterExamples.class.st b/src/GToolkit-Coder-Examples/GtSearchNullFilterExamples.class.st index 98a0acbf1..083453e17 100644 --- a/src/GToolkit-Coder-Examples/GtSearchNullFilterExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtSearchNullFilterExamples.class.st @@ -7,12 +7,13 @@ Class { { #category : #'as yet unclassified' } GtSearchNullFilterExamples >> nullSearchFilter [ + | filter | filter := GtSearchNullFilter new. - + self assert: (filter matches: thisContext method) not. self assert: (filter matches: 'GToolkit-Coder' asPackage) not. - self assert: (filter isEmpty). - - ^ filter. + self assert: filter isEmpty. + + ^ filter ] diff --git a/src/GToolkit-Coder-Examples/GtSyncScrollRangesExamples.class.st b/src/GToolkit-Coder-Examples/GtSyncScrollRangesExamples.class.st index fe217a566..c407cb7d0 100644 --- a/src/GToolkit-Coder-Examples/GtSyncScrollRangesExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtSyncScrollRangesExamples.class.st @@ -7,12 +7,14 @@ Class { { #category : #examples } GtSyncScrollRangesExamples >> example [ + ^ GtSyncScrollRanges createFromChange: self exampleDiff ] { #category : #examples } GtSyncScrollRangesExamples >> exampleDiff [ + ^ GtDiffBuilder computeDifferencesFrom: self originalString to: self newString @@ -22,6 +24,7 @@ GtSyncScrollRangesExamples >> exampleDiff [ { #category : #examples } GtSyncScrollRangesExamples >> multilineCode [ + | change ranges | change := GtDiffBuilderExamples new tokenChanges. ranges := GtSyncScrollRanges createFromChange: change. @@ -32,6 +35,7 @@ GtSyncScrollRangesExamples >> multilineCode [ { #category : #accessing } GtSyncScrollRangesExamples >> multipleChanges [ + | diff ranges | diff := GtDiffBuilderExamples new multipleChanges. ranges := GtSyncScrollRanges createFromChange: diff. @@ -49,6 +53,7 @@ GtSyncScrollRangesExamples >> multipleChanges [ { #category : #private } GtSyncScrollRangesExamples >> newString [ + ^ '1 4 5 @@ -61,6 +66,7 @@ GtSyncScrollRangesExamples >> newString [ { #category : #accessing } GtSyncScrollRangesExamples >> nextPreviousLeftChange [ + | diff ranges | diff := GtDiffBuilderExamples new deletionsInMiddle. ranges := GtSyncScrollRanges createFromChange: diff. @@ -72,6 +78,7 @@ GtSyncScrollRangesExamples >> nextPreviousLeftChange [ { #category : #accessing } GtSyncScrollRangesExamples >> nextPreviousMultipleChanges [ + | ranges | ranges := self multipleChanges. self validateNextLeftChangeIn: ranges equals: #(1 2 4). @@ -82,6 +89,7 @@ GtSyncScrollRangesExamples >> nextPreviousMultipleChanges [ { #category : #accessing } GtSyncScrollRangesExamples >> nextPreviousRightChange [ + | diff ranges | diff := GtDiffBuilderExamples new insertionsInMiddle. ranges := GtSyncScrollRanges createFromChange: diff. @@ -93,6 +101,7 @@ GtSyncScrollRangesExamples >> nextPreviousRightChange [ { #category : #private } GtSyncScrollRangesExamples >> originalString [ + ^ '1 2 3 @@ -106,6 +115,7 @@ GtSyncScrollRangesExamples >> originalString [ { #category : #examples } GtSyncScrollRangesExamples >> reversedMultilineCode [ + | change ranges | change := GtDiffBuilderExamples new reversedTokenChanges. ranges := GtSyncScrollRanges createFromChange: change. @@ -116,6 +126,7 @@ GtSyncScrollRangesExamples >> reversedMultilineCode [ { #category : #examples } GtSyncScrollRangesExamples >> textDiffExample [ + ^ GtSyncScrollRanges createFromDiff: (TextDiffBuilder from: self originalString to: self newString) ] @@ -123,6 +134,7 @@ GtSyncScrollRangesExamples >> textDiffExample [ { #category : #examples } GtSyncScrollRangesExamples >> textDiffNextChange [ + | ranges | ranges := self textDiffExample. self validateNextLeftChangeIn: ranges equals: #(1 2 7 8 2). diff --git a/src/GToolkit-Coder-Examples/GtUnionFilterExamples.class.st b/src/GToolkit-Coder-Examples/GtUnionFilterExamples.class.st index 7c1aad5f2..d995820f3 100644 --- a/src/GToolkit-Coder-Examples/GtUnionFilterExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtUnionFilterExamples.class.st @@ -7,6 +7,7 @@ Class { { #category : #examples } GtUnionFilterExamples >> unionDifferentMethods [ + | filter1 filter2 union | filter1 := thisContext method selector gtImplementors. filter2 := #foo gtImplementors. @@ -19,6 +20,7 @@ GtUnionFilterExamples >> unionDifferentMethods [ { #category : #examples } GtUnionFilterExamples >> unionNullFilter [ + | filter union | filter := thisContext method selector gtImplementors. union := GtSearchNullFilter new | filter | filter. @@ -30,6 +32,7 @@ GtUnionFilterExamples >> unionNullFilter [ { #category : #examples } GtUnionFilterExamples >> unionSameFilters [ + | filter union | filter := thisContext method selector gtImplementors. union := filter | filter. diff --git a/src/GToolkit-Coder-Examples/RBRenameClassWithCommentsRefactoringExamples.class.st b/src/GToolkit-Coder-Examples/RBRenameClassWithCommentsRefactoringExamples.class.st index 904cebc42..4f5a1f577 100644 --- a/src/GToolkit-Coder-Examples/RBRenameClassWithCommentsRefactoringExamples.class.st +++ b/src/GToolkit-Coder-Examples/RBRenameClassWithCommentsRefactoringExamples.class.st @@ -18,6 +18,7 @@ RBRenameClassWithCommentsRefactoringExamples >> renameClassComment [ "This comment with RBRenameClassWithCommentsRefactoringExamples should be renamed" + | model refactoring cls newName | model := RBNamespace new. cls := model classFor: RBRenameClassWithCommentsRefactoringExamples. From bf10a0b6aa320c3575a86627c680a17781c0bf92 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 5 May 2025 11:53:14 -0400 Subject: [PATCH 0928/1268] make fix-it popover navigable using keyboard [feenkcom/gtoolkit#4522] --- .../GtFixItAttribute.class.st | 61 +++++++++++++------ ...GtAbstractCoderContextMenuContent.class.st | 1 + .../GtCoderContextMenuContent.class.st | 8 +++ 3 files changed, 51 insertions(+), 19 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st index acf983996..a4ff5b2b9 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st @@ -84,6 +84,8 @@ GtFixItAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ self addHoveringStylingFor: anEditorElement to: element. element ]. + dropDownAptitude withGainFocusOnShow. + button aptitude: BrGlamorousButtonWithIconAptitude - BrGlamorousButtonExteriorAptitude + dropDownAptitude. @@ -98,30 +100,51 @@ GtFixItAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ { #category : #accessing } GtFixItAttribute >> dropDownElementFor: anEditorElement [ | pane menuElement computedFixItActions menuItems | - computedFixItActions := fixItActionsBlock value. menuItems := self computeMenuItemsForFixItActions: computedFixItActions. - + pane := BrVerticalPane new. pane fitContent. - - descriptionBlock ifNotNil: [ - | labelText | - labelText := self - computeDescriptionTextInEditorElement: anEditorElement - forFixItActions: computedFixItActions. - - menuItems isEmpty - ifTrue: [ labelText width: 200 ] - ifFalse: [ labelText hMatchParent ]. - - pane addChild: labelText ]. - - menuElement := GtCoderContextMenuContent new - editorElement: anEditorElement; - items: menuItems. + + descriptionBlock + ifNotNil: [ | labelText | + labelText := self + computeDescriptionTextInEditorElement: anEditorElement + forFixItActions: computedFixItActions. + + menuItems isEmpty + ifTrue: [ labelText width: 200 ] + ifFalse: [ labelText hMatchParent ]. + + pane addChild: labelText ]. + + menuItems ifNotEmpty: [ + menuElement := GtCoderContextMenuContent new + beFocusable; + editorElement: anEditorElement; + items: menuItems; + addShortcut: (BlShortcutWithAction new + combination: BlKeyCombination enter; + name: 'Perform fix'; + description: 'Perform a fix-it action'; + action: [ :aShortcutEvent :aShortcut | + aShortcutEvent consumed: true. + menuElement selectedItemDo: [ :eachGtCoderContextMenuAction | + eachGtCoderContextMenuAction action + cull: anEditorElement textualCoderViewModel + cull: anEditorElement + cull: aShortcutEvent. + menuElement fireEvent: BrDropdownHideWish new. + menuElement fireEvent: BrContextMenuHideWish new ] ]). - pane addChild: menuElement. + pane + when: BrPopoverGainFocusWish + do: [ :anEvent | + menuElement + requestFocus; + selectOne: 1 ]. + + pane addChild: menuElement ]. ^ pane ] diff --git a/src/GToolkit-Coder-UI/GtAbstractCoderContextMenuContent.class.st b/src/GToolkit-Coder-UI/GtAbstractCoderContextMenuContent.class.st index cf81be0b8..5dbb86f82 100644 --- a/src/GToolkit-Coder-UI/GtAbstractCoderContextMenuContent.class.st +++ b/src/GToolkit-Coder-UI/GtAbstractCoderContextMenuContent.class.st @@ -40,5 +40,6 @@ GtAbstractCoderContextMenuContent >> menuItemStencil [ { #category : #accessing } GtAbstractCoderContextMenuContent >> selectionAptitude [ ^ BrStyleCommonAptitude new + selected: [ :aStyle | aStyle background: self theme item selectedColor ]; hovered: [ :aStyle | aStyle background: self theme item selectedColor ] ] diff --git a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st index 744448e7d..e6591dfb5 100644 --- a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st +++ b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st @@ -89,5 +89,13 @@ GtCoderContextMenuContent >> menuItemStencil [ leave cull: self editorElement textualCoderViewModel cull: anEvent ] ]. eachGtCoderContextMenuAction name ifNotNil: [ :anActionName | element containerName: anActionName ]. + + eachGtCoderContextMenuAction isEnabled ifTrue: [ + element + when: BlMouseEnterEvent + do: [ :anEvent | self selectOne: aRowIndex ]; + when: BlMouseLeaveEvent + do: [ :anEvent | self deselectOne: aRowIndex ] ]. + element ] ] From 27f0ae804218a7d8895c6a66bc9d9aef1466f4a4 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 5 May 2025 13:52:09 -0400 Subject: [PATCH 0929/1268] wrench fix-it button displays a shortcut in its tooltip [feenkcom/gtoolkit#4522] --- src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st index 861d3473a..2a55ca9ca 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st @@ -87,8 +87,9 @@ GtFixItAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ dropDownAptitude withGainFocusOnShow. button - aptitude: BrGlamorousButtonWithIconAptitude - BrGlamorousButtonExteriorAptitude - + dropDownAptitude. + aptitude: BrGlamorousButtonWithIconAptitude - BrGlamorousButtonExteriorAptitude - BrGlamorousButtonWithLabelTooltipAptitude2; + addAptitude: dropDownAptitude; + addAptitude: (BrGlamorousWithExplicitTooltipAptitude text: (label ifNil: [ 'Fix it' ]) shortcut: BlKeyCombination primaryT). button userData at: #fixItAttribute put: self. button userData at: #dropDownAptitude put: dropDownAptitude. button icon: BrGlamorousVectorIcons repair. From df59b4016f843e3bcfedb9d1d33c2432330cfa46 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 5 May 2025 16:40:32 -0400 Subject: [PATCH 0930/1268] extract search text addon to its own method [feenkcom/gtoolkit#4504] --- src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st index 048bb2052..81ab64eb2 100644 --- a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st +++ b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st @@ -73,9 +73,8 @@ GtTextualCoder >> addExplicitContextMenu: aString block: aBlock to: coderAddOns ] { #category : #'*GToolkit-Coder-AddOns' } -GtTextualCoder >> initializeAddOns: addOns viewModel: aCoderViewModel [ +GtTextualCoder >> initializeSearchTextAddOns: addOns viewModel: aCoderViewModel [ | aStyler aWeakElement | - super initializeAddOns: addOns viewModel: aCoderViewModel. GtTextualCoderSearchTextSettings isEnabledInCoder ifFalse: [ ^ self ]. From 42c963bd9d05bef68c7609b1a23c0c549a05149b Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 5 May 2025 16:42:41 -0400 Subject: [PATCH 0931/1268] enable search text addon by default [feenkcom/gtoolkit#4504] --- src/GToolkit-Coder-UI/GtTextualCoderSearchTextSettings.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderSearchTextSettings.class.st b/src/GToolkit-Coder-UI/GtTextualCoderSearchTextSettings.class.st index 86681edc8..8842b4b03 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderSearchTextSettings.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderSearchTextSettings.class.st @@ -19,5 +19,5 @@ GtTextualCoderSearchTextSettings class >> enableInCoder [ { #category : #settings } GtTextualCoderSearchTextSettings class >> isEnabledInCoder [ - ^ IsEnabledInCoder ifNil: [ false ] + ^ IsEnabledInCoder ifNil: [ true ] ] From 494d2152e715db38f20b7f554e06ea15c7a95098 Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Tue, 6 May 2025 08:29:00 +0200 Subject: [PATCH 0932/1268] make the search action element id be different from the save action one feenkcom/gtoolkit#4504 --- src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st | 2 +- src/GToolkit-Coder-UI/GtCoderSearchActionId.class.st | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderSearchActionId.class.st diff --git a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st index 81ab64eb2..957f79c29 100644 --- a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st +++ b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st @@ -86,7 +86,7 @@ GtTextualCoder >> initializeSearchTextAddOns: addOns viewModel: aCoderViewModel stencil: [ BrButton new aptitude: BrGlamorousButtonWithIconAptitude; icon: BrGlamorousVectorIcons search; - id: GtMethodCoderSaveActionId; + id: GtCoderSearchActionId; label: 'Search'; beTinySize; when: BrDropdownIsHidden diff --git a/src/GToolkit-Coder-UI/GtCoderSearchActionId.class.st b/src/GToolkit-Coder-UI/GtCoderSearchActionId.class.st new file mode 100644 index 000000000..191b3191b --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderSearchActionId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtCoderSearchActionId, + #superclass : #GtCoderElementId, + #category : #'GToolkit-Coder-UI-Coder - Ids' +} + +{ #category : #converting } +GtCoderSearchActionId >> asSymbol [ + ^ #'main-action--search' +] From e91c292b2160082eb21e2bc3197786a61db66177 Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 6 May 2025 05:48:05 -0500 Subject: [PATCH 0933/1268] [feenkcom/gtoolkit#4517] focus menu when displaying undeclared variable compiler error --- .../GtSourceCoderErrorFixItAttribute.class.st | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderErrorFixItAttribute.class.st b/src/GToolkit-Coder-UI/GtSourceCoderErrorFixItAttribute.class.st index 2aada7d35..2945a0a65 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderErrorFixItAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderErrorFixItAttribute.class.st @@ -24,7 +24,11 @@ GtSourceCoderErrorFixItAttribute >> buildPopupIn: anEditorElement aptitude: apti action: [ :aShortcutEvent :aShortcutAction | aShortcutEvent currentTarget fireEvent: BrDropdownHideWish new. anEditorElement requestFocus ]) ]. - element enqueueTask: [ element requestFocus ] asBlTask. + element + enqueueTask: [ (element + allChildrenBreadthFirstDetect: [ :each | each isKindOf: GtCoderContextMenuContent ] + ifFound: [ :each | each ] + ifNone: [ element ]) requestFocus ] asBlTask. ^ element ] From f0a8efcf4b3212768bbc49f52e3c034caa8f6ab7 Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 6 May 2025 05:52:06 -0500 Subject: [PATCH 0934/1268] reapplying fix for changing fix it attribute to fit contents for description --- src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st index 2a55ca9ca..641db90c9 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st @@ -113,10 +113,6 @@ GtFixItAttribute >> dropDownElementFor: anEditorElement [ computeDescriptionTextInEditorElement: anEditorElement forFixItActions: computedFixItActions. - menuItems isEmpty - ifTrue: [ labelText width: 200 ] - ifFalse: [ labelText hMatchParent ]. - pane addChild: labelText ]. menuItems ifNotEmpty: [ From 36e9b85c9761341acd08ef09c270d59ea468c79c Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 6 May 2025 13:06:49 -0400 Subject: [PATCH 0935/1268] push `GtSourceCoderViewModel>>#requestSearch` to its superclass [feenkcom/gtoolkit#4504] --- src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st | 11 ----------- .../GtTextualCoderViewModel.class.st | 11 +++++++++++ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st index c7fc0dd8e..678bf142f 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st @@ -467,17 +467,6 @@ GtSourceCoderViewModel >> requestSave [ ifFalse: [ self save ] ] -{ #category : #'api - actions' } -GtSourceCoderViewModel >> requestSearch [ - "Request the view model to start the saving process. We first send a corresponding announcement to - allow UI to intercept the saving request and show, for example, a confirmation dialog. If an announcement - was not consumed (= handled) proceed with the default save action" - | anAnnouncement | - - anAnnouncement := GtSourceCoderViewModelSearchTextRequested new textualCoderViewModel: self. - self announce: anAnnouncement. -] - { #category : #'api - actions' } GtSourceCoderViewModel >> save [ "Attempt to save the source code in a default context. For example in terms of a method, the changes would diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 590dd59a8..cb1cf4b77 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -705,6 +705,17 @@ GtTextualCoderViewModel >> removeStylersOfClass: aGtCoderStylerClass [ extraAddOns removeStylersOfClass: aGtCoderStylerClass ] +{ #category : #'api - actions' } +GtTextualCoderViewModel >> requestSearch [ + "Request the view model to start the saving process. We first send a corresponding announcement to + allow UI to intercept the saving request and show, for example, a confirmation dialog. If an announcement + was not consumed (= handled) proceed with the default save action" + | anAnnouncement | + + anAnnouncement := GtSourceCoderViewModelSearchTextRequested new textualCoderViewModel: self. + self announce: anAnnouncement. +] + { #category : #'api - attribute state' } GtTextualCoderViewModel >> resetNodeAttributeMapForStyler: aStyler [ nodeAttributeMap at: aStyler class put: Dictionary new From 0b5b5ad77c1c55d8c1715f2f9939d64e984aecd4 Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Wed, 7 May 2025 14:40:32 +0200 Subject: [PATCH 0936/1268] properly use the class variables for the word movement and double click when initializing an coder editor feenkcom/toolkit#4525 --- src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st index abf6d7592..bd072f4a2 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st @@ -7,8 +7,8 @@ Class { { #category : #initalization } GtSourceCoderEditorElement >> initialize [ super initialize. - self editor doubleClickWordClassifier: BrSmalltalkWordClassifier new. - self editor movementWordClassifier: BrCamelCaseWordClassifier new. + self editor doubleClickWordClassifier: GtSmalltalkSourceCoder doubleClickClassifier. + self editor movementWordClassifier: GtSmalltalkSourceCoder wordMovementClassifier. ] { #category : #'api - textual coder view model' } From 184893bd9801bb80b4f30afc8ec36a319bf99575 Mon Sep 17 00:00:00 2001 From: John Brant Date: Wed, 7 May 2025 09:32:13 -0500 Subject: [PATCH 0937/1268] changing error attribute display --- .../GtSourceCoderErrorAttribute.class.st | 14 ++------------ .../GtSourceCoderErrorFixItAttribute.class.st | 5 ----- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st index 41590c077..a6f884cb6 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st @@ -24,12 +24,10 @@ GtSourceCoderErrorAttribute >> buildPopupIn: anEditorElement aptitude: aptitude pane := BrVerticalPane new. pane id: GtSourceCoderErrorContentElementId. pane matchParent. - pane background: BrGlamorousColors errorBackgroundColor. string lines do: [ :line | text := line asRopedText - medium; - glamorousCodeFontAndSmallSize. + glamorousCodeSmallSize. textElement := BlTextElement new. textElement text: text. textElement padding: (BlInsets all: 10). @@ -74,10 +72,7 @@ GtSourceCoderErrorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditor addAptitude: (aptitude := BrGlamorousWithExplicitDropdownAptitude handle: [ self errorButton ] content: [ self buildPopupIn: anEditorElement aptitude: aptitude ] - containerDo: [ :aMenuContainer | - aMenuContainer border: (BlBorder paint: BrGlamorousColors errorBackgroundColor). - self showErrorBackground - ifTrue: [ aMenuContainer background: BrGlamorousColors errorBackgroundColor ] ]). + containerDo: [ :aMenuContainer | aMenuContainer border: (BlBorder paint: BrGlamorousColors errorBackgroundColor) ]). openOnFirstShow ifTrue: [ button enqueueTask: [ openOnFirstShow := false. @@ -117,8 +112,3 @@ GtSourceCoderErrorAttribute >> openOnFirstShow [ GtSourceCoderErrorAttribute >> openOnFirstShow: aBoolean [ openOnFirstShow := aBoolean ] - -{ #category : #accessing } -GtSourceCoderErrorAttribute >> showErrorBackground [ - ^ true -] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderErrorFixItAttribute.class.st b/src/GToolkit-Coder-UI/GtSourceCoderErrorFixItAttribute.class.st index 2945a0a65..cdba867a2 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderErrorFixItAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderErrorFixItAttribute.class.st @@ -41,8 +41,3 @@ GtSourceCoderErrorFixItAttribute >> fixItAttribute [ GtSourceCoderErrorFixItAttribute >> fixItAttribute: anObject [ fixItAttribute := anObject ] - -{ #category : #testing } -GtSourceCoderErrorFixItAttribute >> showErrorBackground [ - ^ false -] From 21f33235f42367894f0a6a0b126de99e4bde708e Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 9 May 2025 11:00:21 -0400 Subject: [PATCH 0938/1268] add search text styler to the view model [feenkcom/gtoolkit#4504] --- src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st index 957f79c29..1f309c975 100644 --- a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st +++ b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st @@ -78,7 +78,7 @@ GtTextualCoder >> initializeSearchTextAddOns: addOns viewModel: aCoderViewModel GtTextualCoderSearchTextSettings isEnabledInCoder ifFalse: [ ^ self ]. - addOns addStyler: (aStyler := BrEditorSearchTextStyler new). + aCoderViewModel addStyler: (aStyler := BrEditorSearchTextStyler new). addOns addMainAction: (GtCoderCustomAction new From 78181fd2b007657b0898e6fa7b7067a922da3b8c Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 12 May 2025 16:05:50 -0400 Subject: [PATCH 0939/1268] search text: patter marker that works with different text sources [feenkcom/gtoolkit#4504] --- ...EditorSearchTextMarkerContext.extension.st | 6 ++ .../GtTextualCoderEditorElement.class.st | 31 ++++++++ ...GetTextAndVisibleTextAnnouncement.class.st | 40 ++++++++++ ...ualCoderViewModelSearchTextSource.class.st | 79 +++++++++++++++++++ ...lSearchTextUpdateTextAnnouncement.class.st | 40 ++++++++++ 5 files changed, 196 insertions(+) create mode 100644 src/GToolkit-Coder-AddOns/BrEditorSearchTextMarkerContext.extension.st create mode 100644 src/GToolkit-Coder-UI/GtTextualCoderViewModelSearchTextGetTextAndVisibleTextAnnouncement.class.st create mode 100644 src/GToolkit-Coder-UI/GtTextualCoderViewModelSearchTextSource.class.st create mode 100644 src/GToolkit-Coder-UI/GtTextualCoderViewModelSearchTextUpdateTextAnnouncement.class.st diff --git a/src/GToolkit-Coder-AddOns/BrEditorSearchTextMarkerContext.extension.st b/src/GToolkit-Coder-AddOns/BrEditorSearchTextMarkerContext.extension.st new file mode 100644 index 000000000..ee469c54d --- /dev/null +++ b/src/GToolkit-Coder-AddOns/BrEditorSearchTextMarkerContext.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #BrEditorSearchTextMarkerContext } + +{ #category : #'*GToolkit-Coder-AddOns' } +BrEditorSearchTextMarkerContext >> fromCoderViewModel: aCoderViewModel [ + self textSource: (GtTextualCoderViewModelSearchTextSource new textualCoderViewModel: aCoderViewModel) +] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 9ef7f5f4b..a5cd7a1ee 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -337,6 +337,31 @@ GtTextualCoderEditorElement >> onScrollToCharacterPositionAnnouncement: anAnnoun ifFalse: [ self scrollToPosition: aLineIndex ] ] +{ #category : #'private - event handling' } +GtTextualCoderEditorElement >> onSearchTextGetTextAndVisibleTextAnnouncement: anAnnouncement [ + self assertUIProcess. + anAnnouncement consumed ifTrue: [ ^ self ]. + anAnnouncement consumed: true. + + anAnnouncement text: self text. + anAnnouncement visibleText: self visibleText +] + +{ #category : #'private - event handling' } +GtTextualCoderEditorElement >> onSearchTextUpdateTextAnnouncement: anAnnouncement [ + | aResult | + self assertUIProcess. + anAnnouncement consumed ifTrue: [ ^ self ]. + anAnnouncement consumed: true. + + aResult := BrEditorSearchTextUpdater new + editorModel: self editor; + styledText: anAnnouncement styledText; + update. + + anAnnouncement isUpdated: aResult +] + { #category : #'private - event handling' } GtTextualCoderEditorElement >> onStyleTextRequest: anEvent [ "onStyleTextRequest: may be sent from a non-UI thread" @@ -632,6 +657,12 @@ GtTextualCoderEditorElement >> registerCoderViewModelAnnouncementsFor: aGtSource to: self; when: GtTextualCoderViewModelScrollToCharacterPositionAnnouncement send: #onScrollToCharacterPositionAnnouncement: + to: self; + when: GtTextualCoderViewModelSearchTextGetTextAndVisibleTextAnnouncement + send: #onSearchTextGetTextAndVisibleTextAnnouncement: + to: self; + when: GtTextualCoderViewModelSearchTextUpdateTextAnnouncement + send: #onSearchTextUpdateTextAnnouncement: to: self ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelSearchTextGetTextAndVisibleTextAnnouncement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelSearchTextGetTextAndVisibleTextAnnouncement.class.st new file mode 100644 index 000000000..97e646c2f --- /dev/null +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelSearchTextGetTextAndVisibleTextAnnouncement.class.st @@ -0,0 +1,40 @@ +Class { + #name : #GtTextualCoderViewModelSearchTextGetTextAndVisibleTextAnnouncement, + #superclass : #GtTextualCoderViewModelAnnouncement, + #instVars : [ + 'consumed', + 'text', + 'visibleText' + ], + #category : #'GToolkit-Coder-UI-Coder - Source Events' +} + +{ #category : #accessing } +GtTextualCoderViewModelSearchTextGetTextAndVisibleTextAnnouncement >> consumed [ + ^ consumed ifNil: [ false ] +] + +{ #category : #accessing } +GtTextualCoderViewModelSearchTextGetTextAndVisibleTextAnnouncement >> consumed: aBoolean [ + consumed := aBoolean +] + +{ #category : #accessing } +GtTextualCoderViewModelSearchTextGetTextAndVisibleTextAnnouncement >> text [ + ^ text +] + +{ #category : #accessing } +GtTextualCoderViewModelSearchTextGetTextAndVisibleTextAnnouncement >> text: anObject [ + text := anObject +] + +{ #category : #accessing } +GtTextualCoderViewModelSearchTextGetTextAndVisibleTextAnnouncement >> visibleText [ + ^ visibleText +] + +{ #category : #accessing } +GtTextualCoderViewModelSearchTextGetTextAndVisibleTextAnnouncement >> visibleText: anObject [ + visibleText := anObject +] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelSearchTextSource.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelSearchTextSource.class.st new file mode 100644 index 000000000..87337f580 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelSearchTextSource.class.st @@ -0,0 +1,79 @@ +Class { + #name : #GtTextualCoderViewModelSearchTextSource, + #superclass : #BrEditorSearchTextSource, + #instVars : [ + 'textualCoderViewModel' + ], + #category : #'GToolkit-Coder-UI-Coder - Textual Model' +} + +{ #category : #accessing } +GtTextualCoderViewModelSearchTextSource >> editorModel [ + "Return an editor model for which the found patterns, e.g, substrings, are marked" + + + ^ 'self subclassResponsibility' +] + +{ #category : #accessing } +GtTextualCoderViewModelSearchTextSource >> element [ + "Return an element to which actions, e.g., background computation can be hooked" + + + ^ nil +] + +{ #category : #testing } +GtTextualCoderViewModelSearchTextSource >> hasText [ + + ^' self subclassResponsibility' +] + +{ #category : #accessing } +GtTextualCoderViewModelSearchTextSource >> text [ + "Return current editor text" + + + | anAnnouncement | + anAnnouncement := GtTextualCoderViewModelSearchTextGetTextAndVisibleTextAnnouncement new + textualCoderViewModel: textualCoderViewModel. + textualCoderViewModel announce: anAnnouncement. + ^ anAnnouncement text +] + +{ #category : #accessing } +GtTextualCoderViewModelSearchTextSource >> textualCoderViewModel [ + ^ textualCoderViewModel +] + +{ #category : #accessing } +GtTextualCoderViewModelSearchTextSource >> textualCoderViewModel: anObject [ + textualCoderViewModel := anObject +] + +{ #category : #updating } +GtTextualCoderViewModelSearchTextSource >> updateText: aStyledText [ + "Integrate new styled text to the existing editor's text. + Return true if the integration happened, false otherwise. + Note: Must be called from a UI process." + + + | anAnnouncement | + anAnnouncement := GtTextualCoderViewModelSearchTextUpdateTextAnnouncement new + textualCoderViewModel: textualCoderViewModel; + styledText: aStyledText. + textualCoderViewModel announce: anAnnouncement. + ^ anAnnouncement visibleText +] + +{ #category : #accessing } +GtTextualCoderViewModelSearchTextSource >> visibleText [ + "Return current editor visible text" + + + | anAnnouncement | + anAnnouncement := GtTextualCoderViewModelSearchTextGetTextAndVisibleTextAnnouncement new + textualCoderViewModel: textualCoderViewModel. + textualCoderViewModel announce: anAnnouncement. + ^ anAnnouncement visibleText +] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelSearchTextUpdateTextAnnouncement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelSearchTextUpdateTextAnnouncement.class.st new file mode 100644 index 000000000..324ee1717 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelSearchTextUpdateTextAnnouncement.class.st @@ -0,0 +1,40 @@ +Class { + #name : #GtTextualCoderViewModelSearchTextUpdateTextAnnouncement, + #superclass : #GtTextualCoderViewModelAnnouncement, + #instVars : [ + 'consumed', + 'styledText', + 'isUpdated' + ], + #category : #'GToolkit-Coder-UI-Coder - Source Events' +} + +{ #category : #accessing } +GtTextualCoderViewModelSearchTextUpdateTextAnnouncement >> consumed [ + ^ consumed ifNil: [ false ] +] + +{ #category : #accessing } +GtTextualCoderViewModelSearchTextUpdateTextAnnouncement >> consumed: aBoolean [ + consumed := aBoolean +] + +{ #category : #accessing } +GtTextualCoderViewModelSearchTextUpdateTextAnnouncement >> isUpdated [ + ^ isUpdated ifNil: [ false ] +] + +{ #category : #accessing } +GtTextualCoderViewModelSearchTextUpdateTextAnnouncement >> isUpdated: aBoolean [ + isUpdated := aBoolean +] + +{ #category : #accessing } +GtTextualCoderViewModelSearchTextUpdateTextAnnouncement >> styledText [ + ^ styledText +] + +{ #category : #accessing } +GtTextualCoderViewModelSearchTextUpdateTextAnnouncement >> styledText: anObject [ + styledText := anObject +] From 61002f5b0db3f0b884eff40967d6bf94632205be Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 12 May 2025 21:20:35 -0400 Subject: [PATCH 0940/1268] text search: integrate new implementation [feenkcom/gtoolkit#4504] --- .../GtTextualCoder.extension.st | 139 +++++-------- ...iewModelSearchTextCancelRequested.class.st | 29 +++ .../GtTextualCoderSearchTextElement.class.st | 182 ++++++++++++++++++ ...ualCoderViewModelSearchTextSource.class.st | 9 +- 4 files changed, 262 insertions(+), 97 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderViewModelSearchTextCancelRequested.class.st create mode 100644 src/GToolkit-Coder-UI/GtTextualCoderSearchTextElement.class.st diff --git a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st index 1f309c975..4d712244c 100644 --- a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st +++ b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st @@ -74,107 +74,56 @@ GtTextualCoder >> addExplicitContextMenu: aString block: aBlock to: coderAddOns { #category : #'*GToolkit-Coder-AddOns' } GtTextualCoder >> initializeSearchTextAddOns: addOns viewModel: aCoderViewModel [ - | aStyler aWeakElement | - GtTextualCoderSearchTextSettings isEnabledInCoder ifFalse: [ ^ self ]. - - aCoderViewModel addStyler: (aStyler := BrEditorSearchTextStyler new). addOns addMainAction: (GtCoderCustomAction new title: 'Search'; stencil: [ BrButton new - aptitude: BrGlamorousButtonWithIconAptitude; - icon: BrGlamorousVectorIcons search; - id: GtCoderSearchActionId; - label: 'Search'; - beTinySize; - when: BrDropdownIsHidden - do: [ :anEvent | - aStyler subtext: nil. - aCoderViewModel announce: (GtTextualCoderViewModelReadyToRestyle new). ]; - addAptitude: (BrGlamorousWithExplicitDropdownAptitude new - in: [ :theAptitude | - aCoderViewModel weak - when: GtSourceCoderViewModelSearchTextRequested - send: #show - to: theAptitude ]; - withVisibleWidgetBoundsRelocator; - withContainerPermanentVisibilityUpdater; - menuContainerDo: [ :aContainer | - aContainer layout areaBuilders: { - BlSteppedLayoutAreaBuilder dropdownBottomRight. - BlSteppedLayoutAreaBuilder dropdownBottomLeft. - BlSteppedLayoutAreaBuilder allToBottom. - BlSteppedLayoutAreaBuilder allToRight. - BlSteppedLayoutAreaBuilder allToLeft. - BlSteppedLayoutAreaBuilder dropdownUpRight. - BlSteppedLayoutAreaBuilder dropdownUpLeft. - BlSteppedLayoutAreaBuilder allToUp.} ]; - handle: [ BrButton new - aptitude: BrGlamorousButtonWithIconAptitude - - BrGlamorousButtonExteriorAptitude - - BrGlamorousButtonWithLabelTooltipAptitude2; - icon: BrGlamorousVectorIcons search; - beTinySize ] - content: [ :anExplicitMenu | - | anElement | - anElement := BrSearchTextElement new - styler: aStyler; - editorDo: [ :anEditor | anEditor requestFocus ]; - hFitContentLimited; - constraintsDo: [ :c | - c minWidth: 300. - c frame horizontal alignCenter. - c frame vertical alignCenter ]; - when: BrSearchTextPatternWish - do: [ :anEvent | - aStyler subtext: anEvent text. - aCoderViewModel announce: (GtTextualCoderViewModelReadyToRestyle new) ]; - when: BrSearchTextNextOccurenceWish - do: [ :anEvent | - aStyler nextItem. - aCoderViewModel announce: (GtTextualCoderViewModelReadyToRestyle new) ]; - when: BrSearchTextPreviousOccurenceWish - do: [ :anEvent | - aStyler previousItem. - aCoderViewModel announce: (GtTextualCoderViewModelReadyToRestyle new) ]; - when: BrSearchTextEndWish - do: [ :anEvent | - | aRange | - aRange := aStyler currentRange. - aStyler subtext: nil. - aRange ifNotNil: [ - | aSelection | - aSelection := BlCompositeSelection new select: aRange first - 1 to: aRange last. - aCoderViewModel announce: (GtTextualCoderViewModelSelectionChanged new - shouldUpdateCursor: true; - selection: aSelection; - source: aCoderViewModel) ]. - aCoderViewModel announce: (GtTextualCoderViewModelReadyToRestyle new). - aCoderViewModel announce: (GtTextualCoderViewModelFocusChanged new - focused: true; - source: aCoderViewModel). - anEvent currentTarget fireEvent: BrDropdownHideWish new ]. - aWeakElement := anElement asWeakReference. - BrFrame new - fitContentLimited; - padding: (BlInsets all: 5); - addChild: anElement ] ) ] ). - - aStyler - visualizer: (GtTextualCoderSearchTextVisualizer new - textualCoderViewModel: aCoderViewModel; - action: [ :aContext | - aWeakElement - ifNotNil: [ :aWeak | - (aWeak at: 1) - ifNotNil: [ :anElement | - BlTaskAction - enqueueElement: anElement - action: [ anElement index: aContext selectedItem total: aContext itemsCount ] ] ] ]). - - + aptitude: BrGlamorousButtonWithIconAptitude; + icon: BrGlamorousVectorIcons search; + id: GtCoderSearchActionId; + label: 'Search'; + beTinySize; + when: BrDropdownIsHidden + do: [ :anEvent | aCoderViewModel announce: GtSourceCoderViewModelSearchTextCancelRequested new ]; + addAptitude: (BrGlamorousWithExplicitDropdownAptitude new + in: [ :theAptitude | + aCoderViewModel weak + when: GtSourceCoderViewModelSearchTextRequested + send: #show + to: theAptitude ]; + withVisibleWidgetBoundsRelocator; + withContainerPermanentVisibilityUpdater; + menuContainerDo: [ :aContainer | + aContainer layout + areaBuilders: {BlSteppedLayoutAreaBuilder dropdownBottomRight. + BlSteppedLayoutAreaBuilder dropdownBottomLeft. + BlSteppedLayoutAreaBuilder allToBottom. + BlSteppedLayoutAreaBuilder allToRight. + BlSteppedLayoutAreaBuilder allToLeft. + BlSteppedLayoutAreaBuilder dropdownUpRight. + BlSteppedLayoutAreaBuilder dropdownUpLeft. + BlSteppedLayoutAreaBuilder allToUp} ]; + handle: [ BrButton new + aptitude: BrGlamorousButtonWithIconAptitude - BrGlamorousButtonExteriorAptitude + - BrGlamorousButtonWithLabelTooltipAptitude2; + icon: BrGlamorousVectorIcons search; + beTinySize ] + content: [ :anExplicitMenu | + | anElement | + anElement := GtTextualCoderSearchTextElement new + textualCoderViewModel: aCoderViewModel; + editorDo: [ :anEditor | anEditor requestFocus ]; + hFitContentLimited; + constraintsDo: [ :c | + c minWidth: 300. + c frame horizontal alignCenter. + c frame vertical alignCenter ]. + BrFrame new + fitContentLimited; + padding: (BlInsets all: 5); + addChild: anElement ]) ]) ] { #category : #'*GToolkit-Coder-AddOns' } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderViewModelSearchTextCancelRequested.class.st b/src/GToolkit-Coder-UI/GtSourceCoderViewModelSearchTextCancelRequested.class.st new file mode 100644 index 000000000..155de9c16 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderViewModelSearchTextCancelRequested.class.st @@ -0,0 +1,29 @@ +Class { + #name : #GtSourceCoderViewModelSearchTextCancelRequested, + #superclass : #GtTextualCoderViewModelAnnouncement, + #instVars : [ + 'consumed' + ], + #category : #'GToolkit-Coder-UI-Coder - Source Events' +} + +{ #category : #accessing } +GtSourceCoderViewModelSearchTextCancelRequested >> consumed [ + + + ^ consumed +] + +{ #category : #accessing } +GtSourceCoderViewModelSearchTextCancelRequested >> consumed: aBoolean [ + "Prevents the default save action, when set to true by the event handler" + + consumed := aBoolean +] + +{ #category : #initialization } +GtSourceCoderViewModelSearchTextCancelRequested >> initialize [ + super initialize. + + consumed := false +] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderSearchTextElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderSearchTextElement.class.st new file mode 100644 index 000000000..4128a8f33 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtTextualCoderSearchTextElement.class.st @@ -0,0 +1,182 @@ +Class { + #name : #GtTextualCoderSearchTextElement, + #superclass : #BrSearchTextElement, + #traits : 'TGtWithTextualCoderViewModel', + #classTraits : 'TGtWithTextualCoderViewModel classTrait', + #instVars : [ + 'marker', + 'context' + ], + #category : #'GToolkit-Coder-UI-Coder - Textual Model' +} + +{ #category : #initialization } +GtTextualCoderSearchTextElement >> initialize [ + super initialize. + self initializeMarker. + self initializeEventHandlers. + + self hFitContentLimited +] + +{ #category : #initialization } +GtTextualCoderSearchTextElement >> initializeEventHandlers [ + self + when: BrSearchTextPatternWish + do: [ :anEvent | self onBrSearchTextPatternWish: anEvent ]. + self + when: BrSearchTextNextOccurenceWish + do: [ :anEvent | self onBrSearchTextNextOccurenceWish: anEvent ]. + self + when: BrSearchTextPreviousOccurenceWish + do: [ :anEvent | self onBrSearchTextPreviousOccurenceWish: anEvent ]. + self + when: BrSearchTextEndWish + do: [ :anEvent | self onBrSearchTextEndWish: anEvent ]. +] + +{ #category : #initialization } +GtTextualCoderSearchTextElement >> initializeMarker [ + marker := BrEditorSearchTextMarker new + computation: (BrEditorSearchTextAsyncFutureComputation new + executionConfiguration: (AsyncFutureExecutionConfiguration new + customGroup: #SearchText; + defaultPriority)). + + marker + when: BrEditorSearchTextFinishedAnnouncement + send: #onBrEditorSearchTextFinishedAnnouncement: + to: self +] + +{ #category : #private } +GtTextualCoderSearchTextElement >> newMarkerContext [ + self hasTextualCoderViewModel ifFalse: [ ^ nil ]. + + ^ BrEditorSearchTextMarkerContext new + fromCoderViewModel: self textualCoderViewModel; + element: self +] + +{ #category : #'private - event management' } +GtTextualCoderSearchTextElement >> onBrEditorSearchTextFinishedAnnouncement: anAnnouncement [ + BlTaskAction + enqueueElement: self + action: [ self index: anAnnouncement selectedIndex total: anAnnouncement itemsCount ] +] + +{ #category : #initialization } +GtTextualCoderSearchTextElement >> onBrSearchTextEndWish: anEvent [ + | aContext aRange aSelection | + anEvent consumed: true. + self hasTextualCoderViewModel ifFalse: [ ^ self ]. + aContext := context ifNil: [ ^ self ]. + + aRange := aContext selectedRange. + aRange ifNil: [ ^ self ]. + + aSelection := BlCompositeSelection new select: aRange first - 1 to: aRange last. + self textualCoderViewModel + announce: (GtTextualCoderViewModelSelectionChanged new + shouldUpdateCursor: true; + selection: aSelection; + source: self textualCoderViewModel); + announce: (GtTextualCoderViewModelFocusChanged new + focused: true; + source: self textualCoderViewModel). + anEvent currentTarget fireEvent: BrDropdownHideWish new +] + +{ #category : #'private - event management' } +GtTextualCoderSearchTextElement >> onBrSearchTextNextOccurenceWish: anEvent [ + | aContext | + anEvent consumed: true. + self hasTextualCoderViewModel ifFalse: [ ^ self ]. + aContext := context ifNil: [ ^ self ]. + + marker markNext: aContext. + self textualCoderViewModel + scrollToLine: aContext selectedLine + withCharacterPosition: aContext selectedStartPosition +] + +{ #category : #'private - event management' } +GtTextualCoderSearchTextElement >> onBrSearchTextPatternWish: anEvent [ + | aContext | + anEvent consumed: true. + + anEvent text size isZero + ifTrue: [ marker unmark: (context ifNil: [ ^ self ]). + ^ self ]. + + aContext := self newMarkerContext. + aContext ifNil: [ ^ self ]. + + aContext subtext: anEvent text copy. + context := aContext. + marker mark: aContext +] + +{ #category : #'private - event management' } +GtTextualCoderSearchTextElement >> onBrSearchTextPreviousOccurenceWish: anEvent [ + | aContext | + anEvent consumed: true. + self hasTextualCoderViewModel ifFalse: [ ^ self ]. + aContext := context ifNil: [ ^ self ]. + + marker markPrevious: aContext. + self textualCoderViewModel + scrollToLine: aContext selectedLine + withCharacterPosition: aContext selectedStartPosition +] + +{ #category : #'private - event management' } +GtTextualCoderSearchTextElement >> onGtSourceCoderViewModelSearchTextCancelRequested: anAnnouncement [ + | aContext | + anAnnouncement consumed: true. + aContext := context. + aContext ifNil: [ ^ self ]. + marker unmark: aContext +] + +{ #category : #'private - event management' } +GtTextualCoderSearchTextElement >> onGtSourceCoderViewModelSearchTextRequested: anAnnouncement [ + anAnnouncement consumed ifTrue: [ ^ self ]. + anAnnouncement consumed: true. + + self editorDo: [ :anEditor | anEditor requestFocus ] +] + +{ #category : #'api - textual coder view model' } +GtTextualCoderSearchTextElement >> onTextualCoderViewModelChanged [ + "Is sent when a new textualCoder view model is assigned to the element. + Note: #onTextualCoderViewModelChanged is sent before #subscribeToTextualCoderViewModel + which means that if you perform any operation that triggers an announcement it will be ignored because the receiver + didn't get a chance to subscribe to any announcement. Override #onPostTextualCoderViewModelChanged if you + wish to perform an operation that requires an announcement, but keep in mind that this is not the most efficient way" + + +] + +{ #category : #'api - textual coder view model' } +GtTextualCoderSearchTextElement >> subscribeToTextualCoderViewModel [ + "Is sent after a new textualCoder view model is assigned to the element. + It is required to unsubscribe from the view model or domain model by implementing + #unsubscribeFromTextualCoderViewModel if elements subscribe to them" + + self textualCoderViewModel weak + when: GtSourceCoderViewModelSearchTextRequested + send: #onGtSourceCoderViewModelSearchTextRequested: + to: self; + when: GtSourceCoderViewModelSearchTextCancelRequested + send: #onGtSourceCoderViewModelSearchTextCancelRequested: + to: self +] + +{ #category : #'api - textual coder view model' } +GtTextualCoderSearchTextElement >> unsubscribeFromTextualCoderViewModel [ + "Is sent before a new textualCoder view model is assigned to the element. + Elements that subscribe to textualCoder view model in domain model are required to implement this methods." + + self textualCoderViewModel unsubscribe: self +] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelSearchTextSource.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelSearchTextSource.class.st index 87337f580..a8cfb5c09 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelSearchTextSource.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelSearchTextSource.class.st @@ -26,7 +26,12 @@ GtTextualCoderViewModelSearchTextSource >> element [ { #category : #testing } GtTextualCoderViewModelSearchTextSource >> hasText [ - ^' self subclassResponsibility' + ^ self text isNotNil +] + +{ #category : #testing } +GtTextualCoderViewModelSearchTextSource >> hasVisibleText [ + ^ self visibleText isNotNil ] { #category : #accessing } @@ -63,7 +68,7 @@ GtTextualCoderViewModelSearchTextSource >> updateText: aStyledText [ textualCoderViewModel: textualCoderViewModel; styledText: aStyledText. textualCoderViewModel announce: anAnnouncement. - ^ anAnnouncement visibleText + ^ anAnnouncement isUpdated ] { #category : #accessing } From e44164a0f055a9f474ff13d3967521825dfd1a3b Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 13 May 2025 15:46:42 -0400 Subject: [PATCH 0941/1268] search text: progress on editor aptitude [feenkcom/gtoolkit#4504] - move events to Brick - extract scroll code to a scroller class - unmark text on search end wish --- .../GtTextualCoderEditorElement.class.st | 36 ++++--------------- .../GtTextualCoderSearchTextElement.class.st | 25 +++++++++---- 2 files changed, 25 insertions(+), 36 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index a5cd7a1ee..926e92ace 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -305,36 +305,12 @@ GtTextualCoderEditorElement >> onRemovedFromSceneGraph [ { #category : #'private - event handling' } GtTextualCoderEditorElement >> onScrollToCharacterPositionAnnouncement: anAnnouncement [ - | aStartPosition aFirstSegment aLastSegment aLineIndex aLineDistance | - aStartPosition := anAnnouncement characterPosition. - aLineIndex := anAnnouncement lineIndex. - - "Get range of visible lines and characters" - aFirstSegment := (self layout - findFirstVisibleChildClosestToStartCompletelyVisible: true - acceptPartiallyVisible: false) ifNotNil: #segment. - aLastSegment := (self layout - findFirstVisibleChildClosestToEndCompletelyVisible: true - acceptPartiallyVisible: false) ifNotNil: #segment. - - "Scroll only if the character is not visible" - (aFirstSegment isNotNil and: [ - aLastSegment isNotNil and: [ - aFirstSegment textStart >= aStartPosition and: [ - aLastSegment textEnd <= aStartPosition ] ] ]) - ifTrue: [ ^ self ]. - - "Check the distance" - (aFirstSegment isNotNil and: [ - aLastSegment isNotNil ]) - ifTrue: [ - aLineDistance := (aFirstSegment index - aLineIndex) abs - min: (aLastSegment index - aLineIndex) abs ]. - - "Scroll smoothly or jump to the position, depending on the distance." - (aLineDistance isNotNil and: [ aLineDistance < 100 ]) - ifTrue: [ self smoothScrollToPosition: aLineIndex ] - ifFalse: [ self scrollToPosition: aLineIndex ] + BrEditorSearchTextScroller new + editorElement: self; + lineIndex: anAnnouncement lineIndex; + characterStartPosition: anAnnouncement characterPosition; + characterStopPosition: anAnnouncement characterPosition; + scroll ] { #category : #'private - event handling' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderSearchTextElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderSearchTextElement.class.st index 4128a8f33..e775c5578 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderSearchTextElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderSearchTextElement.class.st @@ -24,6 +24,9 @@ GtTextualCoderSearchTextElement >> initializeEventHandlers [ self when: BrSearchTextPatternWish do: [ :anEvent | self onBrSearchTextPatternWish: anEvent ]. + self + when: BrSearchTextNoPatternWish + do: [ :anEvent | self onBrSearchTextNoPatternWish: anEvent ]. self when: BrSearchTextNextOccurenceWish do: [ :anEvent | self onBrSearchTextNextOccurenceWish: anEvent ]. @@ -32,7 +35,7 @@ GtTextualCoderSearchTextElement >> initializeEventHandlers [ do: [ :anEvent | self onBrSearchTextPreviousOccurenceWish: anEvent ]. self when: BrSearchTextEndWish - do: [ :anEvent | self onBrSearchTextEndWish: anEvent ]. + do: [ :anEvent | self onBrSearchTextEndWish: anEvent ] ] { #category : #initialization } @@ -71,7 +74,9 @@ GtTextualCoderSearchTextElement >> onBrSearchTextEndWish: anEvent [ anEvent consumed: true. self hasTextualCoderViewModel ifFalse: [ ^ self ]. aContext := context ifNil: [ ^ self ]. + context := nil. + marker unmark: aContext. aRange := aContext selectedRange. aRange ifNil: [ ^ self ]. @@ -101,18 +106,26 @@ GtTextualCoderSearchTextElement >> onBrSearchTextNextOccurenceWish: anEvent [ ] { #category : #'private - event management' } -GtTextualCoderSearchTextElement >> onBrSearchTextPatternWish: anEvent [ +GtTextualCoderSearchTextElement >> onBrSearchTextNoPatternWish: anEvent [ | aContext | anEvent consumed: true. - anEvent text size isZero - ifTrue: [ marker unmark: (context ifNil: [ ^ self ]). - ^ self ]. + aContext := context. + context := nil. + aContext ifNil: [ ^ self ]. + + marker unmark: aContext +] + +{ #category : #'private - event management' } +GtTextualCoderSearchTextElement >> onBrSearchTextPatternWish: anEvent [ + | aContext | + anEvent consumed: true. aContext := self newMarkerContext. aContext ifNil: [ ^ self ]. - aContext subtext: anEvent text copy. + aContext pattern: anEvent pattern. context := aContext. marker mark: aContext ] From 9184c84e98b46395c6a3b783654d7d60c8a513aa Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 14 May 2025 09:23:18 -0500 Subject: [PATCH 0942/1268] Fix refactorings on class side of coder navigator [[feenkcom/gtoolkit#4538]] --- .../GtCoderMethodsGroupedListElement.class.st | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index 3168bb207..0855e1d41 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -207,8 +207,8 @@ GtCoderMethodsGroupedListElement >> pushDownMethodSubmenuFor: aSelector [ submenu stencil: [ GtRefactoringsWithInputPreviewElement elementForRefactoring: [ RBPushDownMethodRefactoring - pushDown: {aSelector} - from: self selectedClass ] + pushDown: {self selectedMethod selector} + from: self selectedMethod methodClass ] confirmationLabeled: 'Push down ' , aSelector from: self beforeApplyingDo: [ submenu hideAll ] ]. @@ -222,8 +222,8 @@ GtCoderMethodsGroupedListElement >> pushUpMethodSubmenuFor: aSelector [ submenu stencil: [ GtRefactoringsWithInputPreviewElement elementForRefactoring: [ RBPullUpMethodRefactoring - pullUp: {aSelector} - from: self selectedClass ] + pullUp: {self selectedMethod selector} + from: self selectedMethod methodClass ] confirmationLabeled: 'Pull up ' , aSelector from: self beforeApplyingDo: [ submenu hideAll ] ]. @@ -261,7 +261,9 @@ GtCoderMethodsGroupedListElement >> removeMethodSubmenuFor: aSelector [ text: (references printString , ' reference' , (references > 1 ifTrue: [ 's' ] ifFalse: [ '' ])) asRopedText) ]. pane ]). - change := RBRemoveMethodChange remove: aSelector from: self selectedClass. + change := RBRemoveMethodChange + remove: self selectedMethod selector + from: self selectedMethod methodClass. button := BrButton new aptitude: BrGlamorousButtonWithIconAptitude; beSmallSize; @@ -286,8 +288,8 @@ GtCoderMethodsGroupedListElement >> renameMethodSubmenuFor: aSelector [ stencil: [ GtRefactoringsWithInputPreviewElement elementForRefactoring: [ :each | GtRBRenameMethodRefactoring - renameMethod: aSelector - in: self selectedClass + renameMethod: self selectedMethod selector + in: self selectedMethod methodClass to: each permutation: (1 to: aSelector numArgs) ] labeled: 'Rename method: ' @@ -302,6 +304,11 @@ GtCoderMethodsGroupedListElement >> selectedClass [ ^ navigationModel selectedClass ] +{ #category : #'private - context menu' } +GtCoderMethodsGroupedListElement >> selectedMethod [ + ^ navigationModel selectedMethod +] + { #category : #'private - subscriptions' } GtCoderMethodsGroupedListElement >> subscribeToNavigationModel [ | subscriptions | From ed5f7f5d8921f677c6f434d99ee8be5b5db59ba3 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Wed, 14 May 2025 15:40:27 -0500 Subject: [PATCH 0943/1268] Fix failing examples and bug that exists if method with same selector exists on both sides of a class [[feenkcom/gtoolkit#4538]] --- .../GtCoderMethodsGroupedListElement.class.st | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index 0855e1d41..13ac4e21b 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -71,19 +71,19 @@ GtCoderMethodsGroupedListElement >> contextMenuFor: item in: anElement [ menu addItem: (BrMenuSubmenuItem new label: (self createLabel: 'Push up method' description: item selector); - submenu: (self pushUpMethodSubmenuFor: item selector)). + submenu: (self pushUpMethodSubmenuFor: item)). menu addItem: (BrMenuSubmenuItem new label: (self createLabel: 'Push down method' description: item selector); - submenu: (self pushDownMethodSubmenuFor: item selector)). + submenu: (self pushDownMethodSubmenuFor: item)). menu addItem: (BrMenuSubmenuItem new label: (self createLabel: 'Rename message' description: item selector); - submenu: (self renameMethodSubmenuFor: item selector)). + submenu: (self renameMethodSubmenuFor: item)). menu addItem: (BrMenuSubmenuItem new label: (self createLabel: 'Remove method' description: item selector); - submenu: (self removeMethodSubmenuFor: item selector)). + submenu: (self removeMethodSubmenuFor: item)). ^ menu ] @@ -201,37 +201,37 @@ GtCoderMethodsGroupedListElement >> onMethodsToShowChanged: anAnnouncement [ ] { #category : #'private - context menu' } -GtCoderMethodsGroupedListElement >> pushDownMethodSubmenuFor: aSelector [ +GtCoderMethodsGroupedListElement >> pushDownMethodSubmenuFor: aMethod [ | submenu | submenu := BrMenuExplicit new. submenu stencil: [ GtRefactoringsWithInputPreviewElement elementForRefactoring: [ RBPushDownMethodRefactoring - pushDown: {self selectedMethod selector} - from: self selectedMethod methodClass ] - confirmationLabeled: 'Push down ' , aSelector + pushDown: {aMethod selector} + from: aMethod methodClass ] + confirmationLabeled: 'Push down ' , aMethod selector from: self beforeApplyingDo: [ submenu hideAll ] ]. ^ submenu ] { #category : #'private - context menu' } -GtCoderMethodsGroupedListElement >> pushUpMethodSubmenuFor: aSelector [ +GtCoderMethodsGroupedListElement >> pushUpMethodSubmenuFor: aMethod [ | submenu | submenu := BrMenuExplicit new. submenu stencil: [ GtRefactoringsWithInputPreviewElement elementForRefactoring: [ RBPullUpMethodRefactoring - pullUp: {self selectedMethod selector} - from: self selectedMethod methodClass ] - confirmationLabeled: 'Pull up ' , aSelector + pullUp: {aMethod selector} + from: aMethod methodClass ] + confirmationLabeled: 'Pull up ' , aMethod selector from: self beforeApplyingDo: [ submenu hideAll ] ]. ^ submenu ] { #category : #'private - context menu' } -GtCoderMethodsGroupedListElement >> removeMethodSubmenuFor: aSelector [ +GtCoderMethodsGroupedListElement >> removeMethodSubmenuFor: aMethod [ | submenu | submenu := BrMenuExplicit new. ^ submenu @@ -245,14 +245,14 @@ GtCoderMethodsGroupedListElement >> removeMethodSubmenuFor: aSelector [ left: 10 right: 10); aptitude: BrGlamorousLabelAptitude new glamorousRegularFont; - text: ('Remove ' , aSelector) asRopedText). + text: ('Remove ' , aMethod selector) asRopedText). element addChild: (BrAsyncWidget new fitContent; stencil: [ | pane references | pane := BrVerticalPane new. pane fitContent. - references := (GtPharoIndex current sendersOf: aSelector) size. + references := (GtPharoIndex current sendersOf: aMethod size) size. references > 0 ifTrue: [ pane addChild: (BrLabel new @@ -262,8 +262,8 @@ GtCoderMethodsGroupedListElement >> removeMethodSubmenuFor: aSelector [ , (references > 1 ifTrue: [ 's' ] ifFalse: [ '' ])) asRopedText) ]. pane ]). change := RBRemoveMethodChange - remove: self selectedMethod selector - from: self selectedMethod methodClass. + remove: aMethod selector + from: aMethod methodClass. button := BrButton new aptitude: BrGlamorousButtonWithIconAptitude; beSmallSize; @@ -281,19 +281,19 @@ GtCoderMethodsGroupedListElement >> removeMethodSubmenuFor: aSelector [ ] { #category : #'private - context menu' } -GtCoderMethodsGroupedListElement >> renameMethodSubmenuFor: aSelector [ +GtCoderMethodsGroupedListElement >> renameMethodSubmenuFor: aMethod [ | submenu | submenu := BrMenuExplicit new. submenu stencil: [ GtRefactoringsWithInputPreviewElement elementForRefactoring: [ :each | GtRBRenameMethodRefactoring - renameMethod: self selectedMethod selector - in: self selectedMethod methodClass + renameMethod: aMethod selector + in: aMethod methodClass to: each - permutation: (1 to: aSelector numArgs) ] + permutation: (1 to: aMethod selector numArgs) ] labeled: 'Rename method: ' - initialValue: aSelector + initialValue: aMethod selector from: self beforeApplyingDo: [ submenu hideAll ] ]. ^ submenu From 8c3f8b51e0f6ac8b3ce0d3f4763608ea8b4e381f Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 14 May 2025 21:35:35 -0400 Subject: [PATCH 0944/1268] search text: code cleaning [feenkcom/gtoolkit#4504] --- .../GtTextualCoderSearchTextElement.class.st | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderSearchTextElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderSearchTextElement.class.st index e775c5578..cea976c88 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderSearchTextElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderSearchTextElement.class.st @@ -41,10 +41,7 @@ GtTextualCoderSearchTextElement >> initializeEventHandlers [ { #category : #initialization } GtTextualCoderSearchTextElement >> initializeMarker [ marker := BrEditorSearchTextMarker new - computation: (BrEditorSearchTextAsyncFutureComputation new - executionConfiguration: (AsyncFutureExecutionConfiguration new - customGroup: #SearchText; - defaultPriority)). + computation: BrEditorSearchTextAsyncFutureComputation newDefault. marker when: BrEditorSearchTextFinishedAnnouncement From 2f5fe3e3ee401c22aef7aefc1cc29427314f94f5 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 14 May 2025 21:38:41 -0400 Subject: [PATCH 0945/1268] search text: same class name prefixes [feenkcom/gtoolkit#4504] --- .../GtTextualCoderSearchTextElement.class.st | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderSearchTextElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderSearchTextElement.class.st index cea976c88..5faace190 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderSearchTextElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderSearchTextElement.class.st @@ -1,6 +1,6 @@ Class { #name : #GtTextualCoderSearchTextElement, - #superclass : #BrSearchTextElement, + #superclass : #BrEditorSearchTextElement, #traits : 'TGtWithTextualCoderViewModel', #classTraits : 'TGtWithTextualCoderViewModel classTrait', #instVars : [ @@ -22,19 +22,19 @@ GtTextualCoderSearchTextElement >> initialize [ { #category : #initialization } GtTextualCoderSearchTextElement >> initializeEventHandlers [ self - when: BrSearchTextPatternWish + when: BrEditorSearchTextPatternWish do: [ :anEvent | self onBrSearchTextPatternWish: anEvent ]. self - when: BrSearchTextNoPatternWish + when: BrEditorSearchTextNoPatternWish do: [ :anEvent | self onBrSearchTextNoPatternWish: anEvent ]. self - when: BrSearchTextNextOccurenceWish + when: BrEditorSearchTextNextOccurenceWish do: [ :anEvent | self onBrSearchTextNextOccurenceWish: anEvent ]. self - when: BrSearchTextPreviousOccurenceWish + when: BrEditorSearchTextPreviousOccurenceWish do: [ :anEvent | self onBrSearchTextPreviousOccurenceWish: anEvent ]. self - when: BrSearchTextEndWish + when: BrEditorSearchTextEndWish do: [ :anEvent | self onBrSearchTextEndWish: anEvent ] ] From 1cae22d7474905f8a4646e3ac69f1ad29d3c6d39 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 15 May 2025 12:01:23 -0400 Subject: [PATCH 0946/1268] search text: handle not-found cases [feenkcom/gtoolkit#4504] --- src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index cb1cf4b77..0809f9229 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -728,6 +728,9 @@ GtTextualCoderViewModel >> saveAttribute: folder forNode: aNode andStyler: aStyl { #category : #'api - scrolling' } GtTextualCoderViewModel >> scrollToLine: aLineIndex withCharacterPosition: aCharacterPosition [ + aLineIndex ifNil: [ ^ self ]. + aCharacterPosition ifNil: [ ^ self ]. + self announce: (GtTextualCoderViewModelScrollToCharacterPositionAnnouncement new textualCoderViewModel: self; From a895fd13b1a1ee3681cf070a62ebeb18aebd4411 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 19 May 2025 10:35:39 -0400 Subject: [PATCH 0947/1268] support multiple selection of methods [feenkcom/gtoolkit#4546] Users can select several methods in the coder sidebar. All selected methods are expaned in the methods coder. --- .../GtCoderMethodsGroupedListElement.class.st | 22 ++++++++++++++----- ...oderMethodsNavigationAnnouncement.class.st | 18 +++++++++++++++ .../GtCoderNavigationMethodsSelected.class.st | 18 +++++++++++++++ .../GtCoderNavigationModel.class.st | 5 +++++ 4 files changed, 57 insertions(+), 6 deletions(-) create mode 100644 src/GToolkit-Coder/GtClassCoderMethodsNavigationAnnouncement.class.st create mode 100644 src/GToolkit-Coder/GtCoderNavigationMethodsSelected.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index 13ac4e21b..21d710403 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -185,14 +185,23 @@ GtCoderMethodsGroupedListElement >> onMethodSelected: anAnnouncement [ { #category : #'event handling - selection' } GtCoderMethodsGroupedListElement >> onMethodsListSelectionChanged [ - | theIndices anIndex aSelectedItem | - + | theIndices allSelectedItems | theIndices := self selectedIndices ifEmpty: [ ^ self ]. - anIndex := theIndices first. - (anIndex between: 1 and: self viewModel entityCount) + (theIndices first between: 1 and: self viewModel entityCount) + ifFalse: [ ^ self ]. + (theIndices last between: 1 and: self viewModel entityCount) ifFalse: [ ^ self ]. - aSelectedItem := (self viewModel entityAt: anIndex) value object. - self navigationModel selectMethod: aSelectedItem + + allSelectedItems := self selectedItems. + allSelectedItems ifEmpty: [ ^ self ]. + allSelectedItems size = 1 + ifTrue: [ self navigationModel selectMethod: allSelectedItems anyOne ] + ifFalse: [ self navigationModel selectMethods: allSelectedItems ] +] + +{ #category : #'event handling - selection' } +GtCoderMethodsGroupedListElement >> onMethodsSelected: anAnnouncement [ + ] { #category : #'event handling' } @@ -316,6 +325,7 @@ GtCoderMethodsGroupedListElement >> subscribeToNavigationModel [ subscriptions := { GtCoderNavigationMethodsToShowChanged -> #onMethodsToShowChanged:. GtCoderNavigationMethodSelected -> #onMethodSelected:. + GtCoderNavigationMethodsSelected -> #onMethodsSelected:. }. subscriptions diff --git a/src/GToolkit-Coder/GtClassCoderMethodsNavigationAnnouncement.class.st b/src/GToolkit-Coder/GtClassCoderMethodsNavigationAnnouncement.class.st new file mode 100644 index 000000000..0a4d91484 --- /dev/null +++ b/src/GToolkit-Coder/GtClassCoderMethodsNavigationAnnouncement.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtClassCoderMethodsNavigationAnnouncement, + #superclass : #Announcement, + #instVars : [ + 'methods' + ], + #category : #'GToolkit-Coder-Event' +} + +{ #category : #accessing } +GtClassCoderMethodsNavigationAnnouncement >> methods [ + ^ methods +] + +{ #category : #accessing } +GtClassCoderMethodsNavigationAnnouncement >> methods: anObject [ + methods := anObject +] diff --git a/src/GToolkit-Coder/GtCoderNavigationMethodsSelected.class.st b/src/GToolkit-Coder/GtCoderNavigationMethodsSelected.class.st new file mode 100644 index 000000000..aa8e0f422 --- /dev/null +++ b/src/GToolkit-Coder/GtCoderNavigationMethodsSelected.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtCoderNavigationMethodsSelected, + #superclass : #GtCoderNavigationSelectionAnnouncement, + #instVars : [ + 'methods' + ], + #category : #'GToolkit-Coder-Navigation - Events' +} + +{ #category : #accessing } +GtCoderNavigationMethodsSelected >> methods [ + ^ methods +] + +{ #category : #accessing } +GtCoderNavigationMethodsSelected >> methods: anObject [ + methods := anObject +] diff --git a/src/GToolkit-Coder/GtCoderNavigationModel.class.st b/src/GToolkit-Coder/GtCoderNavigationModel.class.st index 0c850e43f..2a2a6626b 100644 --- a/src/GToolkit-Coder/GtCoderNavigationModel.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationModel.class.st @@ -65,6 +65,11 @@ GtCoderNavigationModel >> selectMethod: aCompiledMethod [ self subclassResponsibility ] +{ #category : #'api - selection' } +GtCoderNavigationModel >> selectMethods: aCollectionOfCompiledMethods [ + self subclassResponsibility +] + { #category : #'api - selection' } GtCoderNavigationModel >> selectPackage: aPackage [ self subclassResponsibility From 6b9b9faec7de1ed8ba083d15e5344a28bbf3f6e7 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 19 May 2025 10:35:51 -0400 Subject: [PATCH 0948/1268] support multiple selection of methods [feenkcom/gtoolkit#4546] Users can select several methods in the coder sidebar. All selected methods are expaned in the methods coder. --- .../GtCoderNavigationPackagesTagsClassesElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st index ffb59ba92..79c82556c 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationPackagesTagsClassesElement.class.st @@ -46,7 +46,7 @@ GtCoderNavigationPackagesTagsClassesElement >> buildGroupList [ { #category : #initialization } GtCoderNavigationPackagesTagsClassesElement >> buildMethodGroupList [ - ^ GtCoderMethodsGroupedListElement new + ^ GtCoderMethodsGroupedListElement multiSelection ] { #category : #initialization } From 2217fac88e38b02148753ca97aeb3cbaa633e07c Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 19 May 2025 13:34:36 -0400 Subject: [PATCH 0949/1268] method multi-selection: add context menu [feenkcom/gtoolkit#4546] --- .../GtCoderMethodsGroupedListElement.class.st | 194 +++++++++++++++++- 1 file changed, 191 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index 21d710403..ad6f25ee5 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -34,6 +34,54 @@ GtCoderMethodsGroupedListElement >> browseReferencesOf: aSymbol [ self phlow spawnObject: (GtSearchReferencesFilter literal: aSymbol) ] +{ #category : #'private - actions' } +GtCoderMethodsGroupedListElement >> browseSeveralHierarchyImplementorsOf: aCollectionOfSymbols [ + | aFilter | + aFilter := aCollectionOfSymbols allButFirst + inject: (GtSearchMethodsInClassFilter forClass: self selectedClass) withSuperclasses + withSubclasses & aCollectionOfSymbols first gtImplementors + into: [ :filter :symbol | + filter + | ((GtSearchMethodsInClassFilter forClass: self selectedClass) withSuperclasses + withSubclasses & symbol gtImplementors) ]. + + self phlow spawnObject: aFilter +] + +{ #category : #'private - actions' } +GtCoderMethodsGroupedListElement >> browseSeveralHierarchyReferencesOf: aCollectionOfSymbols [ + | aFilter | + aFilter := aCollectionOfSymbols allButFirst + inject: (GtSearchMethodsInClassFilter forClass: self selectedClass) withSuperclasses + withSubclasses & aCollectionOfSymbols first gtSenders + into: [ :filter :symbol | + filter + | ((GtSearchMethodsInClassFilter forClass: self selectedClass) withSuperclasses + withSubclasses & symbol gtSenders) ]. + + self phlow spawnObject: aFilter +] + +{ #category : #'private - actions' } +GtCoderMethodsGroupedListElement >> browseSeveralImplementorsOf: aCollectionOfSymbols [ + | aFilter | + aFilter := aCollectionOfSymbols allButFirst + inject: (GtSearchImplementorsFilter selector: aCollectionOfSymbols first) + into: [ :filter :symbol | filter | (GtSearchImplementorsFilter selector: symbol) ]. + + self phlow spawnObject: aFilter +] + +{ #category : #'private - actions' } +GtCoderMethodsGroupedListElement >> browseSeveralReferencesOf: aCollectionOfSymbols [ + | aFilter | + aFilter := aCollectionOfSymbols allButFirst + inject: (GtSearchReferencesFilter literal: aCollectionOfSymbols first) + into: [ :filter :symbol | filter | (GtSearchReferencesFilter literal: symbol) ]. + + self phlow spawnObject: aFilter. +] + { #category : #'private - insance creation' } GtCoderMethodsGroupedListElement >> buildMethodItem [ @@ -44,8 +92,14 @@ GtCoderMethodsGroupedListElement >> buildMethodItem [ vFitContent; beSmallSize; aptitude: BrGlamorousLabelAptitude + BrGlamorousListItemAptitude - + (BrGlamorousWithExplicitContextMenuAptitude - menu: [ self contextMenuFor: (aLabel userData at: #method) in: aLabel ]). + + (BrGlamorousWithExplicitContextMenuAptitude new + withGainFocusOnShow; + handleSubmenu: [ | someItems currentMethod | + currentMethod := aLabel userData at: #method. + someItems := self selectedItems. + (someItems size > 1 and: [ someItems identityIncludes: currentMethod ]) + ifTrue: [ self contextMenuForSeveralItems: someItems in: aLabel ] + ifFalse: [ self contextMenuForOneItem: currentMethod in: aLabel ] ]). aLabel addEventHandler: self createMethodDragHandler. @@ -53,7 +107,7 @@ GtCoderMethodsGroupedListElement >> buildMethodItem [ ] { #category : #'private - context menu' } -GtCoderMethodsGroupedListElement >> contextMenuFor: item in: anElement [ +GtCoderMethodsGroupedListElement >> contextMenuForOneItem: item in: anElement [ | menu | menu := BrMenuItems new. menu @@ -87,6 +141,55 @@ GtCoderMethodsGroupedListElement >> contextMenuFor: item in: anElement [ ^ menu ] +{ #category : #'private - context menu' } +GtCoderMethodsGroupedListElement >> contextMenuForSeveralItems: someItems in: anElement [ + | menu | + menu := BrMenuItems new. + menu + addItemLabel: (self + createLabel: 'Browse implementors' + description: ('{1} methods' format: {someItems size})) + action: [ self browseSeveralImplementorsOf: (someItems collect: #selector) ]. + menu + addItemLabel: (self + createLabel: 'Browse hierarachy implementors' + description: ('{1} methods' format: {someItems size})) + action: [ self + browseSeveralHierarchyImplementorsOf: (someItems collect: #selector) ]. + menu + addItemLabel: (self + createLabel: 'Browse references' + description: ('{1} methods' format: {someItems size})) + action: [ self browseSeveralReferencesOf: (someItems collect: #selector) ]. + menu + addItemLabel: (self + createLabel: 'Browse hierarchy references' + description: ('{1} methods' format: {someItems size})) + action: [ self browseSeveralHierarchyReferencesOf: (someItems collect: #selector) ]. + + true ifTrue: [ ^ menu ]. + + menu + addItem: (BrMenuSubmenuItem new + label: (self + createLabel: 'Push up methods' + description: ('{1} methods' format: {someItems size})); + submenu: (self pushUpSeveralMethodsSubmenuFor: someItems)). + menu + addItem: (BrMenuSubmenuItem new + label: (self + createLabel: 'Push down methods' + description: ('{1} methods' format: {someItems size})); + submenu: (self pushDownSeveralMethodsSubmenuFor: someItems)). + menu + addItem: (BrMenuSubmenuItem new + label: (self + createLabel: 'Remove methods' + description: ('{1} methods' format: {someItems size})); + submenu: (self removeSeveralMethodsSubmenuFor: someItems)). + ^ menu +] + { #category : #'private - insance creation' } GtCoderMethodsGroupedListElement >> createDraggedMethodItem: aDragItem [ @@ -224,6 +327,24 @@ GtCoderMethodsGroupedListElement >> pushDownMethodSubmenuFor: aMethod [ ^ submenu ] +{ #category : #'private - context menu' } +GtCoderMethodsGroupedListElement >> pushDownSeveralMethodsSubmenuFor: aCollectionOfMethods [ + | submenu | + submenu := BrMenuExplicit new. + submenu + stencil: [ GtRefactoringsWithInputPreviewElement + elementForRefactoring: [ aCollectionOfMethods + collect: [ :aMethod | + RBPushDownMethodRefactoring + pushDown: {aMethod selector} + from: aMethod methodClass ] ] + confirmationLabeled: ('Push down {1} methods' + format: {aCollectionOfMethods size}) + from: self + beforeApplyingDo: [ submenu hideAll ] ]. + ^ submenu +] + { #category : #'private - context menu' } GtCoderMethodsGroupedListElement >> pushUpMethodSubmenuFor: aMethod [ | submenu | @@ -239,6 +360,21 @@ GtCoderMethodsGroupedListElement >> pushUpMethodSubmenuFor: aMethod [ ^ submenu ] +{ #category : #'private - context menu' } +GtCoderMethodsGroupedListElement >> pushUpSeveralMethodsSubmenuFor: aCollectionOfMethods [ + | submenu | + submenu := BrMenuExplicit new. + submenu + stencil: [ GtRefactoringsWithInputPreviewElement + elementForRefactoring: [ aCollectionOfMethods + collect: [ :aMethod | RBPullUpMethodRefactoring pullUp: {aMethod selector} from: aMethod methodClass ] ] + confirmationLabeled: ('Pull up {1} methods' + format: {aCollectionOfMethods size}) + from: self + beforeApplyingDo: [ submenu hideAll ] ]. + ^ submenu +] + { #category : #'private - context menu' } GtCoderMethodsGroupedListElement >> removeMethodSubmenuFor: aMethod [ | submenu | @@ -289,6 +425,58 @@ GtCoderMethodsGroupedListElement >> removeMethodSubmenuFor: aMethod [ element ] ] +{ #category : #'private - context menu' } +GtCoderMethodsGroupedListElement >> removeSeveralMethodsSubmenuFor: aCollectionOfMethods [ + | submenu | + submenu := BrMenuExplicit new. + ^ submenu + stencil: [ | element change button | + element := BrVerticalPane new fitContent. + element + addChild: (BrLabel new + margin: (BlInsets + top: 10 + bottom: 0 + left: 10 + right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont; + text: ('Remove {1} methods' format: {aCollectionOfMethods size}) asRopedText). + element + addChild: (BrAsyncWidget new + fitContent; + stencil: [ | pane references | + pane := BrVerticalPane new. + pane fitContent. + references := aCollectionOfMethods + inject: 0 + into: [ :sum :method | sum + (GtPharoIndex current sendersOf: method) size ]. + references > 0 + ifTrue: [ pane + addChild: (BrLabel new + margin: (BlInsets left: 10 right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; + text: (references printString , ' reference' + , (references > 1 ifTrue: [ 's' ] ifFalse: [ '' ])) asRopedText) ]. + pane ]). + change := RBRemoveMethodChange + remove: aCollectionOfMethods first selector + from: aCollectionOfMethods first methodClass. + button := BrButton new + aptitude: BrGlamorousButtonWithIconAptitude; + beSmallSize; + margin: (BlInsets + top: 10 + bottom: 10 + left: 10 + right: 10); + icon: BrGlamorousVectorIcons remove; + label: 'Remove'; + action: [ submenu hideAll. + change execute ]. + element addChild: button as: #removeButton. + element ] +] + { #category : #'private - context menu' } GtCoderMethodsGroupedListElement >> renameMethodSubmenuFor: aMethod [ | submenu | From 7c011f5a35e9d6f30134b4aaeccffcfa6931f8ba Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 19 May 2025 13:40:10 -0400 Subject: [PATCH 0950/1268] fix `GtCoderMethodsGroupedListElement>>#removeMethodSubmenuFor:` --- src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index ad6f25ee5..ffade130a 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -397,7 +397,7 @@ GtCoderMethodsGroupedListElement >> removeMethodSubmenuFor: aMethod [ stencil: [ | pane references | pane := BrVerticalPane new. pane fitContent. - references := (GtPharoIndex current sendersOf: aMethod size) size. + references := (GtPharoIndex current sendersOf: aMethod selector) size. references > 0 ifTrue: [ pane addChild: (BrLabel new From cb1c46fe74fd50cd19def1ffcb0a308792073348 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 19 May 2025 13:44:26 -0400 Subject: [PATCH 0951/1268] fix references count in `GtCoderMethodsGroupedListElement>>#removeSeveralMethodsSubmenuFor:` [[feenkcom/gtoolkit#4546]] --- src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index ffade130a..e3210cbc7 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -449,7 +449,7 @@ GtCoderMethodsGroupedListElement >> removeSeveralMethodsSubmenuFor: aCollectionO pane fitContent. references := aCollectionOfMethods inject: 0 - into: [ :sum :method | sum + (GtPharoIndex current sendersOf: method) size ]. + into: [ :sum :method | sum + (GtPharoIndex current sendersOf: method selector) size ]. references > 0 ifTrue: [ pane addChild: (BrLabel new From a4617f1cc1e8acaf50912c9e26f85e9726ac81fd Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 19 May 2025 15:45:01 -0400 Subject: [PATCH 0952/1268] drag hadler handles selection of multiple methods [feenkcom/gtoolkit#4546] --- .../GtCoderMethodsGroupedListElement.class.st | 34 ++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index e3210cbc7..87ab3cc44 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -211,10 +211,21 @@ GtCoderMethodsGroupedListElement >> createMethodDragHandler [ ^ BlDragHandler new enableCopy; liftItem: [ :aLabelElement | - BlDragItem new - sourceElement: aLabelElement; - domainObject: (aLabelElement userData at: #method); - stencil: [ :aDragItem | self createDraggedMethodItem: aDragItem ] ] + | someItems currentMethod | + currentMethod := aLabelElement userData at: #method. + someItems := self selectedItems. + (someItems size > 1 and: [ someItems identityIncludes: currentMethod ]) + ifTrue: [ + someItems collect: [ :each | + BlDragItem new + sourceElement: aLabelElement; + domainObject: each; + stencil: [ :aDragItem | self createSeveralDraggedMethodsItem: someItems ] ] ] + ifFalse: [ + BlDragItem new + sourceElement: aLabelElement; + domainObject: (aLabelElement userData at: #method); + stencil: [ :aDragItem | self createDraggedMethodItem: aDragItem ] ] ] ] { #category : #'private - insance creation' } @@ -239,6 +250,21 @@ GtCoderMethodsGroupedListElement >> createMethodGroups [ classGroup} ] +{ #category : #'private - insance creation' } +GtCoderMethodsGroupedListElement >> createSeveralDraggedMethodsItem: aCollection [ + ^ BrLabel new + aptitude: (BrGlamorousLabelAptitude new padding: (BlInsets all: 5)) + BrShadowAptitude; + beSmallSize; + opacity: 0.85; + margin: (BlInsets all: 5); + background: Color white; + beFocusable; + requestFocus; + geometry: (BlRoundedRectangleGeometry cornerRadius: 5); + fitContent; + text: ('{1} methods' format: {aCollection size}) +] + { #category : #initialization } GtCoderMethodsGroupedListElement >> initialize [ super initialize. From 9c834ff8aae20c38d6e54456b45e246f0b0f90f3 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 19 May 2025 17:45:15 -0400 Subject: [PATCH 0953/1268] add remove several methods context menu item [feenkcom/gtoolkit#4546] --- .../GtCoderMethodsGroupedListElement.class.st | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index 87ab3cc44..857fe1a84 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -167,7 +167,7 @@ GtCoderMethodsGroupedListElement >> contextMenuForSeveralItems: someItems in: an description: ('{1} methods' format: {someItems size})) action: [ self browseSeveralHierarchyReferencesOf: (someItems collect: #selector) ]. - true ifTrue: [ ^ menu ]. + true ifFalse: [ menu addItem: (BrMenuSubmenuItem new @@ -181,6 +181,9 @@ GtCoderMethodsGroupedListElement >> contextMenuForSeveralItems: someItems in: an createLabel: 'Push down methods' description: ('{1} methods' format: {someItems size})); submenu: (self pushDownSeveralMethodsSubmenuFor: someItems)). + + ]. + menu addItem: (BrMenuSubmenuItem new label: (self @@ -456,7 +459,7 @@ GtCoderMethodsGroupedListElement >> removeSeveralMethodsSubmenuFor: aCollectionO | submenu | submenu := BrMenuExplicit new. ^ submenu - stencil: [ | element change button | + stencil: [ | element changes change button | element := BrVerticalPane new fitContent. element addChild: (BrLabel new @@ -484,9 +487,18 @@ GtCoderMethodsGroupedListElement >> removeSeveralMethodsSubmenuFor: aCollectionO text: (references printString , ' reference' , (references > 1 ifTrue: [ 's' ] ifFalse: [ '' ])) asRopedText) ]. pane ]). - change := RBRemoveMethodChange - remove: aCollectionOfMethods first selector - from: aCollectionOfMethods first methodClass. + + + changes := aCollectionOfMethods collect: [ :eachMethod | + RBRemoveMethodChange + remove: eachMethod selector + from: eachMethod methodClass ]. + + change := RBCompositeRefactoryChange new + name: ('Remove {1} methods' format: { aCollectionOfMethods size }); + changes: changes; + yourself. + button := BrButton new aptitude: BrGlamorousButtonWithIconAptitude; beSmallSize; From 950092d60042e86741cdecbf25ef40ff94089cd2 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 19 May 2025 19:49:03 -0400 Subject: [PATCH 0954/1268] enable push up and down refactorings for several selected methods [feenkcom/gtoolkit#4546] --- .../GtCoderMethodsGroupedListElement.class.st | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index 857fe1a84..850118dce 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -167,8 +167,6 @@ GtCoderMethodsGroupedListElement >> contextMenuForSeveralItems: someItems in: an description: ('{1} methods' format: {someItems size})) action: [ self browseSeveralHierarchyReferencesOf: (someItems collect: #selector) ]. - true ifFalse: [ - menu addItem: (BrMenuSubmenuItem new label: (self @@ -182,8 +180,6 @@ GtCoderMethodsGroupedListElement >> contextMenuForSeveralItems: someItems in: an description: ('{1} methods' format: {someItems size})); submenu: (self pushDownSeveralMethodsSubmenuFor: someItems)). - ]. - menu addItem: (BrMenuSubmenuItem new label: (self @@ -362,11 +358,16 @@ GtCoderMethodsGroupedListElement >> pushDownSeveralMethodsSubmenuFor: aCollectio submenu := BrMenuExplicit new. submenu stencil: [ GtRefactoringsWithInputPreviewElement - elementForRefactoring: [ aCollectionOfMethods - collect: [ :aMethod | - RBPushDownMethodRefactoring - pushDown: {aMethod selector} - from: aMethod methodClass ] ] + elementForRefactoring: [ | aModel aCollectionOfRefactorings | + aModel := RBClassModelFactory rbNamespace + onEnvironment: RBPushDownMethodRefactoring new defaultEnvironment. + aCollectionOfRefactorings := aCollectionOfMethods + collect: [ :aMethod | + RBPushDownMethodRefactoring new + model: aModel; + pushDown: {aMethod selector} from: aMethod methodClass ]. + aModel name: ('Push down {1} methods' format: {aCollectionOfMethods size}). + aCollectionOfRefactorings ] confirmationLabeled: ('Push down {1} methods' format: {aCollectionOfMethods size}) from: self @@ -395,8 +396,16 @@ GtCoderMethodsGroupedListElement >> pushUpSeveralMethodsSubmenuFor: aCollectionO submenu := BrMenuExplicit new. submenu stencil: [ GtRefactoringsWithInputPreviewElement - elementForRefactoring: [ aCollectionOfMethods - collect: [ :aMethod | RBPullUpMethodRefactoring pullUp: {aMethod selector} from: aMethod methodClass ] ] + elementForRefactoring: [ | aModel aCollectionOfRefactorings | + aModel := RBClassModelFactory rbNamespace + onEnvironment: RBPullUpMethodRefactoring new defaultEnvironment. + aCollectionOfRefactorings := aCollectionOfMethods + collect: [ :aMethod | + RBPullUpMethodRefactoring new + model: aModel; + pullUp: {aMethod selector} from: aMethod methodClass ]. + aModel name: ('Pull up {1} methods' format: {aCollectionOfMethods size}). + aCollectionOfRefactorings ] confirmationLabeled: ('Pull up {1} methods' format: {aCollectionOfMethods size}) from: self From 103a5bfc2a1b791b1df2717c694eb63a6ef4a955 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 19 May 2025 19:59:40 -0400 Subject: [PATCH 0955/1268] use `pull up` instead of `push up` [feenkcom/gtoolkit#4546] --- .../GtCoderMethodsGroupedListElement.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index 850118dce..d427b5a43 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -124,7 +124,7 @@ GtCoderMethodsGroupedListElement >> contextMenuForOneItem: item in: anElement [ action: [ self browseHierarchyReferencesOf: item selector ]. menu addItem: (BrMenuSubmenuItem new - label: (self createLabel: 'Push up method' description: item selector); + label: (self createLabel: 'Pull up method' description: item selector); submenu: (self pushUpMethodSubmenuFor: item)). menu addItem: (BrMenuSubmenuItem new @@ -170,7 +170,7 @@ GtCoderMethodsGroupedListElement >> contextMenuForSeveralItems: someItems in: an menu addItem: (BrMenuSubmenuItem new label: (self - createLabel: 'Push up methods' + createLabel: 'Pull up methods' description: ('{1} methods' format: {someItems size})); submenu: (self pushUpSeveralMethodsSubmenuFor: someItems)). menu From 47fb1b73df7b8c1117a85bec0a85e2cf49e66e2b Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 20 May 2025 11:26:51 -0400 Subject: [PATCH 0956/1268] improve pull up and push down code [feenkcom/gtoolkit#4546] --- .../GtCoderMethodsGroupedListElement.class.st | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index d427b5a43..6e0d6a325 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -358,14 +358,16 @@ GtCoderMethodsGroupedListElement >> pushDownSeveralMethodsSubmenuFor: aCollectio submenu := BrMenuExplicit new. submenu stencil: [ GtRefactoringsWithInputPreviewElement - elementForRefactoring: [ | aModel aCollectionOfRefactorings | + elementForRefactoring: [ | aGroupByClass aModel aCollectionOfRefactorings | + aGroupByClass := aCollectionOfMethods groupedBy: #methodClass. aModel := RBClassModelFactory rbNamespace onEnvironment: RBPushDownMethodRefactoring new defaultEnvironment. - aCollectionOfRefactorings := aCollectionOfMethods - collect: [ :aMethod | + aCollectionOfRefactorings := aGroupByClass + collect: [ :someMethods | RBPushDownMethodRefactoring new model: aModel; - pushDown: {aMethod selector} from: aMethod methodClass ]. + pushDown: (someMethods collect: #selector) + from: someMethods anyOne methodClass ] as: Array. aModel name: ('Push down {1} methods' format: {aCollectionOfMethods size}). aCollectionOfRefactorings ] confirmationLabeled: ('Push down {1} methods' @@ -396,14 +398,16 @@ GtCoderMethodsGroupedListElement >> pushUpSeveralMethodsSubmenuFor: aCollectionO submenu := BrMenuExplicit new. submenu stencil: [ GtRefactoringsWithInputPreviewElement - elementForRefactoring: [ | aModel aCollectionOfRefactorings | + elementForRefactoring: [ | aGroupByClass aModel aCollectionOfRefactorings | + aGroupByClass := aCollectionOfMethods groupedBy: #methodClass. aModel := RBClassModelFactory rbNamespace onEnvironment: RBPullUpMethodRefactoring new defaultEnvironment. - aCollectionOfRefactorings := aCollectionOfMethods - collect: [ :aMethod | + aCollectionOfRefactorings := aGroupByClass + collect: [ :someMethods | RBPullUpMethodRefactoring new model: aModel; - pullUp: {aMethod selector} from: aMethod methodClass ]. + pullUp: (someMethods collect: #selector) + from: someMethods anyOne methodClass ] as: Array. aModel name: ('Pull up {1} methods' format: {aCollectionOfMethods size}). aCollectionOfRefactorings ] confirmationLabeled: ('Pull up {1} methods' From 846cea3cc2019e01f9e895e66ade096c9733779d Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 22 May 2025 11:52:46 -0400 Subject: [PATCH 0957/1268] coder navigation model with `#selectClasses:` [feenkcom/gtoolkit#4551] --- .../GtCoderNavigationElement.class.st | 15 ++++++++++----- .../GtCoderNavigationClassSelected.class.st | 15 +++++++++++++-- .../GtCoderNavigationModel.class.st | 5 +++++ .../GtCoderNullNavigationModel.class.st | 5 +++++ 4 files changed, 33 insertions(+), 7 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st index 1589aea95..dfd323ec1 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st @@ -93,15 +93,20 @@ GtCoderNavigationElement >> onClassDeselected: anAnnouncement [ { #category : #'event handling' } GtCoderNavigationElement >> onClassListSelectionChanged [ - | anIndex aSelectedItem theIndices | + | theIndices someClasses | supressListChanges ifTrue: [ ^ self ]. theIndices := classesList selectedIndices. theIndices ifEmpty: [ ^ self ]. - anIndex := theIndices first. - (anIndex between: 1 and: classesList viewModel itemCount) + (theIndices first between: 1 and: classesList viewModel itemCount) ifFalse: [ ^ self ]. - aSelectedItem := (classesList viewModel itemAt: anIndex) value rootClass. - self navigationModel selectClass: aSelectedItem + (theIndices last between: 1 and: classesList viewModel itemCount) + ifFalse: [ ^ self ]. + someClasses := classesList selectedNodes + collect: [ :each | each value rootClass ]. + someClasses ifEmpty: [ ^ self ]. + someClasses size = 1 + ifTrue: [ self navigationModel selectClass: someClasses anyOne ] + ifFalse: [ self navigationModel selectClasses: someClasses ] ] { #category : #'event handling' } diff --git a/src/GToolkit-Coder/GtCoderNavigationClassSelected.class.st b/src/GToolkit-Coder/GtCoderNavigationClassSelected.class.st index 49f8d5a18..cf4b8eff5 100644 --- a/src/GToolkit-Coder/GtCoderNavigationClassSelected.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationClassSelected.class.st @@ -4,9 +4,10 @@ Class { #instVars : [ 'theClass', 'package', - 'tag' + 'tag', + 'selectedClasses' ], - #category : 'GToolkit-Coder-Navigation - Events' + #category : #'GToolkit-Coder-Navigation - Events' } { #category : #accessing } @@ -19,6 +20,16 @@ GtCoderNavigationClassSelected >> package: anObject [ package := anObject ] +{ #category : #accessing } +GtCoderNavigationClassSelected >> selectedClasses [ + ^ selectedClasses +] + +{ #category : #accessing } +GtCoderNavigationClassSelected >> selectedClasses: anObject [ + selectedClasses := anObject +] + { #category : #accessing } GtCoderNavigationClassSelected >> tag [ ^ tag diff --git a/src/GToolkit-Coder/GtCoderNavigationModel.class.st b/src/GToolkit-Coder/GtCoderNavigationModel.class.st index 2a2a6626b..e415ce02f 100644 --- a/src/GToolkit-Coder/GtCoderNavigationModel.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationModel.class.st @@ -60,6 +60,11 @@ GtCoderNavigationModel >> selectClass: aClass [ self subclassResponsibility ] +{ #category : #'api - selection' } +GtCoderNavigationModel >> selectClasses: aCollectionOfClasses [ + self subclassResponsibility +] + { #category : #'api - selection' } GtCoderNavigationModel >> selectMethod: aCompiledMethod [ self subclassResponsibility diff --git a/src/GToolkit-Coder/GtCoderNullNavigationModel.class.st b/src/GToolkit-Coder/GtCoderNullNavigationModel.class.st index 3564899d0..f3db505bd 100644 --- a/src/GToolkit-Coder/GtCoderNullNavigationModel.class.st +++ b/src/GToolkit-Coder/GtCoderNullNavigationModel.class.st @@ -46,6 +46,11 @@ GtCoderNullNavigationModel >> selectClass: aClass [ "do nothing" ] +{ #category : #'api - selection' } +GtCoderNullNavigationModel >> selectClasses: aCollectionOfClasses [ + "do nothing" +] + { #category : #'api - selection' } GtCoderNullNavigationModel >> selectMethod: aCompiledMethod [ "do nothing" From 076888bab6bfa8d6d39acf31884872e87ad4e361 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 22 May 2025 12:27:51 -0400 Subject: [PATCH 0958/1268] sidebar several classes context menu [feenkcom/gtoolkit#4551] - users can browse references of selected classes - users can remove all selected classes --- .../GtCoderClassesTreeElement.class.st | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index 1d4dabc6a..275efddf8 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -56,6 +56,16 @@ GtCoderClassesTreeElement >> browseReferencesTo: aClass [ self phlow spawnObject: (aClass gtReferences) ] +{ #category : #initialization } +GtCoderClassesTreeElement >> browseSeveralReferencesTo: someClasses [ + | aFilter | + aFilter := someClasses allButFirst + inject: someClasses first gtReferences + into: [ :aSumFilter :aClass | aSumFilter | aClass gtReferences ]. + + self phlow spawnObject: aFilter +] + { #category : #initialization } GtCoderClassesTreeElement >> buildRemoveClassLabelFor: aClass [ | labelText | @@ -66,6 +76,16 @@ GtCoderClassesTreeElement >> buildRemoveClassLabelFor: aClass [ text: labelText asRopedText ] +{ #category : #initialization } +GtCoderClassesTreeElement >> buildRemoveSeveralClassesLabelFor: someClasses [ + | labelText | + labelText := 'Remove {1} classes' format: { someClasses size }. + ^ BrLabel new + margin: (BlInsets all: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont; + text: labelText asRopedText +] + { #category : #'as yet unclassified' } GtCoderClassesTreeElement >> containsClass: aClass [ "Return true if the classes tree contains a given class, false otherwise" @@ -74,6 +94,16 @@ GtCoderClassesTreeElement >> containsClass: aClass [ { #category : #initialization } GtCoderClassesTreeElement >> contextMenuFor: aClass [ + | someClasses | + someClasses := self selectedItems collect: #rootClass. + + ^ (someClasses size < 2 or: [ (someClasses includes: aClass) not ]) + ifTrue: [ self contextMenuForOneItem: aClass ] + ifFalse: [ self contextMenuForSeveralItems: someClasses ] +] + +{ #category : #initialization } +GtCoderClassesTreeElement >> contextMenuForOneItem: aClass [ | menu | menu := BrMenuItems new. menu @@ -102,6 +132,21 @@ GtCoderClassesTreeElement >> contextMenuFor: aClass [ ^ menu ] +{ #category : #initialization } +GtCoderClassesTreeElement >> contextMenuForSeveralItems: someClasses [ + | menu countLabel | + menu := BrMenuItems new. + countLabel := '{1} classes' format: { someClasses size }. + menu + addItemLabel: (self createLabel: 'Browse references' description: countLabel) + action: [ self browseSeveralReferencesTo: someClasses ]. + menu + addItem: (BrMenuSubmenuItem new + label: (self createLabel: 'Remove classes' description: countLabel); + submenu: (self removeSeveralClassesSubmenuFor: someClasses)). + ^ menu +] + { #category : #initialization } GtCoderClassesTreeElement >> convertToSiblingSubmenuFor: aClass siblings: aCollection [ | submenu | @@ -301,6 +346,63 @@ GtCoderClassesTreeElement >> removeClassSubmenuFor: aClass [ element ] ] +{ #category : #initialization } +GtCoderClassesTreeElement >> removeSeveralClassesSubmenuFor: someClasses [ + | submenu | + submenu := BrMenuExplicit new. + ^ submenu + stencil: [ | element change button | + element := BrVerticalPane new fitContent. + element + addChild: ((self buildRemoveSeveralClassesLabelFor: someClasses) + margin: (BlInsets + top: 10 + bottom: 0 + left: 10 + right: 10)). + element + addChild: (BrAsyncWidget new + fitContent; + stencil: [ | pane references subclasses | + references := someClasses sum: [ :eachClass | (GtPharoIndex current + globalVariableReferencesTo: eachClass binding) size ]. + subclasses := someClasses sum: [ :eachClass | eachClass allSubclasses size ]. + pane := BrVerticalPane new. + pane fitContent. + references > 0 + ifTrue: [ pane + addChild: (BrLabel new + margin: (BlInsets left: 10 right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; + text: (references printString , ' reference' + , (references > 1 ifTrue: [ 's' ] ifFalse: [ '' ])) asRopedText) ]. + subclasses > 0 + ifTrue: [ pane + addChild: (BrLabel new + margin: (BlInsets left: 10 right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; + text: (subclasses printString , ' subclass' + , (subclasses > 1 ifTrue: [ 'es' ] ifFalse: [ '' ])) asRopedText) ]. + pane ]). + change := RBCompositeRefactoryChange new + name: ('Remove {1} classes' format: { someClasses size }); + changes: (someClasses collect: [ :eachClass | RBRemoveClassChange remove: eachClass ]). + button := BrButton new + aptitude: BrGlamorousButtonWithIconAptitude; + beSmallSize; + margin: (BlInsets + top: 10 + bottom: 10 + left: 10 + right: 10); + icon: BrGlamorousVectorIcons remove; + label: 'Remove'; + action: [ submenu hideAll. + change execute ]. + element addChild: button as: #removeButton. + element ] +] + { #category : #initialization } GtCoderClassesTreeElement >> renameClassSubmenuFor: aClass [ | submenu | From 4d1f82fd4c5adae4d5ef15930399608dba532e23 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 22 May 2025 12:30:27 -0400 Subject: [PATCH 0959/1268] enable class multi-selection [feenkcom/gtoolkit#4551] --- src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st index dfd323ec1..63c30901e 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st @@ -53,7 +53,7 @@ GtCoderNavigationElement >> initialize [ { #category : #initialization } GtCoderNavigationElement >> initializeContent [ - classesList := GtCoderClassesTreeElement new. + classesList := GtCoderClassesTreeElement multiSelection. ] { #category : #initialization } From fb0a8ed6fe313d20700eed1fefbeba0388068471 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 22 May 2025 13:56:44 -0400 Subject: [PATCH 0960/1268] drag and drop classes in a package [feenkcom/gtoolkit#4551] --- .../GtCoderClassesTreeElement.class.st | 52 +++++++++++++++++++ .../GtCoderPackagesTreeElement.class.st | 34 ++++++++++++ 2 files changed, 86 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index 275efddf8..f78f0f8f2 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -165,6 +165,27 @@ GtCoderClassesTreeElement >> convertToSiblingSubmenuFor: aClass siblings: aColle ^ submenu ] +{ #category : #'private - drag and drop' } +GtCoderClassesTreeElement >> createClassDragHandler [ + ^ BlDragHandler new + enableCopy; + liftItem: [ :aGtCoderClassesTreeItemElement | + | someClasses currentClass | + currentClass := aGtCoderClassesTreeItemElement theClass. + someClasses := self selectedItems collect: #rootClass. + (someClasses size > 1 and: [ someClasses includes: currentClass ]) + ifTrue: [ someClasses + collect: [ :each | + BlDragItem new + sourceElement: aGtCoderClassesTreeItemElement; + domainObject: each; + stencil: [ :aDragItem | self createSeveralDraggedClassesItem: someClasses ] ] ] + ifFalse: [ BlDragItem new + sourceElement: aGtCoderClassesTreeItemElement; + domainObject: currentClass; + stencil: [ :aDragItem | self createDraggedMethodItem: aDragItem ] ] ] +] + { #category : #'private - drag and drop' } GtCoderClassesTreeElement >> createClassDropHandler [ ^ BlDropHandler new @@ -176,6 +197,21 @@ GtCoderClassesTreeElement >> createClassDropHandler [ whenDragLeftDo: [ :anItemsLeftEvent | anItemsLeftEvent currentTarget effect: BlNullEffect new ] ] +{ #category : #'private - drag and drop' } +GtCoderClassesTreeElement >> createDraggedMethodItem: aDragItem [ + ^ BrLabel new + aptitude: (BrGlamorousLabelAptitude new padding: (BlInsets all: 5)) + BrShadowAptitude; + beSmallSize; + opacity: 0.85; + margin: (BlInsets all: 5); + background: Color white; + beFocusable; + requestFocus; + geometry: (BlRoundedRectangleGeometry cornerRadius: 5); + fitContent; + text: aDragItem domainObject printString +] + { #category : #'private - context menu' } GtCoderClassesTreeElement >> createLabel: aString description: description [ ^ aString asRopedText glamorousRegularFont @@ -189,6 +225,7 @@ GtCoderClassesTreeElement >> createLabel: aString description: description [ GtCoderClassesTreeElement >> createNodeElement [ ^ GtCoderClassesTreeItemElement new addEventHandler: self createClassDropHandler; + addEventHandler: self createClassDragHandler; in: [ :aWidget | aWidget addAptitude: (BrGlamorousWithExplicitContextMenuAptitude @@ -196,6 +233,21 @@ GtCoderClassesTreeElement >> createNodeElement [ yourself ] +{ #category : #'private - drag and drop' } +GtCoderClassesTreeElement >> createSeveralDraggedClassesItem: someClassHierarchyTrees [ + ^ BrLabel new + aptitude: (BrGlamorousLabelAptitude new padding: (BlInsets all: 5)) + BrShadowAptitude; + beSmallSize; + opacity: 0.85; + margin: (BlInsets all: 5); + background: Color white; + beFocusable; + requestFocus; + geometry: (BlRoundedRectangleGeometry cornerRadius: 5); + fitContent; + text: ('{1} classes' format: {someClassHierarchyTrees size}) +] + { #category : #initialization } GtCoderClassesTreeElement >> initialize [ super initialize. diff --git a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st index cb14df673..03aebe551 100644 --- a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st @@ -85,6 +85,17 @@ GtCoderPackagesTreeElement >> contextMenuFor: aPackageOrTag [ ^ menu ] +{ #category : #initialization } +GtCoderPackagesTreeElement >> createPackageOrTagDropHandler [ + ^ BlDropHandler new + acceptDomainObjectsSuchThat: [ :anObject | anObject isClassOrTrait ]; + whenDroppedDo: [ :anItemsDroppedEvent | self onDropClassesOnPackageOrTag: anItemsDroppedEvent ]; + whenDragEnteredDo: [ :anItemsDraggedOverEvent | + anItemsDraggedOverEvent currentTarget + effect: (BlOverlayAboveEffect new paint: (Color gray alpha: 0.2)) ]; + whenDragLeftDo: [ :anItemsLeftEvent | anItemsLeftEvent currentTarget effect: BlNullEffect new ] +] + { #category : #'private - context menu' } GtCoderPackagesTreeElement >> createRenamePackageForm: aPackageOrTag [ ^ GtCoderPackagesTreeRenameEditor new @@ -130,6 +141,7 @@ GtCoderPackagesTreeElement >> initialize [ anItemElement hMatchParent; vFitContent; + addEventHandler: self createPackageOrTagDropHandler; addAptitude: (BrGlamorousWithExplicitContextMenuAptitude menu: [ self contextMenuFor: anItemElement packageOrTag ]) ] ]; nodeDataBinder: [ :aPackageElement :aPackage | @@ -178,6 +190,28 @@ GtCoderPackagesTreeElement >> newTagFor: aPackage inElement: elem [ self notYetImplemented ] +{ #category : #initialization } +GtCoderPackagesTreeElement >> onDropClassesOnPackageOrTag: anItemsDroppedEvent [ + | aPackageOrTag aModel compositeChange someRefactorings | + aPackageOrTag := anItemsDroppedEvent currentTarget packageOrTag. + aModel := RBClassModelFactory rbNamespace + onEnvironment: RBPushDownMethodRefactoring new defaultEnvironment. + + someRefactorings := anItemsDroppedEvent items + collect: [ :eachDragItem | + | eachClass | + eachClass := eachDragItem domainObject. + + GtRBMoveClassToPackageRefactoring + model: aModel + move: eachClass name + to: aPackageOrTag name ]. + + someRefactorings do: #primitiveExecute. + compositeChange := aModel changes. + compositeChange execute +] + { #category : #'private - context menu' } GtCoderPackagesTreeElement >> privateEndRenamePackage [ "Removes package editing UI" From 0c08fb2ba3c817265bf4dba8955245fff47ab259 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 23 May 2025 12:43:42 -0400 Subject: [PATCH 0961/1268] stronger accept conditions for dragged methods and classes [feenkcom/gtoolkit#4551] - do not accept dropping classes on a package where classes are defined - similarly for methods --- .../GtCoderClassesTreeElement.class.st | 14 ++++--- ...onBasicPackagesTagsClassesElement.class.st | 4 +- .../GtCoderNavigationElement.class.st | 38 +++++++++++++++++++ .../GtCoderPackagesTreeElement.class.st | 9 +++-- ...tCoderProtocolsGroupedListElement.class.st | 14 +++++-- 5 files changed, 65 insertions(+), 14 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index f78f0f8f2..bfcc095c4 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -86,7 +86,7 @@ GtCoderClassesTreeElement >> buildRemoveSeveralClassesLabelFor: someClasses [ text: labelText asRopedText ] -{ #category : #'as yet unclassified' } +{ #category : #testing } GtCoderClassesTreeElement >> containsClass: aClass [ "Return true if the classes tree contains a given class, false otherwise" ^ classesTree containsClass: aClass @@ -168,7 +168,6 @@ GtCoderClassesTreeElement >> convertToSiblingSubmenuFor: aClass siblings: aColle { #category : #'private - drag and drop' } GtCoderClassesTreeElement >> createClassDragHandler [ ^ BlDragHandler new - enableCopy; liftItem: [ :aGtCoderClassesTreeItemElement | | someClasses currentClass | currentClass := aGtCoderClassesTreeItemElement theClass. @@ -189,11 +188,14 @@ GtCoderClassesTreeElement >> createClassDragHandler [ { #category : #'private - drag and drop' } GtCoderClassesTreeElement >> createClassDropHandler [ ^ BlDropHandler new - acceptDomainObjectsSuchThat: [ :anObject | anObject isCompiledMethod ]; + acceptItemsSuchThat: [ :aDragItem :aGtCoderClassesTreeItemElement | + aDragItem domainObject isCompiledMethod + and: [ aGtCoderClassesTreeItemElement theClass ~= aDragItem domainObject methodClass ] ]; whenDroppedDo: [ :anItemsDroppedEvent | self onDropCompiledMethodsOnClass: anItemsDroppedEvent ]; whenDragEnteredDo: [ :anItemsDraggedOverEvent | - anItemsDraggedOverEvent currentTarget - effect: (BlOverlayAboveEffect new paint: (Color gray alpha: 0.2)) ]; + anItemsDraggedOverEvent mayAcceptItems + ifTrue: [ anItemsDraggedOverEvent currentTarget + effect: (BlOverlayAboveEffect new paint: (Color gray alpha: 0.2)) ] ]; whenDragLeftDo: [ :anItemsLeftEvent | anItemsLeftEvent currentTarget effect: BlNullEffect new ] ] @@ -418,7 +420,7 @@ GtCoderClassesTreeElement >> removeSeveralClassesSubmenuFor: someClasses [ stencil: [ | pane references subclasses | references := someClasses sum: [ :eachClass | (GtPharoIndex current globalVariableReferencesTo: eachClass binding) size ]. - subclasses := someClasses sum: [ :eachClass | eachClass allSubclasses size ]. + subclasses := someClasses sum: [ :eachClass | (eachClass allSubclasses difference: someClasses) size ]. pane := BrVerticalPane new. pane fitContent. references > 0 diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationBasicPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationBasicPackagesTagsClassesElement.class.st index 75e6612a2..eeebfeb27 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationBasicPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationBasicPackagesTagsClassesElement.class.st @@ -428,8 +428,8 @@ GtCoderNavigationBasicPackagesTagsClassesElement >> updateClassList [ classesList initializeWithClasses: navigationModel classesToShow. - navigationModel selectedClass - ifNotNil: [ :aClass | self selectClass: aClass ] + navigationModel selectedClasses + ifNotNil: [ :aCollectionOfClasses | self selectClasses: aCollectionOfClasses ] ] { #category : #'updating lists' } diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st index 63c30901e..4feaa0be0 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st @@ -196,6 +196,44 @@ GtCoderNavigationElement >> selectClass: aClass [ max: classesList viewModel itemCount) ] ] +{ #category : #'api - class selections' } +GtCoderNavigationElement >> selectClasses: aCollectionOfClasses [ + | aPreviousIndex newIndexes | + aPreviousIndex := classesList selectedIndice. + + newIndexes := Array + new: aCollectionOfClasses size + streamContents: [ :aStream | + aCollectionOfClasses + do: [ :eachClass | + classesList viewModel + indexOfSuchThat: [ :each | each rootClass = eachClass ] + do: [ :aNewIndex | aStream nextPut: aNewIndex ] ] ]. + + newIndexes + ifEmpty: [ classesList deselectAll. + ^ self ]. + + newIndexes size = 1 + ifTrue: [ classesList + selectOne: newIndexes anyOne; + scrollToIndex: (self + scrollIndexFromPrevious: aPreviousIndex + current: newIndexes anyOne + max: classesList viewModel itemCount). + ^ self ]. + + newIndexes sort: [ :a :b | a < b ]. + classesList deselectAll. + newIndexes + do: [ :aNewIndex | classesList addToSelection: aNewIndex dueTo: nil ]. + classesList + scrollToIndex: (self + scrollIndexFromPrevious: aPreviousIndex + current: newIndexes anyOne + max: classesList viewModel itemCount) +] + { #category : #subscriptions } GtCoderNavigationElement >> subscribeToClassList [ classesList diff --git a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st index 03aebe551..4093d8ad1 100644 --- a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st @@ -88,11 +88,14 @@ GtCoderPackagesTreeElement >> contextMenuFor: aPackageOrTag [ { #category : #initialization } GtCoderPackagesTreeElement >> createPackageOrTagDropHandler [ ^ BlDropHandler new - acceptDomainObjectsSuchThat: [ :anObject | anObject isClassOrTrait ]; + acceptItemsSuchThat: [ :aDragItem :aGtCoderPackagesTreeItemElement | + aDragItem domainObject isClassOrTrait + and: [ aGtCoderPackagesTreeItemElement packageOrTag ~= aDragItem domainObject package ] ]; whenDroppedDo: [ :anItemsDroppedEvent | self onDropClassesOnPackageOrTag: anItemsDroppedEvent ]; whenDragEnteredDo: [ :anItemsDraggedOverEvent | - anItemsDraggedOverEvent currentTarget - effect: (BlOverlayAboveEffect new paint: (Color gray alpha: 0.2)) ]; + anItemsDraggedOverEvent mayAcceptItems + ifTrue: [ anItemsDraggedOverEvent currentTarget + effect: (BlOverlayAboveEffect new paint: (Color gray alpha: 0.2)) ] ]; whenDragLeftDo: [ :anItemsLeftEvent | anItemsLeftEvent currentTarget effect: BlNullEffect new ] ] diff --git a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st index 2613d3e98..7f23af5b7 100644 --- a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st @@ -66,11 +66,19 @@ GtCoderProtocolsGroupedListElement >> contextMenuFor: aPharoProtocol [ { #category : #'private - instance creation' } GtCoderProtocolsGroupedListElement >> createProtocolDropHandler [ ^ BlDropHandler new - acceptDomainObjectsSuchThat: [ :anObject | anObject isCompiledMethod ]; + acceptItemsSuchThat: [ :aDragItem :aBrLabel | + aDragItem domainObject isCompiledMethod + and: [ aBrLabel userData + at: #protocol + ifPresent: [ :aProtocol | + aProtocol isVirtualProtocol not + and: [ aProtocol name ~= aDragItem domainObject protocol ] ] + ifAbsent: [ false ] ] ]; whenDroppedDo: [ :anItemsDroppedEvent | self onDropCompiledMethodsOnProtocol: anItemsDroppedEvent ]; whenDragEnteredDo: [ :anItemsDraggedOverEvent | - anItemsDraggedOverEvent currentTarget - effect: (BlOverlayAboveEffect new paint: (Color gray alpha: 0.2)) ]; + anItemsDraggedOverEvent mayAcceptItems + ifTrue: [ anItemsDraggedOverEvent currentTarget + effect: (BlOverlayAboveEffect new paint: (Color gray alpha: 0.2)) ] ]; whenDragLeftDo: [ :anItemsLeftEvent | anItemsLeftEvent currentTarget effect: BlNullEffect new ] ] From 8a6fa02461d77cea8ad041c31e0b1ff6abad2c88 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Sun, 25 May 2025 16:02:37 -0400 Subject: [PATCH 0962/1268] add some action ids [feenkcom/gtoolkit#4559] --- .../GtMethodCoderCopyActionId.class.st | 10 ++++++++++ .../GtMethodCoderInspectActionId.class.st | 10 ++++++++++ .../GtMethodCoderRemoveActionId.class.st | 10 ++++++++++ src/GToolkit-Coder/GtCoderAddOns.class.st | 13 +++++++++++++ 4 files changed, 43 insertions(+) create mode 100644 src/GToolkit-Coder-UI/GtMethodCoderCopyActionId.class.st create mode 100644 src/GToolkit-Coder-UI/GtMethodCoderInspectActionId.class.st create mode 100644 src/GToolkit-Coder-UI/GtMethodCoderRemoveActionId.class.st diff --git a/src/GToolkit-Coder-UI/GtMethodCoderCopyActionId.class.st b/src/GToolkit-Coder-UI/GtMethodCoderCopyActionId.class.st new file mode 100644 index 000000000..04b123254 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtMethodCoderCopyActionId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtMethodCoderCopyActionId, + #superclass : #GtCoderElementId, + #category : #'GToolkit-Coder-UI-Coder - Ids' +} + +{ #category : #converting } +GtMethodCoderCopyActionId >> asSymbol [ + ^ #'main-action--copy' +] diff --git a/src/GToolkit-Coder-UI/GtMethodCoderInspectActionId.class.st b/src/GToolkit-Coder-UI/GtMethodCoderInspectActionId.class.st new file mode 100644 index 000000000..d83bc061a --- /dev/null +++ b/src/GToolkit-Coder-UI/GtMethodCoderInspectActionId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtMethodCoderInspectActionId, + #superclass : #GtCoderElementId, + #category : #'GToolkit-Coder-UI-Coder - Ids' +} + +{ #category : #converting } +GtMethodCoderInspectActionId >> asSymbol [ + ^ #'main-action--inspect' +] diff --git a/src/GToolkit-Coder-UI/GtMethodCoderRemoveActionId.class.st b/src/GToolkit-Coder-UI/GtMethodCoderRemoveActionId.class.st new file mode 100644 index 000000000..000fbfdf6 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtMethodCoderRemoveActionId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtMethodCoderRemoveActionId, + #superclass : #GtCoderElementId, + #category : #'GToolkit-Coder-UI-Coder - Ids' +} + +{ #category : #converting } +GtMethodCoderRemoveActionId >> asSymbol [ + ^ #'main-action--remove' +] diff --git a/src/GToolkit-Coder/GtCoderAddOns.class.st b/src/GToolkit-Coder/GtCoderAddOns.class.st index 557a92335..a3c7a9afb 100644 --- a/src/GToolkit-Coder/GtCoderAddOns.class.st +++ b/src/GToolkit-Coder/GtCoderAddOns.class.st @@ -313,6 +313,19 @@ GtCoderAddOns >> addDropDownWithPreviewAction: aString icon: anIcon action: acti ^ newAction ] +{ #category : #'api - main actions' } +GtCoderAddOns >> addDropDownWithPreviewAction: aString icon: anIcon action: actionBlock stencil: stencilBlock id: anId [ + | newAction | + newAction := GtCoderDropDownWithPreviewAction new + title: aString; + icon: anIcon; + changeAction: actionBlock; + changeStencil: stencilBlock; + id: anId. + mainActions add: newAction. + ^ newAction +] + { #category : #'api - context menu' } GtCoderAddOns >> addExplicitContextMenu: aString block: aBlock [ | newAction | From 63d2319d04516f10afc35ff9c40638094adddfe6 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Sun, 25 May 2025 16:25:55 -0400 Subject: [PATCH 0963/1268] class hierarchy does not change in some cases [feenkcom/gtoolkit#4551] conditions: - all superclasses must be displayed - a new class must be already selected --- ...igationBasicClassHierarchyElement.class.st | 26 ++++++++++++++++++- .../GtCoderNavigationElement.class.st | 12 +++++---- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationBasicClassHierarchyElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationBasicClassHierarchyElement.class.st index 0293ae999..ae4a0dfc0 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationBasicClassHierarchyElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationBasicClassHierarchyElement.class.st @@ -86,7 +86,31 @@ GtCoderNavigationBasicClassHierarchyElement >> updateClassList [ { #category : #'updating lists' } GtCoderNavigationBasicClassHierarchyElement >> updateClassListsWith: aClass [ - classesList initializeWithHierachyForClass: aClass. + | withRootClasses lastIndex isWithAllSuperclasses | + "Check that all its root classes are in the classesList (and therefore visible)." + lastIndex := nil. + withRootClasses := aClass withAllSuperclasses. + isWithAllSuperclasses := withRootClasses + allSatisfy: [ :eachClass | + | currentIndex newIndex | + currentIndex := lastIndex. + newIndex := nil. + classesList viewModel + indexOfSuchThat: [ :eachTree | eachTree rootClass = eachClass ] + do: [ :eachIndex | newIndex := eachIndex ]. + lastIndex := newIndex. + currentIndex + ifNil: [ newIndex isNotNil ] + ifNotNil: [ newIndex isNotNil and: [ currentIndex > newIndex ] ] ]. + + "If a selected item is the same as the requested class, we keep the existing hierarchy items. + Like this, for example, we do not lose siblings when we drag-and-drop methods arround." + (isWithAllSuperclasses + and: [ classesList selectedItems + anySatisfy: [ :eachClassTree | eachClassTree rootClass = aClass ] ]) + ifTrue: [ ^ self ]. + + classesList initializeWithHierachyForClass: aClass ] { #category : #'updating lists' } diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st index 4feaa0be0..69e1bbe9c 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationElement.class.st @@ -111,11 +111,13 @@ GtCoderNavigationElement >> onClassListSelectionChanged [ { #category : #'event handling' } GtCoderNavigationElement >> onClassModified: anAnnouncement [ - self - suppressListChangeEventsDuring: [ self - updateClass: anAnnouncement theClass - inPackage: anAnnouncement package - tag: anAnnouncement tag ] + BlTaskAction + enqueueElement: self + action: [ self + suppressListChangeEventsDuring: [ self + updateClass: anAnnouncement theClass + inPackage: anAnnouncement package + tag: anAnnouncement tag ] ] ] { #category : #'event handling' } From 3a9b6b1c01b11be4174ccbb09ba25c67660805e2 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 27 May 2025 10:46:21 -0400 Subject: [PATCH 0964/1268] enable method multi-selection in the Class Hierarchy view [feenkcom/gtoolkit#4563] --- .../GtCoderNavigationClassHierarchyElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st index 5ee7bbd8a..24a60ac2c 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationClassHierarchyElement.class.st @@ -21,7 +21,7 @@ GtCoderNavigationClassHierarchyElement >> initialize [ protocolsList := GtCoderProtocolsGroupedListElement new. slotsList := GtCoderSlotsGroupedListElement new. - methodsList := GtCoderMethodsGroupedListElement new. + methodsList := GtCoderMethodsGroupedListElement multiSelection. protocolsSlotsTabGroup := BrTabGroup new aptitude: BrGlamorousTabGroupProportionalAptitude - BrTabGroupSplitterAptitude; From 1ec8bfb286945124c00212422d0ba2ed8a1677af Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 27 May 2025 15:25:59 -0400 Subject: [PATCH 0965/1268] Properly update class list when classes are drag-and-dropped [feenkcom/gtoolkit#4551] - use `RBRefactoryChange>>#gtExecuteWithNotificationWithProgress:threshold:` to repackage classes --- src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st index 4093d8ad1..80ef04052 100644 --- a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st @@ -195,7 +195,7 @@ GtCoderPackagesTreeElement >> newTagFor: aPackage inElement: elem [ { #category : #initialization } GtCoderPackagesTreeElement >> onDropClassesOnPackageOrTag: anItemsDroppedEvent [ - | aPackageOrTag aModel compositeChange someRefactorings | + | aPackageOrTag aModel compositeChange someRefactorings aPromise | aPackageOrTag := anItemsDroppedEvent currentTarget packageOrTag. aModel := RBClassModelFactory rbNamespace onEnvironment: RBPushDownMethodRefactoring new defaultEnvironment. @@ -212,7 +212,10 @@ GtCoderPackagesTreeElement >> onDropClassesOnPackageOrTag: anItemsDroppedEvent [ someRefactorings do: #primitiveExecute. compositeChange := aModel changes. - compositeChange execute + + "We use 1 threshold to keep coders with the same selected package." + aPromise := compositeChange gtExecuteWithNotificationThreshold: 1. + self enqueueTask: (BlPromiseTask new promise: aPromise). ] { #category : #'private - context menu' } From 7a960f40966c2e429b98cac5d4e2356bab1705f9 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Wed, 28 May 2025 23:34:50 +0200 Subject: [PATCH 0966/1268] [feenkcom/gtoolkit#1810] use themable background --- src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st | 2 +- src/GToolkit-Coder-UI/GtFilterToggleGroupAptitude.class.st | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st index 3dedf0d4a..4a5a32c6f 100644 --- a/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st @@ -22,7 +22,7 @@ GtFilterTextSettingsElement >> initializeEditorElement [ hFitContentLimited; vFitContent; beMode: BrTextEditorEditableSingleLineMode new; - background: self theme default contentBackgroundColor; + background: self theme default contentBackground; aptitude: BrGlamorousRegularEditorAptitude new glamorousRegularSmallSize; text: ''; diff --git a/src/GToolkit-Coder-UI/GtFilterToggleGroupAptitude.class.st b/src/GToolkit-Coder-UI/GtFilterToggleGroupAptitude.class.st index 74eb951f2..b3abc92b9 100644 --- a/src/GToolkit-Coder-UI/GtFilterToggleGroupAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtFilterToggleGroupAptitude.class.st @@ -16,5 +16,5 @@ GtFilterToggleGroupAptitude >> initialize [ self addChangeProperty: #(widget background) with: - [ self theme default contentBackgroundColor ]. + [ self theme default contentBackground ]. ] From 5cd5a657603c750c72d642b00d87823392aeda3f Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 29 May 2025 00:33:32 +0200 Subject: [PATCH 0967/1268] [feenkcom/gtoolkit#1810] use navigationBackground --- src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index ec3521aac..b5bc114a6 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -94,7 +94,7 @@ GtCoderNavigationTabsStencil >> create [ views: self navigations; asElementDo: [ :aTabGroup | aTabGroup - background: BrGlamorousColors neutralBackgroundColor; + background: BlTheme default default navigationBackground; matchParent ] ] From 54e8f1bd1b8278aa512f3de5b72cde95ca7c9f12 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 28 May 2025 21:45:24 -0400 Subject: [PATCH 0968/1268] classes can be dropped on package tags [feenkcom/gtoolkit#4551] --- .../GtCoderPackagesTreeElement.class.st | 15 +++++++++++++-- .../GtCoderPackageExtensionTag.class.st | 5 +++++ .../GtCoderPackageUncategorizedTag.class.st | 5 +++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st index 80ef04052..f1225187f 100644 --- a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st @@ -90,7 +90,18 @@ GtCoderPackagesTreeElement >> createPackageOrTagDropHandler [ ^ BlDropHandler new acceptItemsSuchThat: [ :aDragItem :aGtCoderPackagesTreeItemElement | aDragItem domainObject isClassOrTrait - and: [ aGtCoderPackagesTreeItemElement packageOrTag ~= aDragItem domainObject package ] ]; + and: [ (aGtCoderPackagesTreeItemElement packageOrTag + isKindOf: GtCoderPackageExtensionTag) not + and: [ | aPackageOrTag | + aPackageOrTag := aDragItem domainObject package + classTagForClass: aDragItem domainObject. + aPackageOrTag isRoot + ifTrue: [ aPackageOrTag := GtCoderPackageUncategorizedTag forPackageTag: aPackageOrTag ]. + + aPackageOrTag isRoot + ifFalse: [ aGtCoderPackagesTreeItemElement packageOrTag ~= aPackageOrTag ] + ifTrue: [ aGtCoderPackagesTreeItemElement packageOrTag ~= aPackageOrTag + and: [ aPackageOrTag package ~= aGtCoderPackagesTreeItemElement packageOrTag ] ] ] ] ]; whenDroppedDo: [ :anItemsDroppedEvent | self onDropClassesOnPackageOrTag: anItemsDroppedEvent ]; whenDragEnteredDo: [ :anItemsDraggedOverEvent | anItemsDraggedOverEvent mayAcceptItems @@ -208,7 +219,7 @@ GtCoderPackagesTreeElement >> onDropClassesOnPackageOrTag: anItemsDroppedEvent [ GtRBMoveClassToPackageRefactoring model: aModel move: eachClass name - to: aPackageOrTag name ]. + to: aPackageOrTag categoryName ]. someRefactorings do: #primitiveExecute. compositeChange := aModel changes. diff --git a/src/GToolkit-Coder/GtCoderPackageExtensionTag.class.st b/src/GToolkit-Coder/GtCoderPackageExtensionTag.class.st index 1900a7a09..a5ffbe827 100644 --- a/src/GToolkit-Coder/GtCoderPackageExtensionTag.class.st +++ b/src/GToolkit-Coder/GtCoderPackageExtensionTag.class.st @@ -18,6 +18,11 @@ GtCoderPackageExtensionTag >> = anObject [ and: [ package = anObject package ] ] +{ #category : #accessing } +GtCoderPackageExtensionTag >> categoryName [ + ^ self package categoryName +] + { #category : #accessing } GtCoderPackageExtensionTag >> classes [ diff --git a/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st b/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st index ccae87815..abb03f11f 100644 --- a/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st +++ b/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st @@ -18,6 +18,11 @@ GtCoderPackageUncategorizedTag >> = anObject [ (anObject isKindOf: RPackageTag) and: [ self packageTagName = anObject name ] ] ] +{ #category : #accessing } +GtCoderPackageUncategorizedTag >> categoryName [ + ^ packageTag categoryName +] + { #category : #accessing } GtCoderPackageUncategorizedTag >> classes [ ^ self packageTag classes From 0358b6b9745fddd59bb0d44b3f0f5ffd2902de48 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 29 May 2025 11:20:12 +0200 Subject: [PATCH 0969/1268] [feenkcom/gtoolkit#1810] use theme background --- .../GtCoderExpanderWithoutShadowAptitude.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderExpanderWithoutShadowAptitude.class.st b/src/GToolkit-Coder-UI/GtCoderExpanderWithoutShadowAptitude.class.st index 575a7316c..b31b54e58 100644 --- a/src/GToolkit-Coder-UI/GtCoderExpanderWithoutShadowAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExpanderWithoutShadowAptitude.class.st @@ -100,8 +100,8 @@ GtCoderExpanderWithoutShadowAptitude >> initialize [ layout: BlLinearLayout vertical. self add: (BrLazyStyleCommonAptitude new - default: [ :aStyle | - aStyle background: Color white]; + default: [ :aStyle :aTheme | + aStyle background: aTheme default contentBackground ]; collapsed: [ :aStyle | aStyle border: (BlBorder paint: self borderPaint width: self borderWidth) ]; expanded: [ :aStyle | From 482a454fd2b57b6051b838a7985d3f4bc56e41b0 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 29 May 2025 18:11:43 +0200 Subject: [PATCH 0970/1268] [feenkcom/gtoolkit#1810] coder header should use text foreground from a theme --- .../GtBehaviorCoderDummyClass.class.st | 5 +++++ .../TGtBehaviorCoderDummyTrait.trait.st | 8 ++++++++ .../GtSourceCoderCollapsedContentElement.class.st | 1 + 3 files changed, 14 insertions(+) diff --git a/src/GToolkit-Coder-Examples/GtBehaviorCoderDummyClass.class.st b/src/GToolkit-Coder-Examples/GtBehaviorCoderDummyClass.class.st index ca12acc6e..f8f660d19 100644 --- a/src/GToolkit-Coder-Examples/GtBehaviorCoderDummyClass.class.st +++ b/src/GToolkit-Coder-Examples/GtBehaviorCoderDummyClass.class.st @@ -73,3 +73,8 @@ GtBehaviorCoderDummyClass >> instVarC: anObject [ GtBehaviorCoderDummyClass >> newMethod [ ^ 4 ] + +{ #category : #'tests - some' } +GtBehaviorCoderDummyClass >> overwrittenMethodFromTrait [ + "overwritten" +] diff --git a/src/GToolkit-Coder-Examples/TGtBehaviorCoderDummyTrait.trait.st b/src/GToolkit-Coder-Examples/TGtBehaviorCoderDummyTrait.trait.st index 7bd4e3531..0f1106a92 100644 --- a/src/GToolkit-Coder-Examples/TGtBehaviorCoderDummyTrait.trait.st +++ b/src/GToolkit-Coder-Examples/TGtBehaviorCoderDummyTrait.trait.st @@ -7,3 +7,11 @@ Trait { ], #category : #'GToolkit-Coder-Examples-Dummies' } + +{ #category : #'tests - some' } +TGtBehaviorCoderDummyTrait >> methodFromTrait [ +] + +{ #category : #'tests - some' } +TGtBehaviorCoderDummyTrait >> overwrittenMethodFromTrait [ +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st index 971b3d2e8..22377ab27 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st @@ -64,6 +64,7 @@ GtSourceCoderCollapsedContentElement >> newLabel [ editorMeasurement; bold; glamorousCodeFont; + foreground: self theme label defaultTextForeground; withAsyncPromiseDo: [ :anElementPromise | anElementPromise whenSuccess: [ :aLabel :aText | aLabel text: aText asRopedText ]; From fffbf45aaed191cb164f7bc05a1d6cca3064445d Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Fri, 30 May 2025 00:42:12 +0200 Subject: [PATCH 0971/1268] [feenkcom/gtoolkit#1810] add NavigationTreeLabel aptitude --- .../GtCoderClassesTreeItemElement.class.st | 2 +- .../GtCoderMethodsGroupedListElement.class.st | 2 +- .../GtCoderNavigationTreeLabelAptitude.class.st | 12 ++++++++++++ .../GtCoderPackagesTreeItemElement.class.st | 2 +- .../GtCoderProtocolsGroupedListElement.class.st | 2 +- .../GtCoderSlotsGroupedListElement.class.st | 2 +- 6 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderNavigationTreeLabelAptitude.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeItemElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeItemElement.class.st index ecb9dcff5..5f9128af5 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeItemElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeItemElement.class.st @@ -52,7 +52,7 @@ GtCoderClassesTreeItemElement >> createClassNameLabel [ hMatchParent; vFitContent; beSmallSize; - aptitude: BrGlamorousLabelAptitude + aptitude: GtCoderNavigationTreeLabelAptitude ] { #category : #initialization } diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index 6e0d6a325..2642ce513 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -91,7 +91,7 @@ GtCoderMethodsGroupedListElement >> buildMethodItem [ hMatchParent; vFitContent; beSmallSize; - aptitude: BrGlamorousLabelAptitude + BrGlamorousListItemAptitude + aptitude: GtCoderNavigationTreeLabelAptitude + BrGlamorousListItemAptitude + (BrGlamorousWithExplicitContextMenuAptitude new withGainFocusOnShow; handleSubmenu: [ | someItems currentMethod | diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTreeLabelAptitude.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTreeLabelAptitude.class.st new file mode 100644 index 000000000..10d4c3783 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTreeLabelAptitude.class.st @@ -0,0 +1,12 @@ +Class { + #name : #GtCoderNavigationTreeLabelAptitude, + #superclass : #BrGlamorousLabelAptitude, + #category : #'GToolkit-Coder-UI-Looks' +} + +{ #category : #initialization } +GtCoderNavigationTreeLabelAptitude >> initialize [ + super initialize. + + self foreground: self theme label navigationTextForeground +] diff --git a/src/GToolkit-Coder-UI/GtCoderPackagesTreeItemElement.class.st b/src/GToolkit-Coder-UI/GtCoderPackagesTreeItemElement.class.st index 6d5d7dbcf..a2c9def32 100644 --- a/src/GToolkit-Coder-UI/GtCoderPackagesTreeItemElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPackagesTreeItemElement.class.st @@ -16,7 +16,7 @@ GtCoderPackagesTreeItemElement >> initialize [ matchParent; text: ''; beSmallSize; - aptitude: (BrGlamorousLabelAptitude new padding: (BlInsets + aptitude: (GtCoderNavigationTreeLabelAptitude new padding: (BlInsets top: 2 bottom: 2 left: 1 diff --git a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st index 7f23af5b7..0981c0bfb 100644 --- a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st @@ -126,7 +126,7 @@ GtCoderProtocolsGroupedListElement >> createProtocolLabelElement [ | aLabel aLabelAptitude | aLabel := BrLabel new. - aLabelAptitude := BrGlamorousLabelAptitude new + aLabelAptitude := GtCoderNavigationTreeLabelAptitude new padding: (BlInsets top: 2 bottom: 2 diff --git a/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st index 6c233bdaa..05dfba3c5 100644 --- a/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st @@ -114,7 +114,7 @@ GtCoderSlotsGroupedListElement >> createSlotGroups [ hMatchParent; vFitContent; beSmallSize; - aptitude: BrGlamorousLabelAptitude. + aptitude: GtCoderNavigationTreeLabelAptitude. slotText := self computeSlotItemText: item. From f98aefe7e52b257577241cd74a0f8b4a9bd5a68b Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Mon, 2 Jun 2025 18:27:17 +0200 Subject: [PATCH 0972/1268] Allow the coder actions element to be passed in the custom action --- src/GToolkit-Coder-UI/GtCoderCustomAction.extension.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderCustomAction.extension.st b/src/GToolkit-Coder-UI/GtCoderCustomAction.extension.st index 78847f42b..4afd7a2e8 100644 --- a/src/GToolkit-Coder-UI/GtCoderCustomAction.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderCustomAction.extension.st @@ -3,7 +3,7 @@ Extension { #name : #GtCoderCustomAction } { #category : #'*GToolkit-Coder-UI' } GtCoderCustomAction >> buildElementIn: aCoderActionsElement [ | anElement | - anElement := stencil asStencil asElement. + anElement := (stencil cull: aCoderActionsElement) asElement. aCoderActionsElement initializeAltClick: self element: anElement. From 906b7bc3f63b5b47ccc76861063aa5165b21bb11 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 4 Jun 2025 13:05:40 -0400 Subject: [PATCH 0973/1268] select all classes on `GtCoderNavigationBasicPackagesTagsClassesElement>>#onClassSelected:` [feenkcom/gtoolkit#4577] --- .../GtCoderNavigationBasicPackagesTagsClassesElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationBasicPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationBasicPackagesTagsClassesElement.class.st index eeebfeb27..9ed3f1f90 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationBasicPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationBasicPackagesTagsClassesElement.class.st @@ -129,7 +129,7 @@ GtCoderNavigationBasicPackagesTagsClassesElement >> onClassRemoved: anAnnounceme { #category : #'event handling - selection' } GtCoderNavigationBasicPackagesTagsClassesElement >> onClassSelected: anAnnouncement [ self - suppressListChangeEventsDuring: [ self selectClass: anAnnouncement theClass ] + suppressListChangeEventsDuring: [ self selectClasses: anAnnouncement selectedClasses ] ] { #category : #'event handling' } From 5c6166c9a2d18703a0094ef7427b6bc6efca5b21 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Fri, 6 Jun 2025 09:52:10 +0200 Subject: [PATCH 0974/1268] Revert injectin coder actions element into custom action stencil --- src/GToolkit-Coder-UI/GtCoderCustomAction.extension.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderCustomAction.extension.st b/src/GToolkit-Coder-UI/GtCoderCustomAction.extension.st index 4afd7a2e8..78847f42b 100644 --- a/src/GToolkit-Coder-UI/GtCoderCustomAction.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderCustomAction.extension.st @@ -3,7 +3,7 @@ Extension { #name : #GtCoderCustomAction } { #category : #'*GToolkit-Coder-UI' } GtCoderCustomAction >> buildElementIn: aCoderActionsElement [ | anElement | - anElement := (stencil cull: aCoderActionsElement) asElement. + anElement := stencil asStencil asElement. aCoderActionsElement initializeAltClick: self element: anElement. From 3f59f8f5f12619c3e99c8ccd7a4a373df69a8239 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Sun, 8 Jun 2025 22:38:43 +0200 Subject: [PATCH 0975/1268] [feenkcom/gtoolkit#1810] don't use background color for border. hardcode instead for now --- src/GToolkit-Coder-UI/GtFilterToggleBackgroundAptitude.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtFilterToggleBackgroundAptitude.class.st b/src/GToolkit-Coder-UI/GtFilterToggleBackgroundAptitude.class.st index a2356f18f..32bbd2f48 100644 --- a/src/GToolkit-Coder-UI/GtFilterToggleBackgroundAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtFilterToggleBackgroundAptitude.class.st @@ -11,5 +11,5 @@ GtFilterToggleBackgroundAptitude >> initialize [ activated: [ :aStyle | aStyle background: self theme button defaultBorderColor lighter. aStyle - border: (BlBorder paint: self theme button defaultBackgroundColor width: 1) ] + border: (BlBorder paint: Color white width: 1) ] ] From 9f89c2bdfd2050674c0c60e9c5b8acef85d76f2a Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 10 Jun 2025 10:25:15 -0500 Subject: [PATCH 0976/1268] [feenkcom/gtoolkit#4585] focus editor after undeclared variable fix --- .../GtSourceCoderErrorFixItAttribute.class.st | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderErrorFixItAttribute.class.st b/src/GToolkit-Coder-UI/GtSourceCoderErrorFixItAttribute.class.st index cdba867a2..0bc3f7828 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderErrorFixItAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderErrorFixItAttribute.class.st @@ -25,10 +25,7 @@ GtSourceCoderErrorFixItAttribute >> buildPopupIn: anEditorElement aptitude: apti aShortcutEvent currentTarget fireEvent: BrDropdownHideWish new. anEditorElement requestFocus ]) ]. element - enqueueTask: [ (element - allChildrenBreadthFirstDetect: [ :each | each isKindOf: GtCoderContextMenuContent ] - ifFound: [ :each | each ] - ifNone: [ element ]) requestFocus ] asBlTask. + enqueueTask: [ element dispatchEvent: BrPopoverGainFocusWish new ] asBlTask. ^ element ] From 6a2b03fd47d3523ca4179477efc2b2fefd4b4e8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Tue, 10 Jun 2025 22:22:39 +0200 Subject: [PATCH 0977/1268] Use Package>>tags instead of Package>>classTags [feenkcom/gtoolkit#3736] --- .../GtCoderUncategorizedDummyClass.class.st | 2 +- ...rNavigationBasicPackagesTagsClassesElement.class.st | 2 +- .../GtCoderPackagesTreeElement.class.st | 2 +- src/GToolkit-Coder/RPackage.extension.st | 10 ++++++++++ 4 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 src/GToolkit-Coder/RPackage.extension.st diff --git a/src/GToolkit-Coder-Examples/GtCoderUncategorizedDummyClass.class.st b/src/GToolkit-Coder-Examples/GtCoderUncategorizedDummyClass.class.st index 2b51e2f97..6f4830c9d 100644 --- a/src/GToolkit-Coder-Examples/GtCoderUncategorizedDummyClass.class.st +++ b/src/GToolkit-Coder-Examples/GtCoderUncategorizedDummyClass.class.st @@ -15,7 +15,7 @@ GtCoderUncategorizedDummyClass >> checkUncategorized [ | aPackage aPackageTag | aPackage := self class package. - aPackageTag := aPackage classTags + aPackageTag := aPackage tags detect: [ :eachTag | eachTag name = aPackage name ]. self assert: aPackage name equals: aPackageTag name. diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationBasicPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationBasicPackagesTagsClassesElement.class.st index 9ed3f1f90..e2adfae67 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationBasicPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationBasicPackagesTagsClassesElement.class.st @@ -49,7 +49,7 @@ GtCoderNavigationBasicPackagesTagsClassesElement >> expandPackage: aRPackage [ GtCoderNavigationBasicPackagesTagsClassesElement >> hasPackageTagsIn: aRPackage [ | noTags noExtensions | - noTags := (aRPackage classTags size = 1 and: [ aRPackage classTags anyOne name = aRPackage name ]). + noTags := (aRPackage tags size = 1 and: [ aRPackage tags anyOne name = aRPackage name ]). noExtensions := aRPackage extendedClasses isEmpty. ^ noTags not or: [ noExtensions not ] ] diff --git a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st index f1225187f..25ae68857 100644 --- a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st @@ -42,7 +42,7 @@ GtCoderPackagesTreeElement >> buildRemoveTagLabelFor: aTag [ GtCoderPackagesTreeElement >> childrenForPackageOrTag: aPackageOrTag [ | theTags anExtension | (aPackageOrTag isKindOf: RPackage) ifFalse: [ ^ #() ]. - theTags := aPackageOrTag classTags asOrderedCollection. + theTags := aPackageOrTag tags asOrderedCollection. theTags withIndexDo: [ :eachTag :eachIndex | eachTag name = aPackageOrTag name ifTrue: [ theTags at: eachIndex put: (GtCoderPackageUncategorizedTag forPackageTag: eachTag) ] ]. theTags sort: [ :tagA :tagB | self isTag: tagA lessThan: tagB ]. diff --git a/src/GToolkit-Coder/RPackage.extension.st b/src/GToolkit-Coder/RPackage.extension.st new file mode 100644 index 000000000..bd9425806 --- /dev/null +++ b/src/GToolkit-Coder/RPackage.extension.st @@ -0,0 +1,10 @@ +Extension { #name : #RPackage } + +{ #category : #'*GToolkit-Coder' } +RPackage >> tags [ + + + ^ self + forPharo12: [ tags] + forPharo11AndPharo10: [ self classTags ] +] From 8ed4ae822877db0e0fdb9678e59ad8ee41d7a4b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Wed, 11 Jun 2025 10:11:43 +0200 Subject: [PATCH 0978/1268] Use GtCodeDefinition>>#when:do:for: [feenkcom/gtoolkit#3736] --- src/GToolkit-Coder-UI/GtCodeDefinitionSingleEditor.class.st | 5 +++-- src/GToolkit-Coder-UI/GtCodeDefinitionSingleReader.class.st | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionSingleEditor.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionSingleEditor.class.st index f12dc74db..15da55291 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionSingleEditor.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionSingleEditor.class.st @@ -4,7 +4,7 @@ Class { #instVars : [ 'setSelector' ], - #category : 'GToolkit-Coder-UI-Behaviour - Editor / Reader' + #category : #'GToolkit-Coder-UI-Behaviour - Editor / Reader' } { #category : #private } @@ -75,7 +75,8 @@ GtCodeDefinitionSingleEditor >> create [ when: renameAnnouncement do: [ :anEvent | (anOwner isNil or: [ anEvent owner = anOwner ]) - ifTrue: [ anEditableLabel text: anEvent newName ] ] ]. + ifTrue: [ anEditableLabel text: anEvent newName ] ] + for: self ]. ^ anEditableLabel ] diff --git a/src/GToolkit-Coder-UI/GtCodeDefinitionSingleReader.class.st b/src/GToolkit-Coder-UI/GtCodeDefinitionSingleReader.class.st index 6886cb918..a1c76ead2 100644 --- a/src/GToolkit-Coder-UI/GtCodeDefinitionSingleReader.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDefinitionSingleReader.class.st @@ -41,7 +41,8 @@ GtCodeDefinitionSingleReader >> create [ when: renameAnnouncement do: [ :anEvent | (anOwner isNil or: [ anEvent owner = anOwner ]) - ifTrue: [ aLabel text: anEvent newName ] ] ]. + ifTrue: [ aLabel text: anEvent newName ] ] + for: self ]. ^ aLabel ] From c95eee40df59339290b72141481a526bde551326 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Wed, 11 Jun 2025 10:12:00 +0200 Subject: [PATCH 0979/1268] Fix method protocol [feenkcom/gtoolkit#3736] --- src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st | 2 +- .../GtTextualCoderViewModel.extension.st | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) delete mode 100644 src/GToolkit-Coder-UI/GtTextualCoderViewModel.extension.st diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 0809f9229..c1706fa2c 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -155,7 +155,7 @@ GtTextualCoderViewModel >> asEditorState [ ^ aMemento ] -{ #category : #'*GToolkit-Coder-UI' } +{ #category : #converting } GtTextualCoderViewModel >> asExpandedOnlyElement [ "Create an element for just the expanded coder without expander" diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.extension.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.extension.st deleted file mode 100644 index d4ee61468..000000000 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.extension.st +++ /dev/null @@ -1,10 +0,0 @@ -Extension { #name : #GtTextualCoderViewModel } - -{ #category : #'*GToolkit-Coder-UI' } -GtTextualCoderViewModel >> asExpandedOnlyElement [ - "Create an element for just the expanded coder without expander" - - ^ GtExpandedOnlyCoderElement new - coderViewModel: self asCoderViewModel; - yourself -] From 4ed295673e8ec816fe120c92871eaed2b4c8b379 Mon Sep 17 00:00:00 2001 From: John Brant Date: Wed, 11 Jun 2025 08:11:44 -0500 Subject: [PATCH 0980/1268] [feenkcom/gtoolkit#4586] hierarchy senders/implementers in index should include class side --- .../GtCoderMethodsGroupedListElement.class.st | 32 ++++++++----------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index 2642ce513..46c311c9f 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -12,16 +12,12 @@ Class { { #category : #'private - actions' } GtCoderMethodsGroupedListElement >> browseHierarchyImplementorsOf: aSymbol [ - self phlow - spawnObject: (GtSearchMethodsInClassFilter forClass: self selectedClass) withSuperclasses - withSubclasses & aSymbol gtImplementors + self phlow spawnObject: aSymbol gtImplementors & self hierarchyFilter ] { #category : #'private - actions' } GtCoderMethodsGroupedListElement >> browseHierarchyReferencesOf: aSymbol [ - self phlow - spawnObject: (GtSearchMethodsInClassFilter forClass: self selectedClass) withSuperclasses - withSubclasses & aSymbol gtSenders + self phlow spawnObject: aSymbol gtSenders & self hierarchyFilter ] { #category : #'private - actions' } @@ -38,12 +34,8 @@ GtCoderMethodsGroupedListElement >> browseReferencesOf: aSymbol [ GtCoderMethodsGroupedListElement >> browseSeveralHierarchyImplementorsOf: aCollectionOfSymbols [ | aFilter | aFilter := aCollectionOfSymbols allButFirst - inject: (GtSearchMethodsInClassFilter forClass: self selectedClass) withSuperclasses - withSubclasses & aCollectionOfSymbols first gtImplementors - into: [ :filter :symbol | - filter - | ((GtSearchMethodsInClassFilter forClass: self selectedClass) withSuperclasses - withSubclasses & symbol gtImplementors) ]. + inject: aCollectionOfSymbols first gtImplementors & self hierarchyFilter + into: [ :filter :symbol | filter | (symbol gtImplementors & self hierarchyFilter) ]. self phlow spawnObject: aFilter ] @@ -52,12 +44,8 @@ GtCoderMethodsGroupedListElement >> browseSeveralHierarchyImplementorsOf: aColle GtCoderMethodsGroupedListElement >> browseSeveralHierarchyReferencesOf: aCollectionOfSymbols [ | aFilter | aFilter := aCollectionOfSymbols allButFirst - inject: (GtSearchMethodsInClassFilter forClass: self selectedClass) withSuperclasses - withSubclasses & aCollectionOfSymbols first gtSenders - into: [ :filter :symbol | - filter - | ((GtSearchMethodsInClassFilter forClass: self selectedClass) withSuperclasses - withSubclasses & symbol gtSenders) ]. + inject: aCollectionOfSymbols first gtSenders & self hierarchyFilter + into: [ :filter :symbol | filter | (symbol gtSenders & self hierarchyFilter) ]. self phlow spawnObject: aFilter ] @@ -114,7 +102,7 @@ GtCoderMethodsGroupedListElement >> contextMenuForOneItem: item in: anElement [ addItemLabel: (self createLabel: 'Browse implementors' description: item selector) action: [ self browseImplementorsOf: item selector ]. menu - addItemLabel: (self createLabel: 'Browse hierarachy implementors' description: item selector) + addItemLabel: (self createLabel: 'Browse hierarchy implementors' description: item selector) action: [ self browseHierarchyImplementorsOf: item selector ]. menu addItemLabel: (self createLabel: 'Browse references' description: item selector) @@ -264,6 +252,12 @@ GtCoderMethodsGroupedListElement >> createSeveralDraggedMethodsItem: aCollection text: ('{1} methods' format: {aCollection size}) ] +{ #category : #'private - actions' } +GtCoderMethodsGroupedListElement >> hierarchyFilter [ + ^ (GtSearchInheritedMethodsFilter forClass: self selectedClass) withSuperclasses + withSubclasses +] + { #category : #initialization } GtCoderMethodsGroupedListElement >> initialize [ super initialize. From eb0d4e8bea04950bfc65ea43b01c5f5369604c6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Thu, 12 Jun 2025 14:15:33 +0200 Subject: [PATCH 0981/1268] Use #messageText for dispaying errors in coder [feenkcom/gtoolkit#3736] --- src/GToolkit-Coder/GtSourceCoder.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder/GtSourceCoder.class.st b/src/GToolkit-Coder/GtSourceCoder.class.st index fdbf71935..3dc14f8a3 100644 --- a/src/GToolkit-Coder/GtSourceCoder.class.st +++ b/src/GToolkit-Coder/GtSourceCoder.class.st @@ -376,7 +376,7 @@ GtSourceCoder >> notifyParseError: aSemanticWarning requesterObject: aRequester announce: (GtCoderParseError new coder: self; exception: aSemanticWarning; - errorMessage: aSemanticWarning errorMessage; + errorMessage: aSemanticWarning messageText; location: aSemanticWarning location; requesterObject: aRequester) ] From 2eacf9f89f9b6737f138e2d9075c6246f64708b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Tue, 17 Jun 2025 17:01:48 +0200 Subject: [PATCH 0982/1268] Use `Smalltalk createRbNamespace` [feenkcom/gtoolkit#3736] --- .../GtCoderMethodsGroupedListElement.class.st | 4 ++-- src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index 46c311c9f..e3159319b 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -354,7 +354,7 @@ GtCoderMethodsGroupedListElement >> pushDownSeveralMethodsSubmenuFor: aCollectio stencil: [ GtRefactoringsWithInputPreviewElement elementForRefactoring: [ | aGroupByClass aModel aCollectionOfRefactorings | aGroupByClass := aCollectionOfMethods groupedBy: #methodClass. - aModel := RBClassModelFactory rbNamespace + aModel := Smalltalk createRbNamespace onEnvironment: RBPushDownMethodRefactoring new defaultEnvironment. aCollectionOfRefactorings := aGroupByClass collect: [ :someMethods | @@ -394,7 +394,7 @@ GtCoderMethodsGroupedListElement >> pushUpSeveralMethodsSubmenuFor: aCollectionO stencil: [ GtRefactoringsWithInputPreviewElement elementForRefactoring: [ | aGroupByClass aModel aCollectionOfRefactorings | aGroupByClass := aCollectionOfMethods groupedBy: #methodClass. - aModel := RBClassModelFactory rbNamespace + aModel := Smalltalk createRbNamespace onEnvironment: RBPullUpMethodRefactoring new defaultEnvironment. aCollectionOfRefactorings := aGroupByClass collect: [ :someMethods | diff --git a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st index 25ae68857..e104f3187 100644 --- a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st @@ -208,7 +208,7 @@ GtCoderPackagesTreeElement >> newTagFor: aPackage inElement: elem [ GtCoderPackagesTreeElement >> onDropClassesOnPackageOrTag: anItemsDroppedEvent [ | aPackageOrTag aModel compositeChange someRefactorings aPromise | aPackageOrTag := anItemsDroppedEvent currentTarget packageOrTag. - aModel := RBClassModelFactory rbNamespace + aModel := Smalltalk createRbNamespace onEnvironment: RBPushDownMethodRefactoring new defaultEnvironment. someRefactorings := anItemsDroppedEvent items From e7e2b3fb4e2c8b9d3b401eac304f7ce4c69d56f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Wed, 18 Jun 2025 16:08:36 +0200 Subject: [PATCH 0983/1268] Use Object>>#packageOrganizer [feenkcom/gtoolkit#3736] --- .../GtCoderClassWithPackageCompletionStrategy.class.st | 4 ++-- .../GtMethodProtocolCompletionStrategy.class.st | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/GToolkit-Coder/GtCoderClassWithPackageCompletionStrategy.class.st b/src/GToolkit-Coder/GtCoderClassWithPackageCompletionStrategy.class.st index c3ea38699..83af64e0d 100644 --- a/src/GToolkit-Coder/GtCoderClassWithPackageCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtCoderClassWithPackageCompletionStrategy.class.st @@ -17,7 +17,7 @@ GtCoderClassWithPackageCompletionStrategy >> allClasses [ { #category : #accessing } GtCoderClassWithPackageCompletionStrategy >> allPackages [ ^ allPackages ifNil: [ - allPackages := GtPrefixTree withAll: RPackage organizer packageNames ] + allPackages := GtPrefixTree withAll: self packageOrganizer packageNames ] ] { #category : #accessing } @@ -35,7 +35,7 @@ GtCoderClassWithPackageCompletionStrategy >> completionActionStreamFor: aText at [ | extractedPackageName partialClassName package | extractedPackageName := currentInput copyFrom: 1 to: delimitedIndex - 1. partialClassName := currentInput copyFrom: delimitedIndex + 1 to: currentInput size. - package := RPackage organizer packageNamed: extractedPackageName ifAbsent: [ ^ #() ]. + package := self packageOrganizer packageNamed: extractedPackageName ifAbsent: [ ^ #() ]. ^ ((self classesIn: package) asyncStreamStartingWith: partialClassName) collect: [ :className | diff --git a/src/GToolkit-Coder/GtMethodProtocolCompletionStrategy.class.st b/src/GToolkit-Coder/GtMethodProtocolCompletionStrategy.class.st index 963317495..ce3720aae 100644 --- a/src/GToolkit-Coder/GtMethodProtocolCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtMethodProtocolCompletionStrategy.class.st @@ -1,7 +1,7 @@ Class { #name : #GtMethodProtocolCompletionStrategy, #superclass : #GtStringsCompletionStrategy, - #category : 'GToolkit-Coder-Completion' + #category : #'GToolkit-Coder-Completion' } { #category : #private } @@ -10,7 +10,7 @@ GtMethodProtocolCompletionStrategy >> buildCompletions [ protocols := GtPrefixTree new. Smalltalk globals allBehaviorsDo: [ :cls | protocols addAll: cls organization categories ]. - RPackage organizer packages + self packageOrganizer packages do: [ :each | protocols add: '*' , each name ]. ^ protocols ] From 5829b3584a896f8fac4f0812686a53bc0815b02a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Wed, 18 Jun 2025 16:41:47 +0200 Subject: [PATCH 0984/1268] Pass on refactorings for Pharo 12 [feenkcom/gtoolkit#3736] --- .../GtCoderMethodsGroupedListElement.class.st | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index e3159319b..483fa624c 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -339,11 +339,14 @@ GtCoderMethodsGroupedListElement >> pushDownMethodSubmenuFor: aMethod [ stencil: [ GtRefactoringsWithInputPreviewElement elementForRefactoring: [ RBPushDownMethodRefactoring pushDown: {aMethod selector} - from: aMethod methodClass ] + from: (self + forPharo12: [ aMethod methodClass name ] + forPharo11AndPharo10: [ aMethod methodClass ]) ] confirmationLabeled: 'Push down ' , aMethod selector from: self beforeApplyingDo: [ submenu hideAll ] ]. ^ submenu + ] { #category : #'private - context menu' } @@ -361,7 +364,10 @@ GtCoderMethodsGroupedListElement >> pushDownSeveralMethodsSubmenuFor: aCollectio RBPushDownMethodRefactoring new model: aModel; pushDown: (someMethods collect: #selector) - from: someMethods anyOne methodClass ] as: Array. + from: (self + forPharo12: [ someMethods anyOne methodClass name ] + forPharo11AndPharo10: [ someMethods anyOne methodClass ]) ] + as: Array. aModel name: ('Push down {1} methods' format: {aCollectionOfMethods size}). aCollectionOfRefactorings ] confirmationLabeled: ('Push down {1} methods' From 49b330caa38ba6522f7c13de8f3c83363b635dc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Thu, 19 Jun 2025 15:10:26 +0200 Subject: [PATCH 0985/1268] Use RPackageTag>>#isRoor to determine if we have a single tag [feenkcom/gtoolkit#3736] --- .../GtCoderPackagesTreeElement.class.st | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st index e104f3187..756c4af58 100644 --- a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st @@ -42,15 +42,20 @@ GtCoderPackagesTreeElement >> buildRemoveTagLabelFor: aTag [ GtCoderPackagesTreeElement >> childrenForPackageOrTag: aPackageOrTag [ | theTags anExtension | (aPackageOrTag isKindOf: RPackage) ifFalse: [ ^ #() ]. + theTags := aPackageOrTag tags asOrderedCollection. - theTags withIndexDo: [ :eachTag :eachIndex | eachTag name = aPackageOrTag name ifTrue: [ - theTags at: eachIndex put: (GtCoderPackageUncategorizedTag forPackageTag: eachTag) ] ]. + theTags withIndexDo: [ :eachTag :eachIndex | + eachTag isRoot ifTrue: [ + theTags + at: eachIndex + put: (GtCoderPackageUncategorizedTag forPackageTag: eachTag) ] ]. theTags sort: [ :tagA :tagB | self isTag: tagA lessThan: tagB ]. anExtension := GtCoderPackageExtensionTag forPackage: aPackageOrTag. anExtension hasExtendedClasses ifTrue: [ theTags addLast: anExtension ]. - "Do not return an only tag of the same name as the package" + + "Do not return an only root tag that contains all classes" (theTags size = 1 and: [ theTags anyOne class = GtCoderPackageUncategorizedTag ]) ifTrue: [ ^ #() ]. From 8c066d59756de189f46d5d565144b7e9b4f1eaab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Thu, 19 Jun 2025 15:13:31 +0200 Subject: [PATCH 0986/1268] Use #classTags instead of #tags [feenkcom/gtoolkit#3736] --- src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st b/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st index c26ea5db2..5eff61ad2 100644 --- a/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st @@ -20,7 +20,7 @@ GtPackagesCompletionStrategy class >> findPackageTagsMatching: aString [ searchString := '*' , aString , '*'. results := OrderedCollection new. self allPackagesDo: [ :each | - each classTags + each tags do: [ :tag | (searchString match: tag categoryName) ifTrue: [ results add: tag ] ] ]. From ad2fce44c40940dd97b1e7eb38c8d35478329df7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Fri, 20 Jun 2025 14:36:44 +0200 Subject: [PATCH 0987/1268] Do not use #classTagForClass: [feenkcom/gtoolkit#3736] --- src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st index 756c4af58..573918223 100644 --- a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st @@ -99,7 +99,7 @@ GtCoderPackagesTreeElement >> createPackageOrTagDropHandler [ isKindOf: GtCoderPackageExtensionTag) not and: [ | aPackageOrTag | aPackageOrTag := aDragItem domainObject package - classTagForClass: aDragItem domainObject. + tagOf: aDragItem domainObject. aPackageOrTag isRoot ifTrue: [ aPackageOrTag := GtCoderPackageUncategorizedTag forPackageTag: aPackageOrTag ]. From ff7e7d7bf7648938909f446b7b50d76106757b38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Fri, 20 Jun 2025 17:14:21 +0200 Subject: [PATCH 0988/1268] Use #tagNamed: [feenkcom/gtoolkit#3736] --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index 16ac035ba..ad8f56cbb 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -47,7 +47,7 @@ GtCreationForm >> commitPackage [ packageNamed: packageAndTagName packageName. ^ packageAndTagName tagName ifEmpty: [ aPackage ] - ifNotEmpty: [ :aTagName | aPackage classTagNamed: aTagName ifAbsent: [ aPackage addClassTag: aTagName ] ] ] + ifNotEmpty: [ :aTagName | aPackage tagNamed: aTagName ifAbsent: [ aPackage addClassTag: aTagName ] ] ] ifFalse: [ aPackage := (RPackage named: packageAndTagName packageName) register. ^ packageAndTagName tagName From 2f6fd81bd3a0e6d6711a1b4345df66e084b25937 Mon Sep 17 00:00:00 2001 From: John Brant Date: Mon, 23 Jun 2025 08:49:51 -0500 Subject: [PATCH 0989/1268] [feenkcom/gtoolkit#3736] refactoring changes for P12 --- src/GToolkit-Coder/RBCondition.extension.st | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/GToolkit-Coder/RBCondition.extension.st b/src/GToolkit-Coder/RBCondition.extension.st index 4a4297077..93659a053 100644 --- a/src/GToolkit-Coder/RBCondition.extension.st +++ b/src/GToolkit-Coder/RBCondition.extension.st @@ -3,7 +3,6 @@ Extension { #name : #RBCondition } { #category : #'*GToolkit-Coder' } RBCondition class >> includesPoolDictionary: aString in: aClass [ ^ self new - type: (Array with: #includesPool with: aString with: aClass) block: [ aClass sharedPoolNames includes: aString asSymbol ] errorString: aString , ' is <1?:not >included in ' , aClass name ] @@ -11,7 +10,6 @@ RBCondition class >> includesPoolDictionary: aString in: aClass [ { #category : #'*GToolkit-Coder' } RBCondition class >> isPoolDictionary: aString in: aRBSmalltalk [ ^ self new - type: (Array with: #isPoolDictionary with: aString) block: [ (aRBSmalltalk includesGlobal: aString asSymbol) and: [ Smalltalk globals at: aString asSymbol From dd54eb7a347db7a994f0b964f8cabb579680cd80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Wed, 25 Jun 2025 23:01:25 +0200 Subject: [PATCH 0990/1268] Use Announcer>>#when:do:for: [feenkcom/gtoolkit#3736] --- .../GtStreamingCodersViewModel.class.st | 5 ++--- .../GtStreamingCodersModel.class.st | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModel.class.st b/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModel.class.st index 4daee79a2..ee36fd875 100644 --- a/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModel.class.st +++ b/src/GToolkit-Coder-StreamingCoders-UI/GtStreamingCodersViewModel.class.st @@ -169,9 +169,8 @@ GtStreamingCodersViewModel >> when: anAnnouncementClass do: aBlock [ { #category : #'api - announcer' } GtStreamingCodersViewModel >> when: anAnnouncementClass do: aBlock for: aSubscriber [ >#whenDoForTemplate'> - ^ (self when: anAnnouncementClass do: aBlock) - subscriber: aSubscriber; - yourself + ^ (announcer ifNil: [ announcer := Announcer new ]) + when: anAnnouncementClass do: aBlock for: aSubscriber ] { #category : #'api - announcer' } diff --git a/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersModel.class.st b/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersModel.class.st index 7513b9a83..20914f28b 100644 --- a/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersModel.class.st +++ b/src/GToolkit-Coder-StreamingCoders/GtStreamingCodersModel.class.st @@ -174,9 +174,8 @@ GtStreamingCodersModel >> when: anAnnouncementClass do: aBlock [ { #category : #'api - announcer' } GtStreamingCodersModel >> when: anAnnouncementClass do: aBlock for: aSubscriber [ >#whenDoForTemplate'> - ^ (self when: anAnnouncementClass do: aBlock) - subscriber: aSubscriber; - yourself + ^ (announcer ifNil: [ announcer := Announcer new ]) + when: anAnnouncementClass do: aBlock for: aSubscriber ] { #category : #'api - announcer' } From a01c377fcb50c7d192a262a66d2aa53e95a14dc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Wed, 25 Jun 2025 23:10:08 +0200 Subject: [PATCH 0991/1268] Update assertions in GtCoderUncategorizedDummyClass>>#checkUncategorized for Pharo 12 [feenkcom/gtoolkit#3736] --- .../GtCoderUncategorizedDummyClass.class.st | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-Examples/GtCoderUncategorizedDummyClass.class.st b/src/GToolkit-Coder-Examples/GtCoderUncategorizedDummyClass.class.st index 6f4830c9d..ab2208e8c 100644 --- a/src/GToolkit-Coder-Examples/GtCoderUncategorizedDummyClass.class.st +++ b/src/GToolkit-Coder-Examples/GtCoderUncategorizedDummyClass.class.st @@ -16,9 +16,15 @@ GtCoderUncategorizedDummyClass >> checkUncategorized [ | aPackage aPackageTag | aPackage := self class package. aPackageTag := aPackage tags - detect: [ :eachTag | eachTag name = aPackage name ]. + detect: [ :eachTag | eachTag isRoot ]. - self assert: aPackage name equals: aPackageTag name. + self assert: aPackageTag isRoot. + self assert: aPackage name equals: 'GToolkit-Coder-Examples'. + self + forPharo12: [ + self assert: aPackageTag name equals: 'Uncategorized'.] + forPharo11AndPharo10: [ + self assert: aPackage name equals: aPackageTag name ]. ^ aPackageTag ] From 3e01ffc4eb8f91c89c7e8cacfc662705c2ca983b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Fri, 27 Jun 2025 09:30:04 +0200 Subject: [PATCH 0992/1268] Improve the detection of an AST node based on the selected text --- src/GToolkit-Coder-AddOns/GtSourceCoder.extension.st | 5 +++-- src/GToolkit-Coder/GtSourceCoder.class.st | 8 +++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtSourceCoder.extension.st b/src/GToolkit-Coder-AddOns/GtSourceCoder.extension.st index fb1f52ca3..fe188255c 100644 --- a/src/GToolkit-Coder-AddOns/GtSourceCoder.extension.st +++ b/src/GToolkit-Coder-AddOns/GtSourceCoder.extension.st @@ -29,9 +29,10 @@ GtSourceCoder >> extractableNodesFrom: aCoderViewModel [ allSelections := aCoderViewModel selection allSelections. allCursors := aCoderViewModel cursors allCursors. - + ^ allSelections size = 1 - ifTrue: [ self extractableNodesWithin: allSelections first interval ] + ifTrue: [ self extractableNodesWithin: (allSelections first from + 1 + to: allSelections first to) ] ifFalse: [ allCursors size = 1 ifTrue: [ self extractableNodesAt: allCursors first position ] ifFalse: [ #() ] ] diff --git a/src/GToolkit-Coder/GtSourceCoder.class.st b/src/GToolkit-Coder/GtSourceCoder.class.st index 3dc14f8a3..7e9ee9a90 100644 --- a/src/GToolkit-Coder/GtSourceCoder.class.st +++ b/src/GToolkit-Coder/GtSourceCoder.class.st @@ -295,10 +295,12 @@ GtSourceCoder >> nodeFrom: aCoderViewModel [ | allSelections allCursors | allSelections := aCoderViewModel selection allSelections. allCursors := aCoderViewModel cursors allCursors. - + ^ allSelections size = 1 - ifTrue: [ self nodeWithin: allSelections first interval ] - ifFalse: [ allCursors size = 1 ifTrue: [ self nodeAt: allCursors first position ] ] + ifTrue: [ self nodeWithin: (allSelections first from + 1 + to: allSelections first to) ] + ifFalse: [ allCursors size = 1 ifTrue: [ + self nodeAt: allCursors first position ] ] ] { #category : #accessing } From a8e9b1f1d4ed21cdfd00b502462a8f99d67636b2 Mon Sep 17 00:00:00 2001 From: John Brant Date: Wed, 2 Jul 2025 07:09:23 -0500 Subject: [PATCH 0993/1268] [feenkcom/gtoolkit#3736] undeclared variable handling for P12 --- .../GtTextualCoderEditorElement.class.st | 2 +- src/GToolkit-Coder/GtCoderParseError.class.st | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 926e92ace..96d25ccf4 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -654,7 +654,7 @@ GtTextualCoderEditorElement >> reportParseError: aString at: anInteger [ { #category : #'private - event handling' } GtTextualCoderEditorElement >> reportUndeclaredError: aGtCoderParseError [ | rbNode interval gtNode ast errorAttribute | - rbNode := aGtCoderParseError exception node. + rbNode := aGtCoderParseError node. interval := rbNode sourceInterval. ast := GtPharoParser parse: rbNode methodNode source diff --git a/src/GToolkit-Coder/GtCoderParseError.class.st b/src/GToolkit-Coder/GtCoderParseError.class.st index 43ab3439c..6295afd27 100644 --- a/src/GToolkit-Coder/GtCoderParseError.class.st +++ b/src/GToolkit-Coder/GtCoderParseError.class.st @@ -32,7 +32,10 @@ GtCoderParseError >> exception: anException [ { #category : #testing } GtCoderParseError >> isUndeclaredError [ - ^ exception isKindOf: OCUndeclaredVariableWarning + ^ self + forPharo12: [ (errorMessage beginsWith: 'Undeclared variable') + or: [ errorMessage beginsWith: 'Undeclared temp' ] ] + forPharo11AndPharo10: [ exception isKindOf: OCUndeclaredVariableWarning ] ] { #category : #accessing } @@ -45,6 +48,15 @@ GtCoderParseError >> location: anObject [ location := anObject ] +{ #category : #accessing } +GtCoderParseError >> node [ + "The node in the exception is an RB node (Pharo 11)" + + ^ (self exception notNil and: [ self exception respondsTo: #node ]) + ifTrue: [ self exception node ] + ifFalse: [ coder rbAST ifNotNil: [ :node | node nodeForOffset: location ] ] +] + { #category : #accessing } GtCoderParseError >> requesterObject [ From 161bb594c9a92ec3dc44038ee87337e3cdcf8269 Mon Sep 17 00:00:00 2001 From: John Brant Date: Thu, 3 Jul 2025 07:20:51 -0500 Subject: [PATCH 0994/1268] [feenkcom/gtoolkit#4610] highlighting references in css strings --- src/GToolkit-Coder/GtSourceReferenceHighlighter.class.st | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder/GtSourceReferenceHighlighter.class.st b/src/GToolkit-Coder/GtSourceReferenceHighlighter.class.st index 64eb3e69d..36b03375c 100644 --- a/src/GToolkit-Coder/GtSourceReferenceHighlighter.class.st +++ b/src/GToolkit-Coder/GtSourceReferenceHighlighter.class.st @@ -4,9 +4,14 @@ Class { #classVars : [ 'HighlightAttributes' ], - #category : 'GToolkit-Coder-Styler/Highlighter' + #category : #'GToolkit-Coder-Styler/Highlighter' } +{ #category : #accessing } +GtSourceReferenceHighlighter class >> highlightAttribute [ + ^ HighlightAttributes first +] + { #category : #'class initialization' } GtSourceReferenceHighlighter class >> initialize [ HighlightAttributes := { From 6d6d99ee2cd3ceee95b8fff1bd5169753a4e851e Mon Sep 17 00:00:00 2001 From: John Brant Date: Thu, 3 Jul 2025 09:34:49 -0500 Subject: [PATCH 0995/1268] changing protocol completion strategy to be weighted instead of alphabetical --- src/GToolkit-Coder/GtMethodProtocolCompletionStrategy.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder/GtMethodProtocolCompletionStrategy.class.st b/src/GToolkit-Coder/GtMethodProtocolCompletionStrategy.class.st index ce3720aae..62bfdbe49 100644 --- a/src/GToolkit-Coder/GtMethodProtocolCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtMethodProtocolCompletionStrategy.class.st @@ -1,6 +1,6 @@ Class { #name : #GtMethodProtocolCompletionStrategy, - #superclass : #GtStringsCompletionStrategy, + #superclass : #GtWeightedStringsCompletionStrategy, #category : #'GToolkit-Coder-Completion' } From 3541ebbb1e966a82b73e6f9f4e9373d21538df49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Tue, 8 Jul 2025 15:30:18 +0200 Subject: [PATCH 0996/1268] Fix for the class creation form in Pharo 12 [feenkcom/gtoolkit#3736] --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index ad8f56cbb..e9769b76f 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -43,13 +43,22 @@ GtCreationForm >> commit [ GtCreationForm >> commitPackage [ | aPackage | (RPackageOrganizer default includesPackageNamed: packageAndTagName packageName) - ifTrue: [ aPackage := RPackageOrganizer default - packageNamed: packageAndTagName packageName. + ifTrue: [ + aPackage := RPackageOrganizer default + packageNamed: packageAndTagName packageName. ^ packageAndTagName tagName ifEmpty: [ aPackage ] - ifNotEmpty: [ :aTagName | aPackage tagNamed: aTagName ifAbsent: [ aPackage addClassTag: aTagName ] ] ] - ifFalse: [ aPackage := (RPackage named: packageAndTagName packageName) - register. + ifNotEmpty: [ :aTagName | + aPackage + tagNamed: aTagName + ifAbsent: [ aPackage addClassTag: aTagName ] ] ] + ifFalse: [ + aPackage := (RPackage named: packageAndTagName packageName). + self + forPharo12: [ + self class packageOrganizer addPackage: aPackage] + forPharo11AndPharo10: [ + aPackage register ]. ^ packageAndTagName tagName ifEmpty: [ aPackage ] ifNotEmpty: [ :aTagName | aPackage addClassTag: aTagName ] ] From 67a960d38de26142ed9b26923a125395b999183c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Wed, 9 Jul 2025 17:29:49 +0200 Subject: [PATCH 0997/1268] Duplicate extensions from RPackage to Package [feenkcom/gtoolkit#4615] --- .../Package.extension.st | 76 +++++++++++++++++++ src/GToolkit-Coder-UI/Package.extension.st | 6 ++ 2 files changed, 82 insertions(+) create mode 100644 src/GToolkit-Coder-Extensions/Package.extension.st create mode 100644 src/GToolkit-Coder-UI/Package.extension.st diff --git a/src/GToolkit-Coder-Extensions/Package.extension.st b/src/GToolkit-Coder-Extensions/Package.extension.st new file mode 100644 index 000000000..4a51b68cb --- /dev/null +++ b/src/GToolkit-Coder-Extensions/Package.extension.st @@ -0,0 +1,76 @@ +Extension { #name : #Package } + +{ #category : #'*GToolkit-Coder-Extensions' } +Package >> gtAllowedDependenciesFor: aView [ + + (self packageManifestOrNil + ifNil: [ false ] + ifNotNil: [ :aPackage | + aPackage class canPerform: #mustOnlyDependOn ]) ifFalse: [ ^ aView empty ] . + + ^ aView list + title: 'Allowed Dependencies'; + priority: 50; + items: [ + self packageManifestOrNil + ifNil: [ #() ] + ifNotNil: [ :aPackage | + (aPackage class canPerform: #mustOnlyDependOn) + ifTrue: [ aPackage mustOnlyDependOn collect: #asPackage ] + ifFalse: [ #() ] ] ]; + itemText: [ :aPackage | aPackage name ] +] + +{ #category : #'*GToolkit-Coder-Extensions' } +Package >> gtBaselinesFor: aView [ + + + ^ aView forward + title: 'References'; + tooltip: 'References to the package name'; + priority: 30; + object: [ self name gtStringLiteralCaseSensitiveMatch | self name gtReferences ]; + view: #gtItemsFor: +] + +{ #category : #'*GToolkit-Coder-Extensions' } +Package >> gtBrowse [ + ^ ((GtCoderElement forPackage: self) + openInPager) maximized +] + +{ #category : #'*GToolkit-Coder-Extensions' } +Package >> gtBrowseFrom: anElement [ + ^ ((GtCoderElement forPackage: self) asElement openInPagerFrom: anElement) maximized +] + +{ #category : #'*GToolkit-Coder-Extensions' } +Package >> gtDefinedClassesFor: aView context: aPhlowContext [ + + (aPhlowContext isKindOf: GtPhlowExecutionContext) ifFalse: [ ^ aView empty ]. + aPhlowContext hasPackageCoder ifFalse: [ ^ aView empty ]. + ^ aView explicit + priority: 1; + title: 'Classes'; + disableAsync; + stencil: [ aPhlowContext packageCoder classesCoder asElement ] +] + +{ #category : #'*GToolkit-Coder-Extensions' } +Package >> gtDefinedTagsFor: aView context: aPhlowContext [ + + (aPhlowContext isKindOf: GtPhlowExecutionContext) ifFalse: [ ^ aView empty ]. + aPhlowContext hasPackageCoder ifFalse: [ ^ aView empty ]. + ^ aView explicit + priority: 10.5; + title: 'Tags'; + disableAsync; + stencil: [ + BrSimpleList new + itemStencil: [ GtPackageTagCardElement new ]; + itemDataBinder: [ :eachTagCard :eachTagCoder | + eachTagCard coder: eachTagCoder ]; + items: (aPhlowContext packageCoder packageTagsCoder coders + asSortedCollection: [ :a :b | a packageTagName < b packageTagName ]); + addEventFilterOn: BlClickEvent do: [ :anEvent | anEvent currentTarget requestFocus ] ] +] diff --git a/src/GToolkit-Coder-UI/Package.extension.st b/src/GToolkit-Coder-UI/Package.extension.st new file mode 100644 index 000000000..85be8ae8f --- /dev/null +++ b/src/GToolkit-Coder-UI/Package.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #Package } + +{ #category : #'*GToolkit-Coder-UI' } +Package >> gtSpawnCoder [ + ^ GtPackageCoderTool package: self +] From 7b1bd469e2966d67c3e9c42fb95c7e4def347eeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Thu, 10 Jul 2025 13:58:03 +0200 Subject: [PATCH 0998/1268] Use #Package as a value in #return: pragmas [feenkcom/gtoolkit#4615] --- .../GtCoderNavigationBasicPackagesTagsClassesElement.class.st | 2 +- src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st | 2 +- src/GToolkit-Coder/GtCoderNavigationModel.class.st | 2 +- src/GToolkit-Coder/GtCoderNavigationPackageSelected.class.st | 4 ++-- src/GToolkit-Coder/GtCoderPackageExtensionTag.class.st | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationBasicPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationBasicPackagesTagsClassesElement.class.st index e2adfae67..30e9ced38 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationBasicPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationBasicPackagesTagsClassesElement.class.st @@ -346,7 +346,7 @@ GtCoderNavigationBasicPackagesTagsClassesElement >> selectedClass [ { #category : #'api - package selections' } GtCoderNavigationBasicPackagesTagsClassesElement >> selectedPackage [ - + ^ packagesList selectedPackage ] diff --git a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st index 573918223..26dcea254 100644 --- a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st @@ -449,7 +449,7 @@ GtCoderPackagesTreeElement >> selectedIndice [ { #category : #'api - selection' } GtCoderPackagesTreeElement >> selectedPackage [ - + ^ self selectedPackageNodeDo: #value ] diff --git a/src/GToolkit-Coder/GtCoderNavigationModel.class.st b/src/GToolkit-Coder/GtCoderNavigationModel.class.st index e415ce02f..2c0e8d7f2 100644 --- a/src/GToolkit-Coder/GtCoderNavigationModel.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationModel.class.st @@ -51,7 +51,7 @@ GtCoderNavigationModel >> isNavigationModel [ { #category : #'api - accessing' } GtCoderNavigationModel >> packagesToShow [ - + ^ self subclassResponsibility ] diff --git a/src/GToolkit-Coder/GtCoderNavigationPackageSelected.class.st b/src/GToolkit-Coder/GtCoderNavigationPackageSelected.class.st index fb3294d49..9ea8e2aa2 100644 --- a/src/GToolkit-Coder/GtCoderNavigationPackageSelected.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationPackageSelected.class.st @@ -4,12 +4,12 @@ Class { #instVars : [ 'package' ], - #category : 'GToolkit-Coder-Navigation - Events' + #category : #'GToolkit-Coder-Navigation - Events' } { #category : #accessing } GtCoderNavigationPackageSelected >> package [ - + ^ package ] diff --git a/src/GToolkit-Coder/GtCoderPackageExtensionTag.class.st b/src/GToolkit-Coder/GtCoderPackageExtensionTag.class.st index a5ffbe827..587aa38ce 100644 --- a/src/GToolkit-Coder/GtCoderPackageExtensionTag.class.st +++ b/src/GToolkit-Coder/GtCoderPackageExtensionTag.class.st @@ -62,7 +62,7 @@ GtCoderPackageExtensionTag >> name [ { #category : #accessing } GtCoderPackageExtensionTag >> package [ - + ^ package ] From ca1a61f29b5f7d1fc39ec1396ce36466a1b2c466 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Thu, 10 Jul 2025 14:55:22 +0200 Subject: [PATCH 0999/1268] Use #isPharoPackageModel [feenkcom/gtoolkit#4615] --- ...tCoderNavigationBasicPackagesTagsClassesElement.class.st | 4 ++-- src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st | 2 +- src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st | 6 +++--- src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationBasicPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationBasicPackagesTagsClassesElement.class.st index 30e9ced38..5bc1ee922 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationBasicPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationBasicPackagesTagsClassesElement.class.st @@ -141,7 +141,7 @@ GtCoderNavigationBasicPackagesTagsClassesElement >> onPackageListSelectionChange anIndex := theIndices first. (anIndex between: 1 and: packagesList viewModel itemCount) ifFalse: [ ^ self ]. aSelectedItem := (packagesList viewModel itemAt: anIndex) value. - (aSelectedItem isKindOf: RPackage) + (aSelectedItem isPharoPackageModel) ifTrue: [ self navigationModel selectPackage: aSelectedItem ] ifFalse: [ self navigationModel selectPackageTag: aSelectedItem ]. self showClassList. @@ -333,7 +333,7 @@ GtCoderNavigationBasicPackagesTagsClassesElement >> selectPackage: aPackage tag: { #category : #'api - package selections' } GtCoderNavigationBasicPackagesTagsClassesElement >> selectPackageOrTag: aPackageOrTag [ - (aPackageOrTag isKindOf: RPackage) + (aPackageOrTag isPharoPackageModel) ifTrue: [ self selectPackage: aPackageOrTag ] ifFalse: [ self selectPackage: aPackageOrTag package tag: aPackageOrTag ] ] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index b5bc114a6..535c2d0cc 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -43,7 +43,7 @@ GtCoderNavigationTabsStencil >> addButtonsTo: explicitView [ objectActOn: [ :anActOnEvent :anItem :theButton | | acted | acted := false. - (anItem isKindOf: RPackage) + (anItem isPharoPackageModel) ifTrue: [ self navigationModel selectPackage: anItem. acted := true ]. (anItem isKindOf: ClassDescription) diff --git a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st index 26dcea254..0de75d5cc 100644 --- a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st @@ -41,7 +41,7 @@ GtCoderPackagesTreeElement >> buildRemoveTagLabelFor: aTag [ { #category : #'private - enumeration' } GtCoderPackagesTreeElement >> childrenForPackageOrTag: aPackageOrTag [ | theTags anExtension | - (aPackageOrTag isKindOf: RPackage) ifFalse: [ ^ #() ]. + (aPackageOrTag isPharoPackageModel) ifFalse: [ ^ #() ]. theTags := aPackageOrTag tags asOrderedCollection. theTags withIndexDo: [ :eachTag :eachIndex | @@ -69,7 +69,7 @@ GtCoderPackagesTreeElement >> contextMenuFor: aPackageOrTag [ menu addItemLabel: (self createLabel: 'New package / tag' description: '') action: [ self newPackage ]. - aPackageOrTag class == RPackage + aPackageOrTag isPharoPackageModel ifTrue: [ menu addItem: (BrMenuSubmenuItem new label: (self createLabel: 'Rename package' description: aPackageOrTag name); @@ -120,7 +120,7 @@ GtCoderPackagesTreeElement >> createRenamePackageForm: aPackageOrTag [ ^ GtCoderPackagesTreeRenameEditor new itemToRename: aPackageOrTag; renameAction: [ :anItemToRename :aNewName | - (anItemToRename isKindOf: RPackage) + (anItemToRename isPharoPackageModel) ifTrue: [ (GtRBRenamePackageRefactoring from: anItemToRename name diff --git a/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st b/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st index 5eff61ad2..a23cdacb0 100644 --- a/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st @@ -53,7 +53,7 @@ GtPackagesCompletionStrategy >> completionActionStreamFor: aText at: positionInt string isEmpty ifTrue: [ ^ #() ]. searchString := '*' , string , '*'. ^ ((self class packageStreamMatching: searchString) - collect: [ :each | (each isKindOf: RPackage) ifTrue: [ each name ] ifFalse: [ each categoryName ] ]) withoutDuplicates + collect: [ :each | (each isPharoPackageModel) ifTrue: [ each name ] ifFalse: [ each categoryName ] ]) withoutDuplicates collect: [ :each | GtReplaceTextCompletionAction forText: each ] ] From 8cd5285d519d02e71b239c617e2523f90f3af58a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Thu, 10 Jul 2025 15:28:10 +0200 Subject: [PATCH 1000/1268] Use `Package named: aPackageName` in both Pharo 11 and Pharo 12 [feenkcom/gtoolkit#4615] --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index e9769b76f..71ebc13c8 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -53,7 +53,7 @@ GtCreationForm >> commitPackage [ tagNamed: aTagName ifAbsent: [ aPackage addClassTag: aTagName ] ] ] ifFalse: [ - aPackage := (RPackage named: packageAndTagName packageName). + aPackage := (Package named: packageAndTagName packageName). self forPharo12: [ self class packageOrganizer addPackage: aPackage] From 0a5d5e094990d1f20f73e2867965f08af463f9c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Wed, 16 Jul 2025 11:00:31 +0200 Subject: [PATCH 1001/1268] Add PackageTag extensions [feenkcom/gtoolkit#4615] --- src/GToolkit-Coder/PackageTag.extension.st | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/GToolkit-Coder/PackageTag.extension.st diff --git a/src/GToolkit-Coder/PackageTag.extension.st b/src/GToolkit-Coder/PackageTag.extension.st new file mode 100644 index 000000000..3a10e073d --- /dev/null +++ b/src/GToolkit-Coder/PackageTag.extension.st @@ -0,0 +1,18 @@ +Extension { #name : #PackageTag } + +{ #category : #'*GToolkit-Coder' } +PackageTag >> gtClassesCoderFor: aView context: aPhlowContext [ + + (aPhlowContext isKindOf: GtPhlowExecutionContext) ifFalse: [ ^ aView empty ]. + aPhlowContext hasPackageTagCoder ifFalse: [ ^ aView empty ]. + ^ aView explicit + priority: 10; + title: 'Classes'; + disableAsync; + stencil: [ aPhlowContext packageTagCoder classesCoder asElement ] +] + +{ #category : #'*GToolkit-Coder' } +PackageTag >> gtTagName [ + ^ self name +] From a86efadc91888744d7b3a5473ddf3184373385e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Tue, 22 Jul 2025 09:28:59 +0200 Subject: [PATCH 1002/1268] Use PackageTag instead of RPackageTag [feenkcom/gtoolkit#4615] --- .../GtCoderUncategorizedDummyClass.class.st | 2 +- .../GtCoderNavigationBasicPackagesTagsClassesElement.class.st | 2 +- src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st | 2 +- .../GtCoderNavigationPackageTagSelected.class.st | 4 ++-- src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/GToolkit-Coder-Examples/GtCoderUncategorizedDummyClass.class.st b/src/GToolkit-Coder-Examples/GtCoderUncategorizedDummyClass.class.st index ab2208e8c..42cf8e564 100644 --- a/src/GToolkit-Coder-Examples/GtCoderUncategorizedDummyClass.class.st +++ b/src/GToolkit-Coder-Examples/GtCoderUncategorizedDummyClass.class.st @@ -12,7 +12,7 @@ Class { { #category : #examples } GtCoderUncategorizedDummyClass >> checkUncategorized [ - + | aPackage aPackageTag | aPackage := self class package. aPackageTag := aPackage tags diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationBasicPackagesTagsClassesElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationBasicPackagesTagsClassesElement.class.st index 5bc1ee922..e741b10bc 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationBasicPackagesTagsClassesElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationBasicPackagesTagsClassesElement.class.st @@ -364,7 +364,7 @@ GtCoderNavigationBasicPackagesTagsClassesElement >> selectedPackageOrTag [ { #category : #'api - package selections' } GtCoderNavigationBasicPackagesTagsClassesElement >> selectedPackageTag [ - + ^ packagesList selectedPackageTag ] diff --git a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st index 0de75d5cc..de702f9e0 100644 --- a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st @@ -462,7 +462,7 @@ GtCoderPackagesTreeElement >> selectedPackageNodeDo: aBlock [ { #category : #'api - selection' } GtCoderPackagesTreeElement >> selectedPackageTag [ - + ^ self selectedPackageTagNodeDo: #value ] diff --git a/src/GToolkit-Coder/GtCoderNavigationPackageTagSelected.class.st b/src/GToolkit-Coder/GtCoderNavigationPackageTagSelected.class.st index 079b12645..feeb8913d 100644 --- a/src/GToolkit-Coder/GtCoderNavigationPackageTagSelected.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationPackageTagSelected.class.st @@ -5,7 +5,7 @@ Class { 'package', 'tag' ], - #category : 'GToolkit-Coder-Navigation - Events' + #category : #'GToolkit-Coder-Navigation - Events' } { #category : #accessing } @@ -20,7 +20,7 @@ GtCoderNavigationPackageTagSelected >> package: anObject [ { #category : #accessing } GtCoderNavigationPackageTagSelected >> tag [ - + ^ tag ] diff --git a/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st b/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st index abb03f11f..93c5b479d 100644 --- a/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st +++ b/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st @@ -60,7 +60,7 @@ GtCoderPackageUncategorizedTag >> packageName [ { #category : #accessing } GtCoderPackageUncategorizedTag >> packageTag [ - + ^ packageTag ] From fbb25a58f01d791064301bb45b6c986623f24e81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Tue, 22 Jul 2025 09:37:59 +0200 Subject: [PATCH 1003/1268] Use #isPharoPackageTagModel for testing for package tags [feenkcom/gtoolkit#4615] --- src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st | 2 +- src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st | 2 +- src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index 535c2d0cc..cd46ca0b8 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -188,7 +188,7 @@ GtCoderNavigationTabsStencil >> gtCreationInterface: look [ selectedPackageDo: [ :aPackage | form packageAndTagName packageName: aPackage name ]. navigationModel selectedTagDo: [ :aTag | - (aTag isKindOf: RPackageTag) + (aTag isPharoPackageTagModel) ifTrue: [ aTag isRoot ifFalse: [ form packageAndTagName tagName: aTag name ] ] ifFalse: [ aTag isUncategorized ifFalse: [ form packageAndTagName tagName: aTag name ] ] ] ]. ((GtCreationFormWidget forForm: form) diff --git a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st index de702f9e0..a06b85872 100644 --- a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st @@ -126,7 +126,7 @@ GtCoderPackagesTreeElement >> createRenamePackageForm: aPackageOrTag [ from: anItemToRename name to: aNewName) execute ]. - (anItemToRename isKindOf: RPackageTag) + (anItemToRename isPharoPackageTagModel) ifTrue: [ (GtRBRenamePackageTagRefactoring packageName: anItemToRename package name diff --git a/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st b/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st index 93c5b479d..5bb427fbf 100644 --- a/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st +++ b/src/GToolkit-Coder/GtCoderPackageUncategorizedTag.class.st @@ -15,7 +15,7 @@ GtCoderPackageUncategorizedTag class >> forPackageTag: aRPackage [ { #category : #comparing } GtCoderPackageUncategorizedTag >> = anObject [ ^ (self class = anObject class and: [ self packageTagName = anObject packageTagName ]) or: [ - (anObject isKindOf: RPackageTag) and: [ self packageTagName = anObject name ] ] + (anObject isPharoPackageTagModel) and: [ self packageTagName = anObject name ] ] ] { #category : #accessing } From d1bfe0ecc5151fb727c69954a8e5743f1c71dcdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Tue, 22 Jul 2025 14:17:12 +0200 Subject: [PATCH 1004/1268] Use #packageOrganizer instead of accessing RPackageOrganizer [feenkcom/gtoolkit#4615] --- .../GtCoderNavigationPackagesListElementExamples.class.st | 2 +- src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st | 2 +- src/GToolkit-Coder-UI/GtCreationForm.class.st | 4 ++-- src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/GToolkit-Coder-Examples/GtCoderNavigationPackagesListElementExamples.class.st b/src/GToolkit-Coder-Examples/GtCoderNavigationPackagesListElementExamples.class.st index 49d8c0b40..7d4af3c9c 100644 --- a/src/GToolkit-Coder-Examples/GtCoderNavigationPackagesListElementExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtCoderNavigationPackagesListElementExamples.class.st @@ -8,5 +8,5 @@ Class { GtCoderNavigationPackagesListElementExamples >> fromAllPackages [ - ^ GtCoderPackagesTreeElement fromPackages: RPackageOrganizer default packages + ^ GtCoderPackagesTreeElement fromPackages: self packageOrganizer packages ] diff --git a/src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st b/src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st index 9ff2cf7fd..b3304d3dc 100644 --- a/src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st +++ b/src/GToolkit-Coder-UI/GtCoderSpotterStart.class.st @@ -23,7 +23,7 @@ GtCoderSpotterStart >> gtSpotterForPackagesFor: aSearch [ ^ aSearch list priority: 20; - items: [ RPackageOrganizer default packages ]; + items: [ self packageOrganizer packages ]; title: 'Packages'; itemName: [ :package | package name ]; filterBySubstring; diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index 71ebc13c8..eecbee9bc 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -42,9 +42,9 @@ GtCreationForm >> commit [ { #category : #callbacks } GtCreationForm >> commitPackage [ | aPackage | - (RPackageOrganizer default includesPackageNamed: packageAndTagName packageName) + (self packageOrganizer includesPackageNamed: packageAndTagName packageName) ifTrue: [ - aPackage := RPackageOrganizer default + aPackage := self packageOrganizer packageNamed: packageAndTagName packageName. ^ packageAndTagName tagName ifEmpty: [ aPackage ] diff --git a/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st b/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st index a23cdacb0..99c089291 100644 --- a/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtPackagesCompletionStrategy.class.st @@ -6,12 +6,12 @@ Class { { #category : #private } GtPackagesCompletionStrategy class >> allPackages [ - ^ RPackageOrganizer default packages asSortedCollection: [ :a :b | a name < b name ] + ^ self packageOrganizer packages asSortedCollection: [ :a :b | a name < b name ] ] { #category : #private } GtPackagesCompletionStrategy class >> allPackagesDo: aBlock [ - ^ RPackageOrganizer default packagesDo: aBlock + ^ self packageOrganizer packagesDo: aBlock ] { #category : #querying } From c87eae9796fb4d72b59b05a09e657d9f981efb57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Tue, 22 Jul 2025 23:13:13 +0200 Subject: [PATCH 1005/1268] Add Tonel version 1.0 [feenkcom/gtoolkit#4622] --- src/.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/src/.properties b/src/.properties index ad0471ded..1bcd6c431 100644 --- a/src/.properties +++ b/src/.properties @@ -1,3 +1,4 @@ { + #version : #1.0, #format : #tonel } \ No newline at end of file From f2fe4b9854ad56b8dca25ad8e940f818001cafbb Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 23 Jul 2025 15:22:42 -0400 Subject: [PATCH 1006/1268] coder sidebar index can be displayed by default (left or top) [feenkcom/gtoolkit#4627] --- src/GToolkit-Coder-UI/GtCoderElement.class.st | 36 +++++++++++++---- .../GtCoderSettings.class.st | 40 +++++++++++++++++++ 2 files changed, 69 insertions(+), 7 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderSettings.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderElement.class.st b/src/GToolkit-Coder-UI/GtCoderElement.class.st index b70b56e5b..3dfb5f7bf 100644 --- a/src/GToolkit-Coder-UI/GtCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderElement.class.st @@ -51,7 +51,21 @@ GtCoderElement >> createSidebarElement [ ^ GtPhlowHorizontalSidebarElement new beLeft; resizerStrategy: (BrResizerElementLength weight: self class defaultSidebarWidth); - contentStencil: (GtCoderNavigationTabsStencil new navigationModel: self navigationModel) + contentStencil: (GtCoderNavigationTabsStencil new navigationModel: self navigationModel); + addAptitude: (GtPhlowToolDetailAptitude new + left: [ :aStyle | + aStyle + do: [ :aWidget | + aWidget beLeft. + (aWidget resizerStrategy isKindOf: BrResizerWeightedLength) + ifTrue: [ aWidget + resizerStrategy: (BrResizerElementLength weight: self class defaultSidebarWidth) ] ] ]; + top: [ :aStyle | + aStyle + do: [ :aWidget | + aWidget beTop. + (aWidget resizerStrategy isKindOf: BrResizerWeightedLength) + ifTrue: [ aWidget resizerStrategy: (BrResizerElementLength weight: 0.5) ] ] ]) ] { #category : #'instance creation' } @@ -79,22 +93,30 @@ GtCoderElement >> initialize [ super initialize. contentElement := self createPlaygroundElement. + titleNotifier := self createTitleNotifier. self layout: BlLinearLayout horizontal; addEventHandler: titleNotifier; addAptitude: (GtPhlowToolDetailAptitude new - normal: [ :aStyle | aStyle do: [ self hideSidebar ] ]; - detailed: [ :aStyle | aStyle do: [ self showSidebar ] ]). + normal: [ :aStyle | aStyle do: [ self hideSidebar ] ]; + detailed: [ :aStyle | aStyle do: [ self showSidebar ] ]; + left: [ :aStyle | aStyle do: [ self layout: BlLinearLayout horizontal ] ]; + top: [ :aStyle | aStyle do: [ self layout: BlLinearLayout vertical ] ]). self addChild: contentElement as: #content. self phlow beViewContent. - self phlow - accessTool: (GtPhlowToolClassType forClass: GtCoderElement) - viewModel: #navigationModel - object: #navigationModel + self phlow + accessTool: (GtPhlowToolClassType forClass: GtCoderElement) + viewModel: #navigationModel + object: #navigationModel. + + GtCoderSettings defaultDetailState + ifNotNil: [ :aState | self states addState: aState ]. + GtCoderSettings defaultDetailPositionState + ifNotNil: [ :aState | self states addState: aState ] ] { #category : #'private - hooks' } diff --git a/src/GToolkit-Coder-UI/GtCoderSettings.class.st b/src/GToolkit-Coder-UI/GtCoderSettings.class.st new file mode 100644 index 000000000..9704d5145 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderSettings.class.st @@ -0,0 +1,40 @@ +Class { + #name : #GtCoderSettings, + #superclass : #Object, + #classVars : [ + 'DefaultDetailPositionState', + 'DefaultDetailState' + ], + #category : #'GToolkit-Coder-UI-! Core' +} + +{ #category : #settings } +GtCoderSettings class >> defaultDetailPositionState [ + + ^ DefaultDetailPositionState +] + +{ #category : #settings } +GtCoderSettings class >> defaultDetailState [ + ^ DefaultDetailState +] + +{ #category : #settings } +GtCoderSettings class >> displayDetails [ + DefaultDetailState := GtPhlowToolDetailState detailed +] + +{ #category : #settings } +GtCoderSettings class >> hideDetails [ + DefaultDetailState := nil +] + +{ #category : #settings } +GtCoderSettings class >> leftPosition [ + DefaultDetailPositionState := nil +] + +{ #category : #settings } +GtCoderSettings class >> topPosition [ + DefaultDetailPositionState := GtPhlowToolDetailPositionState top +] From db3ed6983c396a4d748767164e9be8176b6acf1d Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 24 Jul 2025 14:36:49 -0400 Subject: [PATCH 1007/1268] coder sidebar: store left and top resizer strategies [feenkcom/gtoolkit#4627] --- src/GToolkit-Coder-UI/GtCoderElement.class.st | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderElement.class.st b/src/GToolkit-Coder-UI/GtCoderElement.class.st index 3dfb5f7bf..372b18cd2 100644 --- a/src/GToolkit-Coder-UI/GtCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderElement.class.st @@ -56,16 +56,25 @@ GtCoderElement >> createSidebarElement [ left: [ :aStyle | aStyle do: [ :aWidget | - aWidget beLeft. - (aWidget resizerStrategy isKindOf: BrResizerWeightedLength) - ifTrue: [ aWidget - resizerStrategy: (BrResizerElementLength weight: self class defaultSidebarWidth) ] ] ]; + aWidget userData + at: #leftSidebarResizerStrategy + ifPresent: [ :aResizerStrategy | aWidget resizerStrategy: aResizerStrategy ] + ifAbsentPut: [ aWidget + resizerStrategy: (BrResizerElementLength weight: self class defaultSidebarWidth) ]. + + aWidget beLeft ] + after: [ :aWidget | aWidget userData at: #leftSidebarResizerStrategy put: aWidget resizerStrategy ] ]; top: [ :aStyle | aStyle do: [ :aWidget | - aWidget beTop. - (aWidget resizerStrategy isKindOf: BrResizerWeightedLength) - ifTrue: [ aWidget resizerStrategy: (BrResizerElementLength weight: 0.5) ] ] ]) + aWidget userData + at: #topSidebarResizerStrategy + ifPresent: [ :aResizerStrategy | aWidget resizerStrategy: aResizerStrategy ] + ifAbsentPut: [ aWidget + resizerStrategy: (BrResizerElementLength weight: 0.5) ]. + + aWidget beTop ] + after: [ :aWidget | aWidget userData at: #topSidebarResizerStrategy put: aWidget resizerStrategy ] ]) ] { #category : #'instance creation' } From ddf38067d7293e5185b295675a919e37c70e875f Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 24 Jul 2025 14:50:55 -0400 Subject: [PATCH 1008/1268] coder sidebar: remember collapsed state for left and top states [feenkcom/gtoolkit#4627] --- src/GToolkit-Coder-UI/GtCoderElement.class.st | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderElement.class.st b/src/GToolkit-Coder-UI/GtCoderElement.class.st index 372b18cd2..dd9f38d53 100644 --- a/src/GToolkit-Coder-UI/GtCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderElement.class.st @@ -61,9 +61,14 @@ GtCoderElement >> createSidebarElement [ ifPresent: [ :aResizerStrategy | aWidget resizerStrategy: aResizerStrategy ] ifAbsentPut: [ aWidget resizerStrategy: (BrResizerElementLength weight: self class defaultSidebarWidth) ]. - - aWidget beLeft ] - after: [ :aWidget | aWidget userData at: #leftSidebarResizerStrategy put: aWidget resizerStrategy ] ]; + aWidget beLeft. + aWidget userData + at: #leftSidebarIsCollapsed + ifPresent: [ :aBoolean | aBoolean ifTrue: [ aWidget collapse ] ] + ifAbsent: [ ] ] + after: [ :aWidget | + aWidget userData at: #leftSidebarResizerStrategy put: aWidget resizerStrategy. + aWidget userData at: #leftSidebarIsCollapsed put: aWidget isCollapsed ] ]; top: [ :aStyle | aStyle do: [ :aWidget | @@ -72,9 +77,14 @@ GtCoderElement >> createSidebarElement [ ifPresent: [ :aResizerStrategy | aWidget resizerStrategy: aResizerStrategy ] ifAbsentPut: [ aWidget resizerStrategy: (BrResizerElementLength weight: 0.5) ]. - - aWidget beTop ] - after: [ :aWidget | aWidget userData at: #topSidebarResizerStrategy put: aWidget resizerStrategy ] ]) + aWidget beTop. + aWidget userData + at: #topSidebarIsCollapsed + ifPresent: [ :aBoolean | aBoolean ifTrue: [ aWidget collapse ] ] + ifAbsent: [ ] ] + after: [ :aWidget | + aWidget userData at: #topSidebarResizerStrategy put: aWidget resizerStrategy. + aWidget userData at: #topSidebarIsCollapsed put: aWidget isCollapsed ] ]) ] { #category : #'instance creation' } From 3bbbef6e4d424d7b183d3f1333beba1feeeae5ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Fri, 25 Jul 2025 14:37:57 +0200 Subject: [PATCH 1009/1268] Use #sumNumbers: instead of #sum: --- src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index bfcc095c4..d0e7f7aaf 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -418,9 +418,9 @@ GtCoderClassesTreeElement >> removeSeveralClassesSubmenuFor: someClasses [ addChild: (BrAsyncWidget new fitContent; stencil: [ | pane references subclasses | - references := someClasses sum: [ :eachClass | (GtPharoIndex current + references := someClasses sumNumbers: [ :eachClass | (GtPharoIndex current globalVariableReferencesTo: eachClass binding) size ]. - subclasses := someClasses sum: [ :eachClass | (eachClass allSubclasses difference: someClasses) size ]. + subclasses := someClasses sumNumbers: [ :eachClass | (eachClass allSubclasses difference: someClasses) size ]. pane := BrVerticalPane new. pane fitContent. references > 0 From d60b355f464c66340a9fc07389b7813a717f4ddd Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 25 Jul 2025 13:11:01 -0400 Subject: [PATCH 1010/1268] sidebar index class context menu: extensible context menu for one selected class [feenkcom/gtoolkit#4628] --- src/GToolkit-Coder-UI/Class.extension.st | 69 +++++++++++++++++++ .../GtCoderClassesTreeElement.class.st | 64 ++++++----------- 2 files changed, 89 insertions(+), 44 deletions(-) diff --git a/src/GToolkit-Coder-UI/Class.extension.st b/src/GToolkit-Coder-UI/Class.extension.st index 95deb2c2c..ae216f560 100644 --- a/src/GToolkit-Coder-UI/Class.extension.st +++ b/src/GToolkit-Coder-UI/Class.extension.st @@ -4,3 +4,72 @@ Extension { #name : #Class } Class >> asFilterModelItem [ ^ GtFilterModelClassItem new itemClass: self ] + +{ #category : #'*GToolkit-Coder-UI' } +Class >> gtCoderSidebarIndexBrowseClassFrom: aGtCoderClassesTreeElement [ + + ^ BrMenuActionItem new + label: 'Browse class' preview: self name; + action: [ aGtCoderClassesTreeElement phlow spawnObject: self ] +] + +{ #category : #'*GToolkit-Coder-UI' } +Class >> gtCoderSidebarIndexBrowseReferencesFrom: aGtCoderClassesTreeElement [ + + ^ BrMenuActionItem new + label: 'Browse references' preview: self name; + action: [ aGtCoderClassesTreeElement browseReferencesTo: self ] +] + +{ #category : #'*GToolkit-Coder-UI' } +Class >> gtCoderSidebarIndexExtractSuperclassFrom: aGtCoderClassesTreeElement [ + + self subclasses notEmpty ifFalse: [ ^ nil ]. + + ^ BrMenuSubmenuItem new + label: 'Extract superclass' preview: self name; + submenu: (aGtCoderClassesTreeElement convertToSiblingSubmenuFor: self siblings: #()) +] + +{ #category : #'*GToolkit-Coder-UI' } +Class >> gtCoderSidebarIndexGitFrom: aGtCoderClassesTreeElement [ + + ^ BrMenuActionItem new + id: GtCoderGitButtonId; + icon: BrGlamorousVectorIcons branching + label: 'Browse git repository' + preview: self; + action: [ :aButton | + | coder repository | + repository := self repository. + repository + ifNil: [ aButton phlow + spawnTool: (GtPhlowExplicitTool new + stencil: [ GtGitAddToRepositoryElement new package: coder navigationModel selectedPackage ]) ] + ifNotNil: [ aButton phlow + spawnTool: (GtGitPhlowTool new repository: repository) ] ] +] + +{ #category : #'*GToolkit-Coder-UI' } +Class >> gtCoderSidebarIndexNewSubclassFrom: aGtCoderClassesTreeElement [ + + ^ BrMenuActionItem new + label: 'New subclass' preview: self name; + action: [ aGtCoderClassesTreeElement newSubclassOf: self ] +] + +{ #category : #'*GToolkit-Coder-UI' } +Class >> gtCoderSidebarIndexRemoveClassFrom: aGtCoderClassesTreeElement [ + + ^ BrMenuSubmenuItem new + label: 'Remove class' preview: self name; + submenu: (aGtCoderClassesTreeElement removeClassSubmenuFor: self) +] + +{ #category : #'*GToolkit-Coder-UI' } +Class >> gtCoderSidebarIndexRenameClassFrom: aGtCoderClassesTreeElement [ + + ^ BrMenuSubmenuItem new + label: 'Rename class' preview: self name; + submenu: (aGtCoderClassesTreeElement renameClassSubmenuFor: self) +] diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index d0e7f7aaf..84b10a421 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -104,32 +104,26 @@ GtCoderClassesTreeElement >> contextMenuFor: aClass [ { #category : #initialization } GtCoderClassesTreeElement >> contextMenuForOneItem: aClass [ - | menu | - menu := BrMenuItems new. - menu - addItemLabel: (self createLabel: 'Browse references' description: aClass name) - action: [ self browseReferencesTo: aClass ]. - menu - addItemLabel: (self createLabel: 'New subclass' description: aClass name) - action: [ self newSubclassOf: aClass ]. - menu - addItem: (BrMenuSubmenuItem new - label: (self createLabel: 'Rename class' description: aClass name); - submenu: (self renameClassSubmenuFor: aClass)). - menu - addItem: (BrMenuSubmenuItem new - label: (self createLabel: 'Remove class' description: aClass name); - submenu: (self removeClassSubmenuFor: aClass)). - aClass subclasses notEmpty - ifTrue: [ menu - addItem: (BrMenuSubmenuItem new - label: (self createLabel: 'Convert to sibling' description: aClass name); - submenu: (self convertToSiblingSubmenuFor: aClass siblings: aClass subclasses)) ]. - menu - addItem: (BrMenuSubmenuItem new - label: (self createLabel: 'Extract superclass' description: aClass name); - submenu: (self convertToSiblingSubmenuFor: aClass siblings: #())). - ^ menu + | somePragmas someMenuItems | + somePragmas := Pragma + allNamed: #gtCoderSidebarIndexOneSubjectContextMenuItem: + from: aClass class + to: Behavior + sortedByArgument: 1. + someMenuItems := somePragmas + collect: [ :eachPragma | + [ aClass perform: eachPragma methodSelector with: self ] + onErrorDo: [ :anException | + | frozenException | + frozenException := GtSystemUtility freeze: anException. + frozenException tag: eachPragma. + anException + return: (BrMenuActionItem new + label: 'Error' preview: frozenException messageText; + action: [ :anElement :aButtonModel :anEvent | anElement phlow spawnObject: frozenException ]) ] ] + thenSelect: #isNotNil. + + ^ BrMenuItems new addItems: someMenuItems ] { #category : #initialization } @@ -147,24 +141,6 @@ GtCoderClassesTreeElement >> contextMenuForSeveralItems: someClasses [ ^ menu ] -{ #category : #initialization } -GtCoderClassesTreeElement >> convertToSiblingSubmenuFor: aClass siblings: aCollection [ - | submenu | - submenu := BrMenuExplicit new. - submenu - stencil: [ GtRefactoringsWithInputPreviewElement - elementForRefactoring: [ :each | - GtChildrenToSiblingsRefactoring - name: each - class: aClass - subclasses: aCollection ] - labeled: 'Superclass: ' - initialValue: 'NewClass' - from: self - beforeApplyingDo: [ submenu hideAll ] ]. - ^ submenu -] - { #category : #'private - drag and drop' } GtCoderClassesTreeElement >> createClassDragHandler [ ^ BlDragHandler new From 63a418c3a8a26da1005a3667a4b709ccd06b46dc Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 25 Jul 2025 14:44:29 -0400 Subject: [PATCH 1011/1268] repackage a coder sidebar index class context menu extension [feenkcom/gtoolkit#4628] --- src/GToolkit-Coder-UI/Class.extension.st | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/GToolkit-Coder-UI/Class.extension.st b/src/GToolkit-Coder-UI/Class.extension.st index ae216f560..19d037a50 100644 --- a/src/GToolkit-Coder-UI/Class.extension.st +++ b/src/GToolkit-Coder-UI/Class.extension.st @@ -31,25 +31,6 @@ Class >> gtCoderSidebarIndexExtractSuperclassFrom: aGtCoderClassesTreeElement [ submenu: (aGtCoderClassesTreeElement convertToSiblingSubmenuFor: self siblings: #()) ] -{ #category : #'*GToolkit-Coder-UI' } -Class >> gtCoderSidebarIndexGitFrom: aGtCoderClassesTreeElement [ - - ^ BrMenuActionItem new - id: GtCoderGitButtonId; - icon: BrGlamorousVectorIcons branching - label: 'Browse git repository' - preview: self; - action: [ :aButton | - | coder repository | - repository := self repository. - repository - ifNil: [ aButton phlow - spawnTool: (GtPhlowExplicitTool new - stencil: [ GtGitAddToRepositoryElement new package: coder navigationModel selectedPackage ]) ] - ifNotNil: [ aButton phlow - spawnTool: (GtGitPhlowTool new repository: repository) ] ] -] - { #category : #'*GToolkit-Coder-UI' } Class >> gtCoderSidebarIndexNewSubclassFrom: aGtCoderClassesTreeElement [ From 657235973fbf233270e846d2df48939b6eccbc81 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 25 Jul 2025 15:07:43 -0400 Subject: [PATCH 1012/1268] sidebar index class context menu: add icons [feenkcom/gtoolkit#4628] --- src/GToolkit-Coder-UI/Class.extension.st | 36 ++++++++++++++++++------ 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/src/GToolkit-Coder-UI/Class.extension.st b/src/GToolkit-Coder-UI/Class.extension.st index 19d037a50..4cf0e2cf8 100644 --- a/src/GToolkit-Coder-UI/Class.extension.st +++ b/src/GToolkit-Coder-UI/Class.extension.st @@ -9,7 +9,9 @@ Class >> asFilterModelItem [ Class >> gtCoderSidebarIndexBrowseClassFrom: aGtCoderClassesTreeElement [ ^ BrMenuActionItem new - label: 'Browse class' preview: self name; + icon: BrGlamorousVectorIcons browse + label: 'Browse class' + preview: self name; action: [ aGtCoderClassesTreeElement phlow spawnObject: self ] ] @@ -17,17 +19,29 @@ Class >> gtCoderSidebarIndexBrowseClassFrom: aGtCoderClassesTreeElement [ Class >> gtCoderSidebarIndexBrowseReferencesFrom: aGtCoderClassesTreeElement [ ^ BrMenuActionItem new - label: 'Browse references' preview: self name; + icon: BrGlamorousVectorIcons empty + label: 'Browse references' + preview: self name; action: [ aGtCoderClassesTreeElement browseReferencesTo: self ] ] +{ #category : #'*GToolkit-Coder-UI' } +Class >> gtCoderSidebarIndexCopyClassNameFrom: aGtCoderClassesTreeElement [ + + ^ BrMenuActionItem new + icon: BrGlamorousVectorIcons clipboard + label: 'Copy class name' + preview: self name; + action: [ Clipboard clipboardText: self name ] +] + { #category : #'*GToolkit-Coder-UI' } Class >> gtCoderSidebarIndexExtractSuperclassFrom: aGtCoderClassesTreeElement [ - self subclasses notEmpty ifFalse: [ ^ nil ]. - ^ BrMenuSubmenuItem new - label: 'Extract superclass' preview: self name; + icon: BrGlamorousVectorIcons empty + label: 'Extract superclass' + preview: self name; submenu: (aGtCoderClassesTreeElement convertToSiblingSubmenuFor: self siblings: #()) ] @@ -35,7 +49,9 @@ Class >> gtCoderSidebarIndexExtractSuperclassFrom: aGtCoderClassesTreeElement [ Class >> gtCoderSidebarIndexNewSubclassFrom: aGtCoderClassesTreeElement [ ^ BrMenuActionItem new - label: 'New subclass' preview: self name; + icon: BrGlamorousVectorIcons add + label: 'New subclass' + preview: self name; action: [ aGtCoderClassesTreeElement newSubclassOf: self ] ] @@ -43,7 +59,9 @@ Class >> gtCoderSidebarIndexNewSubclassFrom: aGtCoderClassesTreeElement [ Class >> gtCoderSidebarIndexRemoveClassFrom: aGtCoderClassesTreeElement [ ^ BrMenuSubmenuItem new - label: 'Remove class' preview: self name; + icon: BrGlamorousVectorIcons remove + label: 'Remove class' + preview: self name; submenu: (aGtCoderClassesTreeElement removeClassSubmenuFor: self) ] @@ -51,6 +69,8 @@ Class >> gtCoderSidebarIndexRemoveClassFrom: aGtCoderClassesTreeElement [ Class >> gtCoderSidebarIndexRenameClassFrom: aGtCoderClassesTreeElement [ ^ BrMenuSubmenuItem new - label: 'Rename class' preview: self name; + icon: BrGlamorousVectorIcons empty + label: 'Rename class' + preview: self name; submenu: (aGtCoderClassesTreeElement renameClassSubmenuFor: self) ] From 1917c4524669cd455f5ac2fd2319743915ef2114 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 25 Jul 2025 15:22:25 -0400 Subject: [PATCH 1013/1268] sidebar index class context menu: change order [feenkcom/gtoolkit#4628] --- src/GToolkit-Coder-UI/Class.extension.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/Class.extension.st b/src/GToolkit-Coder-UI/Class.extension.st index 4cf0e2cf8..a7dad1de2 100644 --- a/src/GToolkit-Coder-UI/Class.extension.st +++ b/src/GToolkit-Coder-UI/Class.extension.st @@ -27,7 +27,7 @@ Class >> gtCoderSidebarIndexBrowseReferencesFrom: aGtCoderClassesTreeElement [ { #category : #'*GToolkit-Coder-UI' } Class >> gtCoderSidebarIndexCopyClassNameFrom: aGtCoderClassesTreeElement [ - + ^ BrMenuActionItem new icon: BrGlamorousVectorIcons clipboard label: 'Copy class name' From 392181b076ad17a947e4d0795954f9c43913e66f Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Fri, 25 Jul 2025 20:21:14 -0500 Subject: [PATCH 1014/1268] Start big method coder --- .../GtPharoBigMethodCoder.extension.st | 8 +++++ .../GtPharoBigMethodCoderViewModel.class.st | 10 +++++++ ...ethodExpandableSourceCoderElement.class.st | 16 ++++++++++ ...gMethodExpandedSourceCoderElement.class.st | 30 +++++++++++++++++++ .../GtCoderClassesTreeElement.class.st | 18 ----------- 5 files changed, 64 insertions(+), 18 deletions(-) create mode 100644 src/GToolkit-Coder-AddOns/GtPharoBigMethodCoder.extension.st create mode 100644 src/GToolkit-Coder-AddOns/GtPharoBigMethodCoderViewModel.class.st create mode 100644 src/GToolkit-Coder-AddOns/GtPharoBigMethodExpandableSourceCoderElement.class.st create mode 100644 src/GToolkit-Coder-AddOns/GtPharoBigMethodExpandedSourceCoderElement.class.st diff --git a/src/GToolkit-Coder-AddOns/GtPharoBigMethodCoder.extension.st b/src/GToolkit-Coder-AddOns/GtPharoBigMethodCoder.extension.st new file mode 100644 index 000000000..b412d93ac --- /dev/null +++ b/src/GToolkit-Coder-AddOns/GtPharoBigMethodCoder.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #GtPharoBigMethodCoder } + +{ #category : #'*GToolkit-Coder-AddOns' } +GtPharoBigMethodCoder >> asCoderViewModel [ + ^ GtPharoBigMethodCoderViewModel new + coder: self; + yourself +] diff --git a/src/GToolkit-Coder-AddOns/GtPharoBigMethodCoderViewModel.class.st b/src/GToolkit-Coder-AddOns/GtPharoBigMethodCoderViewModel.class.st new file mode 100644 index 000000000..591846117 --- /dev/null +++ b/src/GToolkit-Coder-AddOns/GtPharoBigMethodCoderViewModel.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtPharoBigMethodCoderViewModel, + #superclass : #GtPharoMethodCoderViewModel, + #category : #'GToolkit-Coder-AddOns-Big Methods' +} + +{ #category : #'as yet unclassified' } +GtPharoBigMethodCoderViewModel >> elementClass [ + ^ GtPharoBigMethodExpandableSourceCoderElement +] diff --git a/src/GToolkit-Coder-AddOns/GtPharoBigMethodExpandableSourceCoderElement.class.st b/src/GToolkit-Coder-AddOns/GtPharoBigMethodExpandableSourceCoderElement.class.st new file mode 100644 index 000000000..56c09f13e --- /dev/null +++ b/src/GToolkit-Coder-AddOns/GtPharoBigMethodExpandableSourceCoderElement.class.st @@ -0,0 +1,16 @@ +Class { + #name : #GtPharoBigMethodExpandableSourceCoderElement, + #superclass : #GtExpandableMethodCoderElement, + #category : #'GToolkit-Coder-AddOns-Big Methods' +} + +{ #category : #'private - instance creation' } +GtPharoBigMethodExpandableSourceCoderElement >> newExpandedElement [ + | anExpandedElement | + anExpandedElement := GtPharoBigMethodExpandedSourceCoderElement new. + + textualCoderViewModel + ifNotNil: [ :aCoder | self assignExpandedCoder: aCoder to: anExpandedElement ]. + + ^ anExpandedElement +] diff --git a/src/GToolkit-Coder-AddOns/GtPharoBigMethodExpandedSourceCoderElement.class.st b/src/GToolkit-Coder-AddOns/GtPharoBigMethodExpandedSourceCoderElement.class.st new file mode 100644 index 000000000..82cae95d8 --- /dev/null +++ b/src/GToolkit-Coder-AddOns/GtPharoBigMethodExpandedSourceCoderElement.class.st @@ -0,0 +1,30 @@ +Class { + #name : #GtPharoBigMethodExpandedSourceCoderElement, + #superclass : #GtSourceCoderExpandedContentElement, + #instVars : [ + 'label', + 'selectorLabel' + ], + #category : #'GToolkit-Coder-AddOns-Big Methods' +} + +{ #category : #initialization } +GtPharoBigMethodExpandedSourceCoderElement >> initialize [ + super initialize. + selectorLabel := BlAttributedTextElement new + id: GtSourceCoderCollapsedTextId; + editorMeasurement; + bold; + glamorousCodeFont; + foreground: self theme label defaultTextForeground; + text: 'selector' asRopedText. + label := BlAttributedTextElement new + editorMeasurement; + italic; + glamorousCodeFont; + foreground: self theme label defaultTextForeground; + text: 'Large Method. Use inspect button to see source' asRopedText. + self removeChild: editorElement. + self addChildFirst: label. + self addChildFirst: selectorLabel +] diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index d0e7f7aaf..b582828a9 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -147,24 +147,6 @@ GtCoderClassesTreeElement >> contextMenuForSeveralItems: someClasses [ ^ menu ] -{ #category : #initialization } -GtCoderClassesTreeElement >> convertToSiblingSubmenuFor: aClass siblings: aCollection [ - | submenu | - submenu := BrMenuExplicit new. - submenu - stencil: [ GtRefactoringsWithInputPreviewElement - elementForRefactoring: [ :each | - GtChildrenToSiblingsRefactoring - name: each - class: aClass - subclasses: aCollection ] - labeled: 'Superclass: ' - initialValue: 'NewClass' - from: self - beforeApplyingDo: [ submenu hideAll ] ]. - ^ submenu -] - { #category : #'private - drag and drop' } GtCoderClassesTreeElement >> createClassDragHandler [ ^ BlDragHandler new From 6ad72756a133dbb42459620fbe995bed18b7510d Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Sun, 27 Jul 2025 14:46:09 -0500 Subject: [PATCH 1015/1268] Big method coder working --- ...gMethodExpandedSourceCoderElement.class.st | 40 ++++++++++++++++--- 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtPharoBigMethodExpandedSourceCoderElement.class.st b/src/GToolkit-Coder-AddOns/GtPharoBigMethodExpandedSourceCoderElement.class.st index 82cae95d8..1f623066e 100644 --- a/src/GToolkit-Coder-AddOns/GtPharoBigMethodExpandedSourceCoderElement.class.st +++ b/src/GToolkit-Coder-AddOns/GtPharoBigMethodExpandedSourceCoderElement.class.st @@ -10,6 +10,7 @@ Class { { #category : #initialization } GtPharoBigMethodExpandedSourceCoderElement >> initialize [ + | coderText inspectIt | super initialize. selectorLabel := BlAttributedTextElement new id: GtSourceCoderCollapsedTextId; @@ -18,13 +19,40 @@ GtPharoBigMethodExpandedSourceCoderElement >> initialize [ glamorousCodeFont; foreground: self theme label defaultTextForeground; text: 'selector' asRopedText. - label := BlAttributedTextElement new - editorMeasurement; - italic; - glamorousCodeFont; - foreground: self theme label defaultTextForeground; - text: 'Large Method. Use inspect button to see source' asRopedText. + inspectIt := 'Inspect it' asRopedText bold. + coderText := 'This is a large method. ' asRopedText. + coderText + attribute: (GtButtonAttribute new + beAppend; + stencil: [ BrButton new + aptitude: BrGlamorousLinkSquaredButtonWithLabelAptitude new; + beSmallSize; + margin: (BlInsets + top: 1 + left: 0 + bottom: 0 + right: 0); + padding: (BlInsets + top: 3 + left: 5 + bottom: 3 + right: 5); + label: 'Inspect it'; + action: [ :aButton | aButton phlow spawnObject: self textualCoderViewModel methodReference ] ]). + coderText := coderText , ' to see source' asRopedText. + label := BrEditor new + aptitude: (BrGlamorousRegularEditorAptitude new + glamorousCodeFont; + foreground: self theme label defaultTextForeground); + text: coderText. self removeChild: editorElement. self addChildFirst: label. self addChildFirst: selectorLabel ] + +{ #category : #'as yet unclassified' } +GtPharoBigMethodExpandedSourceCoderElement >> onPostTextualCoderViewModelChanged [ + super onPostTextualCoderViewModelChanged. + textualCoderViewModel + ifNotNil: [ selectorLabel text: textualCoderViewModel coder selector asRopedText ] +] From 7d95e6c5e3d698c5dca4634b9785705b1d47a8b6 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Sun, 27 Jul 2025 21:05:07 -0500 Subject: [PATCH 1016/1268] Fix big method coder package location --- .../GtPharoBigMethodCoderViewModel.class.st | 10 ---- ...ethodExpandableSourceCoderElement.class.st | 16 ----- ...gMethodExpandedSourceCoderElement.class.st | 58 ------------------- 3 files changed, 84 deletions(-) delete mode 100644 src/GToolkit-Coder-AddOns/GtPharoBigMethodCoderViewModel.class.st delete mode 100644 src/GToolkit-Coder-AddOns/GtPharoBigMethodExpandableSourceCoderElement.class.st delete mode 100644 src/GToolkit-Coder-AddOns/GtPharoBigMethodExpandedSourceCoderElement.class.st diff --git a/src/GToolkit-Coder-AddOns/GtPharoBigMethodCoderViewModel.class.st b/src/GToolkit-Coder-AddOns/GtPharoBigMethodCoderViewModel.class.st deleted file mode 100644 index 591846117..000000000 --- a/src/GToolkit-Coder-AddOns/GtPharoBigMethodCoderViewModel.class.st +++ /dev/null @@ -1,10 +0,0 @@ -Class { - #name : #GtPharoBigMethodCoderViewModel, - #superclass : #GtPharoMethodCoderViewModel, - #category : #'GToolkit-Coder-AddOns-Big Methods' -} - -{ #category : #'as yet unclassified' } -GtPharoBigMethodCoderViewModel >> elementClass [ - ^ GtPharoBigMethodExpandableSourceCoderElement -] diff --git a/src/GToolkit-Coder-AddOns/GtPharoBigMethodExpandableSourceCoderElement.class.st b/src/GToolkit-Coder-AddOns/GtPharoBigMethodExpandableSourceCoderElement.class.st deleted file mode 100644 index 56c09f13e..000000000 --- a/src/GToolkit-Coder-AddOns/GtPharoBigMethodExpandableSourceCoderElement.class.st +++ /dev/null @@ -1,16 +0,0 @@ -Class { - #name : #GtPharoBigMethodExpandableSourceCoderElement, - #superclass : #GtExpandableMethodCoderElement, - #category : #'GToolkit-Coder-AddOns-Big Methods' -} - -{ #category : #'private - instance creation' } -GtPharoBigMethodExpandableSourceCoderElement >> newExpandedElement [ - | anExpandedElement | - anExpandedElement := GtPharoBigMethodExpandedSourceCoderElement new. - - textualCoderViewModel - ifNotNil: [ :aCoder | self assignExpandedCoder: aCoder to: anExpandedElement ]. - - ^ anExpandedElement -] diff --git a/src/GToolkit-Coder-AddOns/GtPharoBigMethodExpandedSourceCoderElement.class.st b/src/GToolkit-Coder-AddOns/GtPharoBigMethodExpandedSourceCoderElement.class.st deleted file mode 100644 index 1f623066e..000000000 --- a/src/GToolkit-Coder-AddOns/GtPharoBigMethodExpandedSourceCoderElement.class.st +++ /dev/null @@ -1,58 +0,0 @@ -Class { - #name : #GtPharoBigMethodExpandedSourceCoderElement, - #superclass : #GtSourceCoderExpandedContentElement, - #instVars : [ - 'label', - 'selectorLabel' - ], - #category : #'GToolkit-Coder-AddOns-Big Methods' -} - -{ #category : #initialization } -GtPharoBigMethodExpandedSourceCoderElement >> initialize [ - | coderText inspectIt | - super initialize. - selectorLabel := BlAttributedTextElement new - id: GtSourceCoderCollapsedTextId; - editorMeasurement; - bold; - glamorousCodeFont; - foreground: self theme label defaultTextForeground; - text: 'selector' asRopedText. - inspectIt := 'Inspect it' asRopedText bold. - coderText := 'This is a large method. ' asRopedText. - coderText - attribute: (GtButtonAttribute new - beAppend; - stencil: [ BrButton new - aptitude: BrGlamorousLinkSquaredButtonWithLabelAptitude new; - beSmallSize; - margin: (BlInsets - top: 1 - left: 0 - bottom: 0 - right: 0); - padding: (BlInsets - top: 3 - left: 5 - bottom: 3 - right: 5); - label: 'Inspect it'; - action: [ :aButton | aButton phlow spawnObject: self textualCoderViewModel methodReference ] ]). - coderText := coderText , ' to see source' asRopedText. - label := BrEditor new - aptitude: (BrGlamorousRegularEditorAptitude new - glamorousCodeFont; - foreground: self theme label defaultTextForeground); - text: coderText. - self removeChild: editorElement. - self addChildFirst: label. - self addChildFirst: selectorLabel -] - -{ #category : #'as yet unclassified' } -GtPharoBigMethodExpandedSourceCoderElement >> onPostTextualCoderViewModelChanged [ - super onPostTextualCoderViewModelChanged. - textualCoderViewModel - ifNotNil: [ selectorLabel text: textualCoderViewModel coder selector asRopedText ] -] From 7399d9d6288b0d938671cabec5f39112014f0df5 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 28 Jul 2025 10:51:10 -0400 Subject: [PATCH 1017/1268] sidebar index class context menu: make it extensible for several classes selection[feenkcom/gtoolkit#4628] --- src/GToolkit-Coder-UI/Class.extension.st | 20 +++++++++++++ .../GtCoderClassesTreeElement.class.st | 30 ++++++++++++------- 2 files changed, 39 insertions(+), 11 deletions(-) diff --git a/src/GToolkit-Coder-UI/Class.extension.st b/src/GToolkit-Coder-UI/Class.extension.st index a7dad1de2..82d84d25c 100644 --- a/src/GToolkit-Coder-UI/Class.extension.st +++ b/src/GToolkit-Coder-UI/Class.extension.st @@ -15,6 +15,16 @@ Class >> gtCoderSidebarIndexBrowseClassFrom: aGtCoderClassesTreeElement [ action: [ aGtCoderClassesTreeElement phlow spawnObject: self ] ] +{ #category : #'*GToolkit-Coder-UI' } +Class >> gtCoderSidebarIndexBrowseClasses: someClasses referencesFrom: aGtCoderClassesTreeElement [ + + ^ BrMenuActionItem new + icon: BrGlamorousVectorIcons empty + label: 'Browse references' + preview: ('{1} classes' format: { someClasses size }); + action: [ aGtCoderClassesTreeElement browseSeveralReferencesTo: someClasses ] +] + { #category : #'*GToolkit-Coder-UI' } Class >> gtCoderSidebarIndexBrowseReferencesFrom: aGtCoderClassesTreeElement [ @@ -65,6 +75,16 @@ Class >> gtCoderSidebarIndexRemoveClassFrom: aGtCoderClassesTreeElement [ submenu: (aGtCoderClassesTreeElement removeClassSubmenuFor: self) ] +{ #category : #'*GToolkit-Coder-UI' } +Class >> gtCoderSidebarIndexRemoveClasses: someClasses from: aGtCoderClassesTreeElement [ + + ^ BrMenuSubmenuItem new + icon: BrGlamorousVectorIcons remove + label: 'Remove classes' + preview: ('{1} classes' format: { someClasses size }); + submenu: (aGtCoderClassesTreeElement removeSeveralClassesSubmenuFor: someClasses) +] + { #category : #'*GToolkit-Coder-UI' } Class >> gtCoderSidebarIndexRenameClassFrom: aGtCoderClassesTreeElement [ diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index 84b10a421..a25d3d3e2 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -128,17 +128,25 @@ GtCoderClassesTreeElement >> contextMenuForOneItem: aClass [ { #category : #initialization } GtCoderClassesTreeElement >> contextMenuForSeveralItems: someClasses [ - | menu countLabel | - menu := BrMenuItems new. - countLabel := '{1} classes' format: { someClasses size }. - menu - addItemLabel: (self createLabel: 'Browse references' description: countLabel) - action: [ self browseSeveralReferencesTo: someClasses ]. - menu - addItem: (BrMenuSubmenuItem new - label: (self createLabel: 'Remove classes' description: countLabel); - submenu: (self removeSeveralClassesSubmenuFor: someClasses)). - ^ menu + | somePragmas someMenuItems | + somePragmas := Pragma + allNamed: #gtCoderSidebarIndexSeveralSubjectsContextMenuItem: + in: Class + sortedByArgument: 1. + someMenuItems := somePragmas + collect: [ :eachPragma | + [ Class perform: eachPragma methodSelector with: someClasses with: self ] + onErrorDo: [ :anException | + | frozenException | + frozenException := GtSystemUtility freeze: anException. + frozenException tag: eachPragma. + anException + return: (BrMenuActionItem new + label: 'Error' preview: frozenException messageText; + action: [ :anElement :aButtonModel :anEvent | anElement phlow spawnObject: frozenException ]) ] ] + thenSelect: #isNotNil. + + ^ BrMenuItems new addItems: someMenuItems ] { #category : #'private - drag and drop' } From 175b297c3c456a341d8a3acd392a4d4cc2e9b461 Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Mon, 28 Jul 2025 17:09:22 +0200 Subject: [PATCH 1018/1268] move extension to the big method coder package --- .../GtPharoBigMethodCoder.extension.st | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 src/GToolkit-Coder-AddOns/GtPharoBigMethodCoder.extension.st diff --git a/src/GToolkit-Coder-AddOns/GtPharoBigMethodCoder.extension.st b/src/GToolkit-Coder-AddOns/GtPharoBigMethodCoder.extension.st deleted file mode 100644 index b412d93ac..000000000 --- a/src/GToolkit-Coder-AddOns/GtPharoBigMethodCoder.extension.st +++ /dev/null @@ -1,8 +0,0 @@ -Extension { #name : #GtPharoBigMethodCoder } - -{ #category : #'*GToolkit-Coder-AddOns' } -GtPharoBigMethodCoder >> asCoderViewModel [ - ^ GtPharoBigMethodCoderViewModel new - coder: self; - yourself -] From 227ed944bf8e8f147165a1dfd63e4d85df3a7fdf Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 29 Jul 2025 00:08:16 -0400 Subject: [PATCH 1019/1268] sidebar index class context menu: set menu definition object [feenkcom/gtoolkit#4630] --- .../GtCoderActionsElement.class.st | 2 +- .../GtCoderClassesTreeElement.class.st | 8 ++++++-- .../GtCoderContextMenuAction.extension.st | 5 +++++ ...tCoderExplicitContextMenuItemAction.extension.st | 13 +++++++++---- .../GtCoderActionClosureDefinition.class.st | 9 +++++++++ 5 files changed, 30 insertions(+), 7 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st index 3dca80380..cc81dcd76 100644 --- a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st @@ -56,7 +56,7 @@ GtCoderActionsElement >> initializeAltClick: aGtCoderAction element: anElement [ anElement viewModel when: BlClickEvent do: [ :anEvent | - anEvent modifiers isAlt + anEvent modifiers isSoftAltOnly ifTrue: [ anEvent consumed: true. anEvent target phlow spawnObject: aGtCoderAction actionDefinition ] ] ] diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index a25d3d3e2..f02383fb3 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -112,7 +112,9 @@ GtCoderClassesTreeElement >> contextMenuForOneItem: aClass [ sortedByArgument: 1. someMenuItems := somePragmas collect: [ :eachPragma | - [ aClass perform: eachPragma methodSelector with: self ] + [ | aMenuItem | + aMenuItem := aClass perform: eachPragma methodSelector with: self. + aMenuItem definition: [ eachPragma method ]. ] onErrorDo: [ :anException | | frozenException | frozenException := GtSystemUtility freeze: anException. @@ -135,7 +137,9 @@ GtCoderClassesTreeElement >> contextMenuForSeveralItems: someClasses [ sortedByArgument: 1. someMenuItems := somePragmas collect: [ :eachPragma | - [ Class perform: eachPragma methodSelector with: someClasses with: self ] + [ | aMenuItem | + aMenuItem := Class perform: eachPragma methodSelector with: someClasses with: self. + aMenuItem definition: [ eachPragma method ]. ] onErrorDo: [ :anException | | frozenException | frozenException := GtSystemUtility freeze: anException. diff --git a/src/GToolkit-Coder-UI/GtCoderContextMenuAction.extension.st b/src/GToolkit-Coder-UI/GtCoderContextMenuAction.extension.st index c1fd537f6..df3c253c0 100644 --- a/src/GToolkit-Coder-UI/GtCoderContextMenuAction.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderContextMenuAction.extension.st @@ -6,5 +6,10 @@ GtCoderContextMenuAction >> asBrMenuItemForCoderElement: aTextualCoderEditorElem textualCoderEditorElement: aTextualCoderEditorElement; coderContextMenuAction: self; disableIf: [ self isDisabled ]; + definition: [ self allowAltClick + ifTrue: [ self actionDefinition isDefined + ifTrue: [ self actionDefinition ] + ifFalse: [ nil ] ] + ifFalse: [ nil ] ]; yourself ] diff --git a/src/GToolkit-Coder-UI/GtCoderExplicitContextMenuItemAction.extension.st b/src/GToolkit-Coder-UI/GtCoderExplicitContextMenuItemAction.extension.st index 567cc78e4..d12bc3a93 100644 --- a/src/GToolkit-Coder-UI/GtCoderExplicitContextMenuItemAction.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderExplicitContextMenuItemAction.extension.st @@ -3,8 +3,13 @@ Extension { #name : #GtCoderExplicitContextMenuItemAction } { #category : #'*GToolkit-Coder-UI' } GtCoderExplicitContextMenuItemAction >> asBrMenuItemForCoderElement: aTextualCoderEditorElement [ - ^ menuItemBlock - cull: aTextualCoderEditorElement - cull: aTextualCoderEditorElement textualCoderViewModel - cull: self + | aMenuItem | + aMenuItem := menuItemBlock + cull: aTextualCoderEditorElement + cull: aTextualCoderEditorElement textualCoderViewModel + cull: self. + + aMenuItem ifNotNil: [ + menuItemBlock isClosure ifTrue: [ + aMenuItem definition: [ menuItemBlock blocDefiningMethod ] ] ] ] diff --git a/src/GToolkit-Coder/GtCoderActionClosureDefinition.class.st b/src/GToolkit-Coder/GtCoderActionClosureDefinition.class.st index 90000c1df..e4e92d4ce 100644 --- a/src/GToolkit-Coder/GtCoderActionClosureDefinition.class.st +++ b/src/GToolkit-Coder/GtCoderActionClosureDefinition.class.st @@ -17,6 +17,15 @@ GtCoderActionClosureDefinition >> closure: aBlock [ closure := aBlock ] +{ #category : #'gt - extensions' } +GtCoderActionClosureDefinition >> gtClosureVariablesFor: aView [ + + ^ aView forward + title: 'Variables'; + object: [ closure ]; + view: #gtVariablesFor: +] + { #category : #'gt - extensions' } GtCoderActionClosureDefinition >> gtSourceCodeFor: aView [ From b247a0f3e9e17da1a212bd8f1a8b04ccc87dc5ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Wed, 30 Jul 2025 17:06:14 +0200 Subject: [PATCH 1020/1268] Update package dependencies for Pharo 12 [feenkcom/gtoolkit#3736] --- .../ManifestGToolkitSearchFilters.class.st | 5 ++++- .../GtCompositeVariablesBindings.class.st | 2 +- .../GtEmptyVariablesBindings.class.st | 2 +- .../GtGlobalVariablesBindings.class.st | 2 +- .../ManifestGToolkitVariableBindings.class.st | 5 ++++- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/GToolkit-SearchFilters/ManifestGToolkitSearchFilters.class.st b/src/GToolkit-SearchFilters/ManifestGToolkitSearchFilters.class.st index ab27ce828..0d0b342a4 100644 --- a/src/GToolkit-SearchFilters/ManifestGToolkitSearchFilters.class.st +++ b/src/GToolkit-SearchFilters/ManifestGToolkitSearchFilters.class.st @@ -14,5 +14,8 @@ ManifestGToolkitSearchFilters class >> mustOnlyDependOn [ 'Collections-Unordered'. 'Futures'. 'Kernel' - } + }, (self + forPharo12: [{ + 'Kernel-CodeModel'.}] + forPharo11AndPharo10: [{}]) ] diff --git a/src/GToolkit-VariableBindings/GtCompositeVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtCompositeVariablesBindings.class.st index ed057ddb4..fc8094c5f 100644 --- a/src/GToolkit-VariableBindings/GtCompositeVariablesBindings.class.st +++ b/src/GToolkit-VariableBindings/GtCompositeVariablesBindings.class.st @@ -6,7 +6,7 @@ Class { #instVars : [ 'bindings' ], - #category : 'GToolkit-VariableBindings-Bindings' + #category : #'GToolkit-VariableBindings-Bindings' } { #category : #comparing } diff --git a/src/GToolkit-VariableBindings/GtEmptyVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtEmptyVariablesBindings.class.st index ef15a7ad2..a9bc2c770 100644 --- a/src/GToolkit-VariableBindings/GtEmptyVariablesBindings.class.st +++ b/src/GToolkit-VariableBindings/GtEmptyVariablesBindings.class.st @@ -3,7 +3,7 @@ Class { #superclass : #Object, #traits : 'TGtVariablesBindings', #classTraits : 'TGtVariablesBindings classTrait', - #category : 'GToolkit-VariableBindings-Bindings' + #category : #'GToolkit-VariableBindings-Bindings' } { #category : #comparing } diff --git a/src/GToolkit-VariableBindings/GtGlobalVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtGlobalVariablesBindings.class.st index 78739860b..ea5160296 100644 --- a/src/GToolkit-VariableBindings/GtGlobalVariablesBindings.class.st +++ b/src/GToolkit-VariableBindings/GtGlobalVariablesBindings.class.st @@ -3,7 +3,7 @@ Class { #superclass : #Object, #traits : 'TGtVariablesBindings', #classTraits : 'TGtVariablesBindings classTrait', - #category : 'GToolkit-VariableBindings-Bindings' + #category : #'GToolkit-VariableBindings-Bindings' } { #category : #comparing } diff --git a/src/GToolkit-VariableBindings/ManifestGToolkitVariableBindings.class.st b/src/GToolkit-VariableBindings/ManifestGToolkitVariableBindings.class.st index f66b3720f..c2c40d0d8 100644 --- a/src/GToolkit-VariableBindings/ManifestGToolkitVariableBindings.class.st +++ b/src/GToolkit-VariableBindings/ManifestGToolkitVariableBindings.class.st @@ -13,5 +13,8 @@ ManifestGToolkitVariableBindings class >> mustOnlyDependOn [ 'Collections-Sequenceable'. 'Collections-Unordered'. 'Kernel' - } + }, (self + forPharo12: [{ + 'Kernel-CodeModel'.}] + forPharo11AndPharo10: [{}]) ] From 467538976791fc8594f35598cc8dce1db5dbb967 Mon Sep 17 00:00:00 2001 From: Veit Heller Date: Thu, 31 Jul 2025 16:04:26 +0200 Subject: [PATCH 1021/1268] Add a guard in context menu against entries that return nil --- src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index f02383fb3..1146445ee 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -112,9 +112,9 @@ GtCoderClassesTreeElement >> contextMenuForOneItem: aClass [ sortedByArgument: 1. someMenuItems := somePragmas collect: [ :eachPragma | - [ | aMenuItem | - aMenuItem := aClass perform: eachPragma methodSelector with: self. - aMenuItem definition: [ eachPragma method ]. ] + [ | aMenuItem | + aMenuItem := aClass perform: eachPragma methodSelector with: self. + aMenuItem ifNotNil: [ aMenuItem definition: [ eachPragma method ] ] ] onErrorDo: [ :anException | | frozenException | frozenException := GtSystemUtility freeze: anException. From e093289158057f2513eddf65e66d5cd3e568134c Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Thu, 31 Jul 2025 09:29:52 -0500 Subject: [PATCH 1022/1268] Add guard to multiple class selection context menu --- .../GtCoderClassesTreeElement.class.st | 43 +++++++++---------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index 1146445ee..d26a88846 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -112,17 +112,9 @@ GtCoderClassesTreeElement >> contextMenuForOneItem: aClass [ sortedByArgument: 1. someMenuItems := somePragmas collect: [ :eachPragma | - [ | aMenuItem | - aMenuItem := aClass perform: eachPragma methodSelector with: self. - aMenuItem ifNotNil: [ aMenuItem definition: [ eachPragma method ] ] ] - onErrorDo: [ :anException | - | frozenException | - frozenException := GtSystemUtility freeze: anException. - frozenException tag: eachPragma. - anException - return: (BrMenuActionItem new - label: 'Error' preview: frozenException messageText; - action: [ :anElement :aButtonModel :anEvent | anElement phlow spawnObject: frozenException ]) ] ] + [ (aClass perform: eachPragma methodSelector with: self) + ifNotNil: [ :aMenuItem | aMenuItem definition: [ eachPragma method ] ] ] + onErrorDo: [ :anException | self createExceptionItemFor: anException andPragma: eachPragma ] ] thenSelect: #isNotNil. ^ BrMenuItems new addItems: someMenuItems @@ -137,17 +129,12 @@ GtCoderClassesTreeElement >> contextMenuForSeveralItems: someClasses [ sortedByArgument: 1. someMenuItems := somePragmas collect: [ :eachPragma | - [ | aMenuItem | - aMenuItem := Class perform: eachPragma methodSelector with: someClasses with: self. - aMenuItem definition: [ eachPragma method ]. ] - onErrorDo: [ :anException | - | frozenException | - frozenException := GtSystemUtility freeze: anException. - frozenException tag: eachPragma. - anException - return: (BrMenuActionItem new - label: 'Error' preview: frozenException messageText; - action: [ :anElement :aButtonModel :anEvent | anElement phlow spawnObject: frozenException ]) ] ] + [ (Class + perform: eachPragma methodSelector + with: someClasses + with: self) + ifNotNil: [ :aMenuItem | aMenuItem definition: [ eachPragma method ] ] ] + onErrorDo: [ :anException | self createExceptionItemFor: anException andPragma: eachPragma ] ] thenSelect: #isNotNil. ^ BrMenuItems new addItems: someMenuItems @@ -202,6 +189,18 @@ GtCoderClassesTreeElement >> createDraggedMethodItem: aDragItem [ text: aDragItem domainObject printString ] +{ #category : #initialization } +GtCoderClassesTreeElement >> createExceptionItemFor: anException andPragma: eachPragma [ + | frozenException | + frozenException := (GtSystemUtility freeze: anException) + tag: eachPragma; + yourself. + ^ anException + return: (BrMenuActionItem new + label: 'Error' preview: frozenException messageText; + action: [ :anElement :aButtonModel :anEvent | anElement phlow spawnObject: frozenException ]) +] + { #category : #'private - context menu' } GtCoderClassesTreeElement >> createLabel: aString description: description [ ^ aString asRopedText glamorousRegularFont From e45c032eaf31bd32e0c85789d88069828f120e34 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 1 Aug 2025 07:08:13 -0400 Subject: [PATCH 1023/1268] fix explicit context menu item action [feenkcom/gtoolkit#4630] --- .../GtCoderContextMenuAction.extension.st | 20 +++++++++---------- ...ExplicitContextMenuItemAction.extension.st | 6 ++++-- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderContextMenuAction.extension.st b/src/GToolkit-Coder-UI/GtCoderContextMenuAction.extension.st index df3c253c0..f4275862b 100644 --- a/src/GToolkit-Coder-UI/GtCoderContextMenuAction.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderContextMenuAction.extension.st @@ -2,14 +2,14 @@ Extension { #name : #GtCoderContextMenuAction } { #category : #'*GToolkit-Coder-UI' } GtCoderContextMenuAction >> asBrMenuItemForCoderElement: aTextualCoderEditorElement [ - ^ GtCoderMenuActionItem new - textualCoderEditorElement: aTextualCoderEditorElement; - coderContextMenuAction: self; - disableIf: [ self isDisabled ]; - definition: [ self allowAltClick - ifTrue: [ self actionDefinition isDefined - ifTrue: [ self actionDefinition ] - ifFalse: [ nil ] ] - ifFalse: [ nil ] ]; - yourself + | aMenuItem | + aMenuItem := GtCoderMenuActionItem new + textualCoderEditorElement: aTextualCoderEditorElement; + coderContextMenuAction: self; + disableIf: [ self isDisabled ]; + yourself. + + self allowAltClick ifTrue: [ aMenuItem definition: [ self actionDefinition ] ]. + + ^ aMenuItem ] diff --git a/src/GToolkit-Coder-UI/GtCoderExplicitContextMenuItemAction.extension.st b/src/GToolkit-Coder-UI/GtCoderExplicitContextMenuItemAction.extension.st index d12bc3a93..d9719d912 100644 --- a/src/GToolkit-Coder-UI/GtCoderExplicitContextMenuItemAction.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderExplicitContextMenuItemAction.extension.st @@ -10,6 +10,8 @@ GtCoderExplicitContextMenuItemAction >> asBrMenuItemForCoderElement: aTextualCod cull: self. aMenuItem ifNotNil: [ - menuItemBlock isClosure ifTrue: [ - aMenuItem definition: [ menuItemBlock blocDefiningMethod ] ] ] + self allowAltClick ifTrue: [ aMenuItem definition: [ self actionDefinition ] ]. + aMenuItem disableIf: [ self isDisabled ] ]. + + ^ aMenuItem ] From 71e2536c8d3c470628dcc2b7680b3e40b5d73f46 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 1 Aug 2025 14:24:31 -0400 Subject: [PATCH 1024/1268] use coder tools instead of coder elements [feenkcom/gtoolkit#4588] --- .../Behavior.extension.st | 14 ++++++-- .../CompiledMethod.extension.st | 16 ++++++--- .../Object.extension.st | 21 ++++++++++++ .../Package.extension.st | 15 +++++++-- .../ProtoObject.extension.st | 12 +++++-- .../RPackage.extension.st | 15 +++++++-- src/GToolkit-Coder-UI/Behavior.extension.st | 16 +++------ .../GtClassCoderTool.class.st | 12 +++---- .../GtObjectCoderTool.class.st | 33 +++++++++++++++++++ .../GtReadyCoderTool.class.st | 10 ++++-- src/GToolkit-Coder/Behavior.extension.st | 8 +++-- 11 files changed, 136 insertions(+), 36 deletions(-) create mode 100644 src/GToolkit-Coder-Extensions/Object.extension.st create mode 100644 src/GToolkit-Coder-UI/GtObjectCoderTool.class.st diff --git a/src/GToolkit-Coder-Extensions/Behavior.extension.st b/src/GToolkit-Coder-Extensions/Behavior.extension.st index 473d3dc55..3e64b2231 100644 --- a/src/GToolkit-Coder-Extensions/Behavior.extension.st +++ b/src/GToolkit-Coder-Extensions/Behavior.extension.st @@ -2,12 +2,22 @@ Extension { #name : #Behavior } { #category : #'*GToolkit-Coder-Extensions' } Behavior >> gtBrowse [ - ^ (GtCoderElement forClass: self) openInPager maximized + ^ BlSpace new + withSceneDriller; + inPager: [ GtClassCoderTool forClass: self ]; + title: self name; + icon: BrGlamorousVectorIcons browse; + show ] { #category : #'*GToolkit-Coder-Extensions' } Behavior >> gtBrowseFrom: anElement [ - ^ ((GtCoderElement forClass: self) asElement openInPagerFrom: anElement) maximized + ^ BlSpace new + withSceneDriller; + inPager: [ GtClassCoderTool forClass: self ]; + title: self name; + icon: BrGlamorousVectorIcons browse; + showFrom: anElement ] { #category : #'*GToolkit-Coder-Extensions' } diff --git a/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st b/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st index fcab20807..2dcde2c6f 100644 --- a/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st +++ b/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st @@ -2,14 +2,22 @@ Extension { #name : #CompiledMethod } { #category : #'*GToolkit-Coder-Extensions' } CompiledMethod >> gtBrowse [ - ^ (GtCoderElement forMethod: self) - openInPager - maximized + ^ BlSpace new + withSceneDriller; + inPager: [ GtMethodCoderTool compiledMethod: self ]; + title: self methodClass name; + icon: BrGlamorousVectorIcons browse; + show ] { #category : #'*GToolkit-Coder-Extensions' } CompiledMethod >> gtBrowseFrom: anElement [ - ^ ((GtCoderElement forMethod: self) asElement openInPagerFrom: anElement) maximized + ^ BlSpace new + withSceneDriller; + inPager: [ GtMethodCoderTool compiledMethod: self ]; + title: self methodClass name; + icon: BrGlamorousVectorIcons browse; + showFrom: anElement ] { #category : #'*GToolkit-Coder-Extensions' } diff --git a/src/GToolkit-Coder-Extensions/Object.extension.st b/src/GToolkit-Coder-Extensions/Object.extension.st new file mode 100644 index 000000000..71e1a4c3f --- /dev/null +++ b/src/GToolkit-Coder-Extensions/Object.extension.st @@ -0,0 +1,21 @@ +Extension { #name : #Object } + +{ #category : #'*GToolkit-Coder-Extensions' } +Object >> gtBrowse [ + ^ BlSpace new + withSceneDriller; + inPager: [ GtObjectCoderTool forObject: self ]; + title: self gtDisplayString; + icon: BrGlamorousVectorIcons browse; + show +] + +{ #category : #'*GToolkit-Coder-Extensions' } +Object >> gtBrowseFrom: anElement [ + ^ BlSpace new + withSceneDriller; + inPager: [ GtObjectCoderTool forObject: self ]; + title: self gtDisplayString; + icon: BrGlamorousVectorIcons browse; + showFrom: anElement +] diff --git a/src/GToolkit-Coder-Extensions/Package.extension.st b/src/GToolkit-Coder-Extensions/Package.extension.st index 4a51b68cb..f473a3e51 100644 --- a/src/GToolkit-Coder-Extensions/Package.extension.st +++ b/src/GToolkit-Coder-Extensions/Package.extension.st @@ -35,13 +35,22 @@ Package >> gtBaselinesFor: aView [ { #category : #'*GToolkit-Coder-Extensions' } Package >> gtBrowse [ - ^ ((GtCoderElement forPackage: self) - openInPager) maximized + ^ BlSpace new + withSceneDriller; + inPager: [ GtCoderElement forPackage: self ]; + title: self packageName; + icon: BrGlamorousVectorIcons browse; + show ] { #category : #'*GToolkit-Coder-Extensions' } Package >> gtBrowseFrom: anElement [ - ^ ((GtCoderElement forPackage: self) asElement openInPagerFrom: anElement) maximized + ^ BlSpace new + withSceneDriller; + inPager: [ GtPackageCoderTool package: self ]; + title: self packageName; + icon: BrGlamorousVectorIcons browse; + showFrom: anElement ] { #category : #'*GToolkit-Coder-Extensions' } diff --git a/src/GToolkit-Coder-Extensions/ProtoObject.extension.st b/src/GToolkit-Coder-Extensions/ProtoObject.extension.st index e60f3aa89..ba4153021 100644 --- a/src/GToolkit-Coder-Extensions/ProtoObject.extension.st +++ b/src/GToolkit-Coder-Extensions/ProtoObject.extension.st @@ -2,10 +2,18 @@ Extension { #name : #ProtoObject } { #category : #'*GToolkit-Coder-Extensions' } ProtoObject >> gtBrowse [ - ^ (GtCoderElement forObject: self) openInPager maximized + ^ BlSpace new + withSceneDriller; + inPager: [ GtObjectCoderTool forObject: self ]; + icon: BrGlamorousVectorIcons browse; + show ] { #category : #'*GToolkit-Coder-Extensions' } ProtoObject >> gtBrowseFrom: anElement [ - ^ ((GtCoderElement forObject: self) asElement openInPagerFrom: anElement) maximized + ^ BlSpace new + withSceneDriller; + inPager: [ GtObjectCoderTool forObject: self ]; + icon: BrGlamorousVectorIcons browse; + showFrom: anElement ] diff --git a/src/GToolkit-Coder-Extensions/RPackage.extension.st b/src/GToolkit-Coder-Extensions/RPackage.extension.st index ec6d5740b..c4b73707e 100644 --- a/src/GToolkit-Coder-Extensions/RPackage.extension.st +++ b/src/GToolkit-Coder-Extensions/RPackage.extension.st @@ -35,13 +35,22 @@ RPackage >> gtBaselinesFor: aView [ { #category : #'*GToolkit-Coder-Extensions' } RPackage >> gtBrowse [ - ^ ((GtCoderElement forPackage: self) - openInPager) maximized + ^ BlSpace new + withSceneDriller; + inPager: [ GtPackageCoderTool package: self ]; + title: self packageName; + icon: BrGlamorousVectorIcons browse; + show ] { #category : #'*GToolkit-Coder-Extensions' } RPackage >> gtBrowseFrom: anElement [ - ^ ((GtCoderElement forPackage: self) asElement openInPagerFrom: anElement) maximized + ^ BlSpace new + withSceneDriller; + inPager: [ GtPackageCoderTool package: self ]; + title: self packageName; + icon: BrGlamorousVectorIcons browse; + showFrom: anElement ] { #category : #'*GToolkit-Coder-Extensions' } diff --git a/src/GToolkit-Coder-UI/Behavior.extension.st b/src/GToolkit-Coder-UI/Behavior.extension.st index a412fd79d..77fa80acd 100644 --- a/src/GToolkit-Coder-UI/Behavior.extension.st +++ b/src/GToolkit-Coder-UI/Behavior.extension.st @@ -3,23 +3,17 @@ Extension { #name : #Behavior } { #category : #'*GToolkit-Coder-UI' } Behavior >> gtBrowseButtonFor: anAction [ - ^ anAction button priority: 1; tooltip: 'Browse class'; icon: BrGlamorousVectorIcons emphasizedBrowse; action: [ :aButton | - aButton phlow - spawnTool: (GtPhlowExplicitTool new - name: self gtDisplayString; - stencil: [ - | aCoder | - aButton phlow firstParentCoderNavigationModel - coderDo: [ :oldCoder | - aCoder := GtCoderElement forCoder: oldCoder asNewCoderModelWithSameSubject ]. - aCoder ]) ]; + aButton phlow firstParentCoderNavigationModel + coderDo: [ :oldCoder | + aButton phlow + spawnTool: (GtReadyCoderTool coder: oldCoder asNewCoderModelWithSameSubject) ] ]; primaryModifierAction: [ :aButton | self gtBrowseFromButton: aButton ] - mouseCursor: BlCopyCursor new. + mouseCursor: BlCopyCursor new ] { #category : #'*GToolkit-Coder-UI' } diff --git a/src/GToolkit-Coder-UI/GtClassCoderTool.class.st b/src/GToolkit-Coder-UI/GtClassCoderTool.class.st index 33cc27737..526cb789d 100644 --- a/src/GToolkit-Coder-UI/GtClassCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtClassCoderTool.class.st @@ -17,13 +17,6 @@ GtClassCoderTool class >> observedClass: aClass [ ^ self new observedClass: aClass ] -{ #category : #'as yet unclassified' } -GtClassCoderTool >> name [ - ^ observedClass - ifNil: [super name] - ifNotNil: [ :aClass | aClass name ] -] - { #category : #converting } GtClassCoderTool >> newCoder [ ^ GtCoderElement forClass: self observedClass instanceSide @@ -44,3 +37,8 @@ GtClassCoderTool >> observedClass [ GtClassCoderTool >> observedClass: anObject [ observedClass := anObject ] + +{ #category : #'api - accessing' } +GtClassCoderTool >> title [ + ^ observedClass ifNil: [ super name ] ifNotNil: [ :aClass | aClass name ] +] diff --git a/src/GToolkit-Coder-UI/GtObjectCoderTool.class.st b/src/GToolkit-Coder-UI/GtObjectCoderTool.class.st new file mode 100644 index 000000000..7f524e837 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtObjectCoderTool.class.st @@ -0,0 +1,33 @@ +Class { + #name : #GtObjectCoderTool, + #superclass : #GtCoderTool, + #instVars : [ + 'object' + ], + #category : #'GToolkit-Coder-UI-Tools' +} + +{ #category : #'instance creation' } +GtObjectCoderTool class >> forObject: anObject [ + ^ self new object: anObject +] + +{ #category : #converting } +GtObjectCoderTool >> newCoder [ + ^ GtCoderElement forObject: self object +] + +{ #category : #accessing } +GtObjectCoderTool >> object [ + ^ object +] + +{ #category : #accessing } +GtObjectCoderTool >> object: anObject [ + object := anObject +] + +{ #category : #'api - accessing' } +GtObjectCoderTool >> title [ + ^ object gtDisplayString +] diff --git a/src/GToolkit-Coder-UI/GtReadyCoderTool.class.st b/src/GToolkit-Coder-UI/GtReadyCoderTool.class.st index 94dbb2d85..be6d4c02b 100644 --- a/src/GToolkit-Coder-UI/GtReadyCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtReadyCoderTool.class.st @@ -17,8 +17,8 @@ GtReadyCoderTool >> asElementDo: aOneArgBlock [ "Create a tool element and execute the block." | anElement | - anElement := (GtCoderElement forCoder: self coder) asElement. - ^ aOneArgBlock cull: anElement asPagerPageElement + anElement := GtCoderElement forCoder: self coder asNewCoderModelWithSameSubject. + ^ aOneArgBlock cull: anElement ] { #category : #accessing } @@ -56,3 +56,9 @@ GtReadyCoderTool >> name [ GtReadyCoderTool >> tabLook [ ^ BrGlamorousTabSwitcherWithIconAptitude ] + +{ #category : #'api - accessing' } +GtReadyCoderTool >> title [ + + ^ self coder ifNotNil: #coderName ifNil: [ super title ] +] diff --git a/src/GToolkit-Coder/Behavior.extension.st b/src/GToolkit-Coder/Behavior.extension.st index e17898314..738e3807f 100644 --- a/src/GToolkit-Coder/Behavior.extension.st +++ b/src/GToolkit-Coder/Behavior.extension.st @@ -6,6 +6,10 @@ Behavior >> gtBrowseFromButton: anElement [ anElement phlow firstParentCoderNavigationModel coderDo: [ :aCoder | - ((GtCoderElement forCoder: aCoder asNewCoderModelWithSameSubject) - openInPagerFrom: anElement) maximized ] + BlSpace new + withSceneDriller; + inPager: [ GtReadyCoderTool coder: aCoder asNewCoderModelWithSameSubject ]; + title: self printString; + icon: BrGlamorousVectorIcons browse; + showFrom: anElement ] ] From e6f2361c0732c8ffd80f275f5519e50719a5d892 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Sat, 2 Aug 2025 16:34:03 -0400 Subject: [PATCH 1025/1268] `GtCoderModel` is compatible with `BrStencil`, having `#asStencil` and `#create` methods [feenkcom/gtoolkit#4588] --- src/GToolkit-Coder-UI/GtCoderModel.extension.st | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtCoderModel.extension.st b/src/GToolkit-Coder-UI/GtCoderModel.extension.st index d32cb8cfc..13dfe8e44 100644 --- a/src/GToolkit-Coder-UI/GtCoderModel.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderModel.extension.st @@ -19,6 +19,11 @@ GtCoderModel >> asExpandedOnlyElement [ yourself ] +{ #category : #'*GToolkit-Coder-UI' } +GtCoderModel >> asStencil [ + ^ self +] + { #category : #'*GToolkit-Coder-UI' } GtCoderModel >> coderLook [ @@ -31,6 +36,11 @@ GtCoderModel >> coderLook: aLookOrBlock [ self attributeNamed: #coderLook put: aLookOrBlock ] +{ #category : #'*GToolkit-Coder-UI' } +GtCoderModel >> create [ + ^ self asElement +] + { #category : #'*GToolkit-Coder-UI' } GtCoderModel >> elementClass [ ^ GtExpandableSourceCoderElement From a2942bdf1a6e2d1d6c2772682b5a14c6b678ea01 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 5 Aug 2025 07:28:35 -0500 Subject: [PATCH 1026/1268] Insert `GtExpandableCoderViewModel` into hiearchy and push up logic. This is to better support expandable coders that shouldn't access sourceCode. --- .../GtExpandableCoderViewModel.class.st | 75 +++++++++++++++++++ ...leCoderViewModelExpansionChanged.class.st} | 6 +- .../GtExpandableSourceCoderElement.class.st | 2 +- .../GtTextualCoderViewModel.class.st | 67 +---------------- 4 files changed, 80 insertions(+), 70 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtExpandableCoderViewModel.class.st rename src/GToolkit-Coder-UI/{GtTextualCoderViewModelExpansionChanged.class.st => GtExpandableCoderViewModelExpansionChanged.class.st} (58%) diff --git a/src/GToolkit-Coder-UI/GtExpandableCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtExpandableCoderViewModel.class.st new file mode 100644 index 000000000..ace8253eb --- /dev/null +++ b/src/GToolkit-Coder-UI/GtExpandableCoderViewModel.class.st @@ -0,0 +1,75 @@ +Class { + #name : #GtExpandableCoderViewModel, + #superclass : #GtSingleCoderViewModel, + #instVars : [ + 'expanded', + 'shouldHaveHeader' + ], + #category : #'GToolkit-Coder-UI-Coder - Basic' +} + +{ #category : #'api - expansion' } +GtExpandableCoderViewModel >> collapse [ + self expanded: false +] + +{ #category : #'api - expansion' } +GtExpandableCoderViewModel >> expand [ + self expanded: true +] + +{ #category : #'api - expansion' } +GtExpandableCoderViewModel >> expanded [ + ^ expanded +] + +{ #category : #'api - expansion' } +GtExpandableCoderViewModel >> expanded: aBoolean [ + expanded = aBoolean ifTrue: [ ^ self ]. + + expanded := aBoolean. + self notifyExpansionChanged: expanded +] + +{ #category : #'api - header' } +GtExpandableCoderViewModel >> headerElementClass [ + "Return an class of an element that should represent a header of the coder. + The used element must implement {{gtClass:TGtWithTextualCoderViewModel}} trait." + + + ^ nil +] + +{ #category : #initialization } +GtExpandableCoderViewModel >> initialize [ + super initialize. + expanded := true. + shouldHaveHeader := true +] + +{ #category : #'private - notifying' } +GtExpandableCoderViewModel >> notifyExpansionChanged: aBoolean [ + self announce: (GtExpandableCoderViewModelExpansionChanged new expanded: aBoolean) +] + +{ #category : #'api - header' } +GtExpandableCoderViewModel >> shouldHaveHeader: aBoolean [ + shouldHaveHeader := aBoolean +] + +{ #category : #'api - header' } +GtExpandableCoderViewModel >> wantsHeader [ + + + ^ shouldHaveHeader and: [ self headerElementClass notNil ] +] + +{ #category : #'api - header' } +GtExpandableCoderViewModel >> withHeader [ + self shouldHaveHeader: true +] + +{ #category : #'api - header' } +GtExpandableCoderViewModel >> withoutHeader [ + self shouldHaveHeader: false +] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelExpansionChanged.class.st b/src/GToolkit-Coder-UI/GtExpandableCoderViewModelExpansionChanged.class.st similarity index 58% rename from src/GToolkit-Coder-UI/GtTextualCoderViewModelExpansionChanged.class.st rename to src/GToolkit-Coder-UI/GtExpandableCoderViewModelExpansionChanged.class.st index c338626c2..05ecce10e 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelExpansionChanged.class.st +++ b/src/GToolkit-Coder-UI/GtExpandableCoderViewModelExpansionChanged.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtTextualCoderViewModelExpansionChanged, + #name : #GtExpandableCoderViewModelExpansionChanged, #superclass : #GtTextualCoderViewModelAnnouncement, #instVars : [ 'expanded' @@ -8,11 +8,11 @@ Class { } { #category : #accessing } -GtTextualCoderViewModelExpansionChanged >> expanded [ +GtExpandableCoderViewModelExpansionChanged >> expanded [ ^ expanded ] { #category : #accessing } -GtTextualCoderViewModelExpansionChanged >> expanded: aBoolean [ +GtExpandableCoderViewModelExpansionChanged >> expanded: aBoolean [ expanded := aBoolean ] diff --git a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st index 862adabfe..13b21675f 100644 --- a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st @@ -211,7 +211,7 @@ GtExpandableSourceCoderElement >> subscribeToTextualCoderViewModel [ #unsubscribeFromTextualCoderViewModel if elements subscribe to them" textualCoderViewModel weak - when: GtTextualCoderViewModelExpansionChanged + when: GtExpandableCoderViewModelExpansionChanged send: #onViewModelExpansionChanged: to: self; when: GtTextualCoderViewModelTextChanged diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index c1706fa2c..2b577cf49 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -1,6 +1,6 @@ Class { #name : #GtTextualCoderViewModel, - #superclass : #GtSingleCoderViewModel, + #superclass : #GtExpandableCoderViewModel, #instVars : [ 'stylers', 'mainActions', @@ -8,12 +8,10 @@ Class { 'contextMenuActions', 'shortcuts', 'hasFocus', - 'expanded', 'cursors', 'selection', 'extraTextAttributes', 'styledText', - 'shouldHaveHeader', 'isTextModifiedPromise', 'completionStrategy', 'debuggerInSpace', @@ -183,11 +181,6 @@ GtTextualCoderViewModel >> astSync [ ^ self coderModel astSync ] -{ #category : #'api - expansion' } -GtTextualCoderViewModel >> collapse [ - self expanded: false -] - { #category : #'api - text' } GtTextualCoderViewModel >> collapsedTextPromise [ "Return a text that should be displayed in the collapsed state" @@ -375,25 +368,6 @@ GtTextualCoderViewModel >> elementClass [ ^ GtTextualCoderEditorElement ] -{ #category : #'api - expansion' } -GtTextualCoderViewModel >> expand [ - self expanded: true -] - -{ #category : #'api - expansion' } -GtTextualCoderViewModel >> expanded [ - ^ expanded -] - -{ #category : #'api - expansion' } -GtTextualCoderViewModel >> expanded: aBoolean [ - expanded = aBoolean - ifTrue: [ ^ self ]. - - expanded := aBoolean. - self notifyExpansionChanged: expanded -] - { #category : #accessing } GtTextualCoderViewModel >> extraTextAttributes [ ^ extraTextAttributes @@ -476,15 +450,6 @@ GtTextualCoderViewModel >> hasStyledText [ ^ styledText notNil ] -{ #category : #'api - header' } -GtTextualCoderViewModel >> headerElementClass [ - "Return an class of an element that should represent a header of the coder. - The used element must implement {{gtClass:TGtWithTextualCoderViewModel}} trait." - - - ^ nil -] - { #category : #initialization } GtTextualCoderViewModel >> initialize [ super initialize. @@ -499,10 +464,7 @@ GtTextualCoderViewModel >> initialize [ cursors := BrTextEditorMultipleCursor new. selection := BlCompositeSelection new. extraTextAttributes := OrderedCollection new. - hasFocus := false. - expanded := true. - shouldHaveHeader := true. nodeAttributeMap := Dictionary new ] @@ -577,11 +539,6 @@ GtTextualCoderViewModel >> notifyCursorsChanged: aBrTextEditorCursor from: aSour source: aSourceObject) ] -{ #category : #'private - notifying' } -GtTextualCoderViewModel >> notifyExpansionChanged: aBoolean [ - self announce: (GtTextualCoderViewModelExpansionChanged new expanded: aBoolean) -] - { #category : #'private - notifying' } GtTextualCoderViewModel >> notifyFocusChanged: aBoolean from: aSourceObject [ self announcer announce: (GtTextualCoderViewModelFocusChanged new @@ -800,11 +757,6 @@ GtTextualCoderViewModel >> shouldAddOnsBeUpdated [ ifNotNil: [ :theAddOnsPromise | theAddOnsPromise then: [ :theAddOns | theAddOns shouldBeUpdated ] ] ] -{ #category : #'api - header' } -GtTextualCoderViewModel >> shouldHaveHeader: aBoolean [ - shouldHaveHeader := aBoolean -] - { #category : #'api - text' } GtTextualCoderViewModel >> sourceText [ @@ -918,20 +870,3 @@ GtTextualCoderViewModel >> unsubscribeFromCoderModel [ self coderModel unsubscribe: self ] - -{ #category : #'api - header' } -GtTextualCoderViewModel >> wantsHeader [ - - - ^ shouldHaveHeader and: [ self headerElementClass notNil ] -] - -{ #category : #'api - header' } -GtTextualCoderViewModel >> withHeader [ - self shouldHaveHeader: true -] - -{ #category : #'api - header' } -GtTextualCoderViewModel >> withoutHeader [ - self shouldHaveHeader: false -] From 01c03384583c4c06f01e32c010e1cda4012fe1e3 Mon Sep 17 00:00:00 2001 From: Don Roberts Date: Tue, 5 Aug 2025 09:19:52 -0500 Subject: [PATCH 1027/1268] Push focus logic up into GtExpandableCoderViewModel --- .../GtExpandableCoderViewModel.class.st | 54 ++++++++++++++++++- .../GtTextualCoderViewModel.class.st | 52 ------------------ 2 files changed, 53 insertions(+), 53 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtExpandableCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtExpandableCoderViewModel.class.st index ace8253eb..5238988df 100644 --- a/src/GToolkit-Coder-UI/GtExpandableCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtExpandableCoderViewModel.class.st @@ -3,16 +3,34 @@ Class { #superclass : #GtSingleCoderViewModel, #instVars : [ 'expanded', - 'shouldHaveHeader' + 'shouldHaveHeader', + 'hasFocus' ], #category : #'GToolkit-Coder-UI-Coder - Basic' } +{ #category : #converting } +GtExpandableCoderViewModel >> asExpandedOnlyElement [ + "Create an element for just the expanded coder without expander" + + ^ GtExpandedOnlyCoderElement new + coderViewModel: self asCoderViewModel; + yourself +] + { #category : #'api - expansion' } GtExpandableCoderViewModel >> collapse [ self expanded: false ] +{ #category : #'api - text' } +GtExpandableCoderViewModel >> collapsedTextPromise [ + "Return a text that should be displayed in the collapsed state" + + + ^ coderModel collapsedTextPromise +] + { #category : #'api - expansion' } GtExpandableCoderViewModel >> expand [ self expanded: true @@ -31,6 +49,32 @@ GtExpandableCoderViewModel >> expanded: aBoolean [ self notifyExpansionChanged: expanded ] +{ #category : #'api - focus' } +GtExpandableCoderViewModel >> focused [ + + + ^ hasFocus +] + +{ #category : #'api - focus' } +GtExpandableCoderViewModel >> focused: aBoolean [ + self focused: aBoolean from: self +] + +{ #category : #'api - focus' } +GtExpandableCoderViewModel >> focused: aBoolean from: aSourceObject [ + hasFocus = aBoolean + ifTrue: [ ^ self ]. + + hasFocus := aBoolean. + self notifyFocusChanged: hasFocus from: aSourceObject. + + codersUIModel ifNotNil: [ :theCoders | + aBoolean + ifTrue: [ theCoders focusCoderUIModel: self ] + ifFalse: [ theCoders unfocusCoderUIModel: self ] ] +] + { #category : #'api - header' } GtExpandableCoderViewModel >> headerElementClass [ "Return an class of an element that should represent a header of the coder. @@ -44,6 +88,7 @@ GtExpandableCoderViewModel >> headerElementClass [ GtExpandableCoderViewModel >> initialize [ super initialize. expanded := true. + hasFocus := false. shouldHaveHeader := true ] @@ -52,6 +97,13 @@ GtExpandableCoderViewModel >> notifyExpansionChanged: aBoolean [ self announce: (GtExpandableCoderViewModelExpansionChanged new expanded: aBoolean) ] +{ #category : #'private - notifying' } +GtExpandableCoderViewModel >> notifyFocusChanged: aBoolean from: aSourceObject [ + self announcer announce: (GtTextualCoderViewModelFocusChanged new + focused: aBoolean; + source: aSourceObject) +] + { #category : #'api - header' } GtExpandableCoderViewModel >> shouldHaveHeader: aBoolean [ shouldHaveHeader := aBoolean diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 2b577cf49..fa9e459bf 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -7,7 +7,6 @@ Class { 'contextActions', 'contextMenuActions', 'shortcuts', - 'hasFocus', 'cursors', 'selection', 'extraTextAttributes', @@ -153,15 +152,6 @@ GtTextualCoderViewModel >> asEditorState [ ^ aMemento ] -{ #category : #converting } -GtTextualCoderViewModel >> asExpandedOnlyElement [ - "Create an element for just the expanded coder without expander" - - ^ GtExpandedOnlyCoderElement new - coderViewModel: self asCoderViewModel; - yourself -] - { #category : #'api - coder model' } GtTextualCoderViewModel >> astAsyncDo: aBlock [ ^ self coderModel astAsyncDo: aBlock @@ -181,14 +171,6 @@ GtTextualCoderViewModel >> astSync [ ^ self coderModel astSync ] -{ #category : #'api - text' } -GtTextualCoderViewModel >> collapsedTextPromise [ - "Return a text that should be displayed in the collapsed state" - - - ^ coderModel collapsedTextPromise -] - { #category : #accessing } GtTextualCoderViewModel >> completionStrategy [ @@ -373,32 +355,6 @@ GtTextualCoderViewModel >> extraTextAttributes [ ^ extraTextAttributes ] -{ #category : #'api - focus' } -GtTextualCoderViewModel >> focused [ - - - ^ hasFocus -] - -{ #category : #'api - focus' } -GtTextualCoderViewModel >> focused: aBoolean [ - self focused: aBoolean from: self -] - -{ #category : #'api - focus' } -GtTextualCoderViewModel >> focused: aBoolean from: aSourceObject [ - hasFocus = aBoolean - ifTrue: [ ^ self ]. - - hasFocus := aBoolean. - self notifyFocusChanged: hasFocus from: aSourceObject. - - codersUIModel ifNotNil: [ :theCoders | - aBoolean - ifTrue: [ theCoders focusCoderUIModel: self ] - ifFalse: [ theCoders unfocusCoderUIModel: self ] ] -] - { #category : #'gt-extension' } GtTextualCoderViewModel >> gtInfo [ ^ Array streamContents: [ :aStream | @@ -464,7 +420,6 @@ GtTextualCoderViewModel >> initialize [ cursors := BrTextEditorMultipleCursor new. selection := BlCompositeSelection new. extraTextAttributes := OrderedCollection new. - hasFocus := false. nodeAttributeMap := Dictionary new ] @@ -539,13 +494,6 @@ GtTextualCoderViewModel >> notifyCursorsChanged: aBrTextEditorCursor from: aSour source: aSourceObject) ] -{ #category : #'private - notifying' } -GtTextualCoderViewModel >> notifyFocusChanged: aBoolean from: aSourceObject [ - self announcer announce: (GtTextualCoderViewModelFocusChanged new - focused: aBoolean; - source: aSourceObject) -] - { #category : #'private - notifying' } GtTextualCoderViewModel >> notifySelectionChanged: aBlCompositeSelection from: aSourceObject [ self announce: (GtTextualCoderViewModelSelectionChanged new selection: aBlCompositeSelection; source: aSourceObject) From f43083667216f1325afb74367a4f646ccdb477a6 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 6 Aug 2025 11:25:56 -0400 Subject: [PATCH 1028/1268] use `BrMenuItemsPragmaBuilder` to build sidebar index class context menus [feenkcom/gtoolkit#4630] --- .../GtCoderClassesTreeElement.class.st | 44 ++++++------------- 1 file changed, 14 insertions(+), 30 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index d26a88846..a31406502 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -104,40 +104,24 @@ GtCoderClassesTreeElement >> contextMenuFor: aClass [ { #category : #initialization } GtCoderClassesTreeElement >> contextMenuForOneItem: aClass [ - | somePragmas someMenuItems | - somePragmas := Pragma - allNamed: #gtCoderSidebarIndexOneSubjectContextMenuItem: - from: aClass class - to: Behavior - sortedByArgument: 1. - someMenuItems := somePragmas - collect: [ :eachPragma | - [ (aClass perform: eachPragma methodSelector with: self) - ifNotNil: [ :aMenuItem | aMenuItem definition: [ eachPragma method ] ] ] - onErrorDo: [ :anException | self createExceptionItemFor: anException andPragma: eachPragma ] ] - thenSelect: #isNotNil. - - ^ BrMenuItems new addItems: someMenuItems + ^ BrMenuItemsPragmaBuilder new + object: aClass; + upToSuperclass: Behavior; + pragma: #gtCoderSidebarIndexOneSubjectContextMenuItem:; + methodArguments: { self }; + sortByFirstPragmaArgument; + build ] { #category : #initialization } GtCoderClassesTreeElement >> contextMenuForSeveralItems: someClasses [ - | somePragmas someMenuItems | - somePragmas := Pragma - allNamed: #gtCoderSidebarIndexSeveralSubjectsContextMenuItem: - in: Class - sortedByArgument: 1. - someMenuItems := somePragmas - collect: [ :eachPragma | - [ (Class - perform: eachPragma methodSelector - with: someClasses - with: self) - ifNotNil: [ :aMenuItem | aMenuItem definition: [ eachPragma method ] ] ] - onErrorDo: [ :anException | self createExceptionItemFor: anException andPragma: eachPragma ] ] - thenSelect: #isNotNil. - - ^ BrMenuItems new addItems: someMenuItems + ^ BrMenuItemsPragmaBuilder new + object: Class; + upToSuperclass: Behavior; + pragma: #gtCoderSidebarIndexSeveralSubjectsContextMenuItem:; + methodArguments: {someClasses. self}; + sortByFirstPragmaArgument; + build ] { #category : #'private - drag and drop' } From c8d719d2576667170523aa041863b181763ab240 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 6 Aug 2025 11:26:53 -0400 Subject: [PATCH 1029/1268] remove an unused method [feenkcom/gtoolkit#4630] --- .../GtCoderClassesTreeElement.class.st | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index a31406502..9af3dca54 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -173,18 +173,6 @@ GtCoderClassesTreeElement >> createDraggedMethodItem: aDragItem [ text: aDragItem domainObject printString ] -{ #category : #initialization } -GtCoderClassesTreeElement >> createExceptionItemFor: anException andPragma: eachPragma [ - | frozenException | - frozenException := (GtSystemUtility freeze: anException) - tag: eachPragma; - yourself. - ^ anException - return: (BrMenuActionItem new - label: 'Error' preview: frozenException messageText; - action: [ :anElement :aButtonModel :anEvent | anElement phlow spawnObject: frozenException ]) -] - { #category : #'private - context menu' } GtCoderClassesTreeElement >> createLabel: aString description: description [ ^ aString asRopedText glamorousRegularFont From 8bd4042214700b9dea079f023beab2ca168211c6 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 18 Aug 2025 15:26:55 -0400 Subject: [PATCH 1030/1268] add new display sidebar index at the top toggle button [feenkcom/gtoolkit#4653] --- src/GToolkit-Coder-UI/Behavior.extension.st | 17 +++++++++ .../GtCoderDisplayTopSidebarWish.class.st | 5 +++ src/GToolkit-Coder-UI/GtCoderElement.class.st | 36 ++++++++++++++++++- .../GtCoderHideSidebarWish.class.st | 5 +++ .../GtCoderSidebarVisibilityWish.class.st | 18 ++++++++++ src/GToolkit-Coder-UI/GtCreationForm.class.st | 2 +- 6 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderDisplayTopSidebarWish.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderHideSidebarWish.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderSidebarVisibilityWish.class.st diff --git a/src/GToolkit-Coder-UI/Behavior.extension.st b/src/GToolkit-Coder-UI/Behavior.extension.st index 77fa80acd..5a8ca3f73 100644 --- a/src/GToolkit-Coder-UI/Behavior.extension.st +++ b/src/GToolkit-Coder-UI/Behavior.extension.st @@ -16,6 +16,23 @@ Behavior >> gtBrowseButtonFor: anAction [ mouseCursor: BlCopyCursor new ] +{ #category : #'*GToolkit-Coder-UI' } +Behavior >> gtDisplayTopSidebarIndexToggleFor: anAction [ + + ^ anAction toggle + tooltip: 'Top sidebar'; + icon: BrGlamorousIcons tree; + id: GtCoderClassHierarchyButtonId; + priority: 3; + isActivated: [ :aTargetElement | + | anEvent | + anEvent := GtCoderSidebarVisibilityWish new. + aTargetElement fireEvent: anEvent. + anEvent isVisible ]; + activatedAction: [ :aButton | aButton fireEvent: GtCoderDisplayTopSidebarWish new ]; + deactivatedAction: [ :aButton | aButton fireEvent: GtCoderHideSidebarWish new ] +] + { #category : #'*GToolkit-Coder-UI' } Behavior >> gtHierarchyButtonFor: anAction [ diff --git a/src/GToolkit-Coder-UI/GtCoderDisplayTopSidebarWish.class.st b/src/GToolkit-Coder-UI/GtCoderDisplayTopSidebarWish.class.st new file mode 100644 index 000000000..6613ea1ff --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderDisplayTopSidebarWish.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtCoderDisplayTopSidebarWish, + #superclass : #BrWish, + #category : #'GToolkit-Coder-UI-Basic' +} diff --git a/src/GToolkit-Coder-UI/GtCoderElement.class.st b/src/GToolkit-Coder-UI/GtCoderElement.class.st index dd9f38d53..e468b2700 100644 --- a/src/GToolkit-Coder-UI/GtCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderElement.class.st @@ -135,7 +135,41 @@ GtCoderElement >> initialize [ GtCoderSettings defaultDetailState ifNotNil: [ :aState | self states addState: aState ]. GtCoderSettings defaultDetailPositionState - ifNotNil: [ :aState | self states addState: aState ] + ifNotNil: [ :aState | self states addState: aState ]. + + self + when: GtCoderSidebarVisibilityWish + do: [ :anEvent | self onGtCoderDisplayTopSidebarWish: anEvent ]. + self + when: GtCoderDisplayTopSidebarWish + do: [ :anEvent | self onGtCoderDisplayTopSidebarWish: anEvent ]. + self + when: GtCoderHideSidebarWish + do: [ :anEvent | self onGtCoderHideSidebarWish: anEvent ] +] + +{ #category : #'private - event handling' } +GtCoderElement >> onGtCoderDisplayTopSidebarWish: anEvent [ + anEvent consumed: true. + self states addState: GtPhlowToolDetailState detailed. + self states addState: GtPhlowToolDetailPositionState top +] + +{ #category : #'private - event handling' } +GtCoderElement >> onGtCoderHideSidebarWish: anEvent [ + anEvent consumed: true. + self states removeState: GtPhlowToolDetailState normal. + self states removeState: GtPhlowToolDetailPositionState top +] + +{ #category : #'private - event handling' } +GtCoderElement >> onGtCoderSidebarVisibilityWish: anEvent [ + anEvent consumed: true. + + self states + stateLike: GtPhlowToolDetailState detailed + ifFound: [ :aState | anEvent isVisible: true ] + ifNone: [ anEvent isVisible: false ] ] { #category : #'private - hooks' } diff --git a/src/GToolkit-Coder-UI/GtCoderHideSidebarWish.class.st b/src/GToolkit-Coder-UI/GtCoderHideSidebarWish.class.st new file mode 100644 index 000000000..d96b5573f --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderHideSidebarWish.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtCoderHideSidebarWish, + #superclass : #BrWish, + #category : #'GToolkit-Coder-UI-Basic' +} diff --git a/src/GToolkit-Coder-UI/GtCoderSidebarVisibilityWish.class.st b/src/GToolkit-Coder-UI/GtCoderSidebarVisibilityWish.class.st new file mode 100644 index 000000000..98bfc0883 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderSidebarVisibilityWish.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtCoderSidebarVisibilityWish, + #superclass : #BrWish, + #instVars : [ + 'isVisible' + ], + #category : #'GToolkit-Coder-UI-Basic' +} + +{ #category : #accessing } +GtCoderSidebarVisibilityWish >> isVisible [ + ^ isVisible ifNil: [ false ] +] + +{ #category : #accessing } +GtCoderSidebarVisibilityWish >> isVisible: anObject [ + isVisible := anObject +] diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index eecbee9bc..67f8ef7af 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -167,7 +167,7 @@ GtCreationForm >> selectInNavigationModel: aNavigationModel anInstance: anInstan anInstance tags ifNotEmpty: [ aNavigationModel - selectPackageTag: (anInstance package classTagNamed: anInstance tags first) ]. + selectPackageTag: (anInstance package tagNamed: anInstance tags first) ]. aNavigationModel selectClass: anInstance ] From f609932bf03b847c3db2fee8082c84862acade53 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 18 Aug 2025 15:28:08 -0400 Subject: [PATCH 1031/1268] remove `Behavior>>#gtHierarchyButtonFor:` [feenkcom/gtoolkit#4653] --- src/GToolkit-Coder-UI/Behavior.extension.st | 23 --------------------- 1 file changed, 23 deletions(-) diff --git a/src/GToolkit-Coder-UI/Behavior.extension.st b/src/GToolkit-Coder-UI/Behavior.extension.st index 5a8ca3f73..bab219f86 100644 --- a/src/GToolkit-Coder-UI/Behavior.extension.st +++ b/src/GToolkit-Coder-UI/Behavior.extension.st @@ -32,26 +32,3 @@ Behavior >> gtDisplayTopSidebarIndexToggleFor: anAction [ activatedAction: [ :aButton | aButton fireEvent: GtCoderDisplayTopSidebarWish new ]; deactivatedAction: [ :aButton | aButton fireEvent: GtCoderHideSidebarWish new ] ] - -{ #category : #'*GToolkit-Coder-UI' } -Behavior >> gtHierarchyButtonFor: anAction [ - - ^ anAction dropdown - tooltip: 'Show Package and Class Hierarchies'; - icon: BrGlamorousIcons tree; - id: GtCoderClassHierarchyButtonId; - priority: 3; - preferredExtentFrom: GtPharoCoderHierarchyDropdownConfiguration; - content: [ :aButton :aTargetElement :anExplicitMenu | - | aNavigationModel | - aNavigationModel := aButton phlow firstParentCoderNavigationModel. - BlElement new - size: GtPharoCoderHierarchyDropdownConfiguration preferredExtent; - addChild: ((GtCoderNavigationTabsStencil new - pragmaName: #gtCoderDropdownNavigation; - navigationModel: aNavigationModel; - asElement) background: Color white); - addAptitude: (BrGlamorousPopoverPinnableAptitude new - withAllPinActions; - menuModel: anExplicitMenu) ] -] From e5217d1ffc744fc0c7bd2c97ae81f4a8ec7edc13 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 18 Aug 2025 15:28:55 -0400 Subject: [PATCH 1032/1268] auto-rewrites --- .../GtMethodProtocolCompletionStrategy.class.st | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder/GtMethodProtocolCompletionStrategy.class.st b/src/GToolkit-Coder/GtMethodProtocolCompletionStrategy.class.st index 62bfdbe49..cd9be7e03 100644 --- a/src/GToolkit-Coder/GtMethodProtocolCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtMethodProtocolCompletionStrategy.class.st @@ -9,9 +9,8 @@ GtMethodProtocolCompletionStrategy >> buildCompletions [ | protocols | protocols := GtPrefixTree new. Smalltalk globals - allBehaviorsDo: [ :cls | protocols addAll: cls organization categories ]. - self packageOrganizer packages - do: [ :each | protocols add: '*' , each name ]. + allBehaviorsDo: [ :cls | protocols addAll: cls organization protocolNames ]. + self packageOrganizer packages do: [ :each | protocols add: '*' , each name ]. ^ protocols ] From 2872fd075425da2f6780aef2cb5034bdae7cd93b Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 18 Aug 2025 15:31:24 -0400 Subject: [PATCH 1033/1268] better tooltip name [feenkcom/gtoolkit#4653] --- src/GToolkit-Coder-UI/Behavior.extension.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/Behavior.extension.st b/src/GToolkit-Coder-UI/Behavior.extension.st index bab219f86..86e613d55 100644 --- a/src/GToolkit-Coder-UI/Behavior.extension.st +++ b/src/GToolkit-Coder-UI/Behavior.extension.st @@ -20,7 +20,7 @@ Behavior >> gtBrowseButtonFor: anAction [ Behavior >> gtDisplayTopSidebarIndexToggleFor: anAction [ ^ anAction toggle - tooltip: 'Top sidebar'; + tooltip: 'Show Package and Class Hierarchies'; icon: BrGlamorousIcons tree; id: GtCoderClassHierarchyButtonId; priority: 3; From 86ca811c5e982bd03149452f0671ace08bd1139f Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 18 Aug 2025 15:53:00 -0400 Subject: [PATCH 1034/1268] disable `Behavior>>#gtDisplayTopSidebarIndexToggleFor:` [feenkcom/gtoolkit#4653] enable `#gtHierarchyButtonFor:` --- src/GToolkit-Coder-UI/Behavior.extension.st | 43 ++++++++++++++++--- src/GToolkit-Coder-UI/GtCoderElement.class.st | 2 +- 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/src/GToolkit-Coder-UI/Behavior.extension.st b/src/GToolkit-Coder-UI/Behavior.extension.st index 86e613d55..747f16523 100644 --- a/src/GToolkit-Coder-UI/Behavior.extension.st +++ b/src/GToolkit-Coder-UI/Behavior.extension.st @@ -18,17 +18,48 @@ Behavior >> gtBrowseButtonFor: anAction [ { #category : #'*GToolkit-Coder-UI' } Behavior >> gtDisplayTopSidebarIndexToggleFor: anAction [ - + "" ^ anAction toggle tooltip: 'Show Package and Class Hierarchies'; icon: BrGlamorousIcons tree; id: GtCoderClassHierarchyButtonId; priority: 3; - isActivated: [ :aTargetElement | - | anEvent | - anEvent := GtCoderSidebarVisibilityWish new. - aTargetElement fireEvent: anEvent. - anEvent isVisible ]; + isActivated: [ :aToggle :aTargetElement | + aTargetElement isAttachedToSceneGraph + ifTrue: [ | anEvent | + anEvent := GtCoderSidebarVisibilityWish new. + aTargetElement fireEvent: anEvent. + anEvent isVisible ] + ifFalse: [ BlTaskAction + enqueueElement: aToggle + action: [ | anEvent | + anEvent := GtCoderSidebarVisibilityWish new. + aToggle fireEvent: anEvent. + aToggle activated: anEvent isVisible ]. + false ] ]; activatedAction: [ :aButton | aButton fireEvent: GtCoderDisplayTopSidebarWish new ]; deactivatedAction: [ :aButton | aButton fireEvent: GtCoderHideSidebarWish new ] ] + +{ #category : #'*GToolkit-Coder-UI' } +Behavior >> gtHierarchyButtonFor: anAction [ + + ^ anAction dropdown + tooltip: 'Show Package and Class Hierarchies'; + icon: BrGlamorousIcons tree; + id: GtCoderClassHierarchyButtonId; + priority: 3; + preferredExtentFrom: GtPharoCoderHierarchyDropdownConfiguration; + content: [ :aButton :aTargetElement :anExplicitMenu | + | aNavigationModel | + aNavigationModel := aButton phlow firstParentCoderNavigationModel. + BlElement new + size: GtPharoCoderHierarchyDropdownConfiguration preferredExtent; + addChild: ((GtCoderNavigationTabsStencil new + pragmaName: #gtCoderDropdownNavigation; + navigationModel: aNavigationModel; + asElement) background: Color white); + addAptitude: (BrGlamorousPopoverPinnableAptitude new + withAllPinActions; + menuModel: anExplicitMenu) ] +] diff --git a/src/GToolkit-Coder-UI/GtCoderElement.class.st b/src/GToolkit-Coder-UI/GtCoderElement.class.st index e468b2700..ded8580a2 100644 --- a/src/GToolkit-Coder-UI/GtCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderElement.class.st @@ -139,7 +139,7 @@ GtCoderElement >> initialize [ self when: GtCoderSidebarVisibilityWish - do: [ :anEvent | self onGtCoderDisplayTopSidebarWish: anEvent ]. + do: [ :anEvent | self onGtCoderSidebarVisibilityWish: anEvent ]. self when: GtCoderDisplayTopSidebarWish do: [ :anEvent | self onGtCoderDisplayTopSidebarWish: anEvent ]. From 583e15e9403221bcdf97e74d86e3c74965ebabe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Tue, 19 Aug 2025 09:19:58 +0300 Subject: [PATCH 1035/1268] Do not use #organization --- src/GToolkit-Coder/GtMethodProtocolCompletionStrategy.class.st | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder/GtMethodProtocolCompletionStrategy.class.st b/src/GToolkit-Coder/GtMethodProtocolCompletionStrategy.class.st index cd9be7e03..cc49d7ed0 100644 --- a/src/GToolkit-Coder/GtMethodProtocolCompletionStrategy.class.st +++ b/src/GToolkit-Coder/GtMethodProtocolCompletionStrategy.class.st @@ -9,7 +9,8 @@ GtMethodProtocolCompletionStrategy >> buildCompletions [ | protocols | protocols := GtPrefixTree new. Smalltalk globals - allBehaviorsDo: [ :cls | protocols addAll: cls organization protocolNames ]. + allBehaviorsDo: [ :cls | protocols addAll: cls protocolNames ]. + self packageOrganizer packages do: [ :each | protocols add: '*' , each name ]. ^ protocols ] From 94b7ddec3f0409f9c034028b826d49fcebd315ca Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 19 Aug 2025 09:35:33 -0400 Subject: [PATCH 1036/1268] request style on sidebar show [feenkcom/gtoolkit#4653] --- src/GToolkit-Coder-UI/Behavior.extension.st | 8 +++- src/GToolkit-Coder-UI/GtCoderElement.class.st | 42 +++++++++++++++---- 2 files changed, 40 insertions(+), 10 deletions(-) diff --git a/src/GToolkit-Coder-UI/Behavior.extension.st b/src/GToolkit-Coder-UI/Behavior.extension.st index 747f16523..094cbcf20 100644 --- a/src/GToolkit-Coder-UI/Behavior.extension.st +++ b/src/GToolkit-Coder-UI/Behavior.extension.st @@ -18,7 +18,9 @@ Behavior >> gtBrowseButtonFor: anAction [ { #category : #'*GToolkit-Coder-UI' } Behavior >> gtDisplayTopSidebarIndexToggleFor: anAction [ - "" + "Previous dropdown solution: Behavior>>#gtHierarchyButtonFor:" + + ^ anAction toggle tooltip: 'Show Package and Class Hierarchies'; icon: BrGlamorousIcons tree; @@ -43,7 +45,9 @@ Behavior >> gtDisplayTopSidebarIndexToggleFor: anAction [ { #category : #'*GToolkit-Coder-UI' } Behavior >> gtHierarchyButtonFor: anAction [ - + "New implementation: Behavior>>#gtDisplayTopSidebarIndexToggleFor:" + + "" ^ anAction dropdown tooltip: 'Show Package and Class Hierarchies'; icon: BrGlamorousIcons tree; diff --git a/src/GToolkit-Coder-UI/GtCoderElement.class.st b/src/GToolkit-Coder-UI/GtCoderElement.class.st index ded8580a2..acbc993f6 100644 --- a/src/GToolkit-Coder-UI/GtCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderElement.class.st @@ -119,10 +119,26 @@ GtCoderElement >> initialize [ layout: BlLinearLayout horizontal; addEventHandler: titleNotifier; addAptitude: (GtPhlowToolDetailAptitude new - normal: [ :aStyle | aStyle do: [ self hideSidebar ] ]; - detailed: [ :aStyle | aStyle do: [ self showSidebar ] ]; - left: [ :aStyle | aStyle do: [ self layout: BlLinearLayout horizontal ] ]; - top: [ :aStyle | aStyle do: [ self layout: BlLinearLayout vertical ] ]). + normal: [ :aStyle | aStyle do: [ :aWidget | aWidget hideSidebar ] ]; + detailed: [ :aStyle | aStyle do: [ :aWidget | aWidget showSidebar ] ]; + left: [ :aStyle | + aStyle do: [ :aWidget | aWidget layout: BlLinearLayout horizontal ]. + aStyle + do: [ :aWidget | + aWidget sidebarElement + ifNotNil: [ :anElement | anElement states addState: GtPhlowToolDetailPositionState left ] ] + after: [ :aWidget | + aWidget sidebarElement + ifNotNil: [ :anElement | anElement states removeState: GtPhlowToolDetailPositionState left ] ] ]; + top: [ :aStyle | + aStyle do: [ :aWidget | aWidget layout: BlLinearLayout vertical ]. + aStyle + do: [ :aWidget | + aWidget sidebarElement + ifNotNil: [ :anElement | anElement states addState: GtPhlowToolDetailPositionState top ] ] + after: [ :aWidget | + aWidget sidebarElement + ifNotNil: [ :anElement | anElement states removeState: GtPhlowToolDetailPositionState top ] ] ]). self addChild: contentElement as: #content. @@ -151,15 +167,17 @@ GtCoderElement >> initialize [ { #category : #'private - event handling' } GtCoderElement >> onGtCoderDisplayTopSidebarWish: anEvent [ anEvent consumed: true. + self states addState: GtPhlowToolDetailPositionState top. self states addState: GtPhlowToolDetailState detailed. - self states addState: GtPhlowToolDetailPositionState top + self requestStyle ] { #category : #'private - event handling' } GtCoderElement >> onGtCoderHideSidebarWish: anEvent [ anEvent consumed: true. + self states removeState: GtPhlowToolDetailPositionState top. self states removeState: GtPhlowToolDetailState normal. - self states removeState: GtPhlowToolDetailPositionState top + self requestStyle ] { #category : #'private - event handling' } @@ -226,9 +244,17 @@ GtCoderElement >> showSidebar [ sidebarElement show. (sidebarElement hasParent: self) - ifTrue: [ ^ self ]. + ifTrue: [ + ^ self ]. - self addChildFirst: sidebarElement + self addChildFirst: sidebarElement. + sidebarElement requestStyle +] + +{ #category : #accessing } +GtCoderElement >> sidebarElement [ + + ^ sidebarElement ] { #category : #'private - accessing' } From 11bd34addd174f97ceeba7ee4f5c6ca8aa861d74 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 19 Aug 2025 17:00:30 -0400 Subject: [PATCH 1037/1268] properly query visibility state [feenkcom/gtoolkit#4627] --- src/GToolkit-Coder-UI/Behavior.extension.st | 2 +- src/GToolkit-Coder-UI/GtCoderElement.class.st | 3 ++- src/GToolkit-Coder-UI/GtObjectCoderTool.class.st | 14 +++++++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/Behavior.extension.st b/src/GToolkit-Coder-UI/Behavior.extension.st index 094cbcf20..79bf3bdd7 100644 --- a/src/GToolkit-Coder-UI/Behavior.extension.st +++ b/src/GToolkit-Coder-UI/Behavior.extension.st @@ -38,7 +38,7 @@ Behavior >> gtDisplayTopSidebarIndexToggleFor: anAction [ anEvent := GtCoderSidebarVisibilityWish new. aToggle fireEvent: anEvent. aToggle activated: anEvent isVisible ]. - false ] ]; + GtCoderSettings defaultDetailState = GtPhlowToolDetailState detailed ] ]; activatedAction: [ :aButton | aButton fireEvent: GtCoderDisplayTopSidebarWish new ]; deactivatedAction: [ :aButton | aButton fireEvent: GtCoderHideSidebarWish new ] ] diff --git a/src/GToolkit-Coder-UI/GtCoderElement.class.st b/src/GToolkit-Coder-UI/GtCoderElement.class.st index acbc993f6..0506dc4e2 100644 --- a/src/GToolkit-Coder-UI/GtCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderElement.class.st @@ -186,7 +186,8 @@ GtCoderElement >> onGtCoderSidebarVisibilityWish: anEvent [ self states stateLike: GtPhlowToolDetailState detailed - ifFound: [ :aState | anEvent isVisible: true ] + ifFound: [ :aState | + anEvent isVisible: GtPhlowToolDetailState detailed = aState ] ifNone: [ anEvent isVisible: false ] ] diff --git a/src/GToolkit-Coder-UI/GtObjectCoderTool.class.st b/src/GToolkit-Coder-UI/GtObjectCoderTool.class.st index 7f524e837..613902a91 100644 --- a/src/GToolkit-Coder-UI/GtObjectCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtObjectCoderTool.class.st @@ -29,5 +29,17 @@ GtObjectCoderTool >> object: anObject [ { #category : #'api - accessing' } GtObjectCoderTool >> title [ - ^ object gtDisplayString + "Return an object name" + + + ^ [ self object gtDisplayString ] + onErrorDo: [ :anError | + [ | anotherTitle | + anotherTitle := self object className. + + '{1}{2}''s error: {3}' + format: {anotherTitle first isVowel ifTrue: [ 'an ' ] ifFalse: [ 'a ' ]. + anotherTitle. + anError gtDisplayString} ] + onErrorDo: [ :anotherError | anError messageText ] ] ] From fb58ba5527664847031ee55842d64bf48900991c Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Sun, 24 Aug 2025 16:51:41 +0200 Subject: [PATCH 1038/1268] add views for the text attributes and intervals in the coder editor element feenkcom/gtoolkit#4672 --- .../GtSourceCoderEditorElement.class.st | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st index bd072f4a2..fe5c6fa9b 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st @@ -4,6 +4,36 @@ Class { #category : #'GToolkit-Coder-UI-Coder - Source' } +{ #category : #views } +GtSourceCoderEditorElement >> gtEditorTextAttributesFor: aView [ + + ^ aView forward + title: 'Text attributes'; + priority: 41; + object: [ self editor ]; + view: #gtTextAttributesFor: +] + +{ #category : #views } +GtSourceCoderEditorElement >> gtEditorTextIntervalsFor: aView [ + + ^ aView forward + title: 'Text intervals'; + priority: 42; + object: [ self editor ]; + view: #gtTextIntervalsFor: +] + +{ #category : #views } +GtSourceCoderEditorElement >> gtView1For: aView [ + + ^ aView forward + title: 'Text intervals'; + priority: 42; + object: [ self editor ]; + view: #gtTextIntervalsFor: +] + { #category : #initalization } GtSourceCoderEditorElement >> initialize [ super initialize. From efa2d40c6fc0d1def6ca2d55271ca88e8093a970 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Wed, 27 Aug 2025 18:49:10 +0200 Subject: [PATCH 1039/1268] Pass on how properties are passes to expanded coders --- ...oderViewModelWithParentProperties.trait.st | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 src/GToolkit-Coder-UI/TGtCoderViewModelWithParentProperties.trait.st diff --git a/src/GToolkit-Coder-UI/TGtCoderViewModelWithParentProperties.trait.st b/src/GToolkit-Coder-UI/TGtCoderViewModelWithParentProperties.trait.st new file mode 100644 index 000000000..7182ca7fa --- /dev/null +++ b/src/GToolkit-Coder-UI/TGtCoderViewModelWithParentProperties.trait.st @@ -0,0 +1,61 @@ +Trait { + #name : #TGtCoderViewModelWithParentProperties, + #category : #'GToolkit-Coder-UI-Coder - Basic' +} + +{ #category : #accessing } +TGtCoderViewModelWithParentProperties >> parentCoderViewModel [ + ^ self + optionAt: #parentCoderViewModel + ifPresent: [ :aWeak | aWeak at: 1 ] + ifAbsent: [ nil ] +] + +{ #category : #accessing } +TGtCoderViewModelWithParentProperties >> parentCoderViewModel: aCoderViewModel [ + "In case of method coders expanded inside of another method coder, + the parent-method-coder view model is set, to be able to get an extra information." + + self + optionAt: #parentCoderViewModel + put: aCoderViewModel asWeakReference +] + +{ #category : #accessing } +TGtCoderViewModelWithParentProperties >> parentExample [ + + ^ self + optionAt: #parentExample + ifPresent: [ :aWeak | aWeak at: 1 ] + ifAbsent: [ nil ] +] + +{ #category : #accessing } +TGtCoderViewModelWithParentProperties >> parentExample: anExample [ + "In case of method coders expanded inside of another method coder, + the parent-method-coder example is set, to be able to highlight failing code + in those expanded method coders." + + self + optionAt: #parentExample + put: anExample asWeakReference +] + +{ #category : #accessing } +TGtCoderViewModelWithParentProperties >> parentTestCase [ + ^ self + optionAt: #parentTestCase + ifPresent: [ :aWeak | aWeak at: 1 ] + ifAbsent: [ nil ] +] + +{ #category : #accessing } +TGtCoderViewModelWithParentProperties >> parentTestCase: aTestCase [ + "In case of method coders expanded inside of another method coder, + the parent-method-coder test case is set, to be able to highlight failing code + in those expanded method coders." + + self + optionAt: #parentTestCase + put: aTestCase asWeakReference +] From 78bbad60468d5225fc3f9d9c396873720b515e9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Fri, 5 Sep 2025 16:14:18 +0200 Subject: [PATCH 1040/1268] Mark coder signals with #gtNormalOperationSignal --- src/GToolkit-Coder-UI/GtCoderAddOnSignal.class.st | 8 ++++++++ .../GtCoderEvaluationStatusChangedSignal.class.st | 8 ++++++++ ...GtCoderEvaluationStatusShowNotificationSignal.class.st | 8 ++++++++ .../GtCoderIncomingEvaluationStatusSignal.class.st | 8 ++++++++ src/GToolkit-Coder-UI/GtFilterSignal.class.st | 8 ++++++++ .../GtSourceCoderProcessInDebuggerSignal.class.st | 8 ++++++++ .../GtTextualCoderEditorElementSignal.class.st | 8 ++++++++ 7 files changed, 56 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtCoderAddOnSignal.class.st b/src/GToolkit-Coder-UI/GtCoderAddOnSignal.class.st index 195fc064d..faad995e2 100644 --- a/src/GToolkit-Coder-UI/GtCoderAddOnSignal.class.st +++ b/src/GToolkit-Coder-UI/GtCoderAddOnSignal.class.st @@ -7,6 +7,14 @@ Class { #category : #'GToolkit-Coder-UI-Signals' } +{ #category : #testing } +GtCoderAddOnSignal class >> gtNormalOperationSignal [ + "Answer a Boolean indicating whether this signal is generated as part of normal operations. + See {{gtMethod:BeaconSignal class>>gtNormalOperationSignal}} for a description" + + ^ true. +] + { #category : #accessing } GtCoderAddOnSignal >> coderViewModel [ ^ coderViewModel diff --git a/src/GToolkit-Coder-UI/GtCoderEvaluationStatusChangedSignal.class.st b/src/GToolkit-Coder-UI/GtCoderEvaluationStatusChangedSignal.class.st index d95549b30..1b0f2dd8c 100644 --- a/src/GToolkit-Coder-UI/GtCoderEvaluationStatusChangedSignal.class.st +++ b/src/GToolkit-Coder-UI/GtCoderEvaluationStatusChangedSignal.class.st @@ -9,6 +9,14 @@ Class { #category : #'GToolkit-Coder-UI-Signals' } +{ #category : #testing } +GtCoderEvaluationStatusChangedSignal class >> gtNormalOperationSignal [ + "Answer a Boolean indicating whether this signal is generated as part of normal operations. + See {{gtMethod:BeaconSignal class>>gtNormalOperationSignal}} for a description" + + ^ true. +] + { #category : #accessing } GtCoderEvaluationStatusChangedSignal >> newStatus [ ^ newStatus diff --git a/src/GToolkit-Coder-UI/GtCoderEvaluationStatusShowNotificationSignal.class.st b/src/GToolkit-Coder-UI/GtCoderEvaluationStatusShowNotificationSignal.class.st index d98067a49..3f1bf441a 100644 --- a/src/GToolkit-Coder-UI/GtCoderEvaluationStatusShowNotificationSignal.class.st +++ b/src/GToolkit-Coder-UI/GtCoderEvaluationStatusShowNotificationSignal.class.st @@ -9,6 +9,14 @@ Class { #category : #'GToolkit-Coder-UI-Signals' } +{ #category : #testing } +GtCoderEvaluationStatusShowNotificationSignal class >> gtNormalOperationSignal [ + "Answer a Boolean indicating whether this signal is generated as part of normal operations. + See {{gtMethod:BeaconSignal class>>gtNormalOperationSignal}} for a description" + + ^ true. +] + { #category : #accessing } GtCoderEvaluationStatusShowNotificationSignal >> announcement [ ^ announcement diff --git a/src/GToolkit-Coder-UI/GtCoderIncomingEvaluationStatusSignal.class.st b/src/GToolkit-Coder-UI/GtCoderIncomingEvaluationStatusSignal.class.st index da03177ca..4fc9d8b68 100644 --- a/src/GToolkit-Coder-UI/GtCoderIncomingEvaluationStatusSignal.class.st +++ b/src/GToolkit-Coder-UI/GtCoderIncomingEvaluationStatusSignal.class.st @@ -9,6 +9,14 @@ Class { #category : #'GToolkit-Coder-UI-Signals' } +{ #category : #testing } +GtCoderIncomingEvaluationStatusSignal class >> gtNormalOperationSignal [ + "Answer a Boolean indicating whether this signal is generated as part of normal operations. + See {{gtMethod:BeaconSignal class>>gtNormalOperationSignal}} for a description" + + ^ true. +] + { #category : #accessing } GtCoderIncomingEvaluationStatusSignal >> existingStatus [ ^ existingStatus diff --git a/src/GToolkit-Coder-UI/GtFilterSignal.class.st b/src/GToolkit-Coder-UI/GtFilterSignal.class.st index e35e81b0f..9f00ce89b 100644 --- a/src/GToolkit-Coder-UI/GtFilterSignal.class.st +++ b/src/GToolkit-Coder-UI/GtFilterSignal.class.st @@ -3,3 +3,11 @@ Class { #superclass : #ContextStackSignal, #category : #'GToolkit-Coder-UI-Filters - Events' } + +{ #category : #testing } +GtFilterSignal class >> gtNormalOperationSignal [ + "Answer a Boolean indicating whether this signal is generated as part of normal operations. + See {{gtMethod:BeaconSignal class>>gtNormalOperationSignal}} for a description" + + ^ true. +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderProcessInDebuggerSignal.class.st b/src/GToolkit-Coder-UI/GtSourceCoderProcessInDebuggerSignal.class.st index 74d1e9a33..85828d8ce 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderProcessInDebuggerSignal.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderProcessInDebuggerSignal.class.st @@ -8,6 +8,14 @@ Class { #category : #'GToolkit-Coder-UI-Signals' } +{ #category : #testing } +GtSourceCoderProcessInDebuggerSignal class >> gtNormalOperationSignal [ + "Answer a Boolean indicating whether this signal is generated as part of normal operations. + See {{gtMethod:BeaconSignal class>>gtNormalOperationSignal}} for a description" + + ^ true. +] + { #category : #printing } GtSourceCoderProcessInDebuggerSignal >> printOneLineContentsOn: aStream [ aStream print: space diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElementSignal.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElementSignal.class.st index 5b560282a..5ca1361ec 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElementSignal.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElementSignal.class.st @@ -7,6 +7,14 @@ Class { #category : #'GToolkit-Coder-UI-Coder - Textual' } +{ #category : #testing } +GtTextualCoderEditorElementSignal class >> gtNormalOperationSignal [ + "Answer a Boolean indicating whether this signal is generated as part of normal operations. + Excluding these signals makes a good starting point for application specific logging, or logging unexpected signals" + + ^ true. +] + { #category : #accessing } GtTextualCoderEditorElementSignal >> element [ ^ element From d00f31f78998c1284b724885b016a0135e21f963 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Sat, 6 Sep 2025 20:11:13 +0200 Subject: [PATCH 1041/1268] Remove Pharo 10 support [feenkcom/gtoolkit#4617] --- .../GtCoderEvaluatedCodeIntervalFinder.class.st | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderEvaluatedCodeIntervalFinder.class.st b/src/GToolkit-Coder-UI/GtCoderEvaluatedCodeIntervalFinder.class.st index 31232cdda..94af1ad7c 100644 --- a/src/GToolkit-Coder-UI/GtCoderEvaluatedCodeIntervalFinder.class.st +++ b/src/GToolkit-Coder-UI/GtCoderEvaluatedCodeIntervalFinder.class.st @@ -53,13 +53,7 @@ GtCoderEvaluatedCodeIntervalFinder >> find [ context ifNil: [ ^ nil ]. context isDead ifTrue: [ ^ nil ]. - ^ self - forPharo11OrNewer: [ self debugSession pcRangeForContext: context ] - forPharo10: [ evaluatedCode ifNil: [ ^ nil ]. - sourceString ifNil: [ ^ nil ]. - self evaluatedCode - findSourceIntervalForContext: context - sourceString: sourceString ] + ^ self debugSession pcRangeForContext: context ] { #category : #accessing } From e5188a3d3ee72b9846da862c60f2c2549aeafba3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Mon, 8 Sep 2025 14:57:07 +0200 Subject: [PATCH 1042/1268] Add utility methods for getting the list if changes from a compiled method [feenkcom/gtoolkit#4651] --- .../CompiledMethod.extension.st | 34 +++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st b/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st index 2dcde2c6f..4fb778074 100644 --- a/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st +++ b/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st @@ -20,11 +20,34 @@ CompiledMethod >> gtBrowseFrom: anElement [ showFrom: anElement ] +{ #category : #'*GToolkit-Coder-Extensions' } +CompiledMethod >> gtChangeRecords [ + + + self sourcePointer ifNil: [ ^ #() ]. + + ^ SourceFiles + changeRecordsFrom: self sourcePointer + className: self methodClass instanceSide name + isMeta: self methodClass isMeta +] + { #category : #'*GToolkit-Coder-Extensions' } CompiledMethod >> gtDisplayOn: aStream [ aStream print: self methodClass; nextPutAll: '>>'; store: self selector. ] +{ #category : #'*GToolkit-Coder-Extensions' } +CompiledMethod >> gtLocalVersions [ + | changeRecords | + changeRecords := self gtChangeRecords. + ^ changeRecords withIndexCollect: [ :aChange :anIndex | + GtLocalVersion + change: aChange + previousChange: (changeRecords at: anIndex + 1 ifAbsent: [nil]) + currentMethod: self ] +] + { #category : #'*GToolkit-Coder-Extensions' } CompiledMethod >> gtLocalVersionsFor: aView [ @@ -35,16 +58,7 @@ CompiledMethod >> gtLocalVersionsFor: aView [ title: 'Local versions'; priority: 10; items: [ - | changeRecords | - changeRecords := SourceFiles - changeRecordsFrom: self sourcePointer - className: self methodClass instanceSide name - isMeta: self methodClass isMeta. - changeRecords withIndexCollect: [ :aChange :anIndex | - GtLocalVersion - change: aChange - previousChange: (changeRecords at: anIndex + 1 ifAbsent: [nil]) - currentMethod: self ] ]; + self gtLocalVersions ]; itemStencil: [ GtLocalVersionElement new ]; itemDataBinder: [ :aLocalVersionElement :aLocalVersion | aLocalVersionElement From 803dcc9e60db148f6bf3258d99df434fec2c9fe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Mon, 8 Sep 2025 14:57:32 +0200 Subject: [PATCH 1043/1268] Add an id for the button for accepting a version [feenkcom/gtoolkit#4651] --- .../BlLocalVersionAcceptVersionButtonId.class.st | 10 ++++++++++ .../GtLocalVersionElement.class.st | 1 + 2 files changed, 11 insertions(+) create mode 100644 src/GToolkit-Coder-Extensions/BlLocalVersionAcceptVersionButtonId.class.st diff --git a/src/GToolkit-Coder-Extensions/BlLocalVersionAcceptVersionButtonId.class.st b/src/GToolkit-Coder-Extensions/BlLocalVersionAcceptVersionButtonId.class.st new file mode 100644 index 000000000..d20202052 --- /dev/null +++ b/src/GToolkit-Coder-Extensions/BlLocalVersionAcceptVersionButtonId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #BlLocalVersionAcceptVersionButtonId, + #superclass : #BlElementUniqueId, + #category : #'GToolkit-Coder-Extensions' +} + +{ #category : #converting } +BlLocalVersionAcceptVersionButtonId >> asSymbol [ + ^ #'local-version-element--accept-change' +] diff --git a/src/GToolkit-Coder-Extensions/GtLocalVersionElement.class.st b/src/GToolkit-Coder-Extensions/GtLocalVersionElement.class.st index 74095ef64..ae601ddec 100644 --- a/src/GToolkit-Coder-Extensions/GtLocalVersionElement.class.st +++ b/src/GToolkit-Coder-Extensions/GtLocalVersionElement.class.st @@ -111,6 +111,7 @@ GtLocalVersionElement >> updateContent [ padding: (BlInsets left: 5); addChild: (BrButton new icon: BrGlamorousVectorIcons accept; + id:BlLocalVersionAcceptVersionButtonId; label: 'Use this version'; aptitude: BrGlamorousButtonWithIconAptitude; action: [ :aButton | localVersion loadChange ])) From 3de936282c65fe7b706ed1016b98a867681fa966 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Tue, 9 Sep 2025 14:00:01 +0200 Subject: [PATCH 1044/1268] Style block open brackes with the default style on error [feenkcom/gtoolkit#4681] --- src/GToolkit-Coder-UI/GtCodeDiffRBTextStyler.class.st | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtCodeDiffRBTextStyler.class.st b/src/GToolkit-Coder-UI/GtCodeDiffRBTextStyler.class.st index fd93ee291..a164c1cf8 100644 --- a/src/GToolkit-Coder-UI/GtCodeDiffRBTextStyler.class.st +++ b/src/GToolkit-Coder-UI/GtCodeDiffRBTextStyler.class.st @@ -12,3 +12,12 @@ GtCodeDiffRBTextStyler >> resolveStyleFor: aVariableNode [ ifTrue: [ #default ] ifFalse: [ value ] ] + +{ #category : #private } +GtCodeDiffRBTextStyler >> resolveStyleOpenBracket: aVariableNode [ + | value | + value := super resolveStyleOpenBracket: aVariableNode. + ^ value = #invalid + ifTrue: [ #default ] + ifFalse: [ value ] +] From 565ac8a7e2e49b0d2d93c7e339debcd73b0d3bed Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 9 Sep 2025 11:31:59 -0300 Subject: [PATCH 1045/1268] refactorings: add context menu ids [feenkcom/gtoolkit#4689] --- src/GToolkit-Coder-UI/Class.extension.st | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/Class.extension.st b/src/GToolkit-Coder-UI/Class.extension.st index 82d84d25c..7bbe11fb3 100644 --- a/src/GToolkit-Coder-UI/Class.extension.st +++ b/src/GToolkit-Coder-UI/Class.extension.st @@ -52,7 +52,8 @@ Class >> gtCoderSidebarIndexExtractSuperclassFrom: aGtCoderClassesTreeElement [ icon: BrGlamorousVectorIcons empty label: 'Extract superclass' preview: self name; - submenu: (aGtCoderClassesTreeElement convertToSiblingSubmenuFor: self siblings: #()) + submenu: (aGtCoderClassesTreeElement convertToSiblingSubmenuFor: self siblings: #()); + bePinSubmenuAction ] { #category : #'*GToolkit-Coder-UI' } @@ -69,6 +70,7 @@ Class >> gtCoderSidebarIndexNewSubclassFrom: aGtCoderClassesTreeElement [ Class >> gtCoderSidebarIndexRemoveClassFrom: aGtCoderClassesTreeElement [ ^ BrMenuSubmenuItem new + id: #'coder--context-menu-remove-class'; icon: BrGlamorousVectorIcons remove label: 'Remove class' preview: self name; From 6915bd0e5f7563614acd1315fd770a86ca832632 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 9 Sep 2025 21:00:32 -0300 Subject: [PATCH 1046/1268] use `GtRefactoringsPreviewWithInputElement` for rename class menu item [feenkcom/gtoolkit#4689] --- .../GtCoderClassesTreeElement.class.st | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index 9af3dca54..b01de12f2 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -421,12 +421,22 @@ GtCoderClassesTreeElement >> renameClassSubmenuFor: aClass [ | submenu | submenu := BrMenuExplicit new. submenu - stencil: [ GtRefactoringsWithInputPreviewElement - elementForRefactoring: [ :each | GtRBRenameClassRefactoring rename: aClass name to: each ] - labeled: 'Rename class: ' - initialValue: aClass name - from: self - beforeApplyingDo: [ submenu hideAll ] ]. + stencil: [ :anExplicitMenu | + | aViewModel | + aViewModel := GtRefactoringsViewModel new + refactoringTitle: 'Rename class'; + targetName: aClass name; + inputLabel: 'New class name:'; + initialText: aClass name; + refactoringBlock: [ :anInput | + GtRBRenameClassRefactoring + rename: aClass name + to: anInput ]; + beforeApplyBlock: [ anExplicitMenu hideAll ]; + menuModel: anExplicitMenu; + anchorElement: self. + GtRefactoringsPreviewWithInputElement new + refactoringsViewModel: aViewModel ]. ^ submenu ] From 4b613d9750bc7c38eedb95722efc0741c16d4897 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Wed, 10 Sep 2025 23:39:34 +0200 Subject: [PATCH 1047/1268] Use #forPharo12AndNewer:forPharo11: [feenkcom/gtoolkit#4616] --- .../GtCoderUncategorizedDummyClass.class.st | 4 ++-- .../GtCoderMethodsGroupedListElement.class.st | 8 ++++---- src/GToolkit-Coder-UI/GtCreationForm.class.st | 4 ++-- src/GToolkit-Coder/GtCoderParseError.class.st | 4 ++-- src/GToolkit-Coder/RPackage.extension.st | 4 ++-- .../ManifestGToolkitSearchFilters.class.st | 4 ++-- .../GtReservedVariablesBindings.class.st | 4 ++-- .../ManifestGToolkitVariableBindings.class.st | 4 ++-- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/GToolkit-Coder-Examples/GtCoderUncategorizedDummyClass.class.st b/src/GToolkit-Coder-Examples/GtCoderUncategorizedDummyClass.class.st index 42cf8e564..08253121e 100644 --- a/src/GToolkit-Coder-Examples/GtCoderUncategorizedDummyClass.class.st +++ b/src/GToolkit-Coder-Examples/GtCoderUncategorizedDummyClass.class.st @@ -21,9 +21,9 @@ GtCoderUncategorizedDummyClass >> checkUncategorized [ self assert: aPackageTag isRoot. self assert: aPackage name equals: 'GToolkit-Coder-Examples'. self - forPharo12: [ + forPharo12AndNewer: [ self assert: aPackageTag name equals: 'Uncategorized'.] - forPharo11AndPharo10: [ + forPharo11: [ self assert: aPackage name equals: aPackageTag name ]. ^ aPackageTag diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index 483fa624c..89d320dbe 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -340,8 +340,8 @@ GtCoderMethodsGroupedListElement >> pushDownMethodSubmenuFor: aMethod [ elementForRefactoring: [ RBPushDownMethodRefactoring pushDown: {aMethod selector} from: (self - forPharo12: [ aMethod methodClass name ] - forPharo11AndPharo10: [ aMethod methodClass ]) ] + forPharo12AndNewer: [ aMethod methodClass name ] + forPharo11: [ aMethod methodClass ]) ] confirmationLabeled: 'Push down ' , aMethod selector from: self beforeApplyingDo: [ submenu hideAll ] ]. @@ -365,8 +365,8 @@ GtCoderMethodsGroupedListElement >> pushDownSeveralMethodsSubmenuFor: aCollectio model: aModel; pushDown: (someMethods collect: #selector) from: (self - forPharo12: [ someMethods anyOne methodClass name ] - forPharo11AndPharo10: [ someMethods anyOne methodClass ]) ] + forPharo12AndNewer: [ someMethods anyOne methodClass name ] + forPharo11: [ someMethods anyOne methodClass ]) ] as: Array. aModel name: ('Push down {1} methods' format: {aCollectionOfMethods size}). aCollectionOfRefactorings ] diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index 67f8ef7af..afc12a4a1 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -55,9 +55,9 @@ GtCreationForm >> commitPackage [ ifFalse: [ aPackage := (Package named: packageAndTagName packageName). self - forPharo12: [ + forPharo12AndNewer: [ self class packageOrganizer addPackage: aPackage] - forPharo11AndPharo10: [ + forPharo11: [ aPackage register ]. ^ packageAndTagName tagName ifEmpty: [ aPackage ] diff --git a/src/GToolkit-Coder/GtCoderParseError.class.st b/src/GToolkit-Coder/GtCoderParseError.class.st index 6295afd27..1686c770e 100644 --- a/src/GToolkit-Coder/GtCoderParseError.class.st +++ b/src/GToolkit-Coder/GtCoderParseError.class.st @@ -33,9 +33,9 @@ GtCoderParseError >> exception: anException [ { #category : #testing } GtCoderParseError >> isUndeclaredError [ ^ self - forPharo12: [ (errorMessage beginsWith: 'Undeclared variable') + forPharo12AndNewer: [ (errorMessage beginsWith: 'Undeclared variable') or: [ errorMessage beginsWith: 'Undeclared temp' ] ] - forPharo11AndPharo10: [ exception isKindOf: OCUndeclaredVariableWarning ] + forPharo11: [ exception isKindOf: OCUndeclaredVariableWarning ] ] { #category : #accessing } diff --git a/src/GToolkit-Coder/RPackage.extension.st b/src/GToolkit-Coder/RPackage.extension.st index bd9425806..cbf08816b 100644 --- a/src/GToolkit-Coder/RPackage.extension.st +++ b/src/GToolkit-Coder/RPackage.extension.st @@ -5,6 +5,6 @@ RPackage >> tags [ ^ self - forPharo12: [ tags] - forPharo11AndPharo10: [ self classTags ] + forPharo12AndNewer: [ tags] + forPharo11: [ self classTags ] ] diff --git a/src/GToolkit-SearchFilters/ManifestGToolkitSearchFilters.class.st b/src/GToolkit-SearchFilters/ManifestGToolkitSearchFilters.class.st index 0d0b342a4..8f8594d15 100644 --- a/src/GToolkit-SearchFilters/ManifestGToolkitSearchFilters.class.st +++ b/src/GToolkit-SearchFilters/ManifestGToolkitSearchFilters.class.st @@ -15,7 +15,7 @@ ManifestGToolkitSearchFilters class >> mustOnlyDependOn [ 'Futures'. 'Kernel' }, (self - forPharo12: [{ + forPharo12AndNewer: [{ 'Kernel-CodeModel'.}] - forPharo11AndPharo10: [{}]) + forPharo11: [{}]) ] diff --git a/src/GToolkit-VariableBindings/GtReservedVariablesBindings.class.st b/src/GToolkit-VariableBindings/GtReservedVariablesBindings.class.st index 6c75d69dc..f295f8b3e 100644 --- a/src/GToolkit-VariableBindings/GtReservedVariablesBindings.class.st +++ b/src/GToolkit-VariableBindings/GtReservedVariablesBindings.class.st @@ -45,6 +45,6 @@ GtReservedVariablesBindings >> hash [ { #category : #binding } GtReservedVariablesBindings >> pseudoVariables [ ^ self - forPharo12: [ self class environment pseudoVariables ] - forPharo11AndPharo10: [ self class environment reservedVariables ] + forPharo12AndNewer: [ self class environment pseudoVariables ] + forPharo11: [ self class environment reservedVariables ] ] diff --git a/src/GToolkit-VariableBindings/ManifestGToolkitVariableBindings.class.st b/src/GToolkit-VariableBindings/ManifestGToolkitVariableBindings.class.st index c2c40d0d8..508902c37 100644 --- a/src/GToolkit-VariableBindings/ManifestGToolkitVariableBindings.class.st +++ b/src/GToolkit-VariableBindings/ManifestGToolkitVariableBindings.class.st @@ -14,7 +14,7 @@ ManifestGToolkitVariableBindings class >> mustOnlyDependOn [ 'Collections-Unordered'. 'Kernel' }, (self - forPharo12: [{ + forPharo12AndNewer: [{ 'Kernel-CodeModel'.}] - forPharo11AndPharo10: [{}]) + forPharo11: [{}]) ] From 8b845beab4a1cb536ce90a4ac876e108ae735fda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Thu, 11 Sep 2025 14:42:51 +0200 Subject: [PATCH 1048/1268] Examples for filtering for unclassified methods [feenkcom/gtoolkit#4694] --- src/GToolkit-Coder-Examples/GtFilterStubSampleA.class.st | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/GToolkit-Coder-Examples/GtFilterStubSampleA.class.st b/src/GToolkit-Coder-Examples/GtFilterStubSampleA.class.st index aa174778d..ec75f1a6e 100644 --- a/src/GToolkit-Coder-Examples/GtFilterStubSampleA.class.st +++ b/src/GToolkit-Coder-Examples/GtFilterStubSampleA.class.st @@ -13,3 +13,8 @@ GtFilterStubSampleA >> anotherMethodReferencingSampleBAndSendingNew [ GtFilterStubSampleA >> methodReferencingSampleB [ ^ GtFilterStubSampleB ] + +{ #category : #'as yet unclassified' } +GtFilterStubSampleA >> uncategoriedMethodForFilter [ + "This method should remain uncategoried" +] From 429293271af6bdd1e9a87d85137a6b35939c3c8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Thu, 11 Sep 2025 16:02:18 +0200 Subject: [PATCH 1049/1268] Remove gtView pragma from CompiledMethod>>#gtChangeRecords --- src/GToolkit-Coder-Extensions/CompiledMethod.extension.st | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st b/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st index 4fb778074..5aedfc2ad 100644 --- a/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st +++ b/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st @@ -22,8 +22,6 @@ CompiledMethod >> gtBrowseFrom: anElement [ { #category : #'*GToolkit-Coder-Extensions' } CompiledMethod >> gtChangeRecords [ - - self sourcePointer ifNil: [ ^ #() ]. ^ SourceFiles From 857ddfbfa5dcaab54a0772fc6343e3ce8797c368 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 11 Sep 2025 15:20:28 -0300 Subject: [PATCH 1050/1268] refactorings: use `GtRefactoringsWithInputViewModel` [feenkcom/gtoolkit#4695] --- src/GToolkit-Coder-UI/Class.extension.st | 5 ++++- src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/Class.extension.st b/src/GToolkit-Coder-UI/Class.extension.st index 7bbe11fb3..c163ba139 100644 --- a/src/GToolkit-Coder-UI/Class.extension.st +++ b/src/GToolkit-Coder-UI/Class.extension.st @@ -52,7 +52,10 @@ Class >> gtCoderSidebarIndexExtractSuperclassFrom: aGtCoderClassesTreeElement [ icon: BrGlamorousVectorIcons empty label: 'Extract superclass' preview: self name; - submenu: (aGtCoderClassesTreeElement convertToSiblingSubmenuFor: self siblings: #()); + submenu: (aGtCoderClassesTreeElement + convertToSiblingSubmenuFor: self + siblings: #() + title: 'Extract superclass'); bePinSubmenuAction ] diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index b01de12f2..aa915c676 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -423,12 +423,12 @@ GtCoderClassesTreeElement >> renameClassSubmenuFor: aClass [ submenu stencil: [ :anExplicitMenu | | aViewModel | - aViewModel := GtRefactoringsViewModel new + aViewModel := GtRefactoringsWithInputViewModel new refactoringTitle: 'Rename class'; targetName: aClass name; inputLabel: 'New class name:'; initialText: aClass name; - refactoringBlock: [ :anInput | + refactoringWithInput: [ :anInput | GtRBRenameClassRefactoring rename: aClass name to: anInput ]; From 24721ae704b68d757471da0dd7a273fd8ba6aec0 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 16 Sep 2025 08:57:37 -0300 Subject: [PATCH 1051/1268] add `GtPharoCreationForm>>#secureCommit` [feenkcom/gtoolkit#4706] --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index afc12a4a1..59fffa75f 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -88,7 +88,7 @@ GtCreationForm >> magritteAcceptAction [ onSuccessCallback: (GtMagritteCallback new action: [ :aModel :aButton :aMemento :aDescription | [ | aClass | - aClass := self commit. + aClass := self secureCommit. onAccept ifNotNil: [ onAccept value: aClass ] ] on: Error do: #debug ]); beEnabledOnValidOverallStatus @@ -161,6 +161,13 @@ GtCreationForm >> packageAndTagName: anObject [ packageAndTagName := anObject ] +{ #category : #callbacks } +GtCreationForm >> secureCommit [ + "Subclasses may use a mutex to prevent race conditions." + + ^ self commit +] + { #category : #accessing } GtCreationForm >> selectInNavigationModel: aNavigationModel anInstance: anInstance [ aNavigationModel selectPackage: anInstance package. From 0b02cd0e594b2ac0f91b238de13124f514ed2b18 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 17 Sep 2025 11:21:20 -0300 Subject: [PATCH 1052/1268] pull up refactoring element with fixed width [feenkcom/gtoolkit#4689] --- src/GToolkit-Coder-UI/Class.extension.st | 3 +- .../GtCoderClassesTreeElement.class.st | 6 ++- .../GtCoderSlotsGroupedListElement.class.st | 48 ++++++++++++++----- 3 files changed, 41 insertions(+), 16 deletions(-) diff --git a/src/GToolkit-Coder-UI/Class.extension.st b/src/GToolkit-Coder-UI/Class.extension.st index c163ba139..e5b1fa116 100644 --- a/src/GToolkit-Coder-UI/Class.extension.st +++ b/src/GToolkit-Coder-UI/Class.extension.st @@ -97,5 +97,6 @@ Class >> gtCoderSidebarIndexRenameClassFrom: aGtCoderClassesTreeElement [ icon: BrGlamorousVectorIcons empty label: 'Rename class' preview: self name; - submenu: (aGtCoderClassesTreeElement renameClassSubmenuFor: self) + submenu: (aGtCoderClassesTreeElement renameClassSubmenuFor: self); + bePinSubmenuAction ] diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index aa915c676..5a1de0645 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -432,11 +432,13 @@ GtCoderClassesTreeElement >> renameClassSubmenuFor: aClass [ GtRBRenameClassRefactoring rename: aClass name to: anInput ]; - beforeApplyBlock: [ anExplicitMenu hideAll ]; + afterAppliedBlock: [ anExplicitMenu hideAll ]; menuModel: anExplicitMenu; anchorElement: self. GtRefactoringsPreviewWithInputElement new - refactoringsViewModel: aViewModel ]. + refactoringsViewModel: aViewModel; + beContextMenuElement; + bePinnable: anExplicitMenu ]. ^ submenu ] diff --git a/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st index 05dfba3c5..4c22a9715 100644 --- a/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st @@ -53,8 +53,9 @@ GtCoderSlotsGroupedListElement >> contextMenuFor: item [ action: [ self browseSlotReferencesFor: item name ]. menu addItem: (BrMenuSubmenuItem new - label: (self createLabel: 'Push up' description: item name); - submenu: (self pushUpSubmenuFor: item name)). + label: (self createLabel: 'Pull up' description: item name); + submenu: (self pullUpSubmenuFor: item name); + bePinSubmenuAction). menu addItem: (BrMenuSubmenuItem new label: (self createLabel: 'Push down' description: item name); @@ -205,30 +206,51 @@ GtCoderSlotsGroupedListElement >> protectSubmenuFor: aString [ ] { #category : #'private - context menu' } -GtCoderSlotsGroupedListElement >> pushDownSubmenuFor: aString [ +GtCoderSlotsGroupedListElement >> pullUpSubmenuFor: aString [ | submenu | submenu := BrMenuExplicit new. submenu - stencil: [ GtRefactoringsWithInputPreviewElement - elementForRefactoring: [ GtPushDownInstanceVariableRefactoring + stencil: [ :anExplicitMenu | + | aViewModel | + aViewModel := GtRefactoringsWithConfirmationViewModel new + refactoringTitle: 'Pull up'; + targetName: ('{1}''s {2} instance variable' format: { self selectedClass name. aString }); + confirmationLabel: ('Pull up {1}' format: { aString }); + refactoringWithConfirmation: [ RBPullUpInstanceVariableRefactoring variable: aString - class: self selectedClass ] - confirmationLabeled: 'Push down ' , aString - from: self - beforeApplyingDo: [ submenu hideAll ] ]. + class: self selectedClass superclass ]; + afterAppliedBlock: [ anExplicitMenu hideAll ]; + menuModel: anExplicitMenu; + anchorElement: self. + GtRefactoringsPreviewWithConfirmationElement new + refactoringsViewModel: aViewModel; + beContextMenuElement; + bePinnable: anExplicitMenu ]. + + false ifTrue: [ + submenu := BrMenuExplicit new. + submenu + stencil: [ GtRefactoringsWithInputPreviewElement + elementForRefactoring: [ RBPullUpInstanceVariableRefactoring + variable: aString + class: self selectedClass superclass ] + confirmationLabeled: 'Push up ' , aString + from: self + beforeApplyingDo: [ submenu hideAll ] ] ]. + ^ submenu ] { #category : #'private - context menu' } -GtCoderSlotsGroupedListElement >> pushUpSubmenuFor: aString [ +GtCoderSlotsGroupedListElement >> pushDownSubmenuFor: aString [ | submenu | submenu := BrMenuExplicit new. submenu stencil: [ GtRefactoringsWithInputPreviewElement - elementForRefactoring: [ RBPullUpInstanceVariableRefactoring + elementForRefactoring: [ GtPushDownInstanceVariableRefactoring variable: aString - class: self selectedClass superclass ] - confirmationLabeled: 'Push up ' , aString + class: self selectedClass ] + confirmationLabeled: 'Push down ' , aString from: self beforeApplyingDo: [ submenu hideAll ] ]. ^ submenu From fdfe82e38b311a29325194af7444b9e2b2ac854d Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 17 Sep 2025 11:39:26 -0300 Subject: [PATCH 1053/1268] slot context menu refactorings use an element with a fixed width [feenkcom/gtoolkit#4689] --- .../GtCoderSlotsGroupedListElement.class.st | 150 ++++++++++++------ 1 file changed, 99 insertions(+), 51 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st index 4c22a9715..71f1b08f0 100644 --- a/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st @@ -14,14 +14,25 @@ Class { GtCoderSlotsGroupedListElement >> abstractSubmenuFor: aString [ | submenu | submenu := BrMenuExplicit new. + submenu - stencil: [ GtRefactoringsWithInputPreviewElement - elementForRefactoring: [ RBAbstractInstanceVariableRefactoring + stencil: [ :anExplicitMenu | + | aViewModel | + aViewModel := GtRefactoringsWithConfirmationViewModel new + refactoringTitle: 'Abstract'; + targetName: ('{1}''s {2} inst. variable' format: { self selectedClass name. aString }); + confirmationLabel: ('Abstract {1}' format: { aString }); + refactoringWithConfirmation: [ RBAbstractInstanceVariableRefactoring variable: aString - class: self selectedClass ] - confirmationLabeled: 'Abstract ' , aString - from: self - beforeApplyingDo: [ submenu hideAll ] ]. + class: self selectedClass ]; + afterAppliedBlock: [ anExplicitMenu hideAll ]; + menuModel: anExplicitMenu; + anchorElement: self. + GtRefactoringsPreviewWithConfirmationElement new + refactoringsViewModel: aViewModel; + beContextMenuElement; + bePinnable: anExplicitMenu ]. + ^ submenu ] @@ -59,19 +70,23 @@ GtCoderSlotsGroupedListElement >> contextMenuFor: item [ menu addItem: (BrMenuSubmenuItem new label: (self createLabel: 'Push down' description: item name); - submenu: (self pushDownSubmenuFor: item name)). + submenu: (self pushDownSubmenuFor: item name); + bePinSubmenuAction). menu addItem: (BrMenuSubmenuItem new label: (self createLabel: 'Create accessors' description: item name); - submenu: (self createAccessorsSubmenuFor: item name)). + submenu: (self createAccessorsSubmenuFor: item name); + bePinSubmenuAction). menu addItem: (BrMenuSubmenuItem new label: (self createLabel: 'Abstract' description: item name); - submenu: (self abstractSubmenuFor: item name)). + submenu: (self abstractSubmenuFor: item name); + bePinSubmenuAction). menu addItem: (BrMenuSubmenuItem new label: (self createLabel: 'Protect' description: item name); - submenu: (self protectSubmenuFor: item name)). + submenu: (self protectSubmenuFor: item name); + bePinSubmenuAction). menu addItem: (BrMenuSubmenuItem new label: (self createLabel: 'Remove' description: item name); @@ -79,7 +94,8 @@ GtCoderSlotsGroupedListElement >> contextMenuFor: item [ menu addItem: (BrMenuSubmenuItem new label: (self createLabel: 'Rename' description: item name); - submenu: (self renameSubmenuFor: item name)). + submenu: (self renameSubmenuFor: item name); + bePinSubmenuAction). ^ menu ] @@ -87,14 +103,25 @@ GtCoderSlotsGroupedListElement >> contextMenuFor: item [ GtCoderSlotsGroupedListElement >> createAccessorsSubmenuFor: aString [ | submenu | submenu := BrMenuExplicit new. + submenu - stencil: [ GtRefactoringsWithInputPreviewElement - elementForRefactoring: [ RBCreateAccessorsForVariableRefactoring + stencil: [ :anExplicitMenu | + | aViewModel | + aViewModel := GtRefactoringsWithConfirmationViewModel new + refactoringTitle: 'Create accessors'; + targetName: ('{1}''s {2} inst. variable' format: { self selectedClass name. aString }); + confirmationLabel: ('Create accessors {1}' format: { aString }); + refactoringWithConfirmation: [ RBCreateAccessorsForVariableRefactoring instanceVariable: aString - class: self selectedClass ] - confirmationLabeled: 'Create accessors ' , aString - from: self - beforeApplyingDo: [ submenu hideAll ] ]. + class: self selectedClass ]; + afterAppliedBlock: [ anExplicitMenu hideAll ]; + menuModel: anExplicitMenu; + anchorElement: self. + GtRefactoringsPreviewWithConfirmationElement new + refactoringsViewModel: aViewModel; + beContextMenuElement; + bePinnable: anExplicitMenu ]. + ^ submenu ] @@ -194,14 +221,25 @@ GtCoderSlotsGroupedListElement >> onSlotsToShowChanged: anAnnouncement [ GtCoderSlotsGroupedListElement >> protectSubmenuFor: aString [ | submenu | submenu := BrMenuExplicit new. + submenu - stencil: [ GtRefactoringsWithInputPreviewElement - elementForRefactoring: [ RBProtectInstanceVariableRefactoring + stencil: [ :anExplicitMenu | + | aViewModel | + aViewModel := GtRefactoringsWithConfirmationViewModel new + refactoringTitle: 'Protect'; + targetName: ('{1}''s {2} inst. variable' format: { self selectedClass name. aString }); + confirmationLabel: ('Protect {1}' format: { aString }); + refactoringWithConfirmation: [ RBProtectInstanceVariableRefactoring variable: aString - class: self selectedClass ] - confirmationLabeled: 'Protect ' , aString - from: self - beforeApplyingDo: [ submenu hideAll ] ]. + class: self selectedClass ]; + afterAppliedBlock: [ anExplicitMenu hideAll ]; + menuModel: anExplicitMenu; + anchorElement: self. + GtRefactoringsPreviewWithConfirmationElement new + refactoringsViewModel: aViewModel; + beContextMenuElement; + bePinnable: anExplicitMenu ]. + ^ submenu ] @@ -214,7 +252,7 @@ GtCoderSlotsGroupedListElement >> pullUpSubmenuFor: aString [ | aViewModel | aViewModel := GtRefactoringsWithConfirmationViewModel new refactoringTitle: 'Pull up'; - targetName: ('{1}''s {2} instance variable' format: { self selectedClass name. aString }); + targetName: ('{1}''s {2} inst. variable' format: { self selectedClass name. aString }); confirmationLabel: ('Pull up {1}' format: { aString }); refactoringWithConfirmation: [ RBPullUpInstanceVariableRefactoring variable: aString @@ -227,17 +265,6 @@ GtCoderSlotsGroupedListElement >> pullUpSubmenuFor: aString [ beContextMenuElement; bePinnable: anExplicitMenu ]. - false ifTrue: [ - submenu := BrMenuExplicit new. - submenu - stencil: [ GtRefactoringsWithInputPreviewElement - elementForRefactoring: [ RBPullUpInstanceVariableRefactoring - variable: aString - class: self selectedClass superclass ] - confirmationLabeled: 'Push up ' , aString - from: self - beforeApplyingDo: [ submenu hideAll ] ] ]. - ^ submenu ] @@ -245,14 +272,25 @@ GtCoderSlotsGroupedListElement >> pullUpSubmenuFor: aString [ GtCoderSlotsGroupedListElement >> pushDownSubmenuFor: aString [ | submenu | submenu := BrMenuExplicit new. + submenu - stencil: [ GtRefactoringsWithInputPreviewElement - elementForRefactoring: [ GtPushDownInstanceVariableRefactoring + stencil: [ :anExplicitMenu | + | aViewModel | + aViewModel := GtRefactoringsWithConfirmationViewModel new + refactoringTitle: 'Push down'; + targetName: ('{1}''s {2} inst. variable' format: { self selectedClass name. aString }); + confirmationLabel: ('Push down {1}' format: { aString }); + refactoringWithConfirmation: [ GtPushDownInstanceVariableRefactoring variable: aString - class: self selectedClass ] - confirmationLabeled: 'Push down ' , aString - from: self - beforeApplyingDo: [ submenu hideAll ] ]. + class: self selectedClass ]; + afterAppliedBlock: [ anExplicitMenu hideAll ]; + menuModel: anExplicitMenu; + anchorElement: self. + GtRefactoringsPreviewWithConfirmationElement new + refactoringsViewModel: aViewModel; + beContextMenuElement; + bePinnable: anExplicitMenu ]. + ^ submenu ] @@ -312,17 +350,27 @@ GtCoderSlotsGroupedListElement >> removeSubmenuFor: aString [ GtCoderSlotsGroupedListElement >> renameSubmenuFor: aString [ | submenu | submenu := BrMenuExplicit new. + submenu - stencil: [ GtRefactoringsWithInputPreviewElement - elementForRefactoring: [ :each | - RBRenameInstanceVariableRefactoring - rename: aString - to: each - in: self selectedClass ] - labeled: 'Rename slot: ' - initialValue: aString - from: self - beforeApplyingDo: [ submenu hideAll ] ]. + stencil: [ :anExplicitMenu | + | aViewModel | + aViewModel := GtRefactoringsWithInputViewModel new + refactoringTitle: 'Rename slot'; + targetName: ('{1}''s {2} inst. variable' format: { self selectedClass name. aString }); + inputLabel: 'Rename slot:'; + refactoringWithInput: [ :anInput | + RBRenameInstanceVariableRefactoring + rename: aString + to: anInput + in: self selectedClass ]; + afterAppliedBlock: [ anExplicitMenu hideAll ]; + menuModel: anExplicitMenu; + anchorElement: self. + GtRefactoringsPreviewWithInputElement new + refactoringsViewModel: aViewModel; + beContextMenuElement; + bePinnable: anExplicitMenu ]. + ^ submenu ] From e0ce1c61a566f8da93d8fd044294060bfda486d5 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 17 Sep 2025 17:19:34 -0300 Subject: [PATCH 1054/1268] add slot context menu groups [feenkcom/gtoolkit#4689] --- .../GtCoderSlotsGroupedListElement.class.st | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st index 71f1b08f0..b7d6099d3 100644 --- a/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st @@ -59,40 +59,48 @@ GtCoderSlotsGroupedListElement >> computeSlotItemText: aSlot [ GtCoderSlotsGroupedListElement >> contextMenuFor: item [ | menu | menu := BrMenuItems new. - menu - addItemLabel: (self createLabel: 'Browse references' description: item name) - action: [ self browseSlotReferencesFor: item name ]. + menu addItem: (BrMenuActionItem new + group: BrMenuItemGroupConfiguration navigation; + label: (self createLabel: 'Browse references' description: item name); + action: [ self browseSlotReferencesFor: item name ]). menu addItem: (BrMenuSubmenuItem new + group: BrMenuItemGroupConfiguration refactoring; label: (self createLabel: 'Pull up' description: item name); submenu: (self pullUpSubmenuFor: item name); bePinSubmenuAction). menu addItem: (BrMenuSubmenuItem new + group: BrMenuItemGroupConfiguration refactoring; label: (self createLabel: 'Push down' description: item name); submenu: (self pushDownSubmenuFor: item name); bePinSubmenuAction). menu addItem: (BrMenuSubmenuItem new + group: BrMenuItemGroupConfiguration refactoring; label: (self createLabel: 'Create accessors' description: item name); submenu: (self createAccessorsSubmenuFor: item name); bePinSubmenuAction). menu addItem: (BrMenuSubmenuItem new + group: BrMenuItemGroupConfiguration refactoring; label: (self createLabel: 'Abstract' description: item name); submenu: (self abstractSubmenuFor: item name); bePinSubmenuAction). menu addItem: (BrMenuSubmenuItem new + group: BrMenuItemGroupConfiguration refactoring; label: (self createLabel: 'Protect' description: item name); submenu: (self protectSubmenuFor: item name); bePinSubmenuAction). menu addItem: (BrMenuSubmenuItem new + group: BrMenuItemGroupConfiguration refactoring; label: (self createLabel: 'Remove' description: item name); submenu: (self removeSubmenuFor: item name)). menu addItem: (BrMenuSubmenuItem new + group: BrMenuItemGroupConfiguration refactoring; label: (self createLabel: 'Rename' description: item name); submenu: (self renameSubmenuFor: item name); bePinSubmenuAction). From 2ca1b3a2930b53cef0cafa6c97d7b26c208852c6 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 17 Sep 2025 22:07:32 -0300 Subject: [PATCH 1055/1268] refactorings: fixed refactoring context menu width [feenkcom/gtoolkit#4689] --- .../GtCoderMethodsGroupedListElement.class.st | 282 +++++++++++------- 1 file changed, 181 insertions(+), 101 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index 89d320dbe..39881eb1f 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -99,31 +99,46 @@ GtCoderMethodsGroupedListElement >> contextMenuForOneItem: item in: anElement [ | menu | menu := BrMenuItems new. menu - addItemLabel: (self createLabel: 'Browse implementors' description: item selector) - action: [ self browseImplementorsOf: item selector ]. + addItem: (BrMenuActionItem new + group: BrMenuItemGroupConfiguration navigation; + label: (self createLabel: 'Browse implementors' description: item selector); + action: [ self browseImplementorsOf: item selector ]). menu - addItemLabel: (self createLabel: 'Browse hierarchy implementors' description: item selector) - action: [ self browseHierarchyImplementorsOf: item selector ]. + addItem: (BrMenuActionItem new + group: BrMenuItemGroupConfiguration navigation; + label: (self createLabel: 'Browse hierarchy implementors' description: item selector); + action: [ self browseHierarchyImplementorsOf: item selector ]). menu - addItemLabel: (self createLabel: 'Browse references' description: item selector) - action: [ self browseReferencesOf: item selector ]. + addItem: (BrMenuActionItem new + group: BrMenuItemGroupConfiguration navigation; + label: (self createLabel: 'Browse references' description: item selector); + action: [ self browseReferencesOf: item selector ]). menu - addItemLabel: (self createLabel: 'Browse hierarchy references' description: item selector) - action: [ self browseHierarchyReferencesOf: item selector ]. + addItem: (BrMenuActionItem new + group: BrMenuItemGroupConfiguration navigation; + label: (self createLabel: 'Browse hierarchy references' description: item selector); + action: [ self browseHierarchyReferencesOf: item selector ]). menu addItem: (BrMenuSubmenuItem new + group: BrMenuItemGroupConfiguration refactoring; label: (self createLabel: 'Pull up method' description: item selector); - submenu: (self pushUpMethodSubmenuFor: item)). + submenu: (self pullUpMethodSubmenuFor: item); + bePinSubmenuAction). menu addItem: (BrMenuSubmenuItem new + group: BrMenuItemGroupConfiguration refactoring; label: (self createLabel: 'Push down method' description: item selector); - submenu: (self pushDownMethodSubmenuFor: item)). + submenu: (self pushDownMethodSubmenuFor: item); + bePinSubmenuAction). menu addItem: (BrMenuSubmenuItem new + group: BrMenuItemGroupConfiguration refactoring; label: (self createLabel: 'Rename message' description: item selector); - submenu: (self renameMethodSubmenuFor: item)). + submenu: (self renameMethodSubmenuFor: item); + bePinSubmenuAction). menu addItem: (BrMenuSubmenuItem new + group: BrMenuItemGroupConfiguration refactoring; label: (self createLabel: 'Remove method' description: item selector); submenu: (self removeMethodSubmenuFor: item)). ^ menu @@ -134,42 +149,54 @@ GtCoderMethodsGroupedListElement >> contextMenuForSeveralItems: someItems in: an | menu | menu := BrMenuItems new. menu - addItemLabel: (self - createLabel: 'Browse implementors' - description: ('{1} methods' format: {someItems size})) - action: [ self browseSeveralImplementorsOf: (someItems collect: #selector) ]. + addItem: (BrMenuActionItem new + group: BrMenuItemGroupConfiguration navigation; + label: (self + createLabel: 'Browse implementors' + description: ('{1} methods' format: {someItems size})); + action: [ self browseSeveralImplementorsOf: (someItems collect: #selector) ]). menu - addItemLabel: (self - createLabel: 'Browse hierarachy implementors' - description: ('{1} methods' format: {someItems size})) - action: [ self - browseSeveralHierarchyImplementorsOf: (someItems collect: #selector) ]. + addItem: (BrMenuActionItem new + group: BrMenuItemGroupConfiguration navigation; + label: (self + createLabel: 'Browse hierarachy implementors' + description: ('{1} methods' format: {someItems size})); + action: [ self browseSeveralHierarchyImplementorsOf: (someItems collect: #selector) ]). menu - addItemLabel: (self - createLabel: 'Browse references' - description: ('{1} methods' format: {someItems size})) - action: [ self browseSeveralReferencesOf: (someItems collect: #selector) ]. + addItem: (BrMenuActionItem new + group: BrMenuItemGroupConfiguration navigation; + label: (self + createLabel: 'Browse references' + description: ('{1} methods' format: {someItems size})); + action: [ self browseSeveralReferencesOf: (someItems collect: #selector) ]). menu - addItemLabel: (self - createLabel: 'Browse hierarchy references' - description: ('{1} methods' format: {someItems size})) - action: [ self browseSeveralHierarchyReferencesOf: (someItems collect: #selector) ]. - + addItem: (BrMenuActionItem new + group: BrMenuItemGroupConfiguration navigation; + label: (self + createLabel: 'Browse hierarchy references' + description: ('{1} methods' format: {someItems size})); + action: [ self browseSeveralHierarchyReferencesOf: (someItems collect: #selector) ]). + menu addItem: (BrMenuSubmenuItem new + group: BrMenuItemGroupConfiguration refactoring; label: (self createLabel: 'Pull up methods' description: ('{1} methods' format: {someItems size})); - submenu: (self pushUpSeveralMethodsSubmenuFor: someItems)). + submenu: (self pullUpSeveralMethodsSubmenuFor: someItems); + bePinSubmenuAction). menu addItem: (BrMenuSubmenuItem new + group: BrMenuItemGroupConfiguration refactoring; label: (self createLabel: 'Push down methods' description: ('{1} methods' format: {someItems size})); - submenu: (self pushDownSeveralMethodsSubmenuFor: someItems)). - + submenu: (self pushDownSeveralMethodsSubmenuFor: someItems); + bePinSubmenuAction). + menu addItem: (BrMenuSubmenuItem new + group: BrMenuItemGroupConfiguration refactoring; label: (self createLabel: 'Remove methods' description: ('{1} methods' format: {someItems size})); @@ -332,88 +359,130 @@ GtCoderMethodsGroupedListElement >> onMethodsToShowChanged: anAnnouncement [ ] { #category : #'private - context menu' } -GtCoderMethodsGroupedListElement >> pushDownMethodSubmenuFor: aMethod [ +GtCoderMethodsGroupedListElement >> pullUpMethodSubmenuFor: aMethod [ | submenu | submenu := BrMenuExplicit new. + submenu - stencil: [ GtRefactoringsWithInputPreviewElement - elementForRefactoring: [ RBPushDownMethodRefactoring - pushDown: {aMethod selector} - from: (self - forPharo12AndNewer: [ aMethod methodClass name ] - forPharo11: [ aMethod methodClass ]) ] - confirmationLabeled: 'Push down ' , aMethod selector - from: self - beforeApplyingDo: [ submenu hideAll ] ]. + stencil: [ :anExplicitMenu | + | aViewModel | + aViewModel := GtRefactoringsWithConfirmationViewModel new + refactoringTitle: 'Pull up'; + targetName: ('{1}>>#{2}' format: { aMethod methodClass. aMethod selector }); + confirmationLabel: ('Pull up {1}' format: { aMethod selector }); + refactoringWithConfirmation: [ RBPullUpMethodRefactoring + pullUp: {aMethod selector} + from: aMethod methodClass ]; + afterAppliedBlock: [ anExplicitMenu hideAll ]; + menuModel: anExplicitMenu; + anchorElement: self. + GtRefactoringsPreviewWithConfirmationElement new + refactoringsViewModel: aViewModel; + beContextMenuElement; + bePinnable: anExplicitMenu ]. + ^ submenu - ] { #category : #'private - context menu' } -GtCoderMethodsGroupedListElement >> pushDownSeveralMethodsSubmenuFor: aCollectionOfMethods [ +GtCoderMethodsGroupedListElement >> pullUpSeveralMethodsSubmenuFor: aCollectionOfMethods [ | submenu | submenu := BrMenuExplicit new. + submenu - stencil: [ GtRefactoringsWithInputPreviewElement - elementForRefactoring: [ | aGroupByClass aModel aCollectionOfRefactorings | - aGroupByClass := aCollectionOfMethods groupedBy: #methodClass. - aModel := Smalltalk createRbNamespace - onEnvironment: RBPushDownMethodRefactoring new defaultEnvironment. - aCollectionOfRefactorings := aGroupByClass - collect: [ :someMethods | - RBPushDownMethodRefactoring new - model: aModel; - pushDown: (someMethods collect: #selector) - from: (self - forPharo12AndNewer: [ someMethods anyOne methodClass name ] - forPharo11: [ someMethods anyOne methodClass ]) ] - as: Array. - aModel name: ('Push down {1} methods' format: {aCollectionOfMethods size}). - aCollectionOfRefactorings ] - confirmationLabeled: ('Push down {1} methods' - format: {aCollectionOfMethods size}) - from: self - beforeApplyingDo: [ submenu hideAll ] ]. + stencil: [ :anExplicitMenu | + | aViewModel | + aViewModel := GtRefactoringsWithConfirmationViewModel new + refactoringTitle: 'Pull up'; + targetName: ('{1} methods' format: {aCollectionOfMethods size}); + confirmationLabel: ('Pull up {1} methods' format: {aCollectionOfMethods size}); + refactoringsWithConfirmation: [ | aGroupByClass aModel aCollectionOfRefactorings | + aGroupByClass := aCollectionOfMethods groupedBy: #methodClass. + aModel := Smalltalk createRbNamespace + onEnvironment: RBPullUpMethodRefactoring new defaultEnvironment. + aCollectionOfRefactorings := aGroupByClass + collect: [ :someMethods | + RBPullUpMethodRefactoring new + model: aModel; + pullUp: (someMethods collect: #selector) + from: someMethods anyOne methodClass ] + as: Array. + aModel name: ('Pull up {1} methods' format: {aCollectionOfMethods size}). + aCollectionOfRefactorings ]; + afterAppliedBlock: [ anExplicitMenu hideAll ]; + menuModel: anExplicitMenu; + anchorElement: self. + GtRefactoringsPreviewWithConfirmationElement new + refactoringsViewModel: aViewModel; + beContextMenuElement; + bePinnable: anExplicitMenu ]. + ^ submenu ] { #category : #'private - context menu' } -GtCoderMethodsGroupedListElement >> pushUpMethodSubmenuFor: aMethod [ +GtCoderMethodsGroupedListElement >> pushDownMethodSubmenuFor: aMethod [ | submenu | submenu := BrMenuExplicit new. + submenu - stencil: [ GtRefactoringsWithInputPreviewElement - elementForRefactoring: [ RBPullUpMethodRefactoring - pullUp: {aMethod selector} - from: aMethod methodClass ] - confirmationLabeled: 'Pull up ' , aMethod selector - from: self - beforeApplyingDo: [ submenu hideAll ] ]. + stencil: [ :anExplicitMenu | + | aViewModel | + aViewModel := GtRefactoringsWithConfirmationViewModel new + refactoringTitle: 'Push down'; + targetName: ('{1}>>#{2}' format: { aMethod methodClass. aMethod selector }); + confirmationLabel: ('Push down {1}' format: { aMethod selector }); + refactoringWithConfirmation: [ RBPushDownMethodRefactoring + pushDown: {aMethod selector} + from: (self + forPharo12AndNewer: [ aMethod methodClass name ] + forPharo11: [ aMethod methodClass ]) ]; + afterAppliedBlock: [ anExplicitMenu hideAll ]; + menuModel: anExplicitMenu; + anchorElement: self. + GtRefactoringsPreviewWithConfirmationElement new + refactoringsViewModel: aViewModel; + beContextMenuElement; + bePinnable: anExplicitMenu ]. + ^ submenu ] { #category : #'private - context menu' } -GtCoderMethodsGroupedListElement >> pushUpSeveralMethodsSubmenuFor: aCollectionOfMethods [ +GtCoderMethodsGroupedListElement >> pushDownSeveralMethodsSubmenuFor: aCollectionOfMethods [ | submenu | submenu := BrMenuExplicit new. + submenu - stencil: [ GtRefactoringsWithInputPreviewElement - elementForRefactoring: [ | aGroupByClass aModel aCollectionOfRefactorings | - aGroupByClass := aCollectionOfMethods groupedBy: #methodClass. - aModel := Smalltalk createRbNamespace - onEnvironment: RBPullUpMethodRefactoring new defaultEnvironment. - aCollectionOfRefactorings := aGroupByClass - collect: [ :someMethods | - RBPullUpMethodRefactoring new - model: aModel; - pullUp: (someMethods collect: #selector) - from: someMethods anyOne methodClass ] as: Array. - aModel name: ('Pull up {1} methods' format: {aCollectionOfMethods size}). - aCollectionOfRefactorings ] - confirmationLabeled: ('Pull up {1} methods' - format: {aCollectionOfMethods size}) - from: self - beforeApplyingDo: [ submenu hideAll ] ]. + stencil: [ :anExplicitMenu | + | aViewModel | + aViewModel := GtRefactoringsWithConfirmationViewModel new + refactoringTitle: 'Push down'; + targetName: ('{1} methods' format: {aCollectionOfMethods size}); + confirmationLabel: ('Push down {1} methods' format: {aCollectionOfMethods size}); + refactoringsWithConfirmation: [ | aGroupByClass aModel aCollectionOfRefactorings | + aGroupByClass := aCollectionOfMethods groupedBy: #methodClass. + aModel := Smalltalk createRbNamespace + onEnvironment: RBPushDownMethodRefactoring new defaultEnvironment. + aCollectionOfRefactorings := aGroupByClass + collect: [ :someMethods | + RBPushDownMethodRefactoring new + model: aModel; + pushDown: (someMethods collect: #selector) + from: (self + forPharo12AndNewer: [ someMethods anyOne methodClass name ] + forPharo11: [ someMethods anyOne methodClass ]) ] + as: Array. + aModel name: ('Push down {1} methods' format: {aCollectionOfMethods size}). + aCollectionOfRefactorings ]; + afterAppliedBlock: [ anExplicitMenu hideAll ]; + menuModel: anExplicitMenu; + anchorElement: self. + GtRefactoringsPreviewWithConfirmationElement new + refactoringsViewModel: aViewModel; + beContextMenuElement; + bePinnable: anExplicitMenu ]. + ^ submenu ] @@ -532,18 +601,29 @@ GtCoderMethodsGroupedListElement >> removeSeveralMethodsSubmenuFor: aCollectionO GtCoderMethodsGroupedListElement >> renameMethodSubmenuFor: aMethod [ | submenu | submenu := BrMenuExplicit new. + submenu - stencil: [ GtRefactoringsWithInputPreviewElement - elementForRefactoring: [ :each | - GtRBRenameMethodRefactoring - renameMethod: aMethod selector - in: aMethod methodClass - to: each - permutation: (1 to: aMethod selector numArgs) ] - labeled: 'Rename method: ' - initialValue: aMethod selector - from: self - beforeApplyingDo: [ submenu hideAll ] ]. + stencil: [ :anExplicitMenu | + | aViewModel | + aViewModel := GtRefactoringsWithInputViewModel new + refactoringTitle: 'Rename method'; + targetName: ('{1}>>#{2}' format: { aMethod methodClass. aMethod selector }); + inputLabel: 'New method name:'; + initialText: aMethod selector; + refactoringWithInput: [ :anInput | + GtRBRenameMethodRefactoring + renameMethod: aMethod selector + in: aMethod methodClass + to: anInput + permutation: (1 to: aMethod selector numArgs) ]; + afterAppliedBlock: [ anExplicitMenu hideAll ]; + menuModel: anExplicitMenu; + anchorElement: self. + GtRefactoringsPreviewWithInputElement new + refactoringsViewModel: aViewModel; + beContextMenuElement; + bePinnable: anExplicitMenu ]. + ^ submenu ] From f662e90e6bf167e8a06ce09ca7c3cd8f5388fcad Mon Sep 17 00:00:00 2001 From: John Brant Date: Thu, 18 Sep 2025 06:32:15 -0500 Subject: [PATCH 1056/1268] adding GtRenameInstanceVariableRefactoring to handle extensions --- src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st index b7d6099d3..cd1e408a6 100644 --- a/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st @@ -367,7 +367,7 @@ GtCoderSlotsGroupedListElement >> renameSubmenuFor: aString [ targetName: ('{1}''s {2} inst. variable' format: { self selectedClass name. aString }); inputLabel: 'Rename slot:'; refactoringWithInput: [ :anInput | - RBRenameInstanceVariableRefactoring + GtRenameInstanceVariableRefactoring rename: aString to: anInput in: self selectedClass ]; From cee43dedb6c0777f608efbc4c170fefbeb943e78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Mon, 22 Sep 2025 12:49:39 +0200 Subject: [PATCH 1057/1268] Use #gtProtocols [feenkcom/gtoolkit#4711] --- src/GToolkit-Coder-UI/GtCoderElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderElement.class.st b/src/GToolkit-Coder-UI/GtCoderElement.class.st index 0506dc4e2..c69efacf3 100644 --- a/src/GToolkit-Coder-UI/GtCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderElement.class.st @@ -225,7 +225,7 @@ GtCoderElement >> repository [ GtCoderElement >> selectMethodProtocolNamed: aMethodProtocolName [ "(GtCoder forClass: GtPhlowProtoView) selectMethodProtocolNamed: #decorating" | classProtocols | - classProtocols := navigationModel selectedClass organization protocols. + classProtocols := navigationModel selectedClass gtProtocols. classProtocols detect: [ :aProtocol | aProtocol name = aMethodProtocolName ] ifFound: [ :aProtocol | self navigationModel selectProtocol: aProtocol source: self ] From 21dc57e91fe8f490070e151dea0ff5dfc08eefe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Mon, 22 Sep 2025 12:49:51 +0200 Subject: [PATCH 1058/1268] Use #gtComment [feenkcom/gtoolkit#4711] --- src/GToolkit-Coder-UI/GtClassCardElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtClassCardElement.class.st b/src/GToolkit-Coder-UI/GtClassCardElement.class.st index e4139861a..58601bf76 100644 --- a/src/GToolkit-Coder-UI/GtClassCardElement.class.st +++ b/src/GToolkit-Coder-UI/GtClassCardElement.class.st @@ -7,7 +7,7 @@ Class { { #category : #'building ui' } GtClassCardElement >> detailsLabel [ | comment | - comment := coder theClass organization comment. + comment := coder theClass gtComment. comment size > 100 ifTrue: [ comment := (comment first: 100) , '...' ]. comment := (comment replaceAllRegex: '[[:space:]]+' with: String space) From 04153b3e95615bafcc1a233c8bdd3b3ebc866f0f Mon Sep 17 00:00:00 2001 From: John Brant Date: Mon, 22 Sep 2025 09:32:04 -0500 Subject: [PATCH 1059/1268] [feenkcom/gtoolkit#4719] empty lines in diff views --- .../GtSyncScrollRangesExamples.class.st | 15 ++++++++++++++ .../GtSyncScrollRanges.class.st | 20 +++++++++++-------- .../GtSourceDiffChange.class.st | 5 +++++ 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/src/GToolkit-Coder-Examples/GtSyncScrollRangesExamples.class.st b/src/GToolkit-Coder-Examples/GtSyncScrollRangesExamples.class.st index c407cb7d0..3b4ceba0a 100644 --- a/src/GToolkit-Coder-Examples/GtSyncScrollRangesExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtSyncScrollRangesExamples.class.st @@ -4,6 +4,21 @@ Class { #category : #'GToolkit-Coder-Examples-Diff' } +{ #category : #examples } +GtSyncScrollRangesExamples >> diffWithEmptyLines [ + + + | ranges | + ranges := GtSyncScrollRanges + createFromChange: (GtDiffBuilder + computeDifferencesFrom: '1\\3\4\5\' withCRs + to: '1\2\3\\5\' withCRs + using: (GtLineDiffSplitter new includeEOLChars: false)). + self validateNextLeftChangeIn: ranges equals: #(2 4). + self validatePreviousRightChangeIn: ranges equals: #(2 4). + ^ ranges +] + { #category : #examples } GtSyncScrollRangesExamples >> example [ diff --git a/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st b/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st index 6223e48c4..9c362b742 100644 --- a/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st +++ b/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st @@ -44,7 +44,7 @@ GtSyncScrollRanges >> addDestinationLineChangesFrom: aCompositeChange to: change ifNotNil: [ :change | (change startIndex between: start and: endWithCR) ifTrue: [ (changedLines at: currentChange) add: lineNumber ]. - change stopIndex <= endWithCR + (change stopIndex max: change startIndex) <= endWithCR ifTrue: [ (changedLines at: currentChange) add: lineNumber + 1. index := index + 1 ] ]. index > aCompositeChange changes size ifTrue: [ ^ self ]. @@ -73,13 +73,17 @@ GtSyncScrollRanges >> addOriginalLineChangesFrom: aCompositeChange to: changedLi ifAbsentPut: [ OrderedCollection with: lineNumber with: lineNumber ]. index := index + 1 ] ] ] ifNotNil: [ :change | - change startIndex <= endWithCR - ifTrue: [ changedLines - at: currentChange - ifAbsentPut: [ OrderedCollection with: lineNumber ] ]. - change stopIndex <= endWithCR - ifTrue: [ (changedLines at: currentChange) add: lineNumber + 1. - index := index + 1 ] ]. + (change isEmpty and: [ change startIndex > endWithCR ]) + ifFalse: [ change startIndex <= endWithCR + ifTrue: [ changedLines + at: currentChange + ifAbsentPut: [ OrderedCollection with: lineNumber ] ]. + change stopIndex <= endWithCR + ifTrue: [ (changedLines + at: currentChange + ifAbsentPut: [ OrderedCollection with: lineNumber + 1 ]) + add: lineNumber + 1. + index := index + 1 ] ] ]. index > aCompositeChange changes size ifTrue: [ ^ self ]. previousIndex ~= index ] whileTrue. lineNumber := lineNumber + 1 ]. diff --git a/src/GToolkit-Coder/GtSourceDiffChange.class.st b/src/GToolkit-Coder/GtSourceDiffChange.class.st index 70ddca612..dc931d8b2 100644 --- a/src/GToolkit-Coder/GtSourceDiffChange.class.st +++ b/src/GToolkit-Coder/GtSourceDiffChange.class.st @@ -49,6 +49,11 @@ GtSourceDiffChange >> highlightColor [ ^ self class highlightColor ] +{ #category : #testing } +GtSourceDiffChange >> isEmpty [ + ^ startIndex > stopIndex +] + { #category : #accessing } GtSourceDiffChange >> objects [ ^ source copyFrom: self startIndex to: self stopIndex From 0708645d6c7fecbef83a9d28d125594cc30f4a1f Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 23 Sep 2025 06:31:26 -0500 Subject: [PATCH 1060/1268] [feenkcom/gtoolkit#4723] by default scroll to first diff --- .../GtDiffElementExamples.class.st | 56 +++++++++++++++++++ src/GToolkit-Coder-UI/GtDiffElement.class.st | 17 ++++++ .../GtSyncScrollRanges.class.st | 4 +- 3 files changed, 75 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-Examples/GtDiffElementExamples.class.st b/src/GToolkit-Coder-Examples/GtDiffElementExamples.class.st index e8ec436d2..660eaa624 100644 --- a/src/GToolkit-Coder-Examples/GtDiffElementExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtDiffElementExamples.class.st @@ -11,6 +11,62 @@ GtDiffElementExamples >> changeElementExample [ ^ (GtDiffElement onChange: self exampleChange) showButtons ] +{ #category : #examples } +GtDiffElementExamples >> changeElementScrollsToFirstDiff [ + + + | scripter | + scripter := BlScripter new. + scripter extent: 800 @ 800. + scripter + element: ((GtDiffElement onChange: self exampleChange) + matchParent; + showButtons; + yourself). + scripter + checkStep: [ :s | + s + label: 'Check has scrolled'; + // GtDiffButtonsId; + // #label; + do: [ :each | self assert: (each text asString beginsWith: '1/') ] ]. + scripter + checkStep: [ :s | + s + label: 'Can scroll text up'; + // GtDiffOldTextId; + do: [ :each | self assert: each canScrollUp ] ]. + ^ scripter +] + +{ #category : #examples } +GtDiffElementExamples >> changeElementWithoutScroll [ + + + | scripter | + scripter := BlScripter new. + scripter extent: 800 @ 800. + scripter + element: ((GtDiffElement onChangeWithoutScrolling: self exampleChange) + matchParent; + showButtons; + yourself). + scripter + checkStep: [ :s | + s + label: 'Check has scrolled'; + // GtDiffButtonsId; + // #label; + do: [ :each | self assert: (each text asString beginsWith: '0/') ] ]. + scripter + checkStep: [ :s | + s + label: 'Can scroll text up'; + // GtDiffOldTextId; + do: [ :each | self assert: each canScrollUp not ] ]. + ^ scripter +] + { #category : #examples } GtDiffElementExamples >> changeExampleFlat [ diff --git a/src/GToolkit-Coder-UI/GtDiffElement.class.st b/src/GToolkit-Coder-UI/GtDiffElement.class.st index 063cc969e..a218c31d8 100644 --- a/src/GToolkit-Coder-UI/GtDiffElement.class.st +++ b/src/GToolkit-Coder-UI/GtDiffElement.class.st @@ -26,6 +26,14 @@ GtDiffElement class >> on: anObject [ { #category : #'instance creation' } GtDiffElement class >> onChange: aCompositeDiffChange [ + ^ self new + change: aCompositeDiffChange; + scrollNext; + yourself +] + +{ #category : #'instance creation' } +GtDiffElement class >> onChangeWithoutScrolling: aCompositeDiffChange [ ^ self new change: aCompositeDiffChange; yourself @@ -35,6 +43,15 @@ GtDiffElement class >> onChange: aCompositeDiffChange [ GtDiffElement class >> onDiff: aDiffBuilder [ ^ self new diff: aDiffBuilder; + scrollNext; + yourself +] + +{ #category : #'instance creation' } +GtDiffElement class >> onDiffWithoutScrolling: aDiffBuilder [ + ^ self new + diff: aDiffBuilder; + scrollNext; yourself ] diff --git a/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st b/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st index 9c362b742..3d4285b88 100644 --- a/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st +++ b/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st @@ -268,7 +268,7 @@ GtSyncScrollRanges >> rightLineFor: anInteger [ GtSyncScrollRanges >> selectNext [ | found | found := false. - self ranges isEmpty ifTrue: [ ^ self ]. + self ranges isEmpty ifTrue: [ ^ nil ]. self ranges do: [ :each | found @@ -284,7 +284,7 @@ GtSyncScrollRanges >> selectNext [ GtSyncScrollRanges >> selectPrevious [ | found | found := false. - self ranges isEmpty ifTrue: [ ^ self ]. + self ranges isEmpty ifTrue: [ ^ nil ]. self ranges reverseDo: [ :each | found From 2ba192342eed240a3accb3fb4e00803324cf86c4 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 23 Sep 2025 14:02:02 -0300 Subject: [PATCH 1061/1268] class context menu items are defined using phlow actions[feenkcom/gtoolkit#4725] --- src/GToolkit-Coder-UI/Class.extension.st | 133 ++++++++++++++++++ .../GtCoderClassTarget.class.st | 5 + .../GtCoderClassesTreeElement.class.st | 70 +++------ .../GtCoderRemoveClassPreviewStencil.class.st | 92 ++++++++++++ 4 files changed, 248 insertions(+), 52 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderClassTarget.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderRemoveClassPreviewStencil.class.st diff --git a/src/GToolkit-Coder-UI/Class.extension.st b/src/GToolkit-Coder-UI/Class.extension.st index e5b1fa116..3b4a9de57 100644 --- a/src/GToolkit-Coder-UI/Class.extension.st +++ b/src/GToolkit-Coder-UI/Class.extension.st @@ -5,6 +5,19 @@ Class >> asFilterModelItem [ ^ GtFilterModelClassItem new itemClass: self ] +{ #category : #'*GToolkit-Coder-UI' } +Class >> gtCoderSidebarIndexBrowseClassFor: anAction [ + + ^ anAction button + priority: 1; + target: GtCoderClassTarget; + icon: BrGlamorousVectorIcons browse; + label: 'Browse class'; + menuItemPreview: self name; + menuItemGroup: BrMenuItemGroupConfiguration navigation; + action: [ :aButton | aButton phlow spawnObject: self instanceSide ] +] + { #category : #'*GToolkit-Coder-UI' } Class >> gtCoderSidebarIndexBrowseClassFrom: aGtCoderClassesTreeElement [ @@ -25,6 +38,19 @@ Class >> gtCoderSidebarIndexBrowseClasses: someClasses referencesFrom: aGtCoderC action: [ aGtCoderClassesTreeElement browseSeveralReferencesTo: someClasses ] ] +{ #category : #'*GToolkit-Coder-UI' } +Class >> gtCoderSidebarIndexBrowseReferencesFor: anAction [ + + ^ anAction button + priority: 2; + target: GtCoderClassTarget; + icon: BrGlamorousVectorIcons empty; + label: 'Browse references'; + menuItemPreview: self name; + menuItemGroup: BrMenuItemGroupConfiguration navigation; + action: [ :aButton | aButton phlow spawnObject: self instanceSide gtReferences ] +] + { #category : #'*GToolkit-Coder-UI' } Class >> gtCoderSidebarIndexBrowseReferencesFrom: aGtCoderClassesTreeElement [ @@ -35,6 +61,19 @@ Class >> gtCoderSidebarIndexBrowseReferencesFrom: aGtCoderClassesTreeElement [ action: [ aGtCoderClassesTreeElement browseReferencesTo: self ] ] +{ #category : #'*GToolkit-Coder-UI' } +Class >> gtCoderSidebarIndexCopyClassNameFor: anAction [ + + ^ anAction button + priority: 9; + target: GtCoderClassTarget; + icon: BrGlamorousVectorIcons clipboard; + label: 'Copy class name'; + menuItemPreview: self name; + menuItemGroup: BrMenuItemGroupConfiguration default; + action: [ Clipboard clipboardText: self name ] +] + { #category : #'*GToolkit-Coder-UI' } Class >> gtCoderSidebarIndexCopyClassNameFrom: aGtCoderClassesTreeElement [ @@ -59,6 +98,51 @@ Class >> gtCoderSidebarIndexExtractSuperclassFrom: aGtCoderClassesTreeElement [ bePinSubmenuAction ] +{ #category : #'*GToolkit-Coder-UI' } +Class >> gtCoderSidebarIndexLlmChatFor: anAction [ + + | chat | + GtLlmFeatures isEnabledInCoder ifFalse: [ ^ anAction noAction ]. + GtLlmConnectionRegistry instance hasConnectableDefaultConnection + ifFalse: [ ^ anAction noAction ]. + + ^ anAction button + priority: 20; + target: GtCoderClassTarget; + icon: BrGlamorousVectorIcons chat; + label: 'Chat about this class'; + menuItemPreview: self name; + menuItemGroup: BrMenuItemGroupConfiguration default; + action: [ :aButton | + aButton phlow + spawnObject: (chat ifNil: [ + chat := GtLlmClassAssistant new chatOn: self instanceSide ]) ] +] + +{ #category : #'*GToolkit-Coder-UI' } +Class >> gtCoderSidebarIndexNewSubclassFor: anAction [ + + ^ anAction button + priority: 3; + target: GtCoderClassTarget; + icon: BrGlamorousVectorIcons add; + label: 'New subclass'; + menuItemPreview: self name; + menuItemGroup: BrMenuItemGroupConfiguration default; + action: [ :aButton :aHostElement | + "TODO: We should replace this with a dedicated wish event." + aHostElement + withAllParentsDetect: [ :eachElement | eachElement class == BrTabGroup ] + ifFound: [ :aTabGroup | + aTabGroup + childWithId: GtNavigationNewDropdownId + ifFound: [ :anElemet | + anElemet dispatchEvent: BrDropdownShowWish new ] + ifNone: [ ] ] + ifNone: [ "ignore" ]. + ] +] + { #category : #'*GToolkit-Coder-UI' } Class >> gtCoderSidebarIndexNewSubclassFrom: aGtCoderClassesTreeElement [ @@ -69,6 +153,25 @@ Class >> gtCoderSidebarIndexNewSubclassFrom: aGtCoderClassesTreeElement [ action: [ aGtCoderClassesTreeElement newSubclassOf: self ] ] +{ #category : #'*GToolkit-Coder-UI' } +Class >> gtCoderSidebarIndexRemoveClassFor: anAction [ + + ^ anAction dropdown + priority: 5; + target: GtCoderClassTarget; + id: #'coder--context-menu-remove-class'; + icon: BrGlamorousVectorIcons remove; + label: 'Remove class'; + menuItemPreview: self name; + menuItemGroup: BrMenuItemGroupConfiguration refactoring; + menuItemPinSubmenu; + content: [ :anActionElement :aTargetElement :anExplicitMenu | + GtCoderRemoveClassPreviewStencil new + classToRemove: self; + menuModel: anExplicitMenu; + asElement ] +] + { #category : #'*GToolkit-Coder-UI' } Class >> gtCoderSidebarIndexRemoveClassFrom: aGtCoderClassesTreeElement [ @@ -90,6 +193,36 @@ Class >> gtCoderSidebarIndexRemoveClasses: someClasses from: aGtCoderClassesTree submenu: (aGtCoderClassesTreeElement removeSeveralClassesSubmenuFor: someClasses) ] +{ #category : #'*GToolkit-Coder-UI' } +Class >> gtCoderSidebarIndexRenameClassFor: anAction [ + + ^ anAction dropdown + priority: 4; + target: GtCoderClassTarget; + icon: BrGlamorousVectorIcons empty; + label: 'Rename class'; + menuItemPreview: self name; + menuItemGroup: BrMenuItemGroupConfiguration refactoring; + content: [ :anActionElement :aTargetElement :anExplicitMenu | + | aViewModel | + aViewModel := GtRefactoringsWithInputViewModel new + refactoringTitle: 'Rename class'; + targetName: self name; + inputLabel: 'New class name:'; + initialText: self name; + refactoringWithInput: [ :anInput | + GtRBRenameClassRefactoring + rename: self name + to: anInput ]; + afterAppliedBlock: [ anExplicitMenu hideAll ]; + menuModel: anExplicitMenu; + anchorElement: self. + GtRefactoringsPreviewWithInputElement new + refactoringsViewModel: aViewModel; + beContextMenuElement; + bePinnable: anExplicitMenu ] +] + { #category : #'*GToolkit-Coder-UI' } Class >> gtCoderSidebarIndexRenameClassFrom: aGtCoderClassesTreeElement [ diff --git a/src/GToolkit-Coder-UI/GtCoderClassTarget.class.st b/src/GToolkit-Coder-UI/GtCoderClassTarget.class.st new file mode 100644 index 000000000..47c35b611 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderClassTarget.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtCoderClassTarget, + #superclass : #GtPhlowActionUniqueTarget, + #category : #'GToolkit-Coder-UI-Phlow Targets' +} diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index 5a1de0645..9587581b7 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -104,11 +104,22 @@ GtCoderClassesTreeElement >> contextMenuFor: aClass [ { #category : #initialization } GtCoderClassesTreeElement >> contextMenuForOneItem: aClass [ + | aMenuItems | + aMenuItems := BrMenuItems new. + GtCoderClassTarget + actionsForObject: aClass + collect: [ :eachAction | + eachAction + asMenuItem: [ :aMenuItem | aMenuItems addItem: aMenuItem ] + withHostElement: self ]. + + true ifTrue: [ ^ aMenuItems ]. + ^ BrMenuItemsPragmaBuilder new object: aClass; upToSuperclass: Behavior; pragma: #gtCoderSidebarIndexOneSubjectContextMenuItem:; - methodArguments: { self }; + methodArguments: {self}; sortByFirstPragmaArgument; build ] @@ -306,57 +317,12 @@ GtCoderClassesTreeElement >> onDropCompiledMethodsOnClass: anItemsDroppedEvent [ { #category : #initialization } GtCoderClassesTreeElement >> removeClassSubmenuFor: aClass [ - | submenu | - submenu := BrMenuExplicit new. - ^ submenu - stencil: [ | element change button | - element := BrVerticalPane new fitContent. - element - addChild: ((self buildRemoveClassLabelFor: aClass) - margin: (BlInsets - top: 10 - bottom: 0 - left: 10 - right: 10)). - element - addChild: (BrAsyncWidget new - fitContent; - stencil: [ | pane references subclasses | - references := (GtPharoIndex current - globalVariableReferencesTo: aClass binding) size. - subclasses := aClass allSubclasses size. - pane := BrVerticalPane new. - pane fitContent. - references > 0 - ifTrue: [ pane - addChild: (BrLabel new - margin: (BlInsets left: 10 right: 10); - aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; - text: (references printString , ' reference' - , (references > 1 ifTrue: [ 's' ] ifFalse: [ '' ])) asRopedText) ]. - subclasses > 0 - ifTrue: [ pane - addChild: (BrLabel new - margin: (BlInsets left: 10 right: 10); - aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; - text: (subclasses printString , ' subclass' - , (subclasses > 1 ifTrue: [ 'es' ] ifFalse: [ '' ])) asRopedText) ]. - pane ]). - change := RBRemoveClassChange remove: aClass. - button := BrButton new - aptitude: BrGlamorousButtonWithIconAptitude; - beSmallSize; - margin: (BlInsets - top: 10 - bottom: 10 - left: 10 - right: 10); - icon: BrGlamorousVectorIcons remove; - label: 'Remove'; - action: [ submenu hideAll. - change execute ]. - element addChild: button as: #removeButton. - element ] + ^ BrMenuExplicit new + stencil: [ :anExplicitMenu | + GtCoderRemoveClassPreviewStencil new + classToRemove: self; + menuModel: anExplicitMenu; + asElement ] ] { #category : #initialization } diff --git a/src/GToolkit-Coder-UI/GtCoderRemoveClassPreviewStencil.class.st b/src/GToolkit-Coder-UI/GtCoderRemoveClassPreviewStencil.class.st new file mode 100644 index 000000000..a62720822 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderRemoveClassPreviewStencil.class.st @@ -0,0 +1,92 @@ +Class { + #name : #GtCoderRemoveClassPreviewStencil, + #superclass : #BrStencil, + #instVars : [ + 'classToRemove', + 'menuModel' + ], + #category : #'GToolkit-Coder-UI-Navigation - Helpers' +} + +{ #category : #accessing } +GtCoderRemoveClassPreviewStencil >> classToRemove [ + ^ classToRemove +] + +{ #category : #accessing } +GtCoderRemoveClassPreviewStencil >> classToRemove: anObject [ + classToRemove := anObject +] + +{ #category : #'api - instantiation' } +GtCoderRemoveClassPreviewStencil >> create [ + | element change button | + element := BrVerticalPane new fitContent. + element + addChild: ((self newRemoveClassLabel) + margin: (BlInsets + top: 10 + bottom: 0 + left: 10 + right: 10)). + element + addChild: (BrAsyncWidget new + fitContent; + stencil: [ | pane references subclasses | + references := (GtPharoIndex current + globalVariableReferencesTo: self classToRemove binding) size. + subclasses := self classToRemove allSubclasses size. + pane := BrVerticalPane new. + pane fitContent. + references > 0 + ifTrue: [ pane + addChild: (BrLabel new + margin: (BlInsets left: 10 right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; + text: (references printString , ' reference' + , (references > 1 ifTrue: [ 's' ] ifFalse: [ '' ])) asRopedText) ]. + subclasses > 0 + ifTrue: [ pane + addChild: (BrLabel new + margin: (BlInsets left: 10 right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; + text: (subclasses printString , ' subclass' + , (subclasses > 1 ifTrue: [ 'es' ] ifFalse: [ '' ])) asRopedText) ]. + pane ]). + change := RBRemoveClassChange remove: self classToRemove. + button := BrButton new + aptitude: BrGlamorousButtonWithIconAptitude; + beSmallSize; + margin: (BlInsets + top: 10 + bottom: 10 + left: 10 + right: 10); + icon: BrGlamorousVectorIcons remove; + label: 'Remove'; + action: [ + self menuModel ifNotNil: #hideAll. + change execute ]. + element addChild: button as: #removeButton. + ^ element +] + +{ #category : #accessing } +GtCoderRemoveClassPreviewStencil >> menuModel [ + ^ menuModel +] + +{ #category : #accessing } +GtCoderRemoveClassPreviewStencil >> menuModel: anObject [ + menuModel := anObject +] + +{ #category : #private } +GtCoderRemoveClassPreviewStencil >> newRemoveClassLabel [ + | labelText | + labelText := 'Remove class ' , self classToRemove name. + ^ BrLabel new + margin: (BlInsets all: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont; + text: labelText asRopedText +] From 258f67c71420fad2979c4dcf345aac893b8f25e1 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 24 Sep 2025 07:11:09 -0300 Subject: [PATCH 1062/1268] define class context menu using phlow actions [feenkcom/gtoolkit#4725] --- src/GToolkit-Coder-UI/Class.extension.st | 49 ++++++- .../GtCoderClassesTarget.class.st | 10 ++ .../GtCoderClassesTreeElement.class.st | 137 ++++++++---------- ...tCoderRemoveClassesPreviewStencil.class.st | 95 ++++++++++++ .../GtPhlowContext.extension.st | 5 + 5 files changed, 214 insertions(+), 82 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderClassesTarget.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderRemoveClassesPreviewStencil.class.st diff --git a/src/GToolkit-Coder-UI/Class.extension.st b/src/GToolkit-Coder-UI/Class.extension.st index 3b4a9de57..678dbd423 100644 --- a/src/GToolkit-Coder-UI/Class.extension.st +++ b/src/GToolkit-Coder-UI/Class.extension.st @@ -38,6 +38,28 @@ Class >> gtCoderSidebarIndexBrowseClasses: someClasses referencesFrom: aGtCoderC action: [ aGtCoderClassesTreeElement browseSeveralReferencesTo: someClasses ] ] +{ #category : #'*GToolkit-Coder-UI' } +Class >> gtCoderSidebarIndexBrowseClassesReferencesFor: anAction context: aPhlowContext [ + + aPhlowContext coderSelectedClasses ifEmpty: [ ^ anAction noAction ]. + + ^ anAction button + priority: 2; + target: GtCoderClassesTarget; + icon: BrGlamorousVectorIcons empty; + label: 'Browse references'; + menuItemPreview: ('{1} classes' format: {aPhlowContext coderSelectedClasses size}); + menuItemGroup: BrMenuItemGroupConfiguration navigation; + action: [ :aButton | + | someClasses aFilter | + someClasses := aPhlowContext coderSelectedClasses. + aFilter := someClasses allButFirst + inject: someClasses first gtReferences + into: [ :aSumFilter :aClass | aSumFilter | aClass gtReferences ]. + + aButton phlow spawnObject: aFilter ] +] + { #category : #'*GToolkit-Coder-UI' } Class >> gtCoderSidebarIndexBrowseReferencesFor: anAction [ @@ -128,7 +150,7 @@ Class >> gtCoderSidebarIndexNewSubclassFor: anAction [ icon: BrGlamorousVectorIcons add; label: 'New subclass'; menuItemPreview: self name; - menuItemGroup: BrMenuItemGroupConfiguration default; + menuItemGroup: BrMenuItemGroupConfiguration modification; action: [ :aButton :aHostElement | "TODO: We should replace this with a dedicated wish event." aHostElement @@ -163,11 +185,11 @@ Class >> gtCoderSidebarIndexRemoveClassFor: anAction [ icon: BrGlamorousVectorIcons remove; label: 'Remove class'; menuItemPreview: self name; - menuItemGroup: BrMenuItemGroupConfiguration refactoring; + menuItemGroup: BrMenuItemGroupConfiguration removal; menuItemPinSubmenu; content: [ :anActionElement :aTargetElement :anExplicitMenu | GtCoderRemoveClassPreviewStencil new - classToRemove: self; + classToRemove: self instanceSide; menuModel: anExplicitMenu; asElement ] ] @@ -193,6 +215,27 @@ Class >> gtCoderSidebarIndexRemoveClasses: someClasses from: aGtCoderClassesTree submenu: (aGtCoderClassesTreeElement removeSeveralClassesSubmenuFor: someClasses) ] +{ #category : #'*GToolkit-Coder-UI' } +Class >> gtCoderSidebarIndexRemoveClassesFor: anAction context: aPhlowContext [ + + aPhlowContext coderSelectedClasses ifEmpty: [ ^ anAction noAction ]. + + ^ anAction dropdown + priority: 5; + target: GtCoderClassesTarget; + icon: BrGlamorousVectorIcons empty; + label: 'Remove classes'; + menuItemPreview: ('{1} classes' format: {aPhlowContext coderSelectedClasses size}); + menuItemGroup: BrMenuItemGroupConfiguration removal; + content: [ :anActionElement :aTargetElement :anExplicitMenu | + | someClasses | + someClasses := aPhlowContext coderSelectedClasses. + GtCoderRemoveClassesPreviewStencil new + classesToRemove: someClasses; + menuModel: anExplicitMenu; + asElement ] +] + { #category : #'*GToolkit-Coder-UI' } Class >> gtCoderSidebarIndexRenameClassFor: anAction [ diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTarget.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTarget.class.st new file mode 100644 index 000000000..3f794806a --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderClassesTarget.class.st @@ -0,0 +1,10 @@ +" +I represent a target for several selected classes, e.g., in the coder sidebar class list. +{{gtClass:GtPhlowAction}} can access the list of classes using {{gtMethod:GtPhlowContext>>#coderSelectedClasses}}. + +" +Class { + #name : #GtCoderClassesTarget, + #superclass : #GtPhlowActionUniqueTarget, + #category : #'GToolkit-Coder-UI-Phlow Targets' +} diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index 9587581b7..2422b5324 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -14,14 +14,32 @@ Class { #instVars : [ 'classesTree' ], + #classVars : [ + 'UsePhlowActions' + ], #category : #'GToolkit-Coder-UI-Navigation - Helpers' } +{ #category : #settings } +GtCoderClassesTreeElement class >> dontUsePhlowActions [ + UsePhlowActions := false +] + { #category : #'instance creation' } GtCoderClassesTreeElement class >> fromClasses: aCollectionOfClasses [ ^ self new initializeWithClasses: aCollectionOfClasses ] +{ #category : #settings } +GtCoderClassesTreeElement class >> isUsePhlowAction [ + ^ UsePhlowActions ifNil: [ false ] +] + +{ #category : #settings } +GtCoderClassesTreeElement class >> usePhlowActions [ + UsePhlowActions := true +] + { #category : #'private - context menu' } GtCoderClassesTreeElement >> addPreviewButtonFor: refactoring to: elem cancelSelector: cancelSelector [ | button | @@ -104,35 +122,38 @@ GtCoderClassesTreeElement >> contextMenuFor: aClass [ { #category : #initialization } GtCoderClassesTreeElement >> contextMenuForOneItem: aClass [ - | aMenuItems | - aMenuItems := BrMenuItems new. - GtCoderClassTarget - actionsForObject: aClass - collect: [ :eachAction | - eachAction - asMenuItem: [ :aMenuItem | aMenuItems addItem: aMenuItem ] - withHostElement: self ]. - - true ifTrue: [ ^ aMenuItems ]. - - ^ BrMenuItemsPragmaBuilder new - object: aClass; - upToSuperclass: Behavior; - pragma: #gtCoderSidebarIndexOneSubjectContextMenuItem:; - methodArguments: {self}; - sortByFirstPragmaArgument; - build + + ^ self isContextMenuFromPhlowActions + ifTrue: [ GtCoderClassTarget menuItemsForObject: aClass hostElement: self ] + ifFalse: [ BrMenuItemsPragmaBuilder new + object: aClass; + upToSuperclass: Behavior; + pragma: #gtCoderSidebarIndexOneSubjectContextMenuItem:; + methodArguments: {self}; + sortByFirstPragmaArgument; + build ] ] { #category : #initialization } GtCoderClassesTreeElement >> contextMenuForSeveralItems: someClasses [ - ^ BrMenuItemsPragmaBuilder new - object: Class; - upToSuperclass: Behavior; - pragma: #gtCoderSidebarIndexSeveralSubjectsContextMenuItem:; - methodArguments: {someClasses. self}; - sortByFirstPragmaArgument; - build + + ^ self isContextMenuFromPhlowActions + ifTrue: [ + | aPhlowContext | + aPhlowContext := GtPhlowContext new coderSelectedClasses: someClasses. + GtCoderClassesTarget + menuItemsForObject: someClasses anyOne + inContext: aPhlowContext + hostElement: self ] + ifFalse: [ + BrMenuItemsPragmaBuilder new + object: Class; + upToSuperclass: Behavior; + pragma: #gtCoderSidebarIndexSeveralSubjectsContextMenuItem:; + methodArguments: {someClasses. + self}; + sortByFirstPragmaArgument; + build ] ] { #category : #'private - drag and drop' } @@ -270,6 +291,11 @@ GtCoderClassesTreeElement >> initializeWithHierachyForClass: aClass [ ^ self ] ] ] +{ #category : #testing } +GtCoderClassesTreeElement >> isContextMenuFromPhlowActions [ + ^ self class isUsePhlowAction +] + { #category : #'private - context menu' } GtCoderClassesTreeElement >> newSubclassOf: aClass [ | dropdown tabGroup | @@ -320,66 +346,19 @@ GtCoderClassesTreeElement >> removeClassSubmenuFor: aClass [ ^ BrMenuExplicit new stencil: [ :anExplicitMenu | GtCoderRemoveClassPreviewStencil new - classToRemove: self; + classToRemove: aClass; menuModel: anExplicitMenu; asElement ] ] { #category : #initialization } GtCoderClassesTreeElement >> removeSeveralClassesSubmenuFor: someClasses [ - | submenu | - submenu := BrMenuExplicit new. - ^ submenu - stencil: [ | element change button | - element := BrVerticalPane new fitContent. - element - addChild: ((self buildRemoveSeveralClassesLabelFor: someClasses) - margin: (BlInsets - top: 10 - bottom: 0 - left: 10 - right: 10)). - element - addChild: (BrAsyncWidget new - fitContent; - stencil: [ | pane references subclasses | - references := someClasses sumNumbers: [ :eachClass | (GtPharoIndex current - globalVariableReferencesTo: eachClass binding) size ]. - subclasses := someClasses sumNumbers: [ :eachClass | (eachClass allSubclasses difference: someClasses) size ]. - pane := BrVerticalPane new. - pane fitContent. - references > 0 - ifTrue: [ pane - addChild: (BrLabel new - margin: (BlInsets left: 10 right: 10); - aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; - text: (references printString , ' reference' - , (references > 1 ifTrue: [ 's' ] ifFalse: [ '' ])) asRopedText) ]. - subclasses > 0 - ifTrue: [ pane - addChild: (BrLabel new - margin: (BlInsets left: 10 right: 10); - aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; - text: (subclasses printString , ' subclass' - , (subclasses > 1 ifTrue: [ 'es' ] ifFalse: [ '' ])) asRopedText) ]. - pane ]). - change := RBCompositeRefactoryChange new - name: ('Remove {1} classes' format: { someClasses size }); - changes: (someClasses collect: [ :eachClass | RBRemoveClassChange remove: eachClass ]). - button := BrButton new - aptitude: BrGlamorousButtonWithIconAptitude; - beSmallSize; - margin: (BlInsets - top: 10 - bottom: 10 - left: 10 - right: 10); - icon: BrGlamorousVectorIcons remove; - label: 'Remove'; - action: [ submenu hideAll. - change execute ]. - element addChild: button as: #removeButton. - element ] + ^ BrMenuExplicit new + stencil: [ :aMenuExplicit | + GtCoderRemoveClassesPreviewStencil new + classesToRemove: someClasses; + menuModel: aMenuExplicit; + asElement ] ] { #category : #initialization } diff --git a/src/GToolkit-Coder-UI/GtCoderRemoveClassesPreviewStencil.class.st b/src/GToolkit-Coder-UI/GtCoderRemoveClassesPreviewStencil.class.st new file mode 100644 index 000000000..431f854fa --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderRemoveClassesPreviewStencil.class.st @@ -0,0 +1,95 @@ +Class { + #name : #GtCoderRemoveClassesPreviewStencil, + #superclass : #BrStencil, + #instVars : [ + 'classesToRemove', + 'menuModel' + ], + #category : #'GToolkit-Coder-UI-Navigation - Helpers' +} + +{ #category : #accessing } +GtCoderRemoveClassesPreviewStencil >> classesToRemove [ + ^ classesToRemove +] + +{ #category : #accessing } +GtCoderRemoveClassesPreviewStencil >> classesToRemove: anObject [ + classesToRemove := anObject +] + +{ #category : #'as yet unclassified' } +GtCoderRemoveClassesPreviewStencil >> create [ + | element change button | + element := BrVerticalPane new fitContent. + element + addChild: (self newRemoveSeveralClassesLabel + margin: (BlInsets + top: 10 + bottom: 0 + left: 10 + right: 10)). + element + addChild: (BrAsyncWidget new + fitContent; + stencil: [ | pane references subclasses | + references := self classesToRemove + sumNumbers: [ :eachClass | (GtPharoIndex current globalVariableReferencesTo: eachClass binding) size ]. + subclasses := self classesToRemove + sumNumbers: [ :eachClass | (eachClass allSubclasses difference: self classesToRemove) size ]. + pane := BrVerticalPane new. + pane fitContent. + references > 0 + ifTrue: [ pane + addChild: (BrLabel new + margin: (BlInsets left: 10 right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; + text: (references printString , ' reference' + , (references > 1 ifTrue: [ 's' ] ifFalse: [ '' ])) asRopedText) ]. + subclasses > 0 + ifTrue: [ pane + addChild: (BrLabel new + margin: (BlInsets left: 10 right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; + text: (subclasses printString , ' subclass' + , (subclasses > 1 ifTrue: [ 'es' ] ifFalse: [ '' ])) asRopedText) ]. + pane ]). + change := RBCompositeRefactoryChange new + name: ('Remove {1} classes' format: {self classesToRemove size}); + changes: (self classesToRemove + collect: [ :eachClass | RBRemoveClassChange remove: eachClass ]). + button := BrButton new + aptitude: BrGlamorousButtonWithIconAptitude; + beSmallSize; + margin: (BlInsets + top: 10 + bottom: 10 + left: 10 + right: 10); + icon: BrGlamorousVectorIcons remove; + label: 'Remove'; + action: [ self menuModel ifNotNil: #hideAll. + change execute ]. + element addChild: button as: #removeButton. + ^ element +] + +{ #category : #accessing } +GtCoderRemoveClassesPreviewStencil >> menuModel [ + ^ menuModel +] + +{ #category : #accessing } +GtCoderRemoveClassesPreviewStencil >> menuModel: anObject [ + menuModel := anObject +] + +{ #category : #private } +GtCoderRemoveClassesPreviewStencil >> newRemoveSeveralClassesLabel [ + | labelText | + labelText := 'Remove {1} classes' format: {self classesToRemove size}. + ^ BrLabel new + margin: (BlInsets all: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont; + text: labelText asRopedText +] diff --git a/src/GToolkit-Coder/GtPhlowContext.extension.st b/src/GToolkit-Coder/GtPhlowContext.extension.st index 34240c73c..52ca0823e 100644 --- a/src/GToolkit-Coder/GtPhlowContext.extension.st +++ b/src/GToolkit-Coder/GtPhlowContext.extension.st @@ -1,5 +1,10 @@ Extension { #name : #GtPhlowContext } +{ #category : #'*GToolkit-Coder-UI\t' } +GtPhlowContext >> coderSelectedClasses [ + ^ self optionAt: #coderSelectedClasses ifAbsent: [ #() ] +] + { #category : #'*GToolkit-Coder' } GtPhlowContext >> hasPackageCoder [ ^ self hasOptionAt: #packageCoder From 844b48781df40d078bebd0e78bc8359b1889ca31 Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Wed, 24 Sep 2025 20:56:52 +0200 Subject: [PATCH 1063/1268] change do it to evaluate. place evaluate and inspect first in the menu feenkcom/gtoolkit#4729 --- .../GtSourceCoderDoItAndInspectShortcut.class.st | 2 +- src/GToolkit-Coder-UI/GtSourceCoderDoItShortcut.class.st | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectShortcut.class.st index ab4dd14b0..2e2ea3d44 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectShortcut.class.st @@ -14,7 +14,7 @@ GtSourceCoderDoItAndInspectShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryG. - name := 'Do it and inspect'. + name := 'Evaluate and inspect'. ] { #category : #evaluation } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDoItShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDoItShortcut.class.st index f06676c3b..b211840b4 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderDoItShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderDoItShortcut.class.st @@ -14,7 +14,7 @@ GtSourceCoderDoItShortcut >> initialize [ super initialize. combination := BlKeyCombination primaryD. - name := 'Do it'. + name := 'Evaluate'. ] { #category : #evaluation } From b4f16ef22fa2f6a508570f8be7a2dfc0a66080ca Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 24 Sep 2025 20:44:24 -0300 Subject: [PATCH 1064/1268] add `GTCoderAction>>#priority:` [feenkcom/gtoolkit#4725] --- .../GtTextualCoder.extension.st | 19 ++++++++++------ src/GToolkit-Coder/GtCoderAction.class.st | 13 ++++++++++- src/GToolkit-Coder/GtCoderAddOns.class.st | 22 +++++++++++++------ 3 files changed, 39 insertions(+), 15 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st index 4d712244c..134ffa5f0 100644 --- a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st +++ b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st @@ -2,6 +2,7 @@ Extension { #name : #GtTextualCoder } { #category : #'*GToolkit-Coder-AddOns' } GtTextualCoder >> addContextMenuItemFrom: shortcut group: menuGroup withId: menuId to: coderAddOns [ + ^ coderAddOns addContextMenuItem: shortcut name group: menuGroup @@ -16,6 +17,7 @@ GtTextualCoder >> addContextMenuItemFrom: shortcut group: menuGroup withId: menu { #category : #'*GToolkit-Coder-AddOns' } GtTextualCoder >> addContextMenuItemFrom: shortcut withId: menuId to: coderAddOns [ + ^ coderAddOns addContextMenuItem: shortcut name action: [ :aCoderViewModel :anEditorElement | @@ -55,20 +57,23 @@ GtTextualCoder >> addContextMenuItemWithNoShortcutFrom: shortcut withId: menuId { #category : #'*GToolkit-Coder-AddOns' } GtTextualCoder >> addCopyCutPasteContextMenuAddOnsAst: anAst to: coderAddOns [ - self + (self addContextMenuItemFrom: BrEditorShortcut cut - withId: GtTextualCoderCutContextMenuItemId - to: coderAddOns; + withId: GtTextualCoderCutContextMenuItemId + to: coderAddOns) ifNotNil: [ :anAction | anAction priority: 1000 ]. + (self addContextMenuItemFrom: BrEditorShortcut copy - withId: GtTextualCoderCopyContextMenuItemId - to: coderAddOns; + withId: GtTextualCoderCopyContextMenuItemId + to: coderAddOns) ifNotNil: [ :anAction | anAction priority: 1000 ]. + (self addContextMenuItemFrom: BrEditorShortcut paste - withId: GtTextualCoderPasteContextMenuItemId - to: coderAddOns + withId: GtTextualCoderPasteContextMenuItemId + to: coderAddOns) ifNotNil: [ :anAction | anAction priority: 1000 ] ] { #category : #'*GToolkit-Coder-AddOns' } GtTextualCoder >> addExplicitContextMenu: aString block: aBlock to: coderAddOns [ + ^ coderAddOns addExplicitContextMenu: aString block: aBlock ] diff --git a/src/GToolkit-Coder/GtCoderAction.class.st b/src/GToolkit-Coder/GtCoderAction.class.st index eec202f92..04d0573be 100644 --- a/src/GToolkit-Coder/GtCoderAction.class.st +++ b/src/GToolkit-Coder/GtCoderAction.class.st @@ -11,7 +11,8 @@ Class { 'allowAltClick', 'actionDefinition', 'isEnabled', - 'properties' + 'properties', + 'priority' ], #category : #'GToolkit-Coder-Coders - Addons' } @@ -163,6 +164,16 @@ GtCoderAction >> printOn: aStream [ nextPut: $) ] +{ #category : #accessing } +GtCoderAction >> priority [ + ^ priority ifNil: [ priority := 50 ] +] + +{ #category : #accessing } +GtCoderAction >> priority: aNumber [ + priority := aNumber +] + { #category : #'accessing properties' } GtCoderAction >> properties [ ^ properties ifNil: [ diff --git a/src/GToolkit-Coder/GtCoderAddOns.class.st b/src/GToolkit-Coder/GtCoderAddOns.class.st index a3c7a9afb..cb9d12648 100644 --- a/src/GToolkit-Coder/GtCoderAddOns.class.st +++ b/src/GToolkit-Coder/GtCoderAddOns.class.st @@ -92,6 +92,7 @@ GtCoderAddOns >> addContextMenuActions: aCollectionOfContextMenuActions [ { #category : #'api - context menu' } GtCoderAddOns >> addContextMenuItem: aString action: aBlock [ + ^ self addContextMenuItem: aString hover: nil @@ -111,6 +112,7 @@ GtCoderAddOns >> addContextMenuItem: aString action: aBlock id: aSymbol [ { #category : #'api - context menu' } GtCoderAddOns >> addContextMenuItem: aString action: aBlock id: aSymbol shortcutKey: shortcutString [ + ^ self addContextMenuItem: aString hover: nil @@ -143,6 +145,7 @@ GtCoderAddOns >> addContextMenuItem: aString group: menuGroup action: aBlock id: { #category : #'api - context menu' } GtCoderAddOns >> addContextMenuItem: aString group: menuGroup action: aBlock id: aSymbol shortcutKey: shortcutString [ + ^ self addContextMenuItem: aString group: menuGroup @@ -167,20 +170,22 @@ GtCoderAddOns >> addContextMenuItem: aString group: menuGroup hover: hoverBlock { #category : #'api - context menu' } GtCoderAddOns >> addContextMenuItem: aString group: menuGroup hover: hoverBlock leave: leaveBlock action: aBlock id: aSymbol [ + | newAction | newAction := GtCoderContextMenuAction new - title: aString; - group: menuGroup; - action: aBlock; - hoverAction: hoverBlock; - leaveAction: leaveBlock; - id: aSymbol. + title: aString; + group: menuGroup; + action: aBlock; + hoverAction: hoverBlock; + leaveAction: leaveBlock; + id: aSymbol. self addContextMenuAction: newAction. ^ newAction ] { #category : #'api - context menu' } GtCoderAddOns >> addContextMenuItem: aString group: menuGroup hover: hoverBlock leave: leaveBlock action: aBlock id: aSymbol shortcutKey: shortcutString [ + | newAction | newAction := GtCoderContextMenuAction new title: aString; @@ -196,7 +201,8 @@ GtCoderAddOns >> addContextMenuItem: aString group: menuGroup hover: hoverBlock { #category : #'api - context menu' } GtCoderAddOns >> addContextMenuItem: aString group: menuGroup hover: hoverBlock leave: leaveBlock action: aBlock shortcutKey: shortcutString [ - self + + ^ self addContextMenuItem: aString group: menuGroup hover: hoverBlock @@ -232,6 +238,7 @@ GtCoderAddOns >> addContextMenuItem: aString hover: hoverBlock leave: leaveBlock { #category : #'api - context menu' } GtCoderAddOns >> addContextMenuItem: aString hover: hoverBlock leave: leaveBlock action: aBlock id: aSymbol shortcutKey: shortcutString [ + | newAction | newAction := GtCoderContextMenuAction new title: aString; @@ -328,6 +335,7 @@ GtCoderAddOns >> addDropDownWithPreviewAction: aString icon: anIcon action: acti { #category : #'api - context menu' } GtCoderAddOns >> addExplicitContextMenu: aString block: aBlock [ + | newAction | newAction := GtCoderExplicitContextMenuItemAction new title: aString; From a037f89e884ff3bbc1ace828daa302a19278e3ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Thu, 25 Sep 2025 17:57:38 +0200 Subject: [PATCH 1065/1268] Fix package tag selection after creating a class --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index 59fffa75f..d09806d07 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -171,10 +171,13 @@ GtCreationForm >> secureCommit [ { #category : #accessing } GtCreationForm >> selectInNavigationModel: aNavigationModel anInstance: anInstance [ aNavigationModel selectPackage: anInstance package. - - anInstance tags - ifNotEmpty: [ aNavigationModel - selectPackageTag: (anInstance package tagNamed: anInstance tags first) ]. + + (anInstance package tags reject: [ :aTag | aTag isRoot]) + ifNotEmpty: [ + anInstance packageTag ifNotNil: [ + aNavigationModel + selectPackageTag: (anInstance package + tagNamed: anInstance tags first) ] ]. aNavigationModel selectClass: anInstance ] From a19f17a73e6a48976b93bbfddf987c4f896b038a Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 25 Sep 2025 13:18:08 -0300 Subject: [PATCH 1066/1268] add `` [feenkcom/gtoolkit#4725] --- src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st | 1 + src/GToolkit-Coder-UI/GtCoderModel.extension.st | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st index 134ffa5f0..a9b503cc3 100644 --- a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st +++ b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st @@ -57,6 +57,7 @@ GtTextualCoder >> addContextMenuItemWithNoShortcutFrom: shortcut withId: menuId { #category : #'*GToolkit-Coder-AddOns' } GtTextualCoder >> addCopyCutPasteContextMenuAddOnsAst: anAst to: coderAddOns [ + (self addContextMenuItemFrom: BrEditorShortcut cut withId: GtTextualCoderCutContextMenuItemId diff --git a/src/GToolkit-Coder-UI/GtCoderModel.extension.st b/src/GToolkit-Coder-UI/GtCoderModel.extension.st index 13dfe8e44..89951569b 100644 --- a/src/GToolkit-Coder-UI/GtCoderModel.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderModel.extension.st @@ -78,7 +78,8 @@ GtCoderModel class >> gtContextMenuAddOnsFor: aView [ priority: 45.1; object: [ (GtSearchMethodsInClassFilter new forClass: self; - includeSuperclass: true) & self contextMenuAddOnsPragma gtPragmas ]; + includeSuperclass: true) & (self contextMenuAddOnsPragma gtPragmas + | GtCoderModel contextMenuAddOnsPragma gtAsReader gtPragmas) ]; view: #gtItemsFor:; actionButtonIcon: BrGlamorousVectorIcons inspect tooltip: 'Inspect Addons' From e8f83d840ec4184490270152193c971ff7b21e0e Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 26 Sep 2025 06:53:47 -0300 Subject: [PATCH 1067/1268] add `` pragma [feenkcom/gtoolkit#4725] --- src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st | 1 + src/GToolkit-Coder/GtCoderAddOns.class.st | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st index a9b503cc3..f7de110dc 100644 --- a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st +++ b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st @@ -31,6 +31,7 @@ GtTextualCoder >> addContextMenuItemFrom: shortcut withId: menuId to: coderAddOn { #category : #'*GToolkit-Coder-AddOns' } GtTextualCoder >> addContextMenuItemWithNoShortcutFrom: shortcut group: menuGroup withId: menuId to: coderAddOns [ + ^ coderAddOns addContextMenuItem: shortcut name group: menuGroup diff --git a/src/GToolkit-Coder/GtCoderAddOns.class.st b/src/GToolkit-Coder/GtCoderAddOns.class.st index cb9d12648..b54f25700 100644 --- a/src/GToolkit-Coder/GtCoderAddOns.class.st +++ b/src/GToolkit-Coder/GtCoderAddOns.class.st @@ -102,6 +102,7 @@ GtCoderAddOns >> addContextMenuItem: aString action: aBlock [ { #category : #'api - context menu' } GtCoderAddOns >> addContextMenuItem: aString action: aBlock id: aSymbol [ + ^ self addContextMenuItem: aString hover: nil @@ -124,6 +125,7 @@ GtCoderAddOns >> addContextMenuItem: aString action: aBlock id: aSymbol shortcut { #category : #'api - context menu' } GtCoderAddOns >> addContextMenuItem: aString action: aBlock shortcutKey: shortcut [ + ^ self addContextMenuItem: aString hover: nil @@ -134,6 +136,7 @@ GtCoderAddOns >> addContextMenuItem: aString action: aBlock shortcutKey: shortcu { #category : #'api - context menu' } GtCoderAddOns >> addContextMenuItem: aString group: menuGroup action: aBlock id: aSymbol [ + ^ self addContextMenuItem: aString group: menuGroup @@ -225,6 +228,7 @@ GtCoderAddOns >> addContextMenuItem: aString hover: hoverBlock leave: leaveBlock { #category : #'api - context menu' } GtCoderAddOns >> addContextMenuItem: aString hover: hoverBlock leave: leaveBlock action: aBlock id: aSymbol [ + | newAction | newAction := GtCoderContextMenuAction new title: aString; @@ -253,7 +257,8 @@ GtCoderAddOns >> addContextMenuItem: aString hover: hoverBlock leave: leaveBlock { #category : #'api - context menu' } GtCoderAddOns >> addContextMenuItem: aString hover: hoverBlock leave: leaveBlock action: aBlock shortcutKey: shortcutString [ - self + + ^ self addContextMenuItem: aString hover: hoverBlock leave: leaveBlock From e7e3ef9fb6fc89a778d887187f2a7c7a45dbf333 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 26 Sep 2025 08:52:46 -0300 Subject: [PATCH 1068/1268] use `` to compute context menu [feenkcom/gtoolkit#4725] --- src/GToolkit-Coder-UI/GtCoderModel.extension.st | 3 +-- .../GtTextualCoderViewModel.class.st | 2 +- src/GToolkit-Coder/GtCoderAddOns.class.st | 11 ++++++++--- src/GToolkit-Coder/GtCoderModel.class.st | 6 ++++-- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderModel.extension.st b/src/GToolkit-Coder-UI/GtCoderModel.extension.st index 89951569b..13dfe8e44 100644 --- a/src/GToolkit-Coder-UI/GtCoderModel.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderModel.extension.st @@ -78,8 +78,7 @@ GtCoderModel class >> gtContextMenuAddOnsFor: aView [ priority: 45.1; object: [ (GtSearchMethodsInClassFilter new forClass: self; - includeSuperclass: true) & (self contextMenuAddOnsPragma gtPragmas - | GtCoderModel contextMenuAddOnsPragma gtAsReader gtPragmas) ]; + includeSuperclass: true) & self contextMenuAddOnsPragma gtPragmas ]; view: #gtItemsFor:; actionButtonIcon: BrGlamorousVectorIcons inspect tooltip: 'Inspect Addons' diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index fa9e459bf..501eb9951 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -270,7 +270,7 @@ GtTextualCoderViewModel >> computeContextMenuAstAddOns [ theAst := aCoderModel astSync. pragmas := aCoderModel - pragmasNamed: #gtCoderContextMenuAddOns: + pragmasNamed: aCoderModel class contextMenuAddOnsPragma inHierarchy: aCoderModel class. newAddOns := aCoderModel newAddOns. diff --git a/src/GToolkit-Coder/GtCoderAddOns.class.st b/src/GToolkit-Coder/GtCoderAddOns.class.st index b54f25700..4fbf3bc52 100644 --- a/src/GToolkit-Coder/GtCoderAddOns.class.st +++ b/src/GToolkit-Coder/GtCoderAddOns.class.st @@ -7,7 +7,8 @@ Class { 'contextMenuActions', 'shortcuts', 'updateRequested', - 'previews' + 'previews', + 'contextMenuActionsSortedArray' ], #category : #'GToolkit-Coder-Coders - Addons' } @@ -82,7 +83,8 @@ GtCoderAddOns >> addContextDropDownWithPreviewAction: aString icon: anIcon actio { #category : #'api - context menu' } GtCoderAddOns >> addContextMenuAction: aContextMenuAction [ - contextMenuActions add: aContextMenuAction + contextMenuActions add: aContextMenuAction. + contextMenuActionsSortedArray := nil. ] { #category : #'api - context menu' } @@ -441,7 +443,9 @@ GtCoderAddOns >> contextActions [ { #category : #'api - context menu' } GtCoderAddOns >> contextMenuActions [ - ^ contextMenuActions + ^ contextMenuActionsSortedArray ifNil: [ + contextMenuActionsSortedArray := contextMenuActions asArray + sort: [ :a | a priority ] ascending ] ] { #category : #'initialize-release' } @@ -450,6 +454,7 @@ GtCoderAddOns >> initialize [ contextActions := OrderedCollection new. mainActions := OrderedCollection new. contextMenuActions := OrderedCollection new. + contextMenuActionsSortedArray := nil. shortcuts := OrderedCollection new. previews := OrderedCollection new. updateRequested := true diff --git a/src/GToolkit-Coder/GtCoderModel.class.st b/src/GToolkit-Coder/GtCoderModel.class.st index 1e1c092aa..379d997c2 100644 --- a/src/GToolkit-Coder/GtCoderModel.class.st +++ b/src/GToolkit-Coder/GtCoderModel.class.st @@ -41,7 +41,7 @@ GtCoderModel class >> astExtensionsPragma [ { #category : #addons } GtCoderModel class >> contextMenuAddOnsPragma [ - ^ #gtCoderContextMenuAddOns: + ^ #gtCoderContextMenuAddOns ] { #category : #'class initialization' } @@ -200,7 +200,9 @@ GtCoderModel >> pragmasNamed: aSymbol inHierarchy: aClass [ actions addAll: (Pragma allNamed: aSymbol in: each) ]. actions sort: ( - [ :aPragma | aPragma arguments first ] ascending, + [ :aPragma | aPragma numArgs isZero + ifFalse: [ aPragma arguments first ] + ifTrue: [ 50 ] ] ascending, [ :aPragma | aPragma methodSelector ] ascending). ^ actions ] From c655650a5606b5b2afe6f3367991fa081c3052a3 Mon Sep 17 00:00:00 2001 From: Roland Bernard <18496639+rolandbernard@users.noreply.github.com> Date: Fri, 26 Sep 2025 14:35:35 +0200 Subject: [PATCH 1069/1268] Initialize search add-on by searching for selection. --- .../GtTextualCoder.extension.st | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st index a9b503cc3..4cc76c15b 100644 --- a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st +++ b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st @@ -120,7 +120,21 @@ GtTextualCoder >> initializeSearchTextAddOns: addOns viewModel: aCoderViewModel | anElement | anElement := GtTextualCoderSearchTextElement new textualCoderViewModel: aCoderViewModel; - editorDo: [ :anEditor | anEditor requestFocus ]; + editorDo: [ :anEditor | + anEditor requestFocus. + aCoderViewModel selection isEmpty ifFalse: [ + | text | + text := (aCoderViewModel sourceText + copyFrom: aCoderViewModel selection from + 1 + to: aCoderViewModel selection to) asString. + anEditor doBlockSoon: [ + (anEditor inserter) + atCursor; + string: text; + insert. + (anEditor selecter) + all; + select ] ] ]; hFitContentLimited; constraintsDo: [ :c | c minWidth: 300. From c634c8d993e2d16fc4aeb0d0cdd8a5f0d04ab044 Mon Sep 17 00:00:00 2001 From: John Brant Date: Fri, 26 Sep 2025 08:21:36 -0500 Subject: [PATCH 1070/1268] [feenkcom/gtoolkit#4738] continue saving after resolving undeclared --- .../GtFixItAction.class.st | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtFixItAction.class.st b/src/GToolkit-Coder-AddOns/GtFixItAction.class.st index fbd5cb251..88de2ccff 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItAction.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItAction.class.st @@ -3,7 +3,8 @@ Class { #superclass : #Object, #instVars : [ 'node', - 'sourceCoder' + 'sourceCoder', + 'autoSave' ], #category : #'GToolkit-Coder-AddOns-FixIt' } @@ -21,6 +22,21 @@ GtFixItAction >> attributePosition [ ^ node name stopPosition ] +{ #category : #accessing } +GtFixItAction >> autoSave [ + ^ autoSave ifNil: [ false ] +] + +{ #category : #accessing } +GtFixItAction >> autoSave: aBoolean [ + autoSave := aBoolean +] + +{ #category : #executing } +GtFixItAction >> basicExecuteOn: anEditorElement [ + self subclassResponsibility +] + { #category : #private } GtFixItAction >> clearFixItAttributeInEditor: aBrTextEditor [ | position | @@ -38,7 +54,12 @@ GtFixItAction >> description [ { #category : #executing } GtFixItAction >> executeOn: anEditorElement [ - self subclassResponsibility + self basicExecuteOn: anEditorElement. + self finishExecuteOn: anEditorElement +] + +{ #category : #executing } +GtFixItAction >> finishExecuteOn: anEditorElement [ ] { #category : #'api - action' } From be56c76741dcfe4a70b29e1e3a89b32e0b3b0316 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 26 Sep 2025 12:16:40 -0300 Subject: [PATCH 1071/1268] add `GtCreationForm>>#taggerStencilWithCompletion:contextMenuContentBlock:contextMenuBlock:` [feenkcom/gtoolkit#4725] --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 22 ++++++++++++++----- src/GToolkit-Coder-UI/Trait.extension.st | 16 ++++++++++++++ 2 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 src/GToolkit-Coder-UI/Trait.extension.st diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index d09806d07..f3bdaa3eb 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -183,7 +183,10 @@ GtCreationForm >> selectInNavigationModel: aNavigationModel anInstance: anInstan ] { #category : #accessing } -GtCreationForm >> taggerStencilWithCompletion: aCompletionStrategy andContextMenuBlock: aContextMenuBlock [ +GtCreationForm >> taggerStencilWithCompletion: aCompletionStrategy contextMenuContentBlock: aContextMenuContentBlock contextMenuBlock: aContextMenuBlock [ + "aContextMenuContentBlock returns an element. + aContextMenuBlock returns a BrMenu or nil." + ^ [ :aMemento :aDescription :aForm | | aTagger aTaggerAptitude | aTagger := BrTagger new hFitContentLimited. @@ -232,12 +235,19 @@ GtCreationForm >> taggerStencilWithCompletion: aCompletionStrategy andContextMen aCompletionStrategy ifNotNil: [ (GtCompletionController on: aLabel strategy: aCompletionStrategy) install ]. aContextMenuBlock + ifNil: [ aContextMenuContentBlock + ifNotNil: [ aLabel + addAptitude: (BrGlamorousWithExplicitContextMenuAptitude + content: [ aContextMenuContentBlock + value: aTag name + value: aLabel + value: aMemento ]) ] ] ifNotNil: [ aLabel - addAptitude: (BrGlamorousWithExplicitContextMenuAptitude - content: [ aContextMenuBlock - value: aTag name - value: aLabel - value: aMemento ]) ]. + addAptitude: (BrGlamorousWithExplicitContextMenuAptitude + menu: [ aContextMenuBlock + value: aTag name + value: aLabel + value: aMemento ]) ]. aLabel ]). aTagger when: BrTaggerAddTagRequest diff --git a/src/GToolkit-Coder-UI/Trait.extension.st b/src/GToolkit-Coder-UI/Trait.extension.st new file mode 100644 index 000000000..3c23b6706 --- /dev/null +++ b/src/GToolkit-Coder-UI/Trait.extension.st @@ -0,0 +1,16 @@ +Extension { #name : #Trait } + +{ #category : #'*GToolkit-Coder-UI' } +Trait >> gtCoderSidebarIndexBrowseTraitUsersFor: anAction [ + + self isTrait ifFalse: [ ^ anAction noAction ]. + + ^ anAction button + priority: 3; + target: GtCoderClassTarget; + icon: BrGlamorousVectorIcons empty; + label: 'Browse trait users'; + menuItemPreview: self name; + menuItemGroup: BrMenuItemGroupConfiguration navigation; + action: [ :aButton | aButton phlow spawnObject: (self instanceSide users asArray sort: [ :a | a name ] ascending) ] +] From 93076b753ee0dc72787823e69b1c7bf73a503794 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 26 Sep 2025 12:17:31 -0300 Subject: [PATCH 1072/1268] re-add a method [feenkcom/gtoolkit#4725] --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index f3bdaa3eb..58e1061f2 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -182,6 +182,14 @@ GtCreationForm >> selectInNavigationModel: aNavigationModel anInstance: anInstan aNavigationModel selectClass: anInstance ] +{ #category : #accessing } +GtCreationForm >> taggerStencilWithCompletion: aCompletionStrategy contextMenuContentBlock: aContextMenuContentBlock [ + ^ self + taggerStencilWithCompletion: aCompletionStrategy + contextMenuContentBlock: aContextMenuContentBlock + contextMenuBlock: nil +] + { #category : #accessing } GtCreationForm >> taggerStencilWithCompletion: aCompletionStrategy contextMenuContentBlock: aContextMenuContentBlock contextMenuBlock: aContextMenuBlock [ "aContextMenuContentBlock returns an element. From 2ed423047438d0d0674d05ad36f1bbea06cb14da Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 26 Sep 2025 20:24:26 -0300 Subject: [PATCH 1073/1268] add class reference submenu with class actions [feenkcom/gtoolkit#4725] --- .../GtTextualCoder.extension.st | 9 ++- ...rGlamorousMenuItemTypeBuilder.extension.st | 15 +++++ .../GtCoderActionsElement.class.st | 2 +- .../GtCoderDropDownMenuAction.extension.st | 19 +++++++ .../GtCoderMenuActionItem.class.st | 4 +- .../GtCoderMenuSubmenuItem.class.st | 56 +++++++++++++++++++ .../GtCoderMenuSubmenuItemElement.class.st | 46 +++++++++++++++ .../TBrMenuModelVisitor.extension.st | 5 ++ src/GToolkit-Coder/GtCoderAddOns.class.st | 11 ++++ .../GtCoderDropDownMenuAction.class.st | 29 +++++++--- .../GtPhlowContext.extension.st | 5 ++ 11 files changed, 188 insertions(+), 13 deletions(-) create mode 100644 src/GToolkit-Coder-UI/BrGlamorousMenuItemTypeBuilder.extension.st create mode 100644 src/GToolkit-Coder-UI/GtCoderMenuSubmenuItem.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderMenuSubmenuItemElement.class.st diff --git a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st index f7de110dc..9f14456a8 100644 --- a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st +++ b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st @@ -61,16 +61,19 @@ GtTextualCoder >> addCopyCutPasteContextMenuAddOnsAst: anAst to: coderAddOns [ (self addContextMenuItemFrom: BrEditorShortcut cut + group: BrMenuItemGroupConfiguration text withId: GtTextualCoderCutContextMenuItemId - to: coderAddOns) ifNotNil: [ :anAction | anAction priority: 1000 ]. + to: coderAddOns) ifNotNil: [ :anAction | anAction priority: 1000.01 ]. (self addContextMenuItemFrom: BrEditorShortcut copy + group: BrMenuItemGroupConfiguration text withId: GtTextualCoderCopyContextMenuItemId - to: coderAddOns) ifNotNil: [ :anAction | anAction priority: 1000 ]. + to: coderAddOns) ifNotNil: [ :anAction | anAction priority: 1000.02 ]. (self addContextMenuItemFrom: BrEditorShortcut paste + group: BrMenuItemGroupConfiguration text withId: GtTextualCoderPasteContextMenuItemId - to: coderAddOns) ifNotNil: [ :anAction | anAction priority: 1000 ] + to: coderAddOns) ifNotNil: [ :anAction | anAction priority: 1000.03 ] ] { #category : #'*GToolkit-Coder-AddOns' } diff --git a/src/GToolkit-Coder-UI/BrGlamorousMenuItemTypeBuilder.extension.st b/src/GToolkit-Coder-UI/BrGlamorousMenuItemTypeBuilder.extension.st new file mode 100644 index 000000000..823139a34 --- /dev/null +++ b/src/GToolkit-Coder-UI/BrGlamorousMenuItemTypeBuilder.extension.st @@ -0,0 +1,15 @@ +Extension { #name : #BrGlamorousMenuItemTypeBuilder } + +{ #category : #'*GToolkit-Coder-UI' } +BrGlamorousMenuItemTypeBuilder >> visitCoderMenuActionItem: aMenuModel [ + ^ self + visitMenuLabeledItem: aMenuModel + withElementClass: GtCoderMenuActionItemElement +] + +{ #category : #'*GToolkit-Coder-UI' } +BrGlamorousMenuItemTypeBuilder >> visitCoderSubmenuItem: aMenuModel [ + ^ self + visitMenuLabeledItem: aMenuModel + withElementClass: GtCoderMenuSubmenuItemElement +] diff --git a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st index cc81dcd76..943dda993 100644 --- a/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderActionsElement.class.st @@ -178,7 +178,7 @@ GtCoderActionsElement >> newDropButtonMenuForAction: aGtCoderAction [ ifNotNil: [ button label: aGtCoderAction title asRopedText ]. aGtCoderAction icon ifNotNil: [ button icon: aGtCoderAction icon asElement ]. - aMenuStencil := aGtCoderAction menuStencil + aMenuStencil := aGtCoderAction menuBlock ifNil: [ [ BrMenuExplicit new stencil: [ self newDropButtonDefaultMenuForAction: aGtCoderAction ] ] ]. diff --git a/src/GToolkit-Coder-UI/GtCoderDropDownMenuAction.extension.st b/src/GToolkit-Coder-UI/GtCoderDropDownMenuAction.extension.st index d499d904f..28b584d7e 100644 --- a/src/GToolkit-Coder-UI/GtCoderDropDownMenuAction.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderDropDownMenuAction.extension.st @@ -1,5 +1,24 @@ Extension { #name : #GtCoderDropDownMenuAction } +{ #category : #'*GToolkit-Coder-UI' } +GtCoderDropDownMenuAction >> asBrMenuItemForCoderElement: aTextualCoderEditorElement [ + | aMenuItem aSubMenu | + aSubMenu := self menuBlock + cull: aTextualCoderEditorElement textualCoderViewModel + cull: aTextualCoderEditorElement. + aSubMenu ifNil: [ ^ nil ]. + + aMenuItem := GtCoderMenuSubmenuItem new + textualCoderEditorElement: aTextualCoderEditorElement; + coderContextMenuAction: self; + disableIf: [ self isDisabled ]; + submenu: aSubMenu. + + self allowAltClick ifTrue: [ aMenuItem definition: [ self actionDefinition ] ]. + + ^ aMenuItem +] + { #category : #'*GToolkit-Coder-UI' } GtCoderDropDownMenuAction >> buildElementIn: aCoderActionsElement [ ^ aCoderActionsElement newDropButtonMenuForAction: self diff --git a/src/GToolkit-Coder-UI/GtCoderMenuActionItem.class.st b/src/GToolkit-Coder-UI/GtCoderMenuActionItem.class.st index 7d5dcc6dc..0fed37226 100644 --- a/src/GToolkit-Coder-UI/GtCoderMenuActionItem.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMenuActionItem.class.st @@ -29,12 +29,12 @@ GtCoderMenuActionItem >> coderContextMenuAction: aCoderContextMenuAction [ ifEmpty: [ self label: aCoderContextMenuAction title ] ] -{ #category : #'as yet unclassified' } +{ #category : #accessing } GtCoderMenuActionItem >> hoverAction [ ^ self coderContextMenuAction hoverAction ] -{ #category : #'as yet unclassified' } +{ #category : #accessing } GtCoderMenuActionItem >> leaveAction [ ^ self coderContextMenuAction leaveAction ] diff --git a/src/GToolkit-Coder-UI/GtCoderMenuSubmenuItem.class.st b/src/GToolkit-Coder-UI/GtCoderMenuSubmenuItem.class.st new file mode 100644 index 000000000..5e9546b0a --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderMenuSubmenuItem.class.st @@ -0,0 +1,56 @@ +Class { + #name : #GtCoderMenuSubmenuItem, + #superclass : #BrMenuSubmenuItem, + #instVars : [ + 'textualCoderEditorElement' + ], + #category : #'GToolkit-Coder-UI-Coder - Addons' +} + +{ #category : #visiting } +GtCoderMenuSubmenuItem >> acceptVisitor: aVisitor [ + ^ aVisitor visitCoderSubmenuItem: self +] + +{ #category : #accessing } +GtCoderMenuSubmenuItem >> coderContextMenuAction [ + + ^ self action +] + +{ #category : #accessing } +GtCoderMenuSubmenuItem >> coderContextMenuAction: aCoderContextMenuAction [ + self action: aCoderContextMenuAction. + self id: aCoderContextMenuAction id. + aCoderContextMenuAction group ifNotNil: [ :aGroup | + self group: aGroup ]. + aCoderContextMenuAction shortcutKey + ifNotEmpty: [ self label: aCoderContextMenuAction title shortcut: aCoderContextMenuAction shortcutKey ] + ifEmpty: [ self label: aCoderContextMenuAction title ] +] + +{ #category : #accessing } +GtCoderMenuSubmenuItem >> hoverAction [ + ^ self coderContextMenuAction hoverAction +] + +{ #category : #accessing } +GtCoderMenuSubmenuItem >> leaveAction [ + ^ self coderContextMenuAction leaveAction +] + +{ #category : #accessing } +GtCoderMenuSubmenuItem >> textualCoderEditorElement [ + + ^ textualCoderEditorElement +] + +{ #category : #accessing } +GtCoderMenuSubmenuItem >> textualCoderEditorElement: aCoderElement [ + textualCoderEditorElement := aCoderElement +] + +{ #category : #accessing } +GtCoderMenuSubmenuItem >> textualCoderViewModel [ + ^ self textualCoderEditorElement textualCoderViewModel +] diff --git a/src/GToolkit-Coder-UI/GtCoderMenuSubmenuItemElement.class.st b/src/GToolkit-Coder-UI/GtCoderMenuSubmenuItemElement.class.st new file mode 100644 index 000000000..1a840d38b --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderMenuSubmenuItemElement.class.st @@ -0,0 +1,46 @@ +Class { + #name : #GtCoderMenuSubmenuItemElement, + #superclass : #BrMenuSubmenuItemElement, + #category : #'GToolkit-Coder-UI-Coder - Addons' +} + +{ #category : #'event handling' } +GtCoderMenuSubmenuItemElement >> leaveOnEvent: anEvent [ + | aMenuModel | + aMenuModel := self menuModel. + aMenuModel ifNil: [ ^ self ]. + aMenuModel leaveAction ifNotNil: [ :aLeaveBlock | + aLeaveBlock cull: aMenuModel textualCoderViewModel cull: anEvent ] +] + +{ #category : #'event handling' } +GtCoderMenuSubmenuItemElement >> onClick: anEvent element: anElement model: aButtonModel [ + | aMenuModel aCoderAction | + aMenuModel := self menuModel. + aMenuModel ifNil: [ ^ self ]. + self leaveOnEvent: anEvent. + aCoderAction := aMenuModel coderContextMenuAction. + aCoderAction ifNil: [ ^ self ]. + aCoderAction action ifNotNil: [ :anAction | + anAction gtValueWithArgs: { + aMenuModel textualCoderEditorElement textualCoderViewModel. + aMenuModel textualCoderEditorElement. + anEvent } ]. + aMenuModel hideOnClick ifTrue: [ aMenuModel hideAll ] +] + +{ #category : #'event handling' } +GtCoderMenuSubmenuItemElement >> onMouseEnterEvent: anEvent [ + | aMenuModel | + super onMouseEnterEvent: anEvent. + aMenuModel := self menuModel. + aMenuModel ifNil: [ ^ self ]. + aMenuModel hoverAction ifNotNil: [ :aHoverBlock | + aHoverBlock cull: aMenuModel textualCoderViewModel cull: anEvent ] +] + +{ #category : #'event handling' } +GtCoderMenuSubmenuItemElement >> onMouseLeaveEvent: anEvent [ + super onMouseLeaveEvent: anEvent. + self leaveOnEvent: anEvent +] diff --git a/src/GToolkit-Coder-UI/TBrMenuModelVisitor.extension.st b/src/GToolkit-Coder-UI/TBrMenuModelVisitor.extension.st index 6d0be95f1..9085223be 100644 --- a/src/GToolkit-Coder-UI/TBrMenuModelVisitor.extension.st +++ b/src/GToolkit-Coder-UI/TBrMenuModelVisitor.extension.st @@ -5,6 +5,11 @@ TBrMenuModelVisitor >> visitCoderMenuActionItem: aMenuModel [ ^ self visitMenuActionItem: aMenuModel ] +{ #category : #'*GToolkit-Coder-UI' } +TBrMenuModelVisitor >> visitCoderSubmenuItem: aMenuModel [ + ^ self visitMenuSubmenuItem: aMenuModel +] + { #category : #'*GToolkit-Coder-UI' } TBrMenuModelVisitor >> visitTextualCoderMenu: aMenuModel [ ^ self visitMenu: aMenuModel diff --git a/src/GToolkit-Coder/GtCoderAddOns.class.st b/src/GToolkit-Coder/GtCoderAddOns.class.st index 4fbf3bc52..c5a088b3d 100644 --- a/src/GToolkit-Coder/GtCoderAddOns.class.st +++ b/src/GToolkit-Coder/GtCoderAddOns.class.st @@ -81,6 +81,17 @@ GtCoderAddOns >> addContextDropDownWithPreviewAction: aString icon: anIcon actio onlyNew: true ] +{ #category : #'api - main actions' } +GtCoderAddOns >> addContextMenu: aString icon: anIcon submenu: aBlock [ + | newAction | + newAction := GtCoderDropDownMenuAction new + title: aString; + icon: anIcon; + menu: aBlock. + self addContextMenuAction: newAction. + ^ newAction +] + { #category : #'api - context menu' } GtCoderAddOns >> addContextMenuAction: aContextMenuAction [ contextMenuActions add: aContextMenuAction. diff --git a/src/GToolkit-Coder/GtCoderDropDownMenuAction.class.st b/src/GToolkit-Coder/GtCoderDropDownMenuAction.class.st index b96302f9d..623ec40dd 100644 --- a/src/GToolkit-Coder/GtCoderDropDownMenuAction.class.st +++ b/src/GToolkit-Coder/GtCoderDropDownMenuAction.class.st @@ -2,15 +2,16 @@ Class { #name : #GtCoderDropDownMenuAction, #superclass : #GtCoderAction, #instVars : [ - 'menuStencil' + 'group', + 'menuBlock' ], #category : #'GToolkit-Coder-Coders - Addons' } { #category : #initialization } GtCoderDropDownMenuAction >> computeActionDefinition [ - self menuStencil isClosure - ifTrue: [ ^ GtCoderActionClosureDefinition new closure: self menuStencil ]. + self menuBlock isClosure + ifTrue: [ ^ GtCoderActionClosureDefinition new closure: self menuBlock ]. ^ nil ] @@ -20,6 +21,17 @@ GtCoderDropDownMenuAction >> content: aBlock [ self menu: [ BrMenuExplicit new stencil: aBlock ] ] +{ #category : #accessing } +GtCoderDropDownMenuAction >> group [ + + ^ group +] + +{ #category : #accessing } +GtCoderDropDownMenuAction >> group: aMenuItemGroupConfiguration [ + group := aMenuItemGroupConfiguration +] + { #category : #accessing } GtCoderDropDownMenuAction >> items: aBlock [ self actionDefinitionFromBlock: aBlock. @@ -30,11 +42,14 @@ GtCoderDropDownMenuAction >> items: aBlock [ ] { #category : #accessing } -GtCoderDropDownMenuAction >> menu: aBlockOrStencil [ - menuStencil := aBlockOrStencil +GtCoderDropDownMenuAction >> menu: aBlock [ + "The block can have two arguments: [ :aTextualCoderViewModel :aTextualCoderEditorElement | ]. + The block returns BrMenu." + + menuBlock := aBlock ] { #category : #accessing } -GtCoderDropDownMenuAction >> menuStencil [ - ^ menuStencil +GtCoderDropDownMenuAction >> menuBlock [ + ^ menuBlock ] diff --git a/src/GToolkit-Coder/GtPhlowContext.extension.st b/src/GToolkit-Coder/GtPhlowContext.extension.st index 52ca0823e..160af5d6d 100644 --- a/src/GToolkit-Coder/GtPhlowContext.extension.st +++ b/src/GToolkit-Coder/GtPhlowContext.extension.st @@ -5,6 +5,11 @@ GtPhlowContext >> coderSelectedClasses [ ^ self optionAt: #coderSelectedClasses ifAbsent: [ #() ] ] +{ #category : #'*GToolkit-Coder-UI\t' } +GtPhlowContext >> coderSelectedClasses: aCollectionOfClasses [ + ^ self optionAt: #coderSelectedClasses put: aCollectionOfClasses +] + { #category : #'*GToolkit-Coder' } GtPhlowContext >> hasPackageCoder [ ^ self hasOptionAt: #packageCoder From 27e90c31b4df881654c2fb97eee015750027eb07 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 26 Sep 2025 20:45:44 -0300 Subject: [PATCH 1074/1268] remove `` pragma [feenkcom/gtoolkit#4725] --- src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st | 1 - 1 file changed, 1 deletion(-) diff --git a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st index 9f14456a8..af89b8ab1 100644 --- a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st +++ b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st @@ -57,7 +57,6 @@ GtTextualCoder >> addContextMenuItemWithNoShortcutFrom: shortcut withId: menuId { #category : #'*GToolkit-Coder-AddOns' } GtTextualCoder >> addCopyCutPasteContextMenuAddOnsAst: anAst to: coderAddOns [ - (self addContextMenuItemFrom: BrEditorShortcut cut From 6bfc3c1f62fef3d416f7242f8effd82bd71b4934 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Sat, 27 Sep 2025 11:46:54 -0300 Subject: [PATCH 1075/1268] clean Trait context menu [feenkcom/gtoolkit#4725] --- src/GToolkit-Coder-UI/Class.extension.st | 23 ++++-- .../GtCoderRemoveClassPreviewStencil.class.st | 75 ++++++++++++------- src/GToolkit-Coder-UI/Trait.extension.st | 5 ++ 3 files changed, 67 insertions(+), 36 deletions(-) diff --git a/src/GToolkit-Coder-UI/Class.extension.st b/src/GToolkit-Coder-UI/Class.extension.st index 678dbd423..370b447de 100644 --- a/src/GToolkit-Coder-UI/Class.extension.st +++ b/src/GToolkit-Coder-UI/Class.extension.st @@ -8,11 +8,11 @@ Class >> asFilterModelItem [ { #category : #'*GToolkit-Coder-UI' } Class >> gtCoderSidebarIndexBrowseClassFor: anAction [ - ^ anAction button + ^ anAction button priority: 1; target: GtCoderClassTarget; icon: BrGlamorousVectorIcons browse; - label: 'Browse class'; + label: ('Browse {1}' format: {self gtCoderTypeName}); menuItemPreview: self name; menuItemGroup: BrMenuItemGroupConfiguration navigation; action: [ :aButton | aButton phlow spawnObject: self instanceSide ] @@ -90,7 +90,7 @@ Class >> gtCoderSidebarIndexCopyClassNameFor: anAction [ priority: 9; target: GtCoderClassTarget; icon: BrGlamorousVectorIcons clipboard; - label: 'Copy class name'; + label: ('Copy {1} name' format: {self gtCoderTypeName}); menuItemPreview: self name; menuItemGroup: BrMenuItemGroupConfiguration default; action: [ Clipboard clipboardText: self name ] @@ -132,7 +132,7 @@ Class >> gtCoderSidebarIndexLlmChatFor: anAction [ priority: 20; target: GtCoderClassTarget; icon: BrGlamorousVectorIcons chat; - label: 'Chat about this class'; + label: ('Chat about this {1}' format: {self gtCoderTypeName}); menuItemPreview: self name; menuItemGroup: BrMenuItemGroupConfiguration default; action: [ :aButton | @@ -144,6 +144,8 @@ Class >> gtCoderSidebarIndexLlmChatFor: anAction [ { #category : #'*GToolkit-Coder-UI' } Class >> gtCoderSidebarIndexNewSubclassFor: anAction [ + self isTrait ifTrue: [ ^ anAction noAction ]. + ^ anAction button priority: 3; target: GtCoderClassTarget; @@ -183,7 +185,7 @@ Class >> gtCoderSidebarIndexRemoveClassFor: anAction [ target: GtCoderClassTarget; id: #'coder--context-menu-remove-class'; icon: BrGlamorousVectorIcons remove; - label: 'Remove class'; + label: ('Remove {1}' format: {self gtCoderTypeName}); menuItemPreview: self name; menuItemGroup: BrMenuItemGroupConfiguration removal; menuItemPinSubmenu; @@ -243,15 +245,15 @@ Class >> gtCoderSidebarIndexRenameClassFor: anAction [ priority: 4; target: GtCoderClassTarget; icon: BrGlamorousVectorIcons empty; - label: 'Rename class'; + label: ('Rename {1}' format: {self gtCoderTypeName}); menuItemPreview: self name; menuItemGroup: BrMenuItemGroupConfiguration refactoring; content: [ :anActionElement :aTargetElement :anExplicitMenu | | aViewModel | aViewModel := GtRefactoringsWithInputViewModel new - refactoringTitle: 'Rename class'; + refactoringTitle: ('Rename {1}' format: {self gtCoderTypeName}); targetName: self name; - inputLabel: 'New class name:'; + inputLabel: ('New {1} name:' format: { self gtCoderTypeName }); initialText: self name; refactoringWithInput: [ :anInput | GtRBRenameClassRefactoring @@ -276,3 +278,8 @@ Class >> gtCoderSidebarIndexRenameClassFrom: aGtCoderClassesTreeElement [ submenu: (aGtCoderClassesTreeElement renameClassSubmenuFor: self); bePinSubmenuAction ] + +{ #category : #'*GToolkit-Coder-UI' } +Class >> gtCoderTypeName [ + ^ 'class' +] diff --git a/src/GToolkit-Coder-UI/GtCoderRemoveClassPreviewStencil.class.st b/src/GToolkit-Coder-UI/GtCoderRemoveClassPreviewStencil.class.st index a62720822..2a066ade8 100644 --- a/src/GToolkit-Coder-UI/GtCoderRemoveClassPreviewStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderRemoveClassPreviewStencil.class.st @@ -23,36 +23,13 @@ GtCoderRemoveClassPreviewStencil >> create [ | element change button | element := BrVerticalPane new fitContent. element - addChild: ((self newRemoveClassLabel) + addChild: (self newRemoveClassLabel margin: (BlInsets top: 10 bottom: 0 left: 10 right: 10)). - element - addChild: (BrAsyncWidget new - fitContent; - stencil: [ | pane references subclasses | - references := (GtPharoIndex current - globalVariableReferencesTo: self classToRemove binding) size. - subclasses := self classToRemove allSubclasses size. - pane := BrVerticalPane new. - pane fitContent. - references > 0 - ifTrue: [ pane - addChild: (BrLabel new - margin: (BlInsets left: 10 right: 10); - aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; - text: (references printString , ' reference' - , (references > 1 ifTrue: [ 's' ] ifFalse: [ '' ])) asRopedText) ]. - subclasses > 0 - ifTrue: [ pane - addChild: (BrLabel new - margin: (BlInsets left: 10 right: 10); - aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; - text: (subclasses printString , ' subclass' - , (subclasses > 1 ifTrue: [ 'es' ] ifFalse: [ '' ])) asRopedText) ]. - pane ]). + element addChild: self newReferencesAsyncElement. change := RBRemoveClassChange remove: self classToRemove. button := BrButton new aptitude: BrGlamorousButtonWithIconAptitude; @@ -64,8 +41,7 @@ GtCoderRemoveClassPreviewStencil >> create [ right: 10); icon: BrGlamorousVectorIcons remove; label: 'Remove'; - action: [ - self menuModel ifNotNil: #hideAll. + action: [ self menuModel ifNotNil: #hideAll. change execute ]. element addChild: button as: #removeButton. ^ element @@ -81,10 +57,53 @@ GtCoderRemoveClassPreviewStencil >> menuModel: anObject [ menuModel := anObject ] +{ #category : #private } +GtCoderRemoveClassPreviewStencil >> newReferencesAsyncElement [ + ^ BrAsyncWidget new + fitContent; + stencil: [ self newReferencesContentElement ] +] + +{ #category : #private } +GtCoderRemoveClassPreviewStencil >> newReferencesContentElement [ + | pane users references subclasses | + references := (GtPharoIndex current + globalVariableReferencesTo: self classToRemove binding) size. + subclasses := self classToRemove allSubclasses size. + users := self classToRemove isTrait + ifFalse: [ #() ] + ifTrue: [ self classToRemove users size ]. + pane := BrVerticalPane new. + pane fitContent. + references > 0 + ifTrue: [ pane + addChild: (BrLabel new + margin: (BlInsets left: 10 right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; + text: (references printString , ' reference' + , (references > 1 ifTrue: [ 's' ] ifFalse: [ '' ])) asRopedText) ]. + subclasses > 0 + ifTrue: [ pane + addChild: (BrLabel new + margin: (BlInsets left: 10 right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; + text: (subclasses printString , ' subclass' + , (subclasses > 1 ifTrue: [ 'es' ] ifFalse: [ '' ])) asRopedText) ]. + + users > 0 + ifTrue: [ pane + addChild: (BrLabel new + margin: (BlInsets left: 10 right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; + text: (users printString , ' user' , (users > 1 ifTrue: [ 's' ] ifFalse: [ '' ])) + asRopedText) ]. + ^ pane +] + { #category : #private } GtCoderRemoveClassPreviewStencil >> newRemoveClassLabel [ | labelText | - labelText := 'Remove class ' , self classToRemove name. + labelText := 'Remove {1} {2}' format: { self classToRemove gtCoderTypeName. self classToRemove name }. ^ BrLabel new margin: (BlInsets all: 10); aptitude: BrGlamorousLabelAptitude new glamorousRegularFont; diff --git a/src/GToolkit-Coder-UI/Trait.extension.st b/src/GToolkit-Coder-UI/Trait.extension.st index 3c23b6706..b990fd17e 100644 --- a/src/GToolkit-Coder-UI/Trait.extension.st +++ b/src/GToolkit-Coder-UI/Trait.extension.st @@ -14,3 +14,8 @@ Trait >> gtCoderSidebarIndexBrowseTraitUsersFor: anAction [ menuItemGroup: BrMenuItemGroupConfiguration navigation; action: [ :aButton | aButton phlow spawnObject: (self instanceSide users asArray sort: [ :a | a name ] ascending) ] ] + +{ #category : #'*GToolkit-Coder-UI' } +Trait >> gtCoderTypeName [ + ^ 'trait' +] From f12f60d385297d57d0ae03cf53d95a4f33ecd3e4 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Sat, 27 Sep 2025 13:19:29 -0300 Subject: [PATCH 1076/1268] improve copy class or trait form [feenkcom/gtoolkit#4725] --- src/GToolkit-Coder-UI/Class.extension.st | 32 +++++++++---------- .../GtCoderNavigationTabsStencil.class.st | 29 ++++++++--------- src/GToolkit-Coder-UI/GtCreationForm.class.st | 5 +++ .../GtPhlowElementContext.extension.st | 14 +++----- 4 files changed, 39 insertions(+), 41 deletions(-) diff --git a/src/GToolkit-Coder-UI/Class.extension.st b/src/GToolkit-Coder-UI/Class.extension.st index 370b447de..8fc84faf7 100644 --- a/src/GToolkit-Coder-UI/Class.extension.st +++ b/src/GToolkit-Coder-UI/Class.extension.st @@ -144,27 +144,27 @@ Class >> gtCoderSidebarIndexLlmChatFor: anAction [ { #category : #'*GToolkit-Coder-UI' } Class >> gtCoderSidebarIndexNewSubclassFor: anAction [ - self isTrait ifTrue: [ ^ anAction noAction ]. - - ^ anAction button + ^ anAction dropdown priority: 3; target: GtCoderClassTarget; icon: BrGlamorousVectorIcons add; - label: 'New subclass'; + label: (self isTrait ifFalse: [ 'New subclass' ] ifTrue: [ 'New trait user' ]); menuItemPreview: self name; menuItemGroup: BrMenuItemGroupConfiguration modification; - action: [ :aButton :aHostElement | - "TODO: We should replace this with a dedicated wish event." - aHostElement - withAllParentsDetect: [ :eachElement | eachElement class == BrTabGroup ] - ifFound: [ :aTabGroup | - aTabGroup - childWithId: GtNavigationNewDropdownId - ifFound: [ :anElemet | - anElemet dispatchEvent: BrDropdownShowWish new ] - ifNone: [ ] ] - ifNone: [ "ignore" ]. - ] + menuItemPinSubmenu; + content: [ :aButton :aTargetElement :anExplicitMenu | + | aNavigationModel | + aNavigationModel := aButton phlow firstParentCoderNavigationModel. + BrVerticalPane new + exact: 400 @ 300; + addChild: ((GtCoderNavigationTabsStencil new + pragmaName: #gtCoderDropdownNavigation; + navigationModel: aNavigationModel; + gtCreationInterface: aButton) background: Color white); + addAptitude: (BrGlamorousPopoverPinnableAptitude new + withResizers; + withAllPinActions; + menuModel: anExplicitMenu) ] ] { #category : #'*GToolkit-Coder-UI' } diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index cd46ca0b8..3b60595cd 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -154,7 +154,7 @@ GtCoderNavigationTabsStencil >> gtClassHierarchyFor: aView [ ] { #category : #'gt-extensions' } -GtCoderNavigationTabsStencil >> gtCreationInterface: look [ +GtCoderNavigationTabsStencil >> gtCreationInterface: anElement [ | contentTabs tabClasses | contentTabs := BrTabGroup new. contentTabs aptitude: BrGlamorousTabGroupAptitude new. @@ -168,35 +168,34 @@ GtCoderNavigationTabsStencil >> gtCreationInterface: look [ and: [ aClass isAdditionForm ] ]) asSortedCollection: [ :a :b | a priority < b priority ]. tabClasses - do: [ :each | + do: [ :eachTabClass | contentTabs addTab: (BrTab new aptitude: BrGlamorousTabAptitude new; - label: each componentName; + label: eachTabClass componentName; stencil: [ (self formCache - at: each + at: eachTabClass ifAbsentPut: [ | form | - form := each new - onReset: [ look - inUIProcessDo: [ look fireEvent: BrDropdownHideWish new. - self formCache removeKey: each ] ]. - form class == GtClassCreationForm - ifTrue: [ navigationModel - selectedClassDo: [ :aClass | aClass isClass ifTrue: [ form superclassName: aClass name ] ] ]. + form := eachTabClass new + onReset: [ anElement + inUIProcessDo: [ anElement fireEvent: BrDropdownHideWish new. + self formCache removeKey: eachTabClass ] ]. + navigationModel + selectedClassDo: [ :aClass | form fillFormWithClass: aClass ]. form hasPackageAndTag ifTrue: [ navigationModel selectedPackageDo: [ :aPackage | form packageAndTagName packageName: aPackage name ]. navigationModel selectedTagDo: [ :aTag | - (aTag isPharoPackageTagModel) + aTag isPharoPackageTagModel ifTrue: [ aTag isRoot ifFalse: [ form packageAndTagName tagName: aTag name ] ] ifFalse: [ aTag isUncategorized ifFalse: [ form packageAndTagName tagName: aTag name ] ] ] ]. ((GtCreationFormWidget forForm: form) onAccept: [ :anInstance | - look + anElement inUIProcessDo: [ form selectInNavigationModel: navigationModel anInstance: anInstance. - look fireEvent: BrDropdownHideWish new ]. - self formCache removeKey: each ifAbsent: [ ] ]) asElement ]) + anElement fireEvent: BrDropdownHideWish new ]. + self formCache removeKey: eachTabClass ifAbsent: [ ] ]) asElement ]) removeFromParent ]) ]. ^ contentTabs ] diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index 58e1061f2..b666e2009 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -64,6 +64,11 @@ GtCreationForm >> commitPackage [ ifNotEmpty: [ :aTagName | aPackage addClassTag: aTagName ] ] ] +{ #category : #'api - initialization' } +GtCreationForm >> fillFormWithClass: aClass [ + +] + { #category : #accessing } GtCreationForm >> ghostTextFor: aString [ ^ BrGhostTextAttribute diff --git a/src/GToolkit-Coder-UI/GtPhlowElementContext.extension.st b/src/GToolkit-Coder-UI/GtPhlowElementContext.extension.st index 7fba5abb4..2e4fdfe6a 100644 --- a/src/GToolkit-Coder-UI/GtPhlowElementContext.extension.st +++ b/src/GToolkit-Coder-UI/GtPhlowElementContext.extension.st @@ -19,16 +19,10 @@ GtPhlowElementContext >> coderNavigationModel [ { #category : #'*GToolkit-Coder-UI' } GtPhlowElementContext >> firstParentCoder [ - | anElement | - anElement := self firstParentWithViewContent. - self - assert: [ anElement isNotNil ] - description: [ 'Coder (element) must be non-nil' ]. - self - assert: [ anElement isKindOf: GtCoderElement ] - description: [ 'Coder (element) must be a kind of ' , GtCoderElement name ]. - - ^ anElement + ^ self element + allParentsDetect: [ :parent | parent isKindOf: GtCoderElement ] + ifFound: [ :parent | parent ] + ifNone: [ self error: 'Couldn''t find a coder parent' ] ] { #category : #'*GToolkit-Coder-UI' } From 92d10e1d76e5507e677e21ccd4b5398eefd31c93 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Sat, 27 Sep 2025 13:21:53 -0300 Subject: [PATCH 1077/1268] enable phlow-based class context menu [feenkcom/gtoolkit#4725] --- src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index 2422b5324..b4f29cfb7 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -32,7 +32,7 @@ GtCoderClassesTreeElement class >> fromClasses: aCollectionOfClasses [ { #category : #settings } GtCoderClassesTreeElement class >> isUsePhlowAction [ - ^ UsePhlowActions ifNil: [ false ] + ^ UsePhlowActions ifNil: [ true ] ] { #category : #settings } From 2b5e227583f6387c8a4b29453724789fb6783c2c Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Sat, 27 Sep 2025 19:32:35 +0200 Subject: [PATCH 1078/1268] replace bitmap icons with vector icons feenkcom/gtoolkit#4737 --- src/GToolkit-Coder-UI/Behavior.extension.st | 4 ++-- src/GToolkit-Coder-UI/GtPreviewChangeButton.class.st | 2 +- src/GToolkit-Coder/GtPackagesCoder.class.st | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/Behavior.extension.st b/src/GToolkit-Coder-UI/Behavior.extension.st index 79bf3bdd7..4b7f20719 100644 --- a/src/GToolkit-Coder-UI/Behavior.extension.st +++ b/src/GToolkit-Coder-UI/Behavior.extension.st @@ -23,7 +23,7 @@ Behavior >> gtDisplayTopSidebarIndexToggleFor: anAction [ ^ anAction toggle tooltip: 'Show Package and Class Hierarchies'; - icon: BrGlamorousIcons tree; + icon: BrGlamorousVectorIcons tree; id: GtCoderClassHierarchyButtonId; priority: 3; isActivated: [ :aToggle :aTargetElement | @@ -50,7 +50,7 @@ Behavior >> gtHierarchyButtonFor: anAction [ "" ^ anAction dropdown tooltip: 'Show Package and Class Hierarchies'; - icon: BrGlamorousIcons tree; + icon: BrGlamorousVectorIcons tree; id: GtCoderClassHierarchyButtonId; priority: 3; preferredExtentFrom: GtPharoCoderHierarchyDropdownConfiguration; diff --git a/src/GToolkit-Coder-UI/GtPreviewChangeButton.class.st b/src/GToolkit-Coder-UI/GtPreviewChangeButton.class.st index 6327f45d2..8b8ed673f 100644 --- a/src/GToolkit-Coder-UI/GtPreviewChangeButton.class.st +++ b/src/GToolkit-Coder-UI/GtPreviewChangeButton.class.st @@ -67,7 +67,7 @@ GtPreviewChangeButton >> initialize [ (BrGlamorousWithExplicitDropdownAptitude handle: [ BrButton new - icon: BrGlamorousIcons empty; + icon: BrGlamorousVectorIcons empty; beTinySize; aptitude: BrGlamorousButtonRectangularAptitude new + BrGlamorousButtonIconAptitude new ] content: [ self buildDropDownElement ]) diff --git a/src/GToolkit-Coder/GtPackagesCoder.class.st b/src/GToolkit-Coder/GtPackagesCoder.class.st index 92e692a26..e199baba0 100644 --- a/src/GToolkit-Coder/GtPackagesCoder.class.st +++ b/src/GToolkit-Coder/GtPackagesCoder.class.st @@ -35,7 +35,7 @@ GtPackagesCoder >> hash [ { #category : #accessing } GtPackagesCoder >> icon [ - ^ BrGlamorousIcons packageicon asElement + ^ BrGlamorousVectorIcons packageicon asElement ] { #category : #accessing } From 433eebc7d79676df42c3527716d2178ba6416085 Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Sun, 28 Sep 2025 20:56:54 +0200 Subject: [PATCH 1079/1268] rename text to editing group configuration feenkcom/gtoolkit#4725 --- src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st index af89b8ab1..5f899d869 100644 --- a/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st +++ b/src/GToolkit-Coder-AddOns/GtTextualCoder.extension.st @@ -60,17 +60,17 @@ GtTextualCoder >> addCopyCutPasteContextMenuAddOnsAst: anAst to: coderAddOns [ (self addContextMenuItemFrom: BrEditorShortcut cut - group: BrMenuItemGroupConfiguration text + group: BrMenuItemGroupConfiguration editing withId: GtTextualCoderCutContextMenuItemId to: coderAddOns) ifNotNil: [ :anAction | anAction priority: 1000.01 ]. (self addContextMenuItemFrom: BrEditorShortcut copy - group: BrMenuItemGroupConfiguration text + group: BrMenuItemGroupConfiguration editing withId: GtTextualCoderCopyContextMenuItemId to: coderAddOns) ifNotNil: [ :anAction | anAction priority: 1000.02 ]. (self addContextMenuItemFrom: BrEditorShortcut paste - group: BrMenuItemGroupConfiguration text + group: BrMenuItemGroupConfiguration editing withId: GtTextualCoderPasteContextMenuItemId to: coderAddOns) ifNotNil: [ :anAction | anAction priority: 1000.03 ] ] From 87e4c38c2c4ed574053ea4e4a4f924ff63ca0714 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 29 Sep 2025 08:03:44 -0300 Subject: [PATCH 1080/1268] remove old class context menu code [feenkcom/gtoolkit#4725] --- src/GToolkit-Coder-UI/Class.extension.st | 98 +------------------ .../GtCoderClassesTreeElement.class.st | 56 ++--------- 2 files changed, 8 insertions(+), 146 deletions(-) diff --git a/src/GToolkit-Coder-UI/Class.extension.st b/src/GToolkit-Coder-UI/Class.extension.st index 8fc84faf7..b73b93878 100644 --- a/src/GToolkit-Coder-UI/Class.extension.st +++ b/src/GToolkit-Coder-UI/Class.extension.st @@ -18,26 +18,6 @@ Class >> gtCoderSidebarIndexBrowseClassFor: anAction [ action: [ :aButton | aButton phlow spawnObject: self instanceSide ] ] -{ #category : #'*GToolkit-Coder-UI' } -Class >> gtCoderSidebarIndexBrowseClassFrom: aGtCoderClassesTreeElement [ - - ^ BrMenuActionItem new - icon: BrGlamorousVectorIcons browse - label: 'Browse class' - preview: self name; - action: [ aGtCoderClassesTreeElement phlow spawnObject: self ] -] - -{ #category : #'*GToolkit-Coder-UI' } -Class >> gtCoderSidebarIndexBrowseClasses: someClasses referencesFrom: aGtCoderClassesTreeElement [ - - ^ BrMenuActionItem new - icon: BrGlamorousVectorIcons empty - label: 'Browse references' - preview: ('{1} classes' format: { someClasses size }); - action: [ aGtCoderClassesTreeElement browseSeveralReferencesTo: someClasses ] -] - { #category : #'*GToolkit-Coder-UI' } Class >> gtCoderSidebarIndexBrowseClassesReferencesFor: anAction context: aPhlowContext [ @@ -73,16 +53,6 @@ Class >> gtCoderSidebarIndexBrowseReferencesFor: anAction [ action: [ :aButton | aButton phlow spawnObject: self instanceSide gtReferences ] ] -{ #category : #'*GToolkit-Coder-UI' } -Class >> gtCoderSidebarIndexBrowseReferencesFrom: aGtCoderClassesTreeElement [ - - ^ BrMenuActionItem new - icon: BrGlamorousVectorIcons empty - label: 'Browse references' - preview: self name; - action: [ aGtCoderClassesTreeElement browseReferencesTo: self ] -] - { #category : #'*GToolkit-Coder-UI' } Class >> gtCoderSidebarIndexCopyClassNameFor: anAction [ @@ -96,30 +66,6 @@ Class >> gtCoderSidebarIndexCopyClassNameFor: anAction [ action: [ Clipboard clipboardText: self name ] ] -{ #category : #'*GToolkit-Coder-UI' } -Class >> gtCoderSidebarIndexCopyClassNameFrom: aGtCoderClassesTreeElement [ - - ^ BrMenuActionItem new - icon: BrGlamorousVectorIcons clipboard - label: 'Copy class name' - preview: self name; - action: [ Clipboard clipboardText: self name ] -] - -{ #category : #'*GToolkit-Coder-UI' } -Class >> gtCoderSidebarIndexExtractSuperclassFrom: aGtCoderClassesTreeElement [ - - ^ BrMenuSubmenuItem new - icon: BrGlamorousVectorIcons empty - label: 'Extract superclass' - preview: self name; - submenu: (aGtCoderClassesTreeElement - convertToSiblingSubmenuFor: self - siblings: #() - title: 'Extract superclass'); - bePinSubmenuAction -] - { #category : #'*GToolkit-Coder-UI' } Class >> gtCoderSidebarIndexLlmChatFor: anAction [ @@ -167,16 +113,6 @@ Class >> gtCoderSidebarIndexNewSubclassFor: anAction [ menuModel: anExplicitMenu) ] ] -{ #category : #'*GToolkit-Coder-UI' } -Class >> gtCoderSidebarIndexNewSubclassFrom: aGtCoderClassesTreeElement [ - - ^ BrMenuActionItem new - icon: BrGlamorousVectorIcons add - label: 'New subclass' - preview: self name; - action: [ aGtCoderClassesTreeElement newSubclassOf: self ] -] - { #category : #'*GToolkit-Coder-UI' } Class >> gtCoderSidebarIndexRemoveClassFor: anAction [ @@ -184,7 +120,7 @@ Class >> gtCoderSidebarIndexRemoveClassFor: anAction [ priority: 5; target: GtCoderClassTarget; id: #'coder--context-menu-remove-class'; - icon: BrGlamorousVectorIcons remove; + icon: BrGlamorousVectorIcons bin; label: ('Remove {1}' format: {self gtCoderTypeName}); menuItemPreview: self name; menuItemGroup: BrMenuItemGroupConfiguration removal; @@ -196,27 +132,6 @@ Class >> gtCoderSidebarIndexRemoveClassFor: anAction [ asElement ] ] -{ #category : #'*GToolkit-Coder-UI' } -Class >> gtCoderSidebarIndexRemoveClassFrom: aGtCoderClassesTreeElement [ - - ^ BrMenuSubmenuItem new - id: #'coder--context-menu-remove-class'; - icon: BrGlamorousVectorIcons remove - label: 'Remove class' - preview: self name; - submenu: (aGtCoderClassesTreeElement removeClassSubmenuFor: self) -] - -{ #category : #'*GToolkit-Coder-UI' } -Class >> gtCoderSidebarIndexRemoveClasses: someClasses from: aGtCoderClassesTreeElement [ - - ^ BrMenuSubmenuItem new - icon: BrGlamorousVectorIcons remove - label: 'Remove classes' - preview: ('{1} classes' format: { someClasses size }); - submenu: (aGtCoderClassesTreeElement removeSeveralClassesSubmenuFor: someClasses) -] - { #category : #'*GToolkit-Coder-UI' } Class >> gtCoderSidebarIndexRemoveClassesFor: anAction context: aPhlowContext [ @@ -268,17 +183,6 @@ Class >> gtCoderSidebarIndexRenameClassFor: anAction [ bePinnable: anExplicitMenu ] ] -{ #category : #'*GToolkit-Coder-UI' } -Class >> gtCoderSidebarIndexRenameClassFrom: aGtCoderClassesTreeElement [ - - ^ BrMenuSubmenuItem new - icon: BrGlamorousVectorIcons empty - label: 'Rename class' - preview: self name; - submenu: (aGtCoderClassesTreeElement renameClassSubmenuFor: self); - bePinSubmenuAction -] - { #category : #'*GToolkit-Coder-UI' } Class >> gtCoderTypeName [ ^ 'class' diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index b4f29cfb7..2afe2c404 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -14,32 +14,14 @@ Class { #instVars : [ 'classesTree' ], - #classVars : [ - 'UsePhlowActions' - ], #category : #'GToolkit-Coder-UI-Navigation - Helpers' } -{ #category : #settings } -GtCoderClassesTreeElement class >> dontUsePhlowActions [ - UsePhlowActions := false -] - { #category : #'instance creation' } GtCoderClassesTreeElement class >> fromClasses: aCollectionOfClasses [ ^ self new initializeWithClasses: aCollectionOfClasses ] -{ #category : #settings } -GtCoderClassesTreeElement class >> isUsePhlowAction [ - ^ UsePhlowActions ifNil: [ true ] -] - -{ #category : #settings } -GtCoderClassesTreeElement class >> usePhlowActions [ - UsePhlowActions := true -] - { #category : #'private - context menu' } GtCoderClassesTreeElement >> addPreviewButtonFor: refactoring to: elem cancelSelector: cancelSelector [ | button | @@ -123,37 +105,18 @@ GtCoderClassesTreeElement >> contextMenuFor: aClass [ { #category : #initialization } GtCoderClassesTreeElement >> contextMenuForOneItem: aClass [ - ^ self isContextMenuFromPhlowActions - ifTrue: [ GtCoderClassTarget menuItemsForObject: aClass hostElement: self ] - ifFalse: [ BrMenuItemsPragmaBuilder new - object: aClass; - upToSuperclass: Behavior; - pragma: #gtCoderSidebarIndexOneSubjectContextMenuItem:; - methodArguments: {self}; - sortByFirstPragmaArgument; - build ] + ^ GtCoderClassTarget menuItemsForObject: aClass hostElement: self ] { #category : #initialization } GtCoderClassesTreeElement >> contextMenuForSeveralItems: someClasses [ - ^ self isContextMenuFromPhlowActions - ifTrue: [ - | aPhlowContext | - aPhlowContext := GtPhlowContext new coderSelectedClasses: someClasses. - GtCoderClassesTarget - menuItemsForObject: someClasses anyOne - inContext: aPhlowContext - hostElement: self ] - ifFalse: [ - BrMenuItemsPragmaBuilder new - object: Class; - upToSuperclass: Behavior; - pragma: #gtCoderSidebarIndexSeveralSubjectsContextMenuItem:; - methodArguments: {someClasses. - self}; - sortByFirstPragmaArgument; - build ] + | aPhlowContext | + aPhlowContext := GtPhlowContext new coderSelectedClasses: someClasses. + ^ GtCoderClassesTarget + menuItemsForObject: someClasses anyOne + inContext: aPhlowContext + hostElement: self ] { #category : #'private - drag and drop' } @@ -291,11 +254,6 @@ GtCoderClassesTreeElement >> initializeWithHierachyForClass: aClass [ ^ self ] ] ] -{ #category : #testing } -GtCoderClassesTreeElement >> isContextMenuFromPhlowActions [ - ^ self class isUsePhlowAction -] - { #category : #'private - context menu' } GtCoderClassesTreeElement >> newSubclassOf: aClass [ | dropdown tabGroup | From 18932ce3eeeae5ee47e08b5877234d9a8b7c06d6 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 29 Sep 2025 08:04:23 -0300 Subject: [PATCH 1081/1268] use bin icon to remove classes [feenkcom/gtoolkit#4741] --- src/GToolkit-Coder-UI/GtCoderRemoveClassPreviewStencil.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderRemoveClassPreviewStencil.class.st b/src/GToolkit-Coder-UI/GtCoderRemoveClassPreviewStencil.class.st index 2a066ade8..daebf7291 100644 --- a/src/GToolkit-Coder-UI/GtCoderRemoveClassPreviewStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderRemoveClassPreviewStencil.class.st @@ -39,7 +39,7 @@ GtCoderRemoveClassPreviewStencil >> create [ bottom: 10 left: 10 right: 10); - icon: BrGlamorousVectorIcons remove; + icon: BrGlamorousVectorIcons bin; label: 'Remove'; action: [ self menuModel ifNotNil: #hideAll. change execute ]. From 4de19a5639558020c63e3b58c30ea6e28c04184c Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 29 Sep 2025 08:48:08 -0300 Subject: [PATCH 1082/1268] remove class toolbar actions (since they are available in the class context menu) [feenkcom/gtoolkit#4743] --- src/GToolkit-Coder-UI/Behavior.extension.st | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/GToolkit-Coder-UI/Behavior.extension.st b/src/GToolkit-Coder-UI/Behavior.extension.st index 4b7f20719..5eeb9e023 100644 --- a/src/GToolkit-Coder-UI/Behavior.extension.st +++ b/src/GToolkit-Coder-UI/Behavior.extension.st @@ -1,21 +1,5 @@ Extension { #name : #Behavior } -{ #category : #'*GToolkit-Coder-UI' } -Behavior >> gtBrowseButtonFor: anAction [ - - ^ anAction button - priority: 1; - tooltip: 'Browse class'; - icon: BrGlamorousVectorIcons emphasizedBrowse; - action: [ :aButton | - aButton phlow firstParentCoderNavigationModel - coderDo: [ :oldCoder | - aButton phlow - spawnTool: (GtReadyCoderTool coder: oldCoder asNewCoderModelWithSameSubject) ] ]; - primaryModifierAction: [ :aButton | self gtBrowseFromButton: aButton ] - mouseCursor: BlCopyCursor new -] - { #category : #'*GToolkit-Coder-UI' } Behavior >> gtDisplayTopSidebarIndexToggleFor: anAction [ "Previous dropdown solution: Behavior>>#gtHierarchyButtonFor:" From cbbb8da90ca4983bcb3042bb8c07968caf74d020 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 29 Sep 2025 10:07:45 -0300 Subject: [PATCH 1083/1268] add behavior definition context menu item [feenkcom/gtoolkit#4725] --- src/GToolkit-Coder-UI/Class.extension.st | 41 ++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/Class.extension.st b/src/GToolkit-Coder-UI/Class.extension.st index b73b93878..1f433e053 100644 --- a/src/GToolkit-Coder-UI/Class.extension.st +++ b/src/GToolkit-Coder-UI/Class.extension.st @@ -5,6 +5,40 @@ Class >> asFilterModelItem [ ^ GtFilterModelClassItem new itemClass: self ] +{ #category : #'*GToolkit-Coder-UI' } +Class >> gtCoderSidebarIndexBehaviorDefinitionFor: anAction [ + + ^ anAction dropdown + priority: 3; + target: GtCoderClassTarget; + icon: BrGlamorousVectorIcons edit; + label: ('{1} definition' format: {self gtCoderTypeName asCamelCase}); + menuItemPreview: self name; + menuItemGroup: BrMenuItemGroupConfiguration modification; + menuItemPinSubmenu; + content: [ :aButton :aTargetElement :anExplicitMenu | + | aForm aFormElement | + aForm := self isTrait + ifTrue: [ GtTraitUpdateForm onTrait: self ] + ifFalse: [ GtClassUpdateForm onClass: self ]. + aFormElement := aForm asElement. + BrFrame new + addChild: aFormElement; + padding: (BlInsets all: GtRefactoringsConstants contextMenuPadding); + hExact: 400; + vFitContentLimited; + background: aButton theme default contentBackground; + addAptitude: (BrLayoutResizerAptitude new + exactToMatchParent: aFormElement; + matchParentToMatchParent: aFormElement; + fitContentToFitContent: aFormElement; + fitContentLimitedToFitContentLimited: aFormElement); + addAptitude: (BrGlamorousPopoverPinnableAptitude new + withLeftAndRightResizers; + withAllPinActions; + menuModel: anExplicitMenu) ] +] + { #category : #'*GToolkit-Coder-UI' } Class >> gtCoderSidebarIndexBrowseClassFor: anAction [ @@ -103,12 +137,13 @@ Class >> gtCoderSidebarIndexNewSubclassFor: anAction [ aNavigationModel := aButton phlow firstParentCoderNavigationModel. BrVerticalPane new exact: 400 @ 300; - addChild: ((GtCoderNavigationTabsStencil new + addChild: (GtCoderNavigationTabsStencil new pragmaName: #gtCoderDropdownNavigation; navigationModel: aNavigationModel; - gtCreationInterface: aButton) background: Color white); + gtCreationInterface: aButton); + background: aButton theme default contentBackground; addAptitude: (BrGlamorousPopoverPinnableAptitude new - withResizers; + withLeftAndRightResizers; withAllPinActions; menuModel: anExplicitMenu) ] ] From d865f3bc11c48a36507c78367083d03ed4afc4fa Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 29 Sep 2025 10:27:35 -0300 Subject: [PATCH 1084/1268] fix new subclass context menu item [feenkcom/gtoolkit#4725] --- src/GToolkit-Coder-UI/Class.extension.st | 21 ++++++++++---- .../GtPhlowElementContext.extension.st | 28 +++++++++++++++++-- 2 files changed, 41 insertions(+), 8 deletions(-) diff --git a/src/GToolkit-Coder-UI/Class.extension.st b/src/GToolkit-Coder-UI/Class.extension.st index 1f433e053..9690395dc 100644 --- a/src/GToolkit-Coder-UI/Class.extension.st +++ b/src/GToolkit-Coder-UI/Class.extension.st @@ -133,14 +133,23 @@ Class >> gtCoderSidebarIndexNewSubclassFor: anAction [ menuItemGroup: BrMenuItemGroupConfiguration modification; menuItemPinSubmenu; content: [ :aButton :aTargetElement :anExplicitMenu | - | aNavigationModel | - aNavigationModel := aButton phlow firstParentCoderNavigationModel. + | aChild | + aChild := aButton phlow + firstParentCoderNavigationModelIfPresent: [ :aNavigationModel | + GtCoderNavigationTabsStencil new + pragmaName: #gtCoderDropdownNavigation; + navigationModel: aNavigationModel; + gtCreationInterface: aButton ] + ifAbsent: [ BrLabel new + aptitude: BrGlamorousLabelAptitude new; + text: 'Currently not available from lepiter'; + constraintsDo: [ :c | + c linear horizontal alignCenter. + c linear vertical alignCenter ] ]. + BrVerticalPane new exact: 400 @ 300; - addChild: (GtCoderNavigationTabsStencil new - pragmaName: #gtCoderDropdownNavigation; - navigationModel: aNavigationModel; - gtCreationInterface: aButton); + addChild: aChild; background: aButton theme default contentBackground; addAptitude: (BrGlamorousPopoverPinnableAptitude new withLeftAndRightResizers; diff --git a/src/GToolkit-Coder-UI/GtPhlowElementContext.extension.st b/src/GToolkit-Coder-UI/GtPhlowElementContext.extension.st index 2e4fdfe6a..bb6ef0e5a 100644 --- a/src/GToolkit-Coder-UI/GtPhlowElementContext.extension.st +++ b/src/GToolkit-Coder-UI/GtPhlowElementContext.extension.st @@ -18,11 +18,19 @@ GtPhlowElementContext >> coderNavigationModel [ { #category : #'*GToolkit-Coder-UI' } GtPhlowElementContext >> firstParentCoder [ + + ^ self + firstParentCoderIfPresent: [ :parent | parent ] + ifAbsent: [ self error: 'Couldn''t find a coder parent' ] +] + +{ #category : #'*GToolkit-Coder-UI' } +GtPhlowElementContext >> firstParentCoderIfPresent: aPresentBlock ifAbsent: anAbsentBlock [ ^ self element allParentsDetect: [ :parent | parent isKindOf: GtCoderElement ] - ifFound: [ :parent | parent ] - ifNone: [ self error: 'Couldn''t find a coder parent' ] + ifFound: aPresentBlock + ifNone: anAbsentBlock ] { #category : #'*GToolkit-Coder-UI' } @@ -38,3 +46,19 @@ GtPhlowElementContext >> firstParentCoderNavigationModel [ ^ aNavigationModel ] + +{ #category : #'*GToolkit-Coder-UI' } +GtPhlowElementContext >> firstParentCoderNavigationModelIfPresent: aPresentBlock ifAbsent: anAbsentBlock [ + + ^ self + firstParentCoderIfPresent: [ :aCoder | + | aNavigationModel | + aNavigationModel := aCoder navigationModel. + + self + assert: [ aNavigationModel isNotNil ] + description: [ 'Coder navigation model must be non-nil' ]. + + ^ aNavigationModel ] + ifAbsent: anAbsentBlock +] From 4002cf377d009fecb51ab4fa220a8eb3ac3c8ae1 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 29 Sep 2025 10:39:48 -0300 Subject: [PATCH 1085/1268] remove `Remove class` button (since it is available in the class context menu) [feenkcom/gtoolkit#4743] --- .../GtBehaviorCoderBehaviorDeleteButtonId.class.st | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorDeleteButtonId.class.st diff --git a/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorDeleteButtonId.class.st b/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorDeleteButtonId.class.st deleted file mode 100644 index 06d982ee9..000000000 --- a/src/GToolkit-Coder-UI/GtBehaviorCoderBehaviorDeleteButtonId.class.st +++ /dev/null @@ -1,10 +0,0 @@ -Class { - #name : #GtBehaviorCoderBehaviorDeleteButtonId, - #superclass : #GtCoderElementId, - #category : #'GToolkit-Coder-UI-Coder - Ids' -} - -{ #category : #converting } -GtBehaviorCoderBehaviorDeleteButtonId >> asSymbol [ - ^ #'behavior-coder--behavior-delete-button' -] From 61de87e8f109c27ba96824ccf08f29e036489af6 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 29 Sep 2025 15:48:15 -0300 Subject: [PATCH 1086/1268] browse class can be used with primery key to open in a new world tab [feenkcom/gtoolkit#4725] Fix `GtPhlowElementContext>>#firstParentCoderNavigationModelIfPresent:ifAbsent:` --- src/GToolkit-Coder-UI/Class.extension.st | 3 ++- src/GToolkit-Coder-UI/GtPhlowElementContext.extension.st | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/Class.extension.st b/src/GToolkit-Coder-UI/Class.extension.st index 9690395dc..4175cbe05 100644 --- a/src/GToolkit-Coder-UI/Class.extension.st +++ b/src/GToolkit-Coder-UI/Class.extension.st @@ -49,7 +49,8 @@ Class >> gtCoderSidebarIndexBrowseClassFor: anAction [ label: ('Browse {1}' format: {self gtCoderTypeName}); menuItemPreview: self name; menuItemGroup: BrMenuItemGroupConfiguration navigation; - action: [ :aButton | aButton phlow spawnObject: self instanceSide ] + action: [ :aButton | aButton phlow spawnObject: self instanceSide ]; + primaryModifierAction: [ :aButton | self gtBrowseFrom: aButton ] ] { #category : #'*GToolkit-Coder-UI' } diff --git a/src/GToolkit-Coder-UI/GtPhlowElementContext.extension.st b/src/GToolkit-Coder-UI/GtPhlowElementContext.extension.st index bb6ef0e5a..a3a6b98e2 100644 --- a/src/GToolkit-Coder-UI/GtPhlowElementContext.extension.st +++ b/src/GToolkit-Coder-UI/GtPhlowElementContext.extension.st @@ -59,6 +59,6 @@ GtPhlowElementContext >> firstParentCoderNavigationModelIfPresent: aPresentBlock assert: [ aNavigationModel isNotNil ] description: [ 'Coder navigation model must be non-nil' ]. - ^ aNavigationModel ] + aPresentBlock value: aNavigationModel ] ifAbsent: anAbsentBlock ] From 11a0c8f7eb54ec8a563ca739967c2da362a369f1 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 29 Sep 2025 19:39:29 -0300 Subject: [PATCH 1087/1268] add class coder toolbar dropdown with phlow class actions [feenkcom/gtoolkit#4743] --- src/GToolkit-Coder-UI/Behavior.extension.st | 12 ++++++++++++ .../GtCoderClassActionsDropdownButtonId.class.st | 10 ++++++++++ 2 files changed, 22 insertions(+) create mode 100644 src/GToolkit-Coder-UI/GtCoderClassActionsDropdownButtonId.class.st diff --git a/src/GToolkit-Coder-UI/Behavior.extension.st b/src/GToolkit-Coder-UI/Behavior.extension.st index 5eeb9e023..8fd0dad74 100644 --- a/src/GToolkit-Coder-UI/Behavior.extension.st +++ b/src/GToolkit-Coder-UI/Behavior.extension.st @@ -1,5 +1,17 @@ Extension { #name : #Behavior } +{ #category : #'*GToolkit-Coder-UI' } +Behavior >> gtClassActionsDropdownFor: anAction [ + + + ^ anAction dropdown + tooltip: 'Class actions'; + icon: BrGlamorousVectorIcons hamburger; + id: GtCoderClassActionsDropdownButtonId; + priority: 100; + menuItemsForObject: self fromTarget: GtCoderClassTarget +] + { #category : #'*GToolkit-Coder-UI' } Behavior >> gtDisplayTopSidebarIndexToggleFor: anAction [ "Previous dropdown solution: Behavior>>#gtHierarchyButtonFor:" diff --git a/src/GToolkit-Coder-UI/GtCoderClassActionsDropdownButtonId.class.st b/src/GToolkit-Coder-UI/GtCoderClassActionsDropdownButtonId.class.st new file mode 100644 index 000000000..a20a18e8a --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderClassActionsDropdownButtonId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtCoderClassActionsDropdownButtonId, + #superclass : #GtCoderElementId, + #category : #'GToolkit-Coder-UI-Coder - Ids' +} + +{ #category : #accessing } +GtCoderClassActionsDropdownButtonId >> asSymbol [ + ^ #'context-action--class-actions' +] From 86e00fa369621b68d9e44190ea387af82097c943 Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Tue, 30 Sep 2025 18:28:42 +0200 Subject: [PATCH 1088/1268] use Evaluate instead of Inspect feenkcom/gtoolkit#4742 --- .../GtSourceCoderDoItAndInspectAsynchronousShortcut.class.st | 2 +- .../GtSourceCoderDoItAndInspectSerializedShortcut.class.st | 2 +- .../GtSourceCoderDoItAsynchronousShortcut.class.st | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectAsynchronousShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectAsynchronousShortcut.class.st index 7f1280158..a77b4dfb7 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectAsynchronousShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectAsynchronousShortcut.class.st @@ -18,7 +18,7 @@ GtSourceCoderDoItAndInspectAsynchronousShortcut >> initialize [ { #category : #accessing } GtSourceCoderDoItAndInspectAsynchronousShortcut >> name [ - ^ 'Do it and inspect (asynchronous)' + ^ 'Evaluate and inspect (asynchronous)' ] { #category : #evaluation } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectSerializedShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectSerializedShortcut.class.st index 8f14348af..f18fb63c0 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectSerializedShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderDoItAndInspectSerializedShortcut.class.st @@ -18,7 +18,7 @@ GtSourceCoderDoItAndInspectSerializedShortcut >> initialize [ { #category : #accessing } GtSourceCoderDoItAndInspectSerializedShortcut >> name [ - ^ 'Do it and inspect serialized' + ^ 'Evaluate and inspect serialized' ] { #category : #evaluation } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderDoItAsynchronousShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderDoItAsynchronousShortcut.class.st index 91d2be6d6..55e0b5021 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderDoItAsynchronousShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderDoItAsynchronousShortcut.class.st @@ -18,7 +18,7 @@ GtSourceCoderDoItAsynchronousShortcut >> initialize [ { #category : #accessing } GtSourceCoderDoItAsynchronousShortcut >> name [ - ^ 'Do it (asynchronous)' + ^ 'Evaluate (asynchronous)' ] { #category : #evaluation } From 821b3b1fe003eab2b54dd5ddd1a90e348ee64162 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 30 Sep 2025 15:51:34 -0300 Subject: [PATCH 1089/1268] fix `GtCoderRemoveClassPreviewStencil>>#newReferencesContentElement` [feenkcom/gtoolkit#4725] --- src/GToolkit-Coder-UI/GtCoderRemoveClassPreviewStencil.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderRemoveClassPreviewStencil.class.st b/src/GToolkit-Coder-UI/GtCoderRemoveClassPreviewStencil.class.st index daebf7291..09d333dc2 100644 --- a/src/GToolkit-Coder-UI/GtCoderRemoveClassPreviewStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderRemoveClassPreviewStencil.class.st @@ -71,7 +71,7 @@ GtCoderRemoveClassPreviewStencil >> newReferencesContentElement [ globalVariableReferencesTo: self classToRemove binding) size. subclasses := self classToRemove allSubclasses size. users := self classToRemove isTrait - ifFalse: [ #() ] + ifFalse: [ 0 ] ifTrue: [ self classToRemove users size ]. pane := BrVerticalPane new. pane fitContent. From 753f6ccfa417c30e83ff4471b01c0e324b84405b Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 30 Sep 2025 10:03:02 -0500 Subject: [PATCH 1090/1268] [feenkcom/gtoolkit#3181,feenkcom/gtoolkit#2710,feenkcom/gtoolkit#2735,feenkcom/gtoolkit#3182,,feenkcom/gtoolkit#3183] adding undo/redo history to the coder model --- .../GtTextualCoderEditorElement.class.st | 11 +++++++++++ .../GtTextualCoderViewModel.class.st | 19 ++++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 96d25ccf4..412e35578 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -200,6 +200,10 @@ GtTextualCoderEditorElement >> initializeListeners [ anEvent isDueToRemoval ifFalse: [ self textualCoderViewModel focused: false from: self ] ]. + self editor + when: BrTextEditorHistoryChangedEvent + do: [ :anEvent | self textualCoderViewModel history: self editor history copy ]. + self editor when: BrTextEditorModifiedEvent do: [ :anEvent | self onTextModifiedDueToEvent: anEvent ]. @@ -690,6 +694,13 @@ GtTextualCoderEditorElement >> subscribeToTextualCoderViewModel [ completion install ] +{ #category : #'editor - accessing' } +GtTextualCoderEditorElement >> text: aBlText [ + (self text equalsIgnoringAttributes: aBlText) + ifTrue: [ ^ self dataSource history disableDuring: [ super text: aBlText ] ]. + ^ super text: aBlText +] + { #category : #'api - textual coder view model' } GtTextualCoderEditorElement >> unsubscribeFromTextualCoderViewModel [ "Is sent before a new textualCoder view model is assigned to the element. diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 501eb9951..cdc6e9e77 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -14,7 +14,8 @@ Class { 'isTextModifiedPromise', 'completionStrategy', 'debuggerInSpace', - 'nodeAttributeMap' + 'nodeAttributeMap', + 'history' ], #category : #'GToolkit-Coder-UI-Coder - Textual Model' } @@ -137,7 +138,8 @@ GtTextualCoderViewModel >> asEditorState [ aMemento := BrTextEditorCompositeMemento new addMemento: (BrTextEditorCursorsMemento new cursors: cursors copy); - addMemento: (BrTextEditorSelectionMemento new selection: selection copy). + addMemento: (BrTextEditorSelectionMemento new selection: selection copy); + addMemento: (BrTextEditorHistoryMemento new history: (history ifNil: [BrTextEditorHistory new]) copy). self hasStyledText ifTrue: [ @@ -406,6 +408,16 @@ GtTextualCoderViewModel >> hasStyledText [ ^ styledText notNil ] +{ #category : #accessing } +GtTextualCoderViewModel >> history [ + ^ history +] + +{ #category : #accessing } +GtTextualCoderViewModel >> history: anObject [ + history := anObject +] + { #category : #initialization } GtTextualCoderViewModel >> initialize [ super initialize. @@ -420,7 +432,8 @@ GtTextualCoderViewModel >> initialize [ cursors := BrTextEditorMultipleCursor new. selection := BlCompositeSelection new. extraTextAttributes := OrderedCollection new. - nodeAttributeMap := Dictionary new + nodeAttributeMap := Dictionary new. + history := BrTextEditorHistory new ] { #category : #'api - text' } From bcc08dff328f72087809413021e88a9b910a2e1b Mon Sep 17 00:00:00 2001 From: John Brant Date: Wed, 1 Oct 2025 14:49:56 -0500 Subject: [PATCH 1091/1268] [feenkcom/gtoolkit#3181,feenkcom/gtoolkit#2710,feenkcom/gtoolkit#2735,feenkcom/gtoolkit#3182,,feenkcom/gtoolkit#3183] check if coder view model is initialized --- src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 412e35578..b8219e72e 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -202,7 +202,9 @@ GtTextualCoderEditorElement >> initializeListeners [ self editor when: BrTextEditorHistoryChangedEvent - do: [ :anEvent | self textualCoderViewModel history: self editor history copy ]. + do: [ :anEvent | + textualCoderViewModel + ifNotNil: [ textualCoderViewModel history: self editor history copy ] ]. self editor when: BrTextEditorModifiedEvent From 8b99a74187346577a1a22dc9deac5ec0bac7650c Mon Sep 17 00:00:00 2001 From: John Brant Date: Fri, 3 Oct 2025 06:17:18 -0500 Subject: [PATCH 1092/1268] [feenkcom/gtoolkit#4754] changing pull up names to push up --- .../GtCoderMethodsGroupedListElement.class.st | 72 +++++++++---------- .../GtCoderSlotsGroupedListElement.class.st | 26 +++---- ...ullUpClassVariableRefactoring.extension.st | 2 +- ...UpInstanceVariableRefactoring.extension.st | 2 +- .../RBPullUpMethodRefactoring.extension.st | 2 +- 5 files changed, 52 insertions(+), 52 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index 39881eb1f..6b880be7d 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -121,8 +121,8 @@ GtCoderMethodsGroupedListElement >> contextMenuForOneItem: item in: anElement [ menu addItem: (BrMenuSubmenuItem new group: BrMenuItemGroupConfiguration refactoring; - label: (self createLabel: 'Pull up method' description: item selector); - submenu: (self pullUpMethodSubmenuFor: item); + label: (self createLabel: 'Push up method' description: item selector); + submenu: (self pushUpMethodSubmenuFor: item); bePinSubmenuAction). menu addItem: (BrMenuSubmenuItem new @@ -181,9 +181,9 @@ GtCoderMethodsGroupedListElement >> contextMenuForSeveralItems: someItems in: an addItem: (BrMenuSubmenuItem new group: BrMenuItemGroupConfiguration refactoring; label: (self - createLabel: 'Pull up methods' + createLabel: 'Push up methods' description: ('{1} methods' format: {someItems size})); - submenu: (self pullUpSeveralMethodsSubmenuFor: someItems); + submenu: (self pushUpSeveralMethodsSubmenuFor: someItems); bePinSubmenuAction). menu addItem: (BrMenuSubmenuItem new @@ -359,7 +359,7 @@ GtCoderMethodsGroupedListElement >> onMethodsToShowChanged: anAnnouncement [ ] { #category : #'private - context menu' } -GtCoderMethodsGroupedListElement >> pullUpMethodSubmenuFor: aMethod [ +GtCoderMethodsGroupedListElement >> pushDownMethodSubmenuFor: aMethod [ | submenu | submenu := BrMenuExplicit new. @@ -367,12 +367,14 @@ GtCoderMethodsGroupedListElement >> pullUpMethodSubmenuFor: aMethod [ stencil: [ :anExplicitMenu | | aViewModel | aViewModel := GtRefactoringsWithConfirmationViewModel new - refactoringTitle: 'Pull up'; + refactoringTitle: 'Push down'; targetName: ('{1}>>#{2}' format: { aMethod methodClass. aMethod selector }); - confirmationLabel: ('Pull up {1}' format: { aMethod selector }); - refactoringWithConfirmation: [ RBPullUpMethodRefactoring - pullUp: {aMethod selector} - from: aMethod methodClass ]; + confirmationLabel: ('Push down {1}' format: { aMethod selector }); + refactoringWithConfirmation: [ RBPushDownMethodRefactoring + pushDown: {aMethod selector} + from: (self + forPharo12AndNewer: [ aMethod methodClass name ] + forPharo11: [ aMethod methodClass ]) ]; afterAppliedBlock: [ anExplicitMenu hideAll ]; menuModel: anExplicitMenu; anchorElement: self. @@ -385,7 +387,7 @@ GtCoderMethodsGroupedListElement >> pullUpMethodSubmenuFor: aMethod [ ] { #category : #'private - context menu' } -GtCoderMethodsGroupedListElement >> pullUpSeveralMethodsSubmenuFor: aCollectionOfMethods [ +GtCoderMethodsGroupedListElement >> pushDownSeveralMethodsSubmenuFor: aCollectionOfMethods [ | submenu | submenu := BrMenuExplicit new. @@ -393,21 +395,23 @@ GtCoderMethodsGroupedListElement >> pullUpSeveralMethodsSubmenuFor: aCollectionO stencil: [ :anExplicitMenu | | aViewModel | aViewModel := GtRefactoringsWithConfirmationViewModel new - refactoringTitle: 'Pull up'; + refactoringTitle: 'Push down'; targetName: ('{1} methods' format: {aCollectionOfMethods size}); - confirmationLabel: ('Pull up {1} methods' format: {aCollectionOfMethods size}); + confirmationLabel: ('Push down {1} methods' format: {aCollectionOfMethods size}); refactoringsWithConfirmation: [ | aGroupByClass aModel aCollectionOfRefactorings | aGroupByClass := aCollectionOfMethods groupedBy: #methodClass. aModel := Smalltalk createRbNamespace - onEnvironment: RBPullUpMethodRefactoring new defaultEnvironment. + onEnvironment: RBPushDownMethodRefactoring new defaultEnvironment. aCollectionOfRefactorings := aGroupByClass collect: [ :someMethods | - RBPullUpMethodRefactoring new + RBPushDownMethodRefactoring new model: aModel; - pullUp: (someMethods collect: #selector) - from: someMethods anyOne methodClass ] + pushDown: (someMethods collect: #selector) + from: (self + forPharo12AndNewer: [ someMethods anyOne methodClass name ] + forPharo11: [ someMethods anyOne methodClass ]) ] as: Array. - aModel name: ('Pull up {1} methods' format: {aCollectionOfMethods size}). + aModel name: ('Push down {1} methods' format: {aCollectionOfMethods size}). aCollectionOfRefactorings ]; afterAppliedBlock: [ anExplicitMenu hideAll ]; menuModel: anExplicitMenu; @@ -421,7 +425,7 @@ GtCoderMethodsGroupedListElement >> pullUpSeveralMethodsSubmenuFor: aCollectionO ] { #category : #'private - context menu' } -GtCoderMethodsGroupedListElement >> pushDownMethodSubmenuFor: aMethod [ +GtCoderMethodsGroupedListElement >> pushUpMethodSubmenuFor: aMethod [ | submenu | submenu := BrMenuExplicit new. @@ -429,14 +433,12 @@ GtCoderMethodsGroupedListElement >> pushDownMethodSubmenuFor: aMethod [ stencil: [ :anExplicitMenu | | aViewModel | aViewModel := GtRefactoringsWithConfirmationViewModel new - refactoringTitle: 'Push down'; + refactoringTitle: 'Push up'; targetName: ('{1}>>#{2}' format: { aMethod methodClass. aMethod selector }); - confirmationLabel: ('Push down {1}' format: { aMethod selector }); - refactoringWithConfirmation: [ RBPushDownMethodRefactoring - pushDown: {aMethod selector} - from: (self - forPharo12AndNewer: [ aMethod methodClass name ] - forPharo11: [ aMethod methodClass ]) ]; + confirmationLabel: ('Push up {1}' format: { aMethod selector }); + refactoringWithConfirmation: [ RBPullUpMethodRefactoring + pullUp: {aMethod selector} + from: aMethod methodClass ]; afterAppliedBlock: [ anExplicitMenu hideAll ]; menuModel: anExplicitMenu; anchorElement: self. @@ -449,7 +451,7 @@ GtCoderMethodsGroupedListElement >> pushDownMethodSubmenuFor: aMethod [ ] { #category : #'private - context menu' } -GtCoderMethodsGroupedListElement >> pushDownSeveralMethodsSubmenuFor: aCollectionOfMethods [ +GtCoderMethodsGroupedListElement >> pushUpSeveralMethodsSubmenuFor: aCollectionOfMethods [ | submenu | submenu := BrMenuExplicit new. @@ -457,23 +459,21 @@ GtCoderMethodsGroupedListElement >> pushDownSeveralMethodsSubmenuFor: aCollectio stencil: [ :anExplicitMenu | | aViewModel | aViewModel := GtRefactoringsWithConfirmationViewModel new - refactoringTitle: 'Push down'; + refactoringTitle: 'Push up'; targetName: ('{1} methods' format: {aCollectionOfMethods size}); - confirmationLabel: ('Push down {1} methods' format: {aCollectionOfMethods size}); + confirmationLabel: ('Push up {1} methods' format: {aCollectionOfMethods size}); refactoringsWithConfirmation: [ | aGroupByClass aModel aCollectionOfRefactorings | aGroupByClass := aCollectionOfMethods groupedBy: #methodClass. aModel := Smalltalk createRbNamespace - onEnvironment: RBPushDownMethodRefactoring new defaultEnvironment. + onEnvironment: RBPullUpMethodRefactoring new defaultEnvironment. aCollectionOfRefactorings := aGroupByClass collect: [ :someMethods | - RBPushDownMethodRefactoring new + RBPullUpMethodRefactoring new model: aModel; - pushDown: (someMethods collect: #selector) - from: (self - forPharo12AndNewer: [ someMethods anyOne methodClass name ] - forPharo11: [ someMethods anyOne methodClass ]) ] + pullUp: (someMethods collect: #selector) + from: someMethods anyOne methodClass ] as: Array. - aModel name: ('Push down {1} methods' format: {aCollectionOfMethods size}). + aModel name: ('Push up {1} methods' format: {aCollectionOfMethods size}). aCollectionOfRefactorings ]; afterAppliedBlock: [ anExplicitMenu hideAll ]; menuModel: anExplicitMenu; diff --git a/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st index cd1e408a6..1a3396c65 100644 --- a/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st @@ -66,8 +66,8 @@ GtCoderSlotsGroupedListElement >> contextMenuFor: item [ menu addItem: (BrMenuSubmenuItem new group: BrMenuItemGroupConfiguration refactoring; - label: (self createLabel: 'Pull up' description: item name); - submenu: (self pullUpSubmenuFor: item name); + label: (self createLabel: 'Push up' description: item name); + submenu: (self pushUpSubmenuFor: item name); bePinSubmenuAction). menu addItem: (BrMenuSubmenuItem new @@ -252,19 +252,20 @@ GtCoderSlotsGroupedListElement >> protectSubmenuFor: aString [ ] { #category : #'private - context menu' } -GtCoderSlotsGroupedListElement >> pullUpSubmenuFor: aString [ +GtCoderSlotsGroupedListElement >> pushDownSubmenuFor: aString [ | submenu | submenu := BrMenuExplicit new. + submenu stencil: [ :anExplicitMenu | | aViewModel | aViewModel := GtRefactoringsWithConfirmationViewModel new - refactoringTitle: 'Pull up'; + refactoringTitle: 'Push down'; targetName: ('{1}''s {2} inst. variable' format: { self selectedClass name. aString }); - confirmationLabel: ('Pull up {1}' format: { aString }); - refactoringWithConfirmation: [ RBPullUpInstanceVariableRefactoring + confirmationLabel: ('Push down {1}' format: { aString }); + refactoringWithConfirmation: [ GtPushDownInstanceVariableRefactoring variable: aString - class: self selectedClass superclass ]; + class: self selectedClass ]; afterAppliedBlock: [ anExplicitMenu hideAll ]; menuModel: anExplicitMenu; anchorElement: self. @@ -277,20 +278,19 @@ GtCoderSlotsGroupedListElement >> pullUpSubmenuFor: aString [ ] { #category : #'private - context menu' } -GtCoderSlotsGroupedListElement >> pushDownSubmenuFor: aString [ +GtCoderSlotsGroupedListElement >> pushUpSubmenuFor: aString [ | submenu | submenu := BrMenuExplicit new. - submenu stencil: [ :anExplicitMenu | | aViewModel | aViewModel := GtRefactoringsWithConfirmationViewModel new - refactoringTitle: 'Push down'; + refactoringTitle: 'Push up'; targetName: ('{1}''s {2} inst. variable' format: { self selectedClass name. aString }); - confirmationLabel: ('Push down {1}' format: { aString }); - refactoringWithConfirmation: [ GtPushDownInstanceVariableRefactoring + confirmationLabel: ('Push up {1}' format: { aString }); + refactoringWithConfirmation: [ RBPullUpInstanceVariableRefactoring variable: aString - class: self selectedClass ]; + class: self selectedClass superclass ]; afterAppliedBlock: [ anExplicitMenu hideAll ]; menuModel: anExplicitMenu; anchorElement: self. diff --git a/src/GToolkit-Coder-UI/RBPullUpClassVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBPullUpClassVariableRefactoring.extension.st index 321074fd7..ef386c07f 100644 --- a/src/GToolkit-Coder-UI/RBPullUpClassVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBPullUpClassVariableRefactoring.extension.st @@ -2,5 +2,5 @@ Extension { #name : #RBPullUpClassVariableRefactoring } { #category : #'*GToolkit-Coder-UI' } RBPullUpClassVariableRefactoring >> gtDescription [ - ^ 'Pull up class variable ' , variableName + ^ 'Push up class variable ' , variableName ] diff --git a/src/GToolkit-Coder-UI/RBPullUpInstanceVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBPullUpInstanceVariableRefactoring.extension.st index 50b93b7b1..e365c9bf1 100644 --- a/src/GToolkit-Coder-UI/RBPullUpInstanceVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBPullUpInstanceVariableRefactoring.extension.st @@ -2,5 +2,5 @@ Extension { #name : #RBPullUpInstanceVariableRefactoring } { #category : #'*GToolkit-Coder-UI' } RBPullUpInstanceVariableRefactoring >> gtDescription [ - ^ 'Pull up instance variable ' , variableName + ^ 'Push up instance variable ' , variableName ] diff --git a/src/GToolkit-Coder-UI/RBPullUpMethodRefactoring.extension.st b/src/GToolkit-Coder-UI/RBPullUpMethodRefactoring.extension.st index 67dcae769..ca168c1fa 100644 --- a/src/GToolkit-Coder-UI/RBPullUpMethodRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBPullUpMethodRefactoring.extension.st @@ -2,5 +2,5 @@ Extension { #name : #RBPullUpMethodRefactoring } { #category : #'*GToolkit-Coder-UI' } RBPullUpMethodRefactoring >> gtDescription [ - ^ 'Pull up method ' , class name , '>>' , selectors anyOne + ^ 'Push up method ' , class name , '>>' , selectors anyOne ] From a46f5af94719dc41b576fdbf756eb983163d9f36 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 3 Oct 2025 09:01:43 -0300 Subject: [PATCH 1093/1268] code cleaning [feenkcom/gtoolkit#4750] - initialize textual coder editor styler - report addOns exceptions --- .../GtExpandedOnlyCoderElement.class.st | 2 +- .../GtTextualCoderEditorElement.class.st | 44 +++++++------------ 2 files changed, 17 insertions(+), 29 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st b/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st index 6706ba177..eb8bae13a 100644 --- a/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st @@ -23,7 +23,7 @@ GtExpandedOnlyCoderElement >> asVerticallyResizableDo: aBlock [ GtExpandedOnlyCoderElement >> coder: aCoderUIModel [ self - deprecated: 'Use #coderUIModel: instead.' + deprecated: 'Use #coderViewModel: instead.' transformWith: '`@receiver coder: `@arg' -> '`@receiver coderViewModel: `@arg'. ^ self coderViewModel: aCoderUIModel diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index b8219e72e..5aa1c5d0c 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -91,31 +91,6 @@ GtTextualCoderEditorElement >> createContextMenu [ ^ aMenu ] -{ #category : #'instance creation' } -GtTextualCoderEditorElement >> createContextMenuContent [ - "wait for the addons to be computed. - Deprected: Use #createContextMenu instead." - - | theContextMenu aContextMenuPromise | - theContextMenu := GtCoderContextMenuContent new editorElement: self. - - aContextMenuPromise := self textualCoderViewModel addOns - asyncThen: [ :theAddOns | - | theItems theContextMenuAstAddons | - "extra context menu items that depend on ast and view model state such as selection" - theContextMenuAstAddons := self textualCoderViewModel - computeContextMenuAstAddOns. - theItems := theAddOns contextMenuActions, theContextMenuAstAddons contextMenuActions. - theItems := theItems reject: [ :e | e title isNil ]. - - theContextMenu - enqueueTask: (BlTaskAction new action: [ theContextMenu items: theItems ]) ]. - - self enqueueTask: (BlPromiseTask new promise: aContextMenuPromise). - - ^ theContextMenu -] - { #category : #initialization } GtTextualCoderEditorElement >> defaultTextEditorMode [ ^ BrTextEditorEditableCodeMode new @@ -154,7 +129,6 @@ GtTextualCoderEditorElement >> initialize [ self aptitude: BrGlamorousCodeEditorAptitude; - "addAptitude: (BrGlamorousWithContextMenuAptitude content: [ self createContextMenuContent ]);" addAptitude: (BrGlamorousWithExplicitContextMenuAptitude menu: [ self createContextMenu ]); padding: BlInsets empty; hMatchParent; @@ -179,7 +153,9 @@ GtTextualCoderEditorElement >> initialize [ addOnsElementFuture := (BrAsyncElementFuture on: self) executionConfiguration: (GtSingleCoderViewModel methodAddOnsExecutionConfiguration); whenSuccess: [ :anEditorElement :theAddOns | - self textualCoderViewModel onAddOnsChanged: theAddOns ]. + self textualCoderViewModel onAddOnsChanged: theAddOns ]; + whenError: [ :anEditorElement :anError | + self onAddOnsError: anError ]. self initializeListeners. @@ -223,6 +199,15 @@ GtTextualCoderEditorElement >> initializeListeners [ do: [ :anEvent | self onTextStyled: anEvent ] ] +{ #category : #initialization } +GtTextualCoderEditorElement >> onAddOnsError: anError [ + anError emit. + NonInteractiveTranscript stderr + show: '[GtTextualCoderEditorElement>>#onAddOnsError:] '; + show: anError; + newLine +] + { #category : #'hooks - children' } GtTextualCoderEditorElement >> onAddedToSceneGraph [ super onAddedToSceneGraph. @@ -401,7 +386,10 @@ GtTextualCoderEditorElement >> onTextualCoderViewModelChanged [ shortcuts := self textualCoderViewModel shortcuts copy. self editor addEditorShortcuts: shortcuts. - completion strategy: self textualCoderViewModel completionStrategy + completion strategy: self textualCoderViewModel completionStrategy. + + self textualCoderViewModel compositeStyler ifNotNil: [ :aStyler | + self styler: aStyler ] ] { #category : #'private - event handling' } From bebf996e3932530e134f8292b310ffca495ac832 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 3 Oct 2025 10:35:38 -0300 Subject: [PATCH 1094/1268] clean future configurations [feenkcom/gtoolkit#4750] --- .../GtFilterSettingsElement.class.st | 7 +++++++ .../GtFilterShortListSettingsElement.class.st | 4 +--- .../GtFilterToggleSettingsElement.class.st | 4 +--- .../GtSingleCoderViewModel.class.st | 8 ++++++++ .../GtTextualCoderViewModel.class.st | 6 ++++-- src/GToolkit-Coder/GtTextualCoder.class.st | 12 ++++++++++-- 6 files changed, 31 insertions(+), 10 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterSettingsElement.class.st index 79ca3379c..4423faade 100644 --- a/src/GToolkit-Coder-UI/GtFilterSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterSettingsElement.class.st @@ -6,6 +6,13 @@ Class { #category : #'GToolkit-Coder-UI-Filters - Widgets' } +{ #category : #accessing } +GtFilterSettingsElement class >> futureExecutionConfiguration [ + ^ AsyncFutureExecutionConfiguration new + customGroup: #CoderFilter; + lowPriority +] + { #category : #initialization } GtFilterSettingsElement >> defaultLayout [ ^ BlLinearLayout horizontal diff --git a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st index 91114fe2b..cf869e02a 100644 --- a/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterShortListSettingsElement.class.st @@ -131,9 +131,7 @@ GtFilterShortListSettingsElement >> newContentElement [ model: nil ]; withAsyncFutureDo: [ :anElementFuture | anElementFuture - executionConfiguration: (AsyncFutureExecutionConfiguration new - customGroup: #CoderFilter; - lowPriority); + executionConfiguration: (self class futureExecutionConfiguration); whenPending: [ :theListElement | theListElement items: { GtFilterModelComputingItem default } ]; whenError: [ :theListElement :anError | diff --git a/src/GToolkit-Coder-UI/GtFilterToggleSettingsElement.class.st b/src/GToolkit-Coder-UI/GtFilterToggleSettingsElement.class.st index 5aeba72e0..de7081475 100644 --- a/src/GToolkit-Coder-UI/GtFilterToggleSettingsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterToggleSettingsElement.class.st @@ -37,9 +37,7 @@ GtFilterToggleSettingsElement >> initializeToggleGroupElement [ do: [ :anEvent | self onToggleActivatedEvent: anEvent ]; withAsyncFutureDo: [ :anElementFuture | anElementFuture - executionConfiguration: (AsyncFutureExecutionConfiguration new - customGroup: #CoderFilter; - lowPriority); + executionConfiguration: (self class futureExecutionConfiguration); whenPending: [ :theToggleGroup | self updateToggleElement: theToggleGroup diff --git a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st index 26bf982b7..fb34cae34 100644 --- a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st @@ -34,6 +34,14 @@ GtSingleCoderViewModel class >> behaviourAddOnsExecutionConfiguration [ lowPriority ] +{ #category : #accessing } +GtSingleCoderViewModel class >> commonExecutionConfiguration [ + ^ AsyncFutureExecutionConfiguration new + customGroup: #Coder; + maxAmountOfWorkers: 2; + defaultPriority +] + { #category : #accessing } GtSingleCoderViewModel class >> methodAddOnsExecutionConfiguration [ ^ AsyncFutureExecutionConfiguration new diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index cdc6e9e77..896811281 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -441,9 +441,11 @@ GtTextualCoderViewModel >> isTextModifiedPromise [ "Return a promise which is resolved to true if the text is modified, false otherwise. Should be used together with {{gtClass:GtTextualCoderViewModelTextChanged}} to update the modification status in the UI" + - - ^ isTextModifiedPromise ifNil: [ isTextModifiedPromise := self coderModel isModifiedPromise ] + ^ isTextModifiedPromise + ifNil: [ isTextModifiedPromise := self coderModel isModifiedFuture + await: self class commonExecutionConfiguration ] ] { #category : #'api - add-ons' } diff --git a/src/GToolkit-Coder/GtTextualCoder.class.st b/src/GToolkit-Coder/GtTextualCoder.class.st index 91f27ac7a..2f22fb1eb 100644 --- a/src/GToolkit-Coder/GtTextualCoder.class.st +++ b/src/GToolkit-Coder/GtTextualCoder.class.st @@ -257,11 +257,19 @@ GtTextualCoder >> isModified [ ^ self sourceCode isModified ] +{ #category : #testing } +GtTextualCoder >> isModifiedFuture [ + + + ^ [ self sourceCode isModified ] asAsyncFuture +] + { #category : #testing } GtTextualCoder >> isModifiedPromise [ - + "Deprecated: use `GtTextualCoderViewModel>>#isTextModifiedPromise` instead." - ^ [ self sourceCode isModified ] asAsyncPromise + + ^ self isModifiedFuture asAsyncPromise ] { #category : #'private - notifying' } From 3f97f27c6008173fc9ff310e7d0862b5abd4869a Mon Sep 17 00:00:00 2001 From: John Brant Date: Fri, 3 Oct 2025 11:18:14 -0500 Subject: [PATCH 1095/1268] [feenkcom/gtoolkit#4754] allow push up method to push up inst vars --- .../GtCoderMethodsGroupedListElement.class.st | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index 6b880be7d..84dbe74e6 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -436,7 +436,7 @@ GtCoderMethodsGroupedListElement >> pushUpMethodSubmenuFor: aMethod [ refactoringTitle: 'Push up'; targetName: ('{1}>>#{2}' format: { aMethod methodClass. aMethod selector }); confirmationLabel: ('Push up {1}' format: { aMethod selector }); - refactoringWithConfirmation: [ RBPullUpMethodRefactoring + refactoringWithConfirmation: [ GtPushUpMethodRefactoring pullUp: {aMethod selector} from: aMethod methodClass ]; afterAppliedBlock: [ anExplicitMenu hideAll ]; @@ -465,10 +465,10 @@ GtCoderMethodsGroupedListElement >> pushUpSeveralMethodsSubmenuFor: aCollectionO refactoringsWithConfirmation: [ | aGroupByClass aModel aCollectionOfRefactorings | aGroupByClass := aCollectionOfMethods groupedBy: #methodClass. aModel := Smalltalk createRbNamespace - onEnvironment: RBPullUpMethodRefactoring new defaultEnvironment. + onEnvironment: GtPushUpMethodRefactoring new defaultEnvironment. aCollectionOfRefactorings := aGroupByClass collect: [ :someMethods | - RBPullUpMethodRefactoring new + GtPushUpMethodRefactoring new model: aModel; pullUp: (someMethods collect: #selector) from: someMethods anyOne methodClass ] From 64c14498186701db46183d686dc31b6ce1665f91 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 3 Oct 2025 17:07:43 -0300 Subject: [PATCH 1096/1268] add `GtSourceCoderExpandedOnlyElement` [feenkcom/gtoolkit#4750] --- .../GtCoderModel.extension.st | 4 +- .../GtExpandableCoderViewModel.class.st | 4 +- .../GtExpandableSourceCoderElement.class.st | 21 +--- .../GtExpandedOnlyCoderElement.class.st | 7 ++ ...SourceCoderExpandedContentElement.class.st | 5 + .../GtSourceCoderExpandedOnlyElement.class.st | 88 +++++++++++++++++ ...tSourceCoderModificationIndicator.class.st | 97 +++++++++++++++++++ 7 files changed, 206 insertions(+), 20 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderExpandedOnlyElement.class.st create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderModificationIndicator.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderModel.extension.st b/src/GToolkit-Coder-UI/GtCoderModel.extension.st index 13dfe8e44..793cdf6b7 100644 --- a/src/GToolkit-Coder-UI/GtCoderModel.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderModel.extension.st @@ -14,8 +14,8 @@ GtCoderModel >> asElement [ GtCoderModel >> asExpandedOnlyElement [ "Create an element for just the expanded coder without expander" - ^ GtExpandedOnlyCoderElement new - coderViewModel: self asCoderViewModel; + ^ GtSourceCoderExpandedOnlyElement new + textualCoderViewModel: self asCoderViewModel; yourself ] diff --git a/src/GToolkit-Coder-UI/GtExpandableCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtExpandableCoderViewModel.class.st index 5238988df..43594cd99 100644 --- a/src/GToolkit-Coder-UI/GtExpandableCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtExpandableCoderViewModel.class.st @@ -13,8 +13,8 @@ Class { GtExpandableCoderViewModel >> asExpandedOnlyElement [ "Create an element for just the expanded coder without expander" - ^ GtExpandedOnlyCoderElement new - coderViewModel: self asCoderViewModel; + ^ GtSourceCoderExpandedOnlyElement new + textualCoderViewModel: self asCoderViewModel; yourself ] diff --git a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st index 13b21675f..d872f3251 100644 --- a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st @@ -137,22 +137,7 @@ GtExpandableSourceCoderElement >> newExpandedElement [ { #category : #'private - instance creation' } GtExpandableSourceCoderElement >> newModificationIndicator [ - ^ BlElement new - constraintsDo: [ :c | - c ignoreByLayout. - c ignored horizontal alignLeft. - c horizontal exact: 5. - c vertical matchParent. - c margin: (BlInsets left: 8) ]; - preventMeAndChildrenMouseEvents; - background: self theme status changesBackgroundColor; - id: GtTextualCoderModificationIndicatorId; - withAsyncPromiseDo: [ :anElementPromise | - anElementPromise - whenSuccess: [ :anIndicator :isModified | - anIndicator visibility: (isModified - ifTrue: [ BlVisibility visible ] - ifFalse: [ BlVisibility gone ]) ] ] + ^ GtSourceCoderModificationIndicator new withVerticalLeftIgnoredLayout ] { #category : #private } @@ -183,6 +168,8 @@ GtExpandableSourceCoderElement >> onTextualCoderViewModelChanged [ didn't get a chance to subscribe to any announcement. Override #onPostTextualCoderViewModelChanged if you wish to perform an operation that requires an announcement, but keep in mind that this is not the most efficient way" + modificationIndicator textualCoderViewModel: self textualCoderViewModel. + self updateElement ] @@ -250,5 +237,7 @@ GtExpandableSourceCoderElement >> updateElement [ { #category : #'private - update' } GtExpandableSourceCoderElement >> updateModificationIndicator [ + true ifTrue: [ ^ self ]. + modificationIndicator asyncPromise promise: textualCoderViewModel isTextModifiedPromise ] diff --git a/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st b/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st index eb8bae13a..9b1979f10 100644 --- a/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtExpandedOnlyCoderElement.class.st @@ -8,6 +8,13 @@ Class { #category : #'GToolkit-Coder-UI-Coder - Source' } +{ #category : #testing } +GtExpandedOnlyCoderElement class >> isDeprecated [ + "Use GtSourceCoderExpandedOnlyElement instead" + + ^ true +] + { #category : #adding } GtExpandedOnlyCoderElement >> addCodersCoderLook: aSourceCoder to: anElement [ aSourceCoder coderLook diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st index 319844117..5528cf796 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st @@ -14,6 +14,11 @@ GtSourceCoderExpandedContentElement >> actions [ ^ actions ] +{ #category : #'focus requesting' } +GtSourceCoderExpandedContentElement >> focusTarget [ + ^ editorElement focusTarget +] + { #category : #initialization } GtSourceCoderExpandedContentElement >> initialize [ super initialize. diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpandedOnlyElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpandedOnlyElement.class.st new file mode 100644 index 000000000..22c06e8cf --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpandedOnlyElement.class.st @@ -0,0 +1,88 @@ +Class { + #name : #GtSourceCoderExpandedOnlyElement, + #superclass : #BlElement, + #traits : 'TBrLayoutResizable + TGtWithTextualCoderViewModel', + #classTraits : 'TBrLayoutResizable classTrait + TGtWithTextualCoderViewModel classTrait', + #instVars : [ + 'expandedElement', + 'modificationIndicator' + ], + #category : #'GToolkit-Coder-UI-Coder - Source' +} + +{ #category : #converting } +GtSourceCoderExpandedOnlyElement >> asVerticallyResizableDo: aBlock [ + ^ self +] + +{ #category : #initialization } +GtSourceCoderExpandedOnlyElement >> defaultLayout [ + ^ BlLinearLayout vertical +] + +{ #category : #'focus requesting' } +GtSourceCoderExpandedOnlyElement >> focusTarget [ + ^ expandedElement focusTarget +] + +{ #category : #initialization } +GtSourceCoderExpandedOnlyElement >> initialize [ + super initialize. + self + hMatchParent; + vFitContent. + + expandedElement := self newExpandedElement. + modificationIndicator := self newModificationIndicator. + modificationIndicator visibility: BlVisibility gone. + + self addChild: expandedElement. + self addChild: modificationIndicator. + + self addAptitude: (BrLayoutResizerAptitude new commonResizing: expandedElement) +] + +{ #category : #initialization } +GtSourceCoderExpandedOnlyElement >> newExpandedElement [ + ^ GtSourceCoderExpandedContentElement new + showScrollbars; + yourself +] + +{ #category : #initialization } +GtSourceCoderExpandedOnlyElement >> newModificationIndicator [ + ^ GtSourceCoderModificationIndicator new + withVerticalLeftIgnoredLayout; + margin: (BlInsets all: 0) +] + +{ #category : #'api - textual coder view model' } +GtSourceCoderExpandedOnlyElement >> onTextualCoderViewModelChanged [ + "Is sent when a new textualCoder view model is assigned to the element. + Note: #onTextualCoderViewModelChanged is sent before #subscribeToTextualCoderViewModel + which means that if you perform any operation that triggers an announcement it will be ignored because the receiver + didn't get a chance to subscribe to any announcement. Override #onPostTextualCoderViewModelChanged if you + wish to perform an operation that requires an announcement, but keep in mind that this is not the most efficient way" + + self textualCoderViewModel expanded: true. + expandedElement textualCoderViewModel: self textualCoderViewModel. + modificationIndicator textualCoderViewModel: self textualCoderViewModel. + + self updateElement +] + +{ #category : #'private - updating' } +GtSourceCoderExpandedOnlyElement >> updateElement [ + self textualCoderViewModel coderLook + ifNotNil: [ :aNewAptitude | + expandedElement userData + at: #coderAptitude + ifPresent: [ :anOldAptitude | expandedElement removeAptitude: anOldAptitude ] + ifAbsent: [ ]. + + expandedElement addAptitude: aNewAptitude. + + expandedElement userData + at: #coderAptitude + put: aNewAptitude ] +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderModificationIndicator.class.st b/src/GToolkit-Coder-UI/GtSourceCoderModificationIndicator.class.st new file mode 100644 index 000000000..deba2e5e5 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderModificationIndicator.class.st @@ -0,0 +1,97 @@ +Class { + #name : #GtSourceCoderModificationIndicator, + #superclass : #BlElement, + #traits : 'TBrLayoutResizable + TGtWithTextualCoderViewModel', + #classTraits : 'TBrLayoutResizable classTrait + TGtWithTextualCoderViewModel classTrait', + #category : #'GToolkit-Coder-UI-Coder - Source' +} + +{ #category : #'api - visibility' } +GtSourceCoderModificationIndicator >> hide [ + self visibility: BlVisibility gone +] + +{ #category : #initialization } +GtSourceCoderModificationIndicator >> initialize [ + super initialize. + + self background: self theme status changesBackgroundColor. + self preventMeAndChildrenMouseEvents. + self id: GtTextualCoderModificationIndicatorId. + self + withAsyncPromiseDo: [ :anElementPromise | + anElementPromise + whenSuccess: [ :anIndicator :isModified | self onPromiseSuccess: isModified ]; + whenError: [ :anIndicator :anException | self onPromiseError: anException ] ] +] + +{ #category : #'private - event handling' } +GtSourceCoderModificationIndicator >> onPromiseError: anException [ +] + +{ #category : #'private - event handling' } +GtSourceCoderModificationIndicator >> onPromiseSuccess: isModified [ + isModified ifTrue: [ self show ] ifFalse: [ self hide ] +] + +{ #category : #'api - textual coder view model' } +GtSourceCoderModificationIndicator >> onTextualCoderViewModelChanged [ + "Is sent when a new textualCoder view model is assigned to the element. + Note: #onTextualCoderViewModelChanged is sent before #subscribeToTextualCoderViewModel + which means that if you perform any operation that triggers an announcement it will be ignored because the receiver + didn't get a chance to subscribe to any announcement. Override #onPostTextualCoderViewModelChanged if you + wish to perform an operation that requires an announcement, but keep in mind that this is not the most efficient way" + + self updateElement +] + +{ #category : #'private - event handling' } +GtSourceCoderModificationIndicator >> onViewModelTextChanged: anAnnouncement [ + self hasTextualCoderViewModel ifFalse: [ ^ self ]. + anAnnouncement textualCoderViewModel = self textualCoderViewModel + ifFalse: [ ^ self ]. + + BlTaskAction enqueueElement: self action: [ self updateElement ] +] + +{ #category : #'api - visibility' } +GtSourceCoderModificationIndicator >> show [ + self visibility: BlVisibility visible +] + +{ #category : #'api - textual coder view model' } +GtSourceCoderModificationIndicator >> subscribeToTextualCoderViewModel [ + "Is sent after a new textualCoder view model is assigned to the element. + It is required to unsubscribe from the view model or domain model by implementing + #unsubscribeFromTextualCoderViewModel if elements subscribe to them" + + self textualCoderViewModel weak + when: GtTextualCoderViewModelTextChanged + send: #onViewModelTextChanged: + to: self +] + +{ #category : #'api - textual coder view model' } +GtSourceCoderModificationIndicator >> unsubscribeFromTextualCoderViewModel [ + "Is sent before a new textualCoder view model is assigned to the element. + Elements that subscribe to textualCoder view model in domain model are required to implement this methods." + + self textualCoderViewModel unsubscribe: self +] + +{ #category : #'api - textual coder view model' } +GtSourceCoderModificationIndicator >> updateElement [ + self hasTextualCoderViewModel ifFalse: [ ^ self ]. + self asyncPromise promise: self textualCoderViewModel isTextModifiedPromise +] + +{ #category : #'api - initialization' } +GtSourceCoderModificationIndicator >> withVerticalLeftIgnoredLayout [ + self + constraintsDo: [ :c | + c ignoreByLayout. + c ignored horizontal alignLeft. + c horizontal exact: 5. + c vertical matchParent. + c margin: (BlInsets left: 8) ] +] From 454950d5edf339a0ad4c0c199bcc969959230c11 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 3 Oct 2025 18:40:01 -0300 Subject: [PATCH 1097/1268] add `GtSourceCoderExpandedOnlyElement>>#coderViewModel:` [feenkcom/gtoolkit#4750] --- .../GtSourceCoderExpandedOnlyElement.class.st | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpandedOnlyElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpandedOnlyElement.class.st index 22c06e8cf..8133fceeb 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExpandedOnlyElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpandedOnlyElement.class.st @@ -15,6 +15,16 @@ GtSourceCoderExpandedOnlyElement >> asVerticallyResizableDo: aBlock [ ^ self ] +{ #category : #'api - textual coder view model' } +GtSourceCoderExpandedOnlyElement >> coderViewModel [ + ^ self textualCoderViewModel +] + +{ #category : #'api - textual coder view model' } +GtSourceCoderExpandedOnlyElement >> coderViewModel: aViewModel [ + self textualCoderViewModel: aViewModel +] + { #category : #initialization } GtSourceCoderExpandedOnlyElement >> defaultLayout [ ^ BlLinearLayout vertical From 17e80fa01d3ac28fc160ffa959445f24af24c077 Mon Sep 17 00:00:00 2001 From: John Brant Date: Mon, 6 Oct 2025 07:58:08 -0500 Subject: [PATCH 1098/1268] [feenkcom/gtoolkit#4758] don't show push down method when no subclasses --- .../GtCoderMethodsGroupedListElement.class.st | 38 ++++++++++--------- .../GtCoderPackagesTreeElement.class.st | 2 +- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index 84dbe74e6..e9525d0b3 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -124,12 +124,14 @@ GtCoderMethodsGroupedListElement >> contextMenuForOneItem: item in: anElement [ label: (self createLabel: 'Push up method' description: item selector); submenu: (self pushUpMethodSubmenuFor: item); bePinSubmenuAction). - menu - addItem: (BrMenuSubmenuItem new - group: BrMenuItemGroupConfiguration refactoring; - label: (self createLabel: 'Push down method' description: item selector); - submenu: (self pushDownMethodSubmenuFor: item); - bePinSubmenuAction). + + item methodClass subclasses notEmpty + ifTrue: [ menu + addItem: (BrMenuSubmenuItem new + group: BrMenuItemGroupConfiguration refactoring; + label: (self createLabel: 'Push down method' description: item selector); + submenu: (self pushDownMethodSubmenuFor: item); + bePinSubmenuAction) ]. menu addItem: (BrMenuSubmenuItem new group: BrMenuItemGroupConfiguration refactoring; @@ -185,14 +187,16 @@ GtCoderMethodsGroupedListElement >> contextMenuForSeveralItems: someItems in: an description: ('{1} methods' format: {someItems size})); submenu: (self pushUpSeveralMethodsSubmenuFor: someItems); bePinSubmenuAction). - menu - addItem: (BrMenuSubmenuItem new - group: BrMenuItemGroupConfiguration refactoring; - label: (self - createLabel: 'Push down methods' - description: ('{1} methods' format: {someItems size})); - submenu: (self pushDownSeveralMethodsSubmenuFor: someItems); - bePinSubmenuAction). + + someItems anyOne methodClass subclasses notEmpty + ifTrue: [ menu + addItem: (BrMenuSubmenuItem new + group: BrMenuItemGroupConfiguration refactoring; + label: (self + createLabel: 'Push down methods' + description: ('{1} methods' format: {someItems size})); + submenu: (self pushDownSeveralMethodsSubmenuFor: someItems); + bePinSubmenuAction) ]. menu addItem: (BrMenuSubmenuItem new @@ -370,7 +374,7 @@ GtCoderMethodsGroupedListElement >> pushDownMethodSubmenuFor: aMethod [ refactoringTitle: 'Push down'; targetName: ('{1}>>#{2}' format: { aMethod methodClass. aMethod selector }); confirmationLabel: ('Push down {1}' format: { aMethod selector }); - refactoringWithConfirmation: [ RBPushDownMethodRefactoring + refactoringWithConfirmation: [ GtRBPushDownMethodRefactoring pushDown: {aMethod selector} from: (self forPharo12AndNewer: [ aMethod methodClass name ] @@ -401,10 +405,10 @@ GtCoderMethodsGroupedListElement >> pushDownSeveralMethodsSubmenuFor: aCollectio refactoringsWithConfirmation: [ | aGroupByClass aModel aCollectionOfRefactorings | aGroupByClass := aCollectionOfMethods groupedBy: #methodClass. aModel := Smalltalk createRbNamespace - onEnvironment: RBPushDownMethodRefactoring new defaultEnvironment. + onEnvironment: GtRBPushDownMethodRefactoring new defaultEnvironment. aCollectionOfRefactorings := aGroupByClass collect: [ :someMethods | - RBPushDownMethodRefactoring new + GtRBPushDownMethodRefactoring new model: aModel; pushDown: (someMethods collect: #selector) from: (self diff --git a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st index a06b85872..67539c015 100644 --- a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st @@ -214,7 +214,7 @@ GtCoderPackagesTreeElement >> onDropClassesOnPackageOrTag: anItemsDroppedEvent [ | aPackageOrTag aModel compositeChange someRefactorings aPromise | aPackageOrTag := anItemsDroppedEvent currentTarget packageOrTag. aModel := Smalltalk createRbNamespace - onEnvironment: RBPushDownMethodRefactoring new defaultEnvironment. + onEnvironment: GtRBPushDownMethodRefactoring new defaultEnvironment. someRefactorings := anItemsDroppedEvent items collect: [ :eachDragItem | From 33d390f452cce1687f6448606d130ddd0f1e1db7 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 6 Oct 2025 15:19:45 -0300 Subject: [PATCH 1099/1268] use new refactoring widgets [feenkcom/gtoolkit#4761] --- .../GtCoderPackagesTreeElement.class.st | 71 ++++++++++++------- ...tCoderProtocolsGroupedListElement.class.st | 39 ++++++---- 2 files changed, 69 insertions(+), 41 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st index 67539c015..6ae051302 100644 --- a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st @@ -73,7 +73,8 @@ GtCoderPackagesTreeElement >> contextMenuFor: aPackageOrTag [ ifTrue: [ menu addItem: (BrMenuSubmenuItem new label: (self createLabel: 'Rename package' description: aPackageOrTag name); - submenu: (self renamePackageSubmenuFor: aPackageOrTag)). + submenu: (self renamePackageSubmenuFor: aPackageOrTag); + bePinSubmenuAction). menu addItem: (BrMenuSubmenuItem new label: (self createLabel: 'Remove package' description: aPackageOrTag name); @@ -81,7 +82,8 @@ GtCoderPackagesTreeElement >> contextMenuFor: aPackageOrTag [ ifFalse: [ menu addItem: (BrMenuSubmenuItem new label: (self createLabel: 'Rename tag' description: aPackageOrTag name); - submenu: (self renamePackageTagSubmenuFor: aPackageOrTag)). + submenu: (self renamePackageTagSubmenuFor: aPackageOrTag); + bePinSubmenuAction). menu addItem: (BrMenuSubmenuItem new label: (self createLabel: 'Remove tag' description: aPackageOrTag name); @@ -367,34 +369,51 @@ GtCoderPackagesTreeElement >> renamePackage: aPackage inElement: elem [ { #category : #'private - context menu' } GtCoderPackagesTreeElement >> renamePackageSubmenuFor: aPackage [ - | submenu | - submenu := BrMenuExplicit new. - submenu - stencil: [ GtRefactoringsWithInputPreviewElement - elementForRefactoring: [ :each | GtRBRenamePackageRefactoring from: aPackage name to: each ] - labeled: 'Rename package: ' - initialValue: aPackage name - from: self - beforeApplyingDo: [ submenu hideAll ] ]. - ^ submenu + ^ BrMenuExplicit new + stencil: [ :anExplicitMenu | + | aViewModel | + anExplicitMenu id: #'coder--context-menu-rename-package-form'. + + aViewModel := GtRefactoringsWithInputViewModel new + refactoringTitle: 'Rename package'; + targetName: aPackage name; + inputLabel: 'New package name:'; + initialText: aPackage name; + refactoringWithInput: [ :anInput | + GtRBRenamePackageRefactoring from: aPackage name to: anInput ]; + afterAppliedBlock: [ anExplicitMenu hideAll ]; + menuModel: anExplicitMenu; + anchorElement: self. + GtRefactoringsPreviewWithInputElement new + refactoringsViewModel: aViewModel; + beContextMenuElement; + bePinnable: anExplicitMenu ] ] { #category : #'private - context menu' } GtCoderPackagesTreeElement >> renamePackageTagSubmenuFor: aPackageTag [ - | submenu | - submenu := BrMenuExplicit new. - submenu - stencil: [ GtRefactoringsWithInputPreviewElement - elementForRefactoring: [ :each | - GtRBRenamePackageTagRefactoring - packageName: aPackageTag packageName - from: aPackageTag name - to: each ] - labeled: 'Rename tag: ' - initialValue: aPackageTag name - from: self - beforeApplyingDo: [ submenu hideAll ] ]. - ^ submenu + ^ BrMenuExplicit new + stencil: [ :anExplicitMenu | + | aViewModel | + anExplicitMenu id: #'coder--context-menu-rename-package-tag-form'. + + aViewModel := GtRefactoringsWithInputViewModel new + refactoringTitle: 'Rename package tag'; + targetName: aPackageTag name; + inputLabel: 'New package tag name:'; + initialText: aPackageTag name; + refactoringWithInput: [ :anInput | + GtRBRenamePackageTagRefactoring + packageName: aPackageTag packageName + from: aPackageTag name + to: anInput ]; + afterAppliedBlock: [ anExplicitMenu hideAll ]; + menuModel: anExplicitMenu; + anchorElement: self. + GtRefactoringsPreviewWithInputElement new + refactoringsViewModel: aViewModel; + beContextMenuElement; + bePinnable: anExplicitMenu ] ] { #category : #initialization } diff --git a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st index 0981c0bfb..c95d43c5b 100644 --- a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st @@ -54,7 +54,8 @@ GtCoderProtocolsGroupedListElement >> contextMenuFor: aPharoProtocol [ ifTrue: [ menu addItem: (BrMenuSubmenuItem new label: (self createLabel: 'Rename' description: aPharoProtocol name); - submenu: (self renameProtocolSubmenuFor: aPharoProtocol)) ]. + submenu: (self renameProtocolSubmenuFor: aPharoProtocol); + bePinSubmenuAction) ]. aPharoProtocol canBeRemoved ifTrue: [ menu addItem: (BrMenuSubmenuItem new @@ -373,20 +374,28 @@ GtCoderProtocolsGroupedListElement >> removeProtocolSubmenuFor: aGtPharoProtocol { #category : #'private - refactorings' } GtCoderProtocolsGroupedListElement >> renameProtocolSubmenuFor: aGtPharoProtocol [ - | submenu | - submenu := BrMenuExplicit new. - submenu - stencil: [ GtRefactoringsWithInputPreviewElement - elementForRefactoring: [ :each | - GtRBRenameProtocolRefactoring - renameProtocol: aGtPharoProtocol name - in: aGtPharoProtocol protocolClass - to: each ] - labeled: 'Rename protocol: ' - initialValue: aGtPharoProtocol name - from: self - beforeApplyingDo: [ submenu hideAll ] ]. - ^ submenu + ^ BrMenuExplicit new + stencil: [ :anExplicitMenu | + | aViewModel | + anExplicitMenu id: #'coder--context-menu-rename-protocol-form'. + + aViewModel := GtRefactoringsWithInputViewModel new + refactoringTitle: 'Rename method protocol'; + targetName: aGtPharoProtocol name; + inputLabel: 'New method protocol name:'; + initialText: aGtPharoProtocol name; + refactoringWithInput: [ :anInput | + GtRBRenameProtocolRefactoring + renameProtocol: aGtPharoProtocol name + in: aGtPharoProtocol protocolClass + to: anInput ]; + afterAppliedBlock: [ anExplicitMenu hideAll ]; + menuModel: anExplicitMenu; + anchorElement: self. + GtRefactoringsPreviewWithInputElement new + refactoringsViewModel: aViewModel; + beContextMenuElement; + bePinnable: anExplicitMenu ] ] { #category : #'api - list' } From edeef09a6141c371df545d69be52ed7e1d2fb238 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 6 Oct 2025 21:57:45 -0300 Subject: [PATCH 1100/1268] remove unused code [feenkcom/gtoolkit#4761] --- .../GtCoderClassesTreeElement.class.st | 21 ------- .../GtCoderPackagesTreeElement.class.st | 57 ------------------- ...TGtCoderNavigationWithContextMenu.trait.st | 44 -------------- 3 files changed, 122 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index 2afe2c404..acc89dfca 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -22,27 +22,6 @@ GtCoderClassesTreeElement class >> fromClasses: aCollectionOfClasses [ ^ self new initializeWithClasses: aCollectionOfClasses ] -{ #category : #'private - context menu' } -GtCoderClassesTreeElement >> addPreviewButtonFor: refactoring to: elem cancelSelector: cancelSelector [ - | button | - elem removeChildNamed: #preview. - button := GtRefactoringsPreviewButton new. - button vMatchParent. - button refactorings: [ {refactoring} ]. - button cancelBlock: [ self perform: cancelSelector ]. - button - padding: (BlInsets - top: 1 - right: 4 - bottom: 0 - left: 4). - button beMiniSize. - button - when: GtRefactoringsAppliedEvent - do: [ :anEvent | elem removeChild: anEvent currentTarget ]. - ^ elem addChild: button as: #preview -] - { #category : #initialization } GtCoderClassesTreeElement >> bind: aClassHierarchyTree element: aClassElement index: anIndexInTree [ aClassElement diff --git a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st index 6ae051302..a47f4b3a3 100644 --- a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st @@ -339,34 +339,6 @@ GtCoderPackagesTreeElement >> removePackageTagSubmenuFor: aPackageTag [ element ] ] -{ #category : #initialization } -GtCoderPackagesTreeElement >> renamePackage: aPackage inElement: elem [ - | refactoring edit childs | - childs := elem children copy. - edit := BrEditableLabel new. - edit - aptitude: (BrGlamorousEditableLabelAptitude new - fontSize: 11.9; "Force the font to match the label font" - background: Color transparent); - text: aPackage name; - when: BrEditorAcceptWish - do: [ :aWish | - refactoring := GtRBRenamePackageRefactoring - from: aPackage name - to: aWish text asString. - edit switchToLabel. - self - addPreviewButtonFor: refactoring - to: elem - appliedBlock: [ ] - cancelBlock: [ elem removeChildren. - elem addChildren: childs ] ]; - switchToEditor. - edit requestFocus. - elem removeChildren. - elem addChild: edit -] - { #category : #'private - context menu' } GtCoderPackagesTreeElement >> renamePackageSubmenuFor: aPackage [ ^ BrMenuExplicit new @@ -416,35 +388,6 @@ GtCoderPackagesTreeElement >> renamePackageTagSubmenuFor: aPackageTag [ bePinnable: anExplicitMenu ] ] -{ #category : #initialization } -GtCoderPackagesTreeElement >> renameTag: aPackageOrTag inElement: elem [ - | refactoring edit childs | - childs := elem children copy. - edit := BrEditableLabel new. - edit - aptitude: (BrGlamorousEditableLabelAptitude new - fontSize: 11.9; "Force the font to match the label font" - background: Color transparent); - text: aPackageOrTag name; - when: BrEditorAcceptWish - do: [ :aWish | - refactoring := GtRBRenamePackageTagRefactoring - packageName: aPackageOrTag package name - from: aPackageOrTag name - to: aWish text asString. - edit switchToLabel. - self - addPreviewButtonFor: refactoring - to: elem - appliedBlock: [ ] - cancelBlock: [ elem removeChildren. - elem addChildren: childs ] ]; - switchToEditor. - edit requestFocus. - elem removeChildren. - elem addChild: edit -] - { #category : #'private - context menu' } GtCoderPackagesTreeElement >> requestRenamePackage: aPackageOrTag [ "An entrance point to the rename package action. diff --git a/src/GToolkit-Coder-UI/TGtCoderNavigationWithContextMenu.trait.st b/src/GToolkit-Coder-UI/TGtCoderNavigationWithContextMenu.trait.st index 154321913..2a42491f8 100644 --- a/src/GToolkit-Coder-UI/TGtCoderNavigationWithContextMenu.trait.st +++ b/src/GToolkit-Coder-UI/TGtCoderNavigationWithContextMenu.trait.st @@ -3,50 +3,6 @@ Trait { #category : #'GToolkit-Coder-UI-Navigation' } -{ #category : #'private - context menu' } -TGtCoderNavigationWithContextMenu >> addPreviewButtonFor: refactoring to: elem appliedBlock: appliedBlock cancelBlock: cancelBlock [ - | button | - elem removeChildNamed: #preview. - button := GtRefactoringsPreviewButton new. - button vMatchParent. - button refactorings: [ {refactoring} ]. - button cancelBlock: cancelBlock. - button - padding: (BlInsets - top: 1 - right: 4 - bottom: 0 - left: 4). - button beMiniSize. - button - when: GtRefactoringsAppliedEvent - do: [ :anEvent | - elem removeChild: anEvent currentTarget. - appliedBlock value ]. - ^ elem addChild: button as: #preview -] - -{ #category : #'private - context menu' } -TGtCoderNavigationWithContextMenu >> addPreviewButtonFor: refactoring to: elem cancelSelector: cancelSelector [ - | button | - elem removeChildNamed: #preview. - button := GtRefactoringsPreviewButton new. - button vMatchParent. - button refactorings: [ {refactoring} ]. - button cancelBlock: [ self perform: cancelSelector ]. - button - padding: (BlInsets - top: 1 - right: 4 - bottom: 0 - left: 4). - button beMiniSize. - button - when: GtRefactoringsAppliedEvent - do: [ :anEvent | elem removeChild: anEvent currentTarget ]. - ^ elem addChild: button as: #preview -] - { #category : #'private - context menu' } TGtCoderNavigationWithContextMenu >> createLabel: aString description: description [ ^ aString asRopedText glamorousRegularFont From 3cd888518a8689fab3ac6f5f701fd4907bb57e13 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 8 Oct 2025 11:01:18 -0300 Subject: [PATCH 1101/1268] use `BrLayoutResizerAptitude >> #common:` --- src/GToolkit-Coder-UI/GtSourceCoderExpandedOnlyElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpandedOnlyElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpandedOnlyElement.class.st index 8133fceeb..60b72c808 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExpandedOnlyElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpandedOnlyElement.class.st @@ -49,7 +49,7 @@ GtSourceCoderExpandedOnlyElement >> initialize [ self addChild: expandedElement. self addChild: modificationIndicator. - self addAptitude: (BrLayoutResizerAptitude new commonResizing: expandedElement) + self addAptitude: (BrLayoutResizerAptitude new common: expandedElement) ] { #category : #initialization } From cebc035cb9172fa5580db414ba041cb9aad076f1 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 8 Oct 2025 18:13:55 -0300 Subject: [PATCH 1102/1268] define slot and class variable actions using phlow actions [feenkcom/gtoolkit#4761] --- .../ClassVariable.extension.st | 223 +++++++++++++ .../GtCoderSlotsGroupedListElement.class.st | 278 +---------------- .../GtCoderVariableTarget.class.st | 5 + .../GtPhlowContext.extension.st | 13 + .../InstanceVariableSlot.extension.st | 294 ++++++++++++++++++ 5 files changed, 543 insertions(+), 270 deletions(-) create mode 100644 src/GToolkit-Coder-UI/ClassVariable.extension.st create mode 100644 src/GToolkit-Coder-UI/GtCoderVariableTarget.class.st create mode 100644 src/GToolkit-Coder/InstanceVariableSlot.extension.st diff --git a/src/GToolkit-Coder-UI/ClassVariable.extension.st b/src/GToolkit-Coder-UI/ClassVariable.extension.st new file mode 100644 index 000000000..f0c4e20ba --- /dev/null +++ b/src/GToolkit-Coder-UI/ClassVariable.extension.st @@ -0,0 +1,223 @@ +Extension { #name : #ClassVariable } + +{ #category : #'*GToolkit-Coder-UI' } +ClassVariable >> gtBrowseReferencesActionFor: anAction context: aPhlowContext [ + + + ^ anAction button + label: 'Browse references'; + priority: 10; + target: GtCoderVariableTarget; + menuItemPreview: self name; + menuItemGroup: BrMenuItemGroupConfiguration navigation; + action: [ :aButton | + aButton phlow + spawnObject: (GtSearchClassVariableReferenceFilter + forClassAndSubclasses: self owningClass + andVariable: self name) ] +] + +{ #category : #'*GToolkit-Coder-UI' } +ClassVariable >> gtCreateAccessorsActionFor: anAction context: aPhlowContext [ + + | aSelectedClass | + aSelectedClass := self owningClass. + + aSelectedClass ifNil: [ ^ anAction noAction ]. + + ^ anAction dropdown + label: 'Create accessors'; + priority: 22; + target: GtCoderVariableTarget; + menuItemPreview: self name; + menuItemGroup: BrMenuItemGroupConfiguration refactoring; + menuItemPinSubmenu; + content: [ :anActionElement :aTargetElement :anExplicitMenu | + | aViewModel | + aViewModel := GtRefactoringsWithConfirmationViewModel new + refactoringTitle: 'Create accessors'; + targetName: ('{1}''s {2} class variable' + format: {aSelectedClass name. + self name}); + confirmationLabel: ('Create accessors {1}' format: {self name}); + refactoringWithConfirmation: [ RBCreateAccessorsForVariableRefactoring + variable: self name + class: aSelectedClass + classVariable: true ]; + afterAppliedBlock: [ anExplicitMenu hideAll ]; + menuModel: anExplicitMenu; + anchorElement: aTargetElement. + GtRefactoringsPreviewWithConfirmationElement new + refactoringsViewModel: aViewModel; + beContextMenuElement; + bePinnable: anExplicitMenu ] +] + +{ #category : #'*GToolkit-Coder-UI' } +ClassVariable >> gtPushDownActionFor: anAction context: aPhlowContext [ + + | aSelectedClass | + aSelectedClass := self owningClass. + + aSelectedClass ifNil: [ ^ anAction noAction ]. + + ^ anAction dropdown + label: 'Push down'; + priority: 21; + target: GtCoderVariableTarget; + menuItemPreview: self name; + menuItemGroup: BrMenuItemGroupConfiguration refactoring; + menuItemPinSubmenu; + content: [ :anActionElement :aTargetElement :anExplicitMenu | + | aViewModel | + aViewModel := GtRefactoringsWithConfirmationViewModel new + refactoringTitle: 'Push down'; + targetName: ('{1}''s {2} class variable' + format: {aSelectedClass name. + self name}); + confirmationLabel: ('Push down {1}' format: {self name}); + refactoringWithConfirmation: [ RBPushDownClassVariableRefactoring + variable: self name + class: aSelectedClass ]; + afterAppliedBlock: [ anExplicitMenu hideAll ]; + menuModel: anExplicitMenu; + anchorElement: aTargetElement. + GtRefactoringsPreviewWithConfirmationElement new + refactoringsViewModel: aViewModel; + beContextMenuElement; + bePinnable: anExplicitMenu ] +] + +{ #category : #'*GToolkit-Coder-UI' } +ClassVariable >> gtPushUpActionFor: anAction context: aPhlowContext [ + + | aSelectedClass | + aSelectedClass := self owningClass. + + aSelectedClass ifNil: [ ^ anAction noAction ]. + + ^ anAction dropdown + label: 'Push up'; + priority: 20; + target: GtCoderVariableTarget; + menuItemPreview: self name; + menuItemGroup: BrMenuItemGroupConfiguration refactoring; + menuItemPinSubmenu; + content: [ :anActionElement :aTargetElement :anExplicitMenu | + | aViewModel | + aViewModel := GtRefactoringsWithConfirmationViewModel new + refactoringTitle: 'Push up'; + targetName: ('{1}''s {2} class variable' + format: {aSelectedClass name. + self name}); + confirmationLabel: ('Push up {1}' format: {self name}); + refactoringWithConfirmation: [ RBPullUpClassVariableRefactoring + variable: self name + class: aSelectedClass superclass ]; + afterAppliedBlock: [ anExplicitMenu hideAll ]; + menuModel: anExplicitMenu; + anchorElement: aTargetElement. + GtRefactoringsPreviewWithConfirmationElement new + refactoringsViewModel: aViewModel; + beContextMenuElement; + bePinnable: anExplicitMenu ] +] + +{ #category : #'*GToolkit-Coder-UI' } +ClassVariable >> gtRemoveActionFor: anAction context: aPhlowContext [ + + | aSelectedClass | + aSelectedClass := self owningClass. + + aSelectedClass ifNil: [ ^ anAction noAction ]. + + ^ anAction dropdown + label: 'Remove'; + priority: 40; + target: GtCoderVariableTarget; + menuItemPreview: self name; + menuItemGroup: BrMenuItemGroupConfiguration removal; + menuItemPinSubmenu; + content: [ :anActionElement :aTargetElement :anExplicitMenu | + | element change button | + element := BrVerticalPane new fitContent. + element + addChild: (BrLabel new + margin: (BlInsets + top: 10 + bottom: 0 + left: 10 + right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont; + text: ('Remove ' , self name) asRopedText). + element + addChild: (BrAsyncWidget new + fitContent; + stencil: [ | pane references | + pane := BrVerticalPane new. + pane fitContent. + references := (GtSearchClassVariableReferenceFilter + forClassAndSubclasses: aSelectedClass + andVariable: self name) size. + references > 0 + ifTrue: [ pane + addChild: (BrLabel new + margin: (BlInsets left: 10 right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; + text: (references printString , ' reference' + , (references > 1 ifTrue: [ 's' ] ifFalse: [ '' ])) asRopedText) ]. + pane ]). + change := RBRemoveClassVariableRefactoring + variable: self name + class: aSelectedClass. + button := BrButton new + aptitude: BrGlamorousButtonWithIconAptitude; + beSmallSize; + margin: (BlInsets + top: 10 + bottom: 10 + left: 10 + right: 10); + icon: BrGlamorousVectorIcons remove; + label: 'Remove'; + action: [ anExplicitMenu hideAll. + change execute ]. + element addChild: button as: #removeButton. + element ] +] + +{ #category : #'*GToolkit-Coder-UI' } +ClassVariable >> gtRenameActionFor: anAction context: aPhlowContext [ + + | aSelectedClass | + aSelectedClass := self owningClass. + aSelectedClass ifNil: [ ^ anAction noAction ]. + + ^ anAction dropdown + label: 'Rename'; + priority: 25; + target: GtCoderVariableTarget; + menuItemPreview: self name; + menuItemGroup: BrMenuItemGroupConfiguration refactoring; + menuItemPinSubmenu; + content: [ :anActionElement :aTargetElement :anExplicitMenu | + | aViewModel | + aViewModel := GtRefactoringsWithInputViewModel new + refactoringTitle: 'Rename'; + targetName: ('{1}''s {2} class variable' + format: {aSelectedClass name. + self name}); + inputLabel: 'New slot name:'; + refactoringWithInput: [ :anInput | + RBRenameClassVariableRefactoring + rename: self name + to: anInput + in: self owningClass ]; + afterAppliedBlock: [ anExplicitMenu hideAll ]; + menuModel: anExplicitMenu; + anchorElement: aTargetElement. + GtRefactoringsPreviewWithInputElement new + refactoringsViewModel: aViewModel; + beContextMenuElement; + bePinnable: anExplicitMenu ] +] diff --git a/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st index 1a3396c65..901b0c8e8 100644 --- a/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st @@ -10,40 +10,6 @@ Class { #category : #'GToolkit-Coder-UI-Navigation - Helpers' } -{ #category : #'private - context menu' } -GtCoderSlotsGroupedListElement >> abstractSubmenuFor: aString [ - | submenu | - submenu := BrMenuExplicit new. - - submenu - stencil: [ :anExplicitMenu | - | aViewModel | - aViewModel := GtRefactoringsWithConfirmationViewModel new - refactoringTitle: 'Abstract'; - targetName: ('{1}''s {2} inst. variable' format: { self selectedClass name. aString }); - confirmationLabel: ('Abstract {1}' format: { aString }); - refactoringWithConfirmation: [ RBAbstractInstanceVariableRefactoring - variable: aString - class: self selectedClass ]; - afterAppliedBlock: [ anExplicitMenu hideAll ]; - menuModel: anExplicitMenu; - anchorElement: self. - GtRefactoringsPreviewWithConfirmationElement new - refactoringsViewModel: aViewModel; - beContextMenuElement; - bePinnable: anExplicitMenu ]. - - ^ submenu -] - -{ #category : #'private - actions' } -GtCoderSlotsGroupedListElement >> browseSlotReferencesFor: aString [ - self phlow - spawnObject: (GtSearchInstanceSlotReferenceFilter - forClassAndSubclasses: self selectedClass - andVariable: aString) -] - { #category : #initialization } GtCoderSlotsGroupedListElement >> computeSlotItemText: aSlot [ | slotText | @@ -55,84 +21,6 @@ GtCoderSlotsGroupedListElement >> computeSlotItemText: aSlot [ ^ slotText ] -{ #category : #'private - context menu' } -GtCoderSlotsGroupedListElement >> contextMenuFor: item [ - | menu | - menu := BrMenuItems new. - menu addItem: (BrMenuActionItem new - group: BrMenuItemGroupConfiguration navigation; - label: (self createLabel: 'Browse references' description: item name); - action: [ self browseSlotReferencesFor: item name ]). - menu - addItem: (BrMenuSubmenuItem new - group: BrMenuItemGroupConfiguration refactoring; - label: (self createLabel: 'Push up' description: item name); - submenu: (self pushUpSubmenuFor: item name); - bePinSubmenuAction). - menu - addItem: (BrMenuSubmenuItem new - group: BrMenuItemGroupConfiguration refactoring; - label: (self createLabel: 'Push down' description: item name); - submenu: (self pushDownSubmenuFor: item name); - bePinSubmenuAction). - menu - addItem: (BrMenuSubmenuItem new - group: BrMenuItemGroupConfiguration refactoring; - label: (self createLabel: 'Create accessors' description: item name); - submenu: (self createAccessorsSubmenuFor: item name); - bePinSubmenuAction). - menu - addItem: (BrMenuSubmenuItem new - group: BrMenuItemGroupConfiguration refactoring; - label: (self createLabel: 'Abstract' description: item name); - submenu: (self abstractSubmenuFor: item name); - bePinSubmenuAction). - menu - addItem: (BrMenuSubmenuItem new - group: BrMenuItemGroupConfiguration refactoring; - label: (self createLabel: 'Protect' description: item name); - submenu: (self protectSubmenuFor: item name); - bePinSubmenuAction). - menu - addItem: (BrMenuSubmenuItem new - group: BrMenuItemGroupConfiguration refactoring; - label: (self createLabel: 'Remove' description: item name); - submenu: (self removeSubmenuFor: item name)). - menu - addItem: (BrMenuSubmenuItem new - group: BrMenuItemGroupConfiguration refactoring; - label: (self createLabel: 'Rename' description: item name); - submenu: (self renameSubmenuFor: item name); - bePinSubmenuAction). - ^ menu -] - -{ #category : #'private - context menu' } -GtCoderSlotsGroupedListElement >> createAccessorsSubmenuFor: aString [ - | submenu | - submenu := BrMenuExplicit new. - - submenu - stencil: [ :anExplicitMenu | - | aViewModel | - aViewModel := GtRefactoringsWithConfirmationViewModel new - refactoringTitle: 'Create accessors'; - targetName: ('{1}''s {2} inst. variable' format: { self selectedClass name. aString }); - confirmationLabel: ('Create accessors {1}' format: { aString }); - refactoringWithConfirmation: [ RBCreateAccessorsForVariableRefactoring - instanceVariable: aString - class: self selectedClass ]; - afterAppliedBlock: [ anExplicitMenu hideAll ]; - menuModel: anExplicitMenu; - anchorElement: self. - GtRefactoringsPreviewWithConfirmationElement new - refactoringsViewModel: aViewModel; - beContextMenuElement; - bePinnable: anExplicitMenu ]. - - ^ submenu -] - { #category : #initialization } GtCoderSlotsGroupedListElement >> createSlotGroups [ | classSlotGroup instanceGroup classVarGroup | @@ -156,7 +44,14 @@ GtCoderSlotsGroupedListElement >> createSlotGroups [ label text: slotText. label - addAptitude: (BrGlamorousWithExplicitContextMenuAptitude menu: [ self contextMenuFor: item ]). + addAptitude: (BrGlamorousWithExplicitContextMenuAptitude + menu: [ | aPhlowContext | + aPhlowContext := GtPhlowContext new + coderSelectedClass: self selectedClass. + GtCoderVariableTarget + menuItemsForObject: item + inContext: aPhlowContext + hostElement: element ]). element addChild: label ]; shouldShowWithoutItems: false. classSlotGroup := instanceGroup copy domainObject: 'class-side slots'. @@ -225,163 +120,6 @@ GtCoderSlotsGroupedListElement >> onSlotsToShowChanged: anAnnouncement [ self updateSlotList ] -{ #category : #'private - context menu' } -GtCoderSlotsGroupedListElement >> protectSubmenuFor: aString [ - | submenu | - submenu := BrMenuExplicit new. - - submenu - stencil: [ :anExplicitMenu | - | aViewModel | - aViewModel := GtRefactoringsWithConfirmationViewModel new - refactoringTitle: 'Protect'; - targetName: ('{1}''s {2} inst. variable' format: { self selectedClass name. aString }); - confirmationLabel: ('Protect {1}' format: { aString }); - refactoringWithConfirmation: [ RBProtectInstanceVariableRefactoring - variable: aString - class: self selectedClass ]; - afterAppliedBlock: [ anExplicitMenu hideAll ]; - menuModel: anExplicitMenu; - anchorElement: self. - GtRefactoringsPreviewWithConfirmationElement new - refactoringsViewModel: aViewModel; - beContextMenuElement; - bePinnable: anExplicitMenu ]. - - ^ submenu -] - -{ #category : #'private - context menu' } -GtCoderSlotsGroupedListElement >> pushDownSubmenuFor: aString [ - | submenu | - submenu := BrMenuExplicit new. - - submenu - stencil: [ :anExplicitMenu | - | aViewModel | - aViewModel := GtRefactoringsWithConfirmationViewModel new - refactoringTitle: 'Push down'; - targetName: ('{1}''s {2} inst. variable' format: { self selectedClass name. aString }); - confirmationLabel: ('Push down {1}' format: { aString }); - refactoringWithConfirmation: [ GtPushDownInstanceVariableRefactoring - variable: aString - class: self selectedClass ]; - afterAppliedBlock: [ anExplicitMenu hideAll ]; - menuModel: anExplicitMenu; - anchorElement: self. - GtRefactoringsPreviewWithConfirmationElement new - refactoringsViewModel: aViewModel; - beContextMenuElement; - bePinnable: anExplicitMenu ]. - - ^ submenu -] - -{ #category : #'private - context menu' } -GtCoderSlotsGroupedListElement >> pushUpSubmenuFor: aString [ - | submenu | - submenu := BrMenuExplicit new. - submenu - stencil: [ :anExplicitMenu | - | aViewModel | - aViewModel := GtRefactoringsWithConfirmationViewModel new - refactoringTitle: 'Push up'; - targetName: ('{1}''s {2} inst. variable' format: { self selectedClass name. aString }); - confirmationLabel: ('Push up {1}' format: { aString }); - refactoringWithConfirmation: [ RBPullUpInstanceVariableRefactoring - variable: aString - class: self selectedClass superclass ]; - afterAppliedBlock: [ anExplicitMenu hideAll ]; - menuModel: anExplicitMenu; - anchorElement: self. - GtRefactoringsPreviewWithConfirmationElement new - refactoringsViewModel: aViewModel; - beContextMenuElement; - bePinnable: anExplicitMenu ]. - - ^ submenu -] - -{ #category : #'private - context menu' } -GtCoderSlotsGroupedListElement >> removeSubmenuFor: aString [ - | submenu | - submenu := BrMenuExplicit new. - ^ submenu - stencil: [ | element change button | - element := BrVerticalPane new fitContent. - element - addChild: (BrLabel new - margin: (BlInsets - top: 10 - bottom: 0 - left: 10 - right: 10); - aptitude: BrGlamorousLabelAptitude new glamorousRegularFont; - text: ('Remove ' , aString) asRopedText). - element - addChild: (BrAsyncWidget new - fitContent; - stencil: [ | pane references | - pane := BrVerticalPane new. - pane fitContent. - references := (GtSearchInstanceSlotReferenceFilter - forClassAndSubclasses: self selectedClass - andVariable: aString) size. - references > 0 - ifTrue: [ pane - addChild: (BrLabel new - margin: (BlInsets left: 10 right: 10); - aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; - text: (references printString , ' reference' - , (references > 1 ifTrue: [ 's' ] ifFalse: [ '' ])) asRopedText) ]. - pane ]). - change := RBRemoveInstanceVariableChange - remove: aString - from: self selectedClass. - button := BrButton new - aptitude: BrGlamorousButtonWithIconAptitude; - beSmallSize; - margin: (BlInsets - top: 10 - bottom: 10 - left: 10 - right: 10); - icon: BrGlamorousVectorIcons remove; - label: 'Remove'; - action: [ submenu hideAll. - change execute ]. - element addChild: button as: #removeButton. - element ] -] - -{ #category : #'private - context menu' } -GtCoderSlotsGroupedListElement >> renameSubmenuFor: aString [ - | submenu | - submenu := BrMenuExplicit new. - - submenu - stencil: [ :anExplicitMenu | - | aViewModel | - aViewModel := GtRefactoringsWithInputViewModel new - refactoringTitle: 'Rename slot'; - targetName: ('{1}''s {2} inst. variable' format: { self selectedClass name. aString }); - inputLabel: 'Rename slot:'; - refactoringWithInput: [ :anInput | - GtRenameInstanceVariableRefactoring - rename: aString - to: anInput - in: self selectedClass ]; - afterAppliedBlock: [ anExplicitMenu hideAll ]; - menuModel: anExplicitMenu; - anchorElement: self. - GtRefactoringsPreviewWithInputElement new - refactoringsViewModel: aViewModel; - beContextMenuElement; - bePinnable: anExplicitMenu ]. - - ^ submenu -] - { #category : #accessing } GtCoderSlotsGroupedListElement >> selectedClass [ ^ navigationModel selectedClass diff --git a/src/GToolkit-Coder-UI/GtCoderVariableTarget.class.st b/src/GToolkit-Coder-UI/GtCoderVariableTarget.class.st new file mode 100644 index 000000000..40e6f2879 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderVariableTarget.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtCoderVariableTarget, + #superclass : #GtPhlowActionUniqueTarget, + #category : #'GToolkit-Coder-UI-Phlow Targets' +} diff --git a/src/GToolkit-Coder/GtPhlowContext.extension.st b/src/GToolkit-Coder/GtPhlowContext.extension.st index 160af5d6d..8575debf8 100644 --- a/src/GToolkit-Coder/GtPhlowContext.extension.st +++ b/src/GToolkit-Coder/GtPhlowContext.extension.st @@ -1,5 +1,18 @@ Extension { #name : #GtPhlowContext } +{ #category : #'*GToolkit-Coder-UI\t' } +GtPhlowContext >> coderSelectedClass: aClass [ + ^ self optionAt: #coderSelectedClass put: aClass +] + +{ #category : #'*GToolkit-Coder-UI\t' } +GtPhlowContext >> coderSelectedClassIfPresent: aPresentBlock ifAbsent: anAbsentBlock [ + ^ self + optionAt: #coderSelectedClass + ifPresent: aPresentBlock + ifAbsent: anAbsentBlock +] + { #category : #'*GToolkit-Coder-UI\t' } GtPhlowContext >> coderSelectedClasses [ ^ self optionAt: #coderSelectedClasses ifAbsent: [ #() ] diff --git a/src/GToolkit-Coder/InstanceVariableSlot.extension.st b/src/GToolkit-Coder/InstanceVariableSlot.extension.st new file mode 100644 index 000000000..154c75b64 --- /dev/null +++ b/src/GToolkit-Coder/InstanceVariableSlot.extension.st @@ -0,0 +1,294 @@ +Extension { #name : #InstanceVariableSlot } + +{ #category : #'*GToolkit-Coder-UI\t' } +InstanceVariableSlot >> gtAbstractActionFor: anAction context: aPhlowContext [ + + | aSelectedClass | + aSelectedClass := self owningClass. + + aSelectedClass ifNil: [ ^ anAction noAction ]. + + ^ anAction dropdown + label: 'Abstract'; + priority: 23; + target: GtCoderVariableTarget; + menuItemPreview: self name; + menuItemGroup: BrMenuItemGroupConfiguration refactoring; + menuItemPinSubmenu; + content: [ :anActionElement :aTargetElement :anExplicitMenu | + | aViewModel | + aViewModel := GtRefactoringsWithConfirmationViewModel new + refactoringTitle: 'Abstract'; + targetName: ('{1}''s {2} inst. variable' + format: {aSelectedClass name. + self name}); + confirmationLabel: ('Abstract {1}' format: {self name}); + refactoringWithConfirmation: [ RBAbstractInstanceVariableRefactoring + variable: self name + class: aSelectedClass ]; + afterAppliedBlock: [ anExplicitMenu hideAll ]; + menuModel: anExplicitMenu; + anchorElement: aTargetElement. + GtRefactoringsPreviewWithConfirmationElement new + refactoringsViewModel: aViewModel; + beContextMenuElement; + bePinnable: anExplicitMenu ] +] + +{ #category : #'*GToolkit-Coder-UI\t' } +InstanceVariableSlot >> gtBrowseReferencesActionFor: anAction context: aPhlowContext [ + + ^ anAction button + label: 'Browse references'; + priority: 10; + target: GtCoderVariableTarget; + menuItemPreview: self name; + menuItemGroup: BrMenuItemGroupConfiguration navigation; + action: [ :aButton | + | aFilter | + aFilter := self owningClass isInstanceSide + ifTrue: [ GtSearchInstanceSlotReferenceFilter + forClassAndSubclasses: self owningClass + andVariable: self name ] + ifFalse: [ GtSearchClassSlotReferenceFilter + forClassAndSubclasses: self owningClass + andVariable: self name ]. + aButton phlow spawnObject: aFilter ] +] + +{ #category : #'*GToolkit-Coder-UI\t' } +InstanceVariableSlot >> gtCreateAccessorsActionFor: anAction context: aPhlowContext [ + + | aSelectedClass | + aSelectedClass := self owningClass. + + aSelectedClass ifNil: [ ^ anAction noAction ]. + + ^ anAction dropdown + label: 'Create accessors'; + priority: 22; + target: GtCoderVariableTarget; + menuItemPreview: self name; + menuItemGroup: BrMenuItemGroupConfiguration refactoring; + menuItemPinSubmenu; + content: [ :anActionElement :aTargetElement :anExplicitMenu | + | aViewModel | + aViewModel := GtRefactoringsWithConfirmationViewModel new + refactoringTitle: 'Create accessors'; + targetName: ('{1}''s {2} inst. variable' + format: {aSelectedClass name. + self name}); + confirmationLabel: ('Create accessors {1}' format: {self name}); + refactoringWithConfirmation: [ RBCreateAccessorsForVariableRefactoring + instanceVariable: self name + class: aSelectedClass ]; + afterAppliedBlock: [ anExplicitMenu hideAll ]; + menuModel: anExplicitMenu; + anchorElement: aTargetElement. + GtRefactoringsPreviewWithConfirmationElement new + refactoringsViewModel: aViewModel; + beContextMenuElement; + bePinnable: anExplicitMenu ] +] + +{ #category : #'*GToolkit-Coder-UI\t' } +InstanceVariableSlot >> gtProtectSlotActionFor: anAction context: aPhlowContext [ + + | aSelectedClass | + aSelectedClass := self owningClass. + + aSelectedClass ifNil: [ ^ anAction noAction ]. + + ^ anAction dropdown + label: 'Protect'; + priority: 24; + target: GtCoderVariableTarget; + menuItemPreview: self name; + menuItemGroup: BrMenuItemGroupConfiguration refactoring; + menuItemPinSubmenu; + content: [ :anActionElement :aTargetElement :anExplicitMenu | + | aViewModel | + aViewModel := GtRefactoringsWithConfirmationViewModel new + refactoringTitle: 'Protect'; + targetName: ('{1}''s {2} inst. variable' + format: {aSelectedClass name. + self name}); + confirmationLabel: ('Protect {1}' format: {self name}); + refactoringWithConfirmation: [ RBProtectInstanceVariableRefactoring variable: self name class: aSelectedClass ]; + afterAppliedBlock: [ anExplicitMenu hideAll ]; + menuModel: anExplicitMenu; + anchorElement: aTargetElement. + GtRefactoringsPreviewWithConfirmationElement new + refactoringsViewModel: aViewModel; + beContextMenuElement; + bePinnable: anExplicitMenu ] +] + +{ #category : #'*GToolkit-Coder-UI\t' } +InstanceVariableSlot >> gtPushDownActionFor: anAction context: aPhlowContext [ + + | aSelectedClass | + aSelectedClass := self owningClass. + + aSelectedClass ifNil: [ ^ anAction noAction ]. + + ^ anAction dropdown + label: 'Push down'; + priority: 21; + target: GtCoderVariableTarget; + menuItemPreview: self name; + menuItemGroup: BrMenuItemGroupConfiguration refactoring; + menuItemPinSubmenu; + content: [ :anActionElement :aTargetElement :anExplicitMenu | + | aViewModel | + aViewModel := GtRefactoringsWithConfirmationViewModel new + refactoringTitle: 'Push down'; + targetName: ('{1}''s {2} inst. variable' + format: {aSelectedClass name. + self name}); + confirmationLabel: ('Push down {1}' format: {self name}); + refactoringWithConfirmation: [ GtPushDownInstanceVariableRefactoring + variable: self name + class: aSelectedClass ]; + afterAppliedBlock: [ anExplicitMenu hideAll ]; + menuModel: anExplicitMenu; + anchorElement: aTargetElement. + GtRefactoringsPreviewWithConfirmationElement new + refactoringsViewModel: aViewModel; + beContextMenuElement; + bePinnable: anExplicitMenu ] +] + +{ #category : #'*GToolkit-Coder-UI\t' } +InstanceVariableSlot >> gtPushUpActionFor: anAction context: aPhlowContext [ + + | aSelectedClass | + aSelectedClass := self owningClass. + + aSelectedClass ifNil: [ ^ anAction noAction ]. + + ^ anAction dropdown + label: 'Push up'; + priority: 20; + target: GtCoderVariableTarget; + menuItemPreview: self name; + menuItemGroup: BrMenuItemGroupConfiguration refactoring; + menuItemPinSubmenu; + content: [ :anActionElement :aTargetElement :anExplicitMenu | + | aViewModel | + aViewModel := GtRefactoringsWithConfirmationViewModel new + refactoringTitle: 'Push up'; + targetName: ('{1}''s {2} inst. variable' + format: {aSelectedClass name. + self name}); + confirmationLabel: ('Push up {1}' format: {self name}); + refactoringWithConfirmation: [ RBPullUpInstanceVariableRefactoring + variable: self name + class: aSelectedClass superclass ]; + afterAppliedBlock: [ anExplicitMenu hideAll ]; + menuModel: anExplicitMenu; + anchorElement: aTargetElement. + GtRefactoringsPreviewWithConfirmationElement new + refactoringsViewModel: aViewModel; + beContextMenuElement; + bePinnable: anExplicitMenu ] +] + +{ #category : #'*GToolkit-Coder-UI\t' } +InstanceVariableSlot >> gtRemoveActionFor: anAction context: aPhlowContext [ + + | aSelectedClass | + aSelectedClass := self owningClass. + + aSelectedClass ifNil: [ ^ anAction noAction ]. + + ^ anAction dropdown + label: 'Remove'; + priority: 40; + target: GtCoderVariableTarget; + menuItemPreview: self name; + menuItemGroup: BrMenuItemGroupConfiguration removal; + menuItemPinSubmenu; + content: [ :anActionElement :aTargetElement :anExplicitMenu | + | element change button | + element := BrVerticalPane new fitContent. + element + addChild: (BrLabel new + margin: (BlInsets + top: 10 + bottom: 0 + left: 10 + right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont; + text: ('Remove ' , self name) asRopedText). + element + addChild: (BrAsyncWidget new + fitContent; + stencil: [ | pane references | + pane := BrVerticalPane new. + pane fitContent. + references := (GtSearchInstanceSlotReferenceFilter + forClassAndSubclasses: aSelectedClass + andVariable: self name) size. + references > 0 + ifTrue: [ pane + addChild: (BrLabel new + margin: (BlInsets left: 10 right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; + text: (references printString , ' reference' + , (references > 1 ifTrue: [ 's' ] ifFalse: [ '' ])) asRopedText) ]. + pane ]). + change := RBRemoveInstanceVariableChange + remove: self name + from: aSelectedClass. + button := BrButton new + aptitude: BrGlamorousButtonWithIconAptitude; + beSmallSize; + margin: (BlInsets + top: 10 + bottom: 10 + left: 10 + right: 10); + icon: BrGlamorousVectorIcons remove; + label: 'Remove'; + action: [ anExplicitMenu hideAll. + change execute ]. + element addChild: button as: #removeButton. + element ] +] + +{ #category : #'*GToolkit-Coder-UI\t' } +InstanceVariableSlot >> gtRenameActionFor: anAction context: aPhlowContext [ + + | aSelectedClass | + aSelectedClass := self owningClass. + aSelectedClass ifNil: [ ^ anAction noAction ]. + + ^ anAction dropdown + label: 'Rename'; + priority: 25; + target: GtCoderVariableTarget; + menuItemPreview: self name; + menuItemGroup: BrMenuItemGroupConfiguration refactoring; + menuItemPinSubmenu; + content: [ :anActionElement :aTargetElement :anExplicitMenu | + | aViewModel | + aViewModel := GtRefactoringsWithInputViewModel new + refactoringTitle: 'Rename'; + targetName: ('{1}''s {2} inst. variable' + format: {aSelectedClass name. + self name}); + inputLabel: 'New slot name:'; + refactoringWithInput: [ :anInput | + GtRenameInstanceVariableRefactoring + rename: self name + to: anInput + in: aSelectedClass ]; + afterAppliedBlock: [ anExplicitMenu hideAll ]; + menuModel: anExplicitMenu; + anchorElement: aTargetElement. + GtRefactoringsPreviewWithInputElement new + refactoringsViewModel: aViewModel; + beContextMenuElement; + bePinnable: anExplicitMenu ] +] From 35a2f7b502d895da7a5605bdfba28a07dd25d071 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 8 Oct 2025 18:28:11 -0300 Subject: [PATCH 1103/1268] define slot and class variable actions using phlow actions [feenkcom/gtoolkit#4761] --- .../InstanceVariableSlot.extension.st | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) rename src/{GToolkit-Coder => GToolkit-Coder-UI}/InstanceVariableSlot.extension.st (96%) diff --git a/src/GToolkit-Coder/InstanceVariableSlot.extension.st b/src/GToolkit-Coder-UI/InstanceVariableSlot.extension.st similarity index 96% rename from src/GToolkit-Coder/InstanceVariableSlot.extension.st rename to src/GToolkit-Coder-UI/InstanceVariableSlot.extension.st index 154c75b64..f4e538d1c 100644 --- a/src/GToolkit-Coder/InstanceVariableSlot.extension.st +++ b/src/GToolkit-Coder-UI/InstanceVariableSlot.extension.st @@ -1,6 +1,6 @@ Extension { #name : #InstanceVariableSlot } -{ #category : #'*GToolkit-Coder-UI\t' } +{ #category : #'*GToolkit-Coder-UI' } InstanceVariableSlot >> gtAbstractActionFor: anAction context: aPhlowContext [ | aSelectedClass | @@ -35,7 +35,7 @@ InstanceVariableSlot >> gtAbstractActionFor: anAction context: aPhlowContext [ bePinnable: anExplicitMenu ] ] -{ #category : #'*GToolkit-Coder-UI\t' } +{ #category : #'*GToolkit-Coder-UI' } InstanceVariableSlot >> gtBrowseReferencesActionFor: anAction context: aPhlowContext [ ^ anAction button @@ -56,7 +56,7 @@ InstanceVariableSlot >> gtBrowseReferencesActionFor: anAction context: aPhlowCon aButton phlow spawnObject: aFilter ] ] -{ #category : #'*GToolkit-Coder-UI\t' } +{ #category : #'*GToolkit-Coder-UI' } InstanceVariableSlot >> gtCreateAccessorsActionFor: anAction context: aPhlowContext [ | aSelectedClass | @@ -91,7 +91,7 @@ InstanceVariableSlot >> gtCreateAccessorsActionFor: anAction context: aPhlowCont bePinnable: anExplicitMenu ] ] -{ #category : #'*GToolkit-Coder-UI\t' } +{ #category : #'*GToolkit-Coder-UI' } InstanceVariableSlot >> gtProtectSlotActionFor: anAction context: aPhlowContext [ | aSelectedClass | @@ -124,7 +124,7 @@ InstanceVariableSlot >> gtProtectSlotActionFor: anAction context: aPhlowContext bePinnable: anExplicitMenu ] ] -{ #category : #'*GToolkit-Coder-UI\t' } +{ #category : #'*GToolkit-Coder-UI' } InstanceVariableSlot >> gtPushDownActionFor: anAction context: aPhlowContext [ | aSelectedClass | @@ -159,7 +159,7 @@ InstanceVariableSlot >> gtPushDownActionFor: anAction context: aPhlowContext [ bePinnable: anExplicitMenu ] ] -{ #category : #'*GToolkit-Coder-UI\t' } +{ #category : #'*GToolkit-Coder-UI' } InstanceVariableSlot >> gtPushUpActionFor: anAction context: aPhlowContext [ | aSelectedClass | @@ -194,7 +194,7 @@ InstanceVariableSlot >> gtPushUpActionFor: anAction context: aPhlowContext [ bePinnable: anExplicitMenu ] ] -{ #category : #'*GToolkit-Coder-UI\t' } +{ #category : #'*GToolkit-Coder-UI' } InstanceVariableSlot >> gtRemoveActionFor: anAction context: aPhlowContext [ | aSelectedClass | @@ -257,7 +257,7 @@ InstanceVariableSlot >> gtRemoveActionFor: anAction context: aPhlowContext [ element ] ] -{ #category : #'*GToolkit-Coder-UI\t' } +{ #category : #'*GToolkit-Coder-UI' } InstanceVariableSlot >> gtRenameActionFor: anAction context: aPhlowContext [ | aSelectedClass | @@ -283,7 +283,7 @@ InstanceVariableSlot >> gtRenameActionFor: anAction context: aPhlowContext [ GtRenameInstanceVariableRefactoring rename: self name to: anInput - in: aSelectedClass ]; + in: aSelectedClass ]; afterAppliedBlock: [ anExplicitMenu hideAll ]; menuModel: anExplicitMenu; anchorElement: aTargetElement. From 2c69cf785b5d6fc9994095b021d782cf943f2058 Mon Sep 17 00:00:00 2001 From: John Brant Date: Thu, 9 Oct 2025 07:29:44 -0500 Subject: [PATCH 1104/1268] [feenkcom/gtoolkit#4769] change pharo diff to look inside strings and comments --- .../GtCharacterGroupDiffSplitter.class.st | 24 +++++++++--- .../GtPharoDiffSplitter.class.st | 25 ++++++++++++ .../GtSmaCCDiffSplitter.class.st | 39 +++++++++++++------ 3 files changed, 71 insertions(+), 17 deletions(-) create mode 100644 src/GToolkit-Coder/GtPharoDiffSplitter.class.st diff --git a/src/GToolkit-Coder/GtCharacterGroupDiffSplitter.class.st b/src/GToolkit-Coder/GtCharacterGroupDiffSplitter.class.st index 5df204913..aed70761d 100644 --- a/src/GToolkit-Coder/GtCharacterGroupDiffSplitter.class.st +++ b/src/GToolkit-Coder/GtCharacterGroupDiffSplitter.class.st @@ -61,19 +61,33 @@ GtCharacterGroupDiffSplitter >> printOn: aStream [ nextPut: $) ] +{ #category : #accessing } +GtCharacterGroupDiffSplitter >> split: aString from: start to: end into: aGtDiffSplits [ + | stream | + stream := ReadStream + on: aString + from: start + to: end. + self splitStream: stream into: aGtDiffSplits +] + { #category : #accessing } GtCharacterGroupDiffSplitter >> split: aString into: aGtDiffSplits [ - | stream start groupId nextGroupId | - stream := aString readStream. + self splitStream: aString readStream into: aGtDiffSplits +] + +{ #category : #accessing } +GtCharacterGroupDiffSplitter >> splitStream: stream into: aGtDiffSplits [ + | nextGroupId groupId start | + start := stream position + 1. groupId := 0. - start := 1. [ stream atEnd ] whileFalse: [ nextGroupId := self classify: stream next. nextGroupId ~= groupId ifTrue: [ groupId = 0 ifFalse: [ aGtDiffSplits addSplit: (GtRangeDiffSplit - on: aString + on: stream originalContents from: start to: stream position - 1) ]. start := stream position. @@ -81,7 +95,7 @@ GtCharacterGroupDiffSplitter >> split: aString into: aGtDiffSplits [ groupId > 0 ifTrue: [ aGtDiffSplits addSplit: (GtRangeDiffSplit - on: aString + on: stream originalContents from: start to: stream position) ] ] diff --git a/src/GToolkit-Coder/GtPharoDiffSplitter.class.st b/src/GToolkit-Coder/GtPharoDiffSplitter.class.st new file mode 100644 index 000000000..c4b879943 --- /dev/null +++ b/src/GToolkit-Coder/GtPharoDiffSplitter.class.st @@ -0,0 +1,25 @@ +Class { + #name : #GtPharoDiffSplitter, + #superclass : #GtSmaCCDiffSplitter, + #category : #'GToolkit-Coder-Diff-Algorithm' +} + +{ #category : #'as yet unclassified' } +GtPharoDiffSplitter >> createCommentSplitFrom: start to: stop into: aGtDiffSplits [ + GtCharacterGroupDiffSplitter words + split: string + from: start + to: stop + into: aGtDiffSplits +] + +{ #category : #'as yet unclassified' } +GtPharoDiffSplitter >> createTokenSplitFrom: aToken into: aGtDiffSplits [ + aToken value first = $' + ifFalse: [ ^ super createTokenSplitFrom: aToken into: aGtDiffSplits ]. + GtCharacterGroupDiffSplitter words + split: string + from: aToken startPosition + to: aToken stopPosition + into: aGtDiffSplits +] diff --git a/src/GToolkit-Coder/GtSmaCCDiffSplitter.class.st b/src/GToolkit-Coder/GtSmaCCDiffSplitter.class.st index eeec959d1..076329ec3 100644 --- a/src/GToolkit-Coder/GtSmaCCDiffSplitter.class.st +++ b/src/GToolkit-Coder/GtSmaCCDiffSplitter.class.st @@ -2,11 +2,30 @@ Class { #name : #GtSmaCCDiffSplitter, #superclass : #GtDiffSplitter, #instVars : [ - 'scannerClass' + 'scannerClass', + 'string' ], #category : #'GToolkit-Coder-Diff-Algorithm' } +{ #category : #accessing } +GtSmaCCDiffSplitter >> createCommentSplitFrom: start to: stop into: aGtDiffSplits [ + aGtDiffSplits + addSplit: (GtRangeDiffSplit + on: string + from: start + to: stop) +] + +{ #category : #accessing } +GtSmaCCDiffSplitter >> createTokenSplitFrom: aToken into: aGtDiffSplits [ + aGtDiffSplits + addSplit: (GtRangeDiffSplit + on: string + from: aToken startPosition + to: aToken stopPosition) +] + { #category : #'as yet unclassified' } GtSmaCCDiffSplitter >> descriptionString [ ^ 'using ' , self scannerClass asString @@ -35,20 +54,16 @@ GtSmaCCDiffSplitter >> scannerClass: aSmaCCScannerClass [ { #category : #accessing } GtSmaCCDiffSplitter >> split: aString into: aGtDiffSplits [ | scanner commentIndex token | - scanner := scannerClass on: aString readStream. + string := aString. + scanner := scannerClass on: string readStream. commentIndex := 0. [ token := scanner next. [ commentIndex < scanner comments size ] whileTrue: [ commentIndex := commentIndex + 1. - aGtDiffSplits - addSplit: (GtRangeDiffSplit - on: aString - from: (scanner comments at: commentIndex) first - to: (scanner comments at: commentIndex) last) ]. + self + createCommentSplitFrom: (scanner comments at: commentIndex) first + to: (scanner comments at: commentIndex) last + into: aGtDiffSplits ]. token ids first ~= scanner emptySymbolTokenId ] - whileTrue: [ aGtDiffSplits - addSplit: (GtRangeDiffSplit - on: aString - from: token startPosition - to: token stopPosition) ] + whileTrue: [ self createTokenSplitFrom: token into: aGtDiffSplits ] ] From c1f705d8531644530ca17d1c93e12ce02f969948 Mon Sep 17 00:00:00 2001 From: John Brant Date: Fri, 10 Oct 2025 11:12:39 -0500 Subject: [PATCH 1105/1268] [feenkcom/gtoolkit#4771] line highlighting on word/token diffs --- .../GtDiffBuilderExamples.class.st | 113 +++++++++++++++++ .../GtSyncScrollRangesExamples.class.st | 120 ++++++++++++++++++ .../GtSyncScrollRanges.class.st | 16 ++- .../GtCharacterGroupDiffSplitter.class.st | 1 + .../GtCompositeDiffChange.class.st | 16 ++- src/GToolkit-Coder/GtDiffBuilder.class.st | 11 +- src/GToolkit-Coder/GtDiffSplitter.class.st | 5 + .../GtLineDiffSplitter.class.st | 5 + 8 files changed, 276 insertions(+), 11 deletions(-) diff --git a/src/GToolkit-Coder-Examples/GtDiffBuilderExamples.class.st b/src/GToolkit-Coder-Examples/GtDiffBuilderExamples.class.st index 01df14cdd..9725cacc0 100644 --- a/src/GToolkit-Coder-Examples/GtDiffBuilderExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtDiffBuilderExamples.class.st @@ -45,6 +45,57 @@ GtDiffBuilderExamples >> changeInMiddleAndDeletionAtEnd [ ^ change ] +{ #category : #examples } +GtDiffBuilderExamples >> deletedLineChanges [ + + + | differences from to change | + to := self exampleMethod. + from := self exampleMethodWithAdditions. + change := GtDiffBuilder + computeDifferencesFrom: from + to: to + using: GtLineDiffSplitter new. + differences := change changes. + self assert: differences size equals: 4. + self assert: (differences allSatisfy: #isReplacement). + ^ change +] + +{ #category : #examples } +GtDiffBuilderExamples >> deletedPharoChanges [ + + + | differences from to change | + to := self exampleMethod. + from := self exampleMethodWithAdditions. + change := GtDiffBuilder + computeDifferencesFrom: from + to: to + using: GtSmaCCDiffSplitter forPharo. + differences := change changes. + self assert: differences size equals: 6. + self assert: (differences allSatisfy: #isDeletion). + ^ change +] + +{ #category : #examples } +GtDiffBuilderExamples >> deletedWordChanges [ + + + | differences from to change | + to := self exampleMethod. + from := self exampleMethodWithAdditions. + change := GtDiffBuilder + computeDifferencesFrom: from + to: to + using: GtCharacterGroupDiffSplitter words. + differences := change changes. + self assert: differences size equals: 6. + self assert: (differences allSatisfy: #isDeletion). + ^ change +] + { #category : #examples } GtDiffBuilderExamples >> deletionsAtBeginningExample [ @@ -103,6 +154,68 @@ GtDiffBuilderExamples >> deletionsInMiddle [ ^ change ] +{ #category : #examples } +GtDiffBuilderExamples >> exampleMethod [ + ^ '1 a.\2 a.\3 a.\4 a.\5 a.\6 a.\7 a.\8 a.\9 a.\10 a.' withCRs +] + +{ #category : #examples } +GtDiffBuilderExamples >> exampleMethodWithAdditions [ + ^ '1 a b.\2 a.\3 a.\4 a b.\5 a.\6 a b.\6.1 a.\7 b a.\8 a.\9 a.\10 a b.' + withCRs +] + +{ #category : #examples } +GtDiffBuilderExamples >> insertedLineChanges [ + + + | differences from to change | + from := self exampleMethod. + to := self exampleMethodWithAdditions. + change := GtDiffBuilder + computeDifferencesFrom: from + to: to + using: GtLineDiffSplitter new. + differences := change changes. + self assert: differences size equals: 4. + self assert: (differences allSatisfy: #isReplacement). + ^ change +] + +{ #category : #examples } +GtDiffBuilderExamples >> insertedPharoChanges [ + + + | differences from to change | + from := self exampleMethod. + to := self exampleMethodWithAdditions. + change := GtDiffBuilder + computeDifferencesFrom: from + to: to + using: GtSmaCCDiffSplitter forPharo. + differences := change changes. + self assert: differences size equals: 6. + self assert: (differences allSatisfy: #isInsertion). + ^ change +] + +{ #category : #examples } +GtDiffBuilderExamples >> insertedWordChanges [ + + + | differences from to change | + from := self exampleMethod. + to := self exampleMethodWithAdditions. + change := GtDiffBuilder + computeDifferencesFrom: from + to: to + using: GtCharacterGroupDiffSplitter words. + differences := change changes. + self assert: differences size equals: 6. + self assert: (differences allSatisfy: #isInsertion). + ^ change +] + { #category : #examples } GtDiffBuilderExamples >> insertionsAtBeginningExample [ diff --git a/src/GToolkit-Coder-Examples/GtSyncScrollRangesExamples.class.st b/src/GToolkit-Coder-Examples/GtSyncScrollRangesExamples.class.st index 3b4ceba0a..ac48e411e 100644 --- a/src/GToolkit-Coder-Examples/GtSyncScrollRangesExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtSyncScrollRangesExamples.class.st @@ -4,6 +4,66 @@ Class { #category : #'GToolkit-Coder-Examples-Diff' } +{ #category : #accessing } +GtSyncScrollRangesExamples >> deletedLineChanges [ + + + | diff ranges fromLines toLines changes | + diff := GtDiffBuilderExamples new deletedLineChanges. + ranges := GtSyncScrollRanges createFromChange: diff. + toLines := #(#(1 1) #(4 1) #(6 2) #(10 1)). + fromLines := #(#(1 1) #(4 1) #(6 3) #(11 1)). + changes := ranges ranges select: #isDifference. + self assert: changes size equals: fromLines size. + changes + doWithIndex: [ :each :i | + self assert: each leftFirst + 1 equals: (fromLines at: i) first. + self assert: each leftLast equals: each leftFirst + (fromLines at: i) last. + self assert: each rightFirst + 1 equals: (toLines at: i) first. + self assert: each rightLast equals: each rightFirst + (toLines at: i) last ]. + ^ ranges +] + +{ #category : #accessing } +GtSyncScrollRangesExamples >> deletedPharoChanges [ + + + | diff ranges fromLines toLines changes | + diff := GtDiffBuilderExamples new deletedPharoChanges. + ranges := GtSyncScrollRanges createFromChange: diff. + toLines := #(#(1 1) #(4 1) #(6 2) #(10 1)). + fromLines := #(#(1 1) #(4 1) #(6 3) #(11 1)). + changes := ranges ranges select: #isDifference. + self assert: changes size equals: fromLines size. + changes + doWithIndex: [ :each :i | + self assert: each leftFirst + 1 equals: (fromLines at: i) first. + self assert: each leftLast equals: each leftFirst + (fromLines at: i) last. + self assert: each rightFirst + 1 equals: (toLines at: i) first. + self assert: each rightLast equals: each rightFirst + (toLines at: i) last ]. + ^ ranges +] + +{ #category : #accessing } +GtSyncScrollRangesExamples >> deletedWordChanges [ + + + | diff ranges fromLines toLines changes | + diff := GtDiffBuilderExamples new deletedWordChanges. + ranges := GtSyncScrollRanges createFromChange: diff. + toLines := #(#(1 1) #(4 1) #(6 2) #(10 1)). + fromLines := #(#(1 1) #(4 1) #(6 3) #(11 1)). + changes := ranges ranges select: #isDifference. + self assert: changes size equals: fromLines size. + changes + doWithIndex: [ :each :i | + self assert: each leftFirst + 1 equals: (fromLines at: i) first. + self assert: each leftLast equals: each leftFirst + (fromLines at: i) last. + self assert: each rightFirst + 1 equals: (toLines at: i) first. + self assert: each rightLast equals: each rightFirst + (toLines at: i) last ]. + ^ ranges +] + { #category : #examples } GtSyncScrollRangesExamples >> diffWithEmptyLines [ @@ -36,6 +96,66 @@ GtSyncScrollRangesExamples >> exampleDiff [ using: GtCharacterGroupDiffSplitter words ] +{ #category : #accessing } +GtSyncScrollRangesExamples >> insertedLineChanges [ + + + | diff ranges fromLines toLines changes | + diff := GtDiffBuilderExamples new insertedLineChanges. + ranges := GtSyncScrollRanges createFromChange: diff. + fromLines := #(#(1 1) #(4 1) #(6 2) #(10 1)). + toLines := #(#(1 1) #(4 1) #(6 3) #(11 1)). + changes := ranges ranges select: #isDifference. + self assert: changes size equals: fromLines size. + changes + doWithIndex: [ :each :i | + self assert: each leftFirst + 1 equals: (fromLines at: i) first. + self assert: each leftLast equals: each leftFirst + (fromLines at: i) last. + self assert: each rightFirst + 1 equals: (toLines at: i) first. + self assert: each rightLast equals: each rightFirst + (toLines at: i) last ]. + ^ ranges +] + +{ #category : #accessing } +GtSyncScrollRangesExamples >> insertedPharoChanges [ + + + | diff ranges fromLines toLines changes | + diff := GtDiffBuilderExamples new insertedPharoChanges. + ranges := GtSyncScrollRanges createFromChange: diff. + fromLines := #(#(1 1) #(4 1) #(6 2) #(10 1)). + toLines := #(#(1 1) #(4 1) #(6 3) #(11 1)). + changes := ranges ranges select: #isDifference. + self assert: changes size equals: fromLines size. + changes + doWithIndex: [ :each :i | + self assert: each leftFirst + 1 equals: (fromLines at: i) first. + self assert: each leftLast equals: each leftFirst + (fromLines at: i) last. + self assert: each rightFirst + 1 equals: (toLines at: i) first. + self assert: each rightLast equals: each rightFirst + (toLines at: i) last ]. + ^ ranges +] + +{ #category : #accessing } +GtSyncScrollRangesExamples >> insertedWordChanges [ + + + | diff ranges fromLines toLines changes | + diff := GtDiffBuilderExamples new insertedWordChanges. + ranges := GtSyncScrollRanges createFromChange: diff. + fromLines := #(#(1 1) #(4 1) #(6 2) #(10 1)). + toLines := #(#(1 1) #(4 1) #(6 3) #(11 1)). + changes := ranges ranges select: #isDifference. + self assert: changes size equals: fromLines size. + changes + doWithIndex: [ :each :i | + self assert: each leftFirst + 1 equals: (fromLines at: i) first. + self assert: each leftLast equals: each leftFirst + (fromLines at: i) last. + self assert: each rightFirst + 1 equals: (toLines at: i) first. + self assert: each rightLast equals: each rightFirst + (toLines at: i) last ]. + ^ ranges +] + { #category : #examples } GtSyncScrollRangesExamples >> multilineCode [ diff --git a/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st b/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st index 3d4285b88..885b95f34 100644 --- a/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st +++ b/src/GToolkit-Coder-UI/GtSyncScrollRanges.class.st @@ -142,16 +142,22 @@ GtSyncScrollRanges >> advanceRight [ { #category : #'private-creation changes' } GtSyncScrollRanges >> buildFromChange: aCompositeChange [ - | changedLines changedRanges | + | changedLines changedRanges change | ranges := OrderedCollection new. changedLines := IdentityDictionary new. - aCompositeChange changes notEmpty - ifTrue: [ self addOriginalLineChangesFrom: aCompositeChange to: changedLines. - self addDestinationLineChangesFrom: aCompositeChange to: changedLines ]. + change := aCompositeChange isLineBased + ifTrue: [ aCompositeChange ] + ifFalse: [ GtDiffBuilder + computeDifferencesFrom: aCompositeChange from + to: aCompositeChange to + using: GtLineDiffSplitter ignoringEOLChars ]. + change changes notEmpty + ifTrue: [ self addOriginalLineChangesFrom: change to: changedLines. + self addDestinationLineChangesFrom: change to: changedLines ]. changedRanges := changedLines values asSortedCollection: [ :a :b | a first < b first or: [ a first = b first and: [ a third < b third ] ] ]. changedRanges := self mergeRanges: changedRanges. - self addRanges: changedRanges fromChanges: aCompositeChange + self addRanges: changedRanges fromChanges: change ] { #category : #'private-creation diff' } diff --git a/src/GToolkit-Coder/GtCharacterGroupDiffSplitter.class.st b/src/GToolkit-Coder/GtCharacterGroupDiffSplitter.class.st index aed70761d..0e75b8958 100644 --- a/src/GToolkit-Coder/GtCharacterGroupDiffSplitter.class.st +++ b/src/GToolkit-Coder/GtCharacterGroupDiffSplitter.class.st @@ -12,6 +12,7 @@ Class { GtCharacterGroupDiffSplitter class >> words [ ^ self new addGroup: #tokenish; + addGroup: #isLineBreak; addGroup: #isSeparator; yourself ] diff --git a/src/GToolkit-Coder/GtCompositeDiffChange.class.st b/src/GToolkit-Coder/GtCompositeDiffChange.class.st index a8db0b21f..b3c2a91ae 100644 --- a/src/GToolkit-Coder/GtCompositeDiffChange.class.st +++ b/src/GToolkit-Coder/GtCompositeDiffChange.class.st @@ -4,7 +4,8 @@ Class { #instVars : [ 'changes', 'from', - 'to' + 'to', + 'isLineBased' ], #category : #'GToolkit-Coder-Diff-Algorithm' } @@ -157,7 +158,8 @@ GtCompositeDiffChange >> gtTextView: aView [ { #category : #initialization } GtCompositeDiffChange >> initialize [ super initialize. - changes := #() + changes := #(). + isLineBased := false ] { #category : #iterating } @@ -165,6 +167,16 @@ GtCompositeDiffChange >> insertionChangesDo: aBlock [ changes do: [ :each | each insertionChangesDo: aBlock ] ] +{ #category : #accessing } +GtCompositeDiffChange >> isLineBased [ + ^ isLineBased +] + +{ #category : #accessing } +GtCompositeDiffChange >> isLineBased: aBoolean [ + isLineBased := aBoolean +] + { #category : #accessing } GtCompositeDiffChange >> to [ ^ to diff --git a/src/GToolkit-Coder/GtDiffBuilder.class.st b/src/GToolkit-Coder/GtDiffBuilder.class.st index 7811905a9..5fa514e03 100644 --- a/src/GToolkit-Coder/GtDiffBuilder.class.st +++ b/src/GToolkit-Coder/GtDiffBuilder.class.st @@ -122,14 +122,17 @@ GtDiffBuilder >> buildDifferencesList [ { #category : #computing } GtDiffBuilder >> computeDifferences [ + | change | self initializeSplits. self skipEqualElementsAtStart. self skipEqualElementsAtEnd. self buildDifferencesList. - ^ GtCompositeDiffChange - from: from - to: to - changes: differences + change := GtCompositeDiffChange + from: from + to: to + changes: differences. + change isLineBased: splitter isLineBased. + ^ change ] { #category : #private } diff --git a/src/GToolkit-Coder/GtDiffSplitter.class.st b/src/GToolkit-Coder/GtDiffSplitter.class.st index 2603af852..c1fc090f4 100644 --- a/src/GToolkit-Coder/GtDiffSplitter.class.st +++ b/src/GToolkit-Coder/GtDiffSplitter.class.st @@ -12,6 +12,11 @@ GtDiffSplitter >> descriptionString [ ^ self subclassResponsibility ] +{ #category : #testing } +GtDiffSplitter >> isLineBased [ + ^ false +] + { #category : #actions } GtDiffSplitter >> split: aCollection [ | splits | diff --git a/src/GToolkit-Coder/GtLineDiffSplitter.class.st b/src/GToolkit-Coder/GtLineDiffSplitter.class.st index be90a1dfa..128377026 100644 --- a/src/GToolkit-Coder/GtLineDiffSplitter.class.st +++ b/src/GToolkit-Coder/GtLineDiffSplitter.class.st @@ -35,6 +35,11 @@ GtLineDiffSplitter >> initialize [ includeEOLChars := true ] +{ #category : #testing } +GtLineDiffSplitter >> isLineBased [ + ^ true +] + { #category : #actions } GtLineDiffSplitter >> split: aString into: aGtDiffSplits [ aString From 157a31988c2e3820101564592e537cb0517c3b90 Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Sun, 12 Oct 2025 19:54:01 +0200 Subject: [PATCH 1106/1268] move class llm extension to the llm package feenkcom/gtoolkit#4759 --- src/GToolkit-Coder-UI/Class.extension.st | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/src/GToolkit-Coder-UI/Class.extension.st b/src/GToolkit-Coder-UI/Class.extension.st index 4175cbe05..87de91793 100644 --- a/src/GToolkit-Coder-UI/Class.extension.st +++ b/src/GToolkit-Coder-UI/Class.extension.st @@ -101,27 +101,6 @@ Class >> gtCoderSidebarIndexCopyClassNameFor: anAction [ action: [ Clipboard clipboardText: self name ] ] -{ #category : #'*GToolkit-Coder-UI' } -Class >> gtCoderSidebarIndexLlmChatFor: anAction [ - - | chat | - GtLlmFeatures isEnabledInCoder ifFalse: [ ^ anAction noAction ]. - GtLlmConnectionRegistry instance hasConnectableDefaultConnection - ifFalse: [ ^ anAction noAction ]. - - ^ anAction button - priority: 20; - target: GtCoderClassTarget; - icon: BrGlamorousVectorIcons chat; - label: ('Chat about this {1}' format: {self gtCoderTypeName}); - menuItemPreview: self name; - menuItemGroup: BrMenuItemGroupConfiguration default; - action: [ :aButton | - aButton phlow - spawnObject: (chat ifNil: [ - chat := GtLlmClassAssistant new chatOn: self instanceSide ]) ] -] - { #category : #'*GToolkit-Coder-UI' } Class >> gtCoderSidebarIndexNewSubclassFor: anAction [ From 89774b96b62a89e2a683c93110787fa610a43da2 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 13 Oct 2025 10:04:23 -0300 Subject: [PATCH 1107/1268] rename `GtCoderObject` to `GtPhlowObject` [feenkcom/gtoolkit#4776] Similarly for other related classes and traits. Define some new slot phlow actions. --- src/GToolkit-Coder-UI/Class.extension.st | 3 +- .../InstanceVariableSlot.extension.st | 50 ++++++++++++++ .../TGtCoderWithSelfObjectHolder.trait.st | 6 +- src/GToolkit-Coder/GtCoderObject.class.st | 59 ++-------------- .../GtCoderUndefinedObject.class.st | 32 ++------- src/GToolkit-Coder/TGtCoderObject.trait.st | 16 ++--- .../TGtCoderWithBehaviorHolder.trait.st | 67 ++---------------- .../TGtCoderWithObjectHolder.trait.st | 61 ++--------------- src/GToolkit-Coder/TGtPhlowObject.trait.st | 17 +++++ .../TGtPhlowWithBehaviorHolder.trait.st | 68 +++++++++++++++++++ .../TGtPhlowWithObjectHolder.trait.st | 62 +++++++++++++++++ 11 files changed, 230 insertions(+), 211 deletions(-) create mode 100644 src/GToolkit-Coder/TGtPhlowObject.trait.st create mode 100644 src/GToolkit-Coder/TGtPhlowWithBehaviorHolder.trait.st create mode 100644 src/GToolkit-Coder/TGtPhlowWithObjectHolder.trait.st diff --git a/src/GToolkit-Coder-UI/Class.extension.st b/src/GToolkit-Coder-UI/Class.extension.st index 4175cbe05..59c8f910e 100644 --- a/src/GToolkit-Coder-UI/Class.extension.st +++ b/src/GToolkit-Coder-UI/Class.extension.st @@ -50,7 +50,8 @@ Class >> gtCoderSidebarIndexBrowseClassFor: anAction [ menuItemPreview: self name; menuItemGroup: BrMenuItemGroupConfiguration navigation; action: [ :aButton | aButton phlow spawnObject: self instanceSide ]; - primaryModifierAction: [ :aButton | self gtBrowseFrom: aButton ] + primaryModifierAction: [ :aButton | + aButton phlow spawnTool: (GtClassCoderTool forClass: self) ] ] { #category : #'*GToolkit-Coder-UI' } diff --git a/src/GToolkit-Coder-UI/InstanceVariableSlot.extension.st b/src/GToolkit-Coder-UI/InstanceVariableSlot.extension.st index f4e538d1c..af515a343 100644 --- a/src/GToolkit-Coder-UI/InstanceVariableSlot.extension.st +++ b/src/GToolkit-Coder-UI/InstanceVariableSlot.extension.st @@ -35,6 +35,40 @@ InstanceVariableSlot >> gtAbstractActionFor: anAction context: aPhlowContext [ bePinnable: anExplicitMenu ] ] +{ #category : #'*GToolkit-Coder-UI' } +InstanceVariableSlot >> gtBrowseDefiningClassFor: anAction context: aPhlowContext [ + + self definingClass = self owningClass ifTrue: [ ^ anAction noAction ]. + + ^ anAction button + label: ('Browse defining {1}' format: {self definingClass gtCoderTypeName}); + priority: 15; + target: GtCoderVariableTarget; + menuItemPreview: [ self definingClass name ]; + menuItemGroup: BrMenuItemGroupConfiguration navigation; + action: [ :aButton | aButton phlow spawnObject: self definingClass ]; + primaryModifierAction: [ :aButton | self definingClass gtBrowseFrom: aButton ] +] + +{ #category : #'*GToolkit-Coder-UI' } +InstanceVariableSlot >> gtBrowseDefiningSuperclassFor: anAction context: aPhlowContext [ + + self definingClass = self owningClass ifFalse: [ ^ anAction noAction ]. + aPhlowContext + ifBehavior: [ :aBehavior | + aBehavior = self owningClass ifTrue: [ ^ anAction noAction ] ] + ifNone: [ ^ anAction noAction ]. + + ^ anAction button + label: 'Browse defining superclass'; + priority: 12; + target: GtCoderVariableTarget; + menuItemPreview: [ self owningClass name ]; + menuItemGroup: BrMenuItemGroupConfiguration navigation; + action: [ :aButton | aButton phlow spawnObject: self owningClass ]; + primaryModifierAction: [ :aButton | self owningClass gtBrowseFrom: aButton ] +] + { #category : #'*GToolkit-Coder-UI' } InstanceVariableSlot >> gtBrowseReferencesActionFor: anAction context: aPhlowContext [ @@ -91,6 +125,22 @@ InstanceVariableSlot >> gtCreateAccessorsActionFor: anAction context: aPhlowCont bePinnable: anExplicitMenu ] ] +{ #category : #'*GToolkit-Coder-UI' } +InstanceVariableSlot >> gtInspectObjectActionFor: anAction context: aPhlowContext [ + + | aSelfObject | + aSelfObject := aPhlowContext selfObjectIfNone: [ ^ anAction noAction ]. + + ^ anAction button + label: 'Inspect object'; + priority: 30; + target: GtCoderVariableTarget; + menuItemPreview: [ (aSelfObject readSlot: self) gtDisplayText ]; + menuItemGroup: BrMenuItemGroupConfiguration navigation; + action: [ :aButton | + aButton phlow spawnObject: (aSelfObject readSlot: self) ] +] + { #category : #'*GToolkit-Coder-UI' } InstanceVariableSlot >> gtProtectSlotActionFor: anAction context: aPhlowContext [ diff --git a/src/GToolkit-Coder-UI/TGtCoderWithSelfObjectHolder.trait.st b/src/GToolkit-Coder-UI/TGtCoderWithSelfObjectHolder.trait.st index 14e1746e0..07e8d130b 100644 --- a/src/GToolkit-Coder-UI/TGtCoderWithSelfObjectHolder.trait.st +++ b/src/GToolkit-Coder-UI/TGtCoderWithSelfObjectHolder.trait.st @@ -36,14 +36,14 @@ TGtCoderWithSelfObjectHolder >> selfObject [ TGtCoderWithSelfObjectHolder >> selfObject: anObject [ "Assign an object that should be bound to `self` during code evaluation" - self selfObjectHolder: (GtCoderObject forValue: anObject) + self selfObjectHolder: (GtPhlowObject forValue: anObject) ] { #category : #'api - self object' } TGtCoderWithSelfObjectHolder >> selfObjectHolder [ - + ^ selfObjectHolder ifNil: [ - selfObjectHolder := GtCoderUndefinedObject default ] + selfObjectHolder := GtPhlowUndefinedObject default ] ] { #category : #'api - self object' } diff --git a/src/GToolkit-Coder/GtCoderObject.class.st b/src/GToolkit-Coder/GtCoderObject.class.st index 132b30149..9d264db3c 100644 --- a/src/GToolkit-Coder/GtCoderObject.class.st +++ b/src/GToolkit-Coder/GtCoderObject.class.st @@ -1,61 +1,12 @@ -" -I am a basic value holder, identifying an existing value. -Users can use {{gtMethod:GtCoderObject>>#ifDefined:ifNone:}} to distinguish between defined and undefined values. - -" Class { #name : #GtCoderObject, - #superclass : #Object, - #traits : 'TGtCoderObject', - #classTraits : 'TGtCoderObject classTrait', - #instVars : [ - 'value' - ], + #superclass : #GtPhlowObject, #category : #'GToolkit-Coder-Object Holder' } -{ #category : #'instance creation' } -GtCoderObject class >> forValue: anObject [ - ^ self new value: anObject -] - -{ #category : #comparing } -GtCoderObject >> = anObject [ - self == anObject ifTrue: [ ^ true ]. - - ^ self class = anObject class and: [ self value = anObject value ] -] - -{ #category : #printing } -GtCoderObject >> gtDisplayOn: aStream [ - self value gtDisplayOn: aStream -] - -{ #category : #comparing } -GtCoderObject >> hash [ - ^ self value hash -] - -{ #category : #'api - accessing' } -GtCoderObject >> ifDefined: definedBlock ifNone: noneBlock [ - ^ definedBlock cull: value -] - -{ #category : #printing } -GtCoderObject >> printOn: aStream [ - super printOn: aStream. - aStream - nextPut: $(; - print: value; - nextPut: $) -] - -{ #category : #accessing } -GtCoderObject >> value [ - ^ value -] +{ #category : #testing } +GtCoderObject class >> isDeprecated [ + "Use my superclass" -{ #category : #accessing } -GtCoderObject >> value: anObject [ - value := anObject + ^ true ] diff --git a/src/GToolkit-Coder/GtCoderUndefinedObject.class.st b/src/GToolkit-Coder/GtCoderUndefinedObject.class.st index b7f03124b..e540739ca 100644 --- a/src/GToolkit-Coder/GtCoderUndefinedObject.class.st +++ b/src/GToolkit-Coder/GtCoderUndefinedObject.class.st @@ -1,34 +1,12 @@ -" -I am a basic value holder, identifying that a value does not exist. -Users can use {{gtMethod:GtCoderUndefinedObject>>#ifDefined:ifNone:}} to distinguish between defined and undefined values. - -" Class { #name : #GtCoderUndefinedObject, - #superclass : #Object, - #traits : 'TGtCoderObject + TGtUniqueInstance', - #classTraits : 'TGtCoderObject classTrait + TGtUniqueInstance classTrait', - #classInstVars : [ - 'uniqueInstance' - ], + #superclass : #GtPhlowUndefinedObject, #category : #'GToolkit-Coder-Object Holder' } -{ #category : #printing } -GtCoderUndefinedObject >> gtDisplayOn: aStream [ - aStream nextPutAll: 'Missing object' -] - -{ #category : #'api - accessing' } -GtCoderUndefinedObject >> ifDefined: definedBlock ifNone: noneBlock [ - ^ noneBlock value -] +{ #category : #testing } +GtCoderUndefinedObject class >> isDeprecated [ + "Use my superclass" -{ #category : #printing } -GtCoderUndefinedObject >> printOn: aStream [ - super printOn: aStream. - aStream - nextPut: $(; - nextPutAll: 'Missing object'; - nextPut: $) + ^ true ] diff --git a/src/GToolkit-Coder/TGtCoderObject.trait.st b/src/GToolkit-Coder/TGtCoderObject.trait.st index 88b4b5494..f838e3490 100644 --- a/src/GToolkit-Coder/TGtCoderObject.trait.st +++ b/src/GToolkit-Coder/TGtCoderObject.trait.st @@ -1,17 +1,13 @@ -" -I define common API for object holders. -See my users for more details: {{gtClass:TGtCoderObject | show= #gtUsersFor: | expanded=true}}. -" Trait { #name : #TGtCoderObject, + #traits : 'TGtPhlowObject', + #classTraits : 'TGtPhlowObject classTrait', #category : #'GToolkit-Coder-Object Holder' } -{ #category : #'api - accessing' } -TGtCoderObject >> ifDefined: definedBlock ifNone: noneBlock [ - "Evaluate definedBlock if a self-object is defined, - passing the object as an argument: [ :aSelfObject | ]. - Evaluate noneBlock if the self-object is not defined." +{ #category : #testing } +TGtCoderObject classSide >> isDeprecated [ + "Use my Trait" - ^ self explicitRequirement + ^ true ] diff --git a/src/GToolkit-Coder/TGtCoderWithBehaviorHolder.trait.st b/src/GToolkit-Coder/TGtCoderWithBehaviorHolder.trait.st index a22db5311..c5cc1c98d 100644 --- a/src/GToolkit-Coder/TGtCoderWithBehaviorHolder.trait.st +++ b/src/GToolkit-Coder/TGtCoderWithBehaviorHolder.trait.st @@ -1,68 +1,13 @@ Trait { #name : #TGtCoderWithBehaviorHolder, - #instVars : [ - 'behaviorHolder' - ], + #traits : 'TGtPhlowWithBehaviorHolder', + #classTraits : 'TGtPhlowWithBehaviorHolder classTrait', #category : #'GToolkit-Coder-Object Holder' } -{ #category : #'api - object' } -TGtCoderWithBehaviorHolder >> behavior [ - "Return an assigned object. - Favor using #ifBehavior:ifNone: to distinguish between defined - behaviors and UndeclaredVariable." +{ #category : #testing } +TGtCoderWithBehaviorHolder classSide >> isDeprecated [ + "Use my Trait instead" - ^ self behaviorHolder ifDefined: [ :anObject | anObject ] ifNone: [ UndeclaredVariable ] -] - -{ #category : #'api - object' } -TGtCoderWithBehaviorHolder >> behavior: aBehavior [ - "Assign a behavior" - - self - assert: [ (aBehavior = nil) not ] - description: [ 'Behavior must be non-nil' ]. - - self behaviorHolder: (GtCoderObject forValue: aBehavior) -] - -{ #category : #'api - object' } -TGtCoderWithBehaviorHolder >> behaviorHolder [ - - ^ behaviorHolder ifNil: [ - behaviorHolder := GtCoderUndefinedObject default ] -] - -{ #category : #'api - object' } -TGtCoderWithBehaviorHolder >> behaviorHolder: aTGtCoderObject [ - self - assert: [ aTGtCoderObject isNotNil ] - description: [ 'behavior holder must not be nil.' ]. - - self behaviorHolder = aTGtCoderObject ifTrue: [ ^ self ]. - - behaviorHolder := aTGtCoderObject. - self onBehaviorHolderChanged -] - -{ #category : #'api - object' } -TGtCoderWithBehaviorHolder >> behaviorIfNone: noneBlock [ - ^ self ifBehavior: [ :anObject | anObject ] ifNone: noneBlock -] - -{ #category : #'api - object' } -TGtCoderWithBehaviorHolder >> hasBehavior [ - ^ self ifBehavior: [ :aBehavior | true ] ifNone: [ false ] -] - -{ #category : #'api - object' } -TGtCoderWithBehaviorHolder >> ifBehavior: definedBlock ifNone: noneBlock [ - ^ self behaviorHolder ifDefined: definedBlock ifNone: noneBlock -] - -{ #category : #'api - object' } -TGtCoderWithBehaviorHolder >> onBehaviorHolderChanged [ - "Trait users can perform other actions using this hook." - - + ^ true ] diff --git a/src/GToolkit-Coder/TGtCoderWithObjectHolder.trait.st b/src/GToolkit-Coder/TGtCoderWithObjectHolder.trait.st index ed68ddf08..017740364 100644 --- a/src/GToolkit-Coder/TGtCoderWithObjectHolder.trait.st +++ b/src/GToolkit-Coder/TGtCoderWithObjectHolder.trait.st @@ -1,62 +1,13 @@ Trait { #name : #TGtCoderWithObjectHolder, - #instVars : [ - 'objectHolder' - ], + #traits : 'TGtPhlowWithObjectHolder', + #classTraits : 'TGtPhlowWithObjectHolder classTrait', #category : #'GToolkit-Coder-Object Holder' } -{ #category : #'api - object' } -TGtCoderWithObjectHolder >> hasObject [ - ^ self ifObject: [ :anObject | true ] ifNone: [ false ] -] - -{ #category : #'api - object' } -TGtCoderWithObjectHolder >> ifObject: definedBlock ifNone: noneBlock [ - ^ self objectHolder ifDefined: definedBlock ifNone: noneBlock -] - -{ #category : #'api - object' } -TGtCoderWithObjectHolder >> object [ - "Return an assigned object. - Favor using #ifObject:ifNone: to distinguish between defined - objects and nil values." - - ^ self objectHolder ifDefined: [ :anObject | anObject ] ifNone: [ nil ] -] - -{ #category : #'api - object' } -TGtCoderWithObjectHolder >> object: anObject [ - self objectHolder: (GtCoderObject forValue: anObject) -] - -{ #category : #'api - object' } -TGtCoderWithObjectHolder >> objectHolder [ - - ^ objectHolder ifNil: [ - objectHolder := GtCoderUndefinedObject default ] -] - -{ #category : #'api - object' } -TGtCoderWithObjectHolder >> objectHolder: aTGtCoderObject [ - self - assert: [ aTGtCoderObject isNotNil ] - description: [ 'object holder must not be nil.' ]. - - self objectHolder = aTGtCoderObject ifTrue: [ ^ self ]. - - objectHolder := aTGtCoderObject. - self onObjectHolderChanged -] - -{ #category : #'api - object' } -TGtCoderWithObjectHolder >> objectIfNone: noneBlock [ - ^ self ifObject: [ :anObject | anObject ] ifNone: noneBlock -] - -{ #category : #'api - object' } -TGtCoderWithObjectHolder >> onObjectHolderChanged [ - "Trait users can perform other actions using this hook." +{ #category : #testing } +TGtCoderWithObjectHolder classSide >> isDeprecated [ + "Use my Trait instead" - + ^ true ] diff --git a/src/GToolkit-Coder/TGtPhlowObject.trait.st b/src/GToolkit-Coder/TGtPhlowObject.trait.st new file mode 100644 index 000000000..2447c32cf --- /dev/null +++ b/src/GToolkit-Coder/TGtPhlowObject.trait.st @@ -0,0 +1,17 @@ +" +I define common API for object holders. +See my users for more details: {{gtClass:TGtCoderObject | show= #gtUsersFor: | expanded=true}}. +" +Trait { + #name : #TGtPhlowObject, + #category : #'GToolkit-Phlow-Object Holder' +} + +{ #category : #'api - accessing' } +TGtPhlowObject >> ifDefined: definedBlock ifNone: noneBlock [ + "Evaluate definedBlock if a self-object is defined, + passing the object as an argument: [ :aSelfObject | ]. + Evaluate noneBlock if the self-object is not defined." + + ^ self explicitRequirement +] diff --git a/src/GToolkit-Coder/TGtPhlowWithBehaviorHolder.trait.st b/src/GToolkit-Coder/TGtPhlowWithBehaviorHolder.trait.st new file mode 100644 index 000000000..290d3a41f --- /dev/null +++ b/src/GToolkit-Coder/TGtPhlowWithBehaviorHolder.trait.st @@ -0,0 +1,68 @@ +Trait { + #name : #TGtPhlowWithBehaviorHolder, + #instVars : [ + 'behaviorHolder' + ], + #category : #'GToolkit-Phlow-Object Holder' +} + +{ #category : #'api - object' } +TGtPhlowWithBehaviorHolder >> behavior [ + "Return an assigned object. + Favor using #ifBehavior:ifNone: to distinguish between defined + behaviors and UndeclaredVariable." + + ^ self behaviorHolder ifDefined: [ :anObject | anObject ] ifNone: [ UndeclaredVariable ] +] + +{ #category : #'api - object' } +TGtPhlowWithBehaviorHolder >> behavior: aBehavior [ + "Assign a behavior" + + self + assert: [ (aBehavior = nil) not ] + description: [ 'Behavior must be non-nil' ]. + + self behaviorHolder: (GtPhlowObject forValue: aBehavior) +] + +{ #category : #'api - object' } +TGtPhlowWithBehaviorHolder >> behaviorHolder [ + + ^ behaviorHolder ifNil: [ + behaviorHolder := GtPhlowUndefinedObject default ] +] + +{ #category : #'api - object' } +TGtPhlowWithBehaviorHolder >> behaviorHolder: aTGtCoderObject [ + self + assert: [ aTGtCoderObject isNotNil ] + description: [ 'behavior holder must not be nil.' ]. + + self behaviorHolder = aTGtCoderObject ifTrue: [ ^ self ]. + + behaviorHolder := aTGtCoderObject. + self onBehaviorHolderChanged +] + +{ #category : #'api - object' } +TGtPhlowWithBehaviorHolder >> behaviorIfNone: noneBlock [ + ^ self ifBehavior: [ :anObject | anObject ] ifNone: noneBlock +] + +{ #category : #'api - object' } +TGtPhlowWithBehaviorHolder >> hasBehavior [ + ^ self ifBehavior: [ :aBehavior | true ] ifNone: [ false ] +] + +{ #category : #'api - object' } +TGtPhlowWithBehaviorHolder >> ifBehavior: definedBlock ifNone: noneBlock [ + ^ self behaviorHolder ifDefined: definedBlock ifNone: noneBlock +] + +{ #category : #'api - object' } +TGtPhlowWithBehaviorHolder >> onBehaviorHolderChanged [ + "Trait users can perform other actions using this hook." + + +] diff --git a/src/GToolkit-Coder/TGtPhlowWithObjectHolder.trait.st b/src/GToolkit-Coder/TGtPhlowWithObjectHolder.trait.st new file mode 100644 index 000000000..518162cb3 --- /dev/null +++ b/src/GToolkit-Coder/TGtPhlowWithObjectHolder.trait.st @@ -0,0 +1,62 @@ +Trait { + #name : #TGtPhlowWithObjectHolder, + #instVars : [ + 'objectHolder' + ], + #category : #'GToolkit-Phlow-Object Holder' +} + +{ #category : #'api - object' } +TGtPhlowWithObjectHolder >> hasObject [ + ^ self ifObject: [ :anObject | true ] ifNone: [ false ] +] + +{ #category : #'api - object' } +TGtPhlowWithObjectHolder >> ifObject: definedBlock ifNone: noneBlock [ + ^ self objectHolder ifDefined: definedBlock ifNone: noneBlock +] + +{ #category : #'api - object' } +TGtPhlowWithObjectHolder >> object [ + "Return an assigned object. + Favor using #ifObject:ifNone: to distinguish between defined + objects and nil values." + + ^ self objectHolder ifDefined: [ :anObject | anObject ] ifNone: [ nil ] +] + +{ #category : #'api - object' } +TGtPhlowWithObjectHolder >> object: anObject [ + self objectHolder: (GtPhlowObject forValue: anObject) +] + +{ #category : #'api - object' } +TGtPhlowWithObjectHolder >> objectHolder [ + + ^ objectHolder ifNil: [ + objectHolder := GtPhlowUndefinedObject default ] +] + +{ #category : #'api - object' } +TGtPhlowWithObjectHolder >> objectHolder: aTGtCoderObject [ + self + assert: [ aTGtCoderObject isNotNil ] + description: [ 'object holder must not be nil.' ]. + + self objectHolder = aTGtCoderObject ifTrue: [ ^ self ]. + + objectHolder := aTGtCoderObject. + self onObjectHolderChanged +] + +{ #category : #'api - object' } +TGtPhlowWithObjectHolder >> objectIfNone: noneBlock [ + ^ self ifObject: [ :anObject | anObject ] ifNone: noneBlock +] + +{ #category : #'api - object' } +TGtPhlowWithObjectHolder >> onObjectHolderChanged [ + "Trait users can perform other actions using this hook." + + +] From 29c0e1c5e31f4278cadfc94bf116ef044ac78b00 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 13 Oct 2025 10:59:55 -0300 Subject: [PATCH 1108/1268] remove classes defined in `gtoolkit-phlow` repository [feenkcom/gtoolkit#4776] --- src/GToolkit-Coder/TGtPhlowObject.trait.st | 17 ----- .../TGtPhlowWithBehaviorHolder.trait.st | 68 ------------------- .../TGtPhlowWithObjectHolder.trait.st | 62 ----------------- 3 files changed, 147 deletions(-) delete mode 100644 src/GToolkit-Coder/TGtPhlowObject.trait.st delete mode 100644 src/GToolkit-Coder/TGtPhlowWithBehaviorHolder.trait.st delete mode 100644 src/GToolkit-Coder/TGtPhlowWithObjectHolder.trait.st diff --git a/src/GToolkit-Coder/TGtPhlowObject.trait.st b/src/GToolkit-Coder/TGtPhlowObject.trait.st deleted file mode 100644 index 2447c32cf..000000000 --- a/src/GToolkit-Coder/TGtPhlowObject.trait.st +++ /dev/null @@ -1,17 +0,0 @@ -" -I define common API for object holders. -See my users for more details: {{gtClass:TGtCoderObject | show= #gtUsersFor: | expanded=true}}. -" -Trait { - #name : #TGtPhlowObject, - #category : #'GToolkit-Phlow-Object Holder' -} - -{ #category : #'api - accessing' } -TGtPhlowObject >> ifDefined: definedBlock ifNone: noneBlock [ - "Evaluate definedBlock if a self-object is defined, - passing the object as an argument: [ :aSelfObject | ]. - Evaluate noneBlock if the self-object is not defined." - - ^ self explicitRequirement -] diff --git a/src/GToolkit-Coder/TGtPhlowWithBehaviorHolder.trait.st b/src/GToolkit-Coder/TGtPhlowWithBehaviorHolder.trait.st deleted file mode 100644 index 290d3a41f..000000000 --- a/src/GToolkit-Coder/TGtPhlowWithBehaviorHolder.trait.st +++ /dev/null @@ -1,68 +0,0 @@ -Trait { - #name : #TGtPhlowWithBehaviorHolder, - #instVars : [ - 'behaviorHolder' - ], - #category : #'GToolkit-Phlow-Object Holder' -} - -{ #category : #'api - object' } -TGtPhlowWithBehaviorHolder >> behavior [ - "Return an assigned object. - Favor using #ifBehavior:ifNone: to distinguish between defined - behaviors and UndeclaredVariable." - - ^ self behaviorHolder ifDefined: [ :anObject | anObject ] ifNone: [ UndeclaredVariable ] -] - -{ #category : #'api - object' } -TGtPhlowWithBehaviorHolder >> behavior: aBehavior [ - "Assign a behavior" - - self - assert: [ (aBehavior = nil) not ] - description: [ 'Behavior must be non-nil' ]. - - self behaviorHolder: (GtPhlowObject forValue: aBehavior) -] - -{ #category : #'api - object' } -TGtPhlowWithBehaviorHolder >> behaviorHolder [ - - ^ behaviorHolder ifNil: [ - behaviorHolder := GtPhlowUndefinedObject default ] -] - -{ #category : #'api - object' } -TGtPhlowWithBehaviorHolder >> behaviorHolder: aTGtCoderObject [ - self - assert: [ aTGtCoderObject isNotNil ] - description: [ 'behavior holder must not be nil.' ]. - - self behaviorHolder = aTGtCoderObject ifTrue: [ ^ self ]. - - behaviorHolder := aTGtCoderObject. - self onBehaviorHolderChanged -] - -{ #category : #'api - object' } -TGtPhlowWithBehaviorHolder >> behaviorIfNone: noneBlock [ - ^ self ifBehavior: [ :anObject | anObject ] ifNone: noneBlock -] - -{ #category : #'api - object' } -TGtPhlowWithBehaviorHolder >> hasBehavior [ - ^ self ifBehavior: [ :aBehavior | true ] ifNone: [ false ] -] - -{ #category : #'api - object' } -TGtPhlowWithBehaviorHolder >> ifBehavior: definedBlock ifNone: noneBlock [ - ^ self behaviorHolder ifDefined: definedBlock ifNone: noneBlock -] - -{ #category : #'api - object' } -TGtPhlowWithBehaviorHolder >> onBehaviorHolderChanged [ - "Trait users can perform other actions using this hook." - - -] diff --git a/src/GToolkit-Coder/TGtPhlowWithObjectHolder.trait.st b/src/GToolkit-Coder/TGtPhlowWithObjectHolder.trait.st deleted file mode 100644 index 518162cb3..000000000 --- a/src/GToolkit-Coder/TGtPhlowWithObjectHolder.trait.st +++ /dev/null @@ -1,62 +0,0 @@ -Trait { - #name : #TGtPhlowWithObjectHolder, - #instVars : [ - 'objectHolder' - ], - #category : #'GToolkit-Phlow-Object Holder' -} - -{ #category : #'api - object' } -TGtPhlowWithObjectHolder >> hasObject [ - ^ self ifObject: [ :anObject | true ] ifNone: [ false ] -] - -{ #category : #'api - object' } -TGtPhlowWithObjectHolder >> ifObject: definedBlock ifNone: noneBlock [ - ^ self objectHolder ifDefined: definedBlock ifNone: noneBlock -] - -{ #category : #'api - object' } -TGtPhlowWithObjectHolder >> object [ - "Return an assigned object. - Favor using #ifObject:ifNone: to distinguish between defined - objects and nil values." - - ^ self objectHolder ifDefined: [ :anObject | anObject ] ifNone: [ nil ] -] - -{ #category : #'api - object' } -TGtPhlowWithObjectHolder >> object: anObject [ - self objectHolder: (GtPhlowObject forValue: anObject) -] - -{ #category : #'api - object' } -TGtPhlowWithObjectHolder >> objectHolder [ - - ^ objectHolder ifNil: [ - objectHolder := GtPhlowUndefinedObject default ] -] - -{ #category : #'api - object' } -TGtPhlowWithObjectHolder >> objectHolder: aTGtCoderObject [ - self - assert: [ aTGtCoderObject isNotNil ] - description: [ 'object holder must not be nil.' ]. - - self objectHolder = aTGtCoderObject ifTrue: [ ^ self ]. - - objectHolder := aTGtCoderObject. - self onObjectHolderChanged -] - -{ #category : #'api - object' } -TGtPhlowWithObjectHolder >> objectIfNone: noneBlock [ - ^ self ifObject: [ :anObject | anObject ] ifNone: noneBlock -] - -{ #category : #'api - object' } -TGtPhlowWithObjectHolder >> onObjectHolderChanged [ - "Trait users can perform other actions using this hook." - - -] From b23111609b042b5068a46a5a1de79b446e11f280 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 13 Oct 2025 11:18:45 -0300 Subject: [PATCH 1109/1268] deprecate `TGtCoderWithSelfObjectHolder` [feenkcom/gtoolkit#4776] --- .../TGtCoderWithSelfObjectHolder.trait.st | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/GToolkit-Coder-UI/TGtCoderWithSelfObjectHolder.trait.st b/src/GToolkit-Coder-UI/TGtCoderWithSelfObjectHolder.trait.st index 07e8d130b..a31546861 100644 --- a/src/GToolkit-Coder-UI/TGtCoderWithSelfObjectHolder.trait.st +++ b/src/GToolkit-Coder-UI/TGtCoderWithSelfObjectHolder.trait.st @@ -6,6 +6,13 @@ Trait { #category : #'GToolkit-Coder-UI-Coder - Basic' } +{ #category : #testing } +TGtCoderWithSelfObjectHolder classSide >> isDeprecated [ + "Use my TGtPhlowWithSelfObjectHolder instead" + + ^ true +] + { #category : #'api - self object' } TGtCoderWithSelfObjectHolder >> hasSelfObject [ ^ self ifSelfObject: [ :anObject | true ] ifNone: [ false ] From 67affdc238a6bedf65cc59ffb94d7e699749e076 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 13 Oct 2025 11:42:11 -0300 Subject: [PATCH 1110/1268] pass behavior and self object in the behavior coder [feenkcom/gtoolkit#4776] --- .../GtCoderSlotsGroupedListElement.class.st | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st index 901b0c8e8..cfb52b4e4 100644 --- a/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderSlotsGroupedListElement.class.st @@ -47,7 +47,12 @@ GtCoderSlotsGroupedListElement >> createSlotGroups [ addAptitude: (BrGlamorousWithExplicitContextMenuAptitude menu: [ | aPhlowContext | aPhlowContext := GtPhlowContext new - coderSelectedClass: self selectedClass. + coderSelectedClass: self selectedClass; + behavior: self selectedClass. + navigationModel + coderDo: [ :aCoder | + (aCoder isKindOf: GtPharoBehaviorCoder) + ifTrue: [ aPhlowContext selfObjectHolder: aCoder objectHolder ] ]. GtCoderVariableTarget menuItemsForObject: item inContext: aPhlowContext From 3da26a3ca38b3e0acfb4c695d851eacc4d829075 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 14 Oct 2025 07:59:25 -0300 Subject: [PATCH 1111/1268] Browse owning class slot action [feenkcom/gtoolkit#4776] --- .../InstanceVariableSlot.extension.st | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/GToolkit-Coder-UI/InstanceVariableSlot.extension.st b/src/GToolkit-Coder-UI/InstanceVariableSlot.extension.st index af515a343..862bffc95 100644 --- a/src/GToolkit-Coder-UI/InstanceVariableSlot.extension.st +++ b/src/GToolkit-Coder-UI/InstanceVariableSlot.extension.st @@ -51,17 +51,18 @@ InstanceVariableSlot >> gtBrowseDefiningClassFor: anAction context: aPhlowContex ] { #category : #'*GToolkit-Coder-UI' } -InstanceVariableSlot >> gtBrowseDefiningSuperclassFor: anAction context: aPhlowContext [ +InstanceVariableSlot >> gtBrowseOwningClassFor: anAction context: aPhlowContext [ + | aHostBehavior | self definingClass = self owningClass ifFalse: [ ^ anAction noAction ]. - aPhlowContext - ifBehavior: [ :aBehavior | - aBehavior = self owningClass ifTrue: [ ^ anAction noAction ] ] - ifNone: [ ^ anAction noAction ]. + aHostBehavior := aPhlowContext behaviorIfNone: [ ^ self owningClass ]. ^ anAction button - label: 'Browse defining superclass'; - priority: 12; + label: ('Browse defining {1}' + format: {aHostBehavior = self owningClass + ifTrue: [ 'class' ] + ifFalse: [ 'superclass' ]}); + priority: 5; target: GtCoderVariableTarget; menuItemPreview: [ self owningClass name ]; menuItemGroup: BrMenuItemGroupConfiguration navigation; From df1089bf272aae22148ae110be8b837877580cec Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 14 Oct 2025 06:54:04 -0500 Subject: [PATCH 1112/1268] fixing command-browse class to open in tab --- src/GToolkit-Coder-UI/Class.extension.st | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/Class.extension.st b/src/GToolkit-Coder-UI/Class.extension.st index 1df1fb1e0..87de91793 100644 --- a/src/GToolkit-Coder-UI/Class.extension.st +++ b/src/GToolkit-Coder-UI/Class.extension.st @@ -50,8 +50,7 @@ Class >> gtCoderSidebarIndexBrowseClassFor: anAction [ menuItemPreview: self name; menuItemGroup: BrMenuItemGroupConfiguration navigation; action: [ :aButton | aButton phlow spawnObject: self instanceSide ]; - primaryModifierAction: [ :aButton | - aButton phlow spawnTool: (GtClassCoderTool forClass: self) ] + primaryModifierAction: [ :aButton | self gtBrowseFrom: aButton ] ] { #category : #'*GToolkit-Coder-UI' } From b4d7fec4a5a5aded33843014afe6216ffb927929 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 14 Oct 2025 09:04:38 -0300 Subject: [PATCH 1113/1268] Improve defining and owning class/trait context menu item definitions [feenkcom/gtoolkit#4776] --- .../InstanceVariableSlot.extension.st | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/GToolkit-Coder-UI/InstanceVariableSlot.extension.st b/src/GToolkit-Coder-UI/InstanceVariableSlot.extension.st index 862bffc95..7395439f9 100644 --- a/src/GToolkit-Coder-UI/InstanceVariableSlot.extension.st +++ b/src/GToolkit-Coder-UI/InstanceVariableSlot.extension.st @@ -42,7 +42,7 @@ InstanceVariableSlot >> gtBrowseDefiningClassFor: anAction context: aPhlowContex ^ anAction button label: ('Browse defining {1}' format: {self definingClass gtCoderTypeName}); - priority: 15; + priority: 6; target: GtCoderVariableTarget; menuItemPreview: [ self definingClass name ]; menuItemGroup: BrMenuItemGroupConfiguration navigation; @@ -53,15 +53,9 @@ InstanceVariableSlot >> gtBrowseDefiningClassFor: anAction context: aPhlowContex { #category : #'*GToolkit-Coder-UI' } InstanceVariableSlot >> gtBrowseOwningClassFor: anAction context: aPhlowContext [ - | aHostBehavior | - self definingClass = self owningClass ifFalse: [ ^ anAction noAction ]. - aHostBehavior := aPhlowContext behaviorIfNone: [ ^ self owningClass ]. ^ anAction button - label: ('Browse defining {1}' - format: {aHostBehavior = self owningClass - ifTrue: [ 'class' ] - ifFalse: [ 'superclass' ]}); + label: 'Browse defining class'; priority: 5; target: GtCoderVariableTarget; menuItemPreview: [ self owningClass name ]; From 35b31d90422d0fe6a69492f6959cf9f3fcd361f4 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 14 Oct 2025 09:05:18 -0300 Subject: [PATCH 1114/1268] fix protocol name --- .../GtPhlowContext.extension.st | 24 +++++++++++++++++++ .../GtPhlowContext.extension.st | 14 +++-------- 2 files changed, 27 insertions(+), 11 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtPhlowContext.extension.st diff --git a/src/GToolkit-Coder-UI/GtPhlowContext.extension.st b/src/GToolkit-Coder-UI/GtPhlowContext.extension.st new file mode 100644 index 000000000..76513f2ea --- /dev/null +++ b/src/GToolkit-Coder-UI/GtPhlowContext.extension.st @@ -0,0 +1,24 @@ +Extension { #name : #GtPhlowContext } + +{ #category : #'*GToolkit-Coder-UI' } +GtPhlowContext >> coderSelectedClass: aClass [ + ^ self optionAt: #coderSelectedClass put: aClass +] + +{ #category : #'*GToolkit-Coder-UI' } +GtPhlowContext >> coderSelectedClassIfPresent: aPresentBlock ifAbsent: anAbsentBlock [ + ^ self + optionAt: #coderSelectedClass + ifPresent: aPresentBlock + ifAbsent: anAbsentBlock +] + +{ #category : #'*GToolkit-Coder-UI' } +GtPhlowContext >> coderSelectedClasses [ + ^ self optionAt: #coderSelectedClasses ifAbsent: [ #() ] +] + +{ #category : #'*GToolkit-Coder-UI' } +GtPhlowContext >> coderSelectedClasses: aCollectionOfClasses [ + ^ self optionAt: #coderSelectedClasses put: aCollectionOfClasses +] diff --git a/src/GToolkit-Coder/GtPhlowContext.extension.st b/src/GToolkit-Coder/GtPhlowContext.extension.st index 8575debf8..f57bdbc2c 100644 --- a/src/GToolkit-Coder/GtPhlowContext.extension.st +++ b/src/GToolkit-Coder/GtPhlowContext.extension.st @@ -1,24 +1,16 @@ Extension { #name : #GtPhlowContext } -{ #category : #'*GToolkit-Coder-UI\t' } +{ #category : #'*GToolkit-Coder-UI' } GtPhlowContext >> coderSelectedClass: aClass [ ^ self optionAt: #coderSelectedClass put: aClass ] -{ #category : #'*GToolkit-Coder-UI\t' } -GtPhlowContext >> coderSelectedClassIfPresent: aPresentBlock ifAbsent: anAbsentBlock [ - ^ self - optionAt: #coderSelectedClass - ifPresent: aPresentBlock - ifAbsent: anAbsentBlock -] - -{ #category : #'*GToolkit-Coder-UI\t' } +{ #category : #'*GToolkit-Coder-UI' } GtPhlowContext >> coderSelectedClasses [ ^ self optionAt: #coderSelectedClasses ifAbsent: [ #() ] ] -{ #category : #'*GToolkit-Coder-UI\t' } +{ #category : #'*GToolkit-Coder-UI' } GtPhlowContext >> coderSelectedClasses: aCollectionOfClasses [ ^ self optionAt: #coderSelectedClasses put: aCollectionOfClasses ] From 7d66d572308084afc9439abcde90aba025f0266c Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 14 Oct 2025 09:14:11 -0300 Subject: [PATCH 1115/1268] remove duplicated `GtPhlowContext` extentions --- src/GToolkit-Coder/GtPhlowContext.extension.st | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/GToolkit-Coder/GtPhlowContext.extension.st b/src/GToolkit-Coder/GtPhlowContext.extension.st index f57bdbc2c..34240c73c 100644 --- a/src/GToolkit-Coder/GtPhlowContext.extension.st +++ b/src/GToolkit-Coder/GtPhlowContext.extension.st @@ -1,20 +1,5 @@ Extension { #name : #GtPhlowContext } -{ #category : #'*GToolkit-Coder-UI' } -GtPhlowContext >> coderSelectedClass: aClass [ - ^ self optionAt: #coderSelectedClass put: aClass -] - -{ #category : #'*GToolkit-Coder-UI' } -GtPhlowContext >> coderSelectedClasses [ - ^ self optionAt: #coderSelectedClasses ifAbsent: [ #() ] -] - -{ #category : #'*GToolkit-Coder-UI' } -GtPhlowContext >> coderSelectedClasses: aCollectionOfClasses [ - ^ self optionAt: #coderSelectedClasses put: aCollectionOfClasses -] - { #category : #'*GToolkit-Coder' } GtPhlowContext >> hasPackageCoder [ ^ self hasOptionAt: #packageCoder From e1f902e3265a75c98fc34f1296e71392e4cc3d3c Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 14 Oct 2025 07:56:55 -0500 Subject: [PATCH 1116/1268] [feenkcom/gtoolkit#4534] scroll to compilation error --- src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 5aa1c5d0c..0eedb1393 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -25,7 +25,8 @@ GtTextualCoderEditorElement >> addErrorAttribute: errorAttribute at: anInteger [ text attribute: errorAttribute from: position - to: position + to: position. + self scrollToPosition: (text asString lineNumberCorrespondingToIndex: position) ] { #category : #'hooks - children' } From 3db27e088f92032058483b35780cbec53a8a074b Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 16 Oct 2025 19:20:14 -0300 Subject: [PATCH 1117/1268] add coder related phlow context extensions [feenkcom/gtoolkit#4789] --- .../Behavior.extension.st | 2 +- src/GToolkit-Coder-UI/Class.extension.st | 23 ++++++++++++++ .../GtPhlowContext.extension.st | 30 +++++++++++++++++-- .../GtSingleCoderViewModel.class.st | 5 ++++ 4 files changed, 57 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-Extensions/Behavior.extension.st b/src/GToolkit-Coder-Extensions/Behavior.extension.st index 3e64b2231..5a83d5cce 100644 --- a/src/GToolkit-Coder-Extensions/Behavior.extension.st +++ b/src/GToolkit-Coder-Extensions/Behavior.extension.st @@ -14,7 +14,7 @@ Behavior >> gtBrowse [ Behavior >> gtBrowseFrom: anElement [ ^ BlSpace new withSceneDriller; - inPager: [ GtClassCoderTool forClass: self ]; + inPager: [ self gtDefaultInspectorTool ]; title: self name; icon: BrGlamorousVectorIcons browse; showFrom: anElement diff --git a/src/GToolkit-Coder-UI/Class.extension.st b/src/GToolkit-Coder-UI/Class.extension.st index 87de91793..4384e4552 100644 --- a/src/GToolkit-Coder-UI/Class.extension.st +++ b/src/GToolkit-Coder-UI/Class.extension.st @@ -75,6 +75,29 @@ Class >> gtCoderSidebarIndexBrowseClassesReferencesFor: anAction context: aPhlow aButton phlow spawnObject: aFilter ] ] +{ #category : #'*GToolkit-Coder-UI' } +Class >> gtCoderSidebarIndexBrowseDefiningClassFor: anAction context: aPhlowContext [ + + | aCompiledMethod | + aCompiledMethod := aPhlowContext + coderCompiledMethodIfPresent: [ :theCompiledMethod | aCompiledMethod := theCompiledMethod ] + ifAbsent: [ nil ]. + aCompiledMethod ifNil: [ ^ anAction noAction ]. + aCompiledMethod methodClass = self ifTrue: [ ^ anAction noAction ]. + + ^ anAction button + priority: 2; + target: GtCoderClassTarget; + icon: BrGlamorousVectorIcons browse; + label: ('Browse defining {1}' format: {aCompiledMethod methodClass gtCoderTypeName}); + menuItemPreview: aCompiledMethod methodClass name; + menuItemGroup: BrMenuItemGroupConfiguration navigation; + action: [ :aButton | + aButton phlow spawnTool: (GtMethodCoderTool compiledMethod: aCompiledMethod) ]; + primaryModifierAction: [ :aButton | + aCompiledMethod gtBrowseFrom: aButton ] +] + { #category : #'*GToolkit-Coder-UI' } Class >> gtCoderSidebarIndexBrowseReferencesFor: anAction [ diff --git a/src/GToolkit-Coder-UI/GtPhlowContext.extension.st b/src/GToolkit-Coder-UI/GtPhlowContext.extension.st index 76513f2ea..66d75b8ad 100644 --- a/src/GToolkit-Coder-UI/GtPhlowContext.extension.st +++ b/src/GToolkit-Coder-UI/GtPhlowContext.extension.st @@ -1,8 +1,21 @@ Extension { #name : #GtPhlowContext } +{ #category : #'*GToolkit-Coder-UI' } +GtPhlowContext >> coderCompiledMethod: aClass [ + self optionAt: #coderCompiledMethod put: aClass +] + +{ #category : #'*GToolkit-Coder-UI' } +GtPhlowContext >> coderCompiledMethodIfPresent: aPresentBlock ifAbsent: anAbsentBlock [ + ^ self + optionAt: #coderCompiledMethod + ifPresent: aPresentBlock + ifAbsent: anAbsentBlock +] + { #category : #'*GToolkit-Coder-UI' } GtPhlowContext >> coderSelectedClass: aClass [ - ^ self optionAt: #coderSelectedClass put: aClass + self optionAt: #coderSelectedClass put: aClass ] { #category : #'*GToolkit-Coder-UI' } @@ -20,5 +33,18 @@ GtPhlowContext >> coderSelectedClasses [ { #category : #'*GToolkit-Coder-UI' } GtPhlowContext >> coderSelectedClasses: aCollectionOfClasses [ - ^ self optionAt: #coderSelectedClasses put: aCollectionOfClasses + self optionAt: #coderSelectedClasses put: aCollectionOfClasses +] + +{ #category : #'*GToolkit-Coder-UI' } +GtPhlowContext >> coderViewModel: aCoderViewModel [ + self optionAt: #coderViewModel: put: aCoderViewModel +] + +{ #category : #'*GToolkit-Coder-UI' } +GtPhlowContext >> coderViewModelIfPresent: aPresentBlock ifAbsent: anAbsentBlock [ + ^ self + optionAt: #coderViewModel + ifPresent: aPresentBlock + ifAbsent: anAbsentBlock ] diff --git a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st index fb34cae34..fb5c28bea 100644 --- a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st @@ -172,6 +172,11 @@ GtSingleCoderViewModel >> computeAddOnsFuture [ ^ self subclassResponsibility ] +{ #category : #converting } +GtSingleCoderViewModel >> createPhlowContext [ + ^ GtPhlowContext new coderViewModel: self +] + { #category : #accessing } GtSingleCoderViewModel >> elementClass [ ^ self subclassResponsibility From 2f6bfda1e1451db6cc4019150bb0fa87ee568cbf Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 17 Oct 2025 23:47:40 -0300 Subject: [PATCH 1118/1268] call `anExplicitMenu hideAll` in a UI process [feenkcom/gtoolkit#4761] --- src/GToolkit-Coder-UI/Class.extension.st | 13 ++--- .../ClassVariable.extension.st | 12 ++-- .../GtCoderClassesTreeElement.class.st | 9 +-- .../GtCoderMethodsGroupedListElement.class.st | 56 ++++++++++--------- .../GtCoderPackagesTreeElement.class.st | 7 +-- ...tCoderProtocolsGroupedListElement.class.st | 2 +- .../InstanceVariableSlot.extension.st | 14 ++--- 7 files changed, 54 insertions(+), 59 deletions(-) diff --git a/src/GToolkit-Coder-UI/Class.extension.st b/src/GToolkit-Coder-UI/Class.extension.st index 4384e4552..24c1d32e7 100644 --- a/src/GToolkit-Coder-UI/Class.extension.st +++ b/src/GToolkit-Coder-UI/Class.extension.st @@ -203,7 +203,7 @@ Class >> gtCoderSidebarIndexRemoveClassesFor: anAction context: aPhlowContext [ { #category : #'*GToolkit-Coder-UI' } Class >> gtCoderSidebarIndexRenameClassFor: anAction [ - ^ anAction dropdown + ^ anAction dropdown priority: 4; target: GtCoderClassTarget; icon: BrGlamorousVectorIcons empty; @@ -215,16 +215,13 @@ Class >> gtCoderSidebarIndexRenameClassFor: anAction [ aViewModel := GtRefactoringsWithInputViewModel new refactoringTitle: ('Rename {1}' format: {self gtCoderTypeName}); targetName: self name; - inputLabel: ('New {1} name:' format: { self gtCoderTypeName }); + inputLabel: ('New {1} name:' format: {self gtCoderTypeName}); initialText: self name; - refactoringWithInput: [ :anInput | - GtRBRenameClassRefactoring - rename: self name - to: anInput ]; - afterAppliedBlock: [ anExplicitMenu hideAll ]; + refactoringWithInput: [ :anInput | GtRBRenameClassRefactoring rename: self name to: anInput ]; + afterAppliedBlock: [ BlTaskAction enqueueElement: self action: [ anExplicitMenu hideAll ] ]; menuModel: anExplicitMenu; anchorElement: self. - GtRefactoringsPreviewWithInputElement new + GtRefactoringsPreviewWithInputElement new refactoringsViewModel: aViewModel; beContextMenuElement; bePinnable: anExplicitMenu ] diff --git a/src/GToolkit-Coder-UI/ClassVariable.extension.st b/src/GToolkit-Coder-UI/ClassVariable.extension.st index f0c4e20ba..f10099ee2 100644 --- a/src/GToolkit-Coder-UI/ClassVariable.extension.st +++ b/src/GToolkit-Coder-UI/ClassVariable.extension.st @@ -44,7 +44,7 @@ ClassVariable >> gtCreateAccessorsActionFor: anAction context: aPhlowContext [ variable: self name class: aSelectedClass classVariable: true ]; - afterAppliedBlock: [ anExplicitMenu hideAll ]; + afterAppliedBlock: [ BlTaskAction enqueueElement: aTargetElement action: [ anExplicitMenu hideAll ] ]; menuModel: anExplicitMenu; anchorElement: aTargetElement. GtRefactoringsPreviewWithConfirmationElement new @@ -76,10 +76,8 @@ ClassVariable >> gtPushDownActionFor: anAction context: aPhlowContext [ format: {aSelectedClass name. self name}); confirmationLabel: ('Push down {1}' format: {self name}); - refactoringWithConfirmation: [ RBPushDownClassVariableRefactoring - variable: self name - class: aSelectedClass ]; - afterAppliedBlock: [ anExplicitMenu hideAll ]; + refactoringWithConfirmation: [ RBPushDownClassVariableRefactoring variable: self name class: aSelectedClass ]; + afterAppliedBlock: [ BlTaskAction enqueueElement: aTargetElement action: [ anExplicitMenu hideAll ] ]; menuModel: anExplicitMenu; anchorElement: aTargetElement. GtRefactoringsPreviewWithConfirmationElement new @@ -114,7 +112,7 @@ ClassVariable >> gtPushUpActionFor: anAction context: aPhlowContext [ refactoringWithConfirmation: [ RBPullUpClassVariableRefactoring variable: self name class: aSelectedClass superclass ]; - afterAppliedBlock: [ anExplicitMenu hideAll ]; + afterAppliedBlock: [ BlTaskAction enqueueElement: aTargetElement action: [ anExplicitMenu hideAll ] ]; menuModel: anExplicitMenu; anchorElement: aTargetElement. GtRefactoringsPreviewWithConfirmationElement new @@ -213,7 +211,7 @@ ClassVariable >> gtRenameActionFor: anAction context: aPhlowContext [ rename: self name to: anInput in: self owningClass ]; - afterAppliedBlock: [ anExplicitMenu hideAll ]; + afterAppliedBlock: [ BlTaskAction enqueueElement: aTargetElement action: [ anExplicitMenu hideAll ] ]; menuModel: anExplicitMenu; anchorElement: aTargetElement. GtRefactoringsPreviewWithInputElement new diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index acc89dfca..826936157 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -310,14 +310,11 @@ GtCoderClassesTreeElement >> renameClassSubmenuFor: aClass [ targetName: aClass name; inputLabel: 'New class name:'; initialText: aClass name; - refactoringWithInput: [ :anInput | - GtRBRenameClassRefactoring - rename: aClass name - to: anInput ]; - afterAppliedBlock: [ anExplicitMenu hideAll ]; + refactoringWithInput: [ :anInput | GtRBRenameClassRefactoring rename: aClass name to: anInput ]; + afterAppliedBlock: [ BlTaskAction enqueueElement: self action: [ anExplicitMenu hideAll ] ]; menuModel: anExplicitMenu; anchorElement: self. - GtRefactoringsPreviewWithInputElement new + GtRefactoringsPreviewWithInputElement new refactoringsViewModel: aViewModel; beContextMenuElement; bePinnable: anExplicitMenu ]. diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index e9525d0b3..7a2cc4830 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -366,27 +366,29 @@ GtCoderMethodsGroupedListElement >> onMethodsToShowChanged: anAnnouncement [ GtCoderMethodsGroupedListElement >> pushDownMethodSubmenuFor: aMethod [ | submenu | submenu := BrMenuExplicit new. - + submenu stencil: [ :anExplicitMenu | | aViewModel | aViewModel := GtRefactoringsWithConfirmationViewModel new refactoringTitle: 'Push down'; - targetName: ('{1}>>#{2}' format: { aMethod methodClass. aMethod selector }); - confirmationLabel: ('Push down {1}' format: { aMethod selector }); + targetName: ('{1}>>#{2}' + format: {aMethod methodClass. + aMethod selector}); + confirmationLabel: ('Push down {1}' format: {aMethod selector}); refactoringWithConfirmation: [ GtRBPushDownMethodRefactoring - pushDown: {aMethod selector} - from: (self - forPharo12AndNewer: [ aMethod methodClass name ] - forPharo11: [ aMethod methodClass ]) ]; - afterAppliedBlock: [ anExplicitMenu hideAll ]; + pushDown: {aMethod selector} + from: (self + forPharo12AndNewer: [ aMethod methodClass name ] + forPharo11: [ aMethod methodClass ]) ]; + afterAppliedBlock: [ BlTaskAction enqueueElement: self action: [ anExplicitMenu hideAll ] ]; menuModel: anExplicitMenu; anchorElement: self. - GtRefactoringsPreviewWithConfirmationElement new + GtRefactoringsPreviewWithConfirmationElement new refactoringsViewModel: aViewModel; beContextMenuElement; bePinnable: anExplicitMenu ]. - + ^ submenu ] @@ -417,7 +419,7 @@ GtCoderMethodsGroupedListElement >> pushDownSeveralMethodsSubmenuFor: aCollectio as: Array. aModel name: ('Push down {1} methods' format: {aCollectionOfMethods size}). aCollectionOfRefactorings ]; - afterAppliedBlock: [ anExplicitMenu hideAll ]; + afterAppliedBlock: [ BlTaskAction enqueueElement: self action: [ anExplicitMenu hideAll ] ]; menuModel: anExplicitMenu; anchorElement: self. GtRefactoringsPreviewWithConfirmationElement new @@ -432,25 +434,25 @@ GtCoderMethodsGroupedListElement >> pushDownSeveralMethodsSubmenuFor: aCollectio GtCoderMethodsGroupedListElement >> pushUpMethodSubmenuFor: aMethod [ | submenu | submenu := BrMenuExplicit new. - + submenu stencil: [ :anExplicitMenu | | aViewModel | aViewModel := GtRefactoringsWithConfirmationViewModel new refactoringTitle: 'Push up'; - targetName: ('{1}>>#{2}' format: { aMethod methodClass. aMethod selector }); - confirmationLabel: ('Push up {1}' format: { aMethod selector }); - refactoringWithConfirmation: [ GtPushUpMethodRefactoring - pullUp: {aMethod selector} - from: aMethod methodClass ]; - afterAppliedBlock: [ anExplicitMenu hideAll ]; + targetName: ('{1}>>#{2}' + format: {aMethod methodClass. + aMethod selector}); + confirmationLabel: ('Push up {1}' format: {aMethod selector}); + refactoringWithConfirmation: [ GtPushUpMethodRefactoring pullUp: {aMethod selector} from: aMethod methodClass ]; + afterAppliedBlock: [ BlTaskAction enqueueElement: self action: [ anExplicitMenu hideAll ] ]; menuModel: anExplicitMenu; anchorElement: self. - GtRefactoringsPreviewWithConfirmationElement new + GtRefactoringsPreviewWithConfirmationElement new refactoringsViewModel: aViewModel; beContextMenuElement; bePinnable: anExplicitMenu ]. - + ^ submenu ] @@ -479,7 +481,7 @@ GtCoderMethodsGroupedListElement >> pushUpSeveralMethodsSubmenuFor: aCollectionO as: Array. aModel name: ('Push up {1} methods' format: {aCollectionOfMethods size}). aCollectionOfRefactorings ]; - afterAppliedBlock: [ anExplicitMenu hideAll ]; + afterAppliedBlock: [ BlTaskAction enqueueElement: self action: [ anExplicitMenu hideAll ] ]; menuModel: anExplicitMenu; anchorElement: self. GtRefactoringsPreviewWithConfirmationElement new @@ -605,13 +607,15 @@ GtCoderMethodsGroupedListElement >> removeSeveralMethodsSubmenuFor: aCollectionO GtCoderMethodsGroupedListElement >> renameMethodSubmenuFor: aMethod [ | submenu | submenu := BrMenuExplicit new. - + submenu stencil: [ :anExplicitMenu | | aViewModel | aViewModel := GtRefactoringsWithInputViewModel new refactoringTitle: 'Rename method'; - targetName: ('{1}>>#{2}' format: { aMethod methodClass. aMethod selector }); + targetName: ('{1}>>#{2}' + format: {aMethod methodClass. + aMethod selector}); inputLabel: 'New method name:'; initialText: aMethod selector; refactoringWithInput: [ :anInput | @@ -620,14 +624,14 @@ GtCoderMethodsGroupedListElement >> renameMethodSubmenuFor: aMethod [ in: aMethod methodClass to: anInput permutation: (1 to: aMethod selector numArgs) ]; - afterAppliedBlock: [ anExplicitMenu hideAll ]; + afterAppliedBlock: [ BlTaskAction enqueueElement: self action: [ anExplicitMenu hideAll ] ]; menuModel: anExplicitMenu; anchorElement: self. - GtRefactoringsPreviewWithInputElement new + GtRefactoringsPreviewWithInputElement new refactoringsViewModel: aViewModel; beContextMenuElement; bePinnable: anExplicitMenu ]. - + ^ submenu ] diff --git a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st index a47f4b3a3..21a4da5f0 100644 --- a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st @@ -351,9 +351,8 @@ GtCoderPackagesTreeElement >> renamePackageSubmenuFor: aPackage [ targetName: aPackage name; inputLabel: 'New package name:'; initialText: aPackage name; - refactoringWithInput: [ :anInput | - GtRBRenamePackageRefactoring from: aPackage name to: anInput ]; - afterAppliedBlock: [ anExplicitMenu hideAll ]; + refactoringWithInput: [ :anInput | GtRBRenamePackageRefactoring from: aPackage name to: anInput ]; + afterAppliedBlock: [ BlTaskAction enqueueElement: self action: [ anExplicitMenu hideAll ] ]; menuModel: anExplicitMenu; anchorElement: self. GtRefactoringsPreviewWithInputElement new @@ -379,7 +378,7 @@ GtCoderPackagesTreeElement >> renamePackageTagSubmenuFor: aPackageTag [ packageName: aPackageTag packageName from: aPackageTag name to: anInput ]; - afterAppliedBlock: [ anExplicitMenu hideAll ]; + afterAppliedBlock: [ BlTaskAction enqueueElement: self action: [ anExplicitMenu hideAll ] ]; menuModel: anExplicitMenu; anchorElement: self. GtRefactoringsPreviewWithInputElement new diff --git a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st index c95d43c5b..bf846c8e5 100644 --- a/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderProtocolsGroupedListElement.class.st @@ -389,7 +389,7 @@ GtCoderProtocolsGroupedListElement >> renameProtocolSubmenuFor: aGtPharoProtocol renameProtocol: aGtPharoProtocol name in: aGtPharoProtocol protocolClass to: anInput ]; - afterAppliedBlock: [ anExplicitMenu hideAll ]; + afterAppliedBlock: [ BlTaskAction enqueueElement: self action: [ anExplicitMenu hideAll ] ]; menuModel: anExplicitMenu; anchorElement: self. GtRefactoringsPreviewWithInputElement new diff --git a/src/GToolkit-Coder-UI/InstanceVariableSlot.extension.st b/src/GToolkit-Coder-UI/InstanceVariableSlot.extension.st index 7395439f9..c6b4c9db5 100644 --- a/src/GToolkit-Coder-UI/InstanceVariableSlot.extension.st +++ b/src/GToolkit-Coder-UI/InstanceVariableSlot.extension.st @@ -26,7 +26,7 @@ InstanceVariableSlot >> gtAbstractActionFor: anAction context: aPhlowContext [ refactoringWithConfirmation: [ RBAbstractInstanceVariableRefactoring variable: self name class: aSelectedClass ]; - afterAppliedBlock: [ anExplicitMenu hideAll ]; + afterAppliedBlock: [ BlTaskAction enqueueElement: aTargetElement action: [ anExplicitMenu hideAll ] ]; menuModel: anExplicitMenu; anchorElement: aTargetElement. GtRefactoringsPreviewWithConfirmationElement new @@ -111,7 +111,7 @@ InstanceVariableSlot >> gtCreateAccessorsActionFor: anAction context: aPhlowCont refactoringWithConfirmation: [ RBCreateAccessorsForVariableRefactoring instanceVariable: self name class: aSelectedClass ]; - afterAppliedBlock: [ anExplicitMenu hideAll ]; + afterAppliedBlock: [ BlTaskAction enqueueElement: aTargetElement action: [ anExplicitMenu hideAll ] ]; menuModel: anExplicitMenu; anchorElement: aTargetElement. GtRefactoringsPreviewWithConfirmationElement new @@ -160,7 +160,7 @@ InstanceVariableSlot >> gtProtectSlotActionFor: anAction context: aPhlowContext self name}); confirmationLabel: ('Protect {1}' format: {self name}); refactoringWithConfirmation: [ RBProtectInstanceVariableRefactoring variable: self name class: aSelectedClass ]; - afterAppliedBlock: [ anExplicitMenu hideAll ]; + afterAppliedBlock: [ BlTaskAction enqueueElement: aTargetElement action: [ anExplicitMenu hideAll ] ]; menuModel: anExplicitMenu; anchorElement: aTargetElement. GtRefactoringsPreviewWithConfirmationElement new @@ -195,7 +195,7 @@ InstanceVariableSlot >> gtPushDownActionFor: anAction context: aPhlowContext [ refactoringWithConfirmation: [ GtPushDownInstanceVariableRefactoring variable: self name class: aSelectedClass ]; - afterAppliedBlock: [ anExplicitMenu hideAll ]; + afterAppliedBlock: [ BlTaskAction enqueueElement: aTargetElement action: [ anExplicitMenu hideAll ] ]; menuModel: anExplicitMenu; anchorElement: aTargetElement. GtRefactoringsPreviewWithConfirmationElement new @@ -230,7 +230,7 @@ InstanceVariableSlot >> gtPushUpActionFor: anAction context: aPhlowContext [ refactoringWithConfirmation: [ RBPullUpInstanceVariableRefactoring variable: self name class: aSelectedClass superclass ]; - afterAppliedBlock: [ anExplicitMenu hideAll ]; + afterAppliedBlock: [ BlTaskAction enqueueElement: aTargetElement action: [ anExplicitMenu hideAll ] ]; menuModel: anExplicitMenu; anchorElement: aTargetElement. GtRefactoringsPreviewWithConfirmationElement new @@ -328,8 +328,8 @@ InstanceVariableSlot >> gtRenameActionFor: anAction context: aPhlowContext [ GtRenameInstanceVariableRefactoring rename: self name to: anInput - in: aSelectedClass ]; - afterAppliedBlock: [ anExplicitMenu hideAll ]; + in: aSelectedClass ]; + afterAppliedBlock: [ BlTaskAction enqueueElement: aTargetElement action: [ anExplicitMenu hideAll ] ]; menuModel: anExplicitMenu; anchorElement: aTargetElement. GtRefactoringsPreviewWithInputElement new From 9e7463f63e3a45184f05c79ecd30dc8ba4db11b1 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Sat, 18 Oct 2025 00:38:47 -0300 Subject: [PATCH 1119/1268] fix `#anchorElement:` arguments [feenkcom/gtoolkit#4761] --- src/GToolkit-Coder-UI/Class.extension.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/Class.extension.st b/src/GToolkit-Coder-UI/Class.extension.st index 24c1d32e7..aab34b2a0 100644 --- a/src/GToolkit-Coder-UI/Class.extension.st +++ b/src/GToolkit-Coder-UI/Class.extension.st @@ -218,9 +218,9 @@ Class >> gtCoderSidebarIndexRenameClassFor: anAction [ inputLabel: ('New {1} name:' format: {self gtCoderTypeName}); initialText: self name; refactoringWithInput: [ :anInput | GtRBRenameClassRefactoring rename: self name to: anInput ]; - afterAppliedBlock: [ BlTaskAction enqueueElement: self action: [ anExplicitMenu hideAll ] ]; + afterAppliedBlock: [ BlTaskAction enqueueElement: aTargetElement action: [ anExplicitMenu hideAll ] ]; menuModel: anExplicitMenu; - anchorElement: self. + anchorElement: aTargetElement. GtRefactoringsPreviewWithInputElement new refactoringsViewModel: aViewModel; beContextMenuElement; From fea55eab392b3e9a24b6e42e3e4afb2426e6dfe6 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 20 Oct 2025 15:18:41 -0300 Subject: [PATCH 1120/1268] add `GtSourceCoderCompileItShortcut` [feenkcom/gtoolkit#4722] --- .../GtCoderCodeExecutor.class.st | 14 +++++++++++ .../GtSourceCoderCompileItShortcut.class.st | 25 +++++++++++++++++++ .../GtSourceCoderViewModel.class.st | 1 + 3 files changed, 40 insertions(+) create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderCompileItShortcut.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st b/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st index 3bf15ee7e..b851c64bd 100644 --- a/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st +++ b/src/GToolkit-Coder-UI/GtCoderCodeExecutor.class.st @@ -16,6 +16,13 @@ Class { #category : #'GToolkit-Coder-UI-Execution' } +{ #category : #'api - instance creation' } +GtCoderCodeExecutor class >> compileIt [ + "Execute a code that creates or updates a class" + + ^ self new compileIt +] + { #category : #'api - instance creation' } GtCoderCodeExecutor class >> doIt [ "Execute a code (and do not display the execution result)" @@ -74,6 +81,13 @@ GtCoderCodeExecutor >> coderViewModel: anObject [ coderUIModel := anObject ] +{ #category : #initialization } +GtCoderCodeExecutor >> compileIt [ + "Execute a code that creates or updates a class" + + action := #compileIt +] + { #category : #initialization } GtCoderCodeExecutor >> doIt [ "Execute a code (and do not display the execution result)" diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCompileItShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCompileItShortcut.class.st new file mode 100644 index 000000000..3d9387276 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderCompileItShortcut.class.st @@ -0,0 +1,25 @@ +Class { + #name : #GtSourceCoderCompileItShortcut, + #superclass : #GtSourceCoderShortcut, + #category : #'GToolkit-Coder-UI-Shortcuts' +} + +{ #category : #accessing } +GtSourceCoderCompileItShortcut >> description [ + ^ 'Compile class or trait definition' +] + +{ #category : #initialization } +GtSourceCoderCompileItShortcut >> initialize [ + super initialize. + + combination := BlKeyCombination primaryS. + name := 'Compile'. +] + +{ #category : #evaluation } +GtSourceCoderCompileItShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ + GtCoderExecutionContextVariable + element: aBrEditorElement + do: [ aSourceCoderViewModel compileIt ] +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st index 678bf142f..00a53ccaf 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderViewModel.class.st @@ -90,6 +90,7 @@ GtSourceCoderViewModel >> doItAllAsynchronousRequestedBy: aRequesterObject [ { #category : #'api - actions' } GtSourceCoderViewModel >> doItAllRequestedBy: aRequesterObject [ "Evaluate the whole source code independent from the selection and return the result" + ^ self handleCoderEvaluationUnhandledErrorDuring: [ self coder doItInContext: (self evaluationContext From cf72fae7626dbb2e55dfcd7f2943b889e360e736 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 21 Oct 2025 08:51:06 -0300 Subject: [PATCH 1121/1268] ensure text changes happens in the UI process [feenkcom/gtoolkit#4722] also, do not duplicate collected pragma methods. --- .../GtTextualCoderEditorElement.class.st | 21 ++++++++++++------- src/GToolkit-Coder/GtCoderModel.class.st | 9 +++++++- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 0eedb1393..5041415e9 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -507,13 +507,10 @@ GtTextualCoderEditorElement >> onViewModelTextChanged: aGtTextualCoderViewModelT "Do nothing if it comes from a different view model" aGtTextualCoderViewModelTextChanged textualCoderViewModel == self textualCoderViewModel ifFalse: [ ^ self ]. - - aGtTextualCoderViewModelTextChanged source == self - ifTrue: [ ^ self hideHighlighters ]. - - aGtTextualCoderViewModelTextChanged isSynchronous - ifTrue: [ self privateUpdateText: self announcement: aGtTextualCoderViewModelTextChanged ] - ifFalse: [ textUpdater requestUpdate: aGtTextualCoderViewModelTextChanged ] + + BlTaskAction + enqueueElement: self + action: [ self processViewModelTextChanged: aGtTextualCoderViewModelTextChanged ]. ] { #category : #'private - event handling' } @@ -572,6 +569,16 @@ GtTextualCoderEditorElement >> privateUpdateText: anEditorElement announcement: self hideHighlighters. ] +{ #category : #'private - event handling' } +GtTextualCoderEditorElement >> processViewModelTextChanged: aGtTextualCoderViewModelTextChanged [ + aGtTextualCoderViewModelTextChanged source == self + ifTrue: [ ^ self hideHighlighters ]. + + aGtTextualCoderViewModelTextChanged isSynchronous + ifTrue: [ self privateUpdateText: self announcement: aGtTextualCoderViewModelTextChanged ] + ifFalse: [ textUpdater requestUpdate: aGtTextualCoderViewModelTextChanged ] +] + { #category : #registration } GtTextualCoderEditorElement >> registerCoderModelAnnouncementsFor: aCoderModel [ aCoderModel announcer weak diff --git a/src/GToolkit-Coder/GtCoderModel.class.st b/src/GToolkit-Coder/GtCoderModel.class.st index 379d997c2..9c93298f2 100644 --- a/src/GToolkit-Coder/GtCoderModel.class.st +++ b/src/GToolkit-Coder/GtCoderModel.class.st @@ -179,6 +179,11 @@ GtCoderModel >> initializeAddOns: addOns viewModel: aCoderViewModel [ GtCoderModel >> initializeShortcuts: addOns [ ] +{ #category : #subscriptions } +GtCoderModel >> isSubscribedToSystem [ + ^ SystemAnnouncer uniqueInstance hasSubscriber: self +] + { #category : #'api - actions' } GtCoderModel >> mainActions [ "Return a collection of main actions in the coder, for example save" @@ -197,7 +202,9 @@ GtCoderModel >> pragmasNamed: aSymbol inHierarchy: aClass [ | actions | actions := OrderedCollection new. aClass withAllSuperclassesDo: [ :each | - actions addAll: (Pragma allNamed: aSymbol in: each) ]. + actions addAll: ((Pragma allNamed: aSymbol in: each) + reject: [ :eachPragma | actions anySatisfy: [ :otherPragma | + eachPragma methodSelector = otherPragma methodSelector ] ]) ]. actions sort: ( [ :aPragma | aPragma numArgs isZero From e55cafef6758cb0eb48085e6ec4944a6e9eb833d Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 22 Oct 2025 10:33:31 -0300 Subject: [PATCH 1122/1268] add `GtCoderModel>>#gtSystemSubscriptionsViewFor:` --- src/GToolkit-Coder/GtCoderModel.class.st | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/GToolkit-Coder/GtCoderModel.class.st b/src/GToolkit-Coder/GtCoderModel.class.st index 9c93298f2..2b60aaf60 100644 --- a/src/GToolkit-Coder/GtCoderModel.class.st +++ b/src/GToolkit-Coder/GtCoderModel.class.st @@ -152,6 +152,18 @@ GtCoderModel >> expanded: aBoolean [ self deprecated: 'The expansion state was moved to the ViewModel' ] +{ #category : #views } +GtCoderModel >> gtSystemSubscriptionsViewFor: aView [ + + ^ aView columnedList + title: 'System subscriptions'; + items: [ self systemSubscriptions ]; + column: 'Announcement' text: [ :each | each announcementClass ]; + column: 'Action' + text: [ :each | each action ] + weight: 2 +] + { #category : #accessing } GtCoderModel >> id [ ^ id @@ -243,6 +255,15 @@ GtCoderModel >> subscribeToSystem [ "do nothing" ] +{ #category : #subscriptions } +GtCoderModel >> systemSubscriptions [ + ^ Array + streamContents: [ :aStream | + SystemAnnouncer uniqueInstance subscriptions + subscriptionsOf: self + do: [ :eachSubscription | aStream nextPut: eachSubscription ] ] +] + { #category : #subscriptions } GtCoderModel >> unsubscribeFromSystem [ SystemAnnouncer uniqueInstance unsubscribe: self From 8e05ec2dacee3e2c8879346202485bd9628434bb Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 22 Oct 2025 16:10:03 -0300 Subject: [PATCH 1123/1268] ensure element changes are performed in a UI process - execute promises with a dedicated coder configuration --- .../GtExpandableCoderViewModel.class.st | 5 ++- .../GtExpandableSourceCoderElement.class.st | 16 ++++---- .../GtSingleCoderViewModel.class.st | 5 +-- ...ourceCoderCollapsedContentElement.class.st | 6 ++- .../GtSourceCoderEditorElement.class.st | 5 --- .../GtSourceCoderErrorFixItAttribute.class.st | 2 +- .../GtTextualCoderEditorElement.class.st | 41 ++++++++++++------- src/GToolkit-Coder/GtCoderModel.class.st | 8 ++++ src/GToolkit-Coder/GtTextualCoder.class.st | 8 ++-- 9 files changed, 59 insertions(+), 37 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtExpandableCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtExpandableCoderViewModel.class.st index 43594cd99..4e7ff787b 100644 --- a/src/GToolkit-Coder-UI/GtExpandableCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtExpandableCoderViewModel.class.st @@ -94,7 +94,10 @@ GtExpandableCoderViewModel >> initialize [ { #category : #'private - notifying' } GtExpandableCoderViewModel >> notifyExpansionChanged: aBoolean [ - self announce: (GtExpandableCoderViewModelExpansionChanged new expanded: aBoolean) + self + announce: (GtExpandableCoderViewModelExpansionChanged new + textualCoderViewModel: self; + expanded: aBoolean) ] { #category : #'private - notifying' } diff --git a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st index d872f3251..3817394fb 100644 --- a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st @@ -175,11 +175,18 @@ GtExpandableSourceCoderElement >> onTextualCoderViewModelChanged [ { #category : #'private - event handling' } GtExpandableSourceCoderElement >> onViewModelExpansionChanged: anAnnouncement [ - self expanded: anAnnouncement expanded + self hasTextualCoderViewModel ifFalse: [ ^ self ]. + anAnnouncement textualCoderViewModel = self textualCoderViewModel + ifFalse: [ ^ self ]. + + BlTaskAction + enqueueElement: self + action: [ self expanded: anAnnouncement expanded ] ] { #category : #'private - event handling' } GtExpandableSourceCoderElement >> onViewModelTextChanged: anAnnouncement [ + "Can be removed" self updateModificationIndicator ] @@ -200,9 +207,6 @@ GtExpandableSourceCoderElement >> subscribeToTextualCoderViewModel [ textualCoderViewModel weak when: GtExpandableCoderViewModelExpansionChanged send: #onViewModelExpansionChanged: - to: self; - when: GtTextualCoderViewModelTextChanged - send: #onViewModelTextChanged: to: self ] @@ -237,7 +241,5 @@ GtExpandableSourceCoderElement >> updateElement [ { #category : #'private - update' } GtExpandableSourceCoderElement >> updateModificationIndicator [ - true ifTrue: [ ^ self ]. - - modificationIndicator asyncPromise promise: textualCoderViewModel isTextModifiedPromise + "can be removed" ] diff --git a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st index fb5c28bea..768150780 100644 --- a/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtSingleCoderViewModel.class.st @@ -36,10 +36,7 @@ GtSingleCoderViewModel class >> behaviourAddOnsExecutionConfiguration [ { #category : #accessing } GtSingleCoderViewModel class >> commonExecutionConfiguration [ - ^ AsyncFutureExecutionConfiguration new - customGroup: #Coder; - maxAmountOfWorkers: 2; - defaultPriority + ^ GtCoderModel commonExecutionConfiguration ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st index 22377ab27..094f1539a 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st @@ -83,7 +83,11 @@ GtSourceCoderCollapsedContentElement >> onTextualCoderViewModelChanged [ { #category : #'private - event handling' } GtSourceCoderCollapsedContentElement >> onViewModelTextChanged: anAnnouncement [ - self updateCollapsedTextLabel + self hasTextualCoderViewModel ifFalse: [ ^ self ]. + anAnnouncement textualCoderViewModel = self textualCoderViewModel + ifFalse: [ ^ self ]. + + BlTaskAction enqueueElement: self action: [ self updateCollapsedTextLabel ] ] { #category : #'api - textual coder view model' } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st index fe5c6fa9b..dc710bfef 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st @@ -50,11 +50,6 @@ GtSourceCoderEditorElement >> onTextualCoderViewModelChanged [ ifNotNil: [ :aResult | evaluationHighlighter displayResult: aResult ] ] -{ #category : #'as yet unclassified' } -GtSourceCoderEditorElement >> onUpdateAddOnsRequest: aGtCoderAddOnsUpdateRequest [ - "To be deleted" -] - { #category : #registration } GtSourceCoderEditorElement >> onViewModelEvaluationStatusChanged: anAnnouncement [ self diff --git a/src/GToolkit-Coder-UI/GtSourceCoderErrorFixItAttribute.class.st b/src/GToolkit-Coder-UI/GtSourceCoderErrorFixItAttribute.class.st index 0bc3f7828..d9960e4f5 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderErrorFixItAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderErrorFixItAttribute.class.st @@ -14,7 +14,7 @@ GtSourceCoderErrorFixItAttribute >> buildPopupIn: anEditorElement aptitude: apti element id: #'error-fix-it'. element beFocusable. {BlKeyCombination escape. - BlKeyCombination enter. + "BlKeyCombination enter." BlKeyCombination backspace} do: [ :key | element diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 5041415e9..d88a0cecc 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -220,17 +220,22 @@ GtTextualCoderEditorElement >> onAddedToSceneGraph [ { #category : #'private - event handling' } GtTextualCoderEditorElement >> onCodeEvaluated: anEvaluationAnnouncement [ - (anEvaluationAnnouncement requesterObject isCoderViewModel: self textualCoderViewModel) - ifFalse: [ ^ self ]. + (anEvaluationAnnouncement requesterObject + isCoderViewModel: self textualCoderViewModel) ifFalse: [ ^ self ]. - evaluationHighlighter displayResult: anEvaluationAnnouncement evaluationResult. - evaluationPrinter hideResult + BlTaskAction + enqueueElement: self + action: [ + evaluationHighlighter displayResult: anEvaluationAnnouncement evaluationResult. + evaluationPrinter hideResult ] ] { #category : #'private - event handling' } GtTextualCoderEditorElement >> onCoderParseError: aGtCoderParseError [ + "A parse error can be notifying from a non-UI thread" + (aGtCoderParseError requesterObject - isUndefinedOrCoderViewModel: self textualCoderViewModel) ifFalse: [ ^ self ]. "A parse error can be notifying from a non-UI thread" + isUndefinedOrCoderViewModel: self textualCoderViewModel) ifFalse: [ ^ self ]. self enqueueTask: [ aGtCoderParseError isUndeclaredError ifTrue: [ self reportUndeclaredError: aGtCoderParseError ] @@ -282,8 +287,9 @@ GtTextualCoderEditorElement >> onPrintRequest: anEvaluationAnnouncement [ (anEvaluationAnnouncement requesterObject isCoderViewModel: self textualCoderViewModel) ifFalse: [ ^ self ]. - evaluationHighlighter hideResult. - evaluationPrinter displayResult: anEvaluationAnnouncement evaluationResult. + BlTaskAction enqueueElement: self action: [ + evaluationHighlighter hideResult. + evaluationPrinter displayResult: anEvaluationAnnouncement evaluationResult ]. ] { #category : #'hooks - children' } @@ -297,6 +303,7 @@ GtTextualCoderEditorElement >> onRemovedFromSceneGraph [ { #category : #'private - event handling' } GtTextualCoderEditorElement >> onScrollToCharacterPositionAnnouncement: anAnnouncement [ + self assertUIProcess. BrEditorSearchTextScroller new editorElement: self; lineIndex: anAnnouncement lineIndex; @@ -429,7 +436,9 @@ GtTextualCoderEditorElement >> onViewModelRecomputeAddOns: aRecomputeAddOnReques aRecomputeAddOnRequest coderViewModel == self textualCoderViewModel ifFalse: [ ^ self ]. - addOnsElementFuture future: self textualCoderViewModel addOnsFuture + BlTaskAction + enqueueElement: self + action: [ addOnsElementFuture future: self textualCoderViewModel addOnsFuture ] ] { #category : #'private - event handling' } @@ -444,11 +453,12 @@ GtTextualCoderEditorElement >> onViewModelSelectionChanged: aSelectionChangedAnn aSelectionChangedAnnouncement source == self textualCoderViewModel ifFalse: [ ^ self ]. - self - inUIProcessDo: [ self deselecter all deselect. + BlTaskAction + enqueueElement: self + action: [ self deselecter all deselect. self selecter in: [ :aSelecter | - aSelectionChangedAnnouncement shouldUpdateCursor + aSelectionChangedAnnouncement shouldUpdateCursor ifFalse: [ aSelecter withoutCursorUpdate ] ]; all: aSelectionChangedAnnouncement selection; select ] @@ -517,9 +527,12 @@ GtTextualCoderEditorElement >> onViewModelTextChanged: aGtTextualCoderViewModelT GtTextualCoderEditorElement >> onViewModelTextEditCommandRequest: aGtTextualCoderViewModelTextEditCommandRequest [ "This is sent by the view model on requests to change the text in the editor by executing a command." - - aGtTextualCoderViewModelTextEditCommandRequest textEditCommand - applyOn: self editor + + BlTaskAction + enqueueElement: self + action: [ + aGtTextualCoderViewModelTextEditCommandRequest textEditCommand + applyOn: self editor ] ] { #category : #'private - updating' } diff --git a/src/GToolkit-Coder/GtCoderModel.class.st b/src/GToolkit-Coder/GtCoderModel.class.st index 2b60aaf60..7c6457524 100644 --- a/src/GToolkit-Coder/GtCoderModel.class.st +++ b/src/GToolkit-Coder/GtCoderModel.class.st @@ -39,6 +39,14 @@ GtCoderModel class >> astExtensionsPragma [ ^ #gtAstCoderAddOns: ] +{ #category : #accessing } +GtCoderModel class >> commonExecutionConfiguration [ + ^ AsyncFutureExecutionConfiguration new + customGroup: #Coder; + maxAmountOfWorkers: 2; + defaultPriority +] + { #category : #addons } GtCoderModel class >> contextMenuAddOnsPragma [ ^ #gtCoderContextMenuAddOns diff --git a/src/GToolkit-Coder/GtTextualCoder.class.st b/src/GToolkit-Coder/GtTextualCoder.class.st index 2f22fb1eb..4f24c4aaa 100644 --- a/src/GToolkit-Coder/GtTextualCoder.class.st +++ b/src/GToolkit-Coder/GtTextualCoder.class.st @@ -76,7 +76,7 @@ GtTextualCoder >> astSync [ GtTextualCoder >> coderAst [ - ^ self coderAstFuture await + ^ self coderAstFuture await: self class commonExecutionConfiguration ] { #category : #'api - ast' } @@ -113,7 +113,7 @@ GtTextualCoder >> collapsedText [ GtTextualCoder >> collapsedTextPromise [ - ^ [ self collapsedText ] asAsyncPromise + ^ [ self collapsedText ] asAsyncFuture await: self class commonExecutionConfiguration ] { #category : #'api - ast' } @@ -217,7 +217,7 @@ GtTextualCoder >> currentSourceText: aText withEditCommand: anEditCommand [ GtTextualCoder >> currentSourceTextPromise [ - ^ [ self currentSourceText ] asAsyncPromise + ^ [ self currentSourceText ] asAsyncFuture await: self class commonExecutionConfiguration ] { #category : #'api - text' } @@ -269,7 +269,7 @@ GtTextualCoder >> isModifiedPromise [ "Deprecated: use `GtTextualCoderViewModel>>#isTextModifiedPromise` instead." - ^ self isModifiedFuture asAsyncPromise + ^ self isModifiedFuture asAsyncFuture await: self class commonExecutionConfiguration ] { #category : #'private - notifying' } From 1a694f5fb90e7638a9fa318b713411a3b97cb8e2 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 22 Oct 2025 19:13:33 -0300 Subject: [PATCH 1124/1268] request focus in `GtAbstractRenameAction>>#processReturnFor:in:` --- src/GToolkit-Coder-AddOns/GtAbstractRenameAction.class.st | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-AddOns/GtAbstractRenameAction.class.st b/src/GToolkit-Coder-AddOns/GtAbstractRenameAction.class.st index 8bad29565..724731dc0 100644 --- a/src/GToolkit-Coder-AddOns/GtAbstractRenameAction.class.st +++ b/src/GToolkit-Coder-AddOns/GtAbstractRenameAction.class.st @@ -182,7 +182,8 @@ GtAbstractRenameAction >> primaryRenameAttribute [ { #category : #actions } GtAbstractRenameAction >> processReturnFor: renameEditor in: anEditorElement [ - self accept + self accept. + anEditorElement requestFocus ] { #category : #private } From 3b2b3f190e71d9e3b8de9307ae783245006b763c Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 24 Oct 2025 15:02:17 -0300 Subject: [PATCH 1125/1268] `GtSourceCoderActionsElement` informs about toolbar item removals using `BrWidgetPermanentlyRemovedEvent` --- .../GtSourceCoderActionsElement.class.st | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st index b6c05f97e..816a51db1 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st @@ -109,12 +109,18 @@ GtSourceCoderActionsElement >> onTextualCoderViewModelChanged [ { #category : #private } GtSourceCoderActionsElement >> removeContextToolbarActions [ - contextToolbar numberOfItems timesRepeat: [ contextToolbar removeItemAt: 1 ] + | aboutToRemoveElements | + aboutToRemoveElements := contextToolbar items. + contextToolbar removeAllItems. + BrWidgetPermanentlyRemovedEvent notifyElements: aboutToRemoveElements ] { #category : #private } GtSourceCoderActionsElement >> removeMainToolbarActions [ - mainToolbar numberOfItems timesRepeat: [ mainToolbar removeItemAt: 1 ] + | aboutToRemoveElements | + aboutToRemoveElements := mainToolbar items. + mainToolbar removeAllItems. + BrWidgetPermanentlyRemovedEvent notifyElements: aboutToRemoveElements ] { #category : #'api - textual coder view model' } From 41e74758bb13041b3b0885ee269ea3fef388dc60 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 27 Oct 2025 10:21:21 -0300 Subject: [PATCH 1126/1268] Make the buttons in method coders only appear on focus or hover [feenkcom/gtoolkit#4463] --- .../GtCoderUIConstants.class.st | 20 +++++++++++++++++++ .../GtSourceCoderActionsElement.class.st | 3 ++- ...SourceCoderExpandedContentElement.class.st | 16 ++++++++++++++- 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderUIConstants.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderUIConstants.class.st b/src/GToolkit-Coder-UI/GtCoderUIConstants.class.st new file mode 100644 index 000000000..b0b698f5e --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderUIConstants.class.st @@ -0,0 +1,20 @@ +Class { + #name : #GtCoderUIConstants, + #superclass : #Object, + #category : #'GToolkit-Coder-UI-Utilities' +} + +{ #category : #initialization } +GtCoderUIConstants class >> actionsToolbarHeight [ + "Coder toobar items are computed later and the coder element height adopted accordingly. + In case of list of coders, it does not behave a best way, + because the list layout: + - first, computes position (ehgith) of coders without the toolbar action items, + - second, scrolls to a specific coder item, + - third, recomputes the coders height. + As a consequence, the position of the item users + wanted to scroll to, might be significantly shifted. + As a workaround, we explicitly set (a minimum) toolbar height." + + ^ 16 +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st index 816a51db1..dbff49fa4 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st @@ -54,7 +54,8 @@ GtSourceCoderActionsElement >> initialize [ self padding: (BlInsets empty). self constraintsDo: [ :c | c horizontal matchParent. - c vertical fitContent ]. + c vertical fitContent. + c minWidth: GtCoderUIConstants actionsToolbarHeight ]. mainToolbar := self newToolbar labeled: 'Main toolbar'. diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st index 5528cf796..03c0f1066 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st @@ -26,10 +26,24 @@ GtSourceCoderExpandedContentElement >> initialize [ editorElement := self newEditorElement. actions := self newActionsElement. + actions visibility: BlVisibility hidden. + + self + addAptitude: (BrStyleCommonAptitude new + when: BlElementState hovered & BlElementState focused not + style: [ :aStyle | + aStyle + do: [ :aWidget | actions visibility: BlVisibility visible ] + after: [ :aWidget | actions visibility: BlVisibility hidden ] ]; + focused: [ :aStyle | + aStyle + do: [ :aWidget | actions visibility: BlVisibility visible ] + after: [ :aWidget | actions visibility: BlVisibility hidden ] ]). + self addChildren: {editorElement. actions}. - self addAptitude: (BrLayoutResizerAptitude new inherit: editorElement). + self addAptitude: (BrLayoutResizerAptitude new inherit: editorElement) ] { #category : #'instance creation' } From 674c307f865a69a62868a0b97b18258695741379 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 28 Oct 2025 11:20:32 -0300 Subject: [PATCH 1127/1268] fix `GtCreationForm>>#selectInNavigationModel:anInstance:` --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index b666e2009..ff2d80157 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -179,10 +179,12 @@ GtCreationForm >> selectInNavigationModel: aNavigationModel anInstance: anInstan (anInstance package tags reject: [ :aTag | aTag isRoot]) ifNotEmpty: [ - anInstance packageTag ifNotNil: [ - aNavigationModel - selectPackageTag: (anInstance package - tagNamed: anInstance tags first) ] ]. + anInstance packageTag ifNotNil: [ :aPackageTag | + aPackageTag isRoot ifFalse: [ + anInstance tags ifNotEmpty: [ :anInstanceTags | + aNavigationModel + selectPackageTag: (anInstance package + tagNamed: anInstanceTags first) ] ] ] ]. aNavigationModel selectClass: anInstance ] From 0fff385c23127d9679aa9c5da65d37057dc132a5 Mon Sep 17 00:00:00 2001 From: Oscar Nierstrasz Date: Fri, 7 Nov 2025 12:19:05 +0100 Subject: [PATCH 1128/1268] Added asSymbol to button id for LePageActionsDropdown --- .../LePageActionTargetDropdownButtonId.class.st | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/GToolkit-Coder-UI/LePageActionTargetDropdownButtonId.class.st diff --git a/src/GToolkit-Coder-UI/LePageActionTargetDropdownButtonId.class.st b/src/GToolkit-Coder-UI/LePageActionTargetDropdownButtonId.class.st new file mode 100644 index 000000000..90864f135 --- /dev/null +++ b/src/GToolkit-Coder-UI/LePageActionTargetDropdownButtonId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #LePageActionTargetDropdownButtonId, + #superclass : #GtCoderElementId, + #category : #'GToolkit-Coder-UI-Coder - Ids' +} + +{ #category : #'as yet unclassified' } +LePageActionTargetDropdownButtonId >> asSymbol [ + ^ #'lepage--action-dropdown' +] From 83de7c93b0590e65094dd9b246d87fa12058773f Mon Sep 17 00:00:00 2001 From: John Brant Date: Mon, 10 Nov 2025 07:42:50 -0600 Subject: [PATCH 1129/1268] [feenkcom/gtoolkit#4841] change text coder to listen for data source changed/text replaced events --- src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index d88a0cecc..029250eaf 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -187,6 +187,10 @@ GtTextualCoderEditorElement >> initializeListeners [ when: BrTextEditorModifiedEvent do: [ :anEvent | self onTextModifiedDueToEvent: anEvent ]. + self editor + when: BlInfiniteDataSourceChanged + do: [ :anEvent | self onTextModifiedDueToEvent: anEvent ]. + self editor when: BrTextEditorCursorChangedEvent do: [ :anEvent | self textualCoderViewModel cursors: anEvent cursors from: self ]. From f4605a4748e9a2471bac62fa4345652365ff4ecf Mon Sep 17 00:00:00 2001 From: Oscar Nierstrasz Date: Mon, 10 Nov 2025 16:32:01 +0100 Subject: [PATCH 1130/1268] Moved LePageActionTargetDropdownButtonId to Lepiter-UI --- .../LePageActionTargetDropdownButtonId.class.st | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 src/GToolkit-Coder-UI/LePageActionTargetDropdownButtonId.class.st diff --git a/src/GToolkit-Coder-UI/LePageActionTargetDropdownButtonId.class.st b/src/GToolkit-Coder-UI/LePageActionTargetDropdownButtonId.class.st deleted file mode 100644 index 90864f135..000000000 --- a/src/GToolkit-Coder-UI/LePageActionTargetDropdownButtonId.class.st +++ /dev/null @@ -1,10 +0,0 @@ -Class { - #name : #LePageActionTargetDropdownButtonId, - #superclass : #GtCoderElementId, - #category : #'GToolkit-Coder-UI-Coder - Ids' -} - -{ #category : #'as yet unclassified' } -LePageActionTargetDropdownButtonId >> asSymbol [ - ^ #'lepage--action-dropdown' -] From d23973896f41ecb00bebc85eb5476797c3a51325 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 10 Nov 2025 16:41:40 -0300 Subject: [PATCH 1131/1268] check whether a coder view model exists --- src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 029250eaf..a87e9672a 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -361,7 +361,8 @@ GtTextualCoderEditorElement >> onTextModified [ { #category : #'private - event handling' } GtTextualCoderEditorElement >> onTextModifiedDueToEvent: aTextModifiedEvent [ "Is sent when the text changes in the editor. Here we should synchronise the UI and the model. We also receive the event, which can contain the type of change." - + self hasTextualCoderViewModel ifFalse: [ ^ self ]. + self textualCoderViewModel sourceText: self text from: self From 1b36c66ef586cc6cf1a1b5217e743bdb1ef40171 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 10 Nov 2025 17:54:22 -0300 Subject: [PATCH 1132/1268] check whether a coder view model exists --- .../GtTextualCoderEditorElement.class.st | 67 ++++++++++++++----- 1 file changed, 51 insertions(+), 16 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index a87e9672a..00fbe355a 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -169,35 +169,33 @@ GtTextualCoderEditorElement >> initialize [ { #category : #initialization } GtTextualCoderEditorElement >> initializeListeners [ - self when: BlFocusInEvent do: [ :anEvent | - self textualCoderViewModel focused: true from: self ]. - self when: BlFocusOutEvent do: [ :anEvent | - "when elements are removed from the scene graph due to tab switching or scrolling they lose focus. - We are only interested when focus is lost explicitly via user interaction" - anEvent isDueToRemoval - ifFalse: [ self textualCoderViewModel focused: false from: self ] ]. - + self + when: BlFocusInEvent + do: [ :anEvent | self onFocusInEvent: anEvent ]. + + self + when: BlFocusOutEvent + do: [ :anEvent | self onFocusOutEvent: anEvent ]. + self editor when: BrTextEditorHistoryChangedEvent - do: [ :anEvent | - textualCoderViewModel - ifNotNil: [ textualCoderViewModel history: self editor history copy ] ]. + do: [ :anEvent | self onTextEditorHistoryChanged: anEvent ]. self editor when: BrTextEditorModifiedEvent - do: [ :anEvent | self onTextModifiedDueToEvent: anEvent ]. + do: [ :anEvent | self onTextModifiedDueToEvent: anEvent ]. self editor when: BlInfiniteDataSourceChanged do: [ :anEvent | self onTextModifiedDueToEvent: anEvent ]. self editor - when: BrTextEditorCursorChangedEvent - do: [ :anEvent | self textualCoderViewModel cursors: anEvent cursors from: self ]. + when: BrTextEditorCursorChangedEvent + do: [ :anEvent | self onTextEditorCursorChanged: anEvent ]. self editor - when: BrTextEditorSelectionChangedEvent - do: [ :anEvent | self textualCoderViewModel selection: anEvent selection from: self ]. + when: BrTextEditorSelectionChangedEvent + do: [ :anEvent | self onTextEditorSelectionChanged: anEvent ]. self editor when: BrTextEditorTextStyledEvent @@ -266,6 +264,21 @@ GtTextualCoderEditorElement >> onFocusChangedAnnouncement: anAnnouncement [ action: [ self onCoderViewModelFocused: anAnnouncement focused ]) ] +{ #category : #initialization } +GtTextualCoderEditorElement >> onFocusInEvent: anEvent [ + self hasTextualCoderViewModel ifFalse: [ ^ self ]. + + self textualCoderViewModel focused: true from: self +] + +{ #category : #initialization } +GtTextualCoderEditorElement >> onFocusOutEvent: anEvent [ + anEvent isDueToRemoval ifTrue: [ ^ self ]. + self hasTextualCoderViewModel ifFalse: [ ^ self ]. + + self textualCoderViewModel focused: false from: self +] + { #category : #'private - event handling' } GtTextualCoderEditorElement >> onObjectSpawnRequest: anAnnouncement [ (anAnnouncement requesterObject isCoderViewModel: self textualCoderViewModel) @@ -348,6 +361,27 @@ GtTextualCoderEditorElement >> onStyleTextRequest: anEvent [ self enqueueTask: (BlTaskAction new action: [ self styleTextAndAfterDo: anEvent afterAction ]) ] +{ #category : #initialization } +GtTextualCoderEditorElement >> onTextEditorCursorChanged: anEvent [ + self hasTextualCoderViewModel ifFalse: [ ^ self ]. + + self textualCoderViewModel cursors: anEvent cursors from: self +] + +{ #category : #initialization } +GtTextualCoderEditorElement >> onTextEditorHistoryChanged: anEvent [ + self hasTextualCoderViewModel ifFalse: [ ^ self ]. + + self textualCoderViewModel history: self editor history copy +] + +{ #category : #initialization } +GtTextualCoderEditorElement >> onTextEditorSelectionChanged: anEvent [ + self hasTextualCoderViewModel ifFalse: [ ^ self ]. + + self textualCoderViewModel selection: anEvent selection from: self +] + { #category : #'private - event handling' } GtTextualCoderEditorElement >> onTextModified [ "Is sent when the text changes in the editor. Here we should synchronise the UI and the model." @@ -373,6 +407,7 @@ GtTextualCoderEditorElement >> onTextModifiedDueToEvent: aTextModifiedEvent [ { #category : #'private - event handling' } GtTextualCoderEditorElement >> onTextStyled: anEvent [ "An underlying editor styled the text" + self hasTextualCoderViewModel ifFalse: [ ^ self ]. self textualCoderViewModel styledText: anEvent styledText ] From 29eea4ea0b5b5d646f0a1a7f5eeaa8ab0a061aea Mon Sep 17 00:00:00 2001 From: John Brant Date: Mon, 10 Nov 2025 15:14:21 -0600 Subject: [PATCH 1133/1268] [feenkcom/gtoolkit#4841] move data source changed event handler down to source coder editor --- .../GtSourceCoderEditorElement.class.st | 9 +++++++++ .../GtTextualCoderEditorElement.class.st | 4 ---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st index dc710bfef..83ffce76c 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st @@ -41,6 +41,15 @@ GtSourceCoderEditorElement >> initialize [ self editor movementWordClassifier: GtSmalltalkSourceCoder wordMovementClassifier. ] +{ #category : #initalization } +GtSourceCoderEditorElement >> initializeListeners [ + super initializeListeners. + + self editor + when: BlInfiniteDataSourceChanged + do: [ :anEvent | self onTextModifiedDueToEvent: anEvent ] +] + { #category : #'api - textual coder view model' } GtSourceCoderEditorElement >> onTextualCoderViewModelChanged [ super onTextualCoderViewModelChanged. diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 00fbe355a..a7a421784 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -185,10 +185,6 @@ GtTextualCoderEditorElement >> initializeListeners [ when: BrTextEditorModifiedEvent do: [ :anEvent | self onTextModifiedDueToEvent: anEvent ]. - self editor - when: BlInfiniteDataSourceChanged - do: [ :anEvent | self onTextModifiedDueToEvent: anEvent ]. - self editor when: BrTextEditorCursorChangedEvent do: [ :anEvent | self onTextEditorCursorChanged: anEvent ]. From 7c471406aa6672237ee8f1984e50b7c83ea75c7e Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 11 Nov 2025 08:07:24 -0600 Subject: [PATCH 1134/1268] [feenkcom/gtoolkit#4841] when data source changed happens don't update if only styling changed --- .../GtSourceCoderEditorElement.class.st | 12 +++++++++++- .../GtTextualCoderViewModel.class.st | 10 ++++++++++ src/GToolkit-Coder/GtTextualCoder.class.st | 16 ++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st index 83ffce76c..12adb6c5c 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st @@ -47,7 +47,17 @@ GtSourceCoderEditorElement >> initializeListeners [ self editor when: BlInfiniteDataSourceChanged - do: [ :anEvent | self onTextModifiedDueToEvent: anEvent ] + do: [ :anEvent | self onInfiniteDataSourceChanged: anEvent ] +] + +{ #category : #initalization } +GtSourceCoderEditorElement >> onInfiniteDataSourceChanged: anEvent [ + self hasTextualCoderViewModel ifFalse: [ ^ self ]. + self textualCoderViewModel + textReplaced: self text + from: self + synchronously: true + dueToEvent: anEvent ] { #category : #'api - textual coder view model' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 896811281..76b7f9aca 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -812,6 +812,16 @@ GtTextualCoderViewModel >> subscribeToCoderModel [ to: self ] +{ #category : #'api - text' } +GtTextualCoderViewModel >> textReplaced: aNewSourceText from: aSourceObject synchronously: isSynchronous dueToEvent: aTextModifiedEvent [ + self coderModel + textReplaced: aNewSourceText + with: (GtCoderUpdateStrategy new + source: aSourceObject; + isSynchronous: isSynchronous) + dueTo: aTextModifiedEvent +] + { #category : #'api - styled text' } GtTextualCoderViewModel >> unsetStyledText [ diff --git a/src/GToolkit-Coder/GtTextualCoder.class.st b/src/GToolkit-Coder/GtTextualCoder.class.st index 4f24c4aaa..4585c5429 100644 --- a/src/GToolkit-Coder/GtTextualCoder.class.st +++ b/src/GToolkit-Coder/GtTextualCoder.class.st @@ -419,3 +419,19 @@ GtTextualCoder >> sourceTextDo: aBlock [ GtTextualCoder >> stylers [ ^ #() ] + +{ #category : #'api - text' } +GtTextualCoder >> textReplaced: aText with: aGtCoderUpdateStragegy dueTo: aReason [ + "Set a new source text if the characters are different, giving also a reason for the change" + + self + critical: [ | previousSourceText | + previousSourceText := self currentSourceText copy. + (previousSourceText equalsIgnoringAttributes: aText) + ifFalse: [ self sourceCode currentSourceText: aText. + self + sourceChangedTo: aText + from: previousSourceText + with: aGtCoderUpdateStragegy + dueTo: aReason ] ] +] From 887f3194565ebee52c4c89564911023c2c97f2ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Tue, 11 Nov 2025 18:16:10 +0100 Subject: [PATCH 1135/1268] Clear the content in the debugger notification when detaching [feenkcom/gtoolkit#4778] --- .../GtNotificationDebugSessionElement.class.st | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtNotificationDebugSessionElement.class.st b/src/GToolkit-Coder-UI/GtNotificationDebugSessionElement.class.st index 908c9752d..9d943b5cc 100644 --- a/src/GToolkit-Coder-UI/GtNotificationDebugSessionElement.class.st +++ b/src/GToolkit-Coder-UI/GtNotificationDebugSessionElement.class.st @@ -10,12 +10,24 @@ Class { #category : #'GToolkit-Coder-UI-DebugSession' } +{ #category : #'private - accessing' } +GtNotificationDebugSessionElement >> actOnElementDetached [ + super actOnElementDetached. + self clearContent. +] + { #category : #'private - accessing' } GtNotificationDebugSessionElement >> borderElement [ ^ borderElement ] +{ #category : #'private - hooks' } +GtNotificationDebugSessionElement >> clearContent [ + self stackListElement items: #(). + self textEditor text: ''. +] + { #category : #'private - actions' } GtNotificationDebugSessionElement >> debug [ self debugSessionDo: [ :aSession | @@ -68,7 +80,9 @@ GtNotificationDebugSessionElement >> initializeBorderElement [ borderElement := GtNotificationBorderElement new borderDo: [ :anElement | anElement - border: (BlBorder paint: self theme status errorBackgroundColor width: 1); + border: (BlBorder + paint: self theme status errorBackgroundColor + width: 1); padding: (BlInsets all: 0) ]; withCloseButtonAction: [ self terminate ] ] From 700d64ff9812dfb57a61c5ed8a880076102ae2ac Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 13 Nov 2025 11:06:13 -0300 Subject: [PATCH 1136/1268] use tree pager in examples [feenkcom/gtoolkit#4588] --- src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st b/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st index e42e9b292..f0fc4b80e 100644 --- a/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st +++ b/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st @@ -95,7 +95,7 @@ TCoderByScripterExamples >> scripterInPagerForBlock: aBlock [ aStep set label: 'Initialize Coder UI'; element: [ :aCoder | - GtPager createWrappedOn: aCoder asElement ]; + GtPagerSettings usedPager createWrappedOn: aCoder asElement ]; onModel; play ]. From da15162201c964e9189b994e2402c87a0c1777c1 Mon Sep 17 00:00:00 2001 From: John Brant Date: Thu, 13 Nov 2025 08:39:27 -0600 Subject: [PATCH 1137/1268] [feenkcom/gtoolkit#4841][feenkcom/gtoolkit#4852] removing BlInfiniteDataSourceChanged handler on coder editor --- .../GtSourceCoderEditorElement.class.st | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st index 12adb6c5c..dc710bfef 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderEditorElement.class.st @@ -41,25 +41,6 @@ GtSourceCoderEditorElement >> initialize [ self editor movementWordClassifier: GtSmalltalkSourceCoder wordMovementClassifier. ] -{ #category : #initalization } -GtSourceCoderEditorElement >> initializeListeners [ - super initializeListeners. - - self editor - when: BlInfiniteDataSourceChanged - do: [ :anEvent | self onInfiniteDataSourceChanged: anEvent ] -] - -{ #category : #initalization } -GtSourceCoderEditorElement >> onInfiniteDataSourceChanged: anEvent [ - self hasTextualCoderViewModel ifFalse: [ ^ self ]. - self textualCoderViewModel - textReplaced: self text - from: self - synchronously: true - dueToEvent: anEvent -] - { #category : #'api - textual coder view model' } GtSourceCoderEditorElement >> onTextualCoderViewModelChanged [ super onTextualCoderViewModelChanged. From d837102b39082222d17ebf271b4400ec15b84913 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 13 Nov 2025 15:43:51 -0300 Subject: [PATCH 1138/1268] use tree pager [feenkcom/gtoolkit#4588] do not wrap elements --- src/GToolkit-Coder-UI/GtCoderTool.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderTool.class.st b/src/GToolkit-Coder-UI/GtCoderTool.class.st index 44dad7343..5ef046eae 100644 --- a/src/GToolkit-Coder-UI/GtCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtCoderTool.class.st @@ -8,7 +8,7 @@ Class { GtCoderTool >> asElementDo: aOneArgBlock [ "Create a tool element and execute the block." - ^ aOneArgBlock cull: self newCoder asPagerPageElement + ^ aOneArgBlock cull: self newCoder ] { #category : #'api - converting' } From b466b0b8d16801cfad7867bcf2f90f3827119620 Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Sat, 15 Nov 2025 20:30:04 +0100 Subject: [PATCH 1139/1268] add method and methods target feenkcom/gtoolkit#4848 --- src/GToolkit-Coder-UI/GtCoderMethodTarget.class.st | 5 +++++ src/GToolkit-Coder-UI/GtCoderMethodsTarget.class.st | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 src/GToolkit-Coder-UI/GtCoderMethodTarget.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderMethodsTarget.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderMethodTarget.class.st b/src/GToolkit-Coder-UI/GtCoderMethodTarget.class.st new file mode 100644 index 000000000..fa3057bc7 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderMethodTarget.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtCoderMethodTarget, + #superclass : #GtPhlowActionUniqueTarget, + #category : #'GToolkit-Coder-UI-Phlow Targets' +} diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsTarget.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsTarget.class.st new file mode 100644 index 000000000..ab601b4b7 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderMethodsTarget.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtCoderMethodsTarget, + #superclass : #GtPhlowActionUniqueTarget, + #category : #'GToolkit-Coder-UI-Phlow Targets' +} From bf7cf8372815450aa47ff2704aed4fa1d44bb679 Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Mon, 17 Nov 2025 07:38:06 +0100 Subject: [PATCH 1140/1268] Add GtPharoCompiledMethods and associated views. Refine the diff stencil alignment with magic numbers. feenkcom/gtoolkit#4848 --- .../GtDiffElementWithLabelStencil.class.st | 7 +- .../GtPharoCompiledMethods.class.st | 118 ++++++++++++++++++ 2 files changed, 122 insertions(+), 3 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtPharoCompiledMethods.class.st diff --git a/src/GToolkit-Coder-UI/GtDiffElementWithLabelStencil.class.st b/src/GToolkit-Coder-UI/GtDiffElementWithLabelStencil.class.st index d9f47d885..d2ec0d173 100644 --- a/src/GToolkit-Coder-UI/GtDiffElementWithLabelStencil.class.st +++ b/src/GToolkit-Coder-UI/GtDiffElementWithLabelStencil.class.st @@ -26,7 +26,6 @@ GtDiffElementWithLabelStencil >> create [ | headerElement diffContainer | headerElement := BrHorizontalPane new - padding: (BlInsets all: 0); hMatchParent; vFitContent. @@ -58,6 +57,7 @@ GtDiffElementWithLabelStencil >> createDiffContainer [ { #category : #'building - widgets' } GtDiffElementWithLabelStencil >> createFromLabel [ ^ BrLabel new + margin: (BlInsets left: 9); aptitude: BrGlamorousLabelAptitude; text: (self fromLabelText asRopedText glamorousCodeSmallSize foreground: BrGlamorousColors defaultButtonTextColor); @@ -85,11 +85,12 @@ GtDiffElementWithLabelStencil >> createPanesDiffElement [ { #category : #'building - widgets' } GtDiffElementWithLabelStencil >> createToLabel [ - ^ BrLabel new + ^ BrLabel new + margin: (BlInsets left: 16); aptitude: BrGlamorousLabelAptitude; text: (self toLabelText asRopedText glamorousCodeSmallSize foreground: BrGlamorousColors defaultButtonTextColor); - hMatchParent + hMatchParent ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtPharoCompiledMethods.class.st b/src/GToolkit-Coder-UI/GtPharoCompiledMethods.class.st new file mode 100644 index 000000000..98c24bc0b --- /dev/null +++ b/src/GToolkit-Coder-UI/GtPharoCompiledMethods.class.st @@ -0,0 +1,118 @@ +Class { + #name : #GtPharoCompiledMethods, + #superclass : #Object, + #traits : 'TGtGroupWithItems', + #classTraits : 'TGtGroupWithItems classTrait', + #category : #'GToolkit-Coder-UI-Phlow Targets' +} + +{ #category : #'as yet unclassified' } +GtPharoCompiledMethods >> gtCompareMethodsAsFilterFor: anAction [ + + self size = 2 ifFalse: [ ^ anAction noAction ]. + ^ anAction button + priority: 2; + target: GtCoderMethodsTarget; + icon: BrGlamorousVectorIcons empty; + label: 'Compare methods'; + menuItemPreview: ('{1} methods' format: {self size}); + menuItemGroup: BrMenuItemGroupConfiguration navigation; + action: [ :b | b phlow spawnObject: (GtRGMethodDefinitionWithComparisonGroup withAll: self) ] +] + +{ #category : #'as yet unclassified' } +GtPharoCompiledMethods >> gtInspectMethodsAsFilterFor: anAction [ + + ^ anAction button + priority: 2; + target: GtCoderMethodsTarget; + icon: BrGlamorousVectorIcons empty; + label: 'Inspect methods as filter'; + menuItemPreview: ('{1} methods' format: {self size}); + menuItemGroup: BrMenuItemGroupConfiguration navigation; + action: [ :b | b phlow spawnObject: (GtSearchFixedMethodsFilter new methods: self) ] +] + +{ #category : #views } +GtPharoCompiledMethods >> gtItemsFor: aView [ + + items ifNil: [ ^ aView empty ]. + ^ aView columnedList + title: 'Items'; + items: [ items ]; + withMultipleSelection; + column: 'Class' text: [ :each | each methodClass name ]; + column: 'Selector' text: [ :each | each selector ]; + column: 'Package' text: [ :each | each package name ]; + dynamicContextItems: [ :aCollection | + (GtCoderMethodsTarget uniqueInstance + menuItemsForObject: (GtPharoCompiledMethods withAll: aCollection) + hostElement: BlElement new) items ] +] + +{ #category : #'as yet unclassified' } +GtPharoCompiledMethods >> gtRemoveMethodsFor: anAction [ + "" + ^ anAction dropdown + priority: 100; + target: GtCoderMethodsTarget; + icon: BrGlamorousVectorIcons bin; + label: 'Remove methods'; + menuItemPreview: ('{1} methods' format: {self size}); + menuItemGroup: BrMenuItemGroupConfiguration removal; + menuItemPinSubmenu; + content: [ :aButton :aTargetElement :anExplicitMenu | + self removeSeveralMethodsSubmenuFor: self ] +] + +{ #category : #'as yet unclassified' } +GtPharoCompiledMethods >> removeSeveralMethodsSubmenuFor: aCollection [ + | element changes change button | + element := BrVerticalPane new fitContent. + element + addChild: (BrLabel new + margin: (BlInsets + top: 10 + bottom: 0 + left: 10 + right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont; + text: ('Remove {1} methods' format: {aCollection size}) asRopedText). + element + addChild: (BrAsyncWidget new + fitContent; + stencil: [ | pane references | + pane := BrVerticalPane new. + pane fitContent. + references := aCollection + inject: 0 + into: [ :sum :method1 | sum + (GtPharoIndex current sendersOf: method1 selector) size ]. + references > 0 + ifTrue: [ pane + addChild: (BrLabel new + margin: (BlInsets left: 10 right: 10); + aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; + text: (references printString , ' reference' + , (references > 1 ifTrue: [ 's' ] ifFalse: [ '' ])) asRopedText) ]. + pane ]). + changes := aCollection + collect: [ :eachMethod | RBRemoveMethodChange remove: eachMethod selector from: eachMethod methodClass ]. + change := RBCompositeRefactoryChange new + name: ('Remove {1} methods' format: {aCollection size}); + changes: changes; + yourself. + button := BrButton new + aptitude: BrGlamorousButtonWithIconAptitude; + beSmallSize; + margin: (BlInsets + top: 10 + bottom: 10 + left: 10 + right: 10); + icon: BrGlamorousVectorIcons remove; + label: 'Remove'; + action: [ "submenu hideAll." self halt. + change execute ]. + element addChild: button as: #removeButton. + ^ element +] From 1ea4d3e52c409e8cddf3e471cda7439779a09300 Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Mon, 17 Nov 2025 12:17:19 +0100 Subject: [PATCH 1141/1268] remove halt feenkcom/gtoolkit#4848 --- src/GToolkit-Coder-UI/GtPharoCompiledMethods.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtPharoCompiledMethods.class.st b/src/GToolkit-Coder-UI/GtPharoCompiledMethods.class.st index 98c24bc0b..d68e143c8 100644 --- a/src/GToolkit-Coder-UI/GtPharoCompiledMethods.class.st +++ b/src/GToolkit-Coder-UI/GtPharoCompiledMethods.class.st @@ -111,7 +111,7 @@ GtPharoCompiledMethods >> removeSeveralMethodsSubmenuFor: aCollection [ right: 10); icon: BrGlamorousVectorIcons remove; label: 'Remove'; - action: [ "submenu hideAll." self halt. + action: [ "submenu hideAll." change execute ]. element addChild: button as: #removeButton. ^ element From c64b592925e8de71dae5ef9cf3b38bc4fad7f203 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 17 Nov 2025 18:05:29 -0300 Subject: [PATCH 1142/1268] use Phlow actions to define method context menu [feenkcom/gtoolkit#4850] --- .../GtCoderMethodsGroupedListElement.class.st | 110 +----------------- .../GtPharoCompiledMethods.class.st | 106 ++--------------- 2 files changed, 12 insertions(+), 204 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index 7a2cc4830..ffaf23ffb 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -96,116 +96,14 @@ GtCoderMethodsGroupedListElement >> buildMethodItem [ { #category : #'private - context menu' } GtCoderMethodsGroupedListElement >> contextMenuForOneItem: item in: anElement [ - | menu | - menu := BrMenuItems new. - menu - addItem: (BrMenuActionItem new - group: BrMenuItemGroupConfiguration navigation; - label: (self createLabel: 'Browse implementors' description: item selector); - action: [ self browseImplementorsOf: item selector ]). - menu - addItem: (BrMenuActionItem new - group: BrMenuItemGroupConfiguration navigation; - label: (self createLabel: 'Browse hierarchy implementors' description: item selector); - action: [ self browseHierarchyImplementorsOf: item selector ]). - menu - addItem: (BrMenuActionItem new - group: BrMenuItemGroupConfiguration navigation; - label: (self createLabel: 'Browse references' description: item selector); - action: [ self browseReferencesOf: item selector ]). - menu - addItem: (BrMenuActionItem new - group: BrMenuItemGroupConfiguration navigation; - label: (self createLabel: 'Browse hierarchy references' description: item selector); - action: [ self browseHierarchyReferencesOf: item selector ]). - menu - addItem: (BrMenuSubmenuItem new - group: BrMenuItemGroupConfiguration refactoring; - label: (self createLabel: 'Push up method' description: item selector); - submenu: (self pushUpMethodSubmenuFor: item); - bePinSubmenuAction). - - item methodClass subclasses notEmpty - ifTrue: [ menu - addItem: (BrMenuSubmenuItem new - group: BrMenuItemGroupConfiguration refactoring; - label: (self createLabel: 'Push down method' description: item selector); - submenu: (self pushDownMethodSubmenuFor: item); - bePinSubmenuAction) ]. - menu - addItem: (BrMenuSubmenuItem new - group: BrMenuItemGroupConfiguration refactoring; - label: (self createLabel: 'Rename message' description: item selector); - submenu: (self renameMethodSubmenuFor: item); - bePinSubmenuAction). - menu - addItem: (BrMenuSubmenuItem new - group: BrMenuItemGroupConfiguration refactoring; - label: (self createLabel: 'Remove method' description: item selector); - submenu: (self removeMethodSubmenuFor: item)). - ^ menu + ^ GtCoderMethodTarget menuItemsForObject: item hostElement: anElement ] { #category : #'private - context menu' } GtCoderMethodsGroupedListElement >> contextMenuForSeveralItems: someItems in: anElement [ - | menu | - menu := BrMenuItems new. - menu - addItem: (BrMenuActionItem new - group: BrMenuItemGroupConfiguration navigation; - label: (self - createLabel: 'Browse implementors' - description: ('{1} methods' format: {someItems size})); - action: [ self browseSeveralImplementorsOf: (someItems collect: #selector) ]). - menu - addItem: (BrMenuActionItem new - group: BrMenuItemGroupConfiguration navigation; - label: (self - createLabel: 'Browse hierarachy implementors' - description: ('{1} methods' format: {someItems size})); - action: [ self browseSeveralHierarchyImplementorsOf: (someItems collect: #selector) ]). - menu - addItem: (BrMenuActionItem new - group: BrMenuItemGroupConfiguration navigation; - label: (self - createLabel: 'Browse references' - description: ('{1} methods' format: {someItems size})); - action: [ self browseSeveralReferencesOf: (someItems collect: #selector) ]). - menu - addItem: (BrMenuActionItem new - group: BrMenuItemGroupConfiguration navigation; - label: (self - createLabel: 'Browse hierarchy references' - description: ('{1} methods' format: {someItems size})); - action: [ self browseSeveralHierarchyReferencesOf: (someItems collect: #selector) ]). - - menu - addItem: (BrMenuSubmenuItem new - group: BrMenuItemGroupConfiguration refactoring; - label: (self - createLabel: 'Push up methods' - description: ('{1} methods' format: {someItems size})); - submenu: (self pushUpSeveralMethodsSubmenuFor: someItems); - bePinSubmenuAction). - - someItems anyOne methodClass subclasses notEmpty - ifTrue: [ menu - addItem: (BrMenuSubmenuItem new - group: BrMenuItemGroupConfiguration refactoring; - label: (self - createLabel: 'Push down methods' - description: ('{1} methods' format: {someItems size})); - submenu: (self pushDownSeveralMethodsSubmenuFor: someItems); - bePinSubmenuAction) ]. - - menu - addItem: (BrMenuSubmenuItem new - group: BrMenuItemGroupConfiguration refactoring; - label: (self - createLabel: 'Remove methods' - description: ('{1} methods' format: {someItems size})); - submenu: (self removeSeveralMethodsSubmenuFor: someItems)). - ^ menu + ^ GtCoderMethodsTarget + menuItemsForObject: (GtPharoCompiledMethods withAll: someItems) + hostElement: anElement ] { #category : #'private - insance creation' } diff --git a/src/GToolkit-Coder-UI/GtPharoCompiledMethods.class.st b/src/GToolkit-Coder-UI/GtPharoCompiledMethods.class.st index d68e143c8..dec20a9ee 100644 --- a/src/GToolkit-Coder-UI/GtPharoCompiledMethods.class.st +++ b/src/GToolkit-Coder-UI/GtPharoCompiledMethods.class.st @@ -6,33 +6,6 @@ Class { #category : #'GToolkit-Coder-UI-Phlow Targets' } -{ #category : #'as yet unclassified' } -GtPharoCompiledMethods >> gtCompareMethodsAsFilterFor: anAction [ - - self size = 2 ifFalse: [ ^ anAction noAction ]. - ^ anAction button - priority: 2; - target: GtCoderMethodsTarget; - icon: BrGlamorousVectorIcons empty; - label: 'Compare methods'; - menuItemPreview: ('{1} methods' format: {self size}); - menuItemGroup: BrMenuItemGroupConfiguration navigation; - action: [ :b | b phlow spawnObject: (GtRGMethodDefinitionWithComparisonGroup withAll: self) ] -] - -{ #category : #'as yet unclassified' } -GtPharoCompiledMethods >> gtInspectMethodsAsFilterFor: anAction [ - - ^ anAction button - priority: 2; - target: GtCoderMethodsTarget; - icon: BrGlamorousVectorIcons empty; - label: 'Inspect methods as filter'; - menuItemPreview: ('{1} methods' format: {self size}); - menuItemGroup: BrMenuItemGroupConfiguration navigation; - action: [ :b | b phlow spawnObject: (GtSearchFixedMethodsFilter new methods: self) ] -] - { #category : #views } GtPharoCompiledMethods >> gtItemsFor: aView [ @@ -44,75 +17,12 @@ GtPharoCompiledMethods >> gtItemsFor: aView [ column: 'Class' text: [ :each | each methodClass name ]; column: 'Selector' text: [ :each | each selector ]; column: 'Package' text: [ :each | each package name ]; - dynamicContextItems: [ :aCollection | - (GtCoderMethodsTarget uniqueInstance - menuItemsForObject: (GtPharoCompiledMethods withAll: aCollection) - hostElement: BlElement new) items ] -] - -{ #category : #'as yet unclassified' } -GtPharoCompiledMethods >> gtRemoveMethodsFor: anAction [ - "" - ^ anAction dropdown - priority: 100; - target: GtCoderMethodsTarget; - icon: BrGlamorousVectorIcons bin; - label: 'Remove methods'; - menuItemPreview: ('{1} methods' format: {self size}); - menuItemGroup: BrMenuItemGroupConfiguration removal; - menuItemPinSubmenu; - content: [ :aButton :aTargetElement :anExplicitMenu | - self removeSeveralMethodsSubmenuFor: self ] -] - -{ #category : #'as yet unclassified' } -GtPharoCompiledMethods >> removeSeveralMethodsSubmenuFor: aCollection [ - | element changes change button | - element := BrVerticalPane new fitContent. - element - addChild: (BrLabel new - margin: (BlInsets - top: 10 - bottom: 0 - left: 10 - right: 10); - aptitude: BrGlamorousLabelAptitude new glamorousRegularFont; - text: ('Remove {1} methods' format: {aCollection size}) asRopedText). - element - addChild: (BrAsyncWidget new - fitContent; - stencil: [ | pane references | - pane := BrVerticalPane new. - pane fitContent. - references := aCollection - inject: 0 - into: [ :sum :method1 | sum + (GtPharoIndex current sendersOf: method1 selector) size ]. - references > 0 - ifTrue: [ pane - addChild: (BrLabel new - margin: (BlInsets left: 10 right: 10); - aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; - text: (references printString , ' reference' - , (references > 1 ifTrue: [ 's' ] ifFalse: [ '' ])) asRopedText) ]. - pane ]). - changes := aCollection - collect: [ :eachMethod | RBRemoveMethodChange remove: eachMethod selector from: eachMethod methodClass ]. - change := RBCompositeRefactoryChange new - name: ('Remove {1} methods' format: {aCollection size}); - changes: changes; - yourself. - button := BrButton new - aptitude: BrGlamorousButtonWithIconAptitude; - beSmallSize; - margin: (BlInsets - top: 10 - bottom: 10 - left: 10 - right: 10); - icon: BrGlamorousVectorIcons remove; - label: 'Remove'; - action: [ "submenu hideAll." - change execute ]. - element addChild: button as: #removeButton. - ^ element + dynamicContextItems: [ :anElement :aCollection | + aCollection size = 1 + ifTrue: [ GtCoderMethodTarget + menuItemsForObject: aCollection anyOne + hostElement: anElement ] + ifFalse: [ GtCoderMethodsTarget + menuItemsForObject: (GtPharoCompiledMethods withAll: aCollection) + hostElement: anElement ] ] ] From 7cb2835ca04a47063c577029fc4e7a57509d4f2e Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 17 Nov 2025 18:14:11 -0300 Subject: [PATCH 1143/1268] rename `GtPharoCompiledMethods` to `GtPharoCompiledMethodGroup` [feenkcom/gtoolkit#4850] --- .../GtCoderMethodsGroupedListElement.class.st | 2 +- ...Methods.class.st => GtPharoCompiledMethodGroup.class.st} | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) rename src/GToolkit-Coder-UI/{GtPharoCompiledMethods.class.st => GtPharoCompiledMethodGroup.class.st} (81%) diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index ffaf23ffb..54f9b60ce 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -102,7 +102,7 @@ GtCoderMethodsGroupedListElement >> contextMenuForOneItem: item in: anElement [ { #category : #'private - context menu' } GtCoderMethodsGroupedListElement >> contextMenuForSeveralItems: someItems in: anElement [ ^ GtCoderMethodsTarget - menuItemsForObject: (GtPharoCompiledMethods withAll: someItems) + menuItemsForObject: (GtPharoCompiledMethodGroup withAll: someItems) hostElement: anElement ] diff --git a/src/GToolkit-Coder-UI/GtPharoCompiledMethods.class.st b/src/GToolkit-Coder-UI/GtPharoCompiledMethodGroup.class.st similarity index 81% rename from src/GToolkit-Coder-UI/GtPharoCompiledMethods.class.st rename to src/GToolkit-Coder-UI/GtPharoCompiledMethodGroup.class.st index dec20a9ee..a13630b91 100644 --- a/src/GToolkit-Coder-UI/GtPharoCompiledMethods.class.st +++ b/src/GToolkit-Coder-UI/GtPharoCompiledMethodGroup.class.st @@ -1,5 +1,5 @@ Class { - #name : #GtPharoCompiledMethods, + #name : #GtPharoCompiledMethodGroup, #superclass : #Object, #traits : 'TGtGroupWithItems', #classTraits : 'TGtGroupWithItems classTrait', @@ -7,7 +7,7 @@ Class { } { #category : #views } -GtPharoCompiledMethods >> gtItemsFor: aView [ +GtPharoCompiledMethodGroup >> gtItemsFor: aView [ items ifNil: [ ^ aView empty ]. ^ aView columnedList @@ -23,6 +23,6 @@ GtPharoCompiledMethods >> gtItemsFor: aView [ menuItemsForObject: aCollection anyOne hostElement: anElement ] ifFalse: [ GtCoderMethodsTarget - menuItemsForObject: (GtPharoCompiledMethods withAll: aCollection) + menuItemsForObject: (GtPharoCompiledMethodGroup withAll: aCollection) hostElement: anElement ] ] ] From ddadf286d0d55a8250c4f7be27ab35940d3b95ad Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 18 Nov 2025 15:19:10 -0300 Subject: [PATCH 1144/1268] move `GtPharoCompiledMethodGroup` to `gt4pharo` repository [feenkcom/gtoolkit#4850] --- .../GtPharoCompiledMethodGroup.class.st | 28 ------------------- 1 file changed, 28 deletions(-) delete mode 100644 src/GToolkit-Coder-UI/GtPharoCompiledMethodGroup.class.st diff --git a/src/GToolkit-Coder-UI/GtPharoCompiledMethodGroup.class.st b/src/GToolkit-Coder-UI/GtPharoCompiledMethodGroup.class.st deleted file mode 100644 index a13630b91..000000000 --- a/src/GToolkit-Coder-UI/GtPharoCompiledMethodGroup.class.st +++ /dev/null @@ -1,28 +0,0 @@ -Class { - #name : #GtPharoCompiledMethodGroup, - #superclass : #Object, - #traits : 'TGtGroupWithItems', - #classTraits : 'TGtGroupWithItems classTrait', - #category : #'GToolkit-Coder-UI-Phlow Targets' -} - -{ #category : #views } -GtPharoCompiledMethodGroup >> gtItemsFor: aView [ - - items ifNil: [ ^ aView empty ]. - ^ aView columnedList - title: 'Items'; - items: [ items ]; - withMultipleSelection; - column: 'Class' text: [ :each | each methodClass name ]; - column: 'Selector' text: [ :each | each selector ]; - column: 'Package' text: [ :each | each package name ]; - dynamicContextItems: [ :anElement :aCollection | - aCollection size = 1 - ifTrue: [ GtCoderMethodTarget - menuItemsForObject: aCollection anyOne - hostElement: anElement ] - ifFalse: [ GtCoderMethodsTarget - menuItemsForObject: (GtPharoCompiledMethodGroup withAll: aCollection) - hostElement: anElement ] ] -] From d18b6ba3a8d901e36e77c9df11fb7d3269124390 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 18 Nov 2025 16:47:26 -0300 Subject: [PATCH 1145/1268] define package and package tag context menu using phlow actions [feenkcom/gtoolkit#4859] --- .../GtCoderPackageTagTarget.class.st | 5 + .../GtCoderPackageTarget.class.st | 5 + .../GtCoderPackagesTarget.class.st | 5 + .../GtCoderPackagesTreeElement.class.st | 167 +----------------- 4 files changed, 19 insertions(+), 163 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderPackageTagTarget.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderPackageTarget.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderPackagesTarget.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderPackageTagTarget.class.st b/src/GToolkit-Coder-UI/GtCoderPackageTagTarget.class.st new file mode 100644 index 000000000..594cbf473 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderPackageTagTarget.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtCoderPackageTagTarget, + #superclass : #GtPhlowActionUniqueTarget, + #category : #'GToolkit-Coder-UI-Phlow Targets' +} diff --git a/src/GToolkit-Coder-UI/GtCoderPackageTarget.class.st b/src/GToolkit-Coder-UI/GtCoderPackageTarget.class.st new file mode 100644 index 000000000..e919d0c86 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderPackageTarget.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtCoderPackageTarget, + #superclass : #GtPhlowActionUniqueTarget, + #category : #'GToolkit-Coder-UI-Phlow Targets' +} diff --git a/src/GToolkit-Coder-UI/GtCoderPackagesTarget.class.st b/src/GToolkit-Coder-UI/GtCoderPackagesTarget.class.st new file mode 100644 index 000000000..fe68c85b2 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderPackagesTarget.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtCoderPackagesTarget, + #superclass : #GtPhlowActionUniqueTarget, + #category : #'GToolkit-Coder-UI-Phlow Targets' +} diff --git a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st index 21a4da5f0..c9f2274a2 100644 --- a/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPackagesTreeElement.class.st @@ -64,32 +64,10 @@ GtCoderPackagesTreeElement >> childrenForPackageOrTag: aPackageOrTag [ { #category : #initialization } GtCoderPackagesTreeElement >> contextMenuFor: aPackageOrTag [ - | menu | - menu := BrMenuItems new. - menu - addItemLabel: (self createLabel: 'New package / tag' description: '') - action: [ self newPackage ]. - aPackageOrTag isPharoPackageModel - ifTrue: [ menu - addItem: (BrMenuSubmenuItem new - label: (self createLabel: 'Rename package' description: aPackageOrTag name); - submenu: (self renamePackageSubmenuFor: aPackageOrTag); - bePinSubmenuAction). - menu - addItem: (BrMenuSubmenuItem new - label: (self createLabel: 'Remove package' description: aPackageOrTag name); - submenu: (self removePackageSubmenuFor: aPackageOrTag)) ] - ifFalse: [ menu - addItem: (BrMenuSubmenuItem new - label: (self createLabel: 'Rename tag' description: aPackageOrTag name); - submenu: (self renamePackageTagSubmenuFor: aPackageOrTag); - bePinSubmenuAction). - menu - addItem: (BrMenuSubmenuItem new - label: (self createLabel: 'Remove tag' description: aPackageOrTag name); - submenu: (self removePackageTagSubmenuFor: aPackageOrTag)) ]. - - ^ menu + + ^ aPackageOrTag isPharoPackageModel + ifTrue: [ GtCoderPackageTarget menuItemsForObject: aPackageOrTag hostElement: self ] + ifFalse: [ GtCoderPackageTagTarget menuItemsForObject: aPackageOrTag hostElement: self ] ] { #category : #initialization } @@ -250,143 +228,6 @@ GtCoderPackagesTreeElement >> promoteTag: aPackageOrTag inElement: elem [ self notYetImplemented ] -{ #category : #initialization } -GtCoderPackagesTreeElement >> removePackageSubmenuFor: aPackage [ - | submenu | - submenu := BrMenuExplicit new. - ^ submenu - stencil: [ | element change button | - element := BrVerticalPane new fitContent. - element - addChild: ((self buildRemovePackageLabelFor: aPackage) - margin: (BlInsets - top: 10 - bottom: 0 - left: 10 - right: 10)). - element - addChild: (BrAsyncWidget new - fitContent; - stencil: [ | pane definedClasses extendedClasses | - pane := BrVerticalPane new. - pane fitContent. - definedClasses := aPackage definedClassNames size. - extendedClasses := aPackage extendedClassNames size. - definedClasses > 0 - ifTrue: [ pane - addChild: (BrLabel new - margin: (BlInsets left: 10 right: 10); - aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; - text: (definedClasses printString , ' defined class' - , (definedClasses > 1 ifTrue: [ 'es' ] ifFalse: [ '' ])) - asRopedText) ]. - extendedClasses > 0 - ifTrue: [ pane - addChild: (BrLabel new - margin: (BlInsets left: 10 right: 10); - aptitude: BrGlamorousLabelAptitude new glamorousRegularFont thin; - text: (extendedClasses printString , ' extended class' - , (extendedClasses > 1 ifTrue: [ 'es' ] ifFalse: [ '' ])) - asRopedText) ]. - pane ]). - change := RBRemovePackageChange removePackageNamed: aPackage name. - button := BrButton new - aptitude: BrGlamorousButtonWithIconAptitude; - beSmallSize; - margin: (BlInsets - top: 10 - bottom: 10 - left: 10 - right: 10); - icon: BrGlamorousVectorIcons remove; - label: 'Remove'; - action: [ submenu hideAll. - change execute ]. - element addChild: button as: #removeButton. - element ] -] - -{ #category : #initialization } -GtCoderPackagesTreeElement >> removePackageTagSubmenuFor: aPackageTag [ - | submenu | - submenu := BrMenuExplicit new. - ^ submenu - stencil: [ | element change button | - element := BrVerticalPane new fitContent. - element - addChild: ((self buildRemoveTagLabelFor: aPackageTag) - margin: (BlInsets - top: 10 - bottom: 0 - left: 10 - right: 10)). - change := GtRBRemovePackageTagChange - packageName: aPackageTag package name - tagName: aPackageTag name. - button := BrButton new - aptitude: BrGlamorousButtonWithIconAptitude; - beSmallSize; - margin: (BlInsets - top: 10 - bottom: 10 - left: 10 - right: 10); - icon: BrGlamorousVectorIcons remove; - label: 'Remove'; - action: [ submenu hideAll. - change execute ]. - element addChild: button as: #removeButton. - element ] -] - -{ #category : #'private - context menu' } -GtCoderPackagesTreeElement >> renamePackageSubmenuFor: aPackage [ - ^ BrMenuExplicit new - stencil: [ :anExplicitMenu | - | aViewModel | - anExplicitMenu id: #'coder--context-menu-rename-package-form'. - - aViewModel := GtRefactoringsWithInputViewModel new - refactoringTitle: 'Rename package'; - targetName: aPackage name; - inputLabel: 'New package name:'; - initialText: aPackage name; - refactoringWithInput: [ :anInput | GtRBRenamePackageRefactoring from: aPackage name to: anInput ]; - afterAppliedBlock: [ BlTaskAction enqueueElement: self action: [ anExplicitMenu hideAll ] ]; - menuModel: anExplicitMenu; - anchorElement: self. - GtRefactoringsPreviewWithInputElement new - refactoringsViewModel: aViewModel; - beContextMenuElement; - bePinnable: anExplicitMenu ] -] - -{ #category : #'private - context menu' } -GtCoderPackagesTreeElement >> renamePackageTagSubmenuFor: aPackageTag [ - ^ BrMenuExplicit new - stencil: [ :anExplicitMenu | - | aViewModel | - anExplicitMenu id: #'coder--context-menu-rename-package-tag-form'. - - aViewModel := GtRefactoringsWithInputViewModel new - refactoringTitle: 'Rename package tag'; - targetName: aPackageTag name; - inputLabel: 'New package tag name:'; - initialText: aPackageTag name; - refactoringWithInput: [ :anInput | - GtRBRenamePackageTagRefactoring - packageName: aPackageTag packageName - from: aPackageTag name - to: anInput ]; - afterAppliedBlock: [ BlTaskAction enqueueElement: self action: [ anExplicitMenu hideAll ] ]; - menuModel: anExplicitMenu; - anchorElement: self. - GtRefactoringsPreviewWithInputElement new - refactoringsViewModel: aViewModel; - beContextMenuElement; - bePinnable: anExplicitMenu ] -] - { #category : #'private - context menu' } GtCoderPackagesTreeElement >> requestRenamePackage: aPackageOrTag [ "An entrance point to the rename package action. From 67d9056254597310bbf5ff9f01ddb8934b7ce78e Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 18 Nov 2025 19:29:24 -0300 Subject: [PATCH 1146/1268] fix method attribute name [feenkcom/gtoolkit#4859] --- src/GToolkit-Coder-UI/GtPhlowContext.extension.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtPhlowContext.extension.st b/src/GToolkit-Coder-UI/GtPhlowContext.extension.st index 66d75b8ad..b969b0fa9 100644 --- a/src/GToolkit-Coder-UI/GtPhlowContext.extension.st +++ b/src/GToolkit-Coder-UI/GtPhlowContext.extension.st @@ -1,8 +1,8 @@ Extension { #name : #GtPhlowContext } { #category : #'*GToolkit-Coder-UI' } -GtPhlowContext >> coderCompiledMethod: aClass [ - self optionAt: #coderCompiledMethod put: aClass +GtPhlowContext >> coderCompiledMethod: aCompiledMethod [ + self optionAt: #coderCompiledMethod put: aCompiledMethod ] { #category : #'*GToolkit-Coder-UI' } From 08ebeff780be7c882a87e9df5b0fc39b57029f47 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 18 Nov 2025 21:11:13 -0300 Subject: [PATCH 1147/1268] use GtPharoClassGroup --- src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st index 826936157..e94a09367 100644 --- a/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderClassesTreeElement.class.st @@ -90,11 +90,8 @@ GtCoderClassesTreeElement >> contextMenuForOneItem: aClass [ { #category : #initialization } GtCoderClassesTreeElement >> contextMenuForSeveralItems: someClasses [ - | aPhlowContext | - aPhlowContext := GtPhlowContext new coderSelectedClasses: someClasses. ^ GtCoderClassesTarget - menuItemsForObject: someClasses anyOne - inContext: aPhlowContext + menuItemsForObject: (GtPharoClassGroup withAll: someClasses) hostElement: self ] From da01fa73fd2715467b3f41e67436a3d1b24246a6 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 19 Nov 2025 16:10:44 -0300 Subject: [PATCH 1148/1268] `GtMethodCoderTool` can have selfObject [feenkcom/gtoolkit#4850] --- src/GToolkit-Coder-UI/GtMethodCoderTool.class.st | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtMethodCoderTool.class.st b/src/GToolkit-Coder-UI/GtMethodCoderTool.class.st index c7c9fe158..14e2d9c1b 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderTool.class.st @@ -1,6 +1,8 @@ Class { #name : #GtMethodCoderTool, #superclass : #GtCoderTool, + #traits : 'TGtPhlowWithSelfObjectHolder', + #classTraits : 'TGtPhlowWithSelfObjectHolder classTrait', #instVars : [ 'compiledMethod' ], @@ -24,7 +26,10 @@ GtMethodCoderTool >> compiledMethod: anObject [ { #category : #converting } GtMethodCoderTool >> newCoder [ - ^ GtCoderElement forMethod: self compiledMethod + ^ self + ifSelfObject: [ :aSelfObject | + GtCoderElement forObject: aSelfObject method: self compiledMethod ] + ifNone: [ GtCoderElement forMethod: self compiledMethod ] ] { #category : #accessing } From 2fcab3b706128ef15e0ccf21594248ca31a9c3a5 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 20 Nov 2025 09:49:30 +0100 Subject: [PATCH 1149/1268] [feenkcom/gtoolkit#4849] pass source around when expanding/collapsing a method coder --- .../GtExpandableCoderViewModel.class.st | 15 +++++++++++---- ...andableCoderViewModelExpansionChanged.class.st | 13 ++++++++++++- .../GtExpandableSourceCoderElement.class.st | 15 +++++++++------ 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtExpandableCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtExpandableCoderViewModel.class.st index 4e7ff787b..933a524b3 100644 --- a/src/GToolkit-Coder-UI/GtExpandableCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtExpandableCoderViewModel.class.st @@ -43,10 +43,16 @@ GtExpandableCoderViewModel >> expanded [ { #category : #'api - expansion' } GtExpandableCoderViewModel >> expanded: aBoolean [ - expanded = aBoolean ifTrue: [ ^ self ]. + self expanded: aBoolean from: self +] + +{ #category : #'api - expansion' } +GtExpandableCoderViewModel >> expanded: aBoolean from: aSourceObject [ + expanded = aBoolean + ifTrue: [ ^ self ]. expanded := aBoolean. - self notifyExpansionChanged: expanded + self notifyExpansionChanged: expanded from: aSourceObject ] { #category : #'api - focus' } @@ -93,11 +99,12 @@ GtExpandableCoderViewModel >> initialize [ ] { #category : #'private - notifying' } -GtExpandableCoderViewModel >> notifyExpansionChanged: aBoolean [ +GtExpandableCoderViewModel >> notifyExpansionChanged: aBoolean from: aSourceObject [ self announce: (GtExpandableCoderViewModelExpansionChanged new textualCoderViewModel: self; - expanded: aBoolean) + expanded: aBoolean; + source: aSourceObject) ] { #category : #'private - notifying' } diff --git a/src/GToolkit-Coder-UI/GtExpandableCoderViewModelExpansionChanged.class.st b/src/GToolkit-Coder-UI/GtExpandableCoderViewModelExpansionChanged.class.st index 05ecce10e..4b5a12265 100644 --- a/src/GToolkit-Coder-UI/GtExpandableCoderViewModelExpansionChanged.class.st +++ b/src/GToolkit-Coder-UI/GtExpandableCoderViewModelExpansionChanged.class.st @@ -2,7 +2,8 @@ Class { #name : #GtExpandableCoderViewModelExpansionChanged, #superclass : #GtTextualCoderViewModelAnnouncement, #instVars : [ - 'expanded' + 'expanded', + 'source' ], #category : #'GToolkit-Coder-UI-Coder - Textual Model - Events' } @@ -16,3 +17,13 @@ GtExpandableCoderViewModelExpansionChanged >> expanded [ GtExpandableCoderViewModelExpansionChanged >> expanded: aBoolean [ expanded := aBoolean ] + +{ #category : #accessing } +GtExpandableCoderViewModelExpansionChanged >> source [ + ^ source +] + +{ #category : #accessing } +GtExpandableCoderViewModelExpansionChanged >> source: anObject [ + source := anObject +] diff --git a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st index 3817394fb..1ba4f7bc3 100644 --- a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st @@ -80,8 +80,8 @@ GtExpandableSourceCoderElement >> initialize [ self states withExpansion. - self when: BrExpandedEvent do: [ self onExpanded ]. - self when: BrCollapsedEvent do: [ self onCollapsed ]. + self when: BrExpandedEvent do: [ :anEvent | anEvent target onExpanded ]. + self when: BrCollapsedEvent do: [ :anEvent | anEvent target onCollapsed ]. self header: [ collapsedElement := self newCollapsedElement ]; @@ -145,7 +145,7 @@ GtExpandableSourceCoderElement >> onCollapsed [ self beInSingleCompositionLayer. textualCoderViewModel ifNotNil: [ :aCoderUIModel | - aCoderUIModel expanded: false. + aCoderUIModel expanded: false from: self. (collapsedElement notNil and: [ self isDirty: collapsedElement ]) ifTrue: [ self assignCollapsedCoder: aCoderUIModel to: collapsedElement ] ] ] @@ -155,7 +155,7 @@ GtExpandableSourceCoderElement >> onExpanded [ self beInSeparateCompositionLayer. textualCoderViewModel ifNotNil: [ :aCoderUIModel | - aCoderUIModel expanded: true. + aCoderUIModel expanded: true from: self. (expandedElement notNil and: [ self isDirty: expandedElement ]) ifTrue: [ self assignExpandedCoder: aCoderUIModel to: expandedElement ] ] ] @@ -175,10 +175,13 @@ GtExpandableSourceCoderElement >> onTextualCoderViewModelChanged [ { #category : #'private - event handling' } GtExpandableSourceCoderElement >> onViewModelExpansionChanged: anAnnouncement [ - self hasTextualCoderViewModel ifFalse: [ ^ self ]. + anAnnouncement source == self + ifTrue: [ ^ self ]. + self hasTextualCoderViewModel + ifFalse: [ ^ self ]. anAnnouncement textualCoderViewModel = self textualCoderViewModel ifFalse: [ ^ self ]. - + BlTaskAction enqueueElement: self action: [ self expanded: anAnnouncement expanded ] From 93ca61f9b18cc15b0671bd409c37aa0da7cf1b07 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 20 Nov 2025 10:43:07 -0300 Subject: [PATCH 1150/1268] improve package and package tag tools [feenkcom/gtoolkit#4859] --- src/GToolkit-Coder-Extensions/Package.extension.st | 2 +- src/GToolkit-Coder-Extensions/RPackage.extension.st | 4 ++-- src/GToolkit-Coder-UI/GtPackageCoderTool.class.st | 11 ++++++++++- src/GToolkit-Coder-UI/GtPackageTagCoderTool.class.st | 11 ++++++++++- src/GToolkit-Coder-UI/Package.extension.st | 2 +- src/GToolkit-Coder-UI/PackageTag.extension.st | 6 ++++++ src/GToolkit-Coder-UI/RPackage.extension.st | 2 +- 7 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 src/GToolkit-Coder-UI/PackageTag.extension.st diff --git a/src/GToolkit-Coder-Extensions/Package.extension.st b/src/GToolkit-Coder-Extensions/Package.extension.st index f473a3e51..f9944384f 100644 --- a/src/GToolkit-Coder-Extensions/Package.extension.st +++ b/src/GToolkit-Coder-Extensions/Package.extension.st @@ -47,7 +47,7 @@ Package >> gtBrowse [ Package >> gtBrowseFrom: anElement [ ^ BlSpace new withSceneDriller; - inPager: [ GtPackageCoderTool package: self ]; + inPager: [ GtPackageCoderTool forPackage: self ]; title: self packageName; icon: BrGlamorousVectorIcons browse; showFrom: anElement diff --git a/src/GToolkit-Coder-Extensions/RPackage.extension.st b/src/GToolkit-Coder-Extensions/RPackage.extension.st index c4b73707e..a8570f9ac 100644 --- a/src/GToolkit-Coder-Extensions/RPackage.extension.st +++ b/src/GToolkit-Coder-Extensions/RPackage.extension.st @@ -37,7 +37,7 @@ RPackage >> gtBaselinesFor: aView [ RPackage >> gtBrowse [ ^ BlSpace new withSceneDriller; - inPager: [ GtPackageCoderTool package: self ]; + inPager: [ GtPackageCoderTool forPackage: self ]; title: self packageName; icon: BrGlamorousVectorIcons browse; show @@ -47,7 +47,7 @@ RPackage >> gtBrowse [ RPackage >> gtBrowseFrom: anElement [ ^ BlSpace new withSceneDriller; - inPager: [ GtPackageCoderTool package: self ]; + inPager: [ GtPackageCoderTool forPackage: self ]; title: self packageName; icon: BrGlamorousVectorIcons browse; showFrom: anElement diff --git a/src/GToolkit-Coder-UI/GtPackageCoderTool.class.st b/src/GToolkit-Coder-UI/GtPackageCoderTool.class.st index 97ed0fc5b..28d04f4b8 100644 --- a/src/GToolkit-Coder-UI/GtPackageCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtPackageCoderTool.class.st @@ -8,10 +8,19 @@ Class { } { #category : #'instance creation' } -GtPackageCoderTool class >> package: aPackage [ +GtPackageCoderTool class >> forPackage: aPackage [ ^ self new package: aPackage ] +{ #category : #'instance creation' } +GtPackageCoderTool class >> package: aPackage [ + "Should be removed since it overrides core method." + + self deprecated: 'Use #forPackage: instead'. + + ^ self forPackage: aPackage +] + { #category : #converting } GtPackageCoderTool >> newCoder [ ^ GtCoderElement forPackage: self package diff --git a/src/GToolkit-Coder-UI/GtPackageTagCoderTool.class.st b/src/GToolkit-Coder-UI/GtPackageTagCoderTool.class.st index c17ab2157..d0acc6531 100644 --- a/src/GToolkit-Coder-UI/GtPackageTagCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtPackageTagCoderTool.class.st @@ -8,10 +8,19 @@ Class { } { #category : #'instace creation' } -GtPackageTagCoderTool class >> packageTag: aPackageTag [ +GtPackageTagCoderTool class >> forPackageTag: aPackageTag [ ^ self new packageTag: aPackageTag ] +{ #category : #'instace creation' } +GtPackageTagCoderTool class >> packageTag: aPackageTag [ + "Should be removed since it overrides core method." + + self deprecated: 'Use #forPackageTag: instead'. + + ^ self forPackageTag: aPackageTag +] + { #category : #accessing } GtPackageTagCoderTool >> newCoder [ ^ GtCoderElement forPackageTag: self packageTag diff --git a/src/GToolkit-Coder-UI/Package.extension.st b/src/GToolkit-Coder-UI/Package.extension.st index 85be8ae8f..909f6eb5f 100644 --- a/src/GToolkit-Coder-UI/Package.extension.st +++ b/src/GToolkit-Coder-UI/Package.extension.st @@ -2,5 +2,5 @@ Extension { #name : #Package } { #category : #'*GToolkit-Coder-UI' } Package >> gtSpawnCoder [ - ^ GtPackageCoderTool package: self + ^ GtPackageCoderTool forPackage: self ] diff --git a/src/GToolkit-Coder-UI/PackageTag.extension.st b/src/GToolkit-Coder-UI/PackageTag.extension.st new file mode 100644 index 000000000..dfd7ba378 --- /dev/null +++ b/src/GToolkit-Coder-UI/PackageTag.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #PackageTag } + +{ #category : #'*GToolkit-Coder-UI' } +PackageTag >> gtSpawnCoder [ + ^ GtPackageTagCoderTool forPackageTag: self +] diff --git a/src/GToolkit-Coder-UI/RPackage.extension.st b/src/GToolkit-Coder-UI/RPackage.extension.st index 091f229b7..12c072432 100644 --- a/src/GToolkit-Coder-UI/RPackage.extension.st +++ b/src/GToolkit-Coder-UI/RPackage.extension.st @@ -2,5 +2,5 @@ Extension { #name : #RPackage } { #category : #'*GToolkit-Coder-UI' } RPackage >> gtSpawnCoder [ - ^ GtPackageCoderTool package: self + ^ GtPackageCoderTool forPackage: self ] From 157a7462d721f98d3a04fe19e58d126e8ead7e2e Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 20 Nov 2025 20:00:00 -0300 Subject: [PATCH 1151/1268] use addOns future instead of promise [feenkcom/gtoolkit#4849] --- ...ourceCoderCollapsedContentElement.class.st | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st index 094f1539a..cff3484f9 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st @@ -34,6 +34,28 @@ GtSourceCoderCollapsedContentElement >> newAddOnsContainer [ ^ BrHorizontalPane new matchParent; alignCenterLeft; + withAsyncFutureDo: [ :anElementFuture | + anElementFuture + executionConfiguration: GtSingleCoderViewModel methodAddOnsExecutionConfiguration; + whenSuccess: [ :aContainer :theAddOns | + aContainer removeChildren. + theAddOns previews do: [ :eachAddOn | + | eachAddOnElement | + + eachAddOnElement := previews + at: eachAddOn id + ifAbsentPut: [ eachAddOn stencil asElement ]. + + eachAddOn dataBinder + element: eachAddOnElement; + coderViewModel: textualCoderViewModel; + build. + + aContainer addChild: eachAddOnElement ] ]; + whenError: [ :aContainer :anError | + aContainer removeChildren. + aContainer addChild: (BrLabel new aptitude: BrGlamorousLabelAptitude; text: anError printString) ]; + whenPending: [ :aContainer | ] ]; withAsyncPromiseDo: [ :anElementPromise | anElementPromise whenSuccess: [ :aContainer :theAddOns | @@ -78,7 +100,7 @@ GtSourceCoderCollapsedContentElement >> onTextualCoderViewModelChanged [ self updateCollapsedTextLabel. addOns removeChildren. - addOns asyncPromise promise: textualCoderViewModel addOns + addOns asyncFuture future: textualCoderViewModel addOnsFuture ] { #category : #'private - event handling' } From 26003f92c36d9814b56323596886ef8603c4fdcf Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 26 Nov 2025 19:02:36 -0300 Subject: [PATCH 1152/1268] make it possible to receive a wish with a method selection [feenkcom/gtoolkit#4877] such wish can be then reflected in a navigation model --- src/GToolkit-Coder-UI/GtCoderElement.class.st | 23 +++++++++- .../GtCoderMethodSelectedSourceEvent.class.st | 25 +++++++++++ .../GtCoderMethodsGroupedListElement.class.st | 42 +++++++++++++++++-- .../GtNavigationMethodSelectionWish.class.st | 24 +++++++++++ ...CoderMethodNavigationAnnouncement.class.st | 13 +++++- ...oderMethodsNavigationAnnouncement.class.st | 13 +++++- .../GtCoderNavigationAnnouncement.class.st | 13 +++++- .../GtCoderNavigationModel.class.st | 21 +++++++++- .../GtCoderNullNavigationModel.class.st | 18 +++++++- 9 files changed, 181 insertions(+), 11 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderMethodSelectedSourceEvent.class.st create mode 100644 src/GToolkit-Coder-UI/GtNavigationMethodSelectionWish.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderElement.class.st b/src/GToolkit-Coder-UI/GtCoderElement.class.st index c69efacf3..54e096384 100644 --- a/src/GToolkit-Coder-UI/GtCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderElement.class.st @@ -161,7 +161,10 @@ GtCoderElement >> initialize [ do: [ :anEvent | self onGtCoderDisplayTopSidebarWish: anEvent ]. self when: GtCoderHideSidebarWish - do: [ :anEvent | self onGtCoderHideSidebarWish: anEvent ] + do: [ :anEvent | self onGtCoderHideSidebarWish: anEvent ]. + self + when: GtNavigationMethodSelectionWish + do: [ :anEvent | self onGtNavigationMethodSelectionWish: anEvent ] ] { #category : #'private - event handling' } @@ -191,6 +194,24 @@ GtCoderElement >> onGtCoderSidebarVisibilityWish: anEvent [ ifNone: [ anEvent isVisible: false ] ] +{ #category : #initialization } +GtCoderElement >> onGtNavigationMethodSelectionWish: anEvent [ + "Another method is selected in a methods coder, + let's select the same method in the navigation model." + + | aCompiledMethod | + anEvent consumed: true. + + anEvent source == self ifTrue: [ ^ self ]. + + aCompiledMethod := anEvent method. + self navigationModel ifNil: [ ^ self ]. + + self navigationModel + selectedMethod: aCompiledMethod + source: (anEvent source ifNil: [ self ]) +] + { #category : #'private - hooks' } GtCoderElement >> onNavigationModelChanged [ super onNavigationModelChanged. diff --git a/src/GToolkit-Coder-UI/GtCoderMethodSelectedSourceEvent.class.st b/src/GToolkit-Coder-UI/GtCoderMethodSelectedSourceEvent.class.st new file mode 100644 index 000000000..29a5f16b2 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderMethodSelectedSourceEvent.class.st @@ -0,0 +1,25 @@ +" +I am a helper event to indicate whether a selection happened due to a user click or changes in a model. +In other words, {{gtClass:GtCoderMethodsGroupedListElement}} does nothing if a selection is triggered from its {{gtClass:GtCoderNavigationModel}}. + +I am instantiated in {{gtMethod:GtCoderMethodsGroupedListElement>>#onMethodSelected:}} and checked in {{gtMethod:GtCoderMethodsGroupedListElement>>#onMethodsListSelectionChanged:}}. + +" +Class { + #name : #GtCoderMethodSelectedSourceEvent, + #superclass : #BlEvent, + #instVars : [ + 'originalSource' + ], + #category : #'GToolkit-Coder-UI-Navigation - Helpers' +} + +{ #category : #accessing } +GtCoderMethodSelectedSourceEvent >> originalSource [ + ^ originalSource +] + +{ #category : #accessing } +GtCoderMethodSelectedSourceEvent >> originalSource: anObject [ + originalSource := anObject +] diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index 54f9b60ce..f36a0b2c9 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -204,7 +204,7 @@ GtCoderMethodsGroupedListElement >> initialize [ self when: BrSelectionChanged - do: [ :anEvent | self onMethodsListSelectionChanged ] + do: [ :anEvent | self onMethodsListSelectionChanged: anEvent ] ] { #category : #accessing } @@ -231,12 +231,46 @@ GtCoderMethodsGroupedListElement >> navigationModel: anObject [ { #category : #'event handling - selection' } GtCoderMethodsGroupedListElement >> onMethodSelected: anAnnouncement [ + | aMethod aGroup | + anAnnouncement source = self ifTrue: [ ^ self ]. + aMethod := anAnnouncement method. + (self selectedItems includes: aMethod) ifTrue: [ ^ self ]. + + aGroup := aMethod methodClass isInstanceSide + ifTrue: [ methodGroups first ] + ifFalse: [ methodGroups second ]. + + self + group: aGroup + itemSuchThat: [ :eachItem | eachItem = aMethod ] + ifFound: [ :anIndex :isSynchronous | + self selectOne: anIndex dueTo: (GtCoderMethodSelectedSourceEvent new + source: self; + originalSource: anAnnouncement source) ] + ifNone: [ ]. + + GtJustContextStackSignal emit ] { #category : #'event handling - selection' } GtCoderMethodsGroupedListElement >> onMethodsListSelectionChanged [ - | theIndices allSelectedItems | + "Can be removed." + + self onMethodsListSelectionChanged: nil +] + +{ #category : #'event handling - selection' } +GtCoderMethodsGroupedListElement >> onMethodsListSelectionChanged: anEvent [ + | theIndices allSelectedItems aSource | + (anEvent isNotNil and: [ anEvent sourceEvent isKindOf: GtCoderMethodSelectedSourceEvent ]) + ifTrue: [ + "This element triggered the selection change, ignore the event." + anEvent sourceEvent source == self ifTrue: [ ^ self ]. + + aSource := anEvent sourceEvent originalSource ifNil: [ self ] ] + ifFalse: [ aSource := self ]. + theIndices := self selectedIndices ifEmpty: [ ^ self ]. (theIndices first between: 1 and: self viewModel entityCount) ifFalse: [ ^ self ]. @@ -246,8 +280,8 @@ GtCoderMethodsGroupedListElement >> onMethodsListSelectionChanged [ allSelectedItems := self selectedItems. allSelectedItems ifEmpty: [ ^ self ]. allSelectedItems size = 1 - ifTrue: [ self navigationModel selectMethod: allSelectedItems anyOne ] - ifFalse: [ self navigationModel selectMethods: allSelectedItems ] + ifTrue: [ self navigationModel selectMethod: allSelectedItems anyOne source: aSource ] + ifFalse: [ self navigationModel selectMethods: allSelectedItems source: aSource ] ] { #category : #'event handling - selection' } diff --git a/src/GToolkit-Coder-UI/GtNavigationMethodSelectionWish.class.st b/src/GToolkit-Coder-UI/GtNavigationMethodSelectionWish.class.st new file mode 100644 index 000000000..dbd862621 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtNavigationMethodSelectionWish.class.st @@ -0,0 +1,24 @@ +" +I let to know that another method is selected in a {{gtMethod:GtPharoStreamingMethodsCoderElement}} and that this new selection should be reflected in a corresponding {{gtClass:GtCoderMethodsGroupedListElement | label=sidebar index method list}}. + +To make it happen, I am handled by {{gtMethod:GtCoderElement>>#onGtNavigationMethodSelectionWish: | label=#methodClass}}, followed by a {{gtMethod:GtCoderNavigationModel>>#selectedMethod:source:}} call. + +" +Class { + #name : #GtNavigationMethodSelectionWish, + #superclass : #BrWish, + #instVars : [ + 'method' + ], + #category : #'GToolkit-Coder-UI-Navigation - Helpers' +} + +{ #category : #accessing } +GtNavigationMethodSelectionWish >> method [ + ^ method +] + +{ #category : #accessing } +GtNavigationMethodSelectionWish >> method: anObject [ + method := anObject +] diff --git a/src/GToolkit-Coder/GtClassCoderMethodNavigationAnnouncement.class.st b/src/GToolkit-Coder/GtClassCoderMethodNavigationAnnouncement.class.st index 7cda787af..54694358a 100644 --- a/src/GToolkit-Coder/GtClassCoderMethodNavigationAnnouncement.class.st +++ b/src/GToolkit-Coder/GtClassCoderMethodNavigationAnnouncement.class.st @@ -2,7 +2,8 @@ Class { #name : #GtClassCoderMethodNavigationAnnouncement, #superclass : #Announcement, #instVars : [ - 'method' + 'method', + 'source' ], #category : #'GToolkit-Coder-Event' } @@ -16,3 +17,13 @@ GtClassCoderMethodNavigationAnnouncement >> method [ GtClassCoderMethodNavigationAnnouncement >> method: aMethod [ method := aMethod ] + +{ #category : #accessing } +GtClassCoderMethodNavigationAnnouncement >> source [ + ^ source +] + +{ #category : #accessing } +GtClassCoderMethodNavigationAnnouncement >> source: anObject [ + source := anObject +] diff --git a/src/GToolkit-Coder/GtClassCoderMethodsNavigationAnnouncement.class.st b/src/GToolkit-Coder/GtClassCoderMethodsNavigationAnnouncement.class.st index 0a4d91484..9e0f3c1d4 100644 --- a/src/GToolkit-Coder/GtClassCoderMethodsNavigationAnnouncement.class.st +++ b/src/GToolkit-Coder/GtClassCoderMethodsNavigationAnnouncement.class.st @@ -2,7 +2,8 @@ Class { #name : #GtClassCoderMethodsNavigationAnnouncement, #superclass : #Announcement, #instVars : [ - 'methods' + 'methods', + 'source' ], #category : #'GToolkit-Coder-Event' } @@ -16,3 +17,13 @@ GtClassCoderMethodsNavigationAnnouncement >> methods [ GtClassCoderMethodsNavigationAnnouncement >> methods: anObject [ methods := anObject ] + +{ #category : #accessing } +GtClassCoderMethodsNavigationAnnouncement >> source [ + ^ source +] + +{ #category : #accessing } +GtClassCoderMethodsNavigationAnnouncement >> source: anObject [ + source := anObject +] diff --git a/src/GToolkit-Coder/GtCoderNavigationAnnouncement.class.st b/src/GToolkit-Coder/GtCoderNavigationAnnouncement.class.st index 9007cafd1..2584be645 100644 --- a/src/GToolkit-Coder/GtCoderNavigationAnnouncement.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationAnnouncement.class.st @@ -2,7 +2,8 @@ Class { #name : #GtCoderNavigationAnnouncement, #superclass : #Announcement, #instVars : [ - 'coder' + 'coder', + 'source' ], #category : #'GToolkit-Coder-Navigation - Events' } @@ -16,3 +17,13 @@ GtCoderNavigationAnnouncement >> coder [ GtCoderNavigationAnnouncement >> coder: aCoder [ coder := aCoder ] + +{ #category : #accessing } +GtCoderNavigationAnnouncement >> source [ + ^ source +] + +{ #category : #accessing } +GtCoderNavigationAnnouncement >> source: anObject [ + source := anObject +] diff --git a/src/GToolkit-Coder/GtCoderNavigationModel.class.st b/src/GToolkit-Coder/GtCoderNavigationModel.class.st index 2c0e8d7f2..432caf80e 100644 --- a/src/GToolkit-Coder/GtCoderNavigationModel.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationModel.class.st @@ -66,12 +66,22 @@ GtCoderNavigationModel >> selectClasses: aCollectionOfClasses [ ] { #category : #'api - selection' } -GtCoderNavigationModel >> selectMethod: aCompiledMethod [ +GtCoderNavigationModel >> selectMethod: aMethod [ + self selectMethod: aMethod source: self +] + +{ #category : #'api - selection' } +GtCoderNavigationModel >> selectMethod: aCompiledMethod source: aSource [ self subclassResponsibility ] { #category : #'api - selection' } -GtCoderNavigationModel >> selectMethods: aCollectionOfCompiledMethods [ +GtCoderNavigationModel >> selectMethods: aCollectionOfMethods [ + self selectMethods: aCollectionOfMethods source: self +] + +{ #category : #'api - selection' } +GtCoderNavigationModel >> selectMethods: aCollectionOfCompiledMethods source: aSource [ self subclassResponsibility ] @@ -85,6 +95,13 @@ GtCoderNavigationModel >> selectedClassDo: aBlock [ self subclassResponsibility ] +{ #category : #'api - selection' } +GtCoderNavigationModel >> selectedMethod: aCompiledMethod source: aSource [ + "Inform that another method was selected and should be reflected in the navigation model." + + self subclassResponsibility +] + { #category : #'api - selection' } GtCoderNavigationModel >> selectedPackageDo: aBlock [ self subclassResponsibility diff --git a/src/GToolkit-Coder/GtCoderNullNavigationModel.class.st b/src/GToolkit-Coder/GtCoderNullNavigationModel.class.st index f3db505bd..6600147fd 100644 --- a/src/GToolkit-Coder/GtCoderNullNavigationModel.class.st +++ b/src/GToolkit-Coder/GtCoderNullNavigationModel.class.st @@ -52,8 +52,10 @@ GtCoderNullNavigationModel >> selectClasses: aCollectionOfClasses [ ] { #category : #'api - selection' } -GtCoderNullNavigationModel >> selectMethod: aCompiledMethod [ +GtCoderNullNavigationModel >> selectMethod: aCompiledMethod source: aSource [ "do nothing" + + ] { #category : #'api - selection' } @@ -61,6 +63,13 @@ GtCoderNullNavigationModel >> selectMethodProtocol: aMethodProtocol [ "do nothing" ] +{ #category : #'api - selection' } +GtCoderNullNavigationModel >> selectMethods: aCollectionOfCompiledMethods source: aSource [ + "do nothing" + + +] + { #category : #'api - selection' } GtCoderNullNavigationModel >> selectPackage: aPackage [ "do nothing" @@ -71,6 +80,13 @@ GtCoderNullNavigationModel >> selectedClassDo: aBlock [ "do nothing" ] +{ #category : #'api - selection' } +GtCoderNullNavigationModel >> selectedMethod: aCompiledMethod source: aSource [ + "Inform that another method was selected and should be reflected in the navigation model. + + Do nothing." +] + { #category : #'as yet unclassified' } GtCoderNullNavigationModel >> selectedPackage [ "Do Nothing" From 5949468c84e39b1cfcb72ca8eb1e9e240d5e4505 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 26 Nov 2025 19:06:16 -0300 Subject: [PATCH 1153/1268] remove debug code [feenkcom/gtoolkit#4877] --- src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index f36a0b2c9..368bb5798 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -249,8 +249,6 @@ GtCoderMethodsGroupedListElement >> onMethodSelected: anAnnouncement [ source: self; originalSource: anAnnouncement source) ] ifNone: [ ]. - - GtJustContextStackSignal emit ] { #category : #'event handling - selection' } From e94a5d3a4b0ee58536403e5d6dab88848e7c16b3 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 1 Dec 2025 10:07:20 -0300 Subject: [PATCH 1154/1268] use `BlDevScripterStepExecutionIndicator` [feenkcom/gtoolkit#4881] --- .../GtCoderEvaluationUnhandledError.class.st | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder/GtCoderEvaluationUnhandledError.class.st b/src/GToolkit-Coder/GtCoderEvaluationUnhandledError.class.st index 5479c1585..dd8540524 100644 --- a/src/GToolkit-Coder/GtCoderEvaluationUnhandledError.class.st +++ b/src/GToolkit-Coder/GtCoderEvaluationUnhandledError.class.st @@ -32,8 +32,16 @@ GtCoderEvaluationUnhandledError >> debug [ { #category : #'priv handling' } GtCoderEvaluationUnhandledError >> defaultAction [ + "We do not want to handle this exception if executed within a scripter. + The reason is that we do not want to open an embedded debuger as it stops + the Scripter's UI process and creates a new one. As a consequence, + an example execution is stopped and example runners (Jenkins, CI) is waiting + indefinitely." + - ^ UIManager default unhandledErrorDefaultAction: self + ^ BlDevScripterStepExecutionIndicator + ifScripter: [ super defaultAction ] + ifNone: [ UIManager default unhandledErrorDefaultAction: self ] ] { #category : #accessing } From 240a7af8f48bc789fa443793535d5b23063ee800 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 2 Dec 2025 16:21:39 -0300 Subject: [PATCH 1155/1268] add overriden icons to the method list [feenkcom/gtoolkit#4884] --- .../GtCoderMethodsGroupedListElement.class.st | 89 ++++++++++++++++--- ...igationCompiledMethodsAddOnsCache.class.st | 67 ++++++++++++++ .../GtPhlowAction.extension.st | 11 +++ .../GtCoderNavigationMethodTarget.class.st | 8 ++ 4 files changed, 164 insertions(+), 11 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtPharoNavigationCompiledMethodsAddOnsCache.class.st create mode 100644 src/GToolkit-Coder-UI/GtPhlowAction.extension.st create mode 100644 src/GToolkit-Coder/GtCoderNavigationMethodTarget.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index 368bb5798..2edd7c6bd 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -5,11 +5,37 @@ Class { #classTraits : 'TGtCoderNavigationWithContextMenu classTrait', #instVars : [ 'navigationModel', - 'methodGroups' + 'methodGroups', + 'addOnsCache' ], #category : #'GToolkit-Coder-UI-Navigation - Helpers' } +{ #category : #'private - insance creation' } +GtCoderMethodsGroupedListElement >> addOnsForMethod: aCompiledMethod hostElement: aHostElement [ + + addOnsCache ifNil: [ + addOnsCache := GtPharoNavigationCompiledMethodsAddOnsCache new subscribeToSystem ]. + + ^ addOnsCache + elementsForCompiledMethod: aCompiledMethod + hostElement: aHostElement +] + +{ #category : #'private - insance creation' } +GtCoderMethodsGroupedListElement >> bindCompiledMethod: eachCompiledMethod withElement: element [ + | aFuture aSelector | + element userData at: #method put: eachCompiledMethod. + + aSelector := eachCompiledMethod selector asRopedText. + eachCompiledMethod isDeprecated ifTrue: [ aSelector lineThrough ]. + + element text: aSelector. + + aFuture := self addOnsForMethod: eachCompiledMethod hostElement: element. + element asyncFuture future: aFuture +] + { #category : #'private - actions' } GtCoderMethodsGroupedListElement >> browseHierarchyImplementorsOf: aSymbol [ self phlow spawnObject: aSymbol gtImplementors & self hierarchyFilter @@ -89,6 +115,31 @@ GtCoderMethodsGroupedListElement >> buildMethodItem [ ifTrue: [ self contextMenuForSeveralItems: someItems in: aLabel ] ifFalse: [ self contextMenuForOneItem: currentMethod in: aLabel ] ]). + aLabel + addChild: (BrHorizontalPane new + id: #addOnsContainer; + alignCenterLeft; + fitContent); + withAsyncFutureDo: [ :anElementFuture | + anElementFuture + executionConfiguration: GtSingleCoderViewModel secondaryMethodAddOnsExecutionConfiguration; + whenPending: [ :theLabel | + theLabel + childWithId: #addOnsContainer + ifFound: [ :aContainer | aContainer removeChildren ] + ifNone: [ ] ]; + whenError: [ :theLabel :anError | + theLabel + childWithId: #addOnsContainer + ifFound: [ :aContainer | + aContainer + removeChildren; + addChildren: (anError asDebuggableElement + hFitContentLimited; + vFitContent) ] + ifNone: [ ] ]; + whenSuccess: [ :theLabel :someElements | self updateLabel: theLabel addOnElements: someElements ] ]. + aLabel addEventHandler: self createMethodDragHandler. ^ aLabel @@ -151,15 +202,8 @@ GtCoderMethodsGroupedListElement >> createMethodGroups [ domainObject: 'instance side'; stream: #() asAsyncStream; itemStencil: [ self buildMethodItem ]; - itemDataBinder: [ :element :eachCompiledMethod | - | aSelector | - element userData at: #method put: eachCompiledMethod. - - aSelector := eachCompiledMethod selector asRopedText. - eachCompiledMethod isDeprecated - ifTrue: [ aSelector lineThrough ]. - - element text: aSelector ]; + itemDataBinder: [ :element :eachCompiledMethod | + self bindCompiledMethod: eachCompiledMethod withElement: element ]; shouldShowWithoutItems: false. classGroup := instanceGroup copy domainObject: 'class side'. ^ {instanceGroup. @@ -190,6 +234,8 @@ GtCoderMethodsGroupedListElement >> hierarchyFilter [ { #category : #initialization } GtCoderMethodsGroupedListElement >> initialize [ super initialize. + + addOnsCache := GtPharoNavigationCompiledMethodsAddOnsCache new subscribeToSystem. self padding: (BlInsets left: 5 right: 10); @@ -204,7 +250,10 @@ GtCoderMethodsGroupedListElement >> initialize [ self when: BrSelectionChanged - do: [ :anEvent | self onMethodsListSelectionChanged: anEvent ] + do: [ :anEvent | self onMethodsListSelectionChanged: anEvent ]. + self + when: BrWidgetPermanentlyRemovedEvent + do: [ :anEvent | self onBrWidgetPermanentlyRemovedEvent: anEvent ]. ] { #category : #accessing } @@ -229,6 +278,11 @@ GtCoderMethodsGroupedListElement >> navigationModel: anObject [ self updateMethodList ] +{ #category : #initialization } +GtCoderMethodsGroupedListElement >> onBrWidgetPermanentlyRemovedEvent: anEvent [ + addOnsCache ifNotNil: #unsubscribeFromSystem +] + { #category : #'event handling - selection' } GtCoderMethodsGroupedListElement >> onMethodSelected: anAnnouncement [ | aMethod aGroup | @@ -598,6 +652,19 @@ GtCoderMethodsGroupedListElement >> unsubscribeFromNavigationModel [ navigationModel ifNotNil: [ :aModel | aModel unsubscribe: self ] ] +{ #category : #'private - insance creation' } +GtCoderMethodsGroupedListElement >> updateLabel: theLabel addOnElements: someElements [ + ^ theLabel + childWithId: #addOnsContainer + ifFound: [ :aContainer | + (someElements allSatisfy: [ :eachElement | eachElement parent == aContainer ]) + ifFalse: [ someElements do: #removeFromParent. + aContainer + removeChildren; + addChildren: someElements ] ] + ifNone: [ ] +] + { #category : #'updating lists' } GtCoderMethodsGroupedListElement >> updateMethodList [ self diff --git a/src/GToolkit-Coder-UI/GtPharoNavigationCompiledMethodsAddOnsCache.class.st b/src/GToolkit-Coder-UI/GtPharoNavigationCompiledMethodsAddOnsCache.class.st new file mode 100644 index 000000000..2909ff531 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtPharoNavigationCompiledMethodsAddOnsCache.class.st @@ -0,0 +1,67 @@ +Class { + #name : #GtPharoNavigationCompiledMethodsAddOnsCache, + #superclass : #Object, + #instVars : [ + 'cache' + ], + #category : #'GToolkit-Coder-UI-Navigation - Helpers' +} + +{ #category : #private } +GtPharoNavigationCompiledMethodsAddOnsCache >> computeElementsForCompiledMethod: aCompiledMethod hostElement: aHostElement [ + + | someElements | + someElements := GtCoderNavigationMethodTarget + actionsForObject: aCompiledMethod + collect: [ :eachAction | eachAction asNavigationElement: [ :e | e ] withHostElement: aHostElement ]. + cache at: aCompiledMethod put: someElements. + ^ someElements +] + +{ #category : #accessing } +GtPharoNavigationCompiledMethodsAddOnsCache >> elementsForCompiledMethod: aCompiledMethod hostElement: aHostElement [ + + ^ cache + at: aCompiledMethod + ifPresent: [ :someElements | someElements asAsyncFuture ] + ifAbsent: [ [ self computeElementsForCompiledMethod: aCompiledMethod hostElement: aHostElement ] asAsyncFuture ] +] + +{ #category : #initialization } +GtPharoNavigationCompiledMethodsAddOnsCache >> initialize [ + super initialize. + + cache := AsyncSharedWeakIdentityKeyDictionary new. +] + +{ #category : #'event handling' } +GtPharoNavigationCompiledMethodsAddOnsCache >> onClassAddedOrRemoved: anAnnouncement [ + cache + keysAndValuesRemove: [ :eachCompiledMethod :someElements | + (eachCompiledMethod methodClass inheritsFrom: anAnnouncement classAffected) + or: [ anAnnouncement classAffected inheritsFrom: eachCompiledMethod methodClass ] ] +] + +{ #category : #'event handling' } +GtPharoNavigationCompiledMethodsAddOnsCache >> onMethodAddedOrRemoved: anAnnouncement [ + cache + keysAndValuesRemove: [ :eachCompiledMethod :someElements | + (eachCompiledMethod methodClass inheritsFrom: anAnnouncement classAffected) + or: [ anAnnouncement classAffected inheritsFrom: eachCompiledMethod methodClass ] ] +] + +{ #category : #initialization } +GtPharoNavigationCompiledMethodsAddOnsCache >> subscribeToSystem [ + SystemAnnouncer uniqueInstance weak + when: MethodAdded , MethodRemoved + send: #onMethodAddedOrRemoved: + to: self; + when: ClassAdded , ClassRemoved + send: #onClassAddedOrRemoved: + to: self +] + +{ #category : #initialization } +GtPharoNavigationCompiledMethodsAddOnsCache >> unsubscribeFromSystem [ + SystemAnnouncer uniqueInstance unsubscribe: self +] diff --git a/src/GToolkit-Coder-UI/GtPhlowAction.extension.st b/src/GToolkit-Coder-UI/GtPhlowAction.extension.st new file mode 100644 index 000000000..ed89b9b78 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtPhlowAction.extension.st @@ -0,0 +1,11 @@ +Extension { #name : #GtPhlowAction } + +{ #category : #'*GToolkit-Coder-UI' } +GtPhlowAction >> asNavigationElement: aBlock withHostElement: aTargetElement [ + + ^ self + asElement: [ :anElement | + anElement states addState: BrSizeAdjustmentState mini. + aBlock value: anElement ] + withHostElement: aTargetElement +] diff --git a/src/GToolkit-Coder/GtCoderNavigationMethodTarget.class.st b/src/GToolkit-Coder/GtCoderNavigationMethodTarget.class.st new file mode 100644 index 000000000..cf240bdb5 --- /dev/null +++ b/src/GToolkit-Coder/GtCoderNavigationMethodTarget.class.st @@ -0,0 +1,8 @@ +" +I define actions that should appear in navigation method list, next to each method label. +" +Class { + #name : #GtCoderNavigationMethodTarget, + #superclass : #GtPhlowActionUniqueTarget, + #category : #'GToolkit-Coder-Navigation - Model' +} From 4addbc2cb7007ad7f8cd3687a7eb1782e70b9bfb Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 2 Dec 2025 17:11:33 -0300 Subject: [PATCH 1156/1268] disable method list addons by default [feenkcom/gtoolkit#4884] --- .../GtCoderMethodsGroupedListElement.class.st | 2 ++ .../GtCoderNavigationMethodTarget.class.st | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index 2edd7c6bd..3e128476d 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -32,6 +32,8 @@ GtCoderMethodsGroupedListElement >> bindCompiledMethod: eachCompiledMethod withE element text: aSelector. + GtCoderNavigationMethodTarget isEnabled ifFalse: [ ^ self ]. + aFuture := self addOnsForMethod: eachCompiledMethod hostElement: element. element asyncFuture future: aFuture ] diff --git a/src/GToolkit-Coder/GtCoderNavigationMethodTarget.class.st b/src/GToolkit-Coder/GtCoderNavigationMethodTarget.class.st index cf240bdb5..c28cec12d 100644 --- a/src/GToolkit-Coder/GtCoderNavigationMethodTarget.class.st +++ b/src/GToolkit-Coder/GtCoderNavigationMethodTarget.class.st @@ -4,5 +4,23 @@ I define actions that should appear in navigation method list, next to each meth Class { #name : #GtCoderNavigationMethodTarget, #superclass : #GtPhlowActionUniqueTarget, + #classVars : [ + 'IsEnabled' + ], #category : #'GToolkit-Coder-Navigation - Model' } + +{ #category : #accessing } +GtCoderNavigationMethodTarget class >> disable [ + ^ IsEnabled := false +] + +{ #category : #accessing } +GtCoderNavigationMethodTarget class >> enable [ + ^ IsEnabled := true +] + +{ #category : #accessing } +GtCoderNavigationMethodTarget class >> isEnabled [ + ^ IsEnabled ifNil: [ IsEnabled := false ] +] From eca47c766e60c363b2e191a8d8d1b76bbcd33a83 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 2 Dec 2025 19:05:42 -0300 Subject: [PATCH 1157/1268] use coder view model to compute method list addons [feenkcom/gtoolkit#4884] --- ...igationCompiledMethodsAddOnsCache.class.st | 48 ++++++++++++++++--- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtPharoNavigationCompiledMethodsAddOnsCache.class.st b/src/GToolkit-Coder-UI/GtPharoNavigationCompiledMethodsAddOnsCache.class.st index 2909ff531..7d4b54be8 100644 --- a/src/GToolkit-Coder-UI/GtPharoNavigationCompiledMethodsAddOnsCache.class.st +++ b/src/GToolkit-Coder-UI/GtPharoNavigationCompiledMethodsAddOnsCache.class.st @@ -2,11 +2,25 @@ Class { #name : #GtPharoNavigationCompiledMethodsAddOnsCache, #superclass : #Object, #instVars : [ - 'cache' + 'elementCache', + 'coderViewModelCache' ], #category : #'GToolkit-Coder-UI-Navigation - Helpers' } +{ #category : #private } +GtPharoNavigationCompiledMethodsAddOnsCache >> addOnsFutureForCompiledMethod: aCompiledMethod hostElement: aHostElement [ + + | coderViewModel | + coderViewModel := coderViewModelCache + at: aCompiledMethod + ifPresent: [ :aCoderViewModel | aCoderViewModel ] + ifAbsentPut: [ (GtPharoMethodCoder forMethod: aCompiledMethod) + asCoderViewModel ]. + + ^ coderViewModel +] + { #category : #private } GtPharoNavigationCompiledMethodsAddOnsCache >> computeElementsForCompiledMethod: aCompiledMethod hostElement: aHostElement [ @@ -14,29 +28,49 @@ GtPharoNavigationCompiledMethodsAddOnsCache >> computeElementsForCompiledMethod: someElements := GtCoderNavigationMethodTarget actionsForObject: aCompiledMethod collect: [ :eachAction | eachAction asNavigationElement: [ :e | e ] withHostElement: aHostElement ]. - cache at: aCompiledMethod put: someElements. + elementCache at: aCompiledMethod put: someElements. ^ someElements ] { #category : #accessing } GtPharoNavigationCompiledMethodsAddOnsCache >> elementsForCompiledMethod: aCompiledMethod hostElement: aHostElement [ - ^ cache + ^ elementCache at: aCompiledMethod ifPresent: [ :someElements | someElements asAsyncFuture ] - ifAbsent: [ [ self computeElementsForCompiledMethod: aCompiledMethod hostElement: aHostElement ] asAsyncFuture ] + ifAbsent: [ | aCoderViewModel someElements | + aCoderViewModel := self + addOnsFutureForCompiledMethod: aCompiledMethod + hostElement: aHostElement. + + aCoderViewModel addOnsFuture + map: [ :addOns | + someElements := addOns previews + collect: [ :eachAddOn | + | eachAddOnElement | + eachAddOnElement := eachAddOn stencil asElement. + eachAddOn dataBinder + element: eachAddOnElement; + coderViewModel: aCoderViewModel; + build. + eachAddOnElement ]. + + elementCache at: aCompiledMethod put: someElements. + + someElements ] ] ] { #category : #initialization } GtPharoNavigationCompiledMethodsAddOnsCache >> initialize [ super initialize. - cache := AsyncSharedWeakIdentityKeyDictionary new. + elementCache := AsyncSharedWeakIdentityKeyDictionary new. + coderViewModelCache := AsyncSharedWeakIdentityKeyDictionary new. ] { #category : #'event handling' } GtPharoNavigationCompiledMethodsAddOnsCache >> onClassAddedOrRemoved: anAnnouncement [ - cache + elementCache keysAndValuesRemove: [ :eachCompiledMethod :someElements | (eachCompiledMethod methodClass inheritsFrom: anAnnouncement classAffected) or: [ anAnnouncement classAffected inheritsFrom: eachCompiledMethod methodClass ] ] @@ -44,7 +78,7 @@ GtPharoNavigationCompiledMethodsAddOnsCache >> onClassAddedOrRemoved: anAnnounce { #category : #'event handling' } GtPharoNavigationCompiledMethodsAddOnsCache >> onMethodAddedOrRemoved: anAnnouncement [ - cache + elementCache keysAndValuesRemove: [ :eachCompiledMethod :someElements | (eachCompiledMethod methodClass inheritsFrom: anAnnouncement classAffected) or: [ anAnnouncement classAffected inheritsFrom: eachCompiledMethod methodClass ] ] From 0d04ca5a1027efbba2d39c3f54944282030eedf2 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 3 Dec 2025 17:39:18 -0300 Subject: [PATCH 1158/1268] remove unused code [feenkcom/gtoolkit#4884] --- .../GtCoderMethodsGroupedListElement.class.st | 14 ++---- ...gationCompiledMethodsAddOnsCache.class.st} | 47 +++++++++++-------- .../GtCoderNavigationMethodTarget.class.st | 26 ---------- 3 files changed, 31 insertions(+), 56 deletions(-) rename src/GToolkit-Coder-UI/{GtPharoNavigationCompiledMethodsAddOnsCache.class.st => GtCoderNavigationCompiledMethodsAddOnsCache.class.st} (70%) delete mode 100644 src/GToolkit-Coder/GtCoderNavigationMethodTarget.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index 3e128476d..2951c0740 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -15,7 +15,7 @@ Class { GtCoderMethodsGroupedListElement >> addOnsForMethod: aCompiledMethod hostElement: aHostElement [ addOnsCache ifNil: [ - addOnsCache := GtPharoNavigationCompiledMethodsAddOnsCache new subscribeToSystem ]. + addOnsCache := GtCoderNavigationCompiledMethodsAddOnsCache new subscribeToSystem ]. ^ addOnsCache elementsForCompiledMethod: aCompiledMethod @@ -32,7 +32,7 @@ GtCoderMethodsGroupedListElement >> bindCompiledMethod: eachCompiledMethod withE element text: aSelector. - GtCoderNavigationMethodTarget isEnabled ifFalse: [ ^ self ]. + GtCoderNavigationCompiledMethodsAddOnsCache isEnabled ifFalse: [ ^ self ]. aFuture := self addOnsForMethod: eachCompiledMethod hostElement: element. element asyncFuture future: aFuture @@ -120,6 +120,7 @@ GtCoderMethodsGroupedListElement >> buildMethodItem [ aLabel addChild: (BrHorizontalPane new id: #addOnsContainer; + cellSpacing: 2; alignCenterLeft; fitContent); withAsyncFutureDo: [ :anElementFuture | @@ -237,7 +238,7 @@ GtCoderMethodsGroupedListElement >> hierarchyFilter [ GtCoderMethodsGroupedListElement >> initialize [ super initialize. - addOnsCache := GtPharoNavigationCompiledMethodsAddOnsCache new subscribeToSystem. + addOnsCache := GtCoderNavigationCompiledMethodsAddOnsCache new subscribeToSystem. self padding: (BlInsets left: 5 right: 10); @@ -307,13 +308,6 @@ GtCoderMethodsGroupedListElement >> onMethodSelected: anAnnouncement [ ifNone: [ ]. ] -{ #category : #'event handling - selection' } -GtCoderMethodsGroupedListElement >> onMethodsListSelectionChanged [ - "Can be removed." - - self onMethodsListSelectionChanged: nil -] - { #category : #'event handling - selection' } GtCoderMethodsGroupedListElement >> onMethodsListSelectionChanged: anEvent [ | theIndices allSelectedItems aSource | diff --git a/src/GToolkit-Coder-UI/GtPharoNavigationCompiledMethodsAddOnsCache.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationCompiledMethodsAddOnsCache.class.st similarity index 70% rename from src/GToolkit-Coder-UI/GtPharoNavigationCompiledMethodsAddOnsCache.class.st rename to src/GToolkit-Coder-UI/GtCoderNavigationCompiledMethodsAddOnsCache.class.st index 7d4b54be8..9cc553e85 100644 --- a/src/GToolkit-Coder-UI/GtPharoNavigationCompiledMethodsAddOnsCache.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationCompiledMethodsAddOnsCache.class.st @@ -1,15 +1,33 @@ Class { - #name : #GtPharoNavigationCompiledMethodsAddOnsCache, + #name : #GtCoderNavigationCompiledMethodsAddOnsCache, #superclass : #Object, #instVars : [ 'elementCache', 'coderViewModelCache' ], + #classVars : [ + 'IsEnabled' + ], #category : #'GToolkit-Coder-UI-Navigation - Helpers' } +{ #category : #settings } +GtCoderNavigationCompiledMethodsAddOnsCache class >> disable [ + IsEnabled := false +] + +{ #category : #settings } +GtCoderNavigationCompiledMethodsAddOnsCache class >> enable [ + IsEnabled := true +] + +{ #category : #settings } +GtCoderNavigationCompiledMethodsAddOnsCache class >> isEnabled [ + ^ IsEnabled ifNil: [ IsEnabled := false ] +] + { #category : #private } -GtPharoNavigationCompiledMethodsAddOnsCache >> addOnsFutureForCompiledMethod: aCompiledMethod hostElement: aHostElement [ +GtCoderNavigationCompiledMethodsAddOnsCache >> addOnsFutureForCompiledMethod: aCompiledMethod hostElement: aHostElement [ | coderViewModel | coderViewModel := coderViewModelCache @@ -21,19 +39,8 @@ GtPharoNavigationCompiledMethodsAddOnsCache >> addOnsFutureForCompiledMethod: aC ^ coderViewModel ] -{ #category : #private } -GtPharoNavigationCompiledMethodsAddOnsCache >> computeElementsForCompiledMethod: aCompiledMethod hostElement: aHostElement [ - - | someElements | - someElements := GtCoderNavigationMethodTarget - actionsForObject: aCompiledMethod - collect: [ :eachAction | eachAction asNavigationElement: [ :e | e ] withHostElement: aHostElement ]. - elementCache at: aCompiledMethod put: someElements. - ^ someElements -] - { #category : #accessing } -GtPharoNavigationCompiledMethodsAddOnsCache >> elementsForCompiledMethod: aCompiledMethod hostElement: aHostElement [ +GtCoderNavigationCompiledMethodsAddOnsCache >> elementsForCompiledMethod: aCompiledMethod hostElement: aHostElement [ ^ elementCache at: aCompiledMethod @@ -61,7 +68,7 @@ GtPharoNavigationCompiledMethodsAddOnsCache >> elementsForCompiledMethod: aCompi ] { #category : #initialization } -GtPharoNavigationCompiledMethodsAddOnsCache >> initialize [ +GtCoderNavigationCompiledMethodsAddOnsCache >> initialize [ super initialize. elementCache := AsyncSharedWeakIdentityKeyDictionary new. @@ -69,7 +76,7 @@ GtPharoNavigationCompiledMethodsAddOnsCache >> initialize [ ] { #category : #'event handling' } -GtPharoNavigationCompiledMethodsAddOnsCache >> onClassAddedOrRemoved: anAnnouncement [ +GtCoderNavigationCompiledMethodsAddOnsCache >> onClassAddedOrRemoved: anAnnouncement [ elementCache keysAndValuesRemove: [ :eachCompiledMethod :someElements | (eachCompiledMethod methodClass inheritsFrom: anAnnouncement classAffected) @@ -77,7 +84,7 @@ GtPharoNavigationCompiledMethodsAddOnsCache >> onClassAddedOrRemoved: anAnnounce ] { #category : #'event handling' } -GtPharoNavigationCompiledMethodsAddOnsCache >> onMethodAddedOrRemoved: anAnnouncement [ +GtCoderNavigationCompiledMethodsAddOnsCache >> onMethodAddedOrRemoved: anAnnouncement [ elementCache keysAndValuesRemove: [ :eachCompiledMethod :someElements | (eachCompiledMethod methodClass inheritsFrom: anAnnouncement classAffected) @@ -85,9 +92,9 @@ GtPharoNavigationCompiledMethodsAddOnsCache >> onMethodAddedOrRemoved: anAnnounc ] { #category : #initialization } -GtPharoNavigationCompiledMethodsAddOnsCache >> subscribeToSystem [ +GtCoderNavigationCompiledMethodsAddOnsCache >> subscribeToSystem [ SystemAnnouncer uniqueInstance weak - when: MethodAdded , MethodRemoved + when: MethodAdded , MethodRemoved, MethodModified send: #onMethodAddedOrRemoved: to: self; when: ClassAdded , ClassRemoved @@ -96,6 +103,6 @@ GtPharoNavigationCompiledMethodsAddOnsCache >> subscribeToSystem [ ] { #category : #initialization } -GtPharoNavigationCompiledMethodsAddOnsCache >> unsubscribeFromSystem [ +GtCoderNavigationCompiledMethodsAddOnsCache >> unsubscribeFromSystem [ SystemAnnouncer uniqueInstance unsubscribe: self ] diff --git a/src/GToolkit-Coder/GtCoderNavigationMethodTarget.class.st b/src/GToolkit-Coder/GtCoderNavigationMethodTarget.class.st deleted file mode 100644 index c28cec12d..000000000 --- a/src/GToolkit-Coder/GtCoderNavigationMethodTarget.class.st +++ /dev/null @@ -1,26 +0,0 @@ -" -I define actions that should appear in navigation method list, next to each method label. -" -Class { - #name : #GtCoderNavigationMethodTarget, - #superclass : #GtPhlowActionUniqueTarget, - #classVars : [ - 'IsEnabled' - ], - #category : #'GToolkit-Coder-Navigation - Model' -} - -{ #category : #accessing } -GtCoderNavigationMethodTarget class >> disable [ - ^ IsEnabled := false -] - -{ #category : #accessing } -GtCoderNavigationMethodTarget class >> enable [ - ^ IsEnabled := true -] - -{ #category : #accessing } -GtCoderNavigationMethodTarget class >> isEnabled [ - ^ IsEnabled ifNil: [ IsEnabled := false ] -] From 5cc1a53c55b120221f0efa2f0375ce9067a52883 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 4 Dec 2025 21:56:21 -0300 Subject: [PATCH 1159/1268] add package default phlow tool --- src/GToolkit-Coder-UI/Package.extension.st | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/GToolkit-Coder-UI/Package.extension.st b/src/GToolkit-Coder-UI/Package.extension.st index 909f6eb5f..efb2b9b1d 100644 --- a/src/GToolkit-Coder-UI/Package.extension.st +++ b/src/GToolkit-Coder-UI/Package.extension.st @@ -1,5 +1,12 @@ Extension { #name : #Package } +{ #category : #'*GToolkit-Coder-UI' } +Package >> gtDefaultInspectorTool [ + ^ GtPhlowCompositeTool new + addTool: (GtPackageCoderTool forPackage: self); + addTool: super gtDefaultInspectorTool +] + { #category : #'*GToolkit-Coder-UI' } Package >> gtSpawnCoder [ ^ GtPackageCoderTool forPackage: self From c457ad22feaca2079b6a79e181c60629dfa64770 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 5 Dec 2025 15:26:53 -0300 Subject: [PATCH 1160/1268] add `GtCoderNavigationIndexStep` [feenkcom/gtoolkit#4887] --- .../GtCoderByScripterExamples.class.st | 2 +- .../GtCoderNavigationIndexStep.class.st | 56 +++++++++++++++++++ .../TBlDevScripterActionStep.extension.st | 6 ++ .../TCoderByScripterExamples.trait.st | 2 +- 4 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 src/GToolkit-Coder-Examples/GtCoderNavigationIndexStep.class.st create mode 100644 src/GToolkit-Coder-Examples/TBlDevScripterActionStep.extension.st diff --git a/src/GToolkit-Coder-Examples/GtCoderByScripterExamples.class.st b/src/GToolkit-Coder-Examples/GtCoderByScripterExamples.class.st index f5240c3d0..fd3c947b6 100644 --- a/src/GToolkit-Coder-Examples/GtCoderByScripterExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtCoderByScripterExamples.class.st @@ -3,5 +3,5 @@ Class { #superclass : #Object, #traits : 'TCoderByScripterExamples', #classTraits : 'TCoderByScripterExamples classTrait', - #category : #'GToolkit-Coder-Examples-By scripter' + #category : #'GToolkit-Coder-Examples-Scripter' } diff --git a/src/GToolkit-Coder-Examples/GtCoderNavigationIndexStep.class.st b/src/GToolkit-Coder-Examples/GtCoderNavigationIndexStep.class.st new file mode 100644 index 000000000..4a405dcf3 --- /dev/null +++ b/src/GToolkit-Coder-Examples/GtCoderNavigationIndexStep.class.st @@ -0,0 +1,56 @@ +Class { + #name : #GtCoderNavigationIndexStep, + #superclass : #BlDevScripterToolActionStep, + #category : #'GToolkit-Coder-Examples-Scripter' +} + +{ #category : #'steps - interactions' } +GtCoderNavigationIndexStep >> assertSelectedMethod: aCompiledMethod [ + ^ self assert + label: ('Assert selected method: {1}' format: {aCompiledMethod selector}); + satisfies: [ :aLabel | aLabel states isSelected ]; + onParentStepTarget: self; + onThisOrBreadthFirstChildOfKind: GtCoderMethodsGroupedListElement; + // BrLabel; + @ [ :eachLabel | eachLabel text asString = aCompiledMethod selector ] +] + +{ #category : #accessing } +GtCoderNavigationIndexStep >> defaultLabel [ + ^ 'Coder navigation' +] + +{ #category : #'steps - interactions' } +GtCoderNavigationIndexStep >> selectMethods: someCompiledMethods [ + ^ someCompiledMethods size = 1 + ifTrue: [ self click + label: ('Select method: {1}' format: {someCompiledMethods first selector}); + onParentStepTarget: self; + onThisOrBreadthFirstChildOfKind: GtCoderMethodsGroupedListElement; + // BrLabel; + @ [ :eachLabel | eachLabel text asString = someCompiledMethods first selector ] ] + ifFalse: [ self + substeps2: ('Select {2} methods' format: {someCompiledMethods size}) + do: [ :aStep | + self click + label: ('Select the first method: {1}' format: {someCompiledMethods first selector}); + onParentStepTarget: aStep; + onThisOrBreadthFirstChildOfKind: GtCoderMethodsGroupedListElement; + // BrLabel; + @ [ :eachLabel | eachLabel text asString = someCompiledMethods first selector ]. + + aStep click + label: 'Select the other methods'; + modifiers: (BlKeyModifiers primary shift: true); + onParentStepTarget: aStep; + onThisOrBreadthFirstChildOfKind: GtCoderMethodsGroupedListElement; + // BrLabel; + @ [ :each | each text asString = someCompiledMethods last selector ]. + + aStep assert + label: 'Assert list selection'; + value: [ :aList | aList selectedItems asArray ] + equals: someCompiledMethods asArray; + onParentStepTarget: aStep; + onThisOrBreadthFirstChildOfKind: GtCoderMethodsGroupedListElement ] ] +] diff --git a/src/GToolkit-Coder-Examples/TBlDevScripterActionStep.extension.st b/src/GToolkit-Coder-Examples/TBlDevScripterActionStep.extension.st new file mode 100644 index 000000000..89238a415 --- /dev/null +++ b/src/GToolkit-Coder-Examples/TBlDevScripterActionStep.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #TBlDevScripterActionStep } + +{ #category : #'*GToolkit-Coder-Examples' } +TBlDevScripterActionStep >> coderNavigationIndex [ + ^ self addStep: GtCoderNavigationIndexStep new referenceSender +] diff --git a/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st b/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st index f0fc4b80e..a3293b480 100644 --- a/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st +++ b/src/GToolkit-Coder-Examples/TCoderByScripterExamples.trait.st @@ -1,6 +1,6 @@ Trait { #name : #TCoderByScripterExamples, - #category : #'GToolkit-Coder-Examples-By scripter' + #category : #'GToolkit-Coder-Examples-Scripter' } { #category : #utilities } From 1ae8439d2b22ef2218cc129dcb831afedebb2ba8 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 5 Dec 2025 17:10:23 -0300 Subject: [PATCH 1161/1268] add `InstanceVariableSlot>>#gtCopySlotNameFor:context:` --- .../InstanceVariableSlot.extension.st | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/GToolkit-Coder-UI/InstanceVariableSlot.extension.st b/src/GToolkit-Coder-UI/InstanceVariableSlot.extension.st index c6b4c9db5..c09c5603d 100644 --- a/src/GToolkit-Coder-UI/InstanceVariableSlot.extension.st +++ b/src/GToolkit-Coder-UI/InstanceVariableSlot.extension.st @@ -85,6 +85,20 @@ InstanceVariableSlot >> gtBrowseReferencesActionFor: anAction context: aPhlowCon aButton phlow spawnObject: aFilter ] ] +{ #category : #'*GToolkit-Coder-UI' } +InstanceVariableSlot >> gtCopySlotNameFor: anAction context: aPhlowContext [ + + + ^ anAction button + label: 'Copy slot name'; + icon: BrGlamorousVectorIcons clipboard; + priority: 5; + target: GtCoderVariableTarget; + menuItemPreview: [ self name ]; + menuItemGroup: BrMenuItemGroupConfiguration editing; + action: [ :aButton | Clipboard default clipboardText: self name asString ] +] + { #category : #'*GToolkit-Coder-UI' } InstanceVariableSlot >> gtCreateAccessorsActionFor: anAction context: aPhlowContext [ From ac9895423aa3aadf154ee43de1b539afef7f3f4d Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 5 Dec 2025 18:52:55 -0300 Subject: [PATCH 1162/1268] `GtMethodCoderSaved` holds previous method [feenkcom/gtoolkit#4888] --- .../GtMethodCoderSaved.class.st | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtMethodCoderSaved.class.st b/src/GToolkit-Coder-UI/GtMethodCoderSaved.class.st index 9f0635de6..e77fbc3dc 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderSaved.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderSaved.class.st @@ -2,11 +2,21 @@ Class { #name : #GtMethodCoderSaved, #superclass : #GtTextualCoderViewModelAnnouncement, #instVars : [ - 'method' + 'method', + 'previousMethod' ], #category : #'GToolkit-Coder-UI-Coder - Method Events' } +{ #category : #testing } +GtMethodCoderSaved >> isSameMethod [ + previousMethod ifNil: [ ^ false ]. + method ifNil: [ ^ false ]. + + ^ method methodClass = previousMethod methodClass + and: [ method selector = previousMethod selector ] +] + { #category : #accessing } GtMethodCoderSaved >> method [ @@ -14,7 +24,17 @@ GtMethodCoderSaved >> method [ ] { #category : #accessing } -GtMethodCoderSaved >> method: anObject [ +GtMethodCoderSaved >> method: aCompiledMethod [ + + method := aCompiledMethod +] - method := anObject +{ #category : #accessing } +GtMethodCoderSaved >> previousMethod [ + ^ previousMethod +] + +{ #category : #accessing } +GtMethodCoderSaved >> previousMethod: aCompiledMethodOrNil [ + previousMethod := aCompiledMethodOrNil ] From c4c48c2385bb00fc500c0691ee67529373172b30 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 5 Dec 2025 19:07:18 -0300 Subject: [PATCH 1163/1268] fix scripter step definition [feenkcom/gtoolkit#4888] --- src/GToolkit-Coder-Examples/GtCoderNavigationIndexStep.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-Examples/GtCoderNavigationIndexStep.class.st b/src/GToolkit-Coder-Examples/GtCoderNavigationIndexStep.class.st index 4a405dcf3..307be9e5e 100644 --- a/src/GToolkit-Coder-Examples/GtCoderNavigationIndexStep.class.st +++ b/src/GToolkit-Coder-Examples/GtCoderNavigationIndexStep.class.st @@ -30,7 +30,7 @@ GtCoderNavigationIndexStep >> selectMethods: someCompiledMethods [ // BrLabel; @ [ :eachLabel | eachLabel text asString = someCompiledMethods first selector ] ] ifFalse: [ self - substeps2: ('Select {2} methods' format: {someCompiledMethods size}) + substeps2: ('Select {1} methods' format: {someCompiledMethods size}) do: [ :aStep | self click label: ('Select the first method: {1}' format: {someCompiledMethods first selector}); From 1e98b861eee540c09c5515b97f4908e6855fc9ce Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 8 Dec 2025 13:08:13 -0300 Subject: [PATCH 1164/1268] fix example [feenkcom/gtoolkit#4888] --- src/GToolkit-Coder-Examples/GtCoderNavigationIndexStep.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-Examples/GtCoderNavigationIndexStep.class.st b/src/GToolkit-Coder-Examples/GtCoderNavigationIndexStep.class.st index 307be9e5e..040951268 100644 --- a/src/GToolkit-Coder-Examples/GtCoderNavigationIndexStep.class.st +++ b/src/GToolkit-Coder-Examples/GtCoderNavigationIndexStep.class.st @@ -32,7 +32,7 @@ GtCoderNavigationIndexStep >> selectMethods: someCompiledMethods [ ifFalse: [ self substeps2: ('Select {1} methods' format: {someCompiledMethods size}) do: [ :aStep | - self click + aStep click label: ('Select the first method: {1}' format: {someCompiledMethods first selector}); onParentStepTarget: aStep; onThisOrBreadthFirstChildOfKind: GtCoderMethodsGroupedListElement; From 169ae989848dd07a61e597d22323509a2e5da731 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 8 Dec 2025 20:11:18 -0300 Subject: [PATCH 1165/1268] add `GtCoderNavigationCompiledMethodElement` [feenkcom/gtoolkit#4892] --- .../GtCoderMethodsGroupedListElement.class.st | 85 ++---------- ...erNavigationCompiledMethodElement.class.st | 130 ++++++++++++++++++ ...igationCompiledMethodsAddOnsCache.class.st | 7 +- 3 files changed, 145 insertions(+), 77 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderNavigationCompiledMethodElement.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index 2951c0740..f373053a2 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -11,31 +11,11 @@ Class { #category : #'GToolkit-Coder-UI-Navigation - Helpers' } -{ #category : #'private - insance creation' } -GtCoderMethodsGroupedListElement >> addOnsForMethod: aCompiledMethod hostElement: aHostElement [ - - addOnsCache ifNil: [ - addOnsCache := GtCoderNavigationCompiledMethodsAddOnsCache new subscribeToSystem ]. - - ^ addOnsCache - elementsForCompiledMethod: aCompiledMethod - hostElement: aHostElement -] - { #category : #'private - insance creation' } GtCoderMethodsGroupedListElement >> bindCompiledMethod: eachCompiledMethod withElement: element [ - | aFuture aSelector | element userData at: #method put: eachCompiledMethod. - aSelector := eachCompiledMethod selector asRopedText. - eachCompiledMethod isDeprecated ifTrue: [ aSelector lineThrough ]. - - element text: aSelector. - - GtCoderNavigationCompiledMethodsAddOnsCache isEnabled ifFalse: [ ^ self ]. - - aFuture := self addOnsForMethod: eachCompiledMethod hostElement: element. - element asyncFuture future: aFuture + element compiledMethod: eachCompiledMethod ] { #category : #'private - actions' } @@ -102,46 +82,18 @@ GtCoderMethodsGroupedListElement >> browseSeveralReferencesOf: aCollectionOfSymb GtCoderMethodsGroupedListElement >> buildMethodItem [ | aLabel | - aLabel := BrLabel new. - aLabel - hMatchParent; - vFitContent; - beSmallSize; - aptitude: GtCoderNavigationTreeLabelAptitude + BrGlamorousListItemAptitude - + (BrGlamorousWithExplicitContextMenuAptitude new - withGainFocusOnShow; - handleSubmenu: [ | someItems currentMethod | - currentMethod := aLabel userData at: #method. - someItems := self selectedItems. - (someItems size > 1 and: [ someItems identityIncludes: currentMethod ]) - ifTrue: [ self contextMenuForSeveralItems: someItems in: aLabel ] - ifFalse: [ self contextMenuForOneItem: currentMethod in: aLabel ] ]). - + aLabel := GtCoderNavigationCompiledMethodElement new. + aLabel addOnsCache: addOnsCache. + aLabel - addChild: (BrHorizontalPane new - id: #addOnsContainer; - cellSpacing: 2; - alignCenterLeft; - fitContent); - withAsyncFutureDo: [ :anElementFuture | - anElementFuture - executionConfiguration: GtSingleCoderViewModel secondaryMethodAddOnsExecutionConfiguration; - whenPending: [ :theLabel | - theLabel - childWithId: #addOnsContainer - ifFound: [ :aContainer | aContainer removeChildren ] - ifNone: [ ] ]; - whenError: [ :theLabel :anError | - theLabel - childWithId: #addOnsContainer - ifFound: [ :aContainer | - aContainer - removeChildren; - addChildren: (anError asDebuggableElement - hFitContentLimited; - vFitContent) ] - ifNone: [ ] ]; - whenSuccess: [ :theLabel :someElements | self updateLabel: theLabel addOnElements: someElements ] ]. + addAptitude: (BrGlamorousWithExplicitContextMenuAptitude new + withGainFocusOnShow; + handleSubmenu: [ | someItems currentMethod | + currentMethod := aLabel userData at: #method. + someItems := self selectedItems. + (someItems size > 1 and: [ someItems identityIncludes: currentMethod ]) + ifTrue: [ self contextMenuForSeveralItems: someItems in: aLabel ] + ifFalse: [ self contextMenuForOneItem: currentMethod in: aLabel ] ]). aLabel addEventHandler: self createMethodDragHandler. @@ -648,19 +600,6 @@ GtCoderMethodsGroupedListElement >> unsubscribeFromNavigationModel [ navigationModel ifNotNil: [ :aModel | aModel unsubscribe: self ] ] -{ #category : #'private - insance creation' } -GtCoderMethodsGroupedListElement >> updateLabel: theLabel addOnElements: someElements [ - ^ theLabel - childWithId: #addOnsContainer - ifFound: [ :aContainer | - (someElements allSatisfy: [ :eachElement | eachElement parent == aContainer ]) - ifFalse: [ someElements do: #removeFromParent. - aContainer - removeChildren; - addChildren: someElements ] ] - ifNone: [ ] -] - { #category : #'updating lists' } GtCoderMethodsGroupedListElement >> updateMethodList [ self diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationCompiledMethodElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationCompiledMethodElement.class.st new file mode 100644 index 000000000..7a5e6c7de --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderNavigationCompiledMethodElement.class.st @@ -0,0 +1,130 @@ +Class { + #name : #GtCoderNavigationCompiledMethodElement, + #superclass : #BlElement, + #traits : 'TBrLayoutResizable', + #classTraits : 'TBrLayoutResizable classTrait', + #instVars : [ + 'label', + 'compiledMethod', + 'labelElement', + 'addOnsElement', + 'addOnsCache' + ], + #category : #'GToolkit-Coder-UI-Navigation - Helpers' +} + +{ #category : #'api - initialization' } +GtCoderNavigationCompiledMethodElement >> addOnsCache: anAddOnsCache [ + addOnsCache := anAddOnsCache +] + +{ #category : #'api - compiled method' } +GtCoderNavigationCompiledMethodElement >> compiledMethod [ + ^ compiledMethod +] + +{ #category : #'api - compiled method' } +GtCoderNavigationCompiledMethodElement >> compiledMethod: aCompiledMethod [ + + self assert: [ aCompiledMethod isNotNil ]. + + compiledMethod = aCompiledMethod ifTrue: [ ^ self ]. + + compiledMethod := aCompiledMethod. + self onCompiledMethodChanged. +] + +{ #category : #initialization } +GtCoderNavigationCompiledMethodElement >> defaultLayout [ + ^ BlLinearLayout horizontal +] + +{ #category : #initialization } +GtCoderNavigationCompiledMethodElement >> initialize [ + super initialize. + + self initializeLabelElement. + self initializeAddonsElement. + + self addChild: labelElement. + self addChild: addOnsElement. + + self addAptitude: BrGlamorousListItemAptitude. + + self + hMatchParent; + vFitContent +] + +{ #category : #initialization } +GtCoderNavigationCompiledMethodElement >> initializeAddonsElement [ + addOnsElement := BrHorizontalPane new + id: #addOnsContainer; + cellSpacing: 2; + alignCenterLeft; + fitContent; + withAsyncFutureDo: [ :anElementFuture | + anElementFuture + executionConfiguration: GtSingleCoderViewModel secondaryMethodAddOnsExecutionConfiguration; + whenPending: [ :theContainer | + theContainer removeChildren ]; + whenError: [ :theContainer :anError | + self updateAddOnElements: { + anError asDebuggableElement + hFitContentLimited; + vFitContent } ]; + whenSuccess: [ :theContainer :someElements | + self updateAddOnElements: someElements ] ] +] + +{ #category : #initialization } +GtCoderNavigationCompiledMethodElement >> initializeLabelElement [ + labelElement := BrLabel new. + labelElement + hFitContent; + vFitContent; + beSmallSize; + aptitude: GtCoderNavigationTreeLabelAptitude +] + +{ #category : #'api - compiled method' } +GtCoderNavigationCompiledMethodElement >> onCompiledMethodChanged [ + self updateElement +] + +{ #category : #'private - updating' } +GtCoderNavigationCompiledMethodElement >> updateAddOnElements: addOnElements [ + (addOnElements allSatisfy: [ :eachElement | eachElement parent == addOnsElement ]) + ifTrue: [ ^ self ]. + + addOnElements do: #removeFromParent. + addOnsElement + removeChildren; + addChildren: addOnElements +] + +{ #category : #'private - updating' } +GtCoderNavigationCompiledMethodElement >> updateAddonsElement [ + | aFuture | + addOnsCache ifNil: [ ^ self ]. + + GtCoderNavigationCompiledMethodsAddOnsCache isEnabled ifFalse: [ ^ self ]. + + aFuture := addOnsCache elementsForCompiledMethod: compiledMethod. + addOnsElement asyncFuture future: aFuture +] + +{ #category : #'private - updating' } +GtCoderNavigationCompiledMethodElement >> updateElement [ + self updateLabelElement. + self updateAddonsElement. +] + +{ #category : #'private - updating' } +GtCoderNavigationCompiledMethodElement >> updateLabelElement [ + | aSelector | + aSelector := compiledMethod selector asRopedText. + compiledMethod isDeprecated ifTrue: [ aSelector lineThrough ]. + + labelElement text: aSelector +] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationCompiledMethodsAddOnsCache.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationCompiledMethodsAddOnsCache.class.st index 9cc553e85..cb96b7178 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationCompiledMethodsAddOnsCache.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationCompiledMethodsAddOnsCache.class.st @@ -27,7 +27,7 @@ GtCoderNavigationCompiledMethodsAddOnsCache class >> isEnabled [ ] { #category : #private } -GtCoderNavigationCompiledMethodsAddOnsCache >> addOnsFutureForCompiledMethod: aCompiledMethod hostElement: aHostElement [ +GtCoderNavigationCompiledMethodsAddOnsCache >> addOnsFutureForCompiledMethod: aCompiledMethod [ | coderViewModel | coderViewModel := coderViewModelCache @@ -40,15 +40,14 @@ GtCoderNavigationCompiledMethodsAddOnsCache >> addOnsFutureForCompiledMethod: aC ] { #category : #accessing } -GtCoderNavigationCompiledMethodsAddOnsCache >> elementsForCompiledMethod: aCompiledMethod hostElement: aHostElement [ +GtCoderNavigationCompiledMethodsAddOnsCache >> elementsForCompiledMethod: aCompiledMethod [ ^ elementCache at: aCompiledMethod ifPresent: [ :someElements | someElements asAsyncFuture ] ifAbsent: [ | aCoderViewModel someElements | aCoderViewModel := self - addOnsFutureForCompiledMethod: aCompiledMethod - hostElement: aHostElement. + addOnsFutureForCompiledMethod: aCompiledMethod. aCoderViewModel addOnsFuture map: [ :addOns | From c98075e1e904a2429f99a0b11099db87a9a2c6ef Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 8 Dec 2025 21:48:14 -0300 Subject: [PATCH 1166/1268] fix navigation index step [feenkcom/gtoolkit#4892] --- .../GtCoderNavigationIndexStep.class.st | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/GToolkit-Coder-Examples/GtCoderNavigationIndexStep.class.st b/src/GToolkit-Coder-Examples/GtCoderNavigationIndexStep.class.st index 040951268..8b477fc5e 100644 --- a/src/GToolkit-Coder-Examples/GtCoderNavigationIndexStep.class.st +++ b/src/GToolkit-Coder-Examples/GtCoderNavigationIndexStep.class.st @@ -11,8 +11,8 @@ GtCoderNavigationIndexStep >> assertSelectedMethod: aCompiledMethod [ satisfies: [ :aLabel | aLabel states isSelected ]; onParentStepTarget: self; onThisOrBreadthFirstChildOfKind: GtCoderMethodsGroupedListElement; - // BrLabel; - @ [ :eachLabel | eachLabel text asString = aCompiledMethod selector ] + // GtCoderNavigationCompiledMethodElement; + @ [ :each | each compiledMethod = aCompiledMethod ] ] { #category : #accessing } @@ -36,16 +36,16 @@ GtCoderNavigationIndexStep >> selectMethods: someCompiledMethods [ label: ('Select the first method: {1}' format: {someCompiledMethods first selector}); onParentStepTarget: aStep; onThisOrBreadthFirstChildOfKind: GtCoderMethodsGroupedListElement; - // BrLabel; - @ [ :eachLabel | eachLabel text asString = someCompiledMethods first selector ]. + // GtCoderNavigationCompiledMethodElement; + @ [ :eachLabel | eachLabel compiledMethod = someCompiledMethods first ]. aStep click label: 'Select the other methods'; modifiers: (BlKeyModifiers primary shift: true); onParentStepTarget: aStep; onThisOrBreadthFirstChildOfKind: GtCoderMethodsGroupedListElement; - // BrLabel; - @ [ :each | each text asString = someCompiledMethods last selector ]. + // GtCoderNavigationCompiledMethodElement; + @ [ :each | each compiledMethod = someCompiledMethods last ]. aStep assert label: 'Assert list selection'; From cbd1a4cdfa26d3b3acdd20e83d06a87ec506b3f6 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 9 Dec 2025 11:46:13 -0300 Subject: [PATCH 1167/1268] add package tag default inspector tool --- src/GToolkit-Coder-UI/PackageTag.extension.st | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/GToolkit-Coder-UI/PackageTag.extension.st b/src/GToolkit-Coder-UI/PackageTag.extension.st index dfd7ba378..e78b150a9 100644 --- a/src/GToolkit-Coder-UI/PackageTag.extension.st +++ b/src/GToolkit-Coder-UI/PackageTag.extension.st @@ -1,5 +1,12 @@ Extension { #name : #PackageTag } +{ #category : #'*GToolkit-Coder-UI' } +PackageTag >> gtDefaultInspectorTool [ + ^ GtPhlowCompositeTool new + addTool: (GtPackageTagCoderTool forPackageTag: self); + addTool: super gtDefaultInspectorTool +] + { #category : #'*GToolkit-Coder-UI' } PackageTag >> gtSpawnCoder [ ^ GtPackageTagCoderTool forPackageTag: self From 9bdc2ba0aa9cf276910995e030ea132365ab4994 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 9 Dec 2025 13:38:30 -0300 Subject: [PATCH 1168/1268] clean `#gtBrowserFrom:` methods --- src/GToolkit-Coder-Extensions/Behavior.extension.st | 2 +- .../CompiledMethod.extension.st | 2 +- src/GToolkit-Coder-Extensions/Package.extension.st | 4 ++-- src/GToolkit-Coder-Extensions/PackageTag.extension.st | 11 +++++++++++ src/GToolkit-Coder-Extensions/RPackage.extension.st | 4 ++-- 5 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 src/GToolkit-Coder-Extensions/PackageTag.extension.st diff --git a/src/GToolkit-Coder-Extensions/Behavior.extension.st b/src/GToolkit-Coder-Extensions/Behavior.extension.st index 5a83d5cce..b55f47216 100644 --- a/src/GToolkit-Coder-Extensions/Behavior.extension.st +++ b/src/GToolkit-Coder-Extensions/Behavior.extension.st @@ -13,7 +13,7 @@ Behavior >> gtBrowse [ { #category : #'*GToolkit-Coder-Extensions' } Behavior >> gtBrowseFrom: anElement [ ^ BlSpace new - withSceneDriller; + withCommonSettings; inPager: [ self gtDefaultInspectorTool ]; title: self name; icon: BrGlamorousVectorIcons browse; diff --git a/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st b/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st index 5aedfc2ad..e40257b8c 100644 --- a/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st +++ b/src/GToolkit-Coder-Extensions/CompiledMethod.extension.st @@ -13,7 +13,7 @@ CompiledMethod >> gtBrowse [ { #category : #'*GToolkit-Coder-Extensions' } CompiledMethod >> gtBrowseFrom: anElement [ ^ BlSpace new - withSceneDriller; + withCommonSettings; inPager: [ GtMethodCoderTool compiledMethod: self ]; title: self methodClass name; icon: BrGlamorousVectorIcons browse; diff --git a/src/GToolkit-Coder-Extensions/Package.extension.st b/src/GToolkit-Coder-Extensions/Package.extension.st index f9944384f..c0ee1f931 100644 --- a/src/GToolkit-Coder-Extensions/Package.extension.st +++ b/src/GToolkit-Coder-Extensions/Package.extension.st @@ -46,8 +46,8 @@ Package >> gtBrowse [ { #category : #'*GToolkit-Coder-Extensions' } Package >> gtBrowseFrom: anElement [ ^ BlSpace new - withSceneDriller; - inPager: [ GtPackageCoderTool forPackage: self ]; + withCommonSettings; + inPager: [ self gtDefaultInspectorTool ]; title: self packageName; icon: BrGlamorousVectorIcons browse; showFrom: anElement diff --git a/src/GToolkit-Coder-Extensions/PackageTag.extension.st b/src/GToolkit-Coder-Extensions/PackageTag.extension.st new file mode 100644 index 000000000..f7b98bc02 --- /dev/null +++ b/src/GToolkit-Coder-Extensions/PackageTag.extension.st @@ -0,0 +1,11 @@ +Extension { #name : #PackageTag } + +{ #category : #'*GToolkit-Coder-Extensions' } +PackageTag >> gtBrowseFrom: anElement [ + ^ BlSpace new + withCommonSettings; + inPager: [ self gtDefaultInspectorTool ]; + title: self name; + icon: BrGlamorousVectorIcons browse; + showFrom: anElement +] diff --git a/src/GToolkit-Coder-Extensions/RPackage.extension.st b/src/GToolkit-Coder-Extensions/RPackage.extension.st index a8570f9ac..525354a14 100644 --- a/src/GToolkit-Coder-Extensions/RPackage.extension.st +++ b/src/GToolkit-Coder-Extensions/RPackage.extension.st @@ -46,8 +46,8 @@ RPackage >> gtBrowse [ { #category : #'*GToolkit-Coder-Extensions' } RPackage >> gtBrowseFrom: anElement [ ^ BlSpace new - withSceneDriller; - inPager: [ GtPackageCoderTool forPackage: self ]; + withCommonSettings; + inPager: [ self gtDefaultInspectorTool ]; title: self packageName; icon: BrGlamorousVectorIcons browse; showFrom: anElement From 939c3833cdf3778c4146161b12d0d44246a9e087 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 10 Dec 2025 14:26:21 -0300 Subject: [PATCH 1169/1268] enable navigation method index addons [feenkcom/gtoolkit#4884] --- .../GtCoderNavigationCompiledMethodsAddOnsCache.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationCompiledMethodsAddOnsCache.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationCompiledMethodsAddOnsCache.class.st index cb96b7178..17b4c7ac3 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationCompiledMethodsAddOnsCache.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationCompiledMethodsAddOnsCache.class.st @@ -23,7 +23,7 @@ GtCoderNavigationCompiledMethodsAddOnsCache class >> enable [ { #category : #settings } GtCoderNavigationCompiledMethodsAddOnsCache class >> isEnabled [ - ^ IsEnabled ifNil: [ IsEnabled := false ] + ^ IsEnabled ifNil: [ IsEnabled := true ] ] { #category : #private } From 947bf12a2778c35b263a2c95a7c12cdcc6ebb804 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 15 Dec 2025 16:34:22 -0300 Subject: [PATCH 1170/1268] users can create their own navigation method item elements and collapsed coder elements [feenkcom/gtoolkit#4898] --- .../GtCoderMethodsGroupedListElement.class.st | 18 ++++++++-- ...avigationMethodItemElementStencil.class.st | 33 +++++++++++++++++++ .../GtCollapsedCoderElementStencil.class.st | 31 +++++++++++++++++ .../GtExpandableSourceCoderElement.class.st | 17 ++++++++-- 4 files changed, 94 insertions(+), 5 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderNavigationMethodItemElementStencil.class.st create mode 100644 src/GToolkit-Coder-UI/GtCollapsedCoderElementStencil.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st index f373053a2..1b81685f7 100644 --- a/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMethodsGroupedListElement.class.st @@ -6,7 +6,8 @@ Class { #instVars : [ 'navigationModel', 'methodGroups', - 'addOnsCache' + 'addOnsCache', + 'methodItemElementStencil' ], #category : #'GToolkit-Coder-UI-Navigation - Helpers' } @@ -82,9 +83,9 @@ GtCoderMethodsGroupedListElement >> browseSeveralReferencesOf: aCollectionOfSymb GtCoderMethodsGroupedListElement >> buildMethodItem [ | aLabel | - aLabel := GtCoderNavigationCompiledMethodElement new. + aLabel := self createBasicMethodItemElement. aLabel addOnsCache: addOnsCache. - + aLabel addAptitude: (BrGlamorousWithExplicitContextMenuAptitude new withGainFocusOnShow; @@ -112,6 +113,11 @@ GtCoderMethodsGroupedListElement >> contextMenuForSeveralItems: someItems in: an hostElement: anElement ] +{ #category : #'private - insance creation' } +GtCoderMethodsGroupedListElement >> createBasicMethodItemElement [ + ^ methodItemElementStencil asElement +] + { #category : #'private - insance creation' } GtCoderMethodsGroupedListElement >> createDraggedMethodItem: aDragItem [ @@ -191,6 +197,7 @@ GtCoderMethodsGroupedListElement >> initialize [ super initialize. addOnsCache := GtCoderNavigationCompiledMethodsAddOnsCache new subscribeToSystem. + methodItemElementStencil := GtCoderNavigationMethodItemElementStencil new. self padding: (BlInsets left: 5 right: 10); @@ -211,6 +218,11 @@ GtCoderMethodsGroupedListElement >> initialize [ do: [ :anEvent | self onBrWidgetPermanentlyRemovedEvent: anEvent ]. ] +{ #category : #accessing } +GtCoderMethodsGroupedListElement >> methodItemElementStencil: aStencil [ + methodItemElementStencil := aStencil asStencil +] + { #category : #accessing } GtCoderMethodsGroupedListElement >> methodList [ ^ methodGroups flatCollect: [ :grp | grp itemsProvider currentItems ] diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationMethodItemElementStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationMethodItemElementStencil.class.st new file mode 100644 index 000000000..1381ff8f2 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderNavigationMethodItemElementStencil.class.st @@ -0,0 +1,33 @@ +" +I create a basic method item element used by {{gtClass:GtCoderMethodsGroupedListElement}}. +Such method item elements are created in the {{gtMethod:GtCoderMethodsGroupedListElement>>#buildMethodItem}} method. +Users can set their own stencil using {{gtMethod:GtCoderNavigationMethodItemElementStencil class>>#defaultStencil:}}. + +" +Class { + #name : #GtCoderNavigationMethodItemElementStencil, + #superclass : #BrStencil, + #classVars : [ + 'DefaultStencil' + ], + #category : #'GToolkit-Coder-UI-Navigation - Helpers' +} + +{ #category : #accessing } +GtCoderNavigationMethodItemElementStencil class >> defaultStencil [ + ^ DefaultStencil +] + +{ #category : #accessing } +GtCoderNavigationMethodItemElementStencil class >> defaultStencil: aStencil [ + "Users can customize their default navigation method item element" + + DefaultStencil := aStencil asStencil +] + +{ #category : #'api - instantiation' } +GtCoderNavigationMethodItemElementStencil >> create [ + ^ DefaultStencil + ifNil: [ GtCoderNavigationCompiledMethodElement new ] + ifNotNil: [ :aStencil | aStencil create ] +] diff --git a/src/GToolkit-Coder-UI/GtCollapsedCoderElementStencil.class.st b/src/GToolkit-Coder-UI/GtCollapsedCoderElementStencil.class.st new file mode 100644 index 000000000..a826d913b --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCollapsedCoderElementStencil.class.st @@ -0,0 +1,31 @@ +" +I create a basic collapsed coder element used by {{gtClass:GtCoderMethodsGroupedListElement}}. +Such collapsed coder element is created in the {{gtMethod:GtExpandableSourceCoderElement>>#newCollapsedElement}} method. +Users can set their own stencil using {{gtMethod:GtCollapsedCoderElementStencil class>>#defaultStencil:}}. + +" +Class { + #name : #GtCollapsedCoderElementStencil, + #superclass : #BrStencil, + #classVars : [ + 'DefaultStencil' + ], + #category : #'GToolkit-Coder-UI-Coder - Source' +} + +{ #category : #accessing } +GtCollapsedCoderElementStencil class >> defaultStencil [ + ^ DefaultStencil +] + +{ #category : #accessing } +GtCollapsedCoderElementStencil class >> defaultStencil: aStencil [ + DefaultStencil := aStencil asStencil +] + +{ #category : #'api - instantiation' } +GtCollapsedCoderElementStencil >> create [ + ^ DefaultStencil + ifNil: [ GtSourceCoderCollapsedContentElement new ] + ifNotNil: [ :aStencil | aStencil create ] +] diff --git a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st index 1ba4f7bc3..fb836e66a 100644 --- a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st @@ -6,7 +6,8 @@ Class { #instVars : [ 'collapsedElement', 'expandedElement', - 'modificationIndicator' + 'modificationIndicator', + 'collapsedElementStencil' ], #category : #'GToolkit-Coder-UI-Coder - Source' } @@ -54,6 +55,16 @@ GtExpandableSourceCoderElement >> coderViewModel: aCoderViewModel [ self textualCoderViewModel: aCoderViewModel ] +{ #category : #accessing } +GtExpandableSourceCoderElement >> collapsedElementStencil: anObject [ + collapsedElementStencil := anObject +] + +{ #category : #'private - instance creation' } +GtExpandableSourceCoderElement >> createBasicCollapsedElement [ + ^ collapsedElementStencil asElement +] + { #category : #accessing } GtExpandableSourceCoderElement >> gtAllShortcutsFor: aView [ @@ -71,6 +82,8 @@ GtExpandableSourceCoderElement >> gtAllShortcutsFor: aView [ GtExpandableSourceCoderElement >> initialize [ super initialize. + collapsedElementStencil := GtCollapsedCoderElementStencil new. + self vFitContent; hMatchParent; @@ -116,7 +129,7 @@ GtExpandableSourceCoderElement >> markDirty: anElement as: aBoolean [ { #category : #'private - instance creation' } GtExpandableSourceCoderElement >> newCollapsedElement [ | aCollapsedElement | - aCollapsedElement := GtSourceCoderCollapsedContentElement new. + aCollapsedElement := self createBasicCollapsedElement. textualCoderViewModel ifNotNil: [ :aCoder | self assignCollapsedCoder: aCoder to: aCollapsedElement ]. From c08d4a553223c488e544c134767100ff89628a69 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 16 Dec 2025 10:21:40 -0300 Subject: [PATCH 1171/1268] improve method name --- .../GtCoderNavigationCompiledMethodElement.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationCompiledMethodElement.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationCompiledMethodElement.class.st index 7a5e6c7de..3537ae1f5 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationCompiledMethodElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationCompiledMethodElement.class.st @@ -44,7 +44,7 @@ GtCoderNavigationCompiledMethodElement >> initialize [ super initialize. self initializeLabelElement. - self initializeAddonsElement. + self initializeAddOnsElement. self addChild: labelElement. self addChild: addOnsElement. @@ -57,7 +57,7 @@ GtCoderNavigationCompiledMethodElement >> initialize [ ] { #category : #initialization } -GtCoderNavigationCompiledMethodElement >> initializeAddonsElement [ +GtCoderNavigationCompiledMethodElement >> initializeAddOnsElement [ addOnsElement := BrHorizontalPane new id: #addOnsContainer; cellSpacing: 2; From fce03658089ab1d4001394b6e4ee6d346e92dc0f Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 17 Dec 2025 13:28:27 -0300 Subject: [PATCH 1172/1268] improve `GtCoderEvaluationUnhandledError` handling inside of a Scripter execution [feenkcom/gtoolkit#4881] --- ...CoderCouldNotHandleEvalutionError.class.st | 21 +++++++++++++++++++ .../GtCoderEvaluationUnhandledError.class.st | 4 +++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 src/GToolkit-Coder/GtCoderCouldNotHandleEvalutionError.class.st diff --git a/src/GToolkit-Coder/GtCoderCouldNotHandleEvalutionError.class.st b/src/GToolkit-Coder/GtCoderCouldNotHandleEvalutionError.class.st new file mode 100644 index 000000000..fb80abca2 --- /dev/null +++ b/src/GToolkit-Coder/GtCoderCouldNotHandleEvalutionError.class.st @@ -0,0 +1,21 @@ +" +I am used to indicate that {{gtClass:GtCoderEvaluationUnhandledError}} error cannot be handled a standard way, e.g., opening a debugger window. When we simulate UI interactions using {{gtClass:BlScripter}}, we cannot open a debugger window as it suspends the Scripter's UI process and an example evaluator waits indefinitely for the example to finish. +" +Class { + #name : #GtCoderCouldNotHandleEvalutionError, + #superclass : #Error, + #instVars : [ + 'unhandledError' + ], + #category : #'GToolkit-Coder-Coders' +} + +{ #category : #accessing } +GtCoderCouldNotHandleEvalutionError >> unhandledError [ + ^ unhandledError +] + +{ #category : #accessing } +GtCoderCouldNotHandleEvalutionError >> unhandledError: anObject [ + unhandledError := anObject +] diff --git a/src/GToolkit-Coder/GtCoderEvaluationUnhandledError.class.st b/src/GToolkit-Coder/GtCoderEvaluationUnhandledError.class.st index dd8540524..553b26e8f 100644 --- a/src/GToolkit-Coder/GtCoderEvaluationUnhandledError.class.st +++ b/src/GToolkit-Coder/GtCoderEvaluationUnhandledError.class.st @@ -40,7 +40,9 @@ GtCoderEvaluationUnhandledError >> defaultAction [ ^ BlDevScripterStepExecutionIndicator - ifScripter: [ super defaultAction ] + ifScripter: [ GtCoderCouldNotHandleEvalutionError new + unhandledError: self; + signal ] ifNone: [ UIManager default unhandledErrorDefaultAction: self ] ] From bdc50ec2339a4bb6e28689d704cd093d46ed6c8b Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 17 Dec 2025 16:30:07 -0300 Subject: [PATCH 1173/1268] add `GtCoderElementStencil` with a configurable default stencil [feenkcom/gtoolkit#4898] --- .../GtCoderElementStencil.class.st | 41 +++++++++++++++++++ .../GtCollapsedCoderElementStencil.class.st | 22 ++-------- .../GtExpandableSourceCoderElement.class.st | 14 ++++--- 3 files changed, 54 insertions(+), 23 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderElementStencil.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderElementStencil.class.st b/src/GToolkit-Coder-UI/GtCoderElementStencil.class.st new file mode 100644 index 000000000..76ada0318 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderElementStencil.class.st @@ -0,0 +1,41 @@ +" +I am a {{gtClass:BrStencil}} that creates a default coder element or customized one, based on users configuration using {{gtMethod:GtCoderElementStencil class>>#defaultStencil:}}. +I am an abstract class. See my {{gtClass:GtCoderElementStencil | show=#gtSubclassesFor: | expanded = true | label=subclasses}} +" +Class { + #name : #GtCoderElementStencil, + #superclass : #BrStencil, + #classInstVars : [ + 'defaultStencil' + ], + #category : #'GToolkit-Coder-UI-Coder - Source' +} + +{ #category : #clearing } +GtCoderElementStencil class >> clearDefaultStencil [ + defaultStencil := nil +] + +{ #category : #accessing } +GtCoderElementStencil class >> defaultStencil [ + + ^ defaultStencil +] + +{ #category : #accessing } +GtCoderElementStencil class >> defaultStencil: aStencil [ + defaultStencil := aStencil asStencil +] + +{ #category : #'api - instantiation' } +GtCoderElementStencil >> create [ + ^ self class defaultStencil + ifNil: [ self defaultElement] + ifNotNil: [ :aStencil | aStencil create ] +] + +{ #category : #'api - instantiation' } +GtCoderElementStencil >> defaultElement [ + + ^ self subclassResponsibility +] diff --git a/src/GToolkit-Coder-UI/GtCollapsedCoderElementStencil.class.st b/src/GToolkit-Coder-UI/GtCollapsedCoderElementStencil.class.st index a826d913b..ccd6a19c2 100644 --- a/src/GToolkit-Coder-UI/GtCollapsedCoderElementStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCollapsedCoderElementStencil.class.st @@ -6,26 +6,12 @@ Users can set their own stencil using {{gtMethod:GtCollapsedCoderElementStencil " Class { #name : #GtCollapsedCoderElementStencil, - #superclass : #BrStencil, - #classVars : [ - 'DefaultStencil' - ], + #superclass : #GtCoderElementStencil, #category : #'GToolkit-Coder-UI-Coder - Source' } -{ #category : #accessing } -GtCollapsedCoderElementStencil class >> defaultStencil [ - ^ DefaultStencil -] - -{ #category : #accessing } -GtCollapsedCoderElementStencil class >> defaultStencil: aStencil [ - DefaultStencil := aStencil asStencil -] - { #category : #'api - instantiation' } -GtCollapsedCoderElementStencil >> create [ - ^ DefaultStencil - ifNil: [ GtSourceCoderCollapsedContentElement new ] - ifNotNil: [ :aStencil | aStencil create ] +GtCollapsedCoderElementStencil >> defaultElement [ + + ^ GtSourceCoderCollapsedContentElement new ] diff --git a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st index fb836e66a..6d36078e2 100644 --- a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st @@ -65,6 +65,11 @@ GtExpandableSourceCoderElement >> createBasicCollapsedElement [ ^ collapsedElementStencil asElement ] +{ #category : #initialization } +GtExpandableSourceCoderElement >> defaultCollapsedElementStencil [ + ^ GtCollapsedCoderElementStencil new +] + { #category : #accessing } GtExpandableSourceCoderElement >> gtAllShortcutsFor: aView [ @@ -82,8 +87,8 @@ GtExpandableSourceCoderElement >> gtAllShortcutsFor: aView [ GtExpandableSourceCoderElement >> initialize [ super initialize. - collapsedElementStencil := GtCollapsedCoderElementStencil new. - + collapsedElementStencil := self defaultCollapsedElementStencil. + self vFitContent; hMatchParent; @@ -102,10 +107,9 @@ GtExpandableSourceCoderElement >> initialize [ self when: BlClickEvent - do: [ :anEvent | + do: [ :anEvent | self isCollapsed - ifTrue: [ - anEvent consumed: true. + ifTrue: [ anEvent consumed: true. self expand. self textualCoderViewModel focused: true ] ]. From 7afb85e418182b4dc4de3a143959a7aa2b55f78a Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 17 Dec 2025 18:43:09 -0300 Subject: [PATCH 1174/1268] add `GtExpandedCoderElementStencil` [feenkcom/gtoolkit#4898] --- .../GtExpandableSourceCoderElement.class.st | 16 ++++++++++++++-- .../GtExpandedCoderElementStencil.class.st | 11 +++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtExpandedCoderElementStencil.class.st diff --git a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st index 6d36078e2..81e36c159 100644 --- a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st @@ -7,7 +7,8 @@ Class { 'collapsedElement', 'expandedElement', 'modificationIndicator', - 'collapsedElementStencil' + 'collapsedElementStencil', + 'expandedElementStencil' ], #category : #'GToolkit-Coder-UI-Coder - Source' } @@ -65,11 +66,21 @@ GtExpandableSourceCoderElement >> createBasicCollapsedElement [ ^ collapsedElementStencil asElement ] +{ #category : #'private - instance creation' } +GtExpandableSourceCoderElement >> createBasicExpandedElement [ + ^ expandedElementStencil asElement +] + { #category : #initialization } GtExpandableSourceCoderElement >> defaultCollapsedElementStencil [ ^ GtCollapsedCoderElementStencil new ] +{ #category : #initialization } +GtExpandableSourceCoderElement >> defaultExpandedElementStencil [ + ^ GtExpandedCoderElementStencil new +] + { #category : #accessing } GtExpandableSourceCoderElement >> gtAllShortcutsFor: aView [ @@ -88,6 +99,7 @@ GtExpandableSourceCoderElement >> initialize [ super initialize. collapsedElementStencil := self defaultCollapsedElementStencil. + expandedElementStencil := self defaultExpandedElementStencil. self vFitContent; @@ -144,7 +156,7 @@ GtExpandableSourceCoderElement >> newCollapsedElement [ { #category : #'private - instance creation' } GtExpandableSourceCoderElement >> newExpandedElement [ | anExpandedElement | - anExpandedElement := GtSourceCoderExpandedContentElement new. + anExpandedElement := self createBasicExpandedElement. textualCoderViewModel ifNotNil: [ :aCoder | self assignExpandedCoder: aCoder to: anExpandedElement ]. diff --git a/src/GToolkit-Coder-UI/GtExpandedCoderElementStencil.class.st b/src/GToolkit-Coder-UI/GtExpandedCoderElementStencil.class.st new file mode 100644 index 000000000..b3dd266dd --- /dev/null +++ b/src/GToolkit-Coder-UI/GtExpandedCoderElementStencil.class.st @@ -0,0 +1,11 @@ +Class { + #name : #GtExpandedCoderElementStencil, + #superclass : #GtCoderElementStencil, + #category : #'GToolkit-Coder-UI-Coder - Source' +} + +{ #category : #'api - instantiation' } +GtExpandedCoderElementStencil >> defaultElement [ + + ^ GtSourceCoderExpandedContentElement new +] From 4953b4bec53ab33541f8e6c83f95c4f6f972076c Mon Sep 17 00:00:00 2001 From: John Brant Date: Tue, 30 Dec 2025 08:53:15 -0600 Subject: [PATCH 1175/1268] changing push up method gtDescription to work for newly created classes --- .../RBPullUpMethodRefactoring.extension.st | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/RBPullUpMethodRefactoring.extension.st b/src/GToolkit-Coder-UI/RBPullUpMethodRefactoring.extension.st index ca168c1fa..802a91f5c 100644 --- a/src/GToolkit-Coder-UI/RBPullUpMethodRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBPullUpMethodRefactoring.extension.st @@ -2,5 +2,10 @@ Extension { #name : #RBPullUpMethodRefactoring } { #category : #'*GToolkit-Coder-UI' } RBPullUpMethodRefactoring >> gtDescription [ - ^ 'Push up method ' , class name , '>>' , selectors anyOne + ^ 'Push up method ' , self methodClassName , '>>' , selectors anyOne +] + +{ #category : #'*GToolkit-Coder-UI' } +RBPullUpMethodRefactoring >> methodClassName [ + ^ class name ] From 1579ea8152ecc0f331d37c670ef84a37380c1866 Mon Sep 17 00:00:00 2001 From: John Brant Date: Wed, 31 Dec 2025 09:52:04 -0600 Subject: [PATCH 1176/1268] better gtDescription for some refactorings --- .../RBAddInstanceVariableRefactoring.extension.st | 2 +- .../RBPushDownMethodRefactoring.extension.st | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/RBAddInstanceVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RBAddInstanceVariableRefactoring.extension.st index 622e90dfd..0da544dc2 100644 --- a/src/GToolkit-Coder-UI/RBAddInstanceVariableRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBAddInstanceVariableRefactoring.extension.st @@ -8,5 +8,5 @@ RBAddInstanceVariableRefactoring >> gtDescription [ append: ' instance variable ' asRopedText; append: variableName asRopedText glamorousRoundedBackground; append: ' to ' asRopedText; - append: class printString asRopedText + append: self refactoredClassName asRopedText ] diff --git a/src/GToolkit-Coder-UI/RBPushDownMethodRefactoring.extension.st b/src/GToolkit-Coder-UI/RBPushDownMethodRefactoring.extension.st index ad754131e..96512e08b 100644 --- a/src/GToolkit-Coder-UI/RBPushDownMethodRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBPushDownMethodRefactoring.extension.st @@ -2,5 +2,10 @@ Extension { #name : #RBPushDownMethodRefactoring } { #category : #'*GToolkit-Coder-UI' } RBPushDownMethodRefactoring >> gtDescription [ - ^ 'Push down method ' , class name , '>>' , selectors anyOne + ^ 'Push down method ' , self superclassName , '>>' , selectors anyOne +] + +{ #category : #'*GToolkit-Coder-UI' } +RBPushDownMethodRefactoring >> superclassName [ + ^ class name ] From 91812642bf0103d2487907c72a5dba61d6af00ff Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Mon, 5 Jan 2026 09:18:33 +0100 Subject: [PATCH 1177/1268] improve display of refactoring feenkcom/gtoolkit#4872 --- src/GToolkit-Coder-UI/RBRefactoring.extension.st | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/GToolkit-Coder-UI/RBRefactoring.extension.st b/src/GToolkit-Coder-UI/RBRefactoring.extension.st index 845d214a9..344d1d428 100644 --- a/src/GToolkit-Coder-UI/RBRefactoring.extension.st +++ b/src/GToolkit-Coder-UI/RBRefactoring.extension.st @@ -6,3 +6,8 @@ RBRefactoring >> gtDescription [ ^ self class name ] + +{ #category : #'*GToolkit-Coder-UI' } +RBRefactoring >> gtDisplayOn: aStream [ + aStream nextPutAll: self gtDescription +] From 83f94ee4e3b1015a9ba8dff7fd5c8ea64150dd64 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 7 Jan 2026 11:21:30 -0300 Subject: [PATCH 1178/1268] coder tools may define object holders --- src/GToolkit-Coder-UI/GtClassCoderTool.class.st | 13 ++++++++++++- src/GToolkit-Coder-UI/GtMethodCoderTool.class.st | 7 +++++++ .../GtTextualCoderViewModel.class.st | 6 ++++++ src/GToolkit-Coder/GtTextualCoder.class.st | 3 +-- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtClassCoderTool.class.st b/src/GToolkit-Coder-UI/GtClassCoderTool.class.st index 526cb789d..7e804f62a 100644 --- a/src/GToolkit-Coder-UI/GtClassCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtClassCoderTool.class.st @@ -1,6 +1,8 @@ Class { #name : #GtClassCoderTool, #superclass : #GtCoderTool, + #traits : 'TGtPhlowWithSelfObjectHolder', + #classTraits : 'TGtPhlowWithSelfObjectHolder classTrait', #instVars : [ 'observedClass' ], @@ -12,6 +14,13 @@ GtClassCoderTool class >> forClass: aClass [ ^ self new observedClass: aClass ] +{ #category : #'instance creation' } +GtClassCoderTool class >> forClass: aClass selfObjectHolder: aSelfObjectHolder [ + ^ self new + observedClass: aClass; + selfObjectHolder: aSelfObjectHolder +] + { #category : #'instance creation' } GtClassCoderTool class >> observedClass: aClass [ ^ self new observedClass: aClass @@ -19,7 +28,9 @@ GtClassCoderTool class >> observedClass: aClass [ { #category : #converting } GtClassCoderTool >> newCoder [ - ^ GtCoderElement forClass: self observedClass instanceSide + ^ self + ifSelfObject: [ :aSelfObject | GtCoderElement forObject: aSelfObject ] + ifNone: [ GtCoderElement forClass: self observedClass instanceSide ] ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtMethodCoderTool.class.st b/src/GToolkit-Coder-UI/GtMethodCoderTool.class.st index 14e2d9c1b..d5f0fd34d 100644 --- a/src/GToolkit-Coder-UI/GtMethodCoderTool.class.st +++ b/src/GToolkit-Coder-UI/GtMethodCoderTool.class.st @@ -14,6 +14,13 @@ GtMethodCoderTool class >> compiledMethod: aMethod [ ^ self new compiledMethod: aMethod ] +{ #category : #'instance creation' } +GtMethodCoderTool class >> compiledMethod: aMethod selfObjectHolder: aSelfObjectHolder [ + ^ self new + compiledMethod: aMethod; + selfObjectHolder: aSelfObjectHolder +] + { #category : #accessing } GtMethodCoderTool >> compiledMethod [ ^ compiledMethod diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 76b7f9aca..f56ffb59d 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -173,6 +173,12 @@ GtTextualCoderViewModel >> astSync [ ^ self coderModel astSync ] +{ #category : #'api - coder model' } +GtTextualCoderViewModel >> coderAstFuture [ + + ^ self coderModel coderAstFuture +] + { #category : #accessing } GtTextualCoderViewModel >> completionStrategy [ diff --git a/src/GToolkit-Coder/GtTextualCoder.class.st b/src/GToolkit-Coder/GtTextualCoder.class.st index 4585c5429..c5c5d6c30 100644 --- a/src/GToolkit-Coder/GtTextualCoder.class.st +++ b/src/GToolkit-Coder/GtTextualCoder.class.st @@ -81,8 +81,7 @@ GtTextualCoder >> coderAst [ { #category : #'api - ast' } GtTextualCoder >> coderAstFuture [ - - + ^ AsyncCachedFuture new future: [ self computeCoderAst ] asAsyncFuture cache: astCache From 2577e7bc61c203c3aabe4f1ad796734ad6f51b0f Mon Sep 17 00:00:00 2001 From: Alistair Grant Date: Wed, 7 Jan 2026 16:19:32 +0100 Subject: [PATCH 1179/1268] [feenkcom/gtoolkit#4917] Display the toolbar in the method coder when inspecting big methods --- .../GtSourceCoderActionsElement.class.st | 9 ++++++++- .../GtTextualCoderEditorElement.class.st | 9 +++++++-- .../GtCoderCompiledMethodTextSource.class.st | 5 ++++- src/GToolkit-Coder/GtTextualCoder.class.st | 5 +++++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st index dbff49fa4..b2a30e806 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderActionsElement.class.st @@ -27,8 +27,15 @@ GtSourceCoderActionsElement >> addContextToolbarActions [ { #category : #private } GtSourceCoderActionsElement >> addMainToolbarActions [ + | mainActions coderModel | + + mainActions := self coderViewModel mainActions. + coderModel := self coderViewModel coderModel. + (coderModel isForMethod and: [ coderModel compiledMethod isNotNil and: [ coderModel compiledMethod isBigMethod ] ]) ifTrue: + [ mainActions := mainActions reject: + [ :action | action title = 'Save' ] ]. mainToolbar - addItems: (self coderViewModel mainActions + addItems: (mainActions collect: [ :aGtCoderAction | self flag: 'Temporary hack. Coder should to Phlow actions'. [ aGtCoderAction buildElementIn: self ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index a7a421784..6536a5984 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -734,9 +734,14 @@ GtTextualCoderEditorElement >> subscribeToTextualCoderViewModel [ "Is sent after a new textualCoder view model is assigned to the element. It is required to unsubscribe from the view model or domain model by implementing #unsubscribeFromTextualCoderViewModel if elements subscribe to them" - - self registerCoderModelAnnouncementsFor: self textualCoderViewModel coderModel. + | coderModel | + + coderModel := self textualCoderViewModel coderModel. + self registerCoderModelAnnouncementsFor: coderModel. self registerCoderViewModelAnnouncementsFor: self textualCoderViewModel. + (coderModel isForMethod and: [ coderModel compiledMethod isNotNil ]) ifTrue: + [ coderModel compiledMethod isBigMethod ifTrue: + [ self beReadOnlyWithSelection ] ]. completion install ] diff --git a/src/GToolkit-Coder/GtCoderCompiledMethodTextSource.class.st b/src/GToolkit-Coder/GtCoderCompiledMethodTextSource.class.st index 23451e6c9..0907e98bc 100644 --- a/src/GToolkit-Coder/GtCoderCompiledMethodTextSource.class.st +++ b/src/GToolkit-Coder/GtCoderCompiledMethodTextSource.class.st @@ -23,5 +23,8 @@ GtCoderCompiledMethodTextSource >> compiledMethod: anObject [ { #category : #initialization } GtCoderCompiledMethodTextSource >> computeOriginalSourceText [ - ^ compiledMethod sourceCode asRopedText + + ^ (compiledMethod isBigMethod + ifTrue: [ (compiledMethod sourceCode first: 10000), '...' ] + ifFalse: [ compiledMethod sourceCode ]) asRopedText ] diff --git a/src/GToolkit-Coder/GtTextualCoder.class.st b/src/GToolkit-Coder/GtTextualCoder.class.st index 4585c5429..fc39fad56 100644 --- a/src/GToolkit-Coder/GtTextualCoder.class.st +++ b/src/GToolkit-Coder/GtTextualCoder.class.st @@ -250,6 +250,11 @@ GtTextualCoder >> initialize [ self reset ] +{ #category : #testing } +GtTextualCoder >> isForMethod [ + ^ false +] + { #category : #testing } GtTextualCoder >> isModified [ From 46661723c56e0f14a57ffd5323c934b3b8e5bf37 Mon Sep 17 00:00:00 2001 From: John Brant Date: Wed, 7 Jan 2026 09:48:06 -0600 Subject: [PATCH 1180/1268] add a timestamp to change when it is performed --- src/GToolkit-Coder/GtRefactoryChangeManager.class.st | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder/GtRefactoryChangeManager.class.st b/src/GToolkit-Coder/GtRefactoryChangeManager.class.st index 227458f5b..e85dc8738 100644 --- a/src/GToolkit-Coder/GtRefactoryChangeManager.class.st +++ b/src/GToolkit-Coder/GtRefactoryChangeManager.class.st @@ -199,7 +199,12 @@ GtRefactoryChangeManager >> initialize [ { #category : #executing } GtRefactoryChangeManager >> performChange: aRefactoringChange [ - self ignoreChangesWhile: [ self addUndo: aRefactoringChange execute ] + self + ignoreChangesWhile: [ | now | + now := DateAndTime now. + self addUndo: aRefactoringChange execute. + aRefactoringChange + gtAllChangesDo: [ :each | each attributeNamed: #timestamp put: now ] ] ] { #category : #executing } From f04558158b8754d3d40767bbb0f74ba5dd6df78c Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Sat, 10 Jan 2026 17:06:15 +0100 Subject: [PATCH 1181/1268] [feenkcom/gtoolkit#4919] replace source code editor element --- .../GtCoderMenuActionItem.class.st | 2 +- .../GtCoderMenuSubmenuItem.class.st | 2 +- .../GtSourceCoderEditorInnerId.class.st | 10 + .../GtSourceCoderElement.class.st | 60 ++ ...SourceCoderExpandedContentElement.class.st | 5 +- .../GtTextualCoderEditorElement.class.st | 6 + .../GtTextualCoderElement.class.st | 821 ++++++++++++++++++ .../GtTextualCoderViewModel.class.st | 2 +- 8 files changed, 902 insertions(+), 6 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderEditorInnerId.class.st create mode 100644 src/GToolkit-Coder-UI/GtSourceCoderElement.class.st create mode 100644 src/GToolkit-Coder-UI/GtTextualCoderElement.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderMenuActionItem.class.st b/src/GToolkit-Coder-UI/GtCoderMenuActionItem.class.st index 0fed37226..b6bd19ccc 100644 --- a/src/GToolkit-Coder-UI/GtCoderMenuActionItem.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMenuActionItem.class.st @@ -41,7 +41,7 @@ GtCoderMenuActionItem >> leaveAction [ { #category : #accessing } GtCoderMenuActionItem >> textualCoderEditorElement [ - + ^ textualCoderEditorElement ] diff --git a/src/GToolkit-Coder-UI/GtCoderMenuSubmenuItem.class.st b/src/GToolkit-Coder-UI/GtCoderMenuSubmenuItem.class.st index 5e9546b0a..154b4ed83 100644 --- a/src/GToolkit-Coder-UI/GtCoderMenuSubmenuItem.class.st +++ b/src/GToolkit-Coder-UI/GtCoderMenuSubmenuItem.class.st @@ -41,7 +41,7 @@ GtCoderMenuSubmenuItem >> leaveAction [ { #category : #accessing } GtCoderMenuSubmenuItem >> textualCoderEditorElement [ - + ^ textualCoderEditorElement ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderEditorInnerId.class.st b/src/GToolkit-Coder-UI/GtSourceCoderEditorInnerId.class.st new file mode 100644 index 000000000..2b5382c5c --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderEditorInnerId.class.st @@ -0,0 +1,10 @@ +Class { + #name : #GtSourceCoderEditorInnerId, + #superclass : #GtCoderElementId, + #category : #'GToolkit-Coder-UI-Coder - Ids' +} + +{ #category : #converting } +GtSourceCoderEditorInnerId >> asSymbol [ + ^ #'source-coder--editor-inner' +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderElement.class.st new file mode 100644 index 000000000..b6742d1eb --- /dev/null +++ b/src/GToolkit-Coder-UI/GtSourceCoderElement.class.st @@ -0,0 +1,60 @@ +Class { + #name : #GtSourceCoderElement, + #superclass : #GtTextualCoderElement, + #category : #'GToolkit-Coder-UI-Coder - Source' +} + +{ #category : #views } +GtSourceCoderElement >> gtEditorTextAttributesFor: aView [ + + ^ aView forward + title: 'Text attributes'; + priority: 41; + object: [ self editor ]; + view: #gtTextAttributesFor: +] + +{ #category : #views } +GtSourceCoderElement >> gtEditorTextIntervalsFor: aView [ + + ^ aView forward + title: 'Text intervals'; + priority: 42; + object: [ self editor ]; + view: #gtTextIntervalsFor: +] + +{ #category : #initalization } +GtSourceCoderElement >> initialize [ + super initialize. + self editor doubleClickWordClassifier: GtSmalltalkSourceCoder doubleClickClassifier. + self editor movementWordClassifier: GtSmalltalkSourceCoder wordMovementClassifier. +] + +{ #category : #'api - textual coder view model' } +GtSourceCoderElement >> onTextualCoderViewModelChanged [ + super onTextualCoderViewModelChanged. + + self textualCoderViewModel evaluationResult + ifNil: [ evaluationHighlighter hideResult ] + ifNotNil: [ :aResult | evaluationHighlighter displayResult: aResult ] +] + +{ #category : #registration } +GtSourceCoderElement >> onViewModelEvaluationStatusChanged: anAnnouncement [ + self + enqueueTask: (BlTaskAction new + action: [ anAnnouncement evaluationStatus + handleStatusChangedAnnouncement: anAnnouncement + sourceCoderElement: self. + self styleText ]) +] + +{ #category : #registration } +GtSourceCoderElement >> registerCoderViewModelAnnouncementsFor: aGtSourceCoderUIModel [ + super registerCoderViewModelAnnouncementsFor: aGtSourceCoderUIModel. + aGtSourceCoderUIModel weak + when: GtSourceCoderViewModelEvaluationStatusChanged + send: #onViewModelEvaluationStatusChanged: + to: self +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st index 03c0f1066..558afdcaa 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st @@ -56,7 +56,7 @@ GtSourceCoderExpandedContentElement >> newActionsElement [ { #category : #'instance creation' } GtSourceCoderExpandedContentElement >> newEditorElement [ - ^ GtSourceCoderEditorElement new + ^ GtSourceCoderElement new ] { #category : #'api - textual coder view model' } @@ -69,6 +69,5 @@ GtSourceCoderExpandedContentElement >> onTextualCoderViewModelChanged [ { #category : #initialization } GtSourceCoderExpandedContentElement >> showScrollbars [ - self - addAptitude: (BrGlamorousWithVerticalScrollbarAptitude new scrollableName: editorElement id) + editorElement showScrollbars ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index a7a421784..4b550d2dd 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -719,6 +719,12 @@ GtTextualCoderEditorElement >> reportUndeclaredError: aGtCoderParseError [ self addErrorAttribute: errorAttribute at: aGtCoderParseError location ] +{ #category : #private } +GtTextualCoderEditorElement >> showScrollbars [ + self + addAptitude: (BrGlamorousWithVerticalScrollbarAptitude new scrollableName: self id) +] + { #category : #private } GtTextualCoderEditorElement >> styleText [ self editor styleText diff --git a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st new file mode 100644 index 000000000..50f363e90 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st @@ -0,0 +1,821 @@ +Class { + #name : #GtTextualCoderElement, + #superclass : #BlElement, + #traits : 'TBlAssertUIProcess + TGtWithTextualCoderViewModel + TBrLayoutResizable', + #classTraits : 'TBlAssertUIProcess classTrait + TGtWithTextualCoderViewModel classTrait + TBrLayoutResizable classTrait', + #instVars : [ + 'completion', + 'evaluationHighlighter', + 'evaluationPrinter', + 'shortcuts', + 'cursorsUpdater', + 'textUpdater', + 'addOnsElementFuture', + 'editorElement' + ], + #category : #'GToolkit-Coder-UI-Coder - Textual' +} + +{ #category : #private } +GtTextualCoderElement >> addErrorAttribute: errorAttribute at: anInteger [ + | text position | + text := self editor text. + position := anInteger - 1 max: 0. + text size < position ifTrue: [ ^ self ]. + text clearAttributesOfClass: GtSourceCoderErrorAttribute. + text + attribute: errorAttribute + from: position + to: position. + self scrollToPosition: (text asString lineNumberCorrespondingToIndex: position) +] + +{ #category : #'hooks - children' } +GtTextualCoderElement >> attachSpace [ + super attachSpace. + + GtTextualCoderEditorElementAttachedSpaceSignal new + element: self; + emit +] + +{ #category : #'api - textual coder view model' } +GtTextualCoderElement >> coderViewModel: aTextualCoderViewModel [ + self textualCoderViewModel: aTextualCoderViewModel +] + +{ #category : #'private - updating' } +GtTextualCoderElement >> computeTextForUpdateForTextChangedEvent: aGtTextualCoderViewModelTextChanged [ + "In case the editor has a text edit command we determine + the updated text by editing the text currently in the + editor. If no edit command is present in the event, + we take the text from the event. We use the edit command + to avoid setting the text from the event which is not + styled, and can cause flickerings." + + ^ aGtTextualCoderViewModelTextChanged hasTextEditCommand + ifTrue: [ + | editCommand| + editCommand := aGtTextualCoderViewModelTextChanged textEditCommand. + self editedTextBasedOnEditCommand: editCommand. ] + ifFalse: [ + aGtTextualCoderViewModelTextChanged text copy ] +] + +{ #category : #'instance creation' } +GtTextualCoderElement >> createContextMenu [ + "wait for the addons to be computed" + + + | aMenu aMenuItemsPromise | + aMenu := BrMenuItems new. + aMenu beGroupedElementType. + + aMenuItemsPromise := self textualCoderViewModel addOns + asyncThen: [ :theAddOns | + | theItems theContextMenuAstAddons theMenuItems | + "extra context menu items that depend on ast and view model state such as selection" + theContextMenuAstAddons := self textualCoderViewModel + computeContextMenuAstAddOns. + theItems := theAddOns contextMenuActions, theContextMenuAstAddons contextMenuActions. + theItems := theItems reject: [ :e | e title isNil ]. + + theMenuItems := theItems + collect: [ :eachAction | eachAction asBrMenuItemForCoderElement: self ] + thenReject: #isNil. + + self enqueueTask: (BlTaskAction new + action: [ + aMenu items: theMenuItems ]) ]. + + self enqueueTask: (BlPromiseTask new promise: aMenuItemsPromise). + + ^ aMenu +] + +{ #category : #initialization } +GtTextualCoderElement >> defaultTextEditorMode [ + ^ BrTextEditorEditableCodeMode new +] + +{ #category : #TODO } +GtTextualCoderElement >> deselecter [ + ^ editorElement deselecter +] + +{ #category : #'hooks - children' } +GtTextualCoderElement >> detachSpace [ + super detachSpace. + + GtTextualCoderEditorElementDetachedSpaceSignal new + element: self; + emit +] + +{ #category : #'private - updating' } +GtTextualCoderElement >> editedTextBasedOnEditCommand: aTextEditCommand [ + | modifiedText| + "self haltOnce." + + modifiedText := self text copy. + aTextEditCommand applyTextChangeOn: modifiedText. + ^ modifiedText +] + +{ #category : #TODO } +GtTextualCoderElement >> editor [ + ^ editorElement editor +] + +{ #category : #'focus requesting' } +GtTextualCoderElement >> focusTarget [ + ^ editorElement +] + +{ #category : #private } +GtTextualCoderElement >> hideHighlighters [ + self text clearAttributes: [ :eachAttribute | + eachAttribute isKindOf: GtSourceCoderErrorAttribute ]. + evaluationHighlighter hideResultSynchronously. + evaluationPrinter hideResultSynchronously. +] + +{ #category : #initialization } +GtTextualCoderElement >> initialize [ + super initialize. + + editorElement := BrEditor new. + editorElement + id: GtSourceCoderEditorInnerId; + aptitude: BrGlamorousCodeEditorAptitude; + addAptitude: (BrGlamorousWithExplicitContextMenuAptitude menu: [ self createContextMenu ]); + padding: BlInsets empty. + + self addChild: editorElement. + + self + layout: BlLinearLayout vertical; + addAptitude: (BrLayoutResizerAptitude new inherit: editorElement); + hMatchParent; + vFitContentLimited. + + self id: GtSourceCoderEditorId. + + shortcuts := #(). + completion := GtCompletionController on: editorElement. + + evaluationHighlighter := GtSourceCoderEvaluationHighlighter new editorElement: self. + evaluationPrinter := GtSourceCoderEvaluationPrinter new editorElement: self. + + cursorsUpdater := BrElementUpdater new + element: self; + action: (MessageSend receiver: self selector: #privateUpdateCursors:announcement:). + + textUpdater := BrElementUpdater new + element: self; + action: (MessageSend receiver: self selector: #privateUpdateText:announcement:). + + addOnsElementFuture := (BrAsyncElementFuture on: self) + executionConfiguration: (GtSingleCoderViewModel methodAddOnsExecutionConfiguration); + whenSuccess: [ :anEditorElement :theAddOns | + self textualCoderViewModel onAddOnsChanged: theAddOns ]; + whenError: [ :anEditorElement :anError | + self onAddOnsError: anError ]. + + self initializeListeners. + + self withAsyncPromiseDo: [ :anElementPromise | + anElementPromise + whenSuccess: [ :anEditorElement :anEditorState | anEditorElement privateUpdateEditorState: anEditorState ]; + whenError: [ :anEditorElement :anEditorState | ]; + whenPending: [ :anEditorElement | ] ] +] + +{ #category : #initialization } +GtTextualCoderElement >> initializeListeners [ + self + when: BlFocusInEvent + do: [ :anEvent | self onFocusInEvent: anEvent ]. + + self + when: BlFocusOutEvent + do: [ :anEvent | self onFocusOutEvent: anEvent ]. + + self editor + when: BrTextEditorHistoryChangedEvent + do: [ :anEvent | self onTextEditorHistoryChanged: anEvent ]. + + self editor + when: BrTextEditorModifiedEvent + do: [ :anEvent | self onTextModifiedDueToEvent: anEvent ]. + + self editor + when: BrTextEditorCursorChangedEvent + do: [ :anEvent | self onTextEditorCursorChanged: anEvent ]. + + self editor + when: BrTextEditorSelectionChangedEvent + do: [ :anEvent | self onTextEditorSelectionChanged: anEvent ]. + + self editor + when: BrTextEditorTextStyledEvent + do: [ :anEvent | self onTextStyled: anEvent ] +] + +{ #category : #TODO } +GtTextualCoderElement >> inserter [ + ^ editorElement inserter +] + +{ #category : #TODO } +GtTextualCoderElement >> navigator [ + ^ editorElement navigator +] + +{ #category : #initialization } +GtTextualCoderElement >> onAddOnsError: anError [ + anError emit. + NonInteractiveTranscript stderr + show: '[GtTextualCoderEditorElement>>#onAddOnsError:] '; + show: anError; + newLine +] + +{ #category : #'hooks - children' } +GtTextualCoderElement >> onAddedToSceneGraph [ + super onAddedToSceneGraph. + + GtTextualCoderEditorElementAddedToSceneGraphSignal new + element: self; + emit +] + +{ #category : #'private - event handling' } +GtTextualCoderElement >> onCodeEvaluated: anEvaluationAnnouncement [ + (anEvaluationAnnouncement requesterObject + isCoderViewModel: self textualCoderViewModel) ifFalse: [ ^ self ]. + + BlTaskAction + enqueueElement: self + action: [ + evaluationHighlighter displayResult: anEvaluationAnnouncement evaluationResult. + evaluationPrinter hideResult ] +] + +{ #category : #'private - event handling' } +GtTextualCoderElement >> onCoderParseError: aGtCoderParseError [ + "A parse error can be notifying from a non-UI thread" + + (aGtCoderParseError requesterObject + isUndefinedOrCoderViewModel: self textualCoderViewModel) ifFalse: [ ^ self ]. + self + enqueueTask: [ aGtCoderParseError isUndeclaredError + ifTrue: [ self reportUndeclaredError: aGtCoderParseError ] + ifFalse: [ self + reportParseError: aGtCoderParseError errorMessage + at: aGtCoderParseError location ] ] asBlTask +] + +{ #category : #'private - event handling' } +GtTextualCoderElement >> onCoderViewModelFocused: aBoolean [ + aBoolean + ifTrue: [ self requestFocus ] + ifFalse: [ self loseFocus ] +] + +{ #category : #'private - event handling' } +GtTextualCoderElement >> onFocusChangedAnnouncement: anAnnouncement [ + anAnnouncement source == self ifTrue: [ ^ self ]. + + anAnnouncement source == self textualCoderViewModel ifFalse: [ ^ self ]. + + self + enqueueTask: (BlTaskAction new + action: [ self onCoderViewModelFocused: anAnnouncement focused ]) +] + +{ #category : #initialization } +GtTextualCoderElement >> onFocusInEvent: anEvent [ + self hasTextualCoderViewModel ifFalse: [ ^ self ]. + + self textualCoderViewModel focused: true from: self +] + +{ #category : #initialization } +GtTextualCoderElement >> onFocusOutEvent: anEvent [ + anEvent isDueToRemoval ifTrue: [ ^ self ]. + self hasTextualCoderViewModel ifFalse: [ ^ self ]. + + self textualCoderViewModel focused: false from: self +] + +{ #category : #'private - event handling' } +GtTextualCoderElement >> onObjectSpawnRequest: anAnnouncement [ + (anAnnouncement requesterObject isCoderViewModel: self textualCoderViewModel) + ifFalse: [ ^ self ]. + + self enqueueTask: (BlTaskAction new action: [ + self phlow + spawnObject: anAnnouncement object + withDestination: anAnnouncement spawnDestination ]) +] + +{ #category : #'api - textual coder view model' } +GtTextualCoderElement >> onPostTextualCoderViewModelChanged [ + "I am an optional hook method that is sent after #subscribeToTextualCoderViewModel. + I do nothing by default but allow users to perform update operations when a receiver object is already + subscribed to announcements." + + self textualCoderViewModel requestUpdateAddOns +] + +{ #category : #'private - event handling' } +GtTextualCoderElement >> onPrintRequest: anEvaluationAnnouncement [ + (anEvaluationAnnouncement requesterObject isCoderViewModel: self textualCoderViewModel) + ifFalse: [ ^ self ]. + + BlTaskAction enqueueElement: self action: [ + evaluationHighlighter hideResult. + evaluationPrinter displayResult: anEvaluationAnnouncement evaluationResult ]. +] + +{ #category : #'hooks - children' } +GtTextualCoderElement >> onRemovedFromSceneGraph [ + super onRemovedFromSceneGraph. + + GtTextualCoderEditorElementRemovedFromSceneGraphSignal new + element: self; + emit +] + +{ #category : #'private - event handling' } +GtTextualCoderElement >> onScrollToCharacterPositionAnnouncement: anAnnouncement [ + self assertUIProcess. + BrEditorSearchTextScroller new + editorElement: self; + lineIndex: anAnnouncement lineIndex; + characterStartPosition: anAnnouncement characterPosition; + characterStopPosition: anAnnouncement characterPosition; + scroll +] + +{ #category : #'private - event handling' } +GtTextualCoderElement >> onSearchTextGetTextAndVisibleTextAnnouncement: anAnnouncement [ + self assertUIProcess. + anAnnouncement consumed ifTrue: [ ^ self ]. + anAnnouncement consumed: true. + + anAnnouncement text: self text. + anAnnouncement visibleText: self visibleText +] + +{ #category : #'private - event handling' } +GtTextualCoderElement >> onSearchTextUpdateTextAnnouncement: anAnnouncement [ + | aResult | + self assertUIProcess. + anAnnouncement consumed ifTrue: [ ^ self ]. + anAnnouncement consumed: true. + + aResult := BrEditorSearchTextUpdater new + editorModel: self editor; + styledText: anAnnouncement styledText; + update. + + anAnnouncement isUpdated: aResult +] + +{ #category : #'private - event handling' } +GtTextualCoderElement >> onStyleTextRequest: anEvent [ + "onStyleTextRequest: may be sent from a non-UI thread" + + self enqueueTask: (BlTaskAction new action: [ self styleTextAndAfterDo: anEvent afterAction ]) +] + +{ #category : #initialization } +GtTextualCoderElement >> onTextEditorCursorChanged: anEvent [ + self hasTextualCoderViewModel ifFalse: [ ^ self ]. + + self textualCoderViewModel cursors: anEvent cursors from: self +] + +{ #category : #initialization } +GtTextualCoderElement >> onTextEditorHistoryChanged: anEvent [ + self hasTextualCoderViewModel ifFalse: [ ^ self ]. + + self textualCoderViewModel history: self editor history copy +] + +{ #category : #initialization } +GtTextualCoderElement >> onTextEditorSelectionChanged: anEvent [ + self hasTextualCoderViewModel ifFalse: [ ^ self ]. + + self textualCoderViewModel selection: anEvent selection from: self +] + +{ #category : #'private - event handling' } +GtTextualCoderElement >> onTextModified [ + "Is sent when the text changes in the editor. Here we should synchronise the UI and the model." + + self textualCoderViewModel + sourceText: self text + from: self + synchronously: true +] + +{ #category : #'private - event handling' } +GtTextualCoderElement >> onTextModifiedDueToEvent: aTextModifiedEvent [ + "Is sent when the text changes in the editor. Here we should synchronise the UI and the model. We also receive the event, which can contain the type of change." + self hasTextualCoderViewModel ifFalse: [ ^ self ]. + + self textualCoderViewModel + sourceText: self text + from: self + synchronously: true + dueToEvent: aTextModifiedEvent +] + +{ #category : #'private - event handling' } +GtTextualCoderElement >> onTextStyled: anEvent [ + "An underlying editor styled the text" + self hasTextualCoderViewModel ifFalse: [ ^ self ]. + + self textualCoderViewModel styledText: anEvent styledText +] + +{ #category : #'api - textual coder view model' } +GtTextualCoderElement >> onTextualCoderViewModelChanged [ + "Is sent when a new textualCoder view model is assigned to the element. + Note: #onTextualCoderViewModelChanged is sent before #subscribeToTextualCoderViewModel + which means that if you perform any operation that triggers an announcement it will be ignored because the receiver + didn't get a chance to subscribe to any announcement. Override #onPostTextualCoderViewModelChanged if you + wish to perform an operation that requires an announcement, but keep in mind that this is not the most efficient way" + + self onCoderViewModelFocused: self textualCoderViewModel focused. + + "Setting text may change cursor and selection because text editor makes sure + that they have valid values. That is why we create a snaphot of the editor's state + which we will restore once new text is set" + + "Related to: https://github.com/feenkcom/gtoolkit/issues/3727" + self privateUpdateEditorState: self textualCoderViewModel asEditorState. + + self editor model: self textualCoderViewModel. + + shortcuts := self textualCoderViewModel shortcuts copy. + self editor addEditorShortcuts: shortcuts. + + completion strategy: self textualCoderViewModel completionStrategy. + + self textualCoderViewModel compositeStyler ifNotNil: [ :aStyler | + self styler: aStyler ] +] + +{ #category : #'private - event handling' } +GtTextualCoderElement >> onToolSpawnRequest: anAnnouncement [ + self enqueueTask: (BlTaskAction new action: [ + anAnnouncement requesterObject = self textualCoderViewModel ifTrue: [ + self phlow + spawnTool: anAnnouncement tool + withDestination: anAnnouncement spawnDestination ] ]) +] + +{ #category : #'private - event handling' } +GtTextualCoderElement >> onViewModelCursorsChanged: aCursorsChangedAnnouncement [ + "Is sent when the cursors changes in the View Model. + May be sent from a non-UI thread" + + "if the source of the announcement is myself, do nothing to break the change cycle" + aCursorsChangedAnnouncement source = self + ifTrue: [ ^ self ]. + + "do nothing if it comes from a different view model" + aCursorsChangedAnnouncement textualCoderViewModel == self textualCoderViewModel + ifFalse: [ ^ self ]. + + "since it may be sent from a non-UI process make sure to wrap in the action" + cursorsUpdater requestUpdate: aCursorsChangedAnnouncement +] + +{ #category : #'private - event handling' } +GtTextualCoderElement >> onViewModelReadyToStyle [ + self enqueueTask: (BlTaskAction new action: [ self styleText ]) +] + +{ #category : #registration } +GtTextualCoderElement >> onViewModelRecomputeAddOns: aRecomputeAddOnRequest [ + aRecomputeAddOnRequest coderViewModel == self textualCoderViewModel + ifFalse: [ ^ self ]. + + BlTaskAction + enqueueElement: self + action: [ addOnsElementFuture future: self textualCoderViewModel addOnsFuture ] +] + +{ #category : #'private - event handling' } +GtTextualCoderElement >> onViewModelSelectionChanged: aSelectionChangedAnnouncement [ + "Is sent when the selection changes in the View Model. + May be sent from a non-UI thread" + + "if the source of the announcement is myself, do nothing to break the change cycle" + + aSelectionChangedAnnouncement source = self ifTrue: [ ^ self ]. + + aSelectionChangedAnnouncement source == self textualCoderViewModel + ifFalse: [ ^ self ]. + + BlTaskAction + enqueueElement: self + action: [ self deselecter all deselect. + self selecter + in: [ :aSelecter | + aSelectionChangedAnnouncement shouldUpdateCursor + ifFalse: [ aSelecter withoutCursorUpdate ] ]; + all: aSelectionChangedAnnouncement selection; + select ] +] + +{ #category : #'private - event handling' } +GtTextualCoderElement >> onViewModelShortcutsChanged [ + "Is sent when the shortcuts change in the View Model. + May be sent from a non-UI thread" + + "since it may be sent from a non-UI process make sure to wrap in the action" + self enqueueTask: (BlTaskAction new action: [ + self editor removeEditorShortcuts: shortcuts. + shortcuts := self textualCoderViewModel shortcuts copy. + self editor addEditorShortcuts: shortcuts ]) +] + +{ #category : #'private - event handling' } +GtTextualCoderElement >> onViewModelStyledTextChanged: anAnnouncement [ +] + +{ #category : #'private - event handling' } +GtTextualCoderElement >> onViewModelStylersChanged [ + self enqueueTask: (BlTaskAction new + action: [ self styler: self textualCoderViewModel compositeStyler ]) +] + +{ #category : #'private - event handling' } +GtTextualCoderElement >> onViewModelTextAttributesAdded: anAnnouncement [ + self enqueueTask: (BlTaskAction new action: [ + anAnnouncement text characters = self text characters + ifTrue: [ + anAnnouncement coderTextAttributes + applyOnEditorText: self text + from: anAnnouncement startPosition + to: anAnnouncement stopPosition ] ]) +] + +{ #category : #'private - event handling' } +GtTextualCoderElement >> onViewModelTextAttributesRemoved: anAnnouncement [ + self enqueueTask: (BlTaskAction new action: [ + anAnnouncement coderTextAttributes removeFromEditorText: self text ]) +] + +{ #category : #'private - event handling' } +GtTextualCoderElement >> onViewModelTextChanged: aGtTextualCoderViewModelTextChanged [ + "Text changed in a view model and should be synchronised on the UI side. + There can be multiple sources of the text change: + - an editor element itself + - other sources that changed text through coder model api. + + When the source is a text editor element (`self`) we don't reset the text in the editor. + If an announcement comes from a different view model, we skip it." + + + "Do nothing if it comes from a different view model" + aGtTextualCoderViewModelTextChanged textualCoderViewModel == self textualCoderViewModel + ifFalse: [ ^ self ]. + + BlTaskAction + enqueueElement: self + action: [ self processViewModelTextChanged: aGtTextualCoderViewModelTextChanged ]. +] + +{ #category : #'private - event handling' } +GtTextualCoderElement >> onViewModelTextEditCommandRequest: aGtTextualCoderViewModelTextEditCommandRequest [ + "This is sent by the view model on requests to change the text + in the editor by executing a command." + + BlTaskAction + enqueueElement: self + action: [ + aGtTextualCoderViewModelTextEditCommandRequest textEditCommand + applyOn: self editor ] +] + +{ #category : #'private - updating' } +GtTextualCoderElement >> privateUpdateCursors: anEditorElement announcement: aCursorsChangedAnnouncement [ + + "do nothing if it comes from a different view model" + aCursorsChangedAnnouncement source == self textualCoderViewModel + ifFalse: [ ^ self ]. + + GtTextualCoderEditorElementUpdateCursorsSignal new + element: self; + emit. + + self navigator + withoutResettingDesiredCoordinate; + removeAll; + addAll: aCursorsChangedAnnouncement cursors; + apply +] + +{ #category : #'private - updating' } +GtTextualCoderElement >> privateUpdateEditorState: anEditorState [ + GtTextualCoderEditorElementUpdateStateSignal new + element: self; + emit. + + self editor restoreState: anEditorState +] + +{ #category : #'private - updating' } +GtTextualCoderElement >> privateUpdateText: anEditorElement announcement: aGtTextualCoderViewModelTextChanged [ + | textForUpdate | + "Executed in a UI thread as a result of text being changed in the view model" + + "do nothing if it comes from a different view model" + aGtTextualCoderViewModelTextChanged textualCoderViewModel == self textualCoderViewModel + ifFalse: [ ^ self ]. + + GtTextualCoderEditorElementUpdateTextSignal new + element: self; + emit. + + "Determine the text that we should use to update the editor." + textForUpdate := self computeTextForUpdateForTextChangedEvent: aGtTextualCoderViewModelTextChanged. + + self text: textForUpdate. + self hideHighlighters. +] + +{ #category : #'private - event handling' } +GtTextualCoderElement >> processViewModelTextChanged: aGtTextualCoderViewModelTextChanged [ + aGtTextualCoderViewModelTextChanged source == self + ifTrue: [ ^ self hideHighlighters ]. + + aGtTextualCoderViewModelTextChanged isSynchronous + ifTrue: [ self privateUpdateText: self announcement: aGtTextualCoderViewModelTextChanged ] + ifFalse: [ textUpdater requestUpdate: aGtTextualCoderViewModelTextChanged ] +] + +{ #category : #registration } +GtTextualCoderElement >> registerCoderModelAnnouncementsFor: aCoderModel [ + aCoderModel announcer weak + when: GtCoderStyleTextRequest send: #onStyleTextRequest: to: self; + when: GtCoderParseError send: #onCoderParseError: to: self; + when: GtCoderObjectSpawnRequest + send: #onObjectSpawnRequest: + to: self; + when: GtCoderToolSpawnRequest send: #onToolSpawnRequest: to: self; + when: GtCoderEvaluationAnnouncement + send: #onCodeEvaluated: + to: self; + when: GtCoderPrintAnnouncement send: #onPrintRequest: to: self +] + +{ #category : #registration } +GtTextualCoderElement >> registerCoderViewModelAnnouncementsFor: aGtSourceCoderUIModel [ + aGtSourceCoderUIModel weak + when: GtCoderViewModelRecomputeAddOnRequest + send: #onViewModelRecomputeAddOns: + to: self; + when: GtTextualCoderViewModelFocusChanged + send: #onFocusChangedAnnouncement: + to: self; + when: GtTextualCoderViewModelTextChanged + send: #onViewModelTextChanged: + to: self; + when: GtTextualCoderViewModelTextEditCommandRequestAnnouncement + send: #onViewModelTextEditCommandRequest: + to: self; + when: GtTextualCoderViewModelCursorsChanged + send: #onViewModelCursorsChanged: + to: self; + when: GtTextualCoderViewModelSelectionChanged + send: #onViewModelSelectionChanged: + to: self; + when: GtTextualCoderViewModelStylersChanged + send: #onViewModelStylersChanged + to: self; + when: GtTextualCoderViewModelShortcutsChanged + send: #onViewModelShortcutsChanged + to: self; + when: GtTextualCoderViewModelReadyToRestyle + send: #onViewModelReadyToStyle + to: self; + when: GtTextualCoderViewModelTextAttributesAdded + send: #onViewModelTextAttributesAdded: + to: self; + when: GtTextualCoderViewModelTextAttributesRemoved + send: #onViewModelTextAttributesRemoved: + to: self; + when: GtTextualCoderViewModelStyledTextChanged + send: #onViewModelStyledTextChanged: + to: self; + when: GtTextualCoderViewModelScrollToCharacterPositionAnnouncement + send: #onScrollToCharacterPositionAnnouncement: + to: self; + when: GtTextualCoderViewModelSearchTextGetTextAndVisibleTextAnnouncement + send: #onSearchTextGetTextAndVisibleTextAnnouncement: + to: self; + when: GtTextualCoderViewModelSearchTextUpdateTextAnnouncement + send: #onSearchTextUpdateTextAnnouncement: + to: self +] + +{ #category : #private } +GtTextualCoderElement >> reportParseError: aString at: anInteger [ + | error | + error := (aString endsWith: '->') + ifTrue: [ aString allButLast: 2 ] + ifFalse: [ aString ]. + self addErrorAttribute: (GtSourceCoderErrorAttribute for: error) at: anInteger +] + +{ #category : #'private - event handling' } +GtTextualCoderElement >> reportUndeclaredError: aGtCoderParseError [ + | rbNode interval gtNode ast errorAttribute | + rbNode := aGtCoderParseError node. + interval := rbNode sourceInterval. + ast := GtPharoParser + parse: rbNode methodNode source + startingAt: (rbNode methodNode isDoIt + ifTrue: [ GtPharoParser startingStateForDoItMethod ] + ifFalse: [ GtPharoParser startingStateForMethod ]). + gtNode := ast nodeForInterval: interval. + errorAttribute := GtUndeclaredVariableAdvice new + errorAttribute: gtNode + coderModel: aGtCoderParseError coder. + self addErrorAttribute: errorAttribute at: aGtCoderParseError location +] + +{ #category : #private } +GtTextualCoderElement >> scrollToPosition: anObject [ + editorElement scrollToPosition: anObject +] + +{ #category : #TODO } +GtTextualCoderElement >> selecter [ + ^ editorElement selecter +] + +{ #category : #private } +GtTextualCoderElement >> showScrollbars [ + self + addAptitude: (BrGlamorousWithVerticalScrollbarAptitude new scrollableName: editorElement id) +] + +{ #category : #private } +GtTextualCoderElement >> styleText [ + self editor styleText +] + +{ #category : #private } +GtTextualCoderElement >> styleTextAndAfterDo: aBlock [ + self editor styleTextAndAfterDo: aBlock +] + +{ #category : #TODO } +GtTextualCoderElement >> styler: anObject [ + editorElement styler: anObject +] + +{ #category : #'api - textual coder view model' } +GtTextualCoderElement >> subscribeToTextualCoderViewModel [ + "Is sent after a new textualCoder view model is assigned to the element. + It is required to unsubscribe from the view model or domain model by implementing + #unsubscribeFromTextualCoderViewModel if elements subscribe to them" + + self registerCoderModelAnnouncementsFor: self textualCoderViewModel coderModel. + self registerCoderViewModelAnnouncementsFor: self textualCoderViewModel. + + completion install +] + +{ #category : #TODO } +GtTextualCoderElement >> text [ + ^ editorElement text +] + +{ #category : #TODO } +GtTextualCoderElement >> text: aBlText [ + (self text equalsIgnoringAttributes: aBlText) + ifTrue: [ self editor history disableDuring: [ editorElement text: aBlText ] ]. + editorElement text: aBlText +] + +{ #category : #'api - textual coder view model' } +GtTextualCoderElement >> unsubscribeFromTextualCoderViewModel [ + "Is sent before a new textualCoder view model is assigned to the element. + Elements that subscribe to textualCoder view model in domain model are required to implement this methods." + + self textualCoderViewModel unsubscribe: self. + self textualCoderViewModel coderModel unsubscribe: self. + + completion uninstall. + self editor removeEditorShortcuts: shortcuts +] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 76b7f9aca..9c0e6eab3 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -349,7 +349,7 @@ GtTextualCoderViewModel >> cursors: aBrTextEditorCursor from: aSourceObject [ { #category : #accessing } GtTextualCoderViewModel >> elementClass [ - ^ GtTextualCoderEditorElement + ^ GtTextualCoderElement ] { #category : #accessing } From 80fdae90d75ee4436d723426396d617acf581fef Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 12 Jan 2026 08:44:18 +0100 Subject: [PATCH 1182/1268] [feenkcom/gtoolkit#4919] add GtTextualCoderElement>>#editorElement --- src/GToolkit-Coder-UI/GtTextualCoderElement.class.st | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st index 50f363e90..ed8915b2f 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st @@ -127,6 +127,11 @@ GtTextualCoderElement >> editor [ ^ editorElement editor ] +{ #category : #TODO } +GtTextualCoderElement >> editorElement [ + ^ editorElement +] + { #category : #'focus requesting' } GtTextualCoderElement >> focusTarget [ ^ editorElement From 3d483956362ffd37a0bf724fc5b92ef3df7d86a5 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 12 Jan 2026 13:54:19 +0100 Subject: [PATCH 1183/1268] update itemMenuStencil to find textualCoderViewModel from a parent element --- .../GtCoderContextMenuContent.class.st | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st index e6591dfb5..70d33f2b9 100644 --- a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st +++ b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st @@ -52,7 +52,7 @@ GtCoderContextMenuContent >> menuItemStencil [ do: [ :anEvent | anEvent consumed: true. eachGtCoderContextMenuAction action - cull: self editorElement textualCoderViewModel + cull: self textualCoderViewModel cull: self editorElement cull: anEvent. self fireEvent: BrDropdownHideWish new. @@ -80,13 +80,13 @@ GtCoderContextMenuContent >> menuItemStencil [ element when: BlMouseEnterEvent do: [ :anEvent | - hover cull: self editorElement textualCoderViewModel cull: anEvent ] ]. + hover cull: self textualCoderViewModel cull: anEvent ] ]. eachGtCoderContextMenuAction leaveAction ifNotNil: [ :leave | element when: BlMouseLeaveEvent do: [ :anEvent | - leave cull: self editorElement textualCoderViewModel cull: anEvent ] ]. + leave cull: self textualCoderViewModel cull: anEvent ] ]. eachGtCoderContextMenuAction name ifNotNil: [ :anActionName | element containerName: anActionName ]. @@ -99,3 +99,11 @@ GtCoderContextMenuContent >> menuItemStencil [ element ] ] + +{ #category : #'api - accessing' } +GtCoderContextMenuContent >> textualCoderViewModel [ + "We add a context menu to the CoderElement, not to the editor element" + self flag: #TODO. + + ^ editorElement parent textualCoderViewModel +] From b400140ac52bf6298fd9decdd80ea66110782654 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Tue, 13 Jan 2026 13:34:00 +0100 Subject: [PATCH 1184/1268] add a comment to methods that should be removed from the textual coder element --- .../GtTextualCoderElement.class.st | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st index ed8915b2f..894d2b78d 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st @@ -100,6 +100,9 @@ GtTextualCoderElement >> defaultTextEditorMode [ { #category : #TODO } GtTextualCoderElement >> deselecter [ + "This method should be deprecated and removed, instead add higher-level api methods" + self flag: #TODO. + ^ editorElement deselecter ] @@ -124,6 +127,9 @@ GtTextualCoderElement >> editedTextBasedOnEditCommand: aTextEditCommand [ { #category : #TODO } GtTextualCoderElement >> editor [ + "This method should be deprecated and removed, instead add fine grained api methods" + self flag: #TODO. + ^ editorElement editor ] @@ -228,12 +234,18 @@ GtTextualCoderElement >> initializeListeners [ ] { #category : #TODO } -GtTextualCoderElement >> inserter [ +GtTextualCoderElement >> inserter [ + "This method should be deprecated and removed, instead add fine grained api methods" + self flag: #TODO. + ^ editorElement inserter ] { #category : #TODO } GtTextualCoderElement >> navigator [ + "This method should be deprecated and removed, instead add fine grained api methods" + self flag: #TODO. + ^ editorElement navigator ] @@ -765,6 +777,9 @@ GtTextualCoderElement >> scrollToPosition: anObject [ { #category : #TODO } GtTextualCoderElement >> selecter [ + "This method should be deprecated and removed, instead add higher-level api methods" + self flag: #TODO. + ^ editorElement selecter ] From ac07a5f6fb28f347e52d73ce1a21cd7df3133ef0 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Wed, 14 Jan 2026 12:14:15 +0100 Subject: [PATCH 1185/1268] fixing more examples after editor refactoring --- .../GtFixItAction.class.st | 2 ++ .../GtFixItAttribute.class.st | 2 +- .../GtTextualCoderElement.class.st | 22 ++++++++++++++++--- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtFixItAction.class.st b/src/GToolkit-Coder-AddOns/GtFixItAction.class.st index 88de2ccff..3dc96b4c0 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItAction.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItAction.class.st @@ -74,6 +74,8 @@ GtFixItAction >> menuActionWithIndex: anIndex [ ^ GtCoderContextMenuAction new action: [ :aCoderViewModel :anEditorElement | aCoderViewModel selectNone. + "Pass coder view model alongside of the editor element" + self flag: #TODO. self executeOn: anEditorElement ]; title: self description; id: (self id indexed: anIndex) diff --git a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st index 641db90c9..02df3acae 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st @@ -128,7 +128,7 @@ GtFixItAttribute >> dropDownElementFor: anEditorElement [ aShortcutEvent consumed: true. menuElement selectedItemDo: [ :eachGtCoderContextMenuAction | eachGtCoderContextMenuAction action - cull: anEditorElement textualCoderViewModel + cull: anEditorElement parent textualCoderViewModel cull: anEditorElement cull: aShortcutEvent. menuElement fireEvent: BrDropdownHideWish new. diff --git a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st index 894d2b78d..e34bc3468 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st @@ -98,6 +98,14 @@ GtTextualCoderElement >> defaultTextEditorMode [ ^ BrTextEditorEditableCodeMode new ] +{ #category : #TODO } +GtTextualCoderElement >> deleter [ + "This method should be deprecated and removed, instead add higher-level api methods" + self flag: #TODO. + + ^ editorElement deleter +] + { #category : #TODO } GtTextualCoderElement >> deselecter [ "This method should be deprecated and removed, instead add higher-level api methods" @@ -127,7 +135,7 @@ GtTextualCoderElement >> editedTextBasedOnEditCommand: aTextEditCommand [ { #category : #TODO } GtTextualCoderElement >> editor [ - "This method should be deprecated and removed, instead add fine grained api methods" + "This method should be deprecated and removed, instead add higher-level api methods" self flag: #TODO. ^ editorElement editor @@ -235,7 +243,7 @@ GtTextualCoderElement >> initializeListeners [ { #category : #TODO } GtTextualCoderElement >> inserter [ - "This method should be deprecated and removed, instead add fine grained api methods" + "This method should be deprecated and removed, instead add higher-level api methods" self flag: #TODO. ^ editorElement inserter @@ -243,7 +251,7 @@ GtTextualCoderElement >> inserter [ { #category : #TODO } GtTextualCoderElement >> navigator [ - "This method should be deprecated and removed, instead add fine grained api methods" + "This method should be deprecated and removed, instead add higher-level api methods" self flag: #TODO. ^ editorElement navigator @@ -783,6 +791,14 @@ GtTextualCoderElement >> selecter [ ^ editorElement selecter ] +{ #category : #TODO } +GtTextualCoderElement >> selection [ + "This method should be deprecated and removed, instead add higher-level api methods" + self flag: #TODO. + + ^ editorElement selection +] + { #category : #private } GtTextualCoderElement >> showScrollbars [ self From 4404bf7faf353502f55fb97dd8ef42d02edec96b Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Wed, 14 Jan 2026 14:52:15 +0100 Subject: [PATCH 1186/1268] fix text editor mode handling --- .../GtTextualCoderElement.class.st | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st index e34bc3468..2f4776727 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st @@ -93,11 +93,6 @@ GtTextualCoderElement >> createContextMenu [ ^ aMenu ] -{ #category : #initialization } -GtTextualCoderElement >> defaultTextEditorMode [ - ^ BrTextEditorEditableCodeMode new -] - { #category : #TODO } GtTextualCoderElement >> deleter [ "This method should be deprecated and removed, instead add higher-level api methods" @@ -165,6 +160,7 @@ GtTextualCoderElement >> initialize [ editorElement := BrEditor new. editorElement + beMode: BrTextEditorEditableCodeMode new; id: GtSourceCoderEditorInnerId; aptitude: BrGlamorousCodeEditorAptitude; addAptitude: (BrGlamorousWithExplicitContextMenuAptitude menu: [ self createContextMenu ]); @@ -475,6 +471,12 @@ GtTextualCoderElement >> onTextualCoderViewModelChanged [ didn't get a chance to subscribe to any announcement. Override #onPostTextualCoderViewModelChanged if you wish to perform an operation that requires an announcement, but keep in mind that this is not the most efficient way" + | coderModel | + coderModel := self textualCoderViewModel coderModel. + (coderModel isForMethod and: [ coderModel compiledMethod isNotNil ]) ifTrue: + [ coderModel compiledMethod isBigMethod ifTrue: + [ editorElement beReadOnlyWithSelection ] ]. + self onCoderViewModelFocused: self textualCoderViewModel focused. "Setting text may change cursor and selection because text editor makes sure @@ -825,7 +827,7 @@ GtTextualCoderElement >> subscribeToTextualCoderViewModel [ "Is sent after a new textualCoder view model is assigned to the element. It is required to unsubscribe from the view model or domain model by implementing #unsubscribeFromTextualCoderViewModel if elements subscribe to them" - + self registerCoderModelAnnouncementsFor: self textualCoderViewModel coderModel. self registerCoderViewModelAnnouncementsFor: self textualCoderViewModel. From 678a5269ea39d5267a6cd8b1051d3051a433672b Mon Sep 17 00:00:00 2001 From: John Brant Date: Thu, 15 Jan 2026 12:19:40 -0600 Subject: [PATCH 1187/1268] adding menu to collapsed method coders & big method coders --- .../GtExpandableCoderViewModel.class.st | 30 +++++++++++++++++++ ...ourceCoderCollapsedContentElement.class.st | 17 +++++++---- .../GtSourceCoderContentElement.class.st | 24 +++++++++++++++ src/GToolkit-Coder/GtSourceCoder.class.st | 5 ++++ 4 files changed, 70 insertions(+), 6 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtExpandableCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtExpandableCoderViewModel.class.st index 933a524b3..e1fb72a52 100644 --- a/src/GToolkit-Coder-UI/GtExpandableCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtExpandableCoderViewModel.class.st @@ -31,6 +31,36 @@ GtExpandableCoderViewModel >> collapsedTextPromise [ ^ coderModel collapsedTextPromise ] +{ #category : #'private - addons' } +GtExpandableCoderViewModel >> computeHeaderContextMenuAstAddOns [ + + | aCoderModel newAddOns pragmas | + aCoderModel := self coderModel. + pragmas := aCoderModel + pragmasNamed: aCoderModel class contextHeaderMenuAddOnsPragma + inHierarchy: aCoderModel class. + newAddOns := aCoderModel newAddOns. + pragmas + do: [ :eachPragma | + [ aCoderModel + perform: eachPragma methodSelector + withEnoughArguments: {aCoderModel selector. + newAddOns. + self} ] + on: Error + do: [ :anError | + "emit as a beacon signal" + anError emit. + NonInteractiveTranscript stderr + nextPut: $[; + print: eachPragma method printString; + nextPut: $]; + space; + print: anError; + cr ] ]. + ^ newAddOns +] + { #category : #'api - expansion' } GtExpandableCoderViewModel >> expand [ self expanded: true diff --git a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st index cff3484f9..cd681f60c 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderCollapsedContentElement.class.st @@ -13,20 +13,25 @@ Class { { #category : #initialization } GtSourceCoderCollapsedContentElement >> initialize [ super initialize. - + content := BlElement new - layout: BlLinearLayout horizontal; - constraintsDo: [ :c | - c horizontal matchParent. - c vertical fitContent ]. + layout: BlLinearLayout horizontal; + constraintsDo: [ :c | + c horizontal matchParent. + c vertical fitContent ]. label := self newLabel. addOns := self newAddOnsContainer. previews := Dictionary new. - content addChildren: { label. addOns }. + content + addChildren: {label. + addOns}. self addChild: content. + self + addAptitude: (BrGlamorousWithExplicitContextMenuAptitude + menu: [ self createHeaderContextMenu ]) ] { #category : #'instance creation' } diff --git a/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st index 7919714a4..698d74fc0 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderContentElement.class.st @@ -43,6 +43,30 @@ GtSourceCoderContentElement >> coderViewModel: aGtSourceCoderViewModel [ during: [ self textualCoderViewModel: aGtSourceCoderViewModel ] ] +{ #category : #updating } +GtSourceCoderContentElement >> createHeaderContextMenu [ + "wait for the addons to be computed" + + | aMenu aMenuItemsPromise | + aMenu := BrMenuItems new. + aMenu beGroupedElementType. + aMenuItemsPromise := self textualCoderViewModel addOns asyncThen: + [:theAddOns | + "extra context menu items that depend on ast and view model state such as selection" + | theItems theContextMenuAstAddons theMenuItems | + theContextMenuAstAddons := self textualCoderViewModel + computeHeaderContextMenuAstAddOns. + theItems := theAddOns contextMenuActions + , theContextMenuAstAddons contextMenuActions. + theItems := theItems reject: [:e | e title isNil]. + theMenuItems := theItems + collect: [:eachAction | eachAction asBrMenuItemForCoderElement: self] + thenReject: #isNil. + self enqueueTask: (BlTaskAction new action: [aMenu items: theMenuItems])]. + self enqueueTask: (BlPromiseTask new promise: aMenuItemsPromise). + ^aMenu +] + { #category : #initialization } GtSourceCoderContentElement >> defaultLayout [ ^ BlLinearLayout vertical diff --git a/src/GToolkit-Coder/GtSourceCoder.class.st b/src/GToolkit-Coder/GtSourceCoder.class.st index 7e9ee9a90..817b7ce57 100644 --- a/src/GToolkit-Coder/GtSourceCoder.class.st +++ b/src/GToolkit-Coder/GtSourceCoder.class.st @@ -17,6 +17,11 @@ Class { #category : #'GToolkit-Coder-Coders' } +{ #category : #addons } +GtSourceCoder class >> contextHeaderMenuAddOnsPragma [ + ^#gtCoderHeaderContextMenuAddOns +] + { #category : #'api - actions' } GtSourceCoder >> debug [ self debugInContext: self evaluationContext From e210e217e15757ba8a5e8ba2c796c324b0b484a4 Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Sun, 18 Jan 2026 13:25:12 +0100 Subject: [PATCH 1188/1268] make filter examples more explicit feenkcom/gtoolkit#4872 --- src/GToolkit-Coder-Examples/GtUnionFilterExamples.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-Examples/GtUnionFilterExamples.class.st b/src/GToolkit-Coder-Examples/GtUnionFilterExamples.class.st index d995820f3..f91028f0d 100644 --- a/src/GToolkit-Coder-Examples/GtUnionFilterExamples.class.st +++ b/src/GToolkit-Coder-Examples/GtUnionFilterExamples.class.st @@ -9,11 +9,11 @@ GtUnionFilterExamples >> unionDifferentMethods [ | filter1 filter2 union | - filter1 := thisContext method selector gtImplementors. + filter1 := #unionDifferentMethods gtImplementors. filter2 := #foo gtImplementors. union := filter1 | filter2. self assert: union size = (filter1 size + filter2 size). - self assert: (union matches: thisContext method). + self assert: (union matches: GtUnionFilterExamples>>#unionDifferentMethods). ^ union ] From ebc651df98b8cc73616316e0c8874d3ed70e6dc8 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Mon, 19 Jan 2026 11:01:47 +0100 Subject: [PATCH 1189/1268] add visibleText to textual coder element --- src/GToolkit-Coder-UI/GtTextualCoderElement.class.st | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st index 2f4776727..fc6ad7f19 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st @@ -857,3 +857,8 @@ GtTextualCoderElement >> unsubscribeFromTextualCoderViewModel [ completion uninstall. self editor removeEditorShortcuts: shortcuts ] + +{ #category : #TODO } +GtTextualCoderElement >> visibleText [ + ^ editorElement visibleText +] From a44a8cd1152a2a64096566bb078ab12c6d97cb0b Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 20 Jan 2026 16:46:23 -0300 Subject: [PATCH 1190/1268] fix search text scroller initialization [feenkcom/gtoolkit#4922] --- src/GToolkit-Coder-UI/GtTextualCoderElement.class.st | 2 +- .../GtTextualCoderSearchTextElement.class.st | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st index fc6ad7f19..b1fba82cd 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st @@ -373,7 +373,7 @@ GtTextualCoderElement >> onRemovedFromSceneGraph [ GtTextualCoderElement >> onScrollToCharacterPositionAnnouncement: anAnnouncement [ self assertUIProcess. BrEditorSearchTextScroller new - editorElement: self; + editorElement: editorElement; lineIndex: anAnnouncement lineIndex; characterStartPosition: anAnnouncement characterPosition; characterStopPosition: anAnnouncement characterPosition; diff --git a/src/GToolkit-Coder-UI/GtTextualCoderSearchTextElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderSearchTextElement.class.st index 5faace190..a738b2bbc 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderSearchTextElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderSearchTextElement.class.st @@ -49,6 +49,14 @@ GtTextualCoderSearchTextElement >> initializeMarker [ to: self ] +{ #category : #accessing } +GtTextualCoderSearchTextElement >> markerContext [ + "For testing purposes only" + + + ^ context +] + { #category : #private } GtTextualCoderSearchTextElement >> newMarkerContext [ self hasTextualCoderViewModel ifFalse: [ ^ nil ]. From 30dba02f094bda0ee80ec53262331d96d6d10d44 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 20 Jan 2026 16:48:36 -0300 Subject: [PATCH 1191/1268] coder can be displayed using `vFitContentLimited` [feenkcom/gtoolkit#4872] --- src/GToolkit-Coder-UI/GtCoderContentElement.class.st | 10 ++++++++-- src/GToolkit-Coder-UI/GtCoderElement.class.st | 7 ++++++- .../GtCoderPlaygroundElement.class.st | 6 +++++- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderContentElement.class.st b/src/GToolkit-Coder-UI/GtCoderContentElement.class.st index 90f3fcddc..ee548de18 100644 --- a/src/GToolkit-Coder-UI/GtCoderContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderContentElement.class.st @@ -21,7 +21,11 @@ GtCoderContentElement class >> default [ { #category : #initialization } GtCoderContentElement >> initialize [ super initialize. - self layout: BlFrameLayout new + self layout: BlFrameLayout new. + + self + addAptitude: (BrLayoutResizerAptitude new + common: [ self children ]) ] { #category : #'hooks - children' } @@ -47,5 +51,7 @@ GtCoderContentElement >> subscribeToNavigationModel [ GtCoderContentElement >> updateCoder: anAnnouncement [ self removeChildren. self - addChild: (anAnnouncement coder asElement navigationModelForToolbar: self navigationModel) + addChild: (anAnnouncement coder asElement navigationModelForToolbar: self navigationModel). + + self requestStyle ] diff --git a/src/GToolkit-Coder-UI/GtCoderElement.class.st b/src/GToolkit-Coder-UI/GtCoderElement.class.st index 54e096384..b40b8067e 100644 --- a/src/GToolkit-Coder-UI/GtCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderElement.class.st @@ -164,7 +164,12 @@ GtCoderElement >> initialize [ do: [ :anEvent | self onGtCoderHideSidebarWish: anEvent ]. self when: GtNavigationMethodSelectionWish - do: [ :anEvent | self onGtNavigationMethodSelectionWish: anEvent ] + do: [ :anEvent | self onGtNavigationMethodSelectionWish: anEvent ]. + + self + addAptitude: (BrLayoutResizerAptitude new + common: [ contentElement ]; + common: [ sidebarElement ifNil: [ #() ] ]) ] { #category : #'private - event handling' } diff --git a/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st b/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st index 77def48db..5609d2e3d 100644 --- a/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st +++ b/src/GToolkit-Coder-UI/GtCoderPlaygroundElement.class.st @@ -37,7 +37,11 @@ GtCoderPlaygroundElement >> initialize [ self layout: BlLinearLayout vertical. self addChild: self contentElement as: #content. - self addChild: self playPageElement as: #playPage + self addChild: self playPageElement as: #playPage. + + self + addAptitude: (BrLayoutResizerAptitude new + common: [ contentElement ]) ] { #category : #initialization } From cab211407ccf54d84560baf2f7c108a188476cee Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 27 Jan 2026 16:50:00 -0300 Subject: [PATCH 1192/1268] fix `GtCoderContextMenuContent>>#textualCoderViewModel` [feenkcom/gtoolkit#4924] --- .../GtCoderContextMenuContent.class.st | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st index 70d33f2b9..445ba7675 100644 --- a/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st +++ b/src/GToolkit-Coder-UI/GtCoderContextMenuContent.class.st @@ -103,7 +103,25 @@ GtCoderContextMenuContent >> menuItemStencil [ { #category : #'api - accessing' } GtCoderContextMenuContent >> textualCoderViewModel [ "We add a context menu to the CoderElement, not to the editor element" + self flag: #TODO. + + "There is a hack in: + - `GtSmaCCGrammarCoder>>#addMenuItemsElement` adds itself as an editor element, and + - implements `GtSmaCCGrammarCoder>>#textualCoderViewModel`. + - It is called from `SmaCCParser class>>#gtGrammarFor:context:`. + + It is not covered by any example. + + How to reproduce: + - browse LineParser class, + - in the `Grammar` tab click on the plus button, + - select Production from the dropdown menu. + + Note: it was causing DNU because the coder model does not understands parent. + See: https://github.com/feenkcom/gtoolkit/issues/4924" - ^ editorElement parent textualCoderViewModel + ^ (editorElement respondsTo: #textualCoderViewModel) + ifTrue: [ editorElement textualCoderViewModel ] + ifFalse: [ editorElement parent textualCoderViewModel ] ] From a53660f78d631ae575a3e01bf861316d271afe1b Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Tue, 10 Feb 2026 12:38:33 +0100 Subject: [PATCH 1193/1268] add ExpandableSourceCoderElement >> expandedElementStencil: --- .../GtExpandableSourceCoderElement.class.st | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st index 81e36c159..528209a13 100644 --- a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st @@ -81,6 +81,11 @@ GtExpandableSourceCoderElement >> defaultExpandedElementStencil [ ^ GtExpandedCoderElementStencil new ] +{ #category : #accessing } +GtExpandableSourceCoderElement >> expandedElementStencil: anObject [ + expandedElementStencil := anObject +] + { #category : #accessing } GtExpandableSourceCoderElement >> gtAllShortcutsFor: aView [ From 7ff869ae5f69989d3aa2ddc3ad4b0f6b72d85a16 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Wed, 18 Feb 2026 22:44:56 +0100 Subject: [PATCH 1194/1268] move #styleText to BrEditor --- src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 3a87ae41c..885520e74 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -725,11 +725,6 @@ GtTextualCoderEditorElement >> showScrollbars [ addAptitude: (BrGlamorousWithVerticalScrollbarAptitude new scrollableName: self id) ] -{ #category : #private } -GtTextualCoderEditorElement >> styleText [ - self editor styleText -] - { #category : #private } GtTextualCoderEditorElement >> styleTextAndAfterDo: aBlock [ self editor styleTextAndAfterDo: aBlock From 39bff83fe22523a245a579d020d5dd2c6b2333ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Fri, 27 Feb 2026 17:23:23 +0100 Subject: [PATCH 1195/1268] Fix Announcement class>>#gtAllKindOfReferencesFor: --- src/GToolkit-Coder/Announcement.extension.st | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder/Announcement.extension.st b/src/GToolkit-Coder/Announcement.extension.st index e7f4185d5..a3a029977 100644 --- a/src/GToolkit-Coder/Announcement.extension.st +++ b/src/GToolkit-Coder/Announcement.extension.st @@ -3,10 +3,12 @@ Extension { #name : #Announcement } { #category : #'*GToolkit-Coder' } Announcement class >> gtAllKindOfReferencesFor: aView [ - ^ aView explicit + + ^ aView forward title: 'Announcement references'; tooltip: 'Class and subclass references'; priority: 41; - stencil: [ self gtReferencesWithSubclasses ]; + object: [ self gtReferencesWithSubclasses ]; + view: #gtItemsFor:; actionUpdateButtonTooltip: 'Update reference list' ] From b43de8a698e47eebd09cc787e6c51423258b39c7 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 3 Mar 2026 14:59:56 -0300 Subject: [PATCH 1196/1268] make expanded method coder shadows optional [feenkcom/gtoolkit#4953] --- .../GtCoderExpanderShadowAptitude.class.st | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderExpanderShadowAptitude.class.st b/src/GToolkit-Coder-UI/GtCoderExpanderShadowAptitude.class.st index e3149a02c..ccc85d391 100644 --- a/src/GToolkit-Coder-UI/GtCoderExpanderShadowAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExpanderShadowAptitude.class.st @@ -1,16 +1,37 @@ Class { #name : #GtCoderExpanderShadowAptitude, #superclass : #BrLazyStyleCommonAptitude, + #classVars : [ + 'IsWithPermanentShadows' + ], #category : #'GToolkit-Coder-UI-Looks' } +{ #category : #settings } +GtCoderExpanderShadowAptitude class >> isWithPermanentShadows [ + ^ IsWithPermanentShadows ifNil: [ IsWithPermanentShadows := true ] +] + +{ #category : #settings } +GtCoderExpanderShadowAptitude class >> isWithPermanentShadows: aBoolean [ + "Set to true if you want to display shadows around all expanded method coders. + Set to false if you want to display shadows only around focused and hovered expanded method coders." + + IsWithPermanentShadows := aBoolean +] + { #category : #initialization } GtCoderExpanderShadowAptitude >> initialize [ + | aHoverState | super initialize. + aHoverState := self class isWithPermanentShadows + ifTrue: [ (self state hovered or: (self state expanded & self state unfocused)) ] + ifFalse: [ self state hovered and: self state unfocused ]. + self - when: (self state focused) + when: self state focused style: [ :aStyle | aStyle effect: BrGlamorousFocusedShadowEffect new ]; - when: (self state hovered or: (self state expanded & self state unfocused)) + when: aHoverState style: [ :aStyle | aStyle effect: BrGlamorousShadowEffect new ] ] From e49c2712e5e74bd8c88c2bd68cc5433cc806e785 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 4 Mar 2026 08:57:20 -0300 Subject: [PATCH 1197/1268] disable method coder shadows by default [feenkcom/gtoolkit#4953] --- src/GToolkit-Coder-UI/GtCoderExpanderShadowAptitude.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtCoderExpanderShadowAptitude.class.st b/src/GToolkit-Coder-UI/GtCoderExpanderShadowAptitude.class.st index ccc85d391..a7b139607 100644 --- a/src/GToolkit-Coder-UI/GtCoderExpanderShadowAptitude.class.st +++ b/src/GToolkit-Coder-UI/GtCoderExpanderShadowAptitude.class.st @@ -9,7 +9,7 @@ Class { { #category : #settings } GtCoderExpanderShadowAptitude class >> isWithPermanentShadows [ - ^ IsWithPermanentShadows ifNil: [ IsWithPermanentShadows := true ] + ^ IsWithPermanentShadows ifNil: [ IsWithPermanentShadows := false ] ] { #category : #settings } From 9d08c9dce0c73895504f608263bcce1bcb4d343c Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 5 Mar 2026 13:29:47 -0300 Subject: [PATCH 1198/1268] use `#withCommonSettings` --- src/GToolkit-Coder-Extensions/ProtoObject.extension.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-Extensions/ProtoObject.extension.st b/src/GToolkit-Coder-Extensions/ProtoObject.extension.st index ba4153021..a68be5d74 100644 --- a/src/GToolkit-Coder-Extensions/ProtoObject.extension.st +++ b/src/GToolkit-Coder-Extensions/ProtoObject.extension.st @@ -12,7 +12,7 @@ ProtoObject >> gtBrowse [ { #category : #'*GToolkit-Coder-Extensions' } ProtoObject >> gtBrowseFrom: anElement [ ^ BlSpace new - withSceneDriller; + withCommonSettings; inPager: [ GtObjectCoderTool forObject: self ]; icon: BrGlamorousVectorIcons browse; showFrom: anElement From 1c4997c1dae213240d951171a45cc96804206b2b Mon Sep 17 00:00:00 2001 From: Kilian Kier Date: Wed, 11 Mar 2026 09:49:55 +0100 Subject: [PATCH 1199/1268] add configurable default completion controller --- .../GtTextualCoderElement.class.st | 48 ++++++++++++------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st index b1fba82cd..7c7b6b05c 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st @@ -13,9 +13,23 @@ Class { 'addOnsElementFuture', 'editorElement' ], + #classVars : [ + 'DefaultCompletionControllerClass' + ], #category : #'GToolkit-Coder-UI-Coder - Textual' } +{ #category : #accessing } +GtTextualCoderElement class >> defaultCompletionControllerClass [ + ^ DefaultCompletionControllerClass + ifNil: [ DefaultCompletionControllerClass := GtCompletionController ] +] + +{ #category : #accessing } +GtTextualCoderElement class >> defaultCompletionControllerClass: aCompletionController [ + DefaultCompletionControllerClass := aCompletionController +] + { #category : #private } GtTextualCoderElement >> addErrorAttribute: errorAttribute at: anInteger [ | text position | @@ -157,7 +171,7 @@ GtTextualCoderElement >> hideHighlighters [ { #category : #initialization } GtTextualCoderElement >> initialize [ super initialize. - + editorElement := BrEditor new. editorElement beMode: BrTextEditorEditableCodeMode new; @@ -165,9 +179,9 @@ GtTextualCoderElement >> initialize [ aptitude: BrGlamorousCodeEditorAptitude; addAptitude: (BrGlamorousWithExplicitContextMenuAptitude menu: [ self createContextMenu ]); padding: BlInsets empty. - + self addChild: editorElement. - + self layout: BlLinearLayout vertical; addAptitude: (BrLayoutResizerAptitude new inherit: editorElement); @@ -177,33 +191,33 @@ GtTextualCoderElement >> initialize [ self id: GtSourceCoderEditorId. shortcuts := #(). - completion := GtCompletionController on: editorElement. + completion := self class defaultCompletionControllerClass on: editorElement. - evaluationHighlighter := GtSourceCoderEvaluationHighlighter new editorElement: self. + evaluationHighlighter := GtSourceCoderEvaluationHighlighter new + editorElement: self. evaluationPrinter := GtSourceCoderEvaluationPrinter new editorElement: self. - + cursorsUpdater := BrElementUpdater new - element: self; - action: (MessageSend receiver: self selector: #privateUpdateCursors:announcement:). + element: self; + action: (MessageSend receiver: self selector: #privateUpdateCursors:announcement:). textUpdater := BrElementUpdater new - element: self; - action: (MessageSend receiver: self selector: #privateUpdateText:announcement:). + element: self; + action: (MessageSend receiver: self selector: #privateUpdateText:announcement:). addOnsElementFuture := (BrAsyncElementFuture on: self) - executionConfiguration: (GtSingleCoderViewModel methodAddOnsExecutionConfiguration); - whenSuccess: [ :anEditorElement :theAddOns | - self textualCoderViewModel onAddOnsChanged: theAddOns ]; - whenError: [ :anEditorElement :anError | - self onAddOnsError: anError ]. + executionConfiguration: GtSingleCoderViewModel methodAddOnsExecutionConfiguration; + whenSuccess: [ :anEditorElement :theAddOns | self textualCoderViewModel onAddOnsChanged: theAddOns ]; + whenError: [ :anEditorElement :anError | self onAddOnsError: anError ]. self initializeListeners. - self withAsyncPromiseDo: [ :anElementPromise | + self + withAsyncPromiseDo: [ :anElementPromise | anElementPromise whenSuccess: [ :anEditorElement :anEditorState | anEditorElement privateUpdateEditorState: anEditorState ]; whenError: [ :anEditorElement :anEditorState | ]; - whenPending: [ :anEditorElement | ] ] + whenPending: [ :anEditorElement | ] ] ] { #category : #initialization } From f242d2db13804928286e21b7104bf4f50556c18a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Thu, 12 Mar 2026 18:21:38 +0100 Subject: [PATCH 1200/1268] Extend the play button for running tests with the test status [feenkcom/gtoolkit#4980] --- .../GtCoderRunTestAction.extension.st | 16 ++++++++++++++++ src/GToolkit-Coder/GtCoderRunTestAction.class.st | 5 +++++ 2 files changed, 21 insertions(+) create mode 100644 src/GToolkit-Coder-UI/GtCoderRunTestAction.extension.st create mode 100644 src/GToolkit-Coder/GtCoderRunTestAction.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderRunTestAction.extension.st b/src/GToolkit-Coder-UI/GtCoderRunTestAction.extension.st new file mode 100644 index 000000000..a685a0719 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderRunTestAction.extension.st @@ -0,0 +1,16 @@ +Extension { #name : #GtCoderRunTestAction } + +{ #category : #'*GToolkit-Coder-UI' } +GtCoderRunTestAction >> buildElementIn: aCoderActionsElement [ + ^BlElement new + viewModel: BrWidgetModel new; + layout: BlLinearLayout horizontal; + constraintsDo: [:c | + c horizontal fitContent. + c vertical fitContent]; + addChild: (aCoderActionsElement newButtonForAction: self); + addChild: (GtPharoMethodTestCaseStateElement new + bindToCoderViewModel: aCoderActionsElement coderViewModel; + constraintsDo: [:c | + c linear vertical alignCenter ]) +] diff --git a/src/GToolkit-Coder/GtCoderRunTestAction.class.st b/src/GToolkit-Coder/GtCoderRunTestAction.class.st new file mode 100644 index 000000000..1c4fdbd00 --- /dev/null +++ b/src/GToolkit-Coder/GtCoderRunTestAction.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtCoderRunTestAction, + #superclass : #GtCoderAction, + #category : #'GToolkit-Coder-Coders - Addons' +} From 1fab6f77f767e18e939e4a4f19d2b990935206b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Thu, 12 Mar 2026 18:52:15 +0100 Subject: [PATCH 1201/1268] Move the status to the left [feenkcom/gtoolkit#4980] --- src/GToolkit-Coder-UI/GtCoderRunTestAction.extension.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderRunTestAction.extension.st b/src/GToolkit-Coder-UI/GtCoderRunTestAction.extension.st index a685a0719..b12a44df2 100644 --- a/src/GToolkit-Coder-UI/GtCoderRunTestAction.extension.st +++ b/src/GToolkit-Coder-UI/GtCoderRunTestAction.extension.st @@ -8,9 +8,9 @@ GtCoderRunTestAction >> buildElementIn: aCoderActionsElement [ constraintsDo: [:c | c horizontal fitContent. c vertical fitContent]; - addChild: (aCoderActionsElement newButtonForAction: self); addChild: (GtPharoMethodTestCaseStateElement new bindToCoderViewModel: aCoderActionsElement coderViewModel; constraintsDo: [:c | - c linear vertical alignCenter ]) + c linear vertical alignCenter ]); + addChild: (aCoderActionsElement newButtonForAction: self) ] From 12c8294edd290f82c65e0efd6d9c666bd88395b3 Mon Sep 17 00:00:00 2001 From: John Brant Date: Thu, 12 Mar 2026 05:24:53 -0500 Subject: [PATCH 1202/1268] adding ability for coder to use incremental parsers --- .../GtTextualCoderEditorElement.class.st | 2 +- .../GtTextualCoderElement.class.st | 2 +- src/GToolkit-Coder/GtTextualCoder.class.st | 53 ++++++++++++++++--- 3 files changed, 47 insertions(+), 10 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 885520e74..1e0361d3c 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -182,7 +182,7 @@ GtTextualCoderEditorElement >> initializeListeners [ do: [ :anEvent | self onTextEditorHistoryChanged: anEvent ]. self editor - when: BrTextEditorModifiedEvent + when: BrTextEditorModificationEvent do: [ :anEvent | self onTextModifiedDueToEvent: anEvent ]. self editor diff --git a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st index 7c7b6b05c..c5fb41afb 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st @@ -235,7 +235,7 @@ GtTextualCoderElement >> initializeListeners [ do: [ :anEvent | self onTextEditorHistoryChanged: anEvent ]. self editor - when: BrTextEditorModifiedEvent + when: BrTextEditorModificationEvent do: [ :anEvent | self onTextModifiedDueToEvent: anEvent ]. self editor diff --git a/src/GToolkit-Coder/GtTextualCoder.class.st b/src/GToolkit-Coder/GtTextualCoder.class.st index c76499129..2e25d69eb 100644 --- a/src/GToolkit-Coder/GtTextualCoder.class.st +++ b/src/GToolkit-Coder/GtTextualCoder.class.st @@ -4,11 +4,25 @@ Class { #instVars : [ 'sourceCode', 'astPromise', - 'astCache' + 'astCache', + 'previousAst' + ], + #classVars : [ + 'UseIncrementalParsing' ], #category : #'GToolkit-Coder-Coders' } +{ #category : #accessing } +GtTextualCoder class >> useIncrementalParsing [ + ^ UseIncrementalParsing ifNil: [ false ] +] + +{ #category : #accessing } +GtTextualCoder class >> useIncrementalParsing: aBoolean [ + UseIncrementalParsing := aBoolean +] + { #category : #'private - addons' } GtTextualCoder >> addOnsClass [ ^ GtTextualCoderAddOns @@ -326,9 +340,32 @@ GtTextualCoder >> reset [ { #category : #'private - ast' } GtTextualCoder >> resetAstCache [ - self critical: [ - astPromise := nil. - astCache resetCache ] + ^ self resetAstCache: nil +] + +{ #category : #'private - ast' } +GtTextualCoder >> resetAstCache: aReason [ + self + critical: [ astPromise := nil. + self class useIncrementalParsing + ifTrue: [ (aReason notNil and: [ aReason isModification ]) + ifTrue: [ astCache ifSome: [ :value | previousAst := value ast ] ifNone: [ ]. + (previousAst isKindOf: SmaCCParseNode) + ifTrue: [ aReason isInsertion + ifTrue: [ aReason + indicesAndLengthsDo: [ :index :len | + previousAst + invalidateFrom: index + 1 + to: index + inserting: len ] ] + ifFalse: [ aReason + indicesAndLengthsDo: [ :index :len | + previousAst + invalidateFrom: index + to: index + len - 1 + inserting: 0 ] ] ] ] + ifFalse: [ previousAst := nil ] ]. + astCache resetCache ] ] { #category : #'event handling' } @@ -340,10 +377,10 @@ GtTextualCoder >> sourceChangedTo: aNewText [ { #category : #'event handling' } GtTextualCoder >> sourceChangedTo: aNewText from: aPreviousText with: anUpdateStrategy dueTo: aReason [ - self resetAstCache. - self - notifySourceChangedTo: aNewText - from: aPreviousText + self resetAstCache: aReason. + self + notifySourceChangedTo: aNewText + from: aPreviousText with: anUpdateStrategy dueTo: aReason. self requestUpdateAddOns From 05fdda7dc3224b7d7bbd85058a7185f060a50bc2 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 13 Mar 2026 17:42:49 -0300 Subject: [PATCH 1203/1268] remove `#maxHeight:` from `GtFilterItemsElement>>#createDropdownContent` dropdown menu --- src/GToolkit-Coder-UI/GtFilterItemsElement.class.st | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st index c0f239ba0..acf40f079 100644 --- a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st @@ -142,8 +142,6 @@ GtFilterItemsElement >> createDropdownContent [ ^ aListElement vFitContentLimited; hFitContentLimited; - constraintsDo: [ :c | - c maxHeight: 100 ]; itemStencil: [ :anItemType | self createItemElementForListElement: aListElement ]; itemDataBinder: [ :anItemElement :anItemObject :anItemIndex | anItemElement id: (GtFilterItemId indexed: anItemIndex). From 6830ceb86b96ac35112b7089b9878fbc37df9366 Mon Sep 17 00:00:00 2001 From: Kilian Kier Date: Sun, 15 Mar 2026 11:53:01 +0100 Subject: [PATCH 1204/1268] Ensuring that the change manager instance always exists --- src/GToolkit-Coder/GtRefactoryChangeManager.class.st | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder/GtRefactoryChangeManager.class.st b/src/GToolkit-Coder/GtRefactoryChangeManager.class.st index e85dc8738..fb8119797 100644 --- a/src/GToolkit-Coder/GtRefactoryChangeManager.class.st +++ b/src/GToolkit-Coder/GtRefactoryChangeManager.class.st @@ -19,7 +19,8 @@ Class { { #category : #'class initialization' } GtRefactoryChangeManager class >> initialize [ self nuke. - UndoSize := 200 + UndoSize := 200. + SessionManager default registerUserClassNamed: self name ] { #category : #accessing } @@ -33,6 +34,13 @@ GtRefactoryChangeManager class >> nuke [ Instance := nil ] +{ #category : #'system startup' } +GtRefactoryChangeManager class >> startUp: isImageStarting [ + "Ensure the instance exists." + + self instance +] + { #category : #accessing } GtRefactoryChangeManager class >> undoSize [ ^ UndoSize From 7a01624c7445c1231c760d58160900675a8bde01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Mon, 23 Mar 2026 09:25:42 +0100 Subject: [PATCH 1205/1268] Use GtDebugSession instead of DebugSession [feenkcom/gtoolkit#5001] --- .../GtCoderEvaluatedCodeIntervalFinder.class.st | 2 +- .../GtNotificationDebugSessionElement.class.st | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderEvaluatedCodeIntervalFinder.class.st b/src/GToolkit-Coder-UI/GtCoderEvaluatedCodeIntervalFinder.class.st index 94af1ad7c..1b318f633 100644 --- a/src/GToolkit-Coder-UI/GtCoderEvaluatedCodeIntervalFinder.class.st +++ b/src/GToolkit-Coder-UI/GtCoderEvaluatedCodeIntervalFinder.class.st @@ -23,7 +23,7 @@ GtCoderEvaluatedCodeIntervalFinder >> context: aContext [ { #category : #accessing } GtCoderEvaluatedCodeIntervalFinder >> debugSession [ - + ^ debugSession ] diff --git a/src/GToolkit-Coder-UI/GtNotificationDebugSessionElement.class.st b/src/GToolkit-Coder-UI/GtNotificationDebugSessionElement.class.st index 9d943b5cc..13befe232 100644 --- a/src/GToolkit-Coder-UI/GtNotificationDebugSessionElement.class.st +++ b/src/GToolkit-Coder-UI/GtNotificationDebugSessionElement.class.st @@ -93,7 +93,7 @@ GtNotificationDebugSessionElement >> initializeStackList [ hMatchParent; vExact: 50; padding: (BlInsets top: 5 right: 9 bottom: 10 left: 9); - itemType: [ :anItemTypeFactory :anItemObject :anItemIndex | DebugSession ]; + itemType: [ :anItemTypeFactory :anItemObject :anItemIndex | GtDebugSession ]; itemStencil: [ :anEventElementClass :aListWidget | BrLabel new aptitude: (BrGlamorousLabelAptitude new From b229b0a87485b722ce74f754f7fae9f322441033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Mon, 23 Mar 2026 15:48:46 +0100 Subject: [PATCH 1206/1268] Duplicate extensions for Pharo 13 refactoring classes [feenkcom/gtoolkit#5003] --- .../ReRefactoring.extension.st | 13 +++++++++++ .../ReTransformation.extension.st | 8 +++++++ src/GToolkit-Coder/ReRefactoring.extension.st | 22 +++++++++++++++++++ .../ReTransformation.extension.st | 22 +++++++++++++++++++ 4 files changed, 65 insertions(+) create mode 100644 src/GToolkit-Coder-UI/ReRefactoring.extension.st create mode 100644 src/GToolkit-Coder-UI/ReTransformation.extension.st create mode 100644 src/GToolkit-Coder/ReRefactoring.extension.st create mode 100644 src/GToolkit-Coder/ReTransformation.extension.st diff --git a/src/GToolkit-Coder-UI/ReRefactoring.extension.st b/src/GToolkit-Coder-UI/ReRefactoring.extension.st new file mode 100644 index 000000000..94a2872cc --- /dev/null +++ b/src/GToolkit-Coder-UI/ReRefactoring.extension.st @@ -0,0 +1,13 @@ +Extension { #name : #ReRefactoring } + +{ #category : #'*GToolkit-Coder-UI' } +ReRefactoring >> gtDescription [ + + + ^ self class name +] + +{ #category : #'*GToolkit-Coder-UI' } +ReRefactoring >> gtDisplayOn: aStream [ + aStream nextPutAll: self gtDescription +] diff --git a/src/GToolkit-Coder-UI/ReTransformation.extension.st b/src/GToolkit-Coder-UI/ReTransformation.extension.st new file mode 100644 index 000000000..45b697c1d --- /dev/null +++ b/src/GToolkit-Coder-UI/ReTransformation.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #ReTransformation } + +{ #category : #'*GToolkit-Coder-UI' } +ReTransformation >> gtDescription [ + + + ^ self class name +] diff --git a/src/GToolkit-Coder/ReRefactoring.extension.st b/src/GToolkit-Coder/ReRefactoring.extension.st new file mode 100644 index 000000000..00b191e31 --- /dev/null +++ b/src/GToolkit-Coder/ReRefactoring.extension.st @@ -0,0 +1,22 @@ +Extension { #name : #ReRefactoring } + +{ #category : #'*GToolkit-Coder' } +ReRefactoring >> gtDangers [ + + + ^ self gtPreconditions gtLeafChildren + reject: #check + thenCollect: [ :eachCondition | GtRefactoringDanger new + condition: eachCondition; + description: (eachCondition errorMacro expandMacrosWith: false) ] +] + +{ #category : #'*GToolkit-Coder' } +ReRefactoring >> gtPreconditions [ + ^ self preconditions +] + +{ #category : #'*GToolkit-Coder' } +ReRefactoring >> gtTransform [ + self transform +] diff --git a/src/GToolkit-Coder/ReTransformation.extension.st b/src/GToolkit-Coder/ReTransformation.extension.st new file mode 100644 index 000000000..62ae62a61 --- /dev/null +++ b/src/GToolkit-Coder/ReTransformation.extension.st @@ -0,0 +1,22 @@ +Extension { #name : #ReTransformation } + +{ #category : #'*GToolkit-Coder' } +ReTransformation >> gtDangers [ + + + ^ self gtPreconditions gtLeafChildren + reject: #check + thenCollect: [ :eachCondition | GtRefactoringDanger new + condition: eachCondition; + description: (eachCondition errorMacro expandMacrosWith: false) ] +] + +{ #category : #'*GToolkit-Coder' } +ReTransformation >> gtPreconditions [ + ^ self preconditions +] + +{ #category : #'*GToolkit-Coder' } +ReTransformation >> gtTransform [ + self privateTransform +] From 74c2bc1eb097f44aa3efd3463c6b0a06eb0fb220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Mon, 23 Mar 2026 16:58:30 +0100 Subject: [PATCH 1207/1268] Duplicate extensions for Pharo 13 refactoring classes [feenkcom/gtoolkit#5003] --- .../RePullUpInstanceVariableRefactoring.extension.st | 6 ++++++ .../RePullUpMethodRefactoring.extension.st | 11 +++++++++++ 2 files changed, 17 insertions(+) create mode 100644 src/GToolkit-Coder-UI/RePullUpInstanceVariableRefactoring.extension.st create mode 100644 src/GToolkit-Coder-UI/RePullUpMethodRefactoring.extension.st diff --git a/src/GToolkit-Coder-UI/RePullUpInstanceVariableRefactoring.extension.st b/src/GToolkit-Coder-UI/RePullUpInstanceVariableRefactoring.extension.st new file mode 100644 index 000000000..db255da28 --- /dev/null +++ b/src/GToolkit-Coder-UI/RePullUpInstanceVariableRefactoring.extension.st @@ -0,0 +1,6 @@ +Extension { #name : #RePullUpInstanceVariableRefactoring } + +{ #category : #'*GToolkit-Coder-UI' } +RePullUpInstanceVariableRefactoring >> gtDescription [ + ^ 'Push up instance variable ' , variableName +] diff --git a/src/GToolkit-Coder-UI/RePullUpMethodRefactoring.extension.st b/src/GToolkit-Coder-UI/RePullUpMethodRefactoring.extension.st new file mode 100644 index 000000000..6fc2c7a0e --- /dev/null +++ b/src/GToolkit-Coder-UI/RePullUpMethodRefactoring.extension.st @@ -0,0 +1,11 @@ +Extension { #name : #RePullUpMethodRefactoring } + +{ #category : #'*GToolkit-Coder-UI' } +RePullUpMethodRefactoring >> gtDescription [ + ^ 'Push up method ' , self methodClassName , '>>' , selectors anyOne +] + +{ #category : #'*GToolkit-Coder-UI' } +RePullUpMethodRefactoring >> methodClassName [ + ^ class name +] From 40bf3b1b034e67e7eec21c13df91427be97c092a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Mon, 23 Mar 2026 17:58:44 +0100 Subject: [PATCH 1208/1268] Remove RPackage extension methods [feenkcom/gtoolkit#4904] --- .../RPackage.extension.st | 93 ------------------- src/GToolkit-Coder-UI/RPackage.extension.st | 6 -- src/GToolkit-Coder/RPackage.extension.st | 10 -- 3 files changed, 109 deletions(-) delete mode 100644 src/GToolkit-Coder-Extensions/RPackage.extension.st delete mode 100644 src/GToolkit-Coder-UI/RPackage.extension.st delete mode 100644 src/GToolkit-Coder/RPackage.extension.st diff --git a/src/GToolkit-Coder-Extensions/RPackage.extension.st b/src/GToolkit-Coder-Extensions/RPackage.extension.st deleted file mode 100644 index 525354a14..000000000 --- a/src/GToolkit-Coder-Extensions/RPackage.extension.st +++ /dev/null @@ -1,93 +0,0 @@ -Extension { #name : #RPackage } - -{ #category : #'*GToolkit-Coder-Extensions' } -RPackage >> gtAllowedDependenciesFor: aView [ - - (self packageManifestOrNil - ifNil: [ false ] - ifNotNil: [ :aPackage | - aPackage class canPerform: #mustOnlyDependOn ]) ifFalse: [ ^ aView empty ] . - - ^ aView list - title: 'Allowed Dependencies'; - priority: 50; - items: [ - self packageManifestOrNil - ifNil: [ #() ] - ifNotNil: [ :aPackage | - (aPackage class canPerform: #mustOnlyDependOn) - ifTrue: [ aPackage mustOnlyDependOn collect: #asPackage ] - ifFalse: [ #() ] ] ]; - itemText: [ :aPackage | aPackage name ] -] - -{ #category : #'*GToolkit-Coder-Extensions' } -RPackage >> gtBaselinesFor: aView [ - - - ^ aView forward - title: 'References'; - tooltip: 'References to the package name'; - priority: 30; - object: [ self name gtStringLiteralCaseSensitiveMatch | self name gtReferences ]; - view: #gtItemsFor: -] - -{ #category : #'*GToolkit-Coder-Extensions' } -RPackage >> gtBrowse [ - ^ BlSpace new - withSceneDriller; - inPager: [ GtPackageCoderTool forPackage: self ]; - title: self packageName; - icon: BrGlamorousVectorIcons browse; - show -] - -{ #category : #'*GToolkit-Coder-Extensions' } -RPackage >> gtBrowseFrom: anElement [ - ^ BlSpace new - withCommonSettings; - inPager: [ self gtDefaultInspectorTool ]; - title: self packageName; - icon: BrGlamorousVectorIcons browse; - showFrom: anElement -] - -{ #category : #'*GToolkit-Coder-Extensions' } -RPackage >> gtDefinedClassesFor: aView context: aPhlowContext [ - - (aPhlowContext isKindOf: GtPhlowExecutionContext) ifFalse: [ ^ aView empty ]. - aPhlowContext hasPackageCoder ifFalse: [ ^ aView empty ]. - ^ aView explicit - priority: 1; - title: 'Classes'; - disableAsync; - stencil: [ aPhlowContext packageCoder classesCoder asElement ] -] - -{ #category : #'*GToolkit-Coder-Extensions' } -RPackage >> gtDefinedClassesWithPossibleDuplicatesDo: aBlock [ - classes do: [:each | - Smalltalk globals - at: each - ifPresent: [:aClass| aBlock value: aClass ]]. -] - -{ #category : #'*GToolkit-Coder-Extensions' } -RPackage >> gtDefinedTagsFor: aView context: aPhlowContext [ - - (aPhlowContext isKindOf: GtPhlowExecutionContext) ifFalse: [ ^ aView empty ]. - aPhlowContext hasPackageCoder ifFalse: [ ^ aView empty ]. - ^ aView explicit - priority: 10.5; - title: 'Tags'; - disableAsync; - stencil: [ - BrSimpleList new - itemStencil: [ GtPackageTagCardElement new ]; - itemDataBinder: [ :eachTagCard :eachTagCoder | - eachTagCard coder: eachTagCoder ]; - items: (aPhlowContext packageCoder packageTagsCoder coders - asSortedCollection: [ :a :b | a packageTagName < b packageTagName ]); - addEventFilterOn: BlClickEvent do: [ :anEvent | anEvent currentTarget requestFocus ] ] -] diff --git a/src/GToolkit-Coder-UI/RPackage.extension.st b/src/GToolkit-Coder-UI/RPackage.extension.st deleted file mode 100644 index 12c072432..000000000 --- a/src/GToolkit-Coder-UI/RPackage.extension.st +++ /dev/null @@ -1,6 +0,0 @@ -Extension { #name : #RPackage } - -{ #category : #'*GToolkit-Coder-UI' } -RPackage >> gtSpawnCoder [ - ^ GtPackageCoderTool forPackage: self -] diff --git a/src/GToolkit-Coder/RPackage.extension.st b/src/GToolkit-Coder/RPackage.extension.st deleted file mode 100644 index cbf08816b..000000000 --- a/src/GToolkit-Coder/RPackage.extension.st +++ /dev/null @@ -1,10 +0,0 @@ -Extension { #name : #RPackage } - -{ #category : #'*GToolkit-Coder' } -RPackage >> tags [ - - - ^ self - forPharo12AndNewer: [ tags] - forPharo11: [ self classTags ] -] From 51b9960b14f2715eb56434cc7de2edec156b5d43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Wed, 25 Mar 2026 16:23:04 +0100 Subject: [PATCH 1209/1268] Add extensions to new AST classes [feenkcom/gtoolkit#5004] --- src/GToolkit-Coder/OCArrayNode.extension.st | 10 +++++++++ .../OCAssignmentNode.extension.st | 7 +++++++ src/GToolkit-Coder/OCBlockNode.extension.st | 10 +++++++++ src/GToolkit-Coder/OCCascadeNode.extension.st | 9 ++++++++ src/GToolkit-Coder/OCLiteralNode.extension.st | 8 +++++++ src/GToolkit-Coder/OCMessageNode.extension.st | 9 ++++++++ src/GToolkit-Coder/OCMethodNode.extension.st | 9 ++++++++ .../OCParseErrorNode.extension.st | 7 +++++++ src/GToolkit-Coder/OCPragmaNode.extension.st | 10 +++++++++ src/GToolkit-Coder/OCProgramNode.extension.st | 21 +++++++++++++++++++ .../OCSequenceNode.extension.st | 9 ++++++++ src/GToolkit-Coder/OCValueNode.extension.st | 7 +++++++ .../OCVariableNode.extension.st | 12 +++++++++++ 13 files changed, 128 insertions(+) create mode 100644 src/GToolkit-Coder/OCArrayNode.extension.st create mode 100644 src/GToolkit-Coder/OCAssignmentNode.extension.st create mode 100644 src/GToolkit-Coder/OCBlockNode.extension.st create mode 100644 src/GToolkit-Coder/OCCascadeNode.extension.st create mode 100644 src/GToolkit-Coder/OCLiteralNode.extension.st create mode 100644 src/GToolkit-Coder/OCMessageNode.extension.st create mode 100644 src/GToolkit-Coder/OCMethodNode.extension.st create mode 100644 src/GToolkit-Coder/OCParseErrorNode.extension.st create mode 100644 src/GToolkit-Coder/OCPragmaNode.extension.st create mode 100644 src/GToolkit-Coder/OCProgramNode.extension.st create mode 100644 src/GToolkit-Coder/OCSequenceNode.extension.st create mode 100644 src/GToolkit-Coder/OCValueNode.extension.st create mode 100644 src/GToolkit-Coder/OCVariableNode.extension.st diff --git a/src/GToolkit-Coder/OCArrayNode.extension.st b/src/GToolkit-Coder/OCArrayNode.extension.st new file mode 100644 index 000000000..3b4c77473 --- /dev/null +++ b/src/GToolkit-Coder/OCArrayNode.extension.st @@ -0,0 +1,10 @@ +Extension { #name : #OCArrayNode } + +{ #category : #'*GToolkit-Coder' } +OCArrayNode >> gtMoveBy: anInteger [ + super gtMoveBy: anInteger. + periods + ifNotNil: [ periods := periods collect: [ :f | f + anInteger ] ]. + left ifNotNil: [ left := left + anInteger ]. + right ifNotNil: [ right := right + anInteger ] +] diff --git a/src/GToolkit-Coder/OCAssignmentNode.extension.st b/src/GToolkit-Coder/OCAssignmentNode.extension.st new file mode 100644 index 000000000..0d737364c --- /dev/null +++ b/src/GToolkit-Coder/OCAssignmentNode.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #OCAssignmentNode } + +{ #category : #'*GToolkit-Coder' } +OCAssignmentNode >> gtMoveBy: anInteger [ + super gtMoveBy: anInteger. + assignment ifNotNil: [ assignment := assignment + anInteger ] +] diff --git a/src/GToolkit-Coder/OCBlockNode.extension.st b/src/GToolkit-Coder/OCBlockNode.extension.st new file mode 100644 index 000000000..9aa0dd76e --- /dev/null +++ b/src/GToolkit-Coder/OCBlockNode.extension.st @@ -0,0 +1,10 @@ +Extension { #name : #OCBlockNode } + +{ #category : #'*GToolkit-Coder' } +OCBlockNode >> gtMoveBy: anInteger [ + super gtMoveBy: anInteger. + colons ifNotNil: [ colons := colons collect: [ :f | f + anInteger ] ]. + left ifNotNil: [ left := left + anInteger ]. + right ifNotNil: [ right := right + anInteger ]. + bar ifNotNil: [ bar := bar + anInteger ] +] diff --git a/src/GToolkit-Coder/OCCascadeNode.extension.st b/src/GToolkit-Coder/OCCascadeNode.extension.st new file mode 100644 index 000000000..0279814b5 --- /dev/null +++ b/src/GToolkit-Coder/OCCascadeNode.extension.st @@ -0,0 +1,9 @@ +Extension { #name : #OCCascadeNode } + +{ #category : #'*GToolkit-Coder' } +OCCascadeNode >> gtMoveBy: anInteger [ + super gtMoveBy: anInteger. + (messages size - 1) timesRepeat: [ self receiver gtMoveBy: 0 - anInteger ]. + semicolons + ifNotNil: [ semicolons := semicolons collect: [ :f | f + anInteger ] ] +] diff --git a/src/GToolkit-Coder/OCLiteralNode.extension.st b/src/GToolkit-Coder/OCLiteralNode.extension.st new file mode 100644 index 000000000..0d11d0feb --- /dev/null +++ b/src/GToolkit-Coder/OCLiteralNode.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #OCLiteralNode } + +{ #category : #'*GToolkit-Coder' } +OCLiteralNode >> gtMoveBy: anInteger [ + super gtMoveBy: anInteger. + start ifNotNil: [ start := start + anInteger ]. + stop ifNotNil: [ stop := stop + anInteger ] +] diff --git a/src/GToolkit-Coder/OCMessageNode.extension.st b/src/GToolkit-Coder/OCMessageNode.extension.st new file mode 100644 index 000000000..a944b680a --- /dev/null +++ b/src/GToolkit-Coder/OCMessageNode.extension.st @@ -0,0 +1,9 @@ +Extension { #name : #OCMessageNode } + +{ #category : #'*GToolkit-Coder' } +OCMessageNode >> gtMoveBy: anInteger [ + super gtMoveBy: anInteger. + keywordsPositions + ifNotNil: [ keywordsPositions := keywordsPositions + collect: [ :f | f + anInteger ] ] +] diff --git a/src/GToolkit-Coder/OCMethodNode.extension.st b/src/GToolkit-Coder/OCMethodNode.extension.st new file mode 100644 index 000000000..5884ee44f --- /dev/null +++ b/src/GToolkit-Coder/OCMethodNode.extension.st @@ -0,0 +1,9 @@ +Extension { #name : #OCMethodNode } + +{ #category : #'*GToolkit-Coder' } +OCMethodNode >> gtMoveBy: anInteger [ + super gtMoveBy: anInteger. + keywordsPositions + ifNotNil: [ keywordsPositions := keywordsPositions + collect: [ :f | f + anInteger ] ] +] diff --git a/src/GToolkit-Coder/OCParseErrorNode.extension.st b/src/GToolkit-Coder/OCParseErrorNode.extension.st new file mode 100644 index 000000000..bfbf9a75f --- /dev/null +++ b/src/GToolkit-Coder/OCParseErrorNode.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #OCParseErrorNode } + +{ #category : #'*GToolkit-Coder' } +OCParseErrorNode >> gtMoveBy: anInteger [ + super gtMoveBy: anInteger. + start ifNotNil: [ start := start + anInteger ] +] diff --git a/src/GToolkit-Coder/OCPragmaNode.extension.st b/src/GToolkit-Coder/OCPragmaNode.extension.st new file mode 100644 index 000000000..86314fa43 --- /dev/null +++ b/src/GToolkit-Coder/OCPragmaNode.extension.st @@ -0,0 +1,10 @@ +Extension { #name : #OCPragmaNode } + +{ #category : #'*GToolkit-Coder' } +OCPragmaNode >> gtMoveBy: anInteger [ + super gtMoveBy: anInteger. + keywordsPositions + ifNotNil: [ keywordsPositions := keywordsPositions collect: [ :f | f + anInteger ] ]. + left ifNotNil: [ left := left + anInteger ]. + right ifNotNil: [ right := right + anInteger ] +] diff --git a/src/GToolkit-Coder/OCProgramNode.extension.st b/src/GToolkit-Coder/OCProgramNode.extension.st new file mode 100644 index 000000000..aa72f5434 --- /dev/null +++ b/src/GToolkit-Coder/OCProgramNode.extension.st @@ -0,0 +1,21 @@ +Extension { #name : #OCProgramNode } + +{ #category : #'*GToolkit-Coder' } +OCProgramNode >> gtMoveAllBy: anInteger [ + self gtMoveBy: anInteger. + self children do: [ :e | e gtMoveAllBy: anInteger ] +] + +{ #category : #'*GToolkit-Coder' } +OCProgramNode >> gtMoveBy: anInteger [ + self comments do: [ :f | f with: f contents at: f start + anInteger ] +] + +{ #category : #'*GToolkit-Coder' } +OCProgramNode >> withAllParentsDo: aBlock [ + | node | + node := self. + [ node notNil ] + whileTrue: [ aBlock value: node. + node := node parent ] +] diff --git a/src/GToolkit-Coder/OCSequenceNode.extension.st b/src/GToolkit-Coder/OCSequenceNode.extension.st new file mode 100644 index 000000000..9e198ef15 --- /dev/null +++ b/src/GToolkit-Coder/OCSequenceNode.extension.st @@ -0,0 +1,9 @@ +Extension { #name : #OCSequenceNode } + +{ #category : #'*GToolkit-Coder' } +OCSequenceNode >> gtMoveBy: anInteger [ + super gtMoveBy: anInteger. + periods ifNotNil: [ periods := periods collect: [ :f | f + anInteger ] ]. + leftBar ifNotNil: [ leftBar := leftBar + anInteger ]. + rightBar ifNotNil: [ rightBar := rightBar + anInteger ] +] diff --git a/src/GToolkit-Coder/OCValueNode.extension.st b/src/GToolkit-Coder/OCValueNode.extension.st new file mode 100644 index 000000000..0347c25a6 --- /dev/null +++ b/src/GToolkit-Coder/OCValueNode.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #OCValueNode } + +{ #category : #'*GToolkit-Coder' } +OCValueNode >> gtMoveBy: anInteger [ + super gtMoveBy: anInteger. + parentheses ifNotNil: [ parentheses := parentheses collect: [ :f | f + anInteger ] ]. +] diff --git a/src/GToolkit-Coder/OCVariableNode.extension.st b/src/GToolkit-Coder/OCVariableNode.extension.st new file mode 100644 index 000000000..207e6cafe --- /dev/null +++ b/src/GToolkit-Coder/OCVariableNode.extension.st @@ -0,0 +1,12 @@ +Extension { #name : #OCVariableNode } + +{ #category : #'*GToolkit-Coder' } +OCVariableNode >> gtIsLocal [ + ^ (self whoDefines: self name) notNil +] + +{ #category : #'*GToolkit-Coder' } +OCVariableNode >> gtMoveBy: anInteger [ + super gtMoveBy: anInteger. + start ifNotNil: [ start := start + anInteger ] +] From 88cee4f45d763563ef9d6b6823aa7b678b68b716 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 25 Mar 2026 23:49:24 -0300 Subject: [PATCH 1210/1268] make it possible to initialize another text editor element using `GtTextualCoderElement>>#initializeEditorElement:` --- ...GtSourceCoderExpandedContentElement.class.st | 5 +++++ .../GtTextualCoderElement.class.st | 17 ++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st index 558afdcaa..395d611b6 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st @@ -46,6 +46,11 @@ GtSourceCoderExpandedContentElement >> initialize [ self addAptitude: (BrLayoutResizerAptitude new inherit: editorElement) ] +{ #category : #'api - initialization' } +GtSourceCoderExpandedContentElement >> initializeEditorElement: anElement [ + editorElement initializeEditorElement: anElement +] + { #category : #'instance creation' } GtSourceCoderExpandedContentElement >> newActionsElement [ ^ GtSourceCoderActionsElement new diff --git a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st index c5fb41afb..fb0eea68b 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st @@ -184,7 +184,7 @@ GtTextualCoderElement >> initialize [ self layout: BlLinearLayout vertical; - addAptitude: (BrLayoutResizerAptitude new inherit: editorElement); + addAptitude: (BrLayoutResizerAptitude new inherit: [ editorElement ]); hMatchParent; vFitContentLimited. @@ -220,6 +220,21 @@ GtTextualCoderElement >> initialize [ whenPending: [ :anEditorElement | ] ] ] +{ #category : #'api - initialization' } +GtTextualCoderElement >> initializeEditorElement: aNewEditorElement [ + | anOldEditor | + anOldEditor := editorElement. + editorElement := aNewEditorElement. + self + replaceChild: anOldEditor + with: editorElement + as: GtSourceCoderEditorInnerId. + + self hasTextualCoderViewModel ifFalse: [ ^ self ]. + self onTextualCoderViewModelChanged. + self onPostTextualCoderViewModelChanged. +] + { #category : #initialization } GtTextualCoderElement >> initializeListeners [ self From 0f1217cd0aa3c1001c81b57d9a68b7e70c823e7a Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Thu, 26 Mar 2026 13:05:04 +0100 Subject: [PATCH 1211/1268] add copy value text in the raw view feenkcom/gtoolkit#5009 --- .../InstanceVariableSlot.extension.st | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/GToolkit-Coder-UI/InstanceVariableSlot.extension.st b/src/GToolkit-Coder-UI/InstanceVariableSlot.extension.st index c09c5603d..3fb46f746 100644 --- a/src/GToolkit-Coder-UI/InstanceVariableSlot.extension.st +++ b/src/GToolkit-Coder-UI/InstanceVariableSlot.extension.st @@ -99,6 +99,22 @@ InstanceVariableSlot >> gtCopySlotNameFor: anAction context: aPhlowContext [ action: [ :aButton | Clipboard default clipboardText: self name asString ] ] +{ #category : #'*GToolkit-Coder-UI' } +InstanceVariableSlot >> gtCopyValueTextFor: anAction context: aPhlowContext [ + + | aSelfObject | + aSelfObject := aPhlowContext selfObjectIfNone: [ ^ anAction noAction ]. + + ^ anAction button + label: 'Copy value text'; + icon: BrGlamorousVectorIcons clipboard; + priority: 6; + target: GtCoderVariableTarget; + menuItemPreview: [ (aSelfObject readSlot: self) gtDisplayText ]; + menuItemGroup: BrMenuItemGroupConfiguration editing; + action: [ :aButton | Clipboard default clipboardText: (aSelfObject readSlot: self) gtDisplayText ] +] + { #category : #'*GToolkit-Coder-UI' } InstanceVariableSlot >> gtCreateAccessorsActionFor: anAction context: aPhlowContext [ From 1f48d63f1bbb856dafa97ab1458323bae72c4cfb Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 26 Mar 2026 13:51:45 -0300 Subject: [PATCH 1212/1268] initialize context menu, completion, and event handlers for new editor elements [feenkcom/gtoolkit#5007] --- .../GtTextualCoderElement.class.st | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st index fb0eea68b..5f5a7c700 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st @@ -229,22 +229,23 @@ GtTextualCoderElement >> initializeEditorElement: aNewEditorElement [ replaceChild: anOldEditor with: editorElement as: GtSourceCoderEditorInnerId. + + aNewEditorElement + aptitude: BrGlamorousCodeEditorAptitude; + addAptitude: (BrGlamorousWithExplicitContextMenuAptitude menu: [ self createContextMenu ]); + padding: BlInsets empty. + completion textElement: aNewEditorElement. + + self initializeEditorListeners. + self hasTextualCoderViewModel ifFalse: [ ^ self ]. self onTextualCoderViewModelChanged. - self onPostTextualCoderViewModelChanged. + self onPostTextualCoderViewModelChanged ] { #category : #initialization } -GtTextualCoderElement >> initializeListeners [ - self - when: BlFocusInEvent - do: [ :anEvent | self onFocusInEvent: anEvent ]. - - self - when: BlFocusOutEvent - do: [ :anEvent | self onFocusOutEvent: anEvent ]. - +GtTextualCoderElement >> initializeEditorListeners [ self editor when: BrTextEditorHistoryChangedEvent do: [ :anEvent | self onTextEditorHistoryChanged: anEvent ]. @@ -266,6 +267,13 @@ GtTextualCoderElement >> initializeListeners [ do: [ :anEvent | self onTextStyled: anEvent ] ] +{ #category : #initialization } +GtTextualCoderElement >> initializeListeners [ + self when: BlFocusInEvent do: [ :anEvent | self onFocusInEvent: anEvent ]. + self when: BlFocusOutEvent do: [ :anEvent | self onFocusOutEvent: anEvent ]. + self initializeEditorListeners +] + { #category : #TODO } GtTextualCoderElement >> inserter [ "This method should be deprecated and removed, instead add higher-level api methods" From 996ad75d092e4a28bad5683a1ecbe517fe2be327 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 26 Mar 2026 15:54:34 -0300 Subject: [PATCH 1213/1268] fix styling [feenkcom/gtoolkit#5007] --- src/GToolkit-Coder-UI/GtTextualCoderElement.class.st | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st index 5f5a7c700..416c898a9 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st @@ -234,10 +234,15 @@ GtTextualCoderElement >> initializeEditorElement: aNewEditorElement [ aptitude: BrGlamorousCodeEditorAptitude; addAptitude: (BrGlamorousWithExplicitContextMenuAptitude menu: [ self createContextMenu ]); padding: BlInsets empty. - + completion textElement: aNewEditorElement. - + self initializeEditorListeners. + + "I think this can be removed one `BrTextEditorModificationEvent` works." + self editor + when: BrTextEditorModifiedEvent + do: [ :anEvent | self onTextModifiedDueToEvent: anEvent ]. self hasTextualCoderViewModel ifFalse: [ ^ self ]. self onTextualCoderViewModelChanged. From 2a01289296e9f7918797251950a68f519425aab1 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 26 Mar 2026 16:23:09 -0300 Subject: [PATCH 1214/1268] move methods to another repository [feenkcom/gtoolkit#5007] --- ...SourceCoderExpandedContentElement.class.st | 5 ---- .../GtTextualCoderElement.class.st | 29 ------------------- 2 files changed, 34 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st index 395d611b6..558afdcaa 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st @@ -46,11 +46,6 @@ GtSourceCoderExpandedContentElement >> initialize [ self addAptitude: (BrLayoutResizerAptitude new inherit: editorElement) ] -{ #category : #'api - initialization' } -GtSourceCoderExpandedContentElement >> initializeEditorElement: anElement [ - editorElement initializeEditorElement: anElement -] - { #category : #'instance creation' } GtSourceCoderExpandedContentElement >> newActionsElement [ ^ GtSourceCoderActionsElement new diff --git a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st index 416c898a9..8f6ef056d 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st @@ -220,35 +220,6 @@ GtTextualCoderElement >> initialize [ whenPending: [ :anEditorElement | ] ] ] -{ #category : #'api - initialization' } -GtTextualCoderElement >> initializeEditorElement: aNewEditorElement [ - | anOldEditor | - anOldEditor := editorElement. - editorElement := aNewEditorElement. - self - replaceChild: anOldEditor - with: editorElement - as: GtSourceCoderEditorInnerId. - - aNewEditorElement - aptitude: BrGlamorousCodeEditorAptitude; - addAptitude: (BrGlamorousWithExplicitContextMenuAptitude menu: [ self createContextMenu ]); - padding: BlInsets empty. - - completion textElement: aNewEditorElement. - - self initializeEditorListeners. - - "I think this can be removed one `BrTextEditorModificationEvent` works." - self editor - when: BrTextEditorModifiedEvent - do: [ :anEvent | self onTextModifiedDueToEvent: anEvent ]. - - self hasTextualCoderViewModel ifFalse: [ ^ self ]. - self onTextualCoderViewModelChanged. - self onPostTextualCoderViewModelChanged -] - { #category : #initialization } GtTextualCoderElement >> initializeEditorListeners [ self editor From dc936466d6a66a9f1725fd5deaf0c8a6b376a158 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 26 Mar 2026 20:16:02 -0300 Subject: [PATCH 1215/1268] make `completion` instance variable optional [feenkcom/gtoolkit#5007] --- src/GToolkit-Coder-UI/GtTextualCoderElement.class.st | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st index 8f6ef056d..475c269c9 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st @@ -504,7 +504,10 @@ GtTextualCoderElement >> onTextualCoderViewModelChanged [ shortcuts := self textualCoderViewModel shortcuts copy. self editor addEditorShortcuts: shortcuts. - completion strategy: self textualCoderViewModel completionStrategy. + completion + ifNotNil: [ :aCompletion | + aCompletion strategy: self textualCoderViewModel completionStrategy ] + ifNil: [ editorElement completionStrategy: self textualCoderViewModel completionStrategy ]. self textualCoderViewModel compositeStyler ifNotNil: [ :aStyler | self styler: aStyler ] @@ -844,7 +847,7 @@ GtTextualCoderElement >> subscribeToTextualCoderViewModel [ self registerCoderModelAnnouncementsFor: self textualCoderViewModel coderModel. self registerCoderViewModelAnnouncementsFor: self textualCoderViewModel. - completion install + completion ifNotNil: #install ] { #category : #TODO } @@ -867,7 +870,7 @@ GtTextualCoderElement >> unsubscribeFromTextualCoderViewModel [ self textualCoderViewModel unsubscribe: self. self textualCoderViewModel coderModel unsubscribe: self. - completion uninstall. + completion ifNotNil: #uninstall. self editor removeEditorShortcuts: shortcuts ] From d3abe907ae941ebbfd8f5fe8bf19836860e0a527 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 27 Mar 2026 13:21:32 -0300 Subject: [PATCH 1216/1268] do not use `completion` instance variable [feenkcom/gtoolkit#5007] --- src/GToolkit-Coder-UI/GtTextualCoderElement.class.st | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st index 475c269c9..796c91c9b 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st @@ -22,11 +22,14 @@ Class { { #category : #accessing } GtTextualCoderElement class >> defaultCompletionControllerClass [ ^ DefaultCompletionControllerClass - ifNil: [ DefaultCompletionControllerClass := GtCompletionController ] ] { #category : #accessing } GtTextualCoderElement class >> defaultCompletionControllerClass: aCompletionController [ + self + deprecated: 'It is not possible to set completion controller in the new editor element, +therefore such settings will not be supported.'. + DefaultCompletionControllerClass := aCompletionController ] @@ -191,7 +194,8 @@ GtTextualCoderElement >> initialize [ self id: GtSourceCoderEditorId. shortcuts := #(). - completion := self class defaultCompletionControllerClass on: editorElement. + self class defaultCompletionControllerClass ifNotNil: [ :aClass | + editorElement completionControllerClass: aClass ]. evaluationHighlighter := GtSourceCoderEvaluationHighlighter new editorElement: self. @@ -870,7 +874,9 @@ GtTextualCoderElement >> unsubscribeFromTextualCoderViewModel [ self textualCoderViewModel unsubscribe: self. self textualCoderViewModel coderModel unsubscribe: self. - completion ifNotNil: #uninstall. + completion + ifNotNil: #uninstall + ifNil: [ editorElement resetCompletionStrategy ]. self editor removeEditorShortcuts: shortcuts ] From cf9bc4ec38eb1da78396cf67411a2b8c60db0f0c Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 27 Mar 2026 13:42:22 -0300 Subject: [PATCH 1217/1268] remove `#completionControllerClass:` [feenkcom/gtoolkit#5007] --- src/GToolkit-Coder-UI/GtTextualCoderElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st index 796c91c9b..4af2ea914 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st @@ -195,7 +195,7 @@ GtTextualCoderElement >> initialize [ shortcuts := #(). self class defaultCompletionControllerClass ifNotNil: [ :aClass | - editorElement completionControllerClass: aClass ]. + completion := aClass on: editorElement ]. evaluationHighlighter := GtSourceCoderEvaluationHighlighter new editorElement: self. From 2443f3f2da767e378a3569229b99bdf4985d8298 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Sun, 29 Mar 2026 10:42:44 -0300 Subject: [PATCH 1218/1268] fix `GtSourceCoderErrorAttribute` popup resizers[feenkcom/gtoolkit#5011] --- src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st index a6f884cb6..be47aa561 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderErrorAttribute.class.st @@ -23,7 +23,7 @@ GtSourceCoderErrorAttribute >> buildPopupIn: anEditorElement aptitude: aptitude | pane text textElement | pane := BrVerticalPane new. pane id: GtSourceCoderErrorContentElementId. - pane matchParent. + pane fitContentLimited. string lines do: [ :line | text := line asRopedText From 45de138e3e06aad748b6ba028923ea3a771d2231 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 31 Mar 2026 13:08:55 -0300 Subject: [PATCH 1219/1268] correct coder view model info item name --- src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 2182826ed..21b204736 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -376,7 +376,7 @@ GtTextualCoderViewModel >> gtInfo [ aStream nextPut: (#contextActions -> self contextActions). aStream nextPut: (#contextMenuActions -> self contextMenuActions). aStream nextPut: (#shortcuts -> self shortcuts). - aStream nextPut: (#attributes -> self extraTextAttributes). + aStream nextPut: (#extraTextAttributes -> self extraTextAttributes). aStream nextPut: (#hasFocus -> self focused). aStream nextPut: (#expanded -> self expanded). aStream nextPut: (#wantsHeader -> self wantsHeader) ] From 398b428dd6c4cc540d99ee6ab7f65b207510b7b4 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 31 Mar 2026 18:33:59 -0300 Subject: [PATCH 1220/1268] `GtTextualCoderTextAttributes` works also with `GtTextEditorElement` [feenkcom/gtoolkit#5007] --- .../GtTextualCoderElement.class.st | 21 +++++----- .../GtTextualCoderTextAttributes.class.st | 40 +++++++++++++++++++ .../GtTextualCoderViewModel.class.st | 5 ++- 3 files changed, 56 insertions(+), 10 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st index 4af2ea914..f4080e05c 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st @@ -605,19 +605,22 @@ GtTextualCoderElement >> onViewModelStylersChanged [ { #category : #'private - event handling' } GtTextualCoderElement >> onViewModelTextAttributesAdded: anAnnouncement [ - self enqueueTask: (BlTaskAction new action: [ - anAnnouncement text characters = self text characters - ifTrue: [ - anAnnouncement coderTextAttributes - applyOnEditorText: self text - from: anAnnouncement startPosition - to: anAnnouncement stopPosition ] ]) + self textualCoderViewModel = anAnnouncement textualCoderViewModel ifFalse: [ ^ self ]. + + self enqueueTask: (BlTaskAction new action: [ + anAnnouncement coderTextAttributes + applyOnEditorElement: editorElement + receivedText: anAnnouncement text + from: anAnnouncement startPosition + to: anAnnouncement stopPosition ]) ] { #category : #'private - event handling' } GtTextualCoderElement >> onViewModelTextAttributesRemoved: anAnnouncement [ - self enqueueTask: (BlTaskAction new action: [ - anAnnouncement coderTextAttributes removeFromEditorText: self text ]) + self textualCoderViewModel = anAnnouncement textualCoderViewModel ifFalse: [ ^ self ]. + + self enqueueTask: (BlTaskAction new action: [ + anAnnouncement coderTextAttributes removeFromEditorElement: editorElement ]) ] { #category : #'private - event handling' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st b/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st index 50c089c50..68edf4408 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st @@ -8,8 +8,30 @@ Class { #category : #'GToolkit-Coder-UI-Coder - Textual Model' } +{ #category : #'api - attribute' } +GtTextualCoderTextAttributes >> applyOnEditorElement: aTextEditorElement receivedText: aText from: aStartPosition to: anEndPosition [ + (aTextEditorElement isKindOf: BrEditorElement) + ifTrue: [ aText characters = aTextEditorElement text characters + ifTrue: [ self + applyOnEditorText: aTextEditorElement text + from: aStartPosition + to: anEndPosition ]. + ^ self ]. + + "We assume it is a GtTextEditorElement element. + I think the markerAttribute is simply ignored." + + self flag: #TODO. + aTextEditorElement addAttribute: markerAttribute from: aStartPosition to: anEndPosition. + textAttributes do: [ :eachAttribute | + aTextEditorElement addAttribute: eachAttribute from: aStartPosition to: anEndPosition ] +] + { #category : #'api - attribute' } GtTextualCoderTextAttributes >> applyOnEditorText: aText [ + "It is called from `GtTextualCoderViewModel>>#asEditorState` + and seems to be ok." + aText findAttribute: markerAttribute indicesDo: [ :aStartPosition :anEndPosition | @@ -18,6 +40,8 @@ GtTextualCoderTextAttributes >> applyOnEditorText: aText [ { #category : #'api - attribute' } GtTextualCoderTextAttributes >> applyOnEditorText: aText from: aStartPosition to: anEndPosition [ + "Can be used only on the BrEditorElement kind of editors. Not on GtTextEditorElement." + aText findAttribute: markerAttribute indicesDo: [ :aMarkerStartPosition :aMarkerEndPosition | @@ -36,8 +60,24 @@ GtTextualCoderTextAttributes >> markerAttribute: anObject [ markerAttribute := anObject ] +{ #category : #'api - attribute' } +GtTextualCoderTextAttributes >> removeFromEditorElement: aTextEditorElement [ + (aTextEditorElement isKindOf: BrEditorElement) + ifTrue: [ self removeFromEditorText: aTextEditorElement text. + ^ self ]. + + "We assume it is a GtTextEditorElement element." + self flag: #TODO. + + aTextEditorElement removeTextAttribute: markerAttribute. + textAttributes do: [ :eachAttribute | + aTextEditorElement removeTextAttribute: eachAttribute ] +] + { #category : #'api - attribute' } GtTextualCoderTextAttributes >> removeFromEditorText: aText [ + "Can be used only on the BrEditorElement kind of editors. Not on GtTextEditorElement." + aText removeAttributes: { self markerAttribute }, self textAttributes ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 21b204736..70b2e29ab 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -105,6 +105,7 @@ GtTextualCoderViewModel >> addTextAttributes: aCollectionOfTextAttributes onText extraTextAttributes add: newCoderTextAttributes. self announce: (GtTextualCoderViewModelTextAttributesAdded new + textualCoderViewModel: self; coderTextAttributes: newCoderTextAttributes; text: aText; startPosition: aStartPosition; @@ -623,7 +624,9 @@ GtTextualCoderViewModel >> removeCoderTextAttributes: aGtTextualCoderTextAttribu aCurrentText := self sourceText. aCurrentText removeAttributes: { aGtTextualCoderTextAttributes markerAttribute }, aGtTextualCoderTextAttributes textAttributes. - self announce: (GtTextualCoderViewModelTextAttributesRemoved new coderTextAttributes: aGtTextualCoderTextAttributes) + self announce: (GtTextualCoderViewModelTextAttributesRemoved new + textualCoderViewModel: self; + coderTextAttributes: aGtTextualCoderTextAttributes) ] { #category : #'api - shortcuts' } From ceb67acf771176d7fbdafe4c24b1a32011ed2672 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Wed, 1 Apr 2026 21:29:27 +0200 Subject: [PATCH 1221/1268] add documentId to the textual view model. menus should be created for that document id and propagate all the way to the api that adds attributes --- .../GtTextualCoderElement.class.st | 1 + .../GtTextualCoderTextAttributes.class.st | 42 +++++++++++++++---- .../GtTextualCoderViewModel.class.st | 16 ++++++- 3 files changed, 50 insertions(+), 9 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st index f4080e05c..257b490a5 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st @@ -466,6 +466,7 @@ GtTextualCoderElement >> onTextModifiedDueToEvent: aTextModifiedEvent [ self hasTextualCoderViewModel ifFalse: [ ^ self ]. self textualCoderViewModel + documentId: aTextModifiedEvent documentId; sourceText: self text from: self synchronously: true diff --git a/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st b/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st index 68edf4408..1aca65162 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st @@ -3,7 +3,10 @@ Class { #superclass : #Object, #instVars : [ 'markerAttribute', - 'textAttributes' + 'textAttributes', + 'textAttributeTags', + 'markerAttributeTag', + 'documentId' ], #category : #'GToolkit-Coder-UI-Coder - Textual Model' } @@ -22,9 +25,23 @@ GtTextualCoderTextAttributes >> applyOnEditorElement: aTextEditorElement receive I think the markerAttribute is simply ignored." self flag: #TODO. - aTextEditorElement addAttribute: markerAttribute from: aStartPosition to: anEndPosition. - textAttributes do: [ :eachAttribute | - aTextEditorElement addAttribute: eachAttribute from: aStartPosition to: anEndPosition ] + "Investigate what to do when documentId is nil. Can it even be nil here?" + self assert: [ documentId isNotNil ]. + + "From where does (aStartPosition to: anEndPosition) come from?" + self flag: #TODO. + markerAttributeTag := aTextEditorElement + addAttribute: markerAttribute + from: aStartPosition + to: anEndPosition + documentId: documentId. + + textAttributeTags := textAttributes collect: [ :eachAttribute | + aTextEditorElement + addAttribute: eachAttribute + from: aStartPosition + to: anEndPosition + documentId: documentId ] ] { #category : #'api - attribute' } @@ -50,6 +67,16 @@ GtTextualCoderTextAttributes >> applyOnEditorText: aText from: aStartPosition to aText attributes: { markerAttribute }, textAttributes from: aStartPosition to: anEndPosition ] +{ #category : #accessing } +GtTextualCoderTextAttributes >> documentId [ + ^ documentId +] + +{ #category : #accessing } +GtTextualCoderTextAttributes >> documentId: anObject [ + documentId := anObject +] + { #category : #accessing } GtTextualCoderTextAttributes >> markerAttribute [ ^ markerAttribute @@ -69,9 +96,10 @@ GtTextualCoderTextAttributes >> removeFromEditorElement: aTextEditorElement [ "We assume it is a GtTextEditorElement element." self flag: #TODO. - aTextEditorElement removeTextAttribute: markerAttribute. - textAttributes do: [ :eachAttribute | - aTextEditorElement removeTextAttribute: eachAttribute ] + textAttributeTags do: [ :eachTagToRemove | + aTextEditorElement removeAttributeTagged: eachTagToRemove overAdornment: markerAttributeTag ]. + + aTextEditorElement removeAttributeTagged: markerAttributeTag ] { #category : #'api - attribute' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 70b2e29ab..05399f026 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -15,7 +15,8 @@ Class { 'completionStrategy', 'debuggerInSpace', 'nodeAttributeMap', - 'history' + 'history', + 'documentId' ], #category : #'GToolkit-Coder-UI-Coder - Textual Model' } @@ -101,7 +102,8 @@ GtTextualCoderViewModel >> addTextAttributes: aCollectionOfTextAttributes onText newCoderTextAttributes := GtTextualCoderTextAttributes new markerAttribute: aMarkerAttribute; - textAttributes: aCollectionOfTextAttributes. + textAttributes: aCollectionOfTextAttributes; + documentId: documentId. extraTextAttributes add: newCoderTextAttributes. self announce: (GtTextualCoderViewModelTextAttributesAdded new @@ -354,6 +356,16 @@ GtTextualCoderViewModel >> cursors: aBrTextEditorCursor from: aSourceObject [ self notifyCursorsChanged: cursors from: aSourceObject ] +{ #category : #accessing } +GtTextualCoderViewModel >> documentId [ + ^ documentId +] + +{ #category : #accessing } +GtTextualCoderViewModel >> documentId: anObject [ + documentId := anObject +] + { #category : #accessing } GtTextualCoderViewModel >> elementClass [ ^ GtTextualCoderElement From f9b03971438b40d546a7bf3076910df326461c08 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Wed, 1 Apr 2026 21:45:37 +0200 Subject: [PATCH 1222/1268] initialize tags in coder text attributes with default values --- .../GtTextualCoderTextAttributes.class.st | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st b/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st index 1aca65162..b2b44e324 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st @@ -77,6 +77,14 @@ GtTextualCoderTextAttributes >> documentId: anObject [ documentId := anObject ] +{ #category : #'as yet unclassified' } +GtTextualCoderTextAttributes >> initialize [ + super initialize. + + markerAttributeTag := 0. + textAttributeTags := #() +] + { #category : #accessing } GtTextualCoderTextAttributes >> markerAttribute [ ^ markerAttribute From 4dd37b41423a606fe417247cc18598cc787a19dc Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 2 Apr 2026 00:59:35 -0300 Subject: [PATCH 1223/1268] add `documentId: anDocumentId` parameter to some methods [feenkcom/gtoolkit#5007] Particularly `GtTextualCoderViewModel>>#addTextAttributes:onText:from:to:documentId:` and similar `#addTextAttributes:*` methods. --- .../GtCoderViewModelRenameAction.class.st | 70 +++++++++++-------- ...GtSourceCoderInlineRenameShortcut.class.st | 2 + ...tSourceCoderRefactoringController.class.st | 13 +++- .../GtCoderDocumentIdDifferentSignal.class.st | 28 ++++++++ .../GtCoderDocumentIdIsNilSignal.class.st | 20 ++++++ .../GtCoderDocumentIdSignal.class.st | 5 ++ .../GtTextualCoderElement.class.st | 2 +- .../GtTextualCoderViewModel.class.st | 60 +++++++++++++++- 8 files changed, 167 insertions(+), 33 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderDocumentIdDifferentSignal.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderDocumentIdIsNilSignal.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderDocumentIdSignal.class.st diff --git a/src/GToolkit-Coder-AddOns/GtCoderViewModelRenameAction.class.st b/src/GToolkit-Coder-AddOns/GtCoderViewModelRenameAction.class.st index fe806b984..0317c830c 100644 --- a/src/GToolkit-Coder-AddOns/GtCoderViewModelRenameAction.class.st +++ b/src/GToolkit-Coder-AddOns/GtCoderViewModelRenameAction.class.st @@ -3,6 +3,7 @@ Class { #superclass : #GtAbstractRenameAction, #instVars : [ 'pharoSourceCoderViewModel', + 'documentId', 'originalCursors', 'coderAttributes', 'hasRefactoringPreview', @@ -22,40 +23,43 @@ GtCoderViewModelRenameAction class >> locations: aCollectionOfIntervals textualC { #category : #'private - attributes' } GtCoderViewModelRenameAction >> addRenameAttributes [ | text cursorInLocation | - - text := self pharoSourceCoderViewModel styledText ifNil: [ self pharoSourceCoderViewModel sourceText ]. + text := self pharoSourceCoderViewModel styledText + ifNil: [ self pharoSourceCoderViewModel sourceText ]. cursorInLocation := originalLocations - anySatisfy: [ :each | originalCursors anySatisfy: [ :eachCursor | eachCursor position between: each first - 1 and: each last ] ]. + anySatisfy: [ :each | + originalCursors + anySatisfy: [ :eachCursor | eachCursor position between: each first - 1 and: each last ] ]. coderAttributes := originalLocations - collect: [ :each | - | attribute | - attribute := (cursorInLocation not - or: [ originalCursors anySatisfy: [ :eachCursor | eachCursor position between: each first - 1 and: each last ] ]) - ifTrue: [ - GtRenameEditorAttribute new - action: self; - selectAll: selectAll; - filter: filter; - coordinateFocus: hasRefactoringPreview; - requestInitialFocus: requestInitialFocus; - text: (text from: each first to: each last) ] - ifFalse: [ - GtRenamePreviewAttribute new - action: self; - text: (text from: each first to: each last) ]. - cursorInLocation := true. - - self pharoSourceCoderViewModel - addTextAttribute: attribute - from: each first - to: each last ]. - - renameAttributes := coderAttributes flatCollect: [ :eachCoderAttribute | eachCoderAttribute textAttributes ]. + collect: [ :each | + | attribute | + attribute := (cursorInLocation not + or: [ originalCursors + anySatisfy: [ :eachCursor | eachCursor position between: each first - 1 and: each last ] ]) + ifTrue: [ GtRenameEditorAttribute new + action: self; + selectAll: selectAll; + filter: filter; + coordinateFocus: hasRefactoringPreview; + requestInitialFocus: requestInitialFocus; + text: (text from: each first to: each last) ] + ifFalse: [ GtRenamePreviewAttribute new + action: self; + text: (text from: each first to: each last) ]. + cursorInLocation := true. + self pharoSourceCoderViewModel + addTextAttribute: attribute + from: each first + to: each last + documentId: documentId ]. + + renameAttributes := coderAttributes + flatCollect: [ :eachCoderAttribute | eachCoderAttribute textAttributes ]. self - assert: [ (renameAttributes select: [ :each | each isKindOf: GtRenameEditorAttribute ]) size <= 1 ] + assert: [ (renameAttributes select: [ :each | each isKindOf: GtRenameEditorAttribute ]) + size <= 1 ] description: [ 'There must not be more than one editor attribute' ] ] @@ -64,6 +68,16 @@ GtCoderViewModelRenameAction >> allowSave [ pharoSourceCoderViewModel allowSaveDueTo: self ] +{ #category : #accessing } +GtCoderViewModelRenameAction >> documentId [ + ^ documentId +] + +{ #category : #accessing } +GtCoderViewModelRenameAction >> documentId: anObject [ + documentId := anObject +] + { #category : #accessing } GtCoderViewModelRenameAction >> hasRefactoringPreview [ ^ hasRefactoringPreview diff --git a/src/GToolkit-Coder-AddOns/GtSourceCoderInlineRenameShortcut.class.st b/src/GToolkit-Coder-AddOns/GtSourceCoderInlineRenameShortcut.class.st index edeb0c0c2..379e1167b 100644 --- a/src/GToolkit-Coder-AddOns/GtSourceCoderInlineRenameShortcut.class.st +++ b/src/GToolkit-Coder-AddOns/GtSourceCoderInlineRenameShortcut.class.st @@ -29,10 +29,12 @@ GtSourceCoderInlineRenameShortcut >> performOnEditor: aBrTextEditor element: aBr aSourceCoderViewModel coder renameAt: aSelectionInterval last in: aSourceCoderViewModel + documentId: aSourceCoderViewModel documentId for: aBrEditorElement ] orCursorStringPositionDo: [ :aCursorTextPosition | aSourceCoderViewModel coder renameAt: aCursorTextPosition in: aSourceCoderViewModel + documentId: aSourceCoderViewModel documentId for: aBrEditorElement ] ] diff --git a/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st b/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st index dcbdb1406..60b078761 100644 --- a/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st +++ b/src/GToolkit-Coder-AddOns/GtSourceCoderRefactoringController.class.st @@ -11,7 +11,8 @@ Class { 'originalSource', 'sourceCoderViewModel', 'refactoringPreviewAttributes', - 'element' + 'element', + 'documentId' ], #category : #'GToolkit-Coder-AddOns-! Core' } @@ -33,6 +34,16 @@ GtSourceCoderRefactoringController >> cleanUp [ self allowSave ] +{ #category : #accessing } +GtSourceCoderRefactoringController >> documentId [ + ^ documentId +] + +{ #category : #accessing } +GtSourceCoderRefactoringController >> documentId: anObject [ + documentId := anObject +] + { #category : #executing } GtSourceCoderRefactoringController >> execute [ [ self saveSource. diff --git a/src/GToolkit-Coder-UI/GtCoderDocumentIdDifferentSignal.class.st b/src/GToolkit-Coder-UI/GtCoderDocumentIdDifferentSignal.class.st new file mode 100644 index 000000000..383db0544 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderDocumentIdDifferentSignal.class.st @@ -0,0 +1,28 @@ +Class { + #name : #GtCoderDocumentIdDifferentSignal, + #superclass : #GtCoderDocumentIdSignal, + #instVars : [ + 'originalDocumentId', + 'receivedDocumentId' + ], + #category : #'GToolkit-Coder-UI-Signals' +} + +{ #category : #'api - text' } +GtCoderDocumentIdDifferentSignal >> originalDocumentId: aDocumentId [ + originalDocumentId := aDocumentId +] + +{ #category : #printing } +GtCoderDocumentIdDifferentSignal >> printOneLineContentsOn: aStream [ + aStream + nextPutAll: 'Original: '; + print: originalDocumentId; + nextPutAll: ', received: '; + print: receivedDocumentId +] + +{ #category : #'api - text' } +GtCoderDocumentIdDifferentSignal >> receivedDocumentId: aDocumentId [ + receivedDocumentId := aDocumentId +] diff --git a/src/GToolkit-Coder-UI/GtCoderDocumentIdIsNilSignal.class.st b/src/GToolkit-Coder-UI/GtCoderDocumentIdIsNilSignal.class.st new file mode 100644 index 000000000..91a62267d --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderDocumentIdIsNilSignal.class.st @@ -0,0 +1,20 @@ +Class { + #name : #GtCoderDocumentIdIsNilSignal, + #superclass : #GtCoderDocumentIdSignal, + #instVars : [ + 'originalDocumentId' + ], + #category : #'GToolkit-Coder-UI-Signals' +} + +{ #category : #'api - text' } +GtCoderDocumentIdIsNilSignal >> originalDocumentId: aDocumentId [ + originalDocumentId := aDocumentId +] + +{ #category : #printing } +GtCoderDocumentIdIsNilSignal >> printOneLineContentsOn: aStream [ + aStream + nextPutAll: 'Original: '; + print: originalDocumentId +] diff --git a/src/GToolkit-Coder-UI/GtCoderDocumentIdSignal.class.st b/src/GToolkit-Coder-UI/GtCoderDocumentIdSignal.class.st new file mode 100644 index 000000000..14f7de8b5 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderDocumentIdSignal.class.st @@ -0,0 +1,5 @@ +Class { + #name : #GtCoderDocumentIdSignal, + #superclass : #ContextStackSignal, + #category : #'GToolkit-Coder-UI-Signals' +} diff --git a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st index 257b490a5..cae51052f 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st @@ -833,7 +833,7 @@ GtTextualCoderElement >> showScrollbars [ { #category : #private } GtTextualCoderElement >> styleText [ - self editor styleText + self editor requestManualStyling ] { #category : #private } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 05399f026..c44e4c13d 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -62,44 +62,98 @@ GtTextualCoderViewModel >> addStylers: aCollectionOfGtCoderStyler [ { #category : #'api - text' } GtTextualCoderViewModel >> addTextAttribute: aTextAttribute from: aStartPosition to: anEndPosition [ + + self deprecated: 'Use addTextAttribute:from:to:documentId: instead.'. + + ^ self + addTextAttribute: aTextAttribute + from: aStartPosition + to: anEndPosition + documentId: documentId +] + +{ #category : #'api - text' } +GtTextualCoderViewModel >> addTextAttribute: aTextAttribute from: aStartPosition to: anEndPosition documentId: aDocumentId [ ^ self - addTextAttributes: { aTextAttribute } + addTextAttributes: {aTextAttribute} from: aStartPosition to: anEndPosition + documentId: aDocumentId ] { #category : #'api - text' } GtTextualCoderViewModel >> addTextAttribute: aTextAttribute onText: aText from: aStartPosition to: anEndPosition [ + self deprecated: 'Use addTextAttribute:onText:from:to:documentId: instead'. + ^ self - addTextAttributes: { aTextAttribute } + addTextAttribute: aTextAttribute onText: aText from: aStartPosition to: anEndPosition + documentId: documentId +] + +{ #category : #'api - text' } +GtTextualCoderViewModel >> addTextAttribute: aTextAttribute onText: aText from: aStartPosition to: anEndPosition documentId: aDocumentId [ + + ^ self + addTextAttributes: {aTextAttribute} + onText: aText + from: aStartPosition + to: anEndPosition + documentId: aDocumentId ] { #category : #'api - text' } GtTextualCoderViewModel >> addTextAttributes: aCollectionOfTextAttributes from: aStartPosition to: anEndPosition [ + self deprecated: 'Use addTextAttributes:from:to:documentId: instead'. + + ^ self + addTextAttributes: aCollectionOfTextAttributes + from: aStartPosition + to: anEndPosition + documentId: documentId +] + +{ #category : #'api - text' } +GtTextualCoderViewModel >> addTextAttributes: aCollectionOfTextAttributes from: aStartPosition to: anEndPosition documentId: aDocumentId [ + ^ self addTextAttributes: aCollectionOfTextAttributes onText: self sourceText from: aStartPosition to: anEndPosition + documentId: aDocumentId ] { #category : #'api - text' } -GtTextualCoderViewModel >> addTextAttributes: aCollectionOfTextAttributes onText: aText from: aStartPosition to: anEndPosition [ +GtTextualCoderViewModel >> addTextAttributes: aCollectionOfTextAttributes onText: aText from: aStartPosition to: anEndPosition documentId: aDocumentId [ | aMarkerAttribute newCoderTextAttributes | + "If documentId is different, do nothing." + self flag: #TODO. + aDocumentId ifNil: [ + GtCoderDocumentIdIsNilSignal new + originalDocumentId: documentId; + emit ]. + aDocumentId = documentId ifFalse: [ + GtCoderDocumentIdDifferentSignal new + originalDocumentId: documentId; + receivedDocumentId: aDocumentId; + emit ]. + aMarkerAttribute := BrTextInvisibleMarkerAttribute new beNotOverwritableByStyler. "we change the sourceText directly to not trigger the styler recomputation" aText attribute: aMarkerAttribute from: aStartPosition to: anEndPosition. + "Pass aDocumentId, once it circulates properly." + self flag: #TODO. newCoderTextAttributes := GtTextualCoderTextAttributes new markerAttribute: aMarkerAttribute; textAttributes: aCollectionOfTextAttributes; From 1253215b2b5a9d19ac254dd25e39aa112f52e1db Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 2 Apr 2026 11:21:57 +0200 Subject: [PATCH 1224/1268] move baseline of gtoolkit-editor to coder --- .../BaselineOfGToolkitCoder.class.st | 99 ++++++++----------- ...rElementWithRustTextEditorStencil.class.st | 16 +++ ...SourceCoderExpandedContentElement.class.st | 5 + .../GtTextualCoderElement.class.st | 33 +++++++ .../GtTextualCoderTextAttributes.class.st | 2 +- 5 files changed, 98 insertions(+), 57 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtExpandedCoderElementWithRustTextEditorStencil.class.st diff --git a/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st b/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st index c86a8dd18..a3e664be7 100644 --- a/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st +++ b/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st @@ -30,61 +30,48 @@ Class { { #category : #baseline } BaselineOfGToolkitCoder >> baseline: spec [ - - spec for: #common do: [ - spec - baseline: 'Futures' - with: [ - spec repository: 'github://feenkcom/pharo-futures:main/src' ]; - baseline: 'GToolkitBasicUtility' - with: [ - spec repository: 'github://feenkcom/gtoolkit-utility:main/src' ]; - baseline: 'GToolkitAnnouncerUtility' - with: [ - spec repository: 'github://feenkcom/gtoolkit-utility:main/src' ]; - baseline: 'GToolkitNotifications' - with: [ - spec repository: 'github://feenkcom/gtoolkit-notifications:main/src' ]; - baseline: 'GToolkitPager' - with: [ - spec repository: 'github://feenkcom/gtoolkit-pager:main/src' ]; - baseline: 'GToolkitCompleter' - with: [ - spec repository: 'github://feenkcom/gtoolkit-completer:main/src' ]; - baseline: 'GToolkit4Magritte' - with: [ - spec repository: 'github://feenkcom/gt4magritte:main/src' ]. - - spec - package: 'GToolkit-VariableBindings'; - - package: 'GToolkit-SearchFilters' with: [ - spec requires: #('Futures') ]; - package: 'GToolkit-SearchFilters-PhlowTool' with: [ - spec requires: #('GToolkit-SearchFilters' 'GToolkitPager') ]; - - package: 'GToolkit-Coder-StreamingCoders' with: [ - spec requires: #('Futures' 'GToolkit-SearchFilters') ]; - package: 'GToolkit-Coder-StreamingCoders-UI' with: [ - spec requires: #('Futures' 'GToolkit-Coder-StreamingCoders') ]; - - package: 'GToolkit-Coder' with: [ - spec requires: - #('Futures' 'GToolkitBasicUtility' 'GToolkitAnnouncerUtility' - 'GToolkitPager' 'GToolkitCompleter' 'GToolkit-SearchFilters' ) ]; - package: 'GToolkit-Coder-UI' with: [ - spec requires: #( 'GToolkit-Coder' 'GToolkit-VariableBindings' - 'GToolkitBasicUtility' 'GToolkitPager' 'GToolkitNotifications' - 'GToolkit4Magritte' ) ]; - package: 'GToolkit-Coder-AddOns' - with: [ spec requires: #( 'GToolkit-Coder' 'GToolkit-Coder-UI' ) ]; - package: 'GToolkit-Coder-Extensions' with: [ - spec requires: - #( 'GToolkit-Coder' 'GToolkit-Coder-UI' 'GToolkit-Coder-AddOns' ) ]; - package: 'GToolkit-Coder-Examples-SystemS1'; - package: 'GToolkit-Coder-Examples' with: [ - spec requires: - #( 'GToolkit-Coder' 'GToolkit-Coder-UI' 'GToolkit-Coder-AddOns' - 'GToolkit-Coder-Examples-SystemS1' 'GToolkit4Magritte' ) ] ] + spec + for: #common + do: [ spec + baseline: 'Futures' + with: [ spec repository: 'github://feenkcom/pharo-futures:main/src' ]; + baseline: 'GToolkitBasicUtility' + with: [ spec repository: 'github://feenkcom/gtoolkit-utility:main/src' ]; + baseline: 'GToolkitAnnouncerUtility' + with: [ spec repository: 'github://feenkcom/gtoolkit-utility:main/src' ]; + baseline: 'GToolkitNotifications' + with: [ spec repository: 'github://feenkcom/gtoolkit-notifications:main/src' ]; + baseline: 'GToolkitPager' + with: [ spec repository: 'github://feenkcom/gtoolkit-pager:main/src' ]; + baseline: 'GToolkitCompleter' + with: [ spec repository: 'github://feenkcom/gtoolkit-completer:main/src' ]; + baseline: 'GToolkit4Magritte' + with: [ spec repository: 'github://feenkcom/gt4magritte:main/src' ]; + baseline: 'GToolkitEditor' + with: [ spec repository: 'github://feenkcom/gtoolkit-editor:main/src' ]. + + spec + package: 'GToolkit-VariableBindings'; + package: 'GToolkit-SearchFilters' with: [ spec requires: #('Futures') ]; + package: 'GToolkit-SearchFilters-PhlowTool' + with: [ spec requires: #('GToolkit-SearchFilters' 'GToolkitPager') ]; + package: 'GToolkit-Coder-StreamingCoders' + with: [ spec requires: #('Futures' 'GToolkit-SearchFilters') ]; + package: 'GToolkit-Coder-StreamingCoders-UI' + with: [ spec requires: #('Futures' 'GToolkit-Coder-StreamingCoders') ]; + package: 'GToolkit-Coder' + with: [ spec + requires: #('Futures' 'GToolkitBasicUtility' 'GToolkitAnnouncerUtility' 'GToolkitPager' 'GToolkitCompleter' 'GToolkit-SearchFilters') ]; + package: 'GToolkit-Coder-UI' + with: [ spec + requires: #('GToolkit-Coder' 'GToolkit-VariableBindings' 'GToolkitBasicUtility' 'GToolkitPager' 'GToolkitNotifications' 'GToolkit4Magritte' 'GToolkitEditor') ]; + package: 'GToolkit-Coder-AddOns' + with: [ spec requires: #('GToolkit-Coder' 'GToolkit-Coder-UI') ]; + package: 'GToolkit-Coder-Extensions' + with: [ spec requires: #('GToolkit-Coder' 'GToolkit-Coder-UI' 'GToolkit-Coder-AddOns') ]; + package: 'GToolkit-Coder-Examples-SystemS1'; + package: 'GToolkit-Coder-Examples' + with: [ spec + requires: #('GToolkit-Coder' 'GToolkit-Coder-UI' 'GToolkit-Coder-AddOns' 'GToolkit-Coder-Examples-SystemS1' 'GToolkit4Magritte') ] ] ] diff --git a/src/GToolkit-Coder-UI/GtExpandedCoderElementWithRustTextEditorStencil.class.st b/src/GToolkit-Coder-UI/GtExpandedCoderElementWithRustTextEditorStencil.class.st new file mode 100644 index 000000000..405a89604 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtExpandedCoderElementWithRustTextEditorStencil.class.st @@ -0,0 +1,16 @@ +Class { + #name : #GtExpandedCoderElementWithRustTextEditorStencil, + #superclass : #GtCoderElementStencil, + #category : #'GToolkit-Coder-UI-Coder - Source' +} + +{ #category : #'api - instantiation' } +GtExpandedCoderElementWithRustTextEditorStencil >> defaultElement [ + + ^ GtSourceCoderExpandedContentElement new + initializeEditorElement: (GtTextEditorElement new + defaultFontName: 'Source Code Pro'; + defaultFontSize: 14; + defaultForeground: Color black; + yourself) +] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st index 558afdcaa..a7563dc63 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderExpandedContentElement.class.st @@ -46,6 +46,11 @@ GtSourceCoderExpandedContentElement >> initialize [ self addAptitude: (BrLayoutResizerAptitude new inherit: editorElement) ] +{ #category : #initialization } +GtSourceCoderExpandedContentElement >> initializeEditorElement: anElement [ + editorElement initializeEditorElement: anElement +] + { #category : #'instance creation' } GtSourceCoderExpandedContentElement >> newActionsElement [ ^ GtSourceCoderActionsElement new diff --git a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st index cae51052f..c1bd8d714 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st @@ -224,6 +224,39 @@ GtTextualCoderElement >> initialize [ whenPending: [ :anEditorElement | ] ] ] +{ #category : #initialization } +GtTextualCoderElement >> initializeEditorElement: aNewEditorElement [ + | anOldEditor | + self assert: [ aNewEditorElement isKindOf: GtTextEditorElement ]. + + anOldEditor := editorElement. + editorElement := aNewEditorElement. + self + replaceChild: anOldEditor + with: editorElement + as: GtSourceCoderEditorInnerId. + + aNewEditorElement + aptitude: BrGlamorousCodeEditorAptitude; + addAptitude: (BrGlamorousWithExplicitContextMenuAptitude menu: [ self createContextMenu ]); + padding: BlInsets empty. + + completion ifNotNil: [ :aCompletion | + aCompletion uninstall. + completion := nil ]. + + self initializeEditorListeners. + + "I think this can be removed once `BrTextEditorModificationEvent` works." + self editor + when: BrTextEditorModifiedEvent + do: [ :anEvent | self onTextModifiedDueToEvent: anEvent ]. + + self hasTextualCoderViewModel ifFalse: [ ^ self ]. + self onTextualCoderViewModelChanged. + self onPostTextualCoderViewModelChanged +] + { #category : #initialization } GtTextualCoderElement >> initializeEditorListeners [ self editor diff --git a/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st b/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st index b2b44e324..4c603e25c 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st @@ -105,7 +105,7 @@ GtTextualCoderTextAttributes >> removeFromEditorElement: aTextEditorElement [ self flag: #TODO. textAttributeTags do: [ :eachTagToRemove | - aTextEditorElement removeAttributeTagged: eachTagToRemove overAdornment: markerAttributeTag ]. + aTextEditorElement removeAttributeTagged: eachTagToRemove overMarker: markerAttributeTag ]. aTextEditorElement removeAttributeTagged: markerAttributeTag ] From d7698ff89d7e602fb555a75c36c9b78eb819930a Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 2 Apr 2026 11:25:49 +0200 Subject: [PATCH 1225/1268] use range based api when adding attributes --- .../GtTextualCoderTextAttributes.class.st | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st b/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st index 4c603e25c..91ce22d19 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st @@ -13,6 +13,7 @@ Class { { #category : #'api - attribute' } GtTextualCoderTextAttributes >> applyOnEditorElement: aTextEditorElement receivedText: aText from: aStartPosition to: anEndPosition [ + | attributesRange | (aTextEditorElement isKindOf: BrEditorElement) ifTrue: [ aText characters = aTextEditorElement text characters ifTrue: [ self @@ -30,18 +31,20 @@ GtTextualCoderTextAttributes >> applyOnEditorElement: aTextEditorElement receive "From where does (aStartPosition to: anEndPosition) come from?" self flag: #TODO. + + attributesRange := GtTextEditorCharacterRange + start: aStartPosition + end: anEndPosition + documentId: documentId. + markerAttributeTag := aTextEditorElement addAttribute: markerAttribute - from: aStartPosition - to: anEndPosition - documentId: documentId. + range: attributesRange. textAttributeTags := textAttributes collect: [ :eachAttribute | aTextEditorElement addAttribute: eachAttribute - from: aStartPosition - to: anEndPosition - documentId: documentId ] + range: attributesRange ] ] { #category : #'api - attribute' } From 0be7f669856d7cbf225b396d6345a96af58276c3 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 2 Apr 2026 11:27:47 +0200 Subject: [PATCH 1226/1268] rename to addAttribute:overRange: --- src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st b/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st index 91ce22d19..eaa55c641 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st @@ -39,12 +39,12 @@ GtTextualCoderTextAttributes >> applyOnEditorElement: aTextEditorElement receive markerAttributeTag := aTextEditorElement addAttribute: markerAttribute - range: attributesRange. + overRange: attributesRange. textAttributeTags := textAttributes collect: [ :eachAttribute | aTextEditorElement addAttribute: eachAttribute - range: attributesRange ] + overRange: attributesRange ] ] { #category : #'api - attribute' } From 7ed52077ac3987cf5fda89ba1f7e3e5d64ee9e6b Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 2 Apr 2026 13:47:39 +0200 Subject: [PATCH 1227/1268] pass a marker attribute when removing attributes over the marker --- src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st b/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st index eaa55c641..f2f1c6acf 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st @@ -108,7 +108,7 @@ GtTextualCoderTextAttributes >> removeFromEditorElement: aTextEditorElement [ self flag: #TODO. textAttributeTags do: [ :eachTagToRemove | - aTextEditorElement removeAttributeTagged: eachTagToRemove overMarker: markerAttributeTag ]. + aTextEditorElement removeAttributeTagged: eachTagToRemove overMarker: markerAttribute ]. aTextEditorElement removeAttributeTagged: markerAttributeTag ] From 3b7a444b50b7f767d91d9d55bd42dcb32ded492c Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 2 Apr 2026 12:31:36 -0300 Subject: [PATCH 1228/1268] add `GtTextualCoderTextAttributes` views [feenkcom/gtoolkit#5007] --- .../GtTextualCoderTextAttributes.class.st | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st b/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st index f2f1c6acf..c01adb953 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st @@ -80,6 +80,31 @@ GtTextualCoderTextAttributes >> documentId: anObject [ documentId := anObject ] +{ #category : #'gt - extensions' } +GtTextualCoderTextAttributes >> gtAttributes [ + textAttributes ifNil: [ ^ #() ]. + ^ Array + new: textAttributes size + 1 + streamContents: [ :aStream | + aStream nextPut: markerAttributeTag -> markerAttribute. + textAttributes + withIndexDo: [ :anAttribute :anIndex | + | aTag | + aTag := textAttributeTags at: anIndex ifAbsent: [ nil ]. + aStream nextPut: aTag -> anAttribute ] ] +] + +{ #category : #'gt - extensions' } +GtTextualCoderTextAttributes >> gtAttributesFor: aView [ + + ^ aView columnedList + title: 'Attributes'; + items: [ self gtAttributes ]; + column: 'Tag' text: #key width: 60; + column: 'Attribute' text: #value; + send: #value +] + { #category : #'as yet unclassified' } GtTextualCoderTextAttributes >> initialize [ super initialize. @@ -98,6 +123,15 @@ GtTextualCoderTextAttributes >> markerAttribute: anObject [ markerAttribute := anObject ] +{ #category : #printing } +GtTextualCoderTextAttributes >> printOn: aStream [ + super printOn: aStream. + aStream + nextPut: $(; + print: documentId; + nextPut: $) +] + { #category : #'api - attribute' } GtTextualCoderTextAttributes >> removeFromEditorElement: aTextEditorElement [ (aTextEditorElement isKindOf: BrEditorElement) From 082a98d0a56ee9646187296296d3e8601899d5ee Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 2 Apr 2026 16:27:45 -0300 Subject: [PATCH 1229/1268] use async futures to compute coder context menu --- .../GtTextualCoderEditorElement.class.st | 35 +++++++++++++------ .../GtTextualCoderElement.class.st | 31 +++++++++++----- 2 files changed, 48 insertions(+), 18 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 1e0361d3c..ff41ae7df 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -10,7 +10,8 @@ Class { 'shortcuts', 'cursorsUpdater', 'textUpdater', - 'addOnsElementFuture' + 'addOnsElementFuture', + 'menuItemsElementFuture' ], #category : #'GToolkit-Coder-UI-Coder - Textual' } @@ -66,12 +67,12 @@ GtTextualCoderEditorElement >> createContextMenu [ "wait for the addons to be computed" - | aMenu aMenuItemsPromise | + | aMenu aMenuItemsFuture | aMenu := BrMenuItems new. aMenu beGroupedElementType. - aMenuItemsPromise := self textualCoderViewModel addOns - asyncThen: [ :theAddOns | + aMenuItemsFuture := self textualCoderViewModel addOnsFuture + map: [ :theAddOns | | theItems theContextMenuAstAddons theMenuItems | "extra context menu items that depend on ast and view model state such as selection" theContextMenuAstAddons := self textualCoderViewModel @@ -83,13 +84,11 @@ GtTextualCoderEditorElement >> createContextMenu [ collect: [ :eachAction | eachAction asBrMenuItemForCoderElement: self ] thenReject: #isNil. - self enqueueTask: (BlTaskAction new - action: [ - aMenu items: theMenuItems ]) ]. + aMenu -> theMenuItems ]. + + menuItemsElementFuture future: aMenuItemsFuture. - self enqueueTask: (BlPromiseTask new promise: aMenuItemsPromise). - - ^ aMenu + ^ aMenu ] { #category : #initialization } @@ -157,6 +156,13 @@ GtTextualCoderEditorElement >> initialize [ self textualCoderViewModel onAddOnsChanged: theAddOns ]; whenError: [ :anEditorElement :anError | self onAddOnsError: anError ]. + + menuItemsElementFuture := (BrAsyncElementFuture on: self) + executionConfiguration: (GtSingleCoderViewModel methodAddOnsExecutionConfiguration); + whenSuccess: [ :anEditorElement :anAssoc | + anAssoc key items: anAssoc value ]; + whenError: [ :anEditorElement :anError | + self onContextMenuError: anError ]. self initializeListeners. @@ -249,6 +255,15 @@ GtTextualCoderEditorElement >> onCoderViewModelFocused: aBoolean [ ifFalse: [ self loseFocus ] ] +{ #category : #initialization } +GtTextualCoderEditorElement >> onContextMenuError: anError [ + anError emit. + NonInteractiveTranscript stderr + show: '[GtTextualCoderEditorElement>>#onContextMenuError:] '; + show: anError; + newLine +] + { #category : #'private - event handling' } GtTextualCoderEditorElement >> onFocusChangedAnnouncement: anAnnouncement [ anAnnouncement source == self ifTrue: [ ^ self ]. diff --git a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st index c1bd8d714..e34401176 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st @@ -11,7 +11,8 @@ Class { 'cursorsUpdater', 'textUpdater', 'addOnsElementFuture', - 'editorElement' + 'editorElement', + 'menuItemsElementFuture' ], #classVars : [ 'DefaultCompletionControllerClass' @@ -84,12 +85,12 @@ GtTextualCoderElement >> createContextMenu [ "wait for the addons to be computed" - | aMenu aMenuItemsPromise | + | aMenu aMenuItemsFuture | aMenu := BrMenuItems new. aMenu beGroupedElementType. - aMenuItemsPromise := self textualCoderViewModel addOns - asyncThen: [ :theAddOns | + aMenuItemsFuture := self textualCoderViewModel addOnsFuture + map: [ :theAddOns | | theItems theContextMenuAstAddons theMenuItems | "extra context menu items that depend on ast and view model state such as selection" theContextMenuAstAddons := self textualCoderViewModel @@ -101,11 +102,9 @@ GtTextualCoderElement >> createContextMenu [ collect: [ :eachAction | eachAction asBrMenuItemForCoderElement: self ] thenReject: #isNil. - self enqueueTask: (BlTaskAction new - action: [ - aMenu items: theMenuItems ]) ]. + aMenu -> theMenuItems ]. - self enqueueTask: (BlPromiseTask new promise: aMenuItemsPromise). + menuItemsElementFuture future: aMenuItemsFuture. ^ aMenu ] @@ -214,6 +213,13 @@ GtTextualCoderElement >> initialize [ whenSuccess: [ :anEditorElement :theAddOns | self textualCoderViewModel onAddOnsChanged: theAddOns ]; whenError: [ :anEditorElement :anError | self onAddOnsError: anError ]. + menuItemsElementFuture := (BrAsyncElementFuture on: self) + executionConfiguration: (GtSingleCoderViewModel methodAddOnsExecutionConfiguration); + whenSuccess: [ :anEditorElement :anAssoc | + anAssoc key items: anAssoc value ]; + whenError: [ :anEditorElement :anError | + self onContextMenuError: anError ]. + self initializeListeners. self @@ -354,6 +360,15 @@ GtTextualCoderElement >> onCoderViewModelFocused: aBoolean [ ifFalse: [ self loseFocus ] ] +{ #category : #initialization } +GtTextualCoderElement >> onContextMenuError: anError [ + anError emit. + NonInteractiveTranscript stderr + show: '[GtTextualCoderElement>>#onContextMenuError:] '; + show: anError; + newLine +] + { #category : #'private - event handling' } GtTextualCoderElement >> onFocusChangedAnnouncement: anAnnouncement [ anAnnouncement source == self ifTrue: [ ^ self ]. From 9c835cf62ead1e526696e62e103792c55c68642d Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 9 Apr 2026 04:20:29 -0400 Subject: [PATCH 1230/1268] do not signal documentId that often [feenkcom/gtoolkit#5007] --- .../GtTextualCoderViewModel.class.st | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index c44e4c13d..6acae1a06 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -137,15 +137,18 @@ GtTextualCoderViewModel >> addTextAttributes: aCollectionOfTextAttributes onText "If documentId is different, do nothing." self flag: #TODO. - aDocumentId ifNil: [ - GtCoderDocumentIdIsNilSignal new - originalDocumentId: documentId; - emit ]. - aDocumentId = documentId ifFalse: [ - GtCoderDocumentIdDifferentSignal new - originalDocumentId: documentId; - receivedDocumentId: aDocumentId; - emit ]. + documentId ifNotNil: [ + aDocumentId + ifNil: [ + GtCoderDocumentIdIsNilSignal new + originalDocumentId: documentId; + emit ] + ifNotNil: [ + aDocumentId = documentId ifFalse: [ + GtCoderDocumentIdDifferentSignal new + originalDocumentId: documentId; + receivedDocumentId: aDocumentId; + emit ] ] ]. aMarkerAttribute := BrTextInvisibleMarkerAttribute new beNotOverwritableByStyler. From 8f56937518913a456fe4159bc4c4324fd0d7e43c Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 10 Apr 2026 17:03:59 -0400 Subject: [PATCH 1231/1268] add copy class as lepiter link context menu action --- src/GToolkit-Coder-UI/Class.extension.st | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/Class.extension.st b/src/GToolkit-Coder-UI/Class.extension.st index aab34b2a0..4a5469322 100644 --- a/src/GToolkit-Coder-UI/Class.extension.st +++ b/src/GToolkit-Coder-UI/Class.extension.st @@ -120,10 +120,23 @@ Class >> gtCoderSidebarIndexCopyClassNameFor: anAction [ icon: BrGlamorousVectorIcons clipboard; label: ('Copy {1} name' format: {self gtCoderTypeName}); menuItemPreview: self name; - menuItemGroup: BrMenuItemGroupConfiguration default; + menuItemGroup: BrMenuItemGroupConfiguration editing; action: [ Clipboard clipboardText: self name ] ] +{ #category : #'*GToolkit-Coder-UI' } +Class >> gtCoderSidebarIndexCopyClassNameForLepiterFor: anAction [ + + ^ anAction button + priority: 10; + target: GtCoderClassTarget; + icon: BrGlamorousVectorIcons clipboard; + label: 'Copy lepiter link'; + menuItemPreview: [ '\{\{gtClass:{1}\}\}' format: {self name} ]; + menuItemGroup: BrMenuItemGroupConfiguration editing; + action: [ Clipboard clipboardText: ('\{\{gtClass:{1}\}\}' format: {self name}) ] +] + { #category : #'*GToolkit-Coder-UI' } Class >> gtCoderSidebarIndexNewSubclassFor: anAction [ From 41d9cc92f37ef326424043b710e056ac1f6bf492 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 14 Apr 2026 11:12:34 -0400 Subject: [PATCH 1232/1268] new subclass context menu form should consider the context menu's class, not the navigation selected class [feenkcom/gtoolkit#5028] --- src/GToolkit-Coder-UI/Class.extension.st | 3 +- .../GtCoderNavigationTabsStencil.class.st | 83 ++++++++++++++++--- 2 files changed, 74 insertions(+), 12 deletions(-) diff --git a/src/GToolkit-Coder-UI/Class.extension.st b/src/GToolkit-Coder-UI/Class.extension.st index 4a5469322..38690d6c5 100644 --- a/src/GToolkit-Coder-UI/Class.extension.st +++ b/src/GToolkit-Coder-UI/Class.extension.st @@ -155,10 +155,11 @@ Class >> gtCoderSidebarIndexNewSubclassFor: anAction [ GtCoderNavigationTabsStencil new pragmaName: #gtCoderDropdownNavigation; navigationModel: aNavigationModel; + classOfInterest: self; gtCreationInterface: aButton ] ifAbsent: [ BrLabel new aptitude: BrGlamorousLabelAptitude new; - text: 'Currently not available from lepiter'; + text: 'Currently not available in this context menu'; constraintsDo: [ :c | c linear horizontal alignCenter. c linear vertical alignCenter ] ]. diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st index 3b60595cd..abc8d03fb 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationTabsStencil.class.st @@ -5,7 +5,10 @@ Class { 'navigations', 'navigationModel', 'formCache', - 'pragmaName' + 'pragmaName', + 'classOfInterest', + 'packageOfInterest', + 'packageTagOfInterest' ], #classVars : [ 'DisplayFullDropdownNavigation' @@ -87,6 +90,38 @@ GtCoderNavigationTabsStencil >> assertNavigationView: aNavigationView [ description: [ 'Navigation must be kind of ', GtPhlowView name ]. ] +{ #category : #navigation } +GtCoderNavigationTabsStencil >> classOfInterest [ + ^ classOfInterest +] + +{ #category : #'as yet unclassified' } +GtCoderNavigationTabsStencil >> classOfInterest: aClass [ + "Consider this class instead of the navigation model selected class." + + classOfInterest := aClass +] + +{ #category : #navigation } +GtCoderNavigationTabsStencil >> consideredClassDo: aBlock [ + self classOfInterest ifNotNil: [ :aClass | ^ aBlock value: aClass ]. + ^ navigationModel selectedClassDo: aBlock +] + +{ #category : #navigation } +GtCoderNavigationTabsStencil >> consideredPackageDo: aBlock [ + self packageOfInterest ifNotNil: [ :aPackage | ^ aBlock value: aPackage ]. + self classOfInterest ifNotNil: [ :aClass | ^ aBlock value: aClass package ]. + ^ navigationModel selectedPackageDo: aBlock +] + +{ #category : #navigation } +GtCoderNavigationTabsStencil >> consideredPackageTagDo: aBlock [ + self packageTagOfInterest ifNotNil: [ :aPackageTag | ^ aBlock value: aPackageTag ]. + self classOfInterest ifNotNil: [ :aClass | ^ aBlock value: aClass packageTag ]. + ^ navigationModel selectedTagDo: aBlock +] + { #category : #'api - instantiation' } GtCoderNavigationTabsStencil >> create [ @@ -173,27 +208,29 @@ GtCoderNavigationTabsStencil >> gtCreationInterface: anElement [ addTab: (BrTab new aptitude: BrGlamorousTabAptitude new; label: eachTabClass componentName; + addAptitude: (GtPhlowBrowseDefinitionAptitude new definition: [ eachTabClass ]); stencil: [ (self formCache at: eachTabClass ifAbsentPut: [ | form | form := eachTabClass new - onReset: [ anElement - inUIProcessDo: [ anElement fireEvent: BrDropdownHideWish new. + onReset: [ BlTaskAction + enqueueElement: anElement + action: [ anElement fireEvent: BrDropdownHideWish new. self formCache removeKey: eachTabClass ] ]. - navigationModel - selectedClassDo: [ :aClass | form fillFormWithClass: aClass ]. + self consideredClassDo: [ :aClass | form fillFormWithClass: aClass ]. form hasPackageAndTag - ifTrue: [ navigationModel - selectedPackageDo: [ :aPackage | form packageAndTagName packageName: aPackage name ]. - navigationModel - selectedTagDo: [ :aTag | + ifTrue: [ self + consideredPackageDo: [ :aPackage | form packageAndTagName packageName: aPackage name ]. + self + consideredPackageTagDo: [ :aTag | aTag isPharoPackageTagModel ifTrue: [ aTag isRoot ifFalse: [ form packageAndTagName tagName: aTag name ] ] ifFalse: [ aTag isUncategorized ifFalse: [ form packageAndTagName tagName: aTag name ] ] ] ]. ((GtCreationFormWidget forForm: form) onAccept: [ :anInstance | - anElement - inUIProcessDo: [ form selectInNavigationModel: navigationModel anInstance: anInstance. + BlTaskAction + enqueueElement: anElement + action: [ form selectInNavigationModel: navigationModel anInstance: anInstance. anElement fireEvent: BrDropdownHideWish new ]. self formCache removeKey: eachTabClass ifAbsent: [ ] ]) asElement ]) removeFromParent ]) ]. @@ -263,6 +300,30 @@ GtCoderNavigationTabsStencil >> navigations: anArrayOfPhlowViews [ navigations := anArrayOfPhlowViews ] +{ #category : #navigation } +GtCoderNavigationTabsStencil >> packageOfInterest [ + ^ packageOfInterest +] + +{ #category : #navigation } +GtCoderNavigationTabsStencil >> packageOfInterest: aPackage [ + "Consider this package instead of the navigation model selected package." + + packageOfInterest := aPackage +] + +{ #category : #navigation } +GtCoderNavigationTabsStencil >> packageTagOfInterest [ + ^ packageTagOfInterest +] + +{ #category : #navigation } +GtCoderNavigationTabsStencil >> packageTagOfInterest: aPackageTag [ + "Consider this package tag instead of the navigation model selected package tag." + + packageTagOfInterest := aPackageTag +] + { #category : #accessing } GtCoderNavigationTabsStencil >> pragmaName [ ^ pragmaName ifNil: [ pragmaName := self defaultPragmaName ] From 1d64fe2305afc44b75ef045d8c43e6d632c8ab29 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 14 Apr 2026 14:18:28 -0400 Subject: [PATCH 1233/1268] use `BlTextUnderlayAttribute` [feenkcom/gtoolkit#5007] --- src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st b/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st index c01adb953..68958fe9b 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st @@ -32,7 +32,7 @@ GtTextualCoderTextAttributes >> applyOnEditorElement: aTextEditorElement receive "From where does (aStartPosition to: anEndPosition) come from?" self flag: #TODO. - attributesRange := GtTextEditorCharacterRange + attributesRange := BrTextCharacterRange start: aStartPosition end: anEndPosition documentId: documentId. From 73d91c0f986469110633ce43b5b59900448f26ef Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 14 Apr 2026 18:09:51 -0400 Subject: [PATCH 1234/1268] coder view model has add and remove highlight API [feenkcom/gtoolkit#5007] --- .../GtTextualCoderEditorElement.class.st | 32 +++++++++++++++++-- .../GtTextualCoderElement.class.st | 28 ++++++++++++++++ .../GtTextualCoderViewModel.class.st | 17 ++++++++++ ...CoderViewModelAddHighlightRequest.class.st | 29 +++++++++++++++++ ...rViewModelRemoveHighlightsRequest.class.st | 18 +++++++++++ 5 files changed, 122 insertions(+), 2 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtTextualCoderViewModelAddHighlightRequest.class.st create mode 100644 src/GToolkit-Coder-UI/GtTextualCoderViewModelRemoveHighlightsRequest.class.st diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index ff41ae7df..b6dd476a2 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -423,6 +423,18 @@ GtTextualCoderEditorElement >> onTextStyled: anEvent [ self textualCoderViewModel styledText: anEvent styledText ] +{ #category : #'private - event handling' } +GtTextualCoderEditorElement >> onTextualCoderViewModelAddHighlightRequest: anAnnouncement [ + anAnnouncement textualCoderViewModel = self textualCoderViewModel + ifFalse: [ ^ self ]. + + BlTaskAction + enqueueElement: self + action: [ self + addHighlight: anAnnouncement textHighlight + overRange: anAnnouncement textRange ] +] + { #category : #'api - textual coder view model' } GtTextualCoderEditorElement >> onTextualCoderViewModelChanged [ "Is sent when a new textualCoder view model is assigned to the element. @@ -451,6 +463,16 @@ GtTextualCoderEditorElement >> onTextualCoderViewModelChanged [ self styler: aStyler ] ] +{ #category : #'private - event handling' } +GtTextualCoderEditorElement >> onTextualCoderViewModelRemoveHighlightsRequest: anAnnouncement [ + anAnnouncement textualCoderViewModel = self textualCoderViewModel + ifFalse: [ ^ self ]. + + BlTaskAction + enqueueElement: self + action: [ self removeHighlightsWithId: anAnnouncement id ] +] + { #category : #'private - event handling' } GtTextualCoderEditorElement >> onToolSpawnRequest: anAnnouncement [ self enqueueTask: (BlTaskAction new action: [ @@ -688,8 +710,14 @@ GtTextualCoderEditorElement >> registerCoderViewModelAnnouncementsFor: aGtSource when: GtTextualCoderViewModelReadyToRestyle send: #onViewModelReadyToStyle to: self; - when: GtTextualCoderViewModelTextAttributesAdded - send: #onViewModelTextAttributesAdded: + when: GtTextualCoderViewModelAddHighlightRequest + send: #onTextualCoderViewModelAddHighlightRequest: + to: self; + when: GtTextualCoderViewModelRemoveHighlightsRequest + send: #onTextualCoderViewModelRemoveHighlightsRequest: + to: self; + when: GtTextualCoderViewModelTextAttributesRemoved + send: #onViewModelTextAttributesRemoved: to: self; when: GtTextualCoderViewModelTextAttributesRemoved send: #onViewModelTextAttributesRemoved: diff --git a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st index e34401176..089afdd1a 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st @@ -529,6 +529,18 @@ GtTextualCoderElement >> onTextStyled: anEvent [ self textualCoderViewModel styledText: anEvent styledText ] +{ #category : #'private - event handling' } +GtTextualCoderElement >> onTextualCoderViewModelAddHighlightRequest: anAnnouncement [ + anAnnouncement textualCoderViewModel = self textualCoderViewModel + ifFalse: [ ^ self ]. + + BlTaskAction + enqueueElement: self + action: [ editorElement + addHighlight: anAnnouncement textHighlight + overRange: anAnnouncement textRange ] +] + { #category : #'api - textual coder view model' } GtTextualCoderElement >> onTextualCoderViewModelChanged [ "Is sent when a new textualCoder view model is assigned to the element. @@ -566,6 +578,16 @@ GtTextualCoderElement >> onTextualCoderViewModelChanged [ self styler: aStyler ] ] +{ #category : #'private - event handling' } +GtTextualCoderElement >> onTextualCoderViewModelRemoveHighlightsRequest: anAnnouncement [ + anAnnouncement textualCoderViewModel = self textualCoderViewModel + ifFalse: [ ^ self ]. + + BlTaskAction + enqueueElement: self + action: [ editorElement removeHighlightsWithId: anAnnouncement id ] +] + { #category : #'private - event handling' } GtTextualCoderElement >> onToolSpawnRequest: anAnnouncement [ self enqueueTask: (BlTaskAction new action: [ @@ -812,6 +834,12 @@ GtTextualCoderElement >> registerCoderViewModelAnnouncementsFor: aGtSourceCoderU when: GtTextualCoderViewModelTextAttributesRemoved send: #onViewModelTextAttributesRemoved: to: self; + when: GtTextualCoderViewModelAddHighlightRequest + send: #onTextualCoderViewModelAddHighlightRequest: + to: self; + when: GtTextualCoderViewModelRemoveHighlightsRequest + send: #onTextualCoderViewModelRemoveHighlightsRequest: + to: self; when: GtTextualCoderViewModelStyledTextChanged send: #onViewModelStyledTextChanged: to: self; diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 6acae1a06..f0fd56a22 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -21,6 +21,15 @@ Class { #category : #'GToolkit-Coder-UI-Coder - Textual Model' } +{ #category : #'api - text' } +GtTextualCoderViewModel >> addHighlight: aBrTextHighlight overRange: aBrTextRange [ + self + announce: (GtTextualCoderViewModelAddHighlightRequest new + textualCoderViewModel: self; + textHighlight: aBrTextHighlight; + textRange: aBrTextRange) +] + { #category : #'api - add-ons' } GtTextualCoderViewModel >> addLocateDebuggerInSpaceAction: aSpace [ debuggerInSpace := aSpace asWeakReference. @@ -698,6 +707,14 @@ GtTextualCoderViewModel >> removeCoderTextAttributes: aGtTextualCoderTextAttribu coderTextAttributes: aGtTextualCoderTextAttributes) ] +{ #category : #'api - text' } +GtTextualCoderViewModel >> removeHighlightsWithId: aStringId [ + self + announce: (GtTextualCoderViewModelRemoveHighlightsRequest new + textualCoderViewModel: self; + id: aStringId) +] + { #category : #'api - shortcuts' } GtTextualCoderViewModel >> removeStylersOfClass: aGtCoderStylerClass [ extraAddOns removeStylersOfClass: aGtCoderStylerClass diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelAddHighlightRequest.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelAddHighlightRequest.class.st new file mode 100644 index 000000000..f0ebf28c6 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelAddHighlightRequest.class.st @@ -0,0 +1,29 @@ +Class { + #name : #GtTextualCoderViewModelAddHighlightRequest, + #superclass : #GtTextualCoderViewModelAnnouncement, + #instVars : [ + 'textHighlight', + 'textRange' + ], + #category : #'GToolkit-Coder-UI-Coder - Textual Model - Events' +} + +{ #category : #accessing } +GtTextualCoderViewModelAddHighlightRequest >> textHighlight [ + ^ textHighlight +] + +{ #category : #accessing } +GtTextualCoderViewModelAddHighlightRequest >> textHighlight: anObject [ + textHighlight := anObject +] + +{ #category : #accessing } +GtTextualCoderViewModelAddHighlightRequest >> textRange [ + ^ textRange +] + +{ #category : #accessing } +GtTextualCoderViewModelAddHighlightRequest >> textRange: anObject [ + textRange := anObject +] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelRemoveHighlightsRequest.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelRemoveHighlightsRequest.class.st new file mode 100644 index 000000000..f1d0808ca --- /dev/null +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelRemoveHighlightsRequest.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtTextualCoderViewModelRemoveHighlightsRequest, + #superclass : #GtTextualCoderViewModelAnnouncement, + #instVars : [ + 'id' + ], + #category : #'GToolkit-Coder-UI-Coder - Textual Model - Events' +} + +{ #category : #accessing } +GtTextualCoderViewModelRemoveHighlightsRequest >> id [ + ^ id +] + +{ #category : #accessing } +GtTextualCoderViewModelRemoveHighlightsRequest >> id: anObject [ + id := anObject +] From 8a3361255212abfff73804fede7d48b2f1e79373 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 14 Apr 2026 19:34:19 -0400 Subject: [PATCH 1235/1268] fix incorrectly changed method [feenkcom/gtoolkit#5007] --- .../GtTextualCoderEditorElement.class.st | 12 ++++++------ .../GtTextualCoderViewModel.class.st | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index b6dd476a2..cccb447b5 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -710,18 +710,18 @@ GtTextualCoderEditorElement >> registerCoderViewModelAnnouncementsFor: aGtSource when: GtTextualCoderViewModelReadyToRestyle send: #onViewModelReadyToStyle to: self; + when: GtTextualCoderViewModelTextAttributesAdded + send: #onViewModelTextAttributesAdded: + to: self; + when: GtTextualCoderViewModelTextAttributesRemoved + send: #onViewModelTextAttributesRemoved: + to: self; when: GtTextualCoderViewModelAddHighlightRequest send: #onTextualCoderViewModelAddHighlightRequest: to: self; when: GtTextualCoderViewModelRemoveHighlightsRequest send: #onTextualCoderViewModelRemoveHighlightsRequest: to: self; - when: GtTextualCoderViewModelTextAttributesRemoved - send: #onViewModelTextAttributesRemoved: - to: self; - when: GtTextualCoderViewModelTextAttributesRemoved - send: #onViewModelTextAttributesRemoved: - to: self; when: GtTextualCoderViewModelStyledTextChanged send: #onViewModelStyledTextChanged: to: self; diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index f0fd56a22..2179956ed 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -169,7 +169,7 @@ GtTextualCoderViewModel >> addTextAttributes: aCollectionOfTextAttributes onText newCoderTextAttributes := GtTextualCoderTextAttributes new markerAttribute: aMarkerAttribute; textAttributes: aCollectionOfTextAttributes; - documentId: documentId. + documentId: (aDocumentId ifNil: [ documentId ]). extraTextAttributes add: newCoderTextAttributes. self announce: (GtTextualCoderViewModelTextAttributesAdded new From b3cf4f0352c09aede39ff5ef7ef55f6794162c18 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Tue, 14 Apr 2026 19:34:36 -0400 Subject: [PATCH 1236/1268] auto-rewrite [feenkcom/gtoolkit#5007] --- src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index cccb447b5..3e5551fbc 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -501,7 +501,7 @@ GtTextualCoderEditorElement >> onViewModelCursorsChanged: aCursorsChangedAnnounc { #category : #'private - event handling' } GtTextualCoderEditorElement >> onViewModelReadyToStyle [ - self enqueueTask: (BlTaskAction new action: [ self styleText ]) + self enqueueTask: (BlTaskAction new action: [ self requestManualStyling ]) ] { #category : #registration } From 5de507f56b71e8b9bdaea5546f68a0c8b0aee109 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 15 Apr 2026 03:36:58 -0400 Subject: [PATCH 1237/1268] add `GtCoderAddOnsBuildContext` to simplify future changes [feenkcom/gtoolkit#5007] --- .../GtCoderAddOnsBuildContext.class.st | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/GToolkit-Coder-AddOns/GtCoderAddOnsBuildContext.class.st diff --git a/src/GToolkit-Coder-AddOns/GtCoderAddOnsBuildContext.class.st b/src/GToolkit-Coder-AddOns/GtCoderAddOnsBuildContext.class.st new file mode 100644 index 000000000..0ae5780fe --- /dev/null +++ b/src/GToolkit-Coder-AddOns/GtCoderAddOnsBuildContext.class.st @@ -0,0 +1,21 @@ +" +My main purpose is to pass information while building coder addOns without having to add more method parameters. +" +Class { + #name : #GtCoderAddOnsBuildContext, + #superclass : #Object, + #instVars : [ + 'documentId' + ], + #category : #'GToolkit-Coder-AddOns-Support' +} + +{ #category : #accessing } +GtCoderAddOnsBuildContext >> documentId [ + ^ documentId +] + +{ #category : #accessing } +GtCoderAddOnsBuildContext >> documentId: anObject [ + documentId := anObject +] From 54821c1273666aaeaf95f31a2d0fd675b40f5af7 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 15 Apr 2026 16:13:42 -0400 Subject: [PATCH 1238/1268] call `#cancelFrom:` [feenkcom/gtoolkit#5007] --- src/GToolkit-Coder-AddOns/GtAbstractRenameAction.class.st | 7 +++++++ src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st | 6 +++--- src/GToolkit-Coder-UI/GtTextualCoderElement.class.st | 2 ++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtAbstractRenameAction.class.st b/src/GToolkit-Coder-AddOns/GtAbstractRenameAction.class.st index 724731dc0..c2b1460a1 100644 --- a/src/GToolkit-Coder-AddOns/GtAbstractRenameAction.class.st +++ b/src/GToolkit-Coder-AddOns/GtAbstractRenameAction.class.st @@ -63,6 +63,13 @@ GtAbstractRenameAction >> cancel [ self announceEvent: #cancel ] +{ #category : #actions } +GtAbstractRenameAction >> cancelFrom: anEditorElement [ + "Just announce cancel, because the controller then calls action cancel." + + self announceEvent: #cancel +] + { #category : #accessing } GtAbstractRenameAction >> editor [ ^ self editorAttribute editor diff --git a/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st b/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st index 258ce3a28..9beefee37 100644 --- a/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtRenameEditorAttribute.class.st @@ -78,7 +78,7 @@ GtRenameEditorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElem handlers := {BrTextEditorDeletedEvent. BrTextEditorInsertedEvent} - collect: [ :each | BlEventHandler on: each do: [ :event | self renameAction cancel ] ]. + collect: [ :each | BlEventHandler on: each do: [ :event | self renameAction cancelFrom: anEditorElement ] ]. renameEditor when: BlElementAddedToSceneGraphEvent do: [ :anEvent | handlers do: [ :each | anEditorElement editor addEventHandler: each ] ]; @@ -87,7 +87,7 @@ GtRenameEditorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElem renameEditor whenKey: BlKeyCombination escape - editorDo: [ :aShortcutEvent | self renameAction cancel ]; + editorDo: [ :aShortcutEvent | self renameAction cancelFrom: anEditorElement ]; whenKey: BlKeyCombination builder shift tab build editorDo: [ :aShortcutEvent | (self focusNext: false in: anEditorElement) @@ -99,7 +99,7 @@ GtRenameEditorAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElem whenKey: BlKeyCombination enter editorDo: [ :aShortcutEvent | self renameAction processReturnFor: renameEditor in: anEditorElement ]. - renameEditor when: BrEditorCancelWish do: [ :event | self renameAction cancel ]. + renameEditor when: BrEditorCancelWish do: [ :event | self renameAction cancelFrom: anEditorElement ]. renameEditor editor when: BrTextEditorModifiedEvent diff --git a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st index 089afdd1a..566ee281c 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st @@ -676,6 +676,8 @@ GtTextualCoderElement >> onViewModelStylersChanged [ { #category : #'private - event handling' } GtTextualCoderElement >> onViewModelTextAttributesAdded: anAnnouncement [ + self assert: [ anAnnouncement startPosition isZero not ]. + self textualCoderViewModel = anAnnouncement textualCoderViewModel ifFalse: [ ^ self ]. self enqueueTask: (BlTaskAction new action: [ From 9702c4b4003b9cec511cda2e267f0c26bab31297 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Fri, 17 Apr 2026 12:12:35 +0200 Subject: [PATCH 1239/1268] [feenkcom/gtoolkit#5007] enable commands recorder when using a rust editor --- .../GtExpandedCoderElementWithRustTextEditorStencil.class.st | 1 + 1 file changed, 1 insertion(+) diff --git a/src/GToolkit-Coder-UI/GtExpandedCoderElementWithRustTextEditorStencil.class.st b/src/GToolkit-Coder-UI/GtExpandedCoderElementWithRustTextEditorStencil.class.st index 405a89604..79c9182e2 100644 --- a/src/GToolkit-Coder-UI/GtExpandedCoderElementWithRustTextEditorStencil.class.st +++ b/src/GToolkit-Coder-UI/GtExpandedCoderElementWithRustTextEditorStencil.class.st @@ -12,5 +12,6 @@ GtExpandedCoderElementWithRustTextEditorStencil >> defaultElement [ defaultFontName: 'Source Code Pro'; defaultFontSize: 14; defaultForeground: Color black; + in: [ :anEditor | anEditor privateEditorHandle enableInMemoryCommandsRecorder ]; yourself) ] From 72ed3d261daecb9a37cc321173e33d85457f0e70 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 17 Apr 2026 10:59:36 -0400 Subject: [PATCH 1240/1268] add `GtExpandableSourceCoderElement class>>#defaultExpandedElementStencilClass:` [feenkcom/gtoolkit#5007] --- .../GtExpandableSourceCoderElement.class.st | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st index 528209a13..05677185c 100644 --- a/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtExpandableSourceCoderElement.class.st @@ -10,9 +10,22 @@ Class { 'collapsedElementStencil', 'expandedElementStencil' ], + #classVars : [ + 'DefaultExpandedElementStencilClass' + ], #category : #'GToolkit-Coder-UI-Coder - Source' } +{ #category : #accessing } +GtExpandableSourceCoderElement class >> defaultExpandedElementStencilClass [ + ^ DefaultExpandedElementStencilClass +] + +{ #category : #accessing } +GtExpandableSourceCoderElement class >> defaultExpandedElementStencilClass: anObject [ + DefaultExpandedElementStencilClass := anObject +] + { #category : #private } GtExpandableSourceCoderElement >> addCodersCoderLook: aSourceCoder to: anElement [ aSourceCoder coderLook @@ -78,7 +91,9 @@ GtExpandableSourceCoderElement >> defaultCollapsedElementStencil [ { #category : #initialization } GtExpandableSourceCoderElement >> defaultExpandedElementStencil [ - ^ GtExpandedCoderElementStencil new + ^ self class defaultExpandedElementStencilClass + ifNil: [ GtExpandedCoderElementStencil new ] + ifNotNil: [ :aClass | aClass new ] ] { #category : #accessing } From cc7d784e222b855e049cdb491998d0af7487dc1d Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 17 Apr 2026 11:44:14 -0400 Subject: [PATCH 1241/1268] use `BrTextEditorDocumentId` [feenkcom/gtoolkit#5007] plus some fixes --- .../GtTextualCoderElement.class.st | 23 ++++++++- .../GtTextualCoderViewModel.class.st | 6 +++ ...alCoderViewModelTextChangedSignal.class.st | 48 +++++++++++++++++++ src/GToolkit-Coder/GtTextualCoder.class.st | 1 + 4 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtTextualCoderViewModelTextChangedSignal.class.st diff --git a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st index 566ee281c..868aaa311 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st @@ -265,6 +265,10 @@ GtTextualCoderElement >> initializeEditorElement: aNewEditorElement [ { #category : #initialization } GtTextualCoderElement >> initializeEditorListeners [ + self editor + when: BrTextEditorTextReplacedEvent + do: [ :anEvent | self onTextEditorTextReplacedEvent: anEvent ]. + self editor when: BrTextEditorHistoryChangedEvent do: [ :anEvent | self onTextEditorHistoryChanged: anEvent ]. @@ -498,6 +502,18 @@ GtTextualCoderElement >> onTextEditorSelectionChanged: anEvent [ self textualCoderViewModel selection: anEvent selection from: self ] +{ #category : #'private - event handling' } +GtTextualCoderElement >> onTextEditorTextReplacedEvent: aTextReplacedEvent [ + "We assume that the text we have in the view model is same + as this event is a consequence that this element updated + its editor element in GtTextualCoderElement>>#onTextualCoderViewModelChanged. + For that reason we just update the document ID." + self hasTextualCoderViewModel ifFalse: [ ^ self ]. + + self textualCoderViewModel + documentId: aTextReplacedEvent documentId +] + { #category : #'private - event handling' } GtTextualCoderElement >> onTextModified [ "Is sent when the text changes in the editor. Here we should synchronise the UI and the model." @@ -943,9 +959,12 @@ GtTextualCoderElement >> text [ { #category : #TODO } GtTextualCoderElement >> text: aBlText [ + self text == aBlText ifTrue: [ ^ self ]. + (self text equalsIgnoringAttributes: aBlText) - ifTrue: [ self editor history disableDuring: [ editorElement text: aBlText ] ]. - editorElement text: aBlText + ifTrue: [ self editor history + disableDuring: [ editorElement text: aBlText ] ] + ifFalse: [ editorElement text: aBlText ] ] { #category : #'api - textual coder view model' } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 2179956ed..d84d3e1a1 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -664,6 +664,12 @@ GtTextualCoderViewModel >> onSourceCodeChanged: anSourceCodeChangedAnnouncement addOnPromise := nil. isTextModifiedPromise := nil. + + GtTextualCoderViewModelTextChangedSignal new + documentId: documentId; + text: self coderModel currentSourceText; + textualCoderViewModel: self; + emit. self announce: (GtTextualCoderViewModelTextChanged new textualCoderViewModel: self; diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextChangedSignal.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextChangedSignal.class.st new file mode 100644 index 000000000..01698d7cc --- /dev/null +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextChangedSignal.class.st @@ -0,0 +1,48 @@ +Class { + #name : #GtTextualCoderViewModelTextChangedSignal, + #superclass : #ContextStackSignal, + #instVars : [ + 'text', + 'documentId', + 'textualCoderViewModel' + ], + #category : #'GToolkit-Coder-UI-Coder - Textual Model' +} + +{ #category : #accessing } +GtTextualCoderViewModelTextChangedSignal >> documentId [ + ^ documentId +] + +{ #category : #accessing } +GtTextualCoderViewModelTextChangedSignal >> documentId: anObject [ + documentId := anObject +] + +{ #category : #printing } +GtTextualCoderViewModelTextChangedSignal >> printOneLineContentsOn: aStream [ + + documentId gtDisplayOn: aStream. + aStream space. + text gtDisplayOn: aStream. +] + +{ #category : #accessing } +GtTextualCoderViewModelTextChangedSignal >> text [ + ^ text +] + +{ #category : #accessing } +GtTextualCoderViewModelTextChangedSignal >> text: anObject [ + text := anObject +] + +{ #category : #accessing } +GtTextualCoderViewModelTextChangedSignal >> textualCoderViewModel [ + ^ textualCoderViewModel +] + +{ #category : #accessing } +GtTextualCoderViewModelTextChangedSignal >> textualCoderViewModel: anObject [ + textualCoderViewModel := anObject +] diff --git a/src/GToolkit-Coder/GtTextualCoder.class.st b/src/GToolkit-Coder/GtTextualCoder.class.st index 2e25d69eb..4ffefaf9c 100644 --- a/src/GToolkit-Coder/GtTextualCoder.class.st +++ b/src/GToolkit-Coder/GtTextualCoder.class.st @@ -208,6 +208,7 @@ GtTextualCoder >> currentSourceText: aText with: aGtCoderUpdateStragegy dueTo: a self critical: [ | previousSourceText| + aText == self currentSourceText ifTrue: [ ^ self ]. previousSourceText := self currentSourceText copy. self sourceCode currentSourceText: aText. self From 17d84485a91c045c77c901d710ca1e0b9b725d8e Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 17 Apr 2026 21:44:40 -0400 Subject: [PATCH 1242/1268] `GtTextualCoderTextAttributes` stores start and stop positions [feenkcom/gtoolkit#5007] --- .../GtTextualCoderTextAttributes.class.st | 24 ++++++++++++++++++- .../GtTextualCoderViewModel.class.st | 4 +++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st b/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st index 68958fe9b..d02ad4ae7 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st @@ -6,7 +6,9 @@ Class { 'textAttributes', 'textAttributeTags', 'markerAttributeTag', - 'documentId' + 'documentId', + 'startPosition', + 'stopPosition' ], #category : #'GToolkit-Coder-UI-Coder - Textual Model' } @@ -154,6 +156,26 @@ GtTextualCoderTextAttributes >> removeFromEditorText: aText [ aText removeAttributes: { self markerAttribute }, self textAttributes ] +{ #category : #accessing } +GtTextualCoderTextAttributes >> startPosition [ + ^ startPosition +] + +{ #category : #accessing } +GtTextualCoderTextAttributes >> startPosition: anObject [ + startPosition := anObject +] + +{ #category : #accessing } +GtTextualCoderTextAttributes >> stopPosition [ + ^ stopPosition +] + +{ #category : #accessing } +GtTextualCoderTextAttributes >> stopPosition: anObject [ + stopPosition := anObject +] + { #category : #accessing } GtTextualCoderTextAttributes >> textAttributes [ ^ textAttributes diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index d84d3e1a1..3eb0dbcc3 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -169,7 +169,9 @@ GtTextualCoderViewModel >> addTextAttributes: aCollectionOfTextAttributes onText newCoderTextAttributes := GtTextualCoderTextAttributes new markerAttribute: aMarkerAttribute; textAttributes: aCollectionOfTextAttributes; - documentId: (aDocumentId ifNil: [ documentId ]). + documentId: (aDocumentId ifNil: [ documentId ]); + startPosition: aStartPosition; + stopPosition: anEndPosition. extraTextAttributes add: newCoderTextAttributes. self announce: (GtTextualCoderViewModelTextAttributesAdded new From 6ad39194431afac31dc60e53d258beb7d0520cf5 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Sat, 18 Apr 2026 00:23:01 -0400 Subject: [PATCH 1243/1268] add a signal [feenkcom/gtoolkit#5007] --- ...rElementUpdateTextRequestedSignal.class.st | 24 +++++++++++++++++++ .../GtTextualCoderElement.class.st | 5 ++++ 2 files changed, 29 insertions(+) create mode 100644 src/GToolkit-Coder-UI/GtTextualCoderEditorElementUpdateTextRequestedSignal.class.st diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElementUpdateTextRequestedSignal.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElementUpdateTextRequestedSignal.class.st new file mode 100644 index 000000000..737ea184b --- /dev/null +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElementUpdateTextRequestedSignal.class.st @@ -0,0 +1,24 @@ +Class { + #name : #GtTextualCoderEditorElementUpdateTextRequestedSignal, + #superclass : #GtTextualCoderEditorElementSignal, + #instVars : [ + 'text' + ], + #category : #'GToolkit-Coder-UI-Coder - Textual' +} + +{ #category : #printing } +GtTextualCoderEditorElementUpdateTextRequestedSignal >> printOneLineContentsOn: aStream [ + + text gtDisplayOn: aStream. +] + +{ #category : #'private - event handling' } +GtTextualCoderEditorElementUpdateTextRequestedSignal >> text [ + ^ text +] + +{ #category : #'private - event handling' } +GtTextualCoderEditorElementUpdateTextRequestedSignal >> text: aBlText [ + text := aBlText +] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st index 868aaa311..d76b4fdff 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st @@ -726,6 +726,11 @@ GtTextualCoderElement >> onViewModelTextChanged: aGtTextualCoderViewModelTextCha "Do nothing if it comes from a different view model" aGtTextualCoderViewModelTextChanged textualCoderViewModel == self textualCoderViewModel ifFalse: [ ^ self ]. + + GtTextualCoderEditorElementUpdateTextRequestedSignal new + element: self; + text: aGtTextualCoderViewModelTextChanged text; + emit. BlTaskAction enqueueElement: self From aa97dd06e35d7fb469d6b538b02277295c7fc5c4 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Sun, 19 Apr 2026 15:58:19 -0400 Subject: [PATCH 1244/1268] add action signals [feenkcom/gtoolkit#5007] --- ...erRenameActionAddAttributesSignal.class.st | 63 +++++++++++++++++++ ...enameActionRemoveAttributesSignal.class.st | 63 +++++++++++++++++++ .../GtCoderRenameActionSignal.class.st | 18 ++++++ .../GtCoderViewModelRenameAction.class.st | 7 ++- .../GtTextualCoderViewModel.class.st | 10 +++ 5 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 src/GToolkit-Coder-AddOns/GtCoderRenameActionAddAttributesSignal.class.st create mode 100644 src/GToolkit-Coder-AddOns/GtCoderRenameActionRemoveAttributesSignal.class.st create mode 100644 src/GToolkit-Coder-AddOns/GtCoderRenameActionSignal.class.st diff --git a/src/GToolkit-Coder-AddOns/GtCoderRenameActionAddAttributesSignal.class.st b/src/GToolkit-Coder-AddOns/GtCoderRenameActionAddAttributesSignal.class.st new file mode 100644 index 000000000..29f5f7ce1 --- /dev/null +++ b/src/GToolkit-Coder-AddOns/GtCoderRenameActionAddAttributesSignal.class.st @@ -0,0 +1,63 @@ +Class { + #name : #GtCoderRenameActionAddAttributesSignal, + #superclass : #GtCoderRenameActionSignal, + #instVars : [ + 'coderAttributes' + ], + #category : #'GToolkit-Coder-AddOns-Signals' +} + +{ #category : #accessing } +GtCoderRenameActionAddAttributesSignal >> coderAttributes [ + ^ coderAttributes +] + +{ #category : #accessing } +GtCoderRenameActionAddAttributesSignal >> coderAttributes: anObject [ + coderAttributes := anObject +] + +{ #category : #'gt - extensions' } +GtCoderRenameActionAddAttributesSignal >> gtExtraTextAttributesFor: aView [ + + coderAttributes ifNil: [ ^ aView empty ]. + ^ aView columnedList + title: 'Extra Text Attributes'; + priority: 0; + items: [ coderAttributes ]; + column: 'Document' + text: [ :each | + '{1}.{2}' + format: {each documentId ifNotNil: #textId ifNil: [ '-' ]. + each documentId ifNotNil: #textId ifNil: [ '-' ]} ] + width: 70; + column: 'Range' + text: [ :each | + '{1}..{2}' + format: {each startPosition ifNil: [ '-' ]. + each stopPosition ifNil: [ '-' ]} ] + width: 50; + column: 'Count' + text: [ :each | each textAttributes ifNotNil: #size ifNil: [ 0 ] ] + width: 50; + column: 'Attributes' + text: [ :each | + each textAttributes + ifNotNil: [ :aCollection | + String + streamContents: [ :aStream | + aCollection + do: [ :eachAttribute | eachAttribute gtDisplayOn: aStream ] + separatedBy: [ aStream nextPut: ', ' ] ] ] + ifNil: [ '' ] ] +] + +{ #category : #printing } +GtCoderRenameActionAddAttributesSignal >> printOneLineContentsOn: aStream [ + action ifNil: [ ^ super printOneLineContentsOn: aStream ]. + + aStream nextPutAll: '+A '. + action documentId gtDisplayOn: aStream. + aStream space. + action newSelector gtDisplayOn: aStream +] diff --git a/src/GToolkit-Coder-AddOns/GtCoderRenameActionRemoveAttributesSignal.class.st b/src/GToolkit-Coder-AddOns/GtCoderRenameActionRemoveAttributesSignal.class.st new file mode 100644 index 000000000..b4721e951 --- /dev/null +++ b/src/GToolkit-Coder-AddOns/GtCoderRenameActionRemoveAttributesSignal.class.st @@ -0,0 +1,63 @@ +Class { + #name : #GtCoderRenameActionRemoveAttributesSignal, + #superclass : #GtCoderRenameActionSignal, + #instVars : [ + 'coderAttributes' + ], + #category : #'GToolkit-Coder-AddOns-Signals' +} + +{ #category : #accessing } +GtCoderRenameActionRemoveAttributesSignal >> coderAttributes [ + ^ coderAttributes +] + +{ #category : #accessing } +GtCoderRenameActionRemoveAttributesSignal >> coderAttributes: anObject [ + coderAttributes := anObject +] + +{ #category : #'gt - extensions' } +GtCoderRenameActionRemoveAttributesSignal >> gtExtraTextAttributesFor: aView [ + + coderAttributes ifNil: [ ^ aView empty ]. + ^ aView columnedList + title: 'Extra Text Attributes'; + priority: 0; + items: [ coderAttributes ]; + column: 'Document' + text: [ :each | + '{1}.{2}' + format: {each documentId ifNotNil: #textId ifNil: [ '-' ]. + each documentId ifNotNil: #textId ifNil: [ '-' ]} ] + width: 70; + column: 'Range' + text: [ :each | + '{1}..{2}' + format: {each startPosition ifNil: [ '-' ]. + each stopPosition ifNil: [ '-' ]} ] + width: 50; + column: 'Count' + text: [ :each | each textAttributes ifNotNil: #size ifNil: [ 0 ] ] + width: 50; + column: 'Attributes' + text: [ :each | + each textAttributes + ifNotNil: [ :aCollection | + String + streamContents: [ :aStream | + aCollection + do: [ :eachAttribute | eachAttribute gtDisplayOn: aStream ] + separatedBy: [ aStream nextPut: ', ' ] ] ] + ifNil: [ '' ] ] +] + +{ #category : #printing } +GtCoderRenameActionRemoveAttributesSignal >> printOneLineContentsOn: aStream [ + action ifNil: [ ^ super printOneLineContentsOn: aStream ]. + + aStream nextPutAll: '-A '. + action documentId gtDisplayOn: aStream. + aStream space. + action newSelector gtDisplayOn: aStream +] diff --git a/src/GToolkit-Coder-AddOns/GtCoderRenameActionSignal.class.st b/src/GToolkit-Coder-AddOns/GtCoderRenameActionSignal.class.st new file mode 100644 index 000000000..134d1d554 --- /dev/null +++ b/src/GToolkit-Coder-AddOns/GtCoderRenameActionSignal.class.st @@ -0,0 +1,18 @@ +Class { + #name : #GtCoderRenameActionSignal, + #superclass : #ContextStackSignal, + #instVars : [ + 'action' + ], + #category : #'GToolkit-Coder-AddOns-Signals' +} + +{ #category : #accessing } +GtCoderRenameActionSignal >> action [ + ^ action +] + +{ #category : #accessing } +GtCoderRenameActionSignal >> action: anObject [ + action := anObject +] diff --git a/src/GToolkit-Coder-AddOns/GtCoderViewModelRenameAction.class.st b/src/GToolkit-Coder-AddOns/GtCoderViewModelRenameAction.class.st index 0317c830c..2f17e8d81 100644 --- a/src/GToolkit-Coder-AddOns/GtCoderViewModelRenameAction.class.st +++ b/src/GToolkit-Coder-AddOns/GtCoderViewModelRenameAction.class.st @@ -118,7 +118,12 @@ GtCoderViewModelRenameAction >> preventSave [ ] { #category : #'private - attributes' } -GtCoderViewModelRenameAction >> removeAttributes [ +GtCoderViewModelRenameAction >> removeAttributes [ + GtCoderRenameActionRemoveAttributesSignal new + action: self; + coderAttributes: coderAttributes; + emit. + self pharoSourceCoderViewModel removeAllCoderTextAttributes: coderAttributes ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index 3eb0dbcc3..a0a4102ff 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -685,6 +685,16 @@ GtTextualCoderViewModel >> onSourceCodeReplaced: aSourceCodeReplacedAnnouncement the source text has changed." ] +{ #category : #printing } +GtTextualCoderViewModel >> printOn: aStream [ + super printOn: aStream. + + aStream + nextPut: $(; + print: documentId; + nextPut: $) +] + { #category : #'api - text' } GtTextualCoderViewModel >> removeAllCoderTextAttributes: aCollectionOfGtTextualCoderTextAttributes [ aCollectionOfGtTextualCoderTextAttributes do: [ :eachCoderTextAttribute | From 98e9bce3ee165d56b56e3fbe338ad176715e85ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Wed, 29 Apr 2026 14:34:20 +0200 Subject: [PATCH 1245/1268] Move RB extensions to GToolkit-Coder-Pharo12Extensions [feenkcom/gtoolkit#5004] --- .../BaselineOfGToolkitCoder.class.st | 10 +++++++++- .../RBArrayNode.extension.st | 2 +- .../RBAssignmentNode.extension.st | 2 +- .../RBBlockNode.extension.st | 2 +- .../RBCascadeNode.extension.st | 2 +- .../RBLiteralNode.extension.st | 2 +- .../RBMessageNode.extension.st | 2 +- .../RBMethodNode.extension.st | 2 +- .../RBParseErrorNode.extension.st | 2 +- .../RBPragmaNode.extension.st | 2 +- .../RBProgramNode.extension.st | 6 +++--- .../RBSequenceNode.extension.st | 2 +- .../RBValueNode.extension.st | 2 +- .../RBVariableNode.extension.st | 4 ++-- src/GToolkit-Coder-Pharo12Extensions/package.st | 1 + 15 files changed, 26 insertions(+), 17 deletions(-) rename src/{GToolkit-Coder => GToolkit-Coder-Pharo12Extensions}/RBArrayNode.extension.st (83%) rename src/{GToolkit-Coder => GToolkit-Coder-Pharo12Extensions}/RBAssignmentNode.extension.st (76%) rename src/{GToolkit-Coder => GToolkit-Coder-Pharo12Extensions}/RBBlockNode.extension.st (85%) rename src/{GToolkit-Coder => GToolkit-Coder-Pharo12Extensions}/RBCascadeNode.extension.st (83%) rename src/{GToolkit-Coder => GToolkit-Coder-Pharo12Extensions}/RBLiteralNode.extension.st (79%) rename src/{GToolkit-Coder => GToolkit-Coder-Pharo12Extensions}/RBMessageNode.extension.st (80%) rename src/{GToolkit-Coder => GToolkit-Coder-Pharo12Extensions}/RBMethodNode.extension.st (80%) rename src/{GToolkit-Coder => GToolkit-Coder-Pharo12Extensions}/RBParseErrorNode.extension.st (75%) rename src/{GToolkit-Coder => GToolkit-Coder-Pharo12Extensions}/RBPragmaNode.extension.st (85%) rename src/{GToolkit-Coder => GToolkit-Coder-Pharo12Extensions}/RBProgramNode.extension.st (72%) rename src/{GToolkit-Coder => GToolkit-Coder-Pharo12Extensions}/RBSequenceNode.extension.st (84%) rename src/{GToolkit-Coder => GToolkit-Coder-Pharo12Extensions}/RBValueNode.extension.st (78%) rename src/{GToolkit-Coder => GToolkit-Coder-Pharo12Extensions}/RBVariableNode.extension.st (68%) create mode 100644 src/GToolkit-Coder-Pharo12Extensions/package.st diff --git a/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st b/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st index a3e664be7..8cabac53a 100644 --- a/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st +++ b/src/BaselineOfGToolkitCoder/BaselineOfGToolkitCoder.class.st @@ -73,5 +73,13 @@ BaselineOfGToolkitCoder >> baseline: spec [ package: 'GToolkit-Coder-Examples-SystemS1'; package: 'GToolkit-Coder-Examples' with: [ spec - requires: #('GToolkit-Coder' 'GToolkit-Coder-UI' 'GToolkit-Coder-AddOns' 'GToolkit-Coder-Examples-SystemS1' 'GToolkit4Magritte') ] ] + requires: #('GToolkit-Coder' 'GToolkit-Coder-UI' 'GToolkit-Coder-AddOns' 'GToolkit-Coder-Examples-SystemS1' 'GToolkit4Magritte') ]. + + self + forPharo13AndNewer: [] + forOlder: [ + spec package: 'GToolkit-Coder-Pharo12Extensions' with: [ + spec requires: #('GToolkit-Coder-Extensions') ] ] + + ] ] diff --git a/src/GToolkit-Coder/RBArrayNode.extension.st b/src/GToolkit-Coder-Pharo12Extensions/RBArrayNode.extension.st similarity index 83% rename from src/GToolkit-Coder/RBArrayNode.extension.st rename to src/GToolkit-Coder-Pharo12Extensions/RBArrayNode.extension.st index 8cf8c00b2..89799b2fa 100644 --- a/src/GToolkit-Coder/RBArrayNode.extension.st +++ b/src/GToolkit-Coder-Pharo12Extensions/RBArrayNode.extension.st @@ -1,6 +1,6 @@ Extension { #name : #RBArrayNode } -{ #category : #'*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder-Pharo12Extensions' } RBArrayNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. periods diff --git a/src/GToolkit-Coder/RBAssignmentNode.extension.st b/src/GToolkit-Coder-Pharo12Extensions/RBAssignmentNode.extension.st similarity index 76% rename from src/GToolkit-Coder/RBAssignmentNode.extension.st rename to src/GToolkit-Coder-Pharo12Extensions/RBAssignmentNode.extension.st index 932ce03eb..ed0f89c9c 100644 --- a/src/GToolkit-Coder/RBAssignmentNode.extension.st +++ b/src/GToolkit-Coder-Pharo12Extensions/RBAssignmentNode.extension.st @@ -1,6 +1,6 @@ Extension { #name : #RBAssignmentNode } -{ #category : #'*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder-Pharo12Extensions' } RBAssignmentNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. assignment ifNotNil: [ assignment := assignment + anInteger ] diff --git a/src/GToolkit-Coder/RBBlockNode.extension.st b/src/GToolkit-Coder-Pharo12Extensions/RBBlockNode.extension.st similarity index 85% rename from src/GToolkit-Coder/RBBlockNode.extension.st rename to src/GToolkit-Coder-Pharo12Extensions/RBBlockNode.extension.st index 9d93e4028..226d9fbb4 100644 --- a/src/GToolkit-Coder/RBBlockNode.extension.st +++ b/src/GToolkit-Coder-Pharo12Extensions/RBBlockNode.extension.st @@ -1,6 +1,6 @@ Extension { #name : #RBBlockNode } -{ #category : #'*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder-Pharo12Extensions' } RBBlockNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. colons ifNotNil: [ colons := colons collect: [ :f | f + anInteger ] ]. diff --git a/src/GToolkit-Coder/RBCascadeNode.extension.st b/src/GToolkit-Coder-Pharo12Extensions/RBCascadeNode.extension.st similarity index 83% rename from src/GToolkit-Coder/RBCascadeNode.extension.st rename to src/GToolkit-Coder-Pharo12Extensions/RBCascadeNode.extension.st index acb9718b5..dbc45527b 100644 --- a/src/GToolkit-Coder/RBCascadeNode.extension.st +++ b/src/GToolkit-Coder-Pharo12Extensions/RBCascadeNode.extension.st @@ -1,6 +1,6 @@ Extension { #name : #RBCascadeNode } -{ #category : #'*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder-Pharo12Extensions' } RBCascadeNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. (messages size - 1) timesRepeat: [ self receiver gtMoveBy: 0 - anInteger ]. diff --git a/src/GToolkit-Coder/RBLiteralNode.extension.st b/src/GToolkit-Coder-Pharo12Extensions/RBLiteralNode.extension.st similarity index 79% rename from src/GToolkit-Coder/RBLiteralNode.extension.st rename to src/GToolkit-Coder-Pharo12Extensions/RBLiteralNode.extension.st index 78ecb4692..8cd3aa22c 100644 --- a/src/GToolkit-Coder/RBLiteralNode.extension.st +++ b/src/GToolkit-Coder-Pharo12Extensions/RBLiteralNode.extension.st @@ -1,6 +1,6 @@ Extension { #name : #RBLiteralNode } -{ #category : #'*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder-Pharo12Extensions' } RBLiteralNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. start ifNotNil: [ start := start + anInteger ]. diff --git a/src/GToolkit-Coder/RBMessageNode.extension.st b/src/GToolkit-Coder-Pharo12Extensions/RBMessageNode.extension.st similarity index 80% rename from src/GToolkit-Coder/RBMessageNode.extension.st rename to src/GToolkit-Coder-Pharo12Extensions/RBMessageNode.extension.st index 7dfab62f7..2948a29c7 100644 --- a/src/GToolkit-Coder/RBMessageNode.extension.st +++ b/src/GToolkit-Coder-Pharo12Extensions/RBMessageNode.extension.st @@ -1,6 +1,6 @@ Extension { #name : #RBMessageNode } -{ #category : #'*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder-Pharo12Extensions' } RBMessageNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. keywordsPositions diff --git a/src/GToolkit-Coder/RBMethodNode.extension.st b/src/GToolkit-Coder-Pharo12Extensions/RBMethodNode.extension.st similarity index 80% rename from src/GToolkit-Coder/RBMethodNode.extension.st rename to src/GToolkit-Coder-Pharo12Extensions/RBMethodNode.extension.st index 74564e5e0..68255990c 100644 --- a/src/GToolkit-Coder/RBMethodNode.extension.st +++ b/src/GToolkit-Coder-Pharo12Extensions/RBMethodNode.extension.st @@ -1,6 +1,6 @@ Extension { #name : #RBMethodNode } -{ #category : #'*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder-Pharo12Extensions' } RBMethodNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. keywordsPositions diff --git a/src/GToolkit-Coder/RBParseErrorNode.extension.st b/src/GToolkit-Coder-Pharo12Extensions/RBParseErrorNode.extension.st similarity index 75% rename from src/GToolkit-Coder/RBParseErrorNode.extension.st rename to src/GToolkit-Coder-Pharo12Extensions/RBParseErrorNode.extension.st index 89fc9c541..c48083e0e 100644 --- a/src/GToolkit-Coder/RBParseErrorNode.extension.st +++ b/src/GToolkit-Coder-Pharo12Extensions/RBParseErrorNode.extension.st @@ -1,6 +1,6 @@ Extension { #name : #RBParseErrorNode } -{ #category : #'*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder-Pharo12Extensions' } RBParseErrorNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. start ifNotNil: [ start := start + anInteger ] diff --git a/src/GToolkit-Coder/RBPragmaNode.extension.st b/src/GToolkit-Coder-Pharo12Extensions/RBPragmaNode.extension.st similarity index 85% rename from src/GToolkit-Coder/RBPragmaNode.extension.st rename to src/GToolkit-Coder-Pharo12Extensions/RBPragmaNode.extension.st index 963884f68..6c07af9f6 100644 --- a/src/GToolkit-Coder/RBPragmaNode.extension.st +++ b/src/GToolkit-Coder-Pharo12Extensions/RBPragmaNode.extension.st @@ -1,6 +1,6 @@ Extension { #name : #RBPragmaNode } -{ #category : #'*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder-Pharo12Extensions' } RBPragmaNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. keywordsPositions diff --git a/src/GToolkit-Coder/RBProgramNode.extension.st b/src/GToolkit-Coder-Pharo12Extensions/RBProgramNode.extension.st similarity index 72% rename from src/GToolkit-Coder/RBProgramNode.extension.st rename to src/GToolkit-Coder-Pharo12Extensions/RBProgramNode.extension.st index 62eb9d6ae..aade28bc9 100644 --- a/src/GToolkit-Coder/RBProgramNode.extension.st +++ b/src/GToolkit-Coder-Pharo12Extensions/RBProgramNode.extension.st @@ -1,17 +1,17 @@ Extension { #name : #RBProgramNode } -{ #category : #'*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder-Pharo12Extensions' } RBProgramNode >> gtMoveAllBy: anInteger [ self gtMoveBy: anInteger. self children do: [ :e | e gtMoveAllBy: anInteger ] ] -{ #category : #'*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder-Pharo12Extensions' } RBProgramNode >> gtMoveBy: anInteger [ self comments do: [ :f | f with: f contents at: f start + anInteger ] ] -{ #category : #'*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder-Pharo12Extensions' } RBProgramNode >> withAllParentsDo: aBlock [ | node | node := self. diff --git a/src/GToolkit-Coder/RBSequenceNode.extension.st b/src/GToolkit-Coder-Pharo12Extensions/RBSequenceNode.extension.st similarity index 84% rename from src/GToolkit-Coder/RBSequenceNode.extension.st rename to src/GToolkit-Coder-Pharo12Extensions/RBSequenceNode.extension.st index 2e06f438e..9b2017b2b 100644 --- a/src/GToolkit-Coder/RBSequenceNode.extension.st +++ b/src/GToolkit-Coder-Pharo12Extensions/RBSequenceNode.extension.st @@ -1,6 +1,6 @@ Extension { #name : #RBSequenceNode } -{ #category : #'*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder-Pharo12Extensions' } RBSequenceNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. periods ifNotNil: [ periods := periods collect: [ :f | f + anInteger ] ]. diff --git a/src/GToolkit-Coder/RBValueNode.extension.st b/src/GToolkit-Coder-Pharo12Extensions/RBValueNode.extension.st similarity index 78% rename from src/GToolkit-Coder/RBValueNode.extension.st rename to src/GToolkit-Coder-Pharo12Extensions/RBValueNode.extension.st index 3d8f74ea1..3edb5348d 100644 --- a/src/GToolkit-Coder/RBValueNode.extension.st +++ b/src/GToolkit-Coder-Pharo12Extensions/RBValueNode.extension.st @@ -1,6 +1,6 @@ Extension { #name : #RBValueNode } -{ #category : #'*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder-Pharo12Extensions' } RBValueNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. parentheses ifNotNil: [ parentheses := parentheses collect: [ :f | f + anInteger ] ]. diff --git a/src/GToolkit-Coder/RBVariableNode.extension.st b/src/GToolkit-Coder-Pharo12Extensions/RBVariableNode.extension.st similarity index 68% rename from src/GToolkit-Coder/RBVariableNode.extension.st rename to src/GToolkit-Coder-Pharo12Extensions/RBVariableNode.extension.st index aa4a6fd38..df4a4d3ea 100644 --- a/src/GToolkit-Coder/RBVariableNode.extension.st +++ b/src/GToolkit-Coder-Pharo12Extensions/RBVariableNode.extension.st @@ -1,11 +1,11 @@ Extension { #name : #RBVariableNode } -{ #category : #'*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder-Pharo12Extensions' } RBVariableNode >> gtIsLocal [ ^ (self whoDefines: self name) notNil ] -{ #category : #'*GToolkit-Coder' } +{ #category : #'*GToolkit-Coder-Pharo12Extensions' } RBVariableNode >> gtMoveBy: anInteger [ super gtMoveBy: anInteger. start ifNotNil: [ start := start + anInteger ] diff --git a/src/GToolkit-Coder-Pharo12Extensions/package.st b/src/GToolkit-Coder-Pharo12Extensions/package.st new file mode 100644 index 000000000..19410f66d --- /dev/null +++ b/src/GToolkit-Coder-Pharo12Extensions/package.st @@ -0,0 +1 @@ +Package { #name : #'GToolkit-Coder-Pharo12Extensions' } From 1a99a50c6f1a639df00a5cffb7ce812aa874ce9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Wed, 29 Apr 2026 16:30:19 +0200 Subject: [PATCH 1246/1268] Cleanup RPackage related classes [feenkcom/gtoolkit#4904] --- src/GToolkit-Coder/RPackageTag.extension.st | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 src/GToolkit-Coder/RPackageTag.extension.st diff --git a/src/GToolkit-Coder/RPackageTag.extension.st b/src/GToolkit-Coder/RPackageTag.extension.st deleted file mode 100644 index da654eb28..000000000 --- a/src/GToolkit-Coder/RPackageTag.extension.st +++ /dev/null @@ -1,18 +0,0 @@ -Extension { #name : #RPackageTag } - -{ #category : #'*GToolkit-Coder' } -RPackageTag >> gtClassesCoderFor: aView context: aPhlowContext [ - - (aPhlowContext isKindOf: GtPhlowExecutionContext) ifFalse: [ ^ aView empty ]. - aPhlowContext hasPackageTagCoder ifFalse: [ ^ aView empty ]. - ^ aView explicit - priority: 10; - title: 'Classes'; - disableAsync; - stencil: [ aPhlowContext packageTagCoder classesCoder asElement ] -] - -{ #category : #'*GToolkit-Coder' } -RPackageTag >> gtTagName [ - ^ self name -] From e225fbad686fad19ded8631127539ddfa61c0390 Mon Sep 17 00:00:00 2001 From: John Brant Date: Thu, 30 Apr 2026 07:53:58 -0500 Subject: [PATCH 1247/1268] more refactoring changes for P13 --- src/GToolkit-Coder-UI/InstanceVariableSlot.extension.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/InstanceVariableSlot.extension.st b/src/GToolkit-Coder-UI/InstanceVariableSlot.extension.st index 3fb46f746..b9d359462 100644 --- a/src/GToolkit-Coder-UI/InstanceVariableSlot.extension.st +++ b/src/GToolkit-Coder-UI/InstanceVariableSlot.extension.st @@ -257,7 +257,7 @@ InstanceVariableSlot >> gtPushUpActionFor: anAction context: aPhlowContext [ format: {aSelectedClass name. self name}); confirmationLabel: ('Push up {1}' format: {self name}); - refactoringWithConfirmation: [ RBPullUpInstanceVariableRefactoring + refactoringWithConfirmation: [ GtRBPullUpInstanceVariableRefactoring variable: self name class: aSelectedClass superclass ]; afterAppliedBlock: [ BlTaskAction enqueueElement: aTargetElement action: [ anExplicitMenu hideAll ] ]; From 11ed5dd896e448cc6bc608a06d78736e8c6ec5ba Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Sun, 10 May 2026 19:23:59 +0200 Subject: [PATCH 1248/1268] [feenkcom/gtoolkit#5050] move to the text expander api --- src/GToolkit-Coder/GtCoderAstStyler.class.st | 22 ++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/GToolkit-Coder/GtCoderAstStyler.class.st b/src/GToolkit-Coder/GtCoderAstStyler.class.st index 6cb955b7e..f061c7bae 100644 --- a/src/GToolkit-Coder/GtCoderAstStyler.class.st +++ b/src/GToolkit-Coder/GtCoderAstStyler.class.st @@ -83,6 +83,28 @@ GtCoderAstStyler >> coderViewModel: anObject [ GtCoderAstStyler >> extraStyle: aText ast: theAst [ ] +{ #category : #'api - styling' } +GtCoderAstStyler >> from: aStart to: anEnd [ + ^ [ text from: aStart to: anEnd ] + on: Error + do: [ :anError | + anError emit. + + NonInteractiveTranscript stdout + nextPutAll: '['; + nextPutAll: self class name; + nextPutAll: '] '; + nextPutAll: 'Was not able to get subtext from '; + print: aStart; + nextPutAll: ' to '; + print: anEnd; + nextPutAll: ' on text of size '; + print: text size; + cr. + + '' asRopedText ]. +] + { #category : #comparing } GtCoderAstStyler >> hash [ ^self class hash From 3271ed23d671ca1c0574ae59d269a269221268e0 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Tue, 12 May 2026 12:29:51 +0200 Subject: [PATCH 1249/1268] don't listen to TextModified event in the coder, we use fine grained now --- src/GToolkit-Coder-UI/GtTextualCoderElement.class.st | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st index d76b4fdff..39091980c 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st @@ -252,11 +252,6 @@ GtTextualCoderElement >> initializeEditorElement: aNewEditorElement [ completion := nil ]. self initializeEditorListeners. - - "I think this can be removed once `BrTextEditorModificationEvent` works." - self editor - when: BrTextEditorModifiedEvent - do: [ :anEvent | self onTextModifiedDueToEvent: anEvent ]. self hasTextualCoderViewModel ifFalse: [ ^ self ]. self onTextualCoderViewModelChanged. From 138386d12b79053c29ad60490f8269b83da49277 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Wed, 13 May 2026 10:50:41 +0200 Subject: [PATCH 1250/1268] Use #gtSelectCoderClass to select a coder instead of using allways the pharo method coder --- .../GtCoderNavigationCompiledMethodsAddOnsCache.class.st | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationCompiledMethodsAddOnsCache.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationCompiledMethodsAddOnsCache.class.st index 17b4c7ac3..3d6d4c57d 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationCompiledMethodsAddOnsCache.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationCompiledMethodsAddOnsCache.class.st @@ -33,8 +33,12 @@ GtCoderNavigationCompiledMethodsAddOnsCache >> addOnsFutureForCompiledMethod: aC coderViewModel := coderViewModelCache at: aCompiledMethod ifPresent: [ :aCoderViewModel | aCoderViewModel ] - ifAbsentPut: [ (GtPharoMethodCoder forMethod: aCompiledMethod) - asCoderViewModel ]. + ifAbsentPut: [ + | coderClass newCoder | + coderClass := aCompiledMethod gtSelectCoderClass. + newCoder := [ coderClass forMethod: aCompiledMethod ] + onErrorDo: [ aCompiledMethod gtMethodCoder forMethod: aCompiledMethod ]. + newCoder asCoderViewModel ]. ^ coderViewModel ] From eda23a3e6e0f7dd202827e3e41b6349124546e21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Wed, 13 May 2026 16:56:48 +0200 Subject: [PATCH 1251/1268] Use #limitedSourceCode for bigMethods --- src/GToolkit-Coder/GtCoderCompiledMethodTextSource.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder/GtCoderCompiledMethodTextSource.class.st b/src/GToolkit-Coder/GtCoderCompiledMethodTextSource.class.st index 0907e98bc..7f542c421 100644 --- a/src/GToolkit-Coder/GtCoderCompiledMethodTextSource.class.st +++ b/src/GToolkit-Coder/GtCoderCompiledMethodTextSource.class.st @@ -25,6 +25,6 @@ GtCoderCompiledMethodTextSource >> compiledMethod: anObject [ GtCoderCompiledMethodTextSource >> computeOriginalSourceText [ ^ (compiledMethod isBigMethod - ifTrue: [ (compiledMethod sourceCode first: 10000), '...' ] + ifTrue: [ (compiledMethod limitedSourceCode), '...' ] ifFalse: [ compiledMethod sourceCode ]) asRopedText ] From b08e84833c06ff0a96dd8390c5a28e4b25460e7e Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 14 May 2026 15:51:07 -0400 Subject: [PATCH 1252/1268] use `GtPharoMethodCoder forMethod: aMethod` [feenkcom/gtoolkit#5062] --- .../GtCoderNavigationCompiledMethodsAddOnsCache.class.st | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCoderNavigationCompiledMethodsAddOnsCache.class.st b/src/GToolkit-Coder-UI/GtCoderNavigationCompiledMethodsAddOnsCache.class.st index 3d6d4c57d..24fa1c8ad 100644 --- a/src/GToolkit-Coder-UI/GtCoderNavigationCompiledMethodsAddOnsCache.class.st +++ b/src/GToolkit-Coder-UI/GtCoderNavigationCompiledMethodsAddOnsCache.class.st @@ -34,10 +34,8 @@ GtCoderNavigationCompiledMethodsAddOnsCache >> addOnsFutureForCompiledMethod: aC at: aCompiledMethod ifPresent: [ :aCoderViewModel | aCoderViewModel ] ifAbsentPut: [ - | coderClass newCoder | - coderClass := aCompiledMethod gtSelectCoderClass. - newCoder := [ coderClass forMethod: aCompiledMethod ] - onErrorDo: [ aCompiledMethod gtMethodCoder forMethod: aCompiledMethod ]. + | newCoder | + newCoder := GtSourceCoder forPharoMethod: aCompiledMethod. newCoder asCoderViewModel ]. ^ coderViewModel From 6afd080d611c2120577dc30fd1ac0d41764438d3 Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Fri, 15 May 2026 18:14:58 +0200 Subject: [PATCH 1253/1268] [feenkcom/gtoolkit-editor#9] update browse implementors and references to use new editor api --- .../GtSourceCoderBrowseImplementorsShortcut.class.st | 3 +-- .../GtSourceCoderBrowseReferencesShortcut.class.st | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBrowseImplementorsShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBrowseImplementorsShortcut.class.st index 419883152..a4e35459c 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderBrowseImplementorsShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderBrowseImplementorsShortcut.class.st @@ -23,8 +23,7 @@ GtSourceCoderBrowseImplementorsShortcut >> name [ { #category : #evaluation } GtSourceCoderBrowseImplementorsShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent requesterObject: aRequester [ - self - forEditor: aBrTextEditor + aBrEditorElement selectedStringDo: [ :aSelectedString | aGtSourceCoder browseImplementorsIn: aSelectedString diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBrowseReferencesShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBrowseReferencesShortcut.class.st index b02da1a8d..f7f8ae511 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderBrowseReferencesShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderBrowseReferencesShortcut.class.st @@ -23,8 +23,7 @@ GtSourceCoderBrowseReferencesShortcut >> name [ { #category : #evaluation } GtSourceCoderBrowseReferencesShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent requesterObject: aRequester [ - self - forEditor: aBrTextEditor + aBrEditorElement selectedStringDo: [ :aSelectedString | aGtSourceCoder browseReferencesIn: aSelectedString From 0556da296e4299adce3dbd1ac58167342663a632 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 15 May 2026 16:18:54 -0400 Subject: [PATCH 1254/1268] editor shortcuts use text editor API [feenkcom/gtoolkit-editor#9] --- .../GtSourceCoderBrowseBehaviorShortcut.class.st | 13 +++---------- .../GtSourceCoderPlayAndInspectShortcut.class.st | 10 ++++++---- .../GtSourceCoderPlayShortcut.class.st | 8 +++++--- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBrowseBehaviorShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBrowseBehaviorShortcut.class.st index d1b7ce006..da2956830 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderBrowseBehaviorShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderBrowseBehaviorShortcut.class.st @@ -23,14 +23,7 @@ GtSourceCoderBrowseBehaviorShortcut >> name [ { #category : #evaluation } GtSourceCoderBrowseBehaviorShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent requesterObject: aRequester [ - self - forEditor: aBrTextEditor - selectedStringDo: [ :aSelectedString | - aGtSourceCoder - browseBehaviorIn: aSelectedString - requesterObject: aRequester ] - orCursorStringPositionDo: [ :aStringPosition | - aGtSourceCoder - browseBehaviorAt: aStringPosition - requesterObject: aRequester ] + aBrEditorElement + selectedStringDo: [ :aSelectedString | aGtSourceCoder browseBehaviorIn: aSelectedString requesterObject: aRequester ] + orCursorStringPositionDo: [ :aStringPosition | aGtSourceCoder browseBehaviorAt: aStringPosition requesterObject: aRequester ] ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderPlayAndInspectShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderPlayAndInspectShortcut.class.st index 50ad27337..a692d1ae3 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderPlayAndInspectShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderPlayAndInspectShortcut.class.st @@ -25,8 +25,10 @@ GtSourceCoderPlayAndInspectShortcut >> name [ GtSourceCoderPlayAndInspectShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent requesterObject: aRequester [ GtCoderExecutionContextVariable element: aBrEditorElement - do: [ - "only execute if there is selection" - aBrTextEditor hasSelection - ifTrue: [ GtSourceCoderDoItAndInspectShortcut new performDueTo: aShortcutEvent ] ] + do: [ + aBrEditorElement + selectedStringDo: [ :aSelectedString | + "only execute if there is selection" + GtSourceCoderDoItAndInspectShortcut new performDueTo: aShortcutEvent ] + orCursorStringPositionDo: [ :aStringPosition | ] ]. ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderPlayShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderPlayShortcut.class.st index b1a91a5e8..8c6978fd2 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderPlayShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderPlayShortcut.class.st @@ -26,7 +26,9 @@ GtSourceCoderPlayShortcut >> performOnEditor: aBrTextEditor element: aBrEditorEl GtCoderExecutionContextVariable element: aBrEditorElement do: [ - "only execute if there is selection" - aBrTextEditor hasSelection - ifTrue: [ GtSourceCoderDoItShortcut new performDueTo: aShortcutEvent ] ] + aBrEditorElement + selectedStringDo: [ :aSelectedString | + "only execute if there is selection" + GtSourceCoderDoItShortcut new performDueTo: aShortcutEvent ] + orCursorStringPositionDo: [ :aStringPosition | ] ]. ] From 7b05c1e121ba65b869fb27baede238ffc8a51540 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 15 May 2026 18:13:30 -0400 Subject: [PATCH 1255/1268] use `#selectedStringDo:orCursorStringPositionDo:` in shortcuts [feenkcom/gtoolkit-editor#9] --- .../GtSourceCoderInlineRenameShortcut.class.st | 5 ++--- .../GtSourceCoderMoveStatementDownShortcut.class.st | 5 ++--- .../GtSourceCoderMoveStatementUpShortcut.class.st | 5 ++--- .../GtSourceCoderSelectStatementDownShortcut.class.st | 5 ++--- .../GtSourceCoderSelectStatementUpShortcut.class.st | 5 ++--- src/GToolkit-Coder-UI/GtSourceCoderShortcut.class.st | 4 ++++ 6 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtSourceCoderInlineRenameShortcut.class.st b/src/GToolkit-Coder-AddOns/GtSourceCoderInlineRenameShortcut.class.st index 379e1167b..212a27b12 100644 --- a/src/GToolkit-Coder-AddOns/GtSourceCoderInlineRenameShortcut.class.st +++ b/src/GToolkit-Coder-AddOns/GtSourceCoderInlineRenameShortcut.class.st @@ -23,9 +23,8 @@ GtSourceCoderInlineRenameShortcut >> name [ { #category : #evaluation } GtSourceCoderInlineRenameShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ - self - forEditor: aBrTextEditor - selectionIntervalDo: [ :aSelectionInterval | + aBrEditorElement + selectedStringDo: [ :aSelectedString :aSelectionInterval | aSourceCoderViewModel coder renameAt: aSelectionInterval last in: aSourceCoderViewModel diff --git a/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementDownShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementDownShortcut.class.st index 9ef73ab35..716b6f99a 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementDownShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementDownShortcut.class.st @@ -23,9 +23,8 @@ GtSourceCoderMoveStatementDownShortcut >> name [ { #category : #accessing } GtSourceCoderMoveStatementDownShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ - self - forEditor: aBrTextEditor - selectionIntervalDo: [ :aSelectionInterval | + aBrEditorElement + selectedStringDo: [ :aSelectedString :aSelectionInterval | aSourceCoderViewModel coder moveStatementsOrCascadesDownWithin: aSelectionInterval in: aSourceCoderViewModel ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementUpShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementUpShortcut.class.st index fadca38c7..9b445ad12 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementUpShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementUpShortcut.class.st @@ -23,9 +23,8 @@ GtSourceCoderMoveStatementUpShortcut >> name [ { #category : #accessing } GtSourceCoderMoveStatementUpShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ - self - forEditor: aBrTextEditor - selectionIntervalDo: [ :aSelectionInterval | + aBrEditorElement + selectedStringDo: [ :aSelectedString :aSelectionInterval | aSourceCoderViewModel coder moveStatementsOrCascadesUpWithin: aSelectionInterval in: aSourceCoderViewModel ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderSelectStatementDownShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderSelectStatementDownShortcut.class.st index c8b84d11c..5117a69ae 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderSelectStatementDownShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderSelectStatementDownShortcut.class.st @@ -23,9 +23,8 @@ GtSourceCoderSelectStatementDownShortcut >> name [ { #category : #accessing } GtSourceCoderSelectStatementDownShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ - self - forEditor: aBrTextEditor - selectionIntervalDo: [ :aSelectionInterval | + aBrEditorElement + selectedStringDo: [ :aSelectedString :aSelectionInterval | aSourceCoderViewModel coder expandStatementSelection: aSelectionInterval downIn: aSourceCoderViewModel ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderSelectStatementUpShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderSelectStatementUpShortcut.class.st index 07a9bbe27..b72721e6c 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderSelectStatementUpShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderSelectStatementUpShortcut.class.st @@ -23,9 +23,8 @@ GtSourceCoderSelectStatementUpShortcut >> name [ { #category : #accessing } GtSourceCoderSelectStatementUpShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ - self - forEditor: aBrTextEditor - selectionIntervalDo: [ :aSelectionInterval | + aBrEditorElement + selectedStringDo: [ :aSelectedString :aSelectionInterval | aSourceCoderViewModel coder expandStatementSelection: aSelectionInterval upIn: aSourceCoderViewModel ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderShortcut.class.st index 0e042471c..49cf6a515 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderShortcut.class.st @@ -6,6 +6,8 @@ Class { { #category : #private } GtSourceCoderShortcut >> forEditor: aBrTextEditor selectedStringDo: aSelectedTextBlock orCursorStringPositionDo: aCursorTextPositionBlock [ + self deprecated: 'Use #selectedStringDo:orCursorStringPositionDo: text editor element API instead'. + aBrTextEditor selectedText ifEmpty: [ aBrTextEditor hasCursors ifTrue: [ @@ -20,6 +22,8 @@ GtSourceCoderShortcut >> forEditor: aBrTextEditor selectedStringDo: aSelectedTex { #category : #private } GtSourceCoderShortcut >> forEditor: aBrTextEditor selectionIntervalDo: aSelectionIntervalBlock orCursorStringPositionDo: aCursorTextPositionBlock [ + self deprecated: 'Use #selectedStringDo:orCursorStringPositionDo: text editor element API instead'. + aBrTextEditor hasSelection ifTrue: [ | aFromIndex aToIndex | From 44d7feff05144535852260ad588d1e45b11e2d7a Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 15 May 2026 22:47:45 -0400 Subject: [PATCH 1256/1268] remove `documentId` assertion in `GtTextualCoderTextAttributes>>#applyOnEditorElement:receivedText:from:to:` [feenkcom/gtoolkit-editor#7] Add `GtCoderTextAttributesDocumentIdIsNilSignal`. --- ...xtAttributesDocumentIdIsNilSignal.class.st | 78 +++++++++++++++++++ .../GtTextualCoderTextAttributes.class.st | 12 ++- 2 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderTextAttributesDocumentIdIsNilSignal.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderTextAttributesDocumentIdIsNilSignal.class.st b/src/GToolkit-Coder-UI/GtCoderTextAttributesDocumentIdIsNilSignal.class.st new file mode 100644 index 000000000..836d40e85 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderTextAttributesDocumentIdIsNilSignal.class.st @@ -0,0 +1,78 @@ +Class { + #name : #GtCoderTextAttributesDocumentIdIsNilSignal, + #superclass : #GtCoderDocumentIdSignal, + #instVars : [ + 'editorElement', + 'receivedText', + 'startPosition', + 'endPosition', + 'coderTextAttributes' + ], + #category : #'GToolkit-Coder-UI-Signals' +} + +{ #category : #accessing } +GtCoderTextAttributesDocumentIdIsNilSignal >> coderTextAttributes [ + ^ coderTextAttributes +] + +{ #category : #accessing } +GtCoderTextAttributesDocumentIdIsNilSignal >> coderTextAttributes: aGtTextualCoderTextAttributes [ + coderTextAttributes := aGtTextualCoderTextAttributes +] + +{ #category : #accessing } +GtCoderTextAttributesDocumentIdIsNilSignal >> editorElement [ + ^ editorElement +] + +{ #category : #accessing } +GtCoderTextAttributesDocumentIdIsNilSignal >> editorElement: anObject [ + editorElement := anObject +] + +{ #category : #accessing } +GtCoderTextAttributesDocumentIdIsNilSignal >> endPosition [ + ^ endPosition +] + +{ #category : #accessing } +GtCoderTextAttributesDocumentIdIsNilSignal >> endPosition: anObject [ + endPosition := anObject +] + +{ #category : #printing } +GtCoderTextAttributesDocumentIdIsNilSignal >> printOneLineContentsOn: aStream [ + aStream + nextPut: $[; + print: startPosition; + nextPut: $,; + print: endPosition; + space; + print: self textAttributes +] + +{ #category : #accessing } +GtCoderTextAttributesDocumentIdIsNilSignal >> receivedText [ + ^ receivedText +] + +{ #category : #accessing } +GtCoderTextAttributesDocumentIdIsNilSignal >> receivedText: anObject [ + receivedText := anObject +] + +{ #category : #accessing } +GtCoderTextAttributesDocumentIdIsNilSignal >> startPosition [ + ^ startPosition +] + +{ #category : #accessing } +GtCoderTextAttributesDocumentIdIsNilSignal >> startPosition: anObject [ + startPosition := anObject +] + +{ #category : #accessing } +GtCoderTextAttributesDocumentIdIsNilSignal >> textAttributes [ + ^ coderTextAttributes ifNotNil: #textAttributes +] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st b/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st index d02ad4ae7..7aaec628d 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st @@ -29,7 +29,17 @@ GtTextualCoderTextAttributes >> applyOnEditorElement: aTextEditorElement receive self flag: #TODO. "Investigate what to do when documentId is nil. Can it even be nil here?" - self assert: [ documentId isNotNil ]. + true + ifTrue: [ documentId ifNil: [ + GtCoderTextAttributesDocumentIdIsNilSignal new + coderTextAttributes: self; + editorElement: aTextEditorElement; + receivedText: aText; + startPosition: aStartPosition; + endPosition: anEndPosition; + emit. + ^ self ] ] + ifFalse: [ self assert: [ documentId isNotNil ] ]. "From where does (aStartPosition to: anEndPosition) come from?" self flag: #TODO. From 4cf36e647909d1db177e2f0d8c8ea715587db96c Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Sat, 16 May 2026 01:44:37 -0400 Subject: [PATCH 1257/1268] add `documentId` signals to detect cause of `nil` values [feenkcom/gtoolkit-editor#8] --- .../GtCoderDocumentIdUpdatedSignal.class.st | 48 +++++++++ ...ributesAddedDocumentIdIsNilSignal.class.st | 82 ++++++++++++++ ...xtAttributesDocumentIdIsNilSignal.class.st | 14 +++ .../GtTextualCoderEditorElement.class.st | 10 ++ .../GtTextualCoderElement.class.st | 8 ++ .../GtTextualCoderViewModel.class.st | 12 ++- ...CoderViewModelTextAttributesAdded.class.st | 5 + ...odelWaitForDocumentIdRepeatedTask.class.st | 102 ++++++++++++++++++ 8 files changed, 280 insertions(+), 1 deletion(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderDocumentIdUpdatedSignal.class.st create mode 100644 src/GToolkit-Coder-UI/GtCoderTextAttributesAddedDocumentIdIsNilSignal.class.st create mode 100644 src/GToolkit-Coder-UI/GtTextualCoderViewModelWaitForDocumentIdRepeatedTask.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderDocumentIdUpdatedSignal.class.st b/src/GToolkit-Coder-UI/GtCoderDocumentIdUpdatedSignal.class.st new file mode 100644 index 000000000..272aaf733 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderDocumentIdUpdatedSignal.class.st @@ -0,0 +1,48 @@ +Class { + #name : #GtCoderDocumentIdUpdatedSignal, + #superclass : #GtCoderDocumentIdSignal, + #instVars : [ + 'texturalCoderViewModel', + 'oldDocumentId', + 'newDocumentId' + ], + #category : #'GToolkit-Coder-UI-Signals' +} + +{ #category : #accessing } +GtCoderDocumentIdUpdatedSignal >> newDocumentId [ + ^ newDocumentId +] + +{ #category : #accessing } +GtCoderDocumentIdUpdatedSignal >> newDocumentId: anObject [ + newDocumentId := anObject +] + +{ #category : #accessing } +GtCoderDocumentIdUpdatedSignal >> oldDocumentId [ + ^ oldDocumentId +] + +{ #category : #accessing } +GtCoderDocumentIdUpdatedSignal >> oldDocumentId: anObject [ + oldDocumentId := anObject +] + +{ #category : #printing } +GtCoderDocumentIdUpdatedSignal >> printOneLineContentsOn: aStream [ + aStream + print: newDocumentId; + nextPutAll: ', old is '; + print: oldDocumentId +] + +{ #category : #accessing } +GtCoderDocumentIdUpdatedSignal >> texturalCoderViewModel [ + ^ texturalCoderViewModel +] + +{ #category : #accessing } +GtCoderDocumentIdUpdatedSignal >> texturalCoderViewModel: anObject [ + texturalCoderViewModel := anObject +] diff --git a/src/GToolkit-Coder-UI/GtCoderTextAttributesAddedDocumentIdIsNilSignal.class.st b/src/GToolkit-Coder-UI/GtCoderTextAttributesAddedDocumentIdIsNilSignal.class.st new file mode 100644 index 000000000..87e6ba3e6 --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderTextAttributesAddedDocumentIdIsNilSignal.class.st @@ -0,0 +1,82 @@ +Class { + #name : #GtCoderTextAttributesAddedDocumentIdIsNilSignal, + #superclass : #GtCoderDocumentIdSignal, + #instVars : [ + 'editorElement', + 'receivedText', + 'startPosition', + 'endPosition', + 'coderTextAttributes' + ], + #category : #'GToolkit-Coder-UI-Signals' +} + +{ #category : #accessing } +GtCoderTextAttributesAddedDocumentIdIsNilSignal >> coderTextAttributes [ + ^ coderTextAttributes +] + +{ #category : #accessing } +GtCoderTextAttributesAddedDocumentIdIsNilSignal >> coderTextAttributes: aGtTextualCoderTextAttributes [ + coderTextAttributes := aGtTextualCoderTextAttributes +] + +{ #category : #accessing } +GtCoderTextAttributesAddedDocumentIdIsNilSignal >> editorElement [ + ^ editorElement +] + +{ #category : #accessing } +GtCoderTextAttributesAddedDocumentIdIsNilSignal >> editorElement: anObject [ + editorElement := anObject +] + +{ #category : #accessing } +GtCoderTextAttributesAddedDocumentIdIsNilSignal >> endPosition [ + ^ endPosition +] + +{ #category : #accessing } +GtCoderTextAttributesAddedDocumentIdIsNilSignal >> endPosition: anObject [ + endPosition := anObject +] + +{ #category : #views } +GtCoderTextAttributesAddedDocumentIdIsNilSignal >> gtTextAttributesViewFor: aView [ + + ^ aView columnedList + title: 'Attributes'; + priority: 0; + items: [ self textAttributes ifNil: [ #() ] ]; + column: 'Index' + text: [ :eachItem :eachIndex | eachIndex asRopedText foreground: Color gray ] + width: 45; + column: 'Attribute' text: [ :each | each gtDisplayString ] +] + +{ #category : #printing } +GtCoderTextAttributesAddedDocumentIdIsNilSignal >> printOneLineContentsOn: aStream [ + aStream + nextPut: $[; + print: startPosition; + nextPut: $,; + print: endPosition; + nextPut: $]; + space; + print: self textAttributes +] + +{ #category : #accessing } +GtCoderTextAttributesAddedDocumentIdIsNilSignal >> startPosition [ + ^ startPosition +] + +{ #category : #accessing } +GtCoderTextAttributesAddedDocumentIdIsNilSignal >> startPosition: anObject [ + startPosition := anObject +] + +{ #category : #accessing } +GtCoderTextAttributesAddedDocumentIdIsNilSignal >> textAttributes [ + ^ coderTextAttributes ifNotNil: #textAttributes +] diff --git a/src/GToolkit-Coder-UI/GtCoderTextAttributesDocumentIdIsNilSignal.class.st b/src/GToolkit-Coder-UI/GtCoderTextAttributesDocumentIdIsNilSignal.class.st index 836d40e85..1da9e9ea9 100644 --- a/src/GToolkit-Coder-UI/GtCoderTextAttributesDocumentIdIsNilSignal.class.st +++ b/src/GToolkit-Coder-UI/GtCoderTextAttributesDocumentIdIsNilSignal.class.st @@ -41,6 +41,19 @@ GtCoderTextAttributesDocumentIdIsNilSignal >> endPosition: anObject [ endPosition := anObject ] +{ #category : #views } +GtCoderTextAttributesDocumentIdIsNilSignal >> gtTextAttributesViewFor: aView [ + + ^ aView columnedList + title: 'Attributes'; + priority: 0; + items: [ self textAttributes ifNil: [ #() ] ]; + column: 'Index' + text: [ :eachItem :eachIndex | eachIndex asRopedText foreground: Color gray ] + width: 45; + column: 'Attribute' text: [ :each | each gtDisplayString ] +] + { #category : #printing } GtCoderTextAttributesDocumentIdIsNilSignal >> printOneLineContentsOn: aStream [ aStream @@ -48,6 +61,7 @@ GtCoderTextAttributesDocumentIdIsNilSignal >> printOneLineContentsOn: aStream [ print: startPosition; nextPut: $,; print: endPosition; + nextPut: $]; space; print: self textAttributes ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st index 3e5551fbc..8e9c53a40 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderEditorElement.class.st @@ -561,6 +561,16 @@ GtTextualCoderEditorElement >> onViewModelStylersChanged [ { #category : #'private - event handling' } GtTextualCoderEditorElement >> onViewModelTextAttributesAdded: anAnnouncement [ + self textualCoderViewModel = anAnnouncement textualCoderViewModel ifFalse: [ ^ self ]. + + anAnnouncement documentId ifNil: [ + GtCoderTextAttributesAddedDocumentIdIsNilSignal new + coderTextAttributes: anAnnouncement coderTextAttributes; + editorElement: self; + startPosition: anAnnouncement startPosition; + endPosition: anAnnouncement stopPosition; + emit ]. + self enqueueTask: (BlTaskAction new action: [ anAnnouncement text characters = self text characters ifTrue: [ diff --git a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st index 39091980c..1d277258b 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderElement.class.st @@ -691,6 +691,14 @@ GtTextualCoderElement >> onViewModelTextAttributesAdded: anAnnouncement [ self textualCoderViewModel = anAnnouncement textualCoderViewModel ifFalse: [ ^ self ]. + anAnnouncement documentId ifNil: [ + GtCoderTextAttributesAddedDocumentIdIsNilSignal new + coderTextAttributes: anAnnouncement coderTextAttributes; + editorElement: self; + startPosition: anAnnouncement startPosition; + endPosition: anAnnouncement stopPosition; + emit ]. + self enqueueTask: (BlTaskAction new action: [ anAnnouncement coderTextAttributes applyOnEditorElement: editorElement diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index a0a4102ff..a26af726e 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -431,7 +431,17 @@ GtTextualCoderViewModel >> documentId [ { #category : #accessing } GtTextualCoderViewModel >> documentId: anObject [ - documentId := anObject + | oldDocumentId | + documentId = anObject ifTrue: [ ^ self ]. + + oldDocumentId := documentId. + documentId := anObject. + + GtCoderDocumentIdUpdatedSignal new + texturalCoderViewModel: self; + oldDocumentId: oldDocumentId; + newDocumentId: anObject; + emit ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextAttributesAdded.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextAttributesAdded.class.st index 8b8cf6316..69df637c8 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextAttributesAdded.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelTextAttributesAdded.class.st @@ -20,6 +20,11 @@ GtTextualCoderViewModelTextAttributesAdded >> coderTextAttributes: anObject [ coderTextAttributes := anObject ] +{ #category : #accessing } +GtTextualCoderViewModelTextAttributesAdded >> documentId [ + ^ self coderTextAttributes ifNotNil: #documentId +] + { #category : #accessing } GtTextualCoderViewModelTextAttributesAdded >> startPosition [ ^ startPosition diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModelWaitForDocumentIdRepeatedTask.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModelWaitForDocumentIdRepeatedTask.class.st new file mode 100644 index 000000000..e73e7019d --- /dev/null +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModelWaitForDocumentIdRepeatedTask.class.st @@ -0,0 +1,102 @@ +Class { + #name : #GtTextualCoderViewModelWaitForDocumentIdRepeatedTask, + #superclass : #BlRepeatedTask, + #instVars : [ + 'textualCoderViewModel', + 'onUpdatedBlock', + 'onMissedBlock', + 'maxRepetitions', + 'counter' + ], + #category : #'GToolkit-Coder-UI-Coder - Textual Model' +} + +{ #category : #initialization } +GtTextualCoderViewModelWaitForDocumentIdRepeatedTask >> initialize [ + super initialize. + + onUpdatedBlock := [ :aTextualCoderViewModel :aDocumentId | ]. + onMissedBlock := [ :aTextualCoderViewModel | ]. + + "Wait delay * maxRepetitions time, + which is approximately 500ms * 144 = 72 seconds" + maxRepetitions := 144. + counter := 0. +] + +{ #category : #accessing } +GtTextualCoderViewModelWaitForDocumentIdRepeatedTask >> maxRepetitions [ + ^ maxRepetitions +] + +{ #category : #accessing } +GtTextualCoderViewModelWaitForDocumentIdRepeatedTask >> maxRepetitions: anInteger [ + maxRepetitions := anInteger +] + +{ #category : #private } +GtTextualCoderViewModelWaitForDocumentIdRepeatedTask >> missed [ + onMissedBlock ifNotNil: [ :aBlock | + aBlock cull: textualCoderViewModel ]. + self stop. +] + +{ #category : #hooks } +GtTextualCoderViewModelWaitForDocumentIdRepeatedTask >> onEnqueuedInElement: anElement [ + element == anElement + ifFalse: [ counter := 0 ]. + + super onEnqueuedInElement: anElement. +] + +{ #category : #accessing } +GtTextualCoderViewModelWaitForDocumentIdRepeatedTask >> onMissedBlock [ + + ^ onMissedBlock +] + +{ #category : #accessing } +GtTextualCoderViewModelWaitForDocumentIdRepeatedTask >> onMissedBlock: aBlock [ + + onMissedBlock := aBlock +] + +{ #category : #'api - running' } +GtTextualCoderViewModelWaitForDocumentIdRepeatedTask >> onRun [ + | documentId | + textualCoderViewModel ifNil: [ self missed. ^ self ]. + counter > maxRepetitions ifTrue: [ self missed. ^ self ]. + counter := counter + 1. + + documentId := textualCoderViewModel documentId ifNil: [ ^ self ]. + + onUpdatedBlock ifNotNil: [ :aBlock | + aBlock cull: textualCoderViewModel cull: documentId ]. + self stop +] + +{ #category : #accessing } +GtTextualCoderViewModelWaitForDocumentIdRepeatedTask >> onUpdatedBlock [ + ^ onUpdatedBlock +] + +{ #category : #accessing } +GtTextualCoderViewModelWaitForDocumentIdRepeatedTask >> onUpdatedBlock: aBlock [ + onUpdatedBlock := aBlock +] + +{ #category : #'api - running' } +GtTextualCoderViewModelWaitForDocumentIdRepeatedTask >> stop [ + super stop. + counter := 0. +] + +{ #category : #accessing } +GtTextualCoderViewModelWaitForDocumentIdRepeatedTask >> textualCoderViewModel [ + ^ textualCoderViewModel +] + +{ #category : #accessing } +GtTextualCoderViewModelWaitForDocumentIdRepeatedTask >> textualCoderViewModel: anObject [ + textualCoderViewModel := anObject +] From 516bca0bca209a5c641293bb93159f781b7df4b0 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Sat, 16 May 2026 02:15:00 -0400 Subject: [PATCH 1258/1268] signal deprecated text attributes [feenkcom/gtoolkit-editor#7] --- ...eprecatedTextAttributeAddedSignal.class.st | 37 +++++++++++++++++++ .../GtTextualCoderTextAttributes.class.st | 11 +++++- .../GtTextualCoderViewModel.class.st | 4 +- 3 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 src/GToolkit-Coder-UI/GtCoderDeprecatedTextAttributeAddedSignal.class.st diff --git a/src/GToolkit-Coder-UI/GtCoderDeprecatedTextAttributeAddedSignal.class.st b/src/GToolkit-Coder-UI/GtCoderDeprecatedTextAttributeAddedSignal.class.st new file mode 100644 index 000000000..7cdbbfcca --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderDeprecatedTextAttributeAddedSignal.class.st @@ -0,0 +1,37 @@ +Class { + #name : #GtCoderDeprecatedTextAttributeAddedSignal, + #superclass : #ContextStackSignal, + #instVars : [ + 'coderTextAttributes', + 'deprecatedAttribute' + ], + #category : #'GToolkit-Coder-UI-Signals' +} + +{ #category : #accessing } +GtCoderDeprecatedTextAttributeAddedSignal >> coderTextAttributes [ + ^ coderTextAttributes +] + +{ #category : #accessing } +GtCoderDeprecatedTextAttributeAddedSignal >> coderTextAttributes: anObject [ + coderTextAttributes := anObject +] + +{ #category : #accessing } +GtCoderDeprecatedTextAttributeAddedSignal >> deprecatedAttribute [ + ^ deprecatedAttribute +] + +{ #category : #accessing } +GtCoderDeprecatedTextAttributeAddedSignal >> deprecatedAttribute: anObject [ + deprecatedAttribute := anObject +] + +{ #category : #printing } +GtCoderDeprecatedTextAttributeAddedSignal >> printOneLineContentsOn: stream [ + stream + nextPutAll: '! '; + print: deprecatedAttribute; + space +] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st b/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st index 7aaec628d..2a1e6c236 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderTextAttributes.class.st @@ -192,6 +192,13 @@ GtTextualCoderTextAttributes >> textAttributes [ ] { #category : #accessing } -GtTextualCoderTextAttributes >> textAttributes: anObject [ - textAttributes := anObject +GtTextualCoderTextAttributes >> textAttributes: aCollection [ + textAttributes := aCollection. + + aCollection do: [ :eachAttribute | + (eachAttribute isKindOf: BlTextHighlightAttribute) ifTrue: [ + GtCoderDeprecatedTextAttributeAddedSignal new + coderTextAttributes: self; + deprecatedAttribute: eachAttribute; + emit ] ] ] diff --git a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st index a26af726e..a17fa511a 100644 --- a/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st +++ b/src/GToolkit-Coder-UI/GtTextualCoderViewModel.class.st @@ -146,7 +146,7 @@ GtTextualCoderViewModel >> addTextAttributes: aCollectionOfTextAttributes onText "If documentId is different, do nothing." self flag: #TODO. - documentId ifNotNil: [ + "documentId ifNotNil: [" aDocumentId ifNil: [ GtCoderDocumentIdIsNilSignal new @@ -157,7 +157,7 @@ GtTextualCoderViewModel >> addTextAttributes: aCollectionOfTextAttributes onText GtCoderDocumentIdDifferentSignal new originalDocumentId: documentId; receivedDocumentId: aDocumentId; - emit ] ] ]. + emit ] ] "]". aMarkerAttribute := BrTextInvisibleMarkerAttribute new beNotOverwritableByStyler. From dcb5879144809f42b6434b54b50812023428fdfb Mon Sep 17 00:00:00 2001 From: Aliaksei Syrel Date: Thu, 21 May 2026 10:29:03 +0200 Subject: [PATCH 1259/1268] rename selectedStringDo: to selectedStringAndIntervalDo: --- .../GtSourceCoderInlineRenameShortcut.class.st | 4 ++-- .../GtSourceCoderBrowseBehaviorShortcut.class.st | 4 ++-- .../GtSourceCoderBrowseImplementorsShortcut.class.st | 4 ++-- .../GtSourceCoderBrowseReferencesShortcut.class.st | 4 ++-- .../GtSourceCoderMoveStatementDownShortcut.class.st | 4 ++-- .../GtSourceCoderMoveStatementUpShortcut.class.st | 4 ++-- .../GtSourceCoderPlayAndInspectShortcut.class.st | 4 ++-- src/GToolkit-Coder-UI/GtSourceCoderPlayShortcut.class.st | 4 ++-- .../GtSourceCoderSelectStatementDownShortcut.class.st | 4 ++-- .../GtSourceCoderSelectStatementUpShortcut.class.st | 4 ++-- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtSourceCoderInlineRenameShortcut.class.st b/src/GToolkit-Coder-AddOns/GtSourceCoderInlineRenameShortcut.class.st index 212a27b12..e2f8390da 100644 --- a/src/GToolkit-Coder-AddOns/GtSourceCoderInlineRenameShortcut.class.st +++ b/src/GToolkit-Coder-AddOns/GtSourceCoderInlineRenameShortcut.class.st @@ -24,13 +24,13 @@ GtSourceCoderInlineRenameShortcut >> name [ { #category : #evaluation } GtSourceCoderInlineRenameShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ aBrEditorElement - selectedStringDo: [ :aSelectedString :aSelectionInterval | + selectedStringAndIntervalDo: [ :aSelectedString :aSelectionInterval | aSourceCoderViewModel coder renameAt: aSelectionInterval last in: aSourceCoderViewModel documentId: aSourceCoderViewModel documentId for: aBrEditorElement ] - orCursorStringPositionDo: [ :aCursorTextPosition | + orCursorPositionDo: [ :aCursorTextPosition | aSourceCoderViewModel coder renameAt: aCursorTextPosition in: aSourceCoderViewModel diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBrowseBehaviorShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBrowseBehaviorShortcut.class.st index da2956830..678c75463 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderBrowseBehaviorShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderBrowseBehaviorShortcut.class.st @@ -24,6 +24,6 @@ GtSourceCoderBrowseBehaviorShortcut >> name [ { #category : #evaluation } GtSourceCoderBrowseBehaviorShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent requesterObject: aRequester [ aBrEditorElement - selectedStringDo: [ :aSelectedString | aGtSourceCoder browseBehaviorIn: aSelectedString requesterObject: aRequester ] - orCursorStringPositionDo: [ :aStringPosition | aGtSourceCoder browseBehaviorAt: aStringPosition requesterObject: aRequester ] + selectedStringAndIntervalDo: [ :aSelectedString | aGtSourceCoder browseBehaviorIn: aSelectedString requesterObject: aRequester ] + orCursorPositionDo: [ :aStringPosition | aGtSourceCoder browseBehaviorAt: aStringPosition requesterObject: aRequester ] ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBrowseImplementorsShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBrowseImplementorsShortcut.class.st index a4e35459c..510c3a861 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderBrowseImplementorsShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderBrowseImplementorsShortcut.class.st @@ -24,11 +24,11 @@ GtSourceCoderBrowseImplementorsShortcut >> name [ { #category : #evaluation } GtSourceCoderBrowseImplementorsShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent requesterObject: aRequester [ aBrEditorElement - selectedStringDo: [ :aSelectedString | + selectedStringAndIntervalDo: [ :aSelectedString | aGtSourceCoder browseImplementorsIn: aSelectedString requesterObject: aRequester ] - orCursorStringPositionDo: [ :aStringPosition | + orCursorPositionDo: [ :aStringPosition | aGtSourceCoder browseImplementorsAt: aStringPosition requesterObject: aRequester ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderBrowseReferencesShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderBrowseReferencesShortcut.class.st index f7f8ae511..4fd43c536 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderBrowseReferencesShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderBrowseReferencesShortcut.class.st @@ -24,11 +24,11 @@ GtSourceCoderBrowseReferencesShortcut >> name [ { #category : #evaluation } GtSourceCoderBrowseReferencesShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent requesterObject: aRequester [ aBrEditorElement - selectedStringDo: [ :aSelectedString | + selectedStringAndIntervalDo: [ :aSelectedString | aGtSourceCoder browseReferencesIn: aSelectedString requesterObject: aRequester ] - orCursorStringPositionDo: [ :aStringPosition | + orCursorPositionDo: [ :aStringPosition | aGtSourceCoder browseReferencesAt: aStringPosition requesterObject: aRequester ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementDownShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementDownShortcut.class.st index 716b6f99a..395ca17b9 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementDownShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementDownShortcut.class.st @@ -24,11 +24,11 @@ GtSourceCoderMoveStatementDownShortcut >> name [ { #category : #accessing } GtSourceCoderMoveStatementDownShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ aBrEditorElement - selectedStringDo: [ :aSelectedString :aSelectionInterval | + selectedStringAndIntervalDo: [ :aSelectedString :aSelectionInterval | aSourceCoderViewModel coder moveStatementsOrCascadesDownWithin: aSelectionInterval in: aSourceCoderViewModel ] - orCursorStringPositionDo: [ :aCursorTextPosition | + orCursorPositionDo: [ :aCursorTextPosition | aSourceCoderViewModel coder moveStatementOrCascadeDownAt: aCursorTextPosition in: aSourceCoderViewModel ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementUpShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementUpShortcut.class.st index 9b445ad12..12ee0523e 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementUpShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderMoveStatementUpShortcut.class.st @@ -24,11 +24,11 @@ GtSourceCoderMoveStatementUpShortcut >> name [ { #category : #accessing } GtSourceCoderMoveStatementUpShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ aBrEditorElement - selectedStringDo: [ :aSelectedString :aSelectionInterval | + selectedStringAndIntervalDo: [ :aSelectedString :aSelectionInterval | aSourceCoderViewModel coder moveStatementsOrCascadesUpWithin: aSelectionInterval in: aSourceCoderViewModel ] - orCursorStringPositionDo: [ :aCursorTextPosition | + orCursorPositionDo: [ :aCursorTextPosition | aSourceCoderViewModel coder moveStatementOrCascadeUpAt: aCursorTextPosition in: aSourceCoderViewModel ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderPlayAndInspectShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderPlayAndInspectShortcut.class.st index a692d1ae3..69f3ac0d2 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderPlayAndInspectShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderPlayAndInspectShortcut.class.st @@ -27,8 +27,8 @@ GtSourceCoderPlayAndInspectShortcut >> performOnEditor: aBrTextEditor element: a element: aBrEditorElement do: [ aBrEditorElement - selectedStringDo: [ :aSelectedString | + selectedStringAndIntervalDo: [ :aSelectedString | "only execute if there is selection" GtSourceCoderDoItAndInspectShortcut new performDueTo: aShortcutEvent ] - orCursorStringPositionDo: [ :aStringPosition | ] ]. + orCursorPositionDo: [ :aStringPosition | ] ]. ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderPlayShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderPlayShortcut.class.st index 8c6978fd2..cf5556d9a 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderPlayShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderPlayShortcut.class.st @@ -27,8 +27,8 @@ GtSourceCoderPlayShortcut >> performOnEditor: aBrTextEditor element: aBrEditorEl element: aBrEditorElement do: [ aBrEditorElement - selectedStringDo: [ :aSelectedString | + selectedStringAndIntervalDo: [ :aSelectedString | "only execute if there is selection" GtSourceCoderDoItShortcut new performDueTo: aShortcutEvent ] - orCursorStringPositionDo: [ :aStringPosition | ] ]. + orCursorPositionDo: [ :aStringPosition | ] ]. ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderSelectStatementDownShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderSelectStatementDownShortcut.class.st index 5117a69ae..f1e9a393b 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderSelectStatementDownShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderSelectStatementDownShortcut.class.st @@ -24,11 +24,11 @@ GtSourceCoderSelectStatementDownShortcut >> name [ { #category : #accessing } GtSourceCoderSelectStatementDownShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ aBrEditorElement - selectedStringDo: [ :aSelectedString :aSelectionInterval | + selectedStringAndIntervalDo: [ :aSelectedString :aSelectionInterval | aSourceCoderViewModel coder expandStatementSelection: aSelectionInterval downIn: aSourceCoderViewModel ] - orCursorStringPositionDo: [ :aCursorTextPosition | + orCursorPositionDo: [ :aCursorTextPosition | aSourceCoderViewModel coder selectStatementOrCascadeAt: aCursorTextPosition in: aSourceCoderViewModel ] diff --git a/src/GToolkit-Coder-UI/GtSourceCoderSelectStatementUpShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderSelectStatementUpShortcut.class.st index b72721e6c..93ed4854b 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderSelectStatementUpShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderSelectStatementUpShortcut.class.st @@ -24,11 +24,11 @@ GtSourceCoderSelectStatementUpShortcut >> name [ { #category : #accessing } GtSourceCoderSelectStatementUpShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coderViewModel: aSourceCoderViewModel dueTo: aShortcutEvent [ aBrEditorElement - selectedStringDo: [ :aSelectedString :aSelectionInterval | + selectedStringAndIntervalDo: [ :aSelectedString :aSelectionInterval | aSourceCoderViewModel coder expandStatementSelection: aSelectionInterval upIn: aSourceCoderViewModel ] - orCursorStringPositionDo: [ :aCursorTextPosition | + orCursorPositionDo: [ :aCursorTextPosition | aSourceCoderViewModel coder selectStatementOrCascadeAt: aCursorTextPosition in: aSourceCoderViewModel ] From 213babe356d5e53cd95e5313b30b8e664b16aeba Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 21 May 2026 19:35:13 -0400 Subject: [PATCH 1260/1268] Add a basic package comment view --- .../Package.extension.st | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/GToolkit-Coder-Extensions/Package.extension.st b/src/GToolkit-Coder-Extensions/Package.extension.st index c0ee1f931..96e0f8953 100644 --- a/src/GToolkit-Coder-Extensions/Package.extension.st +++ b/src/GToolkit-Coder-Extensions/Package.extension.st @@ -83,3 +83,26 @@ Package >> gtDefinedTagsFor: aView context: aPhlowContext [ asSortedCollection: [ :a :b | a packageTagName < b packageTagName ]); addEventFilterOn: BlClickEvent do: [ :anEvent | anEvent currentTarget requestFocus ] ] ] + +{ #category : #'*GToolkit-Coder-Extensions' } +Package >> gtPackageCommentViewFor: aView context: aPhlowContext [ + + (aPhlowContext isKindOf: GtPhlowExecutionContext) ifFalse: [ ^ aView empty ]. + aPhlowContext hasPackageCoder ifFalse: [ ^ aView empty ]. + + ^ aView textEditor + priority: 5; + title: 'Comment'; + text: [ aPhlowContext packageCoder package packageComment ]; + actionButtonIcon: BrGlamorousVectorIcons accept + tooltip: 'Save package comment' + action: [ :aButton | + aButton phlow firstParentWithViewContent + ifNotNil: [ :anElement | + anElement phlow firstChildWithViewContent + ifNotNil: [ :aChild | + aChild + childWithId: #editor + ifFound: [ :anEditor | aPhlowContext packageCoder package packageComment: anEditor text asString ] + ifNone: [ ] ] ] ] +] From 4fca305c0119193699e2072412ca78667db80393 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 25 May 2026 10:37:56 -0400 Subject: [PATCH 1261/1268] add `GtTextFolderAttributeV2` [feenkcom/gtoolkit-editor#9] - add `#styledTextAttributesDo:` text editor API - clicking on the folding expander works - the folding shortcut works in existing text editor --- .../GtSourceCoderFoldNoiseShortcut.class.st | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderFoldNoiseShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderFoldNoiseShortcut.class.st index 7f13cb8fb..4db38b885 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderFoldNoiseShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderFoldNoiseShortcut.class.st @@ -25,12 +25,11 @@ GtSourceCoderFoldNoiseShortcut >> name [ GtSourceCoderFoldNoiseShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent requesterObject: aRequester [ | folding | folding := nil. - aBrTextEditor text - attributesDo: [ :arr | - arr - detect: [ :att | att class == GtTextFolderAttribute ] - ifFound: [ :att | - folding ifNil: [ folding := att isExpanded ]. - att isExpanded: folding not. - att applyExpandedOrCollapsedAttributesOnText: aBrTextEditor text ] ] + aBrTextEditor styledTextAttributesDo: [ :someAttributes | + someAttributes + detect: [ :eachAttribute | eachAttribute class == GtTextFolderAttributeV2 ] + ifFound: [ :aFoundAttribute | + folding ifNil: [ folding := aFoundAttribute isExpanded ]. + aFoundAttribute isExpanded: folding not. + aFoundAttribute applyExpandedOrCollapsedIn: aBrEditorElement ] ] ] From c7db9e7275c5d2a6bcd7e9fdaf015e57587da300 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Mon, 25 May 2026 16:30:10 -0400 Subject: [PATCH 1262/1268] revert the folding attribute changes [feenkcom/gtoolkit-editor#9] --- src/GToolkit-Coder-UI/GtSourceCoderFoldNoiseShortcut.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderFoldNoiseShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderFoldNoiseShortcut.class.st index 4db38b885..dd549dd99 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderFoldNoiseShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderFoldNoiseShortcut.class.st @@ -27,7 +27,7 @@ GtSourceCoderFoldNoiseShortcut >> performOnEditor: aBrTextEditor element: aBrEdi folding := nil. aBrTextEditor styledTextAttributesDo: [ :someAttributes | someAttributes - detect: [ :eachAttribute | eachAttribute class == GtTextFolderAttributeV2 ] + detect: [ :eachAttribute | eachAttribute class == GtTextFolderAttribute ] ifFound: [ :aFoundAttribute | folding ifNil: [ folding := aFoundAttribute isExpanded ]. aFoundAttribute isExpanded: folding not. From 44a24ef05690e8e56c3b8f41df3103c4b7410149 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Wed, 27 May 2026 23:03:05 +0200 Subject: [PATCH 1263/1268] Remove unused #methodsCoderFromContext --- src/GToolkit-Coder-Extensions/Behavior.extension.st | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/GToolkit-Coder-Extensions/Behavior.extension.st b/src/GToolkit-Coder-Extensions/Behavior.extension.st index b55f47216..1c521199e 100644 --- a/src/GToolkit-Coder-Extensions/Behavior.extension.st +++ b/src/GToolkit-Coder-Extensions/Behavior.extension.st @@ -19,10 +19,3 @@ Behavior >> gtBrowseFrom: anElement [ icon: BrGlamorousVectorIcons browse; showFrom: anElement ] - -{ #category : #'*GToolkit-Coder-Extensions' } -Behavior >> methodsCoderFromContext: aPhlowContext [ - - - ^ (GtClassMethodsCoder forClass: self) asCoderViewModel -] From 7ff7fd681837acab3f7ac9b4649676ab9997ba65 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Thu, 28 May 2026 11:28:47 -0400 Subject: [PATCH 1264/1268] enable fold noise shortcut [feenkcom/gtoolkit-editor#9] use `BrGlamorousFolderTextAttributeV2` --- .../GtSourceCoderFoldNoiseShortcut.class.st | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtSourceCoderFoldNoiseShortcut.class.st b/src/GToolkit-Coder-UI/GtSourceCoderFoldNoiseShortcut.class.st index dd549dd99..914794df6 100644 --- a/src/GToolkit-Coder-UI/GtSourceCoderFoldNoiseShortcut.class.st +++ b/src/GToolkit-Coder-UI/GtSourceCoderFoldNoiseShortcut.class.st @@ -25,11 +25,13 @@ GtSourceCoderFoldNoiseShortcut >> name [ GtSourceCoderFoldNoiseShortcut >> performOnEditor: aBrTextEditor element: aBrEditorElement coder: aGtSourceCoder dueTo: aShortcutEvent requesterObject: aRequester [ | folding | folding := nil. - aBrTextEditor styledTextAttributesDo: [ :someAttributes | - someAttributes - detect: [ :eachAttribute | eachAttribute class == GtTextFolderAttribute ] - ifFound: [ :aFoundAttribute | - folding ifNil: [ folding := aFoundAttribute isExpanded ]. - aFoundAttribute isExpanded: folding not. - aFoundAttribute applyExpandedOrCollapsedIn: aBrEditorElement ] ] + aBrTextEditor + styledTextAttributesDo: [ :someAttributes | + someAttributes + detect: [ :eachAttribute | + eachAttribute class == GtTextFolderAttribute + or: [ eachAttribute class == BrGlamorousFolderTextAttributeV2 ] ] + ifFound: [ :aFoundAttribute | + folding ifNil: [ folding := aFoundAttribute isFolded not ]. + aFoundAttribute isFolded: folding fromTextEditorElement: aBrEditorElement ] ] ] From 3b6b5577e8a42753ac3d23cb3289d3c9b1d7daa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Wed, 3 Jun 2026 18:43:07 +0200 Subject: [PATCH 1265/1268] Update GtCreationForm to not depend on tags --- src/GToolkit-Coder-UI/GtCreationForm.class.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-UI/GtCreationForm.class.st b/src/GToolkit-Coder-UI/GtCreationForm.class.st index ff2d80157..ee2c87cd2 100644 --- a/src/GToolkit-Coder-UI/GtCreationForm.class.st +++ b/src/GToolkit-Coder-UI/GtCreationForm.class.st @@ -181,10 +181,10 @@ GtCreationForm >> selectInNavigationModel: aNavigationModel anInstance: anInstan ifNotEmpty: [ anInstance packageTag ifNotNil: [ :aPackageTag | aPackageTag isRoot ifFalse: [ - anInstance tags ifNotEmpty: [ :anInstanceTags | + anInstance packageTagName ifNotNil: [ :aPackageTagName | aNavigationModel selectPackageTag: (anInstance package - tagNamed: anInstanceTags first) ] ] ] ]. + tagNamed: aPackageTagName) ] ] ] ]. aNavigationModel selectClass: anInstance ] From 5e82c39fd03dd119f4a87c44ca4297435fb0194c Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 3 Jun 2026 17:01:32 -0400 Subject: [PATCH 1266/1268] update `GtFixItAttribute>>#addHoveringStylingFor:to:` [feenkcom/gtoolkit-editor#9] --- .../GtFixItAttribute.class.st | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st index 02df3acae..3cb448f0d 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st @@ -5,9 +5,9 @@ Class { 'fixItActionsBlock', 'descriptionBlock', 'hoverMarker', - 'hoverAttribute', 'label', - 'elementId' + 'elementId', + 'hoverHighlight' ], #category : #'GToolkit-Coder-AddOns-FixIt' } @@ -15,17 +15,15 @@ Class { { #category : #accessing } GtFixItAttribute >> addHoveringStylingFor: anEditorElement to: anElement [ hoverMarker ifNil: [ ^ self ]. + hoverHighlight ifNil: [ ^ self ]. anElement when: BlMouseEnterEvent do: [ :anEvent | - anEditorElement editor text - findAttribute: hoverMarker - indicesDo: [ :aHighlightStart :aHighlightEnd | - (anEditorElement text from: aHighlightStart to: aHighlightEnd) - attribute: hoverAttribute ] ]. + anEditorElement addHighlight: hoverHighlight overMarker: hoverMarker ]. anElement when: BlMouseLeaveEvent - do: [ :anEvent | anEditorElement text clearAttributes: [ :each | each == hoverAttribute ] ] + do: [ :anEvent | + anEditorElement removeHighlightsWithId: hoverHighlight id ] ] { #category : #accessing } @@ -162,12 +160,12 @@ GtFixItAttribute >> fixItActions: aCollection [ { #category : #accessing } GtFixItAttribute >> hoverAttribute [ - ^ hoverAttribute + ^ hoverHighlight ] { #category : #accessing } GtFixItAttribute >> hoverAttribute: aTextAttribute [ - hoverAttribute := aTextAttribute + hoverHighlight := aTextAttribute ] { #category : #accessing } From 3235dd4fd4870bf9eb65cca3f0cebd523a0ed872 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Fri, 5 Jun 2026 20:31:48 +0200 Subject: [PATCH 1267/1268] Add tool annotations to RGMethodDefinition [feenkcom/gtoolkit#5097] --- src/GToolkit-Coder-Extensions/RGMethodDefinition.extension.st | 1 + 1 file changed, 1 insertion(+) diff --git a/src/GToolkit-Coder-Extensions/RGMethodDefinition.extension.st b/src/GToolkit-Coder-Extensions/RGMethodDefinition.extension.st index 40847604d..2cdad1093 100644 --- a/src/GToolkit-Coder-Extensions/RGMethodDefinition.extension.st +++ b/src/GToolkit-Coder-Extensions/RGMethodDefinition.extension.st @@ -3,6 +3,7 @@ Extension { #name : #RGMethodDefinition } { #category : #'*GToolkit-Coder-Extensions' } RGMethodDefinition >> gtLocalVersionsFor: aView [ + self isDefined ifFalse: [ ^aView empty]. From 61232ef1166da241e19ac1296dfc443069a3b70c Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Fri, 5 Jun 2026 15:22:40 -0400 Subject: [PATCH 1268/1268] `GtFixItButton` listens to fixIt announcements [feenkcom/gtoolkit-editor#9] --- .../GtFixItAttribute.class.st | 16 +++++++- .../GtFixItButton.class.st | 40 +++++++++++++++++++ 2 files changed, 54 insertions(+), 2 deletions(-) diff --git a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st index 3cb448f0d..664697959 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItAttribute.class.st @@ -7,7 +7,8 @@ Class { 'hoverMarker', 'label', 'elementId', - 'hoverHighlight' + 'hoverHighlight', + 'model' ], #category : #'GToolkit-Coder-AddOns-FixIt' } @@ -66,7 +67,8 @@ GtFixItAttribute >> doAffect: aTBrTextEditorTextualPiece in: anEditorElement [ elementId ifNotNil: [ button id: elementId ]. button beTinySize. button label: (label ifNil: [ 'Fix it' ]). - + model ifNotNil: [ :aModel | button fixItModel: aModel ]. + dropDownAptitude := BrGlamorousWithExplicitDropdownAptitude handle: [ | dropdownButton | dropdownButton := BrButton new. @@ -199,3 +201,13 @@ GtFixItAttribute >> label: aString [ GtFixItAttribute >> mayHaveExternalReferences [ ^ true ] + +{ #category : #accessing } +GtFixItAttribute >> model [ + ^ model +] + +{ #category : #accessing } +GtFixItAttribute >> model: anObject [ + model := anObject +] diff --git a/src/GToolkit-Coder-AddOns/GtFixItButton.class.st b/src/GToolkit-Coder-AddOns/GtFixItButton.class.st index a3248280d..08a091399 100644 --- a/src/GToolkit-Coder-AddOns/GtFixItButton.class.st +++ b/src/GToolkit-Coder-AddOns/GtFixItButton.class.st @@ -1,5 +1,45 @@ Class { #name : #GtFixItButton, #superclass : #BrButton, + #instVars : [ + 'fixItModel' + ], #category : #'GToolkit-Coder-AddOns-FixIt' } + +{ #category : #accessing } +GtFixItButton >> fixItModel [ + ^ fixItModel +] + +{ #category : #accessing } +GtFixItButton >> fixItModel: anObject [ + self + assert: [ anObject isNotNil ] + description: [ 'FixIt model must be non-nil' ]. + + fixItModel = anObject ifTrue: [ ^ self ]. + + fixItModel := anObject. + self onFixItModelChanged +] + +{ #category : #hooks } +GtFixItButton >> onFixItModelChanged [ + fixItModel + when: GtFixItAdviceModelShowDropdownAnnouncement + send: #onGtFixItAdviceModelShowDropdownAnnouncement: + to: self +] + +{ #category : #'private - event handling' } +GtFixItButton >> onGtFixItAdviceModelShowDropdownAnnouncement: anAnnouncement [ + self fixItModel = anAnnouncement model ifFalse: [ ^ self ]. + + BlTaskAction enqueueElement: self action: [ self updateShowFixItDropdown ] +] + +{ #category : #'private - updating' } +GtFixItButton >> updateShowFixItDropdown [ + self dispatchEvent: (BrDropdownShowWish new anchor: self) +]