mercurial/HGCommitDialog.st
changeset 151 527a1e85aef8
parent 146 1015b8f6dc1c
child 152 9068fe7a5795
--- a/mercurial/HGCommitDialog.st	Sun Dec 09 23:27:08 2012 +0000
+++ b/mercurial/HGCommitDialog.st	Mon Dec 10 02:49:43 2012 +0000
@@ -1,7 +1,7 @@
 "{ Package: 'stx:libscm/mercurial' }"
 
 SCMAbstractCommitDialog subclass:#HGCommitDialog
-	instanceVariableNames:''
+	instanceVariableNames:'remoteHolder remoteListHolder remotePushHolder'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'SCM-Mercurial-StX-Interface'
@@ -19,6 +19,149 @@
 
 !HGCommitDialog class methodsFor:'interface specs'!
 
+contentSpec
+    "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:HGCommitDialog andSelector:#contentSpec
+     HGCommitDialog new openInterface:#contentSpec
+    "
+
+    <resource: #canvas>
+
+    ^ 
+     #(FullSpec
+        name: contentSpec
+        window: 
+       (WindowSpec
+          label: 'Commit...'
+          name: 'Commit...'
+          min: (Point 10 10)
+          bounds: (Rectangle 0 0 698 603)
+        )
+        component: 
+       (SpecCollection
+          collection: (
+           (VariableVerticalPanelSpec
+              name: 'VariablePanel'
+              layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+              component: 
+             (SpecCollection
+                collection: (
+                 (VerticalPanelViewSpec
+                    name: 'VerticalPanel1'
+                    horizontalLayout: fit
+                    verticalLayout: bottomSpaceFit
+                    horizontalSpace: 3
+                    verticalSpace: 3
+                    elementsChangeSize: true
+                    component: 
+                   (SpecCollection
+                      collection: (
+                       (ViewSpec
+                          name: 'MessageAndInfoPane'
+                          component: 
+                         (SpecCollection
+                            collection: (
+                             (SubCanvasSpec
+                                name: 'InfoPanel'
+                                layout: (LayoutFrame 0 0 0 0 0 1 40 0)
+                                level: 0
+                                initiallyInvisible: true
+                                hasHorizontalScrollBar: false
+                                hasVerticalScrollBar: false
+                                clientKey: infoPanel
+                                createNewBuilder: false
+                              )
+                             (ViewSpec
+                                name: 'MessagePane'
+                                layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+                                component: 
+                               (SpecCollection
+                                  collection: (
+                                   (LabelSpec
+                                      label: 'Commit message:'
+                                      name: 'MessageLabel'
+                                      layout: (LayoutFrame 0 0 0 0 0 1 25 0)
+                                      translateLabel: true
+                                      adjust: left
+                                    )
+                                   (TextEditorSpec
+                                      name: 'Message'
+                                      layout: (LayoutFrame 0 0 30 0 0 1 0 1)
+                                      enableChannel: enabledHolder
+                                      hasHorizontalScrollBar: true
+                                      hasVerticalScrollBar: true
+                                      modifiedChannel: messageModifiedHolder
+                                      hasKeyboardFocusInitially: false
+                                      postBuildCallback: messageView:
+                                    )
+                                   )
+                                 
+                                )
+                              )
+                             )
+                           
+                          )
+                          extent: (Point 698 267)
+                        )
+                       (ViewSpec
+                          name: 'PushCheckbox'
+                          component: 
+                         (SpecCollection
+                            collection: (
+                             (ComboListSpec
+                                name: 'ComboList1'
+                                layout: (LayoutFrame 250 0 0 0 0 1 0 1)
+                                visibilityChannel: remotePushHolder
+                                model: remoteHolder
+                                comboList: remoteListHolder
+                              )
+                             (CheckBoxSpec
+                                label: 'Push to upstream repository'
+                                name: 'UpstreamRepositoryCheckBox'
+                                layout: (LayoutFrame 0 0 2 0 250 0 25 0)
+                                model: remotePushHolder
+                                translateLabel: true
+                              )
+                             )
+                           
+                          )
+                          extent: (Point 698 25)
+                        )
+                       )
+                     
+                    )
+                  )
+                 (ViewSpec
+                    name: 'FilePane'
+                    component: 
+                   (SpecCollection
+                      collection: (
+                       (UISubSpecification
+                          name: 'FilePaneSpec'
+                          layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+                          minorKey: filePaneSpec
+                        )
+                       )
+                     
+                    )
+                  )
+                 )
+               
+              )
+              handles: (Any 0.5 1.0)
+            )
+           )
+         
+        )
+      )
+!
+
 fileListColumnSpec
     "This resource specification was automatically generated
      by the DataSetBuilder of ST/X."
@@ -119,6 +262,26 @@
 
 !HGCommitDialog methodsFor:'actions'!
 
+doAccept
+    self remotePushHolder value ifTrue:[
+        self task remote: self remoteHolder
+    ] ifFalse:[
+        self task remote: nil.
+    ].
+    [
+        super doAccept.
+    ] on: HGPushWouldCreateNewHeadError do:[:ex|
+        self infoPanel 
+                reset;
+                beWarning;
+                message: (self resources string:'Push to upstream would create a new head. Changes were not pushed.');
+                addButtonOK;
+                show.
+    ]
+
+    "Created: / 10-12-2012 / 01:46:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 doEditUserConfig
     | hgrc |
 
@@ -186,6 +349,68 @@
     "Modified: / 06-12-2012 / 17:04:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!HGCommitDialog methodsFor:'aspects'!
+
+remoteHolder
+    <resource: #uiAspect>
+
+    "automatically generated by UIPainter ..."
+
+    "*** the code below creates a default model when invoked."
+    "*** (which may not be the one you wanted)"
+    "*** Please change as required and accept it in the browser."
+    "*** (and replace this comment by something more useful ;-)"
+
+    remoteHolder isNil ifTrue:[
+        remoteHolder := self task package repository remoteDefault asValue
+
+    ].
+    ^ remoteHolder.
+
+    "Modified: / 10-12-2012 / 01:28:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+remoteListHolder
+    <resource: #uiAspect>
+
+    "automatically generated by UIPainter ..."
+
+    "*** the code below creates a default model when invoked."
+    "*** (which may not be the one you wanted)"
+    "*** Please change as required and accept it in the browser."
+    "*** (and replace this comment by something more useful ;-)"
+
+    remoteListHolder isNil ifTrue:[
+        remoteListHolder := self task package repository remotes asValue
+"/ if your app needs to be notified of changes, uncomment one of the lines below:
+"/       remoteListHolder addDependent:self.
+"/       remoteListHolder onChangeSend:#remoteListHolderChanged to:self.
+    ].
+    ^ remoteListHolder.
+
+    "Modified: / 10-12-2012 / 01:28:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+remotePushHolder
+    <resource: #uiAspect>
+    "automatically generated by UIPainter ..."
+    "*** the code below creates a default model when invoked."
+    "*** (which may not be the one you wanted)"
+    "*** Please change as required and accept it in the browser."
+    "*** (and replace this comment by something more useful ;-)"
+    
+    remotePushHolder isNil ifTrue:[
+        remotePushHolder := UserPreferences current hgAutopush asValue.
+        
+"/ if your app needs to be notified of changes, uncomment one of the lines below:
+"/       pushHolder addDependent:self.
+"/       pushHolder onChangeSend:#pushHolderChanged to:self.
+    ].
+    ^ remotePushHolder.
+
+    "Modified: / 10-12-2012 / 01:25:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !HGCommitDialog methodsFor:'change & update'!
 
 updateFileList