Fixes for Java (and possibly other languages)
- in the class browser, if it is full source browser, only scroll to
method's source line when method is selected.
- show field type for Java classes in variable list.
--- a/Tools__NewSystemBrowser.st Fri Sep 06 15:49:08 2013 +0100
+++ b/Tools__NewSystemBrowser.st Mon Sep 09 02:02:10 2013 +0100
@@ -19016,6 +19016,8 @@
"Created: / 24.2.2000 / 23:28:06 / cg"
! !
+
+
!NewSystemBrowser methodsFor:'aspects-organization'!
categoryMenuVisible
@@ -22711,6 +22713,7 @@
^ UserPreferences current useSearchBarInBrowser or:[self codeView searchBarActionBlock notNil]
! !
+
!NewSystemBrowser methodsFor:'change & update'!
categorySelectionChanged
@@ -22910,100 +22913,100 @@
self enqueueDelayedUpdateBufferLabel.
navigationState isClassDocumentationBrowser ifTrue:[
- "/ show classes documentation
- self showClassDocumentation.
- ^ self.
+ "/ show classes documentation
+ self showClassDocumentation.
+ ^ self.
].
navigationState isVersionDiffBrowser ifTrue:[
- "/ show version differences
- self showVersionDiff.
- ^ self.
+ "/ show version differences
+ self showVersionDiff.
+ ^ self.
].
codeView := self codeView.
checkModified ifTrue:[
- ((codeView notNil and:[codeView modified])
- or:[navigationState modified])
- ifTrue:[
- "/ recheck against the code (could have been unedited)
- (self reallyModified:navigationState) ifTrue:[
- "/ do not overwrite the user's modifications;
- "/ instead, flash and show the code all-red
- "/ (to tell user, that she is possibly editing obsolete code)
+ ((codeView notNil and:[codeView modified])
+ or:[navigationState modified])
+ ifTrue:[
+ "/ recheck against the code (could have been unedited)
+ (self reallyModified:navigationState) ifTrue:[
+ "/ do not overwrite the user's modifications;
+ "/ instead, flash and show the code all-red
+ "/ (to tell user, that she is possibly editing obsolete code)
"/ self codeHolder
"/ value:(codeView contentsAsString asText
"/ emphasizeAllWith:(UserPreferences current emphasisForObsoleteCode)).
"/ self codeHolder changed:#value.
- codeView flash.
- ^ self.
- ]
- ].
+ codeView flash.
+ ^ self.
+ ]
+ ].
].
navigationState isFullClassSourceBrowser ifTrue:[
- "/ show full classes source - set accept action for fileIn
- self showFullClassSource.
- ^ self.
+ "/ show full classes source - set accept action for fileIn
+ self showFullClassSource.
+ ^ self.
].
"/ show method, or class definition
methods := self selectedMethodsValue.
methods size == 1 ifTrue:[
- mthd := methods first.
+ mthd := methods first.
].
mthd notNil ifTrue:[
- "/ show methods source - set accept action to compile that single method
- self setAcceptActionForMethod.
- self showMethodsCode:mthd scrollToTop:false.
-
- "/ if there is a variable filter,
- "/ set the autoSearch for it
- (navigationState isMethodListBrowser
- or:[navigationState isFullProtocolBrowser
- or:[navigationState isMethodBrowser]]) ifFalse:[
- filteredVariables := self variableFilter value.
- filteredVariables size > 0 ifTrue:[
- self searchVariables:filteredVariables readers:true writers:true asAutoSearch:false.
- "/ codeView notNil ifTrue:[codeView searchFwd]
- ] ifFalse:[
- self autoSearchPattern:nil
- ].
- ].
- ] ifFalse:[
- self updatePackageInfoForMethod:nil.
-
- protocol := self theSingleSelectedProtocol.
- (protocol isNil or:[protocol = BrowserList nameListEntryForALL]) ifTrue:[
- doShowMethodTemplate := false
- ] ifFalse:[
- navigationState showMethodTemplate ifTrue:[
- doShowMethodTemplate := self showMethodTemplate value
+ "/ show methods source - set accept action to compile that single method
+ self setAcceptActionForMethod.
+ self showMethodsCode:mthd scrollToTop:false.
+
+ "/ if there is a variable filter,
+ "/ set the autoSearch for it
+ (navigationState isMethodListBrowser
+ or:[navigationState isFullProtocolBrowser
+ or:[navigationState isMethodBrowser]]) ifFalse:[
+ filteredVariables := self variableFilter value.
+ filteredVariables size > 0 ifTrue:[
+ self searchVariables:filteredVariables readers:true writers:true asAutoSearch:false.
+ "/ codeView notNil ifTrue:[codeView searchFwd]
+ ] ifFalse:[
+ self autoSearchPattern:nil
+ ].
+ ].
+ ] ifFalse:[
+ self updatePackageInfoForMethod:nil.
+
+ protocol := self theSingleSelectedProtocol.
+ (protocol isNil or:[protocol = BrowserList nameListEntryForALL]) ifTrue:[
+ doShowMethodTemplate := false
+ ] ifFalse:[
+ navigationState showMethodTemplate ifTrue:[
+ doShowMethodTemplate := self showMethodTemplate value
"/ and:[ShowMethodTemplateWhenProtocolIsSelected == true
"/ or:[ navigationState methodList size == 0 ]].
- ]
- ].
- doShowMethodTemplate ifTrue:[
- methods size > 1 ifTrue:[
- code := nil.
- ] ifFalse:[
- code := self methodTemplate.
- ].
- self setAcceptActionForMethod.
- self codeAspect:SyntaxHighlighter codeAspectMethod.
- self showCode:code.
- ] ifFalse:[
- self hasProtocolSelected ifTrue:[
- self showCode:''.
- self setAcceptActionForMethod.
- self codeAspect:SyntaxHighlighter codeAspectMethod.
- ] ifFalse:[
- selectedClass := self theSingleSelectedClass.
- selectedClass notNil ifTrue:[
- self showClassAspect:(self codeAspect) forClass:selectedClass.
- ] ifFalse:[
+ ]
+ ].
+ doShowMethodTemplate ifTrue:[
+ methods size > 1 ifTrue:[
+ code := nil.
+ ] ifFalse:[
+ code := self methodTemplate.
+ ].
+ self setAcceptActionForMethod.
+ self codeAspect:SyntaxHighlighter codeAspectMethod.
+ self showCode:code.
+ ] ifFalse:[
+ self hasProtocolSelected ifTrue:[
+ self showCode:''.
+ self setAcceptActionForMethod.
+ self codeAspect:SyntaxHighlighter codeAspectMethod.
+ ] ifFalse:[
+ selectedClass := self theSingleSelectedClass.
+ selectedClass notNil ifTrue:[
+ self showClassAspect:(self codeAspect) forClass:selectedClass.
+ ] ifFalse:[
"/ self organizerMode value == OrganizerCanvas organizerModeProject ifTrue:[
"/ package := self theSingleSelectedProject.
"/ package notNil ifTrue:[
@@ -23015,54 +23018,54 @@
"/ self showCode:code ? ''.
"/ self setAcceptActionForProjectComment.
"/ ] ifFalse:[
- self showCode:code ? ''.
- self setAcceptActionForClass.
+ self showCode:code ? ''.
+ self setAcceptActionForClass.
"/ ]
- ]
- ]
- ]
+ ]
+ ]
+ ]
].
self updateSpecialCodeEditorVisibility.
codeView notNil ifTrue:[
- "/ perform an auto-search, unless the user did some other search
- "/ in the meanwhile (i.e. the codeViews searchPattern is different from the autoSearchPattern)
- withAutoSearch ifTrue:[
- codeView numberOfLines > 0 ifTrue:[
- searchAction := navigationState autoSearchAction.
- searchAction notNil ifTrue:[
- true "codeView searchAction isNil" ifTrue:[
- true "codeView searchPattern isNil" ifTrue:[
- codeView
- cursorHome;
- searchAction:searchAction;
- searchUsingSearchAction:#forward ifAbsent:nil.
-
- "/ The searchAction is mantained until a cut/replace or a search with a user selection is done
+ "/ perform an auto-search, unless the user did some other search
+ "/ in the meanwhile (i.e. the codeViews searchPattern is different from the autoSearchPattern)
+ withAutoSearch ifTrue:[
+ codeView numberOfLines > 0 ifTrue:[
+ searchAction := navigationState autoSearchAction.
+ searchAction notNil ifTrue:[
+ true "codeView searchAction isNil" ifTrue:[
+ true "codeView searchPattern isNil" ifTrue:[
+ codeView
+ cursorHome;
+ searchAction:searchAction;
+ searchUsingSearchAction:#forward ifAbsent:nil.
+
+ "/ The searchAction is mantained until a cut/replace or a search with a user selection is done
"/ codeView clearSearchAction.
- ]
+ ]
"/ ] ifFalse:[
"/ codeView
"/ cursorHome;
"/ searchUsingSearchAction:#forward ifAbsent:nil
- ].
- ] ifFalse:[
- searchPattern := navigationState autoSearchPattern.
- searchPattern notNil ifTrue:[
- searchPattern = codeView searchPattern ifTrue:[
- codeView
- cursorHome;
- cursorRight; "/ to avoid finding the selector
- searchFwd:searchPattern
- ignoreCase:(navigationState autoSearchIgnoreCase)
- ifAbsent:[codeView cursorHome].
- ].
- ].
- ].
- ].
- ] ifFalse:[
- codeView clearSearchAction.
- ].
+ ].
+ ] ifFalse:[
+ searchPattern := navigationState autoSearchPattern.
+ searchPattern notNil ifTrue:[
+ searchPattern = codeView searchPattern ifTrue:[
+ codeView
+ cursorHome;
+ cursorRight; "/ to avoid finding the selector
+ searchFwd:searchPattern
+ ignoreCase:(navigationState autoSearchIgnoreCase)
+ ifAbsent:[codeView cursorHome].
+ ].
+ ].
+ ].
+ ].
+ ] ifFalse:[
+ codeView clearSearchAction.
+ ].
].
navigationState modified:false.
@@ -38112,6 +38115,7 @@
HTMLDocumentView openFullOnDocumentationFile:'TOP.html'
! !
+
!NewSystemBrowser methodsFor:'menu actions-inheritance'!
inheritanceMenuNavigateToClass
@@ -47573,6 +47577,7 @@
"Modified: / 28-02-2012 / 16:48:38 / cg"
! !
+
!NewSystemBrowser methodsFor:'menu actions-variables'!
browseVarRefsOrModsWithTitle:browserTitle boxTitle:boxTitle variables:varType access:accessType all:browseAll
@@ -50841,6 +50846,7 @@
"Modified: / 19-10-2011 / 16:48:31 / cg"
! !
+
!NewSystemBrowser methodsFor:'menus-dynamic-popup'!
categoryPopUpMenu
@@ -52816,26 +52822,27 @@
!
showMethodsCode:mthd scrollToTop:doScrollToTop
- |code codeView doAutoFormat doSyntaxColoring doUpdateCode prevMthd |
+ |code codeView doAutoFormat doSyntaxColoring doUpdateCode prevMthd doShowFullClassSource |
doAutoFormat := self doAutoFormat value and:[RBFormatter notNil].
+ doShowFullClassSource := self navigationState isFullClassSourceBrowser.
codeView := self codeView.
self assert:codeView notNil.
code := self sourceOfMethod:mthd.
code isText ifTrue:[
- doSyntaxColoring := false.
- ] ifFalse:[
- "/Do no coloring here if CodeView2 is used,
- "/since CodeView2 itself cares about the coloring!!
- "/Not working correctly -> do the coloring until fixed in CodeView2
- "JV: Enable is, otherwise I won't notice that it does not work
- correctly!!"
- (UserPreferences current useCodeView2In: #Browser) ifTrue:[
- doSyntaxColoring := code size < 2000
- ] ifFalse:[
- doSyntaxColoring := self doSyntaxColoring value == true.
- ].
+ doSyntaxColoring := false.
+ ] ifFalse:[
+ "/Do no coloring here if CodeView2 is used,
+ "/since CodeView2 itself cares about the coloring!!
+ "/Not working correctly -> do the coloring until fixed in CodeView2
+ "JV: Enable is, otherwise I won't notice that it does not work
+ correctly!!"
+ (UserPreferences current useCodeView2In: #Browser) ifTrue:[
+ doSyntaxColoring := code size < 2000
+ ] ifFalse:[
+ doSyntaxColoring := self doSyntaxColoring value == true.
+ ].
].
@@ -52843,55 +52850,59 @@
doAutoFormat ifTrue:[
- Error catch:[
- code := RBFormatter format:code
- ].
- ].
-
- "Hack for Java methods: 'As whole class source coce is shown,
- there is no need to set codeview's content if previous method
- belonged to the same class. Code is already shown, we need only
- to scrool to it..."
- "hmm...hmm...how implement it in a better, more generic way?"
- doUpdateCode := true.
- (mthd isJavaMethod and:[mthd isSynthetic not]) ifTrue:[
- prevMthd := navigationState lastMethodShownInCodeView.
- (prevMthd notNil and:[prevMthd isJavaMethod]) ifTrue:[
- doUpdateCode := prevMthd isSynthetic or:[mthd javaClass ~~ prevMthd javaClass]
- ].
+ Error catch:[
+ code := RBFormatter format:code
+ ].
+ ].
+
+ doShowFullClassSource ifTrue:[
+ "As whole class source coce is shown,
+ there is no need to set codeview's content if previous method
+ belonged to the same class. Code is already shown, we need only
+ to scrool to it..."
+ "hmm...hmm...how implement it in a better, more generic way?"
+ doUpdateCode := true.
+ mthd isSynthetic not ifTrue:[
+ prevMthd := navigationState lastMethodShownInCodeView.
+ prevMthd notNil ifTrue:[
+ doUpdateCode := prevMthd isSynthetic or:[mthd mclass ~~ prevMthd mclass]
+ ].
+ ].
].
doUpdateCode ifTrue:[
- doSyntaxColoring ifTrue:[
- "/ immediate coloring, if code is not too large;
- "/ otherwise, do it in the background.
- code size < 2000 " 10000 " ifTrue:[
- Error handle:[:ex |
- Transcript showCR:'error in syntaxHighlighter: ',ex description.
- ] do:[
- code := self syntaxHighlightedCodeFor:code method:mthd.
- ].
- ] ifFalse:[
- self enqueueDelayedStartSyntaxHighlightProcess.
- ].
-
- [
- codeView modifiedChannel removeDependent:self.
- codeView modified:false.
- self showCode:code scrollToTop:doScrollToTop.
- ] ensure:[
- codeView modifiedChannel addDependent:self.
- ]
- ] ifFalse:[
- self showCode:code scrollToTop:doScrollToTop.
- ].
+ doSyntaxColoring ifTrue:[
+ "/ immediate coloring, if code is not too large;
+ "/ otherwise, do it in the background.
+ code size < 2000 " 10000 " ifTrue:[
+ Error handle:[:ex |
+ Transcript showCR:'error in syntaxHighlighter: ',ex description.
+ ] do:[
+ code := self syntaxHighlightedCodeFor:code method:mthd.
+ ].
+ ] ifFalse:[
+ self enqueueDelayedStartSyntaxHighlightProcess.
+ ].
+
+ [
+ codeView modifiedChannel removeDependent:self.
+ codeView modified:false.
+ self showCode:code scrollToTop:doScrollToTop.
+ ] ensure:[
+ codeView modifiedChannel addDependent:self.
+ ]
+ ] ifFalse:[
+ self showCode:code scrollToTop:doScrollToTop.
+ ].
].
navigationState lastMethodShownInCodeView: mthd.
"/ scroll, for file-based classes (java, ruby, etc.)
- mthd sourceLineNumber ~~ 1 ifTrue:[
- doScrollToTop "ifTrue:" ifFalse:[
- codeView scrollToLine:mthd sourceLineNumber
- ]
+ doShowFullClassSource ifTrue:[
+ mthd sourceLineNumber ~~ 1 ifTrue:[
+ doScrollToTop "ifTrue:" ifFalse:[
+ codeView scrollToLine:mthd sourceLineNumber
+ ]
+ ].
].
self codeAspect:(code ifNil:[nil] ifNotNil:[SyntaxHighlighter codeAspectMethod]).
self normalLabel.
@@ -52899,7 +52910,7 @@
"Created: / 01-03-2000 / 11:38:57 / cg"
"Modified: / 27-07-2012 / 22:18:18 / cg"
- "Modified: / 13-04-2012 / 18:21:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 08-09-2013 / 12:25:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
showNothing
@@ -55304,6 +55315,7 @@
^ navigationState projectListApplication
! !
+
!NewSystemBrowser methodsFor:'private-history'!
lastSearchPatterns
--- a/Tools__VariableList.st Fri Sep 06 15:49:08 2013 +0100
+++ b/Tools__VariableList.st Mon Sep 09 02:02:10 2013 +0100
@@ -520,14 +520,27 @@
| nm entry |
nm := name.
+ "/ Hack for Java classes to display field type
+ cls theNonMetaclass isJavaClass ifTrue:[
+ | field |
+
+ field := cls theNonMetaclass lookupFieldFor:name static: (cls isMetaclass) onlyPublic: false.
+ field notNil ifTrue:[
+ nm := nm asText ,
+ ' ' ,
+ (('< ' , (JavaMethod fieldTypeFromStream: (field descriptor readStream) in: cls theNonMetaclass javaPackage) , ' >')
+ asText colorizeAllWith: Color brown).
+ ].
+ ].
entry := Tools::VariableList::VariableEntry application: self class: cls name: nm.
entry sortingByNameHolder:sortVariablesByName.
classInfo notNil ifTrue:[
- entry type: (classInfo infoForInstvarOrNil: name).
+ entry type: (classInfo infoForInstvarOrNil: name).
].
^entry
"Created: / 27-11-2011 / 17:17:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 09-09-2013 / 01:44:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
listOfVariables