"
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague
All Rights Reserved
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the 'Software'), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
"
"{ Package: 'stx:libtool' }"
"{ NameSpace: Tools }"
ToolApplicationModel subclass:#ChangeSetBrowser2
instanceVariableNames:'changesetHolder titleHolder allowOpenHolder changesetFile
navigatorChangesetHolder navigatorSpecHolder selectionHolder
classHolder codeAspectHolder selection1Holder
list1GeneratorHolder showRemovedAspect acceptEnabledHolder
changeListViews sourceView changeSourceHolder imageSourceHolder'
classVariableNames:'ShowRemoved LastSelectionConditionString'
poolDictionaries:''
category:'Interface-Browsers-ChangeSet'
!
!ChangeSetBrowser2 class methodsFor:'documentation'!
copyright
"
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague
All Rights Reserved
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the 'Software'), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
"
! !
!ChangeSetBrowser2 class methodsFor:'instance creation'!
on: aChangeSet
^self on: aChangeSet label: aChangeSet name
"Modified: / 26-10-2010 / 22:51:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
on: aChangeSet label: aString
^self on: aChangeSet label: aString setupWith: [:browser]
"Created: / 26-10-2010 / 22:50:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
on: aChangeSet label: label setupWith: aBlock
| browser |
browser := self new.
browser
changeset: aChangeSet;
title: label.
aBlock value: browser.
^browser
"Created: / 26-10-2010 / 22:50:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!ChangeSetBrowser2 class methodsFor:'accessing'!
showRemoved
^ShowRemoved == true
!
showRemoved: aBoolean
ShowRemoved := aBoolean
! !
!ChangeSetBrowser2 class methodsFor:'help specs'!
helpSpec
"This resource specification was automatically generated
by the UIHelpTool of ST/X."
"Do not manually edit this!! If it is corrupted,
the UIHelpTool may not be able to read the specification."
"
UIHelpTool openOnClass:Tools::ChangeSetBrowser
"
<resource: #help>
^ super helpSpec addPairsFrom:#(
#fileLoad
''
#fileSave
''
)
! !
!ChangeSetBrowser2 class methodsFor:'interface opening'!
confirmChanges: aChangeSet
^self confirmChanges: aChangeSet label: 'Apply following changes?'
"Modified: / 08-11-2010 / 18:01:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
confirmChanges:aChangeSet label: aString
"Hmm, DialogBox class layout options are quite limited :-(("
|browser browserView dialog|
browser := self on: aChangeSet.
browser acceptEnabled: false.
browser showRemovedAspect: (true asValue).
browserView := ApplicationSubView new
client:browser
spec:#windowSpecForEmbedding.
dialog := (Dialog new)
addComponent:browserView withHeight: 300;
addAbortAndOkButtons.
dialog label: aString.
dialog buttonPanel
layout:(LayoutFrame fractions:(0.0 @ 1.0 corner:1.0 @ 1.0)
offsets:(0 @ -30 corner:0 @ 0)).
browserView layout:(LayoutFrame fractions:(0.0 @ 0.0 corner:1.0 @ 1.0)
offsets:(0 @ 0 corner:0 @ -30)).
dialog
okAction:
[^browser navigatorChangesetHolder value condenseChangesForRemoved];
abortAction:
[^#()].
dialog openWithExtent: 800@700.
^#()
"
Tools::ChangeSetBrowser2
confirmChanges:
(ChangeSet current copyFrom: ((ChangeSet current size - 10) max: 1) to: ChangeSet current size)
label: 'Last 10 changes...'
"
"Created: / 08-11-2010 / 17:59:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified (format): / 01-07-2011 / 16:34:06 / cg"
"Modified: / 19-07-2011 / 19:39:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
open
super open.
"Created: / 26-10-2010 / 23:18:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
openOn: aChangeSet
^(self on: aChangeSet) open
!
openOn: aChangeSet label: aString
^self openOn: aChangeSet label: aString setupWith: [:browser]
"Created: / 26-10-2010 / 22:50:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
openOn: aChangeSet label: aString setupWith: aBlock
^(self on: aChangeSet label: aString setupWith: aBlock) open
"Created: / 26-10-2010 / 23:07:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!ChangeSetBrowser2 class methodsFor:'interface specs'!
hierarchicalNavigatorSpec
"This resource specification was automatically generated
by the UIPainter of ST/X."
"Do not manually edit this!! If it is corrupted,
the UIPainter may not be able to read the specification."
"
UIPainter new openOnClass:Tools::ChangeSetBrowser andSelector:#hierarchicalNavigatorSpec
Tools::ChangeSetBrowser new openInterface:#hierarchicalNavigatorSpec
"
<resource: #canvas>
^
#(FullSpec
name: hierarchicalNavigatorSpec
window:
(WindowSpec
label: 'Hierarchical Navigator'
name: 'Hierarchical Navigator'
min: (Point 10 10)
bounds: (Rectangle 0 0 300 300)
)
component:
(SpecCollection
collection: (
(SubCanvasSpec
name: 'ChangeList'
layout: (LayoutFrame 0 0 0 0 0 1 0 1)
hasHorizontalScrollBar: false
hasVerticalScrollBar: false
majorKey: #'Tools::HierarchicalChangeList'
subAspectHolders:
(Array
(SubChannelInfoSpec
subAspect: acceptEnabledHolder
aspect: acceptEnabledHolder
)
(SubChannelInfoSpec
subAspect: inGeneratorHolder
aspect: navigatorChangesetHolder
)
(SubChannelInfoSpec
subAspect: menuHolder
aspect: changeMenuHolder
)
(SubChannelInfoSpec
subAspect: selectionHolder
aspect: selectionHolder
)
(SubChannelInfoSpec
subAspect: showRemovedHolder
aspect: showRemovedAspect
)
)
createNewApplication: true
createNewBuilder: true
postBuildCallback: addChangeListView:
)
)
)
)
!
oneColumnNavigatorSpec
"This resource specification was automatically generated
by the UIPainter of ST/X."
"Do not manually edit this!! If it is corrupted,
the UIPainter may not be able to read the specification."
"
UIPainter new openOnClass:Tools::ChangeSetBrowser andSelector:#oneColumnNavigatorSpec
Tools::ChangeSetBrowser new openInterface:#oneColumnNavigatorSpec
"
<resource: #canvas>
^
#(FullSpec
name: oneColumnNavigatorSpec
window:
(WindowSpec
label: 'One Column Navigator'
name: 'One Column Navigator'
min: (Point 10 10)
bounds: (Rectangle 0 0 300 300)
)
component:
(SpecCollection
collection: (
(SubCanvasSpec
name: 'ChangeList'
layout: (LayoutFrame 0 0 0 0 0 1 0 1)
hasHorizontalScrollBar: false
hasVerticalScrollBar: false
majorKey: #'Tools::ChangeList'
subAspectHolders:
(Array
(SubChannelInfoSpec
subAspect: acceptEnabledHolder
aspect: acceptEnabledHolder
)
(SubChannelInfoSpec
subAspect: inGeneratorHolder
aspect: changesetHolder
)
(SubChannelInfoSpec
subAspect: menuHolder
aspect: changeMenuHolder
)
(SubChannelInfoSpec
subAspect: selectionHolder
aspect: selectionHolder
)
(SubChannelInfoSpec
subAspect: showRemovedHolder
aspect: showRemovedAspect
)
)
createNewApplication: true
createNewBuilder: true
postBuildCallback: addChangeListView:
)
)
)
)
!
twoColumnNavigatorSpec
"This resource specification was automatically generated
by the UIPainter of ST/X."
"Do not manually edit this!! If it is corrupted,
the UIPainter may not be able to read the specification."
"
UIPainter new openOnClass:Tools::ChangeSetBrowser andSelector:#twoColumnNavigatorSpec
Tools::ChangeSetBrowser new openInterface:#twoColumnNavigatorSpec
"
<resource: #canvas>
^
#(FullSpec
name: twoColumnNavigatorSpec
window:
(WindowSpec
label: 'Two Column Navigator'
name: 'Two Column Navigator'
min: (Point 10 10)
bounds: (Rectangle 0 0 300 300)
)
component:
(SpecCollection
collection: (
(VariableHorizontalPanelSpec
name: 'Columns'
layout: (LayoutFrame 0 0 0 0 0 1 0 1)
component:
(SpecCollection
collection: (
(SubCanvasSpec
name: 'FirstColumn'
hasHorizontalScrollBar: false
hasVerticalScrollBar: false
majorKey: #'Tools::ChangeList'
subAspectHolders:
(Array
(SubChannelInfoSpec
subAspect: acceptEnabledHolder
aspect: acceptEnabledHolder
)
(SubChannelInfoSpec
subAspect: inGeneratorHolder
aspect: navigatorChangesetHolder
)
(SubChannelInfoSpec
subAspect: menuHolder
aspect: changeMenuHolder
)
(SubChannelInfoSpec
subAspect: outGeneratorHolder
aspect: list1GeneratorHolder
)
(SubChannelInfoSpec
subAspect: selectionHolder
aspect: selection1Holder
)
(SubChannelInfoSpec
subAspect: showRemovedHolder
aspect: showRemovedAspect
)
)
createNewApplication: true
createNewBuilder: true
postBuildCallback: addChangeListView:
)
(SubCanvasSpec
name: 'SecondColumn'
hasHorizontalScrollBar: false
hasVerticalScrollBar: false
majorKey: #'Tools::ChangeList'
subAspectHolders:
(Array
(SubChannelInfoSpec
subAspect: acceptEnabledHolder
aspect: acceptEnabledHolder
)
(SubChannelInfoSpec
subAspect: inGeneratorHolder
aspect: list1GeneratorHolder
)
(SubChannelInfoSpec
subAspect: menuHolder
aspect: changeMenuHolder
)
(SubChannelInfoSpec
subAspect: selectionHolder
aspect: selectionHolder
)
(SubChannelInfoSpec
subAspect: showRemovedHolder
aspect: showRemovedAspect
)
)
createNewApplication: true
createNewBuilder: true
postBuildCallback: addChangeListView:
)
)
)
handles: (Any 0.5 1.0)
)
)
)
)
!
windowSpec
"This resource specification was automatically generated
by the UIPainter of ST/X."
"Do not manually edit this!! If it is corrupted,
the UIPainter may not be able to read the specification."
"
UIPainter new openOnClass:Tools::ChangeSetBrowser andSelector:#windowSpec
Tools::ChangeSetBrowser new openInterface:#windowSpec
Tools::ChangeSetBrowser open
"
<resource: #canvas>
^
#(FullSpec
name: windowSpec
window:
(WindowSpec
label: 'ChangeSet browser'
name: 'ChangeSet browser'
labelChannel: titleHolder
min: (Point 10 10)
bounds: (Rectangle 0 0 653 488)
menu: mainMenu
)
component:
(SpecCollection
collection: (
(MenuPanelSpec
name: 'ToolBar'
layout: (LayoutFrame 0 0 0 0 0 1 30 0)
menu: toolbarMenu
textDefault: true
)
(UISubSpecification
name: 'Contents'
layout: (LayoutFrame 0 0 30 0 0 1 0 1)
minorKey: windowSpecWithoutToolbar
)
)
)
)
!
windowSpecForEmbedding
^self windowSpecWithoutToolbar
!
windowSpecWithoutToolbar
"This resource specification was automatically generated
by the UIPainter of ST/X."
"Do not manually edit this!! If it is corrupted,
the UIPainter may not be able to read the specification."
"
UIPainter new openOnClass:Tools::ChangeSetBrowser2 andSelector:#windowSpecWithoutToolbar
Tools::ChangeSetBrowser2 new openInterface:#windowSpecWithoutToolbar
"
<resource: #canvas>
^
#(FullSpec
name: windowSpecWithoutToolbar
window:
(WindowSpec
label: 'ChangeSet browser'
name: 'ChangeSet browser'
min: (Point 10 10)
bounds: (Rectangle 0 0 653 488)
menu: mainMenu
)
component:
(SpecCollection
collection: (
(VariableVerticalPanelSpec
name: 'VerticalPanel'
layout: (LayoutFrame 0 0 0 0 0 1 0 1)
component:
(SpecCollection
collection: (
(SubCanvasSpec
name: 'NavigatorPanel'
hasHorizontalScrollBar: false
hasVerticalScrollBar: false
specHolder: navigatorSpecHolder
createNewBuilder: false
)
(SubCanvasSpec
name: 'TextDiffTool'
hasHorizontalScrollBar: false
hasVerticalScrollBar: false
majorKey: #'Tools::TextDiffTool'
minorKey: windowSpecForEmbedding
subAspectHolders:
(Array
(SubChannelInfoSpec
subAspect: classHolder
aspect: classHolder
)
(SubChannelInfoSpec
subAspect: codeAspectHolder
aspect: codeAspectHolder
)
(SubChannelInfoSpec
subAspect: labelAHolder
aspect: labelAHolder
)
(SubChannelInfoSpec
subAspect: labelBHolder
aspect: labelBHolder
)
(SubChannelInfoSpec
subAspect: textAHolder
aspect: changeSourceHolder
)
(SubChannelInfoSpec
subAspect: textBHolder
aspect: imageSourceHolder
)
)
createNewApplication: true
createNewBuilder: true
)
)
)
handles: (Any 0.5 1.0)
)
)
)
)
! !
!ChangeSetBrowser2 class methodsFor:'menu specs'!
changeMenu
"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::ChangeSetBrowser andSelector:#changeMenu
(Menu new fromLiteralArrayEncoding:(Tools::ChangeSetBrowser changeMenu)) startUp
"
<resource: #menu>
^
#(Menu
(
(MenuItem
enabled: hasChangeSelectedAndNotRemoved
label: 'Apply'
itemValue: changeMenuApplySelection
translateLabel: true
isVisible: acceptEnabledHolder
shortcutKey: Accept
)
(MenuItem
label: 'Apply all'
itemValue: changeMenuApply
translateLabel: true
isVisible: acceptEnabledHolder
)
(MenuItem
label: '-'
)
(MenuItem
label: 'Delete'
itemValue: changeMenuDeleteSelection
nameKey: Delete
translateLabel: true
shortcutKey: Delete
)
(MenuItem
label: 'Undelete'
itemValue: changeMenuUndeleteSelection
nameKey: Undelete
translateLabel: true
shortcutKey: Delete
)
(MenuItem
label: '-'
)
(MenuItem
label: 'Select...'
translateLabel: true
submenu:
(Menu
(
(MenuItem
label: 'Select same'
itemValue: changeMenuSelectSame
translateLabel: true
)
(MenuItem
label: 'Select additions (new classes/methods)'
itemValue: changeMenuSelectAdditions
translateLabel: true
)
(MenuItem
label: 'Select removals'
itemValue: changeMenuSelectRemovals
translateLabel: true
)
(MenuItem
label: 'Select differences'
itemValue: changeMenuSelectDifferences
translateLabel: true
)
(MenuItem
label: '-'
)
(MenuItem
label: 'Select all'
itemValue: changeMenuSelectAll
translateLabel: true
)
(MenuItem
label: 'Select none'
itemValue: changeMenuSelectNone
translateLabel: true
)
(MenuItem
label: '-'
)
(MenuItem
label: 'Select using block'
itemValue: changeMenuSelectUsingBlock
translateLabel: true
)
)
nil
nil
)
)
(MenuItem
label: '-'
)
(MenuItem
enabled: false
label: 'Show Deleted'
translateLabel: true
indication: showRemovedAspect
)
(MenuItem
label: 'Inspect change'
itemValue: changeMenuInspect
translateLabel: true
)
(MenuItem
enabled: hasSingleChangeSelectedAndCanBrowse
label: 'Browse'
itemValue: changeMenuBrowse
translateLabel: true
)
)
nil
nil
)
!
mainMenu
"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::ChangeSetBrowser andSelector:#mainMenu
(Menu new fromLiteralArrayEncoding:(Tools::ChangeSetBrowser mainMenu)) startUp
"
<resource: #menu>
^
#(Menu
(
(MenuItem
label: 'File'
translateLabel: true
submenu:
(Menu
(
(MenuItem
label: 'Open'
itemValue: doOpen
translateLabel: true
isVisible: allowOpenHolder
shortcutKey: Ctrlo
)
(MenuItem
label: 'Open current'
itemValue: doOpenCurrent
translateLabel: true
isVisible: allowOpenHolder
)
(MenuItem
label: 'Save'
itemValue: doSave
translateLabel: true
)
(MenuItem
label: 'Save As...'
itemValue: doSaveAs
translateLabel: true
)
(MenuItem
label: '-'
)
(MenuItem
label: 'Exit'
itemValue: closeRequest
translateLabel: true
)
)
nil
nil
)
)
(MenuItem
label: 'Change'
translateLabel: true
submenuChannel: changeMenu
keepLinkedMenu: true
)
(MenuItem
label: 'View'
translateLabel: true
submenu:
(Menu
(
(MenuItem
label: 'List'
translateLabel: true
choice: navigatorSpecHolder
choiceValue: oneColumnNavigatorSpec
)
(MenuItem
label: 'Hierarchical List'
translateLabel: true
choice: navigatorSpecHolder
choiceValue: hierarchicalNavigatorSpec
)
(MenuItem
label: 'Browser Like'
translateLabel: true
choice: navigatorSpecHolder
choiceValue: twoColumnNavigatorSpec
)
)
nil
nil
)
)
)
nil
nil
)
!
toolbarMenu
"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::ChangeSetBrowser andSelector:#toolbarMenu
(Menu new fromLiteralArrayEncoding:(Tools::ChangeSetBrowser toolbarMenu)) startUp
"
<resource: #menu>
^
#(Menu
(
(MenuItem
activeHelpKey: fileLoad
label: 'Open'
itemValue: doOpen
translateLabel: true
isButton: true
isVisible: allowOpenHolder
labelImage: (ResourceRetriever XPToolbarIconLibrary loadFromFileIcon)
)
(MenuItem
activeHelpKey: fileSave
label: 'Save'
itemValue: doSave
translateLabel: true
isButton: true
labelImage: (ResourceRetriever XPToolbarIconLibrary saveToFileIcon)
)
)
nil
nil
)
! !
!ChangeSetBrowser2 class methodsFor:'plugIn spec'!
aspectSelectors
"This resource specification was automatically generated
by the UIPainter of ST/X."
"Do not manually edit this. If it is corrupted,
the UIPainter may not be able to read the specification."
"Return a description of exported aspects;
these can be connected to aspects of an embedding application
(if this app is embedded in a subCanvas)."
^ #(
#changesetHolder
).
! !
!ChangeSetBrowser2 methodsFor:'accessing'!
acceptEnabled: aBoolean
^self acceptEnabledHolder value: aBoolean
!
allowOpen: aBoolean
self allowOpenHolder value: aBoolean
"Created: / 26-10-2010 / 23:18:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
beHierarchical
^self navigatorSpecHolder value: #hierarchicalNavigatorSpec
"Modified: / 14-10-2010 / 15:52:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
beOneColumn
^self navigatorSpecHolder value: #oneColumnNavigatorSpec
"Modified: / 14-10-2010 / 15:52:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
beTwoColumn
^self navigatorSpecHolder value: #twoColumnNavigatorSpec
"Modified: / 14-10-2010 / 15:51:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
changeset
^self changesetHolder value
!
changeset: aChangeSet
self changesetHolder value: aChangeSet
!
readOnly: aBoolean
"Created: / 20-07-2010 / 09:48:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
theSingleSelectedChange
| change |
change := nil.
selectionHolder value do:
[:each|
change ifNotNil:[nil].
change ifNil:[change := each]].
^change
!
title: aString
self titleHolder value: aString
"Created: / 26-10-2010 / 23:01:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!ChangeSetBrowser2 methodsFor:'accessing - defaults'!
defaultTitle
^ 'No changeset'
"Modified: / 08-04-2011 / 10:10:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!ChangeSetBrowser2 methodsFor:'accessing - menus'!
changeMenuHolder
^[self menuFor: #changeMenu]
"Created: / 29-10-2010 / 13:23:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!ChangeSetBrowser2 methodsFor:'actions'!
accept: source
| entry |
(entry := self theSingleSelectedChange) ifNil:[^self].
entry change isMethodCodeChange ifTrue:
[entry change source: source asString]
"Modified: / 29-11-2010 / 22:40:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
postBuildSourceView: aView
sourceView := aView.
"Modified: / 19-07-2011 / 19:08:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!ChangeSetBrowser2 methodsFor:'aspects'!
acceptEnabledHolder
"return/create the 'selectionHolder' value holder (automatically generated)"
acceptEnabledHolder isNil ifTrue:[
acceptEnabledHolder := ValueHolder with: true.
].
^ acceptEnabledHolder
"Modified: / 24-10-2009 / 19:56:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
allowOpenHolder
"return/create the 'allowOpenHolder' value holder (automatically generated)"
allowOpenHolder isNil ifTrue:[
allowOpenHolder := ValueHolder with: true.
].
^ allowOpenHolder
"Modified: / 17-03-2011 / 22:32:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
changeSourceHolder
<resource: #uiAspect>
changeSourceHolder isNil ifTrue: [
changeSourceHolder := nil asValue.
].
^ changeSourceHolder.
"Modified: / 19-07-2011 / 11:54:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
changesetHolder
"return/create the 'changesetHolder' value holder (automatically generated)"
changesetHolder isNil ifTrue:[
changesetHolder := ValueHolder new.
changesetHolder addDependent:self.
].
^ changesetHolder
!
changesetHolder:something
"set the 'changesetHolder' value holder (automatically generated)"
|oldValue newValue|
changesetHolder notNil ifTrue:[
oldValue := changesetHolder value.
changesetHolder removeDependent:self.
].
changesetHolder := something.
changesetHolder notNil ifTrue:[
changesetHolder addDependent:self.
].
newValue := changesetHolder value.
oldValue ~~ newValue ifTrue:[
self update:#value with:newValue from:changesetHolder.
].
!
classHolder
"return/create the 'classHolder' value holder (automatically generated)"
classHolder isNil ifTrue:[
classHolder := ValueHolder with:nil.
].
^ classHolder
"Modified: / 19-07-2011 / 19:12:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
codeAspectHolder
"return/create the 'codeAspectHolder' value holder (automatically generated)"
codeAspectHolder isNil ifTrue:[
codeAspectHolder := ValueHolder new.
].
^ codeAspectHolder
!
imageSourceHolder
<resource: #uiAspect>
imageSourceHolder isNil ifTrue: [
imageSourceHolder := nil asValue.
].
^ imageSourceHolder.
"Created: / 19-07-2011 / 11:54:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
labelAHolder
^'Change' asValue
"Created: / 19-07-2011 / 11:46:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
labelBHolder
^'Image' asValue
"Created: / 19-07-2011 / 11:46:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
list1GeneratorHolder
"return/create the 'list1GeneratorHolder' value holder (automatically generated)"
list1GeneratorHolder isNil ifTrue:[
list1GeneratorHolder := ValueHolder new.
].
^ list1GeneratorHolder
!
list1GeneratorHolder:something
"set the 'list1GeneratorHolder' value holder (automatically generated)"
list1GeneratorHolder := something.
!
listHolder
^self navigatorSpecHolder value == #twoColumnNavigatorSpec
ifTrue:[self list1GeneratorHolder]
ifFalse:[self navigatorChangesetHolder]
"Created: / 20-03-2011 / 22:16:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
navigatorChangesetHolder
"return/create the 'navigatorChangesetHolder' value holder (automatically generated)"
navigatorChangesetHolder isNil ifTrue:[
navigatorChangesetHolder := ValueHolder new.
].
^ navigatorChangesetHolder
!
navigatorSpecHolder
<resource: #uiAspect>
navigatorSpecHolder isNil ifTrue:[
navigatorSpecHolder := ValueHolder with:
#hierarchicalNavigatorSpec
"/#twoColumnNavigatorSpec
"/#oneColumnNavigatorSpec
].
^ navigatorSpecHolder.
"Modified: / 20-11-2009 / 20:12:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
selection1Holder
"return/create the 'selection1Holder' value holder (automatically generated)"
selection1Holder isNil ifTrue:[
selection1Holder := ValueHolder with:#().
].
^ selection1Holder
"Modified: / 24-10-2009 / 20:29:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
selectionHolder
"return/create the 'selectionHolder' value holder (automatically generated)"
selectionHolder isNil ifTrue:[
selectionHolder := ValueHolder new.
selectionHolder addDependent: self.
].
^ selectionHolder
"Modified: / 24-10-2009 / 19:56:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
showRemovedAspect
"return/create the 'showDeletedAspect' value holder (automatically generated)"
showRemovedAspect isNil ifTrue:[
showRemovedAspect := (AspectAdaptor forAspect:#showRemoved)
subject: self class.
].
^ showRemovedAspect
!
showRemovedAspect:aValueHolder
showRemovedAspect := aValueHolder.
!
titleHolder
"return/create the 'titleHolder' value holder (automatically generated)"
titleHolder isNil
ifTrue:[ titleHolder := ValueHolder with:self defaultTitle. ].
^ titleHolder
"Modified: / 26-10-2010 / 22:54:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!ChangeSetBrowser2 methodsFor:'change & update'!
changesetChanged
self titleHolder value: (self changeset name ? (self defaultTitle)).
self navigatorChangesetHolder value: self getNavigatorChangeSet
"Modified: / 26-10-2010 / 22:57:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
selectionChanged
| change |
change := self theSingleSelectedChange.
(change notNil and:[change change isCompositeChange not]) ifTrue:[
self classHolder value: change changeClass.
changeSourceHolder setValue: change changeSource; changed: #value.
imageSourceHolder setValue: change imageSource; changed: #value.
codeAspectHolder value:
(change change isMethodCodeChange
ifTrue:[#method]
ifFalse:[#expression]).
self showSource: true
] ifFalse:[
self showSource: false.
self classHolder value: nil.
changeSourceHolder setValue: nil; changed: #value.
imageSourceHolder setValue: nil; changed: #value.
].
"Created: / 24-10-2009 / 19:49:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
update: aspect with: param from: sender
sender == changesetHolder ifTrue: [ ^ self changesetChanged ].
sender == selectionHolder ifTrue: [ ^ self selectionChanged ].
"Created: / 24-10-2009 / 19:29:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!ChangeSetBrowser2 methodsFor:'interface opening'!
open
super open.
^self
"Created: / 20-07-2010 / 09:48:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!ChangeSetBrowser2 methodsFor:'menu actions'!
doOpen
| file changeset |
file := Dialog requestFileName:'Select changeset' pattern:'*.chg;*.st'.
file ifNil:[^self].
[changeset := ChangeSet fromFile: file]
on: Error
do: [:ex|Dialog error: 'Error when loading changeset: ',ex description. ^self].
changesetFile := file.
self title: file asFilename baseName asString.
self doOpen: changeset
"Modified: / 08-04-2011 / 10:11:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
doOpen: aChangeSet
self changesetHolder value: aChangeSet
"Created: / 05-12-2009 / 13:43:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
doOpenCurrent
self doOpen: ChangeSet current
"Created: / 05-12-2009 / 13:44:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
doSave
changesetFile
ifNil:[self doSaveAs]
ifNotNil:[self doSaveAs: changesetFile]
"Modified: / 24-10-2009 / 22:55:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
doSaveAs
| file |
file := Dialog requestFileName:'Select file' default: (changesetFile ? 'somechanges.chg') pattern:('*.chg').
file ifNil:[^self].
self doSaveAs: file.
!
doSaveAs: newFile
[
| s |
s := newFile asFilename writeStream.
[self changeset fileOutOn: s] ensure:[s close].
changesetFile := newFile.
] on: Error do:
[:ex|Dialog warn: 'Erorr saving changes: ' , ex description]
! !
!ChangeSetBrowser2 methodsFor:'menu actions - changes'!
changeMenuApply
| changesToApply |
changesToApply := OrderedCollection new.
self changesDo:[:chg|chg removed ifFalse:[changesToApply add: chg]].
self changeMenuApply: changesToApply.
"Created: / 29-10-2010 / 13:53:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 16-03-2011 / 22:54:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
changeMenuApply: changesToApply
| changesThatFailToApply |
changesThatFailToApply := ChangeSet new.
ProgressIndicator
displayProgress:'Applying changes...'
at:(Screen default center)
from:200 to:400
during:[:val |
1 to: changesToApply size do:
[:i|
val value:((100 / changesToApply size) * i) rounded.
[self changeMenuApplyChange: (changesToApply at: i)]
on: Error do:[changesThatFailToApply add: (changesToApply at: i)]]]
"Created: / 29-10-2010 / 14:54:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
changeMenuApplyChange: aChange
aChange isClassDefinitionChange ifTrue:
[(Smalltalk at: aChange superClassName asSymbol)
ifNil:[^self error: 'Nil superclass']].
aChange apply
"Modified: / 29-10-2010 / 14:57:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
changeMenuApplySelection
self selectionDo:[:change|self changeMenuApplyChange:change].
"Created: / 29-10-2010 / 13:53:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 29-10-2010 / 14:55:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
changeMenuBrowse
"automatically generated by UIEditor ..."
"*** the code below performs no action"
"*** (except for some feedback on the Transcript)"
"*** Please change as required and accept in the browser."
"*** (and replace this comment by something more useful ;-)"
"action to be added ..."
Transcript showCR:self class name, ': action for #changeMenuBrowse ...'.
!
changeMenuDeleteSelection
self selectionDo:[:chg|chg removed: true]
"Modified: / 29-10-2010 / 13:53:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
changeMenuInspect
| changes |
changes := OrderedCollection new: 1.
self selectionDo:[:chg|changes add: chg].
changes size = 1
ifTrue:[changes anyOne inspect]
ifFalse:[changes inspect].
"Created: / 29-10-2010 / 14:16:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
changeMenuInspect:aValueHolder
aValueHolder value size = 1
ifTrue:[aValueHolder value anyOne inspect]
ifFalse:[aValueHolder value inspect]
!
changeMenuInspectChangeset
self changesetHolder value inspect.
!
changeMenuSelectAdditions
self changeMenuSelectAllSuchThat:[:change|change delta = #+]
"Modified: / 29-10-2010 / 13:16:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
changeMenuSelectAll
self changeMenuSelectAllSuchThat:[:change|true]
"Modified: / 29-10-2010 / 13:17:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
changeMenuSelectAllSuchThat:conditionBlock
| newSelection |
newSelection := OrderedCollection new.
self listDo: [:chg|(conditionBlock value: chg) ifTrue:[newSelection add: chg]].
self selectionHolder value: newSelection.
"Created: / 29-10-2010 / 13:05:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 20-03-2011 / 22:33:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
changeMenuSelectDifferences
self changeMenuSelectAllSuchThat:[:change|change delta = #~]
"Created: / 29-10-2010 / 14:07:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
changeMenuSelectNone
self changesDo:[:chg|chg removed: true].
"Modified: / 29-10-2010 / 14:23:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
changeMenuSelectRemovals
self changeMenuSelectAllSuchThat:[:change|change delta = #-]
"Modified: / 29-10-2010 / 13:18:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
changeMenuSelectSame
self changeMenuSelectAllSuchThat:[:change|change delta = #=]
"Modified: / 29-10-2010 / 13:18:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
changeMenuSelectUsingBlock
|conditionBlockString conditionBlock dialog textHolder template|
template :=
'[:change|
"/ Define condition for selection below:
"/ change is an instance of Change
"/ change will be selected if and only if block returns true
true"/always select the change
]
'.
LastSelectionConditionString isNil ifTrue:[
LastSelectionConditionString := template.
].
textHolder := ValueHolder new.
dialog := Dialog
forRequestText:(resources string:'Enter condition for selection')
lines:20
columns:70
initialAnswer:LastSelectionConditionString
model:textHolder.
dialog addButton:(Button label:'Template' action:[textHolder value:template. textHolder changed:#value.]).
dialog open.
dialog accepted ifFalse:[^ self].
conditionBlockString := textHolder value.
LastSelectionConditionString := conditionBlockString.
conditionBlock := Parser evaluate:conditionBlockString.
conditionBlock isBlock ifFalse:[
self error:'Bad selection block (syntax error?)'.
^ self
].
self changeMenuSelectAllSuchThat: conditionBlock
"Modified: / 29-10-2010 / 13:05:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
changeMenuUndeleteSelection
self selectionDo:[:chg|chg removed: false]
"Modified: / 29-10-2010 / 13:53:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!ChangeSetBrowser2 methodsFor:'private'!
addChangeListView: aView
changeListViews ifNil:[changeListViews := Set new].
changeListViews add: aView
"Created: / 16-03-2011 / 22:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
changesDo: aBlock
self navigatorChangesetHolder value do:[:chg|chg do: aBlock].
self redrawChangeListViews
"Created: / 29-10-2010 / 13:46:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 16-03-2011 / 22:43:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
getNavigatorChangeSet
| changeset |
changeset := changesetHolder value deepCopy.
(changeset isKindOf: ChangeSet) ifFalse:
[changeset := ChangeSet withAll: changeset].
(self navigatorSpecHolder value ~= #oneColumnNavigatorSpec)
ifTrue:[^changeset groupByClass].
"Default"
^changeset
"Created: / 24-10-2009 / 19:31:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 20-07-2010 / 09:46:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
redrawChangeListViews
changeListViews ifNil:[^self].
changeListViews do:[:v|
v allSubViewsDo:
[:sv|sv redraw]
]
"Created: / 16-03-2011 / 22:41:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
selectionDo: aBlock
| applyBlock |
applyBlock := [:e|aBlock value: e change].
selectionHolder value isNilOrEmptyCollection ifTrue:[
(self navigatorChangesetHolder value ? #()) do: aBlock
] ifFalse:[
selection1Holder value isNilOrEmptyCollection not
ifTrue:[selection1Holder value do: applyBlock]
ifFalse:[selectionHolder value do: applyBlock].
].
self redrawChangeListViews
"Created: / 29-10-2010 / 13:47:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 08-04-2011 / 10:15:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
showSource: aBoolean
| panel |
"Not yet implemented"
^self.
sourceView ifNil:[^self].
panel := builder componentAt: #VerticalPanel.
aBoolean ifTrue:[
(panel subViews includes: sourceView) ifTrue:[^self].
panel addSubView: sourceView.
] ifFalse:[
(panel subViews includes: sourceView) ifFalse:[^self].
panel removeSubView: sourceView.
sourceView setId: nil.
]
"Created: / 11-07-2011 / 16:06:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!ChangeSetBrowser2 methodsFor:'private-enumerating'!
listDo: aBlock
self listHolder value ? #() do: aBlock
"Created: / 20-03-2011 / 22:20:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!ChangeSetBrowser2 methodsFor:'queries'!
canApplyChanges
^true
"Created: / 29-10-2010 / 13:07:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
canDrop: somethign
self halt.
"Created: / 20-03-2011 / 21:34:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
hasChangeSelectedAndNotRemoved
self selectionDo:[:e|e removed not ifTrue:[^true]].
^false
"Created: / 18-03-2011 / 08:01:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
hasSingleChangeSelectedAndCanBrowse
^false
"Created: / 18-03-2011 / 08:02:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!ChangeSetBrowser2 class methodsFor:'documentation'!
version_CVS
^ '$Header: /cvs/stx/stx/libtool/Tools__ChangeSetBrowser2.st,v 1.6 2011-07-20 21:08:39 vrany Exp $'
!
version_SVN
^ '§Id: Tools__ChangeSetBrowser.st 7486 2009-10-26 22:06:24Z vranyj1 §'
! !