Skip to content

Commit

Permalink
browser: indicate out-of-sync messages, make target label more compact
Browse files Browse the repository at this point in the history
  • Loading branch information
LinqLover committed Dec 21, 2024
1 parent fae36b7 commit 5449f02
Show file tree
Hide file tree
Showing 19 changed files with 102 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
testing
isOutOfSync

^ self method isInstalled not
and: [self method timeStamp ~= ([self method methodReference timeStamp] ifError: [nil])]
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"newFor:test:resultData:" : "ct 12/12/2024 05:38" },
"instance" : {
"classObject" : "ct 12/12/2024 06:13",
"isOutOfSync" : "ct 12/21/2024 21:29",
"message" : "ct 12/12/2024 06:17",
"method" : "ct 12/12/2024 05:39",
"method:" : "ct 12/12/2024 05:39",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
testing
isOutOfSync

^ false
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"instance" : {
"classObject" : "ct 12/19/2024 21:03",
"isError" : "ct 12/21/2024 20:53",
"isOutOfSync" : "ct 12/21/2024 21:08",
"message" : "ct 12/19/2024 21:03",
"printOn:" : "ct 12/12/2024 05:46",
"resultData" : "ct 12/12/2024 05:13",
Expand Down
19 changes: 17 additions & 2 deletions packages/SwaLintBrowser.package/SL2Target.class/instance/label.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
accessing
label

self flag: #todo. "compute compact representation"
^ '{1} / {2}' format: {self systemCategories asCommaStringAnd. self classes asCommaStringAnd}
| allCategories allClasses |
self flag: #todo. "compute more compact representation"

allCategories := OrderedCollection new.
allClasses := OrderedCollection withAll: self classes.
self systemCategories do: [:category |
| categoryClasses |
categoryClasses := SystemOrganizer default listAtCategoryNamed: category.
(allClasses includesAllOf: categoryClasses) ifTrue:
[allClasses removeAll: categoryClasses.
allCategories add: category]].

allCategories ifEmpty:
[allClasses ifEmpty: [^ '(none)'].
^ allClasses asCommaStringAnd].
allClasses ifEmpty: [^ allCategories asCommaStringAnd].
^ '{1} + {2}' format: {allCategories asCommaStringAnd. allClasses asCommaStringAnd}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"classes:" : "ct 12/12/2024 03:41",
"editModally" : "ct 12/12/2024 03:44",
"initialize" : "ct 12/12/2024 03:41",
"label" : "ct 12/19/2024 21:04",
"label" : "ct 12/21/2024 21:35",
"systemCategories" : "ct 12/12/2024 02:17",
"systemCategories:" : "ct 12/12/2024 03:41" } }
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ initializeWithSystemOrganizer: aSystemOrganizer

self systemOrganizer: aSystemOrganizer.
self allSystemCategories: aSystemOrganizer categories sorted.
self allClasses: aSystemOrganizer elementArray sorted.
self allClasses: (aSystemOrganizer elementArray sorted collect: [:className | self environment classNamed: className]).
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"hasSystemCategorySelected:" : "ct 12/12/2024 03:14",
"hasSystemCategorySelectedAt:" : "ct 12/12/2024 03:14",
"initialize" : "ct 12/12/2024 03:07",
"initializeWithSystemOrganizer:" : "ct 12/18/2024 22:39",
"initializeWithSystemOrganizer:" : "ct 12/21/2024 21:38",
"selectClass:" : "ct 12/12/2024 03:33",
"selectClassAt:" : "ct 12/12/2024 03:32",
"selectSystemCategory:" : "ct 12/12/2024 03:23",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
accessing - toolbuilder
basicHelpForMessage: message

| selector iconHelp method |
Preferences balloonHelpInMessageLists ifFalse: [^ nil].

selector := (Symbol lookup: message) ifNil: [^ nil].
method := self selectedClassOrMetaClass compiledMethodAt: selector ifAbsent: [^ nil].
iconHelp := (self messageIconHelpFor: method selector) ifNotEmpty: [:t |
t , Character cr, Character cr].

^ iconHelp asText
append: (self messageHelpForMethod: method);
yourself
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildMessageList: builder
list: #messageLabels;
getIndex: #selectedMessageIndex;
setIndex: #selectMessageIndex:;
helpItem: #messageHelpAt:;
helpItem: #helpForMessageAt:;

menu: #messageListMenu:shifted:;
keyPress: #messageListKey:from:;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
accessing - toolbuilder
contents: input notifying: aController

^ (super contents: input notifying: aController)
ifTrue: [self changed: #messageLabels];
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
accessing - toolbuilder
helpForMessage: message

| help |
help := [self basicHelpForMessage: message] ifError: [nil].

(self isMessageOutOfSync: message) ifTrue:
[help := '<i>This method has been changed after running the rests. You can press the <b>Run</b> button to update the results.</i>' asTextFromHtml ,
(help isEmptyOrNil ifTrue: [''] ifFalse: [String cr , String cr , help])].
^ help
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing - toolbuilder
helpForMessageAt: index

^ self helpForMessage: (self messages at: index ifAbsent: [^ nil])
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
private
isMessageOutOfSync: message

^ (self resultsForTestAndClassSelectionAndMessage: message) anySatisfy: [:result | result isOutOfSync]
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
accessing - toolbuilder
labelForMessage: message

| count label |
| label messageResults count |
label := message asString.
count := (self resultsForTestAndClassSelectionAndMessage: message) size.
count = 1 ifTrue: [^ label].
^ '{1} ({2})' format: {label. count}
messageResults := self resultsForTestAndClassSelectionAndMessage: message.
count := messageResults size.
count = 1 ifFalse:
[label := '{1} ({2})' format: {label. count}].

(messageResults anySatisfy: [:result | result isOutOfSync]) ifTrue:
[label := label asText
addAttribute: (TextColor color: Color gray);
yourself].

^ label
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ selectClass: anObject
self changed: #selectedClass.

"(self messages includes: self selectedMessageName) ifFalse: [self selectMessageNamed: nil]."
self selectMessageNamed: (self messages at: 1 ifAbsent: [nil]).
self selectMessageNamed: (self messages detect: [:message | (self isMessageOutOfSync: message) not] ifNone: [nil]).
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ accessing - toolbuilder
targetLabel
<uses: #(target)>

^ 'Target: {1}' format: {self target label}
^ 'Run for {1}' format: {self target label}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
updating
updateListsAndCodeIn: aWindow

super updateListsAndCodeIn: aWindow.

(self messages anySatisfy: [:message | self isMessageOutOfSync: message]) ifTrue:
[self changed: #messageLabels].
self changed: #targetLabel.
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
"addModelItemsToWindowMenu:" : "ct 12/19/2024 23:25",
"aspectDependencies" : "ct 12/17/2024 23:12",
"authorFilterLabel" : "ct 12/10/2024 23:22",
"basicHelpForMessage:" : "ct 12/21/2024 21:20",
"browseSelectedTestNode" : "ct 12/21/2024 20:39",
"browseSelectedTestNodeMapper" : "ct 12/21/2024 20:39",
"buildClassList:" : "ct 12/17/2024 22:15",
"buildControlBar:" : "ct 12/21/2024 20:46",
"buildMessageList:" : "ct 12/18/2024 03:42",
"buildMessageList:" : "ct 12/21/2024 21:14",
"buildTestPane:" : "ct 12/12/2024 06:36",
"buildTestTree:" : "ct 12/21/2024 20:36",
"buildWith:" : "ct 12/10/2024 23:20",
Expand All @@ -32,6 +33,7 @@
"classListMenu:shifted:" : "ct 12/13/2024 00:36",
"classListMenuMore:" : "ct 12/13/2024 00:39",
"classes" : "ct 12/21/2024 20:49",
"contents:notifying:" : "ct 12/21/2024 21:48",
"copySelectedTestName" : "ct 12/21/2024 20:35",
"dateFilterLabel" : "ct 12/10/2024 23:22",
"defaultShouldDisplayAllTests" : "ct 12/18/2024 03:07",
Expand All @@ -46,13 +48,16 @@
"hasTestGroupSelected" : "ct 12/18/2024 02:07",
"hasTestNodeSelected" : "ct 12/12/2024 06:12",
"hasTestSelected" : "ct 12/12/2024 06:37",
"helpForMessage:" : "ct 12/21/2024 21:45",
"helpForMessageAt:" : "ct 12/21/2024 21:17",
"helpForTestNode:" : "ct 12/21/2024 20:34",
"helpForTestNodePath:" : "ct 12/21/2024 20:32",
"initialize" : "ct 12/18/2024 03:07",
"inspectSelectedResults" : "ct 12/19/2024 21:29",
"inspectSelectedTestNode" : "ct 12/21/2024 20:39",
"isMessageOutOfSync:" : "ct 12/21/2024 21:22",
"labelForClass:" : "ct 12/17/2024 22:19",
"labelForMessage:" : "ct 12/18/2024 03:38",
"labelForMessage:" : "ct 12/21/2024 21:21",
"labelForTestNode:" : "ct 12/18/2024 20:58",
"labelForTestNodePath:" : "ct 12/18/2024 04:44",
"labelString" : "ct 12/10/2024 23:33",
Expand All @@ -76,7 +81,7 @@
"resultsForTestSelectionAndClass:" : "ct 12/17/2024 22:17",
"runTests" : "ct 12/12/2024 04:02",
"runnerClass" : "ct 12/12/2024 04:02",
"selectClass:" : "ct 12/19/2024 21:27",
"selectClass:" : "ct 12/21/2024 21:23",
"selectClassIndex:" : "ct 12/17/2024 22:20",
"selectMessageIndex:" : "ct 12/18/2024 03:39",
"selectMessageNamed:" : "ct 12/12/2024 06:30",
Expand All @@ -100,7 +105,7 @@
"target" : "ct 12/12/2024 01:59",
"target:" : "ct 12/12/2024 02:00",
"targetClass" : "ct 12/12/2024 01:59",
"targetLabel" : "ct 12/17/2024 23:11",
"targetLabel" : "ct 12/21/2024 21:30",
"testNodeForPath:" : "ct 12/18/2024 06:27",
"testNodeMenu:" : "ct 12/21/2024 20:39",
"testNodePathFor:" : "ct 12/18/2024 05:02",
Expand All @@ -112,5 +117,6 @@
"testTreeKey:from:" : "ct 12/21/2024 20:40",
"tests" : "ct 12/12/2024 05:54",
"tests:" : "ct 12/12/2024 04:24",
"updateListsAndCodeIn:" : "ct 12/21/2024 21:47",
"updateSelectedTestNode" : "ct 12/18/2024 04:23",
"windowColorToUse" : "ct 12/10/2024 23:32" } }

0 comments on commit 5449f02

Please sign in to comment.