Lint menus and UI refactored to provide both better UX and cleaner code.
authorJan Vrany <jan.vrany@fit.cvut.cz>
Thu, 27 Nov 2014 11:41:19 +0100
changeset 14924 4a9807948b2d
parent 14923 7c189a24693c
child 14925 5ffea2d23226
Lint menus and UI refactored to provide both better UX and cleaner code.
Tools__NewSystemBrowser.st
--- a/Tools__NewSystemBrowser.st	Thu Nov 27 11:39:06 2014 +0100
+++ b/Tools__NewSystemBrowser.st	Thu Nov 27 11:41:19 2014 +0100
@@ -14,59 +14,59 @@
 "{ NameSpace: Tools }"
 
 SystemBrowser subclass:#NewSystemBrowser
-	instanceVariableNames:'environmentHolder environment navigationState bufferNameList
-		selectedBuffer buffers bufferUsageOrder browserCanvas
-		immediateUpdate showClassPackages lastMethodCategory
-		lastMethodMoveClass browserCanvasType
-		syntaxColoringProcessRunning syntaxColoringProcess
-		methodInfoProcess browsletShowHideLabelHolder browserPageCanvas
-		isEmbedded hasNonEmptyEnvironmentSelectedHolder
-		smalllintRulesOrAllHolder smalllintRulesOrDefaultHolder'
-	classVariableNames:'LastNewProtocols LastProtocolRenames LastCategoryRenames
-		LastCategoryRenameOld LastCategoryRenameNew LastProjectMoves
-		LastNameSpaceMove LastMethodMoveOrCopyTargetClass
-		LastClassFilterBlockString LastMethodFilterBlockString
-		LastBreakPointConditionString LastIndividualChecks
-		LastAcceptPackage LastVariableRenames LastVisitorClassName
-		LastTemporaryVariableName FindHistory
-		CheckForInstancesWhenRemovingClasses SynchronousUpdate
-		DoubleClickIsOpenBrowser ShowMethodTemplateWhenProtocolIsSelected
-		DefaultShowMethodInheritance DefaultEmphasizeUnloadedClasses
-		DefaultImmediateSyntaxColoring DefaultImmediateExplaining
-		DefaultSyntaxColoring DefaultToolBarVisible
-		DefaultCodeInfoVisible DefaultShortNameInTabs
-		DefaultHideUnloadedClasses DefaultMarkApplications
-		DefaultAutoFormat DefaultShowMethodComplexity
-		DefaultShowMethodTypeIcon DefaultShowSpecialResourceEditors
-		DefaultShowSyntheticMethods SharedMethodCategoryCache
-		LastMethodProcessingBlockString LastLoadedPackages
-		DefaultShortAllClassesInNameSpaceOrganisation LastBaseVersionTag
-		LastTag DefaultShowPseudoProtocols DefaultShowMultitabMode
-		LastRenamedOld LastRenamedNew LastImportedPackage
-		LastLintRulesHolder NewNavigationHistory
-		LastLiteralReplacementType LastLiteralReplacementNewName
-		LastLiteralReplacementOldLiteral LastNewProjectType
-		LastClassProcessingBlockString RecentlyClosedList
-		LastClassSearchBoxShowedFullName CachedTagToRevisionMapping
-		CachedMethodsImplemented LastCypressDirectory
-		LastClassSearchBoxShowedJavaOnly LastRemoteRepository
-		LastClassDocDirectory'
-	poolDictionaries:''
-	category:'Interface-Browsers-New'
+        instanceVariableNames:'environmentHolder environment navigationState bufferNameList
+                selectedBuffer buffers bufferUsageOrder browserCanvas
+                immediateUpdate showClassPackages lastMethodCategory
+                lastMethodMoveClass browserCanvasType
+                syntaxColoringProcessRunning syntaxColoringProcess
+                methodInfoProcess browsletShowHideLabelHolder browserPageCanvas
+                isEmbedded hasNonEmptyEnvironmentSelectedHolder
+                smalllintRulesOrAllHolder smalllintRulesOrDefaultHolder'
+        classVariableNames:'LastNewProtocols LastProtocolRenames LastCategoryRenames
+                LastCategoryRenameOld LastCategoryRenameNew LastProjectMoves
+                LastNameSpaceMove LastMethodMoveOrCopyTargetClass
+                LastClassFilterBlockString LastMethodFilterBlockString
+                LastBreakPointConditionString LastIndividualChecks
+                LastAcceptPackage LastVariableRenames LastVisitorClassName
+                LastTemporaryVariableName FindHistory
+                CheckForInstancesWhenRemovingClasses SynchronousUpdate
+                DoubleClickIsOpenBrowser ShowMethodTemplateWhenProtocolIsSelected
+                DefaultShowMethodInheritance DefaultEmphasizeUnloadedClasses
+                DefaultImmediateSyntaxColoring DefaultImmediateExplaining
+                DefaultSyntaxColoring DefaultToolBarVisible
+                DefaultCodeInfoVisible DefaultShortNameInTabs
+                DefaultHideUnloadedClasses DefaultMarkApplications
+                DefaultAutoFormat DefaultShowMethodComplexity
+                DefaultShowMethodTypeIcon DefaultShowSpecialResourceEditors
+                DefaultShowSyntheticMethods SharedMethodCategoryCache
+                LastMethodProcessingBlockString LastLoadedPackages
+                DefaultShortAllClassesInNameSpaceOrganisation LastBaseVersionTag
+                LastTag DefaultShowPseudoProtocols DefaultShowMultitabMode
+                LastRenamedOld LastRenamedNew LastImportedPackage
+                LastLintRulesHolder NewNavigationHistory
+                LastLiteralReplacementType LastLiteralReplacementNewName
+                LastLiteralReplacementOldLiteral LastNewProjectType
+                LastClassProcessingBlockString RecentlyClosedList
+                LastClassSearchBoxShowedFullName CachedTagToRevisionMapping
+                CachedMethodsImplemented LastCypressDirectory
+                LastClassSearchBoxShowedJavaOnly LastRemoteRepository
+                LastClassDocDirectory'
+        poolDictionaries:''
+        category:'Interface-Browsers-New'
 !
 
 ListEntry subclass:#OwnershipGraph
-	instanceVariableNames:'ownershipInfo cachedForm'
-	classVariableNames:''
-	poolDictionaries:''
-	privateIn:NewSystemBrowser
+        instanceVariableNames:'ownershipInfo cachedForm'
+        classVariableNames:''
+        poolDictionaries:''
+        privateIn:NewSystemBrowser
 !
 
 Object subclass:#RevisionOwnershipInfo
-	instanceVariableNames:'revision author date lineOwnership'
-	classVariableNames:''
-	poolDictionaries:''
-	privateIn:NewSystemBrowser::OwnershipGraph
+        instanceVariableNames:'revision author date lineOwnership'
+        classVariableNames:''
+        poolDictionaries:''
+        privateIn:NewSystemBrowser::OwnershipGraph
 !
 
 !NewSystemBrowser class methodsFor:'documentation'!
@@ -6322,22 +6322,9 @@
      #(Menu
         (
          (MenuItem
-            label: 'Repeat Previously Selected Checks'
-            itemValue: categoryMenuSmalllintCheck:
-            translateLabel: true
-            argument: smalllintRules
-          )
-         (MenuItem
-            label: 'Run Default Checks'
-            itemValue: categoryMenuSmalllintCheck:
-            translateLabel: true
-            argument: smalllintRulesDefaultOrAskUser
-          )
-         (MenuItem
-            label: 'Run Selected Checks...'
-            itemValue: categoryMenuSmalllintCheck:
-            translateLabel: true
-            argument: smalllintRulesAskUser
+            label: 'SmallLint Menu'
+            submenuChannel: smalllintCheckMenuForCategory
+            isMenuSlice: true
           )
 
          )
@@ -6346,7 +6333,7 @@
       )
 
     "Modified: / 05-05-2012 / 10:18:13 / cg"
-    "Modified: / 14-10-2014 / 17:14:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 27-11-2014 / 06:56:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 categoryMenu
@@ -6948,23 +6935,10 @@
      #(Menu
         (
          (MenuItem
-            label: 'Repeat Previously Selected Checks'
-            itemValue: classCheckMenuSmalllintCheck:
-            translateLabel: true
-            argument: smalllintRules
-          )
-         (MenuItem
-            label: 'Run Default Checks'
-            itemValue: classCheckMenuSmalllintCheck:
-            translateLabel: true
-            argument: smalllintRulesDefaultOrAskUser
-          )
-         (MenuItem
-            label: 'Run Selected Checks...'
-            itemValue: classCheckMenuSmalllintCheck:
-            translateLabel: true
-            argument: smalllintRulesAskUser
-          )
+            label: 'SmallLint Menu'
+            submenuChannel: smalllintCheckMenuForClass
+            isMenuSlice: true
+          )        
          (MenuItem
             label: '-'
           )
@@ -6994,7 +6968,7 @@
         nil
       )
 
-    "Modified: / 14-10-2014 / 17:14:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 27-11-2014 / 06:57:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 classClassVariablesMenu
@@ -10045,23 +10019,10 @@
      #(Menu
         (
          (MenuItem
-            label: 'Repeat Previously Selected Checks'
-            itemValue: projectMenuSmalllintCheck:
-            translateLabel: true
-            argument: smalllintRules
-          )
-         (MenuItem
-            label: 'Run Default Checks'
-            itemValue: projectMenuSmalllintCheck:
-            translateLabel: true
-            argument: smalllintRulesDefaultOrAskUser
-          )
-         (MenuItem
-            label: 'Run Selected Checks...'
-            itemValue: projectMenuSmalllintCheck:
-            translateLabel: true
-            argument: smalllintRulesAskUser
-          )
+            label: 'SmallLint Menu'
+            submenuChannel: smalllintCheckMenuForPackage
+            isMenuSlice: true
+          )        
 
          )
         nil
@@ -10069,7 +10030,7 @@
       )
 
     "Created: / 05-05-2012 / 10:22:19 / cg"
-    "Modified: / 14-10-2014 / 17:14:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 27-11-2014 / 06:58:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 projectDebugMenu
@@ -10542,29 +10503,16 @@
      #(Menu
         (
          (MenuItem
-            label: 'Repeat Previously Selected Checks'
-            itemValue: protocolCheckMenuSmalllintCheck:
-            translateLabel: true
-            argument: smalllintRules
-          )
-         (MenuItem
-            label: 'Run Default Checks'
-            itemValue: protocolCheckMenuSmalllintCheck:
-            translateLabel: true
-            argument: smalllintRulesDefaultOrAskUser
-          )
-         (MenuItem
-            label: 'Run Selected Checks...'
-            itemValue: protocolCheckMenuSmalllintCheck:
-            translateLabel: true
-            argument: smalllintRulesAskUser
-          )
-         )
-        nil
-        nil
-      )
-
-    "Modified: / 14-10-2014 / 17:14:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+            label: 'SmallLint Menu'
+            submenuChannel: smalllintCheckMenuForProtocol
+            isMenuSlice: true
+          )        
+         )
+        nil
+        nil
+      )
+
+    "Modified: / 27-11-2014 / 06:58:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 protocolMenu
@@ -11076,23 +11024,10 @@
      #(Menu
         (
          (MenuItem
-            label: 'Repeat Previously Selected Checks'
-            itemValue: selectorCheckMenuSmalllintCheck:
-            translateLabel: true
-            argument: smalllintRules
-          )
-         (MenuItem
-            label: 'Run Default Checks'
-            itemValue: selectorCheckMenuSmalllintCheck:
-            translateLabel: true
-            argument: smalllintRulesDefaultOrAskUser
-          )
-         (MenuItem
-            label: 'Run Selected Checks...'
-            itemValue: selectorCheckMenuSmalllintCheck:
-            translateLabel: true
-            argument: smalllintRulesAskUser
-          )
+            label: 'SmallLint Menu'
+            submenuChannel: smalllintCheckMenuForSelector
+            isMenuSlice: true
+          )        
 
          )
         nil
@@ -11100,7 +11035,7 @@
       )
 
     "Created: / 17-04-2010 / 10:48:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 14-10-2014 / 17:14:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 27-11-2014 / 06:59:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 selectorMenu
@@ -17767,34 +17702,6 @@
             itemValue: runLint
             nameKey: RunLint
             isButton: true
-            submenu: 
-           (Menu
-              (
-               (MenuItem
-                  label: 'Repeat Previously Selected Checks'
-                  itemValue: runLintOnPreviousRules
-                )
-               (MenuItem
-                  label: 'Run Default Checks'
-                  itemValue: smalllintRulesDefaultOrAskUser
-                )
-               (MenuItem
-                  label: 'Run Selected Checks...'
-                  itemValue: runLintOnSelectedRules
-                )
-               (MenuItem
-                  label: '-'
-                )
-               (MenuItem
-                  enabled: hasClassSelectedAndInstrumentingCompilerExistsHolder
-                  label: 'Recompile all Methods with Instrumentation'
-                  itemValue: classMenuRecompileInstrumented
-                  showBusyCursorWhilePerforming: true
-                )
-               )
-              nil
-              nil
-            )
             labelImage: (ResourceRetriever ToolbarIconLibrary lint24x24Icon)
           )
          (MenuItem
@@ -17926,8 +17833,46 @@
         nil
         nil
       )
-
-    "Modified: / 14-10-2014 / 12:56:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+toolBarMenuLint
+    "This resource specification was automatically generated
+     by the MenuEditor of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the MenuEditor may not be able to read the specification."
+
+
+    "
+     MenuEditor new openOnClass:Tools::NewSystemBrowser andSelector:#toolBarMenuLint
+     (Menu new fromLiteralArrayEncoding:(Tools::NewSystemBrowser toolBarMenuLint)) startUp
+    "
+
+    <resource: #menu>
+
+    ^ 
+     #(Menu
+        (
+         (MenuItem
+            label: 'SmallLint Menu'
+            submenuChannel: smalllintCheckMenuForToolbar
+            isMenuSlice: true
+          )
+         (MenuItem
+            label: '-'
+          )
+         (MenuItem
+            enabled: hasClassSelectedAndInstrumentingCompilerExistsHolder
+            label: 'Recompile all Methods with Instrumentation'
+            itemValue: classMenuRecompileInstrumented
+            showBusyCursorWhilePerforming: true
+          )
+         )
+        nil
+        nil
+      )
+
+    "Modified: / 27-11-2014 / 06:48:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !NewSystemBrowser class methodsFor:'queries'!
@@ -18160,324 +18105,9 @@
 
 !NewSystemBrowser class methodsFor:'utilities'!
 
-askForClassToSearch:doWhatByDefault single:singleClass msgTail:msgTail resources:resourcesOrNil filter:filterOrNil forBrowser:aBrowserOrNil thenDo:aBlock
-    "utility common code for both opening a new browser on a class and
-     to search for a class in an existing browser.
-     If singleClass is true, a single class will be asked for and browsed,
-     otherwise, a match pattern is allowed and a multi-class browser is opened.
-     Moved from instance protocol for better reusability."
-
-    |box boxLabel title okText okText2 okText3 className canFind
-     button2 button3 doWhat doWhat2 doWhat3 classNameHolder updateList updateClassAndNameList
-     reallyAllClasses allClasses allClassesByFullName classNamesInChangeSet classesInChangeSet
-     allNames allFullNames initialShortNames initialFullNames
-     colorizedFullNames colorizedShortNames
-     resources check showingWhatLabel 
-     showFullNameHolder onlyShowJavaClassesHolder genShortNameListEntry|
-
-    resources := resourcesOrNil ? self classResources.
-    showFullNameHolder := (LastClassSearchBoxShowedFullName ? false) asValue.
-    onlyShowJavaClassesHolder := (LastClassSearchBoxShowedJavaOnly ? false) asValue.
-
-    doWhat := doWhatByDefault.
-    canFind := aBrowserOrNil notNil
-               and:[aBrowserOrNil navigationState notNil and:[ aBrowserOrNil navigationState isFullBrowser ]].
-
-    (doWhat isNil or:[aBrowserOrNil isNil]) ifTrue:[
-        title := 'Select a class'.
-        boxLabel := (resources string:'Select a class').
-        okText := 'OK'.
-        okText2 := nil. doWhat2 := nil.
-        okText3 := nil. doWhat3 := nil.
-    ] ifFalse:[
-        title := (singleClass ifTrue:[ 'Class to browse' ] ifFalse:[ 'Class(es) to browse' ]).
-        boxLabel := (resources string:'Browse or Search').
-
-        (doWhat isNil and:[canFind not]) ifTrue:[
-            doWhat := #newBuffer.
-        ].
-
-        doWhat == #newBrowser ifTrue:[
-            okText := 'Open'.
-            okText2 := 'Add Buffer'. doWhat2 := #newBuffer.
-            okText3 := 'Find'.       doWhat3 := nil.
-        ] ifFalse:[ doWhat == #newBuffer ifTrue:[
-            okText := 'Add Buffer'.
-            okText2 := 'Open New'.   doWhat2 := #newBrowser.
-            okText3 := 'Find'.       doWhat3 := nil.
-        ] ifFalse:[
-            title := (singleClass ifTrue:[ 'Class to find' ] ifFalse:[ 'Class(es) to find' ]).
-            okText := 'Find'.
-            okText2 := 'Open New'.   doWhat2 := #newBrowser.
-            okText3 := 'Add Buffer'. doWhat3 := #newBuffer.
-        ]].
-    ].
-
-    genShortNameListEntry :=
-        [:cls |
-            |ns|
-
-            cls isNil ifTrue:[
-                nil
-            ] ifFalse:[
-                ns := cls topNameSpace name.
-                ns = 'Smalltalk'
-                    ifTrue:[ ns := '' ]
-                    ifFalse:[ns := ' (in ',ns,')'].
-                cls nameWithoutNameSpacePrefix,ns
-            ].
-        ].
-
-    classesInChangeSet := ChangeSet current changedClasses.
-    classNamesInChangeSet := classesInChangeSet
-                                select: (filterOrNil ? [:cls | true])
-                                thenCollect:[:each | each theNonMetaclass name].
-
-    initialFullNames := self visitedClassNamesHistory.
-    (filterOrNil notNil) ifTrue:[
-        initialFullNames := initialFullNames select:[:nm | (Smalltalk at:nm) notNil and:[filterOrNil value:(Smalltalk at:nm)]].
-    ].
-
-    initialFullNames := initialFullNames select:[:nm | nm notNil].
-    initialShortNames := initialFullNames collect:[:nm |
-                            |cls|
-
-                            cls := Smalltalk classNamed:nm.
-                            cls isNil ifTrue:[
-                                "/ class no longer exists (removed?)
-                                nm colorizeAllWith:(Color gray)
-                            ] ifFalse:[
-                                cls isJavaClass ifTrue:[
-                                    cls javaName
-                                ] ifFalse:[
-                                    genShortNameListEntry value:(Smalltalk classNamed:nm)
-                                ].
-                            ].
-                        ].
-
-    colorizedFullNames := initialFullNames collect:[:clsName |
-                                (classNamesInChangeSet includes:clsName) ifTrue:[
-                                    clsName asText emphasisAllAdd:(UserPreferences current emphasisForChangedCode)
-                                ] ifFalse:[
-                                    clsName
-                                ].
-                            ].
-
-    colorizedShortNames := initialShortNames with:initialFullNames collect:[:shortName :clsName |
-                                (classNamesInChangeSet includes:clsName) ifTrue:[
-                                    shortName asText emphasisAllAdd:(UserPreferences current emphasisForChangedCode)
-                                ] ifFalse:[
-                                    shortName
-                                ].
-                            ].
-
-    title := (resources string:title) , msgTail , '.\' , (resources string:'(TAB to complete; matchPattern allowed - "*" for all):').
-
-    box := self
-                enterBoxForClassWithCodeSelectionTitle:title withCRs
-                withList:(showFullNameHolder value ifTrue:[colorizedFullNames] ifFalse:[colorizedShortNames])
-                okText:okText
-                forBrowser:aBrowserOrNil.
-
-    box label:boxLabel.
-
-    doWhat notNil ifTrue:[
-        button2 := Button label:(resources string:okText2).
-        (aBrowserOrNil notNil and:[aBrowserOrNil navigationState isFullBrowser]) "singleClass" ifTrue:[
-            button3 := Button label:(resources string:okText3)
-        ].
-        box addButton:button2 after:(box okButton).
-        button3 notNil ifTrue:[box addButton:button3 after:button2].
-
-        button2 
-            action:[
-                doWhat := doWhat2.
-                box doAccept; okPressed.
-            ].
-        button3 notNil ifTrue:[
-            button3 
-                action:[
-                    doWhat := doWhat3.
-                    box doAccept; okPressed.
-                ].
-        ].
-    ].
-
-    reallyAllClasses := Smalltalk allClasses copyAsOrderedCollection.
-    filterOrNil notNil ifTrue:[
-        reallyAllClasses := reallyAllClasses select: filterOrNil
-    ].
-    allClasses := reallyAllClasses.
-
-    updateClassAndNameList :=
-        [
-            onlyShowJavaClassesHolder value ifTrue:[
-                allClasses := reallyAllClasses select:[:cls | cls isJavaClass].
-            ].
-            allClassesByFullName := allClasses copy.
-
-            allNames := (allClasses
-                        collect:[:cls |
-                            |ns nm|
-
-                            cls isJavaClass ifTrue:[
-                                nm := cls javaName,' (in JAVA)'
-                            ] ifFalse:[
-                                ns := cls topNameSpace name.
-                                ns = 'Smalltalk'
-                                    ifTrue:[ ns := '' ]
-                                    ifFalse:[ns := ' (in ',ns,')'].
-                                cls isNameSpace ifTrue:[
-                                    nm := cls nameWithoutNameSpacePrefix,ns,' (Namespace)'
-                                ] ifFalse:[
-                                    nm := cls nameWithoutNameSpacePrefix,ns
-                                ].
-                            ].
-                            (classNamesInChangeSet includes:cls name) ifTrue:[
-                                nm asText emphasisAllAdd:(UserPreferences current emphasisForChangedCode)
-                            ] ifFalse:[
-                                nm
-                            ].
-                        ]) sortWith:allClasses; yourself.
-
-            allFullNames := (allClasses
-                        collect:[:cls |
-                            |nm|
-
-                            nm := cls name.
-                            (classNamesInChangeSet includes:cls name) ifTrue:[
-                                nm asText emphasisAllAdd:(UserPreferences current emphasisForChangedCode)
-                            ] ifFalse:[
-                                nm
-                            ].
-                        ]) sortWith:allClassesByFullName; yourself.
-        ].
-    updateClassAndNameList value.
-
-    updateList := [
-            |nameToSearch list namesStarting namesIncluding lcName nameList classList|
-
-            (nameToSearch := classNameHolder value withoutSeparators) isEmpty ifTrue:[
-                showingWhatLabel label:(resources string:'Recently visited:').
-                list := (showFullNameHolder value ifTrue:[colorizedFullNames] ifFalse:[colorizedShortNames]).
-            ] ifFalse:[
-                showingWhatLabel label:(resources string:'Matching classes:').
-                nameList := showFullNameHolder value ifTrue:[ allFullNames ] ifFalse:[ allNames ].
-                classList := showFullNameHolder value ifTrue:[ allClassesByFullName ] ifFalse:[ allClasses ].
-                lcName := nameToSearch asLowercase.
-                (lcName includesString:'::') ifTrue:[
-                    list := OrderedCollection new.
-                    allClasses doWithIndex:[:cls :idx |
-                        |isIncluded|
-
-                        (nameToSearch includesMatchCharacters) ifTrue:[
-                            isIncluded := (lcName match:cls name asLowercase)
-                        ] ifFalse:[
-                            isIncluded := (cls name includesString:lcName caseSensitive:false)
-                        ].
-                        isIncluded ifTrue:[
-                            list add:(nameList at:idx)
-                        ].
-                    ].
-                ] ifFalse:[
-                    (nameToSearch includesMatchCharacters) ifTrue:[
-                        list := (1 to:nameList size) 
-                                    select:[:idx |
-                                            |nm| 
-                                            nm := nameList at:idx.
-                                            (lcName match:nm asLowercase) 
-                                            or:[ lcName match:(classList at:idx) name caseSensitive:false]
-                                    ] thenCollect:[:idx | nameList at:idx].
-                    ] ifFalse:[
-                        namesIncluding := (1 to:nameList size)
-                                            select:[:idx |
-                                                |nm| 
-                                                nm := nameList at:idx.
-                                                (nm asLowercase includesString:lcName caseSensitive:false)
-                                                or:[ (classList at:idx) name includesString:lcName caseSensitive:false]
-                                            ] thenCollect:[:idx | nameList at:idx].  
-
-                        namesStarting := namesIncluding select:[:nm | nm asLowercase startsWith:lcName].
-                        list := namesStarting , {nil} , (namesIncluding \ namesStarting).
-                    ]
-                ]
-            ].
-            box listView
-                list:list;
-                scrollToLine:((list findFirst:[:line | (line ? '') startsWith:lcName]) max:1)
-        ].
-
-    classNameHolder := '' asValue.
-    box enterField
-        model:classNameHolder;
-        immediateAccept:true.
-    classNameHolder onChangeEvaluate:updateList.
-
-    box entryCompletionBlock:(DoWhatIMeanSupport classNameEntryCompletionBlock).
-    box 
-        action:[:aString |
-            className := aString.
-        ].
-
-    box panelView
-        addSubView:(showingWhatLabel := (Label label:(resources string:'Recently visited:')) adjust:#left) before:nil.
-    (JavaVM notNil and:[JavaVM isLoaded]) ifTrue:[
-        box panelView
-            addSubView:(check := CheckBox label:(resources string:'Only show Java Classes') model:onlyShowJavaClassesHolder) before:nil.
-    ].
-    box panelView
-        addSubView:(check := CheckBox label:(resources string:'Show Full Name (do not strip off Namespace)') model:showFullNameHolder) before:nil.
-
-    showFullNameHolder onChangeEvaluate:updateList.
-    onlyShowJavaClassesHolder onChangeEvaluate:[ updateClassAndNameList value. updateList value].
-
-    box enterField origin:(0 @ check corner y).
-    box enterField
-        onKey:#CursorDown
-        leaveWith:[
-            box listView windowGroup focusView:box listView byTab:true.
-            box listView hasSelection ifFalse:[
-                box listView selectFirst
-            ] ifTrue:[
-                box listView selectNext
-            ].
-        ].
-    box listView origin:(0 @ check corner y).
-
-    box extent:(400 @ 550).
-    box open.
-
-    className isEmptyOrNil ifTrue:[^ nil "cancel"].
-
-    LastClassSearchBoxShowedFullName := showFullNameHolder value.
-    LastClassSearchBoxShowedJavaOnly := onlyShowJavaClassesHolder value.
-
-    (className endsWith:$) ) ifTrue:[
-        (className indexOfSubCollection:'(in ') == 0 ifTrue:[
-            "/ a namespace
-            className := (className copyTo:(className indexOfSubCollection:'(Name')-1) withoutSeparators
-        ] ifFalse:[
-            className := ((className copyFrom:(className indexOfSubCollection:'(in ')+4)
-                            copyButLast)
-                         , '::' , className asCollectionOfWords first
-        ].
-        ((className startsWith:'JAVA::') and:[className includes:$.]) ifTrue:[
-            className := className copyReplaceString:'.' withString:'::'
-        ].
-    ].
-
-    (doWhat isNil or:[aBrowserOrNil isNil]) ifTrue:[
-        aBlock notNil ifTrue:[aBlock value:className optionalArgument:singleClass and:doWhat].
-        ^ className
-    ].
-
-    aBrowserOrNil withSearchCursorDo:[
-        aBlock value:className value:singleClass value:doWhat.
-    ].
-    ^ className
-
-    "Modified: / 29-08-2013 / 12:24:28 / cg"
-    "Modified: / 04-09-2013 / 17:48:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+askForClassToSearch: arg1 single: arg2 msgTail: arg3 resources: arg4 filter: arg5 forBrowser: arg6 thenDo: arg7 
+    "This method has been swizled by SmallSense, forwarding to SmallSense implementation"
+    ^ self stx_goodies_smallsense_askForClassToSearch: arg1 single: arg2 msgTail: arg3 resources: arg4 filter: arg5 forBrowser: arg6 thenDo: arg7 
 !
 
 enterBoxTitle:title okText:okText label:label
@@ -23224,6 +22854,7 @@
     ^ UserPreferences current useSearchBarInBrowser or:[self codeView searchBarActionBlock notNil]
 ! !
 
+
 !NewSystemBrowser methodsFor:'binding access'!
 
 menuFor:key
@@ -28002,22 +27633,15 @@
 !
 
 runLint
-    "run the new smallLint checker tool"
-
-    self runLintOnPreviousRules
-
-    "Modified: / 17-04-2010 / 10:44:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Run previously selected rules or default rules on
+     currently selected code (depends on navigation state)"
+
+    ^ self 
+        smalllintCheck: self selectedCodeComponentsAsEnvironment 
+        against: self smalllintRulesOrDefaultHolder value
+
     "Modified: / 07-03-2012 / 17:39:34 / cg"
-!
-
-runLintOnDefaultRules
-    "run the new smallLint checker tool on default rules"
-
-    self
-        smalllintCheck: self selectedCodeComponentsAsEnvironment
-        against: #smalllintRulesDefaultOrAskUser
-
-    "Created: / 14-10-2014 / 12:56:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 27-11-2014 / 10:20:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 runLintOnPreviousRules
@@ -28025,11 +27649,11 @@
 
     self
         smalllintCheck: self selectedCodeComponentsAsEnvironment
-        against: #smalllintRules
-
-    "Modified: / 17-04-2010 / 10:44:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+        against: LastLintRulesHolder value
+
     "Modified (comment): / 01-03-2012 / 14:10:47 / cg"
     "Created: / 07-03-2012 / 17:39:28 / cg"
+    "Modified: / 27-11-2014 / 09:39:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 runLintOnSelectedRules
@@ -28037,35 +27661,36 @@
 
     self
         smalllintCheck: self selectedCodeComponentsAsEnvironment
-        against: #smalllintRulesAskUser
+        against: nil
 
     "Created: / 07-03-2012 / 17:40:23 / cg"
-    "Modified: / 14-10-2014 / 17:13:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-smalllintCheck:anEnvironment against:ruleSetSymbol
-    "this is exected by an async task!!"
-
-    |rule runRules|
-
-    self assert:(#( #smalllintRulesDefaultOrAskUser smalllintRulesAskUser #smalllintRules ) includes:ruleSetSymbol).
-
-    rule := self perform:ruleSetSymbol asSymbol.
-    rule isNil ifTrue:[ ^ self ].
-"/ cg: that is wrong implemented in RBxxxRule: isEmpty has two meanings:
-"/     for composite: has sub-rules
-"/     for non-composite: has a result
-"/ therefore, isEmpty returns true here, so we will be always asked twice!!
-
-
+    "Modified: / 27-11-2014 / 09:38:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+smalllintCheck:rbenvironment against:ruleSetOrNil
+    "Run given SmallLint rules on given browser environment.
+     If `ruleSetOrNil` is nil. then ask sure for set of
+     rules.
+
+     As a side effect, remembers run rules so next time user
+     do 'Run Again', these rules we be run."
+
+    | rule runRules |
+
+    ruleSetOrNil isNil ifTrue:[
+        | dialog |
+
+        dialog := Tools::LintRuleSelectionDialog new.
+        dialog open.
+        dialog accepted ifTrue:[
+            rule := dialog selectionAsRule
+        ] ifFalse:[ 
+            ^ self
+        ].        
+    ] ifFalse:[ 
+        rule := ruleSetOrNil.
+    ].
     rule isEmptyInTree ifTrue:[
-"/        ruleSetSymbol ~~ #smalllintRulesAskUser ifTrue:[
-"/            rule := self smalllintRulesAskUser.
-"/            rule isNil ifTrue:[ 
-"/                "/ User cancelled
-"/                ^ self 
-"/            ].
-"/        ]
         self inlineMessageApp
             reset;
             beInformation;
@@ -28085,15 +27710,23 @@
             "/ Run on copy, because running rules has a sideeffect
             "/ of modifying the rule (storing in its result)
             rule := rule copy.
-            self smalllintRunRule:rule onEnvironment:anEnvironment.
+            self smalllintRunRule:rule onEnvironment:rbenvironment.
             [rule notNil and:[rule isEmpty]] whileTrue:[
                 (Dialog confirm:'Nothing special found.\\Proceed to select more/different lint rules.' withCRs) ifTrue:[
-                    rule := self smalllintRulesAskUser.
+                    | dialog |
+
+                    dialog := Tools::LintRuleSelectionDialog new.
+                    dialog open.
+                    dialog accepted ifTrue:[
+                        rule := dialog selectionAsRule
+                    ] ifFalse:[ 
+                        rule := nil.
+                    ].        
                     rule notNil ifTrue:[
                         "/ Run on copy, because running rules has a sideeffect
                         "/ of modifying the rule (storing in its result)
                         rule := rule copy.
-                        self smalllintRunRule:rule onEnvironment:anEnvironment.
+                        self smalllintRunRule:rule onEnvironment:rbenvironment.
                     ].
                 ] ifFalse:[
                     rule := nil
@@ -28103,7 +27736,7 @@
                 self
                     spawnSmalllintBrowserByRuleFor:rule
                     in:#newBuffer
-                    label:'SmallLint results for ' , anEnvironment label
+                    label:'SmallLint results for ' , rbenvironment label
             ].
         ].
 
@@ -28119,71 +27752,7 @@
     "Created: / 24-02-2009 / 11:02:57 / Jan Vrany <vranyj1@fel.cvut.cz>"
     "Modified: / 22-07-2009 / 14:38:30 / Jan Vrany <vranyj1@fel.cvut.cz>"
     "Modified: / 15-05-2012 / 10:46:02 / cg"
-    "Modified: / 24-11-2014 / 12:24:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-smalllintRules
-    "Return rule set (as RBCompositeLintRule) containing all rules to run. 
-     If no ruleset has been set and no default is configured in user preferences, 
-     then user is asked sto specify a ruleset (by means of dialog)."
-
-    ^ (LastLintRulesHolder isNil or:[ LastLintRulesHolder value isNil ])
-        ifTrue:[ self smalllintRulesDefaultOrAskUser ]
-        ifFalse:[ LastLintRulesHolder value ]
-
-    "
-        Tools::NewSystemBrowser basicNew smalllintRules"
-
-    "Modified: / 14-10-2014 / 12:50:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-smalllintRulesAskUser
-    | dialog |
-
-    self loadSmalllint.
-    dialog := Tools::LintRuleSelectionDialog new.
-    dialog open.
-    dialog accepted ifTrue:[ 
-        ^ dialog selectionAsRule.
-    ].
-    ^ nil
-
-    "
-     LastLintRulesHolder := nil.
-     Tools::NewSystemBrowser basicNew smalllintRulesAskUser
-    "
-
-    "Created: / 14-10-2014 / 17:13:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-smalllintRulesDefaultOrAskUser
-    "Answer a defaulr ruleset configured in UserPreferences or ask user to specify one"
-
-    | ruleset |
-
-    ruleset := UserPreferences current smallLintRulesetDefault.
-    ruleset isNil ifTrue:[ 
-        ruleset := self smalllintRulesAskUser.
-        ruleset notNil ifTrue:[ 
-            UserPreferences current smallLintRulesetDefault: ruleset.
-        ].
-    ].
-    ^ ruleset
-
-    "Created: / 14-10-2014 / 12:50:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 14-10-2014 / 18:16:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-smalllintRulesHolder
-    "Returns a holder with default ruleset to run"
-
-    smalllintRulesOrDefaultHolder isNil ifTrue:[ 
-        LastLintRulesHolder isNil ifTrue:[ LastLintRulesHolder := ValueHolder new ].
-        smalllintRulesOrDefaultHolder := PluggableAdaptor on: LastLintRulesHolder getter: [:ignored | self smalllintRules ]
-    ].
-    ^ smalllintRulesOrDefaultHolder
-
-    "Created: / 14-10-2014 / 12:31:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 27-11-2014 / 10:18:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 smalllintRulesOrDefault
@@ -28303,7 +27872,7 @@
             "/ cg: does not work - why?
             result failedRules size == 1 ifTrue:[
                 "/ autoselect the first one
-                browser selectedLintRules value:(result failedRules).
+                browser selectedLintRules value: result failedRules.
             ].
 
             "/self halt.
@@ -28412,7 +27981,7 @@
     "Created: / 02-02-2010 / 20:05:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 25-08-2010 / 10:30:33 / Jan Vrany <enter your email here>"
     "Modified: / 01-03-2012 / 19:52:57 / cg"
-    "Modified: / 16-10-2014 / 23:50:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 27-11-2014 / 10:26:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !NewSystemBrowser methodsFor:'menu actions-checks-old'!
@@ -48587,6 +48156,7 @@
     "Modified: / 28-02-2012 / 16:48:38 / cg"
 ! !
 
+
 !NewSystemBrowser methodsFor:'menu actions-variables'!
 
 browseVarRefsOrModsWithTitle:browserTitle boxTitle:boxTitle variables:varType access:accessType all:browseAll
@@ -50045,6 +49615,7 @@
     "Modified: / 24-02-2014 / 22:44:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+
 !NewSystemBrowser methodsFor:'menus-dynamic'!
 
 boockmarksMenu
@@ -51466,10 +51037,13 @@
 "/ no, I explicitly do not want this
 "/    (menu menuItemWithValue: #goForwardInGlobalHistory)
 "/        submenuChannel:[self goForwardInGlobalHistoryMenu].
+    (menu menuItemWithValue: #runLint)
+        submenuChannel:[ (Menu decodeFromLiteralArray: self class toolBarMenuLint) findGuiResourcesIn: self; yourself].       
     ^menu
 
     "Created: / 22-02-2008 / 17:00:05 / janfrog"
     "Modified: / 03-07-2011 / 14:40:57 / cg"
+    "Modified (format): / 27-11-2014 / 06:45:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 variablesMenu
@@ -52026,6 +51600,79 @@
     "Modified: / 19-10-2011 / 16:48:31 / cg"
 ! !
 
+!NewSystemBrowser methodsFor:'menus-dynamic-lint'!
+
+smalllintCheckMenuForCategory
+    ^ self smalllintCheckMenuForEnvironment: self selectedCategoriesAsEnvironment
+
+    "Created: / 27-11-2014 / 07:01:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+smalllintCheckMenuForClass
+    ^ self smalllintCheckMenuForEnvironment: self selectedClassesAsEnvironment
+
+    "Created: / 27-11-2014 / 06:52:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+smalllintCheckMenuForEnvironment: rbenvironment
+    | menu |
+
+    menu := Menu new.
+
+    (Smalltalk at: #RBLintRuleSet) isNil ifTrue:[ 
+        ([ Smalltalk loadPackage: #'stx:goodies/refactoryBrowser/lint' ] on: Error do: [ false ]) ifFalse:[
+            menu addItem:(MenuItem label: (resources string: 'SmallLint not available') itemValue: nil enabled: false).
+            ^ menu
+        ]
+    ].
+
+
+    LastLintRulesHolder value notNil ifTrue:[ 
+        menu addItem: 
+            (MenuItem label: (resources string: 'Run Again - %1' with: LastLintRulesHolder value displayString)   
+                  itemValue: [ self smalllintCheck: rbenvironment against: LastLintRulesHolder value ])
+    ] ifFalse:[ 
+        menu addItem: (MenuItem label: (resources string: 'Run Again')
+           itemValue: [ self smalllintCheck: rbenvironment against: LastLintRulesHolder value ]
+             enabled: false)              
+    ].
+    RBCompositeLintRule rulesets do:[:ruleset| 
+        menu addItem: 
+            (MenuItem label: (resources string: 'Run Checks - %1' with: ruleset displayString)   
+                  itemValue: [ self smalllintCheck: rbenvironment against: ruleset ])
+    ].
+    menu addItem: 
+        (MenuItem label: (resources string: 'Run Selected...')   
+              itemValue: [ self smalllintCheck: rbenvironment against: nil ]).
+    ^ menu
+
+    "Created: / 27-11-2014 / 06:16:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+smalllintCheckMenuForPackage
+    ^ self smalllintCheckMenuForEnvironment: self selectedPackagesAsEnvironment
+
+    "Created: / 27-11-2014 / 06:54:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+smalllintCheckMenuForProtocol
+    ^ self smalllintCheckMenuForEnvironment: self selectedProtocolsAsEnvironment
+
+    "Created: / 27-11-2014 / 06:54:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+smalllintCheckMenuForSelector
+    ^ self smalllintCheckMenuForEnvironment: self selectedSelectorsAsEnvironment
+
+    "Created: / 27-11-2014 / 06:53:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+smalllintCheckMenuForToolbar
+    ^ self smalllintCheckMenuForEnvironment: self selectedCodeComponentsAsEnvironment.
+
+    "Created: / 27-11-2014 / 06:48:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !NewSystemBrowser methodsFor:'menus-dynamic-popup'!
 
 categoryPopUpMenu
@@ -56633,6 +56280,7 @@
     ^ navigationState projectListApplication
 ! !
 
+
 !NewSystemBrowser methodsFor:'private-history'!
 
 lastSearchPatterns
@@ -61916,11 +61564,11 @@
 !NewSystemBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__NewSystemBrowser.st,v 1.2128 2014-11-27 09:00:48 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__NewSystemBrowser.st,v 1.2129 2014-11-27 10:41:19 vrany Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__NewSystemBrowser.st,v 1.2128 2014-11-27 09:00:48 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__NewSystemBrowser.st,v 1.2129 2014-11-27 10:41:19 vrany Exp $'
 !
 
 version_HG
@@ -61929,7 +61577,7 @@
 !
 
 version_SVN
-    ^ '$Id: Tools__NewSystemBrowser.st,v 1.2128 2014-11-27 09:00:48 stefan Exp $'
+    ^ '$Id: Tools__NewSystemBrowser.st,v 1.2129 2014-11-27 10:41:19 vrany Exp $'
 ! !