-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganize context menus and button row
Closes #37.
- Loading branch information
Showing
14 changed files
with
174 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
src/GitS-Core.package/GSBrowser.class/instance/actionManageRemotes.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
actions | ||
actionManageRemotes | ||
GSRemotesBrowser openOnWorkingCopy: self activeWorkingCopy. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
src/GitS-Core.package/GSBrowser.class/instance/buildFetchAllButton..st
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
src/GitS-Core.package/GSBrowser.class/instance/commitListMenu..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
menu | ||
commitListMenu: aMenu | ||
self activeCommit ifNotNil: [:commit | | ||
aMenu addTitle: ('Commit {1}' format: {commit showOneLine printString})]. | ||
^ self menu: aMenu forCommit: self activeCommit |
190 changes: 132 additions & 58 deletions
190
src/GitS-Core.package/GSBrowser.class/instance/menu.forCommit.ref..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,142 @@ | ||
menu | ||
menu: aMenu forCommit: aCommit ref: aStringOrNil | ||
| branch isRef refOrCommit | | ||
aCommit ifNil: [^ aMenu]. | ||
isRef := aStringOrNil notNil. | ||
refOrCommit := isRef ifTrue: [aStringOrNil] ifFalse: [aCommit]. | ||
aMenu | ||
target: self; | ||
|
||
add: 'Create a branch at it' | ||
selector: (isRef ifTrue: [#actionCreateBranchAtRef:] ifFalse: [#actionCreateBranchAtCommit:]) | ||
argument: refOrCommit; | ||
|
||
add: 'Create a branch at it and switch to it' | ||
selector: (isRef | ||
ifTrue: [#actionCreateBranchAtRefAndSwitchToIt:] | ||
ifFalse: [#actionCreateBranchAtCommitAndSwitchToIt:]) | ||
argument: refOrCommit; | ||
|
||
add: 'Create an external branch at it' | ||
selector: (isRef ifTrue: [#actionCreateGitBranchAtRef:] ifFalse: [#actionCreateGitBranchAtCommit:]) | ||
argument: refOrCommit; | ||
balloonTextForLastItem: 'The created branch will be visible from external git tools, like the git command line'; | ||
|
||
addLine; | ||
|
||
add: 'Switch to it (detach HEAD)' | ||
selector: #actionSwitchToCommit: | ||
argument: aCommit; | ||
menu: aMenu forCommit: aCommit ref: refString | ||
| isRef isRefMenu isBranch refOrCommit refTypeName refShortName currentBranch currentBranchShortName | | ||
isRef := refString notNil. | ||
isRefMenu := isRef or: [aCommit isNil]. | ||
isBranch := isRef and: [self activeWorkingCopy isSqueakBranchRef: refString]. | ||
refOrCommit := isRef ifTrue: [refString] ifFalse: [aCommit]. | ||
refTypeName := self refTypeName: refString. | ||
refShortName := isRef ifTrue: [(GitReference shortName: refString) printString] ifFalse: [nil]. | ||
currentBranch := self activeWorkingCopy currentSymbolicHeadTarget. | ||
currentBranchShortName := currentBranch ifNotNil: [(GitReference shortName: currentBranch) printString]. | ||
|
||
aMenu target: self. | ||
|
||
refOrCommit ifNotNil: [ | ||
aMenu addTitle: ('{1} {2}' format: { | ||
refTypeName capitalized. | ||
isRef | ||
ifTrue: [refShortName] | ||
ifFalse: [aCommit showOneLine printStringLimitedTo: 30]})]. | ||
|
||
isRef ifTrue: [ | ||
aMenu | ||
add: ('Switch to {1}' format: {isBranch ifTrue: ['it'] ifFalse: ['a new branch at it']}) | ||
selector: (isBranch ifTrue: [#actionSwitchToBranch:] ifFalse: [#actionCreateBranchAtRefAndSwitchToIt:]) | ||
argument: refString; | ||
|
||
add: 'Delete it' | ||
selector: #actionDeleteRef: | ||
argument: refString]. | ||
|
||
aCommit ifNotNil: [ | ||
aMenu | ||
add: 'Create a branch at it' | ||
selector: (isRef ifTrue: [#actionCreateBranchAtRef:] ifFalse: [#actionCreateBranchAtCommit:]) | ||
argument: refOrCommit. | ||
|
||
add: 'Restore it' | ||
selector: #actionMaterializeCommit: | ||
argument: aCommit; | ||
isRef ifFalse: [ | ||
aMenu | ||
add: 'Create a branch at it and switch' | ||
selector: #actionCreateBranchAtCommitAndSwitchToIt: | ||
argument: aCommit]. | ||
|
||
add: 'Merge it' | ||
selector: (isRef ifTrue: [#actionMergeRef:] ifFalse: [#actionMergeCommit:]) | ||
argument: refOrCommit. | ||
|
||
branch := self activeWorkingCopy currentSymbolicHeadTarget. | ||
branch ifNotNil: [ | ||
| branchShortName resetLabel | | ||
branchShortName := (GitReference shortName: branch) printString. | ||
resetLabel := 'Reset branch {1} to it' format: {branchShortName}. | ||
aMenu | ||
add: resetLabel | ||
selector: #actionResetToCommit: | ||
argument: aCommit; | ||
addLine; | ||
|
||
add: resetLabel, ' and restore it' | ||
selector: #actionResetToCommitAndRestoreIt: | ||
add: 'Load it' | ||
selector: #actionMaterializeCommit: | ||
argument: aCommit; | ||
|
||
add: ('Rebase branch {1} onto it' format: {branchShortName}) | ||
selector: #actionRebaseOntoCommit: | ||
argument: aCommit]. | ||
add: ('Merge it into {1}' format: {currentBranch ifNotNil: ['branch {1}' format: {currentBranchShortName}] ifNil: ['HEAD']}) | ||
selector: (isRef ifTrue: [#actionMergeRef:] ifFalse: [#actionMergeCommit:]) | ||
argument: refOrCommit; | ||
|
||
add: 'Compare it to' | ||
subMenu: (MenuMorph new in: [:subMenu | | ||
subMenu | ||
target: self; | ||
|
||
add: 'its parent commit' | ||
selector: #actionCompareCommitToParent: | ||
argument: aCommit; | ||
|
||
add: 'the image' | ||
selector: #actionCompareCommitToImage: | ||
argument: aCommit; | ||
|
||
yourself])]. | ||
|
||
isRefMenu ifTrue: [ | ||
aMenu | ||
add: 'Remotes' | ||
subMenu: (MenuMorph new in: [:subMenu | | ||
subMenu | ||
target: self; | ||
|
||
add: 'Manage' | ||
action: #actionManageRemotes; | ||
|
||
add: 'Fetch all' | ||
action: #actionFetchAll; | ||
|
||
yourself])]. | ||
|
||
aMenu | ||
addLine; | ||
|
||
add: 'Compare it to its parent commit' | ||
selector: #actionCompareCommitToParent: | ||
argument: aCommit; | ||
|
||
add: 'Compare it to the image' | ||
selector: #actionCompareCommitToImage: | ||
argument: aCommit. | ||
|
||
add: 'Advanced' | ||
subMenu: (MenuMorph new in: [:subMenu | | ||
subMenu target: self. | ||
aCommit ifNotNil: [ | ||
subMenu | ||
add: 'Create an external branch at it' | ||
selector: (isRef ifTrue: [#actionCreateGitBranchAtRef:] ifFalse: [#actionCreateGitBranchAtCommit:]) | ||
argument: refOrCommit; | ||
balloonTextForLastItem: 'The created branch will be visible from external git tools, like the git command line'; | ||
|
||
add: ('Switch to {1} (detach HEAD)' format: {isRef ifTrue: ['its latest commit'] ifFalse: ['it']}) | ||
selector: #actionSwitchToCommit: | ||
argument: aCommit. | ||
|
||
currentBranch ifNotNil: [ | ||
| resetLabel | | ||
resetLabel := 'Reset branch {1} to it' format: {currentBranchShortName}. | ||
subMenu | ||
addLine; | ||
|
||
add: resetLabel | ||
selector: #actionResetToCommit: | ||
argument: aCommit; | ||
|
||
add: resetLabel, ' and load' | ||
selector: #actionResetToCommitAndRestoreIt: | ||
argument: aCommit; | ||
|
||
add: ('Rebase branch {1} onto it' format: {currentBranchShortName}) | ||
selector: #actionRebaseOntoCommit: | ||
argument: aCommit]]. | ||
|
||
isBranch ifTrue: [ | ||
subMenu | ||
addLine; | ||
|
||
add: 'Set its remote branch' | ||
selector: #actionSetUpstreamOfBranch: | ||
argument: refString; | ||
|
||
add: 'Unset its remote branch' | ||
selector: #actionUnsetUpstreamOfBranch: | ||
argument: refString]. | ||
|
||
isRefMenu ifTrue: [ | ||
subMenu | ||
addLine; | ||
|
||
add: 'Refresh refs' | ||
action: #actionRefreshRefList; | ||
|
||
add: (self showGitRefs ifTrue: ['<yes>'] ifFalse: ['<no>']), 'Show git refs' | ||
action: #toggleShowGitRefs]. | ||
|
||
subMenu]). | ||
|
||
^ aMenu |
32 changes: 3 additions & 29 deletions
32
src/GitS-Core.package/GSBrowser.class/instance/menu.forRef..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,6 @@ | ||
menu | ||
menu: aMenu forRef: aString | ||
| isBranch refTypeName | | ||
aMenu target: self. | ||
isBranch := self activeWorkingCopy isSqueakBranchRef: aString. | ||
refTypeName := self refTypeName: aString. | ||
aMenu addTitle: ('{1} {2}' format: {refTypeName capitalized. (GitReference shortName: self activeRef) printString}). | ||
isBranch ifTrue: [ | ||
aMenu | ||
add: 'Switch to it' | ||
selector: #actionSwitchToBranch: | ||
argument: aString]. | ||
aMenu | ||
add: 'Delete it' | ||
selector: #actionDeleteRef: | ||
argument: aString; | ||
addLine. | ||
self | ||
^ self | ||
menu: aMenu | ||
forCommit: (self unitOfWork objectReferenced: aString) | ||
ref: aString. | ||
isBranch ifTrue: [ | ||
aMenu | ||
addLine; | ||
|
||
add: 'Set its remote branch' | ||
selector: #actionSetUpstreamOfBranch: | ||
argument: aString; | ||
|
||
add: 'Unset its remote branch' | ||
selector: #actionUnsetUpstreamOfBranch: | ||
argument: aString] | ||
forCommit: (aString ifNotNil: [self unitOfWork objectReferenced: aString]) | ||
ref: aString |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 21 additions & 15 deletions
36
src/GitS-Core.package/GSBrowser.class/instance/projectListMenu..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,26 @@ | ||
menu | ||
projectListMenu: aMenu | ||
self activeWorkingCopy ifNotNil: [ | ||
aMenu target: self. | ||
self activeWorkingCopy ifNotNil: [:workingCopy | | ||
aMenu | ||
target: self; | ||
add: 'Rename this project' action: #actionRenameActiveProject; | ||
add: 'Choose new repository location' action: #actionChooseNewRepositoryLocationForActiveProject; | ||
add: 'Remove this project' action: #actionRemoveActiveProject; | ||
add: 'Manage remotes' | ||
target: GSRemotesBrowser | ||
selector: #openOnWorkingCopy: | ||
argument: self activeWorkingCopy; | ||
add: 'Export this project to a .sar' action: #actionExportActiveProjectToSar]. | ||
self addMappersProjectListMenu: aMenu. | ||
aMenu items ifNotEmpty: [aMenu addLine]. | ||
title: ('Project {1}' format: {workingCopy name printString}); | ||
add: 'Organize it' | ||
subMenu: (MenuMorph new in: [:subMenu | | ||
subMenu | ||
target: self; | ||
add: 'Rename it' action: #actionRenameActiveProject; | ||
add: 'Remove it' action: #actionRemoveActiveProject; | ||
add: 'Choose new repository location' action: #actionChooseNewRepositoryLocationForActiveProject; | ||
yourself]). | ||
self addMappersProjectListMenu: aMenu. | ||
aMenu add: 'Export it to a .sar' action: #actionExportActiveProjectToSar]. | ||
aMenu | ||
target: self; | ||
add: 'New project' action: #actionNewProject; | ||
add: 'Clone project' action: #actionCloneProject. | ||
addLine; | ||
add: 'New project' | ||
subMenu: (MenuMorph new in: [:subMenu | | ||
subMenu | ||
target: self; | ||
add: 'Clone' action: #actionCloneProject; | ||
add: 'From disk' action: #actionNewProject; | ||
yourself]). | ||
^ aMenu |
13 changes: 1 addition & 12 deletions
13
src/GitS-Core.package/GSBrowser.class/instance/refListMenu..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,3 @@ | ||
menu | ||
refListMenu: aMenu | ||
self activeRef ifNotNil: [self menu: aMenu forRef: self activeRef]. | ||
aMenu | ||
target: self; | ||
addLine; | ||
|
||
add: 'Refresh refs' | ||
action: #actionRefreshRefList; | ||
|
||
add: (self showGitRefs ifTrue: ['<yes>'] ifFalse: ['<no>']), 'Show git refs' | ||
action: #toggleShowGitRefs. | ||
|
||
^ aMenu | ||
^ self menu: aMenu forRef: self activeRef |
Oops, something went wrong.